Merge branch 'mlxsw-trap-adjacency'
authorDavid S. Miller <davem@davemloft.net>
Wed, 22 Sep 2021 13:35:02 +0000 (14:35 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Sep 2021 13:35:02 +0000 (14:35 +0100)
commit428168f9951710854d8d1abf6ca03a8bdab0ccc5
tree210a0d939a1388788fc0945e2f143b606d7a7f41
parent8bea96efa7c0c57dc0c9ec4518ed61e3d5e9261c
parente3a3aae74d76f144c1b4b8b62fbe429b219dfd32
Merge branch 'mlxsw-trap-adjacency'

Ido Schimmel says:

====================
mlxsw: Alter trap adjacency entry allocation scheme

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.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>