diff options
author | wenxu <wenxu@ucloud.cn> | 2020-02-24 13:22:52 +0800 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2020-03-15 15:22:32 +0100 |
commit | 4679877921cd6fb2545ffecbaa3cdbbb74245aab (patch) | |
tree | e01b3b4b7e92e9dc2eb5412205f79a741aabfce0 /net | |
parent | f628c27d8566dc88a138c7e920c02caef48b96fe (diff) | |
download | linux-4679877921cd6fb2545ffecbaa3cdbbb74245aab.tar.bz2 |
netfilter: flowtable: add nf_flow_table_block_offload_init()
Add nf_flow_table_block_offload_init prepare for the indr block
offload patch
Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_flow_table_offload.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c index 88695ff44e76..c4cb03555315 100644 --- a/net/netfilter/nf_flow_table_offload.c +++ b/net/netfilter/nf_flow_table_offload.c @@ -812,6 +812,21 @@ static int nf_flow_table_block_setup(struct nf_flowtable *flowtable, return err; } +static void nf_flow_table_block_offload_init(struct flow_block_offload *bo, + struct net *net, + enum flow_block_command cmd, + struct nf_flowtable *flowtable, + struct netlink_ext_ack *extack) +{ + memset(bo, 0, sizeof(*bo)); + bo->net = net; + bo->block = &flowtable->flow_block; + bo->command = cmd; + bo->binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS; + bo->extack = extack; + INIT_LIST_HEAD(&bo->cb_list); +} + static int nf_flow_table_offload_cmd(struct flow_block_offload *bo, struct nf_flowtable *flowtable, struct net_device *dev, @@ -823,14 +838,8 @@ static int nf_flow_table_offload_cmd(struct flow_block_offload *bo, if (!dev->netdev_ops->ndo_setup_tc) return -EOPNOTSUPP; - memset(bo, 0, sizeof(*bo)); - bo->net = dev_net(dev); - bo->block = &flowtable->flow_block; - bo->command = cmd; - bo->binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS; - bo->extack = extack; - INIT_LIST_HEAD(&bo->cb_list); - + nf_flow_table_block_offload_init(bo, dev_net(dev), cmd, flowtable, + extack); err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_FT, bo); if (err < 0) return err; |