[PATCH net-next 0/5] net: sparx5: add tc matchall port policer offload
Daniel Machon
daniel.machon at microchip.com
Wed Oct 14 02:44:37 PDT 2026
> This series adds offload of tc matchall filters with a police action to
> the ingress port policers of Sparx5 and lan969x, which are both served
> by the sparx5 driver.
>
> In hardware, each ingress port has four single-rate leaky bucket
> policers. A policer drops the frames that exceed its rate and burst.
> The four policers of a port share the pass and drop statistics counters
> of the port.
>
> The driver uses one policer per port, because with more than one, the
> statistics reported to tc could not be attributed to the right policer.
> This matches lan966x and ocelot. The policer meters each frame
> including 20 bytes of preamble and inter-frame gap, so the configured
> rate is a line rate, also as on lan966x and ocelot.
>
> Since the policer meters all ingress frames on the port, only filters on
> chain 0 with protocol all are offloaded, and filters on shared blocks
> are rejected. Only drop is supported as the exceed action, and the
> police overhead parameter is not supported.
>
> Patch #1 drops a redundant prefix from the existing POL_UPD_INT_CFG
> register macros.
>
> Patch #2 adds the registers used by the port policer.
>
> Patch #3 tracks whether the ingress block of a port is shared, and adds
> the per-port policer state.
>
> Patch #4 adds the hardware programming of the port policer.
>
> Patch #5 adds the tc matchall offload.
>
> Signed-off-by: Daniel Machon <daniel.machon at microchip.com>
> ---
> Daniel Machon (5):
> net: sparx5: Drop redundant POL_ prefix from POL_UPD_INT_CFG
> net: sparx5: Add registers used by the port policer
> net: sparx5: Track shared tc blocks and per-port policer state
> net: sparx5: Add hardware programming for the port policer
> net: sparx5: Offload tc port policers via matchall
>
> .../microchip/sparx5/lan969x/lan969x_regs.c | 7 +
> .../net/ethernet/microchip/sparx5/sparx5_ethtool.c | 1 +
> .../net/ethernet/microchip/sparx5/sparx5_main.c | 6 +-
> .../net/ethernet/microchip/sparx5/sparx5_main.h | 36 +-
> .../ethernet/microchip/sparx5/sparx5_main_regs.h | 117 +++++-
> .../net/ethernet/microchip/sparx5/sparx5_police.c | 404 ++++++++++++++++++++-
> drivers/net/ethernet/microchip/sparx5/sparx5_qos.c | 4 +
> .../net/ethernet/microchip/sparx5/sparx5_regs.c | 7 +
> .../net/ethernet/microchip/sparx5/sparx5_regs.h | 7 +
> drivers/net/ethernet/microchip/sparx5/sparx5_tc.c | 14 +-
> .../ethernet/microchip/sparx5/sparx5_tc_matchall.c | 38 ++
> 11 files changed, 627 insertions(+), 14 deletions(-)
> ---
> base-commit: d8674294aefef02266c4d47ad10131f1bffbe534
> change-id: 20260930-b4-lan966x-pci-fdma-sparx5-lan969x-port-policers-474610756e26
>
> Best regards,
> --
> Daniel Machon <daniel.machon at microchip.com>
>
At least a few medium severity issues reported by sashiko are worth fixing. I
will respin a v2.
pw-bot: cr
More information about the linux-arm-kernel
mailing list