instru.h (14414B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_INSTRU_H__ 14 #define __BCM_INSTRU_H__ 15 16 #include <bcm/types.h> 17 18 /* Visibility Modes */ 19 typedef enum bcm_vis_mode_e { 20 bcmVisModeNone = 0, /* Visibility is not enabled */ 21 bcmVisModeAlways = 1, /* Visibility is enabled for all packets from all 22 ports */ 23 bcmVisModeSelective = 2 /* Visibility should be configured per specific 24 parameter */ 25 } bcm_vis_mode_t; 26 27 #ifndef BCM_HIDE_DISPATCHABLE 28 29 /* Set Visibility mode */ 30 extern int bcm_instru_vis_mode_set( 31 int unit, 32 bcm_vis_mode_t mode); 33 34 /* Get Visibility mode */ 35 extern int bcm_instru_vis_mode_get( 36 int unit, 37 bcm_vis_mode_t *mode); 38 39 #endif /* BCM_HIDE_DISPATCHABLE */ 40 41 /* Node type of IPT profile */ 42 typedef enum bcm_instru_ipt_node_type_e { 43 bcmInstruIptNodeTypeTail = 0, /* Tail */ 44 bcmInstruIptNodeTypeIntOverVxlanFirst = 1, /* Vxlan first node */ 45 bcmInstruIptNodeTypeIntOverVxlanIntermediate = 2, /* Vxlan intermediate node */ 46 bcmInstruIptNodeTypeIntOverVxlanLast = 3 /* Vxlan last node */ 47 } bcm_instru_ipt_node_type_t; 48 49 /* Control of various Instrumentation features */ 50 typedef enum bcm_instru_control_e { 51 bcmInstruControlIptSwitchId = 0, /* IPT switch ID */ 52 bcmInstruControlVisMode = 1, /* Visibility Mode */ 53 bcmInstruControlVisSampling = 2, /* Visibility sampling parameters in 54 Selective mode */ 55 bcmInstruControlSFlowSamplingRate = 3, /* Global sampling rate for sFlow 56 datagrams */ 57 bcmInstruControlSFlowAgentIPAddress = 4, /* Global agent IP address for sFlow 58 datagrams */ 59 bcmInstruControlSFlowUpTime = 5 /* Time stamp that will be stamped on 60 sFlow packets. Should be updated 61 periodically. */ 62 } bcm_instru_control_t; 63 64 /* 65 * Supported visibility modes, used in arg when type is 66 * bcmInstruControlVisMode 67 */ 68 typedef enum bcm_instru_vis_mode_control_e { 69 bcmInstruVisModeNone = 0, /* No visibility enabled */ 70 bcmInstruVisModeAlways = 1, /* Visibility is enabled for any packet from 71 any port */ 72 bcmInstruVisModeSelective = 2 /* Selective visibility enabled, user port 73 control to enable specific resources */ 74 } bcm_instru_vis_mode_control_t; 75 76 /* Control of various per-port Instrumentation features */ 77 typedef enum bcm_instru_gport_control_e { 78 bcmInstruGportControlTraceProbability = 0, /* Probability in one tenth percentage */ 79 bcmInstruGportControlVisEnable = 1, /* Enable visibility on per port basis */ 80 bcmInstruGportControlVisForce = 2, /* Force visibility on per port basis */ 81 bcmInstruGportControlIptTrapToRcyEnable = 3 /* Trap IPT packet to Recycle interface */ 82 } bcm_instru_gport_control_t; 83 84 /* IPT first node header values */ 85 typedef struct bcm_instru_ipt_first_node_header_s { 86 uint32 options; /* Options field */ 87 uint32 type; /* Type field */ 88 uint32 length; /* IPT header length length in bytes */ 89 } bcm_instru_ipt_first_node_header_t; 90 91 /* IPT info */ 92 typedef struct bcm_instru_ipt_s { 93 bcm_instru_ipt_node_type_t node_type; /* Node type */ 94 uint32 metadata_flags; /* Metadata flags */ 95 bcm_instru_ipt_first_node_header_t first_node_header; /* First header info */ 96 } bcm_instru_ipt_t; 97 98 /* Control of various Instrumentation features */ 99 #define BCM_INSTRU_CONTROL_FLAG_DIRECTION_INGRESS 0x1 /* Apply control to 100 INGRESS direction */ 101 #define BCM_INSTRU_CONTROL_FLAG_DIRECTION_EGRESS 0x2 /* Apply control to 102 EGRESS direction */ 103 104 #ifndef BCM_HIDE_DISPATCHABLE 105 106 /* Set various instrumentation features. */ 107 extern int bcm_instru_control_set( 108 int unit, 109 uint32 flags, 110 bcm_instru_control_t type, 111 int arg); 112 113 /* Get various instrumentation features. */ 114 extern int bcm_instru_control_get( 115 int unit, 116 uint32 flags, 117 bcm_instru_control_t type, 118 int *arg); 119 120 /* Set various instrumentation features at the port level. */ 121 extern int bcm_instru_gport_control_set( 122 int unit, 123 bcm_gport_t gport, 124 uint32 flags, 125 bcm_instru_gport_control_t type, 126 int arg); 127 128 /* Get various instrumentation features at the port level. */ 129 extern int bcm_instru_gport_control_get( 130 int unit, 131 bcm_gport_t gport, 132 uint32 flags, 133 bcm_instru_gport_control_t type, 134 int *arg); 135 136 /* Get various instrumentation features at the port level. */ 137 extern int bcm_instru_ipt_profile_set( 138 int unit, 139 uint32 flags, 140 int ipt_profile, 141 bcm_instru_ipt_t *config); 142 143 /* Get various instrumentation features at the port level. */ 144 extern int bcm_instru_ipt_profile_get( 145 int unit, 146 uint32 flags, 147 int ipt_profile, 148 bcm_instru_ipt_t *config); 149 150 #endif /* BCM_HIDE_DISPATCHABLE */ 151 152 /* Initialize bcm_instru_ipt_t struct. */ 153 extern void bcm_instru_ipt_t_init( 154 bcm_instru_ipt_t *config); 155 156 /* IPT metadata options */ 157 #define BCM_INSTRU_IPT_METADATA_FLAG_INGRESS_TOD 0x1 /* INGRESS TOD */ 158 #define BCM_INSTRU_IPT_METADATA_FLAG_INGRESS_SYS_PORT 0x2 /* INGRESS PORT */ 159 #define BCM_INSTRU_IPT_METADATA_FLAG_INGRESS_DEV_ID 0x4 /* INGRESS DEVICE ID */ 160 #define BCM_INSTRU_IPT_METADATA_FLAG_INGRESS_RESERVED 0x8 /* INGRESS RESERVED */ 161 #define BCM_INSTRU_IPT_METADATA_FLAG_EGRESS_TOD 0x10 /* EGRESS TOD */ 162 #define BCM_INSTRU_IPT_METADATA_FLAG_EGRESS_SYS_PORT 0x20 /* EGRESS PORT */ 163 #define BCM_INSTRU_IPT_METADATA_FLAG_EGRESS_DEV_ID 0x40 /* EGRESS DEVICE ID */ 164 #define BCM_INSTRU_IPT_METADATA_FLAG_SWITCH_ID 0x80 /* SWITCH ID */ 165 #define BCM_INSTRU_IPT_METADATA_FLAG_EGRESS_RESERVED 0x100 /* EGRESS RESERVED */ 166 #define BCM_INSTRU_IPT_METADATA_FLAG_QUEUE_INFO 0x200 /* QUEUE INFO */ 167 168 /* sFlow encap flags. */ 169 #define BCM_INSTRU_SFLOW_ENCAP_WITH_ID (1 << 0) /* Allocate with sflow 170 encap id. */ 171 #define BCM_INSTRU_SFLOW_ENCAP_REPLACE (1 << 1) /* Replace existing 172 entry, update 173 EEDB_SFLOW, 174 EGRESS_OAM_LIF_DB 175 tables. */ 176 #define BCM_INSTRU_SFLOW_ENCAP_AGGREGATED (2 << 1) /* Sflow samples will be 177 aggregated. */ 178 179 /* SFlow EEDB instrumentation info */ 180 typedef struct bcm_instru_sflow_encap_info_s { 181 uint32 flags; /* See BCM_INSTRU_SFLOW_ENCAP_XXX flags definitions. */ 182 int sflow_encap_id; /* Global lif */ 183 bcm_gport_t tunnel_id; /* next eedb pointer - udp tunnel id */ 184 int stat_cmd; /* Statistic command - request sequence number */ 185 int counter_command_id; /* Command id (interface id) */ 186 int sub_agent_id; /* sub_agent_id for this sFlow encap */ 187 uint16 eventor_id; /* Eventor RX context to use for this flow */ 188 } bcm_instru_sflow_encap_info_t; 189 190 /* Vswitch callback function prototype */ 191 typedef int (*bcm_instru_sflow_encap_traverse_cb)( 192 int unit, 193 bcm_instru_sflow_encap_info_t *sflow_encap_info, 194 void *user_data); 195 196 #ifndef BCM_HIDE_DISPATCHABLE 197 198 /* Fills the sFlow ETPS types. */ 199 extern int bcm_instru_sflow_encap_create( 200 int unit, 201 bcm_instru_sflow_encap_info_t *sflow_encap_info); 202 203 /* Get sFlow ETPS entry. */ 204 extern int bcm_instru_sflow_encap_get( 205 int unit, 206 bcm_instru_sflow_encap_info_t *sflow_encap_info); 207 208 /* Delete sFlow ETPS entry. */ 209 extern int bcm_instru_sflow_encap_delete( 210 int unit, 211 bcm_instru_sflow_encap_info_t *sflow_encap_info); 212 213 /* Traverse sFlow ETPS entries. */ 214 extern int bcm_instru_sflow_encap_traverse( 215 int unit, 216 bcm_instru_sflow_encap_traverse_cb cb, 217 void *user_data); 218 219 #endif /* BCM_HIDE_DISPATCHABLE */ 220 221 /* Eventor context ID. */ 222 typedef uint16 bcm_eventor_context_id_t; 223 224 /* Eventor engine ID. */ 225 typedef uint16 bcm_eventor_builder_id_t; 226 227 /* Number of Eventor srum bank. */ 228 typedef uint16 bcm_eventor_sram_bank_t; 229 230 /* Eventor context type */ 231 typedef enum bcm_eventor_context_type_e { 232 bcmEventorContextTypeRx = 0, /* RX Eventor context type */ 233 bcmEventorContextTypeTx = 1, /* TX Eventor context type */ 234 bcmEventorContextTypeTxFifo = 2, /* FIFO (TX) Eventor context type */ 235 bcmEventorContextTypeAny = 255 /* A value used to get any Eventor 236 context type in a get operation. Not 237 a real type */ 238 } bcm_eventor_context_type_t; 239 240 /* Constant value to be used in Eventor output. */ 241 typedef struct bcm_instru_eventor_operation_s { 242 uint32 flags; /* control flags: TX/additional buffer */ 243 uint32 buf_offset; /* offset inside the buffer in 4 byte words */ 244 uint32 access_info; /* Use APs to generate this information containing 245 block+address+type (reg/mem/DMA) */ 246 } bcm_instru_eventor_operation_t; 247 248 /* Constant value to be used in Eventor output. */ 249 typedef struct bcm_instru_eventor_const_value_s { 250 uint32 value; /* 4 byte words constant value to be used in Eventor output */ 251 uint32 offset; /* output offset for the constant value in 4 byte words */ 252 } bcm_instru_eventor_const_value_t; 253 254 #define BCM_INSTRU_EVENTOR_TIMEOUT_NONE ((uint32)-1) /* No timeout */ 255 #define BCM_INSTRU_EVENTOR_TIMEOUT_MINIMAL 0 /* smallest timeout 256 possible */ 257 258 /* Eventor context configuration */ 259 typedef struct bcm_instru_eventor_context_conf_s { 260 uint32 flags; /* control flags: Was there enough room 261 to return the full DMA program and 262 all constant values , auto select 263 bank/buffer for RX , event type 264 (RX/FIFO/TX) */ 265 bcm_eventor_sram_bank_t bank1; /* SRAM bank used for first buffer */ 266 bcm_eventor_sram_bank_t bank2; /* SRAM bank used for second buffer */ 267 uint32 buffer_size; /* buffer size in 4 byte words used for 268 both buffers */ 269 uint32 buffer1_start; /* offset in 4 byte words in the SRAM 270 bank of the first buffer */ 271 uint32 buffer2_start; /* offset in 4 byte words in the SRAM 272 bank of the second buffer */ 273 uint32 program1_start; /* offset in 4 byte words in the SRAM 274 bank of the first buffer's DMA 275 program filling the buffer */ 276 uint32 program2_start; /* offset in 4 byte words in the SRAM 277 bank of the second buffer's DMA 278 program filling the buffer */ 279 uint32 nof_operations; /* number operations in the DMA program 280 filling the buffers */ 281 bcm_instru_eventor_operation_t operations; /* The operations in the DMA program 282 filling the buffers */ 283 uint32 nof_const_values; /* number operations in the DMA program 284 filling the buffers */ 285 bcm_instru_eventor_const_value_t *const_values; /* The operations in the DMA program 286 filling the buffers */ 287 } bcm_instru_eventor_context_conf_t; 288 289 #ifndef BCM_HIDE_DISPATCHABLE 290 291 /* Set the configuration of the given context */ 292 extern int bcm_instru_eventor_context_set( 293 int unit, 294 uint32 flags, 295 bcm_eventor_context_id_t context, 296 bcm_eventor_context_type_t context_type, 297 bcm_instru_eventor_context_conf_t *conf); 298 299 /* Get the configuration of the given context */ 300 extern int bcm_instru_eventor_context_get( 301 int unit, 302 uint32 flags, 303 bcm_eventor_context_id_t context, 304 bcm_eventor_context_type_t context_type, 305 bcm_instru_eventor_context_conf_t *out_conf); 306 307 #endif /* BCM_HIDE_DISPATCHABLE */ 308 309 /* Eventor builder configuration */ 310 typedef struct bcm_instru_eventor_builder_conf_s { 311 uint32 flags; /* control flags */ 312 uint32 thresh_size; /* When this amount of 4 byte words is reached, 313 generate a packet */ 314 uint32 thresh_time; /* When this amount of ms passes since stated 315 receiving data, generate a packet. May take 316 BCM_INSTRU_EVENTOR_TIMEOUT_* */ 317 uint32 header_length; /* The length, in bytes, of the header to use in 318 generated packets */ 319 uint8 *header_data; /* The data of the header to use in generated 320 packets */ 321 } bcm_instru_eventor_builder_conf_t; 322 323 #ifndef BCM_HIDE_DISPATCHABLE 324 325 /* Set the configuration of the given builder. */ 326 extern int bcm_instru_eventor_builder_set( 327 int unit, 328 uint32 flags, 329 bcm_eventor_builder_id_t builder, 330 bcm_instru_eventor_builder_conf_t *conf); 331 332 /* Get the configuration of the given builder. */ 333 extern int bcm_instru_eventor_builder_get( 334 int unit, 335 uint32 flags, 336 bcm_eventor_builder_id_t builder, 337 bcm_instru_eventor_builder_conf_t *out_conf); 338 339 /* Start or stop the Eventor. */ 340 extern int bcm_instru_eventor_active_set( 341 int unit, 342 uint32 flags, 343 int active); 344 345 /* Check id the Eventor is active/started. */ 346 extern int bcm_instru_eventor_active_get( 347 int unit, 348 uint32 flags, 349 int *out_active); 350 351 #endif /* BCM_HIDE_DISPATCHABLE */ 352 353 #endif /* __BCM_INSTRU_H__ */