@@ -1195,18 +1195,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) {
@@ -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);
@@ -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, \