Skip to content

mlxsw: Alter trap adjacency entry allocation scheme

Ido Schimmel netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (refs/heads/master):

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2mlxsw: spectrum_router: Add trap adjacency entry upon first nexthop groupdrivers/net/ethernet/mellanox/mlxsw/spectrum_router.c drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h+80 -01 replyApplied
2/2mlxsw: spectrum_router: Start using new trap adjacency entrydrivers/net/ethernet/mellanox/mlxsw/spectrum_router.c drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h+1 -521 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJiri Pirko
1/2R-b
2/2R-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/2] mlxsw: Alter trap adjacency entry allocation scheme

From: Ido Schimmel <[email protected]>

In commit 0c3cbbf96def ("mlxsw: Add specific trap for packets routed via invalid nexthops"), mlxsw started allocating a new adjacency entry during driver initialization, to trap packets routed via invalid nexthops.

This behavior was later altered in commit 983db6198f0d ("mlxsw:
spectrum_router: Allocate discard adjacency entry when needed") to only allocate the entry upon the first route that requires it. The motivation for the change is explained in the commit message.

The problem with the current behavior is that the entry shows up as a "leak" in a new BPF resource monitoring tool [1]. This is caused by the asymmetry of the allocation/free scheme. While the entry is allocated upon the first route that requires it, it is only freed during de-initialization of the driver.

Instead, this patchset tracks the number of active nexthop groups and allocates the adjacency entry upon the creation of the first group. The entry is freed when the number of active groups reaches zero.

Patch #1 adds the new entry.

Patch #2 converts mlxsw to start using the new entry and removes the old one.

[1] https://github.com/Mellanox/mlxsw/tree/master/Debugging/libbpf-tools/resmon

Ido Schimmel (2):
mlxsw: spectrum_router: Add trap adjacency entry upon first nexthop
group
mlxsw: spectrum_router: Start using new trap adjacency entry

 .../ethernet/mellanox/mlxsw/spectrum_router.c | 129 +++++++++++-------
 .../ethernet/mellanox/mlxsw/spectrum_router.h |   4 +-
 2 files changed, 81 insertions(+), 52 deletions(-)
Signature · 1 line
2.31.1