return err;
mlxsw_reg_hpkt_pack(hpkt_pl, MLXSW_REG_HPKT_ACTION_TRAP_TO_CPU,
- MLXSW_TRAP_ID_ETHEMAD);
+ MLXSW_TRAP_ID_ETHEMAD,
+ MLXSW_REG_HTGT_TRAP_GROUP_EMAD, false);
return mlxsw_reg_write(mlxsw_core, MLXSW_REG(hpkt), hpkt_pl);
}
mlxsw_core->emad.use_emad = false;
mlxsw_reg_hpkt_pack(hpkt_pl, MLXSW_REG_HPKT_ACTION_DISCARD,
- MLXSW_TRAP_ID_ETHEMAD);
+ MLXSW_TRAP_ID_ETHEMAD,
+ MLXSW_REG_HTGT_TRAP_GROUP_EMAD, false);
mlxsw_reg_write(mlxsw_core, MLXSW_REG(hpkt), hpkt_pl);
mlxsw_core_rx_listener_unregister(mlxsw_core,
if (err)
return err;
- mlxsw_reg_hpkt_pack(hpkt_pl, listener->action, listener->trap_id);
- err = mlxsw_reg_write(mlxsw_core, MLXSW_REG(hpkt), hpkt_pl);
+ mlxsw_reg_hpkt_pack(hpkt_pl, listener->action, listener->trap_id,
+ listener->trap_group, listener->is_ctrl);
+ err = mlxsw_reg_write(mlxsw_core, MLXSW_REG(hpkt), hpkt_pl);
if (err)
goto err_trap_set;
if (!listener->is_event) {
mlxsw_reg_hpkt_pack(hpkt_pl, listener->unreg_action,
- listener->trap_id);
+ listener->trap_id, listener->trap_group,
+ listener->is_ctrl);
mlxsw_reg_write(mlxsw_core, MLXSW_REG(hpkt), hpkt_pl);
}
/* reg_hpkt_ctrl
* Configure dedicated buffer resources for control packets.
+ * Ignored by SwitchX-2.
* 0 - Keep factory defaults.
* 1 - Do not use control buffer for this trap ID.
* 2 - Use control buffer for this trap ID.
*/
MLXSW_ITEM32(reg, hpkt, ctrl, 0x04, 16, 2);
-static inline void mlxsw_reg_hpkt_pack(char *payload, u8 action, u16 trap_id)
+static inline void mlxsw_reg_hpkt_pack(char *payload, u8 action, u16 trap_id,
+ enum mlxsw_reg_htgt_trap_group trap_group,
+ bool is_ctrl)
{
- enum mlxsw_reg_htgt_trap_group trap_group;
-
MLXSW_REG_ZERO(hpkt, payload);
mlxsw_reg_hpkt_ack_set(payload, MLXSW_REG_HPKT_ACK_NOT_REQUIRED);
mlxsw_reg_hpkt_action_set(payload, action);
- switch (trap_id) {
- case MLXSW_TRAP_ID_ETHEMAD:
- case MLXSW_TRAP_ID_PUDE:
- trap_group = MLXSW_REG_HTGT_TRAP_GROUP_EMAD;
- break;
- default:
- trap_group = MLXSW_REG_HTGT_TRAP_GROUP_RX;
- break;
- }
mlxsw_reg_hpkt_trap_group_set(payload, trap_group);
mlxsw_reg_hpkt_trap_id_set(payload, trap_id);
- mlxsw_reg_hpkt_ctrl_set(payload, MLXSW_REG_HPKT_CTRL_PACKET_DEFAULT);
+ mlxsw_reg_hpkt_ctrl_set(payload, is_ctrl ?
+ MLXSW_REG_HPKT_CTRL_PACKET_USE_BUFFER :
+ MLXSW_REG_HPKT_CTRL_PACKET_NO_BUFFER);
}
/* RGCR - Router General Configuration Register
return mlxsw_sp_rx_listener_no_mark_func(skb, local_port, priv);
}
-#define MLXSW_SP_RXL_NO_MARK(_trap_id, _action) \
- MLXSW_RXL(mlxsw_sp_rx_listener_no_mark_func, _trap_id, _action, \
- DISCARD)
+#define MLXSW_SP_RXL_NO_MARK(_trap_id, _action, _is_ctrl) \
+ MLXSW_RXL(mlxsw_sp_rx_listener_no_mark_func, _trap_id, _action, \
+ _is_ctrl, DISCARD)
-#define MLXSW_SP_RXL_MARK(_trap_id, _action) \
+#define MLXSW_SP_RXL_MARK(_trap_id, _action, _is_ctrl) \
MLXSW_RXL(mlxsw_sp_rx_listener_mark_func, _trap_id, _action, \
- DISCARD)
+ _is_ctrl, DISCARD)
static const struct mlxsw_listener mlxsw_sp_listener[] = {
/* Events */
MLXSW_EVENTL(mlxsw_sp_pude_event_func, PUDE),
/* L2 traps */
- MLXSW_SP_RXL_NO_MARK(STP, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(LACP, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(LLDP, TRAP_TO_CPU),
- MLXSW_SP_RXL_MARK(DHCP, MIRROR_TO_CPU),
- MLXSW_SP_RXL_MARK(IGMP_QUERY, MIRROR_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(IGMP_V1_REPORT, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(IGMP_V2_REPORT, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(IGMP_V2_LEAVE, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(IGMP_V3_REPORT, TRAP_TO_CPU),
- MLXSW_SP_RXL_MARK(ARPBC, MIRROR_TO_CPU),
- MLXSW_SP_RXL_MARK(ARPUC, MIRROR_TO_CPU),
+ MLXSW_SP_RXL_NO_MARK(STP, TRAP_TO_CPU, true),
+ MLXSW_SP_RXL_NO_MARK(LACP, TRAP_TO_CPU, true),
+ MLXSW_SP_RXL_NO_MARK(LLDP, TRAP_TO_CPU, true),
+ MLXSW_SP_RXL_MARK(DHCP, MIRROR_TO_CPU, false),
+ MLXSW_SP_RXL_MARK(IGMP_QUERY, MIRROR_TO_CPU, false),
+ MLXSW_SP_RXL_NO_MARK(IGMP_V1_REPORT, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_NO_MARK(IGMP_V2_REPORT, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_NO_MARK(IGMP_V2_LEAVE, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_NO_MARK(IGMP_V3_REPORT, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_MARK(ARPBC, MIRROR_TO_CPU, false),
+ MLXSW_SP_RXL_MARK(ARPUC, MIRROR_TO_CPU, false),
/* L3 traps */
- MLXSW_SP_RXL_NO_MARK(MTUERROR, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(TTLERROR, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(LBERROR, TRAP_TO_CPU),
- MLXSW_SP_RXL_MARK(OSPF, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(IP2ME, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(RTR_INGRESS0, TRAP_TO_CPU),
- MLXSW_SP_RXL_NO_MARK(HOST_MISS_IPV4, TRAP_TO_CPU),
+ MLXSW_SP_RXL_NO_MARK(MTUERROR, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_NO_MARK(TTLERROR, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_NO_MARK(LBERROR, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_MARK(OSPF, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_NO_MARK(IP2ME, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_NO_MARK(RTR_INGRESS0, TRAP_TO_CPU, false),
+ MLXSW_SP_RXL_NO_MARK(HOST_MISS_IPV4, TRAP_TO_CPU, false),
};
static int mlxsw_sp_traps_init(struct mlxsw_sp *mlxsw_sp)