2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-01 14:55:18 +00:00

netdev-afxdp: Postpone libbpf logging helper registration.

When using net/af_xdp DPDK driver along OVS native AF_XDP support,
confusing logs are reported, like:

netdev_dpdk|INFO|Device 'net_af_xdpp0,iface=ovs-p0' attached to DPDK
dpif_netdev|INFO|PMD thread on numa_id: 0, core id: 11 created.
dpif_netdev|INFO|There are 1 pmd threads on numa node 0
dpdk|INFO|Device with port_id=0 already stopped
dpdk(pmd-c11/id:22)|INFO|PMD thread uses DPDK lcore 1.
netdev_dpdk|WARN|Rx checksum offload is not supported on port 0
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(6)
	.xdp_run_config
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(7)
	xdp_metadata
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(7)
	xdp_metadata
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(7)
	xdp_metadata

This comes from the fact that netdev-afxdp unconditionnally registers a
helper for logging libbpf messages.
Making both net/af_xdp and netdev-afxdp work at the same time seems
difficult, so at least, ensure that netdev-afxdp won't register this
helper unless a netdev is actually allocated.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
This commit is contained in:
David Marchand
2023-11-20 16:56:44 +01:00
committed by Simon Horman
parent 818217eafe
commit b561bbdc27
3 changed files with 6 additions and 8 deletions

View File

@@ -1193,18 +1193,18 @@ libbpf_print(enum libbpf_print_level level,
return 0; return 0;
} }
int netdev_afxdp_init(void)
{
libbpf_set_print(libbpf_print);
return 0;
}
int int
netdev_afxdp_construct(struct netdev *netdev) netdev_afxdp_construct(struct netdev *netdev)
{ {
static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
struct netdev_linux *dev = netdev_linux_cast(netdev); struct netdev_linux *dev = netdev_linux_cast(netdev);
int ret; int ret;
if (ovsthread_once_start(&once)) {
libbpf_set_print(libbpf_print);
ovsthread_once_done(&once);
}
/* Configure common netdev-linux first. */ /* Configure common netdev-linux first. */
ret = netdev_linux_construct(netdev); ret = netdev_linux_construct(netdev);
if (ret) { if (ret) {

View File

@@ -47,7 +47,6 @@ struct xsk_socket_info;
int netdev_afxdp_rxq_construct(struct netdev_rxq *rxq_); int netdev_afxdp_rxq_construct(struct netdev_rxq *rxq_);
void netdev_afxdp_rxq_destruct(struct netdev_rxq *rxq_); void netdev_afxdp_rxq_destruct(struct netdev_rxq *rxq_);
int netdev_afxdp_init(void);
int netdev_afxdp_construct(struct netdev *netdev_); int netdev_afxdp_construct(struct netdev *netdev_);
void netdev_afxdp_destruct(struct netdev *netdev_); void netdev_afxdp_destruct(struct netdev *netdev_);
int netdev_afxdp_verify_mtu_size(const struct netdev *netdev, int mtu); int netdev_afxdp_verify_mtu_size(const struct netdev *netdev, int mtu);

View File

@@ -3754,7 +3754,6 @@ const struct netdev_class netdev_internal_class = {
#ifdef HAVE_AF_XDP #ifdef HAVE_AF_XDP
#define NETDEV_AFXDP_CLASS_COMMON \ #define NETDEV_AFXDP_CLASS_COMMON \
.init = netdev_afxdp_init, \
.construct = netdev_afxdp_construct, \ .construct = netdev_afxdp_construct, \
.destruct = netdev_afxdp_destruct, \ .destruct = netdev_afxdp_destruct, \
.get_stats = netdev_afxdp_get_stats, \ .get_stats = netdev_afxdp_get_stats, \