netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next v6 00/11] net: sched: allow qdiscs to share filter block instances
@ 2018-01-05 23:09 Jiri Pirko
  2018-01-05 23:09 ` [patch net-next v6 01/11] net: sched: introduce support for multiple filter chain pointers registration Jiri Pirko
                   ` (14 more replies)
  0 siblings, 15 replies; 33+ messages in thread
From: Jiri Pirko @ 2018-01-05 23:09 UTC (permalink / raw)
  To: netdev
  Cc: davem, jhs, xiyou.wangcong, mlxsw, andrew, vivien.didelot,
	f.fainelli, michael.chan, ganeshgr, saeedm, matanb, leonro,
	idosch, jakub.kicinski, simon.horman, pieter.jansenvanvuuren,
	john.hurley, alexander.h.duyck, ogerlitz, john.fastabend, daniel,
	dsahern

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:

$ tc qdisc
qdisc ingress ffff: dev ens7 parent ffff:fff1 block 22
qdisc ingress ffff: dev ens8 parent ffff:fff1 block 22


To make is more visual, the situation looks like this:

   ens7 ingress qdisc                 ens7 ingress qdisc
          |                                  |
          |                                  |
          +---------->  block 22  <----------+

Unlimited number of qdiscs may share the same block.

Now we can add filter using the block index:

$ tc filter add block 22 protocol ip pref 25 flower dst_ip 192.168.0.0/16 action drop


Note we cannot use the qdisc for filter manipulations for shared blocks:

$ tc filter add dev ens8 ingress protocol ip pref 1 flower dst_ip 192.168.100.2 action drop
Error: Cannot work with shared block, please use block index.


We will see the same output if we list filters for ingress qdisc of
ens7 and ens8, also for the block 22:

$ tc filter show block 22
filter block 22 protocol ip pref 25 flower chain 0
filter block 22 protocol ip pref 25 flower chain 0 handle 0x1
...

$ tc filter show dev ens7 ingress
filter block 22 protocol ip pref 25 flower chain 0
filter block 22 protocol ip pref 25 flower chain 0 handle 0x1
...

$ tc filter show dev ens8 ingress
filter block 22 protocol ip pref 25 flower chain 0
filter block 22 protocol ip pref 25 flower chain 0 handle 0x1
...

---
v5->v6:
- added patch 6 that introduces block handle

v4->v5:
- patch 5:
 - add tracking of binding of devs that are unable to offload and check
   that before block cbs call.

v3->v4:
- patch 1:
 - rebased on top of the current net-next
 - added some extack strings
- patch 3:
 - rebased on top of the current net-next
- patch 5:
 - propagate netdev_ops->ndo_setup_tc error up to tcf_block_offload_bind
   caller
- patch 7:
 - rebased on top of the current net-next

v2->v3:
- removed original patch 1, removing tp->q cls_bpf dependency. Fixed by
  Jakub in the meantime.
- patch 1:
 - rebased on top of the current net-next
- patch 5:
 - new patch
- patch 8:
 - removed "p_" prefix from block index function args
- patch 10:
 - add tc offload feature handling

