Skip to content

mlxsw: Implement ACL-dropped packets identification

Jiri Pirko netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 3 repliesIn review
  2. v110 patches 12 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10flow_offload: pass action cookie through offload structuresinclude/net/flow_offload.h net/core/flow_offload.c net/sched/cls_api.c+62 -11 reply
2/10devlink: add trap metadata type for cookieinclude/net/devlink.h include/uapi/linux/devlink.h net/core/devlink.c+6 -00 replies
3/10drop_monitor: extend by passing cookie from driverinclude/net/drop_monitor.h include/uapi/linux/net_dropmon.h net/core/drop_monitor.c+36 -10 replies
4/10devlink: extend devlink_trap_report() to accept cookie and passdrivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c drivers/net/netdevsim/dev.c include/net/devlink.h +1 more+15 -90 replies
5/10mlxsw: core_acl_flex_actions: Add trap with userdef actiondrivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c+28 -20 replies
6/10mlxsw: core_acl_flex_actions: Implement flow_offload action cookie offloaddrivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h drivers/net/ethernet/mellanox/mlxsw/spectrum.h +2 more+257 -60 replies
7/10mlxsw: pci: Extract cookie index for ACL discard trap packetsdrivers/net/ethernet/mellanox/mlxsw/core.h drivers/net/ethernet/mellanox/mlxsw/pci.c drivers/net/ethernet/mellanox/mlxsw/pci_hw.h+18 -10 replies
8/10mlxsw: spectrum_trap: Lookup and pass cookie down to devlink_trap_report()drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.h drivers/net/ethernet/mellanox/mlxsw/spectrum.h +1 more+63 -30 replies
9/10netdevsim: add ACL trap reporting cookie as a metadatadrivers/net/netdevsim/dev.c drivers/net/netdevsim/netdevsim.h+116 -31 reply
10/10selftests: netdevsim: Extend devlink trap test to include flow action cookietools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh+5 -00 replies

Reviews trailers per patch

4 of 10 patches have a Reviewed-by or Acked-by.

PatchJakub Kicinski
1/10R-b
2/10R-b
3/10
4/10R-b
5/10
6/10
7/10
8/10
9/10R-b
10/10

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

Read the v2 thread

Cover letter [patch net-next v2 00/10] mlxsw: Implement ACL-dropped packets identification

From: Jiri Pirko <[email protected]>

mlxsw hardware allows to insert a ACL-drop action with a value defined by user that would be later on passed with a dropped packet.

To implement this, use the existing TC action cookie and pass it to the driver. As the cookie format coming down from TC and the mlxsw HW cookie format is different, do the mapping of these two using idr and rhashtable.

The cookie is passed up from the HW through devlink_trap_report() to drop_monitor code. A new metadata type is used for that.

Example:

$ tc qdisc add dev enp0s16np1 clsact
$ tc filter add dev enp0s16np1 ingress protocol ip pref 10 flower skip_sw dst_ip 192.168.1.2 action drop cookie 3b45fa38c8
                                                                                                                ^^^^^^^^^^
$ devlink trap set pci/0000:00:10.0 trap acl action trap
$ dropwatch
Initializing null lookup method
dropwatch> set hw true
setting hardware drops monitoring to 1
dropwatch> set alertmode packet
Setting alert mode
Alert mode successfully set
dropwatch> start
Enabling monitoring...
Kernel monitoring activated.
Issue Ctrl-C to stop monitoring
drop at: ingress_flow_action_drop (acl_drops)
origin: hardware
input port ifindex: 30
input port name: enp0s16np1
cookie: 3b45fa38c8    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
timestamp: Fri Jan 24 17:10:53 2020 715387671 nsec
protocol: 0x800
length: 98
original length: 98

This way the user may insert multiple drop rules and monitor the dropped packets with the information of which action caused the drop.

Jiri Pirko (10):
flow_offload: pass action cookie through offload structures
devlink: add trap metadata type for cookie
drop_monitor: extend by passing cookie from driver
devlink: extend devlink_trap_report() to accept cookie and pass
mlxsw: core_acl_flex_actions: Add trap with userdef action
mlxsw: core_acl_flex_actions: Implement flow_offload action cookie
offload
mlxsw: pci: Extract cookie index for ACL discard trap packets
mlxsw: spectrum_trap: Lookup and pass cookie down to
devlink_trap_report()
netdevsim: add ACL trap reporting cookie as a metadata
selftests: netdevsim: Extend devlink trap test to include flow action
cookie

 drivers/net/ethernet/mellanox/mlxsw/core.h    |   5 +-
 .../mellanox/mlxsw/core_acl_flex_actions.c    | 289 +++++++++++++++++-
 .../mellanox/mlxsw/core_acl_flex_actions.h    |   7 +-
 drivers/net/ethernet/mellanox/mlxsw/pci.c     |   9 +
 drivers/net/ethernet/mellanox/mlxsw/pci_hw.h  |   5 +
 .../net/ethernet/mellanox/mlxsw/spectrum.h    |  11 +-
 .../ethernet/mellanox/mlxsw/spectrum_acl.c    |   7 +-
 .../ethernet/mellanox/mlxsw/spectrum_flower.c |   3 +-
 .../ethernet/mellanox/mlxsw/spectrum_trap.c   |  46 ++-
 drivers/net/netdevsim/dev.c                   | 117 ++++++-
 drivers/net/netdevsim/netdevsim.h             |   2 +
 include/net/devlink.h                         |   8 +-
 include/net/drop_monitor.h                    |   3 +
 include/net/flow_offload.h                    |  11 +
 include/uapi/linux/devlink.h                  |   2 +
 include/uapi/linux/net_dropmon.h              |   1 +
 net/core/devlink.c                            |  14 +-
 net/core/drop_monitor.c                       |  33 +-
 net/core/flow_offload.c                       |  21 ++
 net/sched/cls_api.c                           |  31 +-
 .../drivers/net/netdevsim/devlink_trap.sh     |   5 +
 21 files changed, 605 insertions(+), 25 deletions(-)
Signature · 1 line
2.21.1