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

field_int.h (65567B)


      1 /*! \file field_int.h
      2  *
      3  * Field internal management header file.
      4  * This file contains the management for FIELD module.
      5  */
      6 /*
      7  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      8  * 
      9  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
     10  */
     11 
     12 #ifndef BCMINT_LTSW_FIELD_INT_H
     13 #define BCMINT_LTSW_FIELD_INT_H
     14 
     15 #include <bcm/field.h>
     16 #include <bcm_int/ltsw/field.h>
     17 #include <bcm_int/ltsw/field_ha_int.h>
     18 #include <bcm_int/ltsw/profile_mgmt.h>
     19 #include <bcm_int/ltsw/lt_intf.h>
     20 #include <sal/sal_mutex.h>
     21 
     22 /******************************************************************************
     23  * Defines
     24  */
     25 
     26 /* ! Group Info Max value for all array fields */
     27 #define BCMINT_INFO_MAX (16)
     28 
     29 /* ! Invalid field ID */
     30 #define BCMINT_FIELD_ID_INVALID  (-1)
     31 
     32 /* ! MAX EFP KEY combinations */
     33 #define BCMINT_FIELD_EFP_KEYS  (14)
     34 
     35 /* ! GROUP PRIO ANY Value */
     36 #define BCMINT_FIELD_GROUP_PRIO_ANY  (0x7FFFFFF)
     37 
     38 /* ! Max pipe */
     39 #define BCMINT_FIELD_MAX_PIPE (4)
     40 
     41 /*!
     42  * \brief return max uint32 value based on width in bits
     43  */
     44 #define BCMINT_FIELD_MAX_WIDTH_VALUE(width)  \
     45     ((width < 32) ?                          \
     46     ((1 << width) - 1) :                     \
     47     (0xFFFFFFFFUL))
     48 
     49 /*! BCMINT_FP_ALLOC UTILITY */
     50 #define BCMINT_FIELD_MEM_ALLOC(_ptr, _sz, _str)   \
     51     do {                                          \
     52         SHR_ALLOC(_ptr, _sz, _str);               \
     53         SHR_NULL_CHECK(_ptr, SHR_E_MEMORY);       \
     54         sal_memset(_ptr, 0, _sz);                 \
     55     } while(0)
     56 
     57 #define BCMINT_FIELD_MEM_FREE(_ptr)            \
     58     do {                                       \
     59         SHR_FREE(_ptr);                        \
     60     } while(0)
     61 
     62 #define BCMINT_FIELD_UINT16_BIT_SET(_arr, _bit) \
     63     do {                                        \
     64         _arr[(_bit / 16)] |= (1 << (_bit % 16));\
     65     } while (0)
     66 
     67 #define BCMINT_FIELD_UINT16_BIT_GET(_arr, _bit) \
     68     ((_arr[(_bit / 16)] >> (_bit % 16)) & 1)
     69 
     70 #define BCMINT_FIELD_ACTION_ARR_TO_ASET(_a_cnt, _a_arr, _aset)     \
     71      {                                                             \
     72          bcm_field_action_t _a;                                    \
     73          for (_a = 0; _a < _a_cnt; _a++) {                         \
     74              BCM_FIELD_ASET_ADD(_aset, _a_arr[_a]);                \
     75          }                                                         \
     76      }
     77 
     78 #define BCMINT_FIELD_ASET_TO_ACTION_ARR(_aset, _a_cnt, _a_arr)     \
     79      {                                                             \
     80          uint16_t _ct = 0;                                         \
     81          bcm_field_action_t _a;                                    \
     82          for (_a = 0; _a < bcmFieldActionCount; _a++) {            \
     83              if (BCM_FIELD_ASET_TEST(_aset, _a)) {                 \
     84                  _a_arr[_ct++] = _a;                               \
     85              }                                                     \
     86          }                                                         \
     87          _a_cnt = _ct;                                             \
     88      }
     89 
     90 #define BCMINT_FIELD_QUAL_ARR_TO_QSET(_q_cnt, _q_arr, _qset)       \
     91      {                                                             \
     92          bcm_field_qualify_t _q;                                 \
     93          for (_q = 0; _q < _q_cnt; _q++) {                         \
     94              BCM_FIELD_QSET_ADD(_qset, _q_arr[_q]);                \
     95          }                                                         \
     96      }
     97 
     98 
     99 /*! Stage Flags */
    100 #define BCMINT_FIELD_STAGE_KEY_TYPE_PRESEL            (1 << 1)
    101 #define BCMINT_FIELD_STAGE_KEY_TYPE_SELCODE           (1 << 2)
    102 #define BCMINT_FIELD_STAGE_KEY_TYPE_FIXED             (1 << 3)
    103 #define BCMINT_FIELD_STAGE_POLICY_TYPE_PDD            (1 << 4)
    104 #define BCMINT_FIELD_STAGE_KEYGEN_PROFILE             (1 << 5)
    105 #define BCMINT_FIELD_STAGE_ENTRY_TYPE_HASH            (1 << 6)
    106 #define BCMINT_FIELD_STAGE_DEFAULT_POLICY             (1 << 6)
    107 #define BCMINT_FIELD_STAGE_ACTION_RESOLUTION_SBR      (1 << 7)
    108 #define BCMINT_FIELD_STAGE_PRESEL_KEY_DYNAMIC         (1 << 8)
    109 #define BCMINT_FIELD_STAGE_NO_METER_SUPPORT           (1 << 9)
    110 #define BCMINT_FIELD_STAGE_LEGACY_CTR_SUPPORT         (1 << 10)
    111 #define BCMINT_FIELD_STAGE_FLEX_CTR_SUPPORT           (1 << 11)
    112 #define BCMINT_FIELD_STAGE_SUPPORTS_COLORED_ACTIONS   (1 << 12)
    113 #define BCMINT_FIELD_STAGE_COMPRESSION_SUPPORTED      (1 << 13)
    114 #define BCMINT_FIELD_STAGE_POLICER_SUPPORT            (1 << 14)
    115 #define BCMINT_FIELD_STAGE_POLICER_ACTION_SUPPORT     (1 << 15)
    116 #define BCMINT_FIELD_STAGE_DEFAULT_ENTRY_SUPPORT      (1 << 16)
    117 #define BCMINT_FIELD_STAGE_LEGACY_POLICER_SUPPORT     (1 << 17)
    118 #define BCMINT_FIELD_STAGE_COMPRESSION_SRC_IP4_ONLY   (1 << 18)
    119 #define BCMINT_FIELD_STAGE_COMPRESSION_SRC_IP6_ONLY   (1 << 19)
    120 #define BCMINT_FIELD_STAGE_COMPRESSION_DST_IP4_ONLY   (1 << 20)
    121 #define BCMINT_FIELD_STAGE_COMPRESSION_DST_IP6_ONLY   (1 << 21)
    122 #define BCMINT_FIELD_STAGE_PIPE_MODE_NOT_SUPPORTED    (1 << 22)
    123 /* stage supports only a single slice (like stage EM) */
    124 #define BCMINT_FIELD_STAGE_SINGLE_SLICE_ONLY          (1 << 23)
    125 #define BCMINT_FIELD_STAGE_PROFILE_SUPPORT            (1 << 24)
    126 #define BCMINT_FIELD_STAGE_POLICER_POOL_HINT_SUPPORT  (1 << 25)
    127 #define BCMINT_FIELD_STAGE_FLEXCTR_CONT_OBJ_SUPPORT   (1 << 26)
    128 /* Flex stats needs atleast one entry installed in group. */
    129 #define BCMINT_FIELD_STAGE_FLEXSTAT_SLICE_INFO        (1 << 27)
    130 
    131 /*! Group Flags */
    132 #define BCMINT_FIELD_GROUP_INSTALLED                  (1 << 1)
    133 #define BCMINT_FIELD_GROUP_DISABLED                   (1 << 2)
    134 #define BCMINT_FIELD_GROUP_CREATED_WITH_PRESEL        (1 << 3)
    135 #define BCMINT_FIELD_GROUP_COMPRESSION_ENABLED        (1 << 4)
    136 #define BCMINT_FIELD_GROUP_CREATE_WITH_RESERVE_ID     (1 << 5)
    137 #define BCMINT_FIELD_GROUP_ENT_LVL_ACTION_RESOLVE     (1 << 6)
    138 #define BCMINT_FIELD_GROUP_COMPR_SRC_IP_ENABLED       (1 << 7)
    139 #define BCMINT_FIELD_GROUP_COMPR_SRC_IP6_ENABLED      (1 << 8)
    140 #define BCMINT_FIELD_GROUP_COMPR_DST_IP_ENABLED       (1 << 9)
    141 #define BCMINT_FIELD_GROUP_COMPR_DST_IP6_ENABLED      (1 << 10)
    142 
    143 /* Total no of reserved Group Ids.
    144  * The reserved group IDs are allocated as the higher group IDs
    145  * for each stage.
    146  */
    147 #define BCMINT_FIELD_GROUP_RESERVE_GID_COUNT          1
    148 
    149 /*! Entry Flags */
    150 #define BCMINT_FIELD_ENTRY_INSTALLED                   (1 << 1)
    151 #define BCMINT_FIELD_ENTRY_DISABLED                    (1 << 2)
    152 #define BCMINT_FIELD_ENTRY_SRC_PORT_TYPE_GPORT         (1 << 3)
    153 #define BCMINT_FIELD_ENTRY_DST_PORT_TYPE_GPORT         (1 << 4)
    154 #define BCMINT_FIELD_ENTRY_COMP_PAIR_SRC_IP_L4PORT     (1 << 5)
    155 #define BCMINT_FIELD_ENTRY_COMP_PAIR_SRC_IP6_L4PORT    (1 << 6)
    156 #define BCMINT_FIELD_ENTRY_COMP_PAIR_DST_IP_L4PORT     (1 << 7)
    157 #define BCMINT_FIELD_ENTRY_COMP_PAIR_DST_IP6_L4PORT    (1 << 8)
    158 #define BCMINT_FIELD_ENTRY_DEFAULT_ONLY                (1 << 9)
    159 #define BCMINT_FIELD_ENTRY_EGR_OBJ_OVERLAY             (1 << 10)
    160 #define BCMINT_FIELD_ENTRY_EGR_OBJ_UNDERLAY            (1 << 11)
    161 #define BCMINT_FIELD_ENTRY_EGR_OBJ_ECMP_GROUP_OVERLAY  (1 << 12)
    162 #define BCMINT_FIELD_ENTRY_EGR_OBJ_ECMP_GROUP_UNDERLAY (1 << 13)
    163 #define BCMINT_FIELD_ENTRY_EGR_INTF_OVERLAY            (1 << 14)
    164 #define BCMINT_FIELD_ENTRY_GPORT_MPLS                  (1 << 15)
    165 #define BCMINT_FIELD_ENTRY_GPORT_WLAN                  (1 << 16)
    166 #define BCMINT_FIELD_ENTRY_GPORT_VXLAN                 (1 << 17)
    167 #define BCMINT_FIELD_ENTRY_GPORT_VLAN                  (1 << 18)
    168 #define BCMINT_FIELD_ENTRY_GPORT_NIV                   (1 << 19)
    169 #define BCMINT_FIELD_ENTRY_GPORT_MIM                   (1 << 20)
    170 #define BCMINT_FIELD_ENTRY_GPORT_FLOWPORT              (1 << 21)
    171 #define BCMINT_FIELD_ENTRY_GPORT_MODPORT               (1 << 22)
    172 #define BCMINT_FIELD_ENTRY_L2_MCAST                    (1 << 23)
    173 #define BCMINT_FIELD_ENTRY_L3_MCAST                    (1 << 24)
    174 #define BCMINT_FIELD_ENTRY_HW_INVALIDATED              (1 << 25)
    175 #define BCMINT_FIELD_ENTRY_TUNNEL_TYPE_MPLS            (1 << 26)
    176 #define BCMINT_FIELD_ENTRY_TUNNEL_TYPE_IPL3            (1 << 27)
    177 #define BCMINT_FIELD_ENTRY_TUNNEL_TYPE_FLEXFLOW        (1 << 28)
    178 #define BCMINT_FIELD_ENTRY_STAT_ATTACHED               (1 << 29)
    179 #define BCMINT_FIELD_ENTRY_TEMP_FOR_SLICE_INFO         (1 << 30)
    180 
    181 /*! Entry Action Flags */
    182 #define BCMINT_FIELD_ENTRY_ACTION_EGR_OBJ_OVERLAY            (1 << 1)
    183 #define BCMINT_FIELD_ENTRY_ACTION_EGR_OBJ_ECMP_GROUP_OVERLAY (1 << 2)
    184 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_MPLS                 (1 << 3)
    185 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_WLAN                 (1 << 4)
    186 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_VXLAN                (1 << 5)
    187 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_VLAN                 (1 << 6)
    188 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_NIV                  (1 << 7)
    189 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_MIM                  (1 << 8)
    190 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_FLOW                 (1 << 9)
    191 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_MODPORT              (1 << 10)
    192 #define BCMINT_FIELD_ENTRY_ACTION_COSQNEW_WITH_INT           (1 << 11)
    193 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_L2GRE                (1 << 12)
    194 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_TRILL                (1 << 13)
    195 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_PORT                 (1 << 14)
    196 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_TRUNK                (1 << 15)
    197 #define BCMINT_FIELD_ENTRY_ACTION_POLICER_CANCEL_OVERLAY_0   (1 << 16)
    198 #define BCMINT_FIELD_ENTRY_ACTION_POLICER_CANCEL_OVERLAY_1   (1 << 17)
    199 
    200 #define BCMINT_FIELD_ENTRY_ACTION_GPORT_FLAGS         \
    201         (BCMINT_FIELD_ENTRY_ACTION_GPORT_MPLS  |      \
    202          BCMINT_FIELD_ENTRY_ACTION_GPORT_WLAN  |      \
    203          BCMINT_FIELD_ENTRY_ACTION_GPORT_VXLAN |      \
    204          BCMINT_FIELD_ENTRY_ACTION_GPORT_VLAN  |      \
    205          BCMINT_FIELD_ENTRY_ACTION_GPORT_NIV   |      \
    206          BCMINT_FIELD_ENTRY_ACTION_GPORT_MIM   |      \
    207          BCMINT_FIELD_ENTRY_ACTION_GPORT_FLOW  |      \
    208          BCMINT_FIELD_ENTRY_ACTION_GPORT_L2GRE |      \
    209          BCMINT_FIELD_ENTRY_ACTION_GPORT_TRUNK |      \
    210          BCMINT_FIELD_ENTRY_ACTION_GPORT_TRILL)
    211 
    212 /* Validate the Presel ID */
    213 #define BCMINT_FIELD_IS_PRESEL_ENTRY(_e)           \
    214     (((_e & 0xf0000000) == BCM_FIELD_QUALIFY_PRESEL) ? TRUE:FALSE)
    215 
    216 /*! Entry Flags */
    217 #define BCMINT_FIELD_ENTRY_TYPE_PRESEL                (1 << 1)
    218 
    219 /* Initialise field group id bitmap */
    220 #define BCMINT_FIELD_GRPID_BMP_INIT(group_bmp)  \
    221     sal_memset(&(group_bmp), 0, sizeof(bcmi_field_grpid_bmp_t))
    222 
    223 /* Initialise field entry id bitmap */
    224 #define BCMINT_FIELD_ENTRYID_BMP_INIT(entryid_bmp)  \
    225     sal_memset(&(entryid_bmp), 0, sizeof(bcmint_field_entryid_bmp_t))
    226 
    227 /* Initialise field entry id bitmap */
    228 #define BCMINT_FIELD_PRESELID_BMP_INIT(preselid_bmp)  \
    229     sal_memset(&(preselid_bmp), 0, sizeof(bcmint_field_preselid_bmp_t))
    230 
    231 /* Internal stage ID get from the stage qualifier */
    232 #define BCMINT_FIELD_STAGE_ID_GET(_stage_qual_, _stage_id_)                   \
    233      {                                                                        \
    234          if (_stage_qual_ == bcmFieldQualifyStageIngress) {                   \
    235              _stage_id_ = bcmiFieldStageIngress;                              \
    236          } else if (_stage_qual_ == bcmFieldQualifyStageLookup) {             \
    237              _stage_id_ = bcmiFieldStageVlan;                                 \
    238          } else if (_stage_qual_ == bcmFieldQualifyStageEgress) {             \
    239              _stage_id_ = bcmiFieldStageEgress;                               \
    240          } else if (_stage_qual_ == bcmFieldQualifyStageIngressExactMatch) {  \
    241              _stage_id_ = bcmiFieldStageExactMatch;                           \
    242          }  else if (_stage_qual_ == bcmFieldQualifyStageIngressFlowtracker) {\
    243              _stage_id_ = bcmiFieldStageFlowTracker;                          \
    244          }                                                                    \
    245      }
    246 
    247 /* Pseudo qualifiers */
    248 #define BCMINT_FIELD_IS_PSEUDO_QUAL(_q)                         \
    249             ((bcmFieldQualifyStage                   == _q) ||  \
    250              (bcmFieldQualifyStageIngress            == _q) ||  \
    251              (bcmFieldQualifyStageLookup             == _q) ||  \
    252              (bcmFieldQualifyStageEgress             == _q) ||  \
    253              (bcmFieldQualifyStageIngressExactMatch  == _q) ||  \
    254              (bcmFieldQualifyStageIngressFlowtracker == _q) ||  \
    255              (bcmiFieldQualifyUdfExtOuter            == _q) ||  \
    256              (bcmiFieldQualifyUdfExtInner            == _q))
    257 
    258 /* Compression Qualifiers */
    259 #define BCMINT_FIELD_IS_COMPRESSION_QUAL(_q) \
    260             ((bcmFieldQualifySrcIp     == _q) || \
    261              (bcmFieldQualifyDstIp     == _q) || \
    262              (bcmFieldQualifySrcIp6    == _q) || \
    263              (bcmFieldQualifyDstIp6    == _q) || \
    264              (bcmFieldQualifyL4SrcPort == _q) || \
    265              (bcmFieldQualifyL4DstPort == _q))
    266 
    267 #define BCMINT_FIELD_IS_IP_QUAL(_q) \
    268             ((bcmFieldQualifySrcIp     == _q) || \
    269              (bcmFieldQualifyDstIp     == _q) || \
    270              (bcmFieldQualifySrcIp6    == _q) || \
    271              (bcmFieldQualifyDstIp6    == _q))
    272 
    273 /* Colored action. */
    274 #define BCMINT_FIELD_IS_COLORED_ACTION(action) \
    275     ((action == bcmFieldActionGpDrop) || \
    276      (action == bcmFieldActionYpDrop) || \
    277      (action == bcmFieldActionRpDrop) || \
    278      (action == bcmFieldActionGpPrioIntNew) || \
    279      (action == bcmFieldActionYpPrioIntNew) || \
    280      (action == bcmFieldActionRpPrioIntNew) || \
    281      (action == bcmFieldActionGpIntCongestionNotificationNew) || \
    282      (action == bcmFieldActionYpIntCongestionNotificationNew) || \
    283      (action == bcmFieldActionRpIntCongestionNotificationNew) || \
    284      (action == bcmFieldActionGpDropPrecedence) || \
    285      (action == bcmFieldActionYpDropPrecedence) || \
    286      (action == bcmFieldActionRpDropPrecedence) || \
    287      (action == bcmFieldActionGpTimeStampToCpu) || \
    288      (action == bcmFieldActionYpTimeStampToCpu) || \
    289      (action == bcmFieldActionRpTimeStampToCpu) || \
    290      (action == bcmFieldActionGpSwitchToCpuReinstate) || \
    291      (action == bcmFieldActionYpSwitchToCpuReinstate) || \
    292      (action == bcmFieldActionRpSwitchToCpuReinstate) || \
    293      (action == bcmFieldActionGpCopyToCpu) || \
    294      (action == bcmFieldActionYpCopyToCpu) || \
    295      (action == bcmFieldActionRpCopyToCpu) || \
    296      (action == bcmFieldActionGpCopyToCpuCancel) || \
    297      (action == bcmFieldActionYpCopyToCpuCancel) || \
    298      (action == bcmFieldActionRpCopyToCpuCancel) || \
    299      (action == bcmFieldActionGpDropCancel) || \
    300      (action == bcmFieldActionYpDropCancel) || \
    301      (action == bcmFieldActionRpDropCancel) || \
    302      (action == bcmFieldActionGpOpaqueCtrlId) || \
    303      (action == bcmFieldActionYpOpaqueCtrlId) || \
    304      (action == bcmFieldActionRpOpaqueCtrlId) || \
    305      (action == bcmFieldActionGpStatGroup) || \
    306      (action == bcmFieldActionYpStatGroup) || \
    307      (action == bcmFieldActionRpStatGroup) || \
    308      (action == bcmFieldActionGpDscpNew) || \
    309      (action == bcmFieldActionYpDscpNew) || \
    310      (action == bcmFieldActionRpDscpNew) || \
    311      (action == bcmFieldActionGpPrioPktNew) || \
    312      (action == bcmFieldActionYpPrioPktNew) || \
    313      (action == bcmFieldActionRpPrioPktNew) || \
    314      (action == bcmFieldActionGpOuterVlanCfiNew) || \
    315      (action == bcmFieldActionYpOuterVlanCfiNew) || \
    316      (action == bcmFieldActionRpOuterVlanCfiNew) || \
    317      (action == bcmFieldActionGpCosMapNew) || \
    318      (action == bcmFieldActionYpCosMapNew) || \
    319      (action == bcmFieldActionRpCosMapNew))
    320 
    321 /* Egress Mask Bitmaps */
    322 #define BCMINT_FIELD_EGRESS_MASK_L2_L3         0
    323 #define BCMINT_FIELD_EGRESS_MASK_L2            1
    324 #define BCMINT_FIELD_EGRESS_MASK_L3            2
    325 
    326 /* Redirection Action */
    327 #define BCMINT_FIELD_EGRESS_MASK_OP_AND        0
    328 #define BCMINT_FIELD_EGRESS_MASK_OP_OR         1
    329 #define BCMINT_FIELD_DELAYED_DROP              2
    330 #define BCMINT_FIELD_DELAYED_REDIRECT          3
    331 
    332 /* Get stage entry id from entry id and stage. */
    333 #define BCMINT_FIELD_STAGE_ENTRY_ID_GET(_stg_, _eid_, _stg_eid_)      \
    334         {                                                             \
    335            if (_stg_ == bcmiFieldStageIngress) {                      \
    336                _stg_eid_ = _eid_ | BCM_FIELD_IFP_ID_BASE;             \
    337            } else if (_stg_ == bcmiFieldStageVlan) {                  \
    338                _stg_eid_ = _eid_ | BCM_FIELD_VFP_ID_BASE;             \
    339            } else if (_stg_ == bcmiFieldStageEgress) {                \
    340                _stg_eid_ = _eid_ | BCM_FIELD_EFP_ID_BASE;             \
    341            } else if (_stg_ == bcmiFieldStageExactMatch) {            \
    342                _stg_eid_ = _eid_ | BCM_FIELD_EM_ID_BASE;              \
    343            } else if (_stg_ == bcmiFieldStageFlowTracker) {           \
    344                _stg_eid_ = _eid_ | BCM_FIELD_FT_ID_BASE;              \
    345            } else {                                                   \
    346                   SHR_IF_ERR_VERBOSE_EXIT(SHR_E_INTERNAL);            \
    347            }                                                          \
    348         }                                                             \
    349 
    350 /* Hint Hash size & mask */
    351 #define BCMINT_FP_HASH_INDEX_MASK   (BCMI_FIELD_HA_HINT_ID_MAX - 1)
    352 
    353 #define BCMINT_FIELD_ENTRY_ACTION_VALID_LT_FIELDS_SET           (1 << 1)
    354 #define BCMINT_FIELD_ENTRY_ACTION_INVALID_LT_FIELDS_SET         (1 << 2)
    355 
    356 /******************************************************************************
    357  * Internal Field Module Structures
    358  */
    359 
    360 typedef int (*ltsw_field_profile_lt_get_f)(int unit, bcmi_ltsw_field_stage_t stage_id, int index, void *profile);
    361 typedef int (*ltsw_field_profile_lt_insert_f)(int unit, bcmi_ltsw_field_stage_t stage_id, int index, void *profile);
    362 typedef int (*ltsw_field_profile_lt_delete_f)(int unit, bcmi_ltsw_field_stage_t stage_id, int index);
    363 
    364 typedef struct ltsw_field_profile_info_s {
    365     bcmi_ltsw_profile_hdl_t phd;
    366     int entry_idx_min;
    367     int entry_idx_max;
    368     int entries_per_set;
    369     int entry_size;
    370     ltsw_field_profile_lt_get_f lt_get;
    371     ltsw_field_profile_lt_insert_f lt_ins;
    372     ltsw_field_profile_lt_delete_f lt_del;
    373 } ltsw_field_profile_info_t;
    374 
    375 /* EFP Key & Qual mapping */
    376 typedef struct bcmint_field_efp_key_qual_map_s {
    377     bcm_field_qset_t key_qset;
    378     char *grp_mode;
    379     char *port_pkt_type;
    380     bcm_field_group_mode_type_t mode_type;
    381     bcm_field_group_packet_type_t packet_type;
    382 } bcmint_field_efp_key_qual_map_t;
    383 
    384 /* Different FP template IDs and key fields. */
    385 typedef struct bcmint_field_tbls_info_s {
    386     /* Group template SID */
    387     char *group_sid;
    388     /* Group template key FID */
    389     char *group_key_fid;
    390     /* Rule template SID */
    391     char *rule_sid;
    392     /* Rule template key FID */
    393     char *rule_key_fid;
    394     /* Entry Rule template key FID */
    395     char *entry_rule_key_fid;
    396     /* Policy template SID */
    397     char *policy_sid;
    398     /* Policy template key FID */
    399     char *policy_key_fid;
    400     /* Entry Policy template key FID */
    401     char *entry_policy_key_fid;
    402     /* Entry SID */
    403     char *entry_sid;
    404     /* Entry key FID */
    405     char *entry_key_fid;
    406     /* PDD template SID */
    407     char *pdd_sid;
    408     /* PDD template key FID */
    409     char *pdd_key_fid;
    410     /* SBR template SID */
    411     char *sbr_sid;
    412     /* SBR template key FID */
    413     char *sbr_key_fid;
    414     /* Presel entry template SID */
    415     char *presel_entry_sid;
    416     /* Presel entry template key FID */
    417     char *presel_entry_key_fid;
    418     /* Group Presel entry template key FID */
    419     char *grp_presel_entry_key_fid;
    420     /* Presel entry count */
    421     char *presel_entry_count_fid;
    422     /* Presel entry priority */
    423     char *presel_entry_prio_fid;
    424     /* Presel Group template SID */
    425     char *presel_group_sid;
    426     /* Presel Group template key FID */
    427     char *presel_group_key_fid;
    428     /* Counter template SID */
    429     char *ctr_sid;
    430     /* Counter template key FID */
    431     char *ctr_key_fid;
    432     /* Meter template SID */
    433     char *meter_sid;
    434     /* Meter template key FID */
    435     char *meter_key_fid;
    436     /* Operation Mode SID */
    437     char *oper_mode_sid;
    438     /* Operation Mode FID */
    439     char *oper_mode_fid;
    440     /* Flex counter index 0 */
    441     char *flex_ctr_idx0_fid;
    442     /* Flex counter index 1 */
    443     char *flex_ctr_idx1_fid;
    444     /* Flex counter index 2 */
    445     char *flex_ctr_idx2_fid;
    446     /* Flex counter index 3 */
    447     char *flex_ctr_idx3_fid;
    448     /* Flex counter index 4 */
    449     char *flex_ctr_idx4_fid;
    450     /* Flex counter index 5 */
    451     char *flex_ctr_idx5_fid;
    452     /* Flex counter index 6 */
    453     char *flex_ctr_idx6_fid;
    454     /* Flex counter index 7 */
    455     char *flex_ctr_idx7_fid;
    456     /* Flex counter index 8 */
    457     char *flex_ctr_idx8_fid;
    458     /* Flex counter index 9 */
    459     char *flex_ctr_idx9_fid;
    460     /* Field Compression type */
    461     char *compression_type_fid;
    462     /* Field Compression count */
    463     char *compression_type_cnt_fid;
    464     /* group template oper Mode */
    465     char *grp_oper_mode_fid;
    466     /* Source class mode SID. */
    467     char *src_class_mode_sid;
    468     /* Source class mode key FID. */
    469     char *src_class_mode_key_fid;
    470     /* Default SBR template key FID */
    471     char *def_sbr_key_fid;
    472     /* Default PDD template key FID */
    473     char *def_pdd_key_fid;
    474     /* Default action template key FID */
    475     char *def_policy_key_fid;
    476     /* Entry Enable FID */
    477     char *entry_enable_fid;
    478     /* Entry Priority FID */
    479     char *entry_priority_fid;
    480     /* Group info LT SID */
    481     char *group_info_sid;
    482     /* Group info LT key FID */
    483     char *group_info_key_fid;
    484     /* Group info LT num_parts FID */
    485     char *group_info_num_parts_fid;
    486     /* Group info LT entries created FID */
    487     char *group_info_entries_created_fid;
    488     /* Group info LT entries tentative FID */
    489     char *group_info_entries_tentative_fid;
    490     /* Group info LT action res FID */
    491     char *group_info_act_res_fid;
    492     /* Group info qual LT SID */
    493     char *group_info_partition_sid;
    494     /* Group info qual LT key FID */
    495     char *group_info_partition_key_fid;
    496     /* Group info actions LT SID */
    497     char *group_info_action_sid;
    498     /* Group info action LT key FID */
    499     char *group_info_action_key_fid;
    500     /* Group info presel LT SID */
    501     char *group_info_presel_sid;
    502     /* Group info presel LT key FID */
    503     char *group_info_presel_key_fid;
    504     /* Group info qual/action/presel LT Key Part FID */
    505     char *group_info_common_partition_key_fid;
    506     /* Group info LT slice count FID */
    507     char *group_info_num_slice_fid;
    508     /* Group info LT slice FID */
    509     char *group_info_slice_fid;
    510     /* compress config FID */
    511     char *compress_sid;
    512     /* compress config FID */
    513     char *compress_src_ip4_only_sid;
    514     /* compress config FID */
    515     char *compress_src_ip6_only_sid;
    516     /* compress config FID */
    517     char *compress_dst_ip4_only_sid;
    518     /* compress config FID */
    519     char *compress_dst_ip6_only_sid;
    520     /* Slice info LT SID */
    521     char *slice_info_sid;
    522     /* Slice info LT key FID */
    523     char *slice_info_key_fid;
    524     /* Slice info LT pipe FID */
    525     char *slice_info_pipe_fid;
    526     /* Slice info LT entry in use FID */
    527     char *slice_info_entry_in_use_fid;
    528     /* Slice info LT entry maximum FID */
    529     char *slice_info_entry_max_fid;
    530     /* Action container info LT SID */
    531     char *action_cont_info_sid;
    532     /* Action container info LT KEY field */
    533     char *action_cont_info_key_fid;
    534     /* Stage info LT SID */
    535     char *stage_info_sid;
    536     /* Stage info slice count FID */
    537     char *stage_info_num_slices_fid;
    538     /* Stage info entry count FID */
    539     char *stage_info_num_entries_fid;
    540     /* Meter info LT SID */
    541     char *meter_info_sid;
    542     /* Meter info num meters FID */
    543     char *meter_info_num_meters_fid;
    544     /* Meter info entry in use FID */
    545     char *meter_info_num_meters_per_pipe_fid;
    546     /* Action info CPU Match ID FID */
    547     char *action_info_cpu_match_id_fid;
    548     /* Action l3 switch nhop fid */
    549     char *action_l3_switch_nhop_fid;
    550     /* Action l3 switch ecmp fid */
    551     char *action_l3_switch_ecmp_fid;
    552     /* Action redirect egr nexthop fid */
    553     char *action_redirect_egr_nhop_fid;
    554     /* Action redirect egr nexthop ecmp fid */
    555     char *action_redirect_egr_ecmp_fid;
    556     /* Action info Mirror container ID FID */
    557     char *action_mirror_cont_id_fid;
    558     /* Action info Mirror container enable FID */
    559     char *action_mirror_cont_enable_fid;
    560     /* Redirect profile FID */
    561     char *redirect_profile_sid;
    562     /* Redirect profile key SID */
    563     char *redirect_profile_key_fid;
    564     /* Redirect profile ports SID */
    565     char *redirect_profile_ports_fid;
    566     /* Egress Mask SID */
    567     char *egress_mask_profile_sid;
    568     /* Egress Mask key FID */
    569     char *egress_mask_profile_key_fid;
    570     /* Egress Mask section FID */
    571     char *egress_mask_profile_section_fid;
    572     /* Egress Mask ports FID */
    573     char *egress_mask_profile_ports_fid;
    574     /* Egress Mask target FID */
    575     char *egress_mask_profile_target_fid;
    576     /* Egress Mask action FID */
    577     char *egress_mask_profile_action_fid;
    578     /* delayed_redirect profile FID */
    579     char *delayed_redirect_profile_sid;
    580     /* delayed_redirect profile key SID */
    581     char *delayed_redirect_profile_key_fid;
    582     /* delayed_redirect profile ports SID */
    583     char *delayed_redirect_profile_ports_fid;
    584     /* delayed_redirect profile elephant pkts only SID */
    585     char *delayed_redirect_profile_elephant_pkts_fid;
    586     /* delayed_drop profile FID */
    587     char *delayed_drop_profile_sid;
    588     /* delayed_drop profile key SID */
    589     char *delayed_drop_profile_key_fid;
    590     /* delayed_drop profile ports SID */
    591     char *delayed_drop_profile_ports_fid;
    592     /* delayed_drop profile elephant pkts only SID */
    593     char *delayed_drop_profile_elephant_pkts_fid;
    594     /* Action unmodified redirect to port FID */
    595     char *action_unmod_redirect_to_port_fid;
    596     /* Action unmodified redirect to trunk FID */
    597     char *action_unmod_redirect_to_trunk_fid;
    598     /* Action to enable counter FID */
    599     char *action_ctr_enable;
    600     /* Flex Ctr Action Container FID */
    601     char *flex_ctr_cont_fid;
    602 } bcmint_field_tbls_info_t;
    603 
    604 /* Information about the color action tables. */
    605 typedef struct bcmint_field_color_action_tbls_info_s {
    606     /* Number of color action table pools. */
    607     int num_pools;
    608     /* Pipe LT name. */
    609     char *pipe_cfg_sid;
    610     /* Pipe field name. */
    611     char *pipe_cfg_fid;
    612     /* PIPE field name. */
    613     char *pipe_fid;
    614     /* Color action PDD table name. */
    615     char *pdd_tbl_sid;
    616     /* Color action PDD table key field name. */
    617     char *pdd_tbl_key_fid;
    618     /* Color action SBR table name. */
    619     char *sbr_sid;
    620     /* Color action SBR table key field name. */
    621     char *sbr_key_fid;
    622     /* Array of color action table names of each pool . */
    623     char *tbl_sid[BCM_FIELD_COLOR_ACTION_POOL_MAX];
    624     /* Array of color action table key field names of each pool . */
    625     char *tbl_key_fid[BCM_FIELD_COLOR_ACTION_POOL_MAX];
    626 } bcmint_field_color_action_tbls_info_t;
    627 
    628 /* field hintid bitmap */
    629 typedef struct bcmint_field_hintid_bmp_s {
    630     SHR_BITDCL  *w;
    631 } bcmint_field_hintid_bmp_t;
    632 
    633 /* Field Presel Group database Structure */
    634 typedef struct bcmint_field_presel_group_s {
    635 
    636     /*! Presel Group ID */
    637     int presel_group;
    638 
    639     /*! Presel QSET */
    640     bcm_field_qset_t presel_qset;
    641 
    642     /*! next presel group */
    643     struct bcmint_field_presel_group_s *next;
    644 
    645 } bcmint_field_presel_group_t;
    646 
    647 
    648 /* Field Action Strength Profile Structure */
    649 typedef struct bcmint_field_action_strength_prof_s {
    650     bool color;
    651     uint32 group_priority;
    652     bcmi_field_aset_t aset;
    653     uint32 *action_strength;
    654     uint32 action_strength_cnt;
    655     uint32 strength_prof_idx;
    656     bool update;
    657     uint16_t ref_cnt;
    658     struct bcmint_field_action_strength_prof_s *next;
    659     struct bcmint_field_action_strength_prof_s *prev;
    660 } bcmint_field_action_strength_prof_t;
    661 
    662 typedef struct bcmint_field_action_strength_prof_base_s {
    663     bcmint_field_action_strength_prof_t *strength_prof;
    664 } bcmint_field_action_strength_prof_base_t;
    665 
    666 /*!
    667  * \brief Field Stage informaiton.
    668  */
    669 typedef struct bcmint_field_stage_info_s {
    670 
    671     /*! Stage Flags BCM_FIELD_STAGE_FLAGS_XXX */
    672     uint32_t flags;
    673 
    674     /*! Stage ID */
    675     bcmi_ltsw_field_stage_t stage_id;
    676 
    677     /*! Base value for stage Group/Entry/Presel ID */
    678     int stage_base_id;
    679 
    680     /*! entry qualifier db count */
    681     uint16_t qual_db_count;
    682 
    683     /*! group qualifier db count */
    684     uint16_t group_qual_db_count;
    685 
    686     /*! entry udf qualifier db count */
    687     uint16_t udf_qual_db_count;
    688 
    689     /*! presel entry qualifier db count */
    690     uint16_t presel_qual_db_count;
    691 
    692     /*! action db count */
    693     uint16_t action_db_count;
    694 
    695     /*! colored action profile bitmap. */
    696     bcmi_field_ha_profile_info_t *color_tbl_profile;
    697 
    698     /*! colored action pdd profile bitmap. */
    699     bcmi_field_ha_profile_info_t *color_pdd_tbl_profile;
    700 
    701     /*! colored action sbr profile bitmap. */
    702     bcmi_field_ha_profile_info_t *color_sbr_tbl_profile;
    703 
    704     /*! entry qualifier lt map db */
    705     bcm_field_qual_map_t *qual_lt_map_db;
    706 
    707     /*! group qualifier lt map db */
    708     bcm_field_qual_map_t *group_qual_lt_map_db;
    709 
    710     /*! udf qualifier lt map db */
    711     bcm_field_qual_map_t *udf_qual_lt_map_db;
    712 
    713     /*! presel qualifier lt map db */
    714     bcm_field_qual_map_t *presel_qual_lt_map_db;
    715 
    716     /*! action lt map db */
    717     const bcm_field_action_map_t *action_lt_map_db;
    718 
    719     /*! LT table and key field names */
    720     bcmint_field_tbls_info_t *tbls_info;
    721 
    722     /*! Colored action table and key field names. */
    723     bcmint_field_color_action_tbls_info_t *color_action_tbls_info;
    724 
    725     /*! Stage Group info */
    726     bcmi_field_ha_group_info_t *group_info;
    727 
    728     /*! Stage Presel info */
    729     bcmi_field_ha_presel_info_t *presel_info;
    730 
    731     /*! Stage Entry info */
    732     bcmi_field_ha_entry_info_t *entry_info;
    733 
    734     /*! Strength Profile db */
    735     bcmint_field_action_strength_prof_base_t *strength_base_prof;
    736 
    737     /*! SBR enabled actions supported in a stage */
    738     bcmi_field_aset_t sbr_aset;
    739 
    740     /*! Count of SBR enabled actions supported in a stage */
    741     uint16_t sbr_aset_cnt;
    742 
    743     /*! SBR Max limit */
    744     uint16_t sbr_max_limit;
    745 
    746     /*! Maximum possible strength ID */
    747     uint16_t strength_id_max;
    748 
    749     /*! Default Presel Group ID */
    750     int presel_group_def;
    751 
    752     /*! EFP Key & Qual mapping */
    753     bcmint_field_efp_key_qual_map_t efp_key_qual_map[BCMINT_FIELD_EFP_KEYS];
    754 
    755 } bcmint_field_stage_info_t;
    756 
    757 /* Different compression FP template IDs and key fields. */
    758 typedef struct bcmint_field_compress_tbls_info_s {
    759 
    760     /* Index Mapped Ethertype LT SID */
    761     char *index_mapped_ethertype_sid;
    762 
    763     /* Index Mapped Ethertype LT Key */
    764     char *index_key_ethertype_fid;
    765 
    766     /* Index Mapped Ethertype LT Value */
    767     char *index_val_ethertype_fid;
    768 
    769     /* Index Mapped Ethertype LT Mapped Val */
    770     char *index_map_val_ethertype_fid;
    771 
    772     /* Index Mapped IP Protocol LT SID */
    773     char *index_mapped_ipprotocol_sid;
    774 
    775     /* Index Mapped IP Protocol LT Key */
    776     char *index_key_ipprotocol_fid;
    777 
    778     /* Index Mapped IP Protocol LT Value */
    779     char *index_val_ipprotocol_fid;
    780 
    781     /* Index Mapped IP Protocol LT Mapped Val */
    782     char *index_map_val_ipprotocol_fid;
    783 
    784     /* Direct Mapped TTL LT SID */
    785     char *direct_mapped_ttl_sid;
    786 
    787     /* Direct Mapped TTL LT Val */
    788     char *direct_val_ttl_fid;
    789 
    790     /* Direct Mapped TTL LT Mapped Val */
    791     char *direct_map_val_ttl_fid;
    792 
    793     /* Direct Mapped TCP flags LT SID */
    794     char *direct_mapped_tcp_sid;
    795 
    796     /* Direct Mapped TCP flags LT Val */
    797     char *direct_val_tcp_fid;
    798 
    799     /* Direct Mapped TCP flags LT Mapped Val */
    800     char *direct_map_val_tcp_fid;
    801 
    802     /* Direct Mapped TOS LT SID */
    803     char *direct_mapped_tos_sid;
    804 
    805     /* Direct Mapped TOS LT Val */
    806     char *direct_val_tos_fid;
    807 
    808     /* Direct Mapped TOS LT Mapped Val */
    809     char *direct_map_val_tos_fid;
    810 
    811     /* Direct Mapped TTL zero LT SID */
    812     char *direct_mapped_ttl_zero_sid;
    813 
    814     /* Direct Mapped TTL zero LT Val */
    815     char *direct_val_ttl_zero_fid;
    816 
    817     /* Direct Mapped TTL LT zero Mapped Val */
    818     char *direct_map_val_ttl_zero_fid;
    819 
    820     /* Direct Mapped TCP flags zero LT SID */
    821     char *direct_mapped_tcp_zero_sid;
    822 
    823     /* Direct Mapped TCP flags zero LT Val */
    824     char *direct_val_tcp_zero_fid;
    825 
    826     /* Direct Mapped TCP flags zero LT Mapped Val */
    827     char *direct_map_val_tcp_zero_fid;
    828 
    829     /* Direct Mapped TOS zero LT SID */
    830     char *direct_mapped_tos_zero_sid;
    831 
    832     /* Direct Mapped TOS zero LT Val */
    833     char *direct_val_tos_zero_fid;
    834 
    835     /* Direct Mapped TOS LT Mapped Val */
    836     char *direct_map_val_tos_zero_fid;
    837 
    838     /* Direct Mapped TTL one LT SID */
    839     char *direct_mapped_ttl_one_sid;
    840 
    841     /* Direct Mapped TTL one LT Val */
    842     char *direct_val_ttl_one_fid;
    843 
    844     /* Direct Mapped TTL LT one Mapped Val */
    845     char *direct_map_val_ttl_one_fid;
    846 
    847     /* Direct Mapped TCP flags one LT SID */
    848     char *direct_mapped_tcp_one_sid;
    849 
    850     /* Direct Mapped TCP flags one LT Val */
    851     char *direct_val_tcp_one_fid;
    852 
    853     /* Direct Mapped TCP flags one LT Mapped Val */
    854     char *direct_map_val_tcp_one_fid;
    855 
    856     /* Direct Mapped TOS one LT SID */
    857     char *direct_mapped_tos_one_sid;
    858 
    859     /* Direct Mapped TOS one LT Val */
    860     char *direct_val_tos_one_fid;
    861 
    862     /* Direct Mapped TOS LT Mapped Val */
    863     char *direct_map_val_tos_one_fid;
    864 
    865     /* Direct Mapped IP Tunnel LT SID */
    866     char *direct_mapped_tunnelttl_sid;
    867 
    868     /* Direct Mapped IP Tunnel LT Val */
    869     char *direct_val_tunnelttl_fid;
    870 
    871     /* Direct Mapped IP Tunnel LT Mapped Val */
    872     char *direct_map_val_tunnelttl_fid;
    873 
    874     /* Direct Mapped ipprotocol LT SID */
    875     char *direct_mapped_ipprotocol_sid;
    876 
    877     /* Direct Mapped ipprotocol LT Val */
    878     char *direct_val_ipprotocol_fid;
    879 
    880     /* Direct Mapped ipprotocol LT Mapped Val */
    881     char *direct_map_val_ipprotocol_fid;
    882 
    883     /* PIPE */
    884     char *pipe_fid;
    885 
    886     /* Operation Mode SID */
    887     char *oper_mode_sid;
    888 
    889     /* Operation Mode FID */
    890     char *oper_mode_fid;
    891 
    892 } bcmint_field_compress_tbls_info_t;
    893 
    894 /*!
    895  * \brief Field Control informaiton.
    896  */
    897 typedef struct bcmint_field_control_info_s {
    898 
    899     bcmint_field_stage_info_t stage_info[bcmiFieldStageCount];
    900 
    901     /*! Bitmap of created hint ids */
    902     bcmint_field_hintid_bmp_t hintid_bmp;
    903 
    904     /*! Hints lookup hash */
    905     bcmi_field_ha_hints_t *hints_hash;
    906 
    907     /*! Field Control LT Map Info DB */
    908     const bcm_field_control_map_t *control_lt_map_db;
    909 
    910     /*! Field control db count */
    911     uint16_t control_db_count;
    912 
    913     /*! Compression LT table and field names */
    914     bcmint_field_compress_tbls_info_t *comp_tbls_info;
    915 
    916 } bcmint_field_control_info_t;
    917 
    918 
    919 /*!
    920  * \brief Field database.
    921  */
    922 typedef struct bcmi_ltsw_field_db_s {
    923 
    924     /*! Field module lock. */
    925     sal_mutex_t lock;
    926 
    927     /*! Field control database. */
    928     bcmint_field_control_info_t control_db;
    929 
    930 } bcmi_ltsw_field_db_t;
    931 
    932 extern bcmi_ltsw_field_db_t bcmi_ltsw_field_db[BCM_MAX_NUM_UNITS];
    933 
    934 /*! Field mutex lock. */
    935 #define FP_LOCK(unit) \
    936     do { \
    937         if (bcmi_ltsw_field_db[unit].lock) { \
    938             sal_mutex_take(bcmi_ltsw_field_db[unit].lock, SAL_MUTEX_FOREVER); \
    939         } \
    940     } while(0)
    941 
    942 /*! Field mutex unlock. */
    943 #define FP_UNLOCK(unit) \
    944     do { \
    945         if (bcmi_ltsw_field_db[unit].lock) { \
    946             sal_mutex_give(bcmi_ltsw_field_db[unit].lock); \
    947         } \
    948     } while(0)
    949 
    950 /******************************************************************************
    951  * Internal Field Module Specific Purpose Structures
    952  */
    953 typedef struct bcmi_field_udf_qset_bitmap_s {
    954 
    955     /*! 1b Chunk qualifiers bitmaps */
    956     uint32_t *chunk_b1_bitmap;
    957 
    958     /*! 2b Chunk qualifiers bitmaps */
    959     uint32_t *chunk_b2_bitmap;
    960 
    961     /*! 4b Chunk qualifiers bitmap */
    962     uint32_t *chunk_b4_bitmap;
    963 
    964 } bcmi_field_udf_qset_bitmap_t;
    965 
    966 /******************************************************************************
    967  * Internal Field Module Profile Management Functions
    968  */
    969 
    970 /*!
    971  * \brief Get profile entries from LT.
    972  *
    973  * \param [in] unit Unit number.
    974  * \param [in] stage_id Stage Id.
    975  * \param [in] index First profile entry index.
    976  * \param [in] pinfo Profile information.
    977  * \param [out] profile Profile entries.
    978  *
    979  * \return SHR_E_NONE on success and error code otherwise.
    980  */
    981 extern int
    982 bcmint_ltsw_field_profile_get(int unit,
    983         bcmi_ltsw_field_stage_t stage_id, int index,
    984         ltsw_field_profile_info_t *pinfo, void *profile);
    985 
    986 /*!
    987  * \brief Add profile.
    988  *
    989  * If same entries existed, just increment reference count.
    990  *
    991  * \param [in] unit Unit number.
    992  * \param [in] stage_id Stage Id.
    993  * \param [in] profile Profile to be added.
    994  * \param [in] ref_count Add how many reference counts for this profile.
    995  * \param [in] pinfo Profile information.
    996  * \param [out] index Index of the added or existed profile enrty.
    997  *
    998  * \return SHR_E_NONE on success and error code otherwise.
    999  */
   1000 extern int
   1001 bcmint_ltsw_field_profile_add(int unit,
   1002         bcmi_ltsw_field_stage_t stage_id,
   1003         void *profile, int ref_count,
   1004         ltsw_field_profile_info_t *pinfo, int *index);
   1005 
   1006 /*!
   1007  * \brief Add profile reference.
   1008  *
   1009  * \param [in] unit Unit number.
   1010  * \param [in] index Index of the added profile entry.
   1011  * \param [in] ref_count Add how many reference counts for this profile.
   1012  * \param [in] pinfo Profile information.
   1013  *
   1014  * \return SHR_E_NONE on success and error code otherwise.
   1015  */
   1016 extern int
   1017 bcmint_ltsw_field_profile_add_ref(int unit, int index, int ref_count,
   1018         ltsw_field_profile_info_t *pinfo);
   1019 
   1020 /*!
   1021  * \brief Delete profile.
   1022  *
   1023  * If the entry is referred by more than one soure, just decreament ref count.
   1024  *
   1025  * \param [in] unit Unit number.
   1026  * \param [in] stage_id Stage Id.
   1027  * \param [in] index Index of the first entry to be deleted.
   1028  * \param [in] pinfo Profile information.
   1029  *
   1030  * \return SHR_E_NONE on success and error code otherwise.
   1031  */
   1032 extern int
   1033 bcmint_ltsw_field_profile_delete(int unit,
   1034         bcmi_ltsw_field_stage_t stage_id, int index,
   1035         ltsw_field_profile_info_t *pinfo);
   1036 
   1037 /*!
   1038  * \brief Recover hash and reference count for profile.
   1039  *
   1040  * Hash is recovered from HW. Reference count is always increamented.
   1041  *
   1042  * \param [in] unit Unit number.
   1043  * \param [in] stage_id Stage Id.
   1044  * \param [in] index Profile index to be recovered.
   1045  * \param [in] pinfo Profile information.
   1046  *
   1047  * \return SHR_E_NONE on success and error code otherwise.
   1048  */
   1049 extern int
   1050 bcmint_ltsw_field_profile_recover(int unit,
   1051         bcmi_ltsw_field_stage_t stage_id,
   1052         int index,
   1053         ltsw_field_profile_info_t *pinfo);
   1054 
   1055 /*!
   1056  * \brief Compare profile set.
   1057  *
   1058  * Compare if given profile entries equals to the entries in LT.
   1059  *
   1060  * \param [in] unit Unit number.
   1061  * \param [in] entries First profile entry in the set.
   1062  * \param [in] index Profile table index to be compared.
   1063  * \param [in] pinfo Profile information.
   1064  * \param [out] cmp 0 if equal, otherwise not equal.
   1065  *
   1066  * \return SHR_E_NONE on success and error code otherwise.
   1067  */
   1068 extern int
   1069 bcmint_ltsw_field_ingress_profile_cmp(int unit,
   1070         void *entries, int index,
   1071         ltsw_field_profile_info_t *pinfo, int *cmp);
   1072 
   1073 /******************************************************************************
   1074  * Internal Field Module Functions
   1075  */
   1076 extern int
   1077 bcmint_field_control_get(int unit, bcmint_field_control_info_t **fc);
   1078 
   1079 extern int
   1080 bcmint_field_stage_info_get(int unit,
   1081                             bcmi_ltsw_field_stage_t stage_id,
   1082                             bcmint_field_stage_info_t **stage_info);
   1083 
   1084 extern bool
   1085 bcmint_field_map_supported(int unit,
   1086                            bcmint_field_stage_info_t *stage_info,
   1087                            bcm_field_qual_map_info_t map);
   1088 extern int
   1089 bcmint_field_stage_compress_type_init(int unit,
   1090                            bcmint_field_stage_info_t *stage_info);
   1091 extern int
   1092 bcmint_field_qual_map_find(int unit,
   1093                            bcmi_field_qualify_t qual,
   1094                            bcmint_field_stage_info_t *stage_info,
   1095                            bool presel,
   1096                            bool group,
   1097                            int *map_count,
   1098                            bcm_field_qual_map_t **lt_map);
   1099 
   1100 extern int
   1101 bcmint_field_group_oper_lookup(
   1102     int unit,
   1103     int group_id,
   1104     bcmint_field_stage_info_t *stage_info,
   1105     bcmi_field_ha_group_oper_t **group_oper);
   1106 extern int
   1107 bcmint_field_entry_oper_lookup(
   1108     int unit,
   1109     int group_id,
   1110     bcmint_field_stage_info_t *stage_info,
   1111     bcmi_field_ha_entry_oper_t **entry_oper);
   1112 extern int
   1113 bcmint_field_stage_from_entry_get(int unit,
   1114                                   bcm_field_entry_t entry,
   1115                                   bcmint_field_stage_info_t **stage_info);
   1116 extern int
   1117 bcmint_field_stage_from_group_get(int unit, bcm_field_group_t group,
   1118                                   bcmint_field_stage_info_t **stage_info);
   1119 extern int
   1120 bcmint_field_group_stage_based_id_get(int unit,
   1121                                       bcmi_ltsw_field_stage_t stage_id,
   1122                                       bcm_field_group_t group_id,
   1123                                       bcm_field_group_t *stage_base_group_id);
   1124 extern int
   1125 bcmint_field_entry_stage_based_id_get(int unit,
   1126                                       bcmi_ltsw_field_stage_t stage_id,
   1127                                       bcm_field_entry_t entry_id,
   1128                                       bcm_field_entry_t *stage_base_entry_id);
   1129 extern int
   1130 bcmint_field_hint_init(int unit);
   1131 
   1132 extern int
   1133 bcmint_field_hint_cleanup(int unit);
   1134 
   1135 extern int
   1136 bcmint_field_hints_create(int unit, bcm_field_hintid_t *hint_id);
   1137 
   1138 extern int
   1139 bcmint_field_hints_destroy(int unit, bcm_field_hintid_t hint_id);
   1140 
   1141 extern int
   1142 bcmint_field_hints_add(int unit,
   1143                        bcm_field_hintid_t hint_id,
   1144                        bcm_field_hint_t *hint);
   1145 
   1146 extern int
   1147 bcmint_field_hints_get(int unit,
   1148                        bcm_field_hintid_t hint_id,
   1149                        bcm_field_hint_t *hint);
   1150 
   1151 extern int
   1152 bcmint_field_hints_delete(int unit,
   1153                           bcm_field_hintid_t hint_id,
   1154                           bcm_field_hint_t *hint);
   1155 
   1156 extern int
   1157 bcmint_field_hints_delete_all(int unit,
   1158                               bcm_field_hintid_t hint_id);
   1159 
   1160 extern int
   1161 bcmint_field_hint_group_count_update(int unit,
   1162                                      bcm_field_hintid_t hint_id,
   1163                                      uint8 action);
   1164 extern int
   1165 bcmint_field_hints_group_qual_value_update(int unit,
   1166                                            bcm_field_hintid_t hint_id,
   1167                                            uint8_t *qual_hint_extracted,
   1168                                            int qual_idx,
   1169                                            int width,
   1170                                            int map_offset,
   1171                                            uint64_t *max_value);
   1172 
   1173 extern int
   1174 bcmint_field_group_udf_qset_bitmap_alloc(int unit,
   1175     bcmi_field_udf_qset_bitmap_t **udf_qset_bitmap);
   1176 
   1177 extern int
   1178 bcmint_field_group_udf_qset_bitmap_free(int unit,
   1179     bcmi_field_udf_qset_bitmap_t **udf_qset_bitmap);
   1180 
   1181 extern int
   1182 bcmint_field_group_udf_qset_bitmap_update(int unit,
   1183     bcm_field_hintid_t hint_id,
   1184     bcm_udf_id_t udf_id,
   1185     bcm_field_qset_t *udf_qset,
   1186     bcmi_field_udf_qset_bitmap_t *udf_qset_bitmap);
   1187 
   1188 extern int
   1189 bcmint_field_hint_dump(int unit, bcm_field_hintid_t hint_id);
   1190 
   1191 extern int
   1192 bcmint_field_hint_dump_all(int unit);
   1193 
   1194 extern int
   1195 bcmint_field_group_udf_qset_update_with_hints(
   1196     int unit,
   1197     bcm_field_hintid_t hintid,
   1198     bcm_field_qset_t *qset,
   1199     bcm_field_qset_t *udf_qset,
   1200     bcmi_field_udf_qset_bitmap_t *udf_qset_bitmap);
   1201 
   1202 extern int
   1203 bcmint_field_process_group_qset(int unit,
   1204                                 bcm_field_qset_t *qset,
   1205                                 bcm_field_hintid_t hintid,
   1206                                 bcmint_field_stage_info_t *stage_info,
   1207                                 uint8 set_qual_bitmap,
   1208                                 bool is_presel_grp,
   1209                                 bcmlt_entry_handle_t *group_template);
   1210 extern int
   1211 bcmint_field_process_group_aset(int unit,
   1212                                 bcmint_field_stage_info_t *stage_info,
   1213                                 uint8 set_action_bitmap,
   1214                                 int act_pipe,
   1215                                 const bcm_field_aset_t *aset,
   1216                                 bcm_field_hintid_t hintid,
   1217                                 bcmlt_entry_handle_t *pdd_template,
   1218                                 int policer_pool_id,
   1219                                 int *color_pdd_idx);
   1220 extern int
   1221 bcmint_field_group_config_create(int unit,
   1222                                  bcm_field_group_config_t *group_config,
   1223                                  uint32 flags);
   1224 extern int
   1225 bcmint_field_group_entries_remove(int unit,
   1226                           bcm_field_group_t group);
   1227 extern int
   1228 bcmint_field_group_destroy(int unit,
   1229                            bcm_field_group_t group);
   1230 extern int
   1231 bcmint_field_group_destroy_all(int unit,
   1232                                bcmint_field_stage_info_t *stage_info);
   1233 extern int
   1234 bcmint_field_strength_destroy_all(int unit,
   1235                                   bcmint_field_stage_info_t *stage_info);
   1236 extern int
   1237 bcmint_field_group_presel_get(int unit,
   1238                               bcm_field_group_t group,
   1239                               bcm_field_presel_set_t *presel);
   1240 extern int
   1241 bcmint_field_group_presel_set(int unit,
   1242                               bcm_field_group_t group,
   1243                               bcm_field_presel_set_t *presel);
   1244 extern int
   1245 bcmint_field_group_qset_get(int unit,
   1246                             bcm_field_group_t group,
   1247                             bcm_field_qset_t *qset);
   1248 extern int
   1249 bcmint_field_group_qset_set(int unit,
   1250                             bcm_field_group_t group,
   1251                             bcm_field_qset_t qset);
   1252 extern int
   1253 bcmint_field_group_aset_get(int unit,
   1254                             bcm_field_group_t group,
   1255                             bcm_field_aset_t *aset);
   1256 extern int
   1257 bcmint_field_group_aset_set(int unit,
   1258                             bcm_field_group_t group,
   1259                             bcm_field_aset_t aset);
   1260 extern int
   1261 bcmint_field_group_mode_auto_get(int unit,
   1262                                 bcm_field_group_t group,
   1263                                 bool *mode_auto);
   1264 extern int
   1265 bcmint_field_group_priority_get(int unit,
   1266                                 bcm_field_group_t group,
   1267                                 int *prio);
   1268 extern int
   1269 bcmint_field_group_priority_set(int unit,
   1270                                 bcm_field_group_t group,
   1271                                 int prio);
   1272 extern int
   1273 bcmint_field_group_enable_get(int unit,
   1274                               bcm_field_group_t group,
   1275                               int *enable);
   1276 extern int
   1277 bcmint_field_group_enable_set(int unit,
   1278                               bcm_field_group_t group,
   1279                               int enable);
   1280 extern int
   1281 bcmint_field_group_mode_get(int unit,
   1282                             bcm_field_group_t group,
   1283                             bcm_field_group_mode_t *mode);
   1284 extern int
   1285 bcmint_field_entry_config_create(int unit,
   1286                                  bcm_field_entry_config_t *entry_config);
   1287 extern int
   1288 bcmint_field_entry_config_get(int unit,
   1289                                  bcm_field_entry_config_t *entry_config);
   1290 extern int
   1291 bcmint_field_entry_destroy(int unit,
   1292                            bcm_field_entry_t entry,
   1293                            bcmi_field_ha_entry_oper_t *entry_oper);
   1294 extern int
   1295 bcmint_field_entry_destroy_all(int unit, bcm_field_group_t group);
   1296 
   1297 extern int
   1298 bcmint_field_entry_install(int unit,
   1299                            bcm_field_entry_t entry);
   1300 extern int
   1301 bcmint_field_entry_prio_get(int unit,
   1302                             bcm_field_entry_t entry,
   1303                             int *prio);
   1304 extern int
   1305 bcmint_field_entry_prio_set(int unit,
   1306                               bcm_field_entry_t entry,
   1307                               int prio);
   1308 extern int
   1309 bcmint_field_entry_enable_get(int unit,
   1310                               bcm_field_entry_t entry,
   1311                               int *enable_flag);
   1312 extern int
   1313 bcmint_field_entry_enable_set(int unit,
   1314                               bcm_field_entry_t entry,
   1315                               int enable_flag);
   1316 extern int
   1317 bcmint_field_stage_from_presel_get(int unit,
   1318                                   bcm_field_presel_t presel_id,
   1319                                   bcmint_field_stage_info_t **stage_info);
   1320 extern int
   1321 bcmint_field_presel_create_stage_id(int unit,
   1322                                     bcm_field_stage_t stage,
   1323                                     bcm_field_presel_t presel_id);
   1324 extern int
   1325 bcmint_field_presel_config_create(int unit,
   1326                                    bcm_field_presel_config_t *presel_config);
   1327 extern int
   1328 bcmint_field_presel_entry_destroy(int unit,
   1329                             bcm_field_presel_t presel_entry);
   1330 extern int
   1331 bcmint_field_group_ports_get(int unit,
   1332                              bcm_field_group_t group,
   1333                              bcm_pbmp_t *pbmp);
   1334 extern int
   1335 bcmint_field_group_traverse(int unit,
   1336                             bcm_field_group_traverse_cb callback,
   1337                             void *user_data);
   1338 extern int
   1339 bcmint_field_group_oper_mode_get(
   1340     int unit,
   1341     bcm_field_qualify_t stage,
   1342     bcm_field_group_oper_mode_t *mode);
   1343 extern int
   1344 bcmint_field_entry_flexctr_attach(int unit,
   1345                                   bcm_field_entry_t entry,
   1346                                   bcm_field_flexctr_config_t *flexctr_cfg);
   1347 extern int
   1348 bcmint_field_entry_flexctr_detach(int unit,
   1349                                   bcm_field_entry_t entry,
   1350                                   bcm_field_flexctr_config_t *flexctr_cfg);
   1351 
   1352 extern int
   1353 bcmint_field_entry_policer_attach(int unit,
   1354                                   bcm_field_entry_t entry,
   1355                                   int level,
   1356                                   bcm_policer_t policer_id);
   1357 extern int
   1358 bcmint_field_entry_policer_detach(int unit,
   1359                                   bcm_field_entry_t entry,
   1360                                   int level);
   1361 extern int
   1362 bcmint_field_entry_policer_detach_all(int unit,
   1363                                       bcm_field_entry_t entry);
   1364 extern int
   1365 bcmint_field_entry_policer_get(int unit,
   1366                                bcm_field_entry_t entry,
   1367                                int level,
   1368                                bcm_policer_t *policer_id);
   1369 extern int
   1370 bcmint_field_entry_policer_update_all(int unit,
   1371                                       bcm_policer_t policer_id,
   1372                                       uint8_t in_use);
   1373 extern int
   1374 bcmint_field_entry_policer_update(int unit,
   1375                                   bcmint_field_stage_info_t *stage_info,
   1376                                   bcmi_field_ha_entry_oper_t *entry_oper,
   1377                                   bcm_policer_t policer_id);
   1378 extern int
   1379 bcmint_field_entry_multi_get(
   1380     int unit,
   1381     bcm_field_group_t group,
   1382     int entry_size,
   1383     bcm_field_entry_t *entry_array,
   1384     int *entry_count);
   1385 extern int
   1386 bcmint_field_entry_remove(int unit,
   1387                           bcmint_field_stage_info_t *stage_info,
   1388                           int entry_id);
   1389 
   1390 extern int
   1391 bcmint_field_action_entry_update(int unit,
   1392                                  bcmi_field_ha_entry_oper_t *entry_oper,
   1393                                  bcm_field_action_t action,
   1394                                  bool add);
   1395 /* Field Action Internal API - Start */
   1396 extern int
   1397 bcmint_field_action_map_find(int unit,
   1398                              bcm_field_action_t action,
   1399                              bcmint_field_stage_info_t *stage_info,
   1400                              const bcm_field_action_map_t **lt_map);
   1401 extern int
   1402 bcmint_field_action_mirror_gport_get(int unit,
   1403                                      bcm_field_entry_t entry,
   1404                                      bcmint_field_stage_info_t *stage_info,
   1405                                      bcm_field_action_t action,
   1406                                      uint32 *mirror_gport,
   1407                                      int *num_gports);
   1408 extern int
   1409 bcmint_field_action_mirror_set(int unit,
   1410                                bcm_field_entry_t entry,
   1411                                bcmint_field_stage_info_t *stage_info,
   1412                                bcm_field_action_t action,
   1413                                bcm_field_action_params_t *params);
   1414 extern int
   1415 bcmint_ltsw_field_entry_action_present(
   1416         int unit,
   1417         bcm_field_action_t action,
   1418         bcmi_field_ha_entry_oper_t *entry_oper,
   1419         bool *is_action_found);
   1420 
   1421 extern int
   1422 bcmint_field_action_config_info_add(int unit,
   1423                                     bcm_field_entry_t entry,
   1424                                     bcm_field_action_t action,
   1425                                     bcm_field_action_params_t *params,
   1426                                     bcm_field_action_match_config_t *match_config);
   1427 extern int
   1428 bcmint_field_action_config_info_get(int unit,
   1429                                     bcm_field_entry_t entry,
   1430                                     bcm_field_action_t action,
   1431                                     uint64_t *action_lt_val,
   1432                                     bcm_field_action_params_t *params,
   1433                                     bcm_field_action_match_config_t *match_config);
   1434 extern int
   1435 bcmint_field_action_delete(int unit,
   1436                            bcm_field_entry_t entry,
   1437                            bcm_field_action_t action,
   1438                            uint32 param0, uint32 param1,
   1439                            int no_param);
   1440 extern int
   1441 bcmint_field_action_delete_all(int unit,
   1442                                bcm_field_entry_t entry);
   1443 /* Field Action Internal API - End */
   1444 
   1445 extern int
   1446 bcmint_field_lt_entry_commit(int unit,
   1447                              bcmlt_entry_handle_t *template,
   1448                              bcmlt_opcode_t operation,
   1449                              bcmlt_priority_level_t priority,
   1450                              char *table_name,
   1451                              char *key_name,
   1452                              bool key_symbol,
   1453                              uint64_t key_val,
   1454                              char *key_str,
   1455                              char *field_name,
   1456                              uint64_t field_val,
   1457                              uint32_t start_idx,
   1458                              uint32_t num_element,
   1459                              int free_template);
   1460 extern int
   1461 bcmint_field_entry_copy(int unit,
   1462                         bcm_field_entry_t src_entry,
   1463                         bcm_field_entry_t *dst_entry,
   1464                         uint32 flags);
   1465 extern int
   1466 bcmint_field_presel_default_group_create(
   1467     int unit,
   1468     bcmint_field_stage_info_t *stage_info,
   1469     int *presel_group);
   1470 extern int
   1471 bcmint_field_presel_default_group_destroy(
   1472     int unit,
   1473     bcmint_field_stage_info_t *stage_info);
   1474 extern int
   1475 bcmint_field_presel_group_config_create(
   1476     int unit,
   1477     bcm_field_presel_group_config_t *group_config);
   1478 extern int
   1479 bcmint_field_presel_group_destroy(
   1480     int unit,
   1481     bcm_field_group_t presel_group);
   1482 extern int
   1483 bcmint_field_group_stage_get(int unit,
   1484                              bcm_field_qset_t *qset_p,
   1485                              bcmi_ltsw_field_stage_t *stage);
   1486 extern int
   1487 bcmint_field_qset_is_subset(int unit,
   1488                             const bcm_field_qset_t *qset_1,
   1489                             bcmint_field_stage_info_t *stage_info,
   1490                             bool presel,
   1491                             uint16_t *qual_count);
   1492 extern int
   1493 bcmint_field_qset_id_multi_set(
   1494     int unit,
   1495     bcm_field_qualify_t qual,
   1496     int num_objects,
   1497     int objects_list[],
   1498     bcm_field_qset_t *qset);
   1499 
   1500 extern int
   1501 bcmint_field_qset_id_multi_get(
   1502     int unit,
   1503     bcm_field_qset_t qset,
   1504     bcm_field_qualify_t qual,
   1505     int max,
   1506     int *objects_list,
   1507     int *actual);
   1508 
   1509 extern int
   1510 bcmint_field_qset_id_multi_delete(
   1511     int unit,
   1512     bcm_field_qualify_t qual,
   1513     int num_objects,
   1514     int objects_list[],
   1515     bcm_field_qset_t *qset);
   1516 extern int
   1517 bcmint_field_group_mode_validate(int unit,
   1518                                  bcmlt_entry_handle_t grp_template,
   1519                                  bcm_field_group_mode_t mode,
   1520                                  char **group_mode);
   1521 extern int
   1522 bcmint_field_find_is_subset_qset(
   1523         const bcm_field_qset_t *qset_1,
   1524         const bcm_field_qset_t *qset_2);
   1525 
   1526 extern int
   1527 bcmint_field_oper_mode_status_get(
   1528     int unit,
   1529     bcmint_field_stage_info_t *stage_info,
   1530     int *mode);
   1531 extern int
   1532 bcmint_field_group_oper_remove_all(
   1533     int unit,
   1534     bcmint_field_stage_info_t *stage_info);
   1535 extern int
   1536 bcmint_field_entry_oper_remove_all(
   1537     int unit,
   1538     bcmint_field_stage_info_t *stage_info);
   1539 extern int
   1540 bcmint_field_presel_oper_remove_all(
   1541     int unit,
   1542     bcmint_field_stage_info_t *stage_info);
   1543 extern int
   1544 bcmint_field_group_strength_reinit(
   1545     int unit,
   1546     bcmint_field_stage_info_t *stage_info);
   1547 
   1548 extern bcmi_ltsw_field_db_t bcmi_ltsw_field_db[BCM_MAX_NUM_UNITS];
   1549 
   1550 /*! Field mutex lock. */
   1551 #define FP_LOCK(unit) \
   1552     do { \
   1553         if (bcmi_ltsw_field_db[unit].lock) { \
   1554             sal_mutex_take(bcmi_ltsw_field_db[unit].lock, SAL_MUTEX_FOREVER); \
   1555         } \
   1556     } while(0)
   1557 
   1558 /*! Field mutex unlock. */
   1559 #define FP_UNLOCK(unit) \
   1560     do { \
   1561         if (bcmi_ltsw_field_db[unit].lock) { \
   1562             sal_mutex_give(bcmi_ltsw_field_db[unit].lock); \
   1563         } \
   1564     } while(0)
   1565 
   1566 extern int
   1567 bcmint_field_stage_enum_info_get(
   1568         int unit,
   1569         bcm_field_stage_t stage,
   1570         bcmint_field_stage_info_t **stage_info);
   1571 
   1572 extern int
   1573 bcmint_ltsw_field_source_class_mode_get(
   1574         int unit,
   1575         bcm_field_stage_t stage_id,
   1576         bcm_pbmp_t pbmp,
   1577         bcm_field_src_class_mode_t *mode);
   1578 
   1579 extern int
   1580 bcmint_ltsw_field_source_class_mode_set(
   1581         int unit,
   1582         bcm_field_stage_t stage_id,
   1583         bcm_pbmp_t pbmp,
   1584         bcm_field_src_class_mode_t mode);
   1585 
   1586 extern int
   1587 bcmint_ltsw_field_qualify_MixedSrcClassId(
   1588         int unit,
   1589         bcm_field_entry_t entry,
   1590         bcm_pbmp_t pbmp,
   1591         bcm_field_src_class_t data,
   1592         bcm_field_src_class_t mask);
   1593 
   1594 extern int
   1595 bcmint_ltsw_field_qualify_MixedSrcClassId_get(
   1596         int unit,
   1597         bcm_field_entry_t entry,
   1598         bcm_pbmp_t pbmp,
   1599         bcm_field_src_class_t *data,
   1600         bcm_field_src_class_t *mask);
   1601 
   1602 extern int
   1603 bcmint_field_action_internal_map_set(int unit,
   1604         uint8_t set_int_val,
   1605         bcm_field_action_t action,
   1606         bcmlt_entry_handle_t action_template_hdl,
   1607         bcmlt_entry_handle_t action_lookup_template_hdl,
   1608         bcmint_field_stage_info_t *stage_info,
   1609         const bcm_field_action_map_info_t *map,
   1610         uint32_t start_idx,
   1611         uint32_t num_elem,
   1612         bool map_val_valid,
   1613         uint32_t *map_val);
   1614 
   1615 extern int
   1616 bcmint_field_group_action_strength_get(
   1617     int unit,
   1618     bcmint_field_stage_info_t *stage_info,
   1619     int pipe,
   1620     int group_prio,
   1621     bcm_field_action_t action,
   1622     uint32_t *strength);
   1623 
   1624 extern int
   1625 bcmint_field_group_policer_pool_alloc(
   1626     int unit,
   1627     bcmint_field_stage_info_t *stage_info,
   1628     int group_pipe,
   1629     int group_priority,
   1630     int *pool_id);
   1631 
   1632 extern int
   1633 bcmint_field_group_policer_pool_free(
   1634     int unit,
   1635     bcmint_field_stage_info_t *stage_info,
   1636     int pipe,
   1637     int pool_id);
   1638 extern int
   1639 bcmint_field_group_pipe_get(
   1640     int unit,
   1641     bcmint_field_stage_info_t *stage_info,
   1642     bcmi_field_ha_group_oper_t *group_oper,
   1643     int *pipe);
   1644 
   1645 extern int
   1646 bcmint_field_comp_oper_mode_status_get(
   1647     int unit,
   1648     bcmint_field_control_info_t *fp_control,
   1649     int *mode);
   1650 
   1651 extern int
   1652 bcmint_field_presel_action_get(int unit,
   1653                                     bcm_field_entry_t entry,
   1654                                     bcm_field_action_t action,
   1655                                     bcm_field_action_params_t *params);
   1656 
   1657 extern int
   1658 bcmint_field_presel_oper_lookup(
   1659     int unit,
   1660     int presel_entry_id,
   1661     bcmint_field_stage_info_t *stage_info,
   1662     bcmi_field_ha_presel_oper_t **presel_oper);
   1663 
   1664 extern int
   1665 bcmint_field_group_primary_slice_id_get(
   1666         int unit,
   1667         bcm_field_group_t group,
   1668         uint32_t *slice_id);
   1669 
   1670 extern int
   1671 bcmint_field_flexctr_group_object_get(int unit,
   1672         bcm_field_group_t group,
   1673         uint32_t *flex_ctr_obj_id);
   1674 extern int
   1675 bcmint_field_group_entry_strength_update(
   1676     int unit,
   1677     bcmint_field_stage_info_t *stage_info,
   1678     bcmi_field_ha_group_oper_t *grp_oper,
   1679     int curr_grp_prio);
   1680 extern int
   1681 bcmint_field_group_strength_prof_create(
   1682     int unit,
   1683     bcmint_field_stage_info_t *stage_info,
   1684     int pipe,
   1685     int group_priority,
   1686     int hintid,
   1687     int policer_pool_id,
   1688     bcm_field_aset_t *aset,
   1689     uint64_t *strength_prof_id,
   1690     int *color_sbr_idx);
   1691 extern int
   1692 bcmint_field_group_strength_prof_destroy(
   1693     int unit,
   1694     bcmint_field_stage_info_t *stage_info,
   1695     int pipe,
   1696     int group_priority,
   1697     uint32 strength_prof_id,
   1698     int color_sbr_idx);
   1699 extern int
   1700 bcmint_field_action_strength_aset_get(
   1701     int unit,
   1702     bcmint_field_stage_info_t *stage_info,
   1703     bcmi_field_aset_t *aset,
   1704     bcmi_field_aset_t *sbr_aset,
   1705     uint8_t *a_cnt,
   1706     bcmi_field_aset_t *sbr_color_aset,
   1707     uint8_t *color_a_cnt);
   1708 extern int
   1709 bcmint_field_entry_strength_aset_create(
   1710     int unit,
   1711     bcmint_field_stage_info_t *stage_info,
   1712     bcmi_field_ha_group_oper_t *grp_oper,
   1713     bcmi_field_ha_entry_oper_t *entry_oper,
   1714     bcm_field_aset_t *new_aset,
   1715     bool install);
   1716 extern int
   1717 bcmint_field_action_color_set(
   1718     int unit,
   1719     bcmint_field_stage_info_t *stage_info,
   1720     bcmi_field_ha_group_oper_t *group_oper,
   1721     bcmi_field_ha_entry_oper_t *entry_oper,
   1722     int pipe,
   1723     bcm_field_action_t action,
   1724     bcm_field_action_params_t *params);
   1725 extern int
   1726 bcmint_field_action_color_get(
   1727     int unit,
   1728     bcmint_field_stage_info_t *stage_info,
   1729     bcmi_field_ha_group_oper_t *group_oper,
   1730     bcmi_field_ha_entry_oper_t *entry_oper,
   1731     int pipe,
   1732     bcm_field_action_t action,
   1733     uint64_t *param);
   1734 extern int
   1735 bcmint_field_action_color_pdd_sbr_set(
   1736     int unit,
   1737     bcmint_field_stage_info_t *stage_info,
   1738     bcmi_field_ha_group_oper_t *group_oper,
   1739     bcmi_field_ha_entry_oper_t *entry_oper,
   1740     int pipe,
   1741     bcm_field_action_t action);
   1742 extern int
   1743 bcmint_field_color_profile_id_alloc(
   1744     int unit,
   1745     char *tbl_name,
   1746     char *key_name,
   1747     char *pipe_name,
   1748     bcmlt_entry_handle_t entry_hdl,
   1749     int pipe,
   1750     int pool,
   1751     int max_pools,
   1752     bcmi_field_ha_profile_info_t *profile_ptr,
   1753     int curr_id,
   1754     int *alloc_id,
   1755     bool *insert);
   1756 extern int
   1757 bcmint_field_color_profile_id_free(
   1758     int unit,
   1759     char *tbl_name,
   1760     int pipe,
   1761     bcmi_field_ha_profile_info_t *profile_ptr,
   1762     int free_id,
   1763     int pool,
   1764     int max_pools,
   1765     bool *delete);
   1766 extern int
   1767 bcmint_field_action_color_remove(
   1768     int unit,
   1769     bcmint_field_stage_info_t *stage_info,
   1770     bcmi_field_ha_group_oper_t *group_oper,
   1771     bcmi_field_ha_entry_oper_t *entry_oper,
   1772     int pipe,
   1773     bcm_field_action_t action);
   1774 extern int
   1775 bcmint_field_action_color_pdd_sbr_remove(
   1776     int unit,
   1777     bcmint_field_stage_info_t *stage_info,
   1778     bcmi_field_ha_group_oper_t *group_oper,
   1779     bcmi_field_ha_entry_oper_t *entry_oper,
   1780     int pipe,
   1781     bcm_field_action_t action);
   1782 extern int
   1783 bcmint_field_qual_internal_map_set(int unit,
   1784                                 bool group,
   1785                                 uint8_t set_int_val,
   1786                                 bcm_field_qualify_t qual,
   1787                                 bcmlt_entry_handle_t qual_template_hdl,
   1788                                 bcmlt_entry_handle_t qual_template_lkup_hdl,
   1789                                 bcmint_field_stage_info_t *stage_info,
   1790                                 const bcm_field_qual_map_info_t *map,
   1791                                 uint32_t start_idx,
   1792                                 uint32_t num_elem);
   1793 
   1794 extern int
   1795 bcmi_field_flex_counter_info_get(
   1796     int unit,
   1797     bcmi_field_ha_entry_oper_t *entry_oper,
   1798     bcmi_field_ha_group_oper_t *group_oper,
   1799     bcmint_field_stage_info_t *stage_info,
   1800     uint64_t *counter_id,
   1801     uint64_t *gp_counter_id,
   1802     uint64_t *rp_counter_id,
   1803     uint64_t *yp_counter_id);
   1804 
   1805 extern int
   1806 bcmint_field_color_action_mode_get(int unit,
   1807                                    bcmint_field_stage_info_t *stage_info,
   1808                                    int *mode);
   1809 extern int
   1810 bcmint_field_color_action_pipe_get(int unit,
   1811                                    bcmint_field_stage_info_t *stage_info,
   1812                                    bcm_field_group_t group,
   1813                                    int *pipe);
   1814 extern int
   1815 bcmint_field_stage_aset_get(
   1816     int unit,
   1817     bcm_field_stage_t stage,
   1818     bcm_field_aset_t *aset);
   1819 extern int
   1820 bcmint_field_action_cont_info_get(
   1821     int unit,
   1822     bcm_field_stage_t stage,
   1823     bcm_field_action_t action,
   1824     uint8_t max_ct,
   1825     uint16_t *cont_id_arr,
   1826     uint16_t *cont_size_arr,
   1827     uint8_t *actual_ct,
   1828     uint8_t *action_size);
   1829 extern int
   1830 bcmint_field_presel_entry_prio_set(
   1831     int unit,
   1832     bcm_field_entry_t entry, int prio);
   1833 extern int
   1834 bcmint_field_hints_destroy_all(int unit);
   1835 extern int
   1836 bcmint_field_presel_entry_destroy_all(
   1837     int unit,
   1838     bcmint_field_stage_info_t *stage_info);
   1839 extern int
   1840 bcmint_field_flexctr_valid_action_get(
   1841     int unit,
   1842     bcmint_field_stage_info_t *stage_info,
   1843     int hintid,
   1844     bcmi_field_aset_t *aset,
   1845     int max_action_cnt,
   1846     bcmi_field_action_t *action_arr,
   1847     int *action_cnt);
   1848 extern int
   1849 bcmint_field_entry_strength_action_update(
   1850     int unit,
   1851     bcmint_field_stage_info_t *stage_info,
   1852     bcmi_field_ha_group_oper_t *group_oper,
   1853     bcmi_field_ha_entry_oper_t *entry_oper,
   1854     bcm_field_action_t action,
   1855     const bcm_field_action_map_t *lt_map_ref,
   1856     bool add);
   1857 extern int
   1858 bcmint_field_presel_qset_get(
   1859     int unit,
   1860     bcmi_ltsw_field_stage_t stage_id,
   1861     int presel_id,
   1862     bool presel_grp_info,
   1863     bcm_field_qset_t *pqset);
   1864 
   1865 extern int
   1866 bcmint_presel_qual_validate(
   1867     int unit,
   1868     bcmint_field_stage_info_t *stage_info,
   1869     int presel_grp_id,
   1870     int presel_entry_id);
   1871 #endif /* BCMINT_LTSW_FIELD_INT_H */