net: flow_offload: add list handling functions

This patch adds the list handling functions for the flow block API:

* flow_block_cb_lookup() allows drivers to look up for existing flow blocks.
* flow_block_cb_add() adds a flow block to the per driver list to be registered
  by the core.
* flow_block_cb_remove() to remove a flow block from the list of existing
  flow blocks per driver and to request the core to unregister this.

The flow block API also annotates the netns this flow block belongs to.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Pablo Neira Ayuso 2019-07-09 22:55:43 +02:00 committed by David S. Miller
parent d63db30c85
commit da3eeb904f
3 changed files with 39 additions and 0 deletions

View file

@ -680,6 +680,7 @@ static void tc_indr_block_ing_cmd(struct tc_indr_block_dev *indr_dev,
struct tc_block_offload bo = {
.command = command,
.binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS,
.net = dev_net(indr_dev->dev),
.block = indr_dev->block,
};
@ -768,6 +769,7 @@ static void tc_indr_block_call(struct tcf_block *block, struct net_device *dev,
struct tc_block_offload bo = {
.command = command,
.binder_type = ei->binder_type,
.net = dev_net(dev),
.block = block,
.extack = extack,
};
@ -796,6 +798,7 @@ static int tcf_block_offload_cmd(struct tcf_block *block,
{
struct tc_block_offload bo = {};
bo.net = dev_net(dev);
bo.command = command;
bo.binder_type = ei->binder_type;
bo.block = block;