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.march...@redhat.com> Acked-by: Eelco Chaudron <echau...@redhat.com> --- lib/netdev-afxdp.c | 12 ++++++------ lib/netdev-afxdp.h | 1 - lib/netdev-linux.c | 1 - 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/netdev-afxdp.c b/lib/netdev-afxdp.c index b680a14798..54029722e0 100644 --- a/lib/netdev-afxdp.c +++ b/lib/netdev-afxdp.c @@ -1193,18 +1193,18 @@ libbpf_print(enum libbpf_print_level level, return 0; } -int netdev_afxdp_init(void) -{ - libbpf_set_print(libbpf_print); - return 0; -} - int netdev_afxdp_construct(struct netdev *netdev) { + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; struct netdev_linux *dev = netdev_linux_cast(netdev); int ret; + if (ovsthread_once_start(&once)) { + libbpf_set_print(libbpf_print); + ovsthread_once_done(&once); + } + /* Configure common netdev-linux first. */ ret = netdev_linux_construct(netdev); if (ret) { diff --git a/lib/netdev-afxdp.h b/lib/netdev-afxdp.h index bd3b9dfbea..236a37cc84 100644 --- a/lib/netdev-afxdp.h +++ b/lib/netdev-afxdp.h @@ -47,7 +47,6 @@ struct xsk_socket_info; int netdev_afxdp_rxq_construct(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_); void netdev_afxdp_destruct(struct netdev *netdev_); int netdev_afxdp_verify_mtu_size(const struct netdev *netdev, int mtu); diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 70521e3c7f..18b62d90c2 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -3754,7 +3754,6 @@ const struct netdev_class netdev_internal_class = { #ifdef HAVE_AF_XDP #define NETDEV_AFXDP_CLASS_COMMON \ - .init = netdev_afxdp_init, \ .construct = netdev_afxdp_construct, \ .destruct = netdev_afxdp_destruct, \ .get_stats = netdev_afxdp_get_stats, \ -- 2.41.0 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev