From: Björn Töpel <bjorn.topel@xxxxxxxxx> Make all drivers with XDP offloading support use dev_xdp_support_offload(). Signed-off-by: Björn Töpel <bjorn.topel@xxxxxxxxx> --- drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 7 +++++++ drivers/net/netdevsim/netdev.c | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c index 986464d4a206..e320cacc95e6 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c @@ -135,6 +135,13 @@ nfp_net_pf_alloc_vnic(struct nfp_pf *pf, bool needs_netdev, nfp_net_free(nn); return ERR_PTR(err); } + if (nn->app && nn->app->type->xdp_offload) { + err = dev_xdp_support_offload(nn->dp.netdev); + if (err) { + nfp_net_free(nn); + return ERR_PTR(err); + } + } } pf->num_vnics++; diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index e5c8aa08e1cd..26e4fc12cdbe 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -311,6 +311,10 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) SET_NETDEV_DEV(dev, &ns->nsim_bus_dev->dev); dev->netdev_ops = &nsim_netdev_ops; + err = dev_xdp_support_offload(dev); + if (err) + goto err_free_netdev; + rtnl_lock(); err = nsim_bpf_init(ns); if (err) -- 2.20.1