mlxsw: spectrum_trap: Store all trap data in one array
authorIdo Schimmel <idosch@mellanox.com>
Sat, 16 May 2020 22:43:08 +0000 (01:43 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 16 May 2020 23:42:31 +0000 (16:42 -0700)
commit200b7cca0ba170d8a7e1bd228f0fb1f885de02c0
tree0b12f69b31fa2417cc8855d1f5e5b003e90a3ce1
parentb14a40dbdea5d0c4decc463dfd2b5dd8e4b11e46
mlxsw: spectrum_trap: Store all trap data in one array

Each trap registered with devlink is mapped to one or more Rx listeners.
These listeners allow the switch driver (e.g., mlxsw_spectrum) to
register a function that is called when a packet is received (trapped)
for a specific reason.

Currently, three arrays are used to describe the mapping between the
logical devlink traps and the Rx listeners.

Instead, get rid of these arrays and store all the information in one
array that is easier to validate and extend with more per-trap
information.

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