net/sched: cls_api: Expose tc block to the datapath
authorVictor Nogueira <victor@mojatatu.com>
Tue, 19 Dec 2023 18:16:20 +0000 (15:16 -0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Dec 2023 21:20:08 +0000 (21:20 +0000)
The datapath can now find the block of the port in which the packet arrived
at.

In the next patch we show a possible usage of this patch in a new
version of mirred that multicasts to all ports except for the port in
which the packet arrived on.

Co-developed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Co-developed-by: Pedro Tammela <pctammela@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sch_generic.h
net/sched/cls_api.c

index aca11127154fa222bcbaf9fb06e8fb656442fb5a..ba3e1b315de838f9696ad7948ae474552c288e73 100644 (file)
@@ -484,6 +484,8 @@ struct tcf_block {
        struct mutex proto_destroy_lock; /* Lock for proto_destroy hashtable. */
 };
 
+struct tcf_block *tcf_block_lookup(struct net *net, u32 block_index);
+
 static inline bool lockdep_tcf_chain_is_locked(struct tcf_chain *chain)
 {
        return lockdep_is_held(&chain->filter_chain_lock);
index 421ea10bc82ab0361a2d93b8ecf525526dbd82e6..3c50b4037755b2624424a86ef38fa22eec7b3269 100644 (file)
@@ -1011,12 +1011,13 @@ static struct tcf_block *tcf_block_create(struct net *net, struct Qdisc *q,
        return block;
 }
 
-static struct tcf_block *tcf_block_lookup(struct net *net, u32 block_index)
+struct tcf_block *tcf_block_lookup(struct net *net, u32 block_index)
 {
        struct tcf_net *tn = net_generic(net, tcf_net_id);
 
        return idr_find(&tn->idr, block_index);
 }
+EXPORT_SYMBOL(tcf_block_lookup);
 
 static struct tcf_block *tcf_block_refcnt_get(struct net *net, u32 block_index)
 {