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

qos.h (25292B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * This file contains dnx QOS module definitions internal to the BCM library.
      8  */
      9 
     10 #ifndef BCM_DNX_SUPPORT
     11 #error "This file is for use by DNX (JR2) family only!"
     12 #endif
     13 
     14 #ifndef _QOS_H_INCLUDED__
     15 #define _QOS_H_INCLUDED__
     16 
     17 #include <bcm/qos.h>
     18 #include <bcm/port.h>
     19 #include <bcm_int/dnx/algo/algo_gpm.h>
     20 #include <soc/dnx/dbal/dbal_structures.h>
     21 
     22 /**
     23  *  qos map id
     24  */
     25 #define DNX_QOS_INVALID_MAP_ID              -1
     26 #define DNX_QOS_INITIAL_MAP_ID              0
     27 
     28 #define DNX_QOS_L3_MAX_PROFILE              15
     29 #define DNX_QOS_ING_LIF_MAX_PROFILE         255
     30 #define DNX_QOS_ING_AC_MAX_PROFILE          63
     31 #define DNX_QOS_EGR_AC_MAX_PROFILE          31
     32 
     33 #define DNX_QOS_ECN_BURN_OPCODE_NUM  4
     34 #define DNX_QOS_EXPLICIT_IDX_FLAG    1
     35 
     36 /*
     37  * The network qos pipe template data is constructed from network_qos_pipe, 
     38  * network_qos_pipe_mapped and dp_pipe_mapped fields. 
     39  * when calling dnx_qos_egress_network_qos_profile_update function if we 
     40  * want to keep the same value for a field we use this value.
     41  */
     42 #define DNX_QOS_NETWORK_QOS_PROFILE_KEEP_VALUE                          0x800
     43 
     44 /** 
     45  * \brief 
     46  * map id profile mask and shift definition 
     47  */
     48 #define DNX_QOS_MAP_PROFILE_MASK            0xffff
     49 #define DNX_QOS_MAP_PROFILE_SHIFT           0
     50 
     51 #define DNX_QOS_MAP_PROFILE_GET(map_id)       \
     52         (((map_id) >> DNX_QOS_MAP_PROFILE_SHIFT) & DNX_QOS_MAP_PROFILE_MASK)
     53 
     54 /** 
     55  * \brief 
     56  *  Ingress default QoS propagation profile(total 8).
     57  *  It defines a set of compare strength and propagation strength for PHB,REMARK,ECN,TTL. 
     58  *  profile "PIPE" means pipe model (compare strength = 1,propagation strength = 1) for all of them, as default profile
     59  *  profile "UNIFORM" means uniform model (compare strength = 0,propagation strength = 1) for all of them,
     60  *  profile "SHORT_PIPE" means short pipe model (compare strength = 1,propagation strength = 0) for all of them, 
     61  *  All the rest will be managed by user control
     62  */
     63 #define DNX_QOS_INGRESS_PROPAGATION_PROFILE_PIPE                (0)
     64 #define DNX_QOS_INGRESS_PROPAGATION_PROFILE_UNIFORM             (1)
     65 #define DNX_QOS_INGRESS_PROPAGATION_PROFILE_SHORT_PIPE          (2)
     66 #define DNX_QOS_INGRESS_DEFAULT_PROPAGATION_PROFILE    DNX_QOS_INGRESS_PROPAGATION_PROFILE_PIPE
     67 
     68 /**
     69  *\brief
     70  * ECN mapping profile, 
     71  * Only support two ecn mapping profile, default 0 that ecn is not eligible and 
     72  * profile 1 that ecn is eligible
     73  */
     74 #define DNX_QOS_ECN_MAPPING_PROFILE_DEFAULT    0
     75 #define DNX_QOS_ECN_MAPPING_PROFILE_ELIGIBLE   1
     76 
     77 /**
     78  * \brief  
     79  *    dp profile can be applied to ive for inner or outer tag.
     80  */
     81 typedef enum
     82 {
     83     QOS_DP_PROFILE_INNER,
     84     QOS_DP_PROFILE_OUTER
     85 } qos_dp_profile_application_type_e;
     86 
     87 /** 
     88  * bcm internal map flags for type encodig  
     89  */
     90 #define DNX_QOS_MAP_PHB       0x1
     91 #define DNX_QOS_MAP_REMARK    0x2
     92 #define DNX_QOS_MAP_ECN       0x4
     93 #define DNX_QOS_MAP_OPCODE    0x8
     94 #define DNX_QOS_MAP_POLICER   0x10
     95 #define DNX_QOS_MAP_VLAN_PCP  0x20
     96 #define DNX_QOS_MAP_MPLS_PHP  0x40
     97 #define DNX_QOS_MAP_INGRESS   0x1000
     98 #define DNX_QOS_MAP_EGRESS    0x2000
     99 #define DNX_QOS_MAP_OAM_PCP   0x4000
    100 #define DNX_QOS_MAP_ENCAP_COS 0x8000
    101 
    102 /** 
    103  * \brief 
    104  * mask & shift definition 
    105  */
    106 #define DNX_QOS_PRI_MASK         0x7
    107 #define DNX_QOS_PRI_OFFSET       1
    108 #define DNX_QOS_CFI_MASK         0x1
    109 #define DNX_QOS_TC_MASK          0x7
    110 #define DNX_QOS_TC_OFFSET        2
    111 #define DNX_QOS_DP_MASK          0x3
    112 #define DNX_QOS_DP_OFFSET        8
    113 #define DNX_QOS_TOS_MASK         0xFF
    114 #define DNX_QOS_EXP_MASK         0x7
    115 #define DNX_QOS_EXP_OFFSET       3
    116 #define DNX_QOS_ECN_MASK         0x3
    117 #define DNX_QOS_ECN_OFFSET       2
    118 #define DNX_QOS_PCP_DEI_MASK     0xF
    119 #define DNX_QOS_PCP_DEI_OFFSET   4
    120 #define DNX_QOS_EXPLICIT_IDX_OFFSET  10
    121 #define DNX_QOS_MAP_INDEX_MASK   0x3F
    122 /**exp offset in case two labels in single encap entry*/
    123 #define DNX_QOS_SECOND_EXP_OFFSET 0x3
    124 
    125 /**
    126  * explicit network qos index
    127  */
    128 
    129 #define DNX_QOS_IDX_PCP_DEI_TO_NWK_QOS(pcp, cfi) \
    130       ((((pcp << DNX_QOS_PRI_OFFSET) | cfi) << DNX_QOS_PCP_DEI_OFFSET) | \
    131        ((pcp << DNX_QOS_PRI_OFFSET) | cfi))
    132 #define DNX_QOS_IDX_NWK_QOS_PCP_GET(nwk_qos) (((nwk_qos) >> DNX_QOS_PRI_OFFSET) & DNX_QOS_PRI_MASK)
    133 #define DNX_QOS_IDX_NWK_QOS_CFI_GET(nwk_qos) ((nwk_qos) & DNX_QOS_CFI_MASK)
    134 
    135 #define DNX_QOS_EXPLICIT_IDX_L2(pcp, cfi) \
    136      ((DNX_QOS_EXPLICIT_IDX_FLAG << DNX_QOS_EXPLICIT_IDX_OFFSET) | \
    137       DNX_QOS_IDX_PCP_DEI_TO_NWK_QOS(pcp,cfi))
    138 #define DNX_QOS_EXPLICIT_IDX_PCP_GET(nwk_qos_idx) (((nwk_qos_idx) >> DNX_QOS_PRI_OFFSET) & DNX_QOS_PRI_MASK)
    139 #define DNX_QOS_EXPLICIT_IDX_CFI_GET(nwk_qos_idx) ((nwk_qos_idx) & DNX_QOS_CFI_MASK)
    140 
    141 #define DNX_QOS_IDX_EXP_TO_NWK_QOS(exp0, exp1) \
    142       ((exp1 << DNX_QOS_SECOND_EXP_OFFSET) | exp0)
    143 #define DNX_QOS_IDX_NWK_QOS_GET_EXP0(nwk_qos) ((nwk_qos) & DNX_QOS_EXP_MASK)
    144 #define DNX_QOS_IDX_NWK_QOS_GET_EXP1(nwk_qos) ((nwk_qos >> DNX_QOS_SECOND_EXP_OFFSET) & DNX_QOS_EXP_MASK)
    145 
    146 /** 
    147  * \brief
    148  * map type shift, map is 32 bits build of 16 bit map type and 
    149  * 16 bit profile this define indicate the map type shift in 
    150  * the 32 bit value 
    151  */
    152 #define DNX_QOS_MAP_TYPE_SHIFT              16
    153 
    154 #define DNX_QOS_MAP_IS_INGRESS(map_id)    \
    155   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_INGRESS)
    156 
    157 #define DNX_QOS_MAP_IS_EGRESS(map_id)    \
    158   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_EGRESS)
    159 
    160 #define DNX_QOS_MAP_IS_OPCODE(map_id)    \
    161   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_OPCODE)
    162 
    163 #define DNX_QOS_MAP_IS_PHB(map_id)    \
    164   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_PHB)
    165 
    166 #define DNX_QOS_MAP_IS_REMARK(map_id)    \
    167   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_REMARK)
    168 
    169 #define DNX_QOS_MAP_IS_MPLS_PHP(map_id)    \
    170   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_MPLS_PHP)
    171 
    172 #define DNX_QOS_MAP_IS_ECN(map_id)    \
    173   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_ECN)
    174 
    175 #define DNX_QOS_MAP_IS_POLICER(map_id)    \
    176   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_POLICER)
    177 
    178 #define DNX_QOS_MAP_IS_VLAN_PCP(map_id)    \
    179   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_VLAN_PCP)
    180 
    181 #define DNX_QOS_MAP_IS_OAM_PCP(map_id)    \
    182   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_OAM_PCP)
    183 
    184 #define DNX_QOS_MAP_IS_ENCAP_COS(map_id)    \
    185   (((map_id) >> DNX_QOS_MAP_TYPE_SHIFT) & DNX_QOS_MAP_ENCAP_COS)
    186 
    187 #define DNX_QOS_INGRESS_MAP_SET(map_id)   \
    188   (map_id) |= (((DNX_QOS_MAP_INGRESS) << DNX_QOS_MAP_TYPE_SHIFT))
    189 
    190 #define DNX_QOS_EGRESS_MAP_SET(map_id)    \
    191   (map_id) |= (((DNX_QOS_MAP_EGRESS) << DNX_QOS_MAP_TYPE_SHIFT))
    192 
    193 #define DNX_QOS_OPCODE_MAP_SET(map_id)    \
    194   (map_id) |= (((DNX_QOS_MAP_OPCODE) << DNX_QOS_MAP_TYPE_SHIFT))
    195 
    196 #define DNX_QOS_PHB_MAP_SET(map_id)       \
    197   (map_id) |= (((DNX_QOS_MAP_PHB) << DNX_QOS_MAP_TYPE_SHIFT))
    198 
    199 #define DNX_QOS_REMARK_MAP_SET(map_id)    \
    200   (map_id) |= (((DNX_QOS_MAP_REMARK) << DNX_QOS_MAP_TYPE_SHIFT))
    201 
    202 #define DNX_QOS_MPLS_PHP_MAP_SET(map_id)    \
    203   (map_id) |= (((DNX_QOS_MAP_MPLS_PHP) << DNX_QOS_MAP_TYPE_SHIFT))
    204 
    205 #define DNX_QOS_ECN_MAP_SET(map_id)       \
    206   (map_id) |= (((DNX_QOS_MAP_ECN) << DNX_QOS_MAP_TYPE_SHIFT))
    207 
    208 #define DNX_QOS_POLICER_MAP_SET(map_id)   \
    209   (map_id) |= (((DNX_QOS_MAP_POLICER) << DNX_QOS_MAP_TYPE_SHIFT))
    210 
    211 #define DNX_QOS_VLAN_PCP_MAP_SET(map_id)  \
    212   (map_id) |= (((DNX_QOS_MAP_VLAN_PCP) << DNX_QOS_MAP_TYPE_SHIFT))
    213 
    214 #define DNX_QOS_OAM_PCP_MAP_SET(map_id)  \
    215   (map_id) |= (((DNX_QOS_MAP_OAM_PCP) << DNX_QOS_MAP_TYPE_SHIFT))
    216 
    217 #define DNX_QOS_ENCAP_COS_SET(map_id)  \
    218   (map_id) |= (((DNX_QOS_MAP_ENCAP_COS) << DNX_QOS_MAP_TYPE_SHIFT))
    219 
    220 typedef enum
    221 {
    222     /** qos propagation type pipe  */
    223     DNX_QOS_PROPAGATION_TYPE_PIPE = 0,
    224     /** qos propagation type short pipe  */
    225     DNX_QOS_PROPAGATION_TYPE_SHORT_PIPE,
    226      /** qos propagation type uniform  */
    227     DNX_QOS_PROPAGATION_TYPE_UNIFORM,
    228     /** qos propagation type struck  */
    229     DNX_QOS_PROPAGATION_TYPE_STUCK,
    230     /** Number of enum valid values for QOS_PROPAG_TYPE
    231      * Must be last
    232      */
    233     DNX_QOS_PROPAGATION_TYPE_NOF
    234 } dnx_qos_propagation_type_e;
    235 
    236 /**
    237  * \brief 
    238  * Init for qos module. 
    239  * initialize DBAL_TABLE_QOS_PHB_CONTEXT_SELECTION table. 
    240  * \par DIRECT INPUT
    241  *    \param [in] unit - Relevant unit.
    242  * \par INDIRECT INPUT: 
    243  *    None. 
    244  * \par DIRECT OUTPUT:
    245  *   \retval Negative in case of an error. 
    246  *   \retval Zero in case of NO ERROR
    247  * \par INDIRECT OUTPUT:
    248  *   * Write to QOS Hardware.
    249  *   * phbTcDpContextSelectionCam.
    250  *   * phbTcDpContextActionMem.
    251  */
    252 shr_error_e dnx_qos_init(
    253     int unit);
    254 
    255 /**
    256  * \brief 
    257  * map color to hw value DP
    258  * \param [in] unit - Relevant unit.
    259  * \param [in] color - color
    260  * \param [out] dp - hardware dp
    261  * \return
    262  *     \retval Negative in case of an error. 
    263  *     \retval Zero in case of NO ERROR
    264  */
    265 int dnx_qos_color_encode(
    266     int unit,
    267     bcm_color_t color,
    268     int *dp);
    269 
    270 /**
    271  * \brief 
    272  * map hw value DP to color
    273  * \param [in] unit - Relevant unit.
    274  * \param [in] dp - hardware dp
    275  * \param [out] color - color
    276  * \return
    277  *     \retval Negative in case of an error. 
    278  *     \retval Zero in case of NO ERROR
    279  */
    280 
    281 int dnx_qos_color_decode(
    282     int unit,
    283     int dp,
    284     bcm_color_t * color);
    285 
    286 /**
    287  * \brief 
    288  * convert ingress qos model to propagation type.
    289  * \param [in] unit - Relevant unit.
    290  * \param [in] qos_propag_model - ingress propagation model
    291  * \param [out] qos_propag_type - propagation type for PHB/REMARK/TTL
    292  * \return
    293  *     \retval Negative in case of an error. 
    294  *     \retval Zero in case of NO ERROR
    295  */
    296 shr_error_e dnx_qos_ingress_qos_model_to_propag_type(
    297     int unit,
    298     bcm_qos_ingress_model_type_t qos_propag_model,
    299     dnx_qos_propagation_type_e * qos_propag_type);
    300 
    301 /**
    302  * \brief 
    303  * convert propagation type to ingress qos model. 
    304  * \param [in] unit - Relevant unit.
    305  * \param [in] qos_propag_type - propagation type for PHB/REMARK/TTL
    306  * \param [out] qos_propag_model - ingress propagation model
    307  * \return
    308  *     \retval Negative in case of an error. 
    309  *     \retval Zero in case of NO ERROR
    310  */
    311 shr_error_e dnx_qos_ingress_propag_type_to_qos_model(
    312     int unit,
    313     dnx_qos_propagation_type_e qos_propag_type,
    314     bcm_qos_ingress_model_type_t * qos_propag_model);
    315 
    316 /**
    317  * \brief 
    318  * convert egress qos model type to model. 
    319  * \param [in] unit - Relevant unit.
    320  * \param [in] qos_model - bcm egress qos model 
    321  * \param [out] dbal_qos_model - egress qos model in dbal
    322  * \return
    323  *     \retval Negative in case of an error. 
    324  *     \retval Zero in case of NO ERROR
    325  */
    326 shr_error_e dnx_qos_egress_model_bcm_to_dbal(
    327     int unit,
    328     bcm_qos_egress_model_t * qos_model,
    329     dbal_enum_value_field_encap_qos_model_e * dbal_qos_model);
    330 
    331 /**
    332  * \brief 
    333  * convert egress qos model to model type. 
    334  * \param [in] unit - Relevant unit.
    335  * \param [in] dbal_qos_model - egress qos model in dbal
    336  * \param [out] qos_model - bcm egress qos model
    337  * \return
    338  *     \retval Negative in case of an error. 
    339  *     \retval Zero in case of NO ERROR
    340  */
    341 shr_error_e dnx_qos_egress_model_dbal_to_bcm(
    342     int unit,
    343     dbal_enum_value_field_encap_qos_model_e dbal_qos_model,
    344     bcm_qos_egress_model_t * qos_model);
    345 
    346 /**
    347  * \brief
    348  * Write to HW the TTL-value mapped by TTL-PIPE-PROFILE.
    349  * Used by BCM APIs of IPv4 and IPv6 IP-Tunnels.
    350  * \param [in] unit - Relevant unit.
    351  * \param [in] ttl_pipe_profile - template managed TTL PIPE profile index.
    352  * \param [in] ttl_value - TTL PIPE value.
    353  * \return
    354  *   \retval Negative in case of an error.
    355  *   \retval Zero in case of NO ERROR
    356  * \remark
    357  *   * Write to TTL Hardware: DBAL_TABLE_EGRESS_QOS_TTL_PIPE_MAPPING.
    358  */
    359 shr_error_e dnx_qos_egress_ttl_profile_hw_set(
    360     int unit,
    361     uint32 ttl_pipe_profile,
    362     uint32 ttl_value);
    363 
    364 /**
    365  * \brief
    366  * Clear HW entry of TTL-value mapped by TTL-PIPE-PROFILE. Used
    367  * by BCM APIs of IPv4 and IPv6 IP-Tunnels. 
    368  * \param [in] unit - Relevant unit.
    369  * \param [in] ttl_pipe_profile - template managed TTL PIPE profile index. 
    370  * \return
    371  *   \retval Negative in case of an error.
    372  *   \retval Zero in case of NO ERROR
    373  * \remark
    374  *   * Write to TTL Hardware: DBAL_TABLE_EGRESS_QOS_TTL_PIPE_MAPPING.
    375  */
    376 shr_error_e dnx_qos_egress_ttl_profile_hw_clear(
    377     int unit,
    378     uint32 ttl_pipe_profile);
    379 
    380 /**
    381  * \brief 
    382  * get qos propagation profile attributes for requested 
    383  * propagation profile ID.
    384  *  
    385  *    \param [in] unit - Relevant unit. 
    386  *    \param [in] propagation_profile - Relevant
    387  *           propagation_profile.
    388  *    \param [in] phb_propagation_type - PHB app propagation
    389  *           type PIPE/UNIFORM/STUCK/STUCK STRONG
    390  *    \param [in] remark_propagation_type - PHB app propagation
    391  *           type PIPE/UNIFORM/STUCK/STUCK STRONG
    392  *    \param [in] ecn_propagation_type - PHB app propagation
    393  *           type PIPE/UNIFORM/STUCK/STUCK STRONG
    394  *    \param [in] ttl_propagation_type - PHB app propagation
    395  *           type PIPE/UNIFORM/STUCK/STUCK STRONG
    396  *    
    397  * \return
    398  *    \retval Negative in case of an error
    399  *    \retval Zero in case of NO ERROR 
    400  */
    401 shr_error_e dnx_qos_ingress_propagation_profile_attr_get(
    402     int unit,
    403     int propagation_profile,
    404     dnx_qos_propagation_type_e * phb_propagation_type,
    405     dnx_qos_propagation_type_e * remark_propagation_type,
    406     dnx_qos_propagation_type_e * ecn_propagation_type,
    407     dnx_qos_propagation_type_e * ttl_propagation_type);
    408 
    409 /**
    410  * \brief -
    411  *  Allocate a propagation profile with the given PHB/REMARK/ECN/TTL propagation
    412  *  parameters by exchanging.
    413  *
    414  * \param [in] unit - the relevant unit.
    415  * \param [in] phb_propagation_type - PHB propagation type.
    416  * \param [in] remark_propagation_type - REMARK propagation type.
    417  * \param [in] ecn_propagation_type - ECN propagation type.
    418  * \param [in] ttl_propagation_type - TTL propagation type.
    419  * \param [in] old_propagation_profile - The original propagation profile.
    420  * \param [out] new_propagation_profile - pointer to new propagation profile.
    421  * \param [out] is_first - pointer to indicator whether the propagation profile
    422  *              is first used or not.
    423  * \param [out] is_last - pointer to indicator whether the propagation profile
    424  *              is no longer used or not.
    425  *
    426  * \return
    427  *  shr_error_e
    428  *
    429  * \remark
    430  *  If the given propagation profile is in use, do the exchange based on it
    431  *  and the inputs. Otherwise do the exchange based on the inputs only.
    432  *  In case the current propagation profile support the requested type it will
    433  *  remain unchanged except for the reference counter, otherwise a new qos
    434  *  propagation profile is allocated.
    435  *
    436  * \see
    437  *  None
    438  */
    439 shr_error_e dnx_qos_ingress_propagation_profile_alloc(
    440     int unit,
    441     dnx_qos_propagation_type_e phb_propagation_type,
    442     dnx_qos_propagation_type_e remark_propagation_type,
    443     dnx_qos_propagation_type_e ecn_propagation_type,
    444     dnx_qos_propagation_type_e ttl_propagation_type,
    445     int old_propagation_profile,
    446     int *new_propagation_profile,
    447     uint8 *is_first,
    448     uint8 *is_last);
    449 
    450 /**
    451  * \brief -
    452  *  Set the propagation profile attributes to Hardware.
    453  *
    454  * \param [in] unit - the relevant unit.
    455  * \param [in] propagation_profile - The given propagation profile.
    456  * \param [in] phb_propagation_type - PHB propagation type.
    457  * \param [in] remark_propagation_type - REMARK propagation type.
    458  * \param [in] ecn_propagation_type - ECN propagation type.
    459  * \param [in] ttl_propagation_type - TTL propagation type. 
    460  *
    461  * \return
    462  *  shr_error_e
    463  *
    464  * \remark
    465  *  The attributes for the given application types is pairs of compare strength
    466  *  and propagation strength which are predefined.
    467  *
    468  * \see
    469  *  None
    470  */
    471 shr_error_e dnx_qos_ingress_propagation_profile_hw_set(
    472     int unit,
    473     int propagation_profile,
    474     dnx_qos_propagation_type_e phb_propagation_type,
    475     dnx_qos_propagation_type_e remark_propagation_type,
    476     dnx_qos_propagation_type_e ecn_propagation_type,
    477     dnx_qos_propagation_type_e ttl_propagation_type);
    478 
    479 /**
    480  * \brief 
    481  * free qos propagation profile reference according to the 
    482  * requested propagation type of PHB/REMARK/ECN/TTL combination.
    483  * the reference counter decrement (this is done using the 
    484  * template manager).
    485  * If it is the last reference, clear the hardware table.
    486  *  
    487  *    \param [in] unit - Relevant unit.
    488  *    \param [in] propagation_profile - Relevant
    489  *           propagation_profile.
    490  *    \param [out] last_reference - is this the profile last
    491  *           reference
    492  * \return
    493  *    \retval Negative in case of an error
    494  *    \retval Zero in case of NO ERROR  
    495  */
    496 shr_error_e dnx_qos_ingress_propagation_profile_free_and_hw_clear(
    497     int unit,
    498     int propagation_profile,
    499     uint8 *last_reference);
    500 
    501 /**
    502  * \brief
    503  *  Clear propagation profile attributes for a specific ingress 
    504  *  propagation profile.
    505  *
    506  * \param [in] unit - the relevant unit.
    507  * \param [in] propagation_profile - The given propagation profile.
    508  *
    509  * \return
    510  *  shr_error_e
    511  *
    512  * \remark
    513  *
    514  * \see
    515  *  None
    516  */
    517 shr_error_e dnx_qos_ingress_propagation_profile_hw_clear(
    518     int unit,
    519     int propagation_profile);
    520 
    521 /**
    522  * \brief -
    523  *  Set ingress qos model for various qos application at the port.
    524  *
    525  * \param [in] unit - the relevant unit.
    526  * \param [in] port - Device or logical port number.
    527  * \param [in] type - Port feature enumerator (for qos application type), 
    528  *                    see /bcm_port_control_t
    529  * \param [in] value - qos model
    530  *
    531  * \return
    532  *   bcm_error_t
    533  */
    534 shr_error_e dnx_qos_ingress_port_model_set(
    535     int unit,
    536     bcm_port_t port,
    537     bcm_port_control_t type,
    538     int value);
    539 
    540 /**
    541  * \brief -
    542  *  Get ingress qos model for various qos application at the port.
    543  *
    544  * \param [in] unit - the relevant unit.
    545  * \param [in] port - Device or logical port number.
    546  * \param [in] type - Port feature enumerator (for qos application type), 
    547  *                    see /bcm_port_control_t
    548  * \param [in] *value - Value of ingress qos model
    549  *
    550  * \return
    551  *     \retval Negative in case of an error. 
    552  *     \retval Zero in case of NO ERROR
    553  */
    554 shr_error_e dnx_qos_ingress_port_model_get(
    555     int unit,
    556     bcm_port_t port,
    557     bcm_port_control_t type,
    558     int *value);
    559 
    560 /**
    561  * \brief 
    562  * set network_qos profile attributes in hw. 
    563  *  
    564  *    \param [in] unit - Relevant unit.
    565  *    \param [in] network_qos_pipe_profile - Relevant network
    566  *           qos pipe profile.
    567  *    \param [in] network_qos_pipe - current layer network_qos
    568  *           value
    569  *    \param [in] network_qos_pipe_mapped - next layer
    570  *           network_qos value
    571  *    \param [in] dp_pipe_mapped - next layer dp value
    572  * 
    573  * \return
    574  *    \retval Negative in case of an error
    575  *    \retval Zero in case of NO ERROR   
    576  */
    577 shr_error_e dnx_qos_egress_network_qos_pipe_profile_set(
    578     int unit,
    579     uint8 network_qos_pipe_profile,
    580     uint32 network_qos_pipe,
    581     uint32 network_qos_pipe_mapped,
    582     uint32 dp_pipe_mapped);
    583 
    584 /**
    585  * \brief 
    586  * allocate qos egress network_qos profile for update 
    587  * outlif.NWK_QOS_IDX, the profile is allocated according to the
    588  * requested network_qos value for current and next layer and 
    589  * the next layer DP value. In case this is the first time this
    590  * network_qos value is requested a new profile is allocated and 
    591  * the hw is set accordingly with the propare value. In case 
    592  * this network_qos value already exist the profile is returned 
    593  * and the reference counter increment (this is done using the 
    594  * template manager). 
    595  *  
    596  *    \param [in] unit - Relevant unit. 
    597  *    \param [in] network_qos_pipe - current layer network_qos
    598  *           value
    599  *    \param [in] network_qos_pipe_mapped - next layer
    600  *           network_qos value
    601  *    \param [in] dp_pipe_mapped - next layer dp value
    602  *    \param [out] network_qos_pipe_profile -
    603  *           Relevant network_qos_pipe_profile.
    604  *    \param [out] first_reference - indicate if
    605  *         the allocated propagation_profile is the first
    606  *         reference.
    607  * \return
    608  *    \retval Negative in case of an error
    609  *    \retval Zero in case of NO ERROR   
    610  */
    611 shr_error_e dnx_qos_egress_network_qos_pipe_profile_allocate(
    612     int unit,
    613     uint8 network_qos_pipe,
    614     uint8 network_qos_pipe_mapped,
    615     uint8 dp_pipe_mapped,
    616     int *network_qos_pipe_profile,
    617     uint8 *first_reference);
    618 
    619 /**
    620  * \brief 
    621  * get qos network_qos profile attributes for requested 
    622  * network_qos profile ID. 
    623  *  
    624  *    \param [in] unit - Relevant unit.
    625  *    \param [in] network_qos_pipe_profile - Relevant
    626  *           network_qos_pipe_profile.
    627  *    \param [out] network_qos_pipe - current layer network_qos
    628  *           value
    629  *    \param [out] network_qos_pipe_mapped - next layer
    630  *           network_qos value
    631  *    \param [out] dp_pipe_mapped - next layer dp value
    632  *    
    633  * \return
    634  *    \retval Negative in case of an error
    635  *    \retval Zero in case of NO ERROR
    636  */
    637 shr_error_e dnx_qos_egress_network_qos_pipe_profile_attr_get(
    638     int unit,
    639     int network_qos_pipe_profile,
    640     uint8 *network_qos_pipe,
    641     uint8 *network_qos_pipe_mapped,
    642     uint8 *dp_pipe_mapped);
    643 
    644 /**
    645  * \brief 
    646  * update existing profile with new network_qos value. In case 
    647  * the current network_qos profile support the requested 
    648  * network_qos value it will remain unchanged, otherwise a new 
    649  * qos network_qos profile is allocated. 
    650  *    
    651  *    \param [in] unit - Relevant unit. 
    652  *    \param [in] network_qos_pipe - current layer network_qos
    653  *           value
    654  *    \param [in] network_qos_pipe_mapped - next layer
    655  *           network_qos value
    656  *    \param [in] dp_pipe_mapped - next layer dp value
    657  *    \param [out] network_qos_pipe_profile - Relevant
    658  *           network_qos_pipe_profile.
    659  *    \param [out] first_reference - indicate if
    660  *         the new propagation_profile is the first reference.
    661  *    \param [out] last_reference - indicate if
    662  *         the old propagation_profile is the last reference. 
    663  * \return
    664  *    \retval Negative in case of an error
    665  *    \retval Zero in case of NO ERROR  
    666  */
    667 shr_error_e dnx_qos_egress_network_qos_pipe_profile_update(
    668     int unit,
    669     uint16 network_qos_pipe,
    670     uint16 network_qos_pipe_mapped,
    671     uint16 dp_pipe_mapped,
    672     int *network_qos_pipe_profile,
    673     uint8 *first_reference,
    674     uint8 *last_reference);
    675 
    676 /**
    677  * \brief 
    678  * get qos egress network_qos profile with requested network_qos value
    679  * it will be nwk_qos_idx of OUTLIFs
    680  *  
    681  *    \param [in] unit - Relevant unit. 
    682  *    \param [in] network_qos_pipe - current layer network_qos
    683  *           value
    684  *    \param [in] network_qos_pipe_mapped - next layer
    685  *           network_qos value
    686  *    \param [in] dp_pipe_mapped - next layer dp value
    687  *    \param [out] network_qos_pipe_profile -
    688  *           Relevant network_qos_pipe_profile.
    689  * \return
    690  *    \retval Negative in case of an error
    691  *    \retval Zero in case of NO ERROR   
    692  */
    693 shr_error_e dnx_qos_egress_network_qos_pipe_profile_get(
    694     int unit,
    695     uint8 network_qos_pipe,
    696     uint8 network_qos_pipe_mapped,
    697     uint8 dp_pipe_mapped,
    698     int *network_qos_pipe_profile);
    699 
    700 /**
    701  * \brief 
    702  * free qos egress network_qos pipe profile reference. the 
    703  * reference counter decrement (this is done using the template 
    704  * manager). if it is the last reference, it is required to 
    705  * clear the HW by using the new API
    706  *  
    707  *    \param [in] unit - Relevant unit.
    708  *    \param [in] network_qos_pipe_profile - Relevant
    709  *           network_qos_pipe_profile.
    710  *    \param [out] last_reference - indicate if
    711  *         the propagation_profile is the last reference.
    712  * \return
    713  *    \retval Negative in case of an error
    714  *    \retval Zero in case of NO ERROR  
    715  
    716  */
    717 shr_error_e dnx_qos_egress_network_qos_pipe_profile_free(
    718     int unit,
    719     int network_qos_pipe_profile,
    720     uint8 *last_reference);
    721 
    722 /**
    723  * \brief
    724  * Clear HW entry of qos pipe attribute by qos pipe profile. Used
    725  * by BCM APIs of MPLS, IPv4 and IPv6 IP-Tunnels. 
    726  * \param [in] unit - Relevant unit.
    727  * \param [in] network_qos_pipe_profile - Relevant
    728  *           network_qos_pipe_profile. 
    729  * \return
    730  *   \retval Negative in case of an error.
    731  *   \retval Zero in case of NO ERROR
    732  * \remark
    733  *   * Write to TTL Hardware: DBAL_TABLE_QOS_EGRESS_NETWORK_QOS_PIPE_PROFILE_TABLE.
    734  */
    735 shr_error_e dnx_qos_egress_network_qos_pipe_profile_hw_clear(
    736     int unit,
    737     uint8 network_qos_pipe_profile);
    738 
    739 /**
    740  * \brief
    741  *  Get qos map context per bcm flags.
    742  *
    743  * \param [in] unit - Relevant unit.
    744  * \param [in] flags - qos map flags, BCM_QOS_MAP_*
    745  * \param [out] map_index - qos map index, see dbal_enum_value_field_ingress_qos_map_index_e.
    746  *
    747  * \return
    748  *   \retval Negative in case of an error.
    749  *   \retval Zero in case of NO ERROR
    750  *
    751  * \remark
    752  *   None.
    753  */
    754 shr_error_e dnx_qos_ingress_map_index_get(
    755     int unit,
    756     uint32 flags,
    757     dbal_enum_value_field_ingress_qos_map_index_e * map_index);
    758 
    759 /**
    760  * \brief
    761  *  Get qos map context profile.
    762  *
    763  * \param [in] unit - Relevant unit.
    764  * \param [in] table_id - qos table mapping from profile to cs profile
    765  * \param [in] profile - qos profile
    766  * \param [out] cs_profile - qos context profile.
    767  *
    768  * \return
    769  *   \retval Negative in case of an error.
    770  *   \retval Zero in case of NO ERROR
    771  *
    772  * \remark
    773  *   None.
    774  */
    775 
    776 shr_error_e dnx_qos_ingress_cs_profile_map_get(
    777     int unit,
    778     int table_id,
    779     int profile,
    780     uint32 *cs_profile);
    781 
    782 #endif /* _QOS_H_INCLUDED__ */