summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox
diff options
context:
space:
mode:
authorNogah Frankel <nogahf@mellanox.com>2016-11-25 10:33:31 +0100
committerDavid S. Miller <davem@davemloft.net>2016-11-25 21:22:14 -0500
commitb63da93de89bcb009de89d15d4d01e75a2fc37f9 (patch)
tree780a5ab80c4346a52db9490820cf441beba8f7e1 /drivers/net/ethernet/mellanox
parent0791051c43ef994149c6d8b3ee7dc8d7e81a16a6 (diff)
mlxsw: core: Expose generic macros for rx trap
In Spectrum, there is a macro to arrange the traps list. This macro is useful for everyone who is using rx traps. Create a similar macro in core.h for creating the generic listener struct for rx traps. Signed-off-by: Nogah Frankel <nogahf@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.h b/drivers/net/ethernet/mellanox/mlxsw/core.h
index 66d97c495309..5f6fed12ba27 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.h
@@ -101,6 +101,20 @@ struct mlxsw_listener {
bool is_event;
};
+#define MLXSW_RXL(_func, _trap_id, _action, _unreg_action) \
+ { \
+ .trap_id = MLXSW_TRAP_ID_##_trap_id, \
+ .u.rx_listener = \
+ { \
+ .func = _func, \
+ .local_port = MLXSW_PORT_DONT_CARE, \
+ .trap_id = MLXSW_TRAP_ID_##_trap_id, \
+ }, \
+ .action = MLXSW_REG_HPKT_ACTION_##_action, \
+ .unreg_action = MLXSW_REG_HPKT_ACTION_##_unreg_action, \
+ .is_event = false, \
+ }
+
int mlxsw_core_rx_listener_register(struct mlxsw_core *mlxsw_core,
const struct mlxsw_rx_listener *rxl,
void *priv);