Skip to content

devlink: Add support for control packet traps

Ido Schimmel netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14devlink: Create dedicated trap group for layer 3 exceptionsDocumentation/networking/devlink/devlink-trap.rst include/net/devlink.h net/core/devlink.c+9 -20 replies
2/14mlxsw: spectrum_trap: Move layer 3 exceptions to exceptions trap groupdrivers/net/ethernet/mellanox/mlxsw/reg.h drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c+25 -160 replies
3/14netdevsim: Move layer 3 exceptions to exceptions trap groupdrivers/net/netdevsim/dev.c+2 -10 replies
4/14devlink: Add 'mirror' trap actionDocumentation/networking/devlink/devlink-trap.rst include/uapi/linux/devlink.h net/core/devlink.c+7 -10 replies
5/14devlink: Add 'control' trap typeDocumentation/networking/devlink/devlink-trap.rst include/uapi/linux/devlink.h net/core/devlink.c+20 -10 replies
6/14devlink: Add layer 2 control packet trapsDocumentation/networking/devlink/devlink-trap.rst include/net/devlink.h net/core/devlink.c+109 -00 replies
7/14devlink: Add layer 3 control packet trapsDocumentation/networking/devlink/devlink-trap.rst include/net/devlink.h net/core/devlink.c+311 -00 replies
8/14devlink: Add ACL control packet trapsDocumentation/networking/devlink/devlink-trap.rst include/net/devlink.h net/core/devlink.c+30 -00 replies
9/14netdevsim: Register control trapsdrivers/net/netdevsim/dev.c+7 -00 replies
10/14mlxsw: spectrum_trap: Factor out common Rx listener functiondrivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c+24 -50 replies
11/14mlxsw: spectrum_trap: Register layer 2 control trapsdrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c+159 -310 replies
12/14mlxsw: spectrum_trap: Register layer 3 control trapsdrivers/net/ethernet/mellanox/mlxsw/reg.h drivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c+318 -940 replies
13/14mlxsw: spectrum_trap: Register ACL control trapsdrivers/net/ethernet/mellanox/mlxsw/spectrum.c drivers/net/ethernet/mellanox/mlxsw/spectrum.h drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c+55 -230 replies
14/14selftests: mlxsw: Add test for control packetstools/testing/selftests/drivers/net/mlxsw/devlink_trap_control.sh tools/testing/selftests/net/forwarding/devlink_lib.sh+711 -00 replies

Reviews trailers per patch

13 of 14 patches have a Reviewed-by or Acked-by.

PatchJiri Pirko
1/14R-b
2/14R-b
3/14R-b
4/14R-b
5/14R-b
6/14R-b
7/14R-b
8/14R-b
9/14R-b
10/14R-b
11/14R-b
12/14R-b
13/14R-b
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 00/14] devlink: Add support for control packet traps

From: Ido Schimmel <[email protected]>

So far device drivers were only able to register drop and exception packet traps with devlink. These traps are used for packets that were either dropped by the underlying device or encountered an exception (e.g., missing neighbour entry) during forwarding.

However, in the steady state, the majority of the packets being trapped to the CPU are packets that are required for the correct functioning of the control plane. For example, ARP request and IGMP query packets.

This patch set allows device drivers to register such control traps with devlink and expose their default control plane policy to user space. User space can then tune the packet trap policer settings according to its needs, as with existing packet traps.

In a similar fashion to exception traps, the action associated with such traps cannot be changed as it can easily break the control plane. Unlike drop and exception traps, packets trapped via control traps are not reported to the kernel's drop monitor as they are not indicative of any problem.

Patch set overview:

Patches #1-#3 break out layer 3 exceptions to a different group to provide better granularity. A future patch set will make this completely configurable.

Patch #4 adds a new trap action ('mirror') that is used for packets that are forwarded by the device and sent to the CPU. Such packets are marked by device drivers with 'skb->offload_fwd_mark = 1' in order to prevent the kernel from forwarding them again.

Patch #5 adds the new trap type, 'control'.

Patches #6-#8 gradually add various control traps to devlink with proper documentation.

Patch #9 adds a few control traps to netdevsim, which are automatically exercised by existing devlink-trap selftest.

Patches #10 performs small refactoring in mlxsw.

Patches #11-#13 change mlxsw to register its existing control traps with devlink.

Patch #14 adds a selftest over mlxsw that exercises all the registered control traps.

Ido Schimmel (14):
devlink: Create dedicated trap group for layer 3 exceptions
mlxsw: spectrum_trap: Move layer 3 exceptions to exceptions trap group
netdevsim: Move layer 3 exceptions to exceptions trap group
devlink: Add 'mirror' trap action
devlink: Add 'control' trap type
devlink: Add layer 2 control packet traps
devlink: Add layer 3 control packet traps
devlink: Add ACL control packet traps
netdevsim: Register control traps
mlxsw: spectrum_trap: Factor out common Rx listener function
mlxsw: spectrum_trap: Register layer 2 control traps
mlxsw: spectrum_trap: Register layer 3 control traps
mlxsw: spectrum_trap: Register ACL control traps
selftests: mlxsw: Add test for control packets

 .../networking/devlink/devlink-trap.rst       | 219 +++++-
 drivers/net/ethernet/mellanox/mlxsw/reg.h     |   2 +-
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 149 +---
 .../net/ethernet/mellanox/mlxsw/spectrum.h    |   4 +
 .../ethernet/mellanox/mlxsw/spectrum_trap.c   | 583 ++++++++++++++-
 drivers/net/netdevsim/dev.c                   |  10 +-
 include/net/devlink.h                         | 189 +++++
 include/uapi/linux/devlink.h                  |   9 +
 net/core/devlink.c                            |  73 +-
 .../drivers/net/mlxsw/devlink_trap_control.sh | 688 ++++++++++++++++++
 .../selftests/net/forwarding/devlink_lib.sh   |  23 +
 11 files changed, 1781 insertions(+), 168 deletions(-)
 create mode 100755 tools/testing/selftests/drivers/net/mlxsw/devlink_trap_control.sh
Signature · 1 line
2.26.2