1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /* Copyright (c) 2015-2018 Mellanox Technologies. All rights reserved */
3 
4 #ifndef _MLXSW_TRAP_H
5 #define _MLXSW_TRAP_H
6 
7 enum {
8 	/* Ethernet EMAD and FDB miss */
9 	MLXSW_TRAP_ID_FDB_MC = 0x01,
10 	MLXSW_TRAP_ID_ETHEMAD = 0x05,
11 	/* L2 traps for specific packet types */
12 	MLXSW_TRAP_ID_STP = 0x10,
13 	MLXSW_TRAP_ID_LACP = 0x11,
14 	MLXSW_TRAP_ID_EAPOL = 0x12,
15 	MLXSW_TRAP_ID_LLDP = 0x13,
16 	MLXSW_TRAP_ID_MMRP = 0x14,
17 	MLXSW_TRAP_ID_MVRP = 0x15,
18 	MLXSW_TRAP_ID_RPVST = 0x16,
19 	MLXSW_TRAP_ID_DHCP = 0x19,
20 	MLXSW_TRAP_ID_PTP0 = 0x28,
21 	MLXSW_TRAP_ID_PTP1 = 0x29,
22 	MLXSW_TRAP_ID_IGMP_QUERY = 0x30,
23 	MLXSW_TRAP_ID_IGMP_V1_REPORT = 0x31,
24 	MLXSW_TRAP_ID_IGMP_V2_REPORT = 0x32,
25 	MLXSW_TRAP_ID_IGMP_V2_LEAVE = 0x33,
26 	MLXSW_TRAP_ID_IGMP_V3_REPORT = 0x34,
27 	MLXSW_TRAP_ID_PKT_SAMPLE = 0x38,
28 	MLXSW_TRAP_ID_FID_MISS = 0x3D,
29 	MLXSW_TRAP_ID_DECAP_ECN0 = 0x40,
30 	MLXSW_TRAP_ID_ARPBC = 0x50,
31 	MLXSW_TRAP_ID_ARPUC = 0x51,
32 	MLXSW_TRAP_ID_MTUERROR = 0x52,
33 	MLXSW_TRAP_ID_TTLERROR = 0x53,
34 	MLXSW_TRAP_ID_LBERROR = 0x54,
35 	MLXSW_TRAP_ID_IPV4_OSPF = 0x55,
36 	MLXSW_TRAP_ID_IPV4_PIM = 0x58,
37 	MLXSW_TRAP_ID_IPV4_VRRP = 0x59,
38 	MLXSW_TRAP_ID_RPF = 0x5C,
39 	MLXSW_TRAP_ID_IP2ME = 0x5F,
40 	MLXSW_TRAP_ID_IPV6_UNSPECIFIED_ADDRESS = 0x60,
41 	MLXSW_TRAP_ID_IPV6_LINK_LOCAL_DEST = 0x61,
42 	MLXSW_TRAP_ID_IPV6_LINK_LOCAL_SRC = 0x62,
43 	MLXSW_TRAP_ID_IPV6_ALL_NODES_LINK = 0x63,
44 	MLXSW_TRAP_ID_IPV6_OSPF = 0x64,
45 	MLXSW_TRAP_ID_IPV6_MLDV12_LISTENER_QUERY = 0x65,
46 	MLXSW_TRAP_ID_IPV6_MLDV1_LISTENER_REPORT = 0x66,
47 	MLXSW_TRAP_ID_IPV6_MLDV1_LISTENER_DONE = 0x67,
48 	MLXSW_TRAP_ID_IPV6_MLDV2_LISTENER_REPORT = 0x68,
49 	MLXSW_TRAP_ID_IPV6_DHCP = 0x69,
50 	MLXSW_TRAP_ID_IPV6_ALL_ROUTERS_LINK = 0x6F,
51 	MLXSW_TRAP_ID_RTR_INGRESS0 = 0x70,
52 	MLXSW_TRAP_ID_RTR_INGRESS1 = 0x71,
53 	MLXSW_TRAP_ID_IPV6_PIM = 0x79,
54 	MLXSW_TRAP_ID_IPV6_VRRP = 0x7A,
55 	MLXSW_TRAP_ID_IPV4_BGP = 0x88,
56 	MLXSW_TRAP_ID_IPV6_BGP = 0x89,
57 	MLXSW_TRAP_ID_L3_IPV6_ROUTER_SOLICITATION = 0x8A,
58 	MLXSW_TRAP_ID_L3_IPV6_ROUTER_ADVERTISEMENT = 0x8B,
59 	MLXSW_TRAP_ID_L3_IPV6_NEIGHBOR_SOLICITATION = 0x8C,
60 	MLXSW_TRAP_ID_L3_IPV6_NEIGHBOR_ADVERTISEMENT = 0x8D,
61 	MLXSW_TRAP_ID_L3_IPV6_REDIRECTION = 0x8E,
62 	MLXSW_TRAP_ID_IPV4_DHCP = 0x8F,
63 	MLXSW_TRAP_ID_HOST_MISS_IPV4 = 0x90,
64 	MLXSW_TRAP_ID_IPV6_MC_LINK_LOCAL_DEST = 0x91,
65 	MLXSW_TRAP_ID_HOST_MISS_IPV6 = 0x92,
66 	MLXSW_TRAP_ID_IPIP_DECAP_ERROR = 0xB1,
67 	MLXSW_TRAP_ID_NVE_DECAP_ARP = 0xB8,
68 	MLXSW_TRAP_ID_NVE_ENCAP_ARP = 0xBD,
69 	MLXSW_TRAP_ID_IPV4_BFD = 0xD0,
70 	MLXSW_TRAP_ID_IPV6_BFD = 0xD1,
71 	MLXSW_TRAP_ID_ROUTER_ALERT_IPV4 = 0xD6,
72 	MLXSW_TRAP_ID_ROUTER_ALERT_IPV6 = 0xD7,
73 	MLXSW_TRAP_ID_DISCARD_NON_ROUTABLE = 0x11A,
74 	MLXSW_TRAP_ID_DISCARD_ROUTER2 = 0x130,
75 	MLXSW_TRAP_ID_DISCARD_ROUTER3 = 0x131,
76 	MLXSW_TRAP_ID_DISCARD_ING_PACKET_SMAC_MC = 0x140,
77 	MLXSW_TRAP_ID_DISCARD_ING_SWITCH_VTAG_ALLOW = 0x148,
78 	MLXSW_TRAP_ID_DISCARD_ING_SWITCH_VLAN = 0x149,
79 	MLXSW_TRAP_ID_DISCARD_ING_SWITCH_STP = 0x14A,
80 	MLXSW_TRAP_ID_DISCARD_LOOKUP_SWITCH_UC = 0x150,
81 	MLXSW_TRAP_ID_DISCARD_LOOKUP_SWITCH_MC_NULL = 0x151,
82 	MLXSW_TRAP_ID_DISCARD_LOOKUP_SWITCH_LB = 0x152,
83 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_NON_IP_PACKET = 0x160,
84 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_UC_DIP_MC_DMAC = 0x161,
85 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_DIP_LB = 0x162,
86 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_SIP_MC = 0x163,
87 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_SIP_CLASS_E = 0x164,
88 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_SIP_LB = 0x165,
89 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_CORRUPTED_IP_HDR = 0x167,
90 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_MC_DMAC = 0x168,
91 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_SIP_DIP = 0x169,
92 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_IPV4_SIP_BC = 0x16A,
93 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_IPV4_DIP_LOCAL_NET = 0x16B,
94 	MLXSW_TRAP_ID_DISCARD_ING_ROUTER_DIP_LINK_LOCAL = 0x16C,
95 	MLXSW_TRAP_ID_DISCARD_ROUTER_IRIF_EN = 0x178,
96 	MLXSW_TRAP_ID_DISCARD_ROUTER_ERIF_EN = 0x179,
97 	MLXSW_TRAP_ID_DISCARD_ROUTER_LPM4 = 0x17B,
98 	MLXSW_TRAP_ID_DISCARD_ROUTER_LPM6 = 0x17C,
99 	MLXSW_TRAP_ID_DISCARD_DEC_PKT = 0x188,
100 	MLXSW_TRAP_ID_DISCARD_OVERLAY_SMAC_MC = 0x190,
101 	MLXSW_TRAP_ID_DISCARD_IPV6_MC_DIP_RESERVED_SCOPE = 0x1B0,
102 	MLXSW_TRAP_ID_DISCARD_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE = 0x1B1,
103 	MLXSW_TRAP_ID_ACL0 = 0x1C0,
104 	/* Multicast trap used for routes with trap action */
105 	MLXSW_TRAP_ID_ACL1 = 0x1C1,
106 	/* Multicast trap used for routes with trap-and-forward action */
107 	MLXSW_TRAP_ID_ACL2 = 0x1C2,
108 	MLXSW_TRAP_ID_DISCARD_INGRESS_ACL = 0x1C3,
109 	MLXSW_TRAP_ID_DISCARD_EGRESS_ACL = 0x1C4,
110 
111 	MLXSW_TRAP_ID_MAX = 0x1FF
112 };
113 
114 enum mlxsw_event_trap_id {
115 	/* Port Up/Down event generated by hardware */
116 	MLXSW_TRAP_ID_PUDE = 0x8,
117 	/* PTP Ingress FIFO has a new entry */
118 	MLXSW_TRAP_ID_PTP_ING_FIFO = 0x2D,
119 	/* PTP Egress FIFO has a new entry */
120 	MLXSW_TRAP_ID_PTP_EGR_FIFO = 0x2E,
121 };
122 
123 #endif /* _MLXSW_TRAP_H */
124