netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next RFC 0/4] net: sched: allow qdiscs to share filter block instances
@ 2017-07-10 18:51 Jiri Pirko
  2017-07-10 18:51 ` [patch net-next RFC 1/4] net: sched: introduce support for multiple filter chain pointers registration Jiri Pirko
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Jiri Pirko @ 2017-07-10 18:51 UTC (permalink / raw)
  To: netdev
  Cc: davem, jhs, xiyou.wangcong, edumazet, stephen, jbenc, mlxsw,
	andrew, vivien.didelot, f.fainelli, john.fastabend,
	alexander.h.duyck, daniel, ogerlitz, mrv

From: Jiri Pirko <jiri@mellanox.com>

Currently the filters added to qdiscs are independent. So for example if you
have 2 netdevices and you create ingress qdisc on both and you want to add
identical filter rules both, you need to add them twice. This patchset
makes this easier and mainly saves resources allowing to share all filters
within a qdisc - I call it a "filter block". Also this helps to save
resources when we do offload to hw for example to expensive TCAM.

So back to the example. First, we create 2 qdiscs. Both will share
block number 22. "22" is just an identification. If we don't pass any
block number, a new one will be generated by kernel:

$ tc qdisc add dev ens7 ingress block 22
                                ^^^^^^^^
$ tc qdisc add dev ens8 ingress block 22
                                ^^^^^^^^

Now if we list the qdiscs, we will see the block index in the output:
qdisc fq_codel 0: dev ens7 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
 Sent 9014 bytes 99 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc ingress ffff: dev ens7 parent ffff:fff1 block 22 
                                              ^^^^^^^^
 Sent 4592 bytes 58 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc fq_codel 0: dev ens8 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 32Mb ecn 
 Sent 17022 bytes 307 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc ingress ffff: dev ens8 parent ffff:fff1 block 22 
                                              ^^^^^^^^
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 


Now we can add filter to any of qdiscs sharing the same block:

$ tc filter add dev ens7 parent ffff: protocol ip pref 25 flower dst_ip 192.168.0.0/16 action drop


We will see the same output if we list filters for ens7 and ens8, including stats:

$ tc -s filter show dev ens7 root
filter parent ffff: protocol ip pref 25 flower 
filter parent ffff: protocol ip pref 25 flower handle 0x1 
  eth_type ipv4
  dst_ip 192.168.1.0/24
        action order 1: gact action drop
         random type none pass val 0
         index 3 ref 1 bind 1 installed 10201 sec used 10150 sec
        Action statistics:
        Sent 4200 bytes 50 pkt (dropped 50, overlimits 0 requeues 0) 
        backlog 0b 0p requeues 0 

$ tc -s filter show dev ens8 root
filter dev ens7 parent ffff: protocol ip pref 25 flower 
filter dev ens7 parent ffff: protocol ip pref 25 flower handle 0x1 
  eth_type ipv4
  dst_ip 192.168.1.0/24
        action order 1: gact action drop
         random type none pass val 0
         index 3 ref 1 bind 1 installed 10202 sec used 10152 sec
        Action statistics:
        Sent 4200 bytes 50 pkt (dropped 50, overlimits 0 requeues 0) 
        backlog 0b 0p requeues 0 


Issues:
- tp->q is set by the device used to add the filter. That has to be resolved.
  Impacts the dump (as you can see above)

Jiri Pirko (4):
  net: sched: introduce support for multiple filter chain pointers
    registration
  net: sched: intruduce qdisc_net helper
  net: sched: introduce shared filter blocks infrastructure
  net: sched: allow ingress and clsact qdiscs to share filter blocks

 include/net/pkt_cls.h          |  22 +++-
 include/net/pkt_sched.h        |   7 ++
 include/net/sch_generic.h      |   4 +-
 include/uapi/linux/pkt_sched.h |  12 +++
 net/sched/cls_api.c            | 240 +++++++++++++++++++++++++++++++++++++----
 net/sched/sch_ingress.c        | 107 ++++++++++++++++--
 6 files changed, 362 insertions(+), 30 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-07-14  7:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-10 18:51 [patch net-next RFC 0/4] net: sched: allow qdiscs to share filter block instances Jiri Pirko
2017-07-10 18:51 ` [patch net-next RFC 1/4] net: sched: introduce support for multiple filter chain pointers registration Jiri Pirko
2017-07-10 18:51 ` [patch net-next RFC 2/4] net: sched: intruduce qdisc_net helper Jiri Pirko
2017-07-10 18:51 ` [patch net-next RFC 3/4] net: sched: introduce shared filter blocks infrastructure Jiri Pirko
2017-07-10 18:51 ` [patch net-next RFC 4/4] net: sched: allow ingress and clsact qdiscs to share filter blocks Jiri Pirko
2017-07-10 18:52 ` [patch iproute2/net-next RFC] tc: Implement filter block sharing to ingress and clsact qdiscs Jiri Pirko
2017-07-11  6:57 ` [patch net-next RFC 0/4] net: sched: allow qdiscs to share filter block instances Or Gerlitz
2017-07-11  7:02   ` Jiri Pirko
2017-07-11 12:15 ` Jamal Hadi Salim
2017-07-11 12:34   ` Jiri Pirko
2017-07-14  7:33     ` Jamal Hadi Salim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).