openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

lb_hash.h (30639B)


      1 /*! \file lb_hash.h
      2  *
      3  * BCM LB hash module APIs and data structures used only internally.
      4  */
      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 BCMINT_LTSW_MBCM_LB_HASH_H
     12 #define BCMINT_LTSW_MBCM_LB_HASH_H
     13 
     14 #include <bcm_int/ltsw/lb_hash_int.h>
     15 
     16 /*!
     17  * \brief De-init the LB hash module.
     18  *
     19  * \param [in] unit Unit Number.
     20  *
     21  * \retval SHR_E_NONE No errors.
     22  * \retval !SHR_E_NONE Failure.
     23  */
     24 typedef int (*lb_hash_deinit_f)(int unit);
     25 
     26 /*!
     27  * \brief Initialize the LB hash module.
     28  *
     29  * \param [in] unit Unit Number.
     30  *
     31  * \retval SHR_E_NONE No errors.
     32  * \retval !SHR_E_NONE Failure.
     33  */
     34 typedef int (*lb_hash_init_f)(int unit);
     35 
     36 /*!
     37  * \brief Set the port based hash output selection.
     38  *
     39  * \param [in] unit Unit Number.
     40  * \param [in] type The port based hash output selection type.
     41  * \param [in] port Port Number.
     42  * \param [in] value The hash output selection control value.
     43  *
     44  * \retval SHR_E_NONE No errors.
     45  * \retval !SHR_E_NONE Failure.
     46  */
     47 typedef int (*lb_hash_os_port_control_set_f)(
     48     int unit,
     49     bcmi_ltsw_lb_hash_os_t type,
     50     bcm_port_t port,
     51     int value);
     52 
     53 /*!
     54  * \brief Get the port based hash output selection.
     55  *
     56  * \param [in] unit Unit Number.
     57  * \param [in] type The port based hash output selection type.
     58  * \param [in] port Port Number.
     59  * \param [out] value The hash output selection control value.
     60  *
     61  * \retval SHR_E_NONE No errors.
     62  * \retval !SHR_E_NONE Failure.
     63  */
     64 typedef int (*lb_hash_os_port_control_get_f)(
     65     int unit,
     66     bcmi_ltsw_lb_hash_os_t type,
     67     bcm_port_t port,
     68     int *value);
     69 
     70 /*!
     71  * \brief Set the flow based hash output selection.
     72  *
     73  * \param [in] unit Unit Number.
     74  * \param [in] type The flow based hash output selection type.
     75  * \param [in] field The flow based hash output selection field.
     76  * \param [in] value The hash output selection control value.
     77  *
     78  * \retval SHR_E_NONE No errors.
     79  * \retval !SHR_E_NONE Failure.
     80  */
     81 typedef int (*lb_hash_os_flow_control_set_f)(
     82     int unit,
     83     bcmi_ltsw_lb_hash_os_t type,
     84     bcmi_ltsw_lb_hash_flow_field_t field,
     85     int value);
     86 
     87 /*!
     88  * \brief Get the flow based hash output selection.
     89  *
     90  * \param [in] unit Unit Number.
     91  * \param [in] type The flow based hash output selection type.
     92  * \param [in] field The flow based hash output selection field.
     93  * \param [out] value The hash output selection control value.
     94  *
     95  * \retval SHR_E_NONE No errors.
     96  * \retval !SHR_E_NONE Failure.
     97  */
     98 typedef int (*lb_hash_os_flow_control_get_f)(
     99     int unit,
    100     bcmi_ltsw_lb_hash_os_t type,
    101     bcmi_ltsw_lb_hash_flow_field_t field,
    102     int *value);
    103 
    104 /*!
    105  * \brief Get the hash output selection database.
    106  *
    107  * \param [in] unit Unit Number.
    108  * \param [out] tbl_db The hash output selection database.
    109  *
    110  * \retval SHR_E_NONE No errors.
    111  * \retval !SHR_E_NONE Failure.
    112  */
    113 typedef int (*lb_hash_os_tbl_db_get_f)(
    114     int unit,
    115     bcmint_ltsw_lb_hash_os_tbl_db_t *tbl_db);
    116 
    117 /*!
    118  * \brief Set the hash field selection.
    119  *
    120  * \param [in] unit Unit Number.
    121  * \param [in] type The hash fields selection type.
    122  * \param [in] value The hash fields selection value.
    123  *
    124  * \retval SHR_E_NONE No errors.
    125  * \retval !SHR_E_NONE Failure.
    126  */
    127 typedef int (*lb_hash_fields_select_set_f)(
    128     int unit,
    129     bcmi_ltsw_lb_hash_fields_select_t type,
    130     int value);
    131 
    132 /*!
    133  * \brief Get the hash field selection.
    134  *
    135  * \param [in] unit Unit Number.
    136  * \param [in] type The hash fields selection type.
    137  * \param [out] value The hash fields selection value.
    138  *
    139  * \retval SHR_E_NONE No errors.
    140  * \retval !SHR_E_NONE Failure.
    141  */
    142 typedef int (*lb_hash_fields_select_get_f)(
    143     int unit,
    144     bcmi_ltsw_lb_hash_fields_select_t type,
    145     int *value);
    146 
    147 /*!
    148  * \brief Set the hash bin assignment.
    149  *
    150  * \param [in] unit Unit Number.
    151  * \param [in] control The hash bin control.
    152  * \param [in] value The hash bin control value.
    153  *
    154  * \retval SHR_E_NONE No errors.
    155  * \retval !SHR_E_NONE Failure.
    156  */
    157 typedef int (*lb_hash_bins_set_f)(
    158     int unit,
    159     bcmi_ltsw_lb_hash_bin_t control,
    160     int value);
    161 
    162 /*!
    163  * \brief Get the hash bin assignment.
    164  *
    165  * \param [in] unit Unit Number.
    166  * \param [in] control The hash bin control.
    167  * \param [out] value The hash bin control value.
    168  *
    169  * \retval SHR_E_NONE No errors.
    170  * \retval !SHR_E_NONE Failure.
    171  */
    172 typedef int (*lb_hash_bins_get_f)(
    173     int unit,
    174     bcmi_ltsw_lb_hash_bin_t control,
    175     int *value);
    176 
    177 /*!
    178  * \brief Set the hash packet header selection.
    179  *
    180  * \param [in] unit Unit Number.
    181  * \param [in] control The hash packet header selection.
    182  * \param [in] value The hash packet header selection value.
    183  *
    184  * \retval SHR_E_NONE No errors.
    185  * \retval !SHR_E_NONE Failure.
    186  */
    187 typedef int (*lb_hash_pkt_hdr_sel_set_f)(
    188     int unit,
    189     bcmi_ltsw_lb_hash_phs_t control,
    190     int value);
    191 
    192 /*!
    193  * \brief Get the hash packet header selection.
    194  *
    195  * \param [in] unit Unit Number.
    196  * \param [in] control The hash packet header selection.
    197  * \param [out] value The hash packet header selection value.
    198  *
    199  * \retval SHR_E_NONE No errors.
    200  * \retval !SHR_E_NONE Failure.
    201  */
    202 typedef int (*lb_hash_pkt_hdr_sel_get_f)(
    203     int unit,
    204     bcmi_ltsw_lb_hash_phs_t control,
    205     int *value);
    206 
    207 /*!
    208  * \brief Set the hash ip6 collapse selection.
    209  *
    210  * \param [in] unit Unit Number.
    211  * \param [in] control The hash ip6 collapse selection.
    212  * \param [in] value The hash ip6 collapse selection value.
    213  *
    214  * \retval SHR_E_NONE No errors.
    215  * \retval !SHR_E_NONE Failure.
    216  */
    217 typedef int (*lb_hash_ip6_collapse_set_f)(
    218     int unit,
    219     bcmi_ltsw_lb_hash_ip6cs_t control,
    220     int value);
    221 
    222 /*!
    223  * \brief Get the hash ip6 collapse selection.
    224  *
    225  * \param [in] unit Unit Number.
    226  * \param [in] control The hash ip6 collapse selection.
    227  * \param [out] value The hash ip6 collapse selection value.
    228  *
    229  * \retval SHR_E_NONE No errors.
    230  * \retval !SHR_E_NONE Failure.
    231  */
    232 typedef int (*lb_hash_ip6_collapse_get_f)(
    233     int unit,
    234     bcmi_ltsw_lb_hash_ip6cs_t control,
    235     int *value);
    236 
    237 /*!
    238  * \brief Set the hash algorithm.
    239  *
    240  * \param [in] unit Unit Number.
    241  * \param [in] control The hash algorithm control.
    242  * \param [in] value The hash algorithm control value.
    243  *
    244  * \retval SHR_E_NONE No errors.
    245  * \retval !SHR_E_NONE Failure.
    246  */
    247 typedef int (*lb_hash_algorithm_set_f)(
    248     int unit,
    249     bcmi_ltsw_lb_hash_algorithm_t control,
    250     int value);
    251 
    252 /*!
    253  * \brief Get the hash algorithm.
    254  *
    255  * \param [in] unit Unit Number.
    256  * \param [in] control The hash algorithm control.
    257  * \param [out] value The hash algorithm control value.
    258  *
    259  * \retval SHR_E_NONE No errors.
    260  * \retval !SHR_E_NONE Failure.
    261  */
    262 typedef int (*lb_hash_algorithm_get_f)(
    263     int unit,
    264     bcmi_ltsw_lb_hash_algorithm_t control,
    265     int *value);
    266 
    267 /*!
    268  * \brief Set the symmetric hash control.
    269  *
    270  * \param [in] unit Unit Number.
    271  * \param [in] value The symmetric hash control value.
    272  *
    273  * \retval SHR_E_NONE No errors.
    274  * \retval !SHR_E_NONE Failure.
    275  */
    276 typedef int (*lb_hash_symmetric_control_set_f)(
    277     int unit,
    278     int value);
    279 
    280 /*!
    281  * \brief Get the symmetric hash control.
    282  *
    283  * \param [in] unit Unit Number.
    284  * \param [out] value The symmetric hash control value.
    285  *
    286  * \retval SHR_E_NONE No errors.
    287  * \retval !SHR_E_NONE Failure.
    288  */
    289 typedef int (*lb_hash_symmetric_control_get_f)(
    290     int unit,
    291     int *value);
    292 
    293 /*!
    294  * \brief Set the hash control.
    295  *
    296  * \param [in] unit Unit Number.
    297  * \param [in] control Hash control type.
    298  * \param [in] value The hash control value.
    299  *
    300  * \retval SHR_E_NONE No errors.
    301  * \retval !SHR_E_NONE Failure.
    302  */
    303 typedef int (*lb_hash_control_set_f)(
    304     int unit,
    305     bcmi_ltsw_hash_control_t control,
    306     int value);
    307 
    308 /*!
    309  * \brief Get the hash control.
    310  *
    311  * \param [in] unit Unit Number.
    312  * \param [in] control Hash control type.
    313  * \param [out] value The hash control value.
    314  *
    315  * \retval SHR_E_NONE No errors.
    316  * \retval !SHR_E_NONE Failure.
    317  */
    318 typedef int (*lb_hash_control_get_f)(
    319     int unit,
    320     bcmi_ltsw_hash_control_t control,
    321     int *value);
    322 
    323 /*!
    324  * \brief Enable/Disable assignment of hash bins
    325  *        for flex hash.
    326  *
    327  * \param [in] unit Unit Number.
    328  * \param [in] enable Enable Flex Hash
    329  *
    330  * \retval SHR_E_NONE No errors.
    331  * \retval !SHR_E_NONE Failure.
    332  */
    333 typedef int (*lb_hash_bins_flex_set_f)(
    334     int unit,
    335     int enable);
    336 
    337 /*!
    338  * \brief Allocate flex hash entry.
    339  *
    340  * \param [in] unit Unit number.
    341  * \param [out] entry Entry Identifier.
    342  *
    343  * \retval SHR_E_NONE on success and error code otherwise.
    344  */
    345 typedef int (*lb_hash_flex_entry_alloc_f)(
    346     int unit,
    347     int qual_count,
    348     int *qual_list,
    349     bcm_hash_entry_t *entry);
    350 
    351 /*!
    352  * \brief Free flex hash entry.
    353  *
    354  * \param [in] unit Unit number.
    355  * \param [in] entry Entry Identifier.
    356  *
    357  * \retval SHR_E_NONE on success and error code otherwise.
    358  */
    359 typedef int (*lb_hash_flex_entry_free_f)(
    360     int unit,
    361     bcm_hash_entry_t entry);
    362 
    363 /*!
    364  * \brief Install flex hash entry to hardware.
    365  *
    366  * \param [in] unit Unit number.
    367  * \param [in] entry Entry Identifier.
    368  * \param [in] offset L4 offset.
    369  *
    370  * \retval SHR_E_NONE on success and error code otherwise.
    371  */
    372 typedef int (*lb_hash_flex_entry_install_f)(
    373     int unit,
    374     bcm_hash_entry_t entry,
    375     int r,
    376     uint32 offset);
    377 
    378 /*!
    379  * \brief Remove flex hash entry from hardware.
    380  *
    381  * \param [in] unit Unit number.
    382  * \param [in] entry Entry Identifier.
    383  *
    384  * \retval SHR_E_NONE on success and error code otherwise.
    385  */
    386 typedef int (*lb_hash_flex_entry_remove_f)(
    387     int unit,
    388     bcm_hash_entry_t entry);
    389 
    390 /*!
    391  * \brief Set flex hash entry.
    392  *
    393  * This sets up Hash Bin extraction configurations.
    394  *
    395  * \param [in] unit Unit number.
    396  * \param [in] entry Entry Identifier.
    397  * \param [in] config Hash bin configurations.
    398  *
    399  * \retval SHR_E_NONE on success and error code otherwise.
    400  */
    401 typedef int (*lb_hash_flex_entry_set_f)(
    402     int unit,
    403     bcm_hash_entry_t entry,
    404     bcm_switch_hash_entry_config_t *config);
    405 
    406 /*!
    407  * \brief Get flex hash entry.
    408  *
    409  * \param [in] unit Unit number.
    410  * \param [in] entry Entry Identifier.
    411  * \param [out] config Hash bin configurations.
    412  *
    413  * \retval SHR_E_NONE on success and error code otherwise.
    414  */
    415 typedef int (*lb_hash_flex_entry_get_f)(
    416     int unit,
    417     bcm_hash_entry_t entry,
    418     bcm_switch_hash_entry_config_t *config);
    419 
    420 /*!
    421  * \brief Traverse flex hash entries.
    422  *
    423  * \param [in] unit Unit number.
    424  * \param [in] flags Flags.
    425  * \param [in] cb_fn Callback function pointer.
    426  * \param [in] user_data cookie
    427  *
    428  * \retval SHR_E_NONE on success and error code otherwise.
    429  */
    430 typedef int (*lb_hash_flex_entry_traverse_f)(
    431     int unit,
    432     int flags,
    433     bcm_switch_hash_entry_traverse_cb cb_fn,
    434     void *user_data);
    435 
    436 /*!
    437  * \brief Qualify UDF data to flex hash entry.
    438  *
    439  * \param [in] unit Unit number.
    440  * \param [in] entry Entry Identifier.
    441  * \param [in] udf_id UDF object Identifier.
    442  * \param [in] length Number of bytes in 'data'.
    443  * \param [in] data Data to match UDF extraction.
    444  * \param [in] mask Mask to be applied.
    445  *
    446  * \retval SHR_E_NONE on success and error code otherwise.
    447  */
    448 typedef int (*lb_hash_flex_qualify_udf_f)(
    449     int unit,
    450     bcm_hash_entry_t entry,
    451     bcm_udf_id_t udf_id,
    452     int length,
    453     uint8 *data,
    454     uint8 *mask);
    455 
    456 /*!
    457  * \brief Get UDF data qualified to flex hash entry.
    458  *
    459  * \param [in] unit Unit number.
    460  * \param [in] entry Entry Identifier.
    461  * \param [in] udf_id UDF object Identifier.
    462  * \param [in] max_length Number of bytes in 'data'.
    463  * \param [out] data Data.
    464  * \param [out] mask.
    465  * \param [out] actual_length Number of bytes valid in 'data'.
    466  *
    467  * \retval SHR_E_NONE on success and error code otherwise.
    468  */
    469 typedef int (*lb_hash_flex_qualify_udf_get_f)(
    470     int unit,
    471     bcm_hash_entry_t entry,
    472     bcm_udf_id_t udf_id,
    473     int max_length,
    474     uint8 *data,
    475     uint8 *mask,
    476     int *actual_length);
    477 
    478 /*!
    479  * \brief Set lb hash versatile control.
    480  *
    481  * \param [in] unit Unit number.
    482  * \param [in] control Switch control.
    483  * \param [in] value control value.
    484  *
    485  * \retval SHR_E_NONE on success and error code otherwise.
    486  */
    487 typedef int (*lb_hash_versatile_control_set_f)(
    488     int unit,
    489     bcmi_ltsw_hash_versatile_control_t control,
    490     int value);
    491 
    492 /*!
    493  * \brief Get lb hash versatile control.
    494  *
    495  * \param [in] unit Unit number.
    496  * \param [in] control Switch control.
    497  * \param [out] value control value.
    498  *
    499  * \retval SHR_E_NONE on success and error code otherwise.
    500  */
    501 typedef int (*lb_hash_versatile_control_get_f)(
    502     int unit,
    503     bcmi_ltsw_hash_versatile_control_t control,
    504     int *value);
    505 
    506 /*!
    507  * \brief Set lb hash versatile control.
    508  *
    509  * \param [in] unit Unit number.
    510  * \param [in] control Switch control.
    511  * \param [in] value control value.
    512  *
    513  * \retval SHR_E_NONE on success and error code otherwise.
    514  */
    515 typedef int (*lb_hash_control_seed_set_f)(
    516     int unit,
    517     bcmi_ltsw_hash_control_seed_t control,
    518     int value);
    519 
    520 /*!
    521  * \brief Get lb hash versatile control.
    522  *
    523  * \param [in] unit Unit number.
    524  * \param [in] control Switch control.
    525  * \param [out] value control value.
    526  *
    527  * \retval SHR_E_NONE on success and error code otherwise.
    528  */
    529 typedef int (*lb_hash_control_seed_get_f)(
    530     int unit,
    531     bcmi_ltsw_hash_control_seed_t control,
    532     int *value);
    533 
    534 /*!
    535  * \brief Set macro flow hash seed.
    536  *
    537  * \param [in] unit Unit number.
    538  * \param [in] type Macro flow type.
    539  * \param [int] value Seed value.
    540  *
    541  * \retval SHR_E_NONE on success and error code otherwise.
    542  */
    543 typedef int (*lb_hash_macro_flow_seed_set_f)(
    544     int unit,
    545     bcmi_ltsw_macro_flow_t type,
    546     int value);
    547 
    548 /*!
    549  * \brief Lb_hash driver structure.
    550  */
    551 typedef struct mbcm_ltsw_lb_hash_drv_s {
    552 
    553     /*! De-init the LB hash module. */
    554     lb_hash_deinit_f lb_hash_deinit;
    555 
    556     /*! Initialize the LB hash module. */
    557     lb_hash_init_f lb_hash_init;
    558 
    559     /*! Set the port based hash output selection. */
    560     lb_hash_os_port_control_set_f lb_hash_os_port_control_set;
    561 
    562     /*! Get the port based hash output selection. */
    563     lb_hash_os_port_control_get_f lb_hash_os_port_control_get;
    564 
    565     /*! Set the flow based hash output selection. */
    566     lb_hash_os_flow_control_set_f lb_hash_os_flow_control_set;
    567 
    568     /*! Get the flow based hash output selection. */
    569     lb_hash_os_flow_control_get_f lb_hash_os_flow_control_get;
    570 
    571     lb_hash_os_tbl_db_get_f lb_hash_os_tbl_db_get;
    572 
    573     /*! Set the hash field selection. */
    574     lb_hash_fields_select_set_f lb_hash_fields_select_set;
    575 
    576     /*! Set the hash field selection. */
    577     lb_hash_fields_select_get_f lb_hash_fields_select_get;
    578 
    579     /*! Set the hash bin assignment. */
    580     lb_hash_bins_set_f lb_hash_bins_set;
    581 
    582     /*! Get the hash bin assignment. */
    583     lb_hash_bins_get_f lb_hash_bins_get;
    584 
    585     /*! Set the hash packet header selection. */
    586     lb_hash_pkt_hdr_sel_set_f lb_hash_pkt_hdr_sel_set;
    587 
    588     /*! Get the hash packet header selection. */
    589     lb_hash_pkt_hdr_sel_get_f lb_hash_pkt_hdr_sel_get;
    590 
    591     /*! Set the hash ip6 collapse selection. */
    592     lb_hash_ip6_collapse_set_f lb_hash_ip6_collapse_set;
    593 
    594     /*! Get the hash ip6 collapse selection. */
    595     lb_hash_ip6_collapse_get_f lb_hash_ip6_collapse_get;
    596 
    597     /*! Set the hash algorithm. */
    598     lb_hash_algorithm_set_f lb_hash_algorithm_set;
    599 
    600     /*!Get the hash algorithm. */
    601     lb_hash_algorithm_get_f lb_hash_algorithm_get;
    602 
    603     /*! Set the symmetric hash control. */
    604     lb_hash_symmetric_control_set_f lb_hash_symmetric_control_set;
    605 
    606     /*! Get the symmetric hash control. */
    607     lb_hash_symmetric_control_get_f lb_hash_symmetric_control_get;
    608 
    609     /*! Set the hash control. */
    610     lb_hash_control_set_f lb_hash_control_set;
    611 
    612     /*! Get the hash control. */
    613     lb_hash_control_get_f lb_hash_control_get;
    614 
    615     /*! Set the flex hash bins */
    616     lb_hash_bins_flex_set_f lb_hash_bins_flex_set;
    617 
    618     /*! Flex hash entry allocate */
    619     lb_hash_flex_entry_alloc_f lb_hash_flex_entry_alloc;
    620 
    621     /*! Flex hash entry free */
    622     lb_hash_flex_entry_free_f lb_hash_flex_entry_free;
    623 
    624     /*! Set flex hash entry config */
    625     lb_hash_flex_entry_set_f lb_hash_flex_entry_set;
    626 
    627     /*! Get flex hash entry config */
    628     lb_hash_flex_entry_get_f lb_hash_flex_entry_get;
    629 
    630     /*! Qualify udf to flex hash entry */
    631     lb_hash_flex_qualify_udf_f lb_hash_flex_qualify_udf;
    632 
    633     /*! Get Qualified udf from flex hash entry */
    634     lb_hash_flex_qualify_udf_get_f lb_hash_flex_qualify_udf_get;
    635 
    636     /*! Install flex hash entry */
    637     lb_hash_flex_entry_install_f lb_hash_flex_entry_install;
    638 
    639     /*! Remove flex hash entry */
    640     lb_hash_flex_entry_remove_f lb_hash_flex_entry_remove;
    641 
    642     /*! Set lb hash versatile control */
    643     lb_hash_versatile_control_set_f lb_hash_versatile_control_set;
    644 
    645     /*! Get lb hash versatile control */
    646     lb_hash_versatile_control_get_f lb_hash_versatile_control_get;
    647 
    648     /*! Set lb hash control seed */
    649     lb_hash_control_seed_set_f lb_hash_control_seed_set;
    650 
    651     /*! Get lb hash control seed */
    652     lb_hash_control_seed_get_f lb_hash_control_seed_get;
    653 
    654     /*! Set macro flow hash seed */
    655     lb_hash_macro_flow_seed_set_f lb_hash_macro_flow_seed_set;
    656 
    657 } mbcm_ltsw_lb_hash_drv_t;
    658 
    659 /*!
    660  * \brief Set the LB_HASH driver of the device.
    661  *
    662  * \param [in] unit Unit Number.
    663  * \param [in] drv Lb_hash driver to set.
    664  *
    665  * \retval SHR_E_NONE No errors.
    666  * \retval !SHR_E_NONE Failure.
    667  */
    668 extern int
    669 mbcm_ltsw_lb_hash_drv_set(
    670     int unit,
    671     mbcm_ltsw_lb_hash_drv_t *drv);
    672 
    673 /*!
    674  * \brief De-init the LB hash module.
    675  *
    676  * \param [in] unit Unit Number.
    677  *
    678  * \retval SHR_E_NONE No errors.
    679  * \retval !SHR_E_NONE Failure.
    680  */
    681 extern int
    682 mbcm_ltsw_lb_hash_deinit(int unit);
    683 
    684 /*!
    685  * \brief Initialize the LB hash module.
    686  *
    687  * \param [in] unit Unit Number.
    688  *
    689  * \retval SHR_E_NONE No errors.
    690  * \retval !SHR_E_NONE Failure.
    691  */
    692 extern int
    693 mbcm_ltsw_lb_hash_init(int unit);
    694 
    695 /*!
    696  * \brief Set the port based hash output selection.
    697  *
    698  * \param [in] unit Unit Number.
    699  * \param [in] type The port based hash output selection type.
    700  * \param [in] port Port Number.
    701  * \param [in] value The hash output selection control value.
    702  *
    703  * \retval SHR_E_NONE No errors.
    704  * \retval !SHR_E_NONE Failure.
    705  */
    706 extern int
    707 mbcm_ltsw_lb_hash_os_port_control_set(
    708     int unit,
    709     bcmi_ltsw_lb_hash_os_t type,
    710     bcm_port_t port,
    711     int value);
    712 
    713 /*!
    714  * \brief Get the port based hash output selection.
    715  *
    716  * \param [in] unit Unit Number.
    717  * \param [in] type The port based hash output selection type.
    718  * \param [in] port Port Number.
    719  * \param [out] value The hash output selection control value.
    720  *
    721  * \retval SHR_E_NONE No errors.
    722  * \retval !SHR_E_NONE Failure.
    723  */
    724 extern int
    725 mbcm_ltsw_lb_hash_os_port_control_get(
    726     int unit,
    727     bcmi_ltsw_lb_hash_os_t type,
    728     bcm_port_t port,
    729     int *value);
    730 
    731 /*!
    732  * \brief Set the flow based hash output selection.
    733  *
    734  * \param [in] unit Unit Number.
    735  * \param [in] type The flow based hash output selection type.
    736  * \param [in] field The flow based hash output selection field.
    737  * \param [in] value The hash output selection control value.
    738  *
    739  * \retval SHR_E_NONE No errors.
    740  * \retval !SHR_E_NONE Failure.
    741  */
    742 extern int
    743 mbcm_ltsw_lb_hash_os_flow_control_set(
    744     int unit,
    745     bcmi_ltsw_lb_hash_os_t type,
    746     bcmi_ltsw_lb_hash_flow_field_t field,
    747     int value);
    748 
    749 /*!
    750  * \brief Get the flow based hash output selection.
    751  *
    752  * \param [in] unit Unit Number.
    753  * \param [in] type The flow based hash output selection type.
    754  * \param [in] field The flow based hash output selection field.
    755  * \param [out] value The hash output selection control value.
    756  *
    757  * \retval SHR_E_NONE No errors.
    758  * \retval !SHR_E_NONE Failure.
    759  */
    760 extern int
    761 mbcm_ltsw_lb_hash_os_flow_control_get(
    762     int unit,
    763     bcmi_ltsw_lb_hash_os_t type,
    764     bcmi_ltsw_lb_hash_flow_field_t field,
    765     int *value);
    766 
    767 /*!
    768  * \brief Set the hash field selection.
    769  *
    770  * \param [in] unit Unit Number.
    771  * \param [in] type The hash fields selection type.
    772  * \param [in] value The hash fields selection value.
    773  *
    774  * \retval SHR_E_NONE No errors.
    775  * \retval !SHR_E_NONE Failure.
    776  */
    777 extern int
    778 mbcm_ltsw_lb_hash_fields_select_set(
    779     int unit,
    780     bcmi_ltsw_lb_hash_fields_select_t type,
    781     int value);
    782 
    783 /*!
    784  * \brief Get the hash field selection.
    785  *
    786  * \param [in] unit Unit Number.
    787  * \param [in] type The hash fields selection type.
    788  * \param [out] value The hash fields selection value.
    789  *
    790  * \retval SHR_E_NONE No errors.
    791  * \retval !SHR_E_NONE Failure.
    792  */
    793 extern int
    794 mbcm_ltsw_lb_hash_fields_select_get(
    795     int unit,
    796     bcmi_ltsw_lb_hash_fields_select_t type,
    797     int *value);
    798 
    799 /*!
    800  * \brief Set the hash bin assignment.
    801  *
    802  * \param [in] unit Unit Number.
    803  * \param [in] control The hash bin control.
    804  * \param [in] value The hash bin control value.
    805  *
    806  * \retval SHR_E_NONE No errors.
    807  * \retval !SHR_E_NONE Failure.
    808  */
    809 extern int
    810 mbcm_ltsw_lb_hash_bins_set(
    811     int unit,
    812     bcmi_ltsw_lb_hash_bin_t control,
    813     int value);
    814 
    815 /*!
    816  * \brief Get the hash bin assignment.
    817  *
    818  * \param [in] unit Unit Number.
    819  * \param [in] control The hash bin control.
    820  * \param [out] value The hash bin control value.
    821  *
    822  * \retval SHR_E_NONE No errors.
    823  * \retval !SHR_E_NONE Failure.
    824  */
    825 extern int
    826 mbcm_ltsw_lb_hash_bins_get(
    827     int unit,
    828     bcmi_ltsw_lb_hash_bin_t control,
    829     int *value);
    830 
    831 /*!
    832  * \brief Set the hash packet header selection.
    833  *
    834  * \param [in] unit Unit Number.
    835  * \param [in] control The hash packet header selection.
    836  * \param [in] value The hash packet header selection value.
    837  *
    838  * \retval SHR_E_NONE No errors.
    839  * \retval !SHR_E_NONE Failure.
    840  */
    841 extern int
    842 mbcm_ltsw_lb_hash_pkt_hdr_sel_set(
    843     int unit,
    844     bcmi_ltsw_lb_hash_phs_t control,
    845     int value);
    846 
    847 /*!
    848  * \brief Get the hash packet header selection.
    849  *
    850  * \param [in] unit Unit Number.
    851  * \param [in] control The hash packet header selection.
    852  * \param [out] value The hash packet header selection value.
    853  *
    854  * \retval SHR_E_NONE No errors.
    855  * \retval !SHR_E_NONE Failure.
    856  */
    857 extern int
    858 mbcm_ltsw_lb_hash_pkt_hdr_sel_get(
    859     int unit,
    860     bcmi_ltsw_lb_hash_phs_t control,
    861     int *value);
    862 
    863 /*!
    864  * \brief Set the hash ip6 collapse selection.
    865  *
    866  * \param [in] unit Unit Number.
    867  * \param [in] control The hash ip6 collapse selection.
    868  * \param [in] value The hash ip6 collapse selection value.
    869  *
    870  * \retval SHR_E_NONE No errors.
    871  * \retval !SHR_E_NONE Failure.
    872  */
    873 extern int
    874 mbcm_ltsw_lb_hash_ip6_collapse_set(
    875     int unit,
    876     bcmi_ltsw_lb_hash_ip6cs_t control,
    877     int value);
    878 
    879 /*!
    880  * \brief Get the hash ip6 collapse selection.
    881  *
    882  * \param [in] unit Unit Number.
    883  * \param [in] control The hash ip6 collapse selection.
    884  * \param [out] value The hash ip6 collapse selection value.
    885  *
    886  * \retval SHR_E_NONE No errors.
    887  * \retval !SHR_E_NONE Failure.
    888  */
    889 extern int
    890 mbcm_ltsw_lb_hash_ip6_collapse_get(
    891     int unit,
    892     bcmi_ltsw_lb_hash_ip6cs_t control,
    893     int *value);
    894 
    895 /*!
    896  * \brief Set the hash algorithm.
    897  *
    898  * \param [in] unit Unit Number.
    899  * \param [in] control The hash algorithm control.
    900  * \param [in] value The hash algorithm control value.
    901  *
    902  * \retval SHR_E_NONE No errors.
    903  * \retval !SHR_E_NONE Failure.
    904  */
    905 extern int
    906 mbcm_ltsw_lb_hash_algorithm_set(
    907     int unit,
    908     bcmi_ltsw_lb_hash_algorithm_t control,
    909     int value);
    910 
    911 /*!
    912  * \brief Get the hash algorithm.
    913  *
    914  * \param [in] unit Unit Number.
    915  * \param [in] control The hash algorithm control.
    916  * \param [out] value The hash algorithm control value.
    917  *
    918  * \retval SHR_E_NONE No errors.
    919  * \retval !SHR_E_NONE Failure.
    920  */
    921 extern int
    922 mbcm_ltsw_lb_hash_algorithm_get(
    923     int unit,
    924     bcmi_ltsw_lb_hash_algorithm_t control,
    925     int *value);
    926 
    927 /*!
    928  * \brief Set the symmetric hash control.
    929  *
    930  * \param [in] unit Unit Number.
    931  * \param [in] value The symmetric hash control value.
    932  *
    933  * \retval SHR_E_NONE No errors.
    934  * \retval !SHR_E_NONE Failure.
    935  */
    936 extern int
    937 mbcm_ltsw_lb_hash_symmetric_control_set(
    938     int unit,
    939     int value);
    940 
    941 /*!
    942  * \brief Get the symmetric hash control.
    943  *
    944  * \param [in] unit Unit Number.
    945  * \param [out] value The symmetric hash control value.
    946  *
    947  * \retval SHR_E_NONE No errors.
    948  * \retval !SHR_E_NONE Failure.
    949  */
    950 extern int
    951 mbcm_ltsw_lb_hash_symmetric_control_get(
    952     int unit,
    953     int *value);
    954 
    955 /*!
    956  * \brief Set the hash control.
    957  *
    958  * \param [in] unit Unit Number.
    959  * \param [in] control Hash control type.
    960  * \param [in] value The hash control value.
    961  *
    962  * \retval SHR_E_NONE No errors.
    963  * \retval !SHR_E_NONE Failure.
    964  */
    965 extern int
    966 mbcm_ltsw_lb_hash_control_set(
    967     int unit,
    968     bcmi_ltsw_hash_control_t control,
    969     int value);
    970 
    971 /*!
    972  * \brief Get the hash control.
    973  *
    974  * \param [in] unit Unit Number.
    975  * \param [in] control Hash control type.
    976  * \param [out] value The hash control value.
    977  *
    978  * \retval SHR_E_NONE No errors.
    979  * \retval !SHR_E_NONE Failure.
    980  */
    981 extern int
    982 mbcm_ltsw_lb_hash_control_get(
    983     int unit,
    984     bcmi_ltsw_hash_control_t control,
    985     int *value);
    986 
    987 /*!
    988  * \brief Enable/Disable assignment of hash bins
    989  *        for flex hash.
    990  *
    991  * \param [in] unit Unit Number.
    992  * \param [in] enable Enable Flex Hash
    993  *
    994  * \retval SHR_E_NONE No errors.
    995  * \retval !SHR_E_NONE Failure.
    996  */
    997 extern int
    998 mbcm_ltsw_lb_hash_bins_flex_set(
    999     int unit,
   1000     int enable);
   1001 
   1002 /*!
   1003  * \brief Allocate flex hash entry.
   1004  *
   1005  * \param [in] unit Unit number.
   1006  * \param [in] qset Field Qualifier set.
   1007  * \param [out] entry Entry Identifier.
   1008  *
   1009  * \retval SHR_E_NONE on success and error code otherwise.
   1010  */
   1011 extern int
   1012 mbcm_ltsw_lb_hash_flex_entry_alloc(
   1013     int unit,
   1014     int qual_count,
   1015     int *qual_list,
   1016     bcm_hash_entry_t *entry);
   1017 
   1018 /*!
   1019  * \brief Free flex hash entry.
   1020  *
   1021  * \param [in] unit Unit number.
   1022  * \param [in] entry Entry Identifier.
   1023  *
   1024  * \retval SHR_E_NONE on success and error code otherwise.
   1025  */
   1026 extern int
   1027 mbcm_ltsw_lb_hash_flex_entry_free(
   1028     int unit,
   1029     bcm_hash_entry_t entry);
   1030 
   1031 /*!
   1032  * \brief Install flex hash entry to hardware.
   1033  *
   1034  * \param [in] unit Unit number.
   1035  * \param [in] entry Entry Identifier.
   1036  * \param [in] offset L4 offset.
   1037  *
   1038  * \retval SHR_E_NONE on success and error code otherwise.
   1039  */
   1040 extern int
   1041 mbcm_ltsw_lb_hash_flex_entry_install(
   1042     int unit,
   1043     bcm_hash_entry_t entry,
   1044     int r,
   1045     uint32 offset);
   1046 
   1047 /*!
   1048  * \brief Remove flex hash entry from hardware.
   1049  *
   1050  * \param [in] unit Unit number.
   1051  * \param [in] entry Entry Identifier.
   1052  *
   1053  * \retval SHR_E_NONE on success and error code otherwise.
   1054  */
   1055 extern int
   1056 mbcm_ltsw_lb_hash_flex_entry_remove(
   1057     int unit,
   1058     bcm_hash_entry_t entry);
   1059 
   1060 /*!
   1061  * \brief Set flex hash entry.
   1062  *
   1063  * This sets up Hash Bin extraction configurations.
   1064  *
   1065  * \param [in] unit Unit number.
   1066  * \param [in] entry Entry Identifier.
   1067  * \param [in] config Hash bin configurations.
   1068  *
   1069  * \retval SHR_E_NONE on success and error code otherwise.
   1070  */
   1071 extern int
   1072 mbcm_ltsw_lb_hash_flex_entry_set(
   1073     int unit,
   1074     bcm_hash_entry_t entry,
   1075     bcm_switch_hash_entry_config_t *config);
   1076 
   1077 /*!
   1078  * \brief Get flex hash entry.
   1079  *
   1080  * \param [in] unit Unit number.
   1081  * \param [in] entry Entry Identifier.
   1082  * \param [out] config Hash bin configurations.
   1083  *
   1084  * \retval SHR_E_NONE on success and error code otherwise.
   1085  */
   1086 extern int
   1087 mbcm_ltsw_lb_hash_flex_entry_get(
   1088     int unit,
   1089     bcm_hash_entry_t entry,
   1090     bcm_switch_hash_entry_config_t *config);
   1091 
   1092 /*!
   1093  * \brief Traverse flex hash entries.
   1094  *
   1095  * \param [in] unit Unit number.
   1096  * \param [in] flags Flags.
   1097  * \param [in] cb_fn Callback function pointer.
   1098  * \param [in] user_data cookie
   1099  *
   1100  * \retval SHR_E_NONE on success and error code otherwise.
   1101  */
   1102 extern int
   1103 mbcm_ltsw_lb_hash_flex_entry_traverse(
   1104     int unit,
   1105     int flags,
   1106     bcm_switch_hash_entry_traverse_cb cb_fn,
   1107     void *user_data);
   1108 
   1109 /*!
   1110  * \brief Qualify UDF data to flex hash entry.
   1111  *
   1112  * \param [in] unit Unit number.
   1113  * \param [in] entry Entry Identifier.
   1114  * \param [in] udf_id UDF object Identifier.
   1115  * \param [in] length Number of bytes in 'data'.
   1116  * \param [in] data Data to match UDF extraction.
   1117  * \param [in] mask Mask to be applied.
   1118  *
   1119  * \retval SHR_E_NONE on success and error code otherwise.
   1120  */
   1121 extern int
   1122 mbcm_ltsw_lb_hash_flex_qualify_udf(
   1123     int unit,
   1124     bcm_hash_entry_t entry,
   1125     bcm_udf_id_t udf_id,
   1126     int length,
   1127     uint8 *data,
   1128     uint8 *mask);
   1129 
   1130 /*!
   1131  * \brief Get UDF data qualified to flex hash entry.
   1132  *
   1133  * \param [in] unit Unit number.
   1134  * \param [in] entry Entry Identifier.
   1135  * \param [in] udf_id UDF object Identifier.
   1136  * \param [in] max_length Number of bytes in 'data'.
   1137  * \param [out] data Data.
   1138  * \param [out] mask.
   1139  * \param [out] actual_length Number of bytes valid in 'data'.
   1140  *
   1141  * \retval SHR_E_NONE on success and error code otherwise.
   1142  */
   1143 extern int
   1144 mbcm_ltsw_lb_hash_flex_qualify_udf_get(
   1145     int unit,
   1146     bcm_hash_entry_t entry,
   1147     bcm_udf_id_t udf_id,
   1148     int max_length,
   1149     uint8 *data,
   1150     uint8 *mask,
   1151     int *actual_length);
   1152 
   1153 /*!
   1154  * \brief Get lb hash output selection data base.
   1155  *
   1156  * \param [in] unit Unit number.
   1157  * \param [out] tbl_db Table database.
   1158  *
   1159  * \retval SHR_E_NONE on success and error code otherwise.
   1160  */
   1161 extern int
   1162 mbcm_ltsw_lb_hash_os_tbl_db_get(
   1163     int unit,
   1164     bcmint_ltsw_lb_hash_os_tbl_db_t *tbl_db);
   1165 
   1166 /*!
   1167  * \brief Set lb hash versatile control.
   1168  *
   1169  * \param [in] unit Unit number.
   1170  * \param [in] control Switch control.
   1171  * \param [in] value control value.
   1172  *
   1173  * \retval SHR_E_NONE on success and error code otherwise.
   1174  */
   1175 extern int
   1176 mbcm_ltsw_lb_hash_versatile_control_set(
   1177     int unit,
   1178     bcmi_ltsw_hash_versatile_control_t control,
   1179     int value);
   1180 
   1181 /*!
   1182  * \brief Get lb hash versatile control.
   1183  *
   1184  * \param [in] unit Unit number.
   1185  * \param [in] control Switch control.
   1186  * \param [out] value control value.
   1187  *
   1188  * \retval SHR_E_NONE on success and error code otherwise.
   1189  */
   1190 extern int
   1191 mbcm_ltsw_lb_hash_versatile_control_get(
   1192     int unit,
   1193     bcmi_ltsw_hash_versatile_control_t control,
   1194     int *value);
   1195 
   1196 /*!
   1197  * \brief Set lb hash control seed.
   1198  *
   1199  * \param [in] unit Unit number.
   1200  * \param [in] control Switch control.
   1201  * \param [in] value control value.
   1202  *
   1203  * \retval SHR_E_NONE on success and error code otherwise.
   1204  */
   1205 extern int
   1206 mbcm_ltsw_lb_hash_control_seed_set(
   1207     int unit,
   1208     bcmi_ltsw_hash_control_seed_t control,
   1209     int value);
   1210 
   1211 /*!
   1212  * \brief Get lb hash control seed.
   1213  *
   1214  * \param [in] unit Unit number.
   1215  * \param [in] control Switch control.
   1216  * \param [out] value control value.
   1217  *
   1218  * \retval SHR_E_NONE on success and error code otherwise.
   1219  */
   1220 extern int
   1221 mbcm_ltsw_lb_hash_control_seed_get(
   1222     int unit,
   1223     bcmi_ltsw_hash_control_seed_t control,
   1224     int *value);
   1225 
   1226 /*!
   1227  * \brief Set macro flow hash seed.
   1228  *
   1229  * \param [in] unit Unit number.
   1230  * \param [in] type Macro flow type.
   1231  * \param [int] value Seed value.
   1232  *
   1233  * \retval SHR_E_NONE on success and error code otherwise.
   1234  */
   1235 extern int
   1236 mbcm_ltsw_lb_hash_macro_flow_seed_set(
   1237     int unit,
   1238     bcmi_ltsw_macro_flow_t type,
   1239     int value);
   1240 
   1241 #endif /* BCMINT_LTSW_MBCM_LB_HASH_H */