Commit 6df5490f authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nf_tables_offload: add nft_chain_offload_cmd()

This patch adds the nft_chain_offload_cmd() helper function.
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent ad88b7a6
...@@ -316,6 +316,20 @@ static int nft_indr_block_offload_cmd(struct nft_base_chain *chain, ...@@ -316,6 +316,20 @@ static int nft_indr_block_offload_cmd(struct nft_base_chain *chain,
#define FLOW_SETUP_BLOCK TC_SETUP_BLOCK #define FLOW_SETUP_BLOCK TC_SETUP_BLOCK
static int nft_chain_offload_cmd(struct nft_base_chain *basechain,
struct net_device *dev,
enum flow_block_command cmd)
{
int err;
if (dev->netdev_ops->ndo_setup_tc)
err = nft_block_offload_cmd(basechain, dev, cmd);
else
err = nft_indr_block_offload_cmd(basechain, dev, cmd);
return err;
}
static int nft_flow_block_chain(struct nft_base_chain *basechain, static int nft_flow_block_chain(struct nft_base_chain *basechain,
const struct net_device *this_dev, const struct net_device *this_dev,
enum flow_block_command cmd) enum flow_block_command cmd)
...@@ -329,11 +343,7 @@ static int nft_flow_block_chain(struct nft_base_chain *basechain, ...@@ -329,11 +343,7 @@ static int nft_flow_block_chain(struct nft_base_chain *basechain,
if (this_dev && this_dev != dev) if (this_dev && this_dev != dev)
continue; continue;
if (dev->netdev_ops->ndo_setup_tc) err = nft_chain_offload_cmd(basechain, dev, cmd);
err = nft_block_offload_cmd(basechain, dev, cmd);
else
err = nft_indr_block_offload_cmd(basechain, dev, cmd);
if (err < 0) if (err < 0)
return err; return err;
} }
......
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