Skip to content

devlink: Preparations for trap policers support

Ido Schimmel netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5devlink: Add API to register packet trap groupsinclude/net/devlink.h net/core/devlink.c+123 -00 replies
2/5mlxsw: spectrum_trap: Explicitly register packet trap groupsdrivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c+27 -30 replies
3/5netdevsim: Explicitly register packet trap groupsdrivers/net/netdevsim/dev.c+18 -10 replies
4/5devlink: Stop reference counting packet trap groupsnet/core/devlink.c+5 -960 replies
5/5devlink: Only pass packet trap group identifier in trap structuredrivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c drivers/net/netdevsim/dev.c include/net/devlink.h +1 more+32 -180 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJiri PirkoJakub Kicinski
SeriesA-b
1/5R-b
2/5R-b
3/5R-b
4/5R-b
5/5R-b

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 0/5] devlink: Preparations for trap policers support

From: Ido Schimmel <[email protected]>

This patch set prepares the code for devlink-trap policer support in a follow-up patch set [1][2]. No functional changes intended.

Policers are going to be added as attributes of packet trap groups, which are entities used to aggregate logically related packet traps. This will allow users, for example, to limit all the packets that encountered an exception during routing to 10Kpps.

However, currently, device drivers register their packet trap groups implicitly when they register their packet traps via devlink_traps_register(). This makes it difficult to pass additional attributes for the groups. For example, the policer bound to the group.

Therefore, this patch set converts device drivers to explicitly register their packet trap groups. This will later allow these drivers to register the group with additional attributes, if any.

API today:
devlink_traps_register(traps)

API after this patch set:
devlink_trap_groups_register(groups)
devlink_traps_register(traps)

API after follow-up patch set:
devlink_trap_policers_register(policers)
devlink_trap_groups_register(groups)
devlink_traps_register(traps)

Patch set overview:
Patch #1 adds the new API to register packet trap groups Patches #2-#3 convert mlxsw and netdevsim to use the new API Patches #4-#5 remove the old API

Tested successfully with current devlink-trap selftests.

[1] https://github.com/idosch/linux/tree/trap-policers
[2] https://github.com/idosch/iproute2/tree/trap-policers

Ido Schimmel (5):
devlink: Add API to register packet trap groups
mlxsw: spectrum_trap: Explicitly register packet trap groups
netdevsim: Explicitly register packet trap groups
devlink: Stop reference counting packet trap groups
devlink: Only pass packet trap group identifier in trap structure

 .../ethernet/mellanox/mlxsw/spectrum_trap.c   |  38 ++-
 drivers/net/netdevsim/dev.c                   |  27 +-
 include/net/devlink.h                         |  19 +-
 net/core/devlink.c                            | 233 ++++++++++--------
 4 files changed, 202 insertions(+), 115 deletions(-)
Signature · 1 line
2.24.1