summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2018-01-17 11:46:46 +0100
committerDavid S. Miller <davem@davemloft.net>2018-01-17 14:53:56 -0500
commit4861738775d70e0165d04fe014f32b41bcb5414a (patch)
tree496b129c4d9aee0385f924d1e20fc1b0ea854795 /include/net
parenta9b19443edbaac97c5c094f3cc903c1f1548b3f5 (diff)
downloadlinux-4861738775d70e0165d04fe014f32b41bcb5414a.tar.bz2
net: sched: introduce shared filter blocks infrastructure
Allow qdiscs to share filter blocks among them. Each qdisc type has to use block get/put extended modifications that enable sharing. Shared blocks are tracked within each net namespace and identified by u32 index. This index is passed from user during the qdisc creation. If user passes index that is not used by any other qdisc, new block is created. If user passes index that is already used, the existing block will be re-used. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/pkt_cls.h7
-rw-r--r--include/net/sch_generic.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index cc23c041a6d7..c40d60e6a883 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -29,6 +29,7 @@ struct tcf_block_ext_info {
enum tcf_block_binder_type binder_type;
tcf_chain_head_change_t *chain_head_change;
void *chain_head_change_priv;
+ u32 block_index;
};
struct tcf_block_cb;
@@ -48,8 +49,14 @@ void tcf_block_put(struct tcf_block *block);
void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q,
struct tcf_block_ext_info *ei);
+static inline bool tcf_block_shared(struct tcf_block *block)
+{
+ return block->index;
+}
+
static inline struct Qdisc *tcf_block_q(struct tcf_block *block)
{
+ WARN_ON(tcf_block_shared(block));
return block->q;
}
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 17d8cfd0efda..cc0c1e4711dc 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -284,6 +284,8 @@ struct tcf_chain {
struct tcf_block {
struct list_head chain_list;
+ u32 index; /* block index for shared blocks */
+ unsigned int refcnt;
struct net *net;
struct Qdisc *q;
struct list_head cb_list;