Commit 631f65ff authored by Quentin Monnet's avatar Quentin Monnet Committed by David S. Miller

net: sched: cls_bpf: plumb extack support in filter for hardware offload

Pass the extack pointer obtained in the `->change()` filter operation to
cls_bpf_offload() and then to cls_bpf_offload_cmd(). This makes it
possible to use this extack pointer in drivers offloading BPF programs
in a future patch.
Signed-off-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 10a47e0f
...@@ -147,7 +147,8 @@ static bool cls_bpf_is_ebpf(const struct cls_bpf_prog *prog) ...@@ -147,7 +147,8 @@ static bool cls_bpf_is_ebpf(const struct cls_bpf_prog *prog)
} }
static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog, static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
struct cls_bpf_prog *oldprog) struct cls_bpf_prog *oldprog,
struct netlink_ext_ack *extack)
{ {
struct tcf_block *block = tp->chain->block; struct tcf_block *block = tp->chain->block;
struct tc_cls_bpf_offload cls_bpf = {}; struct tc_cls_bpf_offload cls_bpf = {};
...@@ -173,7 +174,7 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog, ...@@ -173,7 +174,7 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSBPF, &cls_bpf, skip_sw); err = tc_setup_cb_call(block, NULL, TC_SETUP_CLSBPF, &cls_bpf, skip_sw);
if (prog) { if (prog) {
if (err < 0) { if (err < 0) {
cls_bpf_offload_cmd(tp, oldprog, prog); cls_bpf_offload_cmd(tp, oldprog, prog, extack);
return err; return err;
} else if (err > 0) { } else if (err > 0) {
tcf_block_offload_inc(block, &prog->gen_flags); tcf_block_offload_inc(block, &prog->gen_flags);
...@@ -192,7 +193,8 @@ static u32 cls_bpf_flags(u32 flags) ...@@ -192,7 +193,8 @@ static u32 cls_bpf_flags(u32 flags)
} }
static int cls_bpf_offload(struct tcf_proto *tp, struct cls_bpf_prog *prog, static int cls_bpf_offload(struct tcf_proto *tp, struct cls_bpf_prog *prog,
struct cls_bpf_prog *oldprog) struct cls_bpf_prog *oldprog,
struct netlink_ext_ack *extack)
{ {
if (prog && oldprog && if (prog && oldprog &&
cls_bpf_flags(prog->gen_flags) != cls_bpf_flags(prog->gen_flags) !=
...@@ -206,7 +208,7 @@ static int cls_bpf_offload(struct tcf_proto *tp, struct cls_bpf_prog *prog, ...@@ -206,7 +208,7 @@ static int cls_bpf_offload(struct tcf_proto *tp, struct cls_bpf_prog *prog,
if (!prog && !oldprog) if (!prog && !oldprog)
return 0; return 0;
return cls_bpf_offload_cmd(tp, prog, oldprog); return cls_bpf_offload_cmd(tp, prog, oldprog, extack);
} }
static void cls_bpf_stop_offload(struct tcf_proto *tp, static void cls_bpf_stop_offload(struct tcf_proto *tp,
...@@ -214,7 +216,7 @@ static void cls_bpf_stop_offload(struct tcf_proto *tp, ...@@ -214,7 +216,7 @@ static void cls_bpf_stop_offload(struct tcf_proto *tp,
{ {
int err; int err;
err = cls_bpf_offload_cmd(tp, NULL, prog); err = cls_bpf_offload_cmd(tp, NULL, prog, NULL);
if (err) if (err)
pr_err("Stopping hardware offload failed: %d\n", err); pr_err("Stopping hardware offload failed: %d\n", err);
} }
...@@ -514,7 +516,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, ...@@ -514,7 +516,7 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
if (ret < 0) if (ret < 0)
goto errout_idr; goto errout_idr;
ret = cls_bpf_offload(tp, prog, oldprog); ret = cls_bpf_offload(tp, prog, oldprog, extack);
if (ret) if (ret)
goto errout_parms; goto errout_parms;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment