mlxsw: spectrum_router: Add trap adjacency entry upon first nexthop group
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
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 . 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, track the number of active nexthop groups and allocate the
adjacency entry upon the creation of the first group. Free it when the
number of active groups reaches zero.
The next patch will convert mlxsw to start using the new entry and
remove the old one.
Signed-off-by: Ido Schimmel <email@example.com>
Reviewed-by: Jiri Pirko <firstname.lastname@example.org>
Signed-off-by: David S. Miller <email@example.com>
2 files changed