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

system_red.h (4751B)


      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  * system_red.h
      8  *
      9  *  Created on: Sep 13, 2018
     10  *      Author: si888124
     11  */
     12 
     13 #ifndef _DNX_SYSTEM_RED_H_INCLUDED_
     14 /*
     15  * {
     16  */
     17 #define _DNX_SYSTEM_RED_H_INCLUDED_
     18 
     19 #ifndef BCM_DNX_SUPPORT
     20 #error "This file is for use by DNX (JR2) family only!"
     21 #endif
     22 
     23 #include <bcm_int/dnx/cosq/cosq.h>
     24 
     25 typedef enum
     26 {
     27     DNX_SYSTEM_RED_RESOURCE_INVALID = -1,
     28     DNX_SYSTEM_RED_RESOURCE_SRAM_PDBS = 0,
     29     DNX_SYSTEM_RED_RESOURCE_SRAM_BUFFERS,
     30     DNX_SYSTEM_RED_RESOURCE_DRAM_BDBS,
     31     DNX_SYSTEM_RED_RESOURCE_NOF
     32 } dnx_system_red_resource_type_e;
     33 
     34 /**
     35  * \brief - Set system RED aging params in both Ingress and Sch
     36  *
     37  * \param [in] unit - The unit number.
     38  * \param [in] discard - aging params:
     39  *          - flags -   BCM_FABRIC_CONFIG_DISCARD_XXX flags
     40  *          - enable -  Enable Aging period functionality in SCH
     41  *          - age - aging period in milliseconds (for both sch and ingress).
     42  *          - age_mode - action to perform when aging period expires (in Sch). options: reset / decrement.
     43  * \return
     44  *   \retval Zero if no error was detected
     45  *   \retval Negative if error was detected. See \ref shr_error_e
     46  * \remark
     47  *   * None
     48  * \see
     49  *   * None
     50  */
     51 shr_error_e dnx_system_red_aging_config_set(
     52     int unit,
     53     bcm_fabric_config_discard_t * discard);
     54 
     55 /**
     56  * \brief - Get system RED aging params
     57  *
     58  * \param [in] unit - The unit number.
     59  * \param [in] discard - aging params: see dnx_system_red_aging_config_set
     60  *
     61  * \return
     62  *   \retval Zero if no error was detected
     63  *   \retval Negative if error was detected. See \ref shr_error_e
     64  * \remark
     65  *   * None
     66  * \see
     67  *   * None
     68  */
     69 shr_error_e dnx_system_red_aging_config_get(
     70     int unit,
     71     bcm_fabric_config_discard_t * discard);
     72 
     73 /**
     74  * \brief - Get system RED status per system port
     75  *
     76  * \param [in] unit - The unit number.
     77  * \param [in] system_port - system port
     78  * \param [out] red_index - max_red_index for the system port
     79  *
     80  * \return
     81  *   \retval Zero if no error was detected
     82  *   \retval Negative if error was detected. See \ref shr_error_e
     83  * \remark
     84  *   * None
     85  * \see
     86  *   * None
     87  */
     88 shr_error_e dnx_system_red_sysport_red_status_get(
     89     int unit,
     90     uint32 system_port,
     91     uint32 *red_index);
     92 
     93 /**
     94  * \brief - Get system RED global status (max and current)
     95  *
     96  * \param [in] unit - The unit number.
     97  * \param [out] current_red_index - current RED index on the device
     98  * \param [out] max_red_index - max_red_index seen since last read
     99  *
    100  * \return
    101  *   \retval Zero if no error was detected
    102  *   \retval Negative if error was detected. See \ref shr_error_e
    103  * \remark
    104  *   * None
    105  * \see
    106  *   * None
    107  */
    108 shr_error_e dnx_system_red_global_red_status_get(
    109     int unit,
    110     uint32 *current_red_index,
    111     uint32 *max_red_index);
    112 
    113 /**
    114  * \brief - Set free resource thresholds and map resource range to system RED index (RED-Q-Size)
    115  *
    116  * \param [in] unit - The unit number.
    117  * \param [in] gport - irrelevant. must be set to 0.
    118  * \param [in] cosq - irrelevant. must be set to 0.
    119  * \param [in,out] threshold - threshold info. relevant fields:
    120  *          - flags - range flags BCM_COSQ_THRESHOLD_RANGE_0/1/2/3
    121  *          - type  - resource_type
    122  *          - dp    - red-q-size to map to thr relevant range
    123  *          - value - range threshold value (will be ignored for RANGE_3, since its max value is max_res)
    124  * \return
    125  *   \retval Zero if no error was detected
    126  *   \retval Negative if error was detected. See \ref shr_error_e
    127  * \remark
    128  *   * None
    129  * \see
    130  *   * None
    131  */
    132 shr_error_e dnx_system_red_free_res_threshold_set(
    133     int unit,
    134     bcm_gport_t gport,
    135     bcm_cos_queue_t cosq,
    136     bcm_cosq_threshold_t * threshold);
    137 
    138 /**
    139  * \brief - Get free resource thresholds and mapping of resource range to system RED index (RED-Q-Size)
    140  *
    141  * \param [in] unit - The unit number.
    142  * \param [in] gport - irrelevant. must be set to 0.
    143  * \param [in] cosq - irrelevant. must be set to 0.
    144  * \param [in,out] threshold - threshold info. relevant fields:
    145  *          - flags (input) - range flags BCM_COSQ_THRESHOLD_RANGE_0/1/2/3
    146  *          - type  (input) - resource_type
    147  *          - dp    (output) - red-q-size mapped to thr relevant range
    148  *          - value (output) - range threshold value
    149  * \return
    150  *   \retval Zero if no error was detected
    151  *   \retval Negative if error was detected. See \ref shr_error_e
    152  * \remark
    153  *   * None
    154  * \see
    155  *   * None
    156  */
    157 shr_error_e dnx_system_red_free_res_threshold_get(
    158     int unit,
    159     bcm_gport_t gport,
    160     bcm_cos_queue_t cosq,
    161     bcm_cosq_threshold_t * threshold);
    162 
    163 #endif /* _DNX_SYSTEM_RED_H_INCLUDED_ */