提交 acc2abbb 编写于 作者: Q Quentin Monnet 提交者: David S. Miller

nfp: bpf: plumb extack into functions related to XDP offload

Pass a pointer to an extack object to nfp_app_xdp_offload() in order to
prepare for extack usage in the nfp driver. Next step will be to forward
this extack pointer to nfp_net_bpf_offload(), once this function is able
to use it for printing error messages.
Signed-off-by: NQuentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f9eda14f
...@@ -54,7 +54,7 @@ static bool nfp_net_ebpf_capable(struct nfp_net *nn) ...@@ -54,7 +54,7 @@ static bool nfp_net_ebpf_capable(struct nfp_net *nn)
static int static int
nfp_bpf_xdp_offload(struct nfp_app *app, struct nfp_net *nn, nfp_bpf_xdp_offload(struct nfp_app *app, struct nfp_net *nn,
struct bpf_prog *prog) struct bpf_prog *prog, struct netlink_ext_ack *extack)
{ {
bool running, xdp_running; bool running, xdp_running;
int ret; int ret;
...@@ -73,7 +73,7 @@ nfp_bpf_xdp_offload(struct nfp_app *app, struct nfp_net *nn, ...@@ -73,7 +73,7 @@ nfp_bpf_xdp_offload(struct nfp_app *app, struct nfp_net *nn,
ret = nfp_net_bpf_offload(nn, prog, running); ret = nfp_net_bpf_offload(nn, prog, running);
/* Stop offload if replace not possible */ /* Stop offload if replace not possible */
if (ret && prog) if (ret && prog)
nfp_bpf_xdp_offload(app, nn, NULL); nfp_bpf_xdp_offload(app, nn, NULL, extack);
nn->dp.bpf_offload_xdp = prog && !ret; nn->dp.bpf_offload_xdp = prog && !ret;
return ret; return ret;
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
struct bpf_prog; struct bpf_prog;
struct net_device; struct net_device;
struct netdev_bpf; struct netdev_bpf;
struct netlink_ext_ack;
struct pci_dev; struct pci_dev;
struct sk_buff; struct sk_buff;
struct sk_buff; struct sk_buff;
...@@ -138,7 +139,8 @@ struct nfp_app_type { ...@@ -138,7 +139,8 @@ struct nfp_app_type {
int (*bpf)(struct nfp_app *app, struct nfp_net *nn, int (*bpf)(struct nfp_app *app, struct nfp_net *nn,
struct netdev_bpf *xdp); struct netdev_bpf *xdp);
int (*xdp_offload)(struct nfp_app *app, struct nfp_net *nn, int (*xdp_offload)(struct nfp_app *app, struct nfp_net *nn,
struct bpf_prog *prog); struct bpf_prog *prog,
struct netlink_ext_ack *extack);
int (*sriov_enable)(struct nfp_app *app, int num_vfs); int (*sriov_enable)(struct nfp_app *app, int num_vfs);
void (*sriov_disable)(struct nfp_app *app); void (*sriov_disable)(struct nfp_app *app);
...@@ -324,11 +326,12 @@ static inline int nfp_app_bpf(struct nfp_app *app, struct nfp_net *nn, ...@@ -324,11 +326,12 @@ static inline int nfp_app_bpf(struct nfp_app *app, struct nfp_net *nn,
} }
static inline int nfp_app_xdp_offload(struct nfp_app *app, struct nfp_net *nn, static inline int nfp_app_xdp_offload(struct nfp_app *app, struct nfp_net *nn,
struct bpf_prog *prog) struct bpf_prog *prog,
struct netlink_ext_ack *extack)
{ {
if (!app || !app->type->xdp_offload) if (!app || !app->type->xdp_offload)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return app->type->xdp_offload(app, nn, prog); return app->type->xdp_offload(app, nn, prog, extack);
} }
static inline bool __nfp_app_ctrl_tx(struct nfp_app *app, struct sk_buff *skb) static inline bool __nfp_app_ctrl_tx(struct nfp_app *app, struct sk_buff *skb)
......
...@@ -3403,7 +3403,7 @@ nfp_net_xdp_setup(struct nfp_net *nn, struct bpf_prog *prog, u32 flags, ...@@ -3403,7 +3403,7 @@ nfp_net_xdp_setup(struct nfp_net *nn, struct bpf_prog *prog, u32 flags,
if (err) if (err)
return err; return err;
err = nfp_app_xdp_offload(nn->app, nn, offload_prog); err = nfp_app_xdp_offload(nn->app, nn, offload_prog, extack);
if (err && flags & XDP_FLAGS_HW_MODE) if (err && flags & XDP_FLAGS_HW_MODE)
return err; return err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册