Jiri Pirko (11):
  net: sched: introduce support for multiple filter chain pointers
    registration
  net: sched: avoid usage of tp->q in tcf_classify
  net: sched: introduce block mechanism to handle netif_keep_dst calls
  net: sched: remove classid and q fields from tcf_proto
  net: sched: keep track of offloaded filters and check tc offload
    feature
  net: sched: use block index as a handle instead of qdisc when block is
    shared
  net: sched: allow ingress and clsact qdiscs to share filter blocks
  mlxsw: spectrum_acl: Reshuffle code around
    mlxsw_sp_acl_ruleset_create/destroy
  mlxsw: spectrum_acl: Don't store netdev and ingress for ruleset unbind
  mlxsw: spectrum_acl: Implement TC block sharing
  mlxsw: spectrum_acl: Pass mlxsw_sp_port down to ruleset bind/unbind
    ops

 drivers/net/ethernet/mellanox/mlxsw/spectrum.c     | 182 ++++++-
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h     |  44 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c | 302 ++++++++---
 .../ethernet/mellanox/mlxsw/spectrum_acl_tcam.c    |  44 +-
 .../net/ethernet/mellanox/mlxsw/spectrum_flower.c  |  41 +-
 include/net/pkt_cls.h                              |   9 +
 include/net/sch_generic.h                          |  27 +-
 include/uapi/linux/pkt_sched.h                     |  11 +
 net/sched/cls_api.c                                | 604 ++++++++++++++++-----
 net/sched/cls_bpf.c                                |   9 +-
 net/sched/cls_flow.c                               |   2 +-
 net/sched/cls_flower.c                             |   3 +-
 net/sched/cls_matchall.c                           |   3 +-
 net/sched/cls_route.c                              |   2 +-
 net/sched/cls_u32.c                                |  13 +-
 net/sched/sch_ingress.c                            |  89 ++-
 16 files changed, 1079 insertions(+), 306 deletions(-)

-- 
2.9.5

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

end of thread, other threads:[~2018-01-08 17:20 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-05 23:09 [patch net-next v6 00/11] net: sched: allow qdiscs to share filter block instances Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 01/11] net: sched: introduce support for multiple filter chain pointers registration Jiri Pirko
2018-01-06 17:11   ` Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 02/11] net: sched: avoid usage of tp->q in tcf_classify Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 03/11] net: sched: introduce block mechanism to handle netif_keep_dst calls Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 04/11] net: sched: remove classid and q fields from tcf_proto Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 05/11] net: sched: keep track of offloaded filters and check tc offload feature Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 06/11] net: sched: use block index as a handle instead of qdisc when block is shared Jiri Pirko
2018-01-06 20:43   ` Jiri Pirko
2018-01-07 13:11     ` Jamal Hadi Salim
2018-01-07 13:46       ` Jiri Pirko
2018-01-07 14:28         ` Jamal Hadi Salim
2018-01-07 14:51           ` Jamal Hadi Salim
2018-01-05 23:09 ` [patch net-next v6 07/11] net: sched: allow ingress and clsact qdiscs to share filter blocks Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 08/11] mlxsw: spectrum_acl: Reshuffle code around mlxsw_sp_acl_ruleset_create/destroy Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 09/11] mlxsw: spectrum_acl: Don't store netdev and ingress for ruleset unbind Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 10/11] mlxsw: spectrum_acl: Implement TC block sharing Jiri Pirko
2018-01-05 23:09 ` [patch net-next v6 11/11] mlxsw: spectrum_acl: Pass mlxsw_sp_port down to ruleset bind/unbind ops Jiri Pirko
2018-01-05 23:12 ` [iproute2 net-next 1/2] tc: implement filter block sharing to ingress and clsact qdiscs Jiri Pirko
2018-01-05 23:12 ` [iproute2 net-next 2/2] tc: introduce support for block-handle for filter operations Jiri Pirko
2018-01-06  3:57 ` [patch net-next v6 00/11] net: sched: allow qdiscs to share filter block instances David Ahern
2018-01-06  8:07   ` Jiri Pirko
2018-01-06  9:48     ` Jiri Pirko
2018-01-06 18:02       ` Jamal Hadi Salim
2018-01-06 18:31         ` Jamal Hadi Salim
2018-01-06 19:29         ` David Ahern
2018-01-06 17:41     ` David Ahern
2018-01-06 18:16       ` Jamal Hadi Salim
2018-01-06 20:38         ` Jiri Pirko
2018-01-06 20:37       ` Jiri Pirko
2018-01-08 15:23 ` Marcelo Ricardo Leitner
2018-01-08 15:42   ` Jiri Pirko
2018-01-08 17:20     ` Marcelo Ricardo Leitner

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).