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

policer_mgmt.h (30502B)


      1  /** \file bcm_int/dnx/policer/policer_mgmt.h
      2  * 
      3  * Internal DNX POLICER MGMT
      4  * 
      5  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      6  * 
      7  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      8  */
      9 
     10 #ifndef _DNX_POLICER_MGMT_INCLUDED__
     11 /*
     12  * { 
     13  */
     14 #define _DNX_POLICER_MGMT_INCLUDED__
     15 
     16 #ifndef BCM_DNX_SUPPORT
     17 #error "This file is for use by DNX (JR2) family only!"
     18 #endif
     19 
     20 #include <include/bcm/policer.h>
     21 #include <bcm_int/dnx/algo/template_mngr/template_manager_types.h>
     22 
     23 /*
     24  * MACROs
     25  * {
     26  */
     27 #define DNX_POLICER_INGRESS_DB0_TEMPLATE_NAME    "meter ingress database-0 profiles"
     28 #define DNX_POLICER_INGRESS_DB1_TEMPLATE_NAME    "meter ingress database-1 profiles"
     29 #define DNX_POLICER_INGRESS_DB2_TEMPLATE_NAME    "meter ingress database-2 profiles"
     30 #define DNX_POLICER_EGRESS_DB0_TEMPLATE_NAME    "meter egress database-0 profiles"
     31 #define DNX_POLICER_EGRESS_DB1_TEMPLATE_NAME    "meter egress database-1 profiles"
     32 
     33 /** kbits to bytes, for burst BCM TO DNX */
     34 #define DNX_POLICER_KBITS_TO_BYTES(__bcm_rate)\
     35         ((__bcm_rate == 0) ? dnx_data_meter.profile.burst_size_min_get(unit) :((__bcm_rate)*DNX_METER_UTILS_KBITS_TO_BYTES))
     36     /** bytes to kbits , for burst DNX TO BCM */
     37 #define DNX_POLICER_BYTES_TO_KBITS(__bcm_rate) ((__bcm_rate)/DNX_METER_UTILS_KBITS_TO_BYTES)
     38 
     39 #define DNX_POLICER_CASCADE_GROUP_SIZE (4)
     40 
     41 #define DNX_POLICER_MGMT_DP_CMD_MAX (15)
     42 
     43 #define POLICER_MNGR_TM_CB(is_ingress, database_id, exec) ( \
     44         (is_ingress && (database_id == 0))         ? dnx_meter_db.policer_templates.policer_ingress_db0.exec   :\
     45         ((is_ingress && (database_id == 1))        ? dnx_meter_db.policer_templates.policer_ingress_db1.exec   :\
     46         ((is_ingress && (database_id == 2))       ? dnx_meter_db.policer_templates.policer_ingress_db2.exec   :\
     47         ((!is_ingress && (database_id == 0))     ? dnx_meter_db.policer_templates.policer_egress_db0.exec    :\
     48                                                   dnx_meter_db.policer_templates.policer_egress_db1.exec    ))))
     49 
     50 /*
     51  * }
     52  */
     53 
     54 /*
     55  * structures
     56  * {
     57  */
     58 
     59 typedef enum
     60 {
     61     /*
     62      *  Ignore the incoming packet color (if any) when
     63      *  determining the (new) color to apply to the packet. (all
     64      *  packets are assumed Green)
     65      */
     66     DNX_MTR_COLOR_MODE_BLIND = 0,
     67     /*
     68      *  Consider the incoming packet color (if any) when
     69      *  determining the (new) color to apply to the packet.
     70      */
     71     DNX_MTR_COLOR_MODE_AWARE = 1,
     72     /*
     73      *  Number of types in SOC_PPC_MTR_COLOR_MODE
     74      */
     75     DNX_NOF_MTR_COLOR_MODES = 2
     76 } dnx_meter_color_t;
     77 
     78 /* brief: internal strucuture that holds the profile configuration. use also for template manager!!! */
     79 typedef struct
     80 {
     81     /*
     82      * When set, disable the CIR. i.e., the Committed Leaky-Bucket will never give credit. The actual rate will be
     83      * zero. Relevant only to meter APIs; not relevant for Ethernet policers (has to be FALSE). 
     84      */
     85     uint32 disable_cir;
     86     /*
     87      * When set, disable the EIR. i.e., * the Excess Leaky-Bucket will never give credit. * The actual rate will be
     88      * zero. Relevant only to meter APIs; * not relevant for Ethernet policers (has to be FALSE). 
     89      */
     90     uint32 disable_eir;
     91     /*
     92      *  Committed Information Rate, in Kbps
     93      */
     94     uint32 cir;
     95     /*
     96      *  Excess Information Rate, in Kbps
     97      */
     98     uint32 eir;
     99     /*
    100      *  Max Committed Information Rate, in Kbps
    101      *  Used only when sharing is enabled
    102      */
    103     uint32 max_cir;
    104     /*
    105      *  Max Excess Information Rate, in Kbps
    106      */
    107     uint32 max_eir;
    108     /*
    109      *  Committed Burst Size, in bytes
    110      */
    111     uint32 cbs;
    112     /*
    113      *  Excess Burst Size, in bytes
    114      */
    115     uint32 ebs;
    116     /*
    117      *  Indicates whether the color-aware or color-blind mode is
    118      *  employed at the metered traffic. In T20E has to be color
    119      *  blind, error is returned otherwise.
    120      */
    121 
    122     dnx_meter_color_t color_mode;
    123 
    124     /*
    125      *  When TRUE, work in coupling mode. In coupling mode
    126      *  excess credits from the Committed Leaky Bucket is passed
    127      *  to the Excess Leaky Bucket. In non- coupling mode excess
    128      *  credits from the Committed Leaky Bucket are discarded
    129      *  (standard behavior). In T20E has to be FALSE, error is
    130      *  returned otherwise. Remarks:1. In coupling mode, the long
    131      *  term average bit rate of bytes in yellow service frames
    132      *  admitted to the network is bounded by EIR. 2. In
    133      *  non-coupling mode, the long term average bit rate of
    134      *  bytes in yellow Service Frames admitted to the network
    135      *  is bounded by CIR + EIR depending on volume of the
    136      *  offered green Service Frames.3. SrTcm (Single Rate Three
    137      *  color meter) is achieved by enable the coupling mode and
    138      *  set EIR to zero.
    139      */
    140     uint32 is_coupling_enabled;
    141     /*
    142      *  When TRUE, work in sharing mode. In sharing mode, meters
    143      *  are part of a hierarchical quad meters. Bucket will get
    144      *  credits only from higher hierarchy bucket with SharingFlag set.
    145      *  When FALSE, all extra credit from all shared buckets will be
    146      *  summed and spread according priority.
    147      *  ARAD only.
    148      */
    149     uint32 is_sharing_enabled;
    150 
    151     /*
    152      *  Enable packet mode,
    153      *  If TRUE then policing according to packet profile rate 
    154      *  If FALSE then policing according to bytes profile rate.
    155      *  Relevant only for Ethernet poilcers.
    156      */
    157     uint32 is_packet_mode;
    158 
    159     /*
    160      *  Enable packet adjust with header truncate,
    161      *  If TRUE then packet size will be considere of the header truncate size in irpp
    162      *  If FALSE then policing without header truncate size
    163      *  Relevant only for Ethernet poilcers and Meters.
    164      */
    165     uint32 is_pkt_truncate;
    166 
    167 /*
    168     for cascade mode (sharing enable TRUE), need to have same rev exp for all buckets.
    169     therefore, we calculate the rev_exp in advance according to all buckets in the cascade and send it to the soc level.
    170     for other cases, it will be 0xFF.
    171 */
    172     uint32 ir_rev_exp;
    173 
    174     /*
    175      * data per profile that may represent something for the resolve table. for example: define if the color of the
    176      * meter will be black or red in case no committed or excess credits left (same as mark_black in QUX)
    177      */
    178     uint32 profile_data;
    179 
    180     /*
    181      * if set, meter is working in large bucket mode. otherwis, noraml bucket mode.
    182      */
    183     uint32 is_large_bucket_mode;
    184 
    185     /*
    186      * Indicate the Profile ID, used in order to allow two profiles with the same data
    187      */
    188     uint32 entropy_id;
    189 } dnx_meter_profile_info_t;
    190 
    191 /*
    192  * Functions prototypes
    193  * {
    194  */
    195 
    196 /**
    197 * \brief
    198 *  Correct all rates in pol_cfg by the specified multiplier.
    199 *  multiplier The amount to multiply or divide by.
    200 *  divide If TRUE then divide the rates by multiplier.
    201 *  Otherwise multiply by it.
    202 * \param [in] unit -unit id
    203 * \param [out] pol_cfg -strucutre which hold the api configuration
    204 * \param [in] is_packets_to_kbits -If TRUE convert from packets to kbits
    205 * \return
    206 *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    207 *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    208 * \remark
    209 *   NONE
    210 * \see
    211 *   NONE
    212 */
    213 shr_error_e dnx_policer_correct_config_rates(
    214     int unit,
    215     bcm_policer_config_t * pol_cfg,
    216     int is_packets_to_kbits);
    217 
    218 /**
    219  * \brief
    220  *      first initialization of the policer module
    221  * \param [in] unit -unit id
    222  * \return
    223  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    224  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    225  * \remark
    226  *   NONE
    227  * \see
    228  *   NONE
    229  */
    230 shr_error_e dnx_policer_init(
    231     int unit);
    232 
    233 /**
    234  * \brief
    235  *      Deinitialize dnx policer module
    236  * \param [in] unit -unit id
    237  * \return
    238  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    239  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    240  * \remark
    241  *   NONE
    242  * \see
    243  *   NONE
    244  */
    245 shr_error_e dnx_policer_deinit(
    246     int unit);
    247 
    248 /**
    249  * \brief
    250  *      callback print function for template manager. print the meter profile
    251  * \param [in] unit -unit id
    252  * \param [in] data -const pointer to profile data
    253  * \return
    254  *  void
    255  * \remark
    256  *   NONE
    257  * \see
    258  *   NONE
    259  */
    260 void dnx_policer_mgmt_tm_meter_profile_print_cb(
    261     int unit,
    262     const void *data);
    263 
    264 /**
    265 * \brief
    266 *   handle the expansion group set functionality
    267 * \param [in] unit  - unit data
    268 * \param [in] flags - 
    269 * \param [in] core_id  - allow ALL
    270 * \param [in] expansion_group  -config structure 
    271 * \return
    272 *   shr_error_e - Error Type
    273 * \remark
    274 *   * None
    275 * \see
    276 *   * None
    277 */
    278 shr_error_e dnx_policer_mgmt_expansion_groups_set(
    279     int unit,
    280     int flags,
    281     bcm_core_t core_id,
    282     bcm_policer_expansion_group_t * expansion_group);
    283 
    284 /**
    285 * \brief
    286 *   handle the expansion group get functionality
    287 * \param [in] unit  - unit data
    288 * \param [in] flags - 
    289 * \param [in] core_id  - allow ALL
    290 * \param [out] expansion_group  -config structure 
    291 * \return
    292 *   shr_error_e - Error Type
    293 * \remark
    294 *   * None
    295 * \see
    296 *   * None
    297 */
    298 shr_error_e dnx_policer_mgmt_expansion_groups_get(
    299     int unit,
    300     int flags,
    301     bcm_core_t core_id,
    302     bcm_policer_expansion_group_t * expansion_group);
    303 
    304 /**
    305 * \brief
    306 *   enable/disable the policer database in hw
    307 * \param [in] unit         - unit id
    308 * \param [in] flags        - 
    309 * \param [in] core_id      - allowed ALL
    310 * \param [in] database_id  - database_id
    311 * \param [in] is_ingress   - is_ingress
    312 * \param [in] is_global    - is_global
    313 * \param [in] enable       - enable/disanle
    314 * \return
    315 *   shr_error_e - Error Type
    316 * \remark
    317 *   * None
    318 * \see
    319 *   * None
    320 */
    321 shr_error_e dnx_policer_mgmt_database_enable_set(
    322     int unit,
    323     int flags,
    324     int core_id,
    325     int database_id,
    326     int is_ingress,
    327     int is_global,
    328     int enable);
    329 
    330 /**
    331 * \brief
    332 *   get if  policer database id enable/disable in hw
    333 * \param [in] unit         - unit id
    334 * \param [in] flags        - 
    335 * \param [in] core_id      - allowed ALL
    336 * \param [in] database_id  - database_id
    337 * \param [in] is_ingress   - is_ingress
    338 * \param [in] is_global    - is_global
    339 * \param [out] enable       - enable/disanle
    340 * \return
    341 *   shr_error_e - Error Type
    342 * \remark
    343 *   * None
    344 * \see
    345 *   * None
    346 */
    347 shr_error_e dnx_policer_mgmt_database_enable_get(
    348     int unit,
    349     int flags,
    350     int core_id,
    351     int database_id,
    352     int is_ingress,
    353     int is_global,
    354     int *enable);
    355 
    356 /**
    357 * \brief
    358 *   set the policer profile. handle the tm and the hw set
    359 * \param [in] unit         - unit is
    360 * \param [in] flags        - api flags. ignore the flags inside the structure pol_cfg for generic meter.
    361 * \param [in] core_id      - core id
    362 * \param [in] is_global    - global or generic meter
    363 * \param [in] is_ingress   - ingress or egrres (relevant for generic)
    364 * \param [in] database_id  - db is (0-2 for ingress, 0-1 for egress)
    365 * \param [in] meter_idx    - meter id
    366 * \param [in] pol_cfg    - configuration structure.
    367 * \return
    368 *   shr_error_e - Error Type
    369 * \remark
    370 *   * None
    371 * \see
    372 *   * None
    373 */
    374 shr_error_e dnx_policer_mgmt_policer_set(
    375     int unit,
    376     uint32 flags,
    377     int core_id,
    378     int is_global,
    379     int is_ingress,
    380     int database_id,
    381     int meter_idx,
    382     bcm_policer_config_t * pol_cfg);
    383 
    384 /**
    385 * \brief
    386 *   get the policer profile from HW.
    387 * \param [in] unit         - unit id
    388 * \param [out] pol_cfg      - API struct with of meter profile
    389 * \param [in] core_id      - core id
    390 * \param [in] is_global    - global or generic meter
    391 * \param [in] is_ingress   - ingress or egrres (relevant for generic)
    392 * \param [in] database_id  - db is (0-2 for ingress, 0-1 for egress)
    393 * \param [in] meter_idx    - meter id
    394 * \return
    395 *   shr_error_e - Error Type
    396 * \remark
    397 *   * None
    398 * \see
    399 *   * None
    400 */
    401 shr_error_e dnx_policer_mgmt_policer_get(
    402     int unit,
    403     int core_id,
    404     int is_global,
    405     int is_ingress,
    406     int database_id,
    407     int meter_idx,
    408     bcm_policer_config_t * pol_cfg);
    409 
    410 /**
    411 * \brief
    412 *   destory all template managers profiles for policer and clear HW configuration
    413 * \param [in] unit         - unit id
    414 * \return
    415 *   shr_error_e - Error Type
    416 * \remark
    417 *   It does not destroy global meter. (only generic meters) and it does not destroy the databases, just the meters.
    418 * \see
    419 *   * None
    420 */
    421 shr_error_e dnx_policer_mgmt_destroy_all(
    422     int unit);
    423 
    424 /**
    425 * \brief
    426 *   create generic policer mgmt. update sw state and hw registers
    427 * \param [in] unit         - unit id
    428 * \param [in] flags        - none
    429 * \param [in] core_id      - core id
    430 * \param [in] is_ingress   - ingress or egrres (relevant for generic)
    431 * \param [in] database_id  - db is (0-2 for ingress, 0-1 for egress)
    432 * \param [in] config    - configuration for the database
    433 * \return
    434 *   shr_error_e - Error Type
    435 * \remark
    436 *   * None
    437 * \see
    438 *   * None
    439 */
    440 shr_error_e dnx_policer_mgmt_database_create(
    441     int unit,
    442     int flags,
    443     int core_id,
    444     int is_ingress,
    445     int database_id,
    446     bcm_policer_database_config_t * config);
    447 
    448 /**
    449  * \brief
    450  *      get from hw the ingress expansion mapping and calculate the number of expansion groups
    451  * \param [in] unit -unit id
    452  * \param [in] flags -flags
    453  * \param [in] core_id -core_id
    454  * \param [out] nof_expansion_groups -nof expansion groups
    455  * \return
    456  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    457  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    458  * \remark
    459  *   NONE
    460  * \see
    461  *   NONE
    462  */
    463 shr_error_e dnx_policer_mgmt_nof_expansion_groups_get(
    464     int unit,
    465     int flags,
    466     int core_id,
    467     int *nof_expansion_groups);
    468 
    469 /**
    470  * \brief
    471  *      handle the API bcm_policer_engine_database_attach
    472  * \param [in] unit -unit id
    473  * \param [in] flags -flags
    474  * \param [in] engine -holds the engine_id, core and memory section.
    475  * \param [in] config -holds the database to connect and the base object stat id.
    476  * \return
    477  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    478  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    479  * \remark
    480  *   NONE
    481  * \see
    482  *   NONE
    483  */
    484 shr_error_e dnx_policer_mgmt_engine_database_attach(
    485     int unit,
    486     int flags,
    487     bcm_policer_engine_t * engine,
    488     bcm_policer_database_attach_config_t * config);
    489 
    490 /**
    491  * \brief
    492  *  find the database that the engine belong to. from the engine id and section, it find the bank id and search it in all databases.
    493  * \param [in] unit -unit id
    494  * \param [in] core_id  -specific core id 
    495  * \param [in] engine  -engine id and section. ignore the core_id
    496  * \param [out] is_ingress  -found in ingress or egress database
    497  * \param [out] database_id  -database id that the engine+section found in.
    498  * \param [out] bank_index  -the index (in the bank_arr sw state) that the bank was found in 
    499  * \param [out] found - if the engine was found or not 
    500  * \return
    501  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    502  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    503  * \remark
    504  *   NONE
    505  * \see
    506  *   NONE
    507  */
    508 shr_error_e dnx_policer_mgmt_engine_database_find(
    509     int unit,
    510     int core_id,
    511     bcm_policer_engine_t * engine,
    512     int *is_ingress,
    513     int *database_id,
    514     int *bank_index,
    515     int *found);
    516 
    517 /**
    518  * \brief
    519  *      handle the API bcm_policer_engine_database_detach
    520  * \param [in] unit -unit id
    521  * \param [in] flags -flags
    522  * \param [in] engine -holds the engine_id, core and memory section.
    523  * \return
    524  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    525  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    526  * \remark
    527  *   NONE
    528  * \see
    529  *   NONE
    530  */
    531 shr_error_e dnx_policer_mgmt_engine_database_detach(
    532     int unit,
    533     int flags,
    534     bcm_policer_engine_t * engine);
    535 
    536 /**
    537  * \brief
    538  *      handle the API bcm_policer_engine_database_get
    539  * \param [in] unit - 
    540  * \param [in] flags - 
    541  * \param [in] engine - holds the core_id, engine_id and section of memory to attach
    542  * \param [out] config - configuration to update in the API
    543  * \return
    544  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    545  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    546  * \remark
    547  *   NONE
    548  * \see
    549  *   NONE
    550  */
    551 shr_error_e dnx_policer_mgmt_engine_database_get(
    552     int unit,
    553     int flags,
    554     bcm_policer_engine_t * engine,
    555     bcm_policer_database_attach_config_t * config);
    556 
    557 /**
    558  * \brief
    559  *      verify that the section is valid for APIs that use the section parameters.
    560  *      Some of the APIs do not get the database handle, so the verification will be made only after extructing the database parameters.
    561  * \param [in] unit -unit id 
    562  * \param [in] core_id - specific core_id
    563  * \param [in] is_ingress - ingress ot egress database
    564  * \param [in] database_id -database_id
    565  * \param [in] section - ALL/LOW/HIGH
    566  * \return
    567  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    568  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    569  * \remark
    570  *   NONE
    571  * \see
    572  *   NONE
    573  */
    574 shr_error_e dnx_policer_mgmt_section_verify(
    575     int unit,
    576     int core_id,
    577     int is_ingress,
    578     int database_id,
    579     bcm_policer_engine_section_t section);
    580 
    581 /**
    582  * \brief
    583  * get how many meters in this database. how many potential meters, based on the banks that were allocated for this database
    584  * \param [in] unit -unit id 
    585  * \param [in] core_id - specific core_id
    586  * \param [in] is_ingress - ingress ot egress database
    587  * \param [in] database_id - database_id
    588  * \param [in] nof_meters - nof_meters 
    589  * \return
    590  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    591  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    592  * \remark
    593  *   NONE
    594  * \see
    595  *   NONE
    596  */
    597 shr_error_e dnx_policer_mgmt_nof_meter_in_database_get(
    598     int unit,
    599     int core_id,
    600     int is_ingress,
    601     int database_id,
    602     int *nof_meters);
    603 
    604 /**
    605  * \brief
    606  *      default policer configuration which use API strucutre. It configure the max rate and max burst (normal mode)
    607  * \param [in] unit -unit id
    608  * \param [in] pol_cfg -strucutre which hold the policer configuration
    609  * \param [in] is_single_bucket - is policer database is single bucket mode
    610  * \return
    611  *   \retval Non-zero (!= _SHR_E_NONE) in case of an error
    612  *   \retval Zero (= _SHR_E_NONE) in case of NO ERROR
    613  * \remark
    614  *   NONE
    615  * \see
    616  *   NONE
    617  */
    618 shr_error_e dnx_policer_default(
    619     int unit,
    620     bcm_policer_config_t * pol_cfg,
    621     uint32 is_single_bucket);
    622 
    623 /**
    624 * \brief
    625 *   handle bcm_policer_primary_color_resolution_set API. configure each time one entry in table
    626 * \param [in] unit        - unit id
    627 * \param [in] flags        - flags (none)
    628 * \param [in] key  - key for the table to configure
    629 * \param [in] config     - configured table
    630 * \return
    631 *   shr_error_e - Error Type
    632 * \remark
    633 *   * None
    634 * \see
    635 *   * None
    636 */
    637 shr_error_e dnx_policer_mgmt_primary_color_resolution_set(
    638     int unit,
    639     int flags,
    640     bcm_policer_primary_color_resolution_key_t * key,
    641     bcm_policer_primary_color_resolution_config_t * config);
    642 
    643 /**
    644 * \brief
    645 *   handle bcm_policer_primary_color_resolution_get API. get each time one entry from table
    646 * \param [in] unit        - unit id
    647 * \param [in] flags        - flags (none)
    648 * \param [in] key  - key for the table to configure
    649 * \param [out] config     - configured table
    650 * \return
    651 *   shr_error_e - Error Type
    652 * \remark
    653 *   * None
    654 * \see
    655 *   * None
    656 */
    657 shr_error_e dnx_policer_mgmt_primary_color_resolution_get(
    658     int unit,
    659     int flags,
    660     bcm_policer_primary_color_resolution_key_t * key,
    661     bcm_policer_primary_color_resolution_config_t * config);
    662 
    663 /**
    664 * \brief
    665 *   handle bcm_policer_color_resolution_set API. set each time one entry from final resolution table
    666 * \param [in] unit        - unit id
    667 * \param [in] policer_color_resolution        - strucutre which hold the key and value of the table. for egress the value is only egress_color.
    668 * \return
    669 *   shr_error_e - Error Type
    670 * \remark
    671 *   * configure all cores always
    672 * \see
    673 *   * None
    674 */
    675 shr_error_e dnx_policer_mgmt_color_final_resolution_set(
    676     int unit,
    677     bcm_policer_color_resolution_t * policer_color_resolution);
    678 
    679 /**
    680 * \brief
    681 *   handle bcm_policer_color_resolution_get API. set each time one entry from final resolution table
    682 * \param [in] unit        - unit id
    683 * \param [in] policer_color_resolution        - strucutre which hold the key and value of the table. for egress the value is only egress_color.
    684 * \return
    685 *   shr_error_e - Error Type
    686 * \remark
    687 *   * configure all cores always
    688 * \see
    689 *   * None
    690 */
    691 shr_error_e dnx_policer_mgmt_color_final_resolution_get(
    692     int unit,
    693     bcm_policer_color_resolution_t * policer_color_resolution);
    694 
    695 /**
    696 * \brief
    697 *   set the delta value in meter ingress header compensation per port table. 
    698 * \param [in] unit        - unit id
    699 * \param [in] logical_port   -logical_port
    700 * \param [in] delta   - -128..127
    701 * \return
    702 *   shr_error_e - Error Type
    703 * \remark
    704 *   There is a table per meter database (o,1,2) and global. Dbal set the given delta for all of them. 
    705 * \see
    706 *   * None
    707 */
    708 shr_error_e dnx_policer_mgmt_ingress_port_compensation_delta_set(
    709     int unit,
    710     bcm_port_t logical_port,
    711     int delta);
    712 
    713 /**
    714 * \brief
    715 *   get the delta value from meter ingress header compensation per port table. 
    716 * \param [in] unit        - unit id
    717 * \param [in] logical_port   - logical port
    718 * \param [out] delta   - -128..127
    719 * \return
    720 *   shr_error_e - Error Type
    721 * \remark
    722 *   There is a table per meter database (o,1,2) and global. Dbal set the given delta for all of them. And get one of them (which should be all the same).
    723 * \see
    724 *   * None
    725 */
    726 shr_error_e dnx_policer_mgmt_ingress_port_compensation_delta_get(
    727     int unit,
    728     bcm_port_t logical_port,
    729     int *delta);
    730 
    731 /**
    732 * \brief
    733 *   enable/disable MEF 10.3 mode in ingress and egress
    734 * \param [in] unit     - unit id
    735 * \param [in] enable   - enable/disable
    736 * \return
    737 *   shr_error_e - Error Type
    738 * \remark
    739 *   
    740 * \see
    741 *   * None
    742 */
    743 shr_error_e dnx_policer_mgmt_mef_10_3_set(
    744     int unit,
    745     int enable);
    746 
    747 /**
    748 * \brief
    749 *   get if MEF 10.3 mode is enabled/disabled
    750 * \param [in] unit      - unit id
    751 * \param [out] enable   - enable/disable
    752 * \return
    753 *   shr_error_e - Error Type
    754 * \remark
    755 *   
    756 * \see
    757 *   * None
    758 */
    759 shr_error_e dnx_policer_mgmt_mef_10_3_get(
    760     int unit,
    761     int *enable);
    762 
    763 /**
    764 * \brief
    765 *   set filter bitmap by DP command 
    766 * \param [in] unit        - unit id
    767 * \param [in] policer_database_handle   - database handle
    768 * \param [in] filter_bitmap - filter bitmap to be set
    769 * \return
    770 *   shr_error_e - Error Type
    771 * \remark
    772 *   API bcm_policer_control_set with type control
    773 *   bcmPolicerControlTypeFilterByDpCommand sets given filter
    774 *   bitmap by DP command. There is a table per
    775 *   ingress/egress/global meter and DBAL sets the given filter
    776 *   to the relevant field.
    777 * \see
    778 *   * None
    779 */
    780 shr_error_e dnx_policer_mgmt_filter_by_dp_command_set(
    781     int unit,
    782     int policer_database_handle,
    783     uint32 filter_bitmap);
    784 
    785 /**
    786 * \brief
    787 *   get filter bitmap by DP command 
    788 * \param [in] unit        - unit id
    789 * \param [in] policer_database_handle   - database handle
    790 * \param [out] filter_bitmap - filter bitmap
    791 * \return
    792 *   shr_error_e - Error Type
    793 * \remark
    794 *   API bcm_policer_control_get with type control
    795 *   bcmPolicerControlTypeFilterByDpCommand gives the filter
    796 *   bitmap by DP command.
    797 * \see
    798 *   * None
    799 */
    800 shr_error_e dnx_policer_mgmt_filter_by_dp_command_get(
    801     int unit,
    802     int policer_database_handle,
    803     uint32 *filter_bitmap);
    804 
    805 /**
    806 * \brief
    807 *   select to pass to table DP-CMD(0) or Meter-Profile(1)
    808 * \param [in] unit        - unit id
    809 * \param [in] policer_database_handle   - database handle
    810 * \param [in] enable - true=DP-CMD / false=Meter-Profile
    811 * \return
    812 *   shr_error_e - Error Type
    813 * \remark
    814 *   API bcm_policer_control_get with type control
    815 *   bcmPolicerControlTypeDpResolutionByDpCommand -
    816 *   enable/disable DP-CMD
    817 * \see
    818 *   * None
    819 */
    820 shr_error_e dnx_policer_mgmt_dp_resolution_by_dp_command_set(
    821     int unit,
    822     int policer_database_handle,
    823     uint32 enable);
    824 
    825 /**
    826 * \brief
    827 *   select to pass to table DP-CMD(0) or Meter-Profile(1)
    828 * \param [in] unit        - unit id
    829 * \param [in] policer_database_handle   - database handle
    830 * \param [out] enable - true=DP-CMD / false=Meter-Profile
    831 * \return
    832 *   shr_error_e - Error Type
    833 * \remark
    834 *   API bcm_policer_control_get with type control
    835 *   bcmPolicerControlTypeDpResolutionByDpCommand -
    836 *   true=DP-CMD / false=Meter-Profile
    837 * \see
    838 *   * None
    839 */
    840 shr_error_e dnx_policer_mgmt_dp_resolution_by_dp_command_get(
    841     int unit,
    842     int policer_database_handle,
    843     uint32 *enable);
    844 
    845 /**
    846 * \brief
    847 *   select to pass to table DP-CMD(0) or Meter-Profile(1)
    848 * \param [in] unit        - unit id
    849 * \param [in] cb   - policer traverse callback
    850 * \param [out] user_data - user data
    851 * \return
    852 *   shr_error_e - Error Type
    853 * \remark
    854 * 
    855 * \see
    856 *   * None
    857 */
    858 shr_error_e dnx_policer_mgmt_traverse(
    859     int unit,
    860     bcm_policer_traverse_cb cb,
    861     void *user_data);
    862 
    863 /**
    864 * \brief
    865 *   enable/disable fairness mechasinm for all meters (ingress/egress/global).
    866 *   The fairness mechanism is adding a random number for the bucket level in order to prevent adverse synchronization.
    867 *   between packet flows and provide fairness between multiple flows using the same meter.
    868 * \param [in] unit        - unit id
    869 * \param [in] policer_database_handle   - database handle
    870 * \param [in] enable   - if true enable fairmness mechanism. false for disable it.
    871 * \return
    872 *   shr_error_e - Error Type
    873 * \remark
    874 * 
    875 * \see
    876 *   * None
    877 */
    878 shr_error_e dnx_policer_mgmt_fairness_set(
    879     int unit,
    880     int policer_database_handle,
    881     int enable);
    882 
    883 /**
    884 * \brief
    885 *   get if meter fairness mechainsm is enabled or disabled
    886 * \param [in] unit        - unit id
    887 * \param [in] policer_database_handle   - database handle
    888 * \param [out] enable   - if true enabled.
    889 * \return
    890 *   shr_error_e - Error Type
    891 * \remark
    892 * 
    893 * \see
    894 *   * None
    895 */
    896 shr_error_e dnx_policer_mgmt_fairness_get(
    897     int unit,
    898     int policer_database_handle,
    899     uint32 *enable);
    900 
    901 /**
    902 * \brief
    903 *   function verify that the meter_pointer is valid, which means that its database was created, 
    904 *   and that It has corresponding entry in the HW memory that belong to the given database.
    905 *   In addition, it give back the meter indexes (base and size) that belongs to the meter_pointer.
    906 * \param [in] unit        - unit id
    907 * \param [in] core_id     - core id
    908 * \param [in] is_ingress     - ingress/egress meter
    909 * \param [in] database_id - database id
    910 * \param [in] meter_pointer - meter pointer is the object_stat_id that was given. 
    911 *             [meter_pointer = is_ingress ? object-stat-id : (object-stat-id*nof_QoS+QoS_offset) ]
    912 * \param [out] meter_valid   - True/valid
    913 * \param [out] meter_idx_base   - the base meter index
    914 * \param [out] meter_idx_size   - size of meter indexes corresponding to the meter pointer. In case of expansion exist,
    915 *                                 the size is according to the expansion, otherwise, the size is 1.
    916 * \return
    917 *   shr_error_e - Error Type
    918 * \remark
    919 *  1. Function does not handle global meter.
    920 * \see
    921 *   * None
    922 */
    923 shr_error_e dnx_policer_mgmt_meter_index_get(
    924     int unit,
    925     int core_id,
    926     int is_ingress,
    927     int database_id,
    928     int meter_pointer,
    929     int *meter_valid,
    930     int *meter_idx_base,
    931     int *meter_idx_size);
    932 
    933 /**
    934 * \brief
    935 *   enable dynamic access to all meter tables
    936 * \param [in] unit        - unit id
    937 * \param [in] enable     - True - enable, false - disable.
    938 * \return
    939 *   shr_error_e - Error Type
    940 * \remark
    941 *   * None
    942 * \see
    943 *   * None
    944 */
    945 shr_error_e dnx_meter_dynamic_access_enable_set(
    946     int unit,
    947     int enable);
    948 
    949 /**
    950 * \brief
    951 *   get if dynamic access to all meter tables enable or disable
    952 * \param [in] unit        - unit id
    953 * \param [out] enable     - True - enable, false - disable.
    954 * \return
    955 *   shr_error_e - Error Type
    956 * \remark
    957 *   * None
    958 * \see
    959 *   * None
    960 */
    961 shr_error_e dnx_meter_dynamic_access_enable_get(
    962     int unit,
    963     int *enable);
    964 
    965 /**
    966 * \brief
    967 *   Function to set the global per TC threshold for TC sensitive meters
    968 * \param [in] unit            - Unit ID
    969 * \param [in] gport           - Core Gport or 0, BCM_CORE_ALL is allowed, 0 indicates to set all cores
    970 * \param [in] cosq            - TC for which the threshold will be set
    971 * \param [in] tcsm_threshold  - Threshold value in percentages of the bucket level
    972 * \return
    973 *   shr_error_e - Error Type
    974 * \remark
    975 *   * None
    976 * \see
    977 *   * None
    978 */
    979 shr_error_e dnx_policer_mgmt_tcsm_threshold_set(
    980     int unit,
    981     bcm_gport_t gport,
    982     bcm_cos_queue_t cosq,
    983     int tcsm_threshold);
    984 
    985 /**
    986 * \brief
    987 *   Function to get the global per TC threshold for TC sensitive meters
    988 * \param [in] unit            - Unit ID
    989 * \param [in] gport           - Core Gport or 0, BCM_CORE_ALL is allowed, 0 indicates to set all cores
    990 * \param [in] cosq            - TC for which to get the threshold
    991 * \param [out] tcsm_threshold - Threshold value in percentages of the bucket level
    992 * \return
    993 *   shr_error_e - Error Type
    994 * \remark
    995 *   * None
    996 * \see
    997 *   * None
    998 */
    999 shr_error_e dnx_policer_mgmt_tcsm_threshold_get(
   1000     int unit,
   1001     bcm_gport_t gport,
   1002     bcm_cos_queue_t cosq,
   1003     int *tcsm_threshold);
   1004 
   1005 /**
   1006 * \brief
   1007 *   Function to set enabler for TC sensitive meters
   1008 * \param [in] unit - Unit ID
   1009 * \param [in] policer_database_handle - database handle
   1010 * \param [in] tcsm_enable - enable the TCSM
   1011 * \return
   1012 *   shr_error_e - Error Type
   1013 * \remark
   1014 *   * None
   1015 * \see
   1016 *   * None
   1017 */
   1018 shr_error_e dnx_policer_mgmt_tcsm_enable_set(
   1019     int unit,
   1020     int policer_database_handle,
   1021     uint32 tcsm_enable);
   1022 
   1023 /**
   1024 * \brief
   1025 *   Function to get enabler for TC sensitive meters
   1026 * \param [in] unit - Unit ID
   1027 * \param [in] policer_database_handle - database handle
   1028 * \param [out] tcsm_enable - enable the TCSM
   1029 * \return
   1030 *   shr_error_e - Error Type
   1031 * \remark
   1032 *   * None
   1033 * \see
   1034 *   * None
   1035 */
   1036 shr_error_e dnx_policer_mgmt_tcsm_enable_get(
   1037     int unit,
   1038     int policer_database_handle,
   1039     uint32 *tcsm_enable);
   1040 
   1041 /**
   1042 * \brief
   1043 *   Function to set which TC will determine the threshold for TC sensitive meters
   1044 * \param [in] unit - Unit ID
   1045 * \param [in] policer_database_handle - database handle
   1046 * \param [in] use_pp_tc - TRUE: use the PP TC; FALSE: use the offset from expansion groups
   1047 * \return
   1048 *   shr_error_e - Error Type
   1049 * \remark
   1050 *   * None
   1051 * \see
   1052 *   * None
   1053 */
   1054 shr_error_e dnx_policer_mgmt_tcsm_use_pp_tc_set(
   1055     int unit,
   1056     int policer_database_handle,
   1057     uint32 use_pp_tc);
   1058 
   1059 /**
   1060 * \brief
   1061 *   Function to get which TC will determine the threshold for TC sensitive meters
   1062 * \param [in] unit - Unit ID
   1063 * \param [in] policer_database_handle - database handle
   1064 * \param [out] use_pp_tc - TRUE: use the PP TC; FALSE: use the offset from expansion groups
   1065 * \return
   1066 *   shr_error_e - Error Type
   1067 * \remark
   1068 *   * None
   1069 * \see
   1070 *   * None
   1071 */
   1072 shr_error_e dnx_policer_mgmt_tcsm_use_pp_tc_get(
   1073     int unit,
   1074     int policer_database_handle,
   1075     uint32 *use_pp_tc);
   1076 
   1077 #endif/*_DNX_POLICER_MGMT_INCLUDED__*/