diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-07-09 16:55:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-09 17:38:50 -0400 |
commit | 955bcb6ea0df0d9ace89ac475405f1295ced5962 (patch) | |
tree | 87f4ec27a73d992423c2c7388100cace5ed6eeb7 /net/dsa | |
parent | 59094b1e5094c7e50a3d2912202fd30b6a1dadf8 (diff) |
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/dsa')
-rw-r--r-- | net/dsa/slave.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 9b5e202c255e..90c32fd680db 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -942,9 +942,12 @@ static int dsa_slave_setup_tc_block_cb_eg(enum tc_setup_type type, | |||
942 | return dsa_slave_setup_tc_block_cb(type, type_data, cb_priv, false); | 942 | return dsa_slave_setup_tc_block_cb(type, type_data, cb_priv, false); |
943 | } | 943 | } |
944 | 944 | ||
945 | static LIST_HEAD(dsa_slave_block_cb_list); | ||
946 | |||
945 | static int dsa_slave_setup_tc_block(struct net_device *dev, | 947 | static int dsa_slave_setup_tc_block(struct net_device *dev, |
946 | struct tc_block_offload *f) | 948 | struct flow_block_offload *f) |
947 | { | 949 | { |
950 | struct flow_block_cb *block_cb; | ||
948 | tc_setup_cb_t *cb; | 951 | tc_setup_cb_t *cb; |
949 | 952 | ||
950 | if (f->binder_type == FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS) | 953 | if (f->binder_type == FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS) |
@@ -954,11 +957,24 @@ static int dsa_slave_setup_tc_block(struct net_device *dev, | |||
954 | else | 957 | else |
955 | return -EOPNOTSUPP; | 958 | return -EOPNOTSUPP; |
956 | 959 | ||
960 | f->driver_block_list = &dsa_slave_block_cb_list; | ||
961 | |||
957 | switch (f->command) { | 962 | switch (f->command) { |
958 | case FLOW_BLOCK_BIND: | 963 | case FLOW_BLOCK_BIND: |
959 | return tcf_block_cb_register(f->block, cb, dev, dev, f->extack); | 964 | block_cb = flow_block_cb_alloc(f->net, cb, dev, dev, NULL); |
965 | if (IS_ERR(block_cb)) | ||
966 | return PTR_ERR(block_cb); | ||
967 | |||
968 | flow_block_cb_add(block_cb, f); | ||
969 | list_add_tail(&block_cb->driver_list, &dsa_slave_block_cb_list); | ||
970 | return 0; | ||
960 | case FLOW_BLOCK_UNBIND: | 971 | case FLOW_BLOCK_UNBIND: |
961 | tcf_block_cb_unregister(f->block, cb, dev); | 972 | block_cb = flow_block_cb_lookup(f, cb, dev); |
973 | if (!block_cb) | ||
974 | return -ENOENT; | ||
975 | |||
976 | flow_block_cb_remove(block_cb, f); | ||
977 | list_del(&block_cb->driver_list); | ||
962 | return 0; | 978 | return 0; |
963 | default: | 979 | default: |
964 | return -EOPNOTSUPP; | 980 | return -EOPNOTSUPP; |