提交 93393b33 编写于 作者: I Ido Schimmel 提交者: David S. Miller

mlxsw: spectrum: Simplify traps definition

Instead of copying & pasting the same struct initialization for every
Rx listener, just use a macro.
Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
Signed-off-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6bc506b4
......@@ -2570,123 +2570,39 @@ static void mlxsw_sp_rx_listener_func(struct sk_buff *skb, u8 local_port,
netif_receive_skb(skb);
}
#define MLXSW_SP_RXL(_func, _trap_id) \
{ \
.func = _func, \
.local_port = MLXSW_PORT_DONT_CARE, \
.trap_id = MLXSW_TRAP_ID_##_trap_id, \
}
static const struct mlxsw_rx_listener mlxsw_sp_rx_listener[] = {
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_FDB_MC,
},
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, FDB_MC),
/* Traps for specific L2 packet types, not trapped as FDB MC */
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_STP,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_LACP,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_EAPOL,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_LLDP,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_MMRP,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_MVRP,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_RPVST,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_DHCP,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_IGMP_QUERY,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_IGMP_V1_REPORT,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_IGMP_V2_REPORT,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_IGMP_V2_LEAVE,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_IGMP_V3_REPORT,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_ARPBC,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_ARPUC,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_MTUERROR,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_TTLERROR,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_LBERROR,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_OSPF,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_IP2ME,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_RTR_INGRESS0,
},
{
.func = mlxsw_sp_rx_listener_func,
.local_port = MLXSW_PORT_DONT_CARE,
.trap_id = MLXSW_TRAP_ID_HOST_MISS_IPV4,
},
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, STP),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, LACP),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, EAPOL),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, LLDP),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, MMRP),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, MVRP),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, RPVST),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, DHCP),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, IGMP_QUERY),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, IGMP_V1_REPORT),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, IGMP_V2_REPORT),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, IGMP_V2_LEAVE),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, IGMP_V3_REPORT),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, ARPBC),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, ARPUC),
/* L3 traps */
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, MTUERROR),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, TTLERROR),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, LBERROR),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, OSPF),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, IP2ME),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, RTR_INGRESS0),
MLXSW_SP_RXL(mlxsw_sp_rx_listener_func, HOST_MISS_IPV4),
};
static int mlxsw_sp_traps_init(struct mlxsw_sp *mlxsw_sp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册