Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
openapi_instru_packet_trace.h
Go to the documentation of this file.
1 
9 /*********************************************************************
10 *
11 * Copyright 2016-2018 Broadcom.
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 **********************************************************************
26 *
27 * @filename openapi_instru_pt.h
28 *
29 * @purpose Instrumentation PT Specific APIs
30 *
31 * @component OPEN
32 *
33 * @create 03/27/2015
34 *
35 * @end
36 *
37 **********************************************************************/
38 
39 
40 #ifndef OPENAPI_PT_H_INCLUDED
41 #define OPENAPI_PT_H_INCLUDED
42 #include <string.h>
43 #include <stdio.h>
44 #include <stdbool.h>
45 
46 #include "openapi_common.h"
47 #include "openapi_instru_nos.h"
48 #include "openapi_tcam.h"
49 
51 #define OPEN_PT_MAX_PACKET_SIZE OPEN_INSTRU_MAX_PACKET_SIZE
52 
54 #define OPEN_MASK_BASE_UNIT unsigned int
55 #define OPEN_MASKWID 32
56 
58 #define OPEN_MASK_SIZE(_max) (((_max) + OPEN_MASKWID - 1) / OPEN_MASKWID)
59 
60 /* Instru Packet trace policy match rule number */
61 #define OPEN_PT_MATCH_RULE_NUM 61
62 
63 /* Packet metering related defines */
64 #define OPEN_PT_CPU_RATE_LIMIT 3
65 #define OPEN_PT_CPU_RATE_LIMIT_BURST 3
66 
68 typedef struct
69 {
70  unsigned char data[OPEN_PT_MAX_PACKET_SIZE];
71  unsigned int pkt_len;
73 
74 /* Drop reasons */
75 typedef enum
76 {
77  OPEN_PT_NO_DROP = 1,
78  OPEN_PT_DROP_REASON_INTERNAL,
79  OPEN_PT_DROP_REASON_MPLS_LABEL_LKUP_MISS,
80  OPEN_PT_DROP_REASON_MPLS_INVALID_ACTION,
81  OPEN_PT_DROP_REASON_MPLS_INVALID_PAYLOAD,
82  OPEN_PT_DROP_REASON_MPLS_TTL_CHECK_FAIL,
83  OPEN_PT_DROP_REASON_MPLS_INVALID_CTRL_WORD,
84  OPEN_PT_DROP_REASON_L2_GRE_SIP_LKUP_MISS,
85  OPEN_PT_DROP_REASON_L2_GRE_VPN_LKUP_MISS,
86  OPEN_PT_DROP_REASON_L2_GRE_TUNNEL_ERROR,
87  OPEN_PT_DROP_REASON_VXLAN_SIP_LKUP_MISS,
88  OPEN_PT_DROP_REASON_VXLAN_VNID_LKUP_MISS,
89  OPEN_PT_DROP_REASON_VXLAN_TUNNEL_ERROR,
90  OPEN_PT_DROP_REASON_VLAN_NOT_VALID,
91  OPEN_PT_DROP_REASON_ING_PORT_NOT_IN_VLAN_MEMBER,
92  OPEN_PT_DROP_REASON_TPID_MISMATCH,
93  OPEN_PT_DROP_REASON_IPV4_PROTO_ERROR,
94  OPEN_PT_DROP_REASON_HIGIG_LP_BACK,
95  OPEN_PT_DROP_REASON_HIGIG_MIRROR_ONLY,
96  OPEN_PT_DROP_REASON_HIGIG_UNKNOWN_HDR,
97  OPEN_PT_DROP_REASON_HIGIG_UNKNOWN_OP_CODE,
98  OPEN_PT_DROP_REASON_LAG_FAIL_LP_BACK,
99  OPEN_PT_DROP_REASON_L2_SRC_EQ_L2_DST,
100  OPEN_PT_DROP_REASON_IPV6_PROTO_ERROR,
101  OPEN_PT_DROP_REASON_NIV_VNTAG_PRESENT,
102  OPEN_PT_DROP_REASON_NIV_VNTAG_NOT_PRESENT,
103  OPEN_PT_DROP_REASON_NIV_VNTAG_FORMAT,
104  OPEN_PT_DROP_REASON_TRILL_ERROR_FRAME,
105  OPEN_PT_DROP_REASON_BPDU,
106  OPEN_PT_DROP_REASON_BAD_UDP_CHKSUM,
107  OPEN_PT_DROP_REASON_TUNNEL_DECAP_ECN_ERROR,
108  OPEN_PT_DROP_REASON_IPV4_HDR_ERROR,
109  OPEN_PT_DROP_REASON_IPV6_HDR_ERROR,
110  OPEN_PT_DROP_REASON_PARITY_ERROR,
111  OPEN_PT_DROP_REASON_RPF_CHK_FAIL,
112  OPEN_PT_DROP_REASON_STAGE_LKUP,
113  OPEN_PT_DROP_REASON_STAGE_INGRESS,
114  OPEN_PT_DROP_REASON_MAX = 128
115 } OPEN_PT_DROP_REASON_t;
116 
117 /* Drop location enums */
118 typedef enum _open_pt_drop_loc_s
119 {
120  OPEN_PT_NO_DROP_LOC = 1,
121  OPEN_PT_DROP_LOC_INGRESS,
122  OPEN_PT_DROP_LOC_PIPELINE,
123  OPEN_PT_DROP_LOC_EGRESS,
124 } OPEN_PT_DROP_LOC_t;
125 
126 /* This is the size of drop reason bit map interms of 32 bits */
127 #define OPEN_PT_DROP_REASON_MAX_SIZE 4
128 
129 #define OPEN_PT_DROP_REASON_STR_MAX_ELE 32
130 #define OPEN_PT_DROP_REASON_STR_SIZE 64
131 
132 /* Structure to hold drop reason information */
134 {
135  OPEN_TIME_t tv;
136  uint32_t code[OPEN_PT_DROP_REASON_MAX_SIZE];
137  uint32_t num_of_reasons;
138  char reason_str[OPEN_PT_DROP_REASON_STR_MAX_ELE][OPEN_PT_DROP_REASON_STR_SIZE];
139  OPEN_PT_DROP_LOC_t loc;
141 
142 /* Interface storage */
143 typedef struct
144 {
145  OPEN_MASK_BASE_UNIT value[OPEN_MASK_SIZE(OPEN_PT_DROP_REASON_MAX)];
147 
149 {
150  OPEN_TIME_t tv;
151  uint32_t code[OPEN_PT_DROP_REASON_MAX_SIZE];
152  OPEN_PT_DROP_LOC_t loc;
153  OPEN_PT_DROP_REASON_MASK_t reason_mask;
155 
156 
157 /* Drop counters */
159 {
160  uint64_t ingress_drop_cnt;
161  uint64_t pipeline_drop_cnt;
162  uint64_t egress_drop_cnt;
164 
166 {
167  unsigned int totalRules;
168  unsigned int ruleMatchId;
169  OPEN_TCAM_API_POLICYID_t icapPolicyHandle;
170  OPEN_TCAM_API_POLICYID_t egressPolicyHandle;
171  OPEN_TCAM_API_POLICYID_t cpuPolicyHandle;
173 
175 {
176  OPEN_PT_NO_HASHING_RESOLUTION = 0,
185 } OPEN_PT_HASHING_INFO_MASK_t;
186 
189 {
190  OPEN_PT_HASHING_INFO_MASK_t flags;
191  int ecmp_1_group;
195  int trunk;
200 
201 
204 {
205  OPEN_PT_RESOLUTIONUNKOWN = 0,
206  OPEN_PT_RESOLUTIONCONTROLPKT = 1,
208  OPEN_PT_RESOLUTIONBFDPKT = 3,
209  OPEN_PT_RESOLUTIONBPDUPKT = 4,
210  OPEN_PT_RESOLUTION1588PKT = 6,
211  OPEN_PT_RESOLUTIONKNOWNL2UCPKT = 8,
212  OPEN_PT_RESOLUTIONUNKNOWNL2UCPKT = 9,
213  OPEN_PT_RESOLUTIONKNOWNL2MCPKT = 10,
214  OPEN_PT_RESOLUTIONUNKNOWNL2MCPKT = 11,
215  OPEN_PT_RESOLUTIONL2BCPKT = 12,
216  OPEN_PT_RESOLUTIONKNOWNL3UCPKT = 16,
217  OPEN_PT_RESOLUTIONUNKNOWNL3UCPKT = 17,
218  OPEN_PT_RESOLUTIONKNOWNIPMCPKT = 18,
219  OPEN_PT_RESOLUTIONUNKNOWNIPMCPKT = 19,
220  OPEN_PT_RESOLUTIONKNOWNMPLSL2PKT = 24,
221  OPEN_PT_RESOLUTIONUNKNOWNMPLSPKT = 25,
222  OPEN_PT_RESOLUTIONKNOWNMPLSL3PKT = 26,
223  OPEN_PT_RESOLUTIONKNOWNMPLSPKT = 28,
224  OPEN_PT_RESOLUTIONKNOWNMIMPKT = 32,
225  OPEN_PT_RESOLUTIONUNKNOWNMIMPKT = 33,
226  OPEN_PT_RESOLUTIONKNOWNTRILLPKT = 40,
227  OPEN_PT_RESOLUTIONUNKNOWNTRILLPKT = 41,
228  OPEN_PT_RESOLUTIONKNOWNNIVPKT = 48,
229  OPEN_PT_RESOLUTIONUNKNOWNNIVPKT = 49,
230  OPEN_PT_RESOLUTIONKNOWNL2GREPKT = 50,
231  OPEN_PT_RESOLUTIONKNOWNVXLANPKT = 51,
232  OPEN_PT_RESOLUTIONCOUNT = 52
234 
235 
238 {
239  OPEN_PT_LOOKUPINVALID = 0,
240  OPEN_PT_LOOKUPFIRSTVLANTRANSLATIONHIT = 1,
241  OPEN_PT_LOOKUPSECONDVLANTRANSLATIONHIT = 2,
242  OPEN_PT_LOOKUPFORWARDINGVLANVALID = 3,
243  OPEN_PT_LOOKUPL2SRCHIT = 6,
244  OPEN_PT_LOOKUPL2SRCSTATIC = 7,
245  OPEN_PT_LOOKUPL2DSTHIT = 8,
246  OPEN_PT_LOOKUPL2CACHEHIT = 9,
247  OPEN_PT_LOOKUPL3SRCHOSTHIT = 10,
248  OPEN_PT_LOOKUPL3DESTHOSTHIT = 11,
249  OPEN_PT_LOOKUPL3DESTROUTEHIT = 12,
250  OPEN_PT_LOOKUPL2SRCMISS = 13,
251  OPEN_PT_LOOKUPDOSATTACK = 14,
252  OPEN_PT_LOOKUPIPTUNNELHIT = 15,
253  OPEN_PT_LOOKUPMPLSLABEL1HIT = 16,
254  OPEN_PT_LOOKUPMPLSLABEL2HIT = 17,
255  OPEN_PT_LOOKUPMPLSTERMINATED = 18,
256  OPEN_PT_LOOKUPMYSTATIONHIT = 19,
257  OPEN_PT_LOOKUPCOUNT = 20
259 
260 
262 typedef struct
263 {
264  OPEN_MASK_BASE_UNIT value[OPEN_MASK_SIZE(OPEN_PT_LOOKUPCOUNT)];
266 
267 
268 typedef enum _OPEN_stp_state_
269 {
270  OPEN_DISABLED = 0,
271  OPEN_FORWARDING = 1,
272  OPEN_DISCRADING = 2,
273  OPEN_LEARNING = 3
274 } OPEN_PT_STP_STATE_t;
275 
278 {
280  int port;
290  OPEN_PT_STP_STATE_t stpState;
293 
295 
297 {
298  unsigned int src_ip;
299  unsigned int dst_ip;
300  unsigned int protocol;
301  unsigned int src_port;
302  unsigned int dst_port;
303  unsigned int tuple_mask;
305 
306 /* Structure to configure five tuple, port to track droppped packets */
308 {
309  int id;
310  int port;
311  OPEN_PT_5_TUPLE_PARAMS_t tuple_params;
312  unsigned int duration;
313  bool send_samples;
314  unsigned int max_samples;
315  bool inc_drop_reasons;
317 
318 /*****************************************************************/
343  int asic, int requestId,
344  OPEN_PORT_MASK_t *portList,
345  OPEN_PT_5_TUPLE_PARAMS_t *tupleParams,
346  OPEN_TCAM_API_POLICYID_t *policyHandle);
347 
348 /**********************************************************************************/
368  int asic, OPEN_TCAM_API_POLICYID_t *policyHandle);
369 
370 /*****************************************************************/
388  int asic, int port,
389  OPEN_PT_PACKET_t *packetData,
390  OPEN_PT_TRACE_PROFILE_t *traceProfile,
391  time_t *time);
392 
393 /*****************************************************************/
414  int asic,
415  OPEN_PT_CONFIG_PKT_DROP_CTRS_t *dropCtrsProfile,
416  OPEN_PT_DROP_CTRS_REQ_INFO_t *ruleReqInfo);
417 
418 /*****************************************************************/
435  int asic,
436  int port,
437  OPEN_PT_PACKET_t *packet,
438  OPEN_PT_DROP_REASON_DATA_t *dropInfo);
439 #endif
440 
_OPEN_pt_lookup_result_type_
packet trace lookup result enums
int trunk_member
destination trunk group
int fabric_trunk
destination member port which packet egress.
OPEN_PT_RESOULTION_t packetResolution
packet trace resolution result
open_error_t
OPEN uses these enumerators to indicate the error codes.
struct _OPEN_pt_hashing_info_ OPEN_PT_HASHING_INFO_t
packet hashing resolution information
open_error_t openapiPtTrace5TupleProfileCreate(openapiClientHandle_t *instruOpenConnHandle, int asic, int requestId, OPEN_PORT_MASK_t *portList, OPEN_PT_5_TUPLE_PARAMS_t *tupleParams, OPEN_TCAM_API_POLICYID_t *policyHandle)
Create a 5 tuple profile/rule in HW to capture live traffic.
OPEN_PT_PACKET_t packet
Packet Including Checksum.
open_error_t openapiPtPktDropCtrsProfileCreate(openapiClientHandle_t *clientHandle, int asic, OPEN_PT_CONFIG_PKT_DROP_CTRS_t *dropCtrsProfile, OPEN_PT_DROP_CTRS_REQ_INFO_t *ruleReqInfo)
PT feature trace profile get function.
open_error_t openapiPtTrace5TupleProfileDelete(openapiClientHandle_t *instruOpenConnHandle, int asic, OPEN_TCAM_API_POLICYID_t *policyHandle)
Delete a 5 tuple profile/rule in HW to capture live traffic.
level 1 ecmp hashing resolution done
int ecmp_1_egress
multipath egress forwarding object.
OPEN_PT_LOOKUP_RESULT_MASK_t lookupResult
packet trace lookup status
int ecmp_2_egress
multipath egress forwarding object.
OPEN_PT_STP_STATE_t stpState
packet trace ingress stp state
hg trunk hashing resolution done
struct _OPEN_pt_trace_profile_ OPEN_PT_TRACE_PROFILE_t
Trace Profile.
OPEN_PT_HASHING_INFO_t hashingInfo
packet trace hashing information
#define OPEN_PT_MAX_PACKET_SIZE
These data structure are used for OpEN API only.
open_error_t openapiPtTraceProfileGet(openapiClientHandle_t *clientHandle, int asic, int port, OPEN_PT_PACKET_t *packetData, OPEN_PT_TRACE_PROFILE_t *traceProfile, time_t *time)
PT feature trace profile get function.
#define OPEN_MASK_BASE_UNIT
Base type for declarations.
#define OPEN_MASK_SIZE(_max)
(internal) Number of OPEN_MASK_BASE_UNITs needed to contain _max bits
int trunk
ecmp destination interface
enum _OPEN_pt_resolution_type_t OPEN_PT_RESOULTION_t
packet trace resolution enums
uint32_t OPEN_TCAM_API_POLICYID_t
Type for Policy IDs.
Definition: openapi_tcam.h:160
open_error_t openapiPtPktDropReasonInfoGet(openapiClientHandle_t *clientHandle, int asic, int port, OPEN_PT_PACKET_t *packet, OPEN_PT_DROP_REASON_DATA_t *dropInfo)
PT feature packet drop reason get function.
OPEN_PORT_MASK_t destPortMask
Mask of destination ports.
trunk hashing resolution done
int fabric_trunk_member
destination hg trunk group
_OPEN_pt_resolution_type_t
packet trace resolution enums
level 2 ecmp hashing resolution done
enum _OPEN_pt_lookup_result_type_ OPEN_PT_LOOKUP_RESULT_TYPE_t
packet trace lookup result enums
packet hashing resolution information
int ecmp_2_group
ecmp destination interface
Packet Including Checksum.