[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190610160234.4070-3-bjorn.topel@gmail.com>
Date: Mon, 10 Jun 2019 18:02:31 +0200
From: Björn Töpel <bjorn.topel@...il.com>
To: ast@...nel.org, daniel@...earbox.net, netdev@...r.kernel.org
Cc: Björn Töpel <bjorn.topel@...el.com>,
magnus.karlsson@...el.com, toke@...hat.com, brouer@...hat.com,
bpf@...r.kernel.org, jakub.kicinski@...ronome.com,
saeedm@...lanox.com
Subject: [PATCH bpf-next v3 2/5] nfp, netdevsim: use dev_xdp_support_offload() function
From: Björn Töpel <bjorn.topel@...el.com>
Make all drivers with XDP offloading support use
dev_xdp_support_offload().
Signed-off-by: Björn Töpel <bjorn.topel@...el.com>
---
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
Powered by blists - more mailing lists