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

rate_measurement.h (3623B)


      1 /*
      2  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      3  * 
      4  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      5  */
      6 /*
      7  * rate_measurement.h
      8  *
      9  *  Created on: Dec 12, 2018
     10  *      Author: si888124
     11  */
     12 
     13 #ifndef _DNX_RATE_MEASUREMENT_H_INCLUDED_
     14 #define _DNX_RATE_MEASUREMENT_H_INCLUDED_
     15 
     16 #ifndef BCM_DNX_SUPPORT
     17 #error "This file is for use by DNX family only!"
     18 #endif
     19 
     20 /**
     21  * \brief - Set interval for egress rate measure.
     22  * interval=0 disables the feature.
     23  *
     24  * \param [in] unit - Unit-ID
     25  * \param [in] interval - interval value [usec]
     26  *
     27  * \return
     28  *   See shr_error_e
     29  * \see
     30  *   * None
     31  */
     32 shr_error_e dnx_rate_measurement_interval_set(
     33     int unit,
     34     int interval);
     35 
     36 /**
     37  * \brief - Get interval used for egress rate measure
     38  *
     39  * \param [in] unit - Unit-ID
     40  * \param [out] interval - interval value [usec]
     41  *
     42  * \return
     43  *   See shr_error_e
     44  * \see
     45  *   * None
     46  */
     47 shr_error_e dnx_rate_measurement_interval_get(
     48     int unit,
     49     int *interval);
     50 
     51 /**
     52  * \brief - Set rate weight for egress rate measure.
     53  *
     54  * \param [in] unit - Unit-ID
     55  * \param [in] rate_weight - rate weight according to defines BCM_COSQ_RATE_WEIGHT_XXX
     56  *
     57  * \return
     58  *   See shr_error_e
     59  * \see
     60  *   * None
     61  */
     62 shr_error_e dnx_rate_measurement_weight_set(
     63     int unit,
     64     int rate_weight);
     65 
     66 /**
     67  * \brief - Get rate weight for egress rate measure.
     68  *
     69  * \param [in] unit - Unit-ID
     70  * \param [out] rate_weight - rate weight according to defines BCM_COSQ_RATE_WEIGHT_XXX
     71  *
     72  * \return
     73  *   See shr_error_e
     74  * \see
     75  *   * None
     76  */
     77 shr_error_e dnx_rate_measurement_weight_get(
     78     int unit,
     79     int *rate_weight);
     80 
     81 /**
     82  * \brief - update new port rate in egress rate measure mechanism.
     83  *
     84  * \param [in] unit - Unit-ID
     85  * \param [in] port - logical port
     86  *
     87  * \return
     88  *   See shr_error_e
     89  * \see
     90  *   * None
     91  */
     92 shr_error_e dnx_rate_measurement_port_rate_update_set(
     93     int unit,
     94     int port);
     95 
     96 /**
     97  * \brief - set packet compensation for egress rate mechanism
     98  *
     99  * \param [in] unit - Unit-ID
    100  * \param [in] core_id - core
    101  * \param [in] egq_if - egress if id
    102  * \param [in] compensation - compensation value
    103  *
    104  * \return
    105  *   See shr_error_e
    106  * \see
    107  *   * None
    108  */
    109 shr_error_e dnx_rate_measurement_compensation_set(
    110     int unit,
    111     bcm_core_t core_id,
    112     uint32 egq_if,
    113     int compensation);
    114 
    115 /**
    116  * \brief - Get packet compensation for egress rate mechanism
    117  *
    118  * \param [in] unit - Unit-ID
    119  * \param [in] core_id - core
    120  * \param [in] egq_if - egress if id
    121  * \param [out] compensation - compensation value
    122  *
    123  * \return
    124  *   See shr_error_e
    125  * \see
    126  *   * None
    127  */
    128 shr_error_e dnx_rate_measurement_compensation_get(
    129     int unit,
    130     bcm_core_t core_id,
    131     uint32 egq_if,
    132     int *compensation);
    133 
    134 /**
    135 * \brief -  Get rate counter per EGQ IF
    136 *
    137 * \param [in] unit - chip unit id
    138 * \param [in] core_id - core id
    139 * \param [in] egq_if - egq if
    140 * \param [out] rate - rate counter
    141 * \return
    142 *   shr_error_e
    143 * \see
    144 *   * None
    145 */
    146 shr_error_e dnx_rate_measurement_counter_get(
    147     uint32 unit,
    148     bcm_core_t core_id,
    149     uint32 egq_if,
    150     uint32 *rate);
    151 
    152 /*
    153  * Exposing internal declarations -
    154  * the following function is required in shell command "tm egress rate interface" implementation.
    155  * see sh_dnx_egr_interface_rate_cmd()
    156  * for information about these functions, see declaration in rate_measurement_dbal.h
    157  */
    158 extern shr_error_e dnx_rate_measurement_dbal_rate_promile_get(
    159     uint32 unit,
    160     bcm_core_t core_id,
    161     uint32 egq_if,
    162     uint32 *rate_promile,
    163     uint32 *granularity);
    164 
    165 #endif /* _DNX_RATE_MEASUREMENT_H_INCLUDED_ */