int.h (30835B)
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 */ 9 10 #ifndef __BCM_INT_H__ 11 #define __BCM_INT_H__ 12 13 #if defined(INCLUDE_INT) 14 15 #include <bcm/types.h> 16 17 /* INT Turnaround configuration information data. */ 18 typedef struct bcm_int_turnaround_config_s { 19 bcm_mac_t src_mac; 20 } bcm_int_turnaround_config_t; 21 22 /* INT Turnaround statistics information data. */ 23 typedef struct bcm_int_turnaround_stat_s { 24 uint64 rx_pkt_cnt; /* Number of packet recieved in FW. */ 25 uint64 tx_pkt_cnt; /* Number of packet transmitted from FW. */ 26 uint64 drop_pkt_cnt; /* Number of packet dropped in FW. */ 27 uint64 int_init_config_drop; /* Number of pkt dropped due to missing 28 configuration. */ 29 uint64 int_hop_cnt_invalid_drop; /* Number of pkt dropped due to Hop 30 count exceeded Hop limit. */ 31 uint64 int_hdr_len_invalid_drop; /* Number of pkt dropped due to current 32 length exceeded maximum length. */ 33 uint64 int_pkt_size_invalid_drop; /* Number of pkt dropped due to invalid 34 packet size. */ 35 } bcm_int_turnaround_stat_t; 36 37 #ifndef BCM_HIDE_DISPATCHABLE 38 39 /* Initializes int subsystem. */ 40 extern int bcm_int_init( 41 int unit); 42 43 /* Detaches int subsystem. */ 44 extern int bcm_int_detach( 45 int unit); 46 47 #endif /* BCM_HIDE_DISPATCHABLE */ 48 49 /* Initialize INT Turnaround configuration information structure. */ 50 extern void bcm_int_turnaround_config_t_init( 51 bcm_int_turnaround_config_t *config_info); 52 53 #ifndef BCM_HIDE_DISPATCHABLE 54 55 /* Set INT Turnaround - configuration information */ 56 extern int bcm_int_turnaround_config_set( 57 int unit, 58 bcm_int_turnaround_config_t *config_data); 59 60 /* Get INT Turnaround - configuration information */ 61 extern int bcm_int_turnaround_config_get( 62 int unit, 63 bcm_int_turnaround_config_t *config_data); 64 65 /* INT Turnaround - INT Turnaround statistics information */ 66 extern int bcm_int_turnaround_stat_get( 67 int unit, 68 bcm_int_turnaround_stat_t *stat_data); 69 70 #endif /* BCM_HIDE_DISPATCHABLE */ 71 72 /* IFA vector match add options. */ 73 #define BCM_INT_IFA_VECTOR_MATCH_OPTIONS_REPLACE (1 << 0) /* Replace the IFA vector 74 match. */ 75 76 /* IFA vector match criteria. */ 77 typedef struct bcm_int_ifa_vector_match_s { 78 int priority; /* The priority of the vector match. */ 79 uint16 gns; /* Value to match against the global namespace 80 (GNS) in the IFA base header. */ 81 uint16 gns_mask; /* Mask value to be applied to the global 82 namespace in the IFA packet before matching 83 with field gns. */ 84 uint8 lns; /* Value to match against the local namespace 85 (LNS) in the IFA metadata. */ 86 uint8 lns_mask; /* Mask value to be applied to the local 87 namespace in the IFA packet before matching 88 with field lns. */ 89 uint32 request_vector; /* Value to match against the request vector in 90 the IFA metadata header. */ 91 uint32 request_vector_mask; /* Mask value to be applied to the request 92 vector in the IFA packet before matching with 93 field request_vector. */ 94 uint8 metadata_profile_id; /* Profile ID to select and construct IFA 95 metadata. */ 96 } bcm_int_ifa_vector_match_t; 97 98 /* IFA vector match callback function prototype. */ 99 typedef int(*bcm_int_ifa_vector_match_traverse_cb)( 100 int unit, 101 bcm_int_ifa_vector_match_t *match, 102 void *user_data); 103 104 /* Initialize the bcm_int_ifa_vector_match_t struct. */ 105 extern void bcm_int_ifa_vector_match_t_init( 106 bcm_int_ifa_vector_match_t *match); 107 108 #ifndef BCM_HIDE_DISPATCHABLE 109 110 /* Add the vector match for IFA. */ 111 extern int bcm_int_ifa_vector_match_add( 112 int unit, 113 uint32 options, 114 bcm_int_ifa_vector_match_t *match); 115 116 /* Get the vector match for IFA. */ 117 extern int bcm_int_ifa_vector_match_get( 118 int unit, 119 bcm_int_ifa_vector_match_t *match); 120 121 /* Delete the vector match for IFA. */ 122 extern int bcm_int_ifa_vector_match_delete( 123 int unit, 124 bcm_int_ifa_vector_match_t *match); 125 126 /* Delete all vector matches for IFA. */ 127 extern int bcm_int_ifa_vector_match_delete_all( 128 int unit); 129 130 /* Traverse all vector matches for IFA. */ 131 extern int bcm_int_ifa_vector_match_traverse( 132 int unit, 133 bcm_int_ifa_vector_match_traverse_cb cb, 134 void *user_data); 135 136 #endif /* BCM_HIDE_DISPATCHABLE */ 137 138 /* IOAM vector match add options. */ 139 #define BCM_INT_IOAM_VECTOR_MATCH_OPTIONS_REPLACE (1 << 0) /* Replace the IOAM 140 vector match. */ 141 142 /* IOAM vector match criteria. */ 143 typedef struct bcm_int_ioam_vector_match_s { 144 int priority; /* The priority of the vector match. */ 145 uint16 namespace_id; /* Value to match against the namespace 146 identifier in the IOAM metadata header. */ 147 uint16 namespace_id_mask; /* Mask value to be applied to the namespace 148 identifier in the IOAM packet before matching 149 with namespace ID. */ 150 uint32 trace_type; /* Value to match against the trace type in the 151 IOAM metadata header. */ 152 uint32 trace_type_mask; /* Mask value to be applied to the trace type in 153 the IOAM packet before matching with trace 154 type. */ 155 uint8 metadata_profile_id; /* Profile ID to select and construct IOAM 156 metadata. */ 157 } bcm_int_ioam_vector_match_t; 158 159 /* IOAM vector match callback function prototype. */ 160 typedef int(*bcm_int_ioam_vector_match_traverse_cb)( 161 int unit, 162 bcm_int_ioam_vector_match_t *match, 163 void *user_data); 164 165 /* Initialize the bcm_int_ioam_vector_match_t struct. */ 166 extern void bcm_int_ioam_vector_match_t_init( 167 bcm_int_ioam_vector_match_t *match); 168 169 #ifndef BCM_HIDE_DISPATCHABLE 170 171 /* Add the vector match for IOAM. */ 172 extern int bcm_int_ioam_vector_match_add( 173 int unit, 174 uint32 options, 175 bcm_int_ioam_vector_match_t *match); 176 177 /* Get the vector match for IOAM. */ 178 extern int bcm_int_ioam_vector_match_get( 179 int unit, 180 bcm_int_ioam_vector_match_t *match); 181 182 /* Delete the vector match for IOAM. */ 183 extern int bcm_int_ioam_vector_match_delete( 184 int unit, 185 bcm_int_ioam_vector_match_t *match); 186 187 /* Delete all vector matches for IOAM. */ 188 extern int bcm_int_ioam_vector_match_delete_all( 189 int unit); 190 191 /* Traverse all vector matches for IOAM. */ 192 extern int bcm_int_ioam_vector_match_traverse( 193 int unit, 194 bcm_int_ioam_vector_match_traverse_cb cb, 195 void *user_data); 196 197 #endif /* BCM_HIDE_DISPATCHABLE */ 198 199 /* INT-DP vector match add options. */ 200 #define BCM_INT_DP_VECTOR_MATCH_OPTIONS_REPLACE (1 << 0) /* Replace the INT-DP 201 vector match. */ 202 203 /* INT-DP vector match criteria. */ 204 typedef struct bcm_int_dp_vector_match_s { 205 int priority; /* The priority of the vector match. */ 206 uint32 request_vector; /* Value to match against the telemetry request 207 vector in the INT-DP header. */ 208 uint32 request_vector_mask; /* Mask value to be applied to the telemetry 209 request vector in the INT-DP packet before 210 matching with request vector. */ 211 uint8 metadata_profile_id; /* Profile ID to select and construct INT-DP 212 metadata. */ 213 } bcm_int_dp_vector_match_t; 214 215 /* INT-DP vector match callback function prototype. */ 216 typedef int(*bcm_int_dp_vector_match_traverse_cb)( 217 int unit, 218 bcm_int_dp_vector_match_t *match, 219 void *user_data); 220 221 /* Initialize the bcm_int_dp_vector_match_t struct. */ 222 extern void bcm_int_dp_vector_match_t_init( 223 bcm_int_dp_vector_match_t *match); 224 225 #ifndef BCM_HIDE_DISPATCHABLE 226 227 /* Add the vector match for INT-DP. */ 228 extern int bcm_int_dp_vector_match_add( 229 int unit, 230 uint32 options, 231 bcm_int_dp_vector_match_t *match); 232 233 /* Get the vector match for INT-DP. */ 234 extern int bcm_int_dp_vector_match_get( 235 int unit, 236 bcm_int_dp_vector_match_t *match); 237 238 /* Delete the vector match for INT-DP. */ 239 extern int bcm_int_dp_vector_match_delete( 240 int unit, 241 bcm_int_dp_vector_match_t *match); 242 243 /* Delete all vector matches for INT-DP. */ 244 extern int bcm_int_dp_vector_match_delete_all( 245 int unit); 246 247 /* Traverse all vector matches for INT-DP. */ 248 extern int bcm_int_dp_vector_match_traverse( 249 int unit, 250 bcm_int_dp_vector_match_traverse_cb cb, 251 void *user_data); 252 253 #endif /* BCM_HIDE_DISPATCHABLE */ 254 255 /* INT header operation mode. */ 256 typedef enum bcm_int_header_operation_mode_e { 257 bcmIntHeaderOperationNone = 0, /* Do not insert metadata. Applies for 258 INT-DP termination. */ 259 bcmIntHeaderOperationMetadataInsert = 1, /* Only insert metadata. */ 260 bcmIntHeaderOperationCount = 2 /* Always last. Not a usable value. */ 261 } bcm_int_header_operation_mode_t; 262 263 /* INT timestamp mode. */ 264 typedef enum bcm_int_timestamp_mode_e { 265 bcmIntTimestampPtp = 0, /* Precision Time Protocol */ 266 bcmIntTimestampNtp = 1, /* Network Time Protocol */ 267 bcmIntTimestampCount = 2 /* Always last. Not a usable value. */ 268 } bcm_int_timestamp_mode_t; 269 270 /* INT residence time format. */ 271 typedef enum bcm_int_residence_time_format_e { 272 bcmIntResidenceTime48Bits = 0, /* Nanoseconds up to 48 bits. */ 273 bcmIntResidenceTime32Bits = 1, /* IOAM compliant, nanoseconds up to 31 274 bits. 0x80000000 indicates overflow. */ 275 bcmIntResidenceTimeCount = 2 /* Always last. Not a usable value. */ 276 } bcm_int_residence_time_format_t; 277 278 /* IFA action profile create options. */ 279 #define BCM_INT_IFA_ACTION_PROFILE_OPTIONS_WITH_ID (1 << 0) /* Create the IFA action 280 profile with ID. */ 281 #define BCM_INT_IFA_ACTION_PROFILE_OPTIONS_REPLACE (1 << 1) /* Replace the IFA action 282 profile. */ 283 284 /* IFA action profile flags. */ 285 #define BCM_INT_IFA_ACTION_PROFILE_FLAGS_IP_LENGTH_UPDATE (1 << 0) /* Enable to update IP 286 length after metadata 287 insertion. */ 288 289 /* IFA action profile. */ 290 typedef struct bcm_int_ifa_action_profile_s { 291 uint32 flags; /* Action profile flags */ 292 bcm_int_timestamp_mode_t timestamp_mode; /* Timestamp mode for ingress timestamp, 293 egress timestamp and residence time. */ 294 bcm_int_residence_time_format_t residence_time_format; /* Format for residence time. Only 295 bcmIntResidenceTime48Bits is 296 applicable. */ 297 bcm_int_header_operation_mode_t header_operation_mode; /* Header operation mode. */ 298 uint8 metadata_profile_id; /* Profile ID to select metadata fields 299 and construct IFA metadata. This can 300 be used to overwrite the profile 301 assigned by IFA vector match. */ 302 } bcm_int_ifa_action_profile_t; 303 304 /* IFA action profile callback function prototype. */ 305 typedef int(*bcm_int_ifa_action_profile_traverse_cb)( 306 int unit, 307 int *profile_id, 308 bcm_int_ifa_action_profile_t *profile, 309 void *user_data); 310 311 /* Initialize the bcm_int_ifa_action_profile_t struct. */ 312 extern void bcm_int_ifa_action_profile_t_init( 313 bcm_int_ifa_action_profile_t *profile); 314 315 #ifndef BCM_HIDE_DISPATCHABLE 316 317 /* Create the IFA action profile. */ 318 extern int bcm_int_ifa_action_profile_create( 319 int unit, 320 uint32 options, 321 int *profile_id, 322 bcm_int_ifa_action_profile_t *profile); 323 324 /* Get the IFA action profile. */ 325 extern int bcm_int_ifa_action_profile_get( 326 int unit, 327 int profile_id, 328 bcm_int_ifa_action_profile_t *profile); 329 330 /* Destroy the IFA action profile. */ 331 extern int bcm_int_ifa_action_profile_destroy( 332 int unit, 333 int profile_id); 334 335 /* Traverse all IFA action profiles. */ 336 extern int bcm_int_ifa_action_profile_traverse( 337 int unit, 338 bcm_int_ifa_action_profile_traverse_cb cb, 339 void *user_data); 340 341 #endif /* BCM_HIDE_DISPATCHABLE */ 342 343 /* IOAM action profile create options. */ 344 #define BCM_INT_IOAM_ACTION_PROFILE_OPTIONS_WITH_ID (1 << 0) /* Create the IOAM action 345 profile with ID. */ 346 #define BCM_INT_IOAM_ACTION_PROFILE_OPTIONS_REPLACE (1 << 1) /* Replace the IOAM 347 action profile. */ 348 349 /* IOAM action profile flags. */ 350 #define BCM_INT_IOAM_ACTION_PROFILE_FLAGS_IP_LENGTH_UPDATE (1 << 0) /* Enable to update IP 351 length after metadata 352 insertion. */ 353 354 /* IOAM O-bit update mode. */ 355 typedef enum bcm_int_ioam_o_bit_update_mode_e { 356 bcmIntIoamObitUpdateSkip = 0, /* Do not update O-bit. */ 357 bcmIntIoamObitUpdateOverflow = 1, /* Update O-bit per max length check. 358 The O-bit will be set if there is no 359 enough room for the metadata to be 360 inserted. */ 361 bcmIntIoamObitUpdateCount = 2 /* Always last. Not a usable value. */ 362 } bcm_int_ioam_o_bit_update_mode_t; 363 364 /* IOAM action profile. */ 365 typedef struct bcm_int_ioam_action_profile_s { 366 uint32 flags; /* Action profile flags */ 367 bcm_int_timestamp_mode_t timestamp_mode; /* Timestamp mode for ingress timestamp, 368 egress timestamp and residence time. */ 369 bcm_int_residence_time_format_t residence_time_format; /* Format for residence time. */ 370 bcm_int_header_operation_mode_t header_operation_mode; /* Header operation mode. */ 371 bcm_int_ioam_o_bit_update_mode_t o_bit_update_mode; /* The O-bit updating mode during 372 metadata insertion. */ 373 uint8 metadata_profile_id; /* Profile ID to select metadata fields 374 and construct IOAM metadata. This can 375 be used to overwrite the profile 376 assigned by IOAM vector match. */ 377 } bcm_int_ioam_action_profile_t; 378 379 /* IOAM action profile callback function prototype. */ 380 typedef int(*bcm_int_ioam_action_profile_traverse_cb)( 381 int unit, 382 int *profile_id, 383 bcm_int_ioam_action_profile_t *profile, 384 void *user_data); 385 386 /* Initialize the bcm_int_ioam_action_profile_t struct. */ 387 extern void bcm_int_ioam_action_profile_t_init( 388 bcm_int_ioam_action_profile_t *profile); 389 390 #ifndef BCM_HIDE_DISPATCHABLE 391 392 /* Create the IOAM action profile. */ 393 extern int bcm_int_ioam_action_profile_create( 394 int unit, 395 uint32 options, 396 int *profile_id, 397 bcm_int_ioam_action_profile_t *profile); 398 399 /* Get the IOAM action profile. */ 400 extern int bcm_int_ioam_action_profile_get( 401 int unit, 402 int profile_id, 403 bcm_int_ioam_action_profile_t *profile); 404 405 /* Destroy the IOAM action profile. */ 406 extern int bcm_int_ioam_action_profile_destroy( 407 int unit, 408 int profile_id); 409 410 /* Traverse all IOAM action profiles. */ 411 extern int bcm_int_ioam_action_profile_traverse( 412 int unit, 413 bcm_int_ioam_action_profile_traverse_cb cb, 414 void *user_data); 415 416 #endif /* BCM_HIDE_DISPATCHABLE */ 417 418 /* INT-DP action profile create options. */ 419 #define BCM_INT_DP_ACTION_PROFILE_OPTIONS_WITH_ID (1 << 0) /* Create the INT-DP 420 action profile with 421 ID. */ 422 #define BCM_INT_DP_ACTION_PROFILE_OPTIONS_REPLACE (1 << 1) /* Replace the INT-DP 423 action profile. */ 424 425 /* INT-DP action profile flags. */ 426 #define BCM_INT_DP_ACTION_PROFILE_FLAGS_IP_LENGTH_UPDATE (1 << 0) /* Enable to update IP 427 length after metadata 428 insertion. */ 429 #define BCM_INT_DP_ACTION_PROFILE_FLAGS_UDP_LENGTH_UPDATE (1 << 1) /* Enable to update UDP 430 length after metadata 431 insertion. */ 432 433 /* INT-DP action profile. */ 434 typedef struct bcm_int_dp_action_profile_s { 435 uint32 flags; /* Action profile flags. */ 436 bcm_int_timestamp_mode_t timestamp_mode; /* Timestamp mode for ingress timestamp, 437 egress timestamp and residence time. */ 438 bcm_int_residence_time_format_t residence_time_format; /* Format for residence time. Only 439 bcmIntResidenceTime48Bits is 440 applicable. */ 441 bcm_int_header_operation_mode_t header_operation_mode; /* Header operation mode. */ 442 uint8 metadata_profile_id; /* Profile ID to select metadata fields 443 and construct INT-DP metadata. This 444 can be used to overwrite the profile 445 assigned by INT-DP vector match. */ 446 } bcm_int_dp_action_profile_t; 447 448 /* INT-DP action profile callback function prototype. */ 449 typedef int(*bcm_int_dp_action_profile_traverse_cb)( 450 int unit, 451 int *profile_id, 452 bcm_int_dp_action_profile_t *profile, 453 void *user_data); 454 455 /* Initialize the bcm_int_dp_action_profile_t struct. */ 456 extern void bcm_int_dp_action_profile_t_init( 457 bcm_int_dp_action_profile_t *profile); 458 459 #ifndef BCM_HIDE_DISPATCHABLE 460 461 /* Create the INT-DP action profile. */ 462 extern int bcm_int_dp_action_profile_create( 463 int unit, 464 uint32 options, 465 int *profile_id, 466 bcm_int_dp_action_profile_t *profile); 467 468 /* Get the INT-DP action profile. */ 469 extern int bcm_int_dp_action_profile_get( 470 int unit, 471 int profile_id, 472 bcm_int_dp_action_profile_t *profile); 473 474 /* Destroy the INT-DP action profile. */ 475 extern int bcm_int_dp_action_profile_destroy( 476 int unit, 477 int profile_id); 478 479 /* Traverse all INT-DP action profiles. */ 480 extern int bcm_int_dp_action_profile_traverse( 481 int unit, 482 bcm_int_dp_action_profile_traverse_cb cb, 483 void *user_data); 484 485 #endif /* BCM_HIDE_DISPATCHABLE */ 486 487 /* INT opaque data profile create options. */ 488 #define BCM_INT_OPAQUE_DATA_PROFILE_OPTIONS_WITH_ID (1 << 0) /* Create the opaque data 489 profile for INT 490 metadata construction 491 with ID. */ 492 #define BCM_INT_OPAQUE_DATA_PROFILE_OPTIONS_REPLACE (1 << 1) /* Replace the opaque 493 data profile for INT 494 metadata construction. */ 495 496 /* INT opaque data field. */ 497 #define BCM_INT_MAX_OPAQUE_DATA 8 /* Max number of INT opaque data. */ 498 499 /* INT opaque data profile. */ 500 typedef struct bcm_int_opaque_data_profile_s { 501 uint32 opaque_data[BCM_INT_MAX_OPAQUE_DATA]; /* Opaque data field. */ 502 } bcm_int_opaque_data_profile_t; 503 504 /* INT opaque data profile callback function prototype. */ 505 typedef int(*bcm_int_opaque_data_profile_traverse_cb)( 506 int unit, 507 int *profile_id, 508 bcm_int_opaque_data_profile_t *profile, 509 void *user_data); 510 511 /* Initialize the bcm_int_opaque_data_profile_t struct. */ 512 extern void bcm_int_opaque_data_profile_t_init( 513 bcm_int_opaque_data_profile_t *profile); 514 515 #ifndef BCM_HIDE_DISPATCHABLE 516 517 /* Create the opaque data profile for INT metadata construction. */ 518 extern int bcm_int_opaque_data_profile_create( 519 int unit, 520 uint32 options, 521 int *profile_id, 522 bcm_int_opaque_data_profile_t *profile); 523 524 /* Get the opaque data profile for INT metadata construction. */ 525 extern int bcm_int_opaque_data_profile_get( 526 int unit, 527 int profile_id, 528 bcm_int_opaque_data_profile_t *profile); 529 530 /* Destroy the opaque data profile for INT metadata construction. */ 531 extern int bcm_int_opaque_data_profile_destroy( 532 int unit, 533 int profile_id); 534 535 /* Traverse all the opaque data profiles for INT metadata construction. */ 536 extern int bcm_int_opaque_data_profile_traverse( 537 int unit, 538 bcm_int_opaque_data_profile_traverse_cb cb, 539 void *user_data); 540 541 #endif /* BCM_HIDE_DISPATCHABLE */ 542 543 /* INT COSQ stat report mode. */ 544 typedef enum bcm_int_cosq_stat_report_mode_e { 545 bcmIntCosqStatReportQueueBased = 0, /* Queue based */ 546 bcmIntCosqStatReportPortBased = 1, /* Port based */ 547 bcmIntCosqStatReportCount = 2 /* Always last. Not a usable value. */ 548 } bcm_int_cosq_stat_report_mode_t; 549 550 /* INT COSQ stat configuration. */ 551 typedef struct bcm_int_cosq_stat_config_s { 552 bcm_int_cosq_stat_report_mode_t report_mode; /* Select to report port or queue based 553 usage in bytes, including current and 554 maximum usage. */ 555 int max_bytes_enable; /* Enable to use max_bytes field as 556 maximum usage in bytes when BST is 557 not enabled. */ 558 uint32 max_bytes; /* Maximum usage in bytes. Applies for 559 cut-through packets or when BST is 560 not enabled. */ 561 uint32 current_bytes; /* Current usage in bytes. Applies for 562 cut-through packets. */ 563 uint32 current_available_bytes; /* Current available buffer in bytes. 564 Applies for cut-through packets. */ 565 uint32 min_available_bytes; /* Minimum available buffer in bytes. 566 Applies for cut-through packets or 567 when BST is not enabled. */ 568 } bcm_int_cosq_stat_config_t; 569 570 /* Initialize the bcm_int_cosq_stat_config_t struct. */ 571 extern void bcm_int_cosq_stat_config_t_init( 572 bcm_int_cosq_stat_config_t *config); 573 574 #ifndef BCM_HIDE_DISPATCHABLE 575 576 /* Set INT COSQ stat configuration. */ 577 extern int bcm_int_cosq_stat_config_set( 578 int unit, 579 bcm_int_cosq_stat_config_t *config); 580 581 /* Get INT COSQ stat configuration. */ 582 extern int bcm_int_cosq_stat_config_get( 583 int unit, 584 bcm_int_cosq_stat_config_t *config); 585 586 #endif /* BCM_HIDE_DISPATCHABLE */ 587 588 /* INT metadata profile create options. */ 589 #define BCM_INT_METADATA_PROFILE_OPTIONS_WITH_ID (1 << 0) /* Create the INT 590 metadata profile with 591 ID. */ 592 593 /* INT metadata field. */ 594 typedef enum bcm_int_metadata_field_e { 595 bcmIntMetadataPadOne = 0, /* Pad ones */ 596 bcmIntMetadataPadZero = 1, /* Pad zeros */ 597 bcmIntMetadataOpaqueData1 = 2, /* Opaque data 1 */ 598 bcmIntMetadataOpaqueData2 = 3, /* Opaque data 2 */ 599 bcmIntMetadataOpaqueData3 = 4, /* Opaque data 3 */ 600 bcmIntMetadataSwitchId = 5, /* Switch ID */ 601 bcmIntMetadataResidenceTimeSubSeconds = 6, /* Sub-seconds portion of residence time */ 602 bcmIntMetadataCosqStat0 = 7, /* Stat 0 generated by traffic manager 603 (TM) */ 604 bcmIntMetadataCosqStat1 = 8, /* Stat 1 generated by traffic manager 605 (TM) */ 606 bcmIntMetadataIngressTimestampSubSeconds = 9, /* Sub-seconds portion of ingress 607 timestamp */ 608 bcmIntMetadataEgressTimestampSubSeconds = 10, /* Sub-seconds portion of egress 609 timestamp */ 610 bcmIntMetadataIngressTimestampSecondsLower = 11, /* Lower seconds portion of ingress 611 timestamp */ 612 bcmIntMetadataEgressTimestampSecondsLower = 12, /* Lower seconds portion of egress 613 timestamp */ 614 bcmIntMetadataIngressTimestampSecondsUpper = 13, /* Higher seconds portion of ingress 615 timestamp */ 616 bcmIntMetadataEgressTimestampSecondsUpper = 14, /* Higher seconds portion of egress 617 timestamp */ 618 bcmIntMetadataResidenceTimeSeconds = 15, /* Seconds portion of residence time */ 619 bcmIntMetadataOverlayL3EgrIntf = 16, /* Overlay L3 egress interface */ 620 bcmIntMetadataL3EgrIntf = 17, /* L3 egress interface */ 621 bcmIntMetadataL3IngIntf = 18, /* L3 ingress interface */ 622 bcmIntMetadataIngPortId = 19, /* Ingress port ID */ 623 bcmIntMetadataEgrPortId = 20, /* Egress port ID */ 624 bcmIntMetadataVrf = 21, /* VRF */ 625 bcmIntMetadataVfi = 22, /* VFI */ 626 bcmIntMetadataDvp = 23, /* DVP */ 627 bcmIntMetadataSvp = 24, /* SVP */ 628 bcmIntMetadataTunnelEncapIndex = 25, /* Tunnel encapsulation index */ 629 bcmIntMetadataCng = 26, /* Internal color/drop precedence */ 630 bcmIntMetadataCongestion = 27, /* Congestion marked status */ 631 bcmIntMetadataQueueId = 28, /* Destination queue ID */ 632 bcmIntMetadataProfileId = 29, /* Metadata profile ID */ 633 bcmIntMetadataCutThrough = 30, /* Cut through status */ 634 bcmIntMetadataQueueIdProfileIdCutThrough = 31, /* Destination queue ID, metadata 635 profile ID and cut through status */ 636 bcmIntMetadataCngQueueIdProfileIdCutThrough = 32, /* Internal color/drop precedence, 637 destination queue ID, metadata 638 profile ID and cut through status */ 639 bcmIntMetadataCount = 33 /* Always last. Not a usable value. */ 640 } bcm_int_metadata_field_t; 641 642 /* INT metadata field select. */ 643 typedef struct bcm_int_metadata_field_select_s { 644 bcm_int_metadata_field_t field; /* Metadata field. */ 645 uint8 start; /* Starting bit position of the field within 646 the chunk, from the MSB of the chunk. */ 647 uint8 size; /* Size of the field in bits. */ 648 uint8 shift; /* Number of bits of the field to barrel 649 shift towards LSB. */ 650 } bcm_int_metadata_field_select_t; 651 652 /* INT metadata field construct. */ 653 typedef struct bcm_int_metadata_field_construct_s { 654 uint8 offset; /* The relative offset of the field within metadata, 655 starting from the MSB of metadata, with byte as 656 granularity. */ 657 } bcm_int_metadata_field_construct_t; 658 659 /* INT metadata field entry. */ 660 typedef struct bcm_int_metadata_field_entry_s { 661 bcm_int_metadata_field_select_t select; /* Metadata field select. */ 662 bcm_int_metadata_field_construct_t construct; /* Metadata field construct. */ 663 } bcm_int_metadata_field_entry_t; 664 665 /* INT metadata field select information. */ 666 typedef struct bcm_int_metadata_field_select_info_s { 667 uint8 start; /* Starting bit position of the field within the chunk, from 668 the MSB of the chunk. */ 669 uint8 size; /* Size of the field in bits. */ 670 } bcm_int_metadata_field_select_info_t; 671 672 /* INT metadata profile callback function prototype. */ 673 typedef int(*bcm_int_metadata_profile_traverse_cb)( 674 int unit, 675 int *profile_id, 676 bcm_int_metadata_field_entry_t *field_entry, 677 void *user_data); 678 679 /* Initialize the bcm_int_metadata_field_select_t struct. */ 680 extern void bcm_int_metadata_field_select_t_init( 681 bcm_int_metadata_field_select_t *field_select); 682 683 /* Initialize the bcm_int_metadata_field_construct_t struct. */ 684 extern void bcm_int_metadata_field_construct_t_init( 685 bcm_int_metadata_field_construct_t *field_construct); 686 687 /* Initialize the bcm_int_metadata_field_entry_t struct. */ 688 extern void bcm_int_metadata_field_entry_t_init( 689 bcm_int_metadata_field_entry_t *field_entry); 690 691 /* Initialize the int_metadata_field_select_info_t struct. */ 692 extern void bcm_int_metadata_field_select_info_t_init( 693 bcm_int_metadata_field_select_info_t *field_select_info); 694 695 #ifndef BCM_HIDE_DISPATCHABLE 696 697 /* Create the metadata profile. */ 698 extern int bcm_int_metadata_profile_create( 699 int unit, 700 uint32 options, 701 int *profile_id); 702 703 /* Get the metadata profile. */ 704 extern int bcm_int_metadata_profile_get( 705 int unit, 706 int profile_id, 707 int array_size, 708 bcm_int_metadata_field_entry_t *entry_array, 709 int *field_count); 710 711 /* Destroy the metadata profile. */ 712 extern int bcm_int_metadata_profile_destroy( 713 int unit, 714 int profile_id); 715 716 /* Traverse all metadata profiles. */ 717 extern int bcm_int_metadata_profile_traverse( 718 int unit, 719 bcm_int_metadata_profile_traverse_cb cb, 720 void *user_data); 721 722 /* Add the metadata field to the metadata profile. */ 723 extern int bcm_int_metadata_field_add( 724 int unit, 725 int profile_id, 726 bcm_int_metadata_field_entry_t *field_entry); 727 728 /* Delete the metadata field from the metadata profile. */ 729 extern int bcm_int_metadata_field_delete( 730 int unit, 731 int profile_id, 732 bcm_int_metadata_field_entry_t *field_entry); 733 734 /* Delete all the metadata field from the metadata profile. */ 735 extern int bcm_int_metadata_field_delete_all( 736 int unit, 737 int profile_id); 738 739 /* Get the metadata field select information. */ 740 extern int bcm_int_metadata_field_select_info_get( 741 int unit, 742 bcm_int_metadata_field_t field, 743 bcm_int_metadata_field_select_info_t *field_select_info); 744 745 #endif /* defined(INCLUDE_INT) */ 746 747 #endif /* BCM_HIDE_DISPATCHABLE */ 748 749 #endif /* __BCM_INT_H__ */