lb_hash.h (23407B)
1 /*! \file lb_hash.h 2 * 3 * LB hash header file. 4 * This file contains LB hash definitions internal to the BCM library. 5 */ 6 /* 7 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 8 * 9 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 10 */ 11 12 #ifndef BCMI_LTSW_LB_HASH_H 13 #define BCMI_LTSW_LB_HASH_H 14 15 #include <bcm/types.h> 16 #include <bcm/field.h> 17 #include <bcm/switch.h> 18 19 /*! 20 * \brief The Hash Output Selection Resolution type. 21 */ 22 typedef enum bcmi_ltsw_lb_hash_os_s { 23 24 /*! For DLB ECMP packet resolution. */ 25 bcmiLbHosPortTypeDlbEcmp = 0, 26 27 /*! For ECMP packet resolution. */ 28 bcmiLbHosPortTypeEcmp = 1, 29 30 /*! For LBID or Entropy label resolution. */ 31 bcmiLbHosPortTypeEntropy = 2, 32 33 /*! For unicast trunk resolution. */ 34 bcmiLbHosPortTypeUcTrunk = 3, 35 36 /*! For non unicast trunk resolution. */ 37 bcmiLbHosPortTypeNonUcTrunk = 4, 38 39 /*! For MPLS ECMP resolution. */ 40 bcmiLbHosPortTypeMplsEcmp = 5, 41 42 /*! For Port LAG Failover resolution. */ 43 bcmiLbHosPortTypePlfs = 6, 44 45 /*! For resilient ECMP resolution. */ 46 bcmiLbHosPortTypeRhEcmp = 7, 47 48 /*! For Weighted ECMP resolution. */ 49 bcmiLbHosPortTypeWEcmp = 8, 50 51 /*! For overlay ECMP Resilient hashing. */ 52 bcmiLbHosPortTypeOverlayRhEcmp = 9, 53 54 /*! For MPLS overlay ECMP hashing. */ 55 bcmiLbHosPortTypeMplsOverlayEcmp = 10, 56 57 /*! For overlay ECMP hashing. */ 58 bcmiLbHosPortTypeOverlayEcmp = 11, 59 60 /*! For overlay weighted ECMP hashing. */ 61 bcmiLbHosPortTypeOverlayWEcmp = 12, 62 63 /*! For L2 ECMP hashing. */ 64 bcmiLbHosPortTypeL2Ecmp = 13, 65 66 /*! For overlay L2 ECMP hashing. */ 67 bcmiLbHosPortTypeL2OverlayEcmp = 14, 68 69 /*! For DLB ECMP packet resolution. */ 70 bcmiLbHosFlowTypeDlbEcmp = 15, 71 72 /*! For ECMP packet resolution. */ 73 bcmiLbHosFlowTypeEcmp = 16, 74 75 /*! For LBID or Entropy label resolution. */ 76 bcmiLbHosFlowTypeEntropy = 17, 77 78 /*! For trunk resolution. */ 79 bcmiLbHosFlowTypeTrunk = 18, 80 81 /*! For Weighted ECMP packet resolution. */ 82 bcmiLbHosFlowTypeWECMP = 19, 83 84 /*! For uc trunk resolution. */ 85 bcmiLbHosFlowTypeUcTrunk = 20, 86 87 /*! For non uc trunk resolution. */ 88 bcmiLbHosFlowTypeNonUcTrunk = 21, 89 90 /*! For resilient ECMP resolution. */ 91 bcmiLbHosFlowTypeRhEcmp = 22, 92 93 /*! For resilient overlay ECMP resolution. */ 94 bcmiLbHosFlowTypeOverlayRhEcmp = 23, 95 96 /*! For MPLS ECMP resolution. */ 97 bcmiLbHosFlowTypeMplsEcmp = 24, 98 99 /*! For MPLS overlay ECMP resolution. */ 100 bcmiLbHosFlowTypeMplsOverlayEcmp = 25, 101 102 /*! For LAG Failover resolution. */ 103 bcmiLbHosFlowTypePlfs = 26, 104 105 /*! For L2 ECMP hashing. */ 106 bcmiLbHosFlowTypeL2Ecmp = 27, 107 108 /*! For overlay L2 ECMP hashing. */ 109 bcmiLbHosFlowTypeL2OverlayEcmp = 28, 110 111 /*! For Overlay Weighted ECMP packet resolution. */ 112 bcmiLbHosFlowTypeOverlayWECMP = 29, 113 114 /*! For Overlay ECMP packet resolution. */ 115 bcmiLbHosFlowTypeOverlayECMP = 30, 116 117 /*! Flow HOS resolution type count. */ 118 bcmiLbHosTypeCount 119 120 } bcmi_ltsw_lb_hash_os_t; 121 122 /*! 123 * \brief The Flow Based Hash Output Selection Field type. 124 */ 125 typedef enum bcmi_ltsw_lb_hash_flow_field_s { 126 127 /*! Min field. */ 128 bcmiLbHosFlowScMin = 0, 129 130 /*! Max field. */ 131 bcmiLbHosFlowScMax = 1, 132 133 /*! Stride field. */ 134 bcmiLbHosFlowScStride = 2, 135 136 /*! Concat field. */ 137 bcmiLbHosFlowScConcat = 3, 138 139 /*! Field count. */ 140 bcmiLbHosFlowFieldCount 141 142 } bcmi_ltsw_lb_hash_flow_field_t; 143 144 145 /*! 146 * \brief The hash fields select type. 147 */ 148 typedef enum bcmi_ltsw_lb_hash_fields_select_s { 149 150 /*! Hash 0 IPV4 fields. */ 151 bcmiHash0FieldSelectTypeIP = 0, 152 153 /*! Hash 0 V4 TCP/UDP fields. */ 154 bcmiHash0FieldSelectTypeTcpUdp = 1, 155 156 /*! Hash 0 V4 L4 source port and destination port fields. */ 157 bcmiHash0FieldSelectTypeL4Port = 2, 158 159 /*! Hash 0 IPV6 fields. */ 160 bcmiHash0FieldSelectTypeIP6 = 3, 161 162 /*! Hash 0 V6 TCP/UDP fields. */ 163 bcmiHash0FieldSelectTypeTcpUdpIp6 = 4, 164 165 /*! Hash 0 V6 L4 source port and destination port fields. */ 166 bcmiHash0FieldSelectTypeL4PortIp6 = 5, 167 168 /*! Hash 0 L2 fields. */ 169 bcmiHash0FieldSelectTypeL2 = 6, 170 171 /*! Hash 0 L3 MPLS IP payload fields. */ 172 bcmiHash0FieldSelectTypeL3Mpls = 7, 173 174 /*! Hash 0 MPLS transit fields. */ 175 bcmiHash0FieldSelectTypeMplsTransit = 8, 176 177 /*! Hash 1 IPV4 fields. */ 178 bcmiHash1FieldSelectTypeIP = 9, 179 180 /*! Hash 1 V4 TCP/UDP fields. */ 181 bcmiHash1FieldSelectTypeTcpUdp = 10, 182 183 /*! Hash 1 V4 L4 source port and destination port fields. */ 184 bcmiHash1FieldSelectTypeL4Port = 11, 185 186 /*! Hash 1 IPV6 fields. */ 187 bcmiHash1FieldSelectTypeIP6 = 12, 188 189 /*! Hash 1 V6 TCP/UDP fields. */ 190 bcmiHash1FieldSelectTypeTcpUdpIp6 = 13, 191 192 /*! Hash 1 V6 L4 source port and destination port fields. */ 193 bcmiHash1FieldSelectTypeL4PortIp6 = 14, 194 195 /*! Hash 1 L2 fields. */ 196 bcmiHash1FieldSelectTypeL2 = 15, 197 198 /*! Hash 1 L3 MPLS IP payload fields. */ 199 bcmiHash1FieldSelectTypeL3Mpls = 16, 200 201 /*! Hash 1 MPLS transit fields. */ 202 bcmiHash1FieldSelectTypeMplsTransit = 17, 203 204 /*! Hash fields select type count. */ 205 bcmiFieldSelectTypeCount 206 207 } bcmi_ltsw_lb_hash_fields_select_t; 208 209 /*! 210 * \brief The hash bins assignment type. 211 */ 212 typedef enum bcmi_ltsw_lb_hash_bin_s { 213 214 /* Enable pre-processing for enhanced hash mode 0. */ 215 bcmiHashBinField0PreProcessEnable = 0, 216 217 /* Enable pre-processing for enhanced hash mode 1. */ 218 bcmiHashBinField1PreProcessEnable = 1, 219 220 /* Selections for IPV6 packets. */ 221 bcmiHashBinField0Ip6FlowLabel = 2, 222 223 /* Selections for IPV6 packets. */ 224 bcmiHashBinField1Ip6FlowLabel = 3, 225 226 /*! Hash 0 V6 TCP/UDP fields. */ 227 bcmiHashBinUdfHashEnable = 4, 228 229 /*! Enable using the Tunnel endpoint id for hashing, for GTP pkts. */ 230 bcmiHashBinGtpTeidEnable0 = 5, 231 232 /*! Enable using the Tunnel endpoint id for hashing, for GTP pkts. */ 233 bcmiHashBinGtpTeidEnable1 = 6, 234 235 /*! Hash fields select type count. */ 236 bcmiHashBinCount 237 238 } bcmi_ltsw_lb_hash_bin_t; 239 240 /*! 241 * \brief The hash packet header selection. 242 */ 243 typedef enum bcmi_ltsw_lb_hash_phs_s { 244 245 /*! Packet header field selection control. */ 246 bcmiPktHdrSelControl = 0, 247 248 /*! 249 * If there are more than 3 labels, 250 * label stack (up to 5 labels) is used 251 * for hashing else Top 3 MPLS labels + 252 * payload IPV4/IPv6 fields will be 253 * selected for hashing . 254 */ 255 bcmiPktHdrSelMplsUseLabelStack = 1, 256 257 /*! Hash Control to select the IPv6 Next Header field for hash Block A. */ 258 bcmiPktHdrSelIp6ExtensionHeader = 2, 259 260 /*! To exclude all reserved labels from hash computation */ 261 bcmiPktHdrSelplsExcludeReservedLabel = 3, 262 263 /*! Hash fields select type count. */ 264 bcmiPktHdrSelCount 265 266 } bcmi_ltsw_lb_hash_phs_t; 267 268 /*! 269 * \brief The hash ip6 collapse selection. 270 */ 271 typedef enum bcmi_ltsw_lb_hash_ip6cs_s { 272 273 /*! Hash Control to collapse IPV6 addresses for hash block A. */ 274 bcmiIp6CollapseField0 = 0, 275 276 /*! Hash Control to collapse IPV6 addresses for hash block B. */ 277 bcmiIp6CollapseField1 = 1, 278 279 280 /*! Hash Control to collapse IPV6 addresses count. */ 281 bcmiIp6CollapseFieldCount 282 283 } bcmi_ltsw_lb_hash_ip6cs_t; 284 285 /*! 286 * \brief The hash ip6 collapse selection. 287 */ 288 typedef enum bcmi_ltsw_lb_hash_algorithm_s { 289 290 /*! Algorithm to be used for Hash 0 Instance 0 computation. */ 291 bcmiAlgorithmField0Inst0 = 0, 292 293 /*! Algorithm to be used for Hash 0 Instance 1 computation. */ 294 bcmiAlgorithmField0Inst1 = 1, 295 296 /*! Algorithm to be used for Hash 1 Instance 0 computation. */ 297 bcmiAlgorithmField1Inst0 = 2, 298 299 /*! Algorithm to be used for Hash 1 Instance 1 computation. */ 300 bcmiAlgorithmField1Inst1 = 3, 301 302 /*! Algorithm used for generation of RTAG7 Hash Macro Flow Identifier. */ 303 bcmiAlgorithmMacroFlow = 4, 304 305 /*! Hash Algorithm count. */ 306 bcmiAlgorithmCount 307 308 } bcmi_ltsw_lb_hash_algorithm_t; 309 310 /*! 311 * \brief Application switch control type of L3 for a specific device. 312 */ 313 typedef enum bcmi_ltsw_hash_control_s { 314 315 /*! Non-IP packets w/DA of my router MAC to CPU. */ 316 bcmiHashControlEcmp = 0, 317 318 /*! DIP not found in L3/LPM tables. */ 319 bcmiHashControlEntroyLabelFlowBased = 1, 320 321 /*! Set Lookup status for Flex Hash fields selection */ 322 bcmiHashControlFlexHashLookupStatus = 2, 323 324 /*! Hash Control count. */ 325 bcmiHashControlCount 326 } bcmi_ltsw_hash_control_t; 327 328 /*! 329 * \brief Application switch control type of L3 for a specific device. 330 */ 331 typedef enum bcmi_ltsw_hash_versatile_control_s { 332 333 /*! Initial value 0 for both versatile hash block A and B. */ 334 bcmiHashVersatileControlInitValue0 = 0, 335 336 /*! Initial value 1 for both versatile hash block A and B. */ 337 bcmiHashVersatileControlInitValue1 = 1, 338 339 /*! Initial value 0 for versatile hash block A. */ 340 bcmiHashVersatileControlBlockAInitValue0 = 2, 341 342 /*! Initial value 1 for versatile hash block A. */ 343 bcmiHashVersatileControlBlockAInitValue1 = 3, 344 345 /*! Initial value 0 for versatile hash block B. */ 346 bcmiHashVersatileControlBlockBInitValue0 = 4, 347 348 /*! Initial value 1 for versatile hash block B. */ 349 bcmiHashVersatileControlBlockBInitValue1 = 5, 350 351 /*! Hash Versatile Control count. */ 352 bcmiHashVersatileControlCount 353 } bcmi_ltsw_hash_versatile_control_t; 354 355 /*! 356 * \brief Application switch control type of lb hash seed for a specific device. 357 */ 358 typedef enum bcmi_ltsw_hash_control_seed_s { 359 360 /*! Hash seed input for hash 0. */ 361 bcmiHashControlSeed0 = 0, 362 363 /*! Hash seed input for hash 1. */ 364 bcmiHashControlSeed1 = 1, 365 366 /*! Hash seed input count. */ 367 bcmiHashControlSeedCount 368 } bcmi_ltsw_hash_control_seed_t; 369 370 /*! 371 * \brief Macro flow type. 372 */ 373 typedef enum bcmi_ltsw_macro_flow_s { 374 375 /*! ECMP macro flow. */ 376 bcmiMacroFlowEcmp = 0, 377 378 /*! Overlay ECMP macro flow. */ 379 bcmiMacroFlowEcmpOverlay = 1, 380 381 /*! Load balance macro flow. */ 382 bcmiMacroFlowLoadBalance = 2, 383 384 /*! Underlay ECMP macro flow. */ 385 bcmiMacroFlowECMPUnderlay = 3, 386 387 /*! Trunk macro flow. */ 388 bcmiMacroFlowTrunk = 4, 389 390 /*! Macro flow count. */ 391 bcmiMacroFlowCount 392 } bcmi_ltsw_macro_flow_t; 393 394 /*! 395 * \brief De-init the LB hash module. 396 * 397 * \param [int] unit Unit Number. 398 */ 399 extern int 400 bcmi_ltsw_lb_hash_deinit(int unit); 401 402 /*! 403 * \brief Initialize the LB hash module. 404 * 405 * \param [int] unit Unit Number. 406 */ 407 extern int 408 bcmi_ltsw_lb_hash_init(int unit); 409 410 /*! 411 * \brief Set the port based hash output selection. 412 * 413 * \param [in] unit Unit Number. 414 * \param [in] type The port based hash output selection type. 415 * \param [in] port Port Number. 416 * \param [in] value The hash output selection control value. 417 * 418 * \retval SHR_E_NONE No errors. 419 * \retval !SHR_E_NONE Failure. 420 */ 421 extern int 422 bcmi_ltsw_lb_hash_os_port_control_set( 423 int unit, 424 bcmi_ltsw_lb_hash_os_t type, 425 bcm_port_t port, 426 int value); 427 428 /*! 429 * \brief Get the port based hash output selection configuration. 430 * 431 * \param [in] unit Unit Number. 432 * \param [in] type The port based hash output selection type. 433 * \param [in] port Port Number. 434 * \param [out] value The hash output selection control value. 435 * 436 * \retval SHR_E_NONE No errors. 437 * \retval !SHR_E_NONE Failure. 438 */ 439 extern int 440 bcmi_ltsw_lb_hash_os_port_control_get( 441 int unit, 442 bcmi_ltsw_lb_hash_os_t type, 443 bcm_port_t port, 444 int *value); 445 446 /*! 447 * \brief Set the macro flow based hash output selection. 448 * 449 * \param [in] unit Unit Number. 450 * \param [in] type The flow based hash output selection type. 451 * \param [in] field The flow based hash output field. 452 * \param [in] value The hash output selection control value. 453 * 454 * \retval SHR_E_NONE No errors. 455 * \retval !SHR_E_NONE Failure. 456 */ 457 extern int 458 bcmi_ltsw_lb_hash_os_flow_control_set( 459 int unit, 460 bcmi_ltsw_lb_hash_os_t type, 461 bcmi_ltsw_lb_hash_flow_field_t field, 462 int value); 463 464 /*! 465 * \brief Get the macro flow based hash output selection configuration. 466 * 467 * \param [in] unit Unit Number. 468 * \param [in] type The flow based hash output selection type. 469 * \param [in] field The flow based hash output field. 470 * \param [out] value The hash output selection control value. 471 * 472 * \retval SHR_E_NONE No errors. 473 * \retval !SHR_E_NONE Failure. 474 */ 475 extern int 476 bcmi_ltsw_lb_hash_os_flow_control_get( 477 int unit, 478 bcmi_ltsw_lb_hash_os_t type, 479 bcmi_ltsw_lb_hash_flow_field_t field, 480 int *value); 481 482 /*! 483 * \brief Set the fields selection. 484 * 485 * \param [in] unit Unit Number. 486 * \param [in] type The hash fields selection type. 487 * \param [in] value The hash fields selection value. 488 * 489 * \retval SHR_E_NONE No errors. 490 * \retval !SHR_E_NONE Failure. 491 */ 492 extern int 493 bcmi_ltsw_lb_hash_fields_select_set( 494 int unit, 495 bcmi_ltsw_lb_hash_fields_select_t type, 496 int value); 497 498 /*! 499 * \brief Get the fields selection. 500 * 501 * \param [in] unit Unit Number. 502 * \param [in] type The hash fields selection type. 503 * \param [out] value The hash fields selection value. 504 * 505 * \retval SHR_E_NONE No errors. 506 * \retval !SHR_E_NONE Failure. 507 */ 508 extern int 509 bcmi_ltsw_lb_hash_fields_select_get( 510 int unit, 511 bcmi_ltsw_lb_hash_fields_select_t type, 512 int *value); 513 514 /*! 515 * \brief Set the hash bin assignment. 516 * 517 * \param [in] unit Unit Number. 518 * \param [in] control The hash bin control. 519 * \param [in] value The hash bin control value. 520 * 521 * \retval SHR_E_NONE No errors. 522 * \retval !SHR_E_NONE Failure. 523 */ 524 extern int 525 bcmi_ltsw_lb_hash_bins_set( 526 int unit, 527 bcmi_ltsw_lb_hash_bin_t control, 528 int value); 529 530 /*! 531 * \brief Get the hash bin assignment. 532 * 533 * \param [in] unit Unit Number. 534 * \param [in] control The hash bin control. 535 * \param [out] value The hash bin control value. 536 * 537 * \retval SHR_E_NONE No errors. 538 * \retval !SHR_E_NONE Failure. 539 */ 540 extern int 541 bcmi_ltsw_lb_hash_bins_get( 542 int unit, 543 bcmi_ltsw_lb_hash_bin_t control, 544 int *value); 545 546 /*! 547 * \brief Set the hash packet header selection. 548 * 549 * \param [in] unit Unit Number. 550 * \param [in] control The hash packet header selection. 551 * \param [in] value The hash packet header selection value. 552 * 553 * \retval SHR_E_NONE No errors. 554 * \retval !SHR_E_NONE Failure. 555 */ 556 extern int 557 bcmi_ltsw_lb_hash_pkt_hdr_sel_set( 558 int unit, 559 bcmi_ltsw_lb_hash_phs_t control, 560 int value); 561 562 /*! 563 * \brief Get the hash packet header selection. 564 * 565 * \param [in] unit Unit Number. 566 * \param [in] control The hash packet header selection. 567 * \param [out] value The hash packet header selection value. 568 * 569 * \retval SHR_E_NONE No errors. 570 * \retval !SHR_E_NONE Failure. 571 */ 572 extern int 573 bcmi_ltsw_lb_hash_pkt_hdr_sel_get( 574 int unit, 575 bcmi_ltsw_lb_hash_phs_t control, 576 int *value); 577 578 /*! 579 * \brief Set the hash ip6 collapse selection. 580 * 581 * \param [in] unit Unit Number. 582 * \param [in] control The hash ip6 collapse selection. 583 * \param [in] value The hash ip6 collapse selection value. 584 * 585 * \retval SHR_E_NONE No errors. 586 * \retval !SHR_E_NONE Failure. 587 */ 588 extern int 589 bcmi_ltsw_lb_hash_ip6_collapse_set( 590 int unit, 591 bcmi_ltsw_lb_hash_ip6cs_t control, 592 int value); 593 594 /*! 595 * \brief Get the hash ip6 collapse selection. 596 * 597 * \param [in] unit Unit Number. 598 * \param [in] control The hash ip6 collapse selection. 599 * \param [out] value The hash ip6 collapse selection value. 600 * 601 * \retval SHR_E_NONE No errors. 602 * \retval !SHR_E_NONE Failure. 603 */ 604 extern int 605 bcmi_ltsw_lb_hash_ip6_collapse_get( 606 int unit, 607 bcmi_ltsw_lb_hash_ip6cs_t control, 608 int *value); 609 610 /*! 611 * \brief Set the hash algorithm. 612 * 613 * \param [in] unit Unit Number. 614 * \param [in] control The hash algorithm control. 615 * \param [in] value The hash algorithm control value. 616 * 617 * \retval SHR_E_NONE No errors. 618 * \retval !SHR_E_NONE Failure. 619 */ 620 extern int 621 bcmi_ltsw_lb_hash_algorithm_set( 622 int unit, 623 bcmi_ltsw_lb_hash_algorithm_t control, 624 int value); 625 626 /*! 627 * \brief Get the hash algorithm. 628 * 629 * \param [in] unit Unit Number. 630 * \param [in] control The hash algorithm control. 631 * \param [out] value The hash algorithm control value. 632 * 633 * \retval SHR_E_NONE No errors. 634 * \retval !SHR_E_NONE Failure. 635 */ 636 extern int 637 bcmi_ltsw_lb_hash_algorithm_get( 638 int unit, 639 bcmi_ltsw_lb_hash_algorithm_t control, 640 int *value); 641 642 /*! 643 * \brief Set the symmetric hash control. 644 * 645 * \param [in] unit Unit Number. 646 * \param [in] value The symmetric hash control value. 647 * 648 * \retval SHR_E_NONE No errors. 649 * \retval !SHR_E_NONE Failure. 650 */ 651 extern int 652 bcmi_ltsw_lb_hash_symmetric_control_set( 653 int unit, 654 int value); 655 656 /*! 657 * \brief Get the symmetric hash control. 658 * 659 * \param [in] unit Unit Number. 660 * \param [out] value The symmetric hash control value. 661 * 662 * \retval SHR_E_NONE No errors. 663 * \retval !SHR_E_NONE Failure. 664 */ 665 extern int 666 bcmi_ltsw_lb_hash_symmetric_control_get( 667 int unit, 668 int *value); 669 670 /*! 671 * \brief Set the hash control. 672 * 673 * \param [in] unit Unit Number. 674 * \param [in] control Hash contro type. 675 * \param [in] value The hash control value. 676 * 677 * \retval SHR_E_NONE No errors. 678 * \retval !SHR_E_NONE Failure. 679 */ 680 extern int 681 bcmi_ltsw_lb_hash_control_set( 682 int unit, 683 bcmi_ltsw_hash_control_t control, 684 int value); 685 686 /*! 687 * \brief Get the hash control. 688 * 689 * \param [in] unit Unit Number. 690 * \param [in] control Hash contro type. 691 * \param [out] value The hash control value. 692 * 693 * \retval SHR_E_NONE No errors. 694 * \retval !SHR_E_NONE Failure. 695 */ 696 extern int 697 bcmi_ltsw_lb_hash_control_get( 698 int unit, 699 bcmi_ltsw_hash_control_t control, 700 int *value); 701 702 /*! 703 * \brief Enable/Disable assignment of hash bins 704 * for flex hash. 705 * 706 * \param [in] unit Unit Number. 707 * \param [in] enable Enable Flex Hash 708 * 709 * \retval SHR_E_NONE No errors. 710 * \retval !SHR_E_NONE Failure. 711 */ 712 extern int 713 bcmi_ltsw_lb_hash_bins_flex_set( 714 int unit, 715 int enable); 716 717 /*! 718 * \brief Create flex hash entry. 719 * 720 * \param [in] unit Unit number. 721 * \param [in] qset Field Qualifier set. 722 * \param [out] entry Entry Identifier. 723 * 724 * \retval SHR_E_NONE on success and error code otherwise. 725 */ 726 extern int 727 bcmi_ltsw_lb_hash_flex_entry_create( 728 int unit, 729 bcm_field_qset_t qset, 730 bcm_hash_entry_t *entry); 731 732 /*! 733 * \brief Destroy flex hash entry. 734 * 735 * \param [in] unit Unit number. 736 * \param [in] entry Entry Identifier. 737 * 738 * \retval SHR_E_NONE on success and error code otherwise. 739 */ 740 extern int 741 bcmi_ltsw_lb_hash_flex_entry_destroy( 742 int unit, 743 bcm_hash_entry_t entry); 744 745 /*! 746 * \brief Install flex hash entry to hardware. 747 * 748 * \param [in] unit Unit number. 749 * \param [in] entry Entry Identifier. 750 * \param [in] offset L4 offset. 751 * 752 * \retval SHR_E_NONE on success and error code otherwise. 753 */ 754 extern int 755 bcmi_ltsw_lb_hash_flex_entry_install( 756 int unit, 757 bcm_hash_entry_t entry, 758 uint32 offset); 759 760 /*! 761 * \brief Reinstall flex hash entry to hardware. 762 * 763 * \param [in] unit Unit number. 764 * \param [in] entry Entry Identifier. 765 * \param [in] offset L4 offset. 766 * 767 * \retval SHR_E_NONE on success and error code otherwise. 768 */ 769 extern int 770 bcmi_ltsw_lb_hash_flex_entry_reinstall( 771 int unit, 772 bcm_hash_entry_t entry, 773 uint32 offset); 774 775 /*! 776 * \brief Remove flex hash entry from hardware. 777 * 778 * \param [in] unit Unit number. 779 * \param [in] entry Entry Identifier. 780 * 781 * \retval SHR_E_NONE on success and error code otherwise. 782 */ 783 extern int 784 bcmi_ltsw_lb_hash_flex_entry_remove( 785 int unit, 786 bcm_hash_entry_t entry); 787 788 /*! 789 * \brief Set flex hash entry. 790 * 791 * This sets up Hash Bin extraction configurations. 792 * 793 * \param [in] unit Unit number. 794 * \param [in] entry Entry Identifier. 795 * \param [in] config Hash bin configurations. 796 * 797 * \retval SHR_E_NONE on success and error code otherwise. 798 */ 799 extern int 800 bcmi_ltsw_lb_hash_flex_entry_set( 801 int unit, 802 bcm_hash_entry_t entry, 803 bcm_switch_hash_entry_config_t *config); 804 805 /*! 806 * \brief Get flex hash entry. 807 * 808 * \param [in] unit Unit number. 809 * \param [in] entry Entry Identifier. 810 * \param [out] config Hash bin configurations. 811 * 812 * \retval SHR_E_NONE on success and error code otherwise. 813 */ 814 extern int 815 bcmi_ltsw_lb_hash_flex_entry_get( 816 int unit, 817 bcm_hash_entry_t entry, 818 bcm_switch_hash_entry_config_t *config); 819 820 /*! 821 * \brief Traverse flex hash entries. 822 * 823 * \param [in] unit Unit number. 824 * \param [in] flags Flags. 825 * \param [in] cb_fn Callback function pointer. 826 * \param [in] user_data cookie 827 * 828 * \retval SHR_E_NONE on success and error code otherwise. 829 */ 830 extern int 831 bcmi_ltsw_lb_hash_flex_entry_traverse( 832 int unit, 833 int flags, 834 bcm_switch_hash_entry_traverse_cb cb_fn, 835 void *user_data); 836 837 /*! 838 * \brief Qualify UDF data to flex hash entry. 839 * 840 * \param [in] unit Unit number. 841 * \param [in] entry Entry Identifier. 842 * \param [in] udf_id UDF object Identifier. 843 * \param [in] length Number of bytes in 'data'. 844 * \param [in] data Data to match UDF extraction. 845 * \param [in] mask Mask to be applied. 846 * 847 * \retval SHR_E_NONE on success and error code otherwise. 848 */ 849 extern int 850 bcmi_ltsw_lb_hash_flex_qualify_udf( 851 int unit, 852 bcm_hash_entry_t entry, 853 bcm_udf_id_t udf_id, 854 int length, 855 uint8 *data, 856 uint8 *mask); 857 858 /*! 859 * \brief Get UDF data qualified to flex hash entry. 860 * 861 * \param [in] unit Unit number. 862 * \param [in] entry Entry Identifier. 863 * \param [in] udf_id UDF object Identifier. 864 * \param [in] max_length Number of bytes in 'data'. 865 * \param [out] data Data. 866 * \param [out] mask. 867 * \param [out] actual_length Number of bytes valid in 'data'. 868 * 869 * \retval SHR_E_NONE on success and error code otherwise. 870 */ 871 extern int 872 bcmi_ltsw_lb_hash_flex_qualify_udf_get( 873 int unit, 874 bcm_hash_entry_t entry, 875 bcm_udf_id_t udf_id, 876 int max_length, 877 uint8 *data, 878 uint8 *mask, 879 int *actual_length); 880 881 /*! 882 * \brief Set lb hash versatile control. 883 * 884 * \param [in] unit Unit number. 885 * \param [in] control Switch control. 886 * \param [in] value control value. 887 * 888 * \retval SHR_E_NONE on success and error code otherwise. 889 */ 890 extern int 891 bcmi_ltsw_lb_hash_versatile_control_set( 892 int unit, 893 bcmi_ltsw_hash_versatile_control_t control, 894 int value); 895 896 /*! 897 * \brief Get lb hash versatile control. 898 * 899 * \param [in] unit Unit number. 900 * \param [in] control Switch control. 901 * \param [out] value control value. 902 * 903 * \retval SHR_E_NONE on success and error code otherwise. 904 */ 905 extern int 906 bcmi_ltsw_lb_hash_versatile_control_get( 907 int unit, 908 bcmi_ltsw_hash_versatile_control_t control, 909 int *value); 910 911 /*! 912 * \brief Set lb hash control seed. 913 * 914 * \param [in] unit Unit number. 915 * \param [in] control Switch control. 916 * \param [in] value control value. 917 * 918 * \retval SHR_E_NONE on success and error code otherwise. 919 */ 920 extern int 921 bcmi_ltsw_lb_hash_control_seed_set( 922 int unit, 923 bcmi_ltsw_hash_control_seed_t control, 924 int value); 925 926 /*! 927 * \brief Get lb hash control seed. 928 * 929 * \param [in] unit Unit number. 930 * \param [in] control Switch control. 931 * \param [out] value control value. 932 * 933 * \retval SHR_E_NONE on success and error code otherwise. 934 */ 935 extern int 936 bcmi_ltsw_lb_hash_control_seed_get( 937 int unit, 938 bcmi_ltsw_hash_control_seed_t control, 939 int *value); 940 941 /*! 942 * \brief Set macro flow hash seed. 943 * 944 * \param [in] unit Unit number. 945 * \param [in] type Macro flow type. 946 * \param [int] value Seed value. 947 * 948 * \retval SHR_E_NONE on success and error code otherwise. 949 */ 950 extern int 951 bcmi_ltsw_lb_hash_macro_flow_seed_set( 952 int unit, 953 bcmi_ltsw_macro_flow_t type, 954 int value); 955 956 #endif /* BCMI_LTSW_LB_HASH_H */