diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-07-09 23:55:46 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-10 00:38:50 +0300 |
commit | 955bcb6ea0df0d9ace89ac475405f1295ced5962 (patch) | |
tree | 87f4ec27a73d992423c2c7388100cace5ed6eeb7 /net/core | |
parent | 59094b1e5094c7e50a3d2912202fd30b6a1dadf8 (diff) | |
download | linux-955bcb6ea0df0d9ace89ac475405f1295ced5962.tar.xz |
drivers: net: use flow block API
This patch updates flow_block_cb_setup_simple() to use the flow block API.
Several drivers are also adjusted to use it.
This patch introduces the per-driver list of flow blocks to account for
blocks that are already in use.
Remove tc_block_offload alias.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/flow_offload.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c index a36a9dc1c6df..a1b36b47dd89 100644 --- a/net/core/flow_offload.c +++ b/net/core/flow_offload.c @@ -2,7 +2,6 @@ #include <linux/kernel.h> #include <linux/slab.h> #include <net/flow_offload.h> -#include <net/pkt_cls.h> struct flow_rule *flow_rule_alloc(unsigned int num_actions) { @@ -234,6 +233,8 @@ int flow_block_cb_setup_simple(struct flow_block_offload *f, tc_setup_cb_t *cb, void *cb_ident, void *cb_priv, bool ingress_only) { + struct flow_block_cb *block_cb; + if (ingress_only && f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS) return -EOPNOTSUPP; @@ -242,10 +243,21 @@ int flow_block_cb_setup_simple(struct flow_block_offload *f, switch (f->command) { case FLOW_BLOCK_BIND: - return tcf_block_cb_register(f->block, cb, cb_ident, cb_priv, - f->extack); + block_cb = flow_block_cb_alloc(f->net, cb, cb_ident, + cb_priv, NULL); + if (IS_ERR(block_cb)) + return PTR_ERR(block_cb); + + flow_block_cb_add(block_cb, f); + list_add_tail(&block_cb->driver_list, driver_block_list); + return 0; case FLOW_BLOCK_UNBIND: - tcf_block_cb_unregister(f->block, cb, cb_ident); + block_cb = flow_block_cb_lookup(f, cb, cb_ident); + if (!block_cb) + return -ENOENT; + + flow_block_cb_remove(block_cb, f); + list_del(&block_cb->driver_list); return 0; default: return -EOPNOTSUPP; |