netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/7] tc: Introduce a trap-and-forward action
@ 2021-04-08 13:38 Petr Machata
  2021-04-08 13:38 ` [PATCH net-next 1/7] net: sched: Add " Petr Machata
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Petr Machata @ 2021-04-08 13:38 UTC (permalink / raw)
  To: netdev
  Cc: Petr Machata, Jiri Pirko, David S. Miller, Jakub Kicinski,
	Ido Schimmel, Cong Wang, Jamal Hadi Salim

The TC action "trap" is used to instruct the HW datapath to drop the
matched packet and transfer it to the host for processing in the SW
pipeline. If instead it is desirable to forward the packet in the HW
datapath, and to transfer a _copy_ to the SW pipeline, there is no
practical way to achieve that.

As a particular use case, the mlxsw driver could instruct a Spectrum
machine to mirror packets that are ECN-marked to the host. However these
packets are still forwarded in the HW datapath, therefore describing this
mirroring through the "trap" action is incorrect. A new action is needed.

To that end, this patchset introduces a new generic action, trap_fwd. In
the software pipeline, it is equivalent to an OK. When offloading, it
should forward the packet to the host, but unlike trap it should not drop
the packet.

This patchset proceeds as follows:

- In patch #1, introduce the new action, and modify the TC code to
  recognize it as an OK.

- In patches #2 and #3, introduce the artifacts necessary for offloading
  the trap_fwd action, and a new trap so that drivers can report the
  trapped packets.

- Patches #4 and #5 offload trap_fwd in mlxsw.

- Patches #6 and #7 add selftests.

Petr Machata (7):
  net: sched: Add a trap-and-forward action
  net: sched: Make the action trap_fwd offloadable
  devlink: Add a new trap for the trap_fwd action
  mlxsw: Propagate extack to mlxsw_afa_block_commit()
  mlxsw: Offload trap_fwd
  selftests: forwarding: Add a test for TC trapping behavior
  selftests: mlxsw: Add a trap_fwd test to devlink_trap_control

 .../networking/devlink/devlink-trap.rst       |   4 +
 .../mellanox/mlxsw/core_acl_flex_actions.c    |  28 ++-
 .../mellanox/mlxsw/core_acl_flex_actions.h    |   3 +-
 .../net/ethernet/mellanox/mlxsw/spectrum.h    |   4 +-
 .../mellanox/mlxsw/spectrum1_acl_tcam.c       |   2 +-
 .../ethernet/mellanox/mlxsw/spectrum_acl.c    |  11 +-
 .../ethernet/mellanox/mlxsw/spectrum_flower.c |   9 +-
 .../mellanox/mlxsw/spectrum_mr_tcam.c         |   2 +-
 .../ethernet/mellanox/mlxsw/spectrum_trap.c   |   8 +
 drivers/net/ethernet/mellanox/mlxsw/trap.h    |   2 +
 include/net/devlink.h                         |   3 +
 include/net/flow_offload.h                    |   1 +
 include/net/tc_act/tc_gact.h                  |   5 +
 include/uapi/linux/pkt_cls.h                  |   6 +-
 net/core/dev.c                                |   2 +
 net/core/devlink.c                            |   1 +
 net/sched/act_bpf.c                           |  13 +-
 net/sched/cls_api.c                           |   2 +
 net/sched/cls_bpf.c                           |   1 +
 net/sched/sch_dsmark.c                        |   1 +
 tools/include/uapi/linux/pkt_cls.h            |   6 +-
 .../drivers/net/mlxsw/devlink_trap_control.sh |  23 ++-
 .../selftests/net/forwarding/tc_trap.sh       | 170 ++++++++++++++++++
 23 files changed, 288 insertions(+), 19 deletions(-)
 create mode 100755 tools/testing/selftests/net/forwarding/tc_trap.sh

-- 
2.26.2


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

end of thread, other threads:[~2021-04-11 19:23 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 13:38 [PATCH net-next 0/7] tc: Introduce a trap-and-forward action Petr Machata
2021-04-08 13:38 ` [PATCH net-next 1/7] net: sched: Add " Petr Machata
2021-04-08 14:05   ` Jamal Hadi Salim
2021-04-08 21:25     ` Jakub Kicinski
2021-04-09 11:13       ` Jamal Hadi Salim
2021-04-09 11:03     ` Petr Machata
2021-04-09 11:44       ` Jamal Hadi Salim
2021-04-09 13:43         ` Petr Machata
2021-04-11 19:23           ` Jamal Hadi Salim
2021-04-08 13:38 ` [PATCH net-next 2/7] net: sched: Make the action trap_fwd offloadable Petr Machata
2021-04-08 13:38 ` [PATCH net-next 3/7] devlink: Add a new trap for the trap_fwd action Petr Machata
2021-04-08 13:38 ` [PATCH net-next 4/7] mlxsw: Propagate extack to mlxsw_afa_block_commit() Petr Machata
2021-04-08 13:38 ` [PATCH net-next 5/7] mlxsw: Offload trap_fwd Petr Machata
2021-04-08 13:38 ` [PATCH net-next 6/7] selftests: forwarding: Add a test for TC trapping behavior Petr Machata
2021-04-08 13:38 ` [PATCH net-next 7/7] selftests: mlxsw: Add a trap_fwd test to devlink_trap_control Petr Machata

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