BroadView™ API Guide and Reference Manual
packet_trace.h
Go to the documentation of this file.
1 
9 /*****************************************************************************
10  *
11  * Copyright © 2016 Broadcom. The term "Broadcom" refers
12  * to Broadcom Limited and/or its subsidiaries.
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  *
17  * You may obtain a copy of the License at
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  *
26  ***************************************************************************/
27 
28 #ifndef INCLUDE_PACKET_TRACE_H
29 #define INCLUDE_PACKET_TRACE_H
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35 
36 #include "broadview.h"
37 #include "asic.h"
38 #include "sbplugin.h"
39 #include "port_utils.h"
40 
41 #define BVIEW_PT_MAX_PACKET_SIZE 1558
42 
43 /* maximum allowed wild cards */
44 #define BVIEW_PT_MAX_WC 3
45 #define BVIEW_PT_MIN_PROTOCOL 0
46 #define BVIEW_PT_MAX_PROTOCOL 144
47 
48 #define BVIEW_PT_MIN_SRC_PORT 0
49 #define BVIEW_PT_MAX_SRC_PORT 65535
50 
51 #define BVIEW_PT_MIN_DST_PORT 0
52 #define BVIEW_PT_MAX_DST_PORT 65535
53 
54 #define BVIEW_PT_MIN_PACKET_LIMIT 1
55 #define BVIEW_PT_MAX_PACKET_LIMIT 10
56 
57 
58 
59 /* Packet Including Checksum*/
60 typedef struct
61 {
62  unsigned char data[BVIEW_PT_MAX_PACKET_SIZE];
63  unsigned int pkt_len;
65 
66 
67 /* Drop Reason Types*/
68 typedef enum _pt_drop_reason_type_
69 {
70  BVIEW_PT_VLAN_XLATE_MISS_DROP,
71  BVIEW_PT_BPDU_DROP,
72  BVIEW_PT_PROTOCOL_PKT_DROP,
73  BVIEW_PT_CML_DROP,
74  BVIEW_PT_SRC_ROUTE_DROP,
75  BVIEW_PT_L2_SRC_DISCARD_DROP,
76  BVIEW_PT_L2SRC_STATIC_MOVE_DROP,
77  BVIEW_PT_L2DST_DISCARD_DROP,
78  BVIEW_PT_CFI_OR_L3DISABLE_DROP,
79  BVIEW_PT_HIGIG_MH_TYPE1_DROP,
80  BVIEW_PT_DISC_STAGE_DROP,
81  BVIEW_PT_SW1_INVALID_VLAN_DROP,
82  BVIEW_PT_HIGIG_HDR_ERROR_DROP,
83  BVIEW_PT_LAG_FAILOVER_DROP,
84  BVIEW_PT_MACSA0_DROP,
85  BVIEW_PT_VFP_DROP,
86  BVIEW_PT_VLAN_CC_OR_PBT_DROP,
87  BVIEW_PT_CLASS_BASED_SM_DROP,
88  BVIEW_PT_MPLS_STAGE_DROP,
89  BVIEW_PT_TIME_SYNC_PKT_DROP,
90  BVIEW_PT_MY_STATION_DROP,
91  BVIEW_PT_BAD_UDP_CHECKSUM_DROP,
92  BVIEW_PT_NIV_FORWARDING_DROP,
93  BVIEW_PT_NIV_RPF_CHECK_FAIL_DROP,
94  BVIEW_PT_PVLAN_VP_EFILTER_DROP,
95  BVIEW_PT_TRILL_HEADER_VERSION_NONZERO_DROP,
96  BVIEW_PT_TRILL_ADJACENCY_CHECK_FAIL_DROP,
97  BVIEW_PT_TRILL_RBRIDGE_LOOKUP_MISS_DROP,
98  BVIEW_PT_TRILL_UC_HDR_MC_MACDA_DROP,
99  BVIEW_PT_TRILL_SLOWPATH_DROP,
100  BVIEW_PT_CORE_IS_IS_PKT_DROP,
101  BVIEW_PT_TRILL_RPF_CHECK_FAIL_DROP,
102  BVIEW_PT_TRILL_PKT_WITH_SNAP_ENCAP_DROP,
103  BVIEW_PT_TRILL_ING_RBRIDGE_EQ_EGR_RBRIDGE_DROP,
104  BVIEW_PT_TRILL_HOPCOUNT_CHECK_FAIL_DROP,
105  BVIEW_PT_BFD_TERMINATED_DROP,
106  BVIEW_PT_L3DST_DISCARD_DROP,
107  BVIEW_PT_TUNNEL_DECAP_ECN_DROP,
108  BVIEW_PT_L3_PKT_RESOURCE_DROP,
109  BVIEW_PT_IPV4_HEADER_ERROR_DROP,
110  BVIEW_PT_L3_IPV6_PKT_RESOURCE_DROP,
111  BVIEW_PT_IPV6_HEADER_ERROR_DROP,
112  BVIEW_PT_INGRESS_PORT_FWD_STATE_DROP,
113  BVIEW_PT_FIELD_PROCESSOR_DROP,
114  BVIEW_PT_MULTICAST_DROP,
115  BVIEW_PT_BITMAP_ZERO_DROP,
116  BVIEW_PT_POLICY_DROP,
117  BVIEW_PT_DOS_L4_HEADER_ERROR_DROP,
118  BVIEW_PT_MTU_ERROR_DROP,
119  BVIEW_PT_RECV_TUNNELED_PKT_ERROR_DROP,
120  BVIEW_PT_VLAN_ERROR_DROP,
121  BVIEW_PT_HIGIG_HEADER_ERROR_DROP,
122  BVIEW_PT_MC_IPMC_INDEX_ERROR_DROP,
123  BVIEW_PT_PARITY_ERROR_DROP,
124  BVIEW_PT_REVERSE_RPF_ERROR_DROP,
125  BVIEW_PT_DST_DISCARD_BIT_ERROR_DROP,
126  BVIEW_PT_ECMP_CALCULATION_ERROR_DROP,
127  BVIEW_PT_MPLS_SEQ_NUM_ERROR_DROP,
128  BVIEW_PT_FIELD_PROCESSOR_REDIRECT_ERROR_DROP,
129  BVIEW_PT_INVALID_L2MC_ENTRY_DROP,
130  BVIEW_PT_NEXTHOP_ZERO_DROP,
131  /* This should be last always*/
132  BVIEW_PT_MAX_DROP_REASON
133 } BVIEW_PT_DROP_REASON_TYPE_t;
134 
135 /*Drop Counters report*/
137 {
138  struct _counter_
139  {
140  uint64_t counter;
141  } data[BVIEW_PT_MAX_DROP_REASON][BVIEW_ASIC_MAX_PORTS];
142 
144 
145 
146 /* Callback Data when packet is droped with configured drop reason*/
147 typedef struct _pt_drop_reason_data_
148 {
149  BVIEW_PT_DROP_REASON_TYPE_t dropReason;
150  int port;
151  BVIEW_PT_PACKET_t packet;
153 
154 /* The callback for invoking when a packet is droped */
155 typedef BVIEW_STATUS(*BVIEW_PT_TRIGGER_CALLBACK_t) (int asic,
156  void *cookie,
157  BVIEW_PT_DROP_REASON_DATA_t dropReasonData);
158 
159 
160 typedef struct
161 {
162  BVIEW_MASK_BASE_UNIT value[BVIEW_MASK_SIZE(BVIEW_PT_MAX_DROP_REASON)];
164 
165 /* Drop Reason Configuration*/
167 {
168  /* Mask of Drop Reasons */
169  BVIEW_PT_DROP_REASON_MASK_t dropReasonMask;
170  /* Port Bitmap */
171  BVIEW_PORT_MASK_t pbmp;
172  /* Determines whether the send copy of the dropped packets or not.*/
173  bool sendDropedPacket;
174  /* Determines whether a trace-profile be sent for each dropped packet. */
175  bool traceProfile;
176  /* Number of packets (default 1) to be sent for a given drop reason.*/
177  int packetCount;
178  /* A minimum number of packets to be dropped,
179  * exceeding which the dropped packet will be sent to the requestor.*/
180  int packetThreshold;
181 
183 
184 
185 
186 typedef enum _bview_pt_hashing_info_mask_
187 {
188  BVIEW_PT_NO_HASHING_RESOLUTION = 1<<0,
189  /* level 1 ecmp hashing resolution done */
190  BVIEW_PT_ECMP_1_RESOLUTION = 1<<1,
191  /* level 2 ecmp hashing resolution done */
192  BVIEW_PT_ECMP_2_RESOLUTION = 1<<2,
193  /* trunk hashing resolution done*/
194  BVIEW_PT_TRUNK_RESOLUTION = 1<<3,
195  /* hg trunk hashing resolution done*/
196  BVIEW_PT_FABRIC_TRUNK_RESOLUTION = 1<<4,
197  /* Destination port resolution done */
198  BVIEW_PT_DGPP_RESOLUTION = 1 <<5
199 } BVIEW_PT_HASHING_INFO_MASK_t;
200 
201 
202 #define BVIEW_MAX_TRUNK_MEMBERS 8
204 {
205  int trunk; /* destination trunk group */
206  int trunk_member; /* destination member port which packet egress. */
207  int trunk_members[BVIEW_MAX_TRUNK_MEMBERS]; /* Port Bitmap of trunk members*/
208  int fabric_trunk; /* destination hg trunk group */
209  int fabric_trunk_member; /* destination member hg port which packet will egress. */
210  int fabric_trunk_members[BVIEW_MAX_TRUNK_MEMBERS]; /* Port Bitmap of trunk members*/
212 
213 #define BVIEW_ECMP_MAX_MEMBERS 8
214 
216 {
217  int member; /* member information */
218  int port; /* port */
219  int ip; /* IP */
221 
223 {
224  int ecmp_group; /* multipath egress forwarding object. */
225  BVIEW_ECMP_MEMBER_t ecmp_group_members[BVIEW_ECMP_MAX_MEMBERS];
226  BVIEW_ECMP_MEMBER_t ecmp_egress_info;
228 
229 #define PKT_TRACE_ECMP_1_INDEX 0
230 #define PKT_TRACE_ECMP_2_INDEX 1
231 #define BVIEW_ECMP_MAX_LEVEL 2
232 
233 
234 /* packet hashing resolution information */
235 typedef struct _bview_pt_hashing_info_
236 {
237  BVIEW_PT_HASHING_INFO_MASK_t flags;
239  BVIEW_PT_ECMP_HASHING_INFO_t ecmp[BVIEW_ECMP_MAX_LEVEL];
241 
242 
243 /* packet trace resolution enums */
244 typedef enum _pt_resolution_type_t
245 {
246  BVIEW_PT_RESOLUTIONUNKOWN = 0,
247  BVIEW_PT_RESOLUTIONCONTROLPKT = 1, /* 1 */
248  BVIEW_PT_RESOLUTIONOAMPKT = 2,
249  BVIEW_PT_RESOLUTIONBFDPKT = 3,
250  BVIEW_PT_RESOLUTIONBPDUPKT = 4,
251  BVIEW_PT_RESOLUTION1588PKT = 6,
252  BVIEW_PT_RESOLUTIONKNOWNL2UCPKT = 8,
253  BVIEW_PT_RESOLUTIONUNKNOWNL2UCPKT = 9,
254  BVIEW_PT_RESOLUTIONKNOWNL2MCPKT = 10,
255  BVIEW_PT_RESOLUTIONUNKNOWNL2MCPKT = 11,
256  BVIEW_PT_RESOLUTIONL2BCPKT = 12,
257  BVIEW_PT_RESOLUTIONKNOWNL3UCPKT = 16,
258  BVIEW_PT_RESOLUTIONUNKNOWNL3UCPKT = 17,
259  BVIEW_PT_RESOLUTIONKNOWNIPMCPKT = 18,
260  BVIEW_PT_RESOLUTIONUNKNOWNIPMCPKT = 19,
261  BVIEW_PT_RESOLUTIONKNOWNMPLSL2PKT = 24,
262  BVIEW_PT_RESOLUTIONUNKNOWNMPLSPKT = 25,
263  BVIEW_PT_RESOLUTIONKNOWNMPLSL3PKT = 26,
264  BVIEW_PT_RESOLUTIONKNOWNMPLSPKT = 28,
265  BVIEW_PT_RESOLUTIONKNOWNMIMPKT = 32,
266  BVIEW_PT_RESOLUTIONUNKNOWNMIMPKT = 33,
267  BVIEW_PT_RESOLUTIONKNOWNTRILLPKT = 40,
268  BVIEW_PT_RESOLUTIONUNKNOWNTRILLPKT = 41,
269  BVIEW_PT_RESOLUTIONKNOWNNIVPKT = 48,
270  BVIEW_PT_RESOLUTIONUNKNOWNNIVPKT = 49,
271  BVIEW_PT_RESOLUTIONKNOWNL2GREPKT = 50,
272  BVIEW_PT_RESOLUTIONKNOWNVXLANPKT = 51,
273  BVIEW_PT_RESOLUTIONCOUNT = 52
274 } BVIEW_PT_RESOULTION_t;
275 
276 /* packet trace lookup result enums */
277 typedef enum _pt_lookup_result_type_
278 {
279  BVIEW_PT_LOOKUPINVALID = 0,
280  BVIEW_PT_LOOKUPFIRSTVLANTRANSLATIONHIT = 1,
281  BVIEW_PT_LOOKUPSECONDVLANTRANSLATIONHIT = 2,
282  BVIEW_PT_LOOKUPFORWARDINGVLANVALID = 3,
283  BVIEW_PT_LOOKUPL2SRCHIT = 6,
284  BVIEW_PT_LOOKUPL2SRCSTATIC = 7,
285  BVIEW_PT_LOOKUPL2DSTHIT = 8,
286  BVIEW_PT_LOOKUPL2CACHEHIT = 9,
287  BVIEW_PT_LOOKUPL3SRCHOSTHIT = 10,
288  BVIEW_PT_LOOKUPL3DESTHOSTHIT = 11,
289  BVIEW_PT_LOOKUPL3DESTROUTEHIT = 12,
290  BVIEW_PT_LOOKUPL2SRCMISS = 13,
291  BVIEW_PT_LOOKUPDOSATTACK = 14,
292  BVIEW_PT_LOOKUPIPTUNNELHIT = 15,
293  BVIEW_PT_LOOKUPMPLSLABEL1HIT = 16,
294  BVIEW_PT_LOOKUPMPLSLABEL2HIT = 17,
295  BVIEW_PT_LOOKUPMPLSTERMINATED = 18,
296  BVIEW_PT_LOOKUPMYSTATIONHIT = 19,
297  BVIEW_PT_LOOKUPCOUNT = 20
298 } BVIEW_PT_LOOKUP_RESULT_TYPE_t;
299 
300 
301 /* lookup result set bit map */
302 typedef struct
303 {
304  BVIEW_MASK_BASE_UNIT value[BVIEW_MASK_SIZE(BVIEW_PT_LOOKUPCOUNT)]; /* bit map for packet trace lookup result set */
306 
307 
308 typedef enum _stp_state_
309 {
310  BVIEW_DISABLED =0,
311  BVIEW_FORWARDING,
312  BVIEW_DISCRADING,
313  BVIEW_LEARNING
314 } BVIEW_PT_STP_STATE_t;
315 
316 /* Trace Profile */
317 typedef struct _pt_trace_profile_
318 {
319  /* port*/
320  int port;
321  /* Packet Including Checksum*/
322  BVIEW_PT_PACKET_t packet;
323  /* packet trace lookup status */
324  BVIEW_PT_LOOKUP_RESULT_MASK_t lookupResult;
325  /* packet trace resolution result */
326  BVIEW_PT_RESOULTION_t packetResolution;
327  /* packet trace hashing information */
328  BVIEW_PT_HASHING_INFO_t hashingInfo;
329  /* packet trace ingress stp state */
330  BVIEW_PT_STP_STATE_t stpState;
331  /* Mask of destination ports*/
332  BVIEW_PORT_MASK_t destPortMask;
334 
335 
336 
337 typedef enum _pt_config_tuple_mask_ {
338  PT_CONFIG_TUPLE_SRC_IP = (1 << 0),
339  PT_CONFIG_TUPLE_DST_IP = (1 << 1),
340  PT_CONFIG_TUPLE_PROTOCOL = (1 << 2),
341  PT_CONFIG_TUPLE_SRC_PORT = (1 << 3),
342  PT_CONFIG_TUPLE_DST_PORT = (1 << 4)
343 }PT_CONFIG_TUPLE_MASK_t;
344 
345 /* 5-tuple information place holder */
346 typedef struct _pt_5_tuple_params_s_
347 {
348  unsigned int src_ip;
349  unsigned int dst_ip;
350  unsigned int protocol;
351  unsigned int src_port;
352  unsigned int dst_port;
353  unsigned int tuple_mask;
355 
356 
357 #ifdef __cplusplus
358 }
359 /* __doxy_func_body_end__ */
360 #endif
361 
362 
363 #endif /* INCLUDE_PACKET_TRACE_H */
364