hash_output_selection.h (13972B)
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_HASH_OUTPUT_SELECTION_H 12 #define BCMI_LTSW_HASH_OUTPUT_SELECTION_H 13 14 #include <bcm/types.h> 15 16 #include <sal/sal_types.h> 17 18 /*! 19 * \brief Option to create hash output selection profile. 20 */ 21 /*! Use input profile Id instead of allocating a new one. */ 22 #define BCMI_LTSW_HOS_PROFILE_CREATE_OPTION_WITH_ID (1 << 0) 23 24 /*! 25 * \brief The max available profile identifier. 26 */ 27 /*! Profile identifier 0. */ 28 #define BCMI_LTSW_HOS_PROFILE_ID_0 0 29 30 /*! Profile identifier 1. */ 31 #define BCMI_LTSW_HOS_PROFILE_ID_1 1 32 33 /*! Profile identifier 2. */ 34 #define BCMI_LTSW_HOS_PROFILE_ID_2 2 35 36 /*! Profile identifier 3. */ 37 #define BCMI_LTSW_HOS_PROFILE_ID_3 3 38 39 /*! 40 * \brief The Hash Output Selection Resolution type. 41 */ 42 typedef enum bcmi_ltsw_hos_type_s { 43 44 /*! For trunk unicast packet resolution. */ 45 bcmiHosTypeTrunkUc = 0, 46 47 /*! For trunk non-unicast packet resolution. */ 48 bcmiHosTypeTrunkNonUc = 1, 49 50 /*! For trunk failover resolution. */ 51 bcmiHosTypeTrunkFailover = 2, 52 53 /*! For trunk system resolution. */ 54 bcmiHosTypeTrunkSystem = 3, 55 56 /*! For trunk system failover resolution. */ 57 bcmiHosTypeTrunkSystemFailover = 4, 58 59 /*! For VPLAG resolution. */ 60 bcmiHosTypeTrunkVp = 5, 61 62 /*! For ECMP overlay resolution. */ 63 bcmiHosTypeEcmpOverlay = 6, 64 65 /*! For ECMP underlay resolution. */ 66 bcmiHosTypeEcmpUnderlay = 7, 67 68 /*! For DLB trunk resolution. */ 69 bcmiHosTypeDlbTrunk = 8, 70 71 /*! For DLB ECMP resolution. */ 72 bcmiHosTypeDlbEcmp = 9, 73 74 /*! For entropy hash resolution. */ 75 bcmiHosTypeEntropy = 10, 76 77 /*! HOS resolution type count. */ 78 bcmiHosTypeCount = 11 79 80 } bcmi_ltsw_hos_type_t; 81 82 #define BCMI_LTSW_HOS_TYPE_STR \ 83 { \ 84 "TrunkUc", \ 85 "TrunkNonUc", \ 86 "TrunkFailover", \ 87 "TrunkSystem", \ 88 "TrunkSystemFailover", \ 89 "TrunkVp", \ 90 "EcmpOverlay", \ 91 "EcmpUnderlay", \ 92 "DlbTrunk", \ 93 "DlbEcmp", \ 94 "Entropy" \ 95 } 96 97 /*! 98 * \brief The Hash Output Selection control type. 99 */ 100 typedef enum bcmi_ltsw_hos_control_s { 101 102 /*! Use macro flow identifier as shuffle table index. */ 103 bcmiHosControlUseFlowSel = 0, 104 105 /*! Use higig3 entropy as shuffle table index. */ 106 bcmiHosControlUseHigig3Entropy = 1, 107 108 /*! Initial seed value. */ 109 bcmiHosControlSeed = 2, 110 111 /*! Hash value offset. */ 112 bcmiHosControlOffset = 3, 113 114 /*! For trunk non-unicast packet resolution. */ 115 bcmiHosControlConcatEnable = 4, 116 117 /*! Minimum offset value to be used in hashing shuffle table. */ 118 bcmiHosControlMinOffset = 5, 119 120 /*! Maximum offset value to be used in hashing shuffle table. */ 121 bcmiHosControlMaxOffset = 6, 122 123 /*! Offset increment to be used for programming hash shuffle table. */ 124 bcmiHosControlStrideOffset = 7, 125 126 /*! Select the bit count of hash result. */ 127 bcmiHosControlBitCountSelect = 8, 128 129 /*! HOS control type count. */ 130 bcmiHosControlCount = 9 131 132 } bcmi_ltsw_hos_control_t; 133 134 #define BCMI_LTSW_HOS_CONTROL_STR \ 135 { \ 136 "UseFlowSel", \ 137 "UseHigig3Entropy", \ 138 "Seed", \ 139 "Offset", \ 140 "ConcatEnable", \ 141 "MinOffset", \ 142 "MaxOffset", \ 143 "StrideOffset", \ 144 "BitCountSelect" \ 145 } 146 147 /*! 148 * \brief The Hash Output Selection Profile control type. 149 */ 150 typedef enum bcmi_ltsw_hos_profile_control_s { 151 152 /*! For trunk unicast packet resolution. */ 153 bcmiHosProfileControlInstance = 0, 154 155 /*! For trunk non-unicast packet resolution. */ 156 bcmiHosProfileControlFlowIdSrc = 1, 157 158 /*! For trunk non-unicast packet use higig3 entropy resolution. */ 159 bcmiHosProfileControlUseHigig3Entropy = 2, 160 161 /*! Enable to select ECMP level0 member index from the input bus. */ 162 bcmiHosProfileControlMemberIndex = 3, 163 164 /*! Enable for weighted distribution ECMP. */ 165 bcmiHosProfileControlWEcmp = 4, 166 167 /*! HOS profile control type count. */ 168 bcmiHosProfileControlCount = 5 169 170 } bcmi_ltsw_hos_profile_control_t; 171 172 #define BCMI_LTSW_HOS_PROFILE_CONTROL_STR \ 173 { \ 174 "Instance", \ 175 "FlowIdSrc", \ 176 "UseHigig3Entropy", \ 177 "MemberIndex", \ 178 "WEcmp" \ 179 } 180 181 /*! 182 * \brief The hash output selection instance control type. 183 */ 184 typedef enum bcmi_ltsw_hos_instance_control_s { 185 186 /*! Hash result size of instance for a specific hash type. */ 187 bcmiHosInstaceControlResultSize = 0, 188 189 /*! Hash offset of instance for a specific hash type. */ 190 bcmiHosInstaceControlOffset = 1, 191 192 /*! Hash subselect of instance for a specific hash type. */ 193 bcmiHosInstaceControlSubSelect = 2, 194 195 /*! Hash concatenation of instance for a specific hash type. */ 196 bcmiHosInstaceControlConcat = 3, 197 198 /*! HOS instance field type count. */ 199 bcmiHosInstaceControlCount = 4 200 201 } bcmi_ltsw_hos_instance_control_t; 202 203 #define BCMI_LTSW_HOS_INSTANCE_CONTROL_STR \ 204 { \ 205 "ResultSize", \ 206 "Offset", \ 207 "SubSelect", \ 208 "Concat" \ 209 } 210 211 /*! 212 * \brief The hash flow identifier source. 213 */ 214 typedef enum bcmi_ltsw_hos_flow_id_source_s { 215 216 /*! The bus hash index. */ 217 bcmiHosFlowIdSrcBusHashIndex = 0, 218 219 /*! Hash A0 Low. */ 220 bcmiHosFlowIdSrcHashA0Lo = 1, 221 222 /*! Hash A0 High. */ 223 bcmiHosFlowIdSrcHashA0Hi = 2, 224 225 /*! Hash A1 Low. */ 226 bcmiHosFlowIdSrcHashA1Lo = 3, 227 228 /*! Hash A1 High. */ 229 bcmiHosFlowIdSrcHashA1Hi = 4, 230 231 /*! Hash B0 Low. */ 232 bcmiHosFlowIdSrcHashB0Lo = 5, 233 234 /*! Hash B0 High. */ 235 bcmiHosFlowIdSrcHashB0Hi = 6, 236 237 /*! Hash B1 Low. */ 238 bcmiHosFlowIdSrcHashB1Lo = 7, 239 240 /*! Hash B1 High. */ 241 bcmiHosFlowIdSrcHashB1Hi = 8, 242 243 /*! Hash C0 Low. */ 244 bcmiHosFlowIdSrcHashC0Lo = 9, 245 246 /*! Hash C0 High. */ 247 bcmiHosFlowIdSrcHashC0Hi = 10, 248 249 /*! Hash C1 Low. */ 250 bcmiHosFlowIdSrcHashC1Lo = 11, 251 252 /*! Hash C1 High. */ 253 bcmiHosFlowIdSrcHashC1Hi = 12, 254 255 /*! HOS flow identifier source count. */ 256 bcmiHosFlowIdSrcCount = 13 257 258 } bcmi_ltsw_hos_flow_id_source_t; 259 260 #define BCMI_LTSW_HOS_FLOW_ID_SOURCE_STR \ 261 { \ 262 "BusHashIndex", \ 263 "HashA0Lo", \ 264 "HashA0Hi", \ 265 "HashA1Lo", \ 266 "HashA1Hi", \ 267 "HashB0Lo", \ 268 "HashB0Hi", \ 269 "HashB1Lo", \ 270 "HashB1Hi", \ 271 "HashC0Lo", \ 272 "HashC0Hi", \ 273 "HashC1Lo", \ 274 "HashC1Hi" \ 275 } 276 277 /*! 278 * \brief ECMP member index source source. 279 */ 280 typedef enum bcmi_ltsw_hos_ecmp_member_idx_s { 281 282 /*! Member index is locally generated. */ 283 bcmiHosEcmpMemberIndexLocallyGenerated = 0, 284 285 /*! Member index is taken from the input bus. */ 286 bcmiHosEcmpMemberIndexInputBus = 1, 287 288 /*! The ecmp member index source count. */ 289 bcmiHosEcmpMemberIndexCount = 2 290 291 } bcmi_ltsw_hos_ecmp_member_idx_t; 292 293 #define BCMI_LTSW_HOS_ECMP_MEMBER_IDX_STR \ 294 { \ 295 "LocallyGenerated", \ 296 "InputBus" \ 297 } 298 299 /*! 300 * \brief Control the hash output selection. 301 * 302 * \param [in] unit Unit Number. 303 * \param [in] type The hash output selection type. 304 * \param [in] ctrl_type The hash output selection control type. 305 * \param [in] value The hash output selection control value. 306 * 307 * \retval SHR_E_NONE No errors. 308 * \retval !SHR_E_NONE Failure. 309 */ 310 extern int 311 bcmi_ltsw_hos_control_set( 312 int unit, 313 bcmi_ltsw_hos_type_t type, 314 bcmi_ltsw_hos_control_t ctrl_type, 315 int value); 316 317 /*! 318 * \brief Get the hash output selection configuration. 319 * 320 * \param [in] unit Unit Number. 321 * \param [in] type The hash output selection type. 322 * \param [in] ctrl_type The hash output selection control type. 323 * \param [out] value The hash output selection control value. 324 * 325 * \retval SHR_E_NONE No errors. 326 * \retval !SHR_E_NONE Failure. 327 */ 328 extern int 329 bcmi_ltsw_hos_control_get( 330 int unit, 331 bcmi_ltsw_hos_type_t type, 332 bcmi_ltsw_hos_control_t ctrl_type, 333 int *value); 334 335 /*! 336 * \brief Control the port based hash output selection. 337 * 338 * \param [in] unit Unit Number. 339 * \param [in] type The hash output selection type. 340 * \param [in] port Port Number. 341 * \param [in] ctrl_type The hash output selection control type. 342 * \param [in] value The hash output selection control value. 343 * 344 * \retval SHR_E_NONE No errors. 345 * \retval !SHR_E_NONE Failure. 346 */ 347 extern int 348 bcmi_ltsw_hos_control_port_set( 349 int unit, 350 bcmi_ltsw_hos_type_t type, 351 bcm_port_t port, 352 bcmi_ltsw_hos_control_t ctrl_type, 353 int value); 354 355 /*! 356 * \brief Get the port based hash output selection configuration. 357 * 358 * \param [in] unit Unit Number. 359 * \param [in] type The hash output selection type. 360 * \param [in] port Port Number. 361 * \param [in] ctrl_type The hash output selection control type. 362 * \param [out] value The hash output selection control value. 363 * 364 * \retval SHR_E_NONE No errors. 365 * \retval !SHR_E_NONE Failure. 366 */ 367 extern int 368 bcmi_ltsw_hos_control_port_get( 369 int unit, 370 bcmi_ltsw_hos_type_t type, 371 bcm_port_t port, 372 bcmi_ltsw_hos_control_t ctrl_type, 373 int *value); 374 375 /*! 376 * \brief Control the macro flow based hash output selection. 377 * 378 * \param [in] unit Unit Number. 379 * \param [in] type The hash output selection type. 380 * \param [in] ctrl_type The hash output selection control type. 381 * \param [in] value The hash output selection control value. 382 * 383 * \retval SHR_E_NONE No errors. 384 * \retval !SHR_E_NONE Failure. 385 */ 386 extern int 387 bcmi_ltsw_hos_control_flow_set( 388 int unit, 389 bcmi_ltsw_hos_type_t type, 390 bcmi_ltsw_hos_control_t ctrl_type, 391 int value); 392 393 /*! 394 * \brief Get the macro flow based hash output selection configuration. 395 * 396 * \param [in] unit Unit Number. 397 * \param [in] type The hash output selection type. 398 * \param [in] ctrl_type The hash output selection control type. 399 * \param [out] value The hash output selection control value. 400 * 401 * \retval SHR_E_NONE No errors. 402 * \retval !SHR_E_NONE Failure. 403 */ 404 extern int 405 bcmi_ltsw_hos_control_flow_get( 406 int unit, 407 bcmi_ltsw_hos_type_t type, 408 bcmi_ltsw_hos_control_t ctrl_type, 409 int *value); 410 411 /*! 412 * \brief dump software information for HOS module. 413 * 414 * \param [in] unit Unit Number. 415 */ 416 extern void 417 bcmi_ltsw_hos_sw_dump(int unit); 418 419 /*! 420 * \brief Insert a hash output selection profile to logical table. 421 * 422 * \param [in] unit Unit Number. 423 * \param [in] option Profile created option. 424 * \param [inout] profile_id Profile identifier. 425 * 426 * \retval SHR_E_NONE No errors. 427 * \retval !SHR_E_NONE Failure. 428 */ 429 extern int 430 bcmi_ltsw_hos_profile_create( 431 int unit, 432 uint32_t option, 433 int *profile_id); 434 435 /*! 436 * \brief Delete a hash output selection profile from logical table. 437 * 438 * \param [in] unit Unit Number. 439 * \param [in] profile_id Profile identifier. 440 * 441 * \retval SHR_E_NONE No errors. 442 * \retval !SHR_E_NONE Failure. 443 */ 444 extern int 445 bcmi_ltsw_hos_profile_destroy( 446 int unit, 447 int profile_id); 448 449 /*! 450 * \brief Multi-control the hash output selection profile. 451 * 452 * \param [in] unit Unit Number. 453 * \param [in] profile_id Profile identifier. 454 * \param [in] type The hash output selection type. 455 * \param [in] array_size controlling configuration array size. 456 * \param [in] ctrl_type The hash output selection profile control type array. 457 * \param [in] value The hash output selection profile control value array. 458 * 459 * \retval SHR_E_NONE No errors. 460 * \retval !SHR_E_NONE Failure. 461 */ 462 extern int 463 bcmi_ltsw_hos_profile_set( 464 int unit, 465 int profile_id, 466 bcmi_ltsw_hos_type_t type, 467 int array_size, 468 bcmi_ltsw_hos_profile_control_t *ctrl_type, 469 int *value); 470 471 /*! 472 * \brief Get the hash output selection profile configuration. 473 * 474 * \param [in] unit Unit Number. 475 * \param [in] profile_id Profile identifier. 476 * \param [in] type The hash output selection type. 477 * \param [in] ctrl_type The hash output selection profile control type. 478 * \param [out] value The hash output selection profile control value. 479 * 480 * \retval SHR_E_NONE No errors. 481 * \retval !SHR_E_NONE Failure. 482 */ 483 extern int 484 bcmi_ltsw_hos_profile_get( 485 int unit, 486 int profile_id, 487 bcmi_ltsw_hos_type_t type, 488 bcmi_ltsw_hos_profile_control_t ctrl_type, 489 int *value); 490 491 /*! 492 * \brief Multi-control the hash output selection instance. 493 * 494 * \param [in] unit Unit Number. 495 * \param [in] type The hash output selection type. 496 * \param [in] inst_id Instance identifier. 497 * \param [in] flow_id Flow identifier. 498 * \param [in] array_size Controlling configuration array size. 499 * \param [in] ctrl_type The hash output selection instance control type array. 500 * \param [in] value The hash output selection instance control value array. 501 * 502 * \retval SHR_E_NONE No errors. 503 * \retval !SHR_E_NONE Failure. 504 */ 505 extern int 506 bcmi_ltsw_hos_instance_set( 507 int unit, 508 bcmi_ltsw_hos_type_t type, 509 int inst_id, 510 int flow_id, 511 int array_size, 512 bcmi_ltsw_hos_instance_control_t *ctrl_type, 513 int *value); 514 515 /*! 516 * \brief Get the hash output selection instance configuration. 517 * 518 * \param [in] unit Unit Number. 519 * \param [in] type The hash output selection type. 520 * \param [in] inst_id Instance identifier. 521 * \param [in] flow_id Flow identifier. 522 * \param [in] array_size Controlling configuration array size. 523 * \param [in] ctrl_type The hash output selection instance control type. 524 * \param [out] value The hash output selection instance control value. 525 * 526 * \retval SHR_E_NONE No errors. 527 * \retval !SHR_E_NONE Failure. 528 */ 529 extern int 530 bcmi_ltsw_hos_instance_get( 531 int unit, 532 bcmi_ltsw_hos_type_t type, 533 int inst_id, 534 int flow_id, 535 int array_size, 536 bcmi_ltsw_hos_instance_control_t *ctrl_type, 537 int *value); 538 539 /*! 540 * \brief Initialize the hash output selection module. 541 * 542 * \param [in] unit Unit Number. 543 * 544 * \retval SHR_E_NONE No errors. 545 * \retval !SHR_E_NONE Failure. 546 */ 547 extern int 548 bcmi_ltsw_hos_init(int unit); 549 550 /*! 551 * \brief De-init the hash output selection module. 552 * 553 * \param [in] unit Unit Number. 554 * 555 * \retval SHR_E_NONE No errors. 556 * \retval !SHR_E_NONE Failure. 557 */ 558 extern int 559 bcmi_ltsw_hos_deinit(int unit); 560 561 #endif /* BCMI_LTSW_HASH_OUTPUT_SELECTION_H */