[PATCH net-next v3 0/5] net: sparx5: add support for port mirroring

From: Daniel Machon
Date: Sat Apr 20 2024 - 15:29:33 EST


This series adds support for port mirroring, and port mirroring stats,
through tc matchall action FLOW_ACTION_MIRRED.

The hardware has three independent mirroring probes. Each probe can be
configured with a separate set of filtering conditions that must be
fulfilled before traffic is mirrored.

A mirror probe can have up to 64 source ports and a single monitor port.
The direction of a mirror probe determines if rx or tx traffic is
mirrored from the source port to the monitor port.

To: David S. Miller <davem@xxxxxxxxxxxxx>
To: Eric Dumazet <edumazet@xxxxxxxxxx>
To: Jakub Kicinski <kuba@xxxxxxxxxx>
To: Paolo Abeni <pabeni@xxxxxxxxxx>
To: Lars Povlsen <lars.povlsen@xxxxxxxxxxxxx>
To: Steen Hegelund <Steen.Hegelund@xxxxxxxxxxxxx>
To: UNGLinuxDriver@xxxxxxxxxxxxx
To: Russell King <linux@xxxxxxxxxxxxxxx>
Cc: netdev@xxxxxxxxxxxxxxx
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx>
Cc: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>
Cc: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
Cc: Vladimir Oltean <vladimir.oltean@xxxxxxx>
Cc: Yue Haibing <yuehaibing@xxxxxxxxxx>

Signed-off-by: Daniel Machon <daniel.machon@xxxxxxxxxxxxx>
---
Changes in v3:
- Ditch do_div() (patch #3) to fix warning on hexagon arch, reported by intel bot
- Link to v2: https://lore.kernel.org/r/20240418-port-mirroring-v2-0-20642868b386@xxxxxxxxxxxxx

Changes in v2:
- Fix clang build warning about uninitialized variable 'err'
- Link to v1: https://lore.kernel.org/r/20240418-port-mirroring-v1-0-e05c35007c55@xxxxxxxxxxxxx

---
Daniel Machon (5):
net: sparx5: add new register definitions
net: sparx5: add bookkeeping code for matchall rules
net: sparx5: add port mirroring implementation
net: sparx5: add the tc glue to support port mirroring
net: sparx5: add support for matchall mirror stats

drivers/net/ethernet/microchip/sparx5/Makefile | 3 +-
.../net/ethernet/microchip/sparx5/sparx5_main.c | 3 +
.../net/ethernet/microchip/sparx5/sparx5_main.h | 25 +++
.../ethernet/microchip/sparx5/sparx5_main_regs.h | 68 ++++++
.../net/ethernet/microchip/sparx5/sparx5_mirror.c | 235 +++++++++++++++++++++
.../ethernet/microchip/sparx5/sparx5_tc_matchall.c | 125 ++++++++++-
6 files changed, 449 insertions(+), 10 deletions(-)
---
base-commit: 1c25fe9a044d5334153a3585754b26553f8287b9
change-id: 20240402-port-mirroring-81735171ecfa

Best regards,
--
Daniel Machon <daniel.machon@xxxxxxxxxxxxx>