summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2019-07-09 22:55:43 +0200
committerDavid S. Miller <davem@davemloft.net>2019-07-09 14:38:50 -0700
commitda3eeb904ff432ec22cf7b4db17a47647428873a (patch)
treebaaf713b85b1eff561b7a155686012807edcc733 /include/net
parentd63db30c8537ba45208c156d71125db73d0fe522 (diff)
downloadlinux-da3eeb904ff432ec22cf7b4db17a47647428873a.tar.bz2
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>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/flow_offload.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index 45d74cb542cd..563d7dc7afc1 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -256,12 +256,16 @@ struct flow_block_offload {
enum flow_block_command command;
enum flow_block_binder_type binder_type;
struct tcf_block *block;
+ struct net *net;
+ struct list_head cb_list;
struct list_head *driver_block_list;
struct netlink_ext_ack *extack;
};
struct flow_block_cb {
+ struct list_head driver_list;
struct list_head list;
+ struct net *net;
tc_setup_cb_t *cb;
void *cb_ident;
void *cb_priv;
@@ -274,6 +278,21 @@ struct flow_block_cb *flow_block_cb_alloc(struct net *net, tc_setup_cb_t *cb,
void (*release)(void *cb_priv));
void flow_block_cb_free(struct flow_block_cb *block_cb);
+struct flow_block_cb *flow_block_cb_lookup(struct flow_block_offload *offload,
+ tc_setup_cb_t *cb, void *cb_ident);
+
+static inline void flow_block_cb_add(struct flow_block_cb *block_cb,
+ struct flow_block_offload *offload)
+{
+ list_add_tail(&block_cb->list, &offload->cb_list);
+}
+
+static inline void flow_block_cb_remove(struct flow_block_cb *block_cb,
+ struct flow_block_offload *offload)
+{
+ list_move(&block_cb->list, &offload->cb_list);
+}
+
int flow_block_cb_setup_simple(struct flow_block_offload *f,
struct list_head *driver_list, tc_setup_cb_t *cb,
void *cb_ident, void *cb_priv, bool ingress_only);