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

flowtracker.h (25693B)


      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 BCMINT_LTSW_MBCM_FLOWTRACKER_H
     12 #define BCMINT_LTSW_MBCM_FLOWTRACKER_H
     13 
     14 #include <bcm/types.h>
     15 #include <bcm/flowtracker.h>
     16 
     17 #include <sal/sal_types.h>
     18 
     19 /*!
     20  * \brief Deinitialize Flowtracker module.
     21  *
     22  * \param [in] unit Unit Number.
     23  *
     24  * \retval SHR_E_NONE No errors.
     25  * \retval !SHR_E_NONE Failure.
     26  */
     27 typedef int (*flowtracker_detach_f)(int unit);
     28 
     29 /*!
     30  * \brief Init Flowtracker module.
     31  *
     32  * \param [in] unit Unit Number.
     33  *
     34  * \retval SHR_E_NONE No errors.
     35  * \retval !SHR_E_NONE Failure.
     36  */
     37 typedef int (*flowtracker_init_f)(int unit);
     38 
     39 /*!
     40  * \brief Set the match criteria for an elephant action.
     41  *
     42  * \param [in] unit Unit Number.
     43  * \param [in] action Match action.
     44  * \param [in] match_types Match types.
     45  * \param [in] match_data Match data.
     46  *
     47  * \retval SHR_E_NONE No errors.
     48  * \retval !SHR_E_NONE Failure.
     49  */
     50 typedef int (*flowtracker_elephant_action_match_set_f)(
     51     int unit,
     52     bcm_flowtracker_elephant_match_action_t action,
     53     uint32_t match_types,
     54     bcm_flowtracker_elephant_match_data_t *match_data);
     55 
     56 /*!
     57  * \brief Get the match criteria for an elephant action.
     58  *
     59  * \param [in] unit Unit Number.
     60  * \param [in] action Match action.
     61  * \param [out] match_types Match types.
     62  * \param [out] match_data Match data.
     63  *
     64  * \retval SHR_E_NONE No errors.
     65  * \retval !SHR_E_NONE Failure.
     66  */
     67 typedef int (*flowtracker_elephant_action_match_get_f)(
     68     int unit,
     69     bcm_flowtracker_elephant_match_action_t action,
     70     uint32_t *match_types,
     71     bcm_flowtracker_elephant_match_data_t *match_data);
     72 
     73 /*!
     74  * \brief Set the internal priority remap for elephant flows.
     75  *
     76  * \param [in] unit Unit Number.
     77  * \param [in] int_pri Internal priority.
     78  * \param [in] new_int_pri New internal priority.
     79  *
     80  * \retval SHR_E_NONE No errors.
     81  * \retval !SHR_E_NONE Failure.
     82  */
     83 typedef int (*flowtracker_elephant_int_pri_remap_set_f)(
     84     int unit,
     85     bcm_cos_t int_pri,
     86     bcm_cos_t new_int_pri);
     87 
     88 /*!
     89  * \brief Get the internal priority remap from elephant flows.
     90  *
     91  * \param [in] unit Unit Number.
     92  * \param [in] int_pri Internal priority.
     93  * \param [out] new_int_pri New internal priority.
     94  *
     95  * \retval SHR_E_NONE No errors.
     96  * \retval !SHR_E_NONE Failure.
     97  */
     98 typedef int (*flowtracker_elephant_int_pri_remap_get_f)(
     99     int unit,
    100     bcm_cos_t int_pri,
    101     bcm_cos_t *new_int_pri);
    102 
    103 /*!
    104  * \brief Set the hashing configuration.
    105  *
    106  * \param [in] unit Unit Number.
    107  * \param [in] hash_table Hash table.
    108  * \param [in] instance_num Hash table instance number.
    109  * \param [in] bank_num Hash table bank number.
    110  * \param [in] hash_type Hash type.
    111  * \param [in] right_rotate_bits Number of bits the hash result should be rotated.
    112  *
    113  * \retval SHR_E_NONE No errors.
    114  * \retval !SHR_E_NONE Failure.
    115  */
    116 typedef int (*flowtracker_elephant_hash_config_set_f)(
    117     int unit,
    118     bcm_flowtracker_elephant_hash_table_t hash_table,
    119     int instance_num,
    120     int bank_num,
    121     bcm_flowtracker_elephant_hash_type_t hash_type,
    122     int right_rotate_bits);
    123 
    124 /*!
    125  * \brief Get the hashing configuration.
    126  *
    127  * \param [in] unit Unit Number.
    128  * \param [in] hash_table Hash table.
    129  * \param [in] instance_num Hash table instance number.
    130  * \param [in] bank_num Hash table bank number.
    131  * \param [out] hash_type Hash type.
    132  * \param [out] right_rotate_bits Number of bits the hash result should be rotated.
    133  *
    134  * \retval SHR_E_NONE No errors.
    135  * \retval !SHR_E_NONE Failure.
    136  */
    137 typedef int (*flowtracker_elephant_hash_config_get_f)(
    138     int unit,
    139     bcm_flowtracker_elephant_hash_table_t hash_table,
    140     int instance_num,
    141     int bank_num,
    142     bcm_flowtracker_elephant_hash_type_t *hash_type,
    143     int *right_rotate_bits);
    144 
    145 /*!
    146  * \brief Set the control configuration.
    147  *
    148  * \param [in] unit Unit Number.
    149  * \param [in] type Control type.
    150  * \param [in] arg Control value.
    151  *
    152  * \retval SHR_E_NONE No errors.
    153  * \retval !SHR_E_NONE Failure.
    154  */
    155 typedef int (*flowtracker_elephant_control_set_f)(
    156     int unit,
    157     bcm_flowtracker_elephant_control_t type,
    158     int arg);
    159 
    160 /*!
    161  * \brief Get the control configuration.
    162  *
    163  * \param [in] unit Unit Number.
    164  * \param [in] type Control type.
    165  * \param [out] arg Control value.
    166  *
    167  * \retval SHR_E_NONE No errors.
    168  * \retval !SHR_E_NONE Failure.
    169  */
    170 typedef int (*flowtracker_elephant_control_get_f)(
    171     int unit,
    172     bcm_flowtracker_elephant_control_t type,
    173     int *arg);
    174 
    175 /*!
    176  * \brief Set the elephant counters.
    177  *
    178  * \param [in] unit Unit Number.
    179  * \param [in] stats Elephant statistics.
    180  *
    181  * \retval SHR_E_NONE No errors.
    182  * \retval !SHR_E_NONE Failure.
    183  */
    184 typedef int (*flowtracker_elephant_stats_set_f)(
    185     int unit,
    186     bcm_flowtracker_elephant_stats_t *stats);
    187 
    188 /*!
    189  * \brief Get the elephant counters.
    190  *
    191  * \param [in] unit Unit Number.
    192  * \param [out] stats Elephant statistics.
    193  *
    194  * \retval SHR_E_NONE No errors.
    195  * \retval !SHR_E_NONE Failure.
    196  */
    197 typedef int (*flowtracker_elephant_stats_get_f)(
    198     int unit,
    199     bcm_flowtracker_elephant_stats_t *stats);
    200 
    201 /*!
    202  * \brief Get the elephant counters.
    203  *
    204  * \param [in] unit Unit Number.
    205  * \param [out] stats Elephant statistics.
    206  *
    207  * \retval SHR_E_NONE No errors.
    208  * \retval !SHR_E_NONE Failure.
    209  */
    210 typedef int (*flowtracker_elephant_stats_sync_get_f)(
    211     int unit,
    212     bcm_flowtracker_elephant_stats_t *stats);
    213 
    214 /*!
    215  * \brief Is default group supported.
    216  *
    217  * \param [in] unit Unit Number.
    218  * \param [out] supported Supported or not.
    219  *
    220  * \retval SHR_E_NONE No errors.
    221  * \retval !SHR_E_NONE Failure.
    222  */
    223 typedef int (*flowtracker_default_grp_supported_f)(
    224     int unit,
    225     bool *supported);
    226 
    227 /*!
    228  * \brief Validate tracking params.
    229  *
    230  * \param [in] unit Unit Number.
    231  * \param [in] id Flow group ID
    232  * \param [in] num_tracking_params Number of tracking parameters
    233  * \param [in] list_of_tracking_params Number of tracking parameters
    234  *
    235  * \retval SHR_E_NONE No errors.
    236  * \retval !SHR_E_NONE Failure.
    237  */
    238 typedef int (*flowtracker_group_tracking_params_validate_f)(
    239     int unit,
    240     bcm_flowtracker_group_t id,
    241     int num_tracking_params,
    242     bcm_flowtracker_tracking_param_info_t *list_of_tracking_params);
    243 
    244 /*!
    245  * \brief Validate export triggers
    246  *
    247  * \param [in] unit Unit Number.
    248  * \param [in] id Flow group ID
    249  * \param [in] export_trigger_info Export triggers
    250  *
    251  * \retval SHR_E_NONE No errors.
    252  * \retval !SHR_E_NONE Failure.
    253  */
    254 typedef int (*flowtracker_group_export_triggers_validate_f)(
    255     int unit,
    256     bcm_flowtracker_group_t id,
    257     bcm_flowtracker_export_trigger_info_t *export_trigger_info);
    258 
    259 /*!
    260  * \brief Validate actions
    261  *
    262  * \param [in] unit Unit Number.
    263  * \param [in] id Flow group ID
    264  * \param [in] flags Flags
    265  * \param [in] hw_learn_en Flow learning is enabled in HW
    266  * \param [in] num_actions Number of actions
    267  * \param [in] action_list Action list
    268  *
    269  * \retval SHR_E_NONE No errors.
    270  * \retval !SHR_E_NONE Failure.
    271  */
    272 typedef int (*flowtracker_group_actions_validate_f)(
    273     int unit,
    274     bcm_flowtracker_group_t id,
    275     uint32 flags,
    276     uint8_t hw_learn_en,
    277     int num_actions,
    278     bcm_flowtracker_group_action_info_t *action_list);
    279 
    280 /*!
    281  * \brief Reserve necessary flex counters
    282  *
    283  * \param [in] unit Unit Number.
    284  * \param [in] max_flows Max flows enabled for learning by flowtracker
    285  * \param [in] hw_learn_en Flow learning is enabled in HW
    286  * \param [out] flex_ctr_stat_id Output flex ctr stat ID
    287  * \param [out] flex_ctr_lt_id Output flex ctr LT index
    288  *
    289  * \retval SHR_E_NONE No errors.
    290  * \retval !SHR_E_NONE Failure.
    291  */
    292 typedef int (*flowtracker_flex_ctr_pkt_byte_reserve_f)(
    293     int unit,
    294     int max_flows,
    295     uint8_t hw_learn_en,
    296     uint32_t *flex_ctr_stat_id,
    297     uint32_t *flex_ctr_lt_id);
    298 
    299 /*!
    300  * \brief Reserve necessary hit bit related flex counters
    301  *
    302  * \param [in] unit Unit Number.
    303  * \param [in] hitbit_type Hitbit type for which flex counters need to be reserved
    304  * \param [in] max_flows Max flows enabled for learning by flowtracker
    305  * \param [in] hw_learn_en Flow learning is enabled in HW
    306  * \param [out] flex_ctr_stat_id Output flex ctr stat ID
    307  * \param [out] flex_ctr_lt_id Output flex ctr LT index
    308  *
    309  * \retval SHR_E_NONE No errors.
    310  * \retval !SHR_E_NONE Failure.
    311  */
    312 typedef int (*flowtracker_flex_ctr_hit_bit_reserve_f)(
    313     int unit,
    314     int hitbit_type,
    315     int max_flows,
    316     uint8_t hw_learn_en,
    317     uint32_t *flex_ctr_stat_id,
    318     uint32_t *flex_ctr_lt_id);
    319 
    320 /*!
    321  * \brief Get the maximum number of HW learnt flows
    322  *
    323  * \param [in] unit Unit Number.
    324  * \param [in] uft_mode Current UFT mode.
    325  * \param [out] max_flows_per_pipe Maximum number of HW learnt flows.
    326  *
    327  * \retval SHR_E_NONE No errors.
    328  * \retval !SHR_E_NONE Failure.
    329  */
    330 typedef int (*flowtracker_hw_learn_max_flows_per_pipe_get_f)(
    331     int unit,
    332     uint8_t uft_mode,
    333     uint32_t *max_flows_per_pipe);
    334 
    335 /*!
    336  * \brief Get the names of the Hw learn enable register and field
    337  *
    338  * \param [in] unit Unit Number.
    339  * \param [out] reg_str Register name.
    340  * \param [out] field_str Field name.
    341  *
    342  * \retval SHR_E_NONE No errors.
    343  * \retval !SHR_E_NONE Failure.
    344  */
    345 typedef int (*flowtracker_hw_learn_global_enable_reg_field_name_get_f)(
    346     int unit,
    347     char **reg_str,
    348     char **field_str);
    349 
    350 /*!
    351  * \brief Group flex counter actions and return group action
    352  *
    353  * \param [in] unit Unit Number.
    354  * \param [in] main_ctr_stat_id The main flex counter banks stat ID.
    355  * \param [in] hitbit_ctr_stat_id The 2x or 4x hitbit counter banks stat ID.
    356  * \param [out] group_action_stat_id The grouped action stat ID.
    357  * \param [out] group_action_hw_idx The grouped action HW index.
    358  *
    359  * \retval SHR_E_NONE No errors.
    360  * \retval !SHR_E_NONE Failure.
    361  */
    362 typedef int (*flowtracker_flex_ctr_action_group_f)(
    363     int unit,
    364     uint32_t main_ctr_stat_id,
    365     uint32_t hitbit_ctr_stat_id,
    366     uint32_t *group_action_stat_id,
    367     uint32_t *group_action_hw_idx);
    368 
    369 /*!
    370  * \brief Get the maximum number of SW learnt flows
    371  *
    372  * \param [in] unit Unit Number.
    373  * \param [out] max_flows_per_pipe Maximum number of SW learnt flows.
    374  *
    375  * \retval SHR_E_NONE No errors.
    376  * \retval !SHR_E_NONE Failure.
    377  */
    378 typedef int (*flowtracker_sw_learn_max_flows_per_pipe_get_f)(
    379     int unit,
    380     uint32_t *max_flows_per_pipe);
    381 
    382 /*!
    383  * \brief Check if the UFT mode is supported for HW learning feature
    384  *
    385  * \param [in] unit Unit Number.
    386  * \param [in] uft_mode Current UFT mode.
    387  * \param [out] supported Is supported or not.
    388  *
    389  * \retval SHR_E_NONE No errors.
    390  * \retval !SHR_E_NONE Failure.
    391  */
    392 typedef int (*flowtracker_hw_learn_is_supported_uft_mode_f)(
    393     int unit,
    394     uint8_t uft_mode,
    395     bool *supported);
    396 
    397 /*!
    398  * \brief Check if the UFT mode is supported for SW learning feature
    399  *
    400  * \param [in] unit Unit Number.
    401  * \param [in] uft_mode Current UFT mode.
    402  * \param [out] supported Is supported or not.
    403  *
    404  * \retval SHR_E_NONE No errors.
    405  * \retval !SHR_E_NONE Failure.
    406  */
    407 typedef int (*flowtracker_sw_learn_is_supported_uft_mode_f)(
    408     int unit,
    409     uint8_t uft_mode,
    410     bool *supported);
    411 
    412 /*!
    413  * \brief Flowtracker driver structure.
    414  */
    415 typedef struct mbcm_ltsw_flowtracker_drv_s {
    416 
    417     /*! Deinitialize Flowtracker module. */
    418     flowtracker_detach_f flowtracker_detach;
    419 
    420     /*! Init Flowtracker module. */
    421     flowtracker_init_f flowtracker_init;
    422 
    423     /*! Set the match criteria for an elephant action. */
    424     flowtracker_elephant_action_match_set_f flowtracker_elephant_action_match_set;
    425 
    426     /*! Get the match criteria for an elephant action. */
    427     flowtracker_elephant_action_match_get_f flowtracker_elephant_action_match_get;
    428 
    429     /*! Set the internal priority remap for elephant flows. */
    430     flowtracker_elephant_int_pri_remap_set_f flowtracker_elephant_int_pri_remap_set;
    431 
    432     /*! Get the internal priority remap from elephant flows. */
    433     flowtracker_elephant_int_pri_remap_get_f flowtracker_elephant_int_pri_remap_get;
    434 
    435     /*! Set the hashing configuration. */
    436     flowtracker_elephant_hash_config_set_f flowtracker_elephant_hash_config_set;
    437 
    438     /*! Get the hashing configuration. */
    439     flowtracker_elephant_hash_config_get_f flowtracker_elephant_hash_config_get;
    440 
    441     /*! Set the control configuration. */
    442     flowtracker_elephant_control_set_f flowtracker_elephant_control_set;
    443 
    444     /*! Get the control configuration. */
    445     flowtracker_elephant_control_get_f flowtracker_elephant_control_get;
    446 
    447     /*! Set the elephant counters. */
    448     flowtracker_elephant_stats_set_f flowtracker_elephant_stats_set;
    449 
    450     /*! Get the elephant counters. */
    451     flowtracker_elephant_stats_get_f flowtracker_elephant_stats_get;
    452 
    453     /*! Get the elephant counters. */
    454     flowtracker_elephant_stats_sync_get_f flowtracker_elephant_stats_sync_get;
    455 
    456     /*! Is default group supported. */
    457     flowtracker_default_grp_supported_f flowtracker_default_grp_supported;
    458 
    459     /*! Validate tracking params. */
    460     flowtracker_group_tracking_params_validate_f flowtracker_group_tracking_params_validate;
    461 
    462     /*! Validate export triggers */
    463     flowtracker_group_export_triggers_validate_f flowtracker_group_export_triggers_validate;
    464 
    465     /*! Validate actions */
    466     flowtracker_group_actions_validate_f flowtracker_group_actions_validate;
    467 
    468     /*! Reserve necessary flex counters */
    469     flowtracker_flex_ctr_pkt_byte_reserve_f flowtracker_flex_ctr_pkt_byte_reserve;
    470 
    471     /*! Reserve necessary hit bit related flex counters */
    472     flowtracker_flex_ctr_hit_bit_reserve_f flowtracker_flex_ctr_hit_bit_reserve;
    473 
    474     /*! Get the maximum number of HW learnt flows */
    475     flowtracker_hw_learn_max_flows_per_pipe_get_f flowtracker_hw_learn_max_flows_per_pipe_get;
    476 
    477     /*! Get the names of the Hw learn enable register and field */
    478     flowtracker_hw_learn_global_enable_reg_field_name_get_f flowtracker_hw_learn_global_enable_reg_field_name_get;
    479 
    480     /*! Group flex counter actions and return group action */
    481     flowtracker_flex_ctr_action_group_f flowtracker_flex_ctr_action_group;
    482 
    483     /*! Get the maximum number of SW learnt flows */
    484     flowtracker_sw_learn_max_flows_per_pipe_get_f flowtracker_sw_learn_max_flows_per_pipe_get;
    485 
    486     /*! Check if the UFT mode is supported for HW learning feature */
    487     flowtracker_hw_learn_is_supported_uft_mode_f flowtracker_hw_learn_is_supported_uft_mode;
    488 
    489     /*! Check if the UFT mode is supported for SW learning feature */
    490     flowtracker_sw_learn_is_supported_uft_mode_f flowtracker_sw_learn_is_supported_uft_mode;
    491 
    492 } mbcm_ltsw_flowtracker_drv_t;
    493 
    494 /*!
    495  * \brief Set the FLOWTRACKER driver of the device.
    496  *
    497  * \param [in] unit Unit Number.
    498  * \param [in] drv Flowtracker driver to set.
    499  *
    500  * \retval SHR_E_NONE No errors.
    501  * \retval !SHR_E_NONE Failure.
    502  */
    503 extern int
    504 mbcm_ltsw_flowtracker_drv_set(
    505     int unit,
    506     mbcm_ltsw_flowtracker_drv_t *drv);
    507 
    508 /*!
    509  * \brief Deinitialize Flowtracker module.
    510  *
    511  * \param [in] unit Unit Number.
    512  *
    513  * \retval SHR_E_NONE No errors.
    514  * \retval !SHR_E_NONE Failure.
    515  */
    516 extern int
    517 mbcm_ltsw_flowtracker_detach(int unit);
    518 
    519 /*!
    520  * \brief Init Flowtracker module.
    521  *
    522  * \param [in] unit Unit Number.
    523  *
    524  * \retval SHR_E_NONE No errors.
    525  * \retval !SHR_E_NONE Failure.
    526  */
    527 extern int
    528 mbcm_ltsw_flowtracker_init(int unit);
    529 
    530 /*!
    531  * \brief Set the match criteria for an elephant action.
    532  *
    533  * \param [in] unit Unit Number.
    534  * \param [in] action Match action.
    535  * \param [in] match_types Match types.
    536  * \param [in] match_data Match data.
    537  *
    538  * \retval SHR_E_NONE No errors.
    539  * \retval !SHR_E_NONE Failure.
    540  */
    541 extern int
    542 mbcm_ltsw_flowtracker_elephant_action_match_set(
    543     int unit,
    544     bcm_flowtracker_elephant_match_action_t action,
    545     uint32_t match_types,
    546     bcm_flowtracker_elephant_match_data_t *match_data);
    547 
    548 /*!
    549  * \brief Get the match criteria for an elephant action.
    550  *
    551  * \param [in] unit Unit Number.
    552  * \param [in] action Match action.
    553  * \param [out] match_types Match types.
    554  * \param [out] match_data Match data.
    555  *
    556  * \retval SHR_E_NONE No errors.
    557  * \retval !SHR_E_NONE Failure.
    558  */
    559 extern int
    560 mbcm_ltsw_flowtracker_elephant_action_match_get(
    561     int unit,
    562     bcm_flowtracker_elephant_match_action_t action,
    563     uint32_t *match_types,
    564     bcm_flowtracker_elephant_match_data_t *match_data);
    565 
    566 /*!
    567  * \brief Set the internal priority remap for elephant flows.
    568  *
    569  * \param [in] unit Unit Number.
    570  * \param [in] int_pri Internal priority.
    571  * \param [in] new_int_pri New internal priority.
    572  *
    573  * \retval SHR_E_NONE No errors.
    574  * \retval !SHR_E_NONE Failure.
    575  */
    576 extern int
    577 mbcm_ltsw_flowtracker_elephant_int_pri_remap_set(
    578     int unit,
    579     bcm_cos_t int_pri,
    580     bcm_cos_t new_int_pri);
    581 
    582 /*!
    583  * \brief Get the internal priority remap from elephant flows.
    584  *
    585  * \param [in] unit Unit Number.
    586  * \param [in] int_pri Internal priority.
    587  * \param [out] new_int_pri New internal priority.
    588  *
    589  * \retval SHR_E_NONE No errors.
    590  * \retval !SHR_E_NONE Failure.
    591  */
    592 extern int
    593 mbcm_ltsw_flowtracker_elephant_int_pri_remap_get(
    594     int unit,
    595     bcm_cos_t int_pri,
    596     bcm_cos_t *new_int_pri);
    597 
    598 /*!
    599  * \brief Set the hashing configuration.
    600  *
    601  * \param [in] unit Unit Number.
    602  * \param [in] hash_table Hash table.
    603  * \param [in] instance_num Hash table instance number.
    604  * \param [in] bank_num Hash table bank number.
    605  * \param [in] hash_type Hash type.
    606  * \param [in] right_rotate_bits Number of bits the hash result should be rotated.
    607  *
    608  * \retval SHR_E_NONE No errors.
    609  * \retval !SHR_E_NONE Failure.
    610  */
    611 extern int
    612 mbcm_ltsw_flowtracker_elephant_hash_config_set(
    613     int unit,
    614     bcm_flowtracker_elephant_hash_table_t hash_table,
    615     int instance_num,
    616     int bank_num,
    617     bcm_flowtracker_elephant_hash_type_t hash_type,
    618     int right_rotate_bits);
    619 
    620 /*!
    621  * \brief Get the hashing configuration.
    622  *
    623  * \param [in] unit Unit Number.
    624  * \param [in] hash_table Hash table.
    625  * \param [in] instance_num Hash table instance number.
    626  * \param [in] bank_num Hash table bank number.
    627  * \param [out] hash_type Hash type.
    628  * \param [out] right_rotate_bits Number of bits the hash result should be rotated.
    629  *
    630  * \retval SHR_E_NONE No errors.
    631  * \retval !SHR_E_NONE Failure.
    632  */
    633 extern int
    634 mbcm_ltsw_flowtracker_elephant_hash_config_get(
    635     int unit,
    636     bcm_flowtracker_elephant_hash_table_t hash_table,
    637     int instance_num,
    638     int bank_num,
    639     bcm_flowtracker_elephant_hash_type_t *hash_type,
    640     int *right_rotate_bits);
    641 
    642 /*!
    643  * \brief Set the control configuration.
    644  *
    645  * \param [in] unit Unit Number.
    646  * \param [in] type Control type.
    647  * \param [in] arg Control value.
    648  *
    649  * \retval SHR_E_NONE No errors.
    650  * \retval !SHR_E_NONE Failure.
    651  */
    652 extern int
    653 mbcm_ltsw_flowtracker_elephant_control_set(
    654     int unit,
    655     bcm_flowtracker_elephant_control_t type,
    656     int arg);
    657 
    658 /*!
    659  * \brief Get the control configuration.
    660  *
    661  * \param [in] unit Unit Number.
    662  * \param [in] type Control type.
    663  * \param [out] arg Control value.
    664  *
    665  * \retval SHR_E_NONE No errors.
    666  * \retval !SHR_E_NONE Failure.
    667  */
    668 extern int
    669 mbcm_ltsw_flowtracker_elephant_control_get(
    670     int unit,
    671     bcm_flowtracker_elephant_control_t type,
    672     int *arg);
    673 
    674 /*!
    675  * \brief Set the elephant counters.
    676  *
    677  * \param [in] unit Unit Number.
    678  * \param [in] stats Elephant statistics.
    679  *
    680  * \retval SHR_E_NONE No errors.
    681  * \retval !SHR_E_NONE Failure.
    682  */
    683 extern int
    684 mbcm_ltsw_flowtracker_elephant_stats_set(
    685     int unit,
    686     bcm_flowtracker_elephant_stats_t *stats);
    687 
    688 /*!
    689  * \brief Get the elephant counters.
    690  *
    691  * \param [in] unit Unit Number.
    692  * \param [out] stats Elephant statistics.
    693  *
    694  * \retval SHR_E_NONE No errors.
    695  * \retval !SHR_E_NONE Failure.
    696  */
    697 extern int
    698 mbcm_ltsw_flowtracker_elephant_stats_get(
    699     int unit,
    700     bcm_flowtracker_elephant_stats_t *stats);
    701 
    702 /*!
    703  * \brief Get the elephant counters.
    704  *
    705  * \param [in] unit Unit Number.
    706  * \param [out] stats Elephant statistics.
    707  *
    708  * \retval SHR_E_NONE No errors.
    709  * \retval !SHR_E_NONE Failure.
    710  */
    711 extern int
    712 mbcm_ltsw_flowtracker_elephant_stats_sync_get(
    713     int unit,
    714     bcm_flowtracker_elephant_stats_t *stats);
    715 
    716 /*!
    717  * \brief Is default group supported.
    718  *
    719  * \param [in] unit Unit Number.
    720  * \param [out] supported Supported or not.
    721  *
    722  * \retval SHR_E_NONE No errors.
    723  * \retval !SHR_E_NONE Failure.
    724  */
    725 extern int
    726 mbcm_ltsw_flowtracker_default_grp_supported(
    727     int unit,
    728     bool *supported);
    729 
    730 /*!
    731  * \brief Validate tracking params.
    732  *
    733  * \param [in] unit Unit Number.
    734  * \param [in] id Flow group ID
    735  * \param [in] num_tracking_params Number of tracking parameters
    736  * \param [in] list_of_tracking_params Number of tracking parameters
    737  *
    738  * \retval SHR_E_NONE No errors.
    739  * \retval !SHR_E_NONE Failure.
    740  */
    741 extern int
    742 mbcm_ltsw_flowtracker_group_tracking_params_validate(
    743     int unit,
    744     bcm_flowtracker_group_t id,
    745     int num_tracking_params,
    746     bcm_flowtracker_tracking_param_info_t *list_of_tracking_params);
    747 
    748 /*!
    749  * \brief Validate export triggers
    750  *
    751  * \param [in] unit Unit Number.
    752  * \param [in] id Flow group ID
    753  * \param [in] export_trigger_info Export triggers
    754  *
    755  * \retval SHR_E_NONE No errors.
    756  * \retval !SHR_E_NONE Failure.
    757  */
    758 extern int
    759 mbcm_ltsw_flowtracker_group_export_triggers_validate(
    760     int unit,
    761     bcm_flowtracker_group_t id,
    762     bcm_flowtracker_export_trigger_info_t *export_trigger_info);
    763 
    764 /*!
    765  * \brief Validate actions
    766  *
    767  * \param [in] unit Unit Number.
    768  * \param [in] id Flow group ID
    769  * \param [in] flags Flags
    770  * \param [in] hw_learn_en Flow learning is enabled in HW
    771  * \param [in] num_actions Number of actions
    772  * \param [in] action_list Action list
    773  *
    774  * \retval SHR_E_NONE No errors.
    775  * \retval !SHR_E_NONE Failure.
    776  */
    777 extern int
    778 mbcm_ltsw_flowtracker_group_actions_validate(
    779     int unit,
    780     bcm_flowtracker_group_t id,
    781     uint32 flags,
    782     uint8_t hw_learn_en,
    783     int num_actions,
    784     bcm_flowtracker_group_action_info_t *action_list);
    785 
    786 /*!
    787  * \brief Reserve necessary flex counters
    788  *
    789  * \param [in] unit Unit Number.
    790  * \param [in] max_flows Max flows enabled for learning by flowtracker
    791  * \param [in] hw_learn_en Flow learning is enabled in HW
    792  * \param [out] flex_ctr_stat_id Output flex ctr stat ID
    793  * \param [out] flex_ctr_lt_id Output flex ctr LT index
    794  *
    795  * \retval SHR_E_NONE No errors.
    796  * \retval !SHR_E_NONE Failure.
    797  */
    798 extern int
    799 mbcm_ltsw_flowtracker_flex_ctr_pkt_byte_reserve(
    800     int unit,
    801     int max_flows,
    802     uint8_t hw_learn_en,
    803     uint32_t *flex_ctr_stat_id,
    804     uint32_t *flex_ctr_lt_id);
    805 
    806 /*!
    807  * \brief Reserve necessary hit bit related flex counters
    808  *
    809  * \param [in] unit Unit Number.
    810  * \param [in] hitbit_type Hitbit type for which flex counters need to be reserved
    811  * \param [in] max_flows Max flows enabled for learning by flowtracker
    812  * \param [in] hw_learn_en Flow learning is enabled in HW
    813  * \param [out] flex_ctr_stat_id Output flex ctr stat ID
    814  * \param [out] flex_ctr_lt_id Output flex ctr LT index
    815  *
    816  * \retval SHR_E_NONE No errors.
    817  * \retval !SHR_E_NONE Failure.
    818  */
    819 extern int
    820 mbcm_ltsw_flowtracker_flex_ctr_hit_bit_reserve(
    821     int unit,
    822     int hitbit_type,
    823     int max_flows,
    824     uint8_t hw_learn_en,
    825     uint32_t *flex_ctr_stat_id,
    826     uint32_t *flex_ctr_lt_id);
    827 
    828 /*!
    829  * \brief Get the maximum number of HW learnt flows
    830  *
    831  * \param [in] unit Unit Number.
    832  * \param [in] uft_mode Current UFT mode.
    833  * \param [out] max_flows_per_pipe Maximum number of HW learnt flows.
    834  *
    835  * \retval SHR_E_NONE No errors.
    836  * \retval !SHR_E_NONE Failure.
    837  */
    838 extern int
    839 mbcm_ltsw_flowtracker_hw_learn_max_flows_per_pipe_get(
    840     int unit,
    841     uint8_t uft_mode,
    842     uint32_t *max_flows_per_pipe);
    843 
    844 /*!
    845  * \brief Get the names of the Hw learn enable register and field
    846  *
    847  * \param [in] unit Unit Number.
    848  * \param [out] reg_str Register name.
    849  * \param [out] field_str Field name.
    850  *
    851  * \retval SHR_E_NONE No errors.
    852  * \retval !SHR_E_NONE Failure.
    853  */
    854 extern int
    855 mbcm_ltsw_flowtracker_hw_learn_global_enable_reg_field_name_get(
    856     int unit,
    857     char **reg_str,
    858     char **field_str);
    859 
    860 /*!
    861  * \brief Group flex counter actions and return group action
    862  *
    863  * \param [in] unit Unit Number.
    864  * \param [in] main_ctr_stat_id The main flex counter banks stat ID.
    865  * \param [in] hitbit_ctr_stat_id The 2x or 4x hitbit counter banks stat ID.
    866  * \param [out] group_action_stat_id The grouped action stat ID.
    867  * \param [out] group_action_hw_idx The grouped action HW index.
    868  *
    869  * \retval SHR_E_NONE No errors.
    870  * \retval !SHR_E_NONE Failure.
    871  */
    872 extern int
    873 mbcm_ltsw_flowtracker_flex_ctr_action_group(
    874     int unit,
    875     uint32_t main_ctr_stat_id,
    876     uint32_t hitbit_ctr_stat_id,
    877     uint32_t *group_action_stat_id,
    878     uint32_t *group_action_hw_idx);
    879 
    880 /*!
    881  * \brief Get the maximum number of SW learnt flows
    882  *
    883  * \param [in] unit Unit Number.
    884  * \param [out] max_flows_per_pipe Maximum number of SW learnt flows.
    885  *
    886  * \retval SHR_E_NONE No errors.
    887  * \retval !SHR_E_NONE Failure.
    888  */
    889 extern int
    890 mbcm_ltsw_flowtracker_sw_learn_max_flows_per_pipe_get(
    891     int unit,
    892     uint32_t *max_flows_per_pipe);
    893 
    894 /*!
    895  * \brief Check if the UFT mode is supported for HW learning feature
    896  *
    897  * \param [in] unit Unit Number.
    898  * \param [in] uft_mode Current UFT mode.
    899  * \param [out] supported Is supported or not.
    900  *
    901  * \retval SHR_E_NONE No errors.
    902  * \retval !SHR_E_NONE Failure.
    903  */
    904 extern int
    905 mbcm_ltsw_flowtracker_hw_learn_is_supported_uft_mode(
    906     int unit,
    907     uint8_t uft_mode,
    908     bool *supported);
    909 
    910 /*!
    911  * \brief Check if the UFT mode is supported for SW learning feature
    912  *
    913  * \param [in] unit Unit Number.
    914  * \param [in] uft_mode Current UFT mode.
    915  * \param [out] supported Is supported or not.
    916  *
    917  * \retval SHR_E_NONE No errors.
    918  * \retval !SHR_E_NONE Failure.
    919  */
    920 extern int
    921 mbcm_ltsw_flowtracker_sw_learn_is_supported_uft_mode(
    922     int unit,
    923     uint8_t uft_mode,
    924     bool *supported);
    925 
    926 #endif /* BCMINT_LTSW_MBCM_FLOWTRACKER_H */