int.h (16620B)
1 /* 2 * DO NOT EDIT THIS FILE! 3 * This file is auto-generated. 4 * Edits to this file will be lost when it is regenerated. 5 * 6 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 7 * 8 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 9 */ 10 11 #ifndef BCMI_LTSW_INT_H 12 #define BCMI_LTSW_INT_H 13 14 #if defined(INCLUDE_INT) 15 16 #include <bcm/int.h> 17 18 #include <sal/sal_types.h> 19 20 /*! 21 * \brief Application switch control type of INT for a specific device. 22 */ 23 typedef enum bcmi_ltsw_int_control_s { 24 25 /*! Action for inband telemetry packets with no vector match. 0: Drop, 1: Forward as non-INT packet. */ 26 bcmiIntControlVectorMatchMissAction = 0, 27 28 /*! Time in nano-second that is added to current timestamp to adjust latency from egress pipeline to port. */ 29 bcmiIntControlEgressTimeDelta = 1, 30 31 /*! Switch identifier. */ 32 bcmiIntControlSwitchId = 2, 33 34 /*! IFA version number. */ 35 bcmiIntControlIfaVersion = 3, 36 37 /*! IFA protocol value. */ 38 bcmiIntControlIfaProtocol = 4, 39 40 /*! Enable to parse IOAM packet with GRE encapsulation. */ 41 bcmiIntControlIoamGreProtocolParse = 5, 42 43 /*! IOAM GRE protocol value. */ 44 bcmiIntControlIoamGreProtocol = 6, 45 46 /*! Enable to parse IOAM packet with IPV6 encapsulation. */ 47 bcmiIntControlIoamOptionIncrementalParse = 7, 48 49 /*! IOAM option type value. */ 50 bcmiIntControlIoamOptionIncremental = 8, 51 52 /*! IOAM type value. */ 53 bcmiIntControlIoamType = 9, 54 55 /*! INT-DP version number. */ 56 bcmiIntControlIntDpVersion = 10, 57 58 /*! INT-DP UDP destination port1. */ 59 bcmiIntControlIntDpL4DestPort1 = 11, 60 61 /*! INT-DP UDP destination port2. */ 62 bcmiIntControlIntDpL4DestPort2 = 12, 63 64 /*! INT-DP Use header ProbeMarker1. */ 65 bcmiIntControlIntDpUseProbeMarker1 = 13, 66 67 /*! INT-DP header ProbeMarker1. */ 68 bcmiIntControlIntDpProbeMarker1 = 14, 69 70 /*! INT-DP Use header ProbeMarker2. */ 71 bcmiIntControlIntDpUseProbeMarker2 = 15, 72 73 /*! INT-DP header ProbeMarker2. */ 74 bcmiIntControlIntDpProbeMarker2 = 16, 75 76 /*! Enable copy to CPU on egress port as turnaround port. */ 77 bcmiIntControlIntTurnAroundCpuEnable = 17, 78 79 /*! Enable copy to CPU on hop limit condition. */ 80 bcmiIntControlIntHopLimitCpuEnable = 18, 81 82 /*! INT control type count. */ 83 bcmiIntControlCount = 19 84 85 } bcmi_ltsw_int_control_t; 86 87 #define BCMI_LTSW_INT_CONTROL_STR \ 88 { \ 89 "VectorMatchMissAction", \ 90 "EgressTimeDelta", \ 91 "SwitchId", \ 92 "IfaVersion", \ 93 "IfaProtocol", \ 94 "IoamGreProtocolParse", \ 95 "IoamGreProtocol", \ 96 "IoamOptionIncrementalParse", \ 97 "IoamOptionIncremental", \ 98 "IoamType", \ 99 "IntDpVersion", \ 100 "IntDpL4DestPort1", \ 101 "IntDpL4DestPort2", \ 102 "IntDpUseProbeMarker1", \ 103 "IntDpProbeMarker1", \ 104 "IntDpUseProbeMarker2", \ 105 "IntDpProbeMarker2", \ 106 "IntTurnAroundCpuEnable", \ 107 "IntHopLimitCpuEnable" \ 108 } 109 110 /*! Replace an INT vector match. */ 111 #define BCMI_LTSW_INT_VECTOR_MATCH_OPTIONS_REPLACE (1 << 0) 112 113 /*! 114 * \brief INT vector match type. 115 */ 116 typedef enum bcmi_ltsw_int_vector_match_type_s { 117 118 /*! Reserved. */ 119 bcmiIntVectorMatchTypeNone = 0, 120 121 /*! In-band Flow Analyzer. */ 122 bcmiIntVectorMatchTypeIfa = 1, 123 124 /*! In-site Operations, Administration, and Maintenance. */ 125 bcmiIntVectorMatchTypeIoam = 2, 126 127 /*! In-band Network Telemetry Data-plane Probe. */ 128 bcmiIntVectorMatchTypeIntDp = 3, 129 130 /*! The count of vector match type, must be the last. */ 131 bcmiIntVectorMatchTypeCount = 4 132 133 } bcmi_ltsw_int_vector_match_type_t; 134 135 #define BCMI_LTSW_INT_VECTOR_MATCH_TYPE_STR \ 136 { \ 137 "None", \ 138 "Ifa", \ 139 "Ioam", \ 140 "IntDp" \ 141 } 142 143 /*! 144 * \brief INT vector match criteria. 145 */ 146 typedef struct bcmi_ltsw_int_vector_match_s { 147 148 /*! vector match type. */ 149 bcmi_ltsw_int_vector_match_type_t type; 150 151 /*! The priority of the vector match. */ 152 int priority; 153 154 /*! IFA/INT-DP metadata header request vector value or IOAM metadata trace type value. */ 155 uint32_t request_vector; 156 157 /*! IFA/INT-DP metadata header request vector mask or IOAM metadata trace type mask. */ 158 uint32_t request_vector_mask; 159 160 /*! IFA metadata LNS value. */ 161 uint8_t md_hdr_temp_id; 162 163 /*! IFA metadata LNS mask. */ 164 uint8_t md_hdr_temp_id_mask; 165 166 /*! IFA header GNS value or IOAM metadata namespace ID value. */ 167 uint16_t base_hdr_ns_id; 168 169 /*! IFA header GNS mask or IOAM metadata namespace ID mask. */ 170 uint16_t base_hdr_ns_id_mask; 171 172 /*! Profile ID to select and construct INT metadata. */ 173 uint8_t metadata_profile_id; 174 175 } bcmi_ltsw_int_vector_match_t; 176 177 /*! 178 * \brief Definition of callback to construct ifa info from int. 179 * 180 * \param [in] unit Unit Number. 181 * \param [in] int_vector_match INT vector match criteria. 182 * \param [out] int_ifa_vector_match IFA vector match criteria. 183 * 184 * \retval SHR_E_NONE No errors. 185 * \retval !SHR_E_NONE Failure. 186 */ 187 typedef int (*bcmi_ltsw_int_ifa_vector_match_from_int_cb_f)( 188 int unit, 189 bcmi_ltsw_int_vector_match_t *int_vector_match, 190 bcm_int_ifa_vector_match_t *int_ifa_vector_match); 191 192 /*! 193 * \brief Definition of callback to construct ioam info from int. 194 * 195 * \param [in] unit Unit Number. 196 * \param [in] int_vector_match INT vector match criteria. 197 * \param [out] int_ioam_vector_match IOAM vector match criteria. 198 * 199 * \retval SHR_E_NONE No errors. 200 * \retval !SHR_E_NONE Failure. 201 */ 202 typedef int (*bcmi_ltsw_int_ioam_vector_match_from_int_cb_f)( 203 int unit, 204 bcmi_ltsw_int_vector_match_t *int_vector_match, 205 bcm_int_ioam_vector_match_t *int_ioam_vector_match); 206 207 /*! 208 * \brief Definition of callback to construct int-dp info from int. 209 * 210 * \param [in] unit Unit Number. 211 * \param [in] int_vector_match INT vector match criteria. 212 * \param [out] int_dp_vector_match INT-DP vector match criteria. 213 * 214 * \retval SHR_E_NONE No errors. 215 * \retval !SHR_E_NONE Failure. 216 */ 217 typedef int (*bcmi_ltsw_int_dp_vector_match_from_int_cb_f)( 218 int unit, 219 bcmi_ltsw_int_vector_match_t *int_vector_match, 220 bcm_int_dp_vector_match_t *int_dp_vector_match); 221 222 /*! Create the INT action profile with ID. */ 223 #define BCMI_LTSW_INT_ACTION_PROFILE_OPTIONS_WITH_ID (1 << 0) 224 225 /*! Replace the INT action profile. */ 226 #define BCMI_LTSW_INT_ACTION_PROFILE_OPTIONS_REPLACE (1 << 1) 227 228 /*! Enable to update IP length after metadata insertion. */ 229 #define BCMI_LTSW_INT_ACTION_PROFILE_FLAGS_IP_LENGTH_UPDATE (1 << 0) 230 231 /*! Enable to update UDP length after metadata insertion. */ 232 #define BCMI_LTSW_INT_ACTION_PROFILE_FLAGS_UDP_LENGTH_UPDATE (1 << 1) 233 234 /*! 235 * \brief INT action profile type. 236 */ 237 typedef enum bcmi_ltsw_int_action_profile_type_s { 238 239 /*! Reserved. */ 240 bcmiIntActionProfileTypeNone = 0, 241 242 /*! In-band Flow Analyzer. */ 243 bcmiIntActionProfileTypeIfa = 1, 244 245 /*! In-site Operations, Administration, and Maintenance. */ 246 bcmiIntActionProfileTypeIoam = 2, 247 248 /*! In-band Network Telemetry Data-plane Probe. */ 249 bcmiIntActionProfileTypeIntDp = 3, 250 251 /*! The count of action profile type, must be the last. */ 252 bcmiIntActionProfileTypeCount = 4 253 254 } bcmi_ltsw_int_action_profile_type_t; 255 256 #define BCMI_LTSW_INT_ACTION_PROFILE_TYPE_STR \ 257 { \ 258 "None", \ 259 "Ifa", \ 260 "Ioam", \ 261 "IntDp" \ 262 } 263 264 /*! 265 * \brief INT action profile. 266 */ 267 typedef struct bcmi_ltsw_int_action_profile_s { 268 269 /*! Action profile type. */ 270 bcmi_ltsw_int_action_profile_type_t type; 271 272 /*! Action profile flags. */ 273 uint32_t flags; 274 275 /*! Timestamp mode for ingress timestamp, egress timestamp and residence time. */ 276 bcm_int_timestamp_mode_t timestamp_mode; 277 278 /*! Format for residence time. */ 279 bcm_int_residence_time_format_t residence_time_format; 280 281 /*! Header operation mode. */ 282 bcm_int_header_operation_mode_t header_operation_mode; 283 284 /*! The updating mode for the O-bit in the flag field during metadata insertion. */ 285 bcm_int_ioam_o_bit_update_mode_t o_bit_update_mode; 286 287 /*! Profile ID to select and construct INT metadata. This can be used to overwrite the profile assigned by INT vector match. */ 288 uint8_t metadata_profile_id; 289 290 } bcmi_ltsw_int_action_profile_t; 291 292 /*! 293 * \brief Definition of callback to construct ifa info from int. 294 * 295 * \param [in] unit Unit Number. 296 * \param [in] int_action_profile INT action profile. 297 * \param [out] int_ifa_action_profile IFA action profile. 298 * 299 * \retval SHR_E_NONE No errors. 300 * \retval !SHR_E_NONE Failure. 301 */ 302 typedef int (*bcmi_ltsw_int_ifa_action_profile_from_int_cb_f)( 303 int unit, 304 bcmi_ltsw_int_action_profile_t *int_action_profile, 305 bcm_int_ifa_action_profile_t *int_ifa_action_profile); 306 307 /*! 308 * \brief Definition of callback to construct ioam info from int. 309 * 310 * \param [in] unit Unit Number. 311 * \param [in] int_action_profile INT action profile. 312 * \param [out] int_ioam_action_profile IOAM action profile. 313 * 314 * \retval SHR_E_NONE No errors. 315 * \retval !SHR_E_NONE Failure. 316 */ 317 typedef int (*bcmi_ltsw_int_ioam_action_profile_from_int_cb_f)( 318 int unit, 319 bcmi_ltsw_int_action_profile_t *int_action_profile, 320 bcm_int_ioam_action_profile_t *int_ioam_action_profile); 321 322 /*! 323 * \brief Definition of callback to construct int-dp info from int. 324 * 325 * \param [in] unit Unit Number. 326 * \param [in] int_action_profile INT action profile. 327 * \param [out] int_dp_action_profile INT-DP action profile. 328 * 329 * \retval SHR_E_NONE No errors. 330 * \retval !SHR_E_NONE Failure. 331 */ 332 typedef int (*bcmi_ltsw_int_dp_action_profile_from_int_cb_f)( 333 int unit, 334 bcmi_ltsw_int_action_profile_t *int_action_profile, 335 bcm_int_dp_action_profile_t *int_dp_action_profile); 336 337 /*! 338 * \brief Specify INT switch control behaviors. 339 * 340 * \param [in] unit Unit Number. 341 * \param [in] control The desired configuration parameter to modify. 342 * \param [in] value The value with which to set the parameter. 343 * 344 * \retval SHR_E_NONE Success. 345 * \retval !SHR_E_NONE Failure. 346 */ 347 extern int 348 bcmi_ltsw_int_control_set( 349 int unit, 350 bcmi_ltsw_int_control_t control, 351 uint32_t value); 352 353 /*! 354 * \brief Retrieve INT switch control behaviors. 355 * 356 * \param [in] unit Unit Number. 357 * \param [in] control The desired configuration parameter to retrieve. 358 * \param [out] value Pointer to where the retrieved value will be written. 359 * 360 * \retval SHR_E_NONE Success. 361 * \retval !SHR_E_NONE Failure. 362 */ 363 extern int 364 bcmi_ltsw_int_control_get( 365 int unit, 366 bcmi_ltsw_int_control_t control, 367 uint32_t *value); 368 369 /*! 370 * \brief Add a vector match for INT. 371 * 372 * \param [in] unit Unit Number. 373 * \param [in] options Add options. 374 * \param [in/out] vector_match Vector match criteria. 375 * 376 * \retval SHR_E_NONE Success. 377 * \retval !SHR_E_NONE Failure. 378 */ 379 extern int 380 bcmi_ltsw_int_vector_match_add( 381 int unit, 382 uint32_t options, 383 bcmi_ltsw_int_vector_match_t *vector_match); 384 385 /*! 386 * \brief Get the vector match for INT. 387 * 388 * \param [in] unit Unit Number. 389 * \param [in/out] vector_match Vector match criteria. 390 * 391 * \retval SHR_E_NONE Success. 392 * \retval !SHR_E_NONE Failure. 393 */ 394 extern int 395 bcmi_ltsw_int_vector_match_get( 396 int unit, 397 bcmi_ltsw_int_vector_match_t *vector_match); 398 399 /*! 400 * \brief Delete the vector match for IFA. 401 * 402 * \param [in] unit Unit Number. 403 * \param [in] vector_match Vector match criteria. 404 * 405 * \retval SHR_E_NONE Success. 406 * \retval !SHR_E_NONE Failure. 407 */ 408 extern int 409 bcmi_ltsw_int_vector_match_delete( 410 int unit, 411 bcmi_ltsw_int_vector_match_t *vector_match); 412 413 /*! 414 * \brief Delete all vector matches for IFA. 415 * 416 * \param [in] unit Unit Number. 417 * \param [in] type Vector match type. 418 * 419 * \retval SHR_E_NONE Success. 420 * \retval !SHR_E_NONE Failure. 421 */ 422 extern int 423 bcmi_ltsw_int_vector_match_delete_all( 424 int unit, 425 bcmi_ltsw_int_vector_match_type_t type); 426 427 /*! 428 * \brief Create the INT action profile. 429 * 430 * \param [in] unit Unit Number. 431 * \param [in] options Create options. 432 * \param [in/out] profile_id Action profile ID. 433 * \param [in] profile Action profile. 434 * 435 * \retval SHR_E_NONE No errors. 436 * \retval !SHR_E_NONE Failure. 437 */ 438 extern int 439 bcmi_ltsw_int_action_profile_create( 440 int unit, 441 uint32 options, 442 int *profile_id, 443 bcmi_ltsw_int_action_profile_t *profile); 444 445 /*! 446 * \brief Get the INT action profile. 447 * 448 * \param [in] unit Unit Number. 449 * \param [in] profile_id Action profile ID. 450 * \param [out] profile Action profile. 451 * 452 * \retval SHR_E_NONE No errors. 453 * \retval !SHR_E_NONE Failure. 454 */ 455 extern int 456 bcmi_ltsw_int_action_profile_get( 457 int unit, 458 int profile_id, 459 bcmi_ltsw_int_action_profile_t *profile); 460 461 /*! 462 * \brief Destroy the INT action profile. 463 * 464 * \param [in] unit Unit Number. 465 * \param [in] type Action profile type. 466 * \param [in] profile_id Action profile ID. 467 * 468 * \retval SHR_E_NONE No errors. 469 * \retval !SHR_E_NONE Failure. 470 */ 471 extern int 472 bcmi_ltsw_int_action_profile_destroy( 473 int unit, 474 bcmi_ltsw_int_action_profile_type_t type, 475 int profile_id); 476 477 /*! 478 * \brief Traverse all vector matches for IFA. 479 * 480 * \param [in] unit Unit Number. 481 * \param [in] trav_fn A pointer to the callback function to call for each vector match. 482 * \param [in] cb A pointer to the callback function to call for construct ifa info from int. 483 * \param [in] user_data Pointer to user data to supply in the callback. 484 * 485 * \retval SHR_E_NONE No errors. 486 * \retval !SHR_E_NONE Failure. 487 */ 488 extern int 489 bcmi_ltsw_int_vector_match_ifa_traverse( 490 int unit, 491 bcm_int_ifa_vector_match_traverse_cb trav_fn, 492 bcmi_ltsw_int_ifa_vector_match_from_int_cb_f cb, 493 void *user_data); 494 495 /*! 496 * \brief Traverse all vector matches for IOAM. 497 * 498 * \param [in] unit Unit Number. 499 * \param [in] trav_fn A pointer to the callback function to call for each vector match. 500 * \param [in] cb A pointer to the callback function to call for construct ioam info from int. 501 * \param [in] user_data Pointer to user data to supply in the callback. 502 * 503 * \retval SHR_E_NONE No errors. 504 * \retval !SHR_E_NONE Failure. 505 */ 506 extern int 507 bcmi_ltsw_int_vector_match_ioam_traverse( 508 int unit, 509 bcm_int_ioam_vector_match_traverse_cb trav_fn, 510 bcmi_ltsw_int_ioam_vector_match_from_int_cb_f cb, 511 void *user_data); 512 513 /*! 514 * \brief Traverse all vector matches for INT-DP. 515 * 516 * \param [in] unit Unit Number. 517 * \param [in] trav_fn A pointer to the callback function to call for each vector match. 518 * \param [in] cb A pointer to the callback function to call for construct int-dp info from int. 519 * \param [in] user_data Pointer to user data to supply in the callback. 520 * 521 * \retval SHR_E_NONE No errors. 522 * \retval !SHR_E_NONE Failure. 523 */ 524 extern int 525 bcmi_ltsw_int_vector_match_dp_traverse( 526 int unit, 527 bcm_int_dp_vector_match_traverse_cb trav_fn, 528 bcmi_ltsw_int_dp_vector_match_from_int_cb_f cb, 529 void *user_data); 530 531 /*! 532 * \brief Traverse all action profiles for IFA. 533 * 534 * \param [in] unit Unit Number. 535 * \param [in] trav_fn A pointer to the callback function to call for each action profile. 536 * \param [in] cb A pointer to the callback function to call for construct ifa info from int. 537 * \param [in] user_data Pointer to user data to supply in the callback. 538 * 539 * \retval SHR_E_NONE No errors. 540 * \retval !SHR_E_NONE Failure. 541 */ 542 extern int 543 bcmi_ltsw_int_action_profile_ifa_traverse( 544 int unit, 545 bcm_int_ifa_action_profile_traverse_cb trav_fn, 546 bcmi_ltsw_int_ifa_action_profile_from_int_cb_f cb, 547 void *user_data); 548 549 /*! 550 * \brief Traverse all action profiles for IOAM. 551 * 552 * \param [in] unit Unit Number. 553 * \param [in] trav_fn A pointer to the callback function to call for each action profile. 554 * \param [in] cb A pointer to the callback function to call for construct ioam info from int. 555 * \param [in] user_data Pointer to user data to supply in the callback. 556 * 557 * \retval SHR_E_NONE No errors. 558 * \retval !SHR_E_NONE Failure. 559 */ 560 extern int 561 bcmi_ltsw_int_action_profile_ioam_traverse( 562 int unit, 563 bcm_int_ioam_action_profile_traverse_cb trav_fn, 564 bcmi_ltsw_int_ioam_action_profile_from_int_cb_f cb, 565 void *user_data); 566 567 /*! 568 * \brief Traverse all action profiles for INT-DP. 569 * 570 * \param [in] unit Unit Number. 571 * \param [in] trav_fn A pointer to the callback function to call for each action profile. 572 * \param [in] cb A pointer to the callback function to call for construct int-dp info from int. 573 * \param [in] user_data Pointer to user data to supply in the callback. 574 * 575 * \retval SHR_E_NONE No errors. 576 * \retval !SHR_E_NONE Failure. 577 */ 578 extern int 579 bcmi_ltsw_int_action_profile_dp_traverse( 580 int unit, 581 bcm_int_dp_action_profile_traverse_cb trav_fn, 582 bcmi_ltsw_int_dp_action_profile_from_int_cb_f cb, 583 void *user_data); 584 585 #endif /* INCLUDE_INT */ 586 587 #endif /* BCMI_LTSW_INT_H */