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

cosq.h (4946B)


      1 /** \file bcm_int/dnx/cosq/cosq.h
      2  * 
      3  */
      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 _DNX_COSQ_INCLUDED__
     12 #define _DNX_COSQ_INCLUDED__
     13 
     14 #ifndef BCM_DNX_SUPPORT
     15 #error "This file is for use by DNX family only!"
     16 #endif
     17 
     18 #include <shared/shrextend/shrextend_error.h>
     19 #include <bcm/cosq.h>
     20 /*
     21  * Defines:
     22  * {
     23  */
     24 
     25 #define DNX_COSQ_NOF_TC (8)
     26 #define DNX_COSQ_NOF_DP (4)
     27 
     28 #define DNX_COSQ_MIN_COS (4)
     29 #define DNX_COSQ_MAX_COS (8)
     30 
     31 #define DNX_COSQ_RESERVED_FLOW_START (0)
     32 #define DNX_COSQ_RESERVED_FLOW_NOF (16)
     33 /*
     34  * } 
     35  */
     36 /*
     37  * Typedefs:
     38  * {
     39  */
     40 
     41 typedef enum
     42 {
     43     DNX_COSQ_THRESHOLD_INDEX_INVALID = -1,
     44     DNX_COSQ_THRESHOLD_INDEX_DP,
     45     DNX_COSQ_THRESHOLD_INDEX_TC,
     46     DNX_COSQ_THRESHOLD_INDEX_POOL_DP,
     47     DNX_COSQ_THRESHOLD_INDEX_CAST_PRIO_FDWACT,
     48     DNX_COSQ_THRESHOLD_INDEX_PRIO,
     49     DNX_COSQ_THRESHOLD_INDEX_POOL_PRIO
     50 } dnx_cosq_threshold_index_type_t;
     51 
     52 typedef struct
     53 {
     54     int dp;
     55     int tc;
     56     int pool_id;
     57     bcm_cast_t cast;
     58     bcm_cosq_ingress_forward_priority_t priority;
     59     bcm_cosq_forward_decision_type_t fwd_action;
     60 } dnx_cosq_threshold_index_info_t;
     61 
     62 typedef struct
     63 {
     64     /*
     65      *  Passing this threshold from above means activation.
     66      */
     67     uint32 set;
     68     /*
     69      *  Passing this threshold from below means deactivation.
     70      */
     71     uint32 clear;
     72 } dnx_cosq_hyst_threshold_t;
     73 
     74 typedef struct
     75 {
     76     /**
     77      * Maximum FADT threshold
     78      */
     79     uint32 max_threshold;
     80     /**
     81      * Minimum FADT threshold
     82      */
     83     uint32 min_threshold;
     84     /**
     85      * If AdjustFactor3 is set,  
     86      *    Dynamic-Max-Th = Free-Resource << AdjustFactor2:0 
     87      * Otherwise, 
     88      *    Dynamic-Max-Th = Free-Resource >> AdjustFactor2:0
     89      */
     90     int alpha;
     91 } dnx_cosq_fadt_threshold_t;
     92 
     93 typedef struct
     94 {
     95     /**
     96      *  Passing this threshold from above means activation.
     97      *  The threshold is dynamic (FADT).
     98      */
     99     dnx_cosq_fadt_threshold_t set;
    100     /**
    101      *  Passing this threshold from below means deactivation.
    102      *  The threshold is an offset below the FADT set threshold.
    103      */
    104     uint32 clear_offset;
    105 } dnx_cosq_fadt_hyst_threshold_t;
    106 
    107  /*
    108   * } 
    109   */
    110 /*
    111  * Functions
    112  * {
    113  */
    114 
    115 /**
    116  * \brief - internal function for setting static (non FADT) threshold,
    117  *          this function supports all available thresh_info->index types, unlike the BCM API
    118  *
    119  * \par DIRECT_INPUT:
    120  *   \param [in] unit -  Unit-ID
    121  *   \param [in] flags - additional flags. currently not in use
    122  *   \param [in] thresh_info - complementary information describing the threshold to be set
    123  *   \param [in] threshold - threshold value
    124  * \par DIRECT OUTPUT:
    125  *   shr_error_e
    126  * \remark
    127  *   * None
    128  * \see
    129  *   * None
    130  */
    131 int dnx_cosq_gport_static_threshold_internal_set(
    132     int unit,
    133     uint32 flags,
    134     bcm_cosq_static_threshold_info_t * thresh_info,
    135     bcm_cosq_static_threshold_t * threshold);
    136 
    137 /**
    138  * \brief - internal function getting static (non FADT) threshold
    139  *          this function supports all available thresh_info->index types, unlike the BCM API
    140  *
    141  * \par DIRECT_INPUT:
    142  *   \param [in] unit -  Unit-ID
    143  *   \param [in] flags - additional flags. currently not in use
    144  *   \param [in] thresh_info - complementary information describing the threshold to be get
    145  *   \param [in] threshold - obtained threshold value
    146  * \par DIRECT OUTPUT:
    147  *   shr_error_e
    148  * \remark
    149  *   * None
    150  * \see
    151  *   * None
    152  */
    153 int dnx_cosq_gport_static_threshold_internal_get(
    154     int unit,
    155     uint32 flags,
    156     bcm_cosq_static_threshold_info_t * thresh_info,
    157     bcm_cosq_static_threshold_t * threshold);
    158 
    159 /*
    160  * }
    161  */
    162 
    163 /**
    164  * \brief - get the queue id and core from gport type queue
    165  * \param [in] unit - unit
    166  * \param [in] gport_queue -  gport to retrieve the information for
    167  * \param [in] cosq - offset of the queue group
    168  * \param [in] force_core_all - indicate if to verify that the core is BCM_CORE_ALL
    169  * \param [out] core - core the queue belong
    170  * \param [out] queue_id - queue id
    171  * \return
    172  *    shr_error_e
    173  * \remark
    174  *   None
    175  * \see
    176  *   NONE
    177  */
    178 shr_error_e dnx_cosq_gport_to_voq_get(
    179     int unit,
    180     bcm_gport_t gport_queue,
    181     bcm_cos_queue_t cosq,
    182     int force_core_all,
    183     bcm_core_t * core,
    184     int *queue_id);
    185 
    186 /**
    187  * \brief -
    188  * verify gport and cosq for rate class threshold APIs
    189  *
    190  * \param [in] unit - unit index
    191  * \param [in] gport - gport to verify. BCM_GPORT_IS_PROFILE for rate class profile. if is_vsq_allowed is set BCM_COSQ_GPORT_IS_VSQ is also accepted.
    192  * \param [in] cosq - cosq to verify. expected 0 or -1
    193  * \param [in] is_vsq_allowed - indication whether to allow VSQ Gport as well.
    194  *
    195  * \return
    196  *   shr_error_e
    197  *
    198  * \remark
    199  *   *
    200  * \see
    201  *   * None
    202  */
    203 int dnx_cosq_rate_class_gport_verify(
    204     int unit,
    205     bcm_gport_t gport,
    206     bcm_cos_queue_t cosq,
    207     int is_vsq_allowed);
    208 
    209 #endif /* COSQ_H_INCLUDED */