diff options
author | David S. Miller <davem@davemloft.net> | 2017-12-22 11:16:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-22 11:16:31 -0500 |
commit | fba961ab29e5ffb055592442808bb0f7962e05da (patch) | |
tree | 5180c384b79399c469e0ed88211114e6ab249484 /drivers/net/netdevsim | |
parent | 0a80f0c26bf5a131892b91db5318eb67608006d2 (diff) | |
parent | ead68f216110170ec729e2c4dec0aad6d38259d7 (diff) | |
download | linux-fba961ab29e5ffb055592442808bb0f7962e05da.tar.bz2 |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Lots of overlapping changes. Also on the net-next side
the XDP state management is handled more in the generic
layers so undo the 'net' nfp fix which isn't applicable
in net-next.
Include a necessary change by Jakub Kicinski, with log message:
====================
cls_bpf no longer takes care of offload tracking. Make sure
netdevsim performs necessary checks. This fixes a warning
caused by TC trying to remove a filter it has not added.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim')
-rw-r--r-- | drivers/net/netdevsim/bpf.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c index 7da814686ad9..a243fa7ae02f 100644 --- a/drivers/net/netdevsim/bpf.c +++ b/drivers/net/netdevsim/bpf.c @@ -107,6 +107,7 @@ int nsim_bpf_setup_tc_block_cb(enum tc_setup_type type, struct tc_cls_bpf_offload *cls_bpf = type_data; struct bpf_prog *prog = cls_bpf->prog; struct netdevsim *ns = cb_priv; + struct bpf_prog *oldprog; if (type != TC_SETUP_CLSBPF || !tc_can_offload(ns->netdev) || @@ -114,25 +115,27 @@ int nsim_bpf_setup_tc_block_cb(enum tc_setup_type type, cls_bpf->common.chain_index) return -EOPNOTSUPP; - if (nsim_xdp_offload_active(ns)) - return -EBUSY; - if (!ns->bpf_tc_accept) return -EOPNOTSUPP; /* Note: progs without skip_sw will probably not be dev bound */ if (prog && !prog->aux->offload && !ns->bpf_tc_non_bound_accept) return -EOPNOTSUPP; - switch (cls_bpf->command) { - case TC_CLSBPF_REPLACE: - return nsim_bpf_offload(ns, prog, true); - case TC_CLSBPF_ADD: - return nsim_bpf_offload(ns, prog, false); - case TC_CLSBPF_DESTROY: - return nsim_bpf_offload(ns, NULL, true); - default: + if (cls_bpf->command != TC_CLSBPF_OFFLOAD) return -EOPNOTSUPP; + + oldprog = cls_bpf->oldprog; + + /* Don't remove if oldprog doesn't match driver's state */ + if (ns->bpf_offloaded != oldprog) { + oldprog = NULL; + if (!cls_bpf->prog) + return 0; + if (ns->bpf_offloaded) + return -EBUSY; } + + return nsim_bpf_offload(ns, cls_bpf->prog, oldprog); } int nsim_bpf_disable_tc(struct netdevsim *ns) |