OSDN Git Service

mlxsw: core: Use mirror reason during Rx listener lookup
authorIdo Schimmel <idosch@mellanox.com>
Tue, 14 Jul 2020 14:21:06 +0000 (17:21 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Jul 2020 21:50:50 +0000 (14:50 -0700)
commit6a8c101e0795d4fe892f281a4e08b2a05cbb9e20
tree737301a56e5470a77f75f43205698b31e87329a9
parenteacc86ec510b9ad64d6dddf3a9924c29d1c4f57b
mlxsw: core: Use mirror reason during Rx listener lookup

The Rx listener abstraction allows the switch driver (e.g.,
mlxsw_spectrum) to register a function that is called when a packet is
received (trapped) for a specific reason.

Up until now, the Rx listener lookup was solely based on the trap
identifier. However, when a packet is mirrored to the CPU the trap
identifier merely indicates that the packet was mirrored, but not why it
was mirrored. This makes it impossible for the switch driver to register
different Rx listeners for different mirror reasons.

Solve this by allowing the switch driver to register a Rx listener with
a mirror reason and by extending the Rx listener lookup to take the
mirror reason into account.

Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core.c
drivers/net/ethernet/mellanox/mlxsw/core.h