Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
net/sched: cls_api: Expose tc block to the datapath
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jamal Hadi Salim <[email protected]>
Co-developed-by: Pedro Tammela <[email protected]>
Signed-off-by: Pedro Tammela <[email protected]>
Signed-off-by: Victor Nogueira <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
vbnogueira authored and davem330 committed Dec 26, 2023
1 parent 913b47d commit a7042cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion net/sched/cls_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit a7042cf

Please sign in to comment.