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.c (2051180B)


      1 /* 
      2  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      3  * 
      4  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      5  *
      6  * Module: Field Processor APIs
      7  *
      8  * Purpose:
      9  *     API for Field Processor (FP) for XGS3 family and later.
     10  */
     11 /**/
     12 #include <shared/bsl.h>
     13 #include <soc/drv.h>
     14 #include <soc/scache.h>
     15 #include <soc/cmic.h>
     16 #include <soc/field.h>
     17 #include <shared/pbmp.h>
     18 #include <bcm/field.h>
     19 #include <bcm/error.h>
     20 #include <bcm/mirror.h>
     21 #include <bcm/link.h>
     22 #include <bcm_int/esw/link.h>
     23 #include <bcm/l3.h>
     24 #include <bcm_int/esw/l3.h>
     25 
     26 #if defined(BCM_FIREBOLT_SUPPORT)
     27 #include <bcm_int/esw/firebolt.h>
     28 #endif
     29 
     30 #if defined(BCM_RAPTOR_SUPPORT)
     31 #include <bcm_int/esw/raptor.h>
     32 #endif
     33 
     34 #if defined(BCM_TRX_SUPPORT)
     35 #include <bcm_int/esw/trx.h>
     36 #endif
     37 
     38 #if defined(BCM_TRIUMPH_SUPPORT)
     39 #include <bcm_int/esw/triumph.h>
     40 #endif
     41 
     42 #if defined(BCM_HGPROXY_COE_SUPPORT)
     43 #include <bcm_int/esw/xgs5.h>
     44 #endif /* BCM_HGPROXY_COE_SUPPORT */
     45 
     46 #include <bcm_int/esw/policer.h>
     47 #include <bcm_int/esw/field.h>
     48 #include <bcm_int/esw/range.h>
     49 #include <bcm_int/esw/triumph2.h>
     50 #include <bcm_int/esw/triumph3.h>
     51 #include <bcm_int/esw/trident.h>
     52 #include <bcm_int/esw/katana.h>
     53 #include <bcm_int/esw/trident2.h>
     54 #include <bcm_int/esw/tomahawk.h>
     55 #include <bcm_int/esw/tomahawk2.h>
     56 #include <bcm_int/esw/tomahawk3.h>
     57 #include <bcm_int/common/multicast.h>
     58 
     59 #if defined(BCM_ENDURO_SUPPORT)
     60 #include <bcm_int/esw/enduro.h>
     61 #endif
     62 
     63 #if defined(BCM_HURRICANE_SUPPORT)
     64 #include <bcm_int/esw/hurricane.h>
     65 #endif
     66 
     67 #if defined(BCM_HURRICANE2_SUPPORT)
     68 #include <bcm_int/esw/hurricane2.h>
     69 #endif
     70 
     71 #if defined(BCM_KATANA2_SUPPORT)
     72 #include <bcm_int/esw/katana2.h>
     73 #endif /* BCM_KATANA2_SUPPORT */
     74 
     75 #if defined(BCM_SABER2_SUPPORT)
     76 #include <bcm_int/esw/saber2.h>
     77 #endif /* BCM_SABER2_SUPPORT */
     78 
     79 #include <bcm_int/esw/scorpion.h>
     80 #include <bcm_int/esw/trunk.h>
     81 #include <bcm_int/esw/mirror.h>
     82 #include <bcm_int/esw/stack.h>
     83 #include <bcm_int/esw/port.h>
     84 #include <bcm_int/control.h>
     85 #include <bcm_int/esw/virtual.h>
     86 #include <bcm_int/esw_dispatch.h>
     87 #include <bcm_int/esw/ecn.h>
     88 
     89 
     90 #if defined(BCM_ESW_SUPPORT) 
     91 #include <bcm_int/esw/flex_ctr.h>
     92 #include <bcm_int/esw/xgs4.h>
     93 #endif
     94 
     95 #ifdef BCM_GREYHOUND_SUPPORT
     96 #include <bcm_int/esw/greyhound.h>
     97 #endif /* BCM_GREYHOUND_SUPPORT */
     98 #ifdef BCM_HURRICANE3_SUPPORT
     99 #include <bcm_int/esw/hurricane3.h>
    100 #include <bcm_int/esw/flowcnt.h>
    101 #endif /* BCM_HURRICANE3_SUPPORT */
    102 #ifdef BCM_GREYHOUND2_SUPPORT
    103 #include <bcm_int/esw/greyhound2.h>
    104 #endif /* BCM_GREYHOUND2_SUPPORT */
    105 #if defined(INCLUDE_REGEX)
    106 #include <bcm_int/esw/bregex.h>
    107 #endif
    108 #include <bcm_int/esw/udf.h>
    109 #include <bcm_int/esw/udf_common.h>
    110 #ifdef BCM_HELIX5_SUPPORT
    111 #include <bcm_int/esw/helix5.h>
    112 #endif /* BCM_HELIX5_SUPPORT */
    113 
    114 #if defined(BCM_ESW_SUPPORT)
    115 #ifdef BCM_FIELD_SUPPORT 
    116 
    117 #define SAL_ALLOC_T(t, n)  ((t *) sal_alloc((n) * sizeof(t), " ")) /* <HP/> */
    118 
    119 #define BCM_POLICER_XGS_NOSUPPORT_FLAGS (BCM_POLICER_DROP_RED | \
    120                                          BCM_POLICER_MACRO    | \
    121                                          BCM_POLICER_EGRESS   | \
    122                                          BCM_POLICER_REPLACE_SHARED)
    123 /* used to store the modport type used for qualifiers SrcGPort and DstGPort */
    124 #define _BCM_GPORT_TYPE_MOD_PORT 100
    125 extern int
    126 _field_policers_hw_free_old(int unit, _field_entry_t *f_ent);
    127 extern int
    128 _bcm_field_entry_copy_id(int unit,
    129                             bcm_field_entry_t src_entry,
    130                             bcm_field_entry_t dst_entry,
    131                             uint32 flags);
    132 extern int
    133 _field_tcam_policy_install(int unit, bcm_field_entry_t entry);
    134 extern int
    135 _bcm_esw_field_group_dump(int unit, bcm_field_group_t group, int stage);
    136 
    137 /*
    138  * Macro:
    139  *     FIELD_IS_INIT (internal)
    140  * Purpose:
    141  *     Check that the unit is valid and confirm that the field functions
    142  *     are initialized.
    143  * Parameters:
    144  *     unit - BCM device number
    145  * Notes:
    146  *     Results in return(BCM_E_UNIT), return(BCM_E_UNAVAIL), or
    147  *     return(BCM_E_INIT) if fails.
    148  */
    149 #define FIELD_IS_INIT(unit)                                      \
    150     if (!soc_feature(unit, soc_feature_field)) {                 \
    151         return (BCM_E_UNAVAIL);                                  \
    152     }                                                            \
    153     if (_field_control[unit] == NULL) {                          \
    154         LOG_ERROR(BSL_LS_BCM_FP, \
    155                   (BSL_META("FP(unit %d) Error: not initialized\n"), \
    156                    unit));   \
    157         return (BCM_E_INIT);                                     \
    158     }
    159     
    160 /*
    161  * Local function prototypes
    162  */
    163 #ifdef BROADCOM_DEBUG
    164 extern char *_field_qual_name(bcm_field_qualify_t qid);
    165 extern char *_field_group_mode_name(uint32 group_flags);
    166 extern char* _field_stage_name(_field_stage_t *stage_fc);
    167 #endif /* BROADCOM_DEBUG */
    168 
    169 /*
    170  * Field control data, one per device.
    171  */
    172 extern _field_control_t         *_field_control[BCM_MAX_NUM_UNITS];
    173 
    174 /* Sw WorkAround for EgressPortsAdd Action */
    175 extern uint8                        _field_egr_ports_recovery_lock[BCM_MAX_NUM_UNITS];
    176 extern _field_egr_ports_recovery_t  *_field_egr_ports_recovery[BCM_MAX_NUM_UNITS];
    177 
    178 
    179 int
    180 bcm_esw_field_group_flush(int unit, bcm_field_group_t group)
    181 {
    182     return BCM_E_UNAVAIL;
    183 }
    184 
    185 /*
    186  * Function: bcm_field_entry_enable_set
    187  *
    188  * Purpose:
    189  *     Enable/Disable an entry from the hardware tables.
    190  *
    191  * Parameters:
    192  *     unit - BCM device number
    193  *     entry - Entry to be enabled/disabled
    194  *     enable_flag - Flag to enable or disable
    195  *
    196  * Returns:
    197  *     BCM_E_XXX
    198  *
    199  * Notes:
    200  *     This does not destroy the entry, nor deallocate any related resources;
    201  *     it only enables/disables a rule from hardware table using VALIDf of the
    202  *     corresponding hardware entry. To deallocate the memory used by the entry
    203  *     call bcm_field_entry_destroy.
    204  */
    205 int
    206 bcm_esw_field_entry_enable_set(int unit, bcm_field_entry_t entry, int enable_flag)
    207 {
    208     _field_control_t    *fc;         /* Field control structure. */
    209     _field_entry_t      *f_ent;      /* Field entry pointer.     */
    210     _field_stage_t      *stage_fc;   /* Stage field control.            */
    211     _field_group_t      *fg;         /* Field group structure.          */
    212     uint32              tcam_entry[SOC_MAX_MEM_FIELD_WORDS];
    213     int                 rv;          /* Operation return status. */
    214     int                 tcam_idx;
    215     soc_mem_t           mem = INVALIDm;
    216 
    217     LOG_DEBUG(BSL_LS_BCM_FP,
    218               (BSL_META_U(unit,
    219                           "FP(unit %d) vverb: bcm_field_entry_enable_set ("
    220                           "entry=%d, enable=%d)\n"), unit, entry, enable_flag));
    221 
    222     
    223     FP_LOCK(unit);
    224     rv = _field_control_get(unit, &fc);
    225     if (BCM_FAILURE(rv)) {
    226         FP_UNLOCK(unit);
    227         return rv;
    228     }
    229 
    230     rv = _bcm_field_entry_get_by_id(unit, entry, &f_ent);
    231     if (BCM_FAILURE(rv)) {
    232         FP_UNLOCK(unit);
    233         return (rv);
    234     }
    235 
    236     if (!(f_ent->flags & _FP_ENTRY_INSTALLED)) {
    237         FP_UNLOCK(unit);
    238         return (BCM_E_PARAM);
    239     }
    240 
    241     fg = f_ent->group;
    242 
    243     /* External stage entries are always enabled */
    244     if (_BCM_FIELD_STAGE_EXTERNAL == fg->stage_id) {
    245         /*
    246          * For external stage, there is no support in the hardware to enable
    247          * or disable the installed entry. It is always enabled.
    248          * So, error is returned when trying to disable the entry and
    249          * set the enable flag when trying to enable the entry.
    250          */
    251 
    252         if (enable_flag == 0) {
    253             LOG_ERROR(BSL_LS_BCM_FP,
    254                       (BSL_META_U(unit,
    255                                   "FP(unit %d) Error: bcm_esw_field_entry_enable_set"
    256                                    " Entry %d Disabling entry not supported for"
    257                                    " external stage\n"), unit, entry));
    258             FP_UNLOCK(unit);
    259             return (BCM_E_PARAM);
    260         }
    261 
    262         f_ent->flags |= _FP_ENTRY_ENABLED; 
    263         FP_UNLOCK(unit);
    264         return (BCM_E_NONE);
    265     }
    266 
    267     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
    268     if (BCM_FAILURE(rv)) {
    269     	FP_UNLOCK(unit);
    270         return rv;
    271     }
    272 
    273 #if defined(BCM_TOMAHAWK_SUPPORT)
    274         if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
    275             rv = fc->functions.fp_entry_enable(unit, f_ent, enable_flag);
    276             FP_UNLOCK(unit);
    277             return rv;
    278         }
    279 #endif /* BCM_TOMAHAWK_SUPPORT */
    280 
    281     if (_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id) {
    282         mem = FP_TCAMm;
    283 #if defined(BCM_FIREBOLT2_SUPPORT) || defined(BCM_TRX_SUPPORT) 
    284     } else if (soc_feature(unit, soc_feature_field_multi_stage)) {
    285         if (_BCM_FIELD_STAGE_LOOKUP  == stage_fc->stage_id) {
    286             mem = VFP_TCAMm;
    287         } else if (_BCM_FIELD_STAGE_EGRESS  == stage_fc->stage_id) {
    288             mem = EFP_TCAMm;
    289         } else {
    290             FP_UNLOCK(unit);
    291             return (BCM_E_INTERNAL);
    292         }
    293 #endif /* BCM_FIREBOLT2_SUPPORT || BCM_TRX_SUPPORT */
    294     } else {
    295         FP_UNLOCK(unit);
    296         return BCM_E_INTERNAL;
    297     }
    298 
    299     /* Get tcam indexes for installed entry. */
    300     rv = _bcm_field_entry_tcam_idx_get(unit, f_ent,
    301                                        &tcam_idx);
    302 
    303     if (BCM_FAILURE(rv)) {
    304         FP_UNLOCK(unit);
    305         return (rv);
    306     }
    307 
    308     rv = soc_mem_read(unit, mem, MEM_BLOCK_ANY, tcam_idx, tcam_entry);
    309     if (SOC_FAILURE(rv)) {
    310         FP_UNLOCK(unit);
    311         return (rv);
    312     }
    313 
    314     /* Set the VALIDf bits appropriately */
    315     if (enable_flag) {
    316         soc_mem_field32_set(unit, mem, tcam_entry, VALIDf, 3);
    317     } else {
    318         soc_mem_field32_set(unit, mem, tcam_entry, VALIDf, 2);
    319     }
    320 
    321     /* Write back the TCAM entry */
    322     rv = soc_mem_write(unit, mem, MEM_BLOCK_ALL, tcam_idx, tcam_entry);
    323     if (SOC_FAILURE(rv)) {
    324         FP_UNLOCK(unit);
    325         return (rv);
    326     }
    327 
    328     if (enable_flag) {
    329        f_ent->flags |= _FP_ENTRY_ENABLED; 
    330     }
    331     else {
    332         f_ent->flags &= ~_FP_ENTRY_ENABLED;
    333     }
    334 
    335 #ifdef BCM_WARM_BOOT_SUPPORT
    336     SOC_CONTROL_LOCK(unit);
    337     SOC_CONTROL(unit)->scache_dirty = 1;
    338     SOC_CONTROL_UNLOCK(unit);
    339 #endif
    340 
    341     FP_UNLOCK(unit);
    342     return (rv);
    343 }
    344 
    345 /*
    346  * Function: bcm_field_entry_enable_get
    347  *
    348  * Purpose:
    349  *     Get the Enable or Disable status of a field Entry.
    350  *
    351  * Parameters:
    352  *     unit - (IN)BCM device number
    353  *     entry - (IN)Entry to be checked for Enabled status
    354  *     enable_flag - (OUT)Status(Enable/Disable) of the given entry
    355  *
    356  * Returns:
    357  *     BCM_E_XXX
    358  */
    359 int
    360 bcm_esw_field_entry_enable_get(int unit, bcm_field_entry_t entry, int *enable_flag)
    361 {
    362     _field_entry_t      *f_ent;      /* Field entry pointer.     */
    363     int                 rv;          /* Operation return status. */
    364 
    365     LOG_DEBUG(BSL_LS_BCM_FP,
    366               (BSL_META_U(unit,
    367                           "FP(unit %d) vverb: bcm_field_entry_enable_get ("
    368                           "entry=%d)\n"), unit, entry));
    369 
    370     rv = _bcm_field_entry_get_by_id(unit, entry, &f_ent);
    371     if (BCM_FAILURE(rv)) {
    372         return (rv);
    373     }
    374 
    375     if (_BCM_FIELD_STAGE_EXACTMATCH == f_ent->group->stage_id) {
    376         return (BCM_E_UNAVAIL);
    377     }
    378 
    379     if (!(f_ent->flags & _FP_ENTRY_INSTALLED)) {
    380         return (BCM_E_PARAM);
    381     }
    382 
    383     *enable_flag = (f_ent->flags & _FP_ENTRY_ENABLED) ? 1 : 0;
    384     return (BCM_E_NONE);
    385 }
    386 
    387 
    388 /*
    389  * Function: bcm_esw_field_init
    390  *
    391  * Purpose:
    392  *    Initialize field module.
    393  *
    394  * Parameters:
    395  *     unit - (IN) BCM device number
    396  *
    397  * Returns:
    398  *     BCM_E_UNIT    - Invalid BCM unit number.
    399  *     BCM_E_UNAVAIL - Field Processor not on device.
    400  *     BCM_E_MEMORY  - Allocation failure
    401  *     BCM_E_XXX     - Error code from bcm_XX_field_init()
    402  *     BCM_E_NONE    - Success
    403  */
    404 int
    405 bcm_esw_field_init(int unit)
    406 {
    407     int  rv = BCM_E_NONE;
    408     FP_LOCK(unit);
    409     rv = _bcm_esw_field_init(unit);
    410     FP_UNLOCK(unit);
    411     return rv;
    412 }
    413 
    414 /*
    415  * Function: bcm_esw_field_stage_qset_get
    416  * Purpose:
    417  *     To list the qualifiers supported for a given stage
    418  * Parameters:
    419  *     unit - (IN) bcm device
    420  *     stage - (IN) stage for which the supported qset is requested
    421  *     presel - (IN) to return qualifiers supported for that presel stage.
    422  *                   0 - return stage qlist
    423  *                   1 - return qlist of presel for that stage
    424  *     qset - (OUT) Pointer to a qualifier set.
    425  *
    426  * Returns:
    427  *     BCM_E_NONE: If the aggregation group monitor creation is success.
    428  *     BCM_E_PARAM: If a wrong parameters are passed.
    429  *     BCM_E_UNAVAIL: if the sent stage is not supported.
    430  *     BCM_E_INTERNAL: if any internal error is encountered.
    431  */
    432 int
    433 bcm_esw_field_stage_qset_get(int unit, bcm_field_stage_t stage,
    434                           uint8 presel, bcm_field_qset_t *qset) {
    435     int                    rv;      /* Operation return status.    */
    436     _field_stage_t         *stage_fc;
    437     _field_stage_id_t stage_id;
    438 
    439     rv = BCM_E_NONE;
    440 
    441     /* Input parameters check. */
    442     if (qset == NULL) {
    443         return (BCM_E_PARAM);
    444     }
    445 
    446     if (presel == 1) {
    447 #if defined(BCM_TOMAHAWK_SUPPORT)
    448         if (!((soc_feature(unit, soc_feature_field_multi_pipe_support)) &&
    449             (soc_feature(unit, soc_feature_field_preselector_support)) &&
    450             ((stage == bcmFieldStageIngress) ||
    451              (stage == bcmFieldStageIngressExactMatch) ||
    452              (stage == bcmFieldStageIngressFlowtracker)))) {
    453             return BCM_E_PARAM;
    454         }
    455 #else
    456         return BCM_E_PARAM;
    457 #endif
    458     }
    459 
    460     switch (stage) {
    461         case bcmFieldStageIngress:
    462             stage_id = _BCM_FIELD_STAGE_INGRESS;
    463             break;
    464         case bcmFieldStageEgress:
    465             stage_id = _BCM_FIELD_STAGE_EGRESS;
    466             break;
    467         case bcmFieldStageExternal:
    468             stage_id = _BCM_FIELD_STAGE_EXTERNAL;
    469             break;
    470         case bcmFieldStageIngressExactMatch:
    471             stage_id = _BCM_FIELD_STAGE_EXACTMATCH;
    472             break;
    473         case bcmFieldStageIngressFlowtracker:
    474             stage_id = _BCM_FIELD_STAGE_FLOWTRACKER;
    475             break;
    476         case bcmFieldStageLookup:
    477             stage_id = _BCM_FIELD_STAGE_LOOKUP;
    478             break;
    479         case bcmFieldStageClass:
    480             stage_id = _BCM_FIELD_STAGE_CLASS;
    481             break;
    482         default:
    483             return BCM_E_PARAM;
    484     }
    485     FP_LOCK(unit);
    486     rv = _field_stage_control_get(unit, stage_id, &stage_fc);
    487     if (BCM_FAILURE(rv)) {
    488         FP_UNLOCK(unit);
    489         return rv;
    490     }
    491 
    492     if (presel == 0) {
    493 #if defined(BCM_TOMAHAWK_SUPPORT)
    494         if (stage_id == _BCM_FIELD_STAGE_CLASS) {
    495              BCM_FIELD_QSET_INIT(*qset);
    496              BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyStageClass);
    497              BCM_FIELD_QSET_ADD(*qset,
    498                                 bcmFieldQualifyStageClassExactMatch);
    499              BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyEtherType);
    500              BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyTtl);
    501              BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyTos);
    502              BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyIpProtocol);
    503              BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyTcpControl);
    504 
    505              BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyVrf);
    506 
    507              if (SOC_IS_TOMAHAWK3(unit)) {
    508                  BCM_FIELD_QSET_ADD(*qset,
    509                                     bcmFieldQualifyIpTunnelTtl);
    510              } else {
    511                  BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyL4SrcPort);
    512                  BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyL4DstPort);
    513                  BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifySrcIp);
    514                  BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifySrcIp6);
    515                  BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyDstIp);
    516                  BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyDstIp6);
    517                  BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyFcoeOxID);
    518                  BCM_FIELD_QSET_ADD(*qset, bcmFieldQualifyFcoeRxID);
    519                  BCM_FIELD_QSET_ADD(*qset,
    520                                     bcmFieldQualifyFibreChanSrcId);
    521                  BCM_FIELD_QSET_ADD(*qset,
    522                                     bcmFieldQualifyFibreChanDstId);
    523              }
    524         } else {
    525             *qset = stage_fc->_field_supported_qset;
    526         }
    527 #else
    528         *qset = stage_fc->_field_supported_qset;
    529 #endif
    530     } else
    531 #if defined(BCM_TOMAHAWK_SUPPORT)
    532          if (presel == 1) {
    533              *qset = stage_fc->presel_qset;
    534          } else
    535 #endif
    536     {
    537         FP_UNLOCK(unit);
    538         return BCM_E_PARAM;
    539     }
    540     FP_UNLOCK(unit);
    541     return rv;
    542 }
    543 
    544 /*
    545  * Function:
    546  *      bcm_esw_field_group_traverse
    547  * Purpose:
    548  *      Traverse all the fp groups in the system, calling a specified
    549  *      callback for each one
    550  * Parameters:
    551  *      unit - (IN) Unit number.
    552  *      callback - (IN) A pointer to the callback function to call for each fp group
    553  *      user_data - (IN) Pointer to user data to supply in the callback
    554  * Returns:
    555  *      BCM_E_xxx
    556  * Notes:
    557  */
    558 int 
    559 bcm_esw_field_group_traverse(int unit, bcm_field_group_traverse_cb callback,
    560                              void *user_data)
    561 {
    562     bcm_field_group_t *grp_arr;/* Field group pointers.    */ 
    563     _field_control_t *fc;      /* Field control structure. */
    564     _field_group_t *fg;        /* Field group structure.   */
    565     int group_count;           /* Number of fp groups.     */
    566     int mem_sz;                /* Allocated memory size.   */
    567     int idx;                   /* Group array iterator.    */
    568     int rv = BCM_E_NONE;       /* Operation return status. */
    569 
    570     /* Input parameters check. */
    571     if (NULL == callback) {
    572         return (BCM_E_PARAM);
    573     }
    574 
    575     /* Field control structure. */
    576      
    577     FP_LOCK(unit);
    578     rv = _field_control_get(unit, &fc);
    579     if (BCM_FAILURE(rv)) {
    580         FP_UNLOCK(unit);
    581         return rv;
    582     }
    583 
    584     /* Count fp groups. */
    585     fg = fc->groups;
    586     group_count = 0;
    587     while (fg != NULL) {
    588         if (!((soc_feature(unit, soc_feature_sw_mmu_flush_rqe_operation)) &&
    589             (fg->gid == _FP_INTERNAL_RESERVED_EM_ID))) {
    590             group_count++;
    591         }
    592         fg = fg->next;
    593     }
    594 
    595     if (0 == group_count) {
    596         FP_UNLOCK(unit);
    597         return (rv);
    598     }
    599 
    600     /* 
    601      * API can not use field contol groups linked list, 
    602      * since group might be destroyed in callback.  
    603      */
    604     mem_sz = group_count * sizeof(bcm_field_group_t);
    605     grp_arr = NULL;
    606     _FP_XGS3_ALLOC(grp_arr, mem_sz, "FP groups array");
    607     if (NULL == grp_arr) {
    608         FP_UNLOCK(unit);
    609         return (BCM_E_MEMORY);
    610     }
    611 
    612     /* Programm fp group ids into allocated array. */
    613     fg = fc->groups;
    614     idx = 0;
    615     while (fg != NULL) {
    616         if (!((soc_feature(unit, soc_feature_sw_mmu_flush_rqe_operation)) &&
    617             (fg->gid == _FP_INTERNAL_RESERVED_EM_ID))) {
    618              grp_arr[idx] = fg->gid;
    619              idx++;
    620         }
    621         fg = fg->next;
    622     }
    623 
    624     /* Call user callback. */
    625     for (idx = 0; idx < group_count; idx++) {
    626         rv = (*callback)(unit, grp_arr[idx], user_data);
    627         if (BCM_FAILURE(rv)) {
    628             break;
    629         }
    630     }
    631     FP_UNLOCK(unit);
    632     sal_free(grp_arr);
    633     return (rv);
    634 }
    635 
    636 /*
    637  * Function: bcm_esw_field_detach
    638  *
    639  * Purpose:
    640  *     Free resources associated with field module
    641  *
    642  * Parameters:
    643  *     unit - BCM device number
    644  *
    645  * Returns:
    646  *     BCM_E_INIT - BCM Unit not initialized.
    647  *     BCM_E_XXX  - Error code from bcm_field_group_destroy() or
    648  *                  bcm_field_entry_destroy_all().
    649  *     BCM_E_NONE - Success
    650  */
    651 
    652 int
    653 bcm_esw_field_detach(int unit)
    654 {
    655     int  rv = BCM_E_NONE;
    656     FP_LOCK(unit);
    657     rv = _bcm_esw_field_detach(unit);
    658     FP_UNLOCK(unit);
    659     return rv;
    660 }
    661 
    662 /*
    663  * Function: bcm_esw_field_control_get
    664  *
    665  * Purpose:
    666  *     Get control status info.
    667  *
    668  * Parameters:
    669  *     unit     - (IN)  BCM device number.
    670  *     control  - (IN)  Control element to get.
    671  *     status   - (OUT) Status of field element.
    672  *
    673  * Returns:
    674  *     BCM_E_INIT    - BCM unit not initialized
    675  *     BCM_E_PARAM   - *state pointing to NULL
    676  *     BCM_E_NONE    - Success
    677  */
    678 int
    679 bcm_esw_field_control_get(int unit, bcm_field_control_t control, uint32 *state)
    680 {
    681     _field_control_t    *fc;             /* Field control structure.      */
    682     int                 rv = BCM_E_NONE; /* Operation return status.      */
    683     
    684     if (state == NULL) {
    685         return (BCM_E_PARAM);
    686     }
    687 
    688     
    689     FP_LOCK(unit);
    690     rv = _field_control_get(unit, &fc);
    691     if (BCM_FAILURE(rv)) {
    692         FP_UNLOCK(unit);
    693         return rv;
    694     }
    695 
    696     if (NULL != fc->functions.fp_control_get) {
    697        rv = fc->functions.fp_control_get(unit, fc, control, state);
    698     }
    699 
    700     FP_UNLOCK(unit);
    701     return (rv);
    702 }
    703 
    704 /*
    705  * Function: bcm_esw_field_control_set
    706  *
    707  * Purpose:
    708  *     Set control status.
    709  *
    710  * Parameters:
    711  *     unit     - (IN) BCM device number.
    712  *     control  - (IN) Control element to set.
    713  *     state    - (IN) State (0/1).
    714  *
    715  * Returns:
    716  *     BCM_E_NONE    - Success
    717  *     BCM_E_INIT    - BCM unit not initialized
    718  *     BCM_E_PARAM   - Flag state not valid on device
    719  */
    720 int
    721 bcm_esw_field_control_set(int unit, bcm_field_control_t control, uint32 state)
    722 {
    723     _field_control_t    *fc;              /* Field control structure.   */
    724     int                 rv = BCM_E_NONE;  /* Operation return status.   */
    725 
    726     
    727     FP_LOCK(unit);
    728     rv = _field_control_get(unit, &fc);
    729     if (BCM_FAILURE(rv)) {
    730         FP_UNLOCK(unit);
    731         return rv;
    732     }
    733 
    734     if (NULL != fc->functions.fp_control_set) {
    735        rv = fc->functions.fp_control_set(unit, fc, control, state);
    736     }
    737 
    738     FP_UNLOCK(unit);
    739     return (rv);
    740 }
    741 
    742 /*
    743  * Function: bcm_field_stage_slice_count_get
    744  *
    745  * Purpose:
    746  *     Return the number os slices in a given stage
    747  *
    748  * Parameters:
    749  *     unit       - (IN)  BCM device number
    750  *     stage_id   - (IN)  Stage ID
    751  *     slice_count- (OUT) number of slices in a given stage
    752  *
    753  * Returns:
    754  *     BCM_E_NONE    - Success
    755  *     BCM_E_CONFIG  - error in configuration
    756  *     BCM_E_PARAM   - invalid parameter
    757  */
    758 
    759 int
    760 bcm_esw_field_stage_slice_count_get(
    761     int unit,
    762     bcm_field_stage_t stage_id,
    763     int *slice_count) {
    764 
    765 #if defined(BCM_TOMAHAWK_SUPPORT)
    766     int  rv;        /* Operation return status.   */
    767     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
    768         return BCM_E_UNAVAIL;
    769     }
    770     FP_LOCK(unit);
    771     rv = _bcm_field_stage_slice_count_get(unit,
    772                                          stage_id,
    773                                          slice_count);
    774     FP_UNLOCK(unit);
    775     return rv;
    776 #else
    777     return (BCM_E_UNAVAIL);
    778 #endif /* BCM_TOMAHAWK_SUPPORT */
    779 }
    780 
    781 /*
    782  * Function: bcm_esw_field_stage_slice_info_get
    783  *
    784  * Purpose:
    785  *     Return the details of the stage and entries
    786  *     count of the given slice for the given portbitmap
    787  *
    788  * Parameters:
    789  *     unit       - (IN) BCM device number
    790  *     stage_id   - (IN) Stage ID
    791  *     pbmp       - (IN) Port bitmap of the pipe
    792  *                       for which the details are required
    793  *     slice_no   - (IN) slice no to retrieve the info
    794  *     slice_info - (OUT) Slice information
    795  *
    796  * Returns:
    797  *     BCM_E_NONE    - Success
    798  *     BCM_E_CONFIG  - error in configuration
    799  *     BCM_E_PARAM   - invalid parameter
    800  */
    801 
    802 int
    803 bcm_esw_field_stage_slice_info_get(
    804     int unit,
    805     bcm_field_stage_t stage_id,
    806     bcm_pbmp_t pbmp,
    807     int slice_no,
    808     bcm_field_stage_slice_info_t *slice_info) {
    809 
    810 #if defined(BCM_TOMAHAWK_SUPPORT)
    811     int  rv;        /* Operation return status.   */
    812     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
    813         return BCM_E_UNAVAIL;
    814     }
    815     FP_LOCK(unit);
    816     rv = _bcm_field_stage_slice_info_get(unit,
    817                                          stage_id,
    818                                          pbmp,
    819                                          slice_no,
    820                                          slice_info);
    821     FP_UNLOCK(unit);
    822     return rv;
    823 #else
    824     return (BCM_E_UNAVAIL);
    825 #endif /* BCM_TOMAHAWK_SUPPORT */
    826 }
    827 
    828 /* Section: Group Management */
    829 
    830 /*
    831  * Function: bcm_esw_field_group_create
    832  *
    833  * Purpose:
    834  *     Create a field group based on the field group selector flags.
    835  *
    836  * Parameters:
    837  *     unit - BCM device number.
    838  *     qset - Field qualifier set
    839  *     pri  - Priority within allowable range,
    840  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
    841  *            priority; each priority value may be used only once
    842  *     group - (OUT) New field group ID
    843  *
    844  * Returns:
    845  *     BCM_E_INIT     - BCM unit not initialized
    846  *     BCM_E_PARAM    - pri out of range (0-15 for FB & ER) or group == NULL
    847  *     BCM_E_RESOURCE - no select codes will satisfy qualifier set
    848  *     BCM_E_NONE     - Success
    849  *
    850  * Notes:
    851  *      Allocates a hardware slice at the requested priority or better.
    852  *      Higher numerical value for priority has better priority for
    853  *      conflict resolution when there is a search hit on multiple slices.
    854  */
    855 int
    856 bcm_esw_field_group_create(int unit,
    857                            bcm_field_qset_t qset,
    858                            int pri,
    859                            bcm_field_group_t *group)
    860 {
    861     int                rv;      /* Operation return status. */
    862 
    863     
    864     FP_LOCK(unit);
    865 
    866     /* qset and pri are validated in bcm_field_group_create_mode_id(). */
    867     rv = _bcm_field_group_id_generate(unit, group);
    868     if (BCM_FAILURE(rv)) {
    869         FP_UNLOCK(unit);
    870         return (rv);
    871     }
    872 
    873     rv = bcm_esw_field_group_create_mode_id(unit, qset, pri,
    874                                             bcmFieldGroupModeDefault, *group);
    875     FP_UNLOCK(unit);
    876     return (rv);
    877 }
    878 
    879 /*
    880  * Function: bcm_esw_field_group_create_id
    881  *     
    882  * Purpose:
    883  *     Create a field group based on the field group selector flags
    884  *     with a requested ID
    885  *
    886  * Parameters:
    887  *     unit - BCM device number.
    888  *     port - Port number
    889  *     qset - Field qualifier set
    890  *     pri  - Priority within allowable range,
    891  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
    892  *            priority; each priority value may be used only once
    893  *    group - Requested field group ID
    894  *
    895  * Returns:
    896  *     BCM_E_INIT      - BCM unit not initialized
    897  *     BCM_E_RESOURCE  - No unused group/slices left
    898  *     BCM_E_PARAM     - priority out of range (0-15 for FB & ER)
    899  *     BCM_E_EXISTS    - group with that id already exists on this unit.
    900  *     BCM_E_MEMORY    - Group memory allocation failure
    901  *     BCM_E_NONE      - Success
    902  */
    903 
    904 int
    905 bcm_esw_field_group_create_id(int unit,
    906                               bcm_field_qset_t qset,
    907                               int pri,
    908                               bcm_field_group_t group)
    909 {
    910     int                rv;      /* Operation return status. */
    911     
    912     FP_LOCK(unit);
    913 
    914     /* coverity[result_independent_of_operands : FALSE] */
    915     if (soc_feature(unit, soc_feature_th3_style_fp)) {
    916         if (group >= (_FP_INTERNAL_RESERVED_ID_MIN)) {
    917            LOG_ERROR(BSL_LS_BCM_FP,
    918                       (BSL_META_U(unit,
    919                       "FP(unit %d) Error: This Group ID is reserved"
    920                       " for internal use\n"),
    921                       unit));
    922             FP_UNLOCK(unit);
    923             return (BCM_E_PARAM);
    924         }
    925     }
    926 
    927     /* Qset, pri and mode are validated in bcm_field_group_create_mode_id(). */
    928     rv = bcm_esw_field_group_create_mode_id(unit, qset, pri,
    929                                             bcmFieldGroupModeDefault, group);
    930     FP_UNLOCK(unit);
    931     return (rv);
    932 }
    933 
    934 /*
    935  * Function: bcm_esw_field_group_create_mode
    936  *     
    937  * Purpose:
    938  *
    939  * Parameters:
    940  *     unit - BCM device number.
    941  *     port - Port number
    942  *     qset - Field qualifier set
    943  *     pri  - Priority within allowable range,
    944  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
    945  *            priority; each priority value may be used only once
    946  *    mode  - Group mode (single, double, triple or Auto-wide)
    947  *    group - (OUT) New field group ID
    948  *
    949  * Returns:
    950  *     BCM_E_INIT      - BCM unit not initialized
    951  *     BCM_E_RESOURCE  - No select codes will satisfy qualifier set
    952  *     BCM_E_NONE      - Success
    953  */
    954 int
    955 bcm_esw_field_group_create_mode(int unit,
    956                                 bcm_field_qset_t qset,
    957                                 int pri,
    958                                 bcm_field_group_mode_t mode,
    959                                 bcm_field_group_t *group)
    960 {
    961     int                rv;      /* Operation return status. */
    962 
    963     
    964     FP_LOCK(unit);
    965 
    966     /* Qset, pri and mode are validated in bcm_field_group_create_mode_id(). */
    967     rv = _bcm_field_group_id_generate(unit, group);
    968     if (BCM_FAILURE(rv)) {
    969         FP_UNLOCK(unit);
    970         return (rv);
    971     }
    972     rv = bcm_esw_field_group_create_mode_id(unit, qset, pri, mode, *group);
    973 
    974     FP_UNLOCK(unit);
    975     return (rv);
    976 }
    977 
    978 /*
    979  * Function: bcm_esw_field_group_create_mode_id
    980  *     
    981  * Purpose:
    982  *     Create a group with both a mode (single, double, etc.) and a Group ID.
    983  *
    984  * Parameters:
    985  *     unit - BCM device number.
    986  *     qset - Field qualifier set
    987  *     pri  - Priority within allowable range,
    988  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
    989  *            priority; each priority value may be used only once
    990  *    mode  - Group mode (single, double, triple or Auto-wide)
    991  *    group - Requested field group ID
    992  *
    993  * Returns:
    994  *     BCM_E_INIT      - BCM unit not initialized
    995  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
    996  *     BCM_E_NONE      - Success
    997  */
    998 int
    999 bcm_esw_field_group_create_mode_id(int unit,
   1000                                    bcm_field_qset_t qset,
   1001                                    int pri,
   1002                                    bcm_field_group_mode_t mode,
   1003                                    bcm_field_group_t group)
   1004 {
   1005     bcm_pbmp_t         all_pbmp;   /* Group port bitmap.           */
   1006     int                rv;         /* Operation return status.     */
   1007 
   1008     /* Read device port configuration. */ 
   1009     BCM_PBMP_CLEAR(all_pbmp);
   1010     BCM_IF_ERROR_RETURN(_bcm_field_valid_pbmp_get(unit, &all_pbmp));
   1011 
   1012     FP_LOCK(unit);
   1013 
   1014     rv =  bcm_esw_field_group_ports_create_mode_id(unit, all_pbmp, qset, 
   1015                                                    pri, mode, group);
   1016     FP_UNLOCK(unit);
   1017 
   1018     return (rv);
   1019 }
   1020 
   1021 /*
   1022  * Function: bcm_esw_field_group_expansion_enable_set
   1023  *
   1024  * Purpose:
   1025  *     Enable or Disable Auto expansion of extries for a group
   1026  *
   1027  * Parameters:
   1028  *     unit - BCM device number.
   1029  *     group - Requested field group ID
   1030  *     enable - enable/disable auto expansion of group
   1031  *
   1032  * Returns:
   1033  *     BCM_E_INIT      - BCM unit not initialized
   1034  *     BCM_E_UNAVAIL   - feature not available
   1035  *     BCM_E_NONE      - Success
   1036  */
   1037 
   1038 int
   1039 bcm_esw_field_group_expansion_enable_set(int unit,
   1040                                          bcm_field_group_t group,
   1041                                          int enable)
   1042 {
   1043     _field_group_t      *fg;           /* Field group structure.      */
   1044     _field_stage_t      *stage_fc;     /* Field stage control.        */
   1045     int                 rv;            /* Operation return status.    */
   1046     int                 virtual_priority = FALSE;/* Virtual priority support flag.*/
   1047 
   1048 
   1049     
   1050     FP_LOCK(unit);
   1051 
   1052     rv = _field_group_get(unit, group, &fg);
   1053     if (BCM_FAILURE(rv)) {
   1054         FP_UNLOCK(unit);
   1055         return (rv);
   1056     }
   1057 
   1058 #if defined(BCM_TOMAHAWK_SUPPORT)
   1059     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   1060         (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   1061         FP_UNLOCK(unit);
   1062         return (BCM_E_UNAVAIL);
   1063     }
   1064 #endif /* BCM_TOMAHAWK_SUPPORT */
   1065 
   1066 #if defined(BCM_FLOWTRACKER_SUPPORT)
   1067     if(fg->stage_id == _BCM_FIELD_STAGE_FLOWTRACKER) {
   1068         FP_UNLOCK(unit);
   1069         return (BCM_E_UNAVAIL);
   1070     }
   1071 #endif
   1072 
   1073     /* Get stage field control structure. */
   1074     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   1075     if(BCM_FAILURE(rv)) {
   1076     	FP_UNLOCK(unit);
   1077     	return (rv);
   1078     }
   1079 
   1080     _field_virtual_priority_support(unit, stage_fc, &virtual_priority);
   1081 
   1082     if (virtual_priority == FALSE) {
   1083         FP_UNLOCK(unit);
   1084         return BCM_E_UNAVAIL;
   1085     }
   1086 
   1087     if (!(stage_fc->flags & _FP_STAGE_AUTO_EXPANSION)) {
   1088        FP_UNLOCK(unit);
   1089        return (BCM_E_UNAVAIL);
   1090     }
   1091 
   1092     if (enable) {
   1093         fg->flags |= _FP_GROUP_SELECT_AUTO_EXPANSION;
   1094     } else {
   1095         fg->flags &= ~_FP_GROUP_SELECT_AUTO_EXPANSION;
   1096     }
   1097 
   1098     FP_UNLOCK(unit);
   1099     return (rv);
   1100 }
   1101 
   1102 
   1103 /*
   1104  * Function: bcm_esw_field_group_expansion_enable_get
   1105  *
   1106  * Purpose:
   1107  *     Get Auto expansion status for the group.
   1108  *
   1109  * Parameters:
   1110  *     unit - BCM device number.
   1111  *     group - Requested field group ID
   1112  *     enable - [OUT] enable/disable status of the group
   1113  *
   1114  * Returns:
   1115  *     BCM_E_INIT      - BCM unit not initialized
   1116  *     BCM_E_UNAVAIL   - feature not available
   1117  *     BCM_E_NONE      - Success
   1118  */
   1119 int
   1120 bcm_esw_field_group_expansion_enable_get(int unit,
   1121                                          bcm_field_group_t group,
   1122                                          int *enable)
   1123 {
   1124     _field_group_t      *fg;           /* Field group structure.      */
   1125     int                 rv;            /* Operation return status.    */
   1126     _field_stage_t      *stage_fc;     /* Field stage control.        */
   1127     int                 virtual_priority = FALSE;/* Virtual priority support flag.*/
   1128 
   1129 
   1130     if (enable == NULL) {
   1131         return (BCM_E_PARAM);
   1132     }
   1133 
   1134     
   1135     FP_LOCK(unit);
   1136 
   1137     rv = _field_group_get(unit, group, &fg);
   1138     if (BCM_FAILURE(rv)) {
   1139         FP_UNLOCK(unit);
   1140         return (rv);
   1141     }
   1142 
   1143 #if defined(BCM_TOMAHAWK_SUPPORT)
   1144     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   1145         (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   1146         FP_UNLOCK(unit);
   1147         return (BCM_E_UNAVAIL);
   1148     }
   1149 #endif /* BCM_TOMAHAWK_SUPPORT */
   1150 
   1151     /* Get stage field control structure. */
   1152     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   1153     if(BCM_FAILURE(rv)) {
   1154         FP_UNLOCK(unit);
   1155         return (rv);
   1156     }
   1157 
   1158     _field_virtual_priority_support(unit, stage_fc, &virtual_priority);
   1159 
   1160     if (virtual_priority == FALSE) {
   1161         FP_UNLOCK(unit);
   1162         return BCM_E_UNAVAIL;
   1163     }
   1164 
   1165     if (fg->flags & _FP_GROUP_SELECT_AUTO_EXPANSION) {
   1166         *enable = TRUE;
   1167     } else {
   1168         *enable = FALSE;
   1169     }
   1170 
   1171     FP_UNLOCK(unit);
   1172     return (rv);
   1173 }
   1174 
   1175 
   1176 /*
   1177  * Function: bcm_esw_field_group_port_create_mode
   1178  *     
   1179  * Purpose:
   1180  *     Create a group with both a mode (single, double, etc.) and a single
   1181  *     port.
   1182  *
   1183  * Parameters:
   1184  *     unit - BCM device number.
   1185  *     port - Port number where group is defined
   1186  *     qset - Field qualifier set
   1187  *     pri  - Priority within allowable range,
   1188  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
   1189  *            priority; each priority value may be used only once
   1190  *    mode  - Group mode (single, double, triple or Auto-wide)
   1191  *    group - (OUT) field Group ID
   1192  *
   1193  * Returns:
   1194  *     BCM_E_INIT      - BCM unit not initialized
   1195  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
   1196  *     BCM_E_NONE      - Success
   1197  */
   1198 int
   1199 bcm_esw_field_group_port_create_mode(int unit, bcm_port_t port,
   1200                                      bcm_field_qset_t qset, int pri,
   1201                                      bcm_field_group_mode_t mode,
   1202                                      bcm_field_group_t *group)
   1203 {
   1204     int                rv;      /* Operation return status. */
   1205 
   1206 #ifdef BCM_TOMAHAWK_SUPPORT
   1207     /*
   1208      * Validation for IFP stage in TH.
   1209      * TH IFP: Port based Group/Logical Table ID lookup is based on
   1210      * Pre-Selection Qualifiers and APIs,Not supported in VFP and EFP also
   1211      * hence return BCM_E_UNAVAIL.
   1212      */
   1213     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   1214             return (BCM_E_UNAVAIL);
   1215         }
   1216 #endif /* !BCM_TOMAHAWK_SUPPORT */
   1217 
   1218     
   1219     FP_LOCK(unit);
   1220 
   1221     /* Check if QSET has flowtracker stage. */
   1222     if (BCM_FIELD_QSET_TEST(qset, bcmFieldQualifyStageIngressFlowtracker)) {
   1223         FP_UNLOCK(unit);
   1224         return BCM_E_UNAVAIL;
   1225     }
   1226 
   1227     /* qset and pri are validated in bcm_field_group_port_create_mode_id(). */
   1228     rv = _bcm_field_group_id_generate(unit, group);
   1229     if (BCM_FAILURE(rv)) {
   1230         FP_UNLOCK(unit);
   1231         return (rv);
   1232     }
   1233 
   1234     rv = bcm_esw_field_group_port_create_mode_id(unit, port, qset, 
   1235                                                  pri, mode, *group);
   1236     FP_UNLOCK(unit);
   1237     return (rv);
   1238 }
   1239 
   1240 /*
   1241  * Function: bcm_esw_field_group_port_create_mode_id
   1242  *     
   1243  * Purpose:
   1244  *     Create a group with a mode (single, double, etc.), a single port,
   1245  *     and a Group ID.
   1246  *
   1247  * Parameters:
   1248  *     unit - BCM device number.
   1249  *     port - Port number where group is defined
   1250  *     qset - Field qualifier set
   1251  *     pri  - Priority within allowable range,
   1252  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
   1253  *            priority; each priority value may be used only once
   1254  *    mode  - Group mode (single, double, triple or Auto-wide)
   1255  *    group - Requested field group ID
   1256  *
   1257  * Returns:
   1258  *     BCM_E_INIT      - BCM unit not initialized
   1259  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
   1260  *     BCM_E_NONE      - Success
   1261  */
   1262 int
   1263 bcm_esw_field_group_port_create_mode_id(int unit, bcm_port_t port,
   1264                                         bcm_field_qset_t qset, int pri,
   1265                                         bcm_field_group_mode_t mode,
   1266                                         bcm_field_group_t group)
   1267 {
   1268     bcm_pbmp_t         pbmp;    /* Group port bitmap.       */
   1269     int                rv;      /* Operation return status. */
   1270     bcm_port_t         local_port; /* Local port to handle gport as input */
   1271 
   1272 #ifdef BCM_TOMAHAWK_SUPPORT
   1273     /*
   1274      * Validation for IFP stage in TH.
   1275      * TH IFP: Port based Group/Logical Table ID lookup is based on
   1276      * Pre-Selection Qualifiers and APIs, Not supported in 
   1277      * VFP and EFP also. hence return BCM_E_UNAVAIL.
   1278      */
   1279     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   1280             return (BCM_E_UNAVAIL);
   1281         }
   1282 #endif /* !BCM_TOMAHAWK_SUPPORT */
   1283 
   1284     /* Check if QSET has flowtracker stage. */
   1285     if (BCM_FIELD_QSET_TEST(qset, bcmFieldQualifyStageIngressFlowtracker)) {
   1286         FP_UNLOCK(unit);
   1287         return BCM_E_UNAVAIL;
   1288     }
   1289 
   1290     BCM_PBMP_CLEAR(pbmp);
   1291     if (BCM_GPORT_IS_SET(port)) {
   1292         BCM_IF_ERROR_RETURN(bcm_esw_port_local_get(unit, port, &local_port));
   1293     } else {
   1294         local_port = port;
   1295     }
   1296     BCM_PBMP_PORT_SET(pbmp, local_port);
   1297 
   1298     
   1299     FP_LOCK(unit);
   1300 
   1301     rv = bcm_esw_field_group_ports_create_mode_id(unit, pbmp, qset, 
   1302                                                   pri, mode, group);
   1303     FP_UNLOCK(unit);
   1304     return (rv);
   1305 }
   1306 
   1307 /*
   1308  * Function: bcm_esw_field_group_ports_create_mode
   1309  *     
   1310  * Purpose:
   1311  *     Create a group with both a mode (single, double, etc.) and a port bitmap.
   1312  *
   1313  * Parameters:
   1314  *     unit - BCM device number.
   1315  *     pbmp - Ports where group is defined
   1316  *     qset - Field qualifier set
   1317  *     pri  - Priority within allowable range,
   1318  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
   1319  *            priority; each priority value may be used only once
   1320  *    mode  - Group mode (single, double, triple or Auto-wide)
   1321  *    group - (OUT) field Group ID
   1322  *
   1323  * Returns:
   1324  *     BCM_E_INIT      - BCM unit not initialized
   1325  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
   1326  *     BCM_E_NONE      - Success
   1327  */
   1328 int
   1329 bcm_esw_field_group_ports_create_mode(int unit, bcm_pbmp_t pbmp,
   1330                                       bcm_field_qset_t qset, int pri,
   1331                                       bcm_field_group_mode_t mode,
   1332                                       bcm_field_group_t *group)
   1333 {
   1334     int                rv;      /* Operation return status. */
   1335     FP_LOCK(unit);
   1336 
   1337     /* Check if QSET has flowtracker stage. */
   1338     if (BCM_FIELD_QSET_TEST(qset, bcmFieldQualifyStageIngressFlowtracker)) {
   1339         FP_UNLOCK(unit);
   1340         return BCM_E_UNAVAIL;
   1341     }
   1342 
   1343     /* qset and pri are validated in bcm_field_group_ports_create_mode_id(). */
   1344     rv = _bcm_field_group_id_generate(unit, group);
   1345     if (BCM_FAILURE(rv)) {
   1346         FP_UNLOCK(unit);
   1347         return (rv);
   1348     }
   1349 
   1350     rv = bcm_esw_field_group_ports_create_mode_id(unit, pbmp, qset, 
   1351                                                   pri, mode, *group);
   1352     FP_UNLOCK(unit);
   1353     return (rv);
   1354 }
   1355 
   1356 /* Function: bcm_esw_field_group_wlan_create_mode
   1357  *     
   1358  * Purpose:
   1359  *     Create a wlan field group with a mode (single, double, etc.).
   1360  *
   1361  * Parameters:
   1362  *     unit - BCM device number.
   1363  *     qset - Field qualifier set
   1364  *     pri  - Priority within allowable range,
   1365  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
   1366  *            priority; each priority value may be used only once
   1367  *    mode  - Group mode (single, double, triple or Auto-wide)
   1368  *    group - (OUT) field Group ID
   1369  *
   1370  * Returns:
   1371  *     BCM_E_INIT      - BCM unit not initialized
   1372  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
   1373  *     BCM_E_NONE      - Success
   1374  */
   1375 int
   1376 bcm_esw_field_group_wlan_create_mode(int unit, bcm_field_qset_t qset, int pri,
   1377                                      bcm_field_group_mode_t mode,
   1378                                      bcm_field_group_t *group)
   1379 {
   1380     int                rv;      /* Operation return status. */
   1381 
   1382     if(SOC_IS_TD2_TT2(unit) || SOC_IS_TOMAHAWKX(unit)) {
   1383        return BCM_E_UNAVAIL;
   1384     }	
   1385 
   1386     FP_LOCK(unit);
   1387 
   1388     /* Check if QSET has flowtracker stage. */
   1389     if (BCM_FIELD_QSET_TEST(qset, bcmFieldQualifyStageIngressFlowtracker)) {
   1390         FP_UNLOCK(unit);
   1391         return BCM_E_UNAVAIL;
   1392     }
   1393 
   1394     /* qset and pri are validated in bcm_field_group_ports_create_mode_id(). */
   1395     rv = _bcm_field_group_id_generate(unit, group);
   1396     if (BCM_FAILURE(rv)) {
   1397         FP_UNLOCK(unit);
   1398         return (rv);
   1399     }
   1400 
   1401     rv = bcm_esw_field_group_wlan_create_mode_id(unit, qset, pri, mode, *group);
   1402     FP_UNLOCK(unit);
   1403     return (rv);
   1404 }
   1405 
   1406 /* Function: bcm_esw_field_group_wlan_create_mode_id
   1407  *     
   1408  * Purpose:
   1409  *     Create a wlan field group with a mode (single, double, etc.).
   1410  *
   1411  * Parameters:
   1412  *     unit - BCM device number.
   1413  *     qset - Field qualifier set
   1414  *     pri  - Priority within allowable range,
   1415  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
   1416  *            priority; each priority value may be used only once
   1417  *    mode  - Group mode (single, double, triple or Auto-wide)
   1418  *    group - (OUT) field Group ID
   1419  *
   1420  * Returns:
   1421  *     BCM_E_INIT      - BCM unit not initialized
   1422  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
   1423  *     BCM_E_NONE      - Success
   1424  */
   1425 int
   1426 bcm_esw_field_group_wlan_create_mode_id(int unit, bcm_field_qset_t qset, int pri,
   1427                                         bcm_field_group_mode_t mode,
   1428                                         bcm_field_group_t group)
   1429 {
   1430     _field_group_add_fsm_t fsm;     /* Group creation state machine. */
   1431     int                    rv;      /* Operation return status.      */
   1432     bcm_pbmp_t             all_pbmp;
   1433 
   1434     if(SOC_IS_TD2_TT2(unit) || SOC_IS_TOMAHAWKX(unit))
   1435        return BCM_E_UNAVAIL;
   1436 
   1437     /* Check if QSET has flowtracker stage. */
   1438     if (BCM_FIELD_QSET_TEST(qset, bcmFieldQualifyStageIngressFlowtracker)) {
   1439         return BCM_E_UNAVAIL;
   1440     }
   1441 
   1442     /* Read device port configuration. */ 
   1443     BCM_PBMP_CLEAR(all_pbmp);
   1444     BCM_IF_ERROR_RETURN(_bcm_field_valid_pbmp_get(unit, &all_pbmp));
   1445     
   1446     FP_LOCK(unit);
   1447 
   1448     /* Initialize group creation tracking structure. */
   1449     sal_memset(&fsm, 0, sizeof(_field_group_add_fsm_t));
   1450     fsm.fsm_state = _BCM_FP_GROUP_ADD_STATE_START;
   1451     fsm.priority  = pri;
   1452     fsm.group_id  = group;
   1453     BCM_PBMP_ASSIGN(fsm.pbmp, all_pbmp);
   1454     fsm.qset      = qset;
   1455     fsm.mode      = mode;
   1456     fsm.flags     = _BCM_FP_GROUP_ADD_WLAN;
   1457     fsm.action_res_id     = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT;
   1458 
   1459     /*  Add FP group. */
   1460     rv = _bcm_field_group_add(unit, &fsm);
   1461 
   1462     FP_UNLOCK(unit);
   1463     return (rv);
   1464 }
   1465 
   1466 /* Function: bcm_esw_field_hints_create 
   1467  *
   1468  * Purpose:
   1469  *    Generate a hint id. 
   1470  * Parameters:
   1471  *     unit    - (IN)  BCM device number.
   1472  *     hint_id - (OUT) Pointer to hint_id
   1473  * Returns:
   1474  *     BCM_E_XXXX.
   1475  */
   1476 int bcm_esw_field_hints_create(int unit,
   1477                            bcm_field_hintid_t *hint_id)
   1478 {
   1479     int rv = BCM_E_NONE;           /* Return Value */
   1480     _field_control_t       *fc;    /* Field control structure.*/
   1481 
   1482     /* Check if Hints can be supported */
   1483 #if defined(BCM_TOMAHAWK_SUPPORT)
   1484     if (!(soc_feature(unit, soc_feature_field_multi_pipe_support)))
   1485 #endif /* BCM_TOMAHAWK_SUPPORT */
   1486     {
   1487         if (soc_feature(unit, soc_feature_field_ingress_two_slice_types) == 0) {
   1488             LOG_DEBUG(BSL_LS_BCM_FP,
   1489                     (BSL_META_U(unit,"AutoExpansion hints supported only for"
   1490                                 " devices that support two slice types\r\n")));
   1491             return BCM_E_UNAVAIL;
   1492         }
   1493     }
   1494 
   1495     /* Input parameters check. */
   1496     if (NULL == hint_id) {
   1497         return (BCM_E_PARAM);
   1498     }
   1499 
   1500     
   1501     FP_LOCK(unit);
   1502     rv = _field_control_get(unit, &fc);
   1503     if (BCM_FAILURE(rv)) {
   1504         FP_UNLOCK(unit);
   1505         return rv;
   1506     }
   1507 
   1508     rv = _field_hints_id_alloc (unit, hint_id);
   1509     if (BCM_SUCCESS(rv)) {
   1510         LOG_DEBUG(BSL_LS_BCM_FP,
   1511                 (BSL_META_U(unit, "FP(unit %d) hint id allocated %d\r\n"),
   1512                                                             unit,*hint_id));
   1513         _FP_HINTID_BMP_ADD(fc->hintid_bmp, *hint_id);
   1514     }
   1515 
   1516     FP_UNLOCK(unit);
   1517     return rv;
   1518 }
   1519 
   1520 /* Function: bcm_esw_field_hints_add
   1521  *
   1522  * Purpose:
   1523  *     Associate hint to hint id.
   1524  * Parameters:
   1525  *     unit    - (IN) BCM device number.
   1526  *     hint_id - (IN) Hint id to which the hint should be associated
   1527  *     hint    - (IN) bcm_field_hint_t structure
   1528  * Returns:
   1529  *     BCM_E_XXXX.
   1530  */
   1531 int bcm_esw_field_hints_add(int unit,
   1532                         bcm_field_hintid_t hint_id,
   1533                         bcm_field_hint_t *hint)
   1534 {
   1535     int                rv = BCM_E_NONE; /* Return Value */
   1536     _field_control_t  *fc;              /* Field control structure. */
   1537 
   1538     /* Check if Hints can be supported */
   1539 #if defined(BCM_TOMAHAWK_SUPPORT)
   1540     if (!(soc_feature(unit, soc_feature_field_multi_pipe_support)))
   1541 #endif /* BCM_TOMAHAWK_SUPPORT */
   1542     {
   1543         if (soc_feature(unit, soc_feature_field_ingress_two_slice_types) == 0) {
   1544             LOG_DEBUG(BSL_LS_BCM_FP,
   1545                     (BSL_META_U(unit, "AutoExpansion hints supported only"
   1546                                 " for devices that support two slice types\r\n")));
   1547             return BCM_E_UNAVAIL;
   1548         }
   1549     }
   1550 
   1551     /* Input parameters check. */
   1552     if ((hint == NULL) || (hint_id >= _FP_HINT_ID_MAX)) {
   1553         return BCM_E_PARAM;
   1554     }
   1555 
   1556     if((hint->hint_type == bcmFieldHintTypeCompression) ||
   1557        (hint->hint_type == bcmFieldHintTypeExtraction) ||
   1558        (hint->hint_type == bcmFieldHintTypeExactMatch) ) {
   1559 #if defined(BCM_TOMAHAWK_SUPPORT)
   1560         if (!(soc_feature(unit, soc_feature_field_multi_pipe_support)))
   1561 #endif /* BCM_TOMAHAWK_SUPPORT */
   1562         {
   1563             return BCM_E_UNAVAIL;
   1564         }
   1565     }
   1566 
   1567     /* Check if hint id created */
   1568     
   1569     FP_LOCK(unit);
   1570     rv = _field_control_get(unit, &fc);
   1571     if (BCM_FAILURE(rv)) {
   1572         FP_UNLOCK(unit);
   1573         return rv;
   1574     }
   1575 
   1576     if (_FP_HINTID_BMP_TEST((fc->hintid_bmp), hint_id) == 0) {
   1577         FP_UNLOCK(unit);
   1578         return BCM_E_NOT_FOUND;
   1579     }
   1580 
   1581 
   1582     rv = _bcm_field_hints_add (unit, hint_id, hint);
   1583     FP_UNLOCK(unit);
   1584 
   1585     return rv;
   1586 }
   1587 
   1588 /* Function: bcm_esw_field_hints_get
   1589  *
   1590  * Purpose:
   1591  *    Return complte hint structure after passing partial structure
   1592  * Parameters:
   1593  *     unit    - (IN) BCM device number.
   1594  *     hint_id - (IN) Hint id to which the hint should be associated
   1595  *     hint    - (INOUT) bcm_field_hint_t structure
   1596  * Returns:
   1597  *      BCM_E_XXXX.
   1598  */
   1599 int bcm_esw_field_hints_get(int unit,
   1600                         bcm_field_hintid_t hint_id,
   1601                         bcm_field_hint_t *hint)
   1602 {
   1603     int                  rv = BCM_E_NONE; /* Return Value */
   1604     _field_control_t    *fc;              /* Field control structure. */
   1605 
   1606     /* Input parameters check. */
   1607     if ((hint == NULL) || (hint_id >= _FP_HINT_ID_MAX)) {
   1608         return BCM_E_PARAM;
   1609     }
   1610 
   1611     /* Check if hint id created */
   1612     
   1613     FP_LOCK(unit);
   1614     rv = _field_control_get(unit, &fc);
   1615     if (BCM_FAILURE(rv)) {
   1616         FP_UNLOCK(unit);
   1617         return rv;
   1618     }
   1619 
   1620     if (_FP_HINTID_BMP_TEST((fc->hintid_bmp), hint_id) == 0) {
   1621         LOG_DEBUG(BSL_LS_BCM_FP,
   1622                 (BSL_META_U(unit, "FP(unit %d) Hint id %d"
   1623                             " not created\r\n"), unit, hint_id));
   1624         FP_UNLOCK(unit);
   1625         return BCM_E_NOT_FOUND;
   1626     }
   1627 
   1628     rv = _bcm_field_hints_get (unit, hint_id, hint);
   1629 
   1630     FP_UNLOCK(unit);
   1631     return rv;
   1632 }
   1633 
   1634 /* Function: bcm_esw_field_hints_delete
   1635  *
   1636  * Purpose:
   1637  *     Delete bcm_field_hint_t structure from a hint_id 
   1638  * Parameters:
   1639  *     unit    - (IN) BCM device number.
   1640  *     hint_id - (IN) Hint id to which the hint should be associated
   1641  *     hint    - (IN) bcm_field_hint_t structure
   1642  * Returns:
   1643  *     BCM_E_XXXX.
   1644  */
   1645 int bcm_esw_field_hints_delete (int unit,
   1646                            bcm_field_hintid_t hint_id,
   1647                            bcm_field_hint_t *hint)
   1648 {
   1649     int                  rv = BCM_E_NONE; /* Return Value. */
   1650     _field_control_t    *fc;              /* Field control structure. */
   1651 
   1652     /* Check if Hints can be supported */
   1653 #if defined(BCM_TOMAHAWK_SUPPORT)
   1654     if (!(soc_feature(unit, soc_feature_field_multi_pipe_support)))
   1655 #endif /* BCM_TOMAHAWK_SUPPORT */
   1656     {
   1657         if (soc_feature(unit, soc_feature_field_ingress_two_slice_types) == 0) {
   1658             LOG_DEBUG(BSL_LS_BCM_FP,
   1659                     (BSL_META_U(unit, "AutoExpansion hints supported only for"
   1660                                 " devices that support two slice types\r\n")));
   1661             return BCM_E_UNAVAIL;
   1662         }
   1663     }
   1664 
   1665     /* Input parameters check. */
   1666     if ((hint == NULL) || (hint_id >= _FP_HINT_ID_MAX)) {
   1667         return BCM_E_PARAM;
   1668     }
   1669 
   1670     /* Check if hint id created */
   1671     
   1672     FP_LOCK(unit);
   1673     rv = _field_control_get(unit, &fc);
   1674     if (BCM_FAILURE(rv)) {
   1675         FP_UNLOCK(unit);
   1676         return rv;
   1677     }
   1678 
   1679     if (_FP_HINTID_BMP_TEST((fc->hintid_bmp), hint_id) == 0) {
   1680         LOG_DEBUG(BSL_LS_BCM_FP,
   1681                 (BSL_META_U(unit, "FP (unit %d) HintId %d not created\r\n"),
   1682                                                                unit, hint_id));
   1683         FP_UNLOCK(unit);
   1684         return BCM_E_NOT_FOUND;
   1685     }
   1686 
   1687     rv = _bcm_field_hints_delete (unit, hint_id, hint);
   1688 
   1689     FP_UNLOCK(unit);
   1690     return rv;
   1691 }
   1692 
   1693 /* Function: bcm_esw_field_hints_delete_all
   1694  *
   1695  * Purpose:
   1696  *    Delete all the bcm_field_hint_t structures from a hint_id 
   1697  * Parameters:
   1698  *     unit -    (IN) BCM device number.
   1699  *     hint_id - (IN) Hint id to which the hint should be associated.
   1700  * Returns:
   1701  *     BCM_E_XXXX.
   1702  */
   1703 int bcm_esw_field_hints_delete_all(int unit,
   1704                                bcm_field_hintid_t hint_id)
   1705 {
   1706     int                  rv = BCM_E_NONE; /* Return Value. */
   1707     _field_control_t    *fc;              /* Field control structure. */
   1708 
   1709     /* Check if Hints can be supported */
   1710 #if defined(BCM_TOMAHAWK_SUPPORT)
   1711     if (!(soc_feature(unit, soc_feature_field_multi_pipe_support)))
   1712 #endif /* BCM_TOMAHAWK_SUPPORT */ 
   1713     {
   1714         if (soc_feature(unit, soc_feature_field_ingress_two_slice_types) == 0) {
   1715             LOG_DEBUG(BSL_LS_BCM_FP,
   1716                     (BSL_META_U(unit, "AutoExpansion hints supported only "
   1717                                 "for devices that support two slice types\r\n")));
   1718             return BCM_E_UNAVAIL;
   1719         }
   1720     }
   1721 
   1722     /* Input parameters check. */
   1723     if (hint_id >= _FP_HINT_ID_MAX) {
   1724         return BCM_E_PARAM;
   1725     }
   1726 
   1727     /* Check if hint id created */
   1728     
   1729     FP_LOCK(unit);
   1730     rv = _field_control_get(unit, &fc);
   1731     if (BCM_FAILURE(rv)) {
   1732         FP_UNLOCK(unit);
   1733         return rv;
   1734     }
   1735 
   1736     if (_FP_HINTID_BMP_TEST((fc->hintid_bmp), hint_id) == 0) {
   1737         LOG_DEBUG(BSL_LS_BCM_FP,
   1738                 (BSL_META_U(unit, "FP (unit %d) HintId %d not created\r\n"),
   1739                                                               unit, hint_id));
   1740         FP_UNLOCK(unit);
   1741         return BCM_E_NOT_FOUND;
   1742     }
   1743 
   1744     rv = _bcm_field_hints_delete_all (unit, hint_id);
   1745 
   1746     FP_UNLOCK(unit);
   1747     return rv;
   1748 }
   1749 
   1750 /* Function: bcm_esw_field_hints_destroy
   1751  *
   1752  * Purpose:
   1753  *    Delete all the bcm_field_hint_t structures from a hint_id
   1754  * Parameters:
   1755  *     unit - BCM device number.
   1756  *     hint_id - (IN) Hint id to which the hint should be associated.
   1757  * Returns:
   1758  *     BCM_E_XXXX.
   1759  */
   1760 int bcm_esw_field_hints_destroy(int unit,
   1761                             bcm_field_hintid_t hint_id)
   1762 {
   1763     int                    rv = BCM_E_NONE; /* Return Value */
   1764     _field_control_t      *fc;    /* Field control structure.*/
   1765 
   1766     /* Check if Hints can be supported */
   1767 #if defined(BCM_TOMAHAWK_SUPPORT)
   1768     if (!(soc_feature(unit, soc_feature_field_multi_pipe_support)))
   1769 #endif /* BCM_TOMAHAWK_SUPPORT */
   1770     {
   1771         if (soc_feature(unit, soc_feature_field_ingress_two_slice_types) == 0) {
   1772             LOG_DEBUG(BSL_LS_BCM_FP,
   1773                     (BSL_META_U(unit, "AutoExpansion hints supported only for"
   1774                                 " devices that support two slice types\r\n")));
   1775             return BCM_E_UNAVAIL;
   1776         }
   1777     }
   1778 
   1779     /* Input parameters check. */
   1780     if (hint_id >= _FP_HINT_ID_MAX) {
   1781         return BCM_E_PARAM;
   1782     }
   1783 
   1784     
   1785     FP_LOCK(unit);
   1786     rv = _field_control_get(unit, &fc);
   1787     if (BCM_FAILURE(rv)) {
   1788         FP_UNLOCK(unit);
   1789         return rv;
   1790     }
   1791 
   1792     rv = bcm_esw_field_hints_delete_all (unit, hint_id);
   1793     if ((rv == BCM_E_NONE) || (rv == BCM_E_NOT_FOUND)) {
   1794         _FP_HINTID_BMP_REMOVE(fc->hintid_bmp, hint_id);
   1795         LOG_DEBUG(BSL_LS_BCM_FP,
   1796                 (BSL_META_U(unit, "FP (unit %d) Hint Id %d destroyed\r\n"),
   1797                                                               unit, hint_id));
   1798         rv = BCM_E_NONE;
   1799     }
   1800 
   1801     FP_UNLOCK(unit);
   1802     return rv;
   1803 }
   1804 
   1805 /* Function: bcm_esw_field_group_config_create
   1806  *
   1807  * Purpose:
   1808  *     Create a group with a mode (single, double, etc.), a port bitmap,
   1809  *     group size and a Group ID.
   1810  * Parameters:
   1811  *     unit - BCM device number.
   1812  *     group_config - Group create attributes namely:
   1813  *          flags       - (IN) Bits indicate which parameters have been
   1814  *                             passed to API and should be used during group
   1815  *                             creation.
   1816  *          qset        - (IN) Field qualifier set
   1817  *          priority    - (IN) Priority within allowable range,
   1818  *                             or BCM_FIELD_GROUP_PRIO_ANY to automatically
   1819  *                             assign a priority; each priority value may be
   1820  *                             used only once
   1821  *          mode        - (IN) Group mode (single, double, triple or Auto-wide)
   1822  *          ports       - (IN) Ports where group is defined
   1823  *          group       - (IN/OUT) Requested Group ID. If Group ID is not set,
   1824  *                              then API allocates and returns the created
   1825  *                              Group ID.
   1826  * Returns:
   1827  *     BCM_E_INIT      - BCM unit not initialized
   1828  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
   1829  *     BCM_E_NONE      - Success
   1830  */
   1831 int
   1832 bcm_esw_field_group_config_create(int unit,
   1833                                   bcm_field_group_config_t *group_config)
   1834 {
   1835     int                    rv;      /* Operation return status.      */
   1836 
   1837     FP_LOCK(unit);
   1838     rv = _bcm_esw_field_group_config_create(unit, group_config, 0);
   1839     FP_UNLOCK(unit);
   1840     return (rv);
   1841 }
   1842 
   1843 /*
   1844  * Function: bcm_esw_field_groups_ports_create_mode_id
   1845  *     
   1846  * Purpose:
   1847  *     Create a group with a mode (single, double, etc.), a port bitmap, and
   1848  *     a Group ID. In practice, the other group creation APIs call this one.
   1849  *     This confirms that the required slice resources are available and
   1850  *     calculates the sets of select codes needed to satisfy the Qset. It also
   1851  *     creates the necessary internal data structures to manage the group.
   1852  *
   1853  * Parameters:
   1854  *     unit - BCM device number.
   1855  *     pbmp - Ports where group is defined
   1856  *     qset - Field qualifier set
   1857  *     pri  - Priority within allowable range,
   1858  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
   1859  *            priority; each priority value may be used only once
   1860  *    mode  - Group mode (single, double, triple or Auto-wide)
   1861  *    group - Requested Group ID
   1862  *
   1863  * Returns:
   1864  *     BCM_E_INIT      - BCM unit not initialized
   1865  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
   1866  *     BCM_E_NONE      - Success
   1867  */
   1868 int
   1869 bcm_esw_field_group_ports_create_mode_id(int unit, bcm_pbmp_t pbmp,
   1870                                          bcm_field_qset_t qset, int pri,
   1871                                          bcm_field_group_mode_t mode,
   1872                                          bcm_field_group_t group)
   1873 {
   1874     _field_group_add_fsm_t *fsm;     /* Group creation state machine. */
   1875     _field_control_t       *fc;     /* Field control structure.      */
   1876     int                    rv = 0;      /* Operation return status.      */
   1877     bcm_pbmp_t             valid_pbm, temp_pbm;
   1878 #if defined(BCM_TOMAHAWK_SUPPORT)
   1879     bcm_field_group_config_t *gc;    /* Group configuration structure. */
   1880     bcm_pbmp_t all_pbmp;             /* Hold valid pbm supported */
   1881 #endif /* BCM_TOMAHAWK_SUPPORT */
   1882 
   1883     fsm = NULL;
   1884 
   1885     if (BCM_PBMP_IS_NULL(pbmp)) {
   1886         return BCM_E_PARAM;
   1887     }
   1888 
   1889     rv = _bcm_field_valid_pbmp_get(unit, &valid_pbm);
   1890     if (BCM_FAILURE(rv)) {
   1891         return (rv);
   1892     }
   1893 
   1894     /* Validate data */
   1895     BCM_PBMP_ASSIGN(temp_pbm, valid_pbm);
   1896     BCM_PBMP_AND(temp_pbm, pbmp);
   1897 
   1898     if (BCM_PBMP_NEQ(temp_pbm, pbmp)) {
   1899         return BCM_E_PARAM;
   1900     }
   1901 
   1902 #ifdef BCM_TOMAHAWK_SUPPORT
   1903     /*
   1904      * Validation for IFP stage in TH.
   1905      * TH IFP: Port based Group/Logical Table ID lookup is based on
   1906      * Pre-Selection Qualifiers and APIs, hence return BCM_E_UNAVAIL.
   1907      */
   1908     gc = NULL;
   1909 
   1910     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   1911             /* Get device port configuration. */
   1912             BCM_IF_ERROR_RETURN(_bcm_field_valid_pbmp_get(unit, &all_pbmp)); 
   1913             /*
   1914              * Validate input port bitmap value and confirm it includes all
   1915              * ports for TH IFP stage else return unavailable support error.
   1916              */
   1917             if (BCM_PBMP_NEQ(pbmp, all_pbmp)) {
   1918                 rv = BCM_E_UNAVAIL;
   1919                 goto bcm_error;
   1920             }
   1921         }
   1922 #endif /* BCM_TOMAHAWK_SUPPORT */
   1923 
   1924     FP_LOCK(unit);
   1925     rv = _field_control_get(unit, &fc);
   1926     if (BCM_FAILURE(rv)) {
   1927         FP_UNLOCK(unit);
   1928         goto bcm_error;
   1929     }
   1930 
   1931 #if defined(BCM_TOMAHAWK_SUPPORT)
   1932     /* If device supports per-pipe FP configuration, */
   1933     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   1934         /* Clear group configuration structure. */
   1935         _FP_XGS3_ALLOC(gc, sizeof(bcm_field_group_config_t),
   1936                        "Group config info ");
   1937         bcm_field_group_config_t_init(gc);
   1938 
   1939         /* Initialize group configuration parameters. */
   1940         gc->priority = pri;
   1941         gc->group = group;
   1942         gc->ports = pbmp;
   1943         gc->qset = qset;
   1944         gc->mode = mode;
   1945         gc->flags |= (BCM_FIELD_GROUP_CREATE_WITH_ID |
   1946                         BCM_FIELD_GROUP_CREATE_WITH_MODE);
   1947 
   1948         /* Call Flexible Key Extraction programming function for TH IFP. */
   1949         rv = fc->functions.fp_group_add(unit, 0, gc);
   1950     } else
   1951 #endif /* BCM_TOMAHAWK_SUPPORT */
   1952     {
   1953         /* Initialize group creation tracking structure. */
   1954         _FP_XGS3_ALLOC(fsm, sizeof(_field_group_add_fsm_t),
   1955                        "Group fsm info ");
   1956 
   1957         fsm->fsm_state = _BCM_FP_GROUP_ADD_STATE_START;
   1958         fsm->priority  = pri;
   1959         fsm->group_id  = group;
   1960         fsm->pbmp      = pbmp;
   1961         fsm->qset      = qset;
   1962         fsm->mode      = mode;
   1963         fsm->action_res_id     = BCM_FIELD_GROUP_ACTION_RES_ID_DEFAULT;
   1964 
   1965         /*  Add FP group. */
   1966         rv = _bcm_field_group_add(unit, fsm);
   1967     }
   1968 
   1969 #ifdef BCM_WARM_BOOT_SUPPORT
   1970     SOC_CONTROL_LOCK(unit);
   1971     SOC_CONTROL(unit)->scache_dirty = 1;
   1972     SOC_CONTROL_UNLOCK(unit);
   1973 #endif
   1974 
   1975     FP_UNLOCK(unit);
   1976 
   1977 bcm_error:
   1978 #ifdef BCM_TOMAHAWK_SUPPORT
   1979     if (gc != NULL) {
   1980         sal_free(gc);
   1981     }
   1982 #endif /* BCM_TOMAHAWK_SUPPORT */
   1983     if (fsm != NULL) {
   1984         sal_free(fsm);
   1985     }
   1986     return (rv);
   1987 }
   1988 
   1989 int 
   1990 bcm_esw_field_group_action_set(int               unit, 
   1991                                bcm_field_group_t group, 
   1992                                bcm_field_aset_t  aset
   1993                                )
   1994 {
   1995     int              errcode = BCM_E_NONE;
   1996     _field_group_t   *fg;
   1997     unsigned         action;
   1998 
   1999     
   2000     FP_LOCK(unit);
   2001 
   2002     if (BCM_FAILURE(errcode = _field_group_get(unit, group, &fg))) {
   2003         LOG_ERROR(BSL_LS_BCM_FP,
   2004                   (BSL_META_U(unit,
   2005                               "FP(unit %d) Error: group=%d not found \n"),
   2006                    unit, group));
   2007         goto cleanup;
   2008     }
   2009 
   2010 #if defined(BCM_TOMAHAWK_SUPPORT) /* BCM_TOMAHAWK_SUPPORT */
   2011     if (soc_feature(unit, soc_feature_field_multi_pipe_support)
   2012         && ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
   2013             (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id))) {
   2014         /* Get TH IFP group's status. */
   2015         errcode = _bcm_field_th_group_status_calc(unit, fg);
   2016     } else if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   2017                (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   2018         errcode = BCM_E_UNAVAIL;
   2019         goto cleanup;
   2020     } else
   2021 #endif /* !BCM_TOMAHAWK_SUPPORT */
   2022 #if defined(BCM_FLOWTRACKER_SUPPORT)
   2023     if (soc_feature(unit, soc_feature_field_flowtracker_support)
   2024         && (_BCM_FIELD_STAGE_FLOWTRACKER == fg->stage_id)) {
   2025         errcode = BCM_E_NONE;
   2026     } else
   2027 #endif /* !BCM_FLOWTRACKER_SUPPORT */
   2028     {
   2029         errcode = _bcm_field_group_status_calc(unit, fg);
   2030     }
   2031 
   2032     if (BCM_FAILURE(errcode)) {
   2033         LOG_ERROR(BSL_LS_BCM_FP, (BSL_META_U(unit,
   2034             "FP(unit %d) Error: group=%d status calc failed.\n"), unit, group));
   2035         goto cleanup;
   2036     }
   2037 
   2038 #if defined(BCM_TRIDENT3_SUPPORT)
   2039         if(soc_feature(unit, soc_feature_ifp_action_profiling)) {
   2040             if (fg->stage_id == _BCM_FIELD_STAGE_INGRESS) {
   2041                 errcode = _field_td3_field_group_aset_update(unit, fg, &aset);
   2042                 goto cleanup;
   2043             }
   2044         }
   2045 #endif
   2046 #if defined(BCM_FLOWTRACKER_SUPPORT)
   2047         if (soc_feature(unit, soc_feature_field_flowtracker_support)) {
   2048             if (fg->stage_id == _BCM_FIELD_STAGE_FLOWTRACKER) {
   2049                 errcode = _bcm_field_hx5_ft_group_aset_update(unit, fg, &aset);
   2050                 goto cleanup;
   2051             }
   2052         }
   2053 #endif
   2054 
   2055     if (fg->group_status.entries_free != fg->group_status.entries_total) {
   2056         /* Some entries defined in group => error */
   2057 
   2058         errcode = BCM_E_CONFIG;
   2059         goto cleanup;
   2060     }
   2061     
   2062     /* Check all actions are supported */
   2063     
   2064     for (action = 0; action < bcmFieldActionCount; ++action) {
   2065         if (!SHR_BITGET(aset.w, action)) {
   2066             continue;
   2067         }
   2068         
   2069         if (!_field_stage_action_support_check(unit, fg, action)) {
   2070             errcode = BCM_E_UNAVAIL;
   2071             goto cleanup;
   2072         }
   2073     }
   2074 
   2075     sal_memcpy(&fg->aset, &aset, sizeof(bcm_field_aset_t));     /* Assign aset to group */
   2076 
   2077     /* Install aset in hardware */
   2078 
   2079     errcode = _field_aset_install(unit, fg);
   2080 
   2081  cleanup:
   2082     FP_UNLOCK(unit);
   2083     return (errcode);
   2084 }
   2085 
   2086 
   2087 int 
   2088 bcm_esw_field_group_action_get(int               unit, 
   2089                                bcm_field_group_t group, 
   2090                                bcm_field_aset_t  *aset
   2091                                )
   2092 {
   2093     int              errcode;
   2094     _field_group_t   *fg;
   2095 
   2096     
   2097     FP_LOCK(unit);
   2098 
   2099     errcode = _field_group_get(unit, group, &fg);
   2100     if (BCM_FAILURE(errcode)) {
   2101         LOG_ERROR(BSL_LS_BCM_FP,
   2102                   (BSL_META_U(unit,
   2103                               "FP(unit %d) Error: group=%d not found \n"),
   2104                    unit, group));
   2105         FP_UNLOCK(unit);
   2106         return (errcode);
   2107     }
   2108 
   2109     sal_memcpy(aset, &fg->aset, sizeof(bcm_field_aset_t));
   2110 
   2111     FP_UNLOCK(unit);
   2112     return (BCM_E_NONE);
   2113 }
   2114 
   2115 
   2116 /*
   2117  * Function: bcm_esw_field_group_mode_get
   2118  *
   2119  * Purpose:
   2120  *     Return the mode of a Group ID. This is its single, double or triple-wide
   2121  *     state. Mode specified the number of slices allocated to the group.
   2122  *
   2123  * Parameters:
   2124  *     unit  - (IN) BCM device number.
   2125  *     group - (IN) Field group ID.
   2126  *     mode  - (OUT) single, double, triple or auto mode.
   2127  *     
   2128  * Returns:
   2129  *     BCM_E_INIT      - BCM unit not initialized
   2130  *     BCM_E_NOT_FOUND - Group ID not found for in this unit
   2131  *     BCM_E_PARAM     - mode pointing to NULL
   2132  *     BCM_E_NONE      - Success
   2133  */
   2134 int
   2135 bcm_esw_field_group_mode_get(int unit,
   2136                              bcm_field_group_t group,
   2137                              bcm_field_group_mode_t *mode)
   2138 {
   2139     _field_group_t    *fg;     /* Field group info.       */
   2140     int                rv;     /* Operation return value. */             
   2141     _field_stage_t    *stage_fc; /* stage info */
   2142 
   2143     if (mode == NULL) {
   2144         LOG_ERROR(BSL_LS_BCM_FP,
   2145                   (BSL_META_U(unit,
   2146                               "FP(unit %d) Error: mode=>NULL\n"),
   2147                    unit));
   2148         return (BCM_E_PARAM);
   2149     }
   2150 
   2151     
   2152     FP_LOCK(unit);
   2153 
   2154     rv = _field_group_get(unit, group, &fg);
   2155     if (BCM_FAILURE(rv)) {
   2156         LOG_ERROR(BSL_LS_BCM_FP,
   2157                   (BSL_META_U(unit,
   2158                               "FP(unit %d) Error: group=%d not found \n"),
   2159                    unit, group));
   2160         FP_UNLOCK(unit);
   2161         return (BCM_E_NOT_FOUND);
   2162     }
   2163 
   2164 #if defined(BCM_TOMAHAWK_SUPPORT)
   2165     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   2166         (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   2167         FP_UNLOCK(unit);
   2168         return (BCM_E_UNAVAIL);
   2169     }
   2170 #endif /* BCM_TOMAHAWK_SUPPORT */
   2171 
   2172     rv = _bcm_esw_field_group_mode_get(fg->flags, mode);
   2173 
   2174     /* Retreive Stage Control. */
   2175     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   2176     if (BCM_FAILURE(rv)) {
   2177         FP_UNLOCK(unit);
   2178         return (rv);
   2179     }
   2180 
   2181 #if defined (BCM_TOMAHAWK3_SUPPORT) || defined (BCM_HELIX5_SUPPORT)
   2182     if ((soc_feature(unit, soc_feature_ifp_no_narrow_mode_support)
   2183         || soc_feature(unit, soc_feature_hx5_style_ifp_no_narrow_mode_support)) &&
   2184          (*mode == bcmFieldGroupModeIntraSliceDouble) &&
   2185          (_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id)) {
   2186          *mode = bcmFieldGroupModeSingle;
   2187     }
   2188 #endif
   2189 
   2190     FP_UNLOCK(unit);
   2191     return (rv);
   2192 }
   2193 
   2194 /*
   2195  * Function:
   2196  *     _bcm_field_qset_validate
   2197  *
   2198  * Purpose:
   2199  *     validate the qset to be added to existing group.
   2200  *
   2201  * Parameters:
   2202  *     unit         - (IN)BCM device number.
   2203  *     groupStage   - (IN)Pipeline stage id of existing group
   2204  *     qset_p       - (IN) qualifiers set to be added.
   2205  *
   2206  * Returns:
   2207  *     BCM_E_XXX
   2208  */
   2209 int
   2210 _bcm_field_qset_validate(int unit, _field_stage_id_t group_stage,
   2211                          bcm_field_qset_t *qset_p) {
   2212     int stage_count = 0;   /* Check that only 1 stage specified in qset */
   2213     _field_stage_id_t stage = group_stage; /*stage in the qset */
   2214 
   2215     if (NULL == qset_p) {
   2216         return (BCM_E_PARAM);
   2217     }
   2218 
   2219 #if defined(BCM_FIREBOLT2_SUPPORT) || defined(BCM_TRX_SUPPORT)
   2220     /* Set stage based on qualifiers set. */
   2221     if (soc_feature(unit, soc_feature_field_multi_stage)) {
   2222         if(BCM_FIELD_QSET_TEST(*qset_p, bcmFieldQualifyStageIngress)) {
   2223             stage  = _BCM_FIELD_STAGE_INGRESS;
   2224             stage_count++;
   2225         }
   2226         if(BCM_FIELD_QSET_TEST(*qset_p, bcmFieldQualifyStageEgress)) {
   2227             stage  = _BCM_FIELD_STAGE_EGRESS;
   2228             stage_count++;
   2229         }
   2230 
   2231         if(BCM_FIELD_QSET_TEST(*qset_p, bcmFieldQualifyStageLookup)) {
   2232             stage  = _BCM_FIELD_STAGE_LOOKUP;
   2233             stage_count++;
   2234         }
   2235     }
   2236 #endif /* BCM_FIREBOLT2_SUPPORT || BCM_TRX_SUPPORT */
   2237 
   2238     if (BCM_FIELD_QSET_TEST(*qset_p, bcmFieldQualifyStageExternal)) {
   2239         stage  = _BCM_FIELD_STAGE_EXTERNAL;
   2240         stage_count++;
   2241     }
   2242 
   2243 #if defined(BCM_TOMAHAWK_SUPPORT)
   2244     if (BCM_FIELD_QSET_TEST(*qset_p, bcmFieldQualifyStageClass)) {
   2245         stage  = _BCM_FIELD_STAGE_CLASS;
   2246         stage_count++;
   2247     }
   2248     if (BCM_FIELD_QSET_TEST(*qset_p, bcmFieldQualifyStageClassExactMatch)) {
   2249         stage  = _BCM_FIELD_STAGE_CLASS;
   2250         stage_count++;
   2251     }
   2252     if (BCM_FIELD_QSET_TEST(*qset_p, bcmFieldQualifyStageIngressExactMatch)) {
   2253         stage  = _BCM_FIELD_STAGE_EXACTMATCH;
   2254         stage_count++;
   2255     }
   2256 #if defined (BCM_FLOWTRACKER_SUPPORT)
   2257     if (BCM_FIELD_QSET_TEST(*qset_p, bcmFieldQualifyStageIngressFlowtracker)) {
   2258         stage = _BCM_FIELD_STAGE_FLOWTRACKER;
   2259         stage_count++;
   2260     }
   2261 #endif
   2262 #endif /* BCM_TOMAHAWK_SUPPORT */
   2263 
   2264     if (stage_count == 0) {
   2265         return (BCM_E_NONE);
   2266     }
   2267 
   2268     if (stage_count > 1) {
   2269         LOG_ERROR(BSL_LS_BCM_FP,
   2270               (BSL_META_U(unit,
   2271                   "FP(unit %d) Error: More than one pipeline stage"
   2272                   " was specified.\n"), unit));
   2273         return (BCM_E_PARAM);
   2274     }
   2275 
   2276     if (stage != group_stage) {
   2277         LOG_ERROR(BSL_LS_BCM_FP,
   2278               (BSL_META_U(unit,
   2279                   "FP(unit %d) Error: Stage in given qset is not "
   2280                   "same as exisiting group stage.\n"), unit));
   2281         return (BCM_E_PARAM);
   2282     }
   2283 
   2284     return (BCM_E_NONE);
   2285 }
   2286 
   2287 /*
   2288  * Function: bcm_esw_field_group_set
   2289  *    
   2290  * Purpose:
   2291  *     Update a previously created field group based on the field
   2292  *     group selector flags
   2293  *     
   2294  * Parameters:
   2295  *     unit  - BCM device number
   2296  *     group - Field group ID
   2297  *     qset  - Field qualifier set
   2298  *     
   2299  * Returns:
   2300  *     BCM_E_INIT      - BCM unit not initialized
   2301  *     BCM_E_NOT_FOUND - Group ID not found for in this unit
   2302  *     BCM_E_RESOURCE  - No select code can satisfy qualifier set
   2303  *     BCM_E_NONE      - Success
   2304  *     
   2305  * Notes:
   2306  *     If no entry exist that use this group then updates are always
   2307  *     permitted.
   2308  *     If entries exist that use this group then updates are permitted
   2309  *     only if it can be satisfied with the current selection of
   2310  *     (fpf0, fpf1, fpf2, fpf3) field selector encodings.
   2311  */
   2312 int
   2313 bcm_esw_field_group_set(int unit,
   2314                         bcm_field_group_t group,
   2315                         bcm_field_qset_t qset)
   2316 {
   2317     bcm_field_qset_t        sel_qset[_FP_MAX_ENTRY_WIDTH];
   2318     bcm_field_qset_t        qset_full, qset_old;
   2319     _field_control_t        *fc;    
   2320     _field_group_t          *fg;
   2321     _field_stage_t          *stage_fc;            
   2322     int                     re_create;
   2323     bcm_field_group_mode_t  mode = bcmFieldGroupModeAuto;
   2324     int                     priority;
   2325     int                     idx;
   2326     int                     rv;
   2327     int                     virtual_priority = FALSE;/* Virtual priority support flag.*/
   2328     bcm_field_group_config_t group_config;
   2329 
   2330     LOG_DEBUG(BSL_LS_BCM_FP,
   2331               (BSL_META_U(unit,
   2332                           "FP(unit %d) vverb:BEGIN bcm_field_group_set(group=%d)\n"),
   2333                unit, group));
   2334 
   2335     
   2336     FP_LOCK(unit);
   2337     rv = _field_control_get(unit, &fc);
   2338     if (BCM_FAILURE(rv)) {
   2339         FP_UNLOCK(unit);
   2340         return rv;
   2341     }
   2342 
   2343     rv = _field_group_get(unit, group, &fg);
   2344     if (BCM_FAILURE(rv)) {
   2345         FP_UNLOCK(unit);
   2346         return (rv);
   2347     }
   2348 
   2349 #if defined(BCM_TOMAHAWK_SUPPORT)
   2350     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   2351         (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   2352         FP_UNLOCK(unit);
   2353         return (BCM_E_UNAVAIL);
   2354     }
   2355 #endif /* BCM_TOMAHAWK_SUPPORT */
   2356 
   2357     rv = _bcm_field_qset_validate(unit, fg->stage_id, &qset);
   2358     if (BCM_FAILURE(rv)) {
   2359         FP_UNLOCK(unit);
   2360         return (rv);
   2361     }
   2362 
   2363     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   2364     if (BCM_FAILURE(rv)) {
   2365         FP_UNLOCK(unit);
   2366         return (rv);
   2367     }
   2368 
   2369     _field_virtual_priority_support(unit, stage_fc, &virtual_priority);
   2370 
   2371     /* If no entries have been added to group try requested qset.  */
   2372     if ((0 == fg->group_status.entry_count) &&
   2373         (stage_fc->stage_id != _BCM_FIELD_STAGE_EXTERNAL)) {
   2374 
   2375         LOG_VERBOSE(BSL_LS_BCM_FP,
   2376                     (BSL_META_U(unit,
   2377                                 "FP: bcm_field_group_set() with no entries\n")));
   2378 
   2379         /* Remember the group's current Qset, mode, and Priority (base slice/ user priority). */
   2380         qset_old = fg->qset;
   2381         if (virtual_priority) {
   2382             priority = fg->priority;
   2383         } else {
   2384             priority = fg->slices[0].slice_number;
   2385         }
   2386 
   2387         rv = _bcm_esw_field_group_mode_get(fg->flags, &mode);
   2388         if (BCM_FAILURE(rv)) {
   2389             FP_UNLOCK(unit);
   2390             return (rv);
   2391         }
   2392 #if defined (BCM_TOMAHAWK3_SUPPORT) || defined (BCM_HELIX5_SUPPORT)
   2393         if ((soc_feature(unit, soc_feature_ifp_no_narrow_mode_support) ||
   2394              soc_feature(unit, soc_feature_hx5_style_ifp_no_narrow_mode_support)) &&
   2395             (mode == bcmFieldGroupModeIntraSliceDouble) &&
   2396             (_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id)) {
   2397              mode = bcmFieldGroupModeSingle;
   2398         }
   2399 #endif
   2400 
   2401         bcm_field_group_config_t_init(&group_config);
   2402         /* OR new qset */
   2403         BCM_FIELD_QSET_INIT(group_config.qset);
   2404         _BCM_FIELD_QSET_OR(group_config.qset, qset, _bcmFieldQualifyCount);
   2405         _BCM_FIELD_QSET_OR(group_config.qset, qset_old, _bcmFieldQualifyCount);
   2406 
   2407         /* Set Priority and mode */
   2408         group_config.priority = priority;
   2409         group_config.flags |= BCM_FIELD_GROUP_CREATE_WITH_MODE;
   2410         group_config.mode = mode;
   2411 
   2412         group_config.flags |= BCM_FIELD_GROUP_CREATE_WITH_ID;
   2413         group_config.group = group;
   2414         /* Copy Group PBMP to group config structure */
   2415         BCM_PBMP_ASSIGN(group_config.ports, fg->pbmp);
   2416         /*
   2417          * Set PORT Based flag by default.
   2418          * New group should have the ports present in the old group structure.
   2419          */
   2420         group_config.flags |= BCM_FIELD_GROUP_CREATE_WITH_PORT;
   2421 
   2422 #if defined(BCM_TOMAHAWK_SUPPORT)
   2423         if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   2424             if ((stage_fc->stage_id == _BCM_FIELD_STAGE_FLOWTRACKER) ||
   2425                     (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) ||
   2426                     (stage_fc->stage_id == _BCM_FIELD_STAGE_EXACTMATCH)) {
   2427                 /* Add presels */
   2428                 for (idx = 0; idx < _FP_PRESEL_ENTRIES_MAX_PER_GROUP; idx++) {
   2429                     if (fg->presel_ent_arr[idx] != NULL) {
   2430                         BCM_FIELD_PRESEL_ADD(group_config.preselset,
   2431                                 fg->presel_ent_arr[idx]->presel_id);
   2432                         group_config.flags |= BCM_FIELD_GROUP_CREATE_WITH_PRESELSET;
   2433                     }
   2434                 }
   2435                 for (idx = 0 ; idx < bcmFieldActionCount; idx++) {
   2436                     if (BCM_FIELD_ASET_TEST(fg->aset, idx)) {
   2437                         BCM_FIELD_ASET_ADD(group_config.aset, idx);
   2438                     }
   2439                 }
   2440             }
   2441         }
   2442 #endif
   2443         /* Set hintId, action_res_id */
   2444         group_config.hintid = fg->hintid;
   2445         group_config.action_res_id = fg->action_res_id;
   2446         /* Destroy the old group. */
   2447         rv = bcm_esw_field_group_destroy(unit, group);
   2448         if (BCM_FAILURE(rv)) {
   2449             FP_UNLOCK(unit);
   2450             return rv;
   2451         }
   2452         /* Try to re-create the group with the requested Qset. */
   2453         rv = bcm_esw_field_group_config_create(unit, &group_config);
   2454         /* On failure, re-create the old group. */
   2455         if (BCM_FAILURE(rv)) {
   2456             LOG_ERROR(BSL_LS_BCM_FP,
   2457                       (BSL_META_U(unit,
   2458                                   "FP(unit %d) Error: new Qset won't work on group=%d.\n"),
   2459                        unit, group));
   2460             BCM_FIELD_QSET_INIT(group_config.qset);
   2461             _BCM_FIELD_QSET_OR(group_config.qset, qset_old, _bcmFieldQualifyCount);
   2462             re_create = bcm_esw_field_group_config_create(unit, &group_config);
   2463             if (BCM_FAILURE(re_create)) { /* Should never fail. */
   2464                 rv = BCM_E_INTERNAL;
   2465             }
   2466         }
   2467         FP_UNLOCK(unit);
   2468         return rv;
   2469     }
   2470 
   2471 #ifdef BCM_TOMAHAWK_SUPPORT
   2472     /*
   2473      * TH IFP HW TCAM key generation and extractor selector values are specific to a
   2474      * Group's QSET and determined dynamically during group creation.
   2475      * There are no pre-defined qualifiers to field selector/extractor mapping
   2476      * in HW. To modify an existing Group's QSET, entry count must be zero in TH
   2477      * IFP group.
   2478      */
   2479     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   2480         if(stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) {
   2481             rv = _bcm_field_th_group_update(unit, group, &qset);
   2482             FP_UNLOCK(unit);
   2483             return rv;
   2484 #if defined (BCM_FLOWTRACKER_SUPPORT)
   2485         } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_FLOWTRACKER) {
   2486             rv = _bcm_field_hx5_ft_group_update(unit, group, &qset);
   2487             FP_UNLOCK(unit);
   2488             return rv;
   2489 #endif
   2490         }
   2491     }
   2492 #endif /* !BCM_TOMAHAWK_SUPPORT */
   2493 
   2494     /*Expand qset with Internal qualifiers*/
   2495     qset_old = fg->qset;
   2496     fg->qset = qset;
   2497     rv = _field_group_qset_update(unit, fg);
   2498     if (BCM_FAILURE(rv)) {
   2499         fg->qset = qset_old;
   2500         FP_UNLOCK(unit);
   2501         return rv;
   2502     }
   2503     qset = fg->qset;
   2504     fg->qset = qset_old;
   2505 
   2506 
   2507     /*
   2508      * Handle cases where entries have been previously set in group.
   2509      */
   2510 
   2511     /* Initialize local slice Qsets. */
   2512     BCM_FIELD_QSET_INIT(qset_full);
   2513     for (idx = 0; idx < _FP_MAX_ENTRY_WIDTH; idx++) {
   2514         BCM_FIELD_QSET_INIT(sel_qset[idx]);
   2515 
   2516 
   2517         rv = fc->functions.fp_selcode_to_qset(unit, stage_fc, fg,
   2518                                               idx, &sel_qset[idx]);
   2519         if (BCM_FAILURE(rv)) {
   2520             FP_UNLOCK(unit);
   2521             return rv;
   2522         }
   2523         _field_qset_union(&sel_qset[idx], &qset_full, &qset_full);
   2524     }
   2525 
   2526     /* If the requested Qset is supported by the current select codes, 
   2527      * change the group's qset.
   2528      */
   2529 
   2530     /* qset_full represents total Qset that current select codes support.
   2531      * If the requested Qset is a subset of the full Qset, then the current
   2532      * select codes will work. */
   2533     if (_field_qset_is_subset(&qset, &qset_full)) {
   2534 
   2535         /* Increment the use-counts of any new UDFs. */
   2536         _field_udf_usecount_update(fc->udf, &fg->qset, &qset);
   2537 
   2538         _field_qset_union(&fg->qset, &qset, &fg->qset);
   2539         LOG_VERBOSE(BSL_LS_BCM_FP,
   2540                     (BSL_META_U(unit,
   2541                                 "FP: Current select codes satisify new Qset\n")));
   2542 
   2543         /* Regenerate the qualifier info lists */
   2544         rv= fc->functions.fp_qual_list_get(unit, stage_fc, fg);
   2545         if (BCM_FAILURE(rv)) {
   2546             FP_UNLOCK(unit);
   2547             return rv;
   2548         }
   2549 
   2550         FP_UNLOCK(unit);
   2551         return (BCM_E_NONE);
   2552     }
   2553 
   2554     if (stage_fc->stage_id == _BCM_FIELD_STAGE_EXTERNAL) {
   2555         FP_UNLOCK(unit);
   2556         return (BCM_E_RESOURCE);
   2557     }
   2558 
   2559     /* 
   2560      * Otherwise, use the current fg->sel_codes as a baseline. Try to
   2561      * change any "don't care" FPFx settings to get the requested qset.
   2562      */
   2563     rv = _field_selcode_assign(unit, qset, 0, fg);
   2564     if (BCM_FAILURE(rv)) {
   2565         FP_UNLOCK(unit);
   2566         return rv;
   2567     }
   2568 
   2569     /* Increment the use-counts of any new UDFs. */
   2570     _field_udf_usecount_update(fc->udf, &fg->qset, &qset);
   2571 
   2572     _field_qset_union(&fg->qset, &qset, &fg->qset);
   2573 
   2574     /* Regenerate the qualifier info lists */
   2575     rv= fc->functions.fp_qual_list_get(unit, stage_fc, fg);
   2576     if (BCM_FAILURE(rv)) {
   2577         FP_UNLOCK(unit);
   2578         return rv;
   2579     }
   2580 
   2581     /* Write the new select codes to hardware. */
   2582     rv = fc->functions.fp_group_install(unit, fg);
   2583 
   2584 #ifdef BCM_WARM_BOOT_SUPPORT
   2585     SOC_CONTROL_LOCK(unit);
   2586     SOC_CONTROL(unit)->scache_dirty = 1;
   2587     SOC_CONTROL_UNLOCK(unit);
   2588 #endif
   2589 
   2590     FP_UNLOCK(unit);
   2591     return rv;
   2592 }
   2593 
   2594 /*
   2595  * Function: bcm_esw_field_group_get
   2596  *    
   2597  * Purpose:
   2598  *     Get the qualifier set for a previously created field group
   2599  *     
   2600  * Parameters:
   2601  *     unit  - BCM device number
   2602  *     port  - Port number
   2603  *     group - Field group ID
   2604  *     qset  - (OUT) Field qualifier set
   2605  *     
   2606  * Returns:
   2607  *     BCM_E_INIT      - BCM unit not initialized.
   2608  *     BCM_E_NOT_FOUND - Group ID not found in this unit
   2609  *     BCM_E_PARAM     - qset is NULL
   2610  *     BCM_E_NONE      - Success
   2611  */
   2612 
   2613 int
   2614 bcm_esw_field_group_get(int unit,
   2615                         bcm_field_group_t group,
   2616                         bcm_field_qset_t *qset)
   2617 {
   2618     _field_group_t         *fg;     /* Field group structure.      */
   2619     int                    rv;      /* Operation return status.    */
   2620 
   2621     /* Input parameters check. */
   2622     if (qset == NULL) {
   2623         return (BCM_E_PARAM);
   2624     }
   2625 
   2626     
   2627     FP_LOCK(unit);
   2628 
   2629     rv = _field_group_get(unit, group, &fg);
   2630     if (BCM_SUCCESS(rv)) {
   2631         *qset = fg->qset;
   2632     }
   2633 
   2634     FP_UNLOCK(unit);
   2635     return (rv);
   2636 }
   2637 
   2638 /*
   2639  * Function: bcm_esw_field_group_destroy
   2640  *    
   2641  * Purpose:
   2642  *     Delete a field group
   2643  *     
   2644  * Parameters:
   2645  *     unit - BCM device number
   2646  *     port - Port number
   2647  *     group - Field group
   2648  *
   2649  * Returns:
   2650  *     BCM_E_INIT      - BCM unit not initialized
   2651  *     BCM_E_NOT_FOUND - Group ID not found in unit
   2652  *     BCM_E_BUSY      - Entries not destroyed yet
   2653  *     BCM_E_NONE      - Success
   2654  *
   2655  * Notes:
   2656  *      All entries that uses this group should have been destroyed
   2657  *      before calling this routine.
   2658  *      Operation will fail if entries exist that uses this template
   2659  */
   2660 int
   2661 bcm_esw_field_group_destroy(int unit, bcm_field_group_t group)
   2662 {
   2663     _field_stage_t      *stage_fc; /* Stage field control structure.  */
   2664     _field_group_t      *fg;      /* Group structure to free up       */ 
   2665     int                 rv;       /* Operation return status.         */
   2666     int                 virtual_priority = FALSE;/* Virtual priority support flag.*/
   2667 
   2668     LOG_DEBUG(BSL_LS_BCM_FP,
   2669               (BSL_META_U(unit,
   2670                           "FP(unit %d) vverb: bcm_field_group_destroy(group=%d)\n"),
   2671                unit, group));
   2672 
   2673     /* Find and validate field control. */
   2674     
   2675     FP_LOCK(unit);
   2676 
   2677     /* Search the field control for the Group ID. */
   2678     rv = _field_group_get(unit, group, &fg);
   2679     if (BCM_FAILURE(rv)) {
   2680         FP_UNLOCK(unit);
   2681         LOG_ERROR(BSL_LS_BCM_FP,
   2682                   (BSL_META_U(unit,
   2683                               "FP(unit %d) Error: Group=%d not found in device.\n"),
   2684                    unit, group));
   2685         return (rv);
   2686     }
   2687   
   2688     /* okay, go ahead and free the group */
   2689 
   2690     /* Entries must be freed first (see note above). */
   2691     if (0 != fg->group_status.entry_count) {
   2692         FP_UNLOCK(unit);
   2693         LOG_ERROR(BSL_LS_BCM_FP,
   2694                   (BSL_META_U(unit,
   2695                               "FP(unit %d) Error: entries still in group=%d.\n"),
   2696                    unit, group));
   2697         return (BCM_E_BUSY);
   2698     }
   2699 
   2700     /* Get stage control for virtual map update. */
   2701     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   2702     if (BCM_FAILURE(rv)) {
   2703         FP_UNLOCK(unit);
   2704         LOG_ERROR(BSL_LS_BCM_FP,
   2705                   (BSL_META_U(unit,
   2706                               "FP(unit %d) Error: Get stage (%d) control failed (%d).\n"), 
   2707                    unit, fg->stage_id, rv));
   2708         return (rv);
   2709     }
   2710 
   2711 #if defined(BCM_TOMAHAWK_SUPPORT)
   2712     if (soc_feature(unit, soc_feature_field_multi_pipe_support)
   2713         && ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
   2714             (_BCM_FIELD_STAGE_CLASS == fg->stage_id) ||
   2715             (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id) ||
   2716             (_BCM_FIELD_STAGE_FLOWTRACKER == fg->stage_id))) {
   2717         rv = _bcm_field_th_group_deinit(unit, fg);
   2718     } else 
   2719 #endif /* !BCM_TOMAHAWK_SUPPORT */
   2720     {
   2721         if (!(fg->flags & _FP_GROUP_CONFIG_VALIDATE)) {
   2722             _field_virtual_priority_support(unit, stage_fc, &virtual_priority);
   2723             if ((virtual_priority) &&
   2724                 BCM_PBMP_EQ(fg->pbmp, fg->slices[0].pbmp)) {
   2725                 /*
   2726                  * If this is the only group in the slice 
   2727                  * flush group slices from virtual map.  
   2728                  */
   2729                 rv = _field_group_vmap_delete(unit, stage_fc, fg, TRUE);
   2730             }
   2731         }
   2732         _field_group_deinit(unit, fg);
   2733     }
   2734 
   2735 #ifdef BCM_WARM_BOOT_SUPPORT
   2736     SOC_CONTROL_LOCK(unit);
   2737     SOC_CONTROL(unit)->scache_dirty = 1;
   2738     SOC_CONTROL_UNLOCK(unit);
   2739 #endif
   2740 
   2741     FP_UNLOCK(unit);
   2742     return (rv);
   2743 }
   2744 
   2745 
   2746 /*
   2747  * Function: bcm_esw_field_group_compress
   2748  *
   2749  * Purpose:
   2750  *     Compress filed group entries, 
   2751  *     in order to free slices used by the group.
   2752  * Paramters:
   2753  *     unit  - (IN) BCM device number
   2754  *     group - (IN) Field group ID
   2755  * Returns:
   2756  *     BCM_E_XXX
   2757  */
   2758 
   2759 int
   2760 bcm_esw_field_group_compress(int unit, bcm_field_group_t group)
   2761 {
   2762     _field_stage_t    *stage_fc;  /* Field group structure.   */
   2763     _field_group_t          *fg;  /* Field group structure.   */
   2764     int                      rv;  /* Operation return status. */
   2765 
   2766     /* Lock the module. */
   2767     
   2768     FP_LOCK(unit);
   2769 
   2770     /* Get group control structure. */
   2771     rv = _field_group_get(unit, group, &fg);
   2772     if (BCM_FAILURE(rv)) {
   2773         FP_UNLOCK(unit);
   2774         return (rv);
   2775     }
   2776 
   2777     /* Get stage control structure. */
   2778     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   2779     if (BCM_FAILURE(rv)) {
   2780         FP_UNLOCK(unit);
   2781         return (rv);
   2782     }
   2783 
   2784 #if defined(BCM_TOMAHAWK_SUPPORT)
   2785     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   2786         if (fg->stage_id == _BCM_FIELD_STAGE_CLASS) {
   2787            FP_UNLOCK(unit);
   2788            return (BCM_E_UNAVAIL);
   2789         }
   2790 
   2791         if (fg->stage_id == _BCM_FIELD_STAGE_INGRESS) {
   2792            rv = _bcm_field_th_group_compress(unit, fg, stage_fc);
   2793            FP_UNLOCK(unit);
   2794            return rv;
   2795         }  
   2796     }
   2797 #endif /* BCM_TOMAHAWK_SUPPORT */
   2798 
   2799     rv = _field_group_compress(unit, fg, stage_fc);
   2800     if (BCM_FAILURE(rv)) {
   2801         FP_UNLOCK(unit);
   2802         return (rv);
   2803     }
   2804 
   2805 #ifdef BCM_WARM_BOOT_SUPPORT
   2806     SOC_CONTROL_LOCK(unit);
   2807     SOC_CONTROL(unit)->scache_dirty = 1;
   2808     SOC_CONTROL_UNLOCK(unit);
   2809 #endif
   2810 
   2811    FP_UNLOCK(unit);
   2812    return (rv);
   2813 }
   2814 
   2815 /*
   2816  * Function: bcm_esw_field_group_priority_set
   2817  *
   2818  * Purpose:
   2819  *    Set field group priority. 
   2820  * Paramters:
   2821  *     unit     - (IN) BCM device number
   2822  *     group    - (IN) Field group ID
   2823  *     priority - (IN) Assigned group priority.
   2824  * Returns:
   2825  *     BCM_E_XXX
   2826  */
   2827 int
   2828 bcm_esw_field_group_priority_set(int unit, bcm_field_group_t group,
   2829                                  int priority)
   2830 {
   2831     _field_group_t   *fg;      /* Field group structure.   */
   2832     _field_stage_t   *stage_fc;/* Field stage control.     */
   2833     int              rv;       /* Operation return status. */
   2834     int                 virtual_priority = FALSE;/* Virtual priority support flag.*/
   2835 
   2836     /* Lock the module. */
   2837     
   2838     FP_LOCK(unit);
   2839 
   2840     /* Get group control structure. */
   2841     rv = _field_group_get(unit, group, &fg);
   2842     if (BCM_FAILURE(rv)) {
   2843         FP_UNLOCK(unit);
   2844         return (rv);
   2845     }
   2846 
   2847 #if defined(BCM_TOMAHAWK_SUPPORT)
   2848     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   2849         (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   2850         FP_UNLOCK(unit);
   2851         return (BCM_E_UNAVAIL);
   2852     }
   2853 #endif /* BCM_TOMAHAWK_SUPPORT */
   2854 
   2855 #if defined(BCM_FLOWTRACKER_SUPPORT)
   2856     if (soc_feature(unit, soc_feature_field_flowtracker_support) &&
   2857             (fg->stage_id == _BCM_FIELD_STAGE_FLOWTRACKER)) {
   2858         FP_UNLOCK(unit);
   2859         LOG_INFO(BSL_LS_BCM_FP,
   2860                 (BSL_META_U(unit, "FP(unit %d) Error: Field Group Priority"
   2861                             " not supported at this stage.\n"), unit));
   2862         return (BCM_E_UNAVAIL);
   2863     }
   2864 #endif /* BCM_FLOWTRACKER_SUPPORT */
   2865 
   2866     /* Get stage control structure. */
   2867     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   2868     if (BCM_FAILURE(rv)) {
   2869         FP_UNLOCK(unit);
   2870         return (rv);
   2871     }
   2872 
   2873     _field_virtual_priority_support(unit, stage_fc, &virtual_priority);
   2874 
   2875     if (virtual_priority == FALSE) {
   2876         FP_UNLOCK(unit);
   2877         return BCM_E_UNAVAIL;
   2878     }
   2879 
   2880 #ifdef BCM_TOMAHAWK_SUPPORT
   2881     if (soc_feature(unit, soc_feature_field_multi_pipe_support)
   2882         && ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
   2883             (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id))) {
   2884         rv = _bcm_field_th_group_lt_prio_update(unit, fg, priority);
   2885     } else
   2886 #endif /* !BCM_TOMAHAWK_SUPPORT */
   2887     {
   2888         /* Remove the group from virtual map . */
   2889         rv = _field_group_vmap_delete(unit, stage_fc, fg, FALSE);
   2890         if (BCM_FAILURE(rv)) {
   2891             FP_UNLOCK(unit);
   2892             return (rv);
   2893         }
   2894 
   2895         /* Assingn group priority. */
   2896         fg->priority = priority;
   2897 
   2898         /* Reinstall group virtual map . */
   2899         rv = _field_group_vmap_add(unit, stage_fc, fg);
   2900     }
   2901 
   2902 #ifdef BCM_WARM_BOOT_SUPPORT
   2903     SOC_CONTROL_LOCK(unit);
   2904     SOC_CONTROL(unit)->scache_dirty = 1;
   2905     SOC_CONTROL_UNLOCK(unit);
   2906 #endif
   2907 
   2908     FP_UNLOCK(unit);
   2909     return (rv);
   2910 }
   2911 
   2912 /*
   2913  * Function: bcm_esw_field_group_priority_get
   2914  *
   2915  * Purpose:
   2916  *    Get field group priority. 
   2917  * Paramters:
   2918  *     unit     - (IN) BCM device number
   2919  *     group    - (IN) Field group ID
   2920  *     priority - (OUT) Assigned group priority.
   2921  * Returns:
   2922  *     BCM_E_XXX
   2923  */
   2924 int
   2925 bcm_esw_field_group_priority_get(int unit, bcm_field_group_t group, 
   2926                                  int *priority)
   2927 {
   2928     _field_group_t      *fg;      /* Field group structure.   */
   2929     int                  rv;      /* Operation return status. */
   2930     _field_stage_t      *stage_fc;     /* Field stage control */
   2931     int                 virtual_priority = FALSE;/* Virtual priority support flag.*/
   2932 
   2933     /* Lock the module. */
   2934     
   2935     FP_LOCK(unit);
   2936 
   2937     /* Get group control structure. */
   2938     rv = _field_group_get(unit, group, &fg);
   2939     if (BCM_FAILURE(rv)) {
   2940         FP_UNLOCK(unit);
   2941         return (rv);
   2942     }
   2943 
   2944 #if defined(BCM_TOMAHAWK_SUPPORT)
   2945     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   2946         (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   2947         FP_UNLOCK(unit);
   2948         return (BCM_E_UNAVAIL);
   2949     }
   2950 #endif /* BCM_TOMAHAWK_SUPPORT */
   2951 
   2952     /* Get stage field control structure. */
   2953     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   2954     if(BCM_FAILURE(rv)) {
   2955         FP_UNLOCK(unit);
   2956         return (rv);
   2957     }
   2958 
   2959     _field_virtual_priority_support(unit, stage_fc, &virtual_priority);
   2960 
   2961     if (virtual_priority == FALSE) {
   2962         FP_UNLOCK(unit);
   2963         return BCM_E_UNAVAIL;
   2964     }
   2965 
   2966     *priority = fg->priority;
   2967 
   2968     FP_UNLOCK(unit);
   2969     return (BCM_E_NONE);
   2970 }
   2971 
   2972 
   2973 /*
   2974  * Function: bcm_esw_field_group_status_get
   2975  *
   2976  * Purpose:
   2977  *     Get the number of used and available entries, counters, and
   2978  *     meters for a field group.
   2979  *
   2980  * Paramters:
   2981  *     unit - BCM device number
   2982  *     group - Field group ID
   2983  *     status - (OUT) Status structure
   2984  *
   2985  * Returns:
   2986  *     BCM_E_INIT      - BCM unit has not been intialized
   2987  *     BCM_E_NOT_FOUND - Group ID not found on unit.
   2988  *     BCM_E_PARAM     - *status is NULL
   2989  *     BCM_E_NONE      - Success
   2990  */
   2991 
   2992 int
   2993 bcm_esw_field_group_status_get(int unit,
   2994                                bcm_field_group_t group,
   2995                                bcm_field_group_status_t *status)
   2996 {
   2997     _field_group_t      *fg;
   2998     int                  rv;
   2999 
   3000     if (status == NULL) {
   3001         return (BCM_E_PARAM);
   3002     }
   3003 
   3004     /* Lock the module. */
   3005     
   3006     FP_LOCK(unit);
   3007 
   3008     rv = _field_group_get(unit, group, &fg);
   3009     if (BCM_FAILURE(rv)) {
   3010         FP_UNLOCK(unit);
   3011         return (rv);
   3012     }
   3013 
   3014 #if defined(BCM_TOMAHAWK_SUPPORT) /* BCM_TOMAHAWK_SUPPORT */
   3015     if (soc_feature(unit, soc_feature_field_multi_pipe_support)
   3016         && ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
   3017             (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id))) {
   3018         /* Get TH IFP group's status. */
   3019         rv = _bcm_field_th_group_status_calc(unit, fg);
   3020     } else if (soc_feature(unit, soc_feature_field_multi_pipe_support)
   3021            && (_BCM_FIELD_STAGE_CLASS == fg->stage_id)) {
   3022         /* Do nothing. for class group status calc
   3023          * It's updated in runtime directly. */
   3024          rv = BCM_E_NONE;
   3025     } else
   3026 #endif /* !BCM_TOMAHAWK_SUPPORT */
   3027     {
   3028         /* Update the numbers of free entries, meters and counters. */
   3029         rv = _bcm_field_group_status_calc(unit, fg);
   3030     }
   3031 
   3032 
   3033     if (BCM_FAILURE(rv)) {
   3034         FP_UNLOCK(unit);
   3035         return (rv);
   3036     }
   3037 
   3038     *status = fg->group_status;
   3039     FP_UNLOCK(unit);
   3040     return (rv);
   3041 }
   3042 
   3043 
   3044 /*
   3045  * Function: bcm_esw_field_group_enable_set
   3046  *    
   3047  * Purpose:
   3048  *     Enable/disable packet lookup on a group.
   3049  *
   3050  * Parameters:
   3051  *     unit   - BCM device number
   3052  *     enable - lookup enable!=0/disable==0 state of group
   3053  *     group  - Field group ID
   3054  *
   3055  * Returns:
   3056  *     BCM_E_NONE      - Success
   3057  *     BCM_E_UNAVAIL   - BCM device does not have enable/disable feature
   3058  *
   3059  * Note:
   3060  *     As a slice may have multiple groups, we just disable the entries
   3061  *         of the particular group.
   3062  */
   3063 int
   3064 bcm_esw_field_group_enable_set(int unit, bcm_field_group_t group, int enable)
   3065 {
   3066     _field_group_t *fg;       /* Field group control structure. */
   3067     _field_stage_t *stage_fc; /* Stage field control structure. */
   3068     int rv;                   /* Operation return status.       */
   3069 
   3070     /* Get field control structure. */
   3071     
   3072     FP_LOCK(unit);
   3073 
   3074     /* Get field group descriptor. */
   3075     rv = _field_group_get(unit, group, &fg);
   3076     if (BCM_FAILURE(rv)) {
   3077         FP_UNLOCK(unit);
   3078         return (rv);
   3079     }
   3080 
   3081 #if defined(BCM_TOMAHAWK_SUPPORT)
   3082     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   3083         (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   3084         FP_UNLOCK(unit);
   3085         return (BCM_E_UNAVAIL);
   3086     }
   3087 #endif /* BCM_TOMAHAWK_SUPPORT */
   3088 
   3089     /* Get field stage control structure. */
   3090     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   3091     if (BCM_FAILURE(rv)) {
   3092         FP_UNLOCK(unit);
   3093         return (rv);
   3094     }
   3095     
   3096     /* Check slice enable feature support. */
   3097     if (0 == (stage_fc->flags & _FP_STAGE_SLICE_ENABLE)) {
   3098         FP_UNLOCK(unit);
   3099         return (BCM_E_UNAVAIL);
   3100     }
   3101 
   3102 #if defined(BCM_TOMAHAWK_SUPPORT)
   3103     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   3104         ((_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id) ||
   3105          (_BCM_FIELD_STAGE_EXACTMATCH == stage_fc->stage_id))) {
   3106         rv =  _bcm_field_th_group_enable_set(unit, group, enable);
   3107         FP_UNLOCK(unit);
   3108         return rv;
   3109     }
   3110 #endif /* BCM_TOMAHAWK_SUPPORT */
   3111 
   3112     /* Enable/disable primary slice. */
   3113     rv = _field_fb_entries_enable_set(unit, fg, &fg->slices[0],enable);
   3114     if (BCM_FAILURE(rv)) {
   3115         FP_UNLOCK(unit);
   3116         return (rv);
   3117     }
   3118 
   3119     /* If needed, enable/disable secondary slice. */
   3120     if (!(fg->flags & _FP_GROUP_SPAN_SINGLE_SLICE)) {
   3121         rv = _field_fb_entries_enable_set(unit, fg, &fg->slices[1], enable);
   3122         if (BCM_FAILURE(rv)) {
   3123             FP_UNLOCK(unit);
   3124             return (rv);
   3125         }
   3126     }
   3127 
   3128     /* If needed, enable/disable tertiary slice. */
   3129     if (fg->flags & _FP_GROUP_SPAN_TRIPLE_SLICE) {
   3130         rv = _field_fb_entries_enable_set(unit, fg, &fg->slices[2], enable);
   3131         if (BCM_FAILURE(rv)) {
   3132             FP_UNLOCK(unit);
   3133             return (rv);
   3134         }
   3135     }
   3136 
   3137     if (enable) {
   3138         fg->flags |= _FP_GROUP_LOOKUP_ENABLED; 
   3139     } else {
   3140         fg->flags &= ~_FP_GROUP_LOOKUP_ENABLED; 
   3141     }
   3142 
   3143     FP_UNLOCK(unit);
   3144     return (BCM_E_NONE);
   3145 }
   3146 
   3147 /*
   3148  * Function: bcm_esw_field_group_enable_get
   3149  *    
   3150  * Purpose:
   3151  *     Get the lookup enable/disable state of a group
   3152  *
   3153  * Parameters:
   3154  *     unit   - BCM device number
   3155  *     group  - Field group ID
   3156  *     enable - (OUT) lookup enable/disable state of group
   3157  *
   3158  * Returns:
   3159  *     BCM_E_XXX
   3160  */
   3161 int
   3162 bcm_esw_field_group_enable_get(int unit, bcm_field_group_t group, int *enable)
   3163 {
   3164     _field_group_t *fg;       /* Field group control structure. */
   3165     int rv;                   /* Operation return status.       */
   3166 
   3167     if (NULL == enable) {
   3168         return (BCM_E_PARAM);
   3169     }
   3170 
   3171     
   3172     FP_LOCK(unit);
   3173 
   3174     rv = _field_group_get(unit, group, &fg);
   3175     if (BCM_SUCCESS(rv)) {
   3176         *enable = (fg->flags & _FP_GROUP_LOOKUP_ENABLED) ? TRUE : FALSE;
   3177     }
   3178 
   3179     FP_UNLOCK(unit);
   3180     return (rv);
   3181 }
   3182 
   3183 /*
   3184  * Function:
   3185  *  bcm_esw_field_group_default_entry_set
   3186  * Purpose:
   3187  *  Set or Clear provided entry as default to a group.
   3188  * Parameters:
   3189  *  unit   - (IN) BCM device number
   3190  *  group  - (IN) Field group ID
   3191  *  entry  - (IN) Field Entry ID
   3192  *  enable - (IN) Enable/Disable flag
   3193  * Returns:
   3194  *     BCM_E_XXX
   3195  */
   3196 int
   3197 bcm_esw_field_group_default_entry_set(int unit, bcm_field_group_t group,
   3198                                       bcm_field_entry_t entry,
   3199                                       int enable)
   3200 {
   3201     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
   3202 
   3203 #if defined BCM_TOMAHAWK_SUPPORT
   3204 
   3205     FP_LOCK(unit);
   3206     rv = _bcm_field_group_default_entry_set(unit, group, entry, enable);
   3207     FP_UNLOCK(unit);
   3208 #endif /* BCM_TOMAHAWK_SUPPORT */
   3209 
   3210     return (rv);
   3211 }
   3212 
   3213 /*
   3214  * Function:
   3215  *  bcm_esw_field_group_default_entry_get
   3216  * Purpose:
   3217  *  Get the default entry id associated to a group.
   3218  * Parameters:
   3219  *  unit   - (IN)  BCM device number
   3220  *  group  - (IN)  Field group ID
   3221  *  entry  - (OUT) Default Entry ID
   3222  * Returns:
   3223  *  BCM_E_XXX
   3224  */
   3225 int
   3226 bcm_esw_field_group_default_entry_get(int unit, bcm_field_group_t group,
   3227                                       bcm_field_entry_t *entry)
   3228 {
   3229     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
   3230 
   3231 #if defined BCM_TOMAHAWK_SUPPORT
   3232 
   3233     FP_LOCK(unit);
   3234     rv = _bcm_field_group_default_entry_get(unit, group, entry);
   3235     FP_UNLOCK(unit);
   3236 #endif /* BCM_TOMAHAWK_SUPPORT */
   3237 
   3238     return (rv);
   3239 }
   3240 
   3241 /* Section: Range Checking */
   3242 
   3243 /*
   3244  * Function: bcm_esw_field_range_create_id
   3245  *    
   3246  * Purpose:
   3247  *     Allocate a range checker and set its parameters.
   3248  *
   3249  * Parameters:
   3250  *     unit   - (IN) BCM device number.
   3251  *     range  - (IN) Range check ID to use.
   3252  *     flags  - (IN) One or more of BCM_FIELD_RANGE_* flags.
   3253  *     min    - (IN) Lower bounds of range to be checked, inclusive.
   3254  *     max    - (IN) Upper bounds of range to be checked, inclusive.
   3255  *
   3256  * Returns:
   3257  *     BCM_E_INIT      - BCM unit not initialized.
   3258  *     BCM_E_EXISTS    - Range ID already in use.
   3259  *     BCM_E_RESOURCE  - Hardware range checkers all in use.
   3260  *     BCM_E_NONE      - Success.
   3261  *     BCM_E_XXX
   3262  */
   3263 
   3264 int
   3265 bcm_esw_field_range_create_id(int unit,
   3266                               bcm_field_range_t range,
   3267                               uint32 flags,
   3268                               bcm_l4_port_t min,
   3269                               bcm_l4_port_t max)
   3270 {
   3271     int                 rv = BCM_E_UNAVAIL; /* Operation return value. */
   3272 
   3273 #if defined(BCM_FIREBOLT_SUPPORT)
   3274     _field_stage_t      *stage_fc;      /* Stage field control info.*/
   3275     _field_range_t      *fr;            /* Field range info.        */  
   3276     int                 idx_max;        /* Loop termination index.  */
   3277     int                 hw_index  = -1; /* Free/matching rang index.*/
   3278     soc_mem_t           mem;            /* Range check memory.      */
   3279     _field_stage_id_t   stage_id;       /* Pipeline stage id.       */
   3280     SHR_BITDCL          *range_bmap;    /* Used indexes map.        */
   3281     uint32              max_field_val;
   3282 
   3283     LOG_DEBUG(BSL_LS_BCM_FP,
   3284               (BSL_META_U(unit,
   3285                           "FP(unit %d) vverb: BEGIN bcm_esw_field_range_create_id(range=%d, "), 
   3286                unit, range));
   3287     LOG_DEBUG(BSL_LS_BCM_FP,
   3288               (BSL_META_U(unit,
   3289                           "flags=%#08x, min=%#x, max=%#x)\n"),
   3290                flags, min, max));
   3291  
   3292     /* Range type sanity check. */
   3293     BCM_IF_ERROR_RETURN(_field_range_flags_check(unit, flags));
   3294 
   3295     if (flags & BCM_FIELD_RANGE_EXTERNAL) {
   3296         mem = ESM_RANGE_CHECKm;
   3297         stage_id = _BCM_FIELD_STAGE_EXTERNAL;
   3298     } else {
   3299 #if defined(BCM_TOMAHAWK_SUPPORT)
   3300         if (soc_feature(unit, soc_feature_field_multi_pipe_support) && RANGE_CTRL(unit)) {
   3301             if (RANGE_CTRL(unit)->range_used_by_module == RANGE_USED_BY_RANGE_MODULE) {
   3302                 LOG_CLI((BSL_META("Range resource is used by Range module. \n")));
   3303                 return BCM_E_UNAVAIL;
   3304             }
   3305             mem = IFP_RANGE_CHECKm;
   3306         } else 
   3307 #endif
   3308         {
   3309             mem = FP_RANGE_CHECKm;
   3310         }
   3311 
   3312         stage_id = _BCM_FIELD_STAGE_INGRESS;
   3313 
   3314     }
   3315 
   3316     if (!SOC_MEM_IS_VALID(unit, mem)) {
   3317         return BCM_E_UNAVAIL;
   3318     }
   3319 
   3320     max_field_val = (1 << soc_mem_field_length(unit, mem, LOWER_BOUNDSf)) - 1 ;
   3321 
   3322     if (min > max_field_val) {
   3323         return (BCM_E_PARAM);
   3324     }
   3325 
   3326     max_field_val = (1 << soc_mem_field_length(unit, mem, UPPER_BOUNDSf)) - 1 ;
   3327 
   3328     if (max > max_field_val) {
   3329         return (BCM_E_PARAM);
   3330     }
   3331 
   3332     idx_max = soc_mem_index_max(unit, mem);  
   3333     range_bmap = NULL;
   3334     _FP_XGS3_ALLOC(range_bmap, SHR_BITALLOCSIZE(idx_max + 1), "FP valid ranges");
   3335     if (NULL == range_bmap) {
   3336         return (BCM_E_MEMORY);
   3337     }
   3338 
   3339     FP_LOCK(unit);
   3340 
   3341     rv = _field_stage_control_get(unit, stage_id, &stage_fc);
   3342     if (BCM_FAILURE(rv)) {
   3343         FP_UNLOCK(unit);
   3344         sal_free(range_bmap);
   3345         return (rv);
   3346     }
   3347 
   3348     if (flags & BCM_FIELD_RANGE_REPLACE) {
   3349         rv = _bcm_field_modify_range_checker(unit, stage_id, range, flags,
   3350                 min, max);
   3351         FP_UNLOCK(unit);
   3352         sal_free(range_bmap);
   3353         return (rv);
   3354     }
   3355 
   3356     /* Search existing ranges */
   3357     for (fr = stage_fc->ranges; fr != NULL; fr = fr->next) {
   3358         if (fr->rid == range) {
   3359             FP_UNLOCK(unit);
   3360             sal_free(range_bmap);
   3361             LOG_ERROR(BSL_LS_BCM_FP,
   3362                       (BSL_META_U(unit,
   3363                                   "FP(unit %d) Error: range_id=%d already exists.\n"),
   3364                        unit, range));
   3365             return (BCM_E_EXISTS);
   3366         }
   3367 
   3368         /* Build maps of hardware in-use indexes. */
   3369         if (fr->style == _FP_RANGE_STYLE_FIREBOLT) {
   3370             SHR_BITSET(range_bmap, fr->hw_index);
   3371         }
   3372 
   3373         /* Found an exisiting match so use it. */
   3374         if (flags == fr->flags && min == fr->min && max == fr->max) {
   3375             hw_index = fr->hw_index;
   3376         }
   3377     }
   3378 
   3379     /* If no match found, allocate a new hardware index. */
   3380     if (hw_index < 0) {
   3381         hw_index = soc_mem_index_min(unit, mem);
   3382         for (; hw_index <= idx_max; hw_index++) {
   3383             /* Found an unused FB style range checker */
   3384             if (0 == SHR_BITGET(range_bmap, hw_index)) {
   3385                 break;
   3386             }
   3387         }
   3388 
   3389         /* No hardware indexes left. */
   3390         if (hw_index == (idx_max + 1)) {
   3391             FP_UNLOCK(unit);
   3392             sal_free(range_bmap);
   3393             LOG_ERROR(BSL_LS_BCM_FP,
   3394                       (BSL_META_U(unit,
   3395                                   "FP(unit %d) Error: No hardware range checkers left.\n"),
   3396                        unit));
   3397             return (BCM_E_RESOURCE);
   3398         }
   3399     }
   3400 
   3401     /* Create a new range entry for the list */
   3402     if ((fr = sal_alloc(sizeof (*fr), "fp_range")) == NULL) {
   3403         FP_UNLOCK(unit);
   3404         sal_free(range_bmap);
   3405         return (BCM_E_MEMORY);
   3406     }
   3407 
   3408     fr->flags    = flags;
   3409     fr->rid      = range;
   3410     fr->min      = min;
   3411     fr->max      = max;
   3412     fr->hw_index = hw_index;
   3413     fr->style    = _FP_RANGE_STYLE_FIREBOLT;
   3414 
   3415     /* Try to program hardware */
   3416 #if defined(BCM_TRX_SUPPORT)
   3417     if (SOC_IS_TRX(unit)) {
   3418         rv = _bcm_field_trx_range_check_set(unit, hw_index, 
   3419                                             flags, 1, min, max);
   3420     } else 
   3421 #endif /* BCM_TRX_SUPPORT */
   3422     {
   3423         rv = _field_fb_er_range_check_set(unit, hw_index, flags, 1, min, max);
   3424     }
   3425 
   3426     if (BCM_FAILURE(rv)) {
   3427         FP_UNLOCK(unit);
   3428         sal_free(range_bmap);
   3429         sal_free(fr);
   3430         LOG_ERROR(BSL_LS_BCM_FP,
   3431                   (BSL_META_U(unit,
   3432                               "FP(unit %d) Error: Device specific range check problem.\n"),
   3433                    unit));
   3434         return rv;
   3435     }
   3436 
   3437     /* Add to list of range checkers. */
   3438 
   3439     {
   3440         _field_range_t *p, **pp;
   3441 
   3442         /* List must be kept in acending order of hw_index -- is assumed by scache save
   3443            and restore functions.
   3444         */
   3445 
   3446         for (pp = &stage_fc->ranges; (p = *pp) && fr->hw_index > p->hw_index; pp = &p->next);
   3447 
   3448         (*pp = fr)->next = p;
   3449     }
   3450 
   3451     FP_UNLOCK(unit);
   3452     sal_free(range_bmap);
   3453 
   3454 #endif /* BCM_FIREBOLT_SUPPORT */
   3455     return (rv);
   3456 }
   3457 
   3458 /*
   3459  * Function: bcm_esw_field_range_group_create_id
   3460  *    
   3461  * Purpose:
   3462  *     Allocate an interface group range checker and set its parameters.
   3463  *
   3464  * Parameters:
   3465  *     unit   - (IN) BCM device number.
   3466  *     range  - (IN) Range check ID to use.
   3467  *     flags  - (IN) One or more of BCM_FIELD_RANGE_* flags.
   3468  *     min    - (IN) Lower bounds of range to be checked, inclusive.
   3469  *     max    - (IN) Upper bounds of range to be checked, inclusive.
   3470  *     group  - (IN) L3 interface group number.
   3471  *
   3472  * Returns:
   3473  *     BCM_E_INIT      - BCM unit not initialized
   3474  *     BCM_E_EXISTS    - Range ID already in use
   3475  *     BCM_E_RESOURCE  - Hardware range checkers all in use
   3476  *     BCM_E_PARAM     - Invalid L3 interface group number
   3477  *     BCM_E_NONE      - Success
   3478  *     BCM_E_XXX
   3479  */
   3480 int
   3481 bcm_esw_field_range_group_create_id(int unit,
   3482                                     bcm_field_range_t range,
   3483                                     uint32 flags,
   3484                                     bcm_l4_port_t min,
   3485                                     bcm_l4_port_t max,
   3486                                     bcm_if_group_t group)
   3487 {
   3488     return BCM_E_UNAVAIL;
   3489 }
   3490 
   3491 /*
   3492  * Function: bcm_esw_field_range_create
   3493  *    
   3494  * Purpose:
   3495  *     Allocate a range checker and set its parameters.
   3496  *
   3497  * Parameters:
   3498  *     unit   - BCM device number
   3499  *     range  - (OUT) Range check ID, will not be zero
   3500  *     flags  - One or more of BCM_FIELD_RANGE_* flags
   3501  *     min    - Lower bounds of range to be checked, inclusive
   3502  *     max    - Upper bounds of range to be checked, inclusive
   3503  *
   3504  * Returns:
   3505  *     BCM_E_INIT      - BCM unit not initialized
   3506  *     BCM_E_NONE      - Success
   3507  *     BCM_E_XXX
   3508  */
   3509 
   3510 int
   3511 bcm_esw_field_range_create(int unit,
   3512                            bcm_field_range_t *range,
   3513                            uint32 flags,
   3514                            bcm_l4_port_t min,
   3515                            bcm_l4_port_t max)
   3516 {
   3517     int rv;                   /* Operation return status.       */
   3518 
   3519     LOG_DEBUG(BSL_LS_BCM_FP,
   3520               (BSL_META_U(unit,
   3521                           "FP(unit %d) vverb:BEGIN bcm_esw_field_range_create( range->%p"), 
   3522                unit, range));
   3523     LOG_DEBUG(BSL_LS_BCM_FP,
   3524               (BSL_META_U(unit,
   3525                           "flags=%#08x, min=%#x, max=%#x)\n"),
   3526                flags, min, max));
   3527 
   3528     
   3529 
   3530     /* Range type sanity check. */
   3531     BCM_IF_ERROR_RETURN(_field_range_flags_check(unit, flags));
   3532 
   3533     FP_LOCK(unit);
   3534 
   3535     rv = _field_range_create(unit, range, flags, min, max, -1);
   3536 
   3537     FP_UNLOCK(unit);
   3538     return (rv);
   3539 }
   3540 
   3541 /*
   3542  * Function: bcm_esw_field_range_group_create
   3543  *    
   3544  * Purpose:
   3545  *     Allocate a range checker and set its parameters.
   3546  *
   3547  * Parameters:
   3548  *     unit   - BCM device number
   3549  *     range  - (OUT) Range check ID, will not be zero
   3550  *     flags  - One or more of BCM_FIELD_RANGE_* flags
   3551  *     min    - Lower bounds of range to be checked, inclusive
   3552  *     max    - Upper bounds of range to be checked, inclusive
   3553  *     group  - L3 interface group number
   3554  *
   3555  * Returns:
   3556  *     BCM_E_INIT      - BCM unit not initialized
   3557  *     BCM_E_PARAM     - Invalid L3 interface group number
   3558  *     BCM_E_NONE      - Success
   3559  *     BCM_E_XXX
   3560  */
   3561 
   3562 int
   3563 bcm_esw_field_range_group_create(int unit,
   3564                                  bcm_field_range_t *range,
   3565                                  uint32 flags,
   3566                                  bcm_l4_port_t min,
   3567                                  bcm_l4_port_t max,
   3568                                  bcm_if_group_t group)
   3569 {
   3570     return BCM_E_UNAVAIL;
   3571 }
   3572 
   3573 /*
   3574  * Function: bcm_esw_field_range_get
   3575  *    
   3576  * Purpose:
   3577  *     Get the TCP/UDP port for a range
   3578  *
   3579  * Parameters:
   3580  *     unit  - (IN)  BCM device number.
   3581  *     range - (IN)  Range check ID.
   3582  *     flags - (OUT) Current range checker flags
   3583  *     min   - (OUT) Lower bounds of range to be checked
   3584  *     max   - (OUT) Upper bounds of range to be checked
   3585  *
   3586  * Returns:
   3587  *     BCM_E_INIT      - BCM unit not initialized
   3588  *     BCM_E_NOT_FOUND - Invalid range ID
   3589  *     BCM_E_NONE      - Success
   3590  *     BCM_E_XXX
   3591  */
   3592 
   3593 int
   3594 bcm_esw_field_range_get(int unit,
   3595                         bcm_field_range_t range,
   3596                         uint32 *flags,
   3597                         bcm_l4_port_t *min,
   3598                         bcm_l4_port_t *max)
   3599 {
   3600     _field_stage_t      *stage_fc; /* Stage FP control info.   */
   3601     _field_range_t      *fr;       /* Field range info.        */   
   3602     int                 rv;        /* Operation return status. */
   3603 
   3604     
   3605     FP_LOCK(unit);
   3606 
   3607     rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc);
   3608     if (BCM_FAILURE(rv)) {
   3609         FP_UNLOCK(unit);
   3610         return (rv);
   3611     }
   3612 
   3613     for (fr = stage_fc->ranges; fr != NULL; fr = fr->next) {
   3614         if (fr->rid == range) {
   3615             break;
   3616         }
   3617     }
   3618 
   3619     if (fr == NULL) {
   3620         /* Check if it is present in the External */
   3621         rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_EXTERNAL, 
   3622                                       &stage_fc);
   3623         if (rv != BCM_E_NONE) {
   3624             FP_UNLOCK(unit);
   3625             return (BCM_E_NOT_FOUND);
   3626         }
   3627         for (fr = stage_fc->ranges; fr != NULL; fr = fr->next) {
   3628             if (fr->rid == range) {
   3629                 break;
   3630             }
   3631         }
   3632         if (fr == NULL) {
   3633             FP_UNLOCK(unit);
   3634             LOG_ERROR(BSL_LS_BCM_FP,
   3635                       (BSL_META_U(unit,
   3636                                   "FP(unit %d) Error: range=%d not found.\n"),
   3637                        unit, range));
   3638             return (BCM_E_NOT_FOUND);
   3639         }
   3640     }
   3641 
   3642     if (flags != NULL) {
   3643         *flags = fr->flags;
   3644     }
   3645 
   3646     if (min != NULL) {
   3647         *min = fr->min;
   3648     }
   3649 
   3650     if (max != NULL) {
   3651         *max = fr->max;
   3652     }
   3653 
   3654     FP_UNLOCK(unit);
   3655     return (BCM_E_NONE);
   3656 }
   3657 
   3658 /*
   3659  * Function: bcm_esw_field_range_destroy
   3660  *
   3661  * Purpose:
   3662  *     Deallocate a range
   3663  *
   3664  * Parameters:
   3665  *     unit  - BCM device number
   3666  *     range  - Range check ID
   3667  *
   3668  * Returns:
   3669  *     BCM_E_INIT      - BCM unit not initialized
   3670  *     BCM_E_NOT_FOUND - Invalid range ID
   3671  *     BCM_E_NONE      - Success
   3672  *     BCM_E_XXX
   3673  */
   3674 
   3675 int
   3676 bcm_esw_field_range_destroy(int unit,
   3677                             bcm_field_range_t range)
   3678 {
   3679     _field_stage_t      *stage_fc;
   3680     _field_range_t      *fr, *fr2, *fr_prev; 
   3681     int                 use_count;
   3682     int                 rv;
   3683 
   3684     
   3685     FP_LOCK(unit);
   3686 
   3687 #if defined (BCM_TOMAHAWK_SUPPORT)
   3688     if (soc_feature(unit, soc_feature_field_multi_pipe_support)
   3689          && RANGE_CTRL(unit) &&
   3690          (RANGE_CTRL(unit)->range_used_by_module ==
   3691           RANGE_USED_BY_RANGE_MODULE)) {
   3692         LOG_CLI((BSL_META("Range resource is used by Range module. \n")));
   3693         FP_UNLOCK(unit);
   3694         return BCM_E_UNAVAIL;
   3695     }
   3696 #endif
   3697 
   3698     rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS,  &stage_fc);
   3699     if (BCM_FAILURE(rv)) {
   3700         FP_UNLOCK(unit);
   3701         return (rv);
   3702     }
   3703 
   3704     /* Find matching entry */
   3705     fr_prev = NULL;
   3706     for (fr = stage_fc->ranges; fr != NULL; fr = fr->next) {
   3707         if (fr->rid == range) {
   3708             break;
   3709         }
   3710         fr_prev = fr;
   3711     }
   3712 
   3713     if (fr == NULL) {
   3714         /* Check if it is present in the External */
   3715         rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_EXTERNAL, 
   3716                                       &stage_fc);
   3717         if (rv != BCM_E_NONE) {
   3718             FP_UNLOCK(unit);
   3719             return (BCM_E_NOT_FOUND);
   3720         }
   3721         fr_prev = NULL;
   3722         for (fr = stage_fc->ranges; fr != NULL; fr = fr->next) {
   3723             if (fr->rid == range) {
   3724                 break;
   3725             }
   3726             fr_prev = fr;
   3727         }
   3728         if (fr == NULL) {
   3729             FP_UNLOCK(unit);
   3730             LOG_ERROR(BSL_LS_BCM_FP,
   3731                       (BSL_META_U(unit,
   3732                                   "FP(unit %d) Error: range=%d not found in.\n"),
   3733                        unit, range));
   3734             return (BCM_E_NOT_FOUND);
   3735         }
   3736     }
   3737 
   3738     {
   3739         /* See how many entries are using the same hardware index */
   3740         use_count = 0;
   3741 
   3742         for (fr2 = stage_fc->ranges; fr2 != NULL; fr2 = fr2->next) {
   3743             if (fr2->hw_index == fr->hw_index && fr->style == fr2->style) {
   3744                 use_count++;
   3745             }
   3746         }
   3747 
   3748         /* Clear from hardware if this is the only use */
   3749         assert(use_count > 0);
   3750 
   3751         if (use_count == 1) {
   3752             rv = BCM_E_UNAVAIL;
   3753 
   3754 #if defined(BCM_TRX_SUPPORT)
   3755             if (SOC_IS_TRX(unit)) {
   3756                 rv = _bcm_field_trx_range_check_set(unit, fr->hw_index,
   3757                                                     (fr->flags & BCM_FIELD_RANGE_EXTERNAL),
   3758                                                     0, 0, 0);
   3759             } else 
   3760 #endif /* BCM_TRX_SUPPORT */
   3761 #if defined(BCM_FIREBOLT_SUPPORT)
   3762                 if (SOC_IS_FBX(unit)) {
   3763                     rv = _field_fb_er_range_check_set(unit, fr->hw_index, 
   3764                                                       0, 0, 0, 0);
   3765                 }
   3766 #endif /* BCM_FIREBOLT_SUPPORT */
   3767 
   3768             if (BCM_FAILURE(rv)) {
   3769                 FP_UNLOCK(unit);
   3770                 return rv;
   3771             }
   3772         }
   3773     }
   3774 
   3775     /* Remove from list and free */
   3776     if (fr_prev == NULL) {
   3777         stage_fc->ranges = fr->next;
   3778     } else {
   3779         fr_prev->next = fr->next;
   3780     }
   3781 
   3782     FP_UNLOCK(unit);
   3783     sal_free(fr);
   3784     return (BCM_E_NONE);
   3785 }
   3786 
   3787 /*
   3788  * Section: Field Entries
   3789  */
   3790 
   3791 /*
   3792  * Function: bcm_esw_field_entry_create
   3793  *
   3794  * Purpose:
   3795  *     Create a blank entry based on a group. Automatically generate an entry
   3796  *     ID.
   3797  *
   3798  * Parameters:
   3799  *     unit  - BCM device number
   3800  *     group - Field group ID
   3801  *     entry - (OUT) New entry
   3802  *
   3803  * Returns:
   3804  *     BCM_E_INIT        BCM unit not initialized
   3805  *     BCM_E_NOT_FOUND   group not found in unit
   3806  *     BCM_E_PARAM       *entry was NULL
   3807  *     BCM_E_RESOURCE    No unused entries available
   3808  *     BCM_E_XXX         Error from bcm_field_entry_create_id
   3809  *
   3810  * See Also:
   3811  * bcm_field_entry_create_id
   3812  */
   3813 
   3814 int
   3815 bcm_esw_field_entry_create(int unit, bcm_field_group_t group,
   3816                            bcm_field_entry_t *entry)
   3817 {
   3818     _field_control_t    *fc;           /* Field control structure.    */
   3819     _field_group_t      *fg;           /* Field group structure.      */
   3820     _field_entry_t      *f_ent;        /* Field entry pointer.        */ 
   3821     int                 rv;            /* Operation return status.    */
   3822 
   3823     if (entry == NULL) {
   3824         LOG_ERROR(BSL_LS_BCM_FP,
   3825                   (BSL_META_U(unit,
   3826                               "FP(unit %d) Error: entry == NULL.\n"),
   3827                    unit));
   3828         return (BCM_E_PARAM);
   3829     }
   3830     
   3831     
   3832     FP_LOCK(unit);
   3833     rv = _field_control_get(unit, &fc);
   3834     if (BCM_FAILURE(rv)) {
   3835         FP_UNLOCK(unit);
   3836         return rv;
   3837     }
   3838 
   3839     rv = _field_group_get(unit, group, &fg);
   3840     if (BCM_FAILURE(rv)) {
   3841         FP_UNLOCK(unit);
   3842         return (rv);
   3843     }
   3844 
   3845     /* When MaxGroupSizeHardLimit is set and limit is reached
   3846      * return BCM_E_FULL */
   3847     if (fg->flags & _FP_GROUP_MAX_SIZE_HARD_LIMIT) {
   3848         if (fg->max_group_size -
   3849                 (fg->group_status.entry_count) <= 0) {
   3850             FP_UNLOCK(unit);
   3851             return BCM_E_FULL;
   3852         }
   3853     }
   3854 
   3855     /* Generate an entry ID.  */
   3856     fc->last_allocated_eid++;
   3857     while (BCM_SUCCESS(_field_entry_get(unit, fc->last_allocated_eid, 
   3858                                         _FP_ENTRY_PRIMARY, &f_ent))) {
   3859         fc->last_allocated_eid++;
   3860         if (_FP_ID_MAX == fc->last_allocated_eid) {
   3861             fc->last_allocated_eid = _FP_ID_BASE;
   3862         }
   3863     }
   3864 
   3865     *entry = fc->last_allocated_eid;
   3866 
   3867 #if defined(BCM_TOMAHAWK_SUPPORT)
   3868     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   3869        (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   3870         rv = _bcm_field_th_class_entry_create(unit, group, *entry);
   3871         FP_UNLOCK(unit);
   3872         return (rv);
   3873     }
   3874 #endif /* BCM_TOMAHAWK_SUPPORT */
   3875 
   3876     rv = _field_entry_create_id(unit, group, *entry);
   3877 
   3878     FP_UNLOCK(unit);
   3879     return (rv);
   3880 }
   3881 
   3882 /*
   3883  * Function: bcm_esw_field_entry_create_id
   3884  *
   3885  * Purpose:
   3886  *     Create a blank entry group based on a group;
   3887  *     allows selection of a specific slot in a slice
   3888  *
   3889  * Parameters:
   3890  *     unit -  (IN) BCM device number.
   3891  *     group - (IN) Field group ID.
   3892  *     entry - (IN) Requested entry ID; must be in the range prio_min through
   3893  *             prio_max as returned by bcm_field_group_status_get().
   3894  * Returns:
   3895  *     BCM_E_INIT      - unit not initialized
   3896  *     BCM_E_EXISTS    - Entry ID already in use
   3897  *     BCM_E_NOT_FOUND - Group ID not found in unit
   3898  *     BCM_E_MEMORY    - allocation failure
   3899  *     BCM_E_NONE      - Success
   3900  */
   3901 int
   3902 bcm_esw_field_entry_create_id(int unit,
   3903                               bcm_field_group_t group,
   3904                               bcm_field_entry_t entry)
   3905 {
   3906     int                 rv;
   3907 
   3908      /* Check if Entry ID is not internal reserved ID */
   3909 
   3910     /* coverity[result_independent_of_operands : FALSE] */
   3911     if ((entry >= (_FP_INTERNAL_RESERVED_ID_MIN))
   3912        && (entry <= _FP_INTERNAL_RESERVED_ID_MAX)) {
   3913        LOG_ERROR(BSL_LS_BCM_FP,
   3914                   (BSL_META_U(unit,
   3915                   "FP(unit %d) Error: This Entry ID is reserved"
   3916                   " for internal use\n"),
   3917                   unit));
   3918         return (BCM_E_PARAM);
   3919     }
   3920 
   3921 
   3922     FP_LOCK(unit);
   3923 
   3924     rv = _bcm_field_entry_create_id(unit, group, entry);
   3925 
   3926     FP_UNLOCK(unit);
   3927 
   3928     return (rv);
   3929 }
   3930 
   3931 /*
   3932  * Function: bcm_esw_field_entry_multi_get
   3933  *
   3934  * Purpose:
   3935  *     Gets an array of a group's entry IDs
   3936  *
   3937  * Parameters:
   3938  *     unit -  (IN) BCM device number.
   3939  *     group - (IN) Field group ID.
   3940  *     entry_size - (IN) Maximum number of entries to return.  Set to 0
   3941  *                       to get the number of entries available
   3942  *     entry_array - (OUT) Pointer to a buffer to fill with the array of
   3943  *                         entry IDs.  Ignored if entry_size is 0
   3944  *     entry_count - (OUT) Returns the number of entries returned in the
   3945  *                         array, or if entry_size was 0, the number of
   3946  *                         entries available
   3947 
   3948  * Returns:
   3949  *     BCM_E_INIT      - unit not initialized
   3950  *     BCM_E_NOT_FOUND - Group ID not found in unit
   3951  *     BCM_E_NONE      - Success
   3952  */
   3953 int
   3954 bcm_esw_field_entry_multi_get(int unit, bcm_field_group_t group,
   3955     int entry_size, bcm_field_entry_t *entry_array, int *entry_count)
   3956 {
   3957         int entry_index;
   3958     _field_group_t *fg_p;
   3959     int rv;
   3960 
   3961     FP_LOCK(unit);
   3962 
   3963     rv = _field_group_get(unit, group, &fg_p);
   3964 
   3965     if (BCM_SUCCESS(rv))
   3966     {
   3967         if (entry_count == NULL) {
   3968             LOG_ERROR(BSL_LS_BCM_FP,
   3969                       (BSL_META_U(unit,
   3970                                   "FP(unit %d) Error: entry_count == NULL.\n"),
   3971                        unit));
   3972             FP_UNLOCK(unit); 
   3973             return (BCM_E_PARAM);
   3974         }
   3975 
   3976         if (entry_size == 0)
   3977         {
   3978             *entry_count = fg_p->group_status.entry_count;
   3979         }
   3980         else
   3981         {
   3982             if (entry_array == NULL) {
   3983                 LOG_ERROR(BSL_LS_BCM_FP,
   3984                           (BSL_META_U(unit,
   3985                                       "FP(unit %d) Error: entry_array == NULL.\n"),
   3986                            unit));
   3987                 FP_UNLOCK(unit); 
   3988                 return (BCM_E_PARAM);
   3989             }
   3990             if (entry_size > fg_p->group_status.entry_count)
   3991             {
   3992                 entry_size = fg_p->group_status.entry_count;
   3993             }
   3994 
   3995             for (entry_index = 0;
   3996                 entry_index < entry_size; ++entry_index)
   3997             {
   3998                 *entry_array = (fg_p->entry_arr[entry_index])->eid;
   3999 
   4000                 ++entry_array;
   4001             }
   4002 
   4003             *entry_count = entry_size;
   4004         }
   4005     }
   4006 
   4007     FP_UNLOCK(unit);
   4008     return (rv);
   4009 }
   4010 
   4011 /*
   4012  * Function: bcm_esw_field_entry_destroy
   4013  *
   4014  * Purpose:
   4015  *     Deallocate the memory used to track an entry. This does not remove the
   4016  *     entry from hardware if it has been installed. In order to remove an
   4017  *     entry from hardware, call bcm_field_entry_remove() prior to calling this
   4018  *     API.
   4019  *
   4020  * Parameters:
   4021  *     unit  - BCM device number
   4022  *     entry - Entry ID
   4023  *
   4024  * Returns:
   4025  *     BCM_E_INIT      - BCM unit not initialized
   4026  *     BCM_E_NOT_FOUND - Entry ID not found
   4027  *     BCM_E_XXX       - From bcm_field_counter_destroy() or
   4028  *                       bcm_field_meter_destroy()
   4029  *     BCM_E_NONE      - Success
   4030  */
   4031 int
   4032 bcm_esw_field_entry_destroy(int unit, bcm_field_entry_t entry)
   4033 {
   4034         _field_entry_t      *f_ent;
   4035         _field_control_t    *fc; 
   4036         _field_stage_t      *stage_fc;      /* Stage field control structure. */
   4037         _field_group_t      *fg;         /* Field group structure.          */
   4038         int                 rv;
   4039 
   4040         FP_LOCK(unit);
   4041         rv = _field_control_get(unit, &fc);
   4042         if (BCM_FAILURE(rv)) {
   4043             FP_UNLOCK(unit);
   4044             return rv;
   4045         }
   4046 
   4047         rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
   4048         if (BCM_FAILURE(rv)) {
   4049            FP_UNLOCK(unit);
   4050            return (rv);
   4051         }
   4052 
   4053         /* Cleanup the entry if the entry has backed up earlier */
   4054         if (NULL != f_ent->ent_copy) {
   4055             rv = _bcm_field_entry_cleanup(unit, entry);
   4056             if (BCM_FAILURE(rv)) {
   4057                 FP_UNLOCK(unit);
   4058                 return (rv);
   4059             }
   4060         }
   4061 
   4062 #if defined(BCM_TOMAHAWK_SUPPORT)
   4063         if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   4064                 (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   4065             rv = _bcm_field_th_class_entry_destroy(unit, f_ent);
   4066             FP_UNLOCK(unit);
   4067             return (rv);
   4068         }
   4069 #endif /* BCM_TOMAHAWK_SUPPORT */
   4070 
   4071     /* Get stage field control structure. */
   4072     rv = _field_stage_control_get(unit, f_ent->fs->stage_id, &stage_fc);
   4073     if (BCM_FAILURE(rv)) {
   4074         FP_UNLOCK(unit);
   4075         return (rv);
   4076     }
   4077 
   4078     fg = f_ent->group;
   4079 
   4080     /* Remove entry from hw before destroying sw image. */
   4081     if (f_ent->flags & _FP_ENTRY_INSTALLED) {
   4082         rv = bcm_esw_field_entry_remove(unit, entry);
   4083         if (BCM_FAILURE(rv)) {
   4084             FP_UNLOCK(unit);
   4085             return(rv);
   4086         }
   4087     }
   4088 
   4089     /* Destroy entry policers */
   4090     rv = bcm_esw_field_entry_policer_detach_all(unit, entry);
   4091     if (BCM_FAILURE(rv)) {
   4092         FP_UNLOCK(unit);
   4093         return(rv);
   4094     }
   4095 
   4096     /* Destroy entry stats */
   4097     if (f_ent->statistic.flags & _FP_ENTRY_STAT_VALID) {
   4098         rv = fc->functions.fp_entry_stat_detach(unit,
   4099                              f_ent, f_ent->statistic.sid);
   4100         if (BCM_FAILURE(rv)) {
   4101             FP_UNLOCK(unit);
   4102             return(rv);
   4103         }
   4104     }
   4105 
   4106 #if defined BCM_TRIDENT2PLUS_SUPPORT
   4107     if (SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit)) {
   4108         if (f_ent->statistic.flags & _FP_ENTRY_EXTENDED_STAT_VALID) {
   4109             rv = fc->functions.fp_entry_stat_detach(unit,
   4110                     f_ent, f_ent->statistic.extended_sid);
   4111             if (BCM_FAILURE(rv)) {
   4112                 FP_UNLOCK(unit);
   4113                 return(rv);
   4114             }
   4115         }
   4116     }
   4117 #endif
   4118 
   4119     if (soc_feature(unit, soc_feature_epc_linkflap_recover)) {
   4120 #if defined(BCM_TRX_SUPPORT)
   4121         if (SOC_IS_TRX(unit)) {
   4122             /* Clear EntryId from _entry_egr_ports_recovery database*/
   4123             _bcm_trx_field_egr_ports_recovery_entry_remove (unit, entry);
   4124         }
   4125 #endif
   4126     }
   4127 
   4128         /* Destroy entry sw images. */
   4129     rv = _field_entry_phys_destroy(unit, f_ent);
   4130     if (BCM_FAILURE(rv)) {
   4131         FP_UNLOCK(unit);
   4132         return(rv);
   4133     }
   4134     f_ent = NULL;
   4135 
   4136 #if defined(BCM_TOMAHAWK_SUPPORT)
   4137     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   4138         ((_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id) ||
   4139          (_BCM_FIELD_STAGE_EXACTMATCH == stage_fc->stage_id) ||
   4140          (_BCM_FIELD_STAGE_FLOWTRACKER == stage_fc->stage_id))) {
   4141        rv = _bcm_field_th_group_free_unused_slices(unit, stage_fc, fg);
   4142     } else 
   4143 #endif /* BCM_TOMAHAWK_SUPPORT */
   4144     { 
   4145        rv = _field_group_free_unused_slices(unit, stage_fc, fg);
   4146     }
   4147     if (BCM_FAILURE(rv)) {
   4148         FP_UNLOCK(unit);
   4149         return(rv);
   4150     }
   4151 
   4152 #ifdef BCM_WARM_BOOT_SUPPORT
   4153     SOC_CONTROL_LOCK(unit);
   4154     SOC_CONTROL(unit)->scache_dirty = 1;
   4155     SOC_CONTROL_UNLOCK(unit);
   4156 #endif
   4157 
   4158     FP_UNLOCK(unit);
   4159     return (BCM_E_NONE);
   4160 }
   4161 
   4162 /*
   4163  * Function: bcm_esw_field_entry_destroy_all
   4164  *
   4165  * Purpose:
   4166  *     Destroy all entries on a unit. It iterates over all slices in a unit.
   4167  *     For each slice, If entries exist, it calls bcm_field_entry_destroy()
   4168  *     using the Entry ID.
   4169  *
   4170  * Parameters:
   4171  *     unit - (IN) BCM device number.
   4172  *
   4173  * Returns:
   4174  *     BCM_E_XXX       - Error from bcm_field_entry_destroy().
   4175  *     BCM_E_INIT      - BCM unit not initialized.
   4176  *     BCM_E_NONE      - Success.
   4177  */
   4178 int
   4179 bcm_esw_field_entry_destroy_all(int unit)
   4180 {
   4181     _field_control_t    *fc;         /* Field control structure. */
   4182     _field_group_t      *fg;         /* Field group info.        */
   4183     _field_stage_t      *stage_fc;   /* Stage field control info.*/
   4184     int                 rv;          /* Operation return status. */
   4185 
   4186     LOG_DEBUG(BSL_LS_BCM_FP,
   4187               (BSL_META_U(unit,
   4188                           "FP(unit %d) vverb: bcm_field_entry_destroy_all()\n"),
   4189                unit));
   4190     
   4191     FP_LOCK(unit);
   4192     rv = _field_control_get(unit, &fc);
   4193     if (BCM_FAILURE(rv)) {
   4194         FP_UNLOCK(unit);
   4195         return rv;
   4196     }
   4197 
   4198     fg = fc->groups;
   4199     if (NULL == fg) {
   4200         FP_UNLOCK(unit);
   4201         return (BCM_E_NONE);
   4202     }  
   4203 
   4204     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
   4205     if (BCM_FAILURE(rv)) {
   4206         FP_UNLOCK(unit);
   4207         return (rv);
   4208     }
   4209 
   4210     /* Scan unit's groups freeing each entry list. */
   4211     for (; fg != NULL; fg = fg->next) {
   4212         /* EM COS SW WAR for TH3 */
   4213 #if defined(BCM_TOMAHAWK3_SUPPORT)
   4214         if((soc_feature(unit, soc_feature_sw_mmu_flush_rqe_operation)) &&
   4215            (!(SOC_WARM_BOOT(unit)))) {
   4216             if (fg->gid == _FP_INTERNAL_RESERVED_EM_ID) {
   4217                 continue;
   4218             }
   4219         }
   4220 #endif /* BCM_TOMAHAWK3_SUPPORT */
   4221         /* Destroy all entries in the group. */
   4222         while(fg->group_status.entry_count) {
   4223             rv =  bcm_esw_field_entry_destroy(unit, (fg->entry_arr[0])->eid);
   4224             if (BCM_FAILURE(rv)) {
   4225                 FP_UNLOCK(unit);
   4226                 return (rv);
   4227             }
   4228         }
   4229     }
   4230 
   4231     FP_UNLOCK(unit);
   4232     return (BCM_E_NONE);
   4233 }
   4234 
   4235 /*
   4236  * Function: _bcm_field_entry_copy
   4237  *
   4238  * Purpose:
   4239  *     Create a copy of an existing entry. The new entry will be a member of
   4240  *     the same group as the source entry.
   4241  *
   4242  * Parameters:
   4243  *     unit      - BCM device number
   4244  *     src_entry - Entry to copy
   4245  *     dst_entry - (OUT) New entry
   4246  *     flags     - Flags to control entry copy
   4247  *
   4248  * Returns:
   4249  *     BCM_E_INIT        BCM Unit not initialized
   4250  *     BCM_E_NOT_FOUND   Source entry not found
   4251  *     BCM_E_INTERNAL    No group exists for source entry ID.
   4252  *     BCM_E_PARAM       dst_entry pointing to NULL
   4253  *     BCM_E_RESOURCE    No destination entry available
   4254  *     BCM_E_XXX         Error from bcm_field_entry_copy_id()
   4255  */
   4256 int
   4257 _bcm_field_entry_copy(int unit,
   4258                       bcm_field_entry_t src_entry,
   4259                       bcm_field_entry_t *dst_entry,
   4260                       uint32 flags)
   4261 {
   4262     _field_entry_t      *f_ent_src;
   4263     _field_entry_t      *f_ent;
   4264     int                 rv;
   4265 
   4266     if (dst_entry == NULL) {
   4267         LOG_ERROR(BSL_LS_BCM_FP,
   4268                   (BSL_META_U(unit,
   4269                               "FP(unit %d) Error: dst_entry == NULL\n"),
   4270                    unit));
   4271         return (BCM_E_PARAM);
   4272     }
   4273 
   4274     
   4275     FP_LOCK(unit);
   4276 
   4277     rv = _field_entry_get(unit, src_entry, _FP_ENTRY_PRIMARY, &f_ent_src);
   4278     if (BCM_FAILURE(rv)) {
   4279         FP_UNLOCK(unit);
   4280         return (rv);
   4281     }
   4282 
   4283     /* Generate a destination Entry ID.  */
   4284     *dst_entry = src_entry + 1;
   4285     while (BCM_SUCCESS
   4286            (_field_entry_get(unit, *dst_entry, _FP_ENTRY_PRIMARY, &f_ent))) {
   4287         *dst_entry += 1;
   4288         if (_FP_ID_MAX == *dst_entry) {
   4289             *dst_entry = _FP_ID_BASE;
   4290         }
   4291 
   4292     }
   4293 
   4294     /* Check if Entry ID is not internal reserved ID */
   4295 
   4296     /* coverity[result_independent_of_operands : FALSE] */
   4297     if ((*dst_entry >= (_FP_INTERNAL_RESERVED_ID_MIN))
   4298        && (*dst_entry <= _FP_INTERNAL_RESERVED_ID_MAX)) {
   4299        LOG_ERROR(BSL_LS_BCM_FP,
   4300                   (BSL_META_U(unit,
   4301                   "FP(unit %d) Error: This Entry ID is reserved"
   4302                   " for internal use\n"),
   4303                   unit));
   4304         FP_UNLOCK(unit);
   4305         return (BCM_E_PARAM);
   4306     }
   4307 
   4308     rv = _bcm_field_entry_copy_id(unit, src_entry, *dst_entry, flags);
   4309 
   4310     FP_UNLOCK(unit);
   4311     return (rv);
   4312 }
   4313 
   4314 /*
   4315  * Function: bcm_esw_field_entry_copy
   4316  *
   4317  * Purpose:
   4318  *     Create a copy of an existing entry. The new entry will be a member of
   4319  *     the same group as the source entry.
   4320  *
   4321  * Parameters:
   4322  *     unit      - BCM device number
   4323  *     src_entry - Entry to copy
   4324  *     dst_entry - (OUT) New entry
   4325  *     flags     - flags to control entry copy
   4326  *                 0 : stats(if attached)will be copied
   4327  *                 BCM_FIELD_ENTRY_COPY_WITHOUT_STATS : Stats are not copied
   4328  * Returns:
   4329  *     BCM_E_INIT        BCM Unit not initialized
   4330  *     BCM_E_NOT_FOUND   Source entry not found
   4331  *     BCM_E_INTERNAL    No group exists for source entry ID.
   4332  *     BCM_E_PARAM       dst_entry pointing to NULL
   4333  *     BCM_E_RESOURCE    No destination entry available
   4334  *     BCM_E_XXX         Error from bcm_field_entry_copy_id()
   4335  */
   4336 int
   4337 bcm_esw_field_entry_config_copy(int unit,
   4338                          bcm_field_entry_t src_entry,
   4339                          bcm_field_entry_t *dst_entry,
   4340                          uint32 flags)
   4341 {
   4342     return _bcm_field_entry_copy(unit,src_entry, dst_entry, flags);
   4343 }
   4344 /*
   4345  * Function: bcm_esw_field_entry_copy
   4346  *
   4347  * Purpose:
   4348  *     Create a copy of an existing entry. The new entry will be a member of
   4349  *     the same group as the source entry.
   4350  *
   4351  * Parameters:
   4352  *     unit      - BCM device number
   4353  *     src_entry - Entry to copy
   4354  *     dst_entry - (OUT) New entry
   4355  *
   4356  * Returns:
   4357  *     BCM_E_INIT        BCM Unit not initialized
   4358  *     BCM_E_NOT_FOUND   Source entry not found
   4359  *     BCM_E_INTERNAL    No group exists for source entry ID.
   4360  *     BCM_E_PARAM       dst_entry pointing to NULL
   4361  *     BCM_E_RESOURCE    No destination entry available
   4362  *     BCM_E_XXX         Error from bcm_field_entry_copy_id()
   4363  */
   4364 int
   4365 bcm_esw_field_entry_copy(int unit,
   4366                          bcm_field_entry_t src_entry,
   4367                          bcm_field_entry_t *dst_entry)
   4368 {
   4369     return _bcm_field_entry_copy(unit,src_entry, dst_entry, 0);
   4370 }
   4371 
   4372 /*
   4373  * Function: bcm_esw_field_entry_copy_id
   4374  *
   4375  * Purpose:
   4376  *     Create a copy of an existing entry with a requested ID
   4377  *
   4378  * Parameters:
   4379  *     unit      - BCM device number
   4380  *     src_entry - Source entry to copy
   4381  *     dst_entry - Destination entry for copy
   4382  *
   4383  * Returns:
   4384  *     BCM_E_INIT      - BCM Unit not initialized
   4385  *     BCM_E_NOT_FOUND - Source Entry ID not found
   4386  *     BCM_E_XXX       - Error code from bcm_field_entry_create_id()
   4387  *     BCM_E_NONE      - Success
   4388  */
   4389 
   4390 int
   4391 bcm_esw_field_entry_copy_id(int unit,
   4392                             bcm_field_entry_t src_entry,
   4393                             bcm_field_entry_t dst_entry)
   4394 {
   4395     int                 rv;
   4396 
   4397     /* Check if Entry ID is not internal reserved ID */
   4398 
   4399     /* coverity[result_independent_of_operands : FALSE] */
   4400     if ((dst_entry >= (_FP_INTERNAL_RESERVED_ID_MIN))
   4401        && (dst_entry <= _FP_INTERNAL_RESERVED_ID_MAX)) {
   4402        LOG_ERROR(BSL_LS_BCM_FP,
   4403                   (BSL_META_U(unit,
   4404                   "FP(unit %d) Error: This Entry ID is reserved"
   4405                   " for internal use\n"),
   4406                   unit));
   4407         return (BCM_E_PARAM);
   4408     }
   4409     /* flags 0 is passed s that stats (if any attached) are copied */
   4410     rv = _bcm_field_entry_copy_id(unit, src_entry, dst_entry, 0);
   4411     return rv;
   4412 }
   4413 
   4414 /*
   4415  * Function: bcm_esw_field_entry_install
   4416  *
   4417  * Purpose:
   4418  *     Install a entry into the hardware tables.
   4419  *
   4420  * Parameters:
   4421  *     unit - BCM device number
   4422  *     entry - Entry to install
   4423  *
   4424  * Returns:
   4425  *     BCM_E_INIT      - BCM unit not initialized
   4426  *     BCM_E_NOT_FOUND - Entry ID not found on unit.
   4427  *     BCM_E_XXX       - Error from _field_XX_tcam_policy_install()
   4428  *     BCM_E_NONE      - Success
   4429  *
   4430  * Notes:
   4431  *     Qualifications should be made and actions should be added
   4432  *     prior to installing the entry.
   4433  */
   4434 int
   4435 bcm_esw_field_entry_install(int unit, bcm_field_entry_t entry)
   4436 {
   4437     return bcm_esw_field_entry_reinstall(unit, entry);
   4438 }
   4439 
   4440 /*
   4441  * Function:
   4442  *
   4443  * Purpose:
   4444  *     Re-install a entry into the hardware tables.
   4445  *
   4446  * Parameters:
   4447  *     unit  - (IN) BCM device number
   4448  *     entry - (IN) Entry to install
   4449  *
   4450  * Returns:
   4451  *     BCM_E_XXX   
   4452  */
   4453 int
   4454 bcm_esw_field_entry_reinstall(int unit, bcm_field_entry_t entry)
   4455 {
   4456     _field_entry_t      *f_ent; /* Field entry structure.   */
   4457     int                 rv;     /* Operation return status. */
   4458     int                 dirty = 0;  /* Field entry dirty flag.  */
   4459     int                 action_dirty = 0;  /* Field entry action dirty flag. */
   4460 
   4461     
   4462     FP_LOCK(unit);
   4463 
   4464     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
   4465     if (BCM_FAILURE(rv)) {
   4466         FP_UNLOCK(unit);
   4467         return rv;
   4468     }
   4469 
   4470 #if defined(BCM_TOMAHAWK_SUPPORT)
   4471     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   4472         (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   4473         rv = _bcm_field_th_class_entry_install(unit, entry);
   4474         FP_UNLOCK(unit);
   4475         return (rv);
   4476     }
   4477 #endif /* BCM_TOMAHAWK_SUPPORT */
   4478 
   4479     /* Check if only action has been modifed for this entry. */
   4480     rv = _field_entry_action_dirty(unit, f_ent, &action_dirty);
   4481     if (BCM_FAILURE(rv)) {
   4482         FP_UNLOCK(unit);
   4483         return (rv);
   4484     }
   4485 
   4486     /* Check if any parameter has been modified for this entry. */
   4487     rv = _field_entry_dirty(unit, f_ent, &dirty);
   4488     if (BCM_FAILURE(rv)) {
   4489         FP_UNLOCK(unit);
   4490         return (rv);
   4491     }
   4492 
   4493 #if defined(BCM_TOMAHAWK_SUPPORT)
   4494     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   4495         (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXACTMATCH)) {
   4496         /* entry is dirty or action is dirty 
   4497          * exact match should call install function always.
   4498          */
   4499         if (action_dirty || dirty) {
   4500             dirty = TRUE;
   4501             action_dirty = FALSE;
   4502         }
   4503     }
   4504 #endif /* BCM_TOMAHAWK_SUPPORT */
   4505 
   4506     if (action_dirty) {
   4507          /* Write Policy table for this entry. */
   4508          rv = _field_tcam_policy_reinstall(unit, entry);
   4509     } else if (dirty) {
   4510         /* Write TCAM and Policy table for this entry.*/
   4511         rv = _field_tcam_policy_install(unit, entry);
   4512     } else {
   4513         rv = BCM_E_NONE;
   4514     }
   4515 
   4516 #ifdef BCM_WARM_BOOT_SUPPORT
   4517     SOC_CONTROL_LOCK(unit);
   4518     SOC_CONTROL(unit)->scache_dirty = 1;
   4519     SOC_CONTROL_UNLOCK(unit);
   4520 #endif
   4521     /* This is to cleanup the meter entry setthat were to be released that
   4522      * are being moved to backup(old) state by calling bcm_policer_set api
   4523      */
   4524     if ( f_ent->flags & _FP_ENTRY_METER_MODIFIED) {
   4525       rv = _field_policers_hw_free_old(unit, f_ent);
   4526     }
   4527 
   4528     FP_UNLOCK(unit);
   4529     return rv;
   4530 }
   4531 
   4532 
   4533 /*
   4534  * Function: bcm_esw_field_entry_remove
   4535  *
   4536  * Purpose:
   4537  *     Remove an entry from the hardware tables.
   4538  *
   4539  * Parameters:
   4540  *     unit - BCM device number
   4541  *     entry - Entry to remove
   4542  *
   4543  * Returns:
   4544  *     BCM_E_XXX
   4545  *
   4546  * Notes:
   4547  *     This does not destroy the entry; it only uninstalls it from
   4548  *     any hardware tables. To deallocate the memory used by the entry call
   4549  *     bcm_field_entry_destroy.
   4550  */
   4551 int
   4552 bcm_esw_field_entry_remove(int unit, bcm_field_entry_t entry)
   4553 {
   4554     _field_control_t    *fc;         /* Field control structure. */
   4555     int                 rv;          /* Operation return status. */
   4556 
   4557     
   4558     FP_LOCK(unit);
   4559     rv = _field_control_get(unit, &fc);
   4560     if (BCM_FAILURE(rv)) {
   4561         FP_UNLOCK(unit);
   4562         return rv;
   4563     }
   4564 
   4565     rv =  _field_entry_remove(unit, fc, entry);
   4566 
   4567 #ifdef BCM_WARM_BOOT_SUPPORT
   4568     SOC_CONTROL_LOCK(unit);
   4569     SOC_CONTROL(unit)->scache_dirty = 1;
   4570     SOC_CONTROL_UNLOCK(unit);
   4571 #endif
   4572 
   4573     FP_UNLOCK(unit);
   4574     return (rv);
   4575 }
   4576 
   4577 /*
   4578  * Function: bcm_esw_field_group_install
   4579  *
   4580  * Purpose:
   4581  *     Install all of a group's entries into the hardware tables.
   4582  *
   4583  * Parameters:
   4584  *     unit - BCM device number
   4585  *     group - Group to install
   4586  *
   4587  * Returns:
   4588  *     BCM_E_INIT      - BCM unit not initialized
   4589  *     BCM_E_NOT_FOUND - Group ID not found on unit.
   4590  *     BCM_E_XXX       - Error from bcm_esw_field_entry_install()
   4591  *     BCM_E_NONE      - Success
   4592  */
   4593 
   4594 int
   4595 bcm_esw_field_group_install(int unit, bcm_field_group_t group)
   4596 {
   4597     _field_group_t *fg_p;
   4598     int entry_index;
   4599     int rv;
   4600 
   4601     
   4602     FP_LOCK(unit);
   4603 
   4604     rv = _field_group_get(unit, group, &fg_p);
   4605     if (BCM_FAILURE(rv)) {
   4606         FP_UNLOCK(unit);
   4607         return (rv);
   4608     }
   4609 
   4610 #if defined(BCM_TOMAHAWK_SUPPORT)
   4611     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   4612         (fg_p->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   4613         FP_UNLOCK(unit);
   4614         return (BCM_E_UNAVAIL);
   4615     }
   4616 #endif /* BCM_TOMAHAWK_SUPPORT */
   4617 
   4618     for (entry_index = 0;
   4619         entry_index < fg_p->group_status.entry_count;
   4620         ++entry_index)
   4621     {
   4622 	rv = bcm_esw_field_entry_install(unit,
   4623 		fg_p->entry_arr[entry_index]->eid);
   4624         if (BCM_FAILURE(rv)) {
   4625             FP_UNLOCK(unit);
   4626             return (rv);
   4627         }
   4628     }
   4629 
   4630     FP_UNLOCK(unit);
   4631 
   4632     return BCM_E_NONE;
   4633 }
   4634 
   4635 /*
   4636  * Function: bcm_esw_field_group_remove
   4637  *
   4638  * Purpose:
   4639  *     Remove all of a group's entries from the hardware tables.
   4640  *
   4641  * Parameters:
   4642  *     unit - BCM device number
   4643  *     group - Group to install
   4644  *
   4645  * Returns:
   4646  *     BCM_E_INIT      - BCM unit not initialized
   4647  *     BCM_E_NOT_FOUND - Group ID not found on unit.
   4648  *     BCM_E_XXX       - Error from _field_entry_remove()
   4649  *     BCM_E_NONE      - Success
   4650  */
   4651 
   4652 int
   4653 bcm_esw_field_group_remove(int unit, bcm_field_group_t group)
   4654 {
   4655     _field_control_t *fc;
   4656     _field_group_t *fg_p;
   4657     int entry_index;
   4658         int rv = BCM_E_NONE;
   4659 
   4660     
   4661     FP_LOCK(unit);
   4662     rv = _field_control_get(unit, &fc);
   4663     if (BCM_FAILURE(rv)) {
   4664         FP_UNLOCK(unit);
   4665         return rv;
   4666     }
   4667 
   4668     rv = _field_group_get(unit, group, &fg_p);
   4669     if (BCM_FAILURE(rv))
   4670     {
   4671         FP_UNLOCK(unit);
   4672         return (rv);
   4673     }
   4674 
   4675     for (entry_index = 0;
   4676         entry_index < fg_p->group_status.entry_count;
   4677         ++entry_index)
   4678     {
   4679         rv = _field_entry_remove(unit, fc,
   4680                         fg_p->entry_arr[entry_index]->eid);
   4681         if (BCM_FAILURE(rv))
   4682         {
   4683             FP_UNLOCK(unit);
   4684             return (rv);
   4685         }
   4686     }
   4687 
   4688     FP_UNLOCK(unit);
   4689 
   4690     return (rv);
   4691 }
   4692 
   4693 /*
   4694  * Function: bcm_esw_field_entry_prio_get
   4695  *
   4696  * Purpose:
   4697  *     Gets the priority within the group of the entry.
   4698  *
   4699  * Parameters:
   4700  *     unit   - BCM device number
   4701  *     entry  - Field entry to operate on
   4702  *     prio   - (OUT) priority of entry
   4703  *
   4704  * Returns:
   4705  *     BCM_E_NONE       - Success
   4706  *     BCM_E_PARAM      - prio pointing to NULL
   4707  *     BCM_E_NOT_FOUND  - Entry ID not found on unit
   4708  */
   4709 int
   4710 bcm_esw_field_entry_prio_get(int unit, bcm_field_entry_t entry, int *prio)
   4711 {
   4712     _field_entry_t      *f_ent;
   4713     int                 rv;          /* Operation return status. */
   4714 
   4715     if (prio == NULL) {
   4716         LOG_ERROR(BSL_LS_BCM_FP,
   4717                   (BSL_META_U(unit,
   4718                               "FP(unit %d) Error: prio==NULL\n"),
   4719                    unit));
   4720         return (BCM_E_PARAM);
   4721     }
   4722 
   4723     
   4724     FP_LOCK(unit);
   4725 
   4726 #if defined(BCM_TOMAHAWK_SUPPORT)
   4727     if (soc_feature(unit, soc_feature_field_preselector_support) && 
   4728         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
   4729         rv = _bcm_field_presel_entry_prio_get(unit, entry, prio);
   4730         FP_UNLOCK(unit);
   4731         return rv;
   4732     }
   4733 #endif /* BCM_TOMAHAWK_SUPPORT */
   4734 
   4735     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
   4736     if (BCM_FAILURE(rv)) {
   4737         FP_UNLOCK(unit);
   4738         return (rv);
   4739     }
   4740 
   4741 #if defined(BCM_TOMAHAWK_SUPPORT)
   4742     /* Priority cannot be fetched for exact match entries. */
   4743     if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXACTMATCH) {
   4744         rv = BCM_E_UNAVAIL;
   4745         FP_UNLOCK(unit);
   4746         return (rv);
   4747     }
   4748     /* Priority get for class entries. */
   4749     if (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS) {
   4750         rv = _bcm_field_th_class_entry_prio_get(unit, f_ent);
   4751         if (BCM_FAILURE(rv)) {
   4752             FP_UNLOCK(unit);
   4753             return (rv);
   4754         }
   4755     }
   4756 #endif /* BCM_TOMAHAWK_SUPPORT */
   4757 
   4758     *prio = f_ent->prio;
   4759 
   4760     FP_UNLOCK(unit);
   4761     return (rv);
   4762 }
   4763 
   4764 /*
   4765  * Function: bcm_esw_field_entry_prio_set
   4766  *
   4767  * Purpose:
   4768  *
   4769  * Parameters:
   4770  *     unit - BCM device number
   4771  *     entry - Field entry to operate on
   4772  *
   4773  * Returns:
   4774  *     BCM_E_NONE       Success
   4775  *
   4776  * Notes: 
   4777  *     The earlier checks guarantee that there is a free slot somewhere
   4778  *     i.e. in one of the alloted slices for the group.
   4779  */
   4780 int
   4781 bcm_esw_field_entry_prio_set(int unit, bcm_field_entry_t entry, int prio)
   4782 {
   4783     int rv;
   4784 
   4785     if (prio < BCM_FIELD_ENTRY_PRIO_LOWEST) {
   4786         return BCM_E_PARAM;
   4787     }
   4788 
   4789     
   4790     FP_LOCK(unit);
   4791 
   4792 #if defined(BCM_TOMAHAWK_SUPPORT)
   4793     if (soc_feature(unit, soc_feature_field_preselector_support) && 
   4794         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
   4795         rv = _bcm_field_presel_entry_prio_set(unit, entry, prio);
   4796         FP_UNLOCK(unit);
   4797         return rv;
   4798     }
   4799 #endif /* BCM_TOMAHAWK_SUPPORT */
   4800 
   4801     rv = _field_entry_prio_set(unit, entry, prio);
   4802 
   4803     FP_UNLOCK(unit);
   4804     return (rv);
   4805 }
   4806 /* Section: Field Qualifiers  */
   4807 
   4808 /*
   4809  * Function: bcm_esw_field_qualify_clear
   4810  *
   4811  * Purpose:
   4812  *     Reset all field qualifications from a filter entry.
   4813  *     Memory is allocated for the entry TCAM Key and Mask.
   4814  *
   4815  * Parameters:
   4816  *     unit - BCM device number
   4817  *     entry - Field entry to operate on
   4818  *
   4819  * Returns:
   4820  *     BCM_E_INIT       BCM Unit not initialized.
   4821  *     BCM_E_NOT_FOUND  Entry ID not found in unit.
   4822  *     BCM_E_NONE       Success
   4823  */
   4824 int
   4825 bcm_esw_field_qualify_clear(int unit,
   4826                             bcm_field_entry_t entry)
   4827 {
   4828     int               parts_count = 0;  /* Tcam entry parts count. */
   4829     _field_entry_t    *f_ent;       /* Field entry pointer.    */
   4830     _field_group_t    *fg;          /* Field group pointer.    */
   4831     int               idx;          /* Entry parts iterator.   */
   4832     int               rv;           /* Operation return status.*/
   4833 
   4834     
   4835     FP_LOCK(unit);
   4836 
   4837     rv = _bcm_field_entry_get_by_id(unit, entry, &f_ent);
   4838     if (BCM_FAILURE(rv)) {
   4839         FP_UNLOCK(unit);
   4840         return (rv);
   4841     }
   4842 
   4843     fg = f_ent->group;
   4844 #if defined(BCM_TOMAHAWK_SUPPORT)
   4845     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   4846         (fg->stage_id == _BCM_FIELD_STAGE_CLASS)) {
   4847         rv = _bcm_field_th_class_qualify_clear(unit, entry);
   4848         FP_UNLOCK(unit);
   4849         return (rv);
   4850     }
   4851 #endif /* BCM_TOMAHAWK_SUPPORT */
   4852 
   4853     /* Get number of entry parts we have to read. */
   4854     rv = _bcm_field_entry_tcam_parts_count (unit, fg->stage_id,
   4855                                             fg->flags, &parts_count);
   4856     if (BCM_FAILURE(rv)) {
   4857         FP_UNLOCK(unit);
   4858         return (rv); 
   4859     }
   4860 
   4861     for (idx = 0; idx < parts_count; idx++) {
   4862         /* Free allocated portion of sw tcam image. */
   4863         _bcm_field_qual_tcam_key_mask_free(unit, f_ent + idx);
   4864         if (BCM_FAILURE(rv)) {
   4865             FP_UNLOCK(unit);
   4866             return (rv);
   4867         }
   4868 
   4869         /* Reset sw tcam image. */
   4870         sal_memset(&f_ent[idx].tcam, 0, sizeof(_field_tcam_t));
   4871 
   4872         /* Get tcam key and mask. */
   4873         rv = _bcm_field_qual_tcam_key_mask_get(unit, f_ent + idx);
   4874         if (BCM_FAILURE(rv)) {
   4875             FP_UNLOCK(unit);
   4876             return (rv); 
   4877         }
   4878 
   4879         /* Reset tcam key and mask. */
   4880         sal_memset(f_ent[idx].tcam.key, 0, f_ent[idx].tcam.key_size);
   4881         sal_memset(f_ent[idx].tcam.mask, 0, f_ent[idx].tcam.key_size);
   4882 
   4883         if ((fg->stage_id == _BCM_FIELD_STAGE_INGRESS) && 
   4884             SOC_MEM_FIELD_VALID(unit, FP_TCAMm, F4f)) {
   4885             f_ent[idx].tcam.f4 = 0;
   4886             f_ent[idx].tcam.f4_mask = 0;
   4887         }
   4888 
   4889         if (f_ent[idx].extra_tcam.key != NULL)
   4890         {
   4891             sal_memset(f_ent[idx].extra_tcam.key, 0,
   4892                 f_ent[idx].extra_tcam.key_size);
   4893 
   4894             sal_memset(f_ent[idx].extra_tcam.mask, 0,
   4895                 f_ent[idx].extra_tcam.key_size);
   4896         }
   4897 
   4898         if (f_ent[idx].key_match_tcam.key != NULL)
   4899         {
   4900             sal_memset(f_ent[idx].key_match_tcam.key, 0,
   4901                 f_ent[idx].key_match_tcam.key_size);
   4902 
   4903             sal_memset(f_ent[idx].key_match_tcam.mask, 0,
   4904                 f_ent[idx].key_match_tcam.key_size);
   4905         }
   4906 
   4907         f_ent[idx].efp_key_match_type = _FP_ENTRY_TYPE_1; 
   4908 
   4909         /* Reset IPBM if aplicable */
   4910 #if defined(BCM_RAPTOR_SUPPORT) || defined (BCM_TRX_SUPPORT)
   4911         if ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) && 
   4912             ((soc_feature(unit, soc_feature_field_ingress_ipbm))
   4913               || (soc_feature(unit, soc_feature_field_multi_pipe_support)))) {
   4914             BCM_PBMP_CLEAR(f_ent[idx].pbmp.data);
   4915             BCM_PBMP_CLEAR(f_ent[idx].pbmp.mask);
   4916         }
   4917 #endif
   4918 
   4919         /* Initialize entry qualifiers based on group flags. */
   4920         rv = _field_entry_qualifiers_init(unit, f_ent);
   4921         if (BCM_FAILURE(rv)) {
   4922             FP_UNLOCK(unit);
   4923             return (rv); 
   4924         }
   4925 
   4926         /* Mark entry for reinstall. */
   4927         f_ent[idx].flags |= _FP_ENTRY_DIRTY;
   4928         if (f_ent[idx].flags & _FP_ENTRY_POLICY_TABLE_ONLY_DIRTY) {
   4929             /* resetting POLICY_TABLE_DIRTY flag
   4930                as it needs change in FP_TCAM and install*/
   4931             f_ent[idx].flags &= ~_FP_ENTRY_POLICY_TABLE_ONLY_DIRTY;
   4932         }
   4933     }
   4934     FP_UNLOCK(unit);
   4935     return (BCM_E_NONE);
   4936 }
   4937 
   4938 /*
   4939  * Function:
   4940  *      bcm_esw_field_qualifier_delete
   4941  * Purpose:
   4942  *      Remove match criteria from a field processor entry.
   4943  * Parameters:
   4944  *      unit - (IN) Unit number.
   4945  *      entry - (IN) BCM field entry id.
   4946  *      qual_id - (IN) BCM field qualifier id.
   4947  * Returns:
   4948  *      BCM_E_XXX
   4949  * Notes:
   4950  *   The assumption is that all qualifiers are less then 128 bit.
   4951  */
   4952 int 
   4953 bcm_esw_field_qualifier_delete(int unit, bcm_field_entry_t entry, 
   4954                                bcm_field_qualify_t qual_id)
   4955 {
   4956     _bcm_field_qual_offset_t *q_offset;/* Qualifier offset in tcam. */
   4957     _bcm_field_qual_data_t    q_data;  /* Qualifier match data.     */ 
   4958     _bcm_field_qual_data_t    q_mask;  /* Qualifier match mask.     */
   4959     _field_entry_t            *f_ent;  /* Field entry structure.    */
   4960     int                       rv;      /* Operation return status.  */
   4961 
   4962     sal_memset(q_data, 0, sizeof(_bcm_field_qual_data_t));
   4963     sal_memset(q_mask, 0, sizeof(_bcm_field_qual_data_t));
   4964 
   4965     
   4966     FP_LOCK(unit);
   4967 
   4968 #if defined(BCM_TOMAHAWK_SUPPORT)
   4969     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   4970         rv = _bcm_field_is_entry_stage_valid(unit, entry,
   4971                                              _BCM_FIELD_STAGE_INGRESS);
   4972 
   4973         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
   4974            /* Error fetching entry */
   4975            FP_UNLOCK(unit);
   4976            return (rv);
   4977         }
   4978 
   4979         if (rv == BCM_E_NONE) { /*Stage is Ingress or ExactMatch*/
   4980            rv = _bcm_field_th_qualifier_delete(unit, entry, qual_id);
   4981            FP_UNLOCK(unit);
   4982            return (rv);
   4983         }
   4984     }
   4985 #endif /* BCM_TOMAHAWK_SUPPORT */
   4986 
   4987     /* Get field entry part that contains the qualifier. */
   4988     rv = _bcm_field_entry_qual_get(unit, entry, qual_id, &f_ent);
   4989     if (BCM_FAILURE(rv)) {
   4990         FP_UNLOCK(unit);
   4991         return (rv);
   4992     }
   4993 
   4994 #if defined(BCM_TOMAHAWK_SUPPORT)
   4995     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   4996         (_BCM_FIELD_STAGE_CLASS == f_ent->group->stage_id)) {
   4997         rv = _bcm_field_th_class_qualify_set(unit, entry, qual_id,
   4998                                                 q_data, q_mask);
   4999         FP_UNLOCK(unit);
   5000         return (rv);
   5001     }
   5002 #endif /* BCM_TOMAHAWK_SUPPORT */
   5003 
   5004     switch(qual_id) {
   5005 #if defined(BCM_RAPTOR_SUPPORT) || defined(BCM_TRX_SUPPORT)
   5006         case bcmFieldQualifyInPort:
   5007         case bcmFieldQualifyInPorts:
   5008             BCM_PBMP_CLEAR(f_ent->pbmp.data);
   5009             BCM_PBMP_CLEAR(f_ent->pbmp.mask);
   5010             break;
   5011 #endif /* BCM_RAPTOR_SUPPORT || BCM_TRX_SUPPORT */
   5012 #if defined(BCM_FIREBOLT2_SUPPORT)
   5013         case bcmFieldQualifyDrop:
   5014             f_ent->tcam.drop      = 0;
   5015             f_ent->tcam.drop_mask = 0;
   5016             break;
   5017 #endif /* BCM_FIREBOLT2_SUPPORT */
   5018         case bcmFieldQualifyHiGig:
   5019             f_ent->tcam.higig      = 0;
   5020             f_ent->tcam.higig_mask = 0;
   5021             break;
   5022         case bcmFieldQualifyIpType:
   5023             f_ent->tcam.ip_type = bcmFieldIpTypeAny;
   5024             break;
   5025         default:
   5026             break;
   5027     }
   5028 
   5029     /* Get entry qualifier offset in tcam. */
   5030     rv = _field_qual_offset_get(unit, f_ent, qual_id, &q_offset);
   5031     if (BCM_FAILURE(rv)) {
   5032         FP_UNLOCK(unit);
   5033         return (rv);
   5034     }
   5035 
   5036     /* Reset qualifier data and mask in the tcam. */
   5037     rv = _bcm_field_qual_value_set(unit, q_offset, f_ent, 
   5038                                    q_data, q_mask);
   5039     if (BCM_FAILURE(rv)) {
   5040         FP_UNLOCK(unit);
   5041         return (rv);
   5042     }
   5043 #if defined(BCM_TRIDENT2_SUPPORT)
   5044     if (SOC_IS_TD2_TT2(unit) &&
   5045         (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) {
   5046 
   5047         uint8 idx;
   5048         for (idx = 1; idx < _FP_MAX_ENTRY_TYPES; idx++) {
   5049             /* Get entry qualifier offset in tcam. */
   5050             rv = _field_qual_offset_get_by_entry_type(unit, f_ent,
   5051                                                  qual_id, idx, &q_offset);
   5052             if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) {
   5053                 FP_UNLOCK(unit);
   5054                 return (rv);
   5055             } else if(BCM_SUCCESS(rv)) {
   5056 
   5057                 /* Reset qualifier data and mask in the tcam. */
   5058                 /* COVERITY 
   5059                  * 
   5060                  *This flow takes care of the  Out-of-bounds access issue  
   5061                  * for data and mask.
   5062                  */
   5063                 /* coverity[callee_ptr_arith : FALSE] */
   5064                 rv = _bcm_field_qual_value_set_by_entry_type(unit,
   5065                                                              q_offset,
   5066                                                              f_ent,
   5067                                                              q_data,
   5068                                                              q_mask,
   5069                                                              idx);
   5070                 if (BCM_FAILURE(rv)) {
   5071                     FP_UNLOCK(unit);
   5072                     return (rv);
   5073                 } 
   5074             } else {
   5075                 rv = BCM_E_NONE;     
   5076             } 
   5077         }
   5078 
   5079         /* When qualifier is deleted from the field entry */
   5080         if (_FP_ENTRY_TYPE_0 == f_ent->efp_key_match_type) {
   5081             rv = _field_efp_key_match_type_set_on_qual_delete(unit, entry);
   5082             if (BCM_FAILURE(rv)) {
   5083                 FP_UNLOCK(unit);
   5084                 return (rv);
   5085             }
   5086         }   
   5087     }
   5088 #endif
   5089 
   5090 #if defined(BCM_TRIUMPH2_SUPPORT)
   5091     if (f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) {
   5092        int ingress_entity = 0;
   5093 
   5094        switch (qual_id) {
   5095            case bcmFieldQualifySrcMplsGport:
   5096            case bcmFieldQualifySrcMplsGports:
   5097            case bcmFieldQualifySrcNivGport:
   5098            case bcmFieldQualifySrcNivGports:
   5099            case bcmFieldQualifySrcMimGport:
   5100            case bcmFieldQualifySrcMimGports:
   5101            case bcmFieldQualifySrcWlanGport:
   5102            case bcmFieldQualifySrcWlanGports:
   5103            case bcmFieldQualifySrcVxlanGport:
   5104            case bcmFieldQualifySrcVxlanGports:
   5105            case bcmFieldQualifySrcVlanGport:
   5106            case bcmFieldQualifySrcVlanGports:
   5107            case bcmFieldQualifySrcGport:
   5108            case bcmFieldQualifySrcGports:
   5109                ingress_entity = 1;
   5110                break;
   5111            default:
   5112                break;
   5113        }
   5114 
   5115        if (ingress_entity) {
   5116           /* Reset Internal qualifier SVP valid bit */
   5117           if (BCM_FIELD_QSET_TEST(f_ent->group->qset,
   5118                                   _bcmFieldQualifySvpValid)) {
   5119              rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 0, 0);
   5120              if (BCM_FAILURE(rv)) {
   5121                 FP_UNLOCK(unit);
   5122                 return (rv);
   5123              }
   5124           }
   5125        }
   5126     }
   5127 #endif
   5128 
   5129 #if defined(BCM_APACHE_SUPPORT)
   5130     rv = _bcm_field_apache_qualify_OamDropReason_delete(unit, entry, qual_id);
   5131     if (BCM_FAILURE(rv)) {
   5132         FP_UNLOCK(unit);
   5133         return (rv);
   5134     }
   5135 #endif
   5136 
   5137     f_ent->flags |= _FP_ENTRY_DIRTY;
   5138     if (f_ent->flags & _FP_ENTRY_POLICY_TABLE_ONLY_DIRTY) {
   5139         /* resetting POLICY_TABLE_DIRTY flag 
   5140            as it needs change in FP_TCAM and install*/
   5141         f_ent->flags &= ~_FP_ENTRY_POLICY_TABLE_ONLY_DIRTY;
   5142     }
   5143 
   5144     FP_UNLOCK(unit);
   5145 #if defined(BCM_TRX_SUPPORT)
   5146     if ((qual_id == bcmFieldQualifyRangeCheck) &&
   5147             BCM_FIELD_QSET_TEST(f_ent->group->qset,
   5148                 _bcmFieldQualifyRangeCheckBits24_31)) {
   5149         rv = bcm_esw_field_qualifier_delete(unit, entry,
   5150                 _bcmFieldQualifyRangeCheckBits24_31);
   5151     }
   5152 #endif
   5153     return rv; 
   5154 }
   5155 
   5156 
   5157 /*
   5158  * Function: bcm_esw_field_qualify_XXX (class of routines)
   5159  *
   5160  * Purpose:
   5161  *     Add a field qualification to a filter entry.
   5162  *
   5163  * Parameters:
   5164  *     unit - BCM device number
   5165  *     entry - Field entry to operate on
   5166  *     data - Data to qualify with (type varies)
   5167  *     mask - Mask to qualify with (type is same as for data)
   5168  *
   5169  * Returns:
   5170  *     BCM_E_INIT       BCM Unit not initialized.
   5171  *     BCM_E_NOT_FOUND  Entry ID not found in unit.
   5172  *     BCM_E_XXX        Other errors
   5173  */
   5174 
   5175 int
   5176 bcm_esw_field_qualify_InPort(int unit, bcm_field_entry_t entry,
   5177                              bcm_port_t data, bcm_port_t mask)
   5178 {
   5179     _field_entry_t   *f_ent;
   5180     int              rv = BCM_E_NONE;
   5181     bcm_port_t       port = data;
   5182 #if defined(BCM_RAPTOR_SUPPORT) || defined (BCM_TRX_SUPPORT)
   5183     bcm_pbmp_t       lb_pbm;
   5184     _field_group_t   *fg = NULL;
   5185 #endif
   5186 #if defined(BCM_KATANA2_SUPPORT)
   5187         bcm_trunk_t tid;
   5188         int id, mod;
   5189 #endif
   5190 
   5191     if (BCM_GPORT_IS_SET(data)) {
   5192 
   5193 #if defined(BCM_HGPROXY_COE_SUPPORT)
   5194         if (soc_feature(unit, soc_feature_hgproxy_subtag_coe) &&
   5195             _BCM_COE_GPORT_IS_SUBTAG_SUBPORT_PORT (unit, data)) {
   5196             rv = _bcmi_coe_subport_physical_port_get(unit, data, &port);
   5197         }  else
   5198 #endif
   5199 
   5200 #if defined(BCM_KATANA2_SUPPORT)
   5201         if (_BCM_KT2_GPORT_IS_LINKPHY_OR_SUBTAG_SUBPORT_GPORT(unit, data)) {
   5202             BCM_IF_ERROR_RETURN(
   5203                 _bcm_esw_gport_resolve(unit, data, &mod, &port, &tid, &id));
   5204             rv = _bcm_kt2_modport_to_pp_port_get(unit, mod, port, &port);
   5205         }  else
   5206 #endif
   5207         {
   5208             rv = _field_qualifier_gport_resolve(unit, data, mask,
   5209                                                &port, NULL, NULL);
   5210         }
   5211         BCM_IF_ERROR_RETURN(rv);
   5212     }
   5213 
   5214     if ((!SOC_PORT_VALID(unit, port)) || IS_LB_PORT(unit, port)) {
   5215         return (BCM_E_PARAM);
   5216     }
   5217 
   5218     
   5219     FP_LOCK(unit);
   5220 
   5221     rv = _bcm_field_entry_qual_get(unit, entry, bcmFieldQualifyInPort, &f_ent);
   5222     if (BCM_FAILURE(rv)) {
   5223         FP_UNLOCK(unit);
   5224         return (rv);
   5225     }
   5226 
   5227 #if defined(BCM_RAPTOR_SUPPORT) || defined (BCM_TRX_SUPPORT)
   5228     fg = f_ent->group;
   5229     if ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) && 
   5230         (soc_feature(unit, soc_feature_field_ingress_ipbm))) {
   5231         bcm_pbmp_t pbmp_data, pbmp_mask;
   5232 
   5233         /* pbmp_mask: All 1's
   5234          * pbmp_data: Qualify *only* on the port requested 
   5235          *     Raptor, Triumph does not have a separate field to 
   5236          *     qualify on InPort  So need to use the IPBM 
   5237          *     Also the "bcm_port_t mask" is assumed to be 1. */
   5238 
   5239         rv = _bcm_field_valid_pbmp_get(unit, &pbmp_mask);
   5240         BCM_IF_ERROR_RETURN(rv);
   5241 
   5242         BCM_PBMP_CLEAR(pbmp_data);
   5243         BCM_PBMP_PORT_SET(pbmp_data, port);
   5244         BCM_PBMP_ASSIGN(f_ent->pbmp.data, pbmp_data);
   5245         BCM_PBMP_ASSIGN(f_ent->pbmp.mask, pbmp_mask);
   5246 
   5247         /* Add loopback port to ipbm mask to avoid false ingress port match */
   5248         BCM_PBMP_CLEAR(lb_pbm);
   5249         BCM_PBMP_OR(lb_pbm, PBMP_LB(unit));
   5250         if (BCM_PBMP_NOT_NULL(lb_pbm)) {
   5251             BCM_PBMP_OR(f_ent->pbmp.mask, PBMP_LB(unit));
   5252         }
   5253 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
   5254         /* Add MACSEC Port to IPBM mask to avoid match on MACSEC port */
   5255         if (soc_feature(unit, soc_feature_xflow_macsec)) {
   5256             bcm_pbmp_t       macsec_pbm;
   5257             BCM_PBMP_CLEAR(macsec_pbm);
   5258             BCM_PBMP_OR(macsec_pbm, PBMP_MACSEC_ALL(unit));
   5259             if (BCM_PBMP_NOT_NULL(macsec_pbm)) {
   5260                 BCM_PBMP_OR(f_ent->pbmp.mask, PBMP_MACSEC_ALL(unit));
   5261             }
   5262         }
   5263 #endif
   5264         f_ent->flags |= _FP_ENTRY_DIRTY;
   5265         f_ent->flags &= ~(_FP_ENTRY_POLICY_TABLE_ONLY_DIRTY);
   5266 
   5267         FP_UNLOCK(unit);
   5268         return (BCM_E_NONE);
   5269     }
   5270 #endif /* BCM_RAPTOR_SUPPORT || BCM_TRX_SUPPORT */
   5271 
   5272     rv = _field_qualify32(unit, entry, bcmFieldQualifyInPort, port, mask);
   5273     FP_UNLOCK(unit);
   5274     return (rv);
   5275 }
   5276 
   5277 int
   5278 bcm_esw_field_qualify_OutPort(int unit, bcm_field_entry_t entry,
   5279                              bcm_port_t data, bcm_port_t mask)
   5280 {
   5281     int              rv = BCM_E_NONE, mod = 0;
   5282     bcm_port_t       port = data;
   5283 
   5284 #if defined(BCM_KATANA2_SUPPORT)
   5285     bcm_trunk_t tid;
   5286     int id;
   5287 #endif
   5288 
   5289     if (BCM_GPORT_IS_SET(data)) {
   5290 #if defined(BCM_HGPROXY_COE_SUPPORT)
   5291         if (soc_feature(unit, soc_feature_hgproxy_subtag_coe) &&
   5292             _BCM_COE_GPORT_IS_SUBTAG_SUBPORT_PORT(unit, data)) {
   5293             rv = _bcmi_coe_subport_physical_port_get(unit, data, &port);
   5294         }  else
   5295 #endif
   5296 
   5297 #if defined(BCM_KATANA2_SUPPORT)
   5298 
   5299         if (_BCM_KT2_GPORT_IS_LINKPHY_OR_SUBTAG_SUBPORT_GPORT (unit, data)) {
   5300             BCM_IF_ERROR_RETURN(
   5301                 _bcm_esw_gport_resolve(unit, data, &mod, &port, &tid, &id));
   5302             rv = _bcm_kt2_modport_to_pp_port_get(unit, mod, port, &port);
   5303         }  else
   5304 #endif
   5305         {
   5306             rv = _field_qualifier_gport_resolve(unit, data, mask, 
   5307                                                 &port, &mod, NULL);
   5308         }
   5309         BCM_IF_ERROR_RETURN(rv);
   5310     }
   5311     if (0 == SOC_PORT_VALID(unit, port)) {
   5312         return (BCM_E_PARAM);
   5313     }
   5314 
   5315     
   5316     FP_LOCK(unit);
   5317 
   5318     rv = _field_qualify32(unit, entry, bcmFieldQualifyOutPort, port, mask);
   5319 
   5320     FP_UNLOCK(unit);
   5321     return (rv);
   5322 }
   5323 
   5324 int
   5325 bcm_esw_field_qualify_InPorts(int unit, bcm_field_entry_t entry,
   5326                               bcm_pbmp_t data, bcm_pbmp_t mask)
   5327 {
   5328     int              rv;           /* OPerational Status. */
   5329     _field_control_t *fc;          /* Field Control Operational Structure. */
   5330 
   5331     if (soc_feature(unit, soc_feature_ifp_no_inports_support)) {
   5332         return (BCM_E_UNAVAIL);
   5333     }
   5334     
   5335     FP_LOCK(unit);
   5336     rv = _field_control_get(unit, &fc);
   5337     if (BCM_FAILURE(rv)) {
   5338         FP_UNLOCK(unit);
   5339         return rv;
   5340     }
   5341     rv = fc->functions.fp_qualify_inports(unit, entry, 
   5342                                           bcmFieldQualifyInPorts,
   5343                                           data, mask);
   5344     FP_UNLOCK(unit);
   5345     return (rv);
   5346 
   5347 }
   5348 
   5349 int
   5350 bcm_esw_field_qualify_OutPorts(int unit, bcm_field_entry_t entry,
   5351                                bcm_pbmp_t data, bcm_pbmp_t mask)
   5352 {
   5353     int              rv;
   5354 
   5355     
   5356     FP_LOCK(unit);
   5357 
   5358     rv = _field_qualify32(unit, entry, bcmFieldQualifyOutPorts,
   5359                           SOC_PBMP_WORD_GET(data, 0),
   5360                           SOC_PBMP_WORD_GET(mask, 0));
   5361     FP_UNLOCK(unit);
   5362     return (rv);
   5363 }
   5364 
   5365 int
   5366 bcm_esw_field_qualify_Drop(int unit, bcm_field_entry_t entry,
   5367                            uint8 data, uint8 mask)
   5368 {
   5369     int              rv;
   5370     
   5371     FP_LOCK(unit);
   5372 
   5373 #ifdef BCM_FIREBOLT2_SUPPORT
   5374     /* 
   5375      * FB2 has Drop at two places:
   5376      *     one is FIXED (always used), and the other based on selectors. 
   5377      * The one based on selector is thus redundant!!!
   5378      */
   5379     if (SOC_IS_FIREBOLT2(unit)) {
   5380         _field_entry_t      *f_ent;
   5381         _field_group_t      *fg;
   5382 
   5383         rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
   5384         if (BCM_FAILURE(rv)) {
   5385             FP_UNLOCK(unit);
   5386             return (rv);
   5387         }
   5388 
   5389         /* Confirm that Drop is in group's Qset. */
   5390         fg = f_ent->group;
   5391         if (!BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyDrop)) {
   5392             LOG_ERROR(BSL_LS_BCM_FP,
   5393                       (BSL_META_U(unit,
   5394                                   "FP(unit %d) Error: Drop not in entry=%d Qset.\n"),
   5395                        unit, entry));
   5396             FP_UNLOCK(unit);
   5397             return (BCM_E_PARAM);
   5398         }
   5399 
   5400         /* Add data & mask to entry. */
   5401         f_ent->tcam.drop      = data;
   5402         f_ent->tcam.drop_mask = mask;
   5403 
   5404         FP_UNLOCK(unit);
   5405         return (BCM_E_NONE);
   5406     }
   5407 #endif /* BCM_FIREBOLT2_SUPPORT */    
   5408 
   5409     rv = _field_qualify32(unit, entry, bcmFieldQualifyDrop,
   5410                           data, mask);
   5411     FP_UNLOCK(unit);
   5412     return (rv);
   5413 }
   5414 
   5415 int
   5416 bcm_esw_field_qualify_SrcPort(int unit, bcm_field_entry_t entry,
   5417                               bcm_module_t data_modid,
   5418                               bcm_module_t mask_modid,
   5419                               bcm_port_t   data_port,
   5420                               bcm_port_t   mask_port)
   5421 {
   5422     int              rv;       /* Operation return status. */
   5423     bcm_gport_t gport, gport_mask; /*temp gport and mask */
   5424 
   5425     if (BCM_GPORT_IS_SET(data_port)) {
   5426         rv = _field_qualifier_gport_resolve(unit, data_port, mask_port, 
   5427                                             &data_port, &data_modid, NULL);
   5428         BCM_IF_ERROR_RETURN(rv);
   5429     } else {
   5430         if ((NUM_MODID(unit) > 1) && (SOC_IS_TR_VL(unit)) ) {
   5431             BCM_GPORT_MODPORT_SET(gport, data_modid, data_port);
   5432             gport_mask = BCM_FIELD_EXACT_MATCH_MASK;
   5433             rv = _field_qualifier_gport_resolve(unit, gport, gport_mask,
   5434                                         &data_port, &data_modid, NULL);
   5435                 BCM_IF_ERROR_RETURN(rv);
   5436         }
   5437     }
   5438     FP_LOCK(unit);
   5439 
   5440     rv = _field_qualify_Port(unit, entry, data_modid, mask_modid,
   5441                              data_port, mask_port, bcmFieldQualifySrcPort);
   5442     FP_UNLOCK(unit);
   5443     return (rv);
   5444 }
   5445 
   5446 int
   5447 bcm_esw_field_qualify_SrcTrunk(int unit, bcm_field_entry_t entry,
   5448                               bcm_trunk_t data, bcm_trunk_t mask)
   5449 {
   5450     _field_control_t *fc;      /* Field control structure. */
   5451     int              rv;       /* Operation return status. */
   5452 
   5453     if (BCM_GPORT_IS_SET(data)) {
   5454         rv = _field_qualifier_gport_resolve(unit, data, mask, 
   5455                                            NULL, NULL, &data);
   5456         BCM_IF_ERROR_RETURN(rv);
   5457     }
   5458 
   5459     
   5460     FP_LOCK(unit);
   5461     rv = _field_control_get(unit, &fc);
   5462     if (BCM_FAILURE(rv)) {
   5463         FP_UNLOCK(unit);
   5464         return rv;
   5465     }
   5466 
   5467     rv = fc->functions.fp_qualify_trunk(unit, entry, 
   5468                                         bcmFieldQualifySrcTrunk, 
   5469                                         data, mask);
   5470     FP_UNLOCK(unit);
   5471     return (rv);
   5472 }
   5473 
   5474 int
   5475 bcm_esw_field_qualify_SrcTrunkMemberGport(int unit,
   5476         bcm_field_entry_t entry ,bcm_gport_t port)
   5477 {
   5478     uint32 data;            /* HW data match criteria.  */
   5479     uint32 mask;            /* HW data mask.            */
   5480     int rv;                 /* Operation return status. */
   5481 
   5482     /* Input parameters check. */
   5483     if (0 == BCM_GPORT_IS_MODPORT(port)) {
   5484         return (BCM_E_PARAM);
   5485     }
   5486 
   5487     data  = BCM_GPORT_MODPORT_PORT_GET(port);
   5488     data |= ((BCM_GPORT_MODPORT_MODID_GET(port)) << _FP_PORT_BITWIDTH(unit));
   5489     mask = BCM_FIELD_EXACT_MATCH_MASK;
   5490 
   5491     
   5492     FP_LOCK(unit);
   5493 
   5494     rv = _field_qualify32(unit, entry, bcmFieldQualifySrcTrunkMemberGport, 
   5495                           data, mask);
   5496 
   5497     FP_UNLOCK(unit);
   5498     return (rv);
   5499 
   5500 }
   5501 
   5502 int
   5503 bcm_esw_field_qualify_DstPort(int unit, bcm_field_entry_t entry,
   5504                               bcm_module_t data_modid,
   5505                               bcm_module_t mask_modid,
   5506                               bcm_port_t   data_port,
   5507                               bcm_port_t   mask_port)
   5508 {
   5509     int              rv;       /* Operation return status. */
   5510     bcm_gport_t gport, gport_mask; /*temp gport and mask */
   5511 #ifdef BCM_APACHE_SUPPORT
   5512     _field_entry_t   *f_ent;   /* Field Entry Structure.   */
   5513 #endif
   5514 
   5515     if (BCM_GPORT_IS_SET(data_port)) {
   5516 #ifdef BCM_APACHE_SUPPORT
   5517        
   5518        FP_LOCK(unit);
   5519        /* Search the entry by eid. */
   5520        rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
   5521        if (BCM_FAILURE(rv)) {
   5522            FP_UNLOCK(unit);
   5523            return rv;
   5524        }
   5525 
   5526        if (SOC_IS_APACHE(unit) &&
   5527                (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) {
   5528            /* DVP gport is not allowed in EFP */
   5529            if (!(BCM_GPORT_IS_MODPORT(data_port) ||
   5530                        BCM_GPORT_IS_LOCAL(data_port))) {
   5531                rv = BCM_E_PARAM;
   5532            }
   5533        }
   5534        FP_UNLOCK(unit);
   5535        BCM_IF_ERROR_RETURN(rv);
   5536 #endif
   5537 
   5538        rv = _field_qualifier_gport_resolve(unit, data_port, mask_port, 
   5539                                            &data_port, &data_modid, NULL);
   5540        BCM_IF_ERROR_RETURN(rv);
   5541        mask_modid = BCM_FIELD_EXACT_MATCH_MASK;
   5542     } else {
   5543         if ((NUM_MODID(unit) > 1) && (SOC_IS_TR_VL(unit)) ) {
   5544             BCM_GPORT_MODPORT_SET(gport, data_modid, data_port);
   5545             gport_mask = BCM_FIELD_EXACT_MATCH_MASK;
   5546             rv = _field_qualifier_gport_resolve(unit, gport, gport_mask,
   5547                                         &data_port, &data_modid, NULL);
   5548             BCM_IF_ERROR_RETURN(rv);
   5549         }
   5550     }
   5551     
   5552     FP_LOCK(unit);
   5553 
   5554     rv = _field_qualify_Port(unit, entry, data_modid, mask_modid,
   5555                              data_port, mask_port, bcmFieldQualifyDstPort);
   5556     FP_UNLOCK(unit);
   5557     return (rv);
   5558 }
   5559 
   5560 int
   5561 bcm_esw_field_qualify_DstTrunk(int unit, bcm_field_entry_t entry,
   5562                                bcm_trunk_t data, bcm_trunk_t mask)
   5563 {
   5564     _field_control_t *fc;      /* Field control structure. */
   5565     int              rv;       /* Operation return status. */
   5566 
   5567     if (BCM_GPORT_IS_SET(data)) {
   5568        rv = _field_qualifier_gport_resolve(unit, data, mask, 
   5569                                            NULL, NULL, &data);
   5570        BCM_IF_ERROR_RETURN(rv);
   5571     }
   5572     
   5573     FP_LOCK(unit);
   5574     rv = _field_control_get(unit, &fc);
   5575     if (BCM_FAILURE(rv)) {
   5576         FP_UNLOCK(unit);
   5577         return rv;
   5578     }
   5579 
   5580     rv = fc->functions.fp_qualify_trunk(unit, entry, 
   5581                                         bcmFieldQualifyDstTrunk, 
   5582                                         data, mask);
   5583     FP_UNLOCK(unit);
   5584     return (rv);
   5585 }
   5586 
   5587 int
   5588 bcm_esw_field_qualify_L4SrcPort(int unit, bcm_field_entry_t entry,
   5589                                 bcm_l4_port_t data, bcm_l4_port_t mask)
   5590 {
   5591     int              rv;       /* Operation return status. */
   5592 
   5593     
   5594     FP_LOCK(unit);
   5595 
   5596     rv = _field_qualify32(unit, entry, bcmFieldQualifyL4SrcPort,
   5597                           data, mask);
   5598 
   5599     FP_UNLOCK(unit);
   5600     return (rv);
   5601 }
   5602 
   5603 int
   5604 bcm_esw_field_qualify_L4DstPort(int unit, bcm_field_entry_t entry,
   5605                                 bcm_l4_port_t data, bcm_l4_port_t mask)
   5606 {
   5607     int              rv;       /* Operation return status. */
   5608 
   5609     
   5610     FP_LOCK(unit);
   5611 
   5612     rv = _field_qualify32(unit, entry, bcmFieldQualifyL4DstPort,
   5613                             data, mask);
   5614     FP_UNLOCK(unit);
   5615     return (rv);
   5616 }
   5617 
   5618 int
   5619 bcm_esw_field_qualify_InnerL4SrcPort(int unit, bcm_field_entry_t entry,
   5620                                 bcm_l4_port_t data, bcm_l4_port_t mask)
   5621 {
   5622     int              rv;       /* Operation return status. */
   5623 
   5624     
   5625     FP_LOCK(unit);
   5626 
   5627     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerL4SrcPort,
   5628                           data, mask);
   5629 
   5630     FP_UNLOCK(unit);
   5631     return (rv);
   5632 }
   5633 
   5634 int
   5635 bcm_esw_field_qualify_InnerL4DstPort(int unit, bcm_field_entry_t entry,
   5636                                 bcm_l4_port_t data, bcm_l4_port_t mask)
   5637 {
   5638     int              rv;       /* Operation return status. */
   5639 
   5640     
   5641     FP_LOCK(unit);
   5642 
   5643     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerL4DstPort,
   5644                             data, mask);
   5645     FP_UNLOCK(unit);
   5646     return (rv);
   5647 }
   5648 
   5649 /*
   5650  * Function:
   5651  *      bcm_esw_field_qualify_OuterVlanId
   5652  * Purpose:
   5653  *       Set match criteria for bcmFieildQualifyOuterVlanId
   5654  *                       qualifier in the field entry.
   5655  * Parameters:
   5656  *      unit - (IN) Unit number.
   5657  *      entry - (IN) BCM field entry id.
   5658  *      data - (IN) Qualifier match data.
   5659  *      mask - (IN) Qualifier match data.
   5660  * Returns:
   5661  *      BCM_E_XXX
   5662  * Notes:
   5663  */
   5664 int 
   5665 bcm_esw_field_qualify_OuterVlanId(
   5666     int unit, 
   5667     bcm_field_entry_t entry, 
   5668     bcm_vlan_t data, 
   5669     bcm_vlan_t mask)
   5670 {
   5671     int              rv;       /* Operation return status. */
   5672 
   5673     /* Validate VLAN ID data, should not be more than 12-bits */
   5674     if (data & ~(0xfff)) {
   5675        return BCM_E_PARAM; 
   5676     }
   5677 
   5678     
   5679     FP_LOCK(unit);
   5680 
   5681     rv = _field_qualify32(unit, entry, bcmFieldQualifyOuterVlanId, data, mask);
   5682 
   5683     FP_UNLOCK(unit);
   5684     return (rv);
   5685 }
   5686 
   5687 
   5688 /*
   5689  * Function:
   5690  *      bcm_esw_field_qualify_OuterVlanPri
   5691  * Purpose:
   5692  *       Set match criteria for bcmFieildQualifyOuterVlanPri
   5693  *                       qualifier in the field entry.
   5694  * Parameters:
   5695  *      unit - (IN) Unit number.
   5696  *      entry - (IN) BCM field entry id.
   5697  *      data - (IN) Qualifier match data.
   5698  *      mask - (IN) Qualifier match data.
   5699  * Returns:
   5700  *      BCM_E_XXX
   5701  * Notes:
   5702  */
   5703 int 
   5704 bcm_esw_field_qualify_OuterVlanPri(
   5705     int unit, 
   5706     bcm_field_entry_t entry, 
   5707     uint8 data, 
   5708     uint8 mask)
   5709 {
   5710     int              rv;       /* Operation return status. */
   5711 
   5712     /* Validate VLAN Priority data, should not be more than 3-bits */
   5713     if (data & ~(0x7)) {
   5714        return BCM_E_PARAM; 
   5715     }
   5716 
   5717     
   5718     FP_LOCK(unit);
   5719 
   5720     rv = _field_qualify32(unit, entry, bcmFieldQualifyOuterVlanPri, data, mask);
   5721 
   5722     FP_UNLOCK(unit);
   5723     return (rv);
   5724 }
   5725 
   5726 
   5727 /*
   5728  * Function:
   5729  *      bcm_esw_field_qualify_OuterVlanCfi
   5730  * Purpose:
   5731  *       Set match criteria for bcmFieildQualifyOuterVlanCfi
   5732  *                       qualifier in the field entry.
   5733  * Parameters:
   5734  *      unit - (IN) Unit number.
   5735  *      entry - (IN) BCM field entry id.
   5736  *      data - (IN) Qualifier match data.
   5737  *      mask - (IN) Qualifier match data.
   5738  * Returns:
   5739  *      BCM_E_XXX
   5740  * Notes:
   5741  */
   5742 int 
   5743 bcm_esw_field_qualify_OuterVlanCfi(
   5744     int unit, 
   5745     bcm_field_entry_t entry, 
   5746     uint8 data, 
   5747     uint8 mask)
   5748 {
   5749     int              rv;       /* Operation return status. */
   5750 
   5751     /* Validate VLAN CFI data, should not be more than 1-bit */
   5752     if (data & ~(0x1)) {
   5753        return BCM_E_PARAM; 
   5754     }
   5755 
   5756     
   5757     FP_LOCK(unit);
   5758 
   5759     rv = _field_qualify32(unit, entry, bcmFieldQualifyOuterVlanCfi, data, mask);
   5760 
   5761     FP_UNLOCK(unit);
   5762     return (rv);
   5763 }
   5764 
   5765 
   5766 /*
   5767  * Function:
   5768  *      bcm_esw_field_qualify_InnerVlanId
   5769  * Purpose:
   5770  *       Set match criteria for bcmFieildQualifyInnerVlanId
   5771  *                       qualifier in the field entry.
   5772  * Parameters:
   5773  *      unit - (IN) Unit number.
   5774  *      entry - (IN) BCM field entry id.
   5775  *      data - (IN) Qualifier match data.
   5776  *      mask - (IN) Qualifier match data.
   5777  * Returns:
   5778  *      BCM_E_XXX
   5779  * Notes:
   5780  */
   5781 int 
   5782 bcm_esw_field_qualify_InnerVlanId(
   5783     int unit, 
   5784     bcm_field_entry_t entry, 
   5785     bcm_vlan_t data, 
   5786     bcm_vlan_t mask)
   5787 {
   5788     int              rv;       /* Operation return status. */
   5789 
   5790     /* Validate VLAN ID data, should not be more than 12-bits */
   5791     if (data & ~(0xfff)) {
   5792        return BCM_E_PARAM; 
   5793     }
   5794     
   5795     FP_LOCK(unit);
   5796 
   5797     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerVlanId, data, mask);
   5798 
   5799     FP_UNLOCK(unit);
   5800     return (rv);
   5801 }
   5802 
   5803 /*
   5804  * Function:
   5805  *      bcm_esw_field_qualify_ForwardingVlanId
   5806  * Purpose:
   5807  *      Set match criteria for bcmFieildQualifyForwardingVlanId
   5808  *      qualifier in the field entry.
   5809  * Parameters:
   5810  *      unit - (IN) Unit number.
   5811  *      entry - (IN) BCM field entry id.
   5812  *      data - (IN) Qualifier match data.
   5813  *      mask - (IN) Qualifier match data.
   5814  * Returns:
   5815  *      BCM_E_XXX
   5816  * Notes:
   5817  */
   5818 int 
   5819 bcm_esw_field_qualify_ForwardingVlanId(
   5820     int unit, 
   5821     bcm_field_entry_t entry, 
   5822     bcm_vlan_t data, 
   5823     bcm_vlan_t mask)
   5824 {
   5825     int              rv;       /* Operation return status. */
   5826     
   5827     FP_LOCK(unit);
   5828 
   5829     rv = _field_qualify32(unit, entry, bcmFieldQualifyForwardingVlanId, data, mask);
   5830 
   5831     FP_UNLOCK(unit);
   5832     return (rv);
   5833 }
   5834 
   5835 
   5836 /*
   5837  * Function:
   5838  *      bcm_esw_field_qualify_Vpn
   5839  * Purpose:
   5840  *      Set match criteria for bcmFieildQualifyVpn
   5841  *      qualifier in the field entry.
   5842  * Parameters:
   5843  *      unit - (IN) Unit number.
   5844  *      entry - (IN) BCM field entry id.
   5845  *      data - (IN) Qualifier match data.
   5846  *      mask - (IN) Qualifier match data.
   5847  * Returns:
   5848  *      BCM_E_XXX
   5849  * Notes:
   5850  */
   5851 int 
   5852 bcm_esw_field_qualify_Vpn(
   5853     int unit, 
   5854     bcm_field_entry_t entry, 
   5855     bcm_vpn_t data, 
   5856     bcm_vpn_t mask)
   5857 {
   5858     int              rv;       /* Operation return status. */
   5859 
   5860     
   5861     FP_LOCK(unit);
   5862 
   5863     rv = _field_qualify32(unit, entry, bcmFieldQualifyVpn, data, mask);
   5864 
   5865     FP_UNLOCK(unit);
   5866     return (rv);
   5867 }
   5868 
   5869 /*
   5870  * Function:
   5871  *      bcm_esw_field_qualify_InnerVlanPri
   5872  * Purpose:
   5873  *       Set match criteria for bcmFieildQualifyInnerVlanPri
   5874  *                       qualifier in the field entry.
   5875  * Parameters:
   5876  *      unit - (IN) Unit number.
   5877  *      entry - (IN) BCM field entry id.
   5878  *      data - (IN) Qualifier match data.
   5879  *      mask - (IN) Qualifier match data.
   5880  * Returns:
   5881  *      BCM_E_XXX
   5882  * Notes:
   5883  */
   5884 int 
   5885 bcm_esw_field_qualify_InnerVlanPri(
   5886     int unit, 
   5887     bcm_field_entry_t entry, 
   5888     uint8 data, 
   5889     uint8 mask)
   5890 {
   5891     int              rv;       /* Operation return status. */
   5892 
   5893     /* Validate VLAN Priority data, should not be more than 3-bits */
   5894     if (data & ~(0x7)) {
   5895        return BCM_E_PARAM; 
   5896     }
   5897     
   5898     FP_LOCK(unit);
   5899 
   5900     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerVlanPri, data, mask);
   5901 
   5902     FP_UNLOCK(unit);
   5903     return (rv);
   5904 }
   5905 
   5906 
   5907 /*
   5908  * Function:
   5909  *      bcm_esw_field_qualify_InnerVlanCfi
   5910  * Purpose:
   5911  *       Set match criteria for bcmFieildQualifyInnerVlanCfi
   5912  *                       qualifier in the field entry.
   5913  * Parameters:
   5914  *      unit - (IN) Unit number.
   5915  *      entry - (IN) BCM field entry id.
   5916  *      data - (IN) Qualifier match data.
   5917  *      mask - (IN) Qualifier match data.
   5918  * Returns:
   5919  *      BCM_E_XXX
   5920  * Notes:
   5921  */
   5922 int 
   5923 bcm_esw_field_qualify_InnerVlanCfi(
   5924     int unit, 
   5925     bcm_field_entry_t entry, 
   5926     uint8 data, 
   5927     uint8 mask)
   5928 {
   5929     int              rv;       /* Operation return status. */
   5930 
   5931     /* Validate VLAN CFI data, should not be more than 1-bit */
   5932     if (data & ~(0x1)) {
   5933        return BCM_E_PARAM; 
   5934     }
   5935 
   5936     
   5937     FP_LOCK(unit);
   5938 
   5939     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerVlanCfi, data, mask);
   5940 
   5941     FP_UNLOCK(unit);
   5942     return (rv);
   5943 }
   5944 
   5945 /*
   5946  * Function:
   5947  *      bcm_esw_field_qualify_OuterVlanId_get
   5948  * Purpose:
   5949  *       Get match criteria for bcmFieildQualifyOuterVlanId
   5950  *                       qualifier from the field entry.
   5951  * Parameters:
   5952  *      unit - (IN) Unit number.
   5953  *      entry - (IN) BCM field entry id.
   5954  *      data - (OUT) Qualifier match data.
   5955  *      mask - (OUT) Qualifier match data.
   5956  * Returns:
   5957  *      BCM_E_XXX
   5958  * Notes:
   5959  */
   5960 int 
   5961 bcm_esw_field_qualify_OuterVlanId_get(
   5962     int unit, 
   5963     bcm_field_entry_t entry, 
   5964     bcm_vlan_t *data, 
   5965     bcm_vlan_t *mask)
   5966 {
   5967     /* Read qualifier match value and mask. */ 
   5968     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
   5969                                             bcmFieldQualifyOuterVlanId,
   5970                                             data, mask);
   5971 }
   5972 
   5973 
   5974 /*
   5975  * Function:
   5976  *      bcm_esw_field_qualify_OuterVlanPri_get
   5977  * Purpose:
   5978  *       Get match criteria for bcmFieildQualifyOuterVlanPri
   5979  *                       qualifier from the field entry.
   5980  * Parameters:
   5981  *      unit - (IN) Unit number.
   5982  *      entry - (IN) BCM field entry id.
   5983  *      data - (OUT) Qualifier match data.
   5984  *      mask - (OUT) Qualifier match mask.
   5985  * Returns:
   5986  *      BCM_E_XXX
   5987  * Notes:
   5988  */
   5989 int 
   5990 bcm_esw_field_qualify_OuterVlanPri_get(
   5991     int unit, 
   5992     bcm_field_entry_t entry, 
   5993     uint8 *data, 
   5994     uint8 *mask)
   5995 {
   5996     /* Read qualifier match value and mask. */
   5997     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
   5998                                             bcmFieldQualifyOuterVlanPri,
   5999                                             data, mask);
   6000 }
   6001 
   6002 /*
   6003  * Function:
   6004  *      bcm_esw_field_qualify_OuterVlanCfi_get
   6005  * Purpose:
   6006  *       Get match criteria for bcmFieildQualifyOuterVlanCfi_get
   6007  *                       qualifier from the field entry.
   6008  * Parameters:
   6009  *      unit - (IN) Unit number.
   6010  *      entry - (IN) BCM field entry id.
   6011  *      data - (OUT) Qualifier match data.
   6012  *      mask - (OUT) Qualifier match mask.
   6013  * Returns:
   6014  *      BCM_E_XXX
   6015  * Notes:
   6016  */
   6017 int 
   6018 bcm_esw_field_qualify_OuterVlanCfi_get(
   6019     int unit, 
   6020     bcm_field_entry_t entry, 
   6021     uint8 *data, 
   6022     uint8 *mask)
   6023 {
   6024     /* Read qualifier match value and mask. */
   6025     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
   6026                                             bcmFieldQualifyOuterVlanCfi,
   6027                                             data, mask);
   6028 }
   6029 
   6030 /*
   6031  * Function:
   6032  *      bcm_esw_field_qualify_InnerVlanId_get
   6033  * Purpose:
   6034  *       Get match criteria for bcmFieildQualifyInnerVlanId
   6035  *                       qualifier from the field entry.
   6036  * Parameters:
   6037  *      unit - (IN) Unit number.
   6038  *      entry - (IN) BCM field entry id.
   6039  *      data - (OUT) Qualifier match data.
   6040  *      mask - (OUT) Qualifier match data.
   6041  * Returns:
   6042  *      BCM_E_XXX
   6043  * Notes:
   6044  */
   6045 int 
   6046 bcm_esw_field_qualify_InnerVlanId_get(
   6047     int unit, 
   6048     bcm_field_entry_t entry, 
   6049     bcm_vlan_t *data, 
   6050     bcm_vlan_t *mask)
   6051 {
   6052     /* Read qualifier match value and mask. */ 
   6053     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
   6054                                             bcmFieldQualifyInnerVlanId,
   6055                                             data, mask);
   6056 }
   6057 
   6058 /*
   6059  * Function:
   6060  *      bcm_esw_field_qualify_ForwardingVlanId_get
   6061  * Purpose:
   6062  *       Get match criteria for bcmFieildQualifyForwardingVlanId
   6063  *                       qualifier from the field entry.
   6064  * Parameters:
   6065  *      unit - (IN) Unit number.
   6066  *      entry - (IN) BCM field entry id.
   6067  *      data - (OUT) Qualifier match data.
   6068  *      mask - (OUT) Qualifier match data.
   6069  * Returns:
   6070  *      BCM_E_XXX
   6071  * Notes:
   6072  */
   6073 int 
   6074 bcm_esw_field_qualify_ForwardingVlanId_get(
   6075     int unit, 
   6076     bcm_field_entry_t entry, 
   6077     bcm_vlan_t *data, 
   6078     bcm_vlan_t *mask)
   6079 {
   6080     /* Read qualifier match value and mask. */ 
   6081     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
   6082                                             bcmFieldQualifyForwardingVlanId,
   6083                                             data, mask);
   6084 }
   6085 
   6086 /*
   6087  * Function:
   6088  *      bcm_esw_field_qualify_Vpn_get
   6089  * Purpose:
   6090  *       Get match criteria for bcmFieildQualifyVpn
   6091  *                       qualifier from the field entry.
   6092  * Parameters:
   6093  *      unit - (IN) Unit number.
   6094  *      entry - (IN) BCM field entry id.
   6095  *      data - (OUT) Qualifier match data.
   6096  *      mask - (OUT) Qualifier match data.
   6097  * Returns:
   6098  *      BCM_E_XXX
   6099  * Notes:
   6100  */
   6101 int 
   6102 bcm_esw_field_qualify_Vpn_get(
   6103     int unit, 
   6104     bcm_field_entry_t entry, 
   6105     bcm_vpn_t *data, 
   6106     bcm_vpn_t *mask)
   6107 {
   6108     /* Read qualifier match value and mask. */ 
   6109     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
   6110                                             bcmFieldQualifyVpn,
   6111                                             data, mask);
   6112 }
   6113 
   6114 /*
   6115  * Function:
   6116  *      bcm_esw_field_qualify_InnerVlanPri_get
   6117  * Purpose:
   6118  *       Get match criteria for bcmFieildQualifyInnerVlanPri
   6119  *                       qualifier from the field entry.
   6120  * Parameters:
   6121  *      unit - (IN) Unit number.
   6122  *      entry - (IN) BCM field entry id.
   6123  *      data - (OUT) Qualifier match data.
   6124  *      mask - (OUT) Qualifier match mask.
   6125  * Returns:
   6126  *      BCM_E_XXX
   6127  * Notes:
   6128  */
   6129 int 
   6130 bcm_esw_field_qualify_InnerVlanPri_get(
   6131     int unit, 
   6132     bcm_field_entry_t entry, 
   6133     uint8 *data, 
   6134     uint8 *mask)
   6135 {
   6136     /* Read qualifier match value and mask. */
   6137     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
   6138                                             bcmFieldQualifyInnerVlanPri,
   6139                                             data, mask);
   6140 }
   6141 
   6142 /*
   6143  * Function:
   6144  *      bcm_esw_field_qualify_InnerVlanCfi_get
   6145  * Purpose:
   6146  *       Get match criteria for bcmFieildQualifyInnerVlanCfi_get
   6147  *                       qualifier from the field entry.
   6148  * Parameters:
   6149  *      unit - (IN) Unit number.
   6150  *      entry - (IN) BCM field entry id.
   6151  *      data - (OUT) Qualifier match data.
   6152  *      mask - (OUT) Qualifier match mask.
   6153  * Returns:
   6154  *      BCM_E_XXX
   6155  * Notes:
   6156  */
   6157 int 
   6158 bcm_esw_field_qualify_InnerVlanCfi_get(
   6159     int unit, 
   6160     bcm_field_entry_t entry, 
   6161     uint8 *data, 
   6162     uint8 *mask)
   6163 {
   6164     /* Read qualifier match value and mask. */
   6165     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
   6166                                             bcmFieldQualifyInnerVlanCfi,
   6167                                             data, mask);
   6168 }
   6169 
   6170 int
   6171 bcm_esw_field_qualify_OuterVlan(int unit, bcm_field_entry_t entry,
   6172                                 bcm_vlan_t data, bcm_vlan_t mask)
   6173 {
   6174 
   6175     int rv;                          /* Operation return status. */
   6176 
   6177 #if defined(BCM_TOMAHAWK_SUPPORT)
   6178     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   6179         rv = _bcm_field_is_entry_stage_valid(unit, entry,
   6180                                              _BCM_FIELD_STAGE_INGRESS);
   6181         
   6182         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
   6183             /* Error fetching entry */
   6184             return (rv); 
   6185         }
   6186     
   6187         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
   6188 
   6189             
   6190             FP_LOCK(unit);
   6191 
   6192             rv = _field_qualify32(unit, entry, bcmFieldQualifyOuterVlan,
   6193                                   data, mask);
   6194             FP_UNLOCK(unit);
   6195             return (rv);
   6196         }
   6197     }
   6198 #endif /* BCM_TOMAHAWK_SUPPORT */
   6199      
   6200     rv = bcm_esw_field_qualify_OuterVlanId(unit, entry, 
   6201                                            (data & 0xfff), 
   6202                                            (mask & 0xfff));
   6203     BCM_IF_ERROR_RETURN(rv);
   6204 
   6205     rv = bcm_esw_field_qualify_OuterVlanCfi(unit, entry, 
   6206                                             ((data >> 12) & 0x1),
   6207                                             ((mask >> 12) & 0x1));
   6208     BCM_IF_ERROR_RETURN(rv);
   6209 
   6210     rv = bcm_esw_field_qualify_OuterVlanPri(unit, entry,
   6211                                             (data >> 13),
   6212                                             (mask >> 13));
   6213     return (rv);
   6214 }
   6215 
   6216 int
   6217 bcm_esw_field_qualify_InnerVlan(int unit, bcm_field_entry_t entry,
   6218                                 bcm_vlan_t data, bcm_vlan_t mask)
   6219 {
   6220     int rv;                       /* Operation return status. */
   6221 
   6222 #if defined(BCM_TOMAHAWK_SUPPORT)
   6223     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   6224         rv = _bcm_field_is_entry_stage_valid(unit, entry,
   6225                                              _BCM_FIELD_STAGE_INGRESS);
   6226         
   6227         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
   6228             /*Error fetching entry*/
   6229             return (rv); 
   6230         }
   6231     
   6232         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
   6233 
   6234             FP_LOCK(unit);
   6235 
   6236             rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerVlan,
   6237                                   data, mask);
   6238             FP_UNLOCK(unit);
   6239             return (rv);
   6240         }
   6241     }
   6242 #endif /* BCM_TOMAHAWK_SUPPORT */
   6243  
   6244     rv = bcm_esw_field_qualify_InnerVlanId(unit, entry, 
   6245                                            (data & 0xfff), 
   6246                                            (mask & 0xfff));
   6247     BCM_IF_ERROR_RETURN(rv);
   6248 
   6249     rv = bcm_esw_field_qualify_InnerVlanCfi(unit, entry, 
   6250                                             ((data >> 12) & 0x1),
   6251                                             ((mask >> 12) & 0x1));
   6252     BCM_IF_ERROR_RETURN(rv);
   6253 
   6254     rv = bcm_esw_field_qualify_InnerVlanPri(unit, entry,
   6255                                             (data >> 13),
   6256                                             (mask >> 13));
   6257     return (rv);
   6258 }
   6259 
   6260 int
   6261 bcm_esw_field_qualify_EtherType(int unit, bcm_field_entry_t entry,
   6262                                 uint16 data, uint16 mask)
   6263 {
   6264     int              rv;
   6265 
   6266     
   6267     FP_LOCK(unit);
   6268 
   6269     rv = _field_qualify32(unit, entry, bcmFieldQualifyEtherType,
   6270                           data, mask);
   6271     FP_UNLOCK(unit);
   6272     return (rv);
   6273 }
   6274 
   6275 int
   6276 bcm_esw_field_qualify_IpProtocol(int unit, bcm_field_entry_t entry,
   6277                                  uint8 data, uint8 mask)
   6278 {
   6279     int              rv;
   6280 
   6281     
   6282     FP_LOCK(unit);
   6283 
   6284     rv = _field_qualify32(unit, entry, bcmFieldQualifyIpProtocol,
   6285                           data, mask);
   6286     FP_UNLOCK(unit);
   6287     return (rv);
   6288 }
   6289 
   6290 /* bcm_field_qualify_DosAttack */
   6291 int 
   6292 bcm_esw_field_qualify_DosAttack(int unit, bcm_field_entry_t entry, 
   6293                                 uint8 data, uint8 mask) 
   6294 {
   6295     int              rv;
   6296 
   6297     
   6298     FP_LOCK(unit);
   6299 
   6300     rv = _field_qualify32(unit, entry, bcmFieldQualifyDosAttack,
   6301                             data, mask);
   6302     FP_UNLOCK(unit);
   6303     return (rv);
   6304 }
   6305 
   6306 /* bcm_field_qualify_IpmcStarGroupHit */
   6307 int 
   6308 bcm_esw_field_qualify_IpmcStarGroupHit(int unit, bcm_field_entry_t entry, 
   6309                                        uint8 data, uint8 mask)
   6310 {
   6311     int              rv;
   6312 
   6313     
   6314     FP_LOCK(unit);
   6315 
   6316     rv = _field_qualify32(unit, entry, bcmFieldQualifyIpmcStarGroupHit,
   6317                             data, mask);
   6318     FP_UNLOCK(unit);
   6319     return (rv);
   6320 }
   6321 
   6322 /* bcm_field_qualify_MyStationHit */
   6323 int 
   6324 bcm_esw_field_qualify_MyStationHit(int unit, bcm_field_entry_t entry, 
   6325                                        uint8 data, uint8 mask)
   6326 {
   6327     int              rv;
   6328 
   6329     
   6330     FP_LOCK(unit);
   6331 
   6332     rv = _field_qualify32(unit, entry, bcmFieldQualifyMyStationHit,
   6333                             data, mask);
   6334     FP_UNLOCK(unit);
   6335     return (rv);
   6336 }
   6337 
   6338 /*
   6339  * Function:
   6340  *      bcm_esw_field_qualify_L2PayloadFirstEightBytes
   6341  * Purpose:
   6342  *      Add match criteria for bcmFieildQualifyL2PayloadFirstEightBytes
   6343  *                     qualifier from the field entry.
   6344  * Parameters:
   6345  *      unit - (IN) Unit number.
   6346  *      entry - (IN) BCM field entry id.
   6347  *      data1 - (IN) Qualifier first four bytes of matched data.
   6348  *      data2 - (IN) Qualifier last four bytes of matched data.
   6349  *      mask1 - (IN) Qualifier first four bytes of matched mask.
   6350  *      mask2 - (IN) Qualifier last four bytes of matched mask.
   6351  *
   6352  * Note: Values passed in data1 and data2 should be in actual packet data 
   6353  *       format order.
   6354  * Returns:
   6355  *      BCM_E_XXX
   6356  * Notes:
   6357  */
   6358 int 
   6359 bcm_esw_field_qualify_L2PayloadFirstEightBytes(int unit,
   6360                                                bcm_field_entry_t entry, 
   6361                                                uint32 data1, uint32 data2,
   6362                                                uint32 mask1, uint32 mask2)
   6363 {
   6364     int                 rv;
   6365 
   6366     FP_LOCK(unit);
   6367 
   6368     rv = _field_qualify_L2PayloadFirstEightBytes(unit, entry,
   6369             bcmFieldQualifyL2PayloadFirstEightBytes, data1, data2,
   6370             mask1, mask2);
   6371 
   6372     FP_UNLOCK(unit);
   6373     return (rv);
   6374 }
   6375 /*
   6376  * Function:
   6377  *     bcm_esw_field_qualify_L2PayLoad
   6378  * Purpose:
   6379  *     Add match criteria for bcmFieildQualifyL2PayLoad
   6380  *     qualifier from the field entry.
   6381  * Parameters:
   6382  *     unit  - (IN) Unit number.
   6383  *     entry - (IN) BCM field entry id.
   6384  *     count - (IN) Number of bytes to qualify from the start of L2 Payload .
   6385  *     data  - (IN) Qualifier matched data.
   6386  *     mask  - (IN) Qualifier matched mask.
   6387  * Returns:
   6388  *     BCM_E_XXX
   6389  * Notes: Number of bytes can be qualified in L2 Payload may vary from chip to chip and
   6390  *        may differ b/w (Vlan/Ingress/Egress) Field Processors of same chip.If user 
   6391  *        passes count more than supported, API will return BCM_E_PARAM.If count is less
   6392  *        than the supported, API will add trailing zeros.
   6393  */
   6394 int
   6395 bcm_esw_field_qualify_L2PayLoad(int unit,
   6396                                 bcm_field_entry_t entry,
   6397                                 uint32 count, 
   6398                                 const uint8 *data, 
   6399                                 const uint8 *mask)
   6400 {
   6401     int rv = BCM_E_UNAVAIL;                 /* Operation return status. */
   6402 #if defined(BCM_TOMAHAWK_SUPPORT)
   6403     uint8  shift;                           /* Shift input by 'x'.      */
   6404     uint8  r_idx;                           /* Local data index.        */
   6405     uint16 width, part_width;                /* Width of the qualifier.  */
   6406     uint16 byte;                            /* Loop iterator.           */
   6407     uint32 ref_data[_FP_QUAL_DATA_WORDS];   /* HW match data.           */
   6408     uint32 ref_mask[_FP_QUAL_DATA_WORDS];   /* HW match mask.           */
   6409     _field_entry_t   *f_ent;                /* Field Entry Structure.   */
   6410     _bcm_field_qual_offset_t *q_offset;     /* Qualfier Offset.         */
   6411     _bcm_field_qual_offset_t qual_offset;   /* Qualfier Offset for IFP/EM*/
   6412     bcm_field_qualify_t qual;               /* Qualifier Id.            */
   6413     int r_offset;                           /* Identify the data index. */ 
   6414     int entry_parts, part_ct;               /* Number of parts		*/
   6415 
   6416     LOG_DEBUG(BSL_LS_BCM_FP,            
   6417               (BSL_META_U(unit,
   6418                           "bcm_esw_field_qualify_L2PayLoad\n")));
   6419 
   6420     /* Input parameters check. */
   6421     if ((NULL == data) || (NULL == mask)) {
   6422         return BCM_E_PARAM;
   6423     }
   6424 
   6425     
   6426 
   6427     FP_LOCK(unit);
   6428 
   6429     qual = bcmFieldQualifyL2PayLoad;
   6430     /* Get field entry part that contains qualifier. */
   6431     rv = _bcm_field_entry_qual_get(unit, entry, qual, &f_ent);
   6432     if BCM_FAILURE(rv) {
   6433        FP_UNLOCK(unit);
   6434        return rv;
   6435     }
   6436 
   6437     width = 0;
   6438     if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   6439     /* Get qualifier offsets in the tcam. */
   6440         rv = _field_qual_offset_get(unit, f_ent, qual, &q_offset);
   6441         if BCM_FAILURE(rv) {
   6442            FP_UNLOCK(unit);
   6443            return rv;
   6444         }
   6445         width = q_offset->width[0] + q_offset->width[1] + q_offset->width[2];
   6446     }
   6447     else {
   6448         /* Retrieve group entry parts */
   6449         rv = _bcm_field_th_entry_tcam_parts_count(unit, f_ent->group->flags,
   6450                                               &entry_parts);
   6451             if BCM_FAILURE(rv) {
   6452                FP_UNLOCK(unit);
   6453                return rv;
   6454             }
   6455         for (part_ct = 0; part_ct < entry_parts; part_ct++) {
   6456             /* Initialize qual_offset to NULL */
   6457             sal_memset(&qual_offset, 0x0, sizeof(qual_offset));
   6458             part_width=0;
   6459             /* Retrieve the Qualifier offsets for the particular entry part */  
   6460             rv = _bcm_field_th_qual_part_offset_get(unit, f_ent, part_ct,
   6461                                                qual, &qual_offset);
   6462             if (rv == BCM_E_NOT_FOUND) {
   6463                 continue;
   6464             } else if (BCM_FAILURE(rv)) {
   6465                 FP_UNLOCK(unit);
   6466                 return rv;
   6467             }
   6468            /* Combined width of a qualifier for a given part */
   6469            _BCM_FIELD_QUAL_MULTI_OFFSET_WIDTH(&qual_offset, part_width);
   6470 	   width = width + part_width;
   6471 	}
   6472     }
   6473     if (width < (count * 8)) {
   6474         FP_UNLOCK(unit);
   6475         return BCM_E_PARAM;
   6476     }
   6477 
   6478     sal_memset(&ref_data, 0, sizeof(ref_data));
   6479     sal_memset(&ref_mask, 0, sizeof(ref_mask));
   6480 
   6481     r_idx = width / 32;
   6482     r_offset = width % 32;
   6483 
   6484     if (!r_offset) {
   6485         r_idx -= 1;
   6486         shift = 24; 
   6487     }
   6488     else {
   6489         shift = 24 - r_offset;
   6490     }
   6491 
   6492     for (byte = 0; byte < count; byte++) {
   6493         ref_data[r_idx] |= data[byte] << shift;
   6494         ref_mask[r_idx] |= mask[byte] << shift;
   6495         if (shift < 8) {
   6496             shift = 24;
   6497             r_idx--;
   6498         }
   6499         else {
   6500             shift -= 8;
   6501         }
   6502     }
   6503 
   6504     /* Program data/mask pair to tcam buffer. */
   6505     /*
   6506      * COVERITY 
   6507      * 
   6508      *This flow takes care of the  Out-of-bounds access issue  
   6509      * for ref_data and ref_mask.
   6510      */
   6511     /* coverity[callee_ptr_arith : FALSE] */
   6512     if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   6513         rv = _field_efp_qualify32(unit, entry, qual, ref_data, ref_mask);
   6514             if BCM_FAILURE(rv) {
   6515                FP_UNLOCK(unit);
   6516                return rv;
   6517             }
   6518     }
   6519     else {
   6520     /* stage is Ingress/ExactMatch */
   6521         rv = _bcm_field_th_qualify_set(unit, entry, qual,
   6522                              ref_data, ref_mask, _FP_QUALIFIER_ADD);
   6523     }
   6524 
   6525     f_ent->flags |= _FP_ENTRY_DIRTY;
   6526 
   6527     FP_UNLOCK(unit);
   6528 #endif
   6529     return (rv);
   6530 }
   6531 /*
   6532  * Function:
   6533  *     bcm_esw_field_qualify_L2PayLoad_get
   6534  * Purpose:
   6535  *     Get match criteria for bcmFieildQualifyL2PayLoad
   6536  *     qualifier from the field entry.
   6537  * Parameters:
   6538  *     unit  - (IN) Unit number.
   6539  *     entry - (IN) BCM field entry id.
   6540  *     count - (IN) Number of bytes to qualify from the start of L2 Payload .
   6541  *     data  - (OUT) Qualifier matched data.
   6542  *     mask  - (OUT) Qualifier matched mask.
   6543  * Returns:
   6544  *     BCM_E_XXX
   6545  * Notes: Number of bytes can be qualified in L2 Payload may vary from chip to chip and
   6546  *        may differ b/w (Vlan/Ingress/Egress) Field Processors of same chip.If user 
   6547  *        passes count more than supported, API will return BCM_E_PARAM.If count is less
   6548  *        than the supported, API will add trailing zeros.
   6549  */
   6550 int
   6551 bcm_esw_field_qualify_L2PayLoad_get(int unit,
   6552                                     bcm_field_entry_t entry,
   6553                                     uint32 count, 
   6554                                     uint8 *data, 
   6555                                     uint8 *mask)
   6556 {
   6557     int rv = BCM_E_UNAVAIL;                 /* Operation return status */
   6558 #if defined(BCM_TOMAHAWK_SUPPORT)
   6559     uint8                       r_idx;      /* Local data index.        */
   6560     uint8                       r_offset;   /* Identify the data index. */
   6561     uint8                       shift;      /* Shift hw data by 'x'.    */
   6562     uint16               width, part_width; /* Width of the qualifier.  */
   6563     uint16                      byte;       /* Loop iterator.           */
   6564     uint32 ref_data[_FP_QUAL_DATA_WORDS];   /* HW match data.           */
   6565     uint32 ref_mask[_FP_QUAL_DATA_WORDS];   /* HW match mask.           */
   6566     _field_entry_t              *f_ent;     /* Field Entry Structure.   */
   6567     _bcm_field_qual_offset_t    *q_offset;  /* Qualfier Offset.         */
   6568     _bcm_field_qual_offset_t    qual_offset;  /* Qualfier Offset.         */
   6569     bcm_field_qualify_t         qual;       /* Qualifier Id.            */
   6570    int entry_parts,part_ct;
   6571 
   6572     /* Input parameters check. */
   6573     if ((NULL == data) || (NULL == mask)) {
   6574         return BCM_E_PARAM;
   6575     }
   6576 
   6577     
   6578 
   6579     FP_LOCK(unit);
   6580 
   6581     qual = bcmFieldQualifyL2PayLoad;
   6582     /* Get field entry part that contains qualifier. */
   6583     rv = _bcm_field_entry_qual_get(unit, entry, qual, &f_ent);
   6584     if BCM_FAILURE(rv) {
   6585        FP_UNLOCK(unit);
   6586        return rv;
   6587     }
   6588 
   6589     /* Get qualifier offsets in the tcam. */
   6590     rv = _field_qual_offset_get(unit, f_ent, qual, &q_offset);
   6591     if BCM_FAILURE(rv) {
   6592        FP_UNLOCK(unit);
   6593        return rv;
   6594     }
   6595 
   6596     width = 0;
   6597     if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   6598     /* Get qualifier offsets in the tcam. */
   6599         rv = _field_qual_offset_get(unit, f_ent, qual, &q_offset);
   6600         if BCM_FAILURE(rv) {
   6601            FP_UNLOCK(unit);
   6602            return rv;
   6603         }
   6604         width = q_offset->width[0] + q_offset->width[1] + q_offset->width[2];
   6605     }
   6606     else {
   6607         /* Retrieve group entry parts */
   6608         rv = _bcm_field_th_entry_tcam_parts_count(unit, f_ent->group->flags,
   6609                                               &entry_parts);
   6610         if BCM_FAILURE(rv) {
   6611            FP_UNLOCK(unit);
   6612            return rv;
   6613         }
   6614         for (part_ct = 0; part_ct < entry_parts; part_ct++) {
   6615             /* Initialize qual_offset to NULL */
   6616             sal_memset(&qual_offset, 0x0, sizeof(qual_offset));
   6617             part_width=0;
   6618             /* Retrieve the Qualifier offsets for the particular entry part */  
   6619             rv = _bcm_field_th_qual_part_offset_get(unit, f_ent, part_ct,
   6620                                                qual, &qual_offset);
   6621             if (rv == BCM_E_NOT_FOUND) {
   6622                 continue;
   6623             } else if (BCM_FAILURE(rv)) {
   6624                 FP_UNLOCK(unit);
   6625                 return rv;
   6626             }
   6627            /* Combined width of a qualifier for a given part */
   6628            _BCM_FIELD_QUAL_MULTI_OFFSET_WIDTH(&qual_offset, part_width);
   6629 	   width = width + part_width;
   6630 	}
   6631     }
   6632     if (width < (count * 8)) {
   6633         FP_UNLOCK(unit);
   6634         return BCM_E_PARAM;
   6635     }
   6636 
   6637 
   6638     sal_memset(&ref_data, 0, sizeof(ref_data));
   6639     sal_memset(&ref_mask, 0, sizeof(ref_mask));
   6640 
   6641     if(f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   6642         /* Read qualifier match value and mask. */
   6643         rv = _bcm_field_qual_value_get(unit, q_offset, f_ent, ref_data,
   6644                                        ref_mask);
   6645     } else {
   6646         rv = _bcm_field_th_entry_qualifier_key_get(unit, entry, qual,
   6647                                                   ref_data, ref_mask);
   6648     }
   6649     
   6650     r_idx = width / 32;
   6651     r_offset = width % 32; 
   6652 
   6653     if (!r_offset) { 
   6654         r_idx -= 1;
   6655         shift = 24;
   6656     }
   6657     else { 
   6658         shift = 24 - r_offset;
   6659     }
   6660 
   6661     for (byte = 0; byte < count; byte++) {
   6662         data[byte] = (uint8)(ref_data[r_idx] >> shift);
   6663         mask[byte] = (uint8)(ref_mask[r_idx] >> shift);
   6664         if (shift < 8) {
   6665             shift = 24;
   6666             r_idx--;
   6667         }
   6668         else {
   6669             shift -= 8;
   6670         }
   6671     }
   6672 
   6673     FP_UNLOCK(unit);
   6674 #endif
   6675     return (rv);
   6676 }
   6677 
   6678 /* bcm_field_qualify_L3DestRouteHit */
   6679 int 
   6680 bcm_esw_field_qualify_L3DestRouteHit(int unit, bcm_field_entry_t entry, 
   6681                                      uint8 data, uint8 mask)
   6682 {
   6683     int              rv;
   6684 
   6685     
   6686     FP_LOCK(unit);
   6687 
   6688     rv = _field_qualify32(unit, entry, bcmFieldQualifyL3DestRouteHit,
   6689                             data, mask);
   6690     FP_UNLOCK(unit);
   6691     return (rv);
   6692 }
   6693 
   6694 /* bcm_field_qualify_L3DestHostHit */
   6695 int 
   6696 bcm_esw_field_qualify_L3DestHostHit(int unit, bcm_field_entry_t entry, 
   6697                                     uint8 data, uint8 mask)
   6698 {
   6699     int              rv;
   6700 
   6701     
   6702     FP_LOCK(unit);
   6703 
   6704     rv = _field_qualify32(unit, entry, bcmFieldQualifyL3DestHostHit,
   6705                             data, mask);
   6706     FP_UNLOCK(unit);
   6707     return (rv);
   6708 }
   6709 
   6710 /* bcm_field_qualify_L3SrcHostHit */
   6711 int 
   6712 bcm_esw_field_qualify_L3SrcHostHit(int unit, bcm_field_entry_t entry, 
   6713                                    uint8 data, uint8 mask)
   6714 {
   6715     int              rv;
   6716 
   6717     
   6718     FP_LOCK(unit);
   6719 
   6720     rv = _field_qualify32(unit, entry, bcmFieldQualifyL3SrcHostHit,
   6721                             data, mask);
   6722     FP_UNLOCK(unit);
   6723     return (rv);
   6724 }
   6725 
   6726 /* bcm_field_qualify_L2CacheHit */
   6727 int 
   6728 bcm_esw_field_qualify_L2CacheHit(int unit, bcm_field_entry_t entry, 
   6729                                   uint8 data, uint8 mask)
   6730 {
   6731     int              rv;
   6732 
   6733     
   6734     FP_LOCK(unit);
   6735 
   6736     rv = _field_qualify32(unit, entry, bcmFieldQualifyL2CacheHit,
   6737                             data, mask);
   6738     FP_UNLOCK(unit);
   6739     return (rv);
   6740 }
   6741 
   6742 /* bcm_field_qualify_L2StationMove */
   6743 int 
   6744 bcm_esw_field_qualify_L2StationMove(int unit, bcm_field_entry_t entry, 
   6745                                     uint8 data, uint8 mask)
   6746 {
   6747     int              rv;
   6748 
   6749     
   6750     FP_LOCK(unit);
   6751 
   6752     rv = _field_qualify32(unit, entry, bcmFieldQualifyL2StationMove,
   6753                             data, mask);
   6754     FP_UNLOCK(unit);
   6755     return (rv);
   6756 }
   6757 
   6758 /* bcm_field_qualify_L2DestHit */
   6759 int 
   6760 bcm_esw_field_qualify_L2DestHit(int unit, bcm_field_entry_t entry, 
   6761                                 uint8 data, uint8 mask)
   6762 {
   6763     int              rv;
   6764 
   6765     
   6766     FP_LOCK(unit);
   6767 
   6768     rv = _field_qualify32(unit, entry, bcmFieldQualifyL2DestHit,
   6769                           data, mask);
   6770     FP_UNLOCK(unit);
   6771     return (rv);
   6772 }
   6773 
   6774 /* bcm_field_qualify_L2SrcStatic */
   6775 int 
   6776 bcm_esw_field_qualify_L2SrcStatic(int unit, bcm_field_entry_t entry, 
   6777                                   uint8 data, uint8 mask) 
   6778 {
   6779     int              rv;
   6780 
   6781     
   6782     FP_LOCK(unit);
   6783 
   6784     rv = _field_qualify32(unit, entry, bcmFieldQualifyL2SrcStatic,
   6785                             data, mask);
   6786     FP_UNLOCK(unit);
   6787     return (rv);
   6788 }
   6789 
   6790 /* bcm_field_qualify_L2SrcHit */
   6791 int 
   6792 bcm_esw_field_qualify_L2SrcHit(int unit, bcm_field_entry_t entry, 
   6793                                uint8 data, uint8 mask) 
   6794 {
   6795     int              rv;
   6796 
   6797     
   6798     FP_LOCK(unit);
   6799 
   6800     rv = _field_qualify32(unit, entry, bcmFieldQualifyL2SrcHit,
   6801                             data, mask);
   6802     FP_UNLOCK(unit);
   6803     return (rv);
   6804 }
   6805 
   6806 /* bcm_field_qualify_IngressStpState */
   6807 int 
   6808 bcm_esw_field_qualify_IngressStpState(int unit,bcm_field_entry_t entry, 
   6809                                       uint8 data, uint8 mask) 
   6810 {
   6811     int              value;
   6812     int              rv;
   6813 
   6814     switch (data) {
   6815       case BCM_STG_STP_DISABLE:
   6816           value = 0; 
   6817           break;
   6818       case BCM_STG_STP_BLOCK:
   6819           value = 1; 
   6820           break;
   6821       case BCM_STG_STP_LEARN:
   6822           value = 2; 
   6823           break;
   6824       case BCM_STG_STP_FORWARD:
   6825           value = 3; 
   6826           break;
   6827       default:
   6828           return (BCM_E_PARAM);
   6829     }
   6830 
   6831     
   6832     FP_LOCK(unit);
   6833 
   6834     rv = _field_qualify32(unit, entry, bcmFieldQualifyIngressStpState,
   6835                             value, 0x3);
   6836     FP_UNLOCK(unit);
   6837     return (rv);
   6838 } 
   6839 
   6840 /* bcm_field_qualify_ForwardingVlanValid */
   6841 int 
   6842 bcm_esw_field_qualify_ForwardingVlanValid(int unit, bcm_field_entry_t entry, 
   6843                                           uint8 data, uint8 mask) 
   6844 {
   6845     int              rv;
   6846 
   6847     
   6848     FP_LOCK(unit);
   6849 
   6850     rv = _field_qualify32(unit, entry, bcmFieldQualifyForwardingVlanValid,
   6851                             data, mask);
   6852     FP_UNLOCK(unit);
   6853     return (rv);
   6854 }
   6855 
   6856 /*
   6857  * Function:
   6858  *      bcm_esw_field_qualify_SrcVirtualPortValid
   6859  *      Set match criteria for bcmFieldQualifySrcVirtualPortValid
   6860  *      qualifier in the field entry.
   6861  * Parameters:
   6862  *      unit    -   (IN) Unit number.
   6863  *      entry   -   (IN) BCM field entry id.
   6864  *      data    -   (IN) Qualifier match data.
   6865  *      mask    -   (IN) Qualifier match data.
   6866  * Returns:
   6867  *      BCM_E_XXX
   6868  * Notes:
   6869  */
   6870 int 
   6871 bcm_esw_field_qualify_SrcVirtualPortValid(int unit, bcm_field_entry_t entry,
   6872                                           uint8 data, uint8 mask) 
   6873 {
   6874     int              rv;
   6875 
   6876     
   6877     FP_LOCK(unit);
   6878 
   6879     rv = _field_qualify32(unit, entry, bcmFieldQualifySrcVirtualPortValid,
   6880                           data, mask);
   6881     FP_UNLOCK(unit);
   6882     return (rv);
   6883 }
   6884 
   6885 /*
   6886  * Function:
   6887  *      bcm_esw_field_qualify_DstL3EgressNextHops
   6888  *      Set match criteria for bcmFieldQualifyDstL3EgressNextHops
   6889  *      qualifier in the field entry.
   6890  * Parameters:
   6891  *      unit    -   (IN) Unit number.
   6892  *      entry   -   (IN) BCM field entry id.
   6893  *      data    -   (IN) Match consecutive Next Hop Index values
   6894  *      mask    -   (IN) Next Hop Index mask value
   6895  * Returns:
   6896  *      BCM_E_XXX
   6897  * Notes:
   6898  */
   6899 int
   6900 bcm_esw_field_qualify_DstL3EgressNextHops(int unit,
   6901     bcm_field_entry_t entry,
   6902     uint32 data,
   6903     uint32 mask)
   6904 {
   6905     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
   6906 #if defined(INCLUDE_L3)
   6907     _field_control_t *fc;
   6908     uint32 max_nexthop_index = 0;
   6909 
   6910     /* Check if L3 feature is supported on the device */
   6911     if (!soc_feature(unit, soc_feature_l3)) {
   6912         return (rv);
   6913     }
   6914 
   6915     /*  Make sure module was initialized. */
   6916     if (!BCM_XGS3_L3_INITIALIZED(unit)) {
   6917         return (rv);
   6918     }
   6919 
   6920     max_nexthop_index = (BCM_XGS3_L3_NH_TBL_SIZE(unit) - 1);
   6921 
   6922     /* Check if mask is greater than possible table index value */
   6923     if ((mask != BCM_FIELD_EXACT_MATCH_MASK) && (mask > max_nexthop_index)) {
   6924         return (BCM_E_PARAM);
   6925     }
   6926 
   6927     /* Check if data is greater than possible table index value */
   6928     if (data > max_nexthop_index) {
   6929         return (BCM_E_PARAM);
   6930     }
   6931 
   6932     
   6933     FP_LOCK(unit);
   6934     rv = _field_control_get(unit, &fc);
   6935     if (BCM_FAILURE(rv)) {
   6936         FP_UNLOCK(unit);
   6937         return rv;
   6938     }
   6939 
   6940     /*
   6941      * Invoke driver function for multi pipe devices.
   6942      */
   6943 #if defined(BCM_TOMAHAWK_SUPPORT)
   6944     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   6945         rv = _bcm_field_is_entry_stage_valid(unit, entry,
   6946                                              _BCM_FIELD_STAGE_INGRESS);
   6947 
   6948         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
   6949             /*Error fetching entry*/
   6950             FP_UNLOCK(unit);
   6951             return (rv);
   6952         }
   6953 
   6954         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
   6955             rv = fc->functions.fp_qualify_dvp(unit, entry,
   6956                                           bcmFieldQualifyDstL3EgressNextHops,
   6957                                           data, mask, 0);
   6958             FP_UNLOCK(unit);
   6959             return (rv);
   6960         }
   6961     }
   6962 #endif /* BCM_TOMAHAWK_SUPPORT */
   6963 
   6964     /* set destination type in data and mask */
   6965     rv = _field_dest_type_qualify(unit, entry,
   6966                                   bcmFieldQualifyDstL3EgressNextHops, 
   6967                                   &data, &mask, _bcmFieldDestTypeNone);
   6968         if (BCM_FAILURE(rv)) {
   6969             FP_UNLOCK(unit);
   6970             return (rv);
   6971         }
   6972 
   6973     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstL3EgressNextHops,
   6974                           data, mask);
   6975     FP_UNLOCK(unit);
   6976 #endif
   6977     return (rv);
   6978 
   6979 }
   6980 
   6981 /*
   6982  * Function:
   6983  *      bcm_esw_field_qualify_VlanTranslationHit/
   6984  * Purpose:
   6985  *      Set match criteria for bcmFieildQualifyVlanTranslationHit
   6986  *                     qualifier from the field entry.
   6987  * Parameters:
   6988  *      unit - (IN) Unit number.
   6989  *      entry - (IN) BCM field entry id.
   6990  *      data - (OUT) Qualifier match data.
   6991  *      mask - (OUT) Qualifier match mask.
   6992  * Returns:
   6993  *      BCM_E_XXX
   6994  * Notes:
   6995  */
   6996 int 
   6997 bcm_esw_field_qualify_VlanTranslationHit(int unit, bcm_field_entry_t entry, 
   6998                                          uint8 data, uint8 mask) 
   6999 {
   7000     int              rv;
   7001     int (*func)(int, bcm_field_entry_t, uint8 *, uint8 *) =
   7002                                      _field_qualify_VlanTranslationHit;
   7003 
   7004 #ifdef BCM_TRIDENT2_SUPPORT
   7005     _field_entry_t *f_ent = NULL;
   7006 #endif
   7007 
   7008     FP_LOCK(unit);
   7009 
   7010 #if defined(BCM_TOMAHAWK_SUPPORT)
   7011     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   7012             func = _bcm_field_th_qualify_VlanTranslationHit;
   7013     } else
   7014 #endif
   7015 #ifdef BCM_TRIDENT2_SUPPORT
   7016     if (SOC_IS_TD2_TT2(unit)) {
   7017         rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
   7018         if (BCM_FAILURE(rv)) {
   7019             FP_UNLOCK(unit);
   7020             return rv;
   7021         }
   7022 
   7023         if (SOC_IS_TD2_TT2(unit)
   7024                 && (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id)) {
   7025             func = _bcm_field_td2_qualify_VlanTranslationHit;
   7026         }
   7027     }
   7028 #endif
   7029 
   7030     rv = (*func)(unit, entry, &data, &mask);
   7031     if (BCM_FAILURE(rv)) {
   7032         FP_UNLOCK(unit);
   7033         return (rv);
   7034     }
   7035     
   7036     rv = _field_qualify32(unit, entry, bcmFieldQualifyVlanTranslationHit,
   7037                           data, mask);
   7038     FP_UNLOCK(unit);
   7039     return (rv);
   7040 }
   7041 
   7042 int
   7043 bcm_esw_field_qualify_IpInfo(int unit, bcm_field_entry_t entry,
   7044                              uint32 data, uint32 mask)   
   7045 {
   7046 #ifdef BCM_TRX_SUPPORT
   7047     _field_entry_t      *f_ent;
   7048 #endif /* BCM_TRX_SUPPORT */
   7049     int                 rv;
   7050     const uint32        data_max = BCM_FIELD_IP_HDR_OFFSET_ZERO |
   7051                                    BCM_FIELD_IP_HDR_FLAGS_MF |
   7052                                    BCM_FIELD_IP_CHECKSUM_OK;
   7053 
   7054     /* Range check data and mask values. */
   7055     if (data > data_max || mask > data_max) {
   7056         LOG_ERROR(BSL_LS_BCM_FP,
   7057                   (BSL_META_U(unit,
   7058                               "FP(unit %d) Error: IpInfo data=%#x or mask=%#x out of range (0-%d)."),
   7059                    unit, data, mask, data_max));
   7060         return (BCM_E_PARAM);
   7061     }
   7062 
   7063 #ifdef BCM_TRX_SUPPORT
   7064     /* For VFP on TRX devices and for ingress and Exact match stage
   7065      * on TD2 and TH family devices, the checksum is 1-bit field and
   7066        for all other devices, IpInfo field is 3 bit
   7067      */
   7068     BCM_IF_ERROR_RETURN(_field_entry_get(unit,
   7069                                          entry,
   7070                                          _FP_ENTRY_PRIMARY,
   7071                                          &f_ent));
   7072     if ( ((SOC_IS_TRX(unit) &&
   7073           (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id)) ||
   7074          ((SOC_IS_TD2_TT2(unit) &&
   7075            ((_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) ||
   7076             (_BCM_FIELD_STAGE_EXACTMATCH == f_ent->group->stage_id)) ))) ){
   7077         /* On Trident2 IP_INFO field is devided into two parts
   7078          * IP_FRAG_INFO(2bits) and IP_CHECKSUM_OK(1bit). IP_FRAG_INFO
   7079          * can be qualified using bcmFieldQualifyIpFrag and IP_CHECKSUM_OK
   7080          * can be qualified using bcmFieldQualifyIpInfo.
   7081          */
   7082         if (data & ~BCM_FIELD_IP_CHECKSUM_OK ||
   7083             mask != BCM_FIELD_IP_CHECKSUM_OK) {
   7084                 return BCM_E_PARAM;
   7085         }
   7086         data = (data & BCM_FIELD_IP_CHECKSUM_OK) ? 1 : 0;
   7087         mask = 1;
   7088     } else
   7089 #endif /* BCM_TRX_SUPPORT */
   7090 
   7091 #if defined(BCM_FIREBOLT2_SUPPORT) || defined(BCM_RAPTOR_SUPPORT) || defined(BCM_TRX_SUPPORT)
   7092     if (SOC_IS_FIREBOLT2(unit) || SOC_IS_RAVEN(unit) || SOC_IS_TRX(unit) || SOC_IS_HAWKEYE(unit)) {
   7093         if (mask & BCM_FIELD_IP_HDR_FLAGS_MF) {
   7094             /* In FB2 More fragments bit replaced with whole packet bit. */
   7095             data = ((data & BCM_FIELD_IP_HDR_OFFSET_ZERO) | 
   7096                 (data & BCM_FIELD_IP_CHECKSUM_OK) | 
   7097                 (data ^ BCM_FIELD_IP_HDR_FLAGS_MF));
   7098         }
   7099     }
   7100 #endif /* BCM_FIREBOLT_SUPPORT || BCM_RAPTOR_SUPPORT || BCM_TRX_SUPPORT */
   7101 
   7102 
   7103     FP_LOCK(unit);
   7104 
   7105     rv = _field_qualify32(unit, entry, bcmFieldQualifyIpInfo,
   7106                             data, mask);
   7107     FP_UNLOCK(unit);
   7108     return (rv);
   7109 }
   7110 
   7111 int
   7112 bcm_esw_field_qualify_PacketRes(int unit, bcm_field_entry_t entry,
   7113                                 uint32 data, uint32 mask) 
   7114 {
   7115     const uint32     data_max = BCM_FIELD_PKT_RES_LAST;
   7116     int              rv;
   7117     _field_control_t *fc = NULL; 
   7118 
   7119     /* Range check data and mask values. */
   7120     if (data > data_max) {
   7121         LOG_ERROR(BSL_LS_BCM_FP,
   7122                   (BSL_META_U(unit,
   7123                   "FP(unit %d) Error: PacketRes data=%#x out of range (0-%d)."),
   7124                    unit, data, data_max));
   7125         return (BCM_E_PARAM);
   7126     }
   7127 
   7128     /* Check for valid data mask combinations */
   7129     if ((mask != data) && (!((mask & 0x3f) == 0x3f))) {
   7130          return (BCM_E_PARAM);
   7131     }
   7132 
   7133     FP_LOCK(unit);
   7134 
   7135     rv = _field_control_get(unit, &fc);
   7136     if (BCM_FAILURE(rv)) {
   7137         FP_UNLOCK(unit);
   7138         return rv;
   7139     }
   7140 
   7141     if (NULL == fc->functions.fp_qualify_packet_res) {
   7142         FP_UNLOCK(unit);
   7143         return BCM_E_CONFIG;
   7144     }
   7145 
   7146     rv = fc->functions.fp_qualify_packet_res(unit, entry, &data, &mask);
   7147     if (BCM_FAILURE(rv)) {
   7148         FP_UNLOCK(unit);
   7149         return rv;
   7150     }
   7151     
   7152     /* convert encoding 0x0 of mask to value 0x1 */
   7153     if(data == 0 && mask == 0) {
   7154        mask = 1;
   7155     }
   7156 
   7157     rv = _field_qualify32(unit, entry, bcmFieldQualifyPacketRes,
   7158                           data, mask);
   7159     FP_UNLOCK(unit);
   7160     return (rv);
   7161 }
   7162 
   7163 int
   7164 bcm_esw_field_qualify_SrcIp(int unit, bcm_field_entry_t entry,
   7165                             bcm_ip_t data, bcm_ip_t mask)
   7166 {
   7167     int              rv;
   7168 
   7169     
   7170     FP_LOCK(unit);
   7171 
   7172     rv = _field_qualify32(unit, entry, bcmFieldQualifySrcIp, data, mask);
   7173 
   7174     FP_UNLOCK(unit);
   7175     return (rv);
   7176 }
   7177 
   7178 int
   7179 bcm_esw_field_qualify_DstIp(int unit, bcm_field_entry_t entry,
   7180                             bcm_ip_t data, bcm_ip_t mask)
   7181 {
   7182     int              rv;
   7183 
   7184     
   7185     FP_LOCK(unit);
   7186 
   7187     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstIp, data, mask);
   7188 
   7189     FP_UNLOCK(unit);
   7190     return(rv);
   7191 }
   7192 
   7193 int
   7194 bcm_esw_field_qualify_DSCP(int unit, bcm_field_entry_t entry,
   7195                            uint8 data, uint8 mask)
   7196 {
   7197     int              rv;
   7198 
   7199     
   7200     FP_LOCK(unit);
   7201 
   7202     rv = _field_qualify32(unit, entry, bcmFieldQualifyDSCP, data, mask);
   7203 
   7204     FP_UNLOCK(unit);
   7205     return(rv);
   7206 }
   7207 
   7208 int
   7209 bcm_esw_field_qualify_Tos(int unit, bcm_field_entry_t entry,
   7210                            uint8 data, uint8 mask)
   7211 {
   7212     int              rv;
   7213 
   7214     
   7215     FP_LOCK(unit);
   7216 
   7217     rv = _field_qualify32(unit, entry, bcmFieldQualifyTos, data, mask);
   7218 
   7219     FP_UNLOCK(unit);
   7220     return(rv);
   7221 }
   7222 
   7223 int
   7224 bcm_esw_field_qualify_IpFlags(int unit, bcm_field_entry_t entry,
   7225                               uint8 data, uint8 mask)
   7226 {
   7227     int              rv;
   7228     const uint8      data_max = BCM_FIELD_IPFLAGS_MASK & ~BCM_FIELD_IPFLAGS_RF;
   7229 
   7230 
   7231     /* Reserved flag bit (RFC791) is unused. */
   7232     data &= ~BCM_FIELD_IPFLAGS_RF;
   7233     mask &= ~BCM_FIELD_IPFLAGS_RF;
   7234 
   7235     /* Range check data and mask values. */
   7236     if (data > data_max) {
   7237         LOG_ERROR(BSL_LS_BCM_FP,
   7238                   (BSL_META_U(unit,
   7239                               "FP(unit %d) Error: IpFlags data=%#x out of range (0-%d)."),
   7240                    unit, data, data_max));
   7241         return (BCM_E_PARAM);
   7242     }
   7243 
   7244 
   7245     
   7246     FP_LOCK(unit);
   7247     rv = _field_qualify32(unit, entry, bcmFieldQualifyIpFlags,
   7248                           data, mask);
   7249     FP_UNLOCK(unit);
   7250     return(rv);
   7251 }
   7252 
   7253 int
   7254 bcm_esw_field_qualify_TcpControl(int unit, bcm_field_entry_t entry,
   7255                                  uint8 data, uint8 mask)
   7256 {
   7257     int              rv;
   7258     uint8      data_max = BCM_FIELD_TCPCONTROL_MASK;
   7259 #if defined(BCM_TOMAHAWK_SUPPORT)
   7260     _field_entry_t *f_ent = NULL;
   7261 #endif
   7262 
   7263     
   7264     FP_LOCK(unit);
   7265 
   7266 #if defined(BCM_TOMAHAWK_SUPPORT)
   7267     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
   7268 
   7269     if (BCM_FAILURE(rv)) {
   7270         FP_UNLOCK(unit);
   7271         return (rv);
   7272     }
   7273 
   7274     /* In Tomahawk 8bit TCP flag is not supported for VFP stage */
   7275     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   7276             (f_ent->group->stage_id != _BCM_FIELD_STAGE_LOOKUP)) {
   7277         data_max |= (BCM_FIELD_TCPCONTROL_R40 | BCM_FIELD_TCPCONTROL_R80);
   7278     }
   7279 #endif
   7280 
   7281     /* Range check data and mask values. */
   7282     if (data > data_max) {
   7283         LOG_ERROR(BSL_LS_BCM_FP,
   7284                   (BSL_META_U(unit,
   7285                               "FP(unit %d) Error: TcpControl data=%#x or mask=%#x out of range (0-%d)."),
   7286                    unit, data, mask, data_max));
   7287         FP_UNLOCK(unit);
   7288         return (BCM_E_PARAM);
   7289     }
   7290 
   7291     rv = _field_qualify32(unit, entry, bcmFieldQualifyTcpControl,
   7292                           data, mask);
   7293     FP_UNLOCK(unit);
   7294     return (rv);
   7295 }
   7296 
   7297 int
   7298 bcm_esw_field_qualify_Ttl(int unit, bcm_field_entry_t entry,
   7299                           uint8 data, uint8 mask)
   7300 {
   7301     int              rv;
   7302 
   7303     
   7304     FP_LOCK(unit);
   7305 
   7306 #if defined(BCM_FIREBOLT2_SUPPORT)
   7307     if (SOC_IS_FIREBOLT2(unit)) {
   7308         rv =  _bcm_field_fb2_qualify_ttl(unit, entry, data, mask);     
   7309     } else 
   7310 #endif /* BCM_FIREBOLT2_SUPPORT */
   7311         
   7312 #if defined(BCM_RAPTOR_SUPPORT)
   7313     if (SOC_IS_RAVEN(unit) || SOC_IS_HAWKEYE(unit)) {
   7314         rv =  _bcm_field_raven_qualify_ttl(unit, entry, data, mask);     
   7315     } else 
   7316 #endif /* BCM_RAPTOR_SUPPORT */
   7317     {
   7318         rv = _field_qualify32(unit, entry, bcmFieldQualifyTtl, data, mask);
   7319     }
   7320     FP_UNLOCK(unit);
   7321     return (rv);
   7322 }
   7323 
   7324 /*
   7325  * Function: bcm_esw_field_qualify_RangeCheck
   7326  *
   7327  * Purpose:
   7328  *     Add a field qualification to a filter entry.
   7329  *
   7330  * Parameters:
   7331  *     unit   - BCM device number
   7332  *     entry  - Field entry to operate on
   7333  *     range  - Range ID to add entry
   7334  *     invert -
   7335  *
   7336  * Returns:
   7337  *     BCM_E_XXX 
   7338  */
   7339 int
   7340 bcm_esw_field_qualify_RangeCheck(int unit, bcm_field_entry_t entry,
   7341                                  bcm_field_range_t range, int invert)
   7342 {
   7343     _bcm_field_qual_offset_t *q_offset;
   7344     _field_range_t         *fr;
   7345     _field_entry_t         *f_ent;
   7346     _field_stage_t         *stage_fc;
   7347     _bcm_field_qual_data_t  data;
   7348     _bcm_field_qual_data_t  mask;
   7349 #if defined(BCM_TRX_SUPPORT)
   7350     _bcm_field_qual_offset_t *q_offset1;
   7351     _field_entry_t         *f_ent1;
   7352     _bcm_field_qual_data_t   data1;
   7353     _bcm_field_qual_data_t   mask1;
   7354 #endif
   7355     int                     rv;
   7356     int                     hw_index = -1;
   7357 
   7358     
   7359     FP_LOCK(unit);
   7360 
   7361     /* Get field entry part that contains qualifier. */
   7362     rv = _bcm_field_entry_qual_get(unit, entry, bcmFieldQualifyRangeCheck, &f_ent);
   7363     if (BCM_FAILURE(rv)) {
   7364         FP_UNLOCK(unit);
   7365         return rv;
   7366     }
   7367 
   7368     if (NULL == f_ent->group) {
   7369         FP_UNLOCK(unit);
   7370         return (BCM_E_INTERNAL);
   7371     }
   7372 
   7373     /* Get stage field control structure. */
   7374     rv = _field_stage_control_get(unit, f_ent->group->stage_id, &stage_fc);
   7375     if (BCM_FAILURE(rv)) {
   7376         FP_UNLOCK(unit);
   7377         return (rv);
   7378     }
   7379 
   7380 #ifdef BCM_TOMAHAWK_SUPPORT
   7381     if (soc_feature(unit, soc_feature_field_multi_pipe_support)
   7382            && RANGE_CTRL(unit) &&
   7383        (RANGE_CTRL(unit)->range_used_by_module == RANGE_USED_BY_RANGE_MODULE)) {
   7384         rv = bcmi_xgs5_range_validate_field_stage_oper_mode (unit, stage_fc->oper_mode);
   7385         if (BCM_FAILURE(rv)) {
   7386             FP_UNLOCK(unit);
   7387             return (rv);
   7388         }
   7389 
   7390         rv = bcmi_xgs5_range_validate_field_group_instance (unit, range, f_ent->group->instance); 
   7391         if (BCM_FAILURE(rv)) {
   7392             FP_UNLOCK(unit);
   7393             return (rv);
   7394         }
   7395 
   7396         rv = bcmi_xgs5_range_get_hw_index(unit, range, &hw_index);
   7397         if (BCM_FAILURE(rv)) {
   7398             FP_UNLOCK(unit);
   7399             return (rv);
   7400         }
   7401     } else {
   7402 #endif
   7403     /* Find range hw entry index. */
   7404     for (fr = stage_fc->ranges; fr != NULL; fr = fr->next) {
   7405         if (fr->rid == range) {
   7406             hw_index = fr->hw_index;
   7407             break;
   7408         }
   7409     }
   7410     if (hw_index < 0) {
   7411         FP_UNLOCK(unit);
   7412         return (BCM_E_NOT_FOUND);
   7413     }
   7414 #if defined BCM_TOMAHAWK_SUPPORT
   7415     }
   7416 #endif
   7417 
   7418 #if defined(BCM_TRX_SUPPORT) 
   7419     /* Range checkers is partially overlaid over 
   7420        interface class selector on trx devices. */
   7421     if (SOC_IS_TRX(unit) &&
   7422         (!soc_feature(unit, soc_feature_field_multi_pipe_support)) &&
   7423             (hw_index > _FP_TRX_RANGE_CHECKER_LOWER_MAX)) {
   7424         if (!BCM_FIELD_QSET_TEST(f_ent->group->qset, _bcmFieldQualifyRangeCheckBits24_31)) {
   7425             FP_UNLOCK(unit);
   7426             return (BCM_E_RESOURCE);
   7427         } else {
   7428             rv = _bcm_trx_range_checker_selcodes_update(unit, entry);
   7429             if (BCM_FAILURE(rv)) {
   7430                 FP_UNLOCK(unit);
   7431                 return (rv);
   7432             }
   7433         }
   7434     }
   7435 #endif /* BCM_TRX_SUPPORT */
   7436 
   7437 #if defined(BCM_TOMAHAWK_SUPPORT)
   7438     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   7439        /* Read qualifier match value and mask. */
   7440        rv = _field_entry_qualifier_key_get(unit, entry,
   7441                                            bcmFieldQualifyRangeCheck,
   7442                                            data, mask);
   7443     } else
   7444 #endif /* BCM_TOMAHAWK_SUPPORT */
   7445     {
   7446        /* Get qualifier offsets in the tcam. */
   7447        rv = _field_qual_offset_get(unit, f_ent, bcmFieldQualifyRangeCheck,
   7448                                 &q_offset);
   7449        if (BCM_FAILURE(rv)) {
   7450            FP_UNLOCK(unit);
   7451            return (rv);
   7452        }
   7453 
   7454        /* Read qualifier match value and mask. */
   7455        rv = _bcm_field_qual_value_get(unit, q_offset, f_ent, 
   7456                                    data, mask);
   7457 
   7458 #if defined(BCM_TRX_SUPPORT)
   7459         if (BCM_SUCCESS(rv) && SOC_IS_TRX(unit) &&
   7460                 BCM_FIELD_QSET_TEST(f_ent->group->qset,
   7461                     _bcmFieldQualifyRangeCheckBits24_31)) {
   7462             /* Get field entry part that contains qualifier. */
   7463             rv = _bcm_field_entry_qual_get(unit, entry,
   7464                     _bcmFieldQualifyRangeCheckBits24_31, &f_ent1);
   7465             if (BCM_FAILURE(rv)) {
   7466                 FP_UNLOCK(unit);
   7467                 return rv;
   7468             }
   7469 
   7470             /* Get qualifier offsets in the tcam. */
   7471             rv = _field_qual_offset_get(unit, f_ent1, _bcmFieldQualifyRangeCheckBits24_31,
   7472                     &q_offset1);
   7473             if (BCM_FAILURE(rv)) {
   7474                 FP_UNLOCK(unit);
   7475                 return (rv);
   7476             }
   7477 
   7478             /* Read qualifier match value and mask. */
   7479             rv = _bcm_field_qual_value_get(unit, q_offset1, f_ent1,
   7480                     data1, mask1);
   7481             if (BCM_FAILURE(rv)) {
   7482                 FP_UNLOCK(unit);
   7483                 return (rv);
   7484             }
   7485             data[0] |= ((data1[0] & 0xff) << 24);
   7486             mask[0] |= ((mask1[0] & 0xff) << 24);
   7487         }
   7488 #endif
   7489     }
   7490 
   7491     if (BCM_FAILURE(rv)) {
   7492         FP_UNLOCK(unit);
   7493         return (rv);
   7494     }
   7495 
   7496     if (invert < 0) {
   7497         mask[0] &= ~(1 << hw_index);
   7498     } else {
   7499         mask[0] |= (1 << hw_index);
   7500 
   7501         if (invert) {
   7502             data[0] &= ~(1 << hw_index);
   7503         } else {
   7504             data[0] |= (1 << hw_index);
   7505         }
   7506     }
   7507 #if defined(BCM_TRX_SUPPORT)
   7508     data1[0] = data[0];
   7509     mask1[0] = mask[0];
   7510 #endif
   7511 #if defined(BCM_TOMAHAWK_SUPPORT)
   7512     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   7513        /* coverity[callee_ptr_arith : FALSE] */
   7514        rv = _bcm_field_th_qualify_set(unit, entry, bcmFieldQualifyRangeCheck,
   7515                                       data, mask, _FP_QUALIFIER_ADD);
   7516        FP_UNLOCK(unit);
   7517        return (rv);
   7518     }
   7519 #endif /* BCM_TOMAHAWK_SUPPORT */
   7520 
   7521     rv = _bcm_field_qual_value_set(unit, q_offset, f_ent, data, mask);
   7522 #if defined(BCM_TRX_SUPPORT)
   7523     if (BCM_SUCCESS(rv) && SOC_IS_TRX(unit) &&
   7524             BCM_FIELD_QSET_TEST(f_ent->group->qset,
   7525                 _bcmFieldQualifyRangeCheckBits24_31)) {
   7526         /* upper 8 bits to data */
   7527         data1[0] = (data1[0] >> 24) & 0xff;
   7528         mask1[0] = (mask1[0] >> 24) & 0xff;
   7529 
   7530         rv = _bcm_field_qual_value_set(unit, q_offset1, f_ent1, data1, mask1);
   7531     }
   7532 #endif
   7533 
   7534     FP_UNLOCK(unit);
   7535     return (rv);
   7536 }
   7537 
   7538 int
   7539 bcm_esw_field_qualify_SrcIp6(int unit, bcm_field_entry_t entry,
   7540                              bcm_ip6_t data, bcm_ip6_t mask)
   7541 {
   7542     int                 rv;
   7543 
   7544     FP_LOCK(unit);
   7545 
   7546     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifySrcIp6, 
   7547                             data, mask);
   7548     FP_UNLOCK(unit);
   7549     return (rv);
   7550 }
   7551 
   7552 int
   7553 bcm_esw_field_qualify_DstIp6(int unit, bcm_field_entry_t entry,
   7554                              bcm_ip6_t data, bcm_ip6_t mask)
   7555 {
   7556     int                 rv;
   7557 
   7558     FP_LOCK(unit);
   7559 
   7560     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifyDstIp6, 
   7561                             data, mask);
   7562 
   7563     FP_UNLOCK(unit);
   7564     return (rv);
   7565 }
   7566 
   7567 int
   7568 bcm_esw_field_qualify_SrcIp6High(int unit, bcm_field_entry_t entry,
   7569                                  bcm_ip6_t data, bcm_ip6_t mask)
   7570 {
   7571     int                 rv;
   7572     
   7573     FP_LOCK(unit);
   7574 
   7575     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifySrcIp6High,
   7576                             data, mask);
   7577 
   7578     FP_UNLOCK(unit);
   7579     return (rv);
   7580 }
   7581 
   7582 int
   7583 bcm_esw_field_qualify_DstIp6High(int unit, bcm_field_entry_t entry,
   7584                                  bcm_ip6_t data, bcm_ip6_t mask)
   7585 {
   7586     int                 rv;
   7587 
   7588     
   7589     FP_LOCK(unit);
   7590 
   7591     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifyDstIp6High,
   7592                             data, mask);
   7593 
   7594     FP_UNLOCK(unit);
   7595     return (rv);
   7596 }
   7597 
   7598 int
   7599 bcm_esw_field_qualify_SrcIp6Low(int unit, bcm_field_entry_t entry,
   7600                                  bcm_ip6_t data, bcm_ip6_t mask)
   7601 {
   7602     int                 rv;
   7603 
   7604     
   7605     FP_LOCK(unit);
   7606 
   7607     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifySrcIp6Low,
   7608                             data, mask);
   7609 
   7610     FP_UNLOCK(unit);
   7611     return (rv);
   7612 }
   7613 
   7614 int
   7615 bcm_esw_field_qualify_DstIp6Low(int unit, bcm_field_entry_t entry,
   7616                                  bcm_ip6_t data, bcm_ip6_t mask)
   7617 {
   7618     int                 rv;
   7619 
   7620     
   7621     FP_LOCK(unit);
   7622 
   7623     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifyDstIp6Low,
   7624                             data, mask);
   7625 
   7626     FP_UNLOCK(unit);
   7627     return (rv);
   7628 }
   7629 
   7630 int
   7631 bcm_esw_field_qualify_Ip6NextHeader(int unit, bcm_field_entry_t entry,
   7632                                     uint8 data, uint8 mask)
   7633 {
   7634     int                 rv;
   7635 
   7636     
   7637     FP_LOCK(unit);
   7638 
   7639     rv = _field_qualify32(unit, entry, bcmFieldQualifyIp6NextHeader,
   7640                             data, mask);
   7641     FP_UNLOCK(unit);
   7642     return (rv);
   7643 }
   7644 
   7645 int
   7646 bcm_esw_field_qualify_InnerIp6NextHeader(int unit, bcm_field_entry_t entry,
   7647                                          uint8 data, uint8 mask)
   7648 {
   7649     int                 rv;
   7650 
   7651     
   7652     FP_LOCK(unit);
   7653 
   7654     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerIp6NextHeader,
   7655                           data, mask);
   7656     FP_UNLOCK(unit);
   7657     return (rv);
   7658 }
   7659 
   7660 
   7661 int
   7662 bcm_esw_field_qualify_InnerIp6FlowLabel(int unit, bcm_field_entry_t entry,
   7663                                    uint32 data, uint32 mask)
   7664 {
   7665     const uint32        data_max = (1 << 20) - 1;
   7666     int                 rv;
   7667 
   7668     /* Range check data and mask values. */
   7669     if (data > data_max) {
   7670         return (BCM_E_PARAM);
   7671     }
   7672  
   7673     
   7674     FP_LOCK(unit);
   7675 
   7676     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerIp6FlowLabel,
   7677                             data, mask);
   7678     FP_UNLOCK(unit);
   7679     return (rv);
   7680 }
   7681 
   7682 int
   7683 bcm_esw_field_qualify_Ip6TrafficClass(int unit, bcm_field_entry_t entry,
   7684                                       uint8 data, uint8 mask)
   7685 {
   7686     int                 rv;
   7687 
   7688     
   7689     FP_LOCK(unit);
   7690 
   7691     rv = _field_qualify32(unit, entry, bcmFieldQualifyIp6TrafficClass,
   7692                             data, mask);
   7693 
   7694     FP_UNLOCK(unit);
   7695     return (rv);
   7696 }
   7697 
   7698 int
   7699 bcm_esw_field_qualify_Ip6FlowLabel(int unit, bcm_field_entry_t entry,
   7700                                    uint32 data, uint32 mask)
   7701 {
   7702     const uint32        data_max = (1 << 20) - 1;
   7703     int                 rv;
   7704 
   7705     /* Range check data and mask values. */
   7706     if (data > data_max) {
   7707         return (BCM_E_PARAM);
   7708     }
   7709  
   7710     
   7711     FP_LOCK(unit);
   7712 
   7713     rv = _field_qualify32(unit, entry, bcmFieldQualifyIp6FlowLabel,
   7714                             data, mask);
   7715     FP_UNLOCK(unit);
   7716     return (rv);
   7717 }
   7718 
   7719 int
   7720 bcm_esw_field_qualify_Ip6HopLimit(int unit, bcm_field_entry_t entry,
   7721                                   uint8 data, uint8 mask)
   7722 {
   7723     int                 rv;
   7724 
   7725     
   7726     FP_LOCK(unit);
   7727 
   7728     rv = _field_qualify32(unit, entry, bcmFieldQualifyIp6HopLimit,
   7729                             data, mask);
   7730     FP_UNLOCK(unit);
   7731     return (rv);
   7732 
   7733 }
   7734 
   7735 int
   7736 bcm_esw_field_qualify_InnerIp6HopLimit(int unit, bcm_field_entry_t entry,
   7737                                   uint8 data, uint8 mask)
   7738 {
   7739     int                 rv;
   7740 
   7741     
   7742     FP_LOCK(unit);
   7743 
   7744     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerIp6HopLimit,
   7745                           data, mask);
   7746     FP_UNLOCK(unit);
   7747     return (rv);
   7748 }
   7749 
   7750 int
   7751 bcm_esw_field_qualify_SrcMac(int unit, bcm_field_entry_t entry,
   7752                              bcm_mac_t data, bcm_mac_t mask)
   7753 {
   7754     int                      rv;
   7755 
   7756     
   7757     FP_LOCK(unit);
   7758 
   7759     rv = _field_qualify_macaddr(unit, entry, bcmFieldQualifySrcMac,
   7760                                 data, mask);
   7761     FP_UNLOCK(unit);
   7762     return (rv);
   7763 }
   7764 
   7765 int
   7766 bcm_esw_field_qualify_DstMac(int unit, bcm_field_entry_t entry,
   7767                              bcm_mac_t data, bcm_mac_t mask)
   7768 {
   7769     int                      rv;
   7770 
   7771     
   7772     FP_LOCK(unit);
   7773 
   7774     rv = _field_qualify_macaddr(unit, entry, bcmFieldQualifyDstMac,
   7775                                 data, mask);
   7776     FP_UNLOCK(unit);
   7777     return (rv);
   7778 
   7779 }
   7780 
   7781 /*
   7782  * Function:
   7783  *      bcm_esw_field_qualify_Loopback
   7784  * Purpose:
   7785  *      Add loopback field qualification to a field entry.
   7786  * Parameters:
   7787  *      unit - (IN) Unit number.
   7788  *      entry - (IN) Field entry id.
   7789  *      data - (IN) Data to qualify with.
   7790  *      mask - (IN) Mask to qualify with.
   7791  * Returns:
   7792  *      BCM_E_XXX
   7793  * Notes:
   7794  */
   7795 int 
   7796 bcm_esw_field_qualify_Loopback(int unit, 
   7797                            bcm_field_entry_t entry, 
   7798                            uint8 data, 
   7799                            uint8 mask)
   7800 {
   7801     int              rv;
   7802 
   7803     
   7804     FP_LOCK(unit);
   7805 
   7806     rv = _field_qualify32(unit, entry, bcmFieldQualifyLoopback, 
   7807                           (data ?  0x1 : 0), (mask ? 0x1 : 0));
   7808 
   7809     FP_UNLOCK(unit);
   7810     return (rv);
   7811 }
   7812 
   7813 
   7814 /*
   7815  * Function:
   7816  *      bcm_esw_field_qualify_LoopbackType
   7817  * Purpose:
   7818  *      Add loopback type field qualification to a field entry.
   7819  * Parameters:
   7820  *      unit - (IN) Unit number.
   7821  *      entry - (IN) Field entry id.
   7822  *      loopback_type - (IN) Loopback type.
   7823  * Returns:
   7824  *      BCM_E_XXX
   7825  * Notes:
   7826  */
   7827 int 
   7828 bcm_esw_field_qualify_LoopbackType(int unit, 
   7829                                bcm_field_entry_t entry, 
   7830                                bcm_field_LoopbackType_t loopback_type)
   7831 {
   7832     int               rv;   /* Operation return status. */
   7833     uint32            data; /* HW data match criteria.  */
   7834     uint32            mask; /* HW data mask.            */
   7835 
   7836 #ifdef BCM_TRIDENT2_SUPPORT
   7837     if (SOC_IS_TD2_TT2(unit)) {
   7838 #if defined(BCM_TOMAHAWK_SUPPORT)
   7839         _field_entry_t *f_ent = NULL;  /* Field entry structure.   */
   7840         
   7841 
   7842 #if defined(BCM_TRIDENT3_SUPPORT)
   7843         if (soc_feature(unit, soc_feature_td3_style_fp)) {
   7844             BCM_IF_ERROR_RETURN(_bcm_field_td3_qualify_LoopbackType(loopback_type,
   7845                                                                     &data,
   7846                                                                     &mask));
   7847         }
   7848 #endif /* BCM_TRIDENT3_SUPPORT */
   7849 
   7850 #if defined(BCM_TOMAHAWK3_SUPPORT)
   7851         if (soc_feature(unit, soc_feature_fp_no_dvp_support)) {
   7852             BCM_IF_ERROR_RETURN (_bcm_field_th3_qualify_LoopbackType(loopback_type,
   7853                                                                     &data,
   7854                                                                     &mask));
   7855         }
   7856 #endif /* BCM_TOMAHAWK3_SUPPORT */ 
   7857  
   7858         /* LoopbackType encodings are different for Tomahawk EFP. For 
   7859            Tomahawk IFP and Preselection TD2 encodings are to be used. 
   7860            Fetch the field entry only if the entry is not a presel entry
   7861            and check for the stage to redirect to appropriate API. */
   7862         if (soc_feature(unit, soc_feature_field_preselector_support) &&
   7863             (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == FALSE)) {
   7864             /* Get field entry part that contains the qualifier. */
   7865             rv = _bcm_field_entry_qual_get(unit, entry, bcmFieldQualifyLoopbackType, &f_ent);
   7866             BCM_IF_ERROR_RETURN(rv);
   7867         
   7868             if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   7869 #if defined(BCM_TOMAHAWK3_SUPPORT)
   7870                 if (soc_feature(unit, soc_feature_fp_no_dvp_support)) {
   7871                      BCM_IF_ERROR_RETURN (_bcm_field_th3_qualify_LoopbackType(loopback_type,
   7872                                                                              &data,
   7873                                                                              &mask));
   7874                 } else
   7875 #endif /* BCM_TOMAHAWK3_SUPPORT */
   7876                 {
   7877                     /*Loopback Type encoding in Tomahawk Egress is different from TD2.*/
   7878                     BCM_IF_ERROR_RETURN(_bcm_field_th_qualify_LoopbackType(unit,
   7879                                                 loopback_type, &data, &mask));
   7880                 }
   7881             }
   7882             else {
   7883 #if defined(BCM_TRIDENT3_SUPPORT)
   7884                  if (soc_feature(unit, soc_feature_td3_style_fp)) {
   7885                     BCM_IF_ERROR_RETURN(_bcm_field_td3_qualify_LoopbackType(loopback_type,
   7886                                                                             &data,
   7887                                                                             &mask));
   7888                  } else
   7889 #endif /* BCM_TRIDENT3_SUPPORT */
   7890 #if defined(BCM_TOMAHAWK3_SUPPORT)
   7891                  if (soc_feature(unit, soc_feature_fp_no_dvp_support)) {
   7892                      BCM_IF_ERROR_RETURN (_bcm_field_th3_qualify_LoopbackType(loopback_type,
   7893                                                                              &data,
   7894                                                                              &mask));
   7895                  } else
   7896 #endif /* BCM_TOMAHAWK3_SUPPORT */ 
   7897                  {
   7898                 BCM_IF_ERROR_RETURN(_bcm_field_td2_qualify_LoopbackType(unit,
   7899                             loopback_type, &data, &mask));
   7900             }
   7901         }
   7902         }
   7903         else
   7904 #endif /* BCM_TOMAHAWK_SUPPORT */
   7905         {
   7906 #if defined(BCM_TRIDENT3_SUPPORT)
   7907             if (soc_feature(unit, soc_feature_td3_style_fp)) {
   7908                 BCM_IF_ERROR_RETURN(_bcm_field_td3_qualify_LoopbackType(loopback_type,
   7909                                                                         &data,
   7910                                                                         &mask));
   7911             } else
   7912 #endif /* BCM_TRIDENT3_SUPPORT */
   7913 #if defined(BCM_TOMAHAWK3_SUPPORT)
   7914             if (soc_feature(unit, soc_feature_fp_no_dvp_support)) {
   7915                 BCM_IF_ERROR_RETURN (_bcm_field_th3_qualify_LoopbackType(loopback_type,
   7916                                                                         &data,
   7917                                                                         &mask));
   7918             } else
   7919 #endif /* BCM_TOMAHAWK3_SUPPORT */
   7920             {
   7921                 BCM_IF_ERROR_RETURN(_bcm_field_td2_qualify_LoopbackType(unit,
   7922                                                                 loopback_type,
   7923                                                                 &data, &mask));
   7924             }
   7925         }
   7926     } else
   7927 #endif /* BCM_TRIDENT2_SUPPORT */
   7928 #ifdef BCM_TRIUMPH3_SUPPORT
   7929     if (SOC_IS_TRIUMPH3(unit)) {
   7930         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_LoopbackType(loopback_type,
   7931                                                                 &data,
   7932                                                                 &mask
   7933                                                                 )
   7934                             );
   7935     } else
   7936 #endif
   7937 #ifdef BCM_TRIDENT_SUPPORT
   7938     if (SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit)) {
   7939         switch (loopback_type) {
   7940             case bcmFieldLoopbackTypeAny:
   7941                 data = 0x8;
   7942                 mask = 0x8;
   7943                 break;
   7944             case bcmFieldLoopbackTypeMim:
   7945                 data = 0xb;
   7946                 mask = 0xf;
   7947                 break;
   7948             case bcmFieldLoopbackTypeTrillNetwork:
   7949                 data = 0xc;
   7950                 mask = 0xf;
   7951                 break;
   7952             case bcmFieldLoopbackTypeTrillAccess:
   7953                 data = 0xd;
   7954                 mask = 0xf;
   7955                 break;
   7956 #ifdef BCM_KATANA2_SUPPORT
   7957             case bcmFieldLoopbackTypeMirror:
   7958                 if (SOC_IS_KATANA2(unit)) {
   7959                     data = 0x9;
   7960                     mask = 0xf;
   7961                 } else {
   7962                     return (BCM_E_PARAM);
   7963                 }
   7964                 break;
   7965             case bcmFieldLoopbackTypeRedirect:
   7966                 if (SOC_IS_KATANA2(unit)) {
   7967                     data = 0xa;
   7968                     mask = 0xf;
   7969                 } else {
   7970                     return (BCM_E_PARAM);
   7971                 }
   7972                 break;
   7973 #endif /* BCM_KATANA2_SUPPORT */
   7974             default:
   7975                 return (BCM_E_PARAM);
   7976         }
   7977     } else
   7978 #endif /* BCM_TRIDENT_SUPPORT */
   7979     {
   7980         switch (loopback_type) { 
   7981             case bcmFieldLoopbackTypeAny:
   7982                 data = 0x8;
   7983                 mask = 0x8;
   7984                 break;
   7985             case bcmFieldLoopbackTypeMirror:
   7986                 data = 0xe;
   7987                 mask = 0xf;
   7988                 break;
   7989             case bcmFieldLoopbackTypeWlan:
   7990                 data = 0xc;
   7991                 mask = 0xf;
   7992                 break;
   7993             case bcmFieldLoopbackTypeMim:
   7994                 data = 0xb;
   7995                 mask = 0xf;
   7996                 break;
   7997             case bcmFieldLoopbackTypeRedirect:
   7998                 data = 0x9;
   7999                 mask = 0xf;
   8000                 break;
   8001             default:
   8002                 return (BCM_E_PARAM);
   8003         }
   8004     }
   8005 
   8006     
   8007     FP_LOCK(unit);
   8008 
   8009     rv = _field_qualify32(unit, entry, bcmFieldQualifyLoopbackType, 
   8010                           data, mask);
   8011 
   8012     FP_UNLOCK(unit);
   8013     return (rv);
   8014 }
   8015 
   8016 
   8017 /*
   8018  * Function:
   8019  *      bcm_esw_field_qualify_TunnelType
   8020  * Purpose:
   8021  *      Add tunnel type field qualification to a field entry.
   8022  * Parameters:
   8023  *      unit - (IN) Unit number.
   8024  *      entry - (IN) Field entry id.
   8025  *      tunnel_type - (IN) Data to qualify with.
   8026  * Returns:
   8027  *      BCM_E_XXX
   8028  * Notes:
   8029  */
   8030 int 
   8031 bcm_esw_field_qualify_TunnelType(int unit, 
   8032                              bcm_field_entry_t entry, 
   8033                              bcm_field_TunnelType_t tunnel_type)
   8034 {
   8035     int               rv;   /* Operation return status. */
   8036     uint32            data; /* HW data match criteria.  */
   8037     uint32            mask; /* HW data mask.            */
   8038 
   8039 #if defined(BCM_TRIDENT3_SUPPORT)
   8040     if (soc_feature(unit, soc_feature_td3_style_fp)) {
   8041         BCM_IF_ERROR_RETURN(_bcm_field_td3_qualify_TunnelType(unit, tunnel_type,
   8042                                                               &data,
   8043                                                               &mask));
   8044     } else
   8045 #endif
   8046 #if defined(BCM_TOMAHAWK3_SUPPORT)
   8047     if (soc_feature(unit, soc_feature_fp_no_dvp_support)) {
   8048         BCM_IF_ERROR_RETURN(_bcm_field_th3_qualify_TunnelType(tunnel_type,
   8049                                                               &data,
   8050                                                               &mask));
   8051     } else
   8052 #endif
   8053 #ifdef BCM_TRIDENT2_SUPPORT
   8054     if (SOC_IS_TD2_TT2(unit)) {
   8055         BCM_IF_ERROR_RETURN(_bcm_field_td2_qualify_TunnelType(tunnel_type,
   8056                                                               &data,
   8057                                                               &mask
   8058                                                               )
   8059                             );
   8060     } else
   8061 #endif /* BCM_TRIDENT2_SUPPORT */
   8062 #ifdef BCM_TRIUMPH3_SUPPORT
   8063     if (SOC_IS_TRIUMPH3(unit)) {
   8064         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_TunnelType(tunnel_type,
   8065                                                               &data,
   8066                                                               &mask
   8067                                                               )
   8068                             );
   8069     } else
   8070 #endif
   8071         {
   8072             switch (tunnel_type) { 
   8073             case bcmFieldTunnelTypeAny:
   8074                 data = 0x0;
   8075                 mask = 0x0;
   8076                 break;
   8077             case bcmFieldTunnelTypeNone:
   8078                 data = 0x0;
   8079                 mask = 0xf;
   8080                 break;
   8081             case bcmFieldTunnelTypeIp:
   8082                 data = 0x1;
   8083                 mask = 0xf;
   8084                 break;
   8085             case bcmFieldTunnelTypeMpls:
   8086                 data = 0x2;
   8087                 mask = 0xf;
   8088                 break;
   8089             case bcmFieldTunnelTypeMim:
   8090                 data = 0x3;
   8091                 mask = 0xf;
   8092                 break;
   8093             case bcmFieldTunnelTypeWlanWtpToAc:
   8094                 data = 0x4;
   8095                 mask = 0xf;
   8096                 break;
   8097             case bcmFieldTunnelTypeWlanAcToAc:
   8098                 data = 0x5;
   8099                 mask = 0xf;
   8100                 break;
   8101             case bcmFieldTunnelTypeAutoMulticast:
   8102                 data = 0x6;
   8103                 mask = 0xf;
   8104                 break;
   8105             case bcmFieldTunnelTypeTrill:
   8106                 data = 0x7;
   8107                 mask = 0xf;
   8108                 break;
   8109             default:
   8110                 return (BCM_E_PARAM);
   8111             }
   8112         }
   8113 
   8114     
   8115     FP_LOCK(unit);
   8116 
   8117     rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelType, 
   8118                           data, mask);
   8119 
   8120     FP_UNLOCK(unit);
   8121     return (rv);
   8122 }
   8123 
   8124 
   8125 /*
   8126  * Function:
   8127  *      bcm_esw_field_qualify_DstL3Egress
   8128  * Purpose:
   8129  *     Add a destination egress object field qualification to a field entry.
   8130  * Parameters:
   8131  *      unit - (IN) Unit number.
   8132  *      entry - (IN) Field Entry id.
   8133  *      if_id - (IN) Egress object id. 
   8134  * Returns:
   8135  *      BCM_E_XXX
   8136  * Notes:
   8137  */
   8138 int 
   8139 bcm_esw_field_qualify_DstL3Egress(int unit, 
   8140                                   bcm_field_entry_t entry, 
   8141                                   bcm_if_t if_id)
   8142 {
   8143     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
   8144 #if defined(INCLUDE_L3)
   8145 #if defined(BCM_TOMAHAWK_SUPPORT)
   8146     _field_control_t *fc;   /* Field control structure. */
   8147 #endif
   8148     uint32 data;            /* HW data match criteria.  */
   8149     uint32 mask;            /* HW data mask.            */
   8150     uint32 flags;           /* L3 forwarding flags      */
   8151     int nh_ecmp_id;         /* Next hop/Ecmp group id.  */
   8152 
   8153     /* Get next hop id. */
   8154     rv = bcm_xgs3_l3_egress_id_parse(unit, if_id, &flags, &nh_ecmp_id);
   8155     BCM_IF_ERROR_RETURN(rv);
   8156 
   8157     if (flags & BCM_L3_MULTIPATH) {
   8158         return (BCM_E_UNAVAIL);
   8159     }
   8160 
   8161     data = nh_ecmp_id;
   8162     mask = (BCM_FIELD_EXACT_MATCH_MASK);
   8163     /*
   8164      * Invoke driver function for multi pipe devices.
   8165      */
   8166     
   8167 #if defined(BCM_TOMAHAWK_SUPPORT)
   8168 
   8169     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   8170         rv = _bcm_field_is_entry_stage_valid(unit, entry,
   8171                                              _BCM_FIELD_STAGE_INGRESS);
   8172         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
   8173             /*Error fetching entry*/
   8174             return (rv); 
   8175         }
   8176     
   8177         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
   8178             FP_LOCK(unit);
   8179             rv = _field_control_get(unit, &fc);
   8180             if (BCM_FAILURE(rv)) {
   8181                 FP_UNLOCK(unit);
   8182                 return rv;
   8183             }
   8184             rv = fc->functions.fp_qualify_dvp(unit, entry,
   8185                                           bcmFieldQualifyDstL3Egress,
   8186                                           data, mask, 0);
   8187             FP_UNLOCK(unit);
   8188             return (rv);
   8189         }
   8190     }
   8191 #endif /* BCM_TOMAHAWK_SUPPORT */
   8192 
   8193     BCM_IF_ERROR_RETURN(_field_dest_type_qualify(unit,
   8194                         entry, bcmFieldQualifyDstL3Egress, &data, &mask,
   8195                         _bcmFieldDestTypeNone));
   8196 
   8197     
   8198     FP_LOCK(unit);
   8199 
   8200     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstL3Egress, 
   8201                           data, mask);
   8202 
   8203     FP_UNLOCK(unit);
   8204 #endif /* INCLUDE_L3 */
   8205     return (rv);
   8206 }
   8207 
   8208 
   8209 /*
   8210  * Function:
   8211  *      bcm_esw_field_qualify_DstMulticastGroup
   8212  * Purpose:
   8213  *     Add a destination multicast group field qualification to a field entry.
   8214  * Parameters:
   8215  *      unit - (IN) Unit number.
   8216  *      entry - (IN) Field Entry id.
   8217  *      group - (IN) Multicast group id.
   8218  * Returns:
   8219  *      BCM_E_XXX
   8220  * Notes:
   8221  */
   8222 int 
   8223 bcm_esw_field_qualify_DstMulticastGroup(int unit, 
   8224                                         bcm_field_entry_t entry, 
   8225                                         bcm_multicast_t group)
   8226 {
   8227     _field_control_t *fc;   /* Field control structure. */
   8228     uint32 data;            /* HW data match criteria.  */
   8229     uint32 mask;            /* HW data mask.            */
   8230     int rv;                 /* Operation return status. */
   8231     _bcm_field_DestType_t ipmc_grp_type = _bcmFieldDestTypeNone; 
   8232                                           /* IPMC group type. */
   8233 
   8234     /* Input parameters check. */
   8235     if (0 == _BCM_MULTICAST_IS_SET(group)) {
   8236         return (BCM_E_PARAM);
   8237     }
   8238 
   8239     data  = _BCM_MULTICAST_ID_GET(group); 
   8240     mask = (BCM_FIELD_EXACT_MATCH_MASK);
   8241 
   8242     if ( (_BCM_MULTICAST_IS_L3(group)) || (_BCM_MULTICAST_IS_VPLS(group)) ) {
   8243         ipmc_grp_type = _bcmFieldDestTypeL3mc;
   8244     } else if ( _BCM_MULTICAST_IS_L2(group)) {
   8245         ipmc_grp_type = _bcmFieldDestTypeL2mc;
   8246     } else {
   8247         return (BCM_E_PARAM);
   8248     }
   8249 
   8250     BCM_IF_ERROR_RETURN(_field_dest_type_qualify(unit, entry,
   8251                         bcmFieldQualifyDstMulticastGroup, &data, &mask, 
   8252                         ipmc_grp_type));
   8253 
   8254     
   8255     FP_LOCK(unit);
   8256     rv = _field_control_get(unit, &fc);
   8257     if (BCM_FAILURE(rv)) {
   8258         FP_UNLOCK(unit);
   8259         return rv;
   8260     }
   8261 #if defined(BCM_TOMAHAWK_SUPPORT)
   8262     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   8263         rv = fc->functions.fp_qualify_dvp(unit, entry,
   8264                                           bcmFieldQualifyDstMulticastGroup,
   8265                                           data, mask, 0);
   8266         FP_UNLOCK(unit);
   8267         return (rv);
   8268     }
   8269 #endif /* BCM_TOMAHAWK_SUPPORT */
   8270 
   8271     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstMulticastGroup, 
   8272                           data, mask);
   8273     FP_UNLOCK(unit);
   8274     return (rv);
   8275 }
   8276 
   8277 /*
   8278  * Function:
   8279  *      bcm_esw_field_qualify_SrcMplsGport
   8280  * Purpose:
   8281  *      Add source mpls port field qualification to a field entry.
   8282  * Parameters:
   8283  *      unit - (IN) Unit number.
   8284  *      entry - (IN) Field Entry id.
   8285  *      mpls_port_id - (IN) Mpls virtual port id.
   8286  * Returns:
   8287  *      BCM_E_XXX
   8288  * Notes:
   8289  */
   8290 int 
   8291 bcm_esw_field_qualify_SrcMplsGport(int unit, 
   8292                                bcm_field_entry_t entry, 
   8293                                bcm_gport_t mpls_port_id)
   8294 {
   8295     _field_control_t *fc;   /* Field control structure. */
   8296     _field_group_t *fg;     /* Field group structure    */
   8297     uint32 data;            /* HW data match criteria.  */
   8298     uint32 mask;            /* HW data mask.            */
   8299     int rv;                 /* Operation return status. */
   8300     int ingress_entity = 0; /* Ingress entity or source entity */
   8301     int i;
   8302 
   8303     /* Input parameters check. */
   8304     if (0 == BCM_GPORT_IS_MPLS_PORT(mpls_port_id)) {
   8305         return (BCM_E_PARAM);
   8306     }
   8307 
   8308     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
   8309 
   8310     /* Get the source virtual port value */
   8311     data  = BCM_GPORT_MPLS_PORT_ID_GET(mpls_port_id); 
   8312 
   8313     /* Include all bits for Mask value */
   8314     mask = BCM_FIELD_EXACT_MATCH_MASK;
   8315 
   8316     
   8317 
   8318     FP_LOCK(unit);
   8319     rv = _field_control_get(unit, &fc);
   8320     if (BCM_FAILURE(rv)) {
   8321         FP_UNLOCK(unit);
   8322         return rv;
   8323     }
   8324 
   8325     /*
   8326      * Invoke driver function for multi pipe devices.
   8327      */
   8328 #if defined(BCM_TOMAHAWK_SUPPORT)
   8329 
   8330     if (soc_feature(unit, soc_feature_field_multi_pipe_support) && 
   8331         ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
   8332          (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id))) {
   8333         rv = fc->functions.fp_qualify_svp(unit, entry,
   8334                                           bcmFieldQualifySrcMplsGport,
   8335                                           data, mask, 1);
   8336         FP_UNLOCK(unit);
   8337         return (rv);
   8338     }
   8339 #endif /* BCM_TOMAHAWK_SUPPORT */
   8340 
   8341     /* Check which configuration of SrcMplsGport is in use */
   8342     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
   8343         if (fg->sel_codes[i].ingress_entity_sel ==
   8344                 _bcmFieldFwdEntityMplsGport) {
   8345             ingress_entity = 1;
   8346             break;
   8347         }
   8348     }
   8349 
   8350     if (ingress_entity) {
   8351         /* Internal qualifier to set SVP valid bit in Fixed field */
   8352         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
   8353         if (BCM_FAILURE(rv)) {
   8354             FP_UNLOCK(unit);
   8355             return (rv);
   8356         }
   8357     }
   8358 
   8359     /* Qualify Mpls Source Virtual Port */
   8360     /* In Stage Lookup bcmFieldQualifySrcMplsGport = 20 bits 
   8361        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
   8362        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp 
   8363        ==> data = svp_valid|s_type_sel|s_field
   8364      */
   8365     rv = _field_qualify_source_virtual_port(unit, entry,
   8366             bcmFieldQualifySrcMplsGport, data, mask, ingress_entity);
   8367 
   8368     FP_UNLOCK(unit);
   8369     return (rv);
   8370 }
   8371 
   8372 
   8373 /*
   8374  * Function:
   8375  *      bcm_esw_field_qualify_DstMplsGport
   8376  * Purpose:
   8377  *      Add destination mpls port field qualification to a field entry.
   8378  * Parameters:
   8379  *      unit - (IN) Unit number.
   8380  *      entry - (IN) Field Entry id.
   8381  *      mpls_port_id - (IN)  Mpls virtual port id.
   8382  * Returns:
   8383  *      BCM_E_XXX
   8384  * Notes:
   8385  */
   8386 int 
   8387 bcm_esw_field_qualify_DstMplsGport(int unit, 
   8388                                bcm_field_entry_t entry, 
   8389                                bcm_gport_t mpls_port_id)
   8390 {
   8391     _field_control_t *fc;   /* Field control structure. */
   8392     uint32 data;            /* HW data match criteria.  */
   8393     uint32 mask;            /* HW data mask.            */
   8394     int rv;                 /* Operation return status. */
   8395     _field_entry_t *f_ent;  /* Field entry structure.   */
   8396 
   8397     /* Input parameters check. */
   8398     if (0 == BCM_GPORT_IS_MPLS_PORT(mpls_port_id)) {
   8399         return (BCM_E_PARAM);
   8400     }
   8401 
   8402     data  = BCM_GPORT_MPLS_PORT_ID_GET(mpls_port_id); 
   8403     mask = (BCM_FIELD_EXACT_MATCH_MASK);
   8404 
   8405     
   8406     
   8407     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
   8408         bcmFieldQualifyDstMplsGport, &f_ent));
   8409 
   8410     FP_LOCK(unit);
   8411     rv = _field_control_get(unit, &fc);
   8412     if (BCM_FAILURE(rv)) {
   8413         FP_UNLOCK(unit);
   8414         return rv;
   8415     }
   8416 
   8417     /*
   8418      * Invoke driver function for multi pipe supported devices.
   8419      */
   8420 #if defined(BCM_TOMAHAWK_SUPPORT)
   8421     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   8422         _BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) {
   8423         rv = fc->functions.fp_qualify_dvp(unit, entry,
   8424                                           bcmFieldQualifyDstMplsGport,
   8425                                           data, mask, 1);
   8426         FP_UNLOCK(unit);
   8427         return (rv);
   8428     }
   8429 #endif /* BCM_TOMAHAWK_SUPPORT */
   8430 
   8431 
   8432     /* Check if entry belongs to Egress Stage. */
   8433     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
   8434         /* 
   8435          * LSB is DVP valid bit.
   8436          * Shift DVP value by 1-bit,
   8437          */
   8438         data <<= 1;
   8439 
   8440         /* Set DVP Valid bit. */
   8441         data |= 1;
   8442     } else {
   8443         /* Qualify the destination type qualifier */
   8444         rv = _field_dest_type_qualify(unit, entry,
   8445                                      bcmFieldQualifyDstMplsGport, &data, &mask, 
   8446                                      _bcmFieldDestTypeNone);
   8447         if (BCM_FAILURE(rv)) {
   8448             FP_UNLOCK(unit);
   8449             return (rv);
   8450         }
   8451     }
   8452 
   8453     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstMplsGport,
   8454                           data, mask);
   8455 
   8456     FP_UNLOCK(unit);
   8457     return (rv);
   8458 }
   8459 
   8460 
   8461 /*
   8462  * Function:
   8463  *      bcm_esw_field_qualify_SrcNivGport
   8464  * Purpose:
   8465  *      Add source niv port field qualification to a field entry.
   8466  * Parameters:
   8467  *      unit - (IN) Unit number.
   8468  *      entry - (IN) Field Entry id.
   8469  *      niv_port_id - (IN) Niv virtual port id.
   8470  * Returns:
   8471  *      BCM_E_XXX
   8472  * Notes:
   8473  */
   8474 int 
   8475 bcm_esw_field_qualify_SrcNivGport(int unit, 
   8476                                bcm_field_entry_t entry, 
   8477                                bcm_gport_t niv_port_id)
   8478 {
   8479     _field_control_t *fc;   /* Field control structure. */
   8480     _field_group_t *fg;     /* Field group structure    */
   8481     uint32 data;            /* HW data match criteria.  */
   8482     uint32 mask;            /* HW data mask.            */
   8483     int rv;                 /* Operation return status. */
   8484     int ingress_entity = 0; /* Ingress entity or source entity */
   8485     int i;
   8486 
   8487     /* Input parameters check. */
   8488     if (0 == BCM_GPORT_IS_NIV_PORT(niv_port_id)) {
   8489         return (BCM_E_PARAM);
   8490     }
   8491 
   8492     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
   8493 
   8494     /* Get the source virtual port value */
   8495     data  = BCM_GPORT_NIV_PORT_ID_GET(niv_port_id); 
   8496     /* Include all bits for Mask value */
   8497     mask = BCM_FIELD_EXACT_MATCH_MASK;
   8498 
   8499     
   8500 
   8501     FP_LOCK(unit);
   8502     rv = _field_control_get(unit, &fc);
   8503     if (BCM_FAILURE(rv)) {
   8504         FP_UNLOCK(unit);
   8505         return rv;
   8506     }
   8507 
   8508     /*
   8509      * Invoke driver function for multi pipe supported devices.
   8510      */
   8511 #if defined(BCM_TOMAHAWK_SUPPORT)
   8512 
   8513     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   8514         ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
   8515          (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id))) {
   8516         rv = fc->functions.fp_qualify_svp(unit, entry,
   8517                                           bcmFieldQualifySrcNivGport,
   8518                                           data, mask, 1);
   8519         FP_UNLOCK(unit);
   8520         return (rv);
   8521     }
   8522 #endif /* BCM_TOMAHAWK_SUPPORT */
   8523 
   8524     /* Check which configuration of SrcNivGport is in use */
   8525     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
   8526         if (fg->sel_codes[i].ingress_entity_sel ==
   8527                 _bcmFieldFwdEntityNivGport) {
   8528             ingress_entity = 1;
   8529             break;
   8530         }
   8531     }
   8532 
   8533     if (ingress_entity) {
   8534         /* Internal qualifier to set SVP valid bit in Fixed field */
   8535         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
   8536         if (BCM_FAILURE(rv)) {
   8537             FP_UNLOCK(unit);
   8538             return (rv);
   8539         }
   8540     }
   8541 
   8542     /* Qualify Niv Source Virtual Port */
   8543     /* In Stage Lookup bcmFieldQualifySrcNivGport = 20 bits 
   8544        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
   8545        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp 
   8546        ==> data = svp_valid|s_type_sel|s_field
   8547      */
   8548     rv = _field_qualify_source_virtual_port(unit, entry,
   8549             bcmFieldQualifySrcNivGport, data, mask, ingress_entity);
   8550 
   8551     FP_UNLOCK(unit);
   8552     return (rv);
   8553 }
   8554 
   8555 
   8556 /*
   8557  * Function:
   8558  *      bcm_esw_field_qualify_DstNivGport
   8559  * Purpose:
   8560  *      Add destination niv port field qualification to a field entry.
   8561  * Parameters:
   8562  *      unit - (IN) Unit number.
   8563  *      entry - (IN) Field Entry id.
   8564  *      niv_port_id - (IN)  Niv virtual port id.
   8565  * Returns:
   8566  *      BCM_E_XXX
   8567  * Notes:
   8568  */
   8569 int 
   8570 bcm_esw_field_qualify_DstNivGport(int unit, 
   8571                                bcm_field_entry_t entry, 
   8572                                bcm_gport_t niv_port_id)
   8573 {
   8574     _field_control_t *fc;   /* Field control structure. */
   8575     uint32 data;            /* HW data match criteria.  */
   8576     uint32 mask;            /* HW data mask.            */
   8577     int rv;                 /* Operation return status. */
   8578     _field_entry_t *f_ent;  /* Field entry structure.   */
   8579 
   8580     /* Input parameters check. */
   8581     if (0 == BCM_GPORT_IS_NIV_PORT(niv_port_id)) {
   8582         return (BCM_E_PARAM);
   8583     }
   8584 
   8585     data  = BCM_GPORT_NIV_PORT_ID_GET(niv_port_id); 
   8586     mask = (BCM_FIELD_EXACT_MATCH_MASK);
   8587 
   8588     
   8589 
   8590     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
   8591                          bcmFieldQualifyDstNivGport, &f_ent));
   8592 
   8593     FP_LOCK(unit);
   8594     rv = _field_control_get(unit, &fc);
   8595     if (BCM_FAILURE(rv)) {
   8596         FP_UNLOCK(unit);
   8597         return rv;
   8598     }
   8599 
   8600     /*
   8601      * Invoke driver function for multi pipe supported devices.
   8602      */
   8603 #if defined(BCM_TOMAHAWK_SUPPORT)
   8604     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   8605         (_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id)) {
   8606         rv = fc->functions.fp_qualify_dvp(unit, entry,
   8607                                           bcmFieldQualifyDstNivGport,
   8608                                           data, mask, 1);
   8609         FP_UNLOCK(unit);
   8610         return (rv);
   8611     }
   8612 #endif /* BCM_TOMAHAWK_SUPPORT */
   8613 
   8614     /* Check if entry belongs to Egress Stage. */
   8615     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
   8616         /* 
   8617          * LSB is DVP valid bit.
   8618          * Shift DVP value by 1-bit,
   8619          */
   8620         data <<= 1;
   8621 
   8622         /* Set DVP Valid bit. */
   8623         data |= 1;
   8624     } else {
   8625         /* Qualify the destination type qualifier */
   8626         rv = _field_dest_type_qualify(unit, entry,
   8627                                       bcmFieldQualifyDstNivGport, &data, &mask,
   8628                                       _bcmFieldDestTypeNone);
   8629         if (BCM_FAILURE(rv)) {
   8630             FP_UNLOCK(unit);
   8631             return (rv);
   8632         }
   8633     }
   8634 
   8635     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstNivGport,
   8636                           data, mask);
   8637     
   8638     FP_UNLOCK(unit);
   8639 
   8640     return (rv);
   8641 }
   8642 
   8643 
   8644 /*
   8645  * Function:
   8646  *      bcm_esw_field_qualify_SrcModPortGport
   8647  * Purpose:
   8648  *      Set match criteria for bcmFieildQualifySrcModPortGport
   8649  *                     qualifier in the field entry.
   8650  * Parameters:
   8651  *      unit - (IN) Unit number.
   8652  *      entry - (IN) BCM field entry id.
   8653  *      data - (IN) Qualifier match gport.
   8654  * Returns:
   8655  *      BCM_E_XXX
   8656  * Notes:
   8657  */
   8658 int 
   8659 bcm_esw_field_qualify_SrcModPortGport(int unit, 
   8660                                       bcm_field_entry_t entry, 
   8661                                       bcm_gport_t port)
   8662 {
   8663     uint32 data;            /* HW data match criteria.  */
   8664     uint32 mask;            /* HW data mask.            */
   8665     int rv;                 /* Operation return status. */
   8666 
   8667     /* Input parameters check. */
   8668     if (0 == BCM_GPORT_IS_MODPORT(port)) {
   8669         return (BCM_E_PARAM);
   8670     }
   8671 
   8672     data  = BCM_GPORT_MODPORT_PORT_GET(port);
   8673     data |= ((BCM_GPORT_MODPORT_MODID_GET(port)) << _FP_PORT_BITWIDTH(unit));
   8674     mask = BCM_FIELD_EXACT_MATCH_MASK;
   8675 
   8676     
   8677     FP_LOCK(unit);
   8678 
   8679     rv = _field_qualify32(unit, entry, bcmFieldQualifySrcModPortGport, 
   8680                           data, mask);
   8681 
   8682     FP_UNLOCK(unit);
   8683     return (rv);
   8684 }
   8685 
   8686 /*
   8687  * Function:
   8688  *      bcm_esw_field_qualify_SrcModuleGport
   8689  * Purpose:
   8690  *      Set match criteria for bcmFieildQualifySrcModuleGport
   8691  *                     qualifier in the field entry.
   8692  * Parameters:
   8693  *      unit - (IN) Unit number.
   8694  *      entry - (IN) BCM field entry id.
   8695  *      data - (IN) Qualifier match gport.
   8696  * Returns:
   8697  *      BCM_E_XXX
   8698  * Notes:
   8699  */
   8700 int 
   8701 bcm_esw_field_qualify_SrcModuleGport(int unit, 
   8702                                       bcm_field_entry_t entry, 
   8703                                       bcm_gport_t port)
   8704 {
   8705     uint32 data;            /* HW data match criteria.  */
   8706     uint32 mask;            /* HW data mask.            */
   8707     int rv;                 /* Operation return status. */
   8708 
   8709     /* Input parameters check. */
   8710     if (0 == BCM_GPORT_IS_MODPORT(port)) {
   8711         return (BCM_E_PARAM);
   8712     }
   8713 
   8714     data = BCM_GPORT_MODPORT_MODID_GET(port);
   8715     mask = BCM_FIELD_EXACT_MATCH_MASK;
   8716 
   8717     
   8718     FP_LOCK(unit);
   8719 
   8720     rv = _field_qualify32(unit, entry, bcmFieldQualifySrcModuleGport, 
   8721                           data, mask);
   8722 
   8723     FP_UNLOCK(unit);
   8724     return (rv);
   8725 }
   8726 
   8727 /*
   8728  * Function:
   8729  *      bcm_esw_field_qualify_SrcMimGport
   8730  * Purpose:
   8731  *      Add source mac in mac port field qualification to a field entry.
   8732  * Parameters:
   8733  *      unit - (IN) Unit number.
   8734  *      entry - (IN) Field Entry id.
   8735  *      mim_port_id - (IN) Mim virtual port id.
   8736  * Returns:
   8737  *      BCM_E_XXX
   8738  * Notes:
   8739  */
   8740 int 
   8741 bcm_esw_field_qualify_SrcMimGport(int unit, 
   8742                               bcm_field_entry_t entry, 
   8743                               bcm_gport_t mim_port_id)
   8744 {
   8745     _field_control_t *fc;   /* Field control structure. */
   8746     _field_group_t *fg;     /* Field group structure    */
   8747     uint32 data;            /* HW data match criteria.  */
   8748     uint32 mask;            /* HW data mask.            */
   8749     int rv;                 /* Operation return status. */
   8750     int ingress_entity = 0; /* Ingress entity or source entity */
   8751     int i;
   8752 
   8753     /* Input parameters check. */
   8754     if (0 == BCM_GPORT_IS_MIM_PORT(mim_port_id)) {
   8755         return (BCM_E_PARAM);
   8756     }
   8757 
   8758     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
   8759 
   8760     /* Get the source virtual port value */
   8761     data  = BCM_GPORT_MIM_PORT_ID_GET(mim_port_id);
   8762     /* Include all bits for Mask value */
   8763     mask = BCM_FIELD_EXACT_MATCH_MASK;
   8764 
   8765     
   8766 
   8767     FP_LOCK(unit);
   8768     rv = _field_control_get(unit, &fc);
   8769     if (BCM_FAILURE(rv)) {
   8770         FP_UNLOCK(unit);
   8771         return rv;
   8772     }
   8773 
   8774 #if defined(BCM_TOMAHAWK_SUPPORT)
   8775     /*
   8776      * Invoke driver function for multi pipe supported devices.
   8777      */
   8778     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   8779         ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
   8780          (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id))) {
   8781         rv = fc->functions.fp_qualify_svp(unit, entry,
   8782                                           bcmFieldQualifySrcMimGport,
   8783                                           data, mask, 1);
   8784         FP_UNLOCK(unit);
   8785         return (rv);
   8786     }
   8787 #endif /* BCM_TOMAHAWK_SUPPORT */
   8788 
   8789     /* Check which configuration of SrcMimGport is in use */
   8790     /* <HP>
   8791        Check this for TR3; fields widths have changed.
   8792        Similar logic for other SrcGport quals?
   8793        </HP> */
   8794 
   8795     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
   8796         if (fg->sel_codes[i].ingress_entity_sel ==
   8797                 _bcmFieldFwdEntityMimGport) {
   8798             ingress_entity = 1;
   8799             break;
   8800         }
   8801     }
   8802 
   8803     if (ingress_entity) {
   8804         /* Internal qualifier to set SVP valid bit in Fixed field */
   8805         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
   8806         if (BCM_FAILURE(rv)) {
   8807             FP_UNLOCK(unit);
   8808             return (rv);
   8809         }
   8810     }
   8811     
   8812     /* Qualify MiM Source Virtual Port */
   8813     /* In Stage Lookup bcmFieldQualifySrcMimGport = 20 bits 
   8814        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
   8815        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp 
   8816        ==> data = svp_valid|s_type_sel|s_field
   8817      */
   8818     rv = _field_qualify_source_virtual_port(unit, entry,
   8819             bcmFieldQualifySrcMimGport, data, mask, ingress_entity);
   8820 
   8821     FP_UNLOCK(unit);
   8822     return (rv);
   8823 }
   8824 
   8825 
   8826 /*
   8827  * Function:
   8828  *      bcm_esw_field_qualify_DstMimGport
   8829  * Purpose:
   8830  *      Add destination mac in mac port field qualification to a field entry.
   8831  * Parameters:
   8832  *      unit - (IN) Unit number.
   8833  *      entry - (IN) Field Entry id.
   8834  *      mim_port_id - (IN) Mim virtual port id.
   8835  * Returns:
   8836  *      BCM_E_XXX
   8837  * Notes:
   8838  */
   8839 int 
   8840 bcm_esw_field_qualify_DstMimGport(int unit, 
   8841                               bcm_field_entry_t entry, 
   8842                               bcm_gport_t mim_port_id)
   8843 {
   8844     _field_control_t *fc;   /* Field control structure. */
   8845     uint32 data;            /* HW data match criteria.  */
   8846     uint32 mask;            /* HW data mask.            */
   8847     int rv;                 /* Operation return status. */
   8848     _field_entry_t *f_ent;  /* Field entry structure.   */
   8849 
   8850     /* Input parameters check. */
   8851     if (0 == BCM_GPORT_IS_MIM_PORT(mim_port_id)) {
   8852         return (BCM_E_PARAM);
   8853     }
   8854 
   8855     data  = BCM_GPORT_MIM_PORT_ID_GET(mim_port_id); 
   8856     mask = (BCM_FIELD_EXACT_MATCH_MASK);
   8857 
   8858     
   8859     
   8860     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
   8861             bcmFieldQualifyDstMimGport, &f_ent));
   8862 
   8863     FP_LOCK(unit);
   8864     rv = _field_control_get(unit, &fc);
   8865     if (BCM_FAILURE(rv)) {
   8866         FP_UNLOCK(unit);
   8867         return rv;
   8868     }
   8869 
   8870     /*
   8871      * Invoke driver function for multi pipe supported devices.
   8872      */
   8873 #if defined(BCM_TOMAHAWK_SUPPORT)
   8874     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   8875         _BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) {
   8876         rv = fc->functions.fp_qualify_dvp(unit, entry,
   8877                                           bcmFieldQualifyDstMimGport,
   8878                                           data, mask, 1);
   8879         FP_UNLOCK(unit);
   8880         return (rv);
   8881     }
   8882 #endif /* BCM_TOMAHAWK_SUPPORT */
   8883 
   8884 
   8885     /* Check if entry belongs to Egress Stage. */
   8886     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
   8887         /* 
   8888          * LSB is DVP valid bit.
   8889          * Shift DVP value by 1-bit,
   8890          */
   8891         data <<= 1;
   8892 
   8893         /* Set DVP Valid bit. */
   8894         data |= 1;
   8895     } else {
   8896         /* Qualify the destination type qualifier */
   8897         rv = _field_dest_type_qualify(unit, entry,
   8898                                       bcmFieldQualifyDstMimGport, &data, &mask, 
   8899                                       _bcmFieldDestTypeNone);
   8900         if (BCM_FAILURE(rv)) {
   8901             FP_UNLOCK(unit);
   8902             return (rv);
   8903         }
   8904     }
   8905 
   8906     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstMimGport, 
   8907                           data, mask);
   8908 
   8909     FP_UNLOCK(unit);
   8910     return (rv);
   8911 }
   8912 
   8913 
   8914 
   8915 /*
   8916  * Function:
   8917  *      bcm_esw_field_qualify_SrcWlanGport
   8918  * Purpose:
   8919  *      Add source wlan port field qualification to a field entry.
   8920  * Parameters:
   8921  *      unit - (IN) Unit number.
   8922  *      entry - (IN) Field Entry id.
   8923  *      wlan_port_id - (IN) Wlan virtual port id.
   8924  * Returns:
   8925  *      BCM_E_XXX
   8926  * Notes:
   8927  */
   8928 int 
   8929 bcm_esw_field_qualify_SrcWlanGport(int unit, 
   8930                                bcm_field_entry_t entry, 
   8931                                bcm_gport_t wlan_port_id)
   8932 {
   8933     _field_control_t *fc;   /* Field control structure. */
   8934     _field_group_t *fg;     /* Field group structure    */
   8935     uint32 data;            /* HW data match criteria.  */
   8936     uint32 mask;            /* HW data mask.            */
   8937     int rv;                 /* Operation return status. */
   8938     int ingress_entity = 0; /* Ingress entity or source entity */
   8939     int i;
   8940 
   8941     /* Input parameters check. */
   8942     if (0 == BCM_GPORT_IS_WLAN_PORT(wlan_port_id)) {
   8943         return (BCM_E_PARAM);
   8944     }
   8945 
   8946     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
   8947 
   8948     data  = BCM_GPORT_WLAN_PORT_ID_GET(wlan_port_id);
   8949 
   8950     /* Include all bits for Mask value */
   8951     mask = BCM_FIELD_EXACT_MATCH_MASK;
   8952 
   8953     
   8954 
   8955     FP_LOCK(unit);
   8956     rv = _field_control_get(unit, &fc);
   8957     if (BCM_FAILURE(rv)) {
   8958         FP_UNLOCK(unit);
   8959         return rv;
   8960     }
   8961 
   8962 #if defined(BCM_TOMAHAWK_SUPPORT)
   8963     /*
   8964      * Invoke driver function for multi pipe supported devices.
   8965      */
   8966     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   8967         ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
   8968          (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id))) {
   8969         rv = fc->functions.fp_qualify_svp(unit, entry,
   8970                                           bcmFieldQualifySrcWlanGport,
   8971                                           data, mask, 1);
   8972         FP_UNLOCK(unit);
   8973         return (rv);
   8974     }
   8975 #endif /* BCM_TOMAHAWK_SUPPORT */
   8976 
   8977     /* Check which configuration of SrcWlanGport is in use */
   8978     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
   8979         if (fg->sel_codes[i].ingress_entity_sel ==
   8980                 _bcmFieldFwdEntityWlanGport) {
   8981             ingress_entity = 1;
   8982             break;
   8983         }
   8984     }
   8985 
   8986     if (ingress_entity) {
   8987         /* Internal qualifier to set SVP valid bit in Fixed field */
   8988         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
   8989         if (BCM_FAILURE(rv)) {
   8990             FP_UNLOCK(unit);
   8991             return (rv);
   8992         }
   8993     }
   8994 
   8995     /* Qualify Wlan Source Virtual Port */
   8996     /* In Stage Lookup bcmFieldQualifySrcWlanGport = 20 bits 
   8997        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
   8998        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp 
   8999        ==> data = svp_valid|s_type_sel|s_field
   9000      */
   9001     rv = _field_qualify_source_virtual_port(unit, entry,
   9002             bcmFieldQualifySrcWlanGport, data, mask, ingress_entity);
   9003 
   9004     FP_UNLOCK(unit);
   9005     return (rv);
   9006 }
   9007 
   9008 /*
   9009  * Function:
   9010  *      bcm_esw_field_qualify_DstWlanGport
   9011  * Purpose:
   9012  *      Add destination wlan port field qualification to a field entry.
   9013  * Parameters:
   9014  *      unit - (IN) Unit number.
   9015  *      entry - (IN) Field Entry id.
   9016  *      wlan_port_id - (IN) Wlan virtual port id.
   9017  * Returns:
   9018  *      BCM_E_XXX
   9019  * Notes:
   9020  */
   9021 int 
   9022 bcm_esw_field_qualify_DstWlanGport(int unit, 
   9023                                bcm_field_entry_t entry, 
   9024                                bcm_gport_t wlan_port_id)
   9025 {
   9026     _field_control_t *fc;   /* Field control structure. */
   9027     uint32 data;            /* HW data match criteria.  */
   9028     uint32 mask;            /* HW data mask.            */
   9029     int rv;                 /* Operation return status. */
   9030     _field_entry_t *f_ent;  /* Field entry structure.   */
   9031 
   9032     /* Input parameters check. */
   9033     if (0 == BCM_GPORT_IS_WLAN_PORT(wlan_port_id)) {
   9034         return (BCM_E_PARAM);
   9035     }
   9036 
   9037     data  = BCM_GPORT_WLAN_PORT_ID_GET(wlan_port_id); 
   9038     mask = (BCM_FIELD_EXACT_MATCH_MASK);
   9039 
   9040     
   9041 
   9042     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
   9043             bcmFieldQualifyDstWlanGport, &f_ent));
   9044 
   9045     FP_LOCK(unit);
   9046     rv = _field_control_get(unit, &fc);
   9047     if (BCM_FAILURE(rv)) {
   9048         FP_UNLOCK(unit);
   9049         return rv;
   9050     }
   9051 
   9052     /*
   9053      * Invoke driver function for multi pipe supported devices.
   9054      */
   9055 #if defined(BCM_TOMAHAWK_SUPPORT)
   9056     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   9057         rv = _bcm_field_is_entry_stage_valid(unit, entry,
   9058                                              _BCM_FIELD_STAGE_INGRESS);
   9059         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
   9060             /*Error fetching entry*/
   9061             FP_UNLOCK(unit);
   9062             return (rv); 
   9063         }
   9064     
   9065         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
   9066             rv = fc->functions.fp_qualify_dvp(unit, entry,
   9067                                           bcmFieldQualifyDstWlanGport,
   9068                                           data, mask, 1);
   9069             FP_UNLOCK(unit);
   9070             return (rv);
   9071         }
   9072     }
   9073 #endif /* BCM_TOMAHAWK_SUPPORT */
   9074 
   9075     /* Check if entry belongs to Egress Stage. */
   9076     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
   9077         /*
   9078          * LSB is DVP valid bit.
   9079          * Shift DVP value by 1-bit,
   9080          */
   9081         data <<= 1;
   9082 
   9083         /* Set DVP Valid bit. */
   9084         data |= 1;
   9085     } else {
   9086         /* Qualify the destination type qualifier */
   9087         rv = _field_dest_type_qualify(unit, entry,
   9088                                       bcmFieldQualifyDstWlanGport, &data,
   9089                                       &mask, _bcmFieldDestTypeNone);
   9090         if (BCM_FAILURE(rv)) {
   9091             FP_UNLOCK(unit);
   9092             return (rv);
   9093         }
   9094     }
   9095  
   9096     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstWlanGport, 
   9097                           data, mask);
   9098 
   9099     FP_UNLOCK(unit);
   9100     return (rv);
   9101 }
   9102 
   9103 /*
   9104  * Function: 
   9105  *      bcm_esw_field_qualify_SrcVxlanGport
   9106  * Purpose:
   9107  *      Add source vxlan port field qualification to a field entry.
   9108  * Parameters:
   9109  *      unit - (IN) Unit number.
   9110  *      entry - (IN) Field Entry id.
   9111  *      vxlan_port_id - (IN) vxlan virtual port id.
   9112  * Returns:
   9113  *      BCM_E_XXX
   9114  * Notes:
   9115  */
   9116 
   9117 int
   9118 bcm_esw_field_qualify_SrcVxlanGport(int unit,
   9119                                     bcm_field_entry_t entry,
   9120                                     bcm_gport_t vxlan_port_id)
   9121 {
   9122     _field_control_t *fc;   /* Field control structure. */
   9123     _field_group_t *fg;     /* Field group structure    */
   9124     _field_entry_t *f_ent = NULL;  /* Field entry structure.   */
   9125     uint32 data;            /* HW data match criteria.  */
   9126     uint32 mask;            /* HW data mask.            */
   9127     int rv;                 /* Operation return status. */
   9128     int ingress_entity = 0; /* Ingress entity or source entity */
   9129     int i;
   9130 
   9131     /* Input parameters check. */
   9132     if ((0 == BCM_GPORT_IS_VXLAN_PORT(vxlan_port_id)) &&
   9133         (0 == BCM_GPORT_IS_FLOW_PORT(vxlan_port_id))) {
   9134         return (BCM_E_PARAM);
   9135     }
   9136 
   9137     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
   9138 
   9139     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
   9140             bcmFieldQualifySrcVxlanGport, &f_ent));
   9141 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
   9142 
   9143     if (soc_feature(unit, soc_feature_flex_flow)
   9144         && BCM_GPORT_IS_FLOW_PORT(vxlan_port_id)) {
   9145         data  = BCM_GPORT_FLOW_PORT_ID_GET(vxlan_port_id);
   9146         f_ent->svp_type = _bcmVpTypeFlow;
   9147     } else {
   9148         data  = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_id);
   9149         f_ent->svp_type = _bcmVpTypeVxlan;
   9150     }
   9151 #else
   9152     data  = BCM_GPORT_FLOW_PORT_ID_GET(vxlan_port_id);
   9153 #endif
   9154 
   9155     /* Include all bits for Mask value */
   9156     mask = BCM_FIELD_EXACT_MATCH_MASK;
   9157 
   9158     
   9159 
   9160     FP_LOCK(unit);
   9161     rv = _field_control_get(unit, &fc);
   9162     if (BCM_FAILURE(rv)) {
   9163         FP_UNLOCK(unit);
   9164         return rv;
   9165     }
   9166 
   9167 #if defined(BCM_TOMAHAWK_SUPPORT)
   9168     /*
   9169      * Invoke driver function for multi pipe supported devices.
   9170      */
   9171     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   9172         ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
   9173          (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id))) {
   9174         rv = fc->functions.fp_qualify_svp(unit, entry,
   9175                                           bcmFieldQualifySrcVxlanGport,
   9176                                           data, mask, 1);
   9177         FP_UNLOCK(unit);
   9178         return (rv);
   9179     }
   9180 #endif /* BCM_TOMAHAWK_SUPPORT */
   9181 
   9182     /* Check which configuration of SrcVxlanGport is in use */
   9183     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
   9184         if (fg->sel_codes[i].ingress_entity_sel ==
   9185                 _bcmFieldFwdEntityVxlanGport) {
   9186             ingress_entity = 1;
   9187             break;
   9188         }
   9189     }
   9190 
   9191     if (ingress_entity) {
   9192         /* Internal qualifier to set SVP valid bit in Fixed field */
   9193         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
   9194         if (BCM_FAILURE(rv)) {
   9195             FP_UNLOCK(unit);
   9196             return (rv);
   9197         }
   9198     }
   9199 
   9200     /* Qualify Vxlan Source Virtual Port */
   9201     /* In Stage Lookup bcmFieldQualifySrcVxlanGport = 20 bits 
   9202        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
   9203        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp 
   9204        ==> data = svp_valid|s_type_sel|s_field
   9205      */
   9206     rv = _field_qualify_source_virtual_port(unit, entry,
   9207             bcmFieldQualifySrcVxlanGport, data, mask, ingress_entity);
   9208 
   9209     FP_UNLOCK(unit);
   9210     return (rv);
   9211 
   9212 }
   9213 
   9214 /*
   9215  * Function:
   9216  *      bcm_esw_field_qualify_DstVxlanGport
   9217  * Purpose:
   9218  *      Add destination vxlan port field qualification to a field entry.
   9219  * Parameters:
   9220  *      unit - (IN) Unit number.
   9221  *      entry - (IN) Field Entry id.
   9222  *      vxlan_port_id - (IN) Vxlan virtual port id.
   9223  * Returns:
   9224  *      BCM_E_XXX
   9225  * Notes:
   9226  */
   9227 
   9228 int
   9229 bcm_esw_field_qualify_DstVxlanGport(int unit,
   9230                                bcm_field_entry_t entry,
   9231                                bcm_gport_t vxlan_port_id)
   9232 {
   9233     _field_control_t *fc = NULL;   /* Field control structure. */
   9234     uint32 data = 0 ;              /* HW data match criteria.  */
   9235     uint32 mask = 0;               /* HW data mask.            */
   9236     int rv = BCM_E_UNAVAIL;        /* Operation return status. */
   9237     _field_entry_t *f_ent = NULL;  /* Field entry structure.   */
   9238 
   9239     /* Input parameters check. */
   9240     if ((0 == BCM_GPORT_IS_VXLAN_PORT(vxlan_port_id)) &&
   9241         (0 == BCM_GPORT_IS_FLOW_PORT(vxlan_port_id))) {
   9242         return (BCM_E_PARAM);
   9243     }
   9244 
   9245     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
   9246             bcmFieldQualifyDstVxlanGport, &f_ent));
   9247 
   9248     mask = (BCM_FIELD_EXACT_MATCH_MASK);
   9249 
   9250 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
   9251     if (soc_feature(unit, soc_feature_flex_flow)
   9252         && BCM_GPORT_IS_FLOW_PORT(vxlan_port_id)) {
   9253         data  = BCM_GPORT_FLOW_PORT_ID_GET(vxlan_port_id);
   9254         f_ent->dvp_type = _bcmVpTypeFlow;
   9255     } else {
   9256         data  = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_id);
   9257         f_ent->dvp_type = _bcmVpTypeVxlan;
   9258     }
   9259 #else
   9260     data  = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_id);
   9261 #endif
   9262     FP_LOCK(unit);
   9263     rv = _field_control_get(unit, &fc);
   9264     if (BCM_FAILURE(rv)) {
   9265         FP_UNLOCK(unit);
   9266         return rv;
   9267     }
   9268 
   9269     /*
   9270      * Invoke driver function for multi pipe supported devices.
   9271      */
   9272 #if defined(BCM_TOMAHAWK_SUPPORT)
   9273     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   9274         _BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) {
   9275         rv = fc->functions.fp_qualify_dvp(unit, entry,
   9276                                           bcmFieldQualifyDstVxlanGport,
   9277                                           data, mask, 1);
   9278         FP_UNLOCK(unit);
   9279         return (rv);
   9280     }
   9281 #endif /* BCM_TOMAHAWK_SUPPORT */
   9282 
   9283     /* Check if entry belongs to Egress Stage. */
   9284     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
   9285 #if defined(BCM_TRIDENT3_SUPPORT)
   9286         /* For Trident3 devices, the dvp_valid field is set
   9287          * _field_efp_qualify function based on the tcam key
   9288          * selected with dvp selector
   9289          */
   9290         if (!soc_feature(unit, soc_feature_td3_style_fp)) {
   9291             /*
   9292              * LSB is DVP valid bit.
   9293              * Shift DVP value by 1-bit,
   9294              */
   9295             data <<= 1;
   9296 
   9297             /* Set DVP Valid bit. */
   9298             data |= 1;
   9299         }
   9300 #else
   9301         /*
   9302          * LSB is DVP valid bit.
   9303          * Shift DVP value by 1-bit,
   9304          */
   9305         data <<= 1;
   9306 
   9307         /* Set DVP Valid bit. */
   9308         data |= 1;
   9309 #endif /* BCM_TRIDENT3_SUPPORT */
   9310     } else {
   9311         /* Qualify the destination type qualifier */
   9312         rv = _field_dest_type_qualify(unit, entry,
   9313                                       bcmFieldQualifyDstVxlanGport, &data, 
   9314                                       &mask, _bcmFieldDestTypeNone);
   9315         if (BCM_FAILURE(rv)) {
   9316             FP_UNLOCK(unit);
   9317             return (rv);
   9318         }
   9319     }
   9320 
   9321     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstVxlanGport,
   9322                           data, mask);
   9323     FP_UNLOCK(unit);
   9324     return (rv);
   9325 }
   9326 
   9327  
   9328 /*
   9329  * Function:
   9330  *      bcm_esw_field_qualify_SrcVlanGport
   9331  * Purpose:
   9332  *      Add source vlan port field qualification to a field entry.
   9333  * Parameters:
   9334  *      unit - (IN) Unit number.
   9335  *      entry - (IN) Field Entry id.
   9336  *      vlan_port_id - (IN) Vlan virtual port id.
   9337  * Returns:
   9338  *      BCM_E_XXX
   9339  * Notes:
   9340  */
   9341 int
   9342 bcm_esw_field_qualify_SrcVlanGport(int unit,
   9343         bcm_field_entry_t entry,
   9344         bcm_gport_t vlan_port_id)
   9345 {
   9346     _field_control_t *fc;   /* Field control structure. */
   9347     _field_group_t *fg;     /* Field group structure    */
   9348     uint32 data;            /* HW data match criteria.  */
   9349     uint32 mask;            /* HW data mask.            */
   9350     int rv;                 /* Operation return status. */
   9351     int ingress_entity = 0; /* Ingress entity or source entity */
   9352     int i;
   9353 
   9354     /* Input parameters check. */
   9355     if (0 == BCM_GPORT_IS_VLAN_PORT(vlan_port_id)) {
   9356         return (BCM_E_PARAM);
   9357     }
   9358 
   9359     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
   9360 
   9361     /* Get the source virtual port value */
   9362     data  = BCM_GPORT_VLAN_PORT_ID_GET(vlan_port_id);
   9363 
   9364     /* Include all bits for Mask value */
   9365     mask = BCM_FIELD_EXACT_MATCH_MASK;
   9366 
   9367     
   9368 
   9369     FP_LOCK(unit);
   9370     rv = _field_control_get(unit, &fc);
   9371     if (BCM_FAILURE(rv)) {
   9372         FP_UNLOCK(unit);
   9373         return rv;
   9374     }
   9375 
   9376 #if defined(BCM_TOMAHAWK_SUPPORT)
   9377     /*
   9378      * Invoke driver function for multi pipe supported devices.
   9379      */
   9380     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   9381         rv = _bcm_field_is_entry_stage_valid(unit, entry,
   9382                                              _BCM_FIELD_STAGE_INGRESS);
   9383         
   9384         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
   9385             /*Error fetching entry*/
   9386             FP_UNLOCK(unit);
   9387             return (rv); 
   9388         }
   9389     
   9390         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
   9391             rv = fc->functions.fp_qualify_svp(unit, entry,
   9392                                           bcmFieldQualifySrcVlanGport,
   9393                                           data, mask, 1);
   9394             FP_UNLOCK(unit);
   9395             return (rv);
   9396         }
   9397     }
   9398 #endif /* BCM_TOMAHAWK_SUPPORT */
   9399 
   9400     /* Check which configuration of SrcVlanGport is in use */
   9401     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
   9402         if (fg->sel_codes[i].ingress_entity_sel ==
   9403                 _bcmFieldFwdEntityVlanGport) {
   9404             ingress_entity = 1;
   9405             break;
   9406         }
   9407     }
   9408 
   9409     if (ingress_entity) {
   9410         /* Internal qualifier to set SVP valid bit in Fixed field */
   9411         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
   9412         if (BCM_FAILURE(rv)) {
   9413             FP_UNLOCK(unit);
   9414             return (rv);
   9415         }
   9416     }
   9417 
   9418     /* Qualify Vlan Source Virtual Port */
   9419     /* In Stage Lookup bcmFieldQualifySrcVlanGport = 20 bits
   9420        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
   9421        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp
   9422        ==> data = svp_valid|s_type_sel|s_field
   9423      */
   9424     rv = _field_qualify_source_virtual_port(unit, entry,
   9425             bcmFieldQualifySrcVlanGport, data, mask, ingress_entity);
   9426 
   9427     FP_UNLOCK(unit);
   9428     return (rv);
   9429 }
   9430 
   9431 
   9432 /*
   9433  * Function:
   9434  *      bcm_esw_field_qualify_DstVlanGport
   9435  * Purpose:
   9436  *      Add destination vlan port field qualification to a field entry.
   9437  * Parameters:
   9438  *      unit - (IN) Unit number.
   9439  *      entry - (IN) Field Entry id.
   9440  *      vlan_port_id - (IN)  Vlan virtual port id.
   9441  * Returns:
   9442  *      BCM_E_XXX
   9443  * Notes:
   9444  */
   9445 int
   9446 bcm_esw_field_qualify_DstVlanGport(int unit,
   9447         bcm_field_entry_t entry,
   9448         bcm_gport_t vlan_port_id)
   9449 {
   9450     _field_control_t *fc;   /* Field control structure. */
   9451     uint32 data;            /* HW data match criteria.  */
   9452     uint32 mask;            /* HW data mask.            */
   9453     int rv;                 /* Operation return status. */
   9454     _field_entry_t *f_ent;  /* Field entry structure.   */
   9455 
   9456     /* Input parameters check. */
   9457     if (0 == BCM_GPORT_IS_VLAN_PORT(vlan_port_id)) {
   9458         return (BCM_E_PARAM);
   9459     }
   9460 
   9461     data  = BCM_GPORT_VLAN_PORT_ID_GET(vlan_port_id);
   9462     mask = (BCM_FIELD_EXACT_MATCH_MASK);
   9463 
   9464     
   9465 
   9466 
   9467     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
   9468                 bcmFieldQualifyDstVlanGport, &f_ent));
   9469 
   9470     FP_LOCK(unit);
   9471     rv = _field_control_get(unit, &fc);
   9472     if (BCM_FAILURE(rv)) {
   9473         FP_UNLOCK(unit);
   9474         return rv;
   9475     }
   9476 
   9477     /*
   9478      * Invoke driver function for multi pipe supported devices.
   9479      */
   9480 #if defined(BCM_TOMAHAWK_SUPPORT)
   9481     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
   9482         _BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) {
   9483         rv = fc->functions.fp_qualify_dvp(unit, entry,
   9484                                           bcmFieldQualifyDstVlanGport,
   9485                                           data, mask, 1);
   9486         FP_UNLOCK(unit);
   9487         return (rv);
   9488     }
   9489 #endif /* BCM_TOMAHAWK_SUPPORT */
   9490 
   9491     /* Check if entry belongs to Egress Stage. */
   9492     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
   9493         /*
   9494          * LSB is DVP valid bit.
   9495          * Shift DVP value by 1-bit,
   9496          */
   9497         data <<= 1;
   9498 
   9499         /* Set DVP Valid bit. */
   9500         data |= 1;
   9501     } else {
   9502         /* Qualify the destination type qualifier */
   9503         rv = _field_dest_type_qualify(unit, entry,
   9504                                       bcmFieldQualifyDstVlanGport, &data, &mask, 
   9505                                       _bcmFieldDestTypeNone);
   9506         if (BCM_FAILURE(rv)) {
   9507             FP_UNLOCK(unit);
   9508             return (rv);
   9509         }
   9510     }
   9511 
   9512     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstVlanGport,
   9513             data, mask);
   9514     FP_UNLOCK(unit);
   9515     return (rv);
   9516 }
   9517  
   9518  
   9519 
   9520 /*
   9521  * Function: 
   9522  *     bcm_esw_field_qualify_SrcClassL3
   9523  * Purpose:
   9524  *     Add Source L2 Class qualification data and mask to an entry.
   9525  * Parameters:
   9526  *     unit            - (IN) BCM unit number
   9527  *     entry           - (IN) Entry ID
   9528  *     data            - (IN) Source lookup class id. 
   9529  *     mask            - (IN) Source lookup class mask. 
   9530  * Returns:
   9531  *     BCM_E_XXX
   9532  */
   9533 int
   9534 bcm_esw_field_qualify_SrcClassL3(int unit, bcm_field_entry_t entry,
   9535                                      uint32 data, uint32 mask)
   9536 {
   9537     int                    rv;
   9538 
   9539 #if defined(BCM_TOMAHAWK_SUPPORT)
   9540     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   9541         BCM_IF_ERROR_RETURN
   9542               (_bcm_field_th_qualify_class(unit, entry,
   9543                                            bcmFieldQualifySrcClassL3,
   9544                                            &data, &mask));
   9545     } else
   9546 #endif /* BCM_TOMAHAWK_SUPPORT */
   9547 #ifdef BCM_TRIDENT2_SUPPORT
   9548     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
   9549         BCM_IF_ERROR_RETURN
   9550             (_bcm_field_td2_qualify_class(unit,
   9551                                           entry,
   9552                                           bcmFieldQualifySrcClassL3,
   9553                                           &data,
   9554                                           &mask
   9555                                           )
   9556             );
   9557     } else
   9558 #endif
   9559 #ifdef BCM_TRIUMPH3_SUPPORT
   9560     if (SOC_IS_TRIUMPH3(unit)) {
   9561         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
   9562                                                          entry,
   9563                                                          bcmFieldQualifySrcClassL3,
   9564                                                          &data,
   9565                                                          &mask
   9566                                                          )
   9567                             );
   9568     } else
   9569 #endif
   9570 #ifdef BCM_KATANA2_SUPPORT
   9571     if (SOC_IS_KATANA2(unit)) {
   9572         BCM_IF_ERROR_RETURN
   9573             (_bcm_field_kt2_qualify_class(unit,
   9574                                           entry,
   9575                                           bcmFieldQualifySrcClassL3,
   9576                                           &data,
   9577                                           &mask
   9578                                           ));
   9579     } else
   9580 #endif /* BCM_KATANA2_SUPPORT */
   9581         {
   9582             /* Input parameters check. */
   9583             if (data > SOC_ADDR_CLASS_MAX(unit)) {
   9584                 return (BCM_E_PARAM);
   9585             }
   9586         }
   9587     
   9588     
   9589     FP_LOCK(unit);
   9590 
   9591     rv = _field_qualify32(unit, entry, bcmFieldQualifySrcClassL3, 
   9592                             data, mask);
   9593     FP_UNLOCK(unit);
   9594     return (rv);
   9595 }
   9596 
   9597 /*
   9598  * Function: 
   9599  *     bcm_esw_field_qualify_SrcClassField
   9600  * Purpose:
   9601  *     Add Source Field Class qualification data and mask to an entry.
   9602  * Parameters:
   9603  *     unit            - (IN) BCM unit number
   9604  *     entry           - (IN) Entry ID
   9605  *     data            - (IN) Source lookup class id. 
   9606  *     mask            - (IN) Source lookup class mask. 
   9607  * Returns:
   9608  *     BCM_E_XXX
   9609  */
   9610 int
   9611 bcm_esw_field_qualify_SrcClassField(int unit, bcm_field_entry_t entry,
   9612                                     uint32 data, uint32 mask)
   9613 {
   9614     int                    rv;
   9615 
   9616 #if defined(BCM_TOMAHAWK_SUPPORT)
   9617     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   9618         BCM_IF_ERROR_RETURN
   9619           (_bcm_field_th_qualify_class(unit, entry,
   9620                                        bcmFieldQualifySrcClassField,
   9621                                        &data, &mask));
   9622     } else
   9623 #endif /* BCM_TOMAHAWK_SUPPORT */
   9624 #ifdef BCM_TRIDENT2_SUPPORT
   9625     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
   9626         BCM_IF_ERROR_RETURN
   9627             (_bcm_field_td2_qualify_class(unit,
   9628                                           entry,
   9629                                           bcmFieldQualifySrcClassField,
   9630                                           &data,
   9631                                           &mask
   9632                                           )
   9633             );
   9634     } else
   9635 #endif
   9636 #ifdef BCM_TRIUMPH3_SUPPORT
   9637     if (SOC_IS_TRIUMPH3(unit)) {
   9638         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
   9639                                                          entry,
   9640                                                          bcmFieldQualifySrcClassField,
   9641                                                          &data,
   9642                                                          &mask
   9643                                                          )
   9644                             );
   9645     } else
   9646 #endif    
   9647 #ifdef BCM_KATANA2_SUPPORT
   9648     if (SOC_IS_KATANA2(unit)) {
   9649         BCM_IF_ERROR_RETURN
   9650             (_bcm_field_kt2_qualify_class(unit,
   9651                                           entry,
   9652                                           bcmFieldQualifySrcClassField,
   9653                                           &data,
   9654                                           &mask
   9655                                           ));
   9656     } else
   9657 #endif /* BCM_KATANA2_SUPPORT */
   9658         {
   9659             /* Input parameters check. */
   9660             if (data > SOC_ADDR_CLASS_MAX(unit)) {
   9661                 return (BCM_E_PARAM);
   9662             }
   9663         }
   9664 
   9665     
   9666     FP_LOCK(unit);
   9667 
   9668     rv = _field_qualify32(unit, entry, bcmFieldQualifySrcClassField, 
   9669                           data, mask);
   9670     FP_UNLOCK(unit);
   9671     return (rv);
   9672 }
   9673 
   9674 
   9675 /*
   9676  * Function: 
   9677  *     bcm_esw_field_qualify_SrcClassL2
   9678  * Purpose:
   9679  *     Add Source Lookup Class qualification data and mask to an entry.
   9680  * Parameters:
   9681  *     unit            - (IN) BCM unit number
   9682  *     entry           - (IN) Entry ID
   9683  *     data            - (IN) Source lookup class id. 
   9684  *     mask            - (IN) Source lookup class mask. 
   9685  * Returns:
   9686  *     BCM_E_XXX
   9687  */
   9688 int
   9689 bcm_esw_field_qualify_SrcClassL2(int unit, bcm_field_entry_t entry,
   9690                                      uint32 data, uint32 mask)
   9691 {
   9692     int                    rv;
   9693 
   9694 #if defined(BCM_TOMAHAWK_SUPPORT)
   9695     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   9696         BCM_IF_ERROR_RETURN
   9697           (_bcm_field_th_qualify_class(unit, entry,
   9698                                        bcmFieldQualifySrcClassL2,
   9699                                        &data, &mask));
   9700     } else
   9701 #endif /* BCM_TOMAHAWK_SUPPORT */
   9702 #ifdef BCM_TRIDENT2_SUPPORT
   9703     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
   9704         BCM_IF_ERROR_RETURN
   9705             (_bcm_field_td2_qualify_class(unit,
   9706                                           entry,
   9707                                           bcmFieldQualifySrcClassL2,
   9708                                           &data,
   9709                                           &mask
   9710                                           )
   9711             );
   9712     } else
   9713 #endif
   9714 #ifdef BCM_TRIUMPH3_SUPPORT
   9715     if (SOC_IS_TRIUMPH3(unit)) {
   9716         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
   9717                                                          entry,
   9718                                                          bcmFieldQualifySrcClassL2,
   9719                                                          &data,
   9720                                                          &mask
   9721                                                          )
   9722                             );
   9723     } else
   9724 #endif
   9725 #ifdef BCM_KATANA2_SUPPORT
   9726     if (SOC_IS_KATANA2(unit)) {
   9727         BCM_IF_ERROR_RETURN
   9728             (_bcm_field_kt2_qualify_class(unit,
   9729                                           entry,
   9730                                           bcmFieldQualifySrcClassL2,
   9731                                           &data,
   9732                                           &mask
   9733                                           ));
   9734     } else
   9735 #endif /* BCM_KATANA2_SUPPORT */
   9736          {
   9737             /* Input parameters check. */
   9738             if (data > SOC_ADDR_CLASS_MAX(unit)) {
   9739                 return (BCM_E_PARAM);
   9740             }
   9741         }
   9742     
   9743     
   9744     FP_LOCK(unit);
   9745 
   9746     rv = _field_qualify32(unit, entry, bcmFieldQualifySrcClassL2, 
   9747                           data, mask);
   9748     FP_UNLOCK(unit);
   9749     return (rv);
   9750 }
   9751 
   9752 
   9753 /*
   9754  * Function: 
   9755  *     bcm_esw_field_qualify_DstClassL3
   9756  * Purpose:
   9757  *     Add Source L2 Class qualification data and mask to an entry.
   9758  * Parameters:
   9759  *     unit            - (IN) BCM unit number
   9760  *     entry           - (IN) Entry ID
   9761  *     data            - (IN) Source lookup class id. 
   9762  *     mask            - (IN) Source lookup class mask. 
   9763  * Returns:
   9764  *     BCM_E_XXX
   9765  */
   9766 int
   9767 bcm_esw_field_qualify_DstClassL3(int unit, bcm_field_entry_t entry,
   9768                                      uint32 data, uint32 mask)
   9769 {
   9770     int                    rv;
   9771 
   9772 #if defined(BCM_TOMAHAWK_SUPPORT)
   9773     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   9774         BCM_IF_ERROR_RETURN
   9775           (_bcm_field_th_qualify_class(unit, entry,
   9776                                        bcmFieldQualifyDstClassL3,
   9777                                        &data, &mask));
   9778     } else
   9779 #endif /* BCM_TOMAHAWK_SUPPORT */
   9780 #ifdef BCM_TRIDENT2_SUPPORT
   9781     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
   9782         BCM_IF_ERROR_RETURN
   9783             (_bcm_field_td2_qualify_class(unit,
   9784                                           entry,
   9785                                           bcmFieldQualifyDstClassL3,
   9786                                           &data,
   9787                                           &mask
   9788                                           )
   9789             );
   9790     } else
   9791 #endif
   9792 #ifdef BCM_TRIUMPH3_SUPPORT
   9793     if (SOC_IS_TRIUMPH3(unit)) {
   9794         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
   9795                                                          entry,
   9796                                                          bcmFieldQualifyDstClassL3,
   9797                                                          &data,
   9798                                                          &mask
   9799                                                          )
   9800                             );
   9801     } else
   9802 #endif
   9803 #ifdef BCM_KATANA2_SUPPORT
   9804     if (SOC_IS_KATANA2(unit)) {
   9805         BCM_IF_ERROR_RETURN
   9806             (_bcm_field_kt2_qualify_class(unit,
   9807                                           entry,
   9808                                           bcmFieldQualifyDstClassL3,
   9809                                           &data,
   9810                                           &mask
   9811                                           ));
   9812     } else
   9813 #endif /* BCM_KATANA2_SUPPORT */
   9814         {
   9815             /* Input parameters check. */
   9816             if (data > SOC_ADDR_CLASS_MAX(unit)) {
   9817                 return (BCM_E_PARAM);
   9818             }
   9819         }
   9820     
   9821     
   9822     FP_LOCK(unit);
   9823 
   9824     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstClassL3, 
   9825                           data, mask);
   9826     FP_UNLOCK(unit);
   9827     return (rv);
   9828 }
   9829 
   9830 /*
   9831  * Function: 
   9832  *     bcm_esw_field_qualify_DstClassField
   9833  * Purpose:
   9834  *     Add Source Field Class qualification data and mask to an entry.
   9835  * Parameters:
   9836  *     unit            - (IN) BCM unit number
   9837  *     entry           - (IN) Entry ID
   9838  *     data            - (IN) Source lookup class id. 
   9839  *     mask            - (IN) Source lookup class mask. 
   9840  * Returns:
   9841  *     BCM_E_XXX
   9842  */
   9843 int
   9844 bcm_esw_field_qualify_DstClassField(int unit, bcm_field_entry_t entry,
   9845                                     uint32 data, uint32 mask)
   9846 {
   9847     int                    rv;
   9848 
   9849 #if defined(BCM_TOMAHAWK_SUPPORT)
   9850     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   9851         BCM_IF_ERROR_RETURN
   9852           (_bcm_field_th_qualify_class(unit, entry,
   9853                                        bcmFieldQualifyDstClassField,
   9854                                        &data, &mask));
   9855     } else
   9856 #endif /* BCM_TOMAHAWK_SUPPORT */
   9857 #ifdef BCM_TRIDENT2_SUPPORT
   9858     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
   9859         BCM_IF_ERROR_RETURN
   9860             (_bcm_field_td2_qualify_class(unit,
   9861                                           entry,
   9862                                           bcmFieldQualifyDstClassField,
   9863                                           &data,
   9864                                           &mask
   9865                                           )
   9866             );
   9867     } else
   9868 #endif
   9869 #ifdef BCM_TRIUMPH3_SUPPORT
   9870     if (SOC_IS_TRIUMPH3(unit)) {
   9871         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
   9872                                                          entry,
   9873                                                          bcmFieldQualifyDstClassField,
   9874                                                          &data,
   9875                                                          &mask
   9876                                                          )
   9877                             );
   9878     } else
   9879 #endif
   9880  #ifdef BCM_KATANA2_SUPPORT
   9881     if (SOC_IS_KATANA2(unit)) {
   9882         BCM_IF_ERROR_RETURN
   9883             (_bcm_field_kt2_qualify_class(unit,
   9884                                           entry,
   9885                                           bcmFieldQualifyDstClassField,
   9886                                           &data,
   9887                                           &mask
   9888                                           ));
   9889     } else
   9890 #endif /* BCM_KATANA2_SUPPORT */
   9891         {
   9892             /* Input parameters check. */
   9893             if (data > SOC_ADDR_CLASS_MAX(unit)) {
   9894                 return (BCM_E_PARAM);
   9895             }
   9896         }
   9897 
   9898     
   9899     FP_LOCK(unit);
   9900 
   9901     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstClassField, 
   9902                           data, mask);
   9903     FP_UNLOCK(unit);
   9904     return (rv);
   9905 }
   9906 
   9907 
   9908 /*
   9909  * Function: 
   9910  *     bcm_esw_field_qualify_DstClassL2
   9911  * Purpose:
   9912  *     Add Source Lookup Class qualification data and mask to an entry.
   9913  * Parameters:
   9914  *     unit            - (IN) BCM unit number
   9915  *     entry           - (IN) Entry ID
   9916  *     data            - (IN) Source lookup class id. 
   9917  *     mask            - (IN) Source lookup class mask. 
   9918  * Returns:
   9919  *     BCM_E_XXX
   9920  */
   9921 int
   9922 bcm_esw_field_qualify_DstClassL2(int unit, bcm_field_entry_t entry,
   9923                                      uint32 data, uint32 mask)
   9924 {
   9925     int                    rv;
   9926 
   9927 #if defined(BCM_TOMAHAWK_SUPPORT)
   9928     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   9929         BCM_IF_ERROR_RETURN
   9930           (_bcm_field_th_qualify_class(unit, entry,
   9931                                        bcmFieldQualifyDstClassL2,
   9932                                        &data, &mask));
   9933     } else
   9934 #endif /* BCM_TOMAHAWK_SUPPORT */
   9935 #ifdef BCM_TRIDENT2_SUPPORT
   9936     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
   9937         BCM_IF_ERROR_RETURN
   9938             (_bcm_field_td2_qualify_class(unit,
   9939                                           entry,
   9940                                           bcmFieldQualifyDstClassL2,
   9941                                           &data,
   9942                                           &mask
   9943                                           )
   9944             );
   9945     } else
   9946 #endif
   9947 #ifdef BCM_TRIUMPH3_SUPPORT
   9948     if (SOC_IS_TRIUMPH3(unit)) {
   9949         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
   9950                                                          entry,
   9951                                                          bcmFieldQualifyDstClassL2,
   9952                                                          &data,
   9953                                                          &mask
   9954                                                          )
   9955                             );
   9956     } else
   9957 #endif
   9958 #ifdef BCM_KATANA2_SUPPORT
   9959     if (SOC_IS_KATANA2(unit)) {
   9960         BCM_IF_ERROR_RETURN
   9961             (_bcm_field_kt2_qualify_class(unit,
   9962                                           entry,
   9963                                           bcmFieldQualifyDstClassL2,
   9964                                           &data,
   9965                                           &mask
   9966                                           ));
   9967     } else
   9968 #endif /* BCM_KATANA2_SUPPORT */
   9969 
   9970         {
   9971             /* Input parameters check. */
   9972             if (data > SOC_ADDR_CLASS_MAX(unit)) {
   9973                 return (BCM_E_PARAM);
   9974             }
   9975         }
   9976 
   9977     
   9978     FP_LOCK(unit);
   9979 
   9980     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstClassL2, 
   9981                           data, mask);
   9982     FP_UNLOCK(unit);
   9983     return (rv);
   9984 }
   9985 
   9986 
   9987 /*
   9988  * Function: bcm_esw_field_qualify_InnerIpType
   9989  *
   9990  * Purpose:
   9991  *     Add qualification data to an entry for IP Type.
   9992  *
   9993  * Parameters:
   9994  *     unit     - BCM unit number
   9995  *     entry    - Entry ID
   9996  *     type     - Ip type
   9997  *
   9998  * Returns:
   9999  *     BCM_E_XXX
  10000  */
  10001 int
  10002 bcm_esw_field_qualify_InnerIpType(int unit, bcm_field_entry_t entry,
  10003                              bcm_field_IpType_t type)
  10004 {
  10005     _field_entry_t      *f_ent;
  10006     _field_control_t    *fc;
  10007     int                 rv;
  10008 
  10009     if (type >= bcmFieldIpTypeCount) {
  10010         return (BCM_E_PARAM);
  10011     }
  10012 
  10013     
  10014     FP_LOCK(unit);
  10015     rv = _field_control_get(unit, &fc);
  10016     if (BCM_FAILURE(rv)) {
  10017         FP_UNLOCK(unit);
  10018         return rv;
  10019     }
  10020 
  10021     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  10022 
  10023     if (BCM_FAILURE(rv)) {
  10024         FP_UNLOCK(unit);
  10025         return (rv);
  10026     }
  10027 
  10028     rv = fc->functions.fp_qualify_ip_type(unit, entry, type, 
  10029                                           bcmFieldQualifyInnerIpType);
  10030     
  10031     FP_UNLOCK(unit);
  10032     return (rv);
  10033 }
  10034 
  10035 /*
  10036  * Function: bcm_esw_field_qualify_ForwardingType
  10037  *
  10038  * Purpose:
  10039  *     Add qualification data to an entry for IP Type.
  10040  *
  10041  * Parameters:
  10042  *     unit     - (IN) BCM unit number.
  10043  *     entry    - (IN) Entry ID.
  10044  *     type     - (IN) Forwarding type.
  10045  *
  10046  * Returns:
  10047  *     BCM_E_XXX
  10048  */
  10049 int
  10050 bcm_esw_field_qualify_ForwardingType(int unit, bcm_field_entry_t entry,
  10051                                      bcm_field_ForwardingType_t type)
  10052 {
  10053     _field_stage_id_t stage_id;
  10054     int               rv;       /* Operation return structure. */
  10055     uint32            data = 0; /* HW qualifier value.         */
  10056     uint32            mask = 0; /* HW qualifier mask.          */
  10057 
  10058     if (type >= bcmFieldForwardingTypeCount) {
  10059         return (BCM_E_PARAM);
  10060     }
  10061 
  10062     
  10063 
  10064 #if defined(BCM_TOMAHAWK_SUPPORT)
  10065     if (soc_feature(unit, soc_feature_field_preselector_support) && 
  10066         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
  10067         stage_id = _BCM_FIELD_STAGE_INGRESS;
  10068     } else
  10069 #endif /* BCM_TOMAHAWK_SUPPORT */
  10070     {
  10071        _field_entry_t *f_ent;
  10072 
  10073        /* Retrieve Field entry structure. */
  10074        BCM_IF_ERROR_RETURN(_field_entry_get(unit, entry,
  10075                                _FP_ENTRY_PRIMARY, &f_ent));
  10076 
  10077        stage_id = f_ent->group->stage_id;
  10078     }
  10079 
  10080     switch (stage_id) {
  10081     case _BCM_FIELD_STAGE_INGRESS:
  10082     case _BCM_FIELD_STAGE_EXACTMATCH:
  10083     case _BCM_FIELD_STAGE_FLOWTRACKER:
  10084 #if defined(BCM_TOMAHAWK_SUPPORT)
  10085         if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  10086 #if defined(BCM_TRIDENT3_SUPPORT)
  10087             if (soc_feature(unit, soc_feature_td3_style_fp)) {
  10088                BCM_IF_ERROR_RETURN
  10089                     (_bcm_field_td3_forwardingType_set(unit, stage_id, entry, type,
  10090                                                &data, &mask));
  10091             } else
  10092 #endif
  10093 #if defined(BCM_TOMAHAWK3_SUPPORT)
  10094             if (soc_feature(unit, soc_feature_fp_no_dvp_support)) {
  10095                BCM_IF_ERROR_RETURN
  10096                     (_bcm_field_th3_forwardingType_set(unit, stage_id, entry, type,
  10097                                                &data, &mask));
  10098             } else
  10099 #endif
  10100             {
  10101            BCM_IF_ERROR_RETURN
  10102              (_bcm_field_th_forwardingType_set(unit, stage_id, entry, type,
  10103                                                &data, &mask));
  10104             }
  10105         } else
  10106 #endif /* BCM_TOMAHAWK_SUPPORT */
  10107         {
  10108           switch (type) {
  10109             case bcmFieldForwardingTypeAny:
  10110                 data = 0;
  10111                 mask = 0;
  10112                 break;
  10113             case bcmFieldForwardingTypeL2:
  10114                 data = 0;
  10115                 mask = 6;
  10116                 break;
  10117             case bcmFieldForwardingTypeL2Independent:
  10118                 data = 0;
  10119                 mask = 7;
  10120                 break;
  10121             case bcmFieldForwardingTypeL2Shared:
  10122                 data = 1;
  10123                 mask = 7;
  10124                 break;
  10125             case bcmFieldForwardingTypeL2Vpn:
  10126                 data = 2;
  10127                 mask = 7;
  10128                 break;
  10129             case bcmFieldForwardingTypeL2VpnDirect:
  10130                 data = 3;
  10131                 mask = 7;
  10132                 break;
  10133             case bcmFieldForwardingTypeL3Direct:
  10134                 data = 4;
  10135                 mask = 7;
  10136                 break;
  10137             case bcmFieldForwardingTypeL3:
  10138                 data = 5;
  10139                 mask = 7;
  10140                 break;
  10141             case bcmFieldForwardingTypeMpls:
  10142                 data = 7;
  10143                 mask = 7;
  10144                 break;
  10145             default:
  10146                return (BCM_E_PARAM);
  10147           }
  10148         }
  10149         break;
  10150 
  10151     case _BCM_FIELD_STAGE_EXTERNAL:
  10152         /* N.B. Currently only supported on Triumph2 */
  10153 
  10154         switch (type) {
  10155         case bcmFieldForwardingTypeAny:
  10156             data = 0;
  10157             mask = 0;
  10158             break;
  10159         case bcmFieldForwardingTypeL2:
  10160             data = 0;
  10161             mask = 1;
  10162 #ifdef BCM_TRIUMPH3_SUPPORT
  10163             if (SOC_IS_TRIUMPH3(unit)) {
  10164                 mask = 0x3;
  10165             }
  10166 #endif
  10167             break;
  10168         case bcmFieldForwardingTypeL2Vpn:
  10169             data = 1;
  10170             mask = 1;
  10171 #ifdef BCM_TRIUMPH3_SUPPORT
  10172             if (SOC_IS_TRIUMPH3(unit)) {
  10173                 mask = 0x3;
  10174             }
  10175 #endif
  10176             break;
  10177 #ifdef BCM_TRIUMPH3_SUPPORT
  10178         case bcmFieldForwardingTypeL3:
  10179             if (SOC_IS_TRIUMPH3(unit)) {
  10180                 data = 0x2;
  10181                 mask = 0x3;
  10182             } else {
  10183                 return (BCM_E_PARAM);
  10184             }
  10185             break;
  10186 #endif
  10187         default:
  10188             return (BCM_E_PARAM);
  10189         }
  10190 
  10191         break;
  10192 
  10193     case _BCM_FIELD_STAGE_EGRESS:
  10194 
  10195 #ifdef BCM_TRIUMPH3_SUPPORT
  10196         /* Currently supported for some devices. For other devices, the default
  10197          * case hits and BCM_E_INTERNAL is returned
  10198          */
  10199         if ((SOC_IS_KATANA2(unit)) || (SOC_IS_TRIUMPH3(unit)) ||
  10200             (SOC_IS_TD2_TT2(unit))) {
  10201             switch (type) {
  10202                 case bcmFieldForwardingTypeAny:
  10203                     data = 0;
  10204                     mask = 0;
  10205                     break;
  10206                 case bcmFieldForwardingTypeL2Independent:
  10207                     data = 1;
  10208                     mask = 3;
  10209                     break;
  10210                 case bcmFieldForwardingTypeL2Vpn:
  10211                     data = 2;
  10212                     mask = 3;
  10213                     break;
  10214                 case bcmFieldForwardingTypeL3:
  10215                     data = 3;
  10216                     mask = 3;
  10217                     break;
  10218                 default:
  10219                     return (BCM_E_PARAM);
  10220             }
  10221 
  10222             break;
  10223         }
  10224 #endif
  10225 
  10226     default:
  10227         return (BCM_E_INTERNAL);
  10228     }
  10229 
  10230     FP_LOCK(unit);
  10231 
  10232     rv = _field_qualify32(unit, entry, bcmFieldQualifyForwardingType, 
  10233                           data, mask);
  10234 
  10235     FP_UNLOCK(unit);
  10236 
  10237     return (rv);
  10238 }
  10239 
  10240 /*
  10241  * Function: bcm_esw_field_qualify_IpType
  10242  *
  10243  * Purpose:
  10244  *     Add qualification data to an entry for IP Type.
  10245  *
  10246  * Parameters:
  10247  *     unit     - BCM unit number
  10248  *     entry    - Entry ID
  10249  *     type     - Ip type
  10250  *
  10251  * Returns:
  10252  *     BCM_E_XXX
  10253  */
  10254 int
  10255 bcm_esw_field_qualify_IpType(int unit, bcm_field_entry_t entry,
  10256                              bcm_field_IpType_t type)
  10257 {
  10258     _field_control_t    *fc;
  10259     int                 rv;
  10260 
  10261     if (type >= bcmFieldIpTypeCount) {
  10262         return (BCM_E_PARAM);
  10263     }
  10264     
  10265     FP_LOCK(unit);
  10266     rv = _field_control_get(unit, &fc);
  10267     if (BCM_FAILURE(rv)) {
  10268         FP_UNLOCK(unit);
  10269         return rv;
  10270     }
  10271 
  10272 #if defined(BCM_TOMAHAWK_SUPPORT)
  10273     if ((soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  10274          soc_feature(unit, soc_feature_field_preselector_support) &&
  10275          (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == FALSE)) ||
  10276         (!(soc_feature(unit, soc_feature_field_multi_pipe_support))))
  10277 #endif
  10278     {
  10279        _field_entry_t      *f_ent = NULL;  /* Field entry structure.   */
  10280        _field_group_t      *f_grp = NULL;  /* Field group structure.   */
  10281 
  10282        rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  10283        if (BCM_FAILURE(rv)){
  10284           FP_UNLOCK(unit);
  10285           return (rv);
  10286        }
  10287        f_grp = f_ent->group;
  10288        if (BCM_FIELD_QSET_TEST(f_grp->qset, bcmFieldQualifyIp4) &&
  10289                 (0 ==BCM_FIELD_QSET_TEST(f_grp->qset, bcmFieldQualifyIp6) )) {
  10290             if ((type >= bcmFieldIpTypeIpv6NoExtHdr) && (type <= bcmFieldIpTypeIpv6)) {
  10291                  /* Qset is set with Ip4*/
  10292                  FP_UNLOCK(unit);
  10293                  return (BCM_E_PARAM);
  10294             }
  10295         } else if (BCM_FIELD_QSET_TEST(f_grp->qset, bcmFieldQualifyIp6) &&
  10296                  (0 == BCM_FIELD_QSET_TEST(f_grp->qset, bcmFieldQualifyIp4))) {
  10297             if ((type >= bcmFieldIpTypeIpv4NoOpts) && (type <= bcmFieldIpTypeIpv4Any)) {
  10298                  /* Qset is set with Ip6*/
  10299                  FP_UNLOCK(unit);
  10300                  return (BCM_E_PARAM);
  10301             }
  10302        }
  10303     }
  10304     rv = fc->functions.fp_qualify_ip_type(unit, entry, type,
  10305                                           bcmFieldQualifyIpType);
  10306     FP_UNLOCK(unit);
  10307     return (rv);
  10308 }
  10309 
  10310 /*
  10311  * Function: bcm_esw_field_qualify_L2Format
  10312  *
  10313  * Purpose:
  10314  *     Add qualification data to an entry for L2 Format.
  10315  *
  10316  * Parameters:
  10317  *     unit     - (IN) BCM unit number.
  10318  *     entry    - (IN) Entry id.
  10319  *     type     - (IN) Ehternet frame type.
  10320  *
  10321  * Returns:
  10322  *     BCM_E_XXX 
  10323  */
  10324 int
  10325 bcm_esw_field_qualify_L2Format(int unit, bcm_field_entry_t entry,
  10326                                bcm_field_L2Format_t type)
  10327 {
  10328     uint32              data;    /* L2 format encoding.      */
  10329     uint32              mask;    /* L2 format mask.          */
  10330     int                 rv;      /* Operation return status. */
  10331 
  10332     if (type >= bcmFieldL2FormatCount) {
  10333         return (BCM_E_PARAM);
  10334     }
  10335 
  10336     
  10337     FP_LOCK(unit);
  10338 
  10339     switch (type) {
  10340       case bcmFieldL2FormatAny:
  10341           data = 0x0;
  10342           mask = 0x0;
  10343           break; 
  10344       case bcmFieldL2FormatEthII:
  10345           data = 0x0;
  10346           mask = 0x3;
  10347           break;
  10348       case bcmFieldL2FormatSnap:
  10349           if ((soc_feature(unit, soc_feature_td3_style_fp)) &&
  10350               !soc_feature(unit, soc_feature_snap)) {
  10351               FP_UNLOCK(unit);
  10352               return BCM_E_PARAM;
  10353           }
  10354           data = 0x1;
  10355           mask = 0x3;
  10356           break;
  10357       case bcmFieldL2FormatLlc:
  10358       case bcmFieldL2Format802dot3:
  10359           data = 0x2;
  10360           mask = 0x3;
  10361           break;
  10362       default:
  10363           FP_UNLOCK(unit);
  10364           LOG_ERROR(BSL_LS_BCM_FP,
  10365                     (BSL_META_U(unit,
  10366                                 "FP(unit %d) Error: %d not supported\n"),
  10367                      unit, type));
  10368           return (BCM_E_UNAVAIL);
  10369     }
  10370     rv = _field_qualify32(unit, entry, bcmFieldQualifyL2Format, data, mask);
  10371     FP_UNLOCK(unit);
  10372     return (rv);
  10373 }
  10374 
  10375 
  10376 /*
  10377  * Function: bcm_esw_field_qualify_VlanFormat
  10378  *
  10379  * Purpose:
  10380  *     Add qualification data to an entry for Vlan Tag Format.
  10381  *
  10382  * Parameters:
  10383  *     unit     - (IN) BCM unit number.
  10384  *     entry    - (IN) Entry ID.
  10385  *     data     - (IN) Outer & Inner tag presence info.
  10386  *     mask     - (IN) Data mask.
  10387  * Returns:
  10388  *     BCM_E_XXX
  10389  */
  10390 int
  10391 bcm_esw_field_qualify_VlanFormat(int unit, bcm_field_entry_t entry,
  10392                                  uint8 data, uint8 mask)
  10393 {
  10394     int                 rv;      /* Operation return status. */
  10395 
  10396     
  10397     FP_LOCK(unit);
  10398     rv = _field_qualify_VlanFormat(unit, entry, bcmFieldQualifyVlanFormat,
  10399                                    data, mask);
  10400 
  10401     FP_UNLOCK(unit);
  10402     return (rv);
  10403 }
  10404 
  10405 
  10406 /*
  10407  * Function: bcm_esw_field_qualify_MHOpcode
  10408  *
  10409  * Purpose:
  10410  *     Add qualification data to an entry for mh opcode. 
  10411  *
  10412  * Parameters:
  10413  *     unit     - (IN) BCM unit number.
  10414  *     entry    - (IN) Entry ID.
  10415  *     data     - (IN) Outer & Inner tag presence info.
  10416  *     mask     - (IN) Data mask.
  10417  * Returns:
  10418  *     BCM_E_XXX     
  10419  */
  10420 int
  10421 bcm_esw_field_qualify_MHOpcode(int unit, bcm_field_entry_t entry,
  10422                                uint8 data, uint8 mask)
  10423 {
  10424     int                 rv;      /* Operation return status. */
  10425 
  10426     if (data > BCM_FIELD_MHOPCODE_IPMULTICAST) {
  10427         LOG_ERROR(BSL_LS_BCM_FP,
  10428                   (BSL_META_U(unit,
  10429                               "FP(unit %d) Error: data=%d too large.\n"),
  10430                    unit, data));
  10431         return (BCM_E_PARAM);
  10432     }
  10433 
  10434     
  10435     FP_LOCK(unit);
  10436 
  10437     rv = _field_qualify32(unit, entry, bcmFieldQualifyMHOpcode, data, mask);
  10438 
  10439     FP_UNLOCK(unit);
  10440     return (rv);
  10441 }
  10442 
  10443 /*
  10444  * Function:
  10445  *     bcm_esw_field_qualify_Decap
  10446  * Purpose:
  10447  *     Set DECAP qualification data to an entry.
  10448  * Parameters:
  10449  *     unit  - (IN) Unit number.
  10450  *     entry - (IN) BCM field entry id.
  10451  *     decap - (IN) Decap type to qualify on
  10452  * Returns:
  10453  *     BCM_E_NONE   - Success
  10454  *     BCM_E_PARAM  - invalid decap value
  10455  */
  10456 int
  10457 bcm_esw_field_qualify_Decap(int unit, bcm_field_entry_t entry,
  10458                             bcm_field_decap_t decap)
  10459 {
  10460     int rv = BCM_E_UNAVAIL;
  10461 #ifdef BCM_GREYHOUND2_SUPPORT
  10462     uint32 data = 0;  /* HW data match criteria */
  10463     uint32 mask = 0;  /* HW data mask */
  10464 
  10465     if (soc_feature(unit, soc_feature_vxlan_lite_riot)) {
  10466         /* Range check decap value */
  10467         if ((decap < bcmFieldDecapNone) ||
  10468             (decap >= bcmFieldDecapCount)) {
  10469             return BCM_E_PARAM;
  10470         }
  10471 
  10472         /* Check for valid decap value */
  10473         switch (decap) {
  10474             case bcmFieldDecapNone:
  10475                 data = 0x0;
  10476                 mask = 0x1;
  10477                 break;
  10478             case bcmFieldDecapVxlan:
  10479                 data = 0x1;
  10480                 mask = 0x1;
  10481                 break;
  10482             default:
  10483                 return BCM_E_PARAM;
  10484         }
  10485 
  10486         FP_LOCK(unit);
  10487         rv = _field_qualify32(unit, entry, bcmFieldQualifyDecap,
  10488                               data, mask);
  10489         FP_UNLOCK(unit);
  10490     }
  10491 #endif /* BCM_GREYHOUND2_SUPPORT */
  10492 
  10493     return rv;
  10494 }
  10495 
  10496 /*
  10497  * Function:
  10498  *     bcm_esw_field_qualify_InterfaceClassMplsLookup1_get
  10499  *
  10500  * Purpose:
  10501  *    To get qualified inputs on Class identifier derived from MPLS label 1 entry Lookup
  10502  *
  10503  * Parameters:
  10504  *    unit     BCM device number
  10505  *    entry    Field entry ID
  10506  *    data     Qualifier match data
  10507  *    mask     Qualifier match mask
  10508  *
  10509  * Returns:
  10510  *    BCM_E_NONE        Operation completed successfully
  10511  *    BCM_E_INIT        BCM unit not initialized
  10512  *    BCM_E_PARAM       Invalid Parameter passed
  10513  *    BCM_E_NOT_FOUND   Entry ID not found
  10514  */
  10515 int
  10516 bcm_esw_field_qualify_InterfaceClassMplsLookup1_get(
  10517                         int unit,
  10518                         bcm_field_entry_t entry_id,
  10519                         uint16 *data,
  10520                         uint16 *mask)
  10521 {
  10522     int rv = BCM_E_UNAVAIL;
  10523 #if defined(BCM_TRIDENT3_SUPPORT)
  10524     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  10525         FP_LOCK(unit);
  10526         /* Read qualifier match value and mask. */ 
  10527         rv = _bcm_field_entry_qualifier_uint16_get(unit,
  10528                                                    entry_id, 
  10529                                                    bcmFieldQualifyInterfaceClassMplsLookup1,
  10530                                                    data,
  10531                                                    mask);
  10532         FP_UNLOCK(unit);
  10533     }
  10534 #endif
  10535     return rv;
  10536 }
  10537 
  10538 /*
  10539  * Function:
  10540  *     bcm_esw_field_qualify_InterfaceClassMplsLookup2_get
  10541  *
  10542  * Purpose:
  10543  *    To get qualified inputs on Class identifier derived from MPLS label 2 entry Lookup
  10544  *
  10545  * Parameters:
  10546  *    unit     BCM device number
  10547  *    entry    Field entry ID
  10548  *    data     Qualifier match data
  10549  *    mask     Qualifier match mask
  10550  *
  10551  * Returns:
  10552  *    BCM_E_NONE        Operation completed successfully
  10553  *    BCM_E_INIT        BCM unit not initialized
  10554  *    BCM_E_PARAM       Invalid Parameter passed
  10555  *    BCM_E_NOT_FOUND   Entry ID not found
  10556  */
  10557 int
  10558 bcm_esw_field_qualify_InterfaceClassMplsLookup2_get(
  10559         int unit,
  10560         bcm_field_entry_t entry_id,
  10561         uint16 *data,
  10562         uint16 *mask)
  10563 {
  10564     int rv = BCM_E_UNAVAIL;
  10565 #if defined(BCM_TRIDENT3_SUPPORT)
  10566     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  10567         FP_LOCK(unit);
  10568         /* Read qualifier match value and mask. */ 
  10569         rv = _bcm_field_entry_qualifier_uint16_get(unit,
  10570                                                    entry_id,
  10571                                                    bcmFieldQualifyInterfaceClassMplsLookup2,
  10572                                                    data,
  10573                                                    mask);
  10574         FP_UNLOCK(unit);
  10575     }
  10576 #endif
  10577     return rv;
  10578 }
  10579 
  10580 /*
  10581  * Function:
  10582  *     bcm_esw_field_qualify_InterfaceClassMplsLookup3_get
  10583  *
  10584  * Purpose:
  10585  *    To get qualified inputs on Class identifier derived from MPLS label 3 entry Lookup
  10586  *
  10587  * Parameters:
  10588  *    unit     BCM device number
  10589  *    entry    Field entry ID
  10590  *    data     Qualifier match data
  10591  *    mask     Qualifier match mask
  10592  *
  10593  * Returns:
  10594  *    BCM_E_NONE        Operation completed successfully
  10595  *    BCM_E_INIT        BCM unit not initialized
  10596  *    BCM_E_PARAM       Invalid Parameter passed
  10597  *    BCM_E_NOT_FOUND   Entry ID not found
  10598  */
  10599 int
  10600 bcm_esw_field_qualify_InterfaceClassMplsLookup3_get(
  10601         int unit,
  10602         bcm_field_entry_t entry_id,
  10603         uint16 *data,
  10604         uint16 *mask)
  10605 {
  10606     return BCM_E_UNAVAIL;
  10607 }
  10608 
  10609 /*
  10610  * Function:
  10611  *     bcm_esw_field_qualify_InterfaceClassL3Tunnel_get
  10612  *
  10613  * Purpose:
  10614  *    To get qualified inputs on Class identifier derived from L3 Tunnel
  10615  *
  10616  * Parameters:
  10617  *    unit     BCM device number
  10618  *    entry    Field entry ID
  10619  *    data     Qualifier match data
  10620  *    mask     Qualifier match mask
  10621  *
  10622  * Returns:
  10623  *    BCM_E_NONE        Operation completed successfully
  10624  *    BCM_E_INIT        BCM unit not initialized
  10625  *    BCM_E_PARAM       Invalid Parameter passed
  10626  *    BCM_E_NOT_FOUND   Entry ID not found
  10627  */
  10628 int
  10629 bcm_esw_field_qualify_InterfaceClassL3Tunnel_get(
  10630         int unit,
  10631         bcm_field_entry_t entry_id,
  10632         uint16 *data,
  10633         uint16 *mask)
  10634 {
  10635     int rv = BCM_E_UNAVAIL;
  10636 #if defined(BCM_TRIDENT3_SUPPORT)
  10637     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  10638         FP_LOCK(unit);
  10639         /* Read qualifier match value and mask. */ 
  10640         rv = _bcm_field_entry_qualifier_uint16_get(unit,
  10641                                                    entry_id,
  10642                                                    bcmFieldQualifyInterfaceClassL3Tunnel,
  10643                                                    data,
  10644                                                    mask);
  10645         FP_UNLOCK(unit);
  10646     }
  10647 #endif
  10648     return rv;
  10649 }
  10650 
  10651 /*
  10652  * Function:
  10653  *     bcm_esw_field_qualify_InterfaceClassMplsLookup1
  10654  *
  10655  * Purpose:
  10656  *    To qualify on Class identifier derived from MPLS label 1 entry Lookup
  10657  *
  10658  * Parameters:
  10659  *    unit     BCM device number
  10660  *    entry    Field entry ID
  10661  *    data     Qualifier match data
  10662  *    mask     Qualifier match mask
  10663  *
  10664  * Returns:
  10665  *    BCM_E_NONE        Operation completed successfully
  10666  *    BCM_E_INIT        BCM unit not initialized
  10667  *    BCM_E_PARAM       Invalid Parameter passed
  10668  *    BCM_E_NOT_FOUND   Entry ID not found
  10669  */
  10670 int
  10671 bcm_esw_field_qualify_InterfaceClassMplsLookup1(
  10672         int unit,
  10673         bcm_field_entry_t entry_id,
  10674         uint16 data,
  10675         uint16 mask)
  10676 {
  10677     int rv = BCM_E_UNAVAIL;
  10678 #if defined(BCM_TRIDENT3_SUPPORT)
  10679     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  10680         if (data >> 12) {
  10681             return (BCM_E_PARAM);
  10682         }
  10683         FP_LOCK(unit);
  10684         rv = _field_qualify32(unit,
  10685                               entry_id,
  10686                               bcmFieldQualifyInterfaceClassMplsLookup1,
  10687                               data,
  10688                               mask);
  10689         FP_UNLOCK(unit);
  10690     }
  10691 #endif
  10692     return rv;
  10693 }
  10694 
  10695 /*
  10696  * Function:
  10697  *     bcm_esw_field_qualify_InterfaceClassMplsLookup2
  10698  *
  10699  * Purpose:
  10700  *    To qualify on Class identifier derived from MPLS label 2 entry Lookup
  10701  *
  10702  * Parameters:
  10703  *    unit     BCM device number
  10704  *    entry    Field entry ID
  10705  *    data     Qualifier match data
  10706  *    mask     Qualifier match mask
  10707  *
  10708  * Returns:
  10709  *    BCM_E_NONE        Operation completed successfully
  10710  *    BCM_E_INIT        BCM unit not initialized
  10711  *    BCM_E_PARAM       Invalid Parameter passed
  10712  *    BCM_E_NOT_FOUND   Entry ID not found
  10713  */
  10714 int
  10715 bcm_esw_field_qualify_InterfaceClassMplsLookup2(
  10716         int unit,
  10717         bcm_field_entry_t entry_id,
  10718         uint16 data,
  10719         uint16 mask)
  10720 {
  10721     int rv = BCM_E_UNAVAIL;
  10722 #if defined(BCM_TRIDENT3_SUPPORT)
  10723     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  10724         if (data >> 12) {
  10725             return (BCM_E_PARAM);
  10726         }
  10727         FP_LOCK(unit);
  10728         rv = _field_qualify32(unit,
  10729                               entry_id,
  10730                               bcmFieldQualifyInterfaceClassMplsLookup2,
  10731                               data,
  10732                               mask);
  10733         FP_UNLOCK(unit);
  10734     }
  10735 #endif
  10736     return rv;
  10737 }
  10738 
  10739 /*
  10740  * Function:
  10741  *     bcm_esw_field_qualify_InterfaceClassMplsLookup3
  10742  *
  10743  * Purpose:
  10744  *    To qualify on Class identifier derived from MPLS label 3 entry Lookup
  10745  *
  10746  * Parameters:
  10747  *    unit     BCM device number
  10748  *    entry    Field entry ID
  10749  *    data     Qualifier match data
  10750  *    mask     Qualifier match mask
  10751  *
  10752  * Returns:
  10753  *    BCM_E_NONE        Operation completed successfully
  10754  *    BCM_E_INIT        BCM unit not initialized
  10755  *    BCM_E_PARAM       Invalid Parameter passed
  10756  *    BCM_E_NOT_FOUND   Entry ID not found
  10757  */
  10758 int
  10759 bcm_esw_field_qualify_InterfaceClassMplsLookup3(
  10760         int unit,
  10761         bcm_field_entry_t entry_id,
  10762         uint16 data,
  10763         uint16 mask)
  10764 {
  10765     return BCM_E_UNAVAIL;
  10766 }
  10767 /*
  10768  * Function:
  10769  *     bcm_esw_field_qualify_InterfaceClassL3Tunnel
  10770  *
  10771  * Purpose:
  10772  *    To qualify on Class identifier derived from L3 Tunnel
  10773  *
  10774  * Parameters:
  10775  *    unit     BCM device number
  10776  *    entry    Field entry ID
  10777  *    data     Qualifier match data
  10778  *    mask     Qualifier match mask
  10779  *
  10780  * Returns:
  10781  *    BCM_E_NONE        Operation completed successfully
  10782  *    BCM_E_INIT        BCM unit not initialized
  10783  *    BCM_E_PARAM       Invalid Parameter passed
  10784  *    BCM_E_NOT_FOUND   Entry ID not found
  10785  */
  10786 int
  10787 bcm_esw_field_qualify_InterfaceClassL3Tunnel(
  10788         int unit,
  10789         bcm_field_entry_t entry_id,
  10790         uint16 data,
  10791         uint16 mask)
  10792 {
  10793     int rv = BCM_E_UNAVAIL;
  10794 #if defined(BCM_TRIDENT3_SUPPORT)
  10795     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  10796         if (data >> 12) {
  10797             return (BCM_E_PARAM);
  10798         }
  10799         FP_LOCK(unit);
  10800         rv = _field_qualify32(unit,
  10801                               entry_id,
  10802                               bcmFieldQualifyInterfaceClassL3Tunnel,
  10803                               data,
  10804                               mask);
  10805         FP_UNLOCK(unit);
  10806     }
  10807 #endif
  10808     return rv;
  10809 }
  10810 
  10811 
  10812 /*
  10813  * Function:
  10814  *    bcm_esw_field_qualify_FlowtrackerGroupId
  10815  *
  10816  * Purpose:
  10817  *    Qualifies on Flow group id assigned(bcmFieldActionFlowtrackerGroupId)
  10818  *    by FlowTracker based Field Processor Stage
  10819  *
  10820  * Parameters:
  10821  *    unit     BCM device number
  10822  *    entry    Field entry ID
  10823  *    data     Qualifier match data
  10824  *    mask     Qualifier match mask
  10825  *
  10826  * Returns:
  10827  *    BCM_E_NONE        Operation completed successfully
  10828  *    BCM_E_INIT        BCM unit not initialized
  10829  *    BCM_E_NOT_FOUND   Entry ID not found
  10830  */
  10831 int
  10832 bcm_esw_field_qualify_FlowtrackerGroupId(
  10833                int unit,
  10834                bcm_field_entry_t entry_id,
  10835                int data,
  10836                int mask)
  10837 {
  10838     int rv = BCM_E_UNAVAIL;
  10839 
  10840 #if defined(BCM_HELIX5_SUPPORT)
  10841 
  10842     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  10843         if (data >> 16) {
  10844             return BCM_E_PARAM;
  10845         }
  10846 
  10847         FP_LOCK(unit);
  10848 
  10849         rv = _field_qualify32(unit, entry_id,
  10850                               bcmFieldQualifyFlowtrackerGroupId,
  10851                               data, mask);
  10852         FP_UNLOCK(unit);
  10853     }
  10854 #endif
  10855 
  10856     return (rv);
  10857 }
  10858 
  10859 /*
  10860  * Function:
  10861  *    bcm_esw_field_qualify_FlowtrackerGroupId_get
  10862  *
  10863  * Purpose:
  10864  *    To get qualified inputs on Flow group id assigned(bcmFieldActionFlowtrackerGroupId)
  10865  *    by FlowTracker based Field Processor Stage
  10866  *
  10867  * Parameters:
  10868  *    unit     BCM device number
  10869  *    entry    Field entry ID
  10870  *    data     Qualifier match data
  10871  *    mask     Qualifier match mask
  10872  *
  10873  * Returns:
  10874  *    BCM_E_NONE        Operation completed successfully
  10875  *    BCM_E_INIT        BCM unit not initialized
  10876  *    BCM_E_NOT_FOUND   Entry ID not found
  10877  */
  10878 int
  10879 bcm_esw_field_qualify_FlowtrackerGroupId_get(
  10880                int unit,
  10881                bcm_field_entry_t entry_id,
  10882                int *data,
  10883                int *mask)
  10884 {
  10885     int rv = BCM_E_UNAVAIL;
  10886 
  10887 #if defined(BCM_HELIX5_SUPPORT)
  10888     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  10889         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry_id,
  10890                                                bcmFieldQualifyFlowtrackerGroupId,
  10891                                                (uint32 *)data, (uint32 *)mask);
  10892     }
  10893 #endif
  10894 
  10895     return rv;
  10896 }
  10897 
  10898 /*
  10899  * Function:
  10900  *    bcm_esw_field_qualify_FlowtrackerClassId
  10901  *
  10902  * Purpose:
  10903  *    Qualifies on Classifier ID from Flowtracker group
  10904  *
  10905  * Parameters:
  10906  *    unit     BCM device number
  10907  *    entry    Field entry ID
  10908  *    data     Qualifier match data
  10909  *    mask     Qualifier match mask
  10910  *
  10911  * Returns:
  10912  *    BCM_E_NONE        Operation completed successfully
  10913  *    BCM_E_INIT        BCM unit not initialized
  10914  *    BCM_E_NOT_FOUND   Entry ID not found
  10915  */
  10916 int
  10917 bcm_esw_field_qualify_FlowtrackerClassId(
  10918                int unit,
  10919                bcm_field_entry_t entry_id,
  10920                int data,
  10921                int mask)
  10922 {
  10923     int rv = BCM_E_UNAVAIL;
  10924 
  10925 #if defined(BCM_HELIX5_SUPPORT)
  10926     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  10927         if (data >> 16) {
  10928             return BCM_E_PARAM;
  10929         }
  10930         FP_LOCK(unit);
  10931 
  10932         rv = _field_qualify32(unit, entry_id,
  10933                               bcmFieldQualifyFlowtrackerClassId,
  10934                               data, mask);
  10935         FP_UNLOCK(unit);
  10936     }
  10937 #endif
  10938 
  10939     return (rv);
  10940 }
  10941 
  10942 /*
  10943  * Function:
  10944  *    bcm_esw_field_qualify_FlowtrackerClassId_get
  10945  *
  10946  * Purpose:
  10947  *    To get qualified inputs on Classifier ID from Flowtracker group
  10948  *
  10949  * Parameters:
  10950  *    unit     BCM device number
  10951  *    entry    Field entry ID
  10952  *    data     Qualifier match data
  10953  *    mask     Qualifier match mask
  10954  *
  10955  * Returns:
  10956  *    BCM_E_NONE        Operation completed successfully
  10957  *    BCM_E_INIT        BCM unit not initialized
  10958  *    BCM_E_NOT_FOUND   Entry ID not found
  10959  */
  10960 int
  10961 bcm_esw_field_qualify_FlowtrackerClassId_get(
  10962                int unit,
  10963                bcm_field_entry_t entry_id,
  10964                int *data,
  10965                int *mask)
  10966 {
  10967     int rv = BCM_E_UNAVAIL;
  10968 
  10969 #if defined(BCM_HELIX5_SUPPORT)
  10970     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  10971         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry_id,
  10972                                                bcmFieldQualifyFlowtrackerClassId,
  10973                                                (uint32 *)data, (uint32 *)mask);
  10974     }
  10975 #endif
  10976 
  10977     return rv;
  10978 }
  10979 
  10980 /*
  10981  * Function:
  10982  *    bcm_esw_field_qualify_FlowtrackerGroupValid
  10983  *
  10984  * Purpose:
  10985  *    Qualifies on event Flowtracker group valid or not
  10986  *
  10987  * Parameters:
  10988  *    unit     BCM device number
  10989  *    entry    Field entry ID
  10990  *    data     Qualifier match data
  10991  *    mask     Qualifier match mask
  10992  *
  10993  * Returns:
  10994  *    BCM_E_NONE        Operation completed successfully
  10995  *    BCM_E_INIT        BCM unit not initialized
  10996  *    BCM_E_NOT_FOUND   Entry ID not found
  10997  */
  10998 int
  10999 bcm_esw_field_qualify_FlowtrackerGroupValid(
  11000                int unit,
  11001                bcm_field_entry_t entry_id,
  11002                uint8 data,
  11003                uint8 mask)
  11004 {
  11005     int    rv = BCM_E_UNAVAIL;
  11006 
  11007 #if defined(BCM_HELIX5_SUPPORT)
  11008 
  11009     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11010         if (data >> 1) {
  11011             LOG_ERROR(BSL_LS_BCM_FP,
  11012                       (BSL_META_U(unit,
  11013                                   "FP(unit %d) Error: data=%d too large.\n"),
  11014                        unit, data));
  11015             return BCM_E_PARAM;
  11016         }
  11017 
  11018         FP_LOCK(unit);
  11019 
  11020         rv = _field_qualify32(unit, entry_id,
  11021                               bcmFieldQualifyFlowtrackerGroupValid,
  11022                               data, mask);
  11023 
  11024         FP_UNLOCK(unit);
  11025     }
  11026 #endif
  11027     return rv;
  11028 }
  11029 
  11030 /*
  11031  * Function:
  11032  *    bcm_esw_field_qualify_FlowtrackerGroupValid_get
  11033  *
  11034  * Purpose:
  11035  *    To get qualified inputs on event Flowtracker group valid or not
  11036  *
  11037  * Parameters:
  11038  *    unit     BCM device number
  11039  *    entry    Field entry ID
  11040  *    data     Qualifier match data
  11041  *    mask     Qualifier match mask
  11042  *
  11043  * Returns:
  11044  *    BCM_E_NONE        Operation completed successfully
  11045  *    BCM_E_INIT        BCM unit not initialized
  11046  *    BCM_E_NOT_FOUND   Entry ID not found
  11047  */
  11048 int
  11049 bcm_esw_field_qualify_FlowtrackerGroupValid_get(
  11050                int unit,
  11051                bcm_field_entry_t entry_id,
  11052                uint8 *data,
  11053                uint8 *mask)
  11054 {
  11055     int    rv = BCM_E_UNAVAIL;
  11056 
  11057 #if defined(BCM_HELIX5_SUPPORT)
  11058 
  11059     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11060         rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11061                                  bcmFieldQualifyFlowtrackerGroupValid,
  11062                                  data, mask);
  11063     }
  11064 #endif
  11065     return rv;
  11066 }
  11067 
  11068 /*
  11069  * Function:
  11070  *    bcm_esw_field_qualify_FlowtrackerDisabled
  11071  *
  11072  * Purpose:
  11073  *    Qualifies on event whether Flowtracker flow tracking is disabled.
  11074  *
  11075  * Parameters:
  11076  *    unit     BCM device number
  11077  *    entry    Field entry ID
  11078  *    data     Qualifier match data
  11079  *    mask     Qualifier match mask
  11080  *
  11081  * Returns:
  11082  *    BCM_E_NONE        Operation completed successfully
  11083  *    BCM_E_INIT        BCM unit not initialized
  11084  *    BCM_E_NOT_FOUND   Entry ID not found
  11085  */
  11086 int
  11087 bcm_esw_field_qualify_FlowtrackerDisabled(
  11088                int unit,
  11089                bcm_field_entry_t entry_id,
  11090                uint8 data,
  11091                uint8 mask)
  11092 {
  11093     int    rv = BCM_E_UNAVAIL;
  11094 
  11095 #if defined(BCM_HELIX5_SUPPORT)
  11096 
  11097     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11098         if (data >> 1) {
  11099             LOG_ERROR(BSL_LS_BCM_FP,
  11100                       (BSL_META_U(unit,
  11101                                   "FP(unit %d) Error: data=%d too large.\n"),
  11102                        unit, data));
  11103             return BCM_E_PARAM;
  11104         }
  11105 
  11106         FP_LOCK(unit);
  11107 
  11108         rv = _field_qualify32(unit, entry_id,
  11109                               bcmFieldQualifyFlowtrackerDisabled,
  11110                               data, mask);
  11111 
  11112         FP_UNLOCK(unit);
  11113     }
  11114 #endif
  11115     return rv;
  11116 }
  11117 
  11118 /*
  11119  * Function:
  11120  *    bcm_esw_field_qualify_FlowtrackerDisabled_get
  11121  *
  11122  * Purpose:
  11123  *    To get qualified inputs on event whether Flowtracker flow tracking is disabled.
  11124  *
  11125  * Parameters:
  11126  *    unit     BCM device number
  11127  *    entry    Field entry ID
  11128  *    data     Qualifier match data
  11129  *    mask     Qualifier match mask
  11130  *
  11131  * Returns:
  11132  *    BCM_E_NONE        Operation completed successfully
  11133  *    BCM_E_INIT        BCM unit not initialized
  11134  *    BCM_E_NOT_FOUND   Entry ID not found
  11135  */
  11136 int
  11137 bcm_esw_field_qualify_FlowtrackerDisabled_get(
  11138                int unit,
  11139                bcm_field_entry_t entry_id,
  11140                uint8 *data,
  11141                uint8 *mask)
  11142 {
  11143     int    rv = BCM_E_UNAVAIL;
  11144 
  11145 #if defined(BCM_HELIX5_SUPPORT)
  11146 
  11147     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11148         rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11149                                  bcmFieldQualifyFlowtrackerDisabled,
  11150                                  data, mask);
  11151     }
  11152 #endif
  11153     return rv;
  11154 }
  11155 
  11156 /*
  11157  * Function:
  11158  *    bcm_esw_field_qualify_FlowtrackerMeteringExceeded
  11159  *
  11160  * Purpose:
  11161  *    Qualifies on event whether Flowtracker metering is exceeded.
  11162  *
  11163  * Parameters:
  11164  *    unit     BCM device number
  11165  *    entry    Field entry ID
  11166  *    data     Qualifier match data
  11167  *    mask     Qualifier match mask
  11168  *
  11169  * Returns:
  11170  *    BCM_E_NONE        Operation completed successfully
  11171  *    BCM_E_INIT        BCM unit not initialized
  11172  *    BCM_E_NOT_FOUND   Entry ID not found
  11173  */
  11174 int
  11175 bcm_esw_field_qualify_FlowtrackerMeteringExceeded(
  11176                int unit,
  11177                bcm_field_entry_t entry_id,
  11178                uint8 data,
  11179                uint8 mask)
  11180 {
  11181     int    rv = BCM_E_UNAVAIL;
  11182 
  11183 #if defined(BCM_HELIX5_SUPPORT)
  11184 
  11185     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11186         if (data >> 1) {
  11187             LOG_ERROR(BSL_LS_BCM_FP,
  11188                       (BSL_META_U(unit,
  11189                                   "FP(unit %d) Error: data=%d too large.\n"),
  11190                        unit, data));
  11191             return BCM_E_PARAM;
  11192         }
  11193 
  11194         FP_LOCK(unit);
  11195 
  11196         rv = _field_qualify32(unit, entry_id,
  11197                               bcmFieldQualifyFlowtrackerMeteringExceeded,
  11198                               data, mask);
  11199 
  11200         FP_UNLOCK(unit);
  11201     }
  11202 #endif
  11203     return rv;
  11204 }
  11205 
  11206 /*
  11207  * Function:
  11208  *    bcm_esw_field_qualify_FlowtrackerMeteringExceeded_get
  11209  *
  11210  * Purpose:
  11211  *    To get qualified inputs on event whether Flowtracker metering is exceeded.
  11212  *
  11213  * Parameters:
  11214  *    unit     BCM device number
  11215  *    entry    Field entry ID
  11216  *    data     Qualifier match data
  11217  *    mask     Qualifier match mask
  11218  *
  11219  * Returns:
  11220  *    BCM_E_NONE        Operation completed successfully
  11221  *    BCM_E_INIT        BCM unit not initialized
  11222  *    BCM_E_NOT_FOUND   Entry ID not found
  11223  */
  11224 int
  11225 bcm_esw_field_qualify_FlowtrackerMeteringExceeded_get(
  11226                int unit,
  11227                bcm_field_entry_t entry_id,
  11228                uint8 *data,
  11229                uint8 *mask)
  11230 {
  11231     int    rv = BCM_E_UNAVAIL;
  11232 
  11233 #if defined(BCM_HELIX5_SUPPORT)
  11234 
  11235     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11236         rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11237                                 bcmFieldQualifyFlowtrackerMeteringExceeded,
  11238                                 data, mask);
  11239     }
  11240 #endif
  11241     return rv;
  11242 }
  11243 
  11244 /*
  11245  * Function:
  11246  *    bcm_esw_field_qualify_FlowtrackerCollectorCopy
  11247  *
  11248  * Purpose:
  11249  *    Qualifies on the event whether initial or sample copied to collector
  11250  *    happened by Flowtracker
  11251  *
  11252  * Parameters:
  11253  *    unit     BCM device number
  11254  *    entry    Field entry ID
  11255  *    data     Qualifier match data
  11256  *    mask     Qualifier match mask
  11257  *
  11258  * Returns:
  11259  *    BCM_E_NONE        Operation completed successfully
  11260  *    BCM_E_INIT        BCM unit not initialized
  11261  *    BCM_E_NOT_FOUND   Entry ID not found
  11262  */
  11263 int
  11264 bcm_esw_field_qualify_FlowtrackerCollectorCopy(
  11265                int unit,
  11266                bcm_field_entry_t entry_id,
  11267                uint8 data,
  11268                uint8 mask)
  11269 {
  11270     int    rv = BCM_E_UNAVAIL;
  11271 
  11272 #if defined(BCM_HELIX5_SUPPORT)
  11273 
  11274     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11275         if (data >> 1) {
  11276             LOG_ERROR(BSL_LS_BCM_FP,
  11277                       (BSL_META_U(unit,
  11278                                   "FP(unit %d) Error: data=%d too large.\n"),
  11279                        unit, data));
  11280             return BCM_E_PARAM;
  11281         }
  11282 
  11283         FP_LOCK(unit);
  11284 
  11285         rv = _field_qualify32(unit, entry_id,
  11286                               bcmFieldQualifyFlowtrackerCollectorCopy,
  11287                               data, mask);
  11288 
  11289         FP_UNLOCK(unit);
  11290     }
  11291 #endif
  11292     return rv;
  11293 }
  11294 
  11295 /*
  11296  * Function:
  11297  *    bcm_esw_field_qualify_FlowtrackerCollectorCopy_get
  11298  *
  11299  * Purpose:
  11300  *    To get qualified inputs on the event whether initial or sample copied to collector
  11301  *    happened by Flowtracker
  11302  *
  11303  * Parameters:
  11304  *    unit     BCM device number
  11305  *    entry    Field entry ID
  11306  *    data     Qualifier match data
  11307  *    mask     Qualifier match mask
  11308  *
  11309  * Returns:
  11310  *    BCM_E_NONE        Operation completed successfully
  11311  *    BCM_E_INIT        BCM unit not initialized
  11312  *    BCM_E_NOT_FOUND   Entry ID not found
  11313  */
  11314 int
  11315 bcm_esw_field_qualify_FlowtrackerCollectorCopy_get(
  11316                int unit,
  11317                bcm_field_entry_t entry_id,
  11318                uint8 *data,
  11319                uint8 *mask)
  11320 {
  11321     int    rv = BCM_E_UNAVAIL;
  11322 
  11323 #if defined(BCM_HELIX5_SUPPORT)
  11324 
  11325     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11326         rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11327                                  bcmFieldQualifyFlowtrackerCollectorCopy,
  11328                                  data, mask);
  11329     }
  11330 #endif
  11331     return rv;
  11332 }
  11333 
  11334 /*
  11335  * Function:
  11336  *    bcm_esw_field_qualify_FlowtrackerFlowTableFull
  11337  *
  11338  * Purpose:
  11339  *    Qualifies on the Flowtracker event whether the flow table is full.
  11340  *
  11341  * Parameters:
  11342  *    unit     BCM device number
  11343  *    entry    Field entry ID
  11344  *    data     Qualifier match data
  11345  *    mask     Qualifier match mask
  11346  *
  11347  * Returns:
  11348  *    BCM_E_NONE        Operation completed successfully
  11349  *    BCM_E_INIT        BCM unit not initialized
  11350  *    BCM_E_NOT_FOUND   Entry ID not found
  11351  */
  11352 int
  11353 bcm_esw_field_qualify_FlowtrackerFlowTableFull(
  11354                int unit,
  11355                bcm_field_entry_t entry_id,
  11356                uint8 data,
  11357                uint8 mask)
  11358 {
  11359     int    rv = BCM_E_UNAVAIL;
  11360 
  11361 #if defined(BCM_HELIX5_SUPPORT)
  11362 
  11363     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11364         if (data >> 1) {
  11365             LOG_ERROR(BSL_LS_BCM_FP,
  11366                       (BSL_META_U(unit,
  11367                                   "FP(unit %d) Error: data=%d too large.\n"),
  11368                        unit, data));
  11369             return BCM_E_PARAM;
  11370         }
  11371 
  11372         FP_LOCK(unit);
  11373 
  11374         rv = _field_qualify32(unit, entry_id,
  11375                               bcmFieldQualifyFlowtrackerFlowTableFull,
  11376                               data, mask);
  11377 
  11378         FP_UNLOCK(unit);
  11379     }
  11380 #endif
  11381     return rv;
  11382 }
  11383 
  11384 /*
  11385  * Function:
  11386  *    bcm_esw_field_qualify_FlowtrackerFlowTableFull_get
  11387  *
  11388  * Purpose:
  11389  *    To get qualified inputs on the Flowtracker event whether the flow table is full.
  11390  *
  11391  * Parameters:
  11392  *    unit     BCM device number
  11393  *    entry    Field entry ID
  11394  *    data     Qualifier match data
  11395  *    mask     Qualifier match mask
  11396  *
  11397  * Returns:
  11398  *    BCM_E_NONE        Operation completed successfully
  11399  *    BCM_E_INIT        BCM unit not initialized
  11400  *    BCM_E_NOT_FOUND   Entry ID not found
  11401  */
  11402 int
  11403 bcm_esw_field_qualify_FlowtrackerFlowTableFull_get(
  11404                int unit,
  11405                bcm_field_entry_t entry_id,
  11406                uint8 *data,
  11407                uint8 *mask)
  11408 {
  11409     int    rv = BCM_E_UNAVAIL;
  11410 
  11411 #if defined(BCM_HELIX5_SUPPORT)
  11412 
  11413     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11414         rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11415                                  bcmFieldQualifyFlowtrackerFlowTableFull,
  11416                                  data, mask);
  11417     }
  11418 #endif
  11419     return rv;
  11420 }
  11421 
  11422 /*
  11423  * Function:
  11424  *    bcm_esw_field_qualify_FlowtrackerGroupFlowExceeded
  11425  *
  11426  * Purpose:
  11427  *    Qualifies on the event whether flow limit for Flowtracker is exceeded.
  11428  *
  11429  * Parameters:
  11430  *    unit     BCM device number
  11431  *    entry    Field entry ID
  11432  *    data     Qualifier match data
  11433  *    mask     Qualifier match mask
  11434  *
  11435  * Returns:
  11436  *    BCM_E_NONE        Operation completed successfully
  11437  *    BCM_E_INIT        BCM unit not initialized
  11438  *    BCM_E_NOT_FOUND   Entry ID not found
  11439  */
  11440 int
  11441 bcm_esw_field_qualify_FlowtrackerGroupFlowExceeded(
  11442                int unit,
  11443                bcm_field_entry_t entry_id,
  11444                uint8 data,
  11445                uint8 mask)
  11446 {
  11447     int    rv = BCM_E_UNAVAIL;
  11448 
  11449 #if defined(BCM_HELIX5_SUPPORT)
  11450 
  11451     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11452         if (data >> 1) {
  11453             LOG_ERROR(BSL_LS_BCM_FP,
  11454                       (BSL_META_U(unit,
  11455                                   "FP(unit %d) Error: data=%d too large.\n"),
  11456                        unit, data));
  11457             return BCM_E_PARAM;
  11458         }
  11459 
  11460         FP_LOCK(unit);
  11461 
  11462         rv = _field_qualify32(unit, entry_id,
  11463                               bcmFieldQualifyFlowtrackerGroupFlowExceeded,
  11464                               data, mask);
  11465 
  11466         FP_UNLOCK(unit);
  11467     }
  11468 #endif
  11469     return rv;
  11470 }
  11471 
  11472 /*
  11473  * Function:
  11474  *    bcm_esw_field_qualify_FlowtrackerGroupFlowExceeded_get
  11475  *
  11476  * Purpose:
  11477  *    To get qualified inputs on the event whether flow limit for Flowtracker is exceeded.
  11478  *
  11479  * Parameters:
  11480  *    unit     BCM device number
  11481  *    entry    Field entry ID
  11482  *    data     Qualifier match data
  11483  *    mask     Qualifier match mask
  11484  *
  11485  * Returns:
  11486  *    BCM_E_NONE        Operation completed successfully
  11487  *    BCM_E_INIT        BCM unit not initialized
  11488  *    BCM_E_NOT_FOUND   Entry ID not found
  11489  */
  11490 int
  11491 bcm_esw_field_qualify_FlowtrackerGroupFlowExceeded_get(
  11492                int unit,
  11493                bcm_field_entry_t entry_id,
  11494                uint8 *data,
  11495                uint8 *mask)
  11496 {
  11497     int    rv = BCM_E_UNAVAIL;
  11498 
  11499 #if defined(BCM_HELIX5_SUPPORT)
  11500 
  11501     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11502         rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11503                                  bcmFieldQualifyFlowtrackerGroupFlowExceeded,
  11504                                  data, mask);
  11505     }
  11506 #endif
  11507     return rv;
  11508 }
  11509 
  11510 /*
  11511  * Function:
  11512  *    bcm_esw_field_qualify_FlowtrackerExportQueueFull
  11513  *
  11514  * Purpose:
  11515  *    Qualifies on the event whether Flowtracker export queue is full.
  11516  *
  11517  * Parameters:
  11518  *    unit     BCM device number
  11519  *    entry    Field entry ID
  11520  *    data     Qualifier match data
  11521  *    mask     Qualifier match mask
  11522  *
  11523  * Returns:
  11524  *    BCM_E_NONE        Operation completed successfully
  11525  *    BCM_E_INIT        BCM unit not initialized
  11526  *    BCM_E_NOT_FOUND   Entry ID not found
  11527  */
  11528 int
  11529 bcm_esw_field_qualify_FlowtrackerExportQueueFull(
  11530                int unit,
  11531                bcm_field_entry_t entry_id,
  11532                uint8 data,
  11533                uint8 mask)
  11534 {
  11535     int    rv = BCM_E_UNAVAIL;
  11536 
  11537 #if defined(BCM_HELIX5_SUPPORT)
  11538 
  11539     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11540         if (data >> 1) {
  11541             LOG_ERROR(BSL_LS_BCM_FP,
  11542                       (BSL_META_U(unit,
  11543                                   "FP(unit %d) Error: data=%d too large.\n"),
  11544                        unit, data));
  11545             return BCM_E_PARAM;
  11546         }
  11547 
  11548         FP_LOCK(unit);
  11549 
  11550         rv = _field_qualify32(unit, entry_id,
  11551                               bcmFieldQualifyFlowtrackerExportQueueFull,
  11552                               data, mask);
  11553 
  11554         FP_UNLOCK(unit);
  11555     }
  11556 #endif
  11557     return rv;
  11558 }
  11559 
  11560 /*
  11561  * Function:
  11562  *    bcm_esw_field_qualify_FlowtrackerExportQueueFull_get
  11563  *
  11564  * Purpose:
  11565  *    To get qualified inputs on the event whether Flowtracker export queue is full.
  11566  *
  11567  * Parameters:
  11568  *    unit     BCM device number
  11569  *    entry    Field entry ID
  11570  *    data     Qualifier match data
  11571  *    mask     Qualifier match mask
  11572  *
  11573  * Returns:
  11574  *    BCM_E_NONE        Operation completed successfully
  11575  *    BCM_E_INIT        BCM unit not initialized
  11576  *    BCM_E_NOT_FOUND   Entry ID not found
  11577  */
  11578 int
  11579 bcm_esw_field_qualify_FlowtrackerExportQueueFull_get(
  11580                int unit,
  11581                bcm_field_entry_t entry_id,
  11582                uint8 *data,
  11583                uint8 *mask)
  11584 {
  11585     int    rv = BCM_E_UNAVAIL;
  11586 
  11587 #if defined(BCM_HELIX5_SUPPORT)
  11588 
  11589     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  11590         rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11591                                  bcmFieldQualifyFlowtrackerGroupValid,
  11592                                  data, mask);
  11593     }
  11594 #endif
  11595     return rv;
  11596 }
  11597 
  11598 /*
  11599  * Function:
  11600  *     bcm_esw_field_qualify_MacSecTagPresent
  11601  *
  11602  * Purpose:
  11603  *    To qualify the MACSEC tagged packets
  11604  *
  11605  * Parameters:
  11606  *    unit     BCM device number
  11607  *    entry    Field entry ID
  11608  *    data     Qualifier match data
  11609  *    mask     Qualifier match mask
  11610  *
  11611  * Returns:
  11612  *    BCM_E_NONE        Operation completed successfully
  11613  *    BCM_E_INIT        BCM unit not initialized
  11614  *    BCM_E_PARAM       Invalid Parameter passed
  11615  *    BCM_E_NOT_FOUND   Entry ID not found
  11616  */
  11617 
  11618 int
  11619 bcm_esw_field_qualify_MacSecTagPresent(
  11620                int unit,
  11621                bcm_field_entry_t entry_id,
  11622                uint8 data,
  11623                uint8 mask)
  11624 {
  11625     int    rv = BCM_E_UNAVAIL;
  11626 
  11627 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  11628 
  11629     if (data >> 1) {
  11630         LOG_ERROR(BSL_LS_BCM_FP,
  11631                   (BSL_META_U(unit,
  11632                               "FP(unit %d) Error: data=%d too large.\n"),
  11633                    unit, data));
  11634         return BCM_E_PARAM;
  11635     }
  11636 
  11637     FP_LOCK(unit);
  11638 
  11639     rv = _field_qualify32(unit, entry_id, bcmFieldQualifyMacSecTagPresent, data, mask);
  11640 
  11641     FP_UNLOCK(unit);
  11642 #endif
  11643     return rv;
  11644 }
  11645 
  11646 /*
  11647  * Function:
  11648  *     bcm_esw_field_qualify_MacSecTagPresent_get
  11649  *
  11650  * Purpose:
  11651  *    To get the qualified inputs on the MACSEC tagged packets
  11652  *
  11653  * Parameters:
  11654  *    unit     BCM device number
  11655  *    entry    Field entry ID
  11656  *    data     Qualifier match data
  11657  *    mask     Qualifier match mask
  11658  *
  11659  * Returns:
  11660  *    BCM_E_NONE        Operation completed successfully
  11661  *    BCM_E_INIT        BCM unit not initialized
  11662  *    BCM_E_NOT_FOUND   Entry ID not found
  11663  */
  11664 int
  11665 bcm_esw_field_qualify_MacSecTagPresent_get(
  11666                int unit,
  11667                bcm_field_entry_t entry_id,
  11668                uint8 *data,
  11669                uint8 *mask)
  11670 {
  11671     int    rv = BCM_E_UNAVAIL;
  11672 
  11673 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  11674 
  11675     if ((NULL == data) || (NULL == mask)) {
  11676         LOG_ERROR(BSL_LS_BCM_FP,
  11677                   (BSL_META_U(unit,
  11678                               "FP(unit %d) Error: NULL pointer passed as parameter.\n"),
  11679                    unit));
  11680         return BCM_E_PARAM;
  11681     }
  11682     
  11683     rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11684                              bcmFieldQualifyMacSecTagPresent,
  11685                              data, mask);
  11686 #endif
  11687     return rv;
  11688 }
  11689 
  11690 /*
  11691  * Function:
  11692  *     bcm_esw_field_qualify_MacSecTag
  11693  *
  11694  * Purpose:
  11695  *    To qualify on the SecTag field in MACSEC tagged packets
  11696  *
  11697  * Parameters:
  11698  *    unit     BCM device number
  11699  *    entry    Field entry ID
  11700  *    data     Qualifier match data
  11701  *    mask     Qualifier match mask
  11702  *
  11703  * Returns:
  11704  *    BCM_E_NONE        Operation completed successfully
  11705  *    BCM_E_INIT        BCM unit not initialized
  11706  *    BCM_E_PARAM       Invalid Parameter passed
  11707  *    BCM_E_NOT_FOUND   Entry ID not found
  11708  */
  11709 int
  11710 bcm_esw_field_qualify_MacSecTag(
  11711                int unit,
  11712                bcm_field_entry_t entry_id,
  11713                uint8 data,
  11714                uint8 mask)
  11715 {
  11716     int    rv = BCM_E_UNAVAIL;
  11717 
  11718 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  11719     FP_LOCK(unit);
  11720 
  11721     rv = _field_qualify32(unit, entry_id, bcmFieldQualifyMacSecTag, data, mask);
  11722 
  11723     FP_UNLOCK(unit);
  11724 #endif
  11725     return rv;
  11726 }
  11727 
  11728 /*
  11729  * Function:
  11730  *     bcm_esw_field_qualify_MacSecTag_get
  11731  *
  11732  * Purpose:
  11733  *    To get the qualified inputs on SecTag field in MACSEC tagged packets
  11734  *
  11735  * Parameters:
  11736  *    unit     BCM device number
  11737  *    entry    Field entry ID
  11738  *    data     Qualifier match data
  11739  *    mask     Qualifier match mask
  11740  *
  11741  * Returns:
  11742  *    BCM_E_NONE        Operation completed successfully
  11743  *    BCM_E_INIT        BCM unit not initialized
  11744  *    BCM_E_NOT_FOUND   Entry ID not found
  11745  */
  11746 int
  11747 bcm_esw_field_qualify_MacSecTag_get(
  11748                int unit,
  11749                bcm_field_entry_t entry_id,
  11750                uint8 *data,
  11751                uint8 *mask)
  11752 {
  11753     int    rv = BCM_E_UNAVAIL;
  11754 
  11755 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  11756 
  11757     if ((NULL == data) || (NULL == mask)) {
  11758         LOG_ERROR(BSL_LS_BCM_FP,
  11759                   (BSL_META_U(unit,
  11760                               "FP(unit %d) Error: NULL pointer passed as parameter.\n"),
  11761                    unit));
  11762         return BCM_E_PARAM;
  11763     }
  11764     
  11765     rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11766                              bcmFieldQualifyMacSecTag,
  11767                              data, mask);
  11768 #endif
  11769     return rv;
  11770 }
  11771 
  11772 /*
  11773  * Function:
  11774  *     bcm_esw_field_qualify_MacSecDstMacRangeHit
  11775  *
  11776  * Purpose:
  11777  *    To qualify the hit on Destination MAC addresses range
  11778  *
  11779  * Parameters:
  11780  *    unit     BCM device number
  11781  *    entry    Field entry ID
  11782  *    data     Qualifier match data
  11783  *    mask     Qualifier match mask
  11784  *
  11785  * Returns:
  11786  *    BCM_E_NONE        Operation completed successfully
  11787  *    BCM_E_INIT        BCM unit not initialized
  11788  *    BCM_E_PARAM       Invalid Parameter passed
  11789  *    BCM_E_NOT_FOUND   Entry ID not found
  11790  */
  11791 int
  11792 bcm_esw_field_qualify_MacSecDstMacRangeHit(
  11793                int unit,
  11794                bcm_field_entry_t entry_id,
  11795                uint8 data,
  11796                uint8 mask)
  11797 {
  11798     int    rv = BCM_E_UNAVAIL;
  11799 
  11800 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  11801 
  11802     if (data >> 1) {
  11803         LOG_ERROR(BSL_LS_BCM_FP,
  11804                   (BSL_META_U(unit,
  11805                               "FP(unit %d) Error: data=%d too large.\n"),
  11806                    unit, data));
  11807         return BCM_E_PARAM;
  11808     }
  11809 
  11810     FP_LOCK(unit);
  11811 
  11812     rv = _field_qualify32(unit, entry_id, bcmFieldQualifyMacSecDstMacRangeHit, data, mask);
  11813 
  11814     FP_UNLOCK(unit);
  11815 #endif
  11816     return rv;
  11817 }
  11818 
  11819 /*
  11820  * Function:
  11821  *     bcm_esw_field_qualify_MacSecDstMacRangeHit_get
  11822  *
  11823  * Purpose:
  11824  *     To get the qualified inputs on the Destination MAC addresses range hit 
  11825  *
  11826  * Parameters:
  11827  *    unit     BCM device number
  11828  *    entry    Field entry ID
  11829  *    data     Qualifier match data
  11830  *    mask     Qualifier match mask
  11831  *
  11832  * Returns:
  11833  *    BCM_E_NONE        Operation completed successfully
  11834  *    BCM_E_INIT        BCM unit not initialized
  11835  *    BCM_E_PARAM       Invalid Parameter passed
  11836  *    BCM_E_NOT_FOUND   Entry ID not found
  11837  */
  11838 int
  11839 bcm_esw_field_qualify_MacSecDstMacRangeHit_get(
  11840                int unit,
  11841                bcm_field_entry_t entry_id,
  11842                uint8 *data,
  11843                uint8 *mask)
  11844 {
  11845     int    rv = BCM_E_UNAVAIL;
  11846 
  11847 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  11848 
  11849     if ((NULL == data) || (NULL == mask)) {
  11850         LOG_ERROR(BSL_LS_BCM_FP,
  11851                   (BSL_META_U(unit,
  11852                               "FP(unit %d) Error: NULL pointer passed as parameter.\n"),
  11853                    unit));
  11854         return BCM_E_PARAM;
  11855     }
  11856     
  11857     rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  11858                              bcmFieldQualifyMacSecDstMacRangeHit,
  11859                              data, mask);
  11860 #endif
  11861     return rv;
  11862 }
  11863 
  11864 /*
  11865  * Function:
  11866  *     bcm_esw_field_macsec_DstMacRange_set
  11867  *
  11868  * Purpose:
  11869  *    Configures lower and upper limits to be used by qualifier bcmFieldQualifyMacSecDstMacRangeHit
  11870  *
  11871  * Parameters:
  11872  *    unit              BCM device number
  11873  *    lower_limit       Floor value of Destination Mac Address range
  11874  *    upper_limit       Ceil value of Destination Mac Address range
  11875  * Returns:
  11876  *    BCM_E_NONE        Operation completed successfully
  11877  *    BCM_E_INIT        BCM unit not initialized
  11878  *    BCM_E_PARAM       Invalid Parameter passed
  11879  */
  11880 int
  11881 bcm_esw_field_macsec_DstMacRange_set(
  11882                int unit,
  11883                bcm_mac_t lower_limit,
  11884                bcm_mac_t upper_limit)
  11885 {
  11886     int    rv = BCM_E_UNAVAIL;
  11887 
  11888 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  11889     uint64 lower_mac, upper_mac;
  11890     macsec_da_range_entry_t buf;
  11891 
  11892     COMPILER_64_ZERO(lower_mac);
  11893     COMPILER_64_ZERO(upper_mac);
  11894 
  11895     SAL_MAC_ADDR_TO_UINT64(lower_limit, lower_mac);
  11896     SAL_MAC_ADDR_TO_UINT64(upper_limit, upper_mac);
  11897     if (COMPILER_64_GE(lower_mac, upper_mac)) {
  11898         LOG_ERROR(BSL_LS_BCM_FP,
  11899                   (BSL_META_U(unit,
  11900                               "FP(unit %d) Error: lower limit MAC address is greater than"
  11901                               " upper limit MAC address.\n"),
  11902                    unit));
  11903         return BCM_E_PARAM;
  11904     }
  11905     soc_mem_mac_addr_set(unit, MACSEC_DA_RANGEm, &buf, LOWERf, lower_limit);
  11906     soc_mem_mac_addr_set(unit, MACSEC_DA_RANGEm, &buf, UPPERf, upper_limit);
  11907 
  11908     rv = soc_mem_write(unit, MACSEC_DA_RANGEm, SOC_BLOCK_ALL, 0, &buf);
  11909 #endif
  11910     return rv;
  11911 }
  11912 
  11913 /*
  11914  * Function:
  11915  *     bcm_esw_field_macsec_DstMacRange_get
  11916  *
  11917  * Purpose:
  11918  *    To get the configured lower and upper limits to be used by qualifier bcmFieldQualifyMacSecDstMacRangeHit
  11919  *
  11920  * Parameters:
  11921  *    unit              BCM device number
  11922  *    lower_limit       Floor value of Destination Mac Address range
  11923  *    upper_limit       Ceil value of Destination Mac Address range
  11924  * Returns:
  11925  *    BCM_E_NONE        Operation completed successfully
  11926  *    BCM_E_INIT        BCM unit not initialized
  11927  *    BCM_E_PARAM       Invalid Parameter passed
  11928  */
  11929 int
  11930 bcm_esw_field_macsec_DstMacRange_get(
  11931                int unit,
  11932                bcm_mac_t *lower_limit,
  11933                bcm_mac_t *upper_limit)
  11934 {
  11935     int    rv = BCM_E_UNAVAIL;
  11936 
  11937 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  11938     macsec_da_range_entry_t buf;
  11939 
  11940     if ((NULL == lower_limit) || (NULL == upper_limit)) {
  11941         LOG_ERROR(BSL_LS_BCM_FP,
  11942                   (BSL_META_U(unit,
  11943                               "FP(unit %d) Error: NULL pointer passed as parameter.\n"),
  11944                    unit));
  11945         return BCM_E_PARAM;
  11946     }
  11947 
  11948     rv = soc_mem_read(unit, MACSEC_DA_RANGEm, SOC_BLOCK_ALL, 0, &buf);
  11949     BCM_IF_ERROR_RETURN(rv);
  11950 
  11951     soc_mem_mac_addr_get(unit, MACSEC_DA_RANGEm, &buf, UPPERf, *upper_limit);
  11952     soc_mem_mac_addr_get(unit, MACSEC_DA_RANGEm, &buf, LOWERf, *lower_limit);
  11953 #endif
  11954     return rv;
  11955 }
  11956 
  11957 /*
  11958  * Function:
  11959  *     bcm_esw_field_qualify_FromMacSecPort
  11960  *
  11961  * Purpose:
  11962  *   To qualify on packet forwarded through the internal MACSEC port
  11963  *
  11964  * Parameters:
  11965  *    unit     BCM device number
  11966  *    entry    Field entry ID
  11967  *    data     Qualifier match data
  11968  *    mask     Qualifier match mask
  11969  *
  11970  * Returns:
  11971  *    BCM_E_NONE        Operation completed successfully
  11972  *    BCM_E_INIT        BCM unit not initialized
  11973  *    BCM_E_PARAM       Invalid Parameter passed
  11974  *    BCM_E_NOT_FOUND   Entry ID not found
  11975  */
  11976 int
  11977 bcm_esw_field_qualify_FromMacSecPort(
  11978                int unit,
  11979                bcm_field_entry_t entry_id,
  11980                uint8 data,
  11981                uint8 mask)
  11982 {
  11983     int    rv = BCM_E_UNAVAIL;
  11984 
  11985 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  11986 
  11987     if (data >> 1) {
  11988         LOG_ERROR(BSL_LS_BCM_FP,
  11989                   (BSL_META_U(unit,
  11990                               "FP(unit %d) Error: data=%d too large.\n"),
  11991                    unit, data));
  11992         return BCM_E_PARAM;
  11993     }
  11994 
  11995     FP_LOCK(unit);
  11996 
  11997     rv = _field_qualify32(unit, entry_id, bcmFieldQualifyFromMacSecPort, data, mask);
  11998 
  11999     FP_UNLOCK(unit);
  12000 #endif
  12001     return rv;
  12002 }
  12003 
  12004 /*
  12005  * Function:
  12006  *     bcm_esw_field_qualify_FromMacSecPort_get
  12007  *
  12008  * Purpose:
  12009  *   To get the qualified inputs on packet forwarded through the internal MACSEC port
  12010  *
  12011  * Parameters:
  12012  *    unit     BCM device number
  12013  *    entry    Field entry ID
  12014  *    data     Qualifier match data
  12015  *    mask     Qualifier match mask
  12016  *
  12017  * Returns:
  12018  *    BCM_E_NONE        Operation completed successfully
  12019  *    BCM_E_INIT        BCM unit not initialized
  12020  *    BCM_E_PARAM       Invalid Parameter passed
  12021  *    BCM_E_NOT_FOUND   Entry ID not found
  12022  */
  12023 int
  12024 bcm_esw_field_qualify_FromMacSecPort_get(
  12025                int unit,
  12026                bcm_field_entry_t entry_id,
  12027                uint8 *data,
  12028                uint8 *mask)
  12029 {
  12030     int    rv = BCM_E_UNAVAIL;
  12031 
  12032 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  12033 
  12034     if ((NULL == data) || (NULL == mask)) {
  12035         LOG_ERROR(BSL_LS_BCM_FP,
  12036                   (BSL_META_U(unit,
  12037                               "FP(unit %d) Error: NULL pointer passed as parameter.\n"),
  12038                    unit));
  12039         return BCM_E_PARAM;
  12040     }
  12041     
  12042     rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  12043                              bcmFieldQualifyFromMacSecPort,
  12044                              data, mask);
  12045 #endif
  12046     return rv;
  12047 }
  12048 
  12049 /*
  12050  * Function:
  12051  *     bcm_esw_field_qualify_MacSecFlow
  12052  *
  12053  * Purpose:
  12054  *   Qualifies on the MACSEC packet flow
  12055  *
  12056  * Parameters:
  12057  *    unit     BCM device number
  12058  *    entry    Field entry ID
  12059  *    data     Qualifier match data
  12060  *
  12061  * Returns:
  12062  *    BCM_E_NONE        Operation completed successfully
  12063  *    BCM_E_INIT        BCM unit not initialized
  12064  *    BCM_E_PARAM       Invalid Parameter passed
  12065  *    BCM_E_NOT_FOUND   Entry ID not found
  12066  */
  12067 int
  12068 bcm_esw_field_qualify_MacSecFlow(
  12069                int unit,
  12070                bcm_field_entry_t entry_id,
  12071                bcm_field_macsec_flow_t data)
  12072 {
  12073     int    rv = BCM_E_UNAVAIL;
  12074 
  12075 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  12076 
  12077     if (data >= bcmFieldMacSecFlowCount) {
  12078         LOG_ERROR(BSL_LS_BCM_FP,
  12079                   (BSL_META_U(unit,
  12080                               "FP(unit %d) Error: data=%d too large.\n"),
  12081                    unit, data));
  12082         return BCM_E_PARAM;
  12083     }
  12084 
  12085     FP_LOCK(unit);
  12086 
  12087     rv = _field_qualify32(unit, entry_id, bcmFieldQualifyMacSecFlow, data, BCM_FIELD_EXACT_MATCH_MASK);
  12088 
  12089     FP_UNLOCK(unit);
  12090 #endif
  12091     return rv;
  12092 }
  12093 
  12094 /*
  12095  * Function:
  12096  *     bcm_esw_field_qualify_MacSecFlow_get
  12097  *
  12098  * Purpose:
  12099  *   To get the qualified inputs on the MACSEC packet flow
  12100  *
  12101  * Parameters:
  12102  *    unit     BCM device number
  12103  *    entry    Field entry ID
  12104  *    data     Qualifier match data
  12105  *
  12106  * Returns:
  12107  *    BCM_E_NONE        Operation completed successfully
  12108  *    BCM_E_INIT        BCM unit not initialized
  12109  *    BCM_E_PARAM       Invalid Parameter passed
  12110  *    BCM_E_NOT_FOUND   Entry ID not found
  12111  */
  12112 int
  12113 bcm_esw_field_qualify_MacSecFlow_get(
  12114                int unit,
  12115                bcm_field_entry_t entry_id,
  12116                bcm_field_macsec_flow_t *data)
  12117 {
  12118     int    rv = BCM_E_UNAVAIL;
  12119 
  12120 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  12121     uint32  mask;
  12122 
  12123     if (NULL == data) {
  12124         LOG_ERROR(BSL_LS_BCM_FP,
  12125                   (BSL_META_U(unit,
  12126                               "FP(unit %d) Error: NULL pointer passed as parameter.\n"),
  12127                    unit));
  12128         return BCM_E_PARAM;
  12129     }
  12130     
  12131     rv =  _bcm_field_entry_qualifier_uint32_get(unit, entry_id,
  12132                              bcmFieldQualifyMacSecFlow,
  12133                              data, &mask);
  12134 #endif
  12135     return rv;
  12136 }
  12137 
  12138 /*
  12139  * Function:
  12140  *     bcm_esw_field_qualify_RoeFrameType
  12141  *
  12142  * Purpose:
  12143  * Qualifies on Roe frame type set in MPLS entry for a MPLS packet or based on
  12144  * UDP port number for an IP tunnel packet.
  12145  * Roe frame types are defined by bcm_field_roe_frame_type_t.
  12146  *
  12147  * Parameters:
  12148  *    unit     BCM device number
  12149  *    entry    Field entry ID
  12150  *    data     Qualifier match data
  12151  *
  12152  * Returns:
  12153  *    BCM_E_NONE        Operation completed successfully
  12154  *    BCM_E_INIT        BCM unit not initialized
  12155  *    BCM_E_PARAM       Invalid Parameter passed
  12156  *    BCM_E_NOT_FOUND   Entry ID not found
  12157  */
  12158 int
  12159 bcm_esw_field_qualify_RoeFrameType(int unit,
  12160                                    bcm_field_entry_t entry_id,
  12161                                    bcm_field_roe_frame_type_t data)
  12162 {
  12163     int    rv = BCM_E_UNAVAIL;
  12164 #if defined(BCM_MONTEREY_SUPPORT)
  12165     uint32 q_data, q_mask;
  12166 
  12167     if (data >= bcmFieldRoeFrameTypeCount) {
  12168         LOG_ERROR(BSL_LS_BCM_FP,
  12169                   (BSL_META_U(unit,
  12170                               "FP(unit %d) Error: data=%d too large.\n"),
  12171                    unit, data));
  12172         return BCM_E_PARAM;
  12173     }
  12174 
  12175     switch (data) {
  12176     case bcmFieldRoeFrameTypeNone:
  12177         q_data = 0;
  12178         break;
  12179     case bcmFieldRoeFrameTypeRoe:
  12180         q_data = 2;
  12181         break;
  12182     case bcmFieldRoeFrameTypeCustom:
  12183         q_data = 1;
  12184         break;
  12185     default :
  12186         return BCM_E_PARAM;
  12187     }
  12188 
  12189     q_mask = 3;
  12190 
  12191     FP_LOCK(unit);
  12192 
  12193     rv = _field_qualify32(unit, entry_id, bcmFieldQualifyRoeFrameType,
  12194                           q_data, q_mask);
  12195 
  12196     FP_UNLOCK(unit);
  12197 #endif
  12198     return rv;
  12199 }
  12200 
  12201 /*
  12202  * Function:
  12203  *     bcm_esw_field_qualify_RoeFrameType_get
  12204  *
  12205  * Purpose:
  12206  *   To get the qualified inputs on the Roe frame type
  12207  *
  12208  * Parameters:
  12209  *    unit     BCM device number
  12210  *    entry    Field entry ID
  12211  *    data     Qualifier match data
  12212  *
  12213  * Returns:
  12214  *    BCM_E_NONE        Operation completed successfully
  12215  *    BCM_E_INIT        BCM unit not initialized
  12216  *    BCM_E_PARAM       Invalid Parameter passed
  12217  *    BCM_E_NOT_FOUND   Entry ID not found
  12218  */
  12219 int
  12220 bcm_esw_field_qualify_RoeFrameType_get(int unit, bcm_field_entry_t entry_id,
  12221                                    bcm_field_roe_frame_type_t *data)
  12222 {
  12223     int    rv = BCM_E_UNAVAIL;
  12224 #if defined(BCM_MONTEREY_SUPPORT)
  12225     uint8  q_data = 0, q_mask = 0;
  12226 
  12227     if (NULL == data) {
  12228         LOG_ERROR(BSL_LS_BCM_FP,
  12229                   (BSL_META_U(unit,
  12230                               "FP(unit %d) Error: NULL pointer passed as parameter.\n"),
  12231                    unit));
  12232         return BCM_E_PARAM;
  12233     }
  12234 
  12235     rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry_id,
  12236                                                bcmFieldQualifyRoeFrameType,
  12237                                                &q_data, &q_mask);
  12238     if (BCM_SUCCESS(rv)) {
  12239         if (q_data == 0 && q_mask == 0) {
  12240             return BCM_E_UNAVAIL;
  12241         }
  12242 
  12243         switch (q_data & q_mask) {
  12244         case 0:
  12245             *data = bcmFieldRoeFrameTypeNone;
  12246             break;
  12247         case 1:
  12248             *data = bcmFieldRoeFrameTypeCustom;
  12249             break;
  12250         case 2:
  12251             *data = bcmFieldRoeFrameTypeRoe;
  12252             break;
  12253         default :
  12254             return BCM_E_INTERNAL;
  12255         }
  12256     }
  12257 #endif
  12258     return rv;
  12259 }
  12260 
  12261 /*
  12262  * Function:
  12263  *      bcm_esw_field_qualify_DstHiGig
  12264  * Purpose:
  12265  *      Qualify on HiGig destination packets.
  12266  * Parameters:
  12267  *      unit - (IN) Unit number.
  12268  *      entry - (IN) BCM field entry id.
  12269  *      data - (IN) Qualifier match data.
  12270  *      mask - (IN) Qualifier match mask.
  12271  * Returns:
  12272  *      BCM_E_XXX
  12273  * Notes:
  12274  */
  12275 int 
  12276 bcm_esw_field_qualify_DstHiGig(
  12277     int unit, 
  12278     bcm_field_entry_t entry, 
  12279     uint8 data, 
  12280     uint8 mask)
  12281 {
  12282     int rv;                 /* Operation return status. */
  12283 
  12284     
  12285     FP_LOCK(unit);
  12286 
  12287     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstHiGig,
  12288                           data, mask);
  12289     FP_UNLOCK(unit);
  12290     return (rv);
  12291 }
  12292 
  12293 /*
  12294  * Function:
  12295  *      bcm_esw_field_qualify_DstHiGig_get
  12296  * Purpose:
  12297  *      Get match criteria for bcmFieildQualifyDstHiGig
  12298  *                     qualifier from the field entry.
  12299  * Parameters:
  12300  *      unit - (IN) Unit number.
  12301  *      entry - (IN) BCM field entry id.
  12302  *      data - (OUT) Qualifier match data.
  12303  *      mask - (OUT) Qualifier match mask.
  12304  * Returns:
  12305  *      BCM_E_XXX
  12306  * Notes:
  12307  */
  12308 int 
  12309 bcm_esw_field_qualify_DstHiGig_get(
  12310     int unit, 
  12311     bcm_field_entry_t entry, 
  12312     uint8 *data, 
  12313     uint8 *mask)
  12314 {
  12315     /* Read qualifier match value and mask. */
  12316     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  12317                                             bcmFieldQualifyDstHiGig,
  12318                                             data, mask);
  12319 }
  12320 
  12321 /*
  12322  * Function:
  12323  *      bcm_esw_field_qualify_HiGigProxy
  12324  * Purpose:
  12325  *      Qualify on HiGig lookedup packets.
  12326  * Parameters:
  12327  *      unit - (IN) Unit number.
  12328  *      entry - (IN) BCM field entry id.
  12329  *      data - (IN) Qualifier match data.
  12330  *      mask - (IN) Qualifier match mask.
  12331  * Returns:
  12332  *      BCM_E_XXX
  12333  * Notes:
  12334  */
  12335 int
  12336 bcm_esw_field_qualify_HiGigProxy(
  12337     int unit,
  12338     bcm_field_entry_t entry,
  12339     uint8 data,
  12340     uint8 mask)
  12341 {
  12342     int rv;                 /* Operation return status. */
  12343 
  12344     
  12345     FP_LOCK(unit);
  12346 
  12347     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigProxy,
  12348                           data, mask);
  12349     FP_UNLOCK(unit);
  12350     return (rv);
  12351 }
  12352 /*
  12353  * Function:
  12354  *      bcm_esw_field_qualify_HiGigProxy_get
  12355  * Purpose:
  12356  *      Get match criteria for bcmFieildQualifyHiGigProxy
  12357  *                     qualifier from the field entry.
  12358  * Parameters:
  12359  *      unit - (IN) Unit number.
  12360  *      entry - (IN) BCM field entry id.
  12361  *      data - (OUT) Qualifier match data.
  12362  *      mask - (OUT) Qualifier match mask.
  12363  * Returns:
  12364  *      BCM_E_XXX
  12365  * Notes:
  12366  */
  12367 int
  12368 bcm_esw_field_qualify_HiGigProxy_get(
  12369     int unit,
  12370     bcm_field_entry_t entry,
  12371     uint8 *data,
  12372     uint8 *mask)
  12373 {
  12374     /* Read qualifier match value and mask. */
  12375     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  12376                                             bcmFieldQualifyHiGigProxy,
  12377                                             data, mask);
  12378 }
  12379 /*
  12380  * Function:
  12381  *     bcm_field_qualify_HiGig
  12382  *
  12383  * Purpose:
  12384  *     Set a HiGig packet qualification on an entry.
  12385  *
  12386  * Parameters:
  12387  *     unit     - BCM unit number
  12388  *     entry    - Entry ID
  12389  *     data     - HiGig packet != 0, non-HiGig packet = 0
  12390  *     mask     - don't care = 0
  12391  *
  12392  * Returns:
  12393  *     BCM_E_NONE   - Success
  12394  *     BCM_E_PARAM  - bcmFieldQualifyHiGig not in group's Qset
  12395  */
  12396 int
  12397 bcm_esw_field_qualify_HiGig(int unit, bcm_field_entry_t entry,
  12398                             uint8 data, uint8 mask)
  12399 {
  12400     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
  12401     _field_entry_t   *f_ent;  /* Field entry structure.   */
  12402     _field_group_t   *fg;     /* Field group structure.   */
  12403 
  12404     
  12405     FP_LOCK(unit);
  12406 
  12407     if (SOC_IS_TRX(unit)) {
  12408         /* In Triumph, Higig is part of FIXED field of TCAM */
  12409         rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGig,
  12410                               data ? 1 : 0, mask ? 1 : 0);
  12411     } else if (SOC_IS_FBX(unit)) {
  12412         rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  12413         if (BCM_FAILURE(rv)) {
  12414             FP_UNLOCK(unit);
  12415             return (rv);
  12416         }
  12417 
  12418         if (f_ent->group->stage_id == _BCM_FIELD_STAGE_LOOKUP) {
  12419             /* FB2 Stage Lookup Higig qualifier is part of the F3. */
  12420             rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGig,
  12421                     data ? 1 : 0, mask ? 1 : 0);
  12422         } else {
  12423             /* Confirm that HiGig is in group's Qset. */
  12424             fg = f_ent->group;
  12425             if (0 == BCM_FIELD_QSET_TEST(fg->qset, bcmFieldQualifyHiGig)) {
  12426                 FP_UNLOCK(unit);
  12427                 LOG_ERROR(BSL_LS_BCM_FP,
  12428                           (BSL_META_U(unit,
  12429                                       "FP(unit %d) Error: HiGig not in entry=%d Qset.\n"),
  12430                            unit, entry));
  12431                 return (BCM_E_PARAM);
  12432             }
  12433 
  12434             /* Add data & mask to entry. */
  12435             f_ent->tcam.higig      = data;
  12436             f_ent->tcam.higig_mask = mask;
  12437         }
  12438     }
  12439     FP_UNLOCK(unit);
  12440     return (rv);
  12441 }
  12442 
  12443 /*
  12444  * Function:
  12445  *     bcm_esw_field_qualify_InterfaceClassPort
  12446  *
  12447  * Purpose:
  12448  *     Set a Port interface class id packet qualification on an entry.
  12449  *
  12450  * Parameters:
  12451  *     unit     - (IN) BCM unit number
  12452  *     entry    - (IN) Entry ID
  12453  *     data     - (IN) Interface Class id.
  12454  *     mask     - (IN) Interface Class mask. 
  12455  *
  12456  * Returns:
  12457  *     BCM_E_XXX
  12458  */
  12459 int
  12460 bcm_esw_field_qualify_InterfaceClassPort(int unit, bcm_field_entry_t entry,
  12461                                          uint32 data, uint32 mask)
  12462 {
  12463 
  12464     int rv;                 /* Operation return status. */
  12465 
  12466     if (data  > SOC_INTF_CLASS_MAX(unit)) {
  12467         LOG_ERROR(BSL_LS_BCM_FP,
  12468                   (BSL_META_U(unit,
  12469                               "FP(unit %d) Error: data=%#x out-of-range\n"),
  12470                    unit, data));
  12471         return (BCM_E_PARAM);
  12472     }
  12473 
  12474     
  12475     FP_LOCK(unit);
  12476 
  12477     rv = _field_qualify32(unit, entry, bcmFieldQualifyInterfaceClassPort,
  12478                           data, mask);
  12479     FP_UNLOCK(unit);
  12480     return (rv);
  12481 }
  12482 
  12483 /*
  12484  * Function:
  12485  *     bcm_esw_field_qualify_InterfaceClassVPort
  12486  *
  12487  * Purpose:
  12488  *     Set a Port interface class id packet qualification on an entry.
  12489  *
  12490  * Parameters:
  12491  *     unit     - (IN) BCM unit number
  12492  *     entry    - (IN) Entry ID
  12493  *     data     - (IN) Interface Class id.
  12494  *     mask     - (IN) Interface Class mask.
  12495  *
  12496  * Returns:
  12497  *     BCM_E_XXX
  12498  */
  12499 int
  12500 bcm_esw_field_qualify_InterfaceClassVPort(int unit, bcm_field_entry_t entry,
  12501                                          uint32 data, uint32 mask)
  12502 {
  12503 
  12504     int rv;                 /* Operation return status. */
  12505 
  12506 
  12507     if (data  > SOC_INTF_CLASS_MAX(unit)) {
  12508         LOG_ERROR(BSL_LS_BCM_FP,
  12509                   (BSL_META_U(unit,
  12510                               "FP(unit %d) Error: data=%#x out-of-range\n"),
  12511                    unit, data));
  12512         return (BCM_E_PARAM);
  12513     }
  12514 
  12515     
  12516     FP_LOCK(unit);
  12517 
  12518     rv = _field_qualify32(unit, entry, bcmFieldQualifyInterfaceClassVPort,
  12519                           data, mask);
  12520     FP_UNLOCK(unit);
  12521     return (rv);
  12522 }
  12523 
  12524 
  12525 
  12526 
  12527 /*
  12528  * Function:
  12529  *     bcm_esw_field_qualify_InterfaceClassL2
  12530  *
  12531  * Purpose:
  12532  *     Set a Port interface class id packet qualification on an entry.
  12533  *
  12534  * Parameters:
  12535  *     unit     - (IN) BCM unit number
  12536  *     entry    - (IN) Entry ID
  12537  *     data     - (IN) Interface Class id.
  12538  *     mask     - (IN) Interface Class mask. 
  12539  *
  12540  * Returns:
  12541  *     BCM_E_XXX
  12542  */
  12543 int
  12544 bcm_esw_field_qualify_InterfaceClassL2(int unit, bcm_field_entry_t entry,
  12545                                          uint32 data, uint32 mask)
  12546 {
  12547     int rv;                 /* Operation return status. */
  12548 
  12549 #if defined(BCM_TOMAHAWK_SUPPORT)
  12550     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  12551         BCM_IF_ERROR_RETURN
  12552           (_bcm_field_th_qualify_class(unit, entry,
  12553                                        bcmFieldQualifyInterfaceClassL2,
  12554                                        &data, &mask));
  12555     } else
  12556 #endif /* BCM_TOMAHAWK_SUPPORT */
  12557 #ifdef BCM_TRIDENT2_SUPPORT
  12558     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  12559         BCM_IF_ERROR_RETURN
  12560             (_bcm_field_td2_qualify_class(unit,
  12561                                           entry,
  12562                                           bcmFieldQualifyInterfaceClassL2,
  12563                                           &data,
  12564                                           &mask
  12565                                           )
  12566             );
  12567     } else
  12568 #endif
  12569 #ifdef BCM_TRIUMPH3_SUPPORT
  12570     if (SOC_IS_TRIUMPH3(unit)) {
  12571         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
  12572                                                          entry,
  12573                                                          bcmFieldQualifyInterfaceClassL2,
  12574                                                          &data,
  12575                                                          &mask
  12576                                                          )
  12577                             );
  12578     } else 
  12579 #endif    
  12580 #ifdef BCM_KATANA2_SUPPORT
  12581     if (SOC_IS_KATANA2(unit)) {
  12582         BCM_IF_ERROR_RETURN
  12583             (_bcm_field_kt2_qualify_class(unit,
  12584                                           entry,
  12585                                           bcmFieldQualifyInterfaceClassL2,
  12586                                           &data,
  12587                                           &mask
  12588                                           ));
  12589     } else {
  12590 #endif /* BCM_KATANA2_SUPPORT */
  12591         if (data  > SOC_INTF_CLASS_MAX(unit)) {
  12592             LOG_ERROR(BSL_LS_BCM_FP,
  12593                       (BSL_META_U(unit,
  12594                                   "FP(unit %d) Error: data=%#x out-of-range\n"),
  12595                        unit, data));
  12596             return (BCM_E_PARAM);
  12597         }
  12598 #ifdef BCM_KATANA2_SUPPORT
  12599     }
  12600 #endif
  12601 
  12602     
  12603     FP_LOCK(unit);
  12604 
  12605     rv = _field_qualify32(unit, entry, bcmFieldQualifyInterfaceClassL2,
  12606                           data, mask);
  12607     FP_UNLOCK(unit);
  12608     return (rv);
  12609 }
  12610 
  12611 
  12612 /*
  12613  * Function:
  12614  *     bcm_esw_field_qualify_InterfaceClassL3
  12615  *
  12616  * Purpose:
  12617  *     Set a L3 interface class id packet qualification on an entry.
  12618  *
  12619  * Parameters:
  12620  *     unit     - (IN) BCM unit number
  12621  *     entry    - (IN) Entry ID
  12622  *     data     - (IN) Interface Class id.
  12623  *     mask     - (IN) Interface Class mask. 
  12624  *
  12625  * Returns:
  12626  *     BCM_E_XXX
  12627  */
  12628 int
  12629 bcm_esw_field_qualify_InterfaceClassL3(int unit, bcm_field_entry_t entry,
  12630                                        uint32 data, uint32 mask)
  12631 {
  12632     int rv;                 /* Operation return status. */
  12633 
  12634 #if defined(BCM_TOMAHAWK_SUPPORT)
  12635     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  12636         BCM_IF_ERROR_RETURN
  12637           (_bcm_field_th_qualify_class(unit, entry,
  12638                                        bcmFieldQualifyInterfaceClassL3,
  12639                                        &data, &mask));
  12640     } else
  12641 #endif /* BCM_TOMAHAWK_SUPPORT */
  12642 #ifdef BCM_TRIDENT2_SUPPORT
  12643     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  12644         BCM_IF_ERROR_RETURN
  12645             (_bcm_field_td2_qualify_class(unit,
  12646                                           entry,
  12647                                           bcmFieldQualifyInterfaceClassL3,
  12648                                           &data,
  12649                                           &mask
  12650                                           )
  12651             );
  12652     } else
  12653 #endif
  12654 #ifdef BCM_TRIUMPH3_SUPPORT
  12655     if (SOC_IS_TRIUMPH3(unit)) {
  12656         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
  12657                                                          entry,
  12658                                                          bcmFieldQualifyInterfaceClassL3,
  12659                                                          &data,
  12660                                                          &mask
  12661                                                          )
  12662                             );
  12663     } else
  12664 #endif    
  12665 #ifdef BCM_KATANA2_SUPPORT
  12666     if (SOC_IS_KATANA2(unit)) {
  12667         BCM_IF_ERROR_RETURN
  12668             (_bcm_field_kt2_qualify_class(unit,
  12669                                           entry,
  12670                                           bcmFieldQualifyInterfaceClassL3,
  12671                                           &data,
  12672                                           &mask
  12673                                           ));
  12674     } else {
  12675 #endif /* BCM_KATANA2_SUPPORT */
  12676         if (data  > SOC_INTF_CLASS_MAX(unit)) {
  12677             LOG_ERROR(BSL_LS_BCM_FP,
  12678                       (BSL_META_U(unit,
  12679                                   "FP(unit %d) Error: data=%#x out-of-range\n"),
  12680                        unit, data));
  12681             return (BCM_E_PARAM);
  12682         }
  12683 #ifdef BCM_KATANA2_SUPPORT
  12684     }
  12685 #endif
  12686 
  12687     
  12688     FP_LOCK(unit);
  12689 
  12690     rv = _field_qualify32(unit, entry, bcmFieldQualifyInterfaceClassL3,
  12691                             data, mask);
  12692     FP_UNLOCK(unit);
  12693     return (rv);
  12694 }
  12695 
  12696 int 
  12697 bcm_esw_field_qualify_TcpSequenceZero(int unit, bcm_field_entry_t entry,
  12698                             uint32 flag)
  12699 {
  12700     return (BCM_E_UNAVAIL);
  12701 }
  12702 
  12703 int
  12704 bcm_esw_field_qualify_TcpHeaderSize(int unit, bcm_field_entry_t entry,
  12705                                  uint8 data, uint8 mask)
  12706 {
  12707     return (BCM_E_UNAVAIL);
  12708 }
  12709 
  12710 /* Function: 
  12711  *       bcm_field_qualify_InnerIpProtocolCommon
  12712  * Description:
  12713  *       Qualify common L3 protocol ID.
  12714  * Parameters: 
  12715  *   unit     (IN) BCM device number
  12716  *   entry    (IN) Field entry to qualify
  12717  *   protocol (IN) Protocol name to qualify
  12718  * Returns: 
  12719  *   BCM_E_XXX
  12720  */
  12721 int
  12722 bcm_esw_field_qualify_InnerIpProtocolCommon(int unit, bcm_field_entry_t entry,
  12723                                        bcm_field_IpProtocolCommon_t protocol)
  12724 {
  12725     int      rv;            /* Operation return status. */
  12726 
  12727     
  12728     FP_LOCK(unit);
  12729 
  12730     rv = _field_qualify_IpProtocolCommon(unit, entry, 
  12731                                          bcmFieldQualifyInnerIpProtocolCommon, 
  12732                                          protocol);
  12733     FP_UNLOCK(unit);
  12734     return (rv);
  12735 }
  12736 
  12737 
  12738 /* Function: 
  12739  *           bcm_field_qualify_IpProtocolCommon
  12740  * Description: 
  12741  *           Qualify common L3 protocol ID
  12742  * Parameters: 
  12743  *   unit     (IN) BCM device number
  12744  *   entry    (IN) Field entry to qualify
  12745  *   protocol (IN) Protocol name to qualify
  12746  * Returns: 
  12747  *   BCM_E_XXX
  12748  */
  12749 int
  12750 bcm_esw_field_qualify_IpProtocolCommon(int unit, bcm_field_entry_t entry,
  12751                                        bcm_field_IpProtocolCommon_t protocol)
  12752 {
  12753     int      rv;            /* Operation return status. */
  12754 
  12755     
  12756     FP_LOCK(unit);
  12757 
  12758     rv = _field_qualify_IpProtocolCommon(unit, entry, bcmFieldQualifyIpProtocolCommon, protocol);
  12759 
  12760     FP_UNLOCK(unit);
  12761     return (rv);
  12762 }
  12763 
  12764 /* Function    : bcm_field_qualify_Snap
  12765  * Description : qualify SNAP headers.
  12766  * Parameters  : (IN) unit     BCM device number
  12767  *               (IN) entry    Field entry to qualify
  12768  *               (IN) data     SNAP fields to qualify
  12769  *               (IN) mask     SNAP mask to qualify
  12770  * Returns     : BCM_E_XXX
  12771  */
  12772 int
  12773 bcm_esw_field_qualify_Snap(int unit, bcm_field_entry_t entry,
  12774                            bcm_field_snap_header_t data, 
  12775                            bcm_field_snap_header_t mask)
  12776 {
  12777     _field_entry_t           *f_ent;
  12778     _bcm_field_qual_offset_t *q_offset;
  12779     uint32                   ref_data[_FP_QUAL_DATA_WORDS];
  12780     uint32                   ref_mask[_FP_QUAL_DATA_WORDS];
  12781     int                      rv; 
  12782 
  12783 
  12784     ref_data[1] = (data.org_code & 0x00ff0000) >> 16;
  12785     ref_data[0] = (data.org_code & 0x0000ffff) << 16 | data.type;
  12786 
  12787     ref_mask[1] = (mask.org_code & 0x00ff0000) >> 16;
  12788     ref_mask[0] = (mask.org_code & 0x0000ffff) << 16 | mask.type;
  12789 
  12790 
  12791     
  12792     FP_LOCK(unit);
  12793 
  12794 
  12795     /* Get field entry part that contains the qualifier. */
  12796     rv = _bcm_field_entry_qual_get(unit, entry, bcmFieldQualifySnap, &f_ent);
  12797     if (BCM_FAILURE(rv)) {
  12798         FP_UNLOCK(unit);
  12799         return (rv);
  12800     }
  12801 
  12802 #if defined(BCM_TOMAHAWK_SUPPORT)
  12803     /* If device supports per-pipe FP configuration, */
  12804     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  12805         ((f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) ||
  12806          (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXACTMATCH))) {
  12807         /* coverity[callee_ptr_arith : FALSE] */
  12808         rv = (_bcm_field_th_qualify_set(unit, entry, bcmFieldQualifySnap,
  12809                                         ref_data, ref_mask,
  12810                                         _FP_QUALIFIER_ADD));
  12811         FP_UNLOCK(unit);
  12812         return (rv);
  12813     }
  12814     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  12815         (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS)) {
  12816         rv =  (_bcm_field_th_class_qualify_set(unit, entry, bcmFieldQualifySnap,
  12817                                                ref_data, ref_mask));
  12818         FP_UNLOCK(unit);
  12819         return (rv);
  12820     }
  12821 #endif /* BCM_TOMAHAWK_SUPPORT */
  12822 
  12823     /* Get qualifier offsets in the tcam. */
  12824     rv = _field_qual_offset_get(unit, f_ent, bcmFieldQualifySnap, &q_offset);
  12825     if (BCM_FAILURE(rv)) {
  12826         FP_UNLOCK(unit);
  12827         return (rv);
  12828     }
  12829 
  12830     /* Program data/mask pair to tcam buffer. */
  12831     /* coverity[callee_ptr_arith : FALSE] */
  12832     rv = _bcm_field_qual_value_set(unit, q_offset, f_ent, 
  12833                                    ref_data, ref_mask);
  12834     FP_UNLOCK(unit);
  12835     return (rv);
  12836 }
  12837 
  12838 /* Function    : bcm_field_qualify_Llc
  12839  * Description : qualify LLC headers.
  12840  * Parameters  : (IN) unit     BCM device number
  12841  *               (IN) entry    Field entry to qualify
  12842  *               (IN) data     LLC fields to qualify
  12843  *               (IN) mask     LLC mask to qualify
  12844  * Returns     : BCM_E_XXX
  12845  */
  12846 int
  12847 bcm_esw_field_qualify_Llc(int unit, bcm_field_entry_t entry,
  12848                           bcm_field_llc_header_t data, 
  12849                           bcm_field_llc_header_t mask)
  12850 {
  12851     uint32              ref_data;
  12852     uint32              ref_mask;
  12853     int                 rv; 
  12854 
  12855     
  12856     FP_LOCK(unit);
  12857 
  12858     ref_data = (data.dsap << 16) | (data.ssap << 8) | \
  12859                data.control; 
  12860     ref_mask = (mask.dsap << 16) | (mask.ssap << 8) | \
  12861                mask.control; 
  12862     rv = _field_qualify32(unit, entry, bcmFieldQualifyLlc,
  12863                           ref_data, ref_mask);
  12864     FP_UNLOCK(unit);
  12865     return (rv);
  12866 }
  12867 
  12868 /* Function    : bcm_field_qualify_InnerTpid
  12869  * Description : qualify outer/inner Tpid
  12870  * Parameters  : (IN) unit   BCM driver unit
  12871  *               (IN) entry  Field entry to qualify
  12872  *               (IN) tpid   TPID to qualify
  12873  * Returns     : BCM_E_XXX
  12874  */
  12875 int
  12876 bcm_esw_field_qualify_InnerTpid(int unit, bcm_field_entry_t entry,
  12877                                 uint16 tpid)
  12878 {
  12879     int     rv = BCM_E_UNAVAIL; 
  12880 #if defined(BCM_FIREBOLT2_SUPPORT) || defined (BCM_TRX_SUPPORT)
  12881     uint32  mask;
  12882     uint32  data;
  12883 
  12884 #if defined(BCM_TRIDENT3_SUPPORT)
  12885     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  12886         BCM_IF_ERROR_RETURN(_bcm_field_td3_tpid_hw_encode(unit, tpid, 0, &data));
  12887     } else
  12888 #endif
  12889     {
  12890     if (SOC_IS_FIREBOLT2(unit) || SOC_IS_TRX(unit)) {
  12891         BCM_IF_ERROR_RETURN(_bcm_field_tpid_hw_encode(unit, tpid, &data));
  12892         } else {
  12893             return rv;
  12894         }
  12895     }
  12896         mask = 0x03;
  12897         
  12898         FP_LOCK(unit);
  12899         rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerTpid, data, mask);
  12900         FP_UNLOCK(unit);
  12901 #endif /* BCM_FIREBOLT2_SUPPORT || BCM_TRX_SUPPORT */
  12902     return (rv);
  12903 }
  12904 
  12905 /* Function    : bcm_field_qualify_OuterTpid
  12906  * Description : qualify outer Tpid
  12907  * Parameters  : (IN) unit   BCM driver unit
  12908  *               (IN) entry  Field entry to qualify
  12909  *               (IN) tpid   TPID to qualify
  12910  * Returns     : BCM_E_XXX
  12911  */
  12912 int
  12913 bcm_esw_field_qualify_OuterTpid(int unit, bcm_field_entry_t entry,
  12914                                 uint16 tpid)
  12915 {
  12916     int     rv = BCM_E_UNAVAIL; 
  12917 #if defined(BCM_FIREBOLT2_SUPPORT) || defined (BCM_TRX_SUPPORT)
  12918     uint32  mask;
  12919     uint32  data;
  12920 
  12921 #if defined(BCM_TRIDENT3_SUPPORT)
  12922     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  12923         BCM_IF_ERROR_RETURN(_bcm_field_td3_tpid_hw_encode(unit, tpid, 1, &data));
  12924     } else
  12925 #endif
  12926     {
  12927     if (SOC_IS_FIREBOLT2(unit) || SOC_IS_TRX(unit)) {
  12928         BCM_IF_ERROR_RETURN(_bcm_field_tpid_hw_encode(unit, tpid, &data));
  12929         } else {
  12930             return rv;
  12931         }
  12932     }
  12933         mask = 0x03;
  12934         
  12935         FP_LOCK(unit);
  12936         rv = _field_qualify32(unit, entry, bcmFieldQualifyOuterTpid, data, mask);
  12937         FP_UNLOCK(unit);
  12938 #endif /* BCM_FIREBOLT2_SUPPORT || BCM_TRX_SUPPORT */
  12939     return (rv);
  12940 }
  12941 
  12942 /* Function    : bcm_esw_field_qualify_L3Routable
  12943  * Description : qualify on the L3 Routable bit.
  12944  * Parameters  : (IN) unit   BCM device number
  12945  *               (IN) entry  Field entry to qualify
  12946  *               (IN) data   Single bit
  12947  *               (IN) mask   Single bit mask
  12948  * Returns     : BCM_E_XXX
  12949  */
  12950 int bcm_esw_field_qualify_L3Routable(int unit, bcm_field_entry_t entry,
  12951                                   uint8 data, uint8 mask)
  12952 {
  12953     int rv;
  12954 
  12955     
  12956     FP_LOCK(unit);
  12957 
  12958     rv = _field_qualify32(unit, entry, bcmFieldQualifyL3Routable, data, mask);
  12959 
  12960     FP_UNLOCK(unit);
  12961     return (rv);
  12962 }
  12963 
  12964 /* Function    : bcm_esw_field_qualify_IpFrag
  12965  * Description : qualify on Ip Frag Info.
  12966  * Parameters  : (IN) unit       BCM device number
  12967  *               (IN) entry      Field entry to qualify
  12968  *               (IN) frag_info  bcm_field_IpFrag_t to qualify
  12969  * Returns     : BCM_E_XXX
  12970  */
  12971 int bcm_esw_field_qualify_IpFrag(int unit, bcm_field_entry_t entry,
  12972                                   bcm_field_IpFrag_t frag_info)
  12973 {
  12974     int             rv = BCM_E_UNAVAIL;
  12975 #if defined(BCM_FIREBOLT2_SUPPORT) || defined(BCM_TRX_SUPPORT) \
  12976     || defined(BCM_RAPTOR_SUPPORT)
  12977 
  12978     
  12979     FP_LOCK(unit);
  12980 
  12981     if (SOC_IS_FIREBOLT2(unit) || SOC_IS_TRX(unit) || 
  12982         SOC_IS_RAVEN(unit) || SOC_IS_HAWKEYE(unit)) {
  12983         rv = _field_qualify_IpFrag(unit, entry, bcmFieldQualifyIpFrag, frag_info);
  12984     }
  12985     FP_UNLOCK(unit);
  12986 #endif /* BCM_FIREBOLT2_SUPPORT || BCM_TRX_SUPPORT || BCM_RAPTOR_SUPPORT */
  12987     return (rv);
  12988 }
  12989 
  12990 /* Function    : bcm_esw_field_qualify_Vrf
  12991  * Description : qualify on the VRF id.
  12992  * Parameters  : (IN) unit   BCM device number
  12993  *               (IN) entry  Field entry to qualify
  12994  *               (IN) data   Vrf id. 
  12995  *               (IN) mask   Vrf mask.
  12996  * Returns     : BCM_E_XXX
  12997  */
  12998 int bcm_esw_field_qualify_Vrf(int unit, bcm_field_entry_t entry,
  12999                               uint32 data, uint32 mask)
  13000 {
  13001     int rv = BCM_E_UNAVAIL;
  13002 
  13003     FP_LOCK(unit);
  13004 
  13005     rv = _field_qualify32(unit, entry, bcmFieldQualifyVrf, data, mask);
  13006 
  13007     FP_UNLOCK(unit);
  13008     return (rv);
  13009 }
  13010 
  13011 /* Function    : bcm_esw_field_qualify_L3Ingress
  13012  * Description : qualify on the L3 ingress interface.
  13013  * Parameters  : (IN) unit   BCM device number
  13014  *               (IN) entry  Field entry to qualify
  13015  *               (IN) data   L3 ingress id. 
  13016  *               (IN) mask   L3 ingress mask.
  13017  * Returns     : BCM_E_XXX
  13018  */
  13019 
  13020 int bcm_esw_field_qualify_L3Ingress(int unit, bcm_field_entry_t entry,
  13021     uint32 data, uint32 mask)
  13022 {
  13023     int rv = BCM_E_UNAVAIL;
  13024 
  13025     
  13026     FP_LOCK(unit);
  13027 
  13028     rv = _field_qualify32(unit, entry, bcmFieldQualifyL3Ingress, data, mask);
  13029 
  13030     FP_UNLOCK(unit);
  13031     return (rv);
  13032 }
  13033 
  13034 /* Function    : bcm_esw_field_qualify_L4Ports
  13035  * Description : qualify on the 4 bytes after L3 header.
  13036  * Parameters  : (IN) unit   BCM device number
  13037  *               (IN) entry  Field entry to qualify
  13038  *               (IN) data   0/1 4 bytes after L3 header are present. 
  13039  *               (IN) mask   data mask.
  13040  * Returns     : BCM_E_XXX
  13041  */
  13042 int bcm_esw_field_qualify_L4Ports(int unit, bcm_field_entry_t entry,
  13043                                   uint8 data, uint8 mask)
  13044 {
  13045     int rv = BCM_E_UNAVAIL;
  13046 
  13047     
  13048     FP_LOCK(unit);
  13049 
  13050 #if defined(BCM_TRX_SUPPORT)
  13051     if (SOC_IS_TRX(unit)) {
  13052         rv = _field_qualify32(unit, entry, bcmFieldQualifyL4Ports, data, mask);
  13053     }
  13054 #endif  /* BCM_TRX_SUPPORT */
  13055     FP_UNLOCK(unit);
  13056     return (rv);
  13057 }
  13058 
  13059 /* Function    : bcm_esw_field_qualify_MirrorCopy
  13060  * Description : qualify on the mirrored packets only.
  13061  * Parameters  : (IN) unit   BCM device number
  13062  *               (IN) entry  Field entry to qualify
  13063  *               (IN) data   0/1 Not Mirrored/Mirrored packets. 
  13064  *               (IN) mask   data mask.
  13065  * Returns     : BCM_E_XXX
  13066  */
  13067 int bcm_esw_field_qualify_MirrorCopy(int unit, bcm_field_entry_t entry,
  13068                                   uint8 data, uint8 mask)
  13069 {
  13070     int rv = BCM_E_UNAVAIL;
  13071 
  13072     
  13073     FP_LOCK(unit);
  13074 
  13075     rv = _field_qualify32(unit, entry, bcmFieldQualifyMirrorCopy, data, mask);
  13076 
  13077     FP_UNLOCK(unit);
  13078     return (rv);
  13079 }
  13080 
  13081 
  13082 /* Function    : bcm_esw_field_qualify_TunnelTerminated
  13083  * Description : qualify on the tunnel terminated packets only.
  13084  * Parameters  : (IN) unit   BCM device number
  13085  *               (IN) entry  Field entry to qualify
  13086  *               (IN) data   0/1 Not Tunneled/Tunnel Terminated packets. 
  13087  *               (IN) mask   data mask.
  13088  * Returns     : BCM_E_XXX
  13089  */
  13090 int bcm_esw_field_qualify_TunnelTerminated(int unit, bcm_field_entry_t entry,
  13091                                            uint8 data, uint8 mask)
  13092 {
  13093     int rv = BCM_E_UNAVAIL;
  13094 
  13095     
  13096     FP_LOCK(unit);
  13097 
  13098     rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelTerminated,
  13099                             data, mask);
  13100     FP_UNLOCK(unit);
  13101     return (rv);
  13102 }
  13103 
  13104 /* Function    : bcm_esw_field_qualify_MplsTerminated
  13105  * Description : qualify on the mpls terminated packets only.
  13106  * Parameters  : (IN) unit   BCM device number
  13107  *               (IN) entry  Field entry to qualify
  13108  *               (IN) data   0/1 Not mpls terminated/mpls Terminated packets. 
  13109  *               (IN) mask   data mask.
  13110  * Returns     : BCM_E_XXX
  13111  */
  13112 int bcm_esw_field_qualify_MplsTerminated(int unit, bcm_field_entry_t entry,
  13113                                            uint8 data, uint8 mask)
  13114 {
  13115     int rv = BCM_E_UNAVAIL; /* Operation return status  */
  13116 #if defined(BCM_TRIUMPH2_SUPPORT) /* BCM_TRIUMPH2_SUPPORT */
  13117     _field_group_t *fg;     /* Field group structure    */
  13118     int i;
  13119 #endif /* !BCM_TRIUMPH2_SUPPORT */
  13120 
  13121     
  13122     FP_LOCK(unit);
  13123 #if defined(BCM_TRIUMPH_SUPPORT)
  13124     if (SOC_IS_TR_VL(unit)) {
  13125 #if defined(BCM_TRIUMPH2_SUPPORT) /* BCM_TRIUMPH2_SUPPORT */
  13126         if (SOC_IS_TRIUMPH2(unit) || SOC_IS_APOLLO(unit)
  13127             || SOC_IS_VALKYRIE2(unit) || SOC_IS_KATANAX(unit)) {
  13128 	    rv = _bcm_field_entry_group_find(unit, entry, &fg);
  13129 	    if (BCM_FAILURE(rv)) {
  13130             FP_UNLOCK(unit);
  13131             return (rv);
  13132 	    }
  13133             for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
  13134                 if (fg->sel_codes[i].loopback_type_sel 
  13135                         == (int8) bcmFieldTunnelTypeMpls) {
  13136                     if (1 == data && 1 == mask) {
  13137                         data = (uint8) bcmFieldTunnelTypeMpls;
  13138                         mask = (BCM_FIELD_EXACT_MATCH_MASK);
  13139                     }
  13140                     break;
  13141                 }
  13142             }
  13143         }
  13144 #endif /* !BCM_TRIUMPH2_SUPPORT */
  13145         rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsTerminated,
  13146                               data, mask);
  13147     }
  13148 #endif  /* BCM_TRIUMPH_SUPPORT*/
  13149     FP_UNLOCK(unit);
  13150     return (rv);
  13151 }
  13152 
  13153 /* Function    : bcm_esw_field_qualify_ExtensionHeaderType
  13154  * Description : Qualify on Next Header Field in First Extension Header.
  13155  * Parameters  : (IN) unit   BCM device number
  13156  *               (IN) entry  Field entry to qualify
  13157  *               (IN) data   Extension Header - Next Header byte.
  13158  *               (IN) mask   Next Header byte mask.
  13159  * Returns     : BCM_E_XXX
  13160  */
  13161 int bcm_esw_field_qualify_ExtensionHeaderType(int unit, 
  13162                                               bcm_field_entry_t entry,
  13163                                               uint8 data, uint8 mask)
  13164 {
  13165     int rv = BCM_E_UNAVAIL;
  13166 
  13167     
  13168     FP_LOCK(unit);
  13169 
  13170 #if defined (BCM_TRX_SUPPORT)
  13171     if (SOC_IS_TRX(unit)) {
  13172         rv = _field_qualify32(unit, entry, bcmFieldQualifyExtensionHeaderType,
  13173                               data, mask);
  13174     }
  13175 #endif 
  13176     FP_UNLOCK(unit);
  13177     return (rv);
  13178 }
  13179 
  13180 /* Function    : bcm_esw_field_qualify_ExtensionHeaderSubCode
  13181  * Description : Qualify on First byte after extentsion header length field.
  13182  * Parameters  : (IN) unit   BCM device number
  13183  *               (IN) entry  Field entry to qualify
  13184  *               (IN) data   Extension Header byte after header length field.
  13185  *               (IN) mask   Byte mask.
  13186  * Returns     : BCM_E_XXX
  13187  */
  13188 int bcm_esw_field_qualify_ExtensionHeaderSubCode(int unit, 
  13189                                                  bcm_field_entry_t entry,
  13190                                                  uint8 data, uint8 mask)
  13191 {
  13192     int rv = BCM_E_UNAVAIL;
  13193     
  13194     FP_LOCK(unit);
  13195 
  13196 #if defined (BCM_TRX_SUPPORT)
  13197     if (SOC_IS_TRX(unit)) {
  13198         rv =  _field_qualify32(unit, entry,
  13199                                bcmFieldQualifyExtensionHeaderSubCode,
  13200                                data, mask);
  13201     }
  13202 #endif 
  13203     FP_UNLOCK(unit);
  13204     return (rv);
  13205 }
  13206 
  13207 /* Function    : bcm_esw_field_qualify_ExtensionHeader2Type
  13208  * Description : Qualify on Next Header Field in Second Extension Header.
  13209  * Parameters  : (IN) unit   BCM device number
  13210  *               (IN) entry  Field entry to qualify
  13211  *               (IN) data   Extension Header - Next Header byte.
  13212  *               (IN) mask   Next Header byte mask.
  13213  * Returns     : BCM_E_XXX
  13214  */
  13215 int bcm_esw_field_qualify_ExtensionHeader2Type(int unit, 
  13216                                               bcm_field_entry_t entry,
  13217                                               uint8 data, uint8 mask)
  13218 {
  13219     int rv = BCM_E_UNAVAIL;
  13220 
  13221     
  13222     FP_LOCK(unit);
  13223 
  13224 #if defined (BCM_TRIDENT_SUPPORT)
  13225     if (SOC_IS_TD_TT(unit) || SOC_IS_KATANAX(unit) || SOC_IS_TRIUMPH3(unit)) {
  13226         rv = _field_qualify32(unit, entry, bcmFieldQualifyExtensionHeader2Type,
  13227                               data, mask);
  13228     }
  13229 #endif  /* BCM_TRIDENT_SUPPORT */
  13230 
  13231     FP_UNLOCK(unit);
  13232     return (rv);
  13233 }
  13234 
  13235 int
  13236 bcm_esw_field_qualify_InnerSrcIp(int unit, bcm_field_entry_t entry,
  13237                             bcm_ip_t data, bcm_ip_t mask)
  13238 {
  13239     int              rv;
  13240     
  13241     FP_LOCK(unit);
  13242 
  13243     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerSrcIp, data, mask);
  13244 
  13245     FP_UNLOCK(unit);
  13246     return (rv);
  13247 }
  13248 
  13249 int
  13250 bcm_esw_field_qualify_InnerDstIp(int unit, bcm_field_entry_t entry,
  13251                             bcm_ip_t data, bcm_ip_t mask)
  13252 {
  13253     int rv; 
  13254     
  13255     FP_LOCK(unit);
  13256 
  13257     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerDstIp, data, mask);
  13258 
  13259     FP_UNLOCK(unit);
  13260     return (rv);
  13261 }
  13262 
  13263 int
  13264 bcm_esw_field_qualify_InnerSrcIp6(int unit, bcm_field_entry_t entry,
  13265                              bcm_ip6_t data, bcm_ip6_t mask)
  13266 {
  13267     int rv; 
  13268 
  13269     
  13270     FP_LOCK(unit);
  13271 
  13272     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifyInnerSrcIp6, 
  13273                             data, mask);
  13274 
  13275     FP_UNLOCK(unit);
  13276     return (rv);
  13277 }
  13278 
  13279 int
  13280 bcm_esw_field_qualify_InnerDstIp6(int unit, bcm_field_entry_t entry,
  13281                              bcm_ip6_t data, bcm_ip6_t mask)
  13282 {
  13283     int rv; 
  13284 
  13285     
  13286     FP_LOCK(unit);
  13287 
  13288     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifyInnerDstIp6, 
  13289                             data, mask);
  13290 
  13291     FP_UNLOCK(unit);
  13292     return (rv);
  13293 }
  13294 
  13295 int
  13296 bcm_esw_field_qualify_InnerSrcIp6High(int unit, bcm_field_entry_t entry,
  13297                                  bcm_ip6_t data, bcm_ip6_t mask)
  13298 {
  13299     int                 rv;
  13300 
  13301     
  13302     FP_LOCK(unit);
  13303 
  13304     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifyInnerSrcIp6High,
  13305                             data, mask);
  13306 
  13307     FP_UNLOCK(unit);
  13308     return (rv);
  13309 }
  13310 
  13311 int
  13312 bcm_esw_field_qualify_InnerDstIp6High(int unit, bcm_field_entry_t entry,
  13313                                  bcm_ip6_t data, bcm_ip6_t mask)
  13314 {
  13315     int                 rv;
  13316 
  13317     
  13318     FP_LOCK(unit);
  13319 
  13320     rv = _field_qualify_ip6(unit, entry, bcmFieldQualifyInnerDstIp6High,
  13321                                 data, mask);
  13322 
  13323     FP_UNLOCK(unit);
  13324     return (rv);
  13325 }
  13326 
  13327 int
  13328 bcm_esw_field_qualify_InnerTos(int unit, bcm_field_entry_t entry,
  13329                            uint8 data, uint8 mask)
  13330 {
  13331     int rv; 
  13332 
  13333     
  13334     FP_LOCK(unit);
  13335 
  13336     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerTos, data, mask);
  13337 
  13338     FP_UNLOCK(unit);
  13339     return (rv);
  13340 }
  13341 
  13342 int
  13343 bcm_esw_field_qualify_InnerDSCP(int unit, bcm_field_entry_t entry,
  13344                            uint8 data, uint8 mask)
  13345 {
  13346     int rv; 
  13347 
  13348     
  13349     FP_LOCK(unit);
  13350 
  13351     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerDSCP, data, mask);
  13352 
  13353     FP_UNLOCK(unit);
  13354     return (rv);
  13355 }
  13356 
  13357 int
  13358 bcm_esw_field_qualify_InnerIpProtocol(int unit, bcm_field_entry_t entry,
  13359                                  uint8 data, uint8 mask)
  13360 {
  13361     int rv; 
  13362 
  13363     
  13364     FP_LOCK(unit);
  13365 
  13366     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerIpProtocol, data, mask);
  13367 
  13368     FP_UNLOCK(unit);
  13369     return (rv);
  13370 }
  13371 
  13372 int bcm_esw_field_qualify_InnerIpFrag(int unit, bcm_field_entry_t entry,
  13373                                   bcm_field_IpFrag_t frag_info)
  13374 {
  13375     int             rv = BCM_E_UNAVAIL;
  13376 #if  defined(BCM_TRX_SUPPORT) 
  13377     
  13378     FP_LOCK(unit);
  13379 
  13380     if (SOC_IS_TRX(unit)) {
  13381         rv = _field_qualify_IpFrag(unit, entry, 
  13382                                    bcmFieldQualifyInnerIpFrag,
  13383                                    frag_info);
  13384     }
  13385     FP_UNLOCK(unit);
  13386 #endif /* BCM_TRX_SUPPORT */
  13387     return (rv);
  13388 }
  13389 
  13390 int
  13391 bcm_esw_field_qualify_InnerTtl(int unit, bcm_field_entry_t entry,
  13392                           uint8 data, uint8 mask)
  13393 {
  13394     int rv; 
  13395 
  13396     
  13397     FP_LOCK(unit);
  13398 
  13399     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerTtl, data, mask);
  13400 
  13401     FP_UNLOCK(unit);
  13402     return (rv);
  13403 }
  13404 
  13405 /*
  13406  * Function:
  13407  *      bcm_esw_field_qualify_TranslatedVlanFormat
  13408  * Purpose:
  13409  *      Set match criteria for bcmFieildQualifyTranslatedVlanFormat
  13410  *                     qualifier in the field entry.
  13411  * Parameters:
  13412  *      unit - (IN) Unit number.
  13413  *      entry - (IN) BCM field entry id.
  13414  *      data - (IN) Qualifier match data.
  13415  *      mask - (IN) Qualifier match mask.
  13416  * Returns:
  13417  *      BCM_E_XXX
  13418  * Notes:
  13419  */
  13420 int 
  13421 bcm_esw_field_qualify_TranslatedVlanFormat( int unit, bcm_field_entry_t entry, 
  13422                                            uint8 data, uint8 mask)
  13423 {
  13424     int                 rv;      /* Operation return status. */
  13425 
  13426     
  13427     FP_LOCK(unit);
  13428 
  13429     rv = _field_qualify_VlanFormat(unit, entry,
  13430                                    bcmFieldQualifyTranslatedVlanFormat,
  13431                                    data, mask);
  13432 
  13433     FP_UNLOCK(unit);
  13434     return (rv);
  13435 }
  13436 
  13437 /*
  13438  * Function:
  13439  *      bcm_esw_field_qualify_IntPriority
  13440  * Purpose:
  13441  *      Set match criteria for bcmFieildQualifyIntPriority
  13442  *                     qualifier in the field entry.
  13443  * Parameters:
  13444  *      unit - (IN) Unit number.
  13445  *      entry - (IN) BCM field entry id.
  13446  *      data - (IN) Qualifier match data.
  13447  *      mask - (IN) Qualifier match mask.
  13448  * Returns:
  13449  *      BCM_E_XXX
  13450  * Notes:
  13451  */
  13452 int 
  13453 bcm_esw_field_qualify_IntPriority(
  13454     int unit, 
  13455     bcm_field_entry_t entry, 
  13456     uint8 data, 
  13457     uint8 mask)
  13458 {
  13459     int rv; 
  13460 
  13461     
  13462     FP_LOCK(unit);
  13463 
  13464     rv = _field_qualify32(unit, entry, bcmFieldQualifyIntPriority, data, mask);
  13465 
  13466     FP_UNLOCK(unit);
  13467     return (rv);
  13468 }
  13469 
  13470 
  13471 /*
  13472  * Function:
  13473  *      bcm_esw_field_qualify_Color
  13474  * Purpose:
  13475  *      Set match criteria for bcmFieildQualifyColor
  13476  *                     qualifier in the field entry.
  13477  * Parameters:
  13478  *      unit - (IN) Unit number.
  13479  *      entry - (IN) BCM field entry id.
  13480  *      color - (IN) Qualifier match color.
  13481  * Returns:
  13482  *      BCM_E_XXX
  13483  * Notes:
  13484  */
  13485 int 
  13486 bcm_esw_field_qualify_Color(int unit, bcm_field_entry_t entry, 
  13487                             uint8 color)
  13488 {
  13489     uint8 data;           /* Qualifier data.          */
  13490     int rv;               /* Operation return status. */
  13491     uint8 mask = 0x3;     /* Qualifier mask.          */
  13492 
  13493     switch (color) {
  13494       case BCM_FIELD_COLOR_GREEN:
  13495           data = 0;
  13496           break;
  13497       case BCM_FIELD_COLOR_RED:
  13498           data = 1;
  13499           break;
  13500       case BCM_FIELD_COLOR_YELLOW:
  13501           data = 3;
  13502           break;
  13503       default:
  13504           return (BCM_E_PARAM);
  13505     }
  13506 
  13507     
  13508     FP_LOCK(unit);
  13509 
  13510     rv = _field_qualify32(unit, entry, bcmFieldQualifyColor, data, mask);
  13511 
  13512     FP_UNLOCK(unit);
  13513     return (rv);
  13514 }
  13515 
  13516 /*
  13517  * Function:
  13518  *      bcm_esw_field_qualify_FibreChanOuter
  13519  * Purpose:
  13520  *      Add Fibre Channel outer header type field qualification to a field entry.
  13521  * Parameters:
  13522  *      unit - (IN) Unit number.
  13523  *      entry - (IN) Field entry id.
  13524  *      fibre_chan_type - (IN) Data to qualify with.
  13525  * Returns:
  13526  *      BCM_E_XXX
  13527  * Notes:
  13528  */
  13529 int 
  13530 bcm_esw_field_qualify_FibreChanOuter(int unit, 
  13531                              bcm_field_entry_t entry, 
  13532                              bcm_field_FibreChan_t fibre_chan_type)
  13533 {
  13534     int               rv;   /* Operation return status. */
  13535     uint32            data; /* HW data match criteria.  */
  13536     uint32            mask; /* HW data mask.            */
  13537 
  13538 
  13539     switch (fibre_chan_type) { 
  13540       case bcmFieldFibreChanAny:
  13541           data = 0x0;
  13542           mask = 0x0;
  13543           break;
  13544       case bcmFieldFibreChan:
  13545           data = 0x1;
  13546           mask = 0x7;
  13547           break;
  13548       case bcmFieldFibreChanEncap:
  13549           data = 0x3;
  13550           mask = 0x7;
  13551           break;
  13552       case bcmFieldFibreChanVirtual:
  13553           data = 0x2;
  13554           mask = 0x7;
  13555           break;
  13556       case bcmFieldFibreChanRouted:
  13557           data = 0x4;
  13558           mask = 0x7;
  13559           break;
  13560       default:
  13561           return (BCM_E_PARAM);
  13562     }
  13563 
  13564     
  13565     FP_LOCK(unit);
  13566 
  13567     rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanOuter, 
  13568                           data, mask);
  13569 
  13570     FP_UNLOCK(unit);
  13571     return (rv);
  13572 }
  13573 
  13574 /*
  13575  * Function:
  13576  *      bcm_esw_field_qualify_FibreChanInner
  13577  * Purpose:
  13578  *      Add Fibre Channel inner header type field qualification to a field entry.
  13579  * Parameters:
  13580  *      unit - (IN) Unit number.
  13581  *      entry - (IN) Field entry id.
  13582  *      fibre_chan_type - (IN) Data to qualify with.
  13583  * Returns:
  13584  *      BCM_E_XXX
  13585  * Notes:
  13586  */
  13587 int 
  13588 bcm_esw_field_qualify_FibreChanInner(int unit, 
  13589                              bcm_field_entry_t entry, 
  13590                              bcm_field_FibreChan_t fibre_chan_type)
  13591 {
  13592     int               rv;   /* Operation return status. */
  13593     uint32            data; /* HW data match criteria.  */
  13594     uint32            mask; /* HW data mask.            */
  13595 
  13596     switch (fibre_chan_type) { 
  13597       case bcmFieldFibreChanAny:
  13598           data = 0x0;
  13599           mask = 0x0;
  13600           break;
  13601       case bcmFieldFibreChan:
  13602           data = 0x1;
  13603           mask = 0x7;
  13604           break;
  13605       case bcmFieldFibreChanEncap:
  13606           data = 0x3;
  13607           mask = 0x7;
  13608           break;
  13609       case bcmFieldFibreChanVirtual:
  13610           data = 0x2;
  13611           mask = 0x7;
  13612           break;
  13613       case bcmFieldFibreChanRouted:
  13614           data = 0x4;
  13615           mask = 0x7;
  13616           break;
  13617       default:
  13618           return (BCM_E_PARAM);
  13619     }
  13620 
  13621     
  13622     FP_LOCK(unit);
  13623 
  13624     rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanInner, 
  13625                           data, mask);
  13626 
  13627     FP_UNLOCK(unit);
  13628     return (rv);
  13629 }
  13630 
  13631 /*
  13632  * Function:
  13633  *      bcm_esw_field_qualify_VnTag
  13634  * Purpose:
  13635  *      Add NIV VN tag field qualification to a field entry.
  13636  * Parameters:
  13637  *      unit  - (IN) Unit number.
  13638  *      entry - (IN) Field entry id.
  13639  *      data  - (IN) Qualifier match data.
  13640  *      mask  - (IN) Qualifier match mask.
  13641  * Returns:
  13642  *      BCM_E_XXX
  13643  * Notes:
  13644  */
  13645 int
  13646 bcm_esw_field_qualify_VnTag(int unit, bcm_field_entry_t entry,
  13647                             uint32 data, uint32 mask)
  13648 {
  13649     return (_bcm_esw_field_qualify_aux_tag(unit,
  13650                                            entry,
  13651                                            bcmFieldQualifyVnTag,
  13652                                            data,
  13653                                            mask
  13654                                            )
  13655             );
  13656 }
  13657 
  13658 /*
  13659  * Function:
  13660  *  bcm_esw_field_qualify_ETag
  13661  * Purpose:
  13662  *  Add E tag field qualification to a field entry.
  13663  * Parameters:
  13664  *  unit  - (IN) Unit number.
  13665  *  entry - (IN) Field entry id.
  13666  *  data  - (IN) Qualifier match data.
  13667  *  mask  - (IN) Qualifier match mask.
  13668  * Returns:
  13669  *  BCM_E_XXX
  13670  * Notes:
  13671  */
  13672 int
  13673 bcm_esw_field_qualify_ETag(int unit, bcm_field_entry_t entry,
  13674                                     uint64 data, uint64 mask)
  13675 {
  13676     uint32 edata = 0;   /* ETag Data */
  13677     uint32 emask = 0;   /* ETag Mask */
  13678 
  13679     /* As per Arch currently only 32 bit ETag is presented
  13680      * to FP */
  13681     COMPILER_64_TO_32_LO(edata, data);
  13682     COMPILER_64_TO_32_LO(emask, mask);
  13683 
  13684     return (_bcm_esw_field_qualify_aux_tag(unit, entry,
  13685                                            bcmFieldQualifyETag,
  13686                                            edata, emask));
  13687 }
  13688 
  13689 /*
  13690  * Function:
  13691  *      bcm_esw_field_qualify_SubportPktTag
  13692  * Purpose:
  13693  *      Add LLTAG tag field qualification to a field entry.
  13694  * Parameters:
  13695  *      unit  - (IN) Unit number.
  13696  *      entry - (IN) Field entry id.
  13697  *      data  - (IN) Qualifier match data.
  13698  *      mask  - (IN) Qualifier match mask.
  13699  * Returns:
  13700  *      BCM_E_XXX
  13701  * Notes:
  13702  */
  13703 int 
  13704 bcm_esw_field_qualify_SubportPktTag(int unit, bcm_field_entry_t entry,
  13705                             uint16 data, uint16 mask)
  13706 {
  13707     return (_bcm_esw_field_qualify_aux_tag(unit,
  13708                                            entry,
  13709                                            bcmFieldQualifySubportPktTag,
  13710                                            data,
  13711                                            mask
  13712                                            )
  13713             );
  13714 }
  13715 
  13716 /*
  13717  * Function:
  13718  *      bcm_esw_field_qualify_CnTag
  13719  * Purpose:
  13720  *      Add CN tag field qualification to a field entry.
  13721  * Parameters:
  13722  *      unit  - (IN) Unit number.
  13723  *      entry - (IN) Field entry id.
  13724  *      data  - (IN) Qualifier match data.
  13725  *      mask  - (IN) Qualifier match mask.
  13726  * Returns:
  13727  *      BCM_E_XXX
  13728  * Notes:
  13729  */
  13730 int
  13731 bcm_esw_field_qualify_CnTag(int unit, bcm_field_entry_t entry,
  13732                             uint32 data, uint32 mask)
  13733 {
  13734     return (_bcm_esw_field_qualify_aux_tag(unit,
  13735                                            entry,
  13736                                            bcmFieldQualifyCnTag,
  13737                                            data,
  13738                                            mask
  13739                                            )
  13740             );
  13741 }
  13742 
  13743 /*
  13744  * Function:
  13745  *      bcm_esw_field_qualify_FabricQueueTag
  13746  * Purpose:
  13747  *      Add Fabric Queue tag field qualification to a field entry.
  13748  * Parameters:
  13749  *      unit  - (IN) Unit number.
  13750  *      entry - (IN) Field entry id.
  13751  *      data  - (IN) Qualifier match data.
  13752  *      mask  - (IN) Qualifier match mask.
  13753  * Returns:
  13754  *      BCM_E_XXX
  13755  * Notes:
  13756  */
  13757 int
  13758 bcm_esw_field_qualify_FabricQueueTag(int unit, bcm_field_entry_t entry,
  13759                                      uint32 data, uint32 mask)
  13760 {
  13761     return (_bcm_esw_field_qualify_aux_tag(unit,
  13762                                            entry,
  13763                                            bcmFieldQualifyFabricQueueTag,
  13764                                            data,
  13765                                            mask
  13766                                            )
  13767             );
  13768 }
  13769 
  13770 /*
  13771  * Function:
  13772  *      bcm_esw_field_qualify_IcmpTypeCode
  13773  * Purpose:
  13774  *      Set match criteria for bcmFieildQualifyIcmpTypeCode
  13775  *                     qualifier to the field entry.
  13776  * Parameters:
  13777  *      unit - (IN) Unit number.
  13778  *      entry - (IN) BCM field entry id.
  13779  *      data - (OUT) Qualifier match data.
  13780  *      mask - (OUT) Qualifier match mask.
  13781  * Returns:
  13782  *      BCM_E_XXX
  13783  * Notes:
  13784  */
  13785 int 
  13786 bcm_esw_field_qualify_IcmpTypeCode(int unit, bcm_field_entry_t entry,
  13787                                          uint16 data,uint16 mask)
  13788 {
  13789     int              rv;       /* Operation return status. */
  13790 
  13791     
  13792     FP_LOCK(unit);
  13793 
  13794     rv = _field_qualify32(unit, entry, bcmFieldQualifyIcmpTypeCode,
  13795                           data, mask);
  13796 
  13797     FP_UNLOCK(unit);
  13798     return (rv);
  13799 }
  13800 
  13801 /*
  13802  * Function:
  13803  *      bcm_esw_field_qualify_FlowId
  13804  * Purpose:
  13805  *      Set match criteria for bcmFieildQualifyFlowId
  13806  *      qualifier in the field entry.
  13807  * Parameters:
  13808  *      unit - (IN) Unit number.
  13809  *      entry - (IN) BCM field entry id.
  13810  *      data - (IN) Qualifier match data.
  13811  *      mask - (IN) Qualifier match data.
  13812  * Returns:
  13813  *      BCM_E_XXX
  13814  * Notes:
  13815  */
  13816 
  13817 int 
  13818 bcm_esw_field_qualify_FlowId(int unit, bcm_field_entry_t entry,
  13819                  uint16 data, uint16 mask)
  13820 {
  13821     return BCM_E_UNAVAIL; 
  13822 }
  13823 /*
  13824  * Function:
  13825  *      bcm_esw_field_qualify_InVPort
  13826  * Purpose:
  13827  *      Set match criteria for bcmFieildQualifyInVPort
  13828  *      qualifier in the field entry.
  13829  * Parameters:
  13830  *      unit - (IN) Unit number.
  13831  *      entry - (IN) BCM field entry id.
  13832  *      data - (IN) Qualifier match data.
  13833  *      mask - (IN) Qualifier match data.
  13834  * Returns:
  13835  *      BCM_E_XXX
  13836  * Notes:
  13837  */
  13838 
  13839 int 
  13840 bcm_esw_field_qualify_InVPort(int unit, bcm_field_entry_t entry,
  13841                  uint8 data, uint8 mask)
  13842 {
  13843     return BCM_E_UNAVAIL; 
  13844 }
  13845 /*
  13846  * Function:
  13847  *      bcm_esw_field_qualify_OutVPort
  13848  * Purpose:
  13849  *      Set match criteria for bcmFieildQualifyOutVPort
  13850  *      qualifier in the field entry.
  13851  * Parameters:
  13852  *      unit - (IN) Unit number.
  13853  *      entry - (IN) BCM field entry id.
  13854  *      data - (IN) Qualifier match data.
  13855  *      mask - (IN) Qualifier match data.
  13856  * Returns:
  13857  *      BCM_E_XXX
  13858  * Notes:
  13859  */
  13860 
  13861 int 
  13862 bcm_esw_field_qualify_OutVPort(int unit, bcm_field_entry_t entry,
  13863                  uint8 data, uint8 mask)
  13864 {
  13865     return BCM_E_UNAVAIL; 
  13866 }
  13867 
  13868 /*
  13869  * Function:
  13870  *      bcm_esw_field_qualify_FlowId_get
  13871  * Purpose:
  13872  *      Get match criteria for bcmFieildQualifyFlowId
  13873  *                     qualifier from the field entry.
  13874  * Parameters:
  13875  *      unit - (IN) Unit number.
  13876  *      entry - (IN) BCM field entry id.
  13877  *      data - (OUT) Qualifier match data.
  13878  *      mask - (OUT) Qualifier match mask.
  13879  * Returns:
  13880  *      BCM_E_XXX
  13881  * Notes:
  13882  */
  13883 int 
  13884 bcm_esw_field_qualify_FlowId_get(int unit, bcm_field_entry_t entry,
  13885                  uint16 *data, uint16 *mask)
  13886 {
  13887     return BCM_E_UNAVAIL;
  13888 }
  13889 
  13890 /*
  13891  * Function:
  13892  *      bcm_esw_field_qualify_InVPort_get
  13893  * Purpose:
  13894  *      Get match criteria for bcmFieildQualifyInVPort
  13895  *                     qualifier from the field entry.
  13896  * Parameters:
  13897  *      unit - (IN) Unit number.
  13898  *      entry - (IN) BCM field entry id.
  13899  *      data - (OUT) Qualifier match data.
  13900  *      mask - (OUT) Qualifier match mask.
  13901  * Returns:
  13902  *      BCM_E_XXX
  13903  * Notes:
  13904  */
  13905 int 
  13906 bcm_esw_field_qualify_InVPort_get(int unit, bcm_field_entry_t entry,
  13907                  uint8 *data, uint8 *mask)
  13908 {
  13909     return BCM_E_UNAVAIL;
  13910 }
  13911 
  13912 /*
  13913  * Function:
  13914  *      bcm_esw_field_qualify_OutVPort_get
  13915  * Purpose:
  13916  *      Get match criteria for bcmFieildQualifyOutVPort
  13917  *                     qualifier from the field entry.
  13918  * Parameters:
  13919  *      unit - (IN) Unit number.
  13920  *      entry - (IN) BCM field entry id.
  13921  *      data - (OUT) Qualifier match data.
  13922  *      mask - (OUT) Qualifier match mask.
  13923  * Returns:
  13924  *      BCM_E_XXX
  13925  * Notes:
  13926  */
  13927 int 
  13928 bcm_esw_field_qualify_OutVPort_get(int unit, bcm_field_entry_t entry,
  13929                  uint8 *data, uint8 *mask)
  13930 {
  13931     return BCM_E_UNAVAIL;
  13932 }
  13933 
  13934 /*
  13935  * Function:
  13936  *      bcm_esw_field_qualify_IntCongestionNotification
  13937  * Purpose:
  13938  *      Set match criteria for IntCongestionNotification
  13939  *                     qualifier from the field entry.
  13940  * Parameters:
  13941  *      unit - (IN) Unit number.
  13942  *      entry - (IN) BCM field entry id.
  13943  *      data - (IN) Qualifier match data.
  13944  *      mask - (IN) Qualifier match mask.
  13945  * Returns:
  13946  *      BCM_E_XXX
  13947  * Notes:
  13948  */
  13949 
  13950 int 
  13951 bcm_esw_field_qualify_IntCongestionNotification(int unit, 
  13952     bcm_field_entry_t entry, uint8 data, uint8 mask)
  13953 {
  13954 #if defined(BCM_GREYHOUND_SUPPORT) || defined(BCM_TOMAHAWK_SUPPORT)
  13955     int              rv = BCM_E_UNAVAIL;       /* Operation return status. */
  13956 
  13957     if (soc_feature(unit, soc_feature_ecn_wred)) {
  13958 
  13959         if ((data > _BCM_ECN_INT_CN_VALUE_MAX) ||
  13960             (mask > _BCM_ECN_INT_CN_VALUE_MAX)) {
  13961             return BCM_E_PARAM;
  13962         }
  13963         
  13964         
  13965         FP_LOCK(unit);
  13966 
  13967         rv = _field_qualify32(unit, entry, 
  13968                     bcmFieldQualifyIntCongestionNotification,
  13969                     data, mask);
  13970 
  13971         FP_UNLOCK(unit);
  13972     }
  13973     return (rv);
  13974 #else /* !BCM_GREYHOUND_SUPPORT */
  13975     return BCM_E_UNAVAIL;
  13976 #endif /* BCM_GREYHOUND_SUPPORT */
  13977 }
  13978 
  13979 /*
  13980  * Function:
  13981  *      bcm_esw_field_qualify_IntCongestionNotification_get
  13982  * Purpose:
  13983  *      Get match criteria for IntCongestionNotification
  13984  *                     qualifier from the field entry.
  13985  * Parameters:
  13986  *      unit - (IN) Unit number.
  13987  *      entry - (IN) BCM field entry id.
  13988  *      data - (OUT) Qualifier match data.
  13989  *      mask - (OUT) Qualifier match mask.
  13990  * Returns:
  13991  *      BCM_E_XXX
  13992  * Notes:
  13993  */
  13994 
  13995 int 
  13996 bcm_esw_field_qualify_IntCongestionNotification_get(int unit, 
  13997     bcm_field_entry_t entry, uint8 *data, uint8 *mask)
  13998 {
  13999 #if defined(BCM_GREYHOUND_SUPPORT) || defined(BCM_TOMAHAWK_SUPPORT)
  14000     if (soc_feature(unit, soc_feature_ecn_wred)) {
  14001         /* Read qualifier match value and mask. */
  14002         return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  14003                            bcmFieldQualifyIntCongestionNotification,
  14004                            data, mask);
  14005     }
  14006 #endif /* BCM_GREYHOUND_SUPPORT */    
  14007 
  14008     return BCM_E_UNAVAIL;
  14009 }
  14010 
  14011 
  14012 /*  Section: Field Actions  */
  14013 
  14014 /*
  14015  * Function: bcm_esw_field_action_add
  14016  *
  14017  * Purpose:
  14018  *     Add action performed when entry rule is matched for a packet
  14019  *
  14020  * Parameters:
  14021  *     unit - BCM device number
  14022  *     entry - entry ID
  14023  *     action - Action to perform (bcmFieldActionXXX)
  14024  *     param0 - Action parameter (use 0 if not required)
  14025  *     param1 - Action parameter (use 0 if not required)
  14026  *
  14027  * Returns:
  14028  *     BCM_E_XXX
  14029  */
  14030 
  14031 int
  14032 bcm_esw_field_action_add(int unit,
  14033                          bcm_field_entry_t entry,
  14034                          bcm_field_action_t action,
  14035                          uint32 param0,
  14036                          uint32 param1)
  14037 {
  14038     _field_control_t    *fc;           /* Field control structure. */
  14039     _field_action_t     *fa = NULL;    /* Field action descriptor. */
  14040     int                 rv;            /* Operation return status. */
  14041 #if defined (BCM_TOMAHAWK_SUPPORT)
  14042     uint8 copyToCpu_manipulate_flg = 0;
  14043     int   matched_rule = -1;
  14044 #endif /* BCM_TOMAHAWK_SUPPORT */
  14045 
  14046 #ifdef BROADCOM_DEBUG
  14047     LOG_DEBUG(BSL_LS_BCM_FP,
  14048               (BSL_META_U(unit,
  14049                           "FP(unit %d) vverb: bcm_field_action_add(entry=%d, action=%s, "
  14050                           "p0=%d, p1=%d)\n"), unit, entry,
  14051                _field_action_name(action), param0, param1));
  14052 #endif
  14053 
  14054     if ((SOC_PORT_ADDR_MAX(unit) > 31)
  14055         && ((action == bcmFieldActionRedirectPbmp)
  14056             || (action == bcmFieldActionEgressMask)
  14057             || (action == bcmFieldActionEgressPortsAdd)
  14058             || (action == bcmFieldActionRedirectBcastPbmp))) {
  14059         LOG_ERROR(BSL_LS_BCM_FP,
  14060                   (BSL_META_U(unit,
  14061                               "FP(unit %d) Error: Use bcm_field_action_ports_add api.\n"),
  14062                    unit));
  14063         return (BCM_E_PARAM);
  14064     }
  14065 
  14066 #if defined(BCM_TOMAHAWK_SUPPORT)
  14067     /*
  14068      * Translate the CopyToCpu Action to an 'Egress Mirror' action.
  14069      */
  14070     if (SOC_INFO(unit).th_ctc_replace_enabled) {
  14071        _field_entry_t      *f_ent;
  14072  
  14073        /*
  14074         *  Mirror Ingress and Color Based CopyToCpu Actions are not
  14075         *  supported in this mode.
  14076         */
  14077        if ((action == bcmFieldActionMirrorIngress) ||
  14078            (action == bcmFieldActionRpCopyToCpu) ||
  14079            (action == bcmFieldActionYpCopyToCpu) ||
  14080            (action == bcmFieldActionGpCopyToCpu)) {
  14081             return BCM_E_UNAVAIL;
  14082        }
  14083 
  14084        BCM_IF_ERROR_RETURN(_field_entry_get(unit, entry,
  14085                            _FP_ENTRY_PRIMARY, &f_ent));
  14086 
  14087        if ((f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) ||
  14088            (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXACTMATCH)) {
  14089 
  14090            /* Conflicting checks for MirrorEgress and CopyToCpu */
  14091            for (fa = f_ent->actions; fa != NULL; fa = fa->next) {
  14092               if ((fa->action == bcmFieldActionMirrorEgress) &&
  14093                   !(fa->flags & _FP_ACTION_DIRTY)) {
  14094                  if ((action == bcmFieldActionCopyToCpu) ||
  14095                      (action == bcmFieldActionMirrorEgress)) {
  14096                      LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit,
  14097                      "Action CopyToCpu/MirrorEgress not applicable,"
  14098                      " MirrorEgress is already configured.\n\r")));
  14099                      return BCM_E_PARAM;
  14100                  }
  14101               }
  14102            }
  14103            if (action == bcmFieldActionCopyToCpu) {
  14104               int modid;
  14105               int cpu_port = 0;
  14106 
  14107               BCM_IF_ERROR_RETURN(bcm_esw_stk_my_modid_get(unit, &modid));
  14108              
  14109               BCM_PBMP_ITER(PBMP_CMIC(unit), cpu_port) {
  14110                  if (param0 != 0) {
  14111                     matched_rule = param1;
  14112                  }
  14113                  action = bcmFieldActionMirrorEgress;
  14114                  param0 = modid;
  14115                  param1 = cpu_port;
  14116                  copyToCpu_manipulate_flg = 1;
  14117                  break;
  14118               }
  14119            }
  14120        }
  14121 
  14122        if (f_ent->group->stage_id == _BCM_FIELD_STAGE_LOOKUP) {
  14123            /* Conflicting checks for SrcClassField and CopyToCpu */
  14124            for (fa = f_ent->actions; fa != NULL; fa = fa->next) {
  14125               if ((fa->action == bcmFieldActionClassSourceSet) ||
  14126                   (fa->action == bcmFieldActionCopyToCpu)) {
  14127                  if ((action == bcmFieldActionCopyToCpu) ||
  14128                      (action == bcmFieldActionClassSourceSet)) {
  14129                      LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit,
  14130                      "Action CopyToCpu/SrcClassField not applicable,"
  14131                      " SrcClassField/CopyToCpu is already configured.\n\r")));
  14132                      return BCM_E_PARAM;
  14133                  }
  14134               }
  14135            }
  14136        }  
  14137     }
  14138 #endif /* BCM_TOMAHAWK_SUPPORT */
  14139 
  14140     /* Adapt action parameters */
  14141     rv = _field_params_api_to_hw_adapt(unit, action, &param0, &param1);
  14142     BCM_IF_ERROR_RETURN(rv);
  14143 
  14144     
  14145     FP_LOCK(unit);
  14146     rv = _field_control_get(unit, &fc);
  14147     if (BCM_FAILURE(rv)) {
  14148         FP_UNLOCK(unit);
  14149         return rv;
  14150     }
  14151 
  14152     fa = NULL;
  14153 
  14154     /* 
  14155      * Allocate the action descriptor, param2 to param5 are not valid here.
  14156      */
  14157     rv = _field_action_alloc(unit, action, param0, param1, 0, 0, 0, 0, &fa);
  14158     if (BCM_FAILURE(rv)) {
  14159         LOG_ERROR(BSL_LS_BCM_FP,
  14160                   (BSL_META_U(unit,
  14161                               "FP(unit %d) Error: failure in _field_action_alloc()\n"),
  14162                    unit));
  14163         FP_UNLOCK(unit);
  14164         return rv;
  14165     }
  14166 
  14167     /*
  14168      * Add action to entry actions list.
  14169      */
  14170     rv = _field_action_add(unit, fc, entry, fa);
  14171     FP_UNLOCK(unit);
  14172     if (BCM_FAILURE(rv)) {
  14173         sal_free(fa);
  14174         return rv;
  14175     }
  14176 
  14177 #if defined (BCM_TOMAHAWK_SUPPORT)
  14178     if (copyToCpu_manipulate_flg == 1) {
  14179         fa->flags |= _BCM_FIELD_ACTION_CTC_MANIPULATE_FLAG;
  14180         if (matched_rule != -1) {
  14181            fa->param[2] = 1;
  14182            fa->param[3] = matched_rule;
  14183         }
  14184     }
  14185 #endif /* BCM_TOMAHAWK_SUPPORT */
  14186     return (BCM_E_NONE);
  14187 }
  14188 
  14189 /*
  14190  * Function:
  14191  *      bcm_esw_field_class_size_get
  14192  * Purpose:
  14193  *      Retrieve the class size for qualifier provided.
  14194  * Parameters:
  14195  *      unit - (IN) Unit number.
  14196  *      qual - (IN) Field Qualifier.
  14197  *      class_size - (OUT) Class Size.
  14198  * Returns:
  14199  *      BCM_E_XXX
  14200  * Notes:
  14201  *      Class Size returned is in bits.
  14202  */
  14203 int
  14204 bcm_esw_field_class_size_get(int unit,
  14205                              bcm_field_qualify_t qual,
  14206                              uint16 *class_size)
  14207 {
  14208     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  14209 #if defined(BCM_TOMAHAWK_SUPPORT)
  14210     _field_control_t *fc;       /* Field control structure. */
  14211     
  14212 
  14213     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  14214         FP_LOCK(unit);
  14215         rv = _field_control_get(unit, &fc);
  14216         if (BCM_FAILURE(rv)) {
  14217             FP_UNLOCK(unit);
  14218             return rv;
  14219         }
  14220         rv = fc->functions.fp_class_size_get(unit, qual, class_size);
  14221         FP_UNLOCK(unit);
  14222     }
  14223 #endif /* BCM_TOMAHAWK_SUPPORT */
  14224     return rv;
  14225 }
  14226 
  14227 /*
  14228  * Function:
  14229  *      bcm_esw_field_action_class_add
  14230  * Purpose:
  14231  *      Add an action to a field class entry.
  14232  * Parameters:
  14233  *      unit - (IN) Unit number.
  14234  *      entry - (IN) Field entry Id.
  14235  *      class_info - (IN) Field Class Info.
  14236  * Returns:
  14237  *      BCM_E_XXX
  14238  * Notes:
  14239  */
  14240 int
  14241 bcm_esw_field_action_class_add(
  14242         int unit,
  14243         bcm_field_entry_t entry,
  14244         bcm_field_class_info_t *class_info)
  14245 {
  14246     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  14247 #if defined BCM_TOMAHAWK_SUPPORT
  14248     
  14249 
  14250     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  14251             FP_LOCK(unit);
  14252             rv = (_bcm_field_th_class_action_set(unit, entry, class_info));
  14253             FP_UNLOCK(unit);
  14254     }
  14255 #endif /* BCM_TOMAHAWK_SUPPORT */
  14256     return (rv);
  14257 }
  14258 
  14259 /*
  14260  * Function:
  14261  *      bcm_esw_field_action_class_get
  14262  * Purpose:
  14263  *      Retrieve the parameters for an action previously added to a
  14264  *      field entry.
  14265  * Parameters:
  14266  *      unit - (IN) Unit number.
  14267  *      entry - (IN) Field entry Id.
  14268  *      class_info - (INOUT) Field Class Info.
  14269  * Returns:
  14270  *      BCM_E_XXX
  14271  * Notes:
  14272  */
  14273 int
  14274 bcm_esw_field_action_class_get(
  14275         int unit,
  14276         bcm_field_entry_t entry,
  14277         bcm_field_class_info_t *class_info)
  14278 {
  14279     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  14280 #if defined BCM_TOMAHAWK_SUPPORT
  14281     
  14282 
  14283     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  14284         FP_LOCK(unit);
  14285         rv = (_bcm_field_th_class_action_get(unit, entry, class_info));
  14286         FP_UNLOCK(unit);
  14287     }
  14288 #endif /* BCM_TOMAHAWK_SUPPORT */
  14289     return (rv);
  14290 }
  14291 
  14292 /*
  14293  * Function:
  14294  *      bcm_esw_field_action_mac_add
  14295  * Purpose:
  14296  *      Add an action to a field entry.
  14297  * Parameters:
  14298  *      unit - (IN) Unit number.
  14299  *      entry - (IN) Field entry Id.
  14300  *      action - (IN) Field action id.
  14301  *      mac - (IN) Field action parameter.
  14302  * Returns:
  14303  *      BCM_E_XXX
  14304  * Notes:
  14305  */
  14306 int 
  14307 bcm_esw_field_action_mac_add(
  14308     int unit, 
  14309     bcm_field_entry_t entry, 
  14310     bcm_field_action_t action, 
  14311     bcm_mac_t mac)
  14312 {
  14313     uint32  param[_FP_ACTION_PARAM_SZ];     
  14314 
  14315     if ((action != bcmFieldActionSrcMacNew) &&
  14316         (action != bcmFieldActionDstMacNew) &&
  14317         (action != bcmFieldActionReplaceDstMac) &&
  14318         (action != bcmFieldActionReplaceSrcMac) ) {
  14319         return (BCM_E_PARAM);
  14320     }
  14321 
  14322     SAL_MAC_ADDR_TO_UINT32(mac, param);
  14323 
  14324     return bcm_esw_field_action_add(unit, entry, action,
  14325                                     param[0],param[1]);
  14326 }
  14327 
  14328 /*
  14329  * Function:
  14330  *      bcm_esw_field_sat_macsa_add
  14331  * Purpose:
  14332  *      Add a mac sa and class id entry.
  14333  * Parameters:
  14334  *      unit - (IN) Unit number.
  14335  *      mac -  (IN) Src Mac.
  14336  *      class_id - (IN) Class id.
  14337  * Returns:
  14338  *      BCM_E_XXX
  14339  * Notes:
  14340  */
  14341 int
  14342 bcm_esw_field_sat_macsa_add(
  14343     int unit,
  14344     bcm_mac_t mac,
  14345     uint32 class_id)
  14346 {
  14347    int rv = BCM_E_UNAVAIL;
  14348 #if defined (BCM_APACHE_SUPPORT)
  14349    
  14350    if (soc_feature(unit, soc_feature_fp_based_sat)) {
  14351        FP_LOCK(unit);
  14352        rv = _bcm_field_apache_sat_macsa_add(unit, mac, class_id);
  14353        FP_UNLOCK(unit);
  14354    }
  14355 #endif
  14356    return rv;
  14357 }
  14358 
  14359 /*
  14360  * Function:
  14361  *      bcm_esw_field_sat_macsa_get
  14362  * Purpose:
  14363  *      Get class id corresponding to mac sa entry.
  14364  * Parameters:
  14365  *      unit - (IN) Unit number.
  14366  *      mac -  (IN) Src Mac.
  14367  *      class_id - (OUT) Class id.
  14368  * Returns:
  14369  *      BCM_E_XXX
  14370  * Notes:
  14371  */
  14372 int
  14373 bcm_esw_field_sat_macsa_get(
  14374     int unit,
  14375     bcm_mac_t mac,
  14376     uint32 *class_id)
  14377 {
  14378    int rv = BCM_E_UNAVAIL;
  14379 #if defined (BCM_APACHE_SUPPORT)
  14380    int index;
  14381    
  14382    if (soc_feature(unit, soc_feature_fp_based_sat)) {
  14383        FP_LOCK(unit);
  14384        rv = _bcm_field_apache_sat_macsa_get(unit, mac, class_id, &index);
  14385        FP_UNLOCK(unit);
  14386    }
  14387 #endif
  14388    return rv;
  14389 }
  14390 
  14391 /*
  14392  * Function:
  14393  *      bcm_esw_field_sat_macsa_delete
  14394  * Purpose:
  14395  *      Delete mac sa and class id entry.
  14396  * Parameters:
  14397  *      unit - (IN) Unit number.
  14398  *      mac -  (IN) Src Mac.
  14399  * Returns:
  14400  *      BCM_E_XXX
  14401  * Notes:
  14402  */
  14403 int
  14404 bcm_esw_field_sat_macsa_delete(
  14405     int unit,
  14406     bcm_mac_t mac)
  14407 {
  14408    int rv = BCM_E_UNAVAIL;
  14409 #if defined (BCM_APACHE_SUPPORT)
  14410    
  14411    if (soc_feature(unit, soc_feature_fp_based_sat)) {
  14412        FP_LOCK(unit);
  14413        rv = _bcm_field_apache_sat_macsa_delete(unit, mac);
  14414        FP_UNLOCK(unit);
  14415    }
  14416 #endif
  14417    return rv;
  14418 }
  14419 
  14420 /*
  14421  * Function:
  14422  *      bcm_esw_field_sat_macsa_delete_all
  14423  * Purpose:
  14424  *      Delete all mac sa and class id entries.
  14425  * Parameters:
  14426  *      unit - (IN) Unit number.
  14427  * Returns:
  14428  *      BCM_E_XXX
  14429  * Notes:
  14430  */
  14431 int
  14432 bcm_esw_field_sat_macsa_delete_all(int unit)
  14433 {
  14434    int rv = BCM_E_UNAVAIL;
  14435 #if defined (BCM_APACHE_SUPPORT)
  14436    
  14437    if (soc_feature(unit, soc_feature_fp_based_sat)) {
  14438        FP_LOCK(unit);
  14439        rv = _bcm_field_apache_sat_macsa_delete_all(unit);
  14440        FP_UNLOCK(unit);
  14441    }
  14442 #endif
  14443    return rv;
  14444 }
  14445 
  14446 /*
  14447  * Function: bcm_esw_field_action_ports_add
  14448  *
  14449  * Purpose:
  14450  *     Add PBMP related actions, when entry rule is matched for a packet
  14451  *
  14452  * Parameters:
  14453  *     unit - BCM device number
  14454  *     entry - entry ID
  14455  *     action - bcmFieldActionRedirectPbmp or
  14456  *              bcmFieldActionEgressMask or
  14457  *              bcmFieldActionEgressPortsAdd or
  14458  *              bcmFieldActionRedirectBcastPbmp
  14459  *     pbmp - Port Bitmap for the action
  14460  *
  14461  * Returns:
  14462  *     BCM_E_INIT      - BCM Unit not initialized
  14463  *     BCM_E_NOT_FOUND - Entry ID not found
  14464  *     BCM_E_MEMORY    - Allocation failure
  14465  *     BCM_E_PARAM     - Incorrect action parameter
  14466  *     BCM_E_NONE      - Success
  14467  */
  14468 
  14469 int
  14470 bcm_esw_field_action_ports_add(int unit,
  14471                                bcm_field_entry_t entry,
  14472                                bcm_field_action_t action,
  14473                                bcm_pbmp_t pbmp)
  14474 {
  14475     uint32  param[_FP_ACTION_PARAM_SZ];     
  14476     int rv = 0;
  14477     int i;
  14478     bcm_pbmp_t valid_pbmp;
  14479     int port = -1;
  14480     int link_status = -1;
  14481 
  14482     if ((action != bcmFieldActionRedirectPbmp) && 
  14483         (action != bcmFieldActionEgressMask) &&
  14484         (action != bcmFieldActionEgressPortsAdd) &&
  14485         (action != bcmFieldActionRedirectBcastPbmp)) {
  14486         LOG_ERROR(BSL_LS_BCM_FP,
  14487                   (BSL_META_U(unit,
  14488                               "FP(unit %d) Error: Incorrect action parameter\n"),
  14489                    unit));
  14490         return (BCM_E_PARAM);
  14491     }
  14492 
  14493     BCM_PBMP_CLEAR(valid_pbmp);
  14494     sal_memset(&param, 0, sizeof(param));
  14495 
  14496     if ((soc_feature(unit, soc_feature_epc_linkflap_recover))
  14497             && action == bcmFieldActionEgressPortsAdd) {
  14498         BCM_PBMP_ITER(pbmp, port) {
  14499             rv = _bcm_esw_link_get (unit,port,&link_status);
  14500             if (rv == BCM_E_NONE) {
  14501                 if (link_status == BCM_PORT_LINK_STATUS_UP) {
  14502                     BCM_PBMP_PORT_ADD (valid_pbmp,port);
  14503                 }
  14504             }
  14505         }
  14506     } else {
  14507        rv = _bcm_field_valid_pbmp_get(unit, &valid_pbmp);
  14508        BCM_IF_ERROR_RETURN(rv);
  14509 
  14510        BCM_PBMP_AND(valid_pbmp, pbmp);
  14511        if (BCM_PBMP_NEQ(valid_pbmp, pbmp)) {
  14512           return BCM_E_PARAM;
  14513        }
  14514 
  14515        BCM_PBMP_ASSIGN(valid_pbmp, pbmp);
  14516     }
  14517 
  14518     for (i = 0; (i < _FP_ACTION_PARAM_SZ) && (i < SOC_PBMP_WORD_MAX) ; i++) {
  14519         param[i] = SOC_PBMP_WORD_GET(valid_pbmp, i);
  14520     }
  14521     rv = _bcm_field_action_ports_add(unit, entry, action,
  14522             param[0], param[1], param[2], param[3], param[4], param[5]);
  14523 
  14524     /* When _field_egr_ports_recovery_lock is set to zero, it implies
  14525      * that the EgressPortsAdd bitmap is updated by the user. Hence
  14526      * the EgressPortsAdd Recovery Database should be updated.
  14527      */
  14528     if (soc_feature(unit, soc_feature_epc_linkflap_recover)) {
  14529 #if defined(BCM_TRX_SUPPORT)
  14530         if (SOC_IS_TRX(unit)) {
  14531             if ((action == bcmFieldActionEgressPortsAdd) &&
  14532                     (_field_egr_ports_recovery_lock[unit] == 0) &&
  14533                     (rv == BCM_E_NONE)) {
  14534                 _bcm_trx_field_egr_ports_recovery_add (unit, entry, pbmp);
  14535             }
  14536         }
  14537 #endif
  14538     }
  14539     return rv;
  14540 }
  14541 
  14542 /*
  14543  * Function: bcm_esw_field_action_get
  14544  *
  14545  * Purpose:
  14546  *     Get parameters associated with an entry action
  14547  *
  14548  * Parameters:
  14549  *     unit - BCM device number
  14550  *     entry - Entry ID
  14551  *     action - Action to perform (bcmFieldActionXXX)
  14552  *     param0 - (OUT) Action parameter
  14553  *     param1 - (OUT) Action parameter
  14554  *
  14555  * Returns:
  14556  *     BCM_E_INIT      - BCM Unit not initialized
  14557  *     BCM_E_NOT_FOUND - Entry ID not found
  14558  *     BCM_E_NOT_FOUND - No matching Action for entry
  14559  *     BCM_E_PARAM     - paramX is NULL
  14560  *     BCM_E_NONE      - Success
  14561  */
  14562 
  14563 int
  14564 bcm_esw_field_action_get(int unit,
  14565                          bcm_field_entry_t entry,
  14566                          bcm_field_action_t action,
  14567                          uint32 *param0,
  14568                          uint32 *param1)
  14569 {
  14570     _field_entry_t      *f_ent;
  14571     _field_action_t     *fa = NULL;
  14572     uint8               idx;
  14573     int                 rv;
  14574     int                 parts_count = 0;
  14575 #if defined(BCM_TOMAHAWK_SUPPORT)
  14576     int                 copyTocpu_revert_flg = 0;
  14577 #endif /* BCM_TOMAHAWK_SUPPORT */
  14578 
  14579 #if defined(BCM_TOMAHAWK_SUPPORT)
  14580     if (soc_feature(unit, soc_feature_field_preselector_support) && 
  14581         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
  14582        return _bcm_field_presel_action_get
  14583                     (unit, entry, action, param0, param1);
  14584     }
  14585 #endif /* BCM_TOMAHAWK_SUPPORT */
  14586 
  14587     /* Input parameters check. */
  14588     if ((NULL == param0) || (NULL == param1)) {
  14589        return (BCM_E_PARAM);
  14590     }
  14591 
  14592     /* Lock the module. */
  14593     
  14594     FP_LOCK(unit);
  14595 
  14596     rv = _bcm_field_entry_get_by_id(unit, entry, &f_ent);
  14597     if (BCM_FAILURE(rv)) {
  14598         FP_UNLOCK(unit);
  14599         return (rv);
  14600     }
  14601 
  14602 #if defined(BCM_TOMAHAWK_SUPPORT)
  14603     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  14604                (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS)) {
  14605         parts_count = 1;
  14606     } else
  14607 #endif
  14608     {
  14609         rv = _bcm_field_entry_tcam_parts_count (unit, f_ent->group->stage_id,
  14610                                            f_ent->group->flags, &parts_count);
  14611         if (BCM_FAILURE(rv)) {
  14612             FP_UNLOCK(unit);
  14613             return (rv);
  14614         }
  14615     }
  14616 
  14617     if (bcmFieldActionColorIndependent == action) {
  14618         *param0 = (f_ent->flags & _FP_ENTRY_COLOR_INDEPENDENT) ? 1 : 0;
  14619         *param1 = 0;
  14620         /* Unlock the module. */
  14621         FP_UNLOCK(unit);
  14622         return (BCM_E_NONE);
  14623     }
  14624 
  14625 #if defined(BCM_TOMAHAWK_SUPPORT)
  14626     if ((SOC_INFO(unit).th_ctc_replace_enabled) &&
  14627         ((f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) ||
  14628          (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXACTMATCH)) &&
  14629         (action == bcmFieldActionCopyToCpu)) {
  14630         action = bcmFieldActionMirrorEgress;
  14631         copyTocpu_revert_flg = 1;
  14632     }
  14633 #endif /* BCM_TOMAHAWK_SUPPORT */
  14634 
  14635     /* Find matching action in the entry */
  14636     for (idx = 0; idx < parts_count; idx++) {
  14637         fa = f_ent[idx].actions;
  14638         while (fa != NULL) {
  14639         if (fa->action == action) {
  14640                 /* if match found, jump out of searching loop */
  14641                 goto action_found;
  14642             }
  14643             fa = fa->next;
  14644         }
  14645     }
  14646 
  14647 action_found:
  14648     if (fa == NULL) {
  14649         FP_UNLOCK(unit);
  14650         LOG_VERBOSE(BSL_LS_BCM_FP,
  14651                     (BSL_META_U(unit,
  14652                                 "FP(unit %d) Error: action not in entry=%d\n"),
  14653                      unit, entry));
  14654         return (BCM_E_NOT_FOUND);
  14655     }
  14656 
  14657 #ifdef BCM_APACHE_SUPPORT
  14658     /* Configured not using
  14659        bcm_field_action_copytocpu_config_set API */
  14660     if ((bcmFieldActionCopyToCpu == action) &&
  14661             SOC_IS_APACHE(unit) &&
  14662             soc_feature(unit, soc_feature_ep_redirect_v2) &&
  14663             (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) &&
  14664             (fa->param[2])) {
  14665         FP_UNLOCK(unit);
  14666         LOG_VERBOSE(BSL_LS_BCM_FP,
  14667                 (BSL_META_U(unit,
  14668                             "FP(unit %d) Error: action configured using"
  14669                             " bcm_field_action_copytocpu_config_set in entry=%d\n"),
  14670                  unit, entry));
  14671         return (BCM_E_CONFIG);
  14672     }
  14673     /* Configured not using
  14674        bcm_field_action_redirect_config_set API */
  14675     if ((bcmFieldActionRedirect == action) &&
  14676             SOC_IS_APACHE(unit) &&
  14677             soc_feature(unit, soc_feature_ep_redirect_v2) &&
  14678             (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) &&
  14679             (fa->param[2])) {
  14680         FP_UNLOCK(unit);
  14681         LOG_VERBOSE(BSL_LS_BCM_FP,
  14682                 (BSL_META_U(unit,
  14683                             "FP(unit %d) Error: action configured using"
  14684                             " bcm_field_action_redirect_config_set in entry=%d\n"),
  14685                  unit, entry));
  14686         return (BCM_E_CONFIG);
  14687     }
  14688 #endif
  14689 
  14690 #if defined(BCM_TOMAHAWK_SUPPORT)
  14691     if (copyTocpu_revert_flg == 1) {
  14692         *param0 = fa->param[2];
  14693         *param1 = fa->param[3];
  14694         FP_UNLOCK(unit);
  14695         return BCM_E_NONE;
  14696     }
  14697 #endif /* BCM_TOMAHAWK_SUPPORT */
  14698 
  14699     *param0 = fa->param[0];
  14700     *param1 = fa->param[1];
  14701 
  14702     /* Unlock the module. */
  14703     FP_UNLOCK(unit);
  14704 
  14705     /* Adapt action parameters */
  14706     rv = _field_params_hw_to_api_adapt(unit, action, param0, param1);
  14707     return (rv);
  14708 }
  14709 
  14710 /*
  14711  * Function: bcm_esw_field_action_ports_get
  14712  *
  14713  * Purpose:
  14714  *     Get parameters associated with port related entry actions
  14715  *
  14716  * Parameters:
  14717  *     unit - BCM device number
  14718  *     entry - Entry ID
  14719  *     action - Action
  14720  *     pbmp - (OUT) Action parameter
  14721  *
  14722  * Returns:
  14723  *     BCM_E_INIT      - BCM Unit not initialized
  14724  *     BCM_E_NOT_FOUND - Entry ID not found
  14725  *     BCM_E_NOT_FOUND - No matching Action for entry
  14726  *     BCM_E_PARAM     - incorrect action OR pbmp is NULL
  14727  *     BCM_E_NONE      - Success
  14728  */
  14729 
  14730 int
  14731 bcm_esw_field_action_ports_get(int unit,
  14732                                bcm_field_entry_t entry,
  14733                                bcm_field_action_t action,
  14734                                bcm_pbmp_t *pbmp)
  14735 {
  14736 
  14737     uint32 param[_FP_ACTION_PARAM_SZ];
  14738     int    i;
  14739     int    rv;
  14740 
  14741     /* Input parameter check. */
  14742     if (NULL == pbmp) {
  14743         return (BCM_E_PARAM);
  14744     }
  14745 
  14746     if ((action != bcmFieldActionRedirectPbmp) && 
  14747         (action != bcmFieldActionEgressMask) &&
  14748         (action != bcmFieldActionRedirectBcastPbmp) &&
  14749         (action != bcmFieldActionEgressPortsAdd)) {
  14750         return (BCM_E_PARAM);
  14751     }
  14752 
  14753 
  14754     sal_memset(param, 0, sizeof(param));
  14755 
  14756     /* Extract action information from field entry. */
  14757     rv = _bcm_field_action_ports_get(unit, entry,
  14758             action, param, param + 1, param + 2, param + 3,
  14759             param + 4, param + 5);
  14760     BCM_IF_ERROR_RETURN(rv);
  14761 
  14762     BCM_PBMP_CLEAR(*pbmp);
  14763     /* When API is called externally, return pbmp from the
  14764      * Egress Port Bitmap Recovery
  14765      */
  14766     if (soc_feature(unit, soc_feature_epc_linkflap_recover)) {
  14767 #if defined(BCM_TRX_SUPPORT)
  14768         if (SOC_IS_TRX(unit)) {
  14769             if ((action == bcmFieldActionEgressPortsAdd) &&
  14770                     (_field_egr_ports_recovery_lock[unit] == 0)) {
  14771                 _bcm_trx_field_egr_ports_recovery_entry_pbmp_get (unit, entry, pbmp);
  14772                 return (BCM_E_NONE);
  14773             }
  14774         }
  14775 #endif
  14776     }
  14777 
  14778     for (i = 0; (i < _FP_ACTION_PARAM_SZ) && (i < SOC_PBMP_WORD_MAX); i++) {
  14779         SOC_PBMP_WORD_SET(*pbmp, i, param[i]);
  14780     }
  14781     return (BCM_E_NONE);
  14782 }
  14783 
  14784 /*
  14785  * Function:
  14786  *      bcm_esw_field_action_mac_get
  14787  * Purpose:
  14788  *      Retrieve the parameters for an action previously added to a
  14789  *      field entry.
  14790  * Parameters:
  14791  *      unit - (IN) Unit number.
  14792  *      entry - (IN) Field entry Id.
  14793  *      action - (IN) Field action id.
  14794  *      mac - (IN) Field action argument.
  14795  * Returns:
  14796  *      BCM_E_XXX
  14797  * Notes:
  14798  */
  14799 int 
  14800 bcm_esw_field_action_mac_get(
  14801     int unit, 
  14802     bcm_field_entry_t entry, 
  14803     bcm_field_action_t action, 
  14804     bcm_mac_t *mac)
  14805 {
  14806     uint32 param[_FP_ACTION_PARAM_SZ];     
  14807     int    rv;
  14808 
  14809     /* Input parameter check. */
  14810     if (NULL == mac) {
  14811         return (BCM_E_PARAM);
  14812     }
  14813 
  14814     if ((action != bcmFieldActionSrcMacNew) && 
  14815         (action != bcmFieldActionDstMacNew) &&
  14816         (action != bcmFieldActionReplaceDstMac) &&
  14817         (action != bcmFieldActionReplaceSrcMac) ) {
  14818 
  14819         return (BCM_E_PARAM);
  14820     }
  14821     
  14822     /* Extract action information from field entry. */
  14823     rv = bcm_esw_field_action_get(unit, entry, action, 
  14824                                   param, param + 1);
  14825     BCM_IF_ERROR_RETURN(rv);
  14826 
  14827     SAL_MAC_ADDR_FROM_UINT32((*mac), param);
  14828     return (BCM_E_NONE);
  14829 }
  14830 
  14831 /*
  14832  * Function:
  14833  *      bcm_field_action_delete
  14834  * Purpose:
  14835  *      Delete an action from a field entry.
  14836  * Parameters:
  14837  *      unit   - (IN) BCM device number
  14838  *      entry  - (IN) Entry ID
  14839  *      action - (IN) Action to remove (bcmFieldActionXXX)
  14840  *      param0 - (IN) Action parameter (use 0 if not required)
  14841  *      param1 - (IN) Action parameter (use 0 if not required)
  14842  * Returns:
  14843  *      BCM_E_XXX
  14844  * Notes:
  14845  */
  14846 int 
  14847 bcm_esw_field_action_delete(int unit, bcm_field_entry_t entry, 
  14848                         bcm_field_action_t action, 
  14849                         uint32 param0, uint32 param1)
  14850 {
  14851     int rv;                /* Operation return status. */
  14852 
  14853     if (action < 0 || bcmFieldActionCount <= action) {
  14854         LOG_ERROR(BSL_LS_BCM_FP,
  14855                   (BSL_META_U(unit,
  14856                               "FP(unit %d) Error: unknown action=%d\n"),
  14857                    unit, action));
  14858         return (BCM_E_PARAM);
  14859     }
  14860 
  14861     
  14862 #if defined(BCM_TOMAHAWK_SUPPORT) 
  14863      /*
  14864       * Manuplate EgressMirror to CopyToCpu Action for CTC WAR.
  14865       */
  14866      if ((SOC_INFO(unit).th_ctc_replace_enabled) &&
  14867           (action == bcmFieldActionCopyToCpu)) {
  14868          _field_entry_t      *f_ent;
  14869 
  14870          BCM_IF_ERROR_RETURN(_field_entry_get(unit, entry,
  14871                               _FP_ENTRY_PRIMARY, &f_ent));
  14872          if ((f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) ||
  14873              (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXACTMATCH)) {
  14874             action = bcmFieldActionMirrorEgress;
  14875          }
  14876      }
  14877 #endif /* BCM_TOMOHAWK_SUPPORT */
  14878 
  14879     /* Adapt action parameters */
  14880     rv = _field_params_api_to_hw_adapt(unit, action, &param0, &param1);
  14881     BCM_IF_ERROR_RETURN(rv);
  14882 
  14883     FP_LOCK(unit);
  14884 
  14885     rv = _field_action_delete(unit, entry, action, param0, param1);
  14886 
  14887     FP_UNLOCK(unit);
  14888     return rv;
  14889 }
  14890 
  14891 
  14892 
  14893 
  14894 /*
  14895  * Function: bcm_esw_field_action_remove
  14896  *
  14897  * Purpose:
  14898  *     Remove an action performed when entry rule is matched for a packet.
  14899  *
  14900  * Parameters:
  14901  *     unit   - BCM device number
  14902  *     entry  - Entry ID
  14903  *     action - Action to remove (bcmFieldActionXXX)
  14904  *
  14905  * Returns:
  14906  *     BCM_E_INIT      - BCM Unit not initialized
  14907  *     BCM_E_NOT_FOUND - Entry ID not found
  14908  *     BCM_E_NOT_FOUND - No matching Action for entry
  14909  *     BCM_E_PARAM     - Action out of valid range.
  14910  *     BCM_E_NONE      - Success
  14911  */
  14912 int
  14913 bcm_esw_field_action_remove(int unit,
  14914                             bcm_field_entry_t entry,
  14915                             bcm_field_action_t action)
  14916 {
  14917     int rv;                /* Operation return status. */
  14918 
  14919     
  14920     FP_LOCK(unit);
  14921 
  14922     if (soc_feature(unit, soc_feature_epc_linkflap_recover)){
  14923 #if defined(BCM_TRX_SUPPORT)
  14924         if (SOC_IS_TRX(unit)) {
  14925             if ((action == bcmFieldActionEgressPortsAdd) &&
  14926                     (_field_egr_ports_recovery_lock[unit] == 0)) {
  14927                 /* Clear EntryId from _entry_egr_ports_recovery database*/
  14928                 _bcm_trx_field_egr_ports_recovery_entry_remove (unit, entry);
  14929             }
  14930         }
  14931 #endif
  14932     }
  14933 
  14934     rv = bcm_esw_field_action_delete(unit, entry, action, 
  14935                                      (uint32)_FP_INVALID_INDEX, 
  14936                                      (uint32)_FP_INVALID_INDEX);
  14937     FP_UNLOCK(unit);
  14938     return (rv);
  14939 }
  14940 
  14941 /*
  14942  * Function: bcm_esw_field_action_remove_all
  14943  *
  14944  * Purpose:
  14945  *     Remove all actions from an entry rule.
  14946  *
  14947  * Parameters:
  14948  *     unit - BCM device number
  14949  *     entry - Entry ID
  14950  *
  14951  * Returns:
  14952  *     BCM_E_INIT      - BCM Unit not initialized
  14953  *     BCM_E_NOT_FOUND - Entry ID not found
  14954  *     BCM_E_NONE      - Success
  14955  */
  14956 
  14957 int
  14958 bcm_esw_field_action_remove_all(int unit,
  14959                                 bcm_field_entry_t entry)
  14960 {
  14961     _field_entry_t      *f_ent;
  14962     _field_action_t     *fa;
  14963     int                  rv = BCM_E_NONE;      /* Operation return status.  */
  14964 
  14965     /* Get field control structure. */
  14966     
  14967     FP_LOCK(unit);
  14968 
  14969     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  14970     if (BCM_FAILURE(rv)) {
  14971         FP_UNLOCK(unit);
  14972         return (rv);
  14973     }
  14974 
  14975 
  14976     /* start at the head of the actions list and burn them up */
  14977     fa = f_ent->actions;
  14978     /* No action is present */
  14979     if (fa == NULL) {
  14980         FP_UNLOCK(unit);
  14981         return rv;
  14982     }
  14983 
  14984     while (fa != NULL) {
  14985         rv = _field_action_delete(unit, entry, fa->action, 
  14986                                   fa->param[0], fa->param[1]);
  14987         if (BCM_FAILURE(rv)) {
  14988             FP_UNLOCK(unit);
  14989             return (rv);
  14990         }
  14991 
  14992         /* 
  14993          * Action might be removed from the entry actions
  14994          * list only if entry was not installed.
  14995          * Otherwise clean up will happen during reinstall.
  14996          */
  14997         fa = (f_ent->flags & _FP_ENTRY_INSTALLED) ? \
  14998             fa->next : f_ent->actions;
  14999     }
  15000 
  15001     f_ent->flags |= _FP_ENTRY_DIRTY;
  15002 
  15003     FP_UNLOCK(unit);
  15004     return (rv);
  15005 }
  15006 
  15007 /* Section: Field Statistics */
  15008 
  15009 /*
  15010  * Function: 
  15011  *    bcm_esw_field_stat_create
  15012  *
  15013  * Description:
  15014  *       Create statistics collection entity.
  15015  * Parameters:
  15016  *      unit     - (IN) BCM device number.
  15017  *      group    - (IN) Field group id. 
  15018  *      nstat    - (IN) Number of elements in stat array.
  15019  *      stat_arr - (IN) Collected statistics descriptors array.
  15020  *      stat_id  - (OUT) Statistics entity id.
  15021  * Returns:
  15022  *      BCM_E_XXX
  15023  */
  15024 int 
  15025 bcm_esw_field_stat_create(int unit, bcm_field_group_t group, int nstat, 
  15026                           bcm_field_stat_t *stat_arr, int *stat_id) 
  15027 {
  15028     int                  rv;      /* Operation return status.  */
  15029 
  15030     /* Get field control structure. */
  15031     
  15032     FP_LOCK(unit);
  15033 
  15034     rv = _field_stat_create(unit, group, nstat, stat_arr, 0, stat_id);
  15035 
  15036     FP_UNLOCK(unit);
  15037     return (rv);
  15038 }
  15039 
  15040 /*
  15041  * Function: 
  15042  *    bcm_esw_field_stat_create_id
  15043  *
  15044  * Description:
  15045  *       Create statistics collection entity with specified ID.
  15046  * Parameters:
  15047  *      unit     - (IN) BCM device number.
  15048  *      group    - (IN) Field group id. 
  15049  *      nstat    - (IN) Number of elements in stat array.
  15050  *      stat_arr - (IN) Collected statistics descriptors array.
  15051  *      stat_id  - (IN) Statistics entity id.
  15052  * Returns:
  15053  *      BCM_E_XXX
  15054  */
  15055 int 
  15056 bcm_esw_field_stat_create_id(int unit, bcm_field_group_t group, int nstat, 
  15057                           bcm_field_stat_t *stat_arr, int stat_id) 
  15058 {
  15059     int                  rv;      /* Operation return status.  */
  15060     int                  stat_id_local = stat_id; /* Stats ID value */
  15061 
  15062     /* Check if Stat ID is in software supported range */
  15063     if ((stat_id < _FP_ID_BASE) || (stat_id > _FP_ID_MAX)) {
  15064         return (BCM_E_PARAM);
  15065     }
  15066     /* Get field control structure. */
  15067     
  15068     FP_LOCK(unit);
  15069 
  15070     rv = _field_stat_create(unit, group, nstat, stat_arr,
  15071             _FP_STAT_CREATE_ID, &stat_id_local);
  15072 
  15073     FP_UNLOCK(unit);
  15074     return (rv);
  15075 }
  15076 
  15077 /*
  15078  * Function:
  15079  *      bcm_esw_field_stat_attach
  15080  * Description:
  15081  *      Attach counters entries to a field group 
  15082  *
  15083  * Parameters:
  15084  *      unit             - (IN) unit number
  15085  *      group            - (IN) Field group statistics entity will be
  15086  *                              Associated with in the future 
  15087  *      Stat_counter_id  - (IN) Stat Counter ID.
  15088  *      Stat_id          - (OUT) Statistics entity ID.
  15089  *
  15090  * Return Value:
  15091  *      BCM_E_XXX
  15092  * Notes:
  15093  */
  15094 
  15095 int
  15096 bcm_esw_field_stat_attach(int unit, bcm_field_group_t field_group, 
  15097                           uint32 stat_counter_id, uint32 *stat_id)
  15098 {
  15099     _field_stat_t                *f_st=NULL;    /* Field statistics entity.  */
  15100     int                          rv=0;          /* Operation return status.  */
  15101     bcm_stat_group_mode_t        group_mode= bcmStatGroupModeSingle;            
  15102     bcm_field_stat_t             field_stat[2]={bcmFieldStatBytes,              
  15103                                              bcmFieldStatPackets};
  15104     int                          nstat=2;
  15105     uint32                       stat_flag=_FP_STAT_INTERNAL_FLEX_COUNTER;
  15106 
  15107 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT)
  15108     bcm_stat_flex_direction_t    direction=bcmStatFlexDirectionIngress;
  15109     bcm_stat_flex_mode_t         offset_mode=0;
  15110 #endif
  15111 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
  15112     defined(BCM_HURRICANE3_SUPPORT)
  15113     uint32                       pool_number=0;
  15114     uint32                       base_index=0;
  15115     bcm_stat_object_t            object=bcmStatObjectIngPort;
  15116     uint32                       total_counters=1;
  15117 #endif
  15118 #if defined(BCM_TOMAHAWK_SUPPORT)
  15119    _field_group_t *fg = NULL;  /* Group Operational Structure. */
  15120 #endif
  15121 
  15122 
  15123 #if defined(BCM_TOMAHAWK_SUPPORT)
  15124    BCM_IF_ERROR_RETURN(_field_group_get(unit, field_group, &fg));
  15125    if (((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) ||
  15126         (_BCM_FIELD_STAGE_LOOKUP == fg->stage_id) ||
  15127         (_BCM_FIELD_STAGE_EXACTMATCH == fg->stage_id)) &&
  15128         (soc_feature(unit, soc_feature_advanced_flex_counter)) &&
  15129         (soc_feature(unit, soc_feature_field_multi_pipe_support))) {
  15130         return _bcm_field_th_stat_attach(unit, field_group, stat_counter_id, stat_id);
  15131    }
  15132 #endif
  15133 
  15134 #if defined(BCM_FLOWTRACKER_SUPPORT)
  15135     if (_BCM_FIELD_STAGE_FLOWTRACKER == fg->stage_id) {
  15136         return (BCM_E_UNAVAIL);
  15137     }
  15138 #endif
  15139 
  15140 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT)
  15141     if (soc_feature(unit,soc_feature_advanced_flex_counter)) {
  15142         _bcm_esw_stat_get_counter_id_info(
  15143                   unit,
  15144                   stat_counter_id,
  15145                   &group_mode,&object,&offset_mode,&pool_number,&base_index);
  15146 
  15147         BCM_IF_ERROR_RETURN(_bcm_esw_stat_validate_object(unit,object,&direction));
  15148         BCM_IF_ERROR_RETURN(_bcm_esw_stat_validate_group(unit,group_mode));
  15149 
  15150         if (object != bcmStatObjectIngPolicy &&
  15151                 object != bcmStatObjectIngEXTPolicy) {
  15152 #if defined(BCM_TRIDENT3_SUPPORT)
  15153             /* StageEgress is supported only for TD3 */
  15154             if (soc_feature(unit, soc_feature_td3_style_fp)) {
  15155                if (object != bcmStatObjectEgrFieldStageEgress) {
  15156                     LOG_VERBOSE(BSL_LS_BCM_FP,
  15157                             (BSL_META_U(unit, "Retrieved object need to be"
  15158                                      " bcmStatObjectIngPolicy or"
  15159                                      " bcmStatObjectIngEXTPolicy or"
  15160                                      " bcmStatObjectEgrFieldStageEgress\n\r")));
  15161                     return BCM_E_PARAM;
  15162                }
  15163             } else
  15164 #endif /* BCM_TRIDENT3_SUPPORT */
  15165 #if defined(BCM_TRIDENT2PLUS_SUPPORT)
  15166             /* StageIngress,StageEgress is supported only for TD2PLUS */
  15167             if (SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit)) {
  15168                 if ((object != bcmStatObjectIngFieldStageIngress) &&
  15169                         (object != bcmStatObjectEgrFieldStageEgress)) {
  15170                     LOG_VERBOSE(BSL_LS_BCM_FP,
  15171                             (BSL_META_U(unit, "Retrieved object need to be"
  15172                                         " bcmStatObjectIngPolicy or"
  15173                                         " bcmStatObjectIngEXTPolicy or"
  15174                                         " bcmStatObjectEgrFieldStageEgress or"
  15175                                         " bcmStatObjectIngFieldStageIngress\n")));
  15176                     return BCM_E_PARAM;
  15177                 }
  15178             } else
  15179 #endif /* BCM_TRIDENT2PLUS_SUPPORT */
  15180             {
  15181                 LOG_VERBOSE(BSL_LS_BCM_FP,
  15182                         (BSL_META_U(unit,
  15183                                     "Retrieved object need to be bcmStatObjectIngPolicy or"
  15184                                     "bcmStatObjectIngEXTPolicy\n")));
  15185                 return BCM_E_PARAM;
  15186             }
  15187         }
  15188 
  15189         rv = _bcm_esw_stat_total_counters_get(unit,
  15190                     stat_counter_id, &total_counters);
  15191         if (BCM_FAILURE(rv)) {
  15192             LOG_ERROR(BSL_LS_BCM_FP,
  15193                     (BSL_META_U(unit,
  15194                                 "Unable to retrieve number of counters based on flex stat id\n")));
  15195             return rv;
  15196         }
  15197     }
  15198 #endif
  15199 #if defined(BCM_HURRICANE3_SUPPORT)
  15200     if (soc_feature(unit,soc_feature_flowcnt)) {
  15201         uint32  profile_group=0;
  15202 
  15203         _bcm_esw_flowcnt_counter_id_get(stat_counter_id,
  15204             &group_mode, &object, &profile_group, 
  15205             &pool_number, &base_index);
  15206         BCM_IF_ERROR_RETURN(
  15207             _bcm_esw_flowcnt_total_counters_get(unit,
  15208                     stat_counter_id, &total_counters));
  15209 
  15210         /* Assign default counter mode is packet count */
  15211         field_stat[0] = bcmFieldStatPackets;
  15212         nstat = 1;
  15213         stat_flag = _FP_STAT_FLOWCNT_CNTR;
  15214     }
  15215 #endif /* BCM_HURRICANE3_SUPPORT */
  15216 
  15217     
  15218     FP_LOCK(unit);
  15219 
  15220 #if defined BCM_TRIDENT2PLUS_SUPPORT
  15221     /* StageIngress is supported only for TD2PLUS */
  15222     if ((SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit) ||
  15223          soc_feature(unit, soc_feature_td3_style_fp)) &&
  15224         ((object == bcmStatObjectIngFieldStageIngress) ||
  15225          (object == bcmStatObjectEgrFieldStageEgress))) {
  15226         stat_flag = _FP_STAT_FLEX_CNTR;
  15227         }
  15228 #endif /* BCM_TRIDENT2PLUS_SUPPORT */
  15229         rv = _field_stat_create( unit, field_group, nstat, field_stat,
  15230                 stat_flag,(int *)stat_id);
  15231 
  15232     if (BCM_FAILURE(rv)) {
  15233         FP_UNLOCK(unit);
  15234         return (rv);
  15235     }
  15236 
  15237     rv = _bcm_field_stat_get(unit, *stat_id, &f_st);
  15238     if(BCM_FAILURE(rv)) {
  15239        FP_UNLOCK(unit);
  15240        bcm_esw_field_stat_destroy(unit,*stat_id);
  15241        return rv;
  15242     }
  15243     FP_UNLOCK(unit);
  15244     f_st->flex_mode = stat_counter_id;
  15245 
  15246     /* Update STAT group mode. */
  15247     if (soc_feature(unit,soc_feature_advanced_flex_counter)) {     
  15248 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT)
  15249        f_st->hw_mode = offset_mode;      /* Advanced Flex stat mode */
  15250        f_st->pool_index = pool_number;
  15251        f_st->hw_index = base_index;
  15252        f_st->hw_entry_count = total_counters;
  15253        f_st->hw_flags |= _FP_STAT_CREATED_BY_FLEX_MODULE;
  15254 #else
  15255        f_st->hw_mode = group_mode;      /* Advanced Flex stat mode */
  15256 #endif
  15257     } else
  15258 #if defined(BCM_HURRICANE3_SUPPORT)        
  15259     if (soc_feature(unit,soc_feature_flowcnt)) {
  15260         f_st->hw_mode = group_mode;
  15261         f_st->pool_index = pool_number;
  15262         f_st->hw_index = base_index;
  15263         f_st->hw_entry_count = total_counters;
  15264     } else
  15265 #endif
  15266     {
  15267        f_st->hw_mode = 1;               /* VFP Flex counters use mode 1 */  
  15268     }
  15269 
  15270     return BCM_E_NONE;
  15271 }
  15272 
  15273 /*
  15274  * Function:
  15275  *      bcm_esw_field_stat_detach
  15276  * Description:
  15277  *      Detach counters entries to a field group. 
  15278  *
  15279  * Parameters:
  15280  *      unit             - (IN) unit number
  15281  *      Stat_id          - (IN) Statistics entity ID.
  15282  *
  15283  * Return Value:
  15284  *      BCM_E_XXX
  15285  * Notes: It might be deprecated soon.
  15286  */
  15287 
  15288 int
  15289 bcm_esw_field_stat_detach(int unit, uint32 stat_id)
  15290 {
  15291 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
  15292     defined(BCM_HURRICANE3_SUPPORT)
  15293     _field_stat_t     *f_st=NULL;       /* Field statatistics entity.    */
  15294     _field_group_t    *group_p=NULL;    /* Group info. */
  15295     int               entry_index=0;
  15296 
  15297     if (!soc_feature(unit,soc_feature_advanced_flex_counter) &&
  15298         !soc_feature(unit,soc_feature_flowcnt)) {
  15299          return BCM_E_UNAVAIL;
  15300     }
  15301 
  15302     BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, stat_id, &f_st));
  15303     BCM_IF_ERROR_RETURN(_field_group_get(unit,f_st->gid,&group_p));
  15304     for (entry_index = 0;
  15305          entry_index < group_p->group_status.entry_count;
  15306          entry_index++) {
  15307          BCM_IF_ERROR_RETURN(bcm_esw_field_entry_stat_detach(
  15308                              unit,group_p->entry_arr[entry_index]->eid,
  15309                              stat_id));
  15310     }
  15311     return BCM_E_NONE;
  15312 #else
  15313     return BCM_E_UNAVAIL;
  15314 #endif
  15315 }
  15316 
  15317 
  15318 /*
  15319  * Function:
  15320  *      bcm_esw_field_stat_counter_get
  15321  * Description:
  15322  *      Get counter statistic values for a field entity
  15323  *
  15324  * Parameters:
  15325  *      unit             - (IN) unit number
  15326  *      Stat_id          - (IN) Statistics entity ID.
  15327  *      stat             - (IN) Type of the counter to retrieve
  15328  *                              I.e. ingress/egress byte/packet)
  15329  *      num_entries      - (IN) Number of counter Entries
  15330  *      counter_indexes  - (IN) Pointer to Counter indexes entries
  15331  *      counter_values   - (OUT) Pointer to counter values
  15332  *
  15333  * Return Value:
  15334  *      BCM_E_XXX
  15335  * Notes:
  15336  */
  15337 int
  15338 bcm_esw_field_stat_counter_get(int unit, uint32 stat_id, bcm_field_stat_t stat, 
  15339                                uint32 num_entries, uint32 *counter_indexes, 
  15340                                bcm_stat_value_t *counter_values)
  15341 {
  15342 
  15343     return _bcm_esw_field_stat_counter_get(unit, 0, stat_id, stat, num_entries,
  15344                                          counter_indexes, counter_values);
  15345    
  15346 }
  15347 
  15348 /*
  15349  * Function:
  15350  *      bcm_esw_field_stat_counter_sync_get
  15351  * Description:
  15352  *      Get counter statistic values fori a field entity
  15353  *      sw accumulated counters synced with hw count.
  15354  *
  15355  * Parameters:
  15356  *      unit             - (IN) unit number
  15357  *      Stat_id          - (IN) Statistics entity ID.
  15358  *      stat             - (IN) Type of the counter to retrieve
  15359  *                              I.e. ingress/egress byte/packet)
  15360  *      num_entries      - (IN) Number of counter Entries
  15361  *      counter_indexes  - (IN) Pointer to Counter indexes entries
  15362  *      counter_values   - (OUT) Pointer to counter values
  15363  *
  15364  * Return Value:
  15365  *      BCM_E_XXX
  15366  * Notes:
  15367  */
  15368 int
  15369 bcm_esw_field_stat_counter_sync_get(int unit, uint32 stat_id, 
  15370                                bcm_field_stat_t stat, 
  15371                                uint32 num_entries, uint32 *counter_indexes, 
  15372                                bcm_stat_value_t *counter_values)
  15373 {
  15374 
  15375     return _bcm_esw_field_stat_counter_get(unit, 1, stat_id, stat, num_entries,
  15376                                          counter_indexes, counter_values);
  15377    
  15378 }
  15379 
  15380 /*
  15381  * Function:
  15382  *      bcm_esw_field_stat_counter_set
  15383  * Description:
  15384  *      Set counter statistic values for a field entity 
  15385  *
  15386  * Parameters:
  15387  *      unit             - (IN) unit number
  15388  *      Stat_id          - (IN) Statistics entity ID.
  15389  *      stat             - (IN) Type of the counter to retrieve
  15390  *                              I.e. ingress/egress byte/packet)
  15391  *      num_entries      - (IN) Number of counter Entries
  15392  *      counter_indexes  - (IN) Pointer to Counter indexes entries
  15393  *      counter_values   - (IN) Pointer to counter values
  15394  *
  15395  * Return Value:
  15396  *      BCM_E_XXX
  15397  * Notes:
  15398  */
  15399 int
  15400 bcm_esw_field_stat_counter_set(int unit, uint32 stat_id, bcm_field_stat_t stat, 
  15401                                uint32 num_entries, uint32 *counter_indexes, 
  15402                                bcm_stat_value_t *counter_values)
  15403 {
  15404 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
  15405     defined(BCM_HURRICANE3_SUPPORT)
  15406     _field_stat_t                   *f_st=NULL; /* Field statistics entity.  */
  15407     uint32                          index_count=0;
  15408     uint32                          byte_flag=0;
  15409 
  15410     if (!soc_feature(unit, soc_feature_advanced_flex_counter) &&
  15411         !soc_feature(unit, soc_feature_flowcnt)) {
  15412          return BCM_E_UNAVAIL;
  15413     }
  15414 
  15415     if (stat == bcmFieldStatPackets ||
  15416         stat == bcmFieldStatGreenPackets ||
  15417         stat == bcmFieldStatYellowPackets ||
  15418         stat == bcmFieldStatRedPackets ||
  15419         stat == bcmFieldStatNotGreenPackets ||
  15420         stat == bcmFieldStatNotYellowPackets ||
  15421         stat == bcmFieldStatNotRedPackets) {
  15422         byte_flag=0;
  15423     } else {
  15424         byte_flag=1;
  15425     }
  15426 
  15427     
  15428     BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, stat_id, &f_st));
  15429     if (f_st->flex_mode == 0) {
  15430         LOG_VERBOSE(BSL_LS_BCM_FP,
  15431                     (BSL_META_U(unit,
  15432                                 "Entry not attached \n")));
  15433         return BCM_E_PARAM;
  15434     }
  15435 
  15436     if (NULL == counter_values || NULL == counter_indexes) {
  15437         return BCM_E_PARAM;
  15438     }
  15439 
  15440     for (index_count=0; index_count < num_entries ; index_count++) {
  15441 #if defined(BCM_HURRICANE3_SUPPORT)        
  15442         if (soc_feature(unit, soc_feature_flowcnt)) {
  15443             BCM_IF_ERROR_RETURN(_bcm_esw_flowcnt_counter_raw_set(
  15444                              unit, f_st->flex_mode, byte_flag,
  15445                              counter_indexes[index_count],
  15446                              &counter_values[index_count]));
  15447             /* update the stat mode */
  15448             if (byte_flag == 1) {
  15449                 f_st->stat_arr[index_count] = bcmFieldStatBytes;
  15450             } else {
  15451                 f_st->stat_arr[index_count] = bcmFieldStatPackets;
  15452             }
  15453             
  15454         }
  15455 #endif /* BCM_HURRICANE3_SUPPORT */         
  15456 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT)        
  15457         if (soc_feature(unit, soc_feature_advanced_flex_counter)) { 
  15458             BCM_IF_ERROR_RETURN(_bcm_esw_stat_counter_raw_set(
  15459                              unit, f_st->flex_mode, byte_flag,
  15460                              counter_indexes[index_count],
  15461                              &counter_values[index_count]));
  15462         }
  15463 #endif /*  BCM_KATANA_SUPPORT || BCM_TRIUMPH3_SUPPORT */
  15464     } 
  15465 
  15466     return BCM_E_NONE;
  15467 #else
  15468     return BCM_E_UNAVAIL;
  15469 #endif
  15470 }
  15471 
  15472 /*
  15473  * Function:
  15474  *      bcm_esw_field_stat_id_get
  15475  * Description:
  15476  *      Get stat counter id associated with given gpo
  15477  *
  15478  * Parameters:
  15479  *      unit             - (IN) unit number
  15480  *      group            - (IN) Field group 
  15481  *      Stat_id          - (IN) Statistics entity ID.
  15482  *      Stat_counter_id  - (OUT) Stat Counter ID
  15483  * Return Value:
  15484  *      BCM_E_XXX
  15485  * Notes:
  15486  */
  15487 int bcm_esw_field_stat_id_get(int               unit,
  15488                               bcm_field_group_t group,
  15489                               uint32            stat_id, 
  15490                               uint32            *stat_counter_id)
  15491 {
  15492 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT)
  15493    _field_group_t      *fg=NULL;       /* Group structure to free up       */
  15494    bcm_field_entry_t   *entry_array=NULL;
  15495    int                 max_entry_count=0;
  15496    int                 entry_index=0;
  15497    int                 entry_count=0;
  15498    uint32              local_stat_id=0;
  15499    _field_stat_t       *f_st=NULL;    /* Field statistics entity.  */
  15500    int                 rv;
  15501 
  15502 
  15503    
  15504    BCM_IF_ERROR_RETURN(_field_group_get(unit, group, &fg));
  15505    BCM_IF_ERROR_RETURN(bcm_esw_field_entry_multi_get(
  15506                        unit,group,0,NULL,&max_entry_count));
  15507    if (max_entry_count == 0) {
  15508        return BCM_E_NOT_FOUND;
  15509    }
  15510    if ((entry_array = sal_alloc(max_entry_count*sizeof (bcm_field_entry_t),
  15511                                "Entry Array")) == NULL) {
  15512         LOG_CLI((BSL_META_U(unit,
  15513                             "Couldn't allocate memoryentry_count=%d"),
  15514                  entry_count));
  15515         return BCM_E_MEMORY;
  15516    }
  15517    if ((rv=bcm_esw_field_entry_multi_get(unit,group,max_entry_count,
  15518                                     entry_array,&entry_count)) != BCM_E_NONE) {
  15519         sal_free(entry_array);
  15520         return rv;
  15521    }
  15522    for (entry_index=0;entry_index < entry_count ; entry_index++) {
  15523 
  15524         rv = bcm_esw_field_entry_stat_get(unit,
  15525                                         entry_array[entry_index],
  15526                                         (int *)&local_stat_id);
  15527 
  15528         /* Stats are not attached to this entry , So skip it. */
  15529         if (BCM_E_NOT_FOUND == rv) {
  15530             continue;
  15531         }
  15532 
  15533         if (BCM_E_NONE != rv)         
  15534         {
  15535             sal_free(entry_array);
  15536             return rv;
  15537         }
  15538 
  15539         if ((rv=_bcm_field_stat_get(unit,local_stat_id,&f_st)) != BCM_E_NONE) {
  15540              sal_free(entry_array);
  15541              return rv;
  15542         }
  15543 
  15544         if (local_stat_id == stat_id ) {
  15545             *stat_counter_id=f_st->flex_mode;
  15546             sal_free(entry_array);
  15547             return BCM_E_NONE;
  15548         }
  15549    }
  15550    sal_free(entry_array);
  15551    return BCM_E_PARAM;
  15552 #else
  15553     return BCM_E_UNAVAIL;
  15554 #endif
  15555 }
  15556 
  15557 /*
  15558  * Function: 
  15559  *    bcm_esw_field_stat_destroy
  15560  *
  15561  * Description:
  15562  *       Destroy statistics collection entity.
  15563  * Parameters:
  15564  *      unit     - (IN) BCM device number.
  15565  *      stat_id  - (IN) Statistics entity id.
  15566  * Returns:
  15567  *      BCM_E_XXX
  15568  */
  15569 int 
  15570 bcm_esw_field_stat_destroy(int unit, int stat_id)
  15571 {
  15572     int                  rv;      /* Operation return status.  */
  15573 
  15574     /* Get field control structure. */
  15575     
  15576     FP_LOCK(unit);
  15577 
  15578     rv = _field_stat_destroy(unit, stat_id);
  15579 
  15580     FP_UNLOCK(unit);
  15581     return (rv);
  15582 }
  15583 
  15584 /*
  15585  * Function: 
  15586  *     bcm_esw_field_stat_size
  15587  *
  15588  * Description:
  15589  *      Get number of different statistics associated with statistics
  15590  *      collection entity.
  15591  * Parameters:
  15592  *      unit      - (IN) BCM device number.
  15593  *      stat_id   - (IN) Statistics entity id.
  15594  *      stat_size - (OUT) Number of collercted statistics
  15595  * Returns:
  15596  *      BCM_E_XXX
  15597  */
  15598 int 
  15599 bcm_esw_field_stat_size(int unit, int stat_id, int *stat_size)
  15600 {
  15601     _field_stat_t       *f_st;    /* Field statistics entity.  */
  15602     int                  rv;      /* Operation return status.  */
  15603 
  15604     /* Input parameters check */
  15605     if (NULL == stat_size) {
  15606         return (BCM_E_PARAM);
  15607     }
  15608 
  15609     /* Get field control structure. */
  15610     
  15611     FP_LOCK(unit);
  15612 
  15613     rv = _bcm_field_stat_get(unit, stat_id, &f_st);
  15614     if (BCM_FAILURE(rv)) {
  15615         FP_UNLOCK(unit);
  15616         return (rv);
  15617     }
  15618 
  15619     *stat_size = f_st->nstat; 
  15620 
  15621     FP_UNLOCK(unit);
  15622     return (rv);
  15623 }
  15624 
  15625 /*
  15626  * Function: 
  15627  *     bcm_esw_field_stat_config_get
  15628  *
  15629  * Description:
  15630  *      Get enabled statistics for specific collection entity.
  15631  * Parameters:
  15632  *      unit     - (IN) BCM device number.
  15633  *      stat_id  - (IN) Statistics entity id.
  15634  *      nstat    - (IN) Number of elements in stat array.
  15635  *      stat_arr - (OUT) Collected statistics descriptors array.
  15636  * Returns:
  15637  *      BCM_E_XXX
  15638  */
  15639 int 
  15640 bcm_esw_field_stat_config_get(int unit, int stat_id, int nstat, 
  15641                               bcm_field_stat_t *stat_arr)
  15642 {
  15643     _field_stat_t       *f_st;     /* Field statistics entity.   */
  15644     int                 stat_count;/* Number of elements to fill.*/
  15645     int                 rv;        /* Operation return status.   */
  15646 
  15647     /* Input parameters check. */
  15648     if ((NULL == stat_arr) || (nstat <= 0) || (nstat > _bcmFieldStatCount)) {
  15649         return (BCM_E_PARAM);
  15650     }
  15651 
  15652     /* Get field control structure. */
  15653     
  15654     FP_LOCK(unit);
  15655 
  15656     rv = _bcm_field_stat_get(unit, stat_id, &f_st);
  15657     if (BCM_FAILURE(rv)) {
  15658         FP_UNLOCK(unit);
  15659         return (rv);
  15660     }
  15661 
  15662 
  15663     /* Initialize application provided array. */
  15664     sal_memset(stat_arr, 0, (nstat * sizeof(bcm_field_stat_t)));
  15665 
  15666     /* Number of items to copy. */
  15667     stat_count = (nstat > f_st->nstat) ? f_st->nstat : nstat;
  15668 
  15669     sal_memcpy(stat_arr, f_st->stat_arr, 
  15670                (stat_count * sizeof(bcm_field_stat_t)));
  15671 
  15672     FP_UNLOCK(unit);
  15673     return (rv);
  15674 }
  15675 
  15676 /*
  15677  * Function: 
  15678  *      bcm_esw_field_stat_set
  15679  *
  15680  * Description:
  15681  *      Set 64 bit counter value for specific statistic type.
  15682  * Parameters:
  15683  *      unit      - (IN) BCM device number.
  15684  *      stat_id   - (IN) Statistics entity id.
  15685  *      stat      - (IN) Collected statistics descriptor.
  15686  *      value     - (OUT) Collected counters value.
  15687  * Returns:
  15688  *      BCM_E_XXX
  15689  */
  15690 int 
  15691 bcm_esw_field_stat_set(int unit, int stat_id, bcm_field_stat_t stat, 
  15692                        uint64 value)
  15693 {
  15694     _field_stat_t       *f_st;     /* Field statistics entity.   */
  15695     int                 rv;        /* Operation return status.   */
  15696 
  15697     /* Get field control structure. */
  15698     
  15699     FP_LOCK(unit);
  15700 
  15701     /* Get statistics entity descriptor. */
  15702     rv = _bcm_field_stat_get(unit, stat_id, &f_st);
  15703     if (BCM_FAILURE(rv)) {
  15704         FP_UNLOCK(unit);
  15705         return (rv);
  15706     }
  15707 
  15708     /* Write specific counter only if statistics entity was installed. */
  15709     if (_FP_INVALID_INDEX == f_st->hw_index) {
  15710         if (COMPILER_64_IS_ZERO(value)) {
  15711             rv = BCM_E_NONE;
  15712         } else {
  15713             rv = BCM_E_UNAVAIL;
  15714         }
  15715     } else {
  15716         rv = _field_stat_value_set(unit, f_st, stat, value);
  15717     }
  15718 
  15719     FP_UNLOCK(unit);
  15720     return (rv);
  15721 }
  15722 
  15723 /*
  15724  * Function: 
  15725  *      bcm_esw_field_stat_set32
  15726  *
  15727  * Description:
  15728  *      Set lower 32 bit counter value for specific statistic type.
  15729  * Parameters:
  15730  *      unit      - (IN) BCM device number.
  15731  *      stat_id   - (IN) Statistics entity id.
  15732  *      stat      - (IN) Collected statistics descriptor.
  15733  *      value     - (OUT) Collected counters value.
  15734  * Returns:
  15735  *      BCM_E_XXX
  15736  */
  15737 int 
  15738 bcm_esw_field_stat_set32(int unit, int stat_id, 
  15739                          bcm_field_stat_t stat, uint32 value)
  15740 {
  15741     uint64 val64;
  15742 
  15743     COMPILER_64_SET(val64, 0, value);
  15744     return bcm_esw_field_stat_set (unit, stat_id, stat, val64);
  15745 }
  15746 
  15747 /*
  15748  * Function: 
  15749  *      bcm_esw_field_stat_all_set
  15750  *
  15751  * Description:
  15752  *      Set 64 bit counter values for all statistic types.
  15753  * Parameters:
  15754  *      unit      - (IN) BCM device number.
  15755  *      stat_id   - (IN) Statistics entity id.
  15756  *      nstat     - (IN) Number of elements in stat array.
  15757  *      stat_arr  - (IN) Collected statistics descriptors array.
  15758  *      value_arr - (OUT) Collected counters values.
  15759  * Returns:
  15760  *      BCM_E_XXX
  15761  */
  15762 int 
  15763 bcm_esw_field_stat_all_set(int unit, int stat_id, uint64 value)
  15764 {
  15765     _field_stat_t       *f_st;     /* Field statistics entity.    */
  15766     int                 idx;       /* Statistics iteration index. */
  15767     int                 rv;        /* Operation return status.    */
  15768 
  15769     /* Get field control structure. */
  15770     
  15771     FP_LOCK(unit);
  15772 
  15773     rv = _bcm_field_stat_get(unit, stat_id, &f_st);
  15774     if (BCM_FAILURE(rv)) {
  15775         FP_UNLOCK(unit);
  15776         return (rv);
  15777     }
  15778 
  15779     /* Read individual statistics. */
  15780     for (idx = 0; idx < f_st->nstat; idx++) {
  15781         rv = bcm_esw_field_stat_set(unit, stat_id, f_st->stat_arr[idx], value);
  15782         if (BCM_FAILURE(rv)) {
  15783             FP_UNLOCK(unit);
  15784             return (rv);
  15785         }
  15786     }
  15787 
  15788     FP_UNLOCK(unit);
  15789     return (rv);
  15790 }
  15791 
  15792 /*
  15793  * Function: 
  15794  *      bcm_esw_field_stat_all_set32
  15795  *
  15796  * Description:
  15797  *      Set 64 bit counter values for all statistic types.
  15798  * Parameters:
  15799  *      unit      - (IN) BCM device number.
  15800  *      stat_id   - (IN) Statistics entity id.
  15801  *      nstat     - (IN) Number of elements in stat array.
  15802  *      stat_arr  - (IN) Collected statistics descriptors array.
  15803  *      value_arr - (OUT) Collected counters values.
  15804  * Returns:
  15805  *      BCM_E_XXX
  15806  */
  15807 int 
  15808 bcm_esw_field_stat_all_set32(int unit, int stat_id, uint32 value)
  15809 {
  15810     uint64              val64;     /* 64 bit value. */
  15811 
  15812     COMPILER_64_SET(val64, 0, value);
  15813     return bcm_esw_field_stat_all_set(unit, stat_id, val64);
  15814 }
  15815 
  15816 
  15817 /*
  15818  * Function: 
  15819  *      _bcm_esw_field_stat_get
  15820  *
  15821  * Description:
  15822  *      Get 64 bit counter value for specific statistic type.
  15823  * Parameters:
  15824  *      unit      - (IN) BCM device number.
  15825  *      stat_id   - (IN) Statistics entity id.
  15826  *      stat      - (IN) Collected statistics descriptor.
  15827  *      value     - (OUT) Collected counters value.
  15828  * Returns:
  15829  *      BCM_E_XXX
  15830  */
  15831 int
  15832 bcm_esw_field_stat_get(int unit, int stat_id, bcm_field_stat_t stat,
  15833                         uint64 *value)
  15834 {
  15835     return _bcm_esw_field_stat_get(unit, 0, stat_id, stat, value);
  15836 
  15837 }
  15838 
  15839 
  15840 /*
  15841  * Function: 
  15842  *      bcm_esw_field_stat_sync_get
  15843  *
  15844  * Description:
  15845  *      Get 64 bit counter value for specific statistic type.
  15846  *      sw accumulated counters synced with hw count.
  15847  * Parameters:
  15848  *      unit      - (IN) BCM device number.
  15849  *      stat_id   - (IN) Statistics entity id.
  15850  *      stat      - (IN) Collected statistics descriptor.
  15851  *      value     - (OUT) Collected counters value.
  15852  * Returns:
  15853  *      BCM_E_XXX
  15854  */
  15855 int
  15856 bcm_esw_field_stat_sync_get(int unit, int stat_id, bcm_field_stat_t stat,
  15857                         uint64 *value)
  15858 {
  15859 
  15860     return _bcm_esw_field_stat_get(unit, 1, stat_id, stat, value);
  15861 
  15862 }
  15863 
  15864 /*
  15865  * Function: 
  15866  *      bcm_esw_field_stat_get32
  15867  *
  15868  * Description:
  15869  *      Get lower 32 bit counter value for specific statistic type.
  15870  * Parameters:
  15871  *      unit      - (IN) BCM device number.
  15872  *      stat_id   - (IN) Statistics entity id.
  15873  *      stat      - (IN) Collected statistics descriptor.
  15874  *      value     - (OUT) Collected counters value.
  15875  * Returns:
  15876  *      BCM_E_XXX
  15877  */
  15878 int 
  15879 bcm_esw_field_stat_get32(int unit, int stat_id, 
  15880                          bcm_field_stat_t stat, uint32 *value)
  15881 {
  15882     uint64 val64;            /* 64 bit counter value.    */
  15883     int rv;                  /* Operation return status. */
  15884 
  15885     /* Input parameters check. */
  15886     if (NULL == value) {
  15887         return (BCM_E_PARAM);
  15888     }
  15889 
  15890     /* Read 64 bit counter value. */
  15891     rv = bcm_esw_field_stat_get (unit, stat_id, stat, &val64);
  15892     if (BCM_SUCCESS(rv)) {
  15893         *value = COMPILER_64_LO(val64);
  15894     } 
  15895     return rv;
  15896 }
  15897 
  15898 /*
  15899  * Function: 
  15900  *      bcm_esw_field_stat_sync_get32
  15901  *
  15902  * Description:
  15903  *      Get lower 32 bit counter value for specific statistic type.
  15904  *      sw accumulated counters synced with hw count.
  15905  * Parameters:
  15906  *      unit      - (IN) BCM device number.
  15907  *      stat_id   - (IN) Statistics entity id.
  15908  *      stat      - (IN) Collected statistics descriptor.
  15909  *      value     - (OUT) Collected counters value.
  15910  * Returns:
  15911  *      BCM_E_XXX
  15912  */
  15913 int
  15914 bcm_esw_field_stat_sync_get32(int unit, int stat_id, bcm_field_stat_t stat,
  15915                         uint32 *value)
  15916 {
  15917 
  15918     return _bcm_esw_field_stat_get32(unit, 1, stat_id, stat, value);
  15919 
  15920 }
  15921 
  15922 /*
  15923  * Function: 
  15924  *      bcm_esw_field_stat_multi_get
  15925  *
  15926  * Description:
  15927  *      Get 64 bit counter values for multiple statistic types.
  15928  * Parameters:
  15929  *      unit      - (IN) BCM device number.
  15930  *      stat_id   - (IN) Statistics entity id.
  15931  *      nstat     - (IN) Number of elements in stat array.
  15932  *      stat_arr  - (IN) Collected statistics descriptors array.
  15933  *      value_arr - (OUT) Collected counters values.
  15934  * Returns:
  15935  *      BCM_E_XXX
  15936  */
  15937 int 
  15938 bcm_esw_field_stat_multi_get(int unit, int stat_id, int nstat, 
  15939                              bcm_field_stat_t *stat_arr, uint64 *value_arr)
  15940 {
  15941     int                 rv;        /* Operation return status.    */
  15942     int                 idx;       /* Statistics iteration index. */
  15943 
  15944     /* Input parameters check. */
  15945     for (idx = 0; idx < nstat; idx++) {
  15946         if ((NULL == stat_arr + idx) ||
  15947             (NULL == value_arr + idx)) {
  15948        /* 
  15949         * COVERITY 
  15950         * 
  15951         * This conditin may not hit.
  15952         * It is kept intentionally as a defensive check. 
  15953         */
  15954         /* coverity[dead_error_line] */
  15955             return (BCM_E_PARAM);
  15956         }
  15957     }
  15958 
  15959     /* Get field control structure. */
  15960     
  15961     FP_LOCK(unit);
  15962 
  15963     /* Read individual statistics. */
  15964     for (idx = 0; idx < nstat; idx++) {
  15965         rv = bcm_esw_field_stat_get(unit, stat_id, stat_arr[idx], 
  15966                                     value_arr + idx);
  15967         if (BCM_FAILURE(rv)) {
  15968             FP_UNLOCK(unit);
  15969             return (rv);
  15970         }
  15971     }
  15972 
  15973     FP_UNLOCK(unit);
  15974     return (BCM_E_NONE);
  15975 }
  15976 
  15977 /*
  15978  * Function: 
  15979  *      bcm_esw_field_stat_multi_get32
  15980  *
  15981  * Description:
  15982  *      Get lower 32 bit counter values for multiple statistic types.
  15983  * Parameters:
  15984  *      unit      - (IN) BCM device number.
  15985  *      stat_id   - (IN) Statistics entity id.
  15986  *      nstat     - (IN) Number of elements in stat array.
  15987  *      stat_arr  - (IN) Collected statistics descriptors array.
  15988  *      value_arr - (OUT) Collected counters values.
  15989  * Returns:
  15990  *      BCM_E_XXX
  15991  */
  15992 int 
  15993 bcm_esw_field_stat_multi_get32(int unit, int stat_id, int nstat, 
  15994                                bcm_field_stat_t *stat_arr, 
  15995                                uint32 *value_arr)
  15996 {
  15997     uint64              value;     /* 64 bit counter value.       */
  15998     int                 rv;        /* Operation return status.    */
  15999     int                 idx;       /* Statistics iteration index. */
  16000 
  16001     /* Input parameters check. */
  16002     for (idx = 0; idx < nstat; idx++) {
  16003         if ((NULL == stat_arr + idx) ||
  16004             (NULL == value_arr + idx)) {
  16005        /* 
  16006         * COVERITY 
  16007         * 
  16008         * This conditin may not hit.
  16009         * It is kept intentionally as a defensive check. 
  16010         */
  16011         /* coverity[dead_error_line] */
  16012             return (BCM_E_PARAM);
  16013         }
  16014     }
  16015 
  16016     /* Get field control structure. */
  16017     
  16018     FP_LOCK(unit);
  16019 
  16020     /* Read individual statistics. */
  16021     for (idx = 0; idx < nstat; idx++) {
  16022         rv = bcm_esw_field_stat_get(unit, stat_id, stat_arr[idx], &value);
  16023         if (BCM_FAILURE(rv)) {
  16024             FP_UNLOCK(unit);
  16025             return (rv);
  16026         }
  16027         value_arr[idx] = COMPILER_64_LO(value);
  16028     }
  16029 
  16030     FP_UNLOCK(unit);
  16031     return (BCM_E_NONE);
  16032 }
  16033 
  16034 /*
  16035  * Function: 
  16036  *      bcm_esw_field_entry_stat_attach
  16037  *
  16038  * Description:
  16039  *       Attach statistics entity to Field Processor entry.
  16040  * Parameters:
  16041  *      unit      - (IN) BCM device number.
  16042  *      entry     - (IN) Field entry id. 
  16043  *      stat_id   - (IN) Statistics entity id.
  16044  * Returns:
  16045  *      BCM_E_XXX
  16046  */
  16047 int 
  16048 bcm_esw_field_entry_stat_attach(int unit, bcm_field_entry_t entry, 
  16049                                 int stat_id)
  16050 {
  16051     _field_entry_t      *f_ent;   /* Internal entry descriptor.       */
  16052     _field_control_t    *fc;      /* Field control structure.  */
  16053     int                  rv;      /* Operation return status.  */
  16054 #if defined(BCM_TOMAHAWK_SUPPORT)
  16055     int action_size = 0;          /* Field Action Size.        */
  16056 #endif 
  16057 
  16058     /* Get field control structure. */
  16059     
  16060     FP_LOCK(unit);
  16061     rv = _field_control_get(unit, &fc);
  16062     if (BCM_FAILURE(rv)) {
  16063         FP_UNLOCK(unit);
  16064         return rv;
  16065     }
  16066 
  16067     /* Get entry description structure. */
  16068     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  16069     if (BCM_FAILURE(rv)) {
  16070         FP_UNLOCK(unit);
  16071         return (rv);
  16072     }
  16073 
  16074 #if defined(BCM_TOMAHAWK_SUPPORT)
  16075     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  16076               (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS)) {
  16077         FP_UNLOCK(unit);
  16078         return (BCM_E_UNAVAIL);
  16079     }
  16080 
  16081     if (f_ent->flags & _FP_ENTRY_EXACT_MATCH_GROUP_DEFAULT) {
  16082         rv = _field_th_em_entry_action_size_get(unit, f_ent,
  16083                                                 &action_size, NULL);
  16084         if (BCM_FAILURE(rv)) {
  16085             FP_UNLOCK(unit);
  16086             return (rv);
  16087         }
  16088         
  16089         if (action_size > EM_DEFAULT_POLICY_ACTION_DATA_SIZE) {
  16090             FP_UNLOCK(unit);
  16091             return (BCM_E_RESOURCE);
  16092         }
  16093     }
  16094 #endif /* BCM_TOMAHAWK_SUPPORT */
  16095 
  16096     /* Attach statistics entity to the entry. */
  16097     rv = _field_entry_stat_attach(unit, f_ent, stat_id);
  16098     FP_UNLOCK(unit);
  16099     return (rv);
  16100 }
  16101 
  16102 /*
  16103  * Function:
  16104  *      bcm_esw_field_entry_stat_extended_attach
  16105  *
  16106  * Description:
  16107  *       Attach statistics with stat action entity to Field Processor entry.
  16108  * Parameters:
  16109  *      unit        - (IN) BCM device number.
  16110  *      entry       - (IN) Field entry id.
  16111  *      stat_id     - (IN) Statistics entity id.
  16112  *      stat_action - (IN) Statistics Action. 
  16113  *                         Applicable stat actions are
  16114  *                         bcmFieldStatActionIncrement
  16115  *                         bcmFieldStatActionIncrementCancel
  16116  *                         bcmFieldStatActionSample
  16117  * Returns:
  16118  *      BCM_E_XXX
  16119  */
  16120 int bcm_esw_field_entry_stat_extended_attach(int unit,
  16121                                            bcm_field_entry_t entry,
  16122                                            int stat_id,
  16123                                            bcm_field_stat_action_t stat_action) 
  16124 {
  16125     int                  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  16126 #if defined (BCM_TRIDENT2PLUS_SUPPORT) || defined (BCM_TRIDENT3_SUPPORT) || \
  16127     defined (BCM_KATANA2_SUPPORT)
  16128     _field_entry_t      *f_ent = NULL;       /* Internal entry descriptor.*/
  16129 
  16130     if (!soc_feature(unit, soc_feature_advanced_flex_counter)) {
  16131         return rv;
  16132     }
  16133 
  16134     if (SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit) ||
  16135             soc_feature(unit, soc_feature_td3_style_fp) ||
  16136              (soc_feature(unit,soc_feature_flex_stat_compaction_support))) {
  16137         /* Get field control structure. */
  16138 
  16139         FP_LOCK(unit);
  16140 
  16141         /* Get entry description structure. */
  16142         rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  16143         if (BCM_FAILURE(rv)) {
  16144             FP_UNLOCK(unit);
  16145             return (rv);
  16146         }
  16147 
  16148 #if defined (BCM_TRIDENT2PLUS_SUPPORT) || defined (BCM_TRIDENT3_SUPPORT)
  16149         /* Attach statistics with action entity to the entry. */
  16150         if (SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit) ||
  16151                 soc_feature(unit, soc_feature_td3_style_fp)) {
  16152             rv = _bcm_field_td2plus_entry_stat_extended_attach (unit, f_ent,
  16153                     stat_id, stat_action);
  16154         } else
  16155 #endif
  16156         {
  16157 #if defined (BCM_KATANA2_SUPPORT)
  16158             if (soc_feature(unit,soc_feature_flex_stat_compaction_support)) {
  16159                 rv = _bcm_field_kt2_entry_stat_extended_attach (unit, f_ent,
  16160                         stat_id, stat_action);
  16161             }
  16162 #endif
  16163         }
  16164         FP_UNLOCK(unit);
  16165     }
  16166 #endif /* BCM_TRIDENT2PLUS_SUPPORT */
  16167 
  16168     return (rv);
  16169 }
  16170 
  16171 /*
  16172  * Function: 
  16173  *      bcm_esw_field_entry_stat_detach
  16174  *
  16175  * Description:
  16176  *       Detach statistics entity to Field Processor entry.
  16177  * Parameters:
  16178  *      unit      - (IN) BCM device number.
  16179  *      entry     - (IN) Field entry id. 
  16180  *      stat_id   - (IN) Statistics entity id.
  16181  * Returns:
  16182  *      BCM_E_XXX
  16183  */
  16184 int 
  16185 bcm_esw_field_entry_stat_detach(int unit, bcm_field_entry_t entry,
  16186                                 int stat_id)
  16187 {
  16188     _field_entry_t      *f_ent;   /* Field entry structure.    */
  16189     _field_control_t    *fc;      /* Field control structure.  */
  16190     int                  rv;      /* Operation return status.  */
  16191 
  16192     /* Get field control structure. */
  16193     FP_LOCK(unit);
  16194     rv = _field_control_get(unit, &fc);
  16195     if (BCM_FAILURE(rv)) {
  16196         FP_UNLOCK(unit);
  16197         return rv;
  16198     }
  16199 
  16200     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  16201     if (BCM_FAILURE(rv)) {
  16202         FP_UNLOCK(unit);
  16203         return (rv);
  16204     }
  16205 #if defined(BCM_TOMAHAWK_SUPPORT)
  16206     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  16207         (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS)) {
  16208         FP_UNLOCK(unit);
  16209         return (BCM_E_UNAVAIL);
  16210     }
  16211 #endif /* BCM_TOMAHAWK_SUPPORT */
  16212 
  16213     rv =  fc->functions.fp_entry_stat_detach(unit, f_ent, stat_id);
  16214 
  16215     FP_UNLOCK(unit);
  16216     return (rv);
  16217 }
  16218 
  16219 /*
  16220  * Function: 
  16221  *      bcm_esw_field_entry_stat_get
  16222  *
  16223  * Description:
  16224  *      Get statistics entity attached to Field Processor entry.  
  16225  * Parameters:
  16226  *      unit      - (IN) BCM device number.
  16227  *      entry     - (IN) Field entry id. 
  16228  *      stat_id   - (IN) Statistics entity id.
  16229  * Returns:
  16230  *      BCM_E_XXX
  16231  */
  16232 int 
  16233 bcm_esw_field_entry_stat_get(int unit, bcm_field_entry_t entry, int *stat_id)
  16234 {
  16235     _field_entry_t      *f_ent;    /* Field entry structure.     */
  16236     int                 rv;        /* Operation return status.   */
  16237 
  16238     /* Input parameters check. */
  16239     if (NULL == stat_id) {
  16240         return (BCM_E_PARAM);
  16241     }
  16242 
  16243     /* Get field control structure. */
  16244     
  16245     FP_LOCK(unit);
  16246 
  16247     /* Get field processor entry structure. */
  16248     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  16249     if (BCM_FAILURE(rv)) {
  16250         FP_UNLOCK(unit);
  16251         return (rv);
  16252     }
  16253 #if defined(BCM_TOMAHAWK_SUPPORT)
  16254     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  16255         (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS)) {
  16256         FP_UNLOCK(unit);
  16257         return (BCM_E_UNAVAIL);
  16258     }
  16259 #endif /* BCM_TOMAHAWK_SUPPORT */
  16260 
  16261 #if defined(BCM_FLOWTRACKER_SUPPORT)
  16262     if (soc_feature(unit, soc_feature_field_flowtracker_support) &&
  16263         (f_ent->group->stage_id == _BCM_FIELD_STAGE_FLOWTRACKER)) {
  16264         FP_UNLOCK(unit);
  16265         return (BCM_E_UNAVAIL);
  16266     }
  16267 #endif
  16268     if (f_ent->statistic.flags & _FP_ENTRY_STAT_VALID) {
  16269         *stat_id = f_ent->statistic.sid; 
  16270     } else {
  16271         rv = BCM_E_NOT_FOUND;
  16272     }
  16273 
  16274     FP_UNLOCK(unit);
  16275     return (rv);
  16276 }
  16277 
  16278 /*
  16279  * Function:
  16280  *      bcm_esw_field_entry_stat_extended_get
  16281  *
  16282  * Description:
  16283  *      Get statistics with stat action entity attached
  16284  *      to Field Processor entry.
  16285  * Parameters:
  16286  *      unit      - (IN) BCM device number.
  16287  *      entry     - (IN) Field entry id.
  16288  *      stat_id   - (IN) Statistics entity id.
  16289  *      stat_action - (IN) Statistics Action.
  16290  * Returns:
  16291  *      BCM_E_XXX
  16292  */
  16293 int bcm_esw_field_entry_stat_extended_get(int unit,
  16294                                           bcm_field_entry_t entry,
  16295                                           int *stat_id,
  16296                                           bcm_field_stat_action_t *stat_action)
  16297 {
  16298     int                 rv = BCM_E_UNAVAIL; /* Operation return status.   */
  16299 #if defined (BCM_TRIDENT2PLUS_SUPPORT) || defined (BCM_KATANA2_SUPPORT)
  16300     _field_entry_t      *f_ent = NULL;      /* Field entry structure.     */
  16301 
  16302     if (!soc_feature(unit, soc_feature_advanced_flex_counter)) {
  16303         return rv;
  16304     }
  16305 
  16306     if (SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit) ||
  16307             soc_feature(unit, soc_feature_td3_style_fp) ||
  16308              (soc_feature(unit,soc_feature_flex_stat_compaction_support))) {
  16309         /* Input parameters check. */
  16310         if ((NULL == stat_id) || (stat_action == NULL)) {
  16311             return (BCM_E_PARAM);
  16312         }
  16313 
  16314         /* Get field control structure. */
  16315 
  16316         FP_LOCK(unit);
  16317 
  16318         /* Get field processor entry structure. */
  16319         rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  16320         if (BCM_FAILURE(rv)) {
  16321             FP_UNLOCK(unit);
  16322             return (rv);
  16323         }
  16324 
  16325 #if defined (BCM_TRIDENT2PLUS_SUPPORT)
  16326         if (SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit) ||
  16327                 soc_feature(unit, soc_feature_td3_style_fp)) {
  16328             rv = _bcm_field_td2plus_entry_stat_extended_get (unit, f_ent,
  16329                     stat_id, stat_action);
  16330         } else
  16331 #endif
  16332         {
  16333 #if defined (BCM_KATANA2_SUPPORT)
  16334             rv = _bcm_field_kt2_entry_stat_extended_get (unit, f_ent,
  16335                     stat_id, stat_action);
  16336 #endif
  16337         }
  16338         FP_UNLOCK(unit);
  16339     }
  16340 #endif /* BCM_TRIDENT2PLUS_SUPPORT */
  16341     return (rv);
  16342 }
  16343 
  16344 /*
  16345  * Function:
  16346  *      bcm_esw_field_oam_stat_action_add
  16347  * Description:
  16348  *      Add Oam Stat action to Field Processor entry.
  16349  * Parameters:
  16350  *      unit            - (IN) BCM device number.
  16351  *      entry           - (IN) Field entry id.
  16352  *      oam_stat_action - (IN) Oam Stat Action Structure.
  16353  *                             Applicable stat actions are
  16354  *                             bcmFieldStatActionNone
  16355  *                             bcmFieldStatActionIncrementCancel
  16356  *                             bcmFieldStatActionSample
  16357  * Returns:
  16358  *      BCM_E_XXX
  16359  */
  16360 int bcm_esw_field_oam_stat_action_add(
  16361     int unit,
  16362     bcm_field_entry_t entry,
  16363     bcm_field_oam_stat_action_t *oam_stat_action)
  16364 {
  16365     int rv =  BCM_E_UNAVAIL;
  16366     if (!soc_feature(unit, soc_feature_advanced_flex_counter)) {
  16367         return rv;
  16368     }
  16369     if (oam_stat_action == NULL) {
  16370         return BCM_E_PARAM;
  16371     }
  16372 
  16373     if (!soc_feature(unit, soc_feature_advanced_flex_counter)) {
  16374         return rv;
  16375     }
  16376     
  16377     FP_LOCK(unit);
  16378 
  16379 #if defined BCM_TRIDENT2PLUS_SUPPORT
  16380     if (soc_feature(unit, soc_feature_fp_based_oam)) {
  16381         rv = _bcm_field_oam_stat_action_add (unit, entry, oam_stat_action);
  16382     }
  16383 #endif /* BCM_TRIDENT2PLUS_SUPPORT */
  16384 
  16385     FP_UNLOCK(unit);
  16386     return (rv);
  16387 }
  16388 
  16389 /*
  16390  * Function:
  16391  *      bcm_esw_field_oam_stat_action_delete
  16392  * Description:
  16393  *      Delete Oam Stat action from Field Processor entry.
  16394  * Parameters:
  16395  *      unit            - (IN) BCM device number.
  16396  *      entry           - (IN) Field entry id.
  16397  *      oam_stat_action - (IN) Oam Stat Action Structure.
  16398  * Returns:
  16399  *      BCM_E_XXX
  16400  */
  16401 int bcm_esw_field_oam_stat_action_delete(
  16402     int unit,
  16403     bcm_field_entry_t entry,
  16404     bcm_field_oam_stat_action_t *oam_stat_action)
  16405 {
  16406     int rv =  BCM_E_UNAVAIL;
  16407     if (!soc_feature(unit, soc_feature_advanced_flex_counter)) {
  16408         return rv;
  16409     }
  16410     if (oam_stat_action == NULL) {
  16411         return BCM_E_PARAM;
  16412     }
  16413 
  16414     if (!soc_feature(unit, soc_feature_advanced_flex_counter)) {
  16415         return rv;
  16416     }
  16417     
  16418     FP_LOCK(unit);
  16419 
  16420 #if defined BCM_TRIDENT2PLUS_SUPPORT
  16421     if (soc_feature(unit, soc_feature_fp_based_oam)) {
  16422         rv = _bcm_field_oam_stat_action_delete (unit, entry, oam_stat_action);
  16423     }
  16424 #endif /* BCM_TRIDENT2PLUS_SUPPORT */
  16425 
  16426     FP_UNLOCK(unit);
  16427     return (rv);
  16428 }
  16429 
  16430 /*
  16431  * Function:
  16432  *      bcm_esw_field_oam_stat_action_delete_all
  16433  * Description:
  16434  *     Remove all Oam Stat action from Field Processor entry.
  16435  * Parameters:
  16436  *      unit            - (IN) BCM device number.
  16437  *      entry           - (IN) Field entry id.
  16438  * Returns:
  16439  *      BCM_E_XXX
  16440  */
  16441 int bcm_esw_field_oam_stat_action_delete_all(
  16442     int unit,
  16443     bcm_field_entry_t entry)
  16444 {
  16445     int rv =  BCM_E_UNAVAIL;
  16446 
  16447     if (!soc_feature(unit, soc_feature_advanced_flex_counter)) {
  16448         return rv;
  16449     }
  16450     
  16451     FP_LOCK(unit);
  16452 
  16453 #if defined BCM_TRIDENT2PLUS_SUPPORT
  16454     if (soc_feature(unit, soc_feature_fp_based_oam)) {
  16455         rv = _bcm_field_oam_stat_action_delete_all (unit, entry);
  16456     }
  16457 #endif /* BCM_TRIDENT2PLUS_SUPPORT */
  16458 
  16459     FP_UNLOCK(unit);
  16460     return (rv);
  16461 }
  16462 
  16463 /*
  16464  * Function:
  16465  *      bcm_esw_field_oam_stat_action_get
  16466  * Description:
  16467  *     Get Oam Stat action from Field Processor entry.
  16468  * Parameters:
  16469  *      unit            - (IN) BCM device number.
  16470  *      entry           - (IN) Field entry id.
  16471  *      oam_stat_action - (INOUT) Oam Stat Action Structure.
  16472  * Returns:
  16473  *      BCM_E_XXX
  16474  */
  16475 int bcm_esw_field_oam_stat_action_get(
  16476     int unit,
  16477     bcm_field_entry_t entry,
  16478     bcm_field_oam_stat_action_t *oam_stat_action)
  16479 {
  16480     int rv =  BCM_E_UNAVAIL;
  16481 
  16482     if (oam_stat_action == NULL) {
  16483         return BCM_E_PARAM;
  16484     }
  16485 
  16486     if (!soc_feature(unit, soc_feature_advanced_flex_counter)) {
  16487         return rv;
  16488     }
  16489     
  16490     FP_LOCK(unit);
  16491 
  16492 #if defined BCM_TRIDENT2PLUS_SUPPORT
  16493     if (soc_feature(unit, soc_feature_fp_based_oam)) {
  16494         rv = _bcm_field_oam_stat_action_get (unit, entry, oam_stat_action);
  16495     }
  16496 #endif /* BCM_TRIDENT2PLUS_SUPPORT */
  16497 
  16498     FP_UNLOCK(unit);
  16499     return (rv);
  16500 }
  16501 
  16502 /*
  16503  * Function:
  16504  *      bcm_esw_field_oam_stat_action_get_all
  16505  * Description:
  16506  *     Get all Oam Stat action from Field Processor entry.
  16507  * Parameters:
  16508  *      unit            - (IN) BCM device number.
  16509  *      entry           - (IN) Field entry id.
  16510  *      oam_stat_max    - (IN) Max number of Oam Stat actions.
  16511  *      oam_stat_action - (IN) Oam Stat Action Structure.
  16512  *      oam_stat_count  - (INOUT) Number of oam stats configured.
  16513  * Returns:
  16514  *      BCM_E_XXX
  16515  */
  16516 int bcm_esw_field_oam_stat_action_get_all(
  16517     int unit,
  16518     bcm_field_entry_t entry,
  16519     int oam_stat_max,
  16520     bcm_field_oam_stat_action_t *oam_stat_action,
  16521     int *oam_stat_count)
  16522 {
  16523     int rv =  BCM_E_UNAVAIL;
  16524 
  16525     if (!soc_feature(unit, soc_feature_advanced_flex_counter)) {
  16526         return rv;
  16527     }
  16528     
  16529     FP_LOCK(unit);
  16530 
  16531 #if defined BCM_TRIDENT2PLUS_SUPPORT
  16532     if (soc_feature(unit, soc_feature_fp_based_oam)) {
  16533         rv = _bcm_field_oam_stat_action_get_all (unit, entry, oam_stat_max,
  16534                 oam_stat_action, oam_stat_count);
  16535     }
  16536 #endif /* BCM_TRIDENT2PLUS_SUPPORT */
  16537 
  16538     FP_UNLOCK(unit);
  16539     return (rv);
  16540 }
  16541 
  16542 
  16543 /* Section Field Policers. */
  16544 /*
  16545  * Function:
  16546  *      bcm_esw_policer_init
  16547  * Purpose:
  16548  *      Initialize policer module.
  16549  * Parameters:
  16550  *      unit - (IN) Unit number.
  16551  * Returns:
  16552  *      BCM_E_XXX
  16553  * Notes:
  16554  */
  16555 int 
  16556 bcm_esw_policer_init(int unit)
  16557 {
  16558 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
  16559     defined(BCM_APACHE_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT)
  16560     if (SOC_IS_KATANAX(unit) || SOC_IS_TRIUMPH3(unit) ||
  16561         SOC_IS_APACHE(unit) || SOC_IS_GREYHOUND2(unit)) {
  16562         if (soc_feature(unit, soc_feature_global_meter)) {
  16563             return(bcm_esw_global_meter_init(unit));
  16564         }
  16565     } 
  16566 #endif
  16567     return (BCM_E_NONE);
  16568 }
  16569 /*
  16570  * Function:
  16571  *      bcm_policer_get
  16572  * Purpose:
  16573  *      Get the config settings for a policer entry.
  16574  * Parameters:
  16575  *      unit - (IN) Unit number.
  16576  *      policer_id - (IN) Policer ID.
  16577  *      pol_cfg - (OUT) Policer configuration.
  16578  * Returns:
  16579  *      BCM_E_XXX
  16580  * Notes:
  16581  */
  16582 int 
  16583 bcm_esw_policer_get(int unit, bcm_policer_t policer_id, 
  16584                     bcm_policer_config_t *pol_cfg)
  16585 {
  16586     _field_policer_t    *f_pl;   /* Internal policer descriptor. */
  16587     int                 rv;      /* Operation return status.     */
  16588     int is_global_policer;
  16589 
  16590     /* Input parameters check. */
  16591     if (NULL == pol_cfg) {
  16592         return (BCM_E_PARAM);
  16593     }
  16594 
  16595     BCM_IF_ERROR_RETURN(
  16596         _bcm_esw_is_global_policer(unit, policer_id, &is_global_policer));
  16597     if (TRUE == is_global_policer) {
  16598         rv = _bcm_esw_global_meter_policer_get(unit, policer_id, pol_cfg);
  16599         return (rv);
  16600     }
  16601 
  16602     FP_LOCK(unit);
  16603 
  16604     rv = _bcm_field_policer_get(unit, policer_id, &f_pl);
  16605     if (BCM_SUCCESS(rv)) {
  16606         sal_memcpy(pol_cfg, &f_pl->cfg, sizeof(bcm_policer_config_t));
  16607     }
  16608 
  16609     
  16610 
  16611     FP_UNLOCK(unit);
  16612     return (rv);
  16613 }
  16614 
  16615 /*
  16616  * Function:
  16617  *      bcm_policer_packet_counter_get32
  16618  * Purpose:
  16619  *      Get the packet count for a policer entry.
  16620  * Parameters:
  16621  *      unit - (IN) Unit number.
  16622  *      policer_id - (IN) Policer ID.
  16623  *      count - (OUT) Policer packet count
  16624  * Returns:
  16625  *      BCM_E_XXX
  16626  * Notes:
  16627  */
  16628 int
  16629 bcm_esw_policer_packet_counter_get32(int unit, bcm_policer_t policer_id,
  16630                     uint32 *count)
  16631 {
  16632     _field_control_t    *fc;     /* Field control structure.     */
  16633     _field_policer_t    *f_pl;   /* Internal policer descriptor. */
  16634     int                 rv = BCM_E_UNAVAIL;      /* Operation return status.     */
  16635 
  16636     /* Input parameters check. */
  16637     if (NULL == count) {
  16638         return (BCM_E_PARAM);
  16639     }
  16640 
  16641     
  16642     FP_LOCK(unit);
  16643     rv = _field_control_get(unit, &fc);
  16644     if (BCM_FAILURE(rv)) {
  16645         FP_UNLOCK(unit);
  16646         return rv;
  16647     }
  16648 
  16649     rv = _bcm_field_policer_get(unit, policer_id, &f_pl);
  16650     if (BCM_FAILURE(rv)) {
  16651         FP_UNLOCK(unit);
  16652         return (rv);
  16653     }
  16654 
  16655     rv = BCM_E_UNAVAIL;
  16656 
  16657     /* Read current policer counters from hw. */
  16658     if(fc->functions.fp_policer_packet_counter_get32) {
  16659         rv = fc->functions.fp_policer_packet_counter_get32(unit,
  16660                                                 f_pl, count);
  16661     }
  16662 
  16663     FP_UNLOCK(unit);
  16664     return (rv);
  16665 }
  16666 
  16667 /*
  16668  * Function:
  16669  *      bcm_policer_packet_reset_counter_get32
  16670  * Purpose:
  16671  *      Set the packet count for a policer entry.
  16672  * Parameters:
  16673  *      unit - (IN) Unit number.
  16674  *      policer_id - (IN) Policer ID.
  16675  *      count - (IN) Policer packet count
  16676  * Returns:
  16677  *      BCM_E_XXX
  16678  * Notes:
  16679  */
  16680 int
  16681 bcm_esw_policer_packet_reset_counter_get32(int unit, bcm_policer_t policer_id,
  16682                     uint32 *count)
  16683 {
  16684     _field_control_t    *fc;     /* Field control structure.     */
  16685     _field_policer_t    *f_pl;   /* Internal policer descriptor. */
  16686     int                 rv = BCM_E_UNAVAIL;      /* Operation return status.     */
  16687 
  16688 
  16689     FP_LOCK(unit);
  16690     rv = _field_control_get(unit, &fc);
  16691     if (BCM_FAILURE(rv)) {
  16692         FP_UNLOCK(unit);
  16693         return rv;
  16694     }
  16695 
  16696     rv = _bcm_field_policer_get(unit, policer_id, &f_pl);
  16697     if (BCM_FAILURE(rv)) {
  16698         FP_UNLOCK(unit);
  16699         return (rv);
  16700     }
  16701 
  16702     rv = BCM_E_UNAVAIL;
  16703 
  16704     /* Set current policer counters */
  16705     if(fc->functions.fp_policer_packet_reset_counter_get32) {
  16706         rv = fc->functions.fp_policer_packet_reset_counter_get32(unit,
  16707                                                   f_pl, count);
  16708     }
  16709 
  16710     FP_UNLOCK(unit);
  16711     return (rv);
  16712 }
  16713 
  16714 int _bcm_update_hw_meter_entry(int unit, _field_control_t *fc,
  16715                                 _field_policer_t *f_pl) {
  16716 
  16717     int            rv;      /* Operation return status.        */
  16718     _field_group_t *fg;     /* Field group info.               */
  16719     _field_entry_t *f_ent;  /* Internal entry descriptor.      */
  16720     _field_entry_policer_t *f_ent_pl;
  16721     int tmp = 0;            /* Temporary iterator.             */
  16722     int eid;                /* Entry ID.                       */
  16723     int idx;                /* Policers levels iterator.       */
  16724     int entry_found = 0;
  16725     /* Set policer "dirty" flags. */
  16726     rv = _field_policer_hw_flags_set(unit, f_pl, 0);
  16727     if (BCM_FAILURE(rv)) {
  16728         return (rv);
  16729     }
  16730 
  16731     if (_FP_POLICER_EXCESS_HW_METER(f_pl)) {
  16732         f_pl->hw_flags &= ~_FP_POLICER_COMMITTED_DIRTY;
  16733     } else if (_FP_POLICER_COMMITTED_HW_METER(f_pl)) {
  16734         f_pl->hw_flags &= ~_FP_POLICER_PEAK_DIRTY;
  16735     }
  16736 
  16737     /*
  16738      * get the entry for which this policer is attached
  16739      */
  16740     fg = fc->groups;
  16741     if (NULL == fg) {
  16742         return (BCM_E_INTERNAL);
  16743     }
  16744     /*
  16745     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
  16746     if (BCM_FAILURE(rv)) {
  16747         return (rv);
  16748     }    */
  16749     entry_found = 0;
  16750     for (fg = fc->groups; fg != NULL; fg = fg->next) {
  16751         tmp = 0;
  16752         /*
  16753          * Check for all entries where this entry was associated
  16754          */
  16755         while (tmp < fg->group_status.entry_count) {
  16756             eid = (fg->entry_arr[tmp])->eid;
  16757 
  16758             /* Get entry description structure. */
  16759             rv = _field_entry_get(unit, eid, _FP_ENTRY_PRIMARY, &f_ent);
  16760             if (BCM_FAILURE(rv)) {
  16761                  return (rv);
  16762             }
  16763 
  16764             for (idx = 0; idx < _FP_POLICER_LEVEL_COUNT; idx++) {
  16765                 f_ent_pl = f_ent->policer + idx;
  16766                 if (f_ent_pl->pid == f_pl->pid) {
  16767                     entry_found = 1;
  16768                     break;
  16769                 }
  16770             }
  16771             if (entry_found == 1) {
  16772                 break;
  16773             }
  16774             tmp++;
  16775         }
  16776         if (entry_found == 1) {
  16777             break;
  16778         }
  16779     }
  16780     if (entry_found) {
  16781         BCM_IF_ERROR_RETURN(fc->functions.fp_policer_install(unit, f_ent, f_pl));
  16782     } else {
  16783         return BCM_E_INTERNAL;
  16784     }
  16785     return BCM_E_NONE;
  16786 }
  16787 
  16788 /*
  16789  * Function:
  16790  *      bcm_esw_policer_set
  16791  * Purpose:
  16792  *      Set the config settings for a policer entry.
  16793  * Parameters:
  16794  *      unit - (IN) Unit number.
  16795  *      policer_id - (IN) Policer ID.
  16796  *      pol_cfg - (IN) Policer configuration.
  16797  * Returns:
  16798  *      BCM_E_XXX
  16799  * Notes:
  16800  */
  16801 int 
  16802 bcm_esw_policer_set(int unit, bcm_policer_t policer_id, 
  16803                     bcm_policer_config_t *pol_cfg)
  16804 {
  16805     _field_control_t    *fc;     /* Field control structure.        */
  16806     _field_policer_t    *f_pl;   /* Internal policer descriptor.    */
  16807     int                 rv;      /* Operation return status.        */
  16808     _field_group_t *fg;          /* Field group info.               */
  16809     _field_stage_t *stage_fc;    /* Stage field control info.       */
  16810     _field_entry_t *f_ent;       /* Internal entry descriptor.      */
  16811     _field_entry_policer_t *f_ent_pl;
  16812                                  /* Field entry policer structure.  */
  16813     int idx;                     /* Policers levels iterator.       */
  16814     int eid;                     /* Entry ID.                       */
  16815     int tmp = 0;                 /* Temporary iterator.             */
  16816     int is_global_policer;       /* globa meter policer ID Check.   */
  16817     int set_entry_flag;
  16818     /* Input parameters check. */
  16819     if (NULL == pol_cfg) {
  16820         return (BCM_E_PARAM);
  16821     }
  16822 
  16823     /* Reject unsupported flags */
  16824     if (pol_cfg->flags & BCM_POLICER_XGS_NOSUPPORT_FLAGS) {
  16825         return (BCM_E_PARAM);
  16826     }
  16827 
  16828     if (bcmPolicerModeCommitted == pol_cfg->mode
  16829         && (pol_cfg->pkbits_sec || pol_cfg->pkbits_burst)) {
  16830         return (BCM_E_PARAM);
  16831     }
  16832 
  16833     if (pol_cfg->flags & BCM_POLICER_MODE_PACKETS) {
  16834         if (!soc_feature(unit, soc_feature_field_packet_based_metering)) {
  16835             return (BCM_E_UNAVAIL);
  16836         }
  16837     }
  16838 
  16839     if ((pol_cfg->flags & BCM_POLICER_AS_PACKET_COUNTER) &&
  16840         (!SOC_IS_KATANA2(unit))) {
  16841             return (BCM_E_UNAVAIL);
  16842     }
  16843 
  16844     if ((pol_cfg->flags & BCM_POLICER_AS_PACKET_COUNTER) &&
  16845         (pol_cfg->flags & BCM_POLICER_MODE_BYTES)) {
  16846         return (BCM_E_PARAM);
  16847     }
  16848 
  16849     BCM_IF_ERROR_RETURN(
  16850         _bcm_esw_is_global_policer(unit, policer_id, &is_global_policer));
  16851     if (TRUE == is_global_policer) {
  16852         rv = _bcm_esw_global_meter_policer_set(unit, policer_id, pol_cfg);
  16853         return (rv);
  16854     }
  16855     
  16856     FP_LOCK(unit);
  16857     rv = _field_control_get(unit, &fc);
  16858     if (BCM_FAILURE(rv)) {
  16859         FP_UNLOCK(unit);
  16860         return rv;
  16861     }
  16862 
  16863     rv = _bcm_field_policer_get(unit, policer_id, &f_pl);
  16864     if (BCM_FAILURE(rv)) {
  16865         /* Policer does not exist. */
  16866         FP_UNLOCK(unit);
  16867         return (rv);
  16868     }
  16869 
  16870     set_entry_flag = 0;
  16871     /* if hardware index is null means thatthe policer is either
  16872      * not installed or is in modified state.
  16873      * check if old backup data of policer cfg exists and is same as
  16874      * newly provided policer config, then reset the policer cfg
  16875      * to old cfg
  16876      */
  16877     if (_FP_INVALID_INDEX == f_pl->hw_index) {
  16878         /* check if old cfg is same as data provided
  16879          * if same, then copy the old cfg to current config and reset the entry flag
  16880          * if not same, copy the given cfg to current cfg and set the entry flag
  16881          */
  16882         if ((sal_memcmp(&f_pl->old_cfg, pol_cfg,
  16883              sizeof(bcm_policer_config_t)) == 0)) {
  16884             /* copy the old cfg to given cfg and reset the entry flag*/
  16885             set_entry_flag = 0;
  16886             sal_memcpy(&f_pl->cfg, &f_pl->old_cfg,
  16887                        sizeof(bcm_policer_config_t));
  16888             f_pl->hw_flags = f_pl->old_hw_flags;
  16889             f_pl->old_hw_flags = 0;
  16890 #ifdef    BCM_TRIUMPH3_SUPPORT
  16891             f_pl->logical_pool_index = f_pl->old_logical_pool_index;
  16892             f_pl->old_logical_pool_index = _FP_INVALID_INDEX;
  16893 #endif
  16894             f_pl->old_mode = 0;
  16895             f_pl->pool_index = f_pl->old_pool_index;
  16896             f_pl->old_pool_index = _FP_INVALID_INDEX;
  16897             f_pl->level = f_pl->old_level;
  16898             f_pl->old_level = 0;
  16899             f_pl->hw_index = f_pl->old_hw_index;
  16900             f_pl->old_hw_index = _FP_INVALID_INDEX;
  16901             f_pl->sw_ref_count = f_pl->old_sw_ref_count;
  16902             f_pl->old_sw_ref_count = 0;
  16903             f_pl->hw_ref_count = f_pl->old_hw_ref_count;
  16904             f_pl->old_hw_ref_count = 0;
  16905             sal_memset(&f_pl->old_cfg, 0x00, sizeof(bcm_policer_config_t));
  16906 
  16907         } else {
  16908             /* copy the given cfg to current cfg and set the entry flag */
  16909             sal_memcpy(&f_pl->cfg, pol_cfg, sizeof(bcm_policer_config_t));
  16910             /* if policer is not installed, dont set the entry flag */
  16911             if ((f_pl->hw_flags & _FP_POLICER_DIRTY) != _FP_POLICER_DIRTY) {
  16912                 set_entry_flag = 1;
  16913             }
  16914             /*set the hw index to invalid so that it reallocates the meter*/
  16915             f_pl->hw_index = -1;
  16916         }
  16917     } else {
  16918         /*if the mode changes is usch that there is no change in meter entries
  16919          * then entry install or meter re-allocation is not required.
  16920          */
  16921         if ((_FP_POLICER_IS_FLOW_MODE(f_pl) &&
  16922             pol_cfg->mode == bcmPolicerModeCommitted) ||
  16923             ((!_FP_POLICER_IS_FLOW_MODE(f_pl)) &&
  16924             (pol_cfg->mode != bcmPolicerModeCommitted))) {
  16925             sal_memcpy(&f_pl->cfg, pol_cfg, sizeof(bcm_policer_config_t));
  16926             rv = _bcm_update_hw_meter_entry(unit, fc, f_pl);
  16927             FP_UNLOCK(unit);
  16928             return (rv);
  16929         }
  16930         set_entry_flag = 1;
  16931         f_pl->old_mode = f_pl->cfg.mode;
  16932         f_pl->old_hw_flags = f_pl->hw_flags;
  16933 #ifdef    BCM_TRIUMPH3_SUPPORT
  16934         f_pl->old_logical_pool_index = f_pl->logical_pool_index;
  16935 #endif
  16936         f_pl->old_pool_index = f_pl->pool_index;
  16937         f_pl->old_level = f_pl->level;
  16938         f_pl->old_hw_index = f_pl->hw_index;
  16939         f_pl->old_sw_ref_count = f_pl->sw_ref_count;
  16940         f_pl->old_hw_ref_count = f_pl->hw_ref_count;
  16941         sal_memcpy(&f_pl->old_cfg, &f_pl->cfg, sizeof(bcm_policer_config_t));
  16942         sal_memcpy(&f_pl->cfg, pol_cfg, sizeof(bcm_policer_config_t));
  16943         /*set the hw indes to invalid so that it reallocates the meter*/
  16944         f_pl->hw_index = -1;
  16945     }
  16946 
  16947 
  16948     /* Set policer "dirty" flags. */
  16949     rv = _field_policer_hw_flags_set(unit, f_pl, 0);
  16950     if (BCM_FAILURE(rv)) {
  16951         FP_UNLOCK(unit);
  16952         return (rv);
  16953     }
  16954 
  16955     if (_FP_INVALID_INDEX != f_pl->hw_index) {
  16956         if (_FP_POLICER_EXCESS_HW_METER(f_pl)) {
  16957             f_pl->hw_flags &= ~_FP_POLICER_COMMITTED_DIRTY;
  16958         } else if (_FP_POLICER_COMMITTED_HW_METER(f_pl)) {
  16959             f_pl->hw_flags &= ~_FP_POLICER_PEAK_DIRTY;
  16960         }
  16961     }
  16962 
  16963     /*
  16964      * Check if any entries has this policer attached and
  16965      * set the dirty flag for the entry
  16966      */
  16967     fg = fc->groups;
  16968     if (NULL == fg) {
  16969         FP_UNLOCK(unit);
  16970         return (BCM_E_NONE);
  16971     }
  16972 
  16973     rv = _field_stage_control_get(unit, fg->stage_id, &stage_fc);
  16974     if (BCM_FAILURE(rv)) {
  16975         FP_UNLOCK(unit);
  16976         return (rv);
  16977     }
  16978 
  16979     for (fg = fc->groups; fg != NULL; fg = fg->next) {
  16980         tmp = 0;
  16981         /*
  16982          * Check for all entries where this entry was associated
  16983          */
  16984         while (tmp < fg->group_status.entry_count) {
  16985             eid = (fg->entry_arr[tmp])->eid;
  16986 
  16987             /* Get entry description structure. */
  16988             rv = _field_entry_get(unit, eid, _FP_ENTRY_PRIMARY, &f_ent);
  16989             if (BCM_FAILURE(rv)) {
  16990                  FP_UNLOCK(unit);
  16991                  return (rv);
  16992             }
  16993             for (idx = 0; idx < _FP_POLICER_LEVEL_COUNT; idx++) {
  16994                 f_ent_pl = f_ent->policer + idx;
  16995                 if (f_ent_pl->pid == policer_id) {
  16996                     if (0 == (f_ent->flags & _FP_ENTRY_DIRTY)) {
  16997                         f_ent->flags |= _FP_ENTRY_POLICY_TABLE_ONLY_DIRTY;
  16998                     } 
  16999                     f_ent->flags |=  _FP_ENTRY_DIRTY;
  17000                     if (set_entry_flag) {
  17001                         f_ent->flags |=  _FP_ENTRY_METER_MODIFIED;
  17002                     } else {
  17003                         f_ent->flags &=  ~_FP_ENTRY_METER_MODIFIED;
  17004                     }
  17005                 }
  17006             }
  17007             tmp++;
  17008         }
  17009     }
  17010 
  17011     FP_UNLOCK(unit);
  17012     return (rv);
  17013 }
  17014 
  17015 /*
  17016  * Function:
  17017  *      bcm_field_entry_policer_attach
  17018  * Purpose:
  17019  *      Attach a policer to a field entry.
  17020  * Parameters:
  17021  *      unit       - (IN) Unit number.
  17022  *      entry_id   - (IN) Field entry ID.
  17023  *      level      - (IN) Policer level.
  17024  *      policer_id - (IN) Policer ID.
  17025  * Returns:
  17026  *      BCM_E_XXX
  17027  * Notes:
  17028  */
  17029 int 
  17030 bcm_esw_field_entry_policer_attach(int unit, bcm_field_entry_t entry_id, 
  17031                                    int level, bcm_policer_t policer_id)
  17032 {
  17033     _field_entry_policer_t *f_ent_pl; /* Field entry policer structure.*/
  17034     _field_policer_t       *f_pl;     /* Internal policer descriptor.  */
  17035     _field_entry_t         *f_ent;    /* Internal entry descriptor.    */
  17036     _field_stage_id_t      stage_id;  /* Pipeline stage id.            */
  17037     int                    idx;       /* Entry policers iterator.      */
  17038     int                    rv;        /* Operation return status.      */
  17039     _field_stage_t         *stage_fc; /* Field stage control structure.*/
  17040     _field_meter_pool_t    *f_mp;     /* Meter pool descriptor.        */
  17041     _field_control_t       *fc;       /* Field control structure.        */
  17042     _field_group_t         *group;    /* Field group structure         */
  17043     _field_slice_t         *slice;    /* Slice iteration count.        */
  17044 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
  17045     defined(BCM_APACHE_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT)
  17046     vfp_policy_table_entry_t vfp_entry;
  17047 #endif
  17048 #ifdef BCM_TOMAHAWK_SUPPORT
  17049     int action_size = 0;
  17050 #endif
  17051 
  17052     /* Input parameters check. */
  17053     if ((level >= _FP_POLICER_LEVEL_COUNT) || (level < 0)) {
  17054         return (BCM_E_PARAM);
  17055     }
  17056 
  17057     FP_LOCK(unit);
  17058     rv = _field_control_get(unit, &fc);
  17059     if (BCM_FAILURE(rv)) {
  17060         FP_UNLOCK(unit);
  17061         return rv;
  17062     }
  17063 
  17064     /* Get entry description structure. */
  17065     rv = _field_entry_get(unit, entry_id, _FP_ENTRY_PRIMARY, &f_ent);
  17066     if (BCM_FAILURE(rv)) {
  17067         FP_UNLOCK(unit);
  17068         return (rv);
  17069     }
  17070 
  17071     /* Get entry pipeline stage id. */
  17072     stage_id = f_ent->group->stage_id;
  17073 
  17074     if (!soc_feature(unit, soc_feature_field_egress_metering)) {
  17075         /*
  17076          * If Egress metering is not supported, then return
  17077          * UNAVAIL if the group is in egress mode
  17078          */
  17079         if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  17080             FP_UNLOCK(unit);
  17081             return BCM_E_UNAVAIL;
  17082         }
  17083     }
  17084 
  17085 #if defined(BCM_FLOWTRACKER_SUPPORT)
  17086     if (soc_feature(unit, soc_feature_field_flowtracker_support) &&
  17087         (f_ent->group->stage_id == _BCM_FIELD_STAGE_FLOWTRACKER)) {
  17088         FP_UNLOCK(unit);
  17089         return (BCM_E_UNAVAIL);
  17090     }
  17091 #endif
  17092 
  17093 #if defined(BCM_TOMAHAWK_SUPPORT)
  17094     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  17095         if (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS) {
  17096             FP_UNLOCK(unit);
  17097             return (BCM_E_UNAVAIL);
  17098         }
  17099         if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXACTMATCH) {
  17100             if (!(f_ent->flags & _FP_ENTRY_EXACT_MATCH_GROUP_DEFAULT)) {
  17101                 if (!(BCM_FIELD_ASET_TEST(f_ent->group->aset,
  17102                                           bcmFieldActionPolicerGroup))) {
  17103                     LOG_ERROR(BSL_LS_BCM_FP,
  17104                        (BSL_META_U(unit,
  17105                         "FP(unit %d) - Exact Match Entry"
  17106                         " Group %d created without action"
  17107                         " bcmFieldActionPolicerGroup.\n"),
  17108                           unit, f_ent->group->gid));
  17109                     FP_UNLOCK(unit);
  17110                     return (BCM_E_CONFIG);
  17111                 }
  17112             }
  17113         }
  17114     }
  17115 #endif /* BCM_TOMAHAWK_SUPPORT */
  17116 
  17117     /*
  17118      * if an entry's corresponding group is auto expanded, then
  17119      * then an entry cannot be attached if global pools is
  17120      * not supported on that stage
  17121      */
  17122     group = f_ent->group;
  17123     /* Get meter pool stage control. */
  17124     rv = _field_stage_control_get (unit, stage_id, &stage_fc);
  17125     if (BCM_FAILURE(rv)) {
  17126         FP_UNLOCK(unit);
  17127         return (rv);
  17128     }
  17129 
  17130     /* Donot attach the policers if _FP_STAGE_AUTOEXPAND_WITH_POLICER is
  17131      * enabled and group is egress and group is auto expanded */
  17132     if (!(stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS) &&
  17133          (group->flags & _FP_GROUP_SELECT_AUTO_EXPANSION)) {
  17134         slice = &group->slices[0];
  17135         if (!((fc->flags &_FP_AUTOEXPAND_WITH_POLICER) &&
  17136               (_BCM_FIELD_STAGE_EGRESS == group->stage_id))) {
  17137             if (slice->next != NULL) {
  17138                 FP_UNLOCK(unit);
  17139                 return BCM_E_CONFIG;
  17140             }
  17141         }
  17142     }
  17143 
  17144 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
  17145     defined(BCM_APACHE_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT)
  17146     if (SOC_IS_KATANAX(unit) || SOC_IS_TRIUMPH3(unit)
  17147         || SOC_IS_APACHE(unit) || SOC_IS_GREYHOUND2(unit)) {
  17148         if ((_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id)
  17149             || (SOC_IS_TRIUMPH3(unit)
  17150                 && (_BCM_FIELD_STAGE_EXTERNAL == f_ent->group->stage_id))) {
  17151             rv = _bcm_esw_add_policer_to_table(unit, policer_id,
  17152                                                VFP_POLICY_TABLEm, 0,
  17153                                                &vfp_entry);
  17154             if (BCM_FAILURE(rv)) {
  17155                 FP_UNLOCK(unit);
  17156                 return (rv);
  17157             }
  17158             if (f_ent->global_meter_policer.pid > 0) {
  17159                 _bcm_esw_policer_decrement_ref_count
  17160                     (unit, f_ent->global_meter_policer.pid);
  17161             }
  17162             f_ent->global_meter_policer.pid = policer_id;
  17163             f_ent->global_meter_policer.flags = level;
  17164             /* 
  17165              * If qualifiers have not been modified for this entry,
  17166              * set Policy table only dirty flag.
  17167              */
  17168             if (0 == (f_ent->flags & _FP_ENTRY_DIRTY)) {
  17169                 f_ent->flags |= _FP_ENTRY_POLICY_TABLE_ONLY_DIRTY;
  17170             }
  17171             /* Entry must be reinstalled for policer to take effect. */
  17172             f_ent->flags  |= _FP_ENTRY_DIRTY;
  17173             FP_UNLOCK(unit);
  17174             return (BCM_E_NONE);
  17175         }
  17176     }
  17177 #endif /* BCM_KATANA_SUPPORT || BCM_TRIUMPH3_SUPPORT ||
  17178           BCM_APACHE_SUPPORT || BCM_GREYHOUND2_SUPPORT */
  17179 #if defined(BCM_FIREBOLT2_SUPPORT) || defined(BCM_TRX_SUPPORT)
  17180     /* Make sure stage has meters. */ 
  17181     if (_BCM_FIELD_STAGE_LOOKUP == stage_id) {
  17182         FP_UNLOCK(unit);
  17183         return (BCM_E_UNAVAIL);
  17184     }
  17185 #endif /* BCM_FIREBOLT2_SUPPORT || BCM_TRX_SUPPORT */
  17186 
  17187     /* Check if another  policer already attached at this level. */
  17188     f_ent_pl = f_ent->policer + level;
  17189     if (f_ent_pl->flags & _FP_POLICER_VALID) {
  17190         FP_UNLOCK(unit);
  17191         return (BCM_E_EXISTS);
  17192     }
  17193 
  17194     /* Check if another policer is in detach state at this level */
  17195     if ((f_ent_pl->flags & _FP_POLICER_DETACH) &&
  17196             (f_ent_pl->pid != policer_id)) {
  17197         FP_UNLOCK(unit);
  17198         return (BCM_E_EXISTS);
  17199     }
  17200 
  17201     /* Check if policer already attached to another level in the entry. */
  17202     for (idx = 0; idx < _FP_POLICER_LEVEL_COUNT; idx++) {
  17203         f_ent_pl = f_ent->policer + idx;
  17204         if (f_ent_pl->pid == policer_id) {
  17205             if (idx == level) {
  17206                 f_ent_pl->flags = _FP_POLICER_VALID;
  17207             }
  17208             FP_UNLOCK(unit);
  17209             return (idx == level) ? (BCM_E_NONE) : (BCM_E_PARAM);
  17210         }
  17211     }
  17212 
  17213     /* Get policer description structure. */
  17214     rv = _bcm_field_policer_get(unit, policer_id, &f_pl);
  17215     if (BCM_FAILURE(rv)) {
  17216         FP_UNLOCK(unit);
  17217         return (rv);
  17218     }
  17219 
  17220     if ((f_pl->cfg.flags & BCM_POLICER_AS_PACKET_COUNTER) &&
  17221         (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id)) {
  17222         return (BCM_E_UNAVAIL);
  17223     }
  17224     /* Check that policer can be shared. */
  17225     if (f_pl->sw_ref_count > 1) {
  17226         /* Policer sharing is restricted to a single stage. */
  17227         if (stage_id != f_pl->stage_id) {
  17228             FP_UNLOCK(unit);
  17229             return (BCM_E_PARAM);
  17230         }
  17231 
  17232         /* Policer sharing is restricted to a single level. */
  17233         if (level != f_pl->level) {
  17234             FP_UNLOCK(unit);
  17235             return (BCM_E_PARAM);
  17236         }
  17237 
  17238         /* cannot attach the policers if _FP_STAGE_AUTOEXPAND_WITH_POLICER is
  17239          * set and the policer is already attached to another entry */
  17240         if ((fc->flags &_FP_AUTOEXPAND_WITH_POLICER) &&
  17241               (_BCM_FIELD_STAGE_EGRESS == group->stage_id)) {
  17242             LOG_ERROR(BSL_LS_BCM_FP,
  17243                           (BSL_META_U(unit,
  17244                            "Cannot attach policer for eid = %d as it cannot be shared.\n"),
  17245                            f_ent->eid));
  17246                 FP_UNLOCK(unit);
  17247                 return (BCM_E_CONFIG);
  17248         }
  17249         /* 
  17250          * When FP stage supports meters per-slice, then policers cannot be attached
  17251          * to entries created on a difference physical slice.
  17252          */
  17253         if (!(stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS)
  17254             && (_FP_INVALID_INDEX != f_pl->hw_index)) {
  17255             if ((!(f_ent->flags & _FP_ENTRY_POLICER_IN_SECONDARY_SLICE)
  17256                    && f_ent->fs->slice_number != f_pl->pool_index)
  17257                 || ((f_ent->flags & _FP_ENTRY_POLICER_IN_SECONDARY_SLICE)
  17258                      && f_ent->fs->slice_number + 1 != f_pl->pool_index)) {
  17259                 LOG_ERROR(BSL_LS_BCM_FP,
  17260                           (BSL_META_U(unit,
  17261                            "FP(unit %d) - Cannot attach policer for eid = %d\n"),
  17262                            unit, f_ent->eid));
  17263                 FP_UNLOCK(unit);
  17264                 return (BCM_E_CONFIG);
  17265             }
  17266         }
  17267 
  17268         if ((!(_FP_POLICER_GROUP_SHARE_ENABLE & fc->flags)) && 
  17269             (_BCM_FIELD_STAGE_INGRESS == stage_fc->stage_id)) {
  17270             if ((0 == level) && (_FP_INVALID_INDEX != f_pl->pool_index)
  17271                 && (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS)) {
  17272                 /* 
  17273                  * Entry's primary slice_number must match Policer
  17274                  * meter pool slice_id value for Level0 policer.
  17275                  */
  17276 #if defined(BCM_TRIUMPH3_SUPPORT)
  17277                 if (SOC_IS_TRIUMPH3(unit) &&
  17278                     (fc->ingress_logical_policer_pools_mode !=
  17279                                   bcmFieldIngressLogicalPolicerPools8x1024)) {
  17280                     f_mp = stage_fc->logical_meter_pool
  17281                               [f_pl->logical_pool_index];
  17282                 } else
  17283 #endif
  17284                 {
  17285                     f_mp = stage_fc->meter_pool
  17286                               [f_ent->group->instance][f_pl->pool_index];
  17287                 }
  17288                 if (f_ent->group->slices->slice_number != f_mp->slice_id) {
  17289                     FP_UNLOCK(unit);
  17290                     return (BCM_E_PARAM);
  17291                 }
  17292             }
  17293         }
  17294     }
  17295 
  17296     /* Check policer mode support. */
  17297     rv = _field_policer_mode_support(unit, f_ent, level, f_pl);
  17298     if (BCM_FAILURE(rv)) {
  17299         FP_UNLOCK(unit);
  17300         return (rv);
  17301     }
  17302 
  17303 #if defined(BCM_TOMAHAWK_SUPPORT)
  17304     if (f_ent->flags & _FP_ENTRY_EXACT_MATCH_GROUP_DEFAULT) {
  17305         rv = _field_th_em_entry_action_size_get(unit, f_ent,
  17306                                                 &action_size, NULL);
  17307         if (BCM_FAILURE(rv)) {
  17308             FP_UNLOCK(unit);
  17309             return (rv);
  17310         }
  17311         if (action_size > EM_DEFAULT_POLICY_ACTION_DATA_SIZE) {
  17312             FP_UNLOCK(unit);
  17313             return (BCM_E_RESOURCE);
  17314         }
  17315     }
  17316 #endif /* BCM_TOMAHAWK_SUPPORT */
  17317 
  17318     /* Increment policer reference counter. */
  17319     f_pl->sw_ref_count++;
  17320 
  17321     /* Set policer stage. */
  17322     f_pl->stage_id = stage_id;
  17323 
  17324     /* Set policer attachment level. */
  17325     f_pl->level = level;
  17326 
  17327     /* Attach policer to an entry. */
  17328     f_ent_pl = f_ent->policer + level;
  17329     f_ent_pl->flags |= _FP_POLICER_VALID;
  17330     f_ent_pl->pid    = policer_id;
  17331 
  17332     /* 
  17333      * If qualifiers have not been modified for this entry,
  17334      * set Policy table only dirty flag.
  17335      */
  17336     if (0 == (f_ent->flags & _FP_ENTRY_DIRTY)) {
  17337         f_ent->flags |= _FP_ENTRY_POLICY_TABLE_ONLY_DIRTY;
  17338     }
  17339     /* Entry must be reinstalled for policer to take effect. */
  17340     f_ent->flags  |= _FP_ENTRY_DIRTY;
  17341 
  17342     FP_UNLOCK(unit);
  17343     return (BCM_E_NONE);
  17344 }
  17345 
  17346 /*
  17347  * Function:
  17348  *      bcm_field_entry_policer_detach
  17349  * Purpose:
  17350  *      Detach a policer from a field entry.
  17351  * Parameters:
  17352  *      unit     - (IN) Unit number.
  17353  *      entry_id - (IN) Field entry ID.
  17354  *      level    - (IN) Policer level.
  17355  * Returns:
  17356  *      BCM_E_XXX
  17357  * Notes:
  17358  */
  17359 int 
  17360 bcm_esw_field_entry_policer_detach(int unit, bcm_field_entry_t entry_id, 
  17361                                    int level)
  17362 {
  17363     _field_entry_t         *f_ent;    /* Internal entry descriptor.    */
  17364     int                     rv;       /* Operation return status.      */
  17365 
  17366     /* Input parameters check. */
  17367     if ((level >= _FP_POLICER_LEVEL_COUNT) || (level < 0)) {
  17368         return (BCM_E_PARAM);
  17369     }
  17370 
  17371     
  17372     FP_LOCK(unit);
  17373 
  17374     /* Get entry description structure. */
  17375     rv = _field_entry_get(unit, entry_id, _FP_ENTRY_PRIMARY, &f_ent);
  17376     if (BCM_FAILURE(rv)) {
  17377         FP_UNLOCK(unit);
  17378         return (rv);
  17379     }
  17380 
  17381 #if defined(BCM_TOMAHAWK_SUPPORT)
  17382     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  17383         (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS)) {
  17384         FP_UNLOCK(unit);
  17385         return (BCM_E_UNAVAIL);
  17386     }
  17387 #endif /* BCM_TOMAHAWK_SUPPORT */
  17388 
  17389     rv = _field_entry_policer_detach(unit, f_ent, level);
  17390 
  17391     FP_UNLOCK(unit);
  17392     return (rv);
  17393 }
  17394 
  17395 /*
  17396  * Function:
  17397  *      bcm_field_entry_policer_detach_all
  17398  * Purpose:
  17399  *      Detach all policers from a field entry.
  17400  * Parameters:
  17401  *      unit - (IN) Unit number.
  17402  *      entry_id - (IN) Field entry ID.
  17403  * Returns:
  17404  *      BCM_E_XXX
  17405  * Notes:
  17406  */
  17407 int 
  17408 bcm_esw_field_entry_policer_detach_all(int unit, bcm_field_entry_t entry_id)
  17409 {
  17410     int       idx;                /* Entry policers iterator. */
  17411     int       rv = BCM_E_NONE;    /* Operation return status. */
  17412 
  17413     /* Detach all the policers attached to an entry. */
  17414     for (idx = 0; idx < _FP_POLICER_LEVEL_COUNT; idx++) {
  17415         rv =  bcm_esw_field_entry_policer_detach(unit, entry_id, idx);
  17416         if (BCM_E_EMPTY == rv) {
  17417             /* No policer at this level. */
  17418             rv = BCM_E_NONE;
  17419         } else if (BCM_FAILURE(rv)) {
  17420             break;
  17421         }
  17422     }
  17423     return (rv);
  17424 }
  17425 
  17426 /*
  17427  * Function:
  17428  *      bcm_field_entry_policer_get
  17429  * Purpose:
  17430  *      Get the policer(s) attached to a field entry.
  17431  * Parameters:
  17432  *      unit       - (IN) Unit number.
  17433  *      entry_id   - (IN) Field entry ID.
  17434  *      level      - (IN) Policer level.
  17435  *      policer_id - (OUT) Policer ID.
  17436  * Returns:
  17437  *      BCM_E_XXX
  17438  * Notes:
  17439  */
  17440 int 
  17441 bcm_esw_field_entry_policer_get(int unit, bcm_field_entry_t entry_id, 
  17442                                 int level, bcm_policer_t *policer_id)
  17443 {
  17444     _field_entry_policer_t *f_ent_pl;/* Field entry policer structure.*/
  17445     _field_entry_t         *f_ent;   /* Internal entry descriptor.    */
  17446     int                    rv;       /* Operation return status.      */
  17447 
  17448     /* Input parameters check. */
  17449     if ((level >= _FP_POLICER_LEVEL_COUNT) || (level < 0)) {
  17450         return (BCM_E_PARAM);
  17451     }
  17452 
  17453     if (NULL == policer_id) {
  17454         return (BCM_E_PARAM);
  17455     }
  17456 
  17457     FP_LOCK(unit);
  17458 
  17459     /* Get entry description structure. */
  17460     rv = _field_entry_get(unit, entry_id, _FP_ENTRY_PRIMARY, &f_ent);
  17461     if (BCM_FAILURE(rv)) {
  17462         FP_UNLOCK(unit);
  17463         return (rv);
  17464     }
  17465 #if defined(BCM_FLOWTRACKER_SUPPORT)
  17466     if (soc_feature(unit, soc_feature_field_flowtracker_support) &&
  17467         (f_ent->group->stage_id == _BCM_FIELD_STAGE_FLOWTRACKER)) {
  17468         FP_UNLOCK(unit);
  17469         return (BCM_E_UNAVAIL);
  17470     }
  17471 #endif
  17472 
  17473 #if defined(BCM_TOMAHAWK_SUPPORT)
  17474     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  17475         (f_ent->group->stage_id == _BCM_FIELD_STAGE_CLASS)) {
  17476         FP_UNLOCK(unit);
  17477         return (BCM_E_UNAVAIL);
  17478     }
  17479 #endif /* BCM_TOMAHAWK_SUPPORT */
  17480 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
  17481     defined(BCM_APACHE_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT)
  17482     if (SOC_IS_KATANAX(unit) || SOC_IS_TRIUMPH3(unit)
  17483         || SOC_IS_APACHE(unit) || SOC_IS_GREYHOUND2(unit)) {
  17484         if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) {
  17485             if (f_ent->global_meter_policer.pid) {
  17486                 *policer_id = f_ent->global_meter_policer.pid;
  17487                 FP_UNLOCK(unit);
  17488                 return (rv);
  17489             } 
  17490             rv = (BCM_E_NOT_FOUND);
  17491         }
  17492     }
  17493 #endif /* BCM_KATANA_SUPPORT || BCM_TRIUMPH3_SUPPORT ||
  17494           BCM_APACHE_SUPPORT || BCM_GREYHOUND2_SUPPORT */
  17495 #if defined(BCM_TRIUMPH3_SUPPORT)
  17496     if (SOC_IS_TRIUMPH3(unit)) {
  17497         if (_BCM_FIELD_STAGE_EXTERNAL == f_ent->group->stage_id) {
  17498             if (f_ent->global_meter_policer.pid) {
  17499                 *policer_id = f_ent->global_meter_policer.pid;
  17500                 FP_UNLOCK(unit);
  17501                 return (rv);
  17502             } 
  17503             rv = (BCM_E_NOT_FOUND);
  17504         }
  17505     }
  17506 #endif
  17507 
  17508     f_ent_pl = f_ent->policer + level;
  17509     /* Make sure policer attached to the entry. */
  17510     if (0 == (f_ent_pl->flags & _FP_POLICER_VALID)) {
  17511         rv = (BCM_E_NOT_FOUND);
  17512     } else {
  17513         *policer_id = f_ent_pl->pid;
  17514     }
  17515 
  17516     FP_UNLOCK(unit);
  17517     return (rv);
  17518 }
  17519 
  17520 
  17521 /*
  17522  * Function:
  17523  *      bcm_esw_policer_create
  17524  * Purpose:
  17525  *      Create a policer entry.
  17526  * Parameters:
  17527  *      unit    - (IN) BCM device number.
  17528  *      pol_cfg - (IN) Policer configuration.
  17529  *      policer_id - (OUT) Policer ID.
  17530  * Returns:
  17531  *      BCM_E_XXX
  17532  * Notes:
  17533  */
  17534 int 
  17535 bcm_esw_policer_create(int unit, bcm_policer_config_t *pol_cfg, 
  17536                        bcm_policer_t *policer_id)
  17537 {
  17538     int                 rv;                /* Operation return status. */
  17539 
  17540     /* Input parameters check. */
  17541     if (NULL == policer_id) {
  17542         return (BCM_E_PARAM);
  17543     }
  17544     
  17545     /* Reject unsupported flags. */
  17546     if (pol_cfg->flags & BCM_POLICER_XGS_NOSUPPORT_FLAGS) {
  17547         return (BCM_E_PARAM);
  17548     }
  17549     if ((pol_cfg->flags & BCM_POLICER_WITH_ID) &&
  17550         ((*policer_id < 0) || (*policer_id >= _FP_ID_MAX))){
  17551        return (BCM_E_PARAM);
  17552     }
  17553     if (bcmPolicerModeCommitted == pol_cfg->mode
  17554         && (pol_cfg->pkbits_sec || pol_cfg->pkbits_burst)) {
  17555         return (BCM_E_PARAM);
  17556     }
  17557 
  17558     if (pol_cfg->flags & BCM_POLICER_MODE_PACKETS) {
  17559         if (!soc_feature(unit, soc_feature_field_packet_based_metering)) {
  17560             return (BCM_E_UNAVAIL);
  17561         }
  17562     }
  17563 
  17564     if ((pol_cfg->flags & BCM_POLICER_AS_PACKET_COUNTER) &&
  17565         (!SOC_IS_KATANA2(unit))) {
  17566             return (BCM_E_UNAVAIL);
  17567     }
  17568 
  17569     if ((pol_cfg->flags & BCM_POLICER_AS_PACKET_COUNTER) &&
  17570         (pol_cfg->flags & BCM_POLICER_MODE_BYTES)) {
  17571         return (BCM_E_PARAM);
  17572     }
  17573 
  17574     /* Overwrite the mode to Flow mode when policer is used as packet counter */
  17575     if (pol_cfg->flags & BCM_POLICER_AS_PACKET_COUNTER) {
  17576         pol_cfg->mode = bcmPolicerModeCommitted;
  17577         pol_cfg->flags |=  BCM_POLICER_MODE_PACKETS;
  17578         pol_cfg->ckbits_sec = 0;
  17579         pol_cfg->ckbits_burst = 0;
  17580         pol_cfg->bucket_width = 30;
  17581         pol_cfg->token_gran = 250;
  17582         pol_cfg->bucket_init_val = 0xFFF << 16;
  17583         pol_cfg->bucket_rollover_val = 0x20000052;
  17584     }
  17585 
  17586     if (pol_cfg->flags & BCM_POLICER_REGEX) {
  17587 #if defined(INCLUDE_REGEX) && defined(BCM_TRIUMPH3_SUPPORT)
  17588         if (soc_feature(unit, soc_feature_regex)) { 
  17589             return  _bcm_esw_regex_policer_create(unit, pol_cfg, policer_id);
  17590         }
  17591 #else
  17592         return BCM_E_UNAVAIL;
  17593 #endif
  17594     }
  17595 
  17596     FP_LOCK(unit);
  17597 
  17598     rv = _field_policer_create(unit, pol_cfg, 0, policer_id);
  17599 
  17600     FP_UNLOCK(unit);
  17601     return (rv);
  17602 }
  17603 
  17604 
  17605 /*
  17606  * Function:
  17607  *      bcm_policer_destroy
  17608  * Purpose:
  17609  *      Destroy a policer entry.
  17610  * Parameters:
  17611  *      unit - (IN) Unit number.
  17612  *      policer_id - (IN) Policer ID.
  17613  * Returns:
  17614  *      BCM_E_XXX
  17615  * Notes:
  17616  */
  17617 int 
  17618 bcm_esw_policer_destroy(int unit, bcm_policer_t policer_id)
  17619 {
  17620     int               rv;       /* Operation return status. */
  17621     int is_global_policer; /* Globa meter policer ID Check. */
  17622 
  17623 #if defined(INCLUDE_REGEX) && defined(BCM_TRIUMPH3_SUPPORT)
  17624     if ((soc_feature(unit, soc_feature_regex)) && (BCM_POLICER_IS_REGEX_METER(policer_id)))  { 
  17625         return  _bcm_esw_regex_policer_destroy(unit, policer_id);
  17626     }
  17627 #endif
  17628 
  17629     BCM_IF_ERROR_RETURN(
  17630         _bcm_esw_is_global_policer(unit, policer_id, &is_global_policer));
  17631     if (TRUE == is_global_policer) {
  17632         rv = _bcm_esw_global_meter_policer_destroy(unit, policer_id);
  17633         return (rv);
  17634     }
  17635 
  17636     FP_LOCK(unit);
  17637     rv = _field_policer_destroy(unit, policer_id);
  17638     FP_UNLOCK(unit);
  17639 
  17640     return (rv);
  17641 }
  17642 
  17643 /*
  17644  * Function:
  17645  *      bcm_policer_destroy_all
  17646  * Purpose:
  17647  *      Destroy all policer entries.
  17648  * Parameters:
  17649  *      unit - (IN) Unit number.
  17650  * Returns:
  17651  *      BCM_E_XXX
  17652  * Notes:
  17653  */
  17654 int 
  17655 bcm_esw_policer_destroy_all(int unit)
  17656 {
  17657     _field_control_t *fc;              /* Field control structure.     */
  17658     int              idx;              /* Policer hash iteration index.*/
  17659     int              rv = BCM_E_NONE;  /* Operation return status.     */
  17660 
  17661     FP_LOCK(unit);
  17662     rv = _field_control_get(unit, &fc);
  17663     if (BCM_FAILURE(rv)) {
  17664         FP_UNLOCK(unit);
  17665         return rv;
  17666     }
  17667 
  17668     /* Iterate over all hash buckets. */
  17669     for (idx = 0; idx < _FP_HASH_SZ(fc); idx++) {
  17670         /* Destroy entries in each bucket. */
  17671         while (NULL != fc->policer_hash[idx]) {
  17672             rv = _field_policer_destroy2(unit, fc, fc->policer_hash[idx]);
  17673             if (BCM_FAILURE(rv)) {
  17674                 break;
  17675             }
  17676         }
  17677         if (BCM_FAILURE(rv)) {
  17678             break;
  17679         }
  17680     }
  17681     FP_UNLOCK(unit);
  17682     BCM_IF_ERROR_RETURN(rv);
  17683     
  17684 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
  17685     defined(BCM_APACHE_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT)
  17686     if (SOC_IS_KATANAX(unit) || SOC_IS_TRIUMPH3(unit) ||
  17687         SOC_IS_APACHE(unit) || SOC_IS_GREYHOUND2(unit)) {
  17688         /* In case warmboot shutdown is going on, there is no need to
  17689          * delete all policers here. It is taken care in
  17690          * _bcm_esw_global_meter_cleanup() call */
  17691         if (soc_feature(unit, soc_feature_global_meter) &&
  17692                         !(SOC_WARM_BOOT(unit))) {
  17693             rv = _bcm_esw_global_meter_policer_destroy_all(unit);
  17694             if (BCM_FAILURE(rv)) {
  17695                 rv = bcm_esw_global_meter_init(unit);
  17696             }
  17697         }
  17698     }
  17699 #endif
  17700 
  17701 #if defined(INCLUDE_REGEX) && defined(BCM_TRIUMPH3_SUPPORT)
  17702     if (soc_feature(unit, soc_feature_regex)) { 
  17703         return  _bcm_esw_regex_policer_destroy_all(unit);
  17704     }
  17705 #endif
  17706 
  17707     return (rv);
  17708 }
  17709 
  17710 /*
  17711  * Function:
  17712  *      bcm_policer_traverse
  17713  * Purpose:
  17714  *      Traverse all existing policer entries and call supplied
  17715  *      callback function.
  17716  * Parameters:
  17717  *      unit - (IN) Unit number.
  17718  *      cb - (IN) Callback function.
  17719  *      user_data - (IN) User data.
  17720  * Returns:
  17721  *      BCM_E_XXX
  17722  * Notes:
  17723  *     To speed up traverse operation - no hw read is perfomed.
  17724  */
  17725 int 
  17726 bcm_esw_policer_traverse(int unit, bcm_policer_traverse_cb cb, 
  17727                          void *user_data)
  17728 {
  17729     _field_control_t        *fc;      /* Field control structure.       */
  17730     _field_policer_t        *f_pl;    /* Internal policer descriptor.   */
  17731     bcm_policer_config_t    cfg;      /* Policer configuration.         */
  17732     int                     idx;      /* Policer hash iteration index.  */
  17733     int              rv = BCM_E_NONE; /* Operation return status.       */
  17734 
  17735     /* Input parameter check. */
  17736     if (NULL == cb) {
  17737         return (BCM_E_PARAM);
  17738     } 
  17739 
  17740     FP_LOCK(unit);
  17741     rv = _field_control_get(unit, &fc);
  17742     if (BCM_FAILURE(rv)) {
  17743         FP_UNLOCK(unit);
  17744         return rv;
  17745     }
  17746 
  17747     /* Iterate over all hash buckets. */
  17748     for (idx = 0; idx < _FP_HASH_SZ(fc); idx++) {
  17749         /* Iterate over entries in each bucket. */
  17750         f_pl = fc->policer_hash[idx]; 
  17751         while (NULL != f_pl) {
  17752             sal_memcpy(&cfg, &f_pl->cfg, sizeof(bcm_policer_config_t));
  17753             rv = (*cb)(unit, f_pl->pid, &cfg, user_data);  
  17754             if (BCM_FAILURE(rv)) {
  17755                 break;
  17756             }
  17757             f_pl = f_pl->next;
  17758         }
  17759         if (BCM_FAILURE(rv)) {
  17760             break;
  17761         }
  17762     }
  17763     FP_UNLOCK(unit);
  17764 #if defined(BCM_KATANA_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || \
  17765     defined(BCM_APACHE_SUPPORT) || defined(BCM_GREYHOUND2_SUPPORT)
  17766     if (SOC_IS_KATANAX(unit) || SOC_IS_TRIUMPH3(unit) ||
  17767         SOC_IS_APACHE(unit) || SOC_IS_GREYHOUND2(unit)) {
  17768         rv = _bcm_esw_global_meter_policer_traverse(unit,cb,user_data); 
  17769     }
  17770 #endif /* BCM_KATANA_SUPPORT || BCM_TRIUMPH3_SUPPORT ||
  17771           BCM_APACHE_SUPPORT || BCM_GREYHOUND2_SUPPORT */
  17772 
  17773 #if defined(INCLUDE_REGEX) && defined(BCM_TRIUMPH3_SUPPORT)
  17774     if (soc_feature(unit, soc_feature_regex)) { 
  17775         return  _bcm_esw_regex_policer_traverse(unit, cb, user_data);
  17776     }
  17777 #endif
  17778 
  17779     return (rv);
  17780 }
  17781 
  17782 /*
  17783 * Function: bcm_field_resync
  17784 *
  17785 * Purpose:
  17786 *     To invalidate HW FP entries that have not been replayed after warm boot.
  17787 *     Can be used in general to clear entries that are in HW but not in SW.
  17788 *
  17789 * Parameters:
  17790 *     unit     - BCM unit number
  17791 *
  17792 * Returns:
  17793 *     BCM_E_INIT      - Unit not initialized
  17794 *     BCM_E_NONE      - Success
  17795 *     BCM_E_XXX       - Other errors
  17796 */
  17797 int
  17798 bcm_esw_field_resync(int unit)
  17799 {
  17800     int               i, rv, tcam_idx, tcam_size;
  17801     _field_stage_t    *stage_fc;
  17802     _field_slice_t    *fs;
  17803     soc_mem_t         mem = INVALIDm;
  17804     soc_field_t field = VALIDf;
  17805     uint32            valid, e[SOC_MAX_MEM_FIELD_WORDS];
  17806     int               slice_number = 0;
  17807     int               slice_offset = 0;
  17808 
  17809     FP_LOCK(unit);
  17810     rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS,
  17811                                                   &stage_fc);
  17812     if (BCM_FAILURE(rv)) {
  17813        FP_UNLOCK(unit);
  17814        return rv;
  17815     }
  17816 
  17817 #if defined(BCM_TOMAHAWK_SUPPORT)
  17818     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  17819        rv = _bcm_field_th_resync(unit, stage_fc);
  17820        FP_UNLOCK(unit);
  17821        return rv;
  17822     }
  17823 #endif /* BCM_TOMAHAWK_SUPPORT */
  17824  
  17825 #ifdef BCM_FIREBOLT_SUPPORT
  17826     if (SOC_IS_FBX(unit)) {
  17827        mem = FP_TCAMm;
  17828     }
  17829 #endif /* BCM_FIREBOLT_SUPPORT */
  17830 
  17831     if (mem == INVALIDm) {
  17832        FP_UNLOCK(unit);
  17833        return BCM_E_UNAVAIL;
  17834     }
  17835 
  17836     tcam_size = soc_mem_index_count(unit, mem);
  17837     for (tcam_idx = 0; tcam_idx < tcam_size; tcam_idx++) {
  17838         /* Read tcam entry. */
  17839         sal_memset(e, 0, sizeof(uint32) * SOC_MAX_MEM_FIELD_WORDS);
  17840         rv = soc_mem_read(unit, mem, MEM_BLOCK_ANY, tcam_idx, e);
  17841         if (BCM_FAILURE(rv)) {
  17842             FP_UNLOCK(unit);
  17843             return rv;
  17844         }
  17845 
  17846         valid = soc_mem_field32_get(unit, mem, e, field);
  17847 
  17848         if (valid) {
  17849             rv = _bcm_field_tcam_idx_to_slice_offset (unit, stage_fc,
  17850                                                       _FP_DEF_INST,
  17851                                                       tcam_idx,
  17852                                                       &slice_number,
  17853                                                       &slice_offset);
  17854             if (BCM_FAILURE(rv)) {
  17855                 FP_UNLOCK(unit);
  17856                 return rv;
  17857             }
  17858             fs = &stage_fc->slices[_FP_DEF_INST][slice_number];
  17859             for (i = 0; i < fs->entry_count; i++) {
  17860                 if (fs->entries[i] != NULL) {
  17861                     if (!(fs->entries[i]->group->flags &
  17862                           _FP_GROUP_INTRASLICE_DOUBLEWIDE) && 
  17863                         fs->entries[i]->slice_idx == slice_offset) {
  17864                         break;
  17865                     } else if (fs->entries[i]->group->flags & 
  17866                                _FP_GROUP_INTRASLICE_DOUBLEWIDE) {
  17867                         if ((fs->entries[i]->flags & _FP_ENTRY_SECOND_HALF) && 
  17868                             fs->entries[i]->slice_idx == slice_offset
  17869                             - fs->entry_count /                               \
  17870                            ((stage_fc->flags & _FP_STAGE_HALF_SLICE) ? 1 : 2)) {
  17871                             break;
  17872                         } else if (!(fs->entries[i]->flags &
  17873                                       _FP_ENTRY_SECOND_HALF) &&  
  17874                                    fs->entries[i]->slice_idx == slice_offset) {
  17875                             break;
  17876                         }           
  17877                     }
  17878                 }
  17879             }
  17880             if (i == fs->entry_count)
  17881             {
  17882                 soc_mem_field32_set(unit, mem, e, field, 0);
  17883                 rv = soc_mem_write(unit, mem, MEM_BLOCK_ANY, tcam_idx, e);
  17884                 if (BCM_FAILURE(rv)) {
  17885                     FP_UNLOCK(unit);
  17886                     return rv;
  17887                 }
  17888             }
  17889         }
  17890     }
  17891     FP_UNLOCK(unit);
  17892     return BCM_E_NONE;
  17893 }
  17894 
  17895 /*
  17896  * Function:
  17897  *      bcm_esw_field_data_qualifier_create
  17898  * Purpose:
  17899  *      Create an data/offset based qualifier.
  17900  * Parameters:
  17901  *      unit           - (IN) bcm device.
  17902  *      data_qualifier - (IN) Qualifier descriptor:
  17903  *                           such as packet type, byte offset, etc.
  17904  * Returns:
  17905  *      BCM_E_XXX
  17906  */
  17907 int
  17908 bcm_esw_field_data_qualifier_create(int unit,  
  17909                                  bcm_field_data_qualifier_t *data_qualifier)
  17910 {
  17911     int                 rv;      /* Operation return status.     */
  17912 
  17913     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  17914        return BCM_E_UNAVAIL;
  17915     }
  17916 
  17917     /* Input parameters check. */
  17918     if (NULL == data_qualifier) {
  17919         return (BCM_E_PARAM);
  17920     }
  17921 
  17922     /* Check data qualifier flags support */
  17923     if ((0 == SOC_MEM_FIELD_VALID(unit, FP_UDF_OFFSETm,
  17924                                   UDF1_ADD_GRE_OPTIONS0f)) &&
  17925         (data_qualifier->flags &
  17926          BCM_FIELD_DATA_QUALIFIER_OFFSET_GRE_OPTIONS_ADJUST)) {
  17927         return (BCM_E_UNAVAIL);
  17928     }
  17929     if ((0 == SOC_MEM_FIELD_VALID(unit, FP_UDF_OFFSETm,
  17930                                   UDF1_ADD_IPV4_OPTIONS0f)) &&
  17931         (data_qualifier->flags &
  17932          BCM_FIELD_DATA_QUALIFIER_OFFSET_IP4_OPTIONS_ADJUST)) {
  17933         return (BCM_E_UNAVAIL);
  17934     }
  17935     if (data_qualifier->flags &
  17936         BCM_FIELD_DATA_QUALIFIER_OFFSET_IP6_EXTENSIONS_ADJUST) {
  17937         return (BCM_E_UNAVAIL);
  17938     }
  17939     if (data_qualifier->flags &
  17940         BCM_FIELD_DATA_QUALIFIER_OFFSET_NEGATIVE) {
  17941         return (BCM_E_UNAVAIL);
  17942     }
  17943     if (data_qualifier->flags &
  17944         BCM_FIELD_DATA_QUALIFIER_OFFSET_PREDEFINED) {
  17945         return (BCM_E_UNAVAIL);
  17946     }
  17947     
  17948     FP_LOCK(unit);
  17949 
  17950     rv = _field_data_qualifier_create(unit, data_qualifier); 
  17951 
  17952     FP_UNLOCK(unit);
  17953     return (rv);
  17954 }
  17955 
  17956 
  17957 /*
  17958  * Function:
  17959  *      bcm_esw_field_data_qualifier_multi_get
  17960  *
  17961  * Purpose:
  17962  *      Return list of ids of defined data qualifiers, per standard API idiom.
  17963  *
  17964  * Parameters:
  17965  *      unit       - (IN)  bcm device.
  17966  *      qual_size  - (IN)  Size of given qualifier id array; if 0, indicates
  17967  *                         return count of data qualifiers only.
  17968  *      qual_array - (OUT) Base of array where to store returned data qualifier
  17969  *                         ids.
  17970  *      qual_count - (OUT) Number of qualifier ids stored in above array; if
  17971  *                         qual_size was given as 0, then number of defined
  17972  *                         qualifiers. 
  17973  *
  17974  * Returns:
  17975  *      BCM_E_XXX
  17976  */
  17977 
  17978 int
  17979 bcm_esw_field_data_qualifier_multi_get(int unit, int qual_size, int *qual_array, int *qual_count)
  17980 {
  17981     _field_stage_t          *stage_fc;
  17982     _field_data_control_t   *data_ctrl;
  17983     _field_data_qualifier_t *f_dq;
  17984     unsigned                dqcnt;
  17985 
  17986     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  17987        return BCM_E_UNAVAIL;
  17988     }
  17989 
  17990     /* Parameter checking */
  17991     if (qual_count == NULL) {
  17992         LOG_ERROR(BSL_LS_BCM_FP,
  17993                   (BSL_META_U(unit,
  17994                               "FP(unit %d) Error: qual_count == NULL.\n"),
  17995                    unit));
  17996         return (BCM_E_PARAM);
  17997     }
  17998 
  17999     if (qual_size != 0 && qual_array == NULL) {
  18000         LOG_ERROR(BSL_LS_BCM_FP,
  18001                   (BSL_META_U(unit,
  18002                               "FP(unit %d) Error: qual_array == NULL.\n"),
  18003                    unit));
  18004         return (BCM_E_PARAM);
  18005     }
  18006 
  18007     /* Point to needed things */
  18008 
  18009     BCM_IF_ERROR_RETURN(_field_stage_control_get(unit,
  18010                                                  _BCM_FIELD_STAGE_INGRESS,
  18011                                                  &stage_fc
  18012                                                  )
  18013                         );
  18014     data_ctrl = stage_fc->data_ctrl;
  18015 
  18016     FP_LOCK(unit);
  18017 
  18018     /* Count defined data qualifiers */
  18019 
  18020     for (dqcnt = 0, f_dq = data_ctrl->data_qual;
  18021          f_dq;
  18022          f_dq = f_dq->next, ++dqcnt
  18023          );
  18024 
  18025     if (qual_size == 0) {
  18026         /* Return count of data qualifiers only */
  18027 
  18028         *qual_count = dqcnt;
  18029     } else {
  18030         /* Return array of data qualifier ids */ 
  18031 
  18032         if (qual_size > dqcnt) {
  18033             qual_size = dqcnt;
  18034         }
  18035         
  18036         *qual_count = qual_size;
  18037 
  18038         for (f_dq = data_ctrl->data_qual;
  18039              qual_size != 0 && f_dq != NULL;
  18040              --qual_size, f_dq = f_dq->next, ++qual_array
  18041              ) {
  18042             *qual_array = f_dq->qid;
  18043         }
  18044     }
  18045 
  18046     FP_UNLOCK(unit);
  18047 
  18048     return (BCM_E_NONE);
  18049 }
  18050 
  18051 /*
  18052  * Function:
  18053  *      bcm_esw_field_data_qualifier_get
  18054  *
  18055  * Purpose:
  18056  *      Return configuration of given data qualifier.
  18057  *
  18058  * Parameters:
  18059  *      unit       - (IN)  bcm device.
  18060  *      qual_id    - (IN)  Id of data qualifier.
  18061  *      qual       - (OUT) Attributes of given data qualifier.
  18062  *
  18063  * Returns:
  18064  *      BCM_E_XXX
  18065  */
  18066 
  18067 int
  18068 bcm_esw_field_data_qualifier_get(int unit, int qual_id, bcm_field_data_qualifier_t *qual)
  18069 {
  18070     int                     rv;
  18071     _field_stage_t          *stage_fc;
  18072     _field_data_qualifier_t *f_dq;
  18073 
  18074     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18075        return BCM_E_UNAVAIL;
  18076     }
  18077 
  18078     /* Parameter checking */
  18079     if (qual == NULL) {
  18080         LOG_ERROR(BSL_LS_BCM_FP,
  18081                   (BSL_META_U(unit,
  18082                               "FP(unit %d) Error: qual == NULL.\n"),
  18083                    unit));
  18084         return (BCM_E_PARAM);
  18085     }
  18086 
  18087     /* Point to needed things */
  18088 
  18089     
  18090     BCM_IF_ERROR_RETURN(_field_stage_control_get(unit,
  18091                                                  _BCM_FIELD_STAGE_INGRESS,
  18092                                                  &stage_fc
  18093                                                  )
  18094                         );
  18095 
  18096     FP_LOCK(unit);
  18097                         
  18098     if ((rv = _bcm_field_data_qualifier_get(unit,
  18099                                             stage_fc,
  18100                                             qual_id,
  18101                                             &f_dq
  18102                                             )
  18103          )
  18104         == BCM_E_NONE
  18105         ) {
  18106         qual->qual_id     = f_dq->qid;
  18107         qual->flags       = f_dq->flags;
  18108         qual->offset_base = f_dq->offset_base;
  18109         qual->offset      = f_dq->offset;
  18110         qual->length      = f_dq->length;
  18111 
  18112         if (FP_VERB_CHECK()) {
  18113           (void)_field_data_qualifier_debug(unit, stage_fc, f_dq);
  18114         }
  18115     }
  18116 
  18117     FP_UNLOCK(unit);
  18118     return (rv);
  18119 }
  18120 
  18121 
  18122 /*
  18123  * Function:
  18124  *      bcm_esw_field_data_qualifier_destroy
  18125  * Purpose:
  18126  *      Destroy an data/offset based qualifier.
  18127  * Parameters:
  18128  *      unit     - (IN)  bcm device.
  18129  *      qual_id  - (IN)  Data qualifier id.
  18130  * Returns:
  18131  *      BCM_E_XXX
  18132  */
  18133 int
  18134 bcm_esw_field_data_qualifier_destroy(int unit, int qual_id)
  18135 {
  18136    int rv = BCM_E_UNAVAIL;      /* Operation return status.     */
  18137     
  18138 #if defined BCM_TRIDENT3_SUPPORT
  18139     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  18140        return rv;
  18141     }
  18142 #endif
  18143     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18144        return BCM_E_UNAVAIL;
  18145     }
  18146     FP_LOCK(unit);
  18147 
  18148     rv = _bcm_field_data_qualifier_destroy(unit, qual_id); 
  18149 
  18150     FP_UNLOCK(unit);
  18151     return (rv);
  18152 }
  18153 
  18154 /*
  18155  * Function:
  18156  *      bcm_esw_field_data_qualifier_destroy_all
  18157  * Purpose:
  18158  *      Delete all data/offset based qualifiers.
  18159  * Parameters:
  18160  *      unit          - (IN)  bcm device.
  18161  * Returns:
  18162  *      BCM_E_XXX
  18163  */
  18164 int
  18165 bcm_esw_field_data_qualifier_destroy_all(int unit)
  18166 {
  18167    int rv = BCM_E_UNAVAIL;      /* Operation return status.     */
  18168     
  18169 #if defined BCM_TRIDENT3_SUPPORT
  18170     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  18171        return rv;
  18172     }
  18173 #endif 
  18174     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18175        return BCM_E_UNAVAIL;
  18176     }
  18177     FP_LOCK(unit);
  18178 
  18179     rv = _field_data_qualifier_destroy_all(unit); 
  18180 
  18181     FP_UNLOCK(unit);
  18182     return (rv);
  18183 }
  18184 
  18185 /*
  18186  * Function:
  18187  *      bcm_esw_field_qset_data_qualifier_get
  18188  * Purpose:
  18189  *      Get field data qualifiers included in group qset. 
  18190  * Parameters:
  18191  *      unit          - (IN) bcm device.
  18192  *      qset          - (IN) Group qualifier set.
  18193  *      qual_max      - (IN) Maximum qualifiers to fill.
  18194  *      qual_arr      - (OUT) Data qualifiers array.
  18195  *      qual_count    - (OUT) Number of data qualifiers filled in qual_arr.
  18196  * Returns:
  18197  *      BCM_E_XXX
  18198  */
  18199 int 
  18200 bcm_esw_field_qset_data_qualifier_get(int unit, bcm_field_qset_t qset, int qual_max,
  18201                                   int *qual_arr, int *qual_count) 
  18202 {
  18203     _field_data_qualifier_p f_dq;  /* Field data qualifier iterator. */
  18204     _field_stage_t *stage_fc;      /* Stage field control structure. */
  18205     bcm_field_qset_t  qset_temp;   /* Temporary qset copy.           */
  18206     int count;                     /* Filled entries count.          */
  18207     int rv;                        /* Operation return status.       */
  18208 
  18209     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18210        return BCM_E_UNAVAIL;
  18211     }
  18212 
  18213     /* Input parameters check. */
  18214     if ((qual_max <= 0) || (NULL == qual_arr) ||
  18215         (NULL == qual_count)) {
  18216         return BCM_E_PARAM;
  18217     }
  18218     /* Get field control structure. */
  18219     
  18220     FP_LOCK(unit);
  18221 
  18222     /* Get stage field control structure. */
  18223     rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 
  18224     if (BCM_FAILURE(rv)) {
  18225         FP_UNLOCK(unit);
  18226         return (rv);
  18227     }
  18228 
  18229     /* Reset caller provided array. */
  18230     sal_memset(qual_arr, 0, qual_max * sizeof(int));
  18231 
  18232     /* Copy qset to a temporary variable. */
  18233     qset_temp = qset;
  18234 
  18235     /* Fill caller array. */
  18236     count = 0;
  18237     f_dq = stage_fc->data_ctrl->data_qual; 
  18238 
  18239     /* Stage data qualifiers iteration array. */
  18240     while (NULL != f_dq) {
  18241         if (f_dq->hw_bmap & qset_temp.udf_map[0]) {
  18242             /* Remove data qualifier udfs from the temporary qset. */
  18243             qset_temp.udf_map[0] &= ~f_dq->hw_bmap;
  18244             /* Add data qualifier id to caller array. */
  18245             qual_arr[count] = f_dq->qid;
  18246             count++;
  18247             if (count >= qual_max) {
  18248                 break;
  18249             }
  18250         }
  18251         f_dq = f_dq->next;
  18252     }
  18253     *qual_count = count;
  18254 
  18255     FP_UNLOCK(unit);
  18256     return (BCM_E_NONE);
  18257 }
  18258 
  18259 /*
  18260  * Function:
  18261  *      bcm_esw_field_qset_data_qualifier_add
  18262  * Purpose:
  18263  *      Add field data qualifier to group qset.
  18264  * Parameters:
  18265  *      unit          - (IN) bcm device.
  18266  *      qset          - (IN/OUT) Group qualifier set.
  18267  *      qualifier_id  - (IN) Data qualifier id.
  18268  * Returns:
  18269  *      BCM_E_XXX
  18270  */
  18271 int
  18272 bcm_esw_field_qset_data_qualifier_add(int unit, bcm_field_qset_t *qset,  
  18273                                       int qual_id)
  18274 {
  18275     _field_stage_t          *stage_fc;  /* Stage field control.       */
  18276     _field_data_qualifier_t *f_dq;      /* Data qualifier descriptor. */
  18277     int                     idx;        /* HW bitmap iteration index. */
  18278     int                     rv;         /* Operation return status.   */
  18279 #ifdef BCM_TRIUMPH_SUPPORT
  18280     uint32              reg_val;        /* Register value */
  18281     uint32              ext_udf_support = 0; /* External UDF support status */
  18282 #endif
  18283 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */
  18284     int offset0_1 = 0;                  /* HW offset 0 and 1 usage status. */
  18285     int offset2_3 = 0;                  /* HW offset 2 and 3 usage status. */
  18286     int offset4_5 = 0;                  /* HW offset 4 and 5 usage status. */
  18287     int offset6_7 = 0;                  /* HW offset 6 and 7 usage status. */
  18288 #endif /* !BCM_TRIDENT_SUPPORT */
  18289 
  18290     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18291        return BCM_E_UNAVAIL;
  18292     }
  18293 
  18294     /* Input parameters check. */
  18295     if (NULL == qset) {
  18296         return (BCM_E_PARAM);
  18297     }
  18298 
  18299     FP_LOCK(unit);
  18300 
  18301     /* Get stage field control structure. */
  18302     rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 
  18303     if (BCM_FAILURE(rv)) {
  18304         FP_UNLOCK(unit);
  18305         return (rv);
  18306     }
  18307 
  18308     /*Get data qualifier info. */
  18309     rv = _bcm_field_data_qualifier_get(unit, stage_fc, qual_id,  &f_dq);
  18310     if (BCM_FAILURE(rv)) {
  18311         FP_UNLOCK(unit);
  18312         return (rv);
  18313     }
  18314 
  18315 #if defined(BCM_TOMAHAWK_SUPPORT)
  18316     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  18317         FP_UNLOCK(unit);
  18318         rv = _bcm_field_th_field_qset_data_qualifier_add(unit, qset, qual_id);
  18319         return (rv);
  18320     }
  18321 #endif
  18322 
  18323 #ifdef BCM_TRIUMPH_SUPPORT
  18324     if (SOC_IS_TRIUMPH(unit) || SOC_IS_TRIUMPH2(unit)) {
  18325         rv = READ_ESM_KEYGEN_CTLr(unit, &reg_val);
  18326         if (BCM_FAILURE(rv)) {
  18327             FP_UNLOCK(unit);
  18328             return (rv);
  18329         }
  18330         ext_udf_support = soc_reg_field_get(unit, ESM_KEYGEN_CTLr, reg_val, 
  18331                                             L2_ACL_PAYLOAD_MODEf);
  18332     }
  18333 #endif
  18334 
  18335     for (idx = 0; idx <= stage_fc->data_ctrl->num_elems * 2; idx++) {
  18336         if (f_dq->hw_bmap & (1 << idx)) {
  18337             SHR_BITSET(qset->udf_map, idx);
  18338             if (idx >= 0 && idx < stage_fc->data_ctrl->num_elems) {
  18339                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData0);
  18340 #ifdef BCM_TRIUMPH_SUPPORT
  18341                 /* External UDF support has to be enabled in ESM_KEYGEN_CTRLr*/
  18342                 if ((SOC_IS_TRIUMPH(unit) || SOC_IS_TRIUMPH2(unit)) && 
  18343                     (1 == ext_udf_support)) {
  18344                     if (SHR_BITGET(qset->udf_map, 0) && 
  18345                         !SHR_BITGET(qset->udf_map, 1) &&
  18346                         !SHR_BITGET(qset->udf_map, 3)) {
  18347                         BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18348                     }
  18349                 } 
  18350 #endif /* !BCM_TRIUMPH_SUPPORT */
  18351             } else if (idx >= stage_fc->data_ctrl->num_elems &&
  18352                        idx < stage_fc->data_ctrl->num_elems * 2) {
  18353                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData1);
  18354             }
  18355         }
  18356     }
  18357 
  18358 #if defined(BCM_ENDURO_SUPPORT) || defined(BCM_TRIUMPH2_SUPPORT)
  18359     if(BCM_FIELD_QSET_TEST_INTERNAL(*qset, _bcmFieldQualifyData0)
  18360         && (SOC_IS_ENDURO(unit)
  18361             || SOC_IS_HURRICANEX(unit) || SOC_IS_GREYHOUND(unit)
  18362             || SOC_IS_GREYHOUND2(unit)
  18363             || (SOC_IS_TRIUMPH2(unit) && !BCM_FIELD_QSET_TEST_INTERNAL(*qset, bcmFieldQualifyStageExternal))
  18364             || SOC_IS_APOLLO(unit) || SOC_IS_VALKYRIE2(unit))) {
  18365         /* See if not having to use all UDF1 */
  18366         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData0);
  18367         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData2);
  18368         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData3);
  18369 
  18370         if (!SHR_BITGET(qset->udf_map, 0) &&
  18371             SHR_BITGET(qset->udf_map, 1) &&
  18372             !SHR_BITGET(qset->udf_map, 2) && 
  18373             !SHR_BITGET(qset->udf_map, 3)) {
  18374             /* Add UDF1_95_64 */
  18375             BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData3);
  18376         } else if(!SHR_BITGET(qset->udf_map, 0) &&
  18377                   !SHR_BITGET(qset->udf_map, 1) && 
  18378                   !SHR_BITGET(qset->udf_map, 2) && 
  18379                   SHR_BITGET(qset->udf_map, 3)){
  18380                   /* Add UDF1_31_0 */
  18381                   BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18382         } else if(!SHR_BITGET(qset->udf_map, 0) &&
  18383                   SHR_BITGET(qset->udf_map, 1) && 
  18384                   !SHR_BITGET(qset->udf_map, 2) && 
  18385                   SHR_BITGET(qset->udf_map, 3)){
  18386             /* Add both UDF1_31_0 and UDF1_95_64 */
  18387             BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18388                   BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData3);
  18389         } else {
  18390             /* Add UDF1_127_0 */
  18391             BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData0);
  18392         }
  18393     }
  18394 #endif /* BCM_ENDURO_SUPPORT */
  18395 
  18396 #if defined(BCM_TRIDENT_SUPPORT) || defined(BCM_KATANA_SUPPORT) 
  18397     if (BCM_FIELD_QSET_TEST_INTERNAL(*qset, _bcmFieldQualifyData0)
  18398         && !((f_dq->flags & BCM_FIELD_DATA_QUALIFIER_STAGE_LOOKUP)
  18399             || BCM_FIELD_QSET_TEST_INTERNAL(*qset, bcmFieldQualifyStageLookup))
  18400         && (SOC_IS_TD_TT(unit)
  18401             || SOC_IS_KATANAX(unit)
  18402             || SOC_IS_TRIUMPH3(unit)
  18403             )
  18404         ) {
  18405 
  18406         /* Remove the internal qualifiers. */
  18407         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData0);
  18408         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData2);
  18409         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData3);
  18410 
  18411         /* Get HW offsets usage status. */
  18412         SHR_BITTEST_RANGE(qset->udf_map, 0, 2, offset0_1);
  18413         SHR_BITTEST_RANGE(qset->udf_map, 2, 2, offset2_3);
  18414         SHR_BITTEST_RANGE(qset->udf_map, 4, 2, offset4_5);
  18415         SHR_BITTEST_RANGE(qset->udf_map, 6, 2, offset6_7);
  18416 
  18417         /* Add new internal qualifiers based on HW offsets usage status. */
  18418         if ((!offset0_1 && !offset4_5) && (offset2_3 || offset6_7)) {
  18419             if (offset2_3 && offset6_7) {
  18420                 /* Add both UDF1_31_0 and UDF1_95_64 */
  18421                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18422                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData3);
  18423             } else if (offset6_7 && !offset2_3) {
  18424                   /* Add UDF1_31_0 */
  18425                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18426             } else {
  18427                   /* Add UDF1_95_64 */
  18428                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData3);
  18429             }
  18430         } else {
  18431             /* Add UDF1_127_0 */
  18432             BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData0);
  18433         }
  18434     }
  18435 #endif /* !BCM_TRIDENT_SUPPORT or BCM_KATANA_SUPPORT*/
  18436 
  18437     FP_UNLOCK(unit);
  18438     return (BCM_E_NONE);
  18439 }
  18440 
  18441 /*
  18442  * Function:
  18443  *      bcm_esw_field_qset_data_qualifier_delete
  18444  * Purpose:
  18445  *      Delete field data qualifier from group qset.
  18446  * Parameters:
  18447  *      unit          - (IN) bcm device.
  18448  *      qset          - (IN/OUT) Group qualifier set.
  18449  *      qualifier_id  - (IN) Data qualifier id.
  18450  * Returns:
  18451  *      BCM_E_XXX
  18452  */
  18453 int
  18454 bcm_esw_field_qset_data_qualifier_delete(int unit, bcm_field_qset_t *qset,  
  18455                                          int qual_id)
  18456 {
  18457     _field_stage_t          *stage_fc;  /* Stage field control.       */
  18458     _field_data_qualifier_t *f_dq;      /* Data qualifier descriptor. */
  18459     int                     idx;        /* HW bitmap iteration index. */
  18460     int                     rv;         /* Operation return status.   */
  18461 #ifdef BCM_TRIUMPH_SUPPORT
  18462     uint32              reg_val;        /* Register value */
  18463     uint32              ext_udf_support = 0; /* External UDF support status */
  18464 #endif
  18465 #if defined(BCM_TRIDENT_SUPPORT) /* BCM_TRIDENT_SUPPORT */
  18466     int offset0_1 = 0;                  /* HW offset 0 and 1 usage status. */
  18467     int offset2_3 = 0;                  /* HW offset 2 and 3 usage status. */
  18468     int offset4_5 = 0;                  /* HW offset 4 and 5 usage status. */
  18469     int offset6_7 = 0;                  /* HW offset 6 and 7 usage status. */
  18470 #endif /* !BCM_TRIDENT_SUPPORT */
  18471 
  18472     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18473        return BCM_E_UNAVAIL;
  18474     }
  18475 
  18476     /* Input parameters check. */
  18477     if (NULL == qset) {
  18478         return (BCM_E_PARAM);
  18479     }
  18480 
  18481     FP_LOCK(unit);
  18482 
  18483     /* Get stage field control structure. */
  18484     rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc); 
  18485     if (BCM_FAILURE(rv)) {
  18486         FP_UNLOCK(unit);
  18487         return (rv);
  18488     }
  18489 
  18490     /*Get data qualifier info. */
  18491     rv = _bcm_field_data_qualifier_get(unit, stage_fc, qual_id,  &f_dq);
  18492     if (BCM_FAILURE(rv)) {
  18493         FP_UNLOCK(unit);
  18494         return (rv);
  18495     }
  18496 
  18497 #if defined(BCM_TOMAHAWK_SUPPORT)
  18498     if (soc_feature(unit, soc_feature_field_multi_pipe_support) && 
  18499             !(f_dq->flags & BCM_FIELD_DATA_QUALIFIER_STAGE_LOOKUP)) {
  18500         FP_UNLOCK(unit);
  18501         rv = _bcm_field_th_field_qset_data_qualifier_delete(unit, qset, qual_id);
  18502         return (rv);
  18503     }
  18504 #endif
  18505 
  18506 #ifdef BCM_TRIUMPH_SUPPORT
  18507     if (SOC_IS_TRIUMPH(unit) || SOC_IS_TRIUMPH2(unit)) {
  18508         rv = READ_ESM_KEYGEN_CTLr(unit, &reg_val);
  18509         if (BCM_FAILURE(rv)) {
  18510             FP_UNLOCK(unit);
  18511             return (rv);
  18512         }
  18513         ext_udf_support = soc_reg_field_get(unit, ESM_KEYGEN_CTLr, reg_val, 
  18514                                             L2_ACL_PAYLOAD_MODEf);
  18515     }
  18516 #endif
  18517 
  18518     /* Remove the internal qualifiers. */
  18519     BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData0);
  18520     BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData1);
  18521     BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData2);
  18522     BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData3);
  18523 
  18524     for (idx = 0; idx <= stage_fc->data_ctrl->num_elems * 2; idx++) {
  18525         if (f_dq->hw_bmap & (1 << idx)) {
  18526             SHR_BITCLR(qset->udf_map, idx);
  18527         } else if (SHR_BITGET(qset->udf_map, idx)) {
  18528             if (idx >= 0 && idx < stage_fc->data_ctrl->num_elems) {
  18529                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData0);
  18530 #ifdef BCM_TRIUMPH_SUPPORT
  18531                 /* External UDF support has to be enabled in ESM_KEYGEN_CTRLr*/
  18532                 if ((SOC_IS_TRIUMPH(unit) || SOC_IS_TRIUMPH2(unit)) && 
  18533                     (1 == ext_udf_support)) {
  18534                     if (SHR_BITGET(qset->udf_map, 0) && 
  18535                         !SHR_BITGET(qset->udf_map, 1) &&
  18536                         !SHR_BITGET(qset->udf_map, 3)) {
  18537                         BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18538                     }
  18539                 } 
  18540 #endif /* !BCM_TRIUMPH_SUPPORT */
  18541             } else if (idx >= stage_fc->data_ctrl->num_elems &&
  18542                        idx < stage_fc->data_ctrl->num_elems * 2) {
  18543                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData1);
  18544             }
  18545         }
  18546     }
  18547 
  18548 #if defined(BCM_ENDURO_SUPPORT) || defined(BCM_TRIUMPH2_SUPPORT)
  18549     if(BCM_FIELD_QSET_TEST_INTERNAL(*qset, _bcmFieldQualifyData0)
  18550         && (SOC_IS_ENDURO(unit)
  18551             || SOC_IS_HURRICANEX(unit) || SOC_IS_GREYHOUND(unit)
  18552             || (SOC_IS_TRIUMPH2(unit) && !BCM_FIELD_QSET_TEST_INTERNAL(*qset, bcmFieldQualifyStageExternal))
  18553             || SOC_IS_APOLLO(unit) || SOC_IS_VALKYRIE2(unit))) {
  18554         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData2);
  18555         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData3);
  18556 
  18557         if (SHR_BITGET(qset->udf_map, 0) &&
  18558             !SHR_BITGET(qset->udf_map, 1) &&
  18559             SHR_BITGET(qset->udf_map, 2) && 
  18560             !SHR_BITGET(qset->udf_map, 3)) {
  18561 
  18562             /* No need to use all UDF1. Remove UDF1_127_0. */
  18563             BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData0);
  18564             /* Add both UDF1_31_0 and UDF1_95_64 */
  18565             BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18566             BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData3);
  18567         } else if(SHR_BITGET(qset->udf_map, 0) &&
  18568                   !SHR_BITGET(qset->udf_map, 1) && 
  18569                   !SHR_BITGET(qset->udf_map, 2) && 
  18570                   !SHR_BITGET(qset->udf_map, 3)){
  18571 
  18572              /* No need to use all UDF1. Remove UDF1_127_0. */
  18573              BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData0);
  18574              /* Add UDF1_31_0 */
  18575              BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18576         } else if(!SHR_BITGET(qset->udf_map, 0) &&
  18577                   !SHR_BITGET(qset->udf_map, 1) && 
  18578                   SHR_BITGET(qset->udf_map, 2) && 
  18579                   !SHR_BITGET(qset->udf_map, 3)){
  18580 
  18581              /* No need to use all UDF1. Remove UDF1_127_0. */
  18582              BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData0);
  18583              /* Add UDF1_95_64 */
  18584              BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData3);
  18585         }
  18586     }
  18587 #endif /* BCM_ENDURO_SUPPORT */
  18588 
  18589 #if defined(BCM_TRIDENT_SUPPORT) || defined(BCM_KATANA_SUPPORT)
  18590     if (BCM_FIELD_QSET_TEST_INTERNAL(*qset, _bcmFieldQualifyData0)
  18591         && !((f_dq->flags & BCM_FIELD_DATA_QUALIFIER_STAGE_LOOKUP)
  18592             || BCM_FIELD_QSET_TEST_INTERNAL(*qset, bcmFieldQualifyStageLookup))
  18593         && (SOC_IS_TD_TT(unit)
  18594             || SOC_IS_KATANA(unit)
  18595             || SOC_IS_TRIUMPH3(unit)
  18596             )
  18597         ) {
  18598 
  18599         /* Remove the internal qualifiers. */
  18600         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData2);
  18601         BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData3);
  18602 
  18603         /* Get HW offsets usage status. */
  18604         SHR_BITTEST_RANGE(qset->udf_map, 0, 2, offset0_1);
  18605         SHR_BITTEST_RANGE(qset->udf_map, 2, 2, offset2_3);
  18606         SHR_BITTEST_RANGE(qset->udf_map, 4, 2, offset4_5);
  18607         SHR_BITTEST_RANGE(qset->udf_map, 6, 2, offset6_7);
  18608 
  18609         /* Add new internal qualifiers based on HW offsets usage status. */
  18610         if ((!offset0_1 && !offset4_5) && (offset2_3 || offset6_7)) {
  18611             if (offset2_3 && offset6_7) {
  18612                 /* No need to use all UDF1. Remove UDF1_127_0. */
  18613                 BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData0);
  18614                 /* Add both UDF1_31_0 and UDF1_95_64 */
  18615                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18616                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData3);
  18617             } else if (offset6_7 && !offset2_3) {
  18618                 /* No need to use all UDF1. Remove UDF1_127_0. */
  18619                 BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData0);
  18620                   /* Add UDF1_31_0 */
  18621                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData2);
  18622             } else {
  18623                 /* No need to use all UDF1. Remove UDF1_127_0. */
  18624                 BCM_FIELD_QSET_REMOVE_INTERNAL(*qset, _bcmFieldQualifyData0);
  18625                   /* Add UDF1_95_64 */
  18626                 BCM_FIELD_QSET_ADD_INTERNAL(*qset, _bcmFieldQualifyData3);
  18627             }
  18628         } 
  18629     }
  18630 #endif /* !BCM_TRIDENT_SUPPORT or BCM_KATANA_SUPPORT*/
  18631 
  18632     FP_UNLOCK(unit);
  18633     return (BCM_E_NONE);
  18634 }
  18635 
  18636 /*
  18637  * Function:
  18638  *      bcm_esw_field_qualify_data
  18639  * Purpose:
  18640  *      Set data/mask in the search engine for entry field data qualifier.
  18641  * Parameters:
  18642  *      unit          - (IN) bcm device.
  18643  *      eid           - (IN) Entry id. 
  18644  *      qual_id       - (IN) Data qualifier id.
  18645  *      data          - (IN) Match data.
  18646  *      mask          - (IN) Match mask.
  18647  *      length        - (IN) Length of data & mask arrays.
  18648  * Returns:
  18649  *      BCM_E_XXX
  18650  */
  18651 int
  18652 bcm_esw_field_qualify_data(int unit, bcm_field_entry_t eid, int qual_id,
  18653                            uint8 *data, uint8 *mask, uint16 length)
  18654 {
  18655     int                     rv;         /* Operation return status.   */
  18656 
  18657     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18658        return BCM_E_UNAVAIL;
  18659     }
  18660 
  18661     /* Input parameters check. */
  18662     if ((NULL == data) || (NULL == mask)) {
  18663         return (BCM_E_PARAM);
  18664     }
  18665 
  18666     FP_LOCK(unit);
  18667 
  18668     rv = _field_qualify_data(unit, eid, qual_id, data, mask, length);
  18669 
  18670     FP_UNLOCK(unit);
  18671     return (rv);
  18672 }
  18673 
  18674 #define _FP_L2_FORMAT_MIN   (0)
  18675 #define _FP_L2_FORMAT_MAX   (2)
  18676 /*
  18677  * Function:
  18678  *      bcm_esw_field_data_qualifier_ethertype_add
  18679  * Purpose:
  18680  *      Add ethertype based offset to data qualifier object.
  18681  * Parameters:
  18682  *      unit       - (IN) bcm device.
  18683  *      qual_id    - (IN) Data qualifier id.
  18684  *      etype      - (IN) Ethertype based offset specification.
  18685  * Returns:
  18686  *      BCM_E_XXX
  18687  */
  18688 int
  18689 bcm_esw_field_data_qualifier_ethertype_add(int unit,  int qual_id,
  18690                                  bcm_field_data_ethertype_t *etype)
  18691 {
  18692     _field_control_t  *fc;             /* Field control structure.  */
  18693     int               rv = BCM_E_NONE; /* Operation return status.  */
  18694 
  18695     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18696        return BCM_E_UNAVAIL;
  18697     }
  18698     /* Input parameters check. */
  18699     if (NULL == etype) {
  18700         return (BCM_E_PARAM);
  18701     }
  18702 
  18703     /* Relative offset calculation. */
  18704     if (SOC_MEM_FIELD_VALID(unit, FP_UDF_OFFSETm, UDF1_OFFSET4f)) {
  18705         if (0 != etype->relative_offset % 2)  {
  18706             return (BCM_E_PARAM);
  18707         }
  18708     } else if (0 != etype->relative_offset % 4)  {
  18709         return (BCM_E_PARAM);
  18710     }
  18711 
  18712     
  18713     FP_LOCK(unit);
  18714     rv = _field_control_get(unit, &fc);
  18715     if (BCM_FAILURE(rv)) {
  18716         FP_UNLOCK(unit);
  18717         return rv;
  18718     }
  18719 
  18720     rv = fc->functions.fp_data_qualifier_ethertype_add(unit, qual_id, etype); 
  18721 
  18722     FP_UNLOCK(unit);
  18723     return (rv);
  18724 }
  18725 
  18726 /*
  18727  * Function:
  18728  *      bcm_esw_field_data_qualifier_ethertype_delete
  18729  * Purpose:
  18730  *      Remove ethertype based offset from data qualifier object. 
  18731  * Parameters:
  18732  *      unit       - (IN) bcm device.
  18733  *      qual_id    - (IN) Data qualifier id.
  18734  *      etype      - (IN) Ethertype based offset specification.                 
  18735  * Returns:
  18736  *      BCM_E_XXX
  18737  */
  18738 int
  18739 bcm_esw_field_data_qualifier_ethertype_delete(int unit, int qual_id,
  18740                                  bcm_field_data_ethertype_t *etype)
  18741 {
  18742     _field_control_t  *fc;             /* Field control structure.  */
  18743     int               rv = BCM_E_NONE; /* Operation return status.  */
  18744 
  18745     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18746        return BCM_E_UNAVAIL;
  18747     }
  18748 
  18749     /* Input parameters check. */
  18750     if (NULL == etype) {
  18751         return (BCM_E_PARAM);
  18752     }
  18753 
  18754     
  18755     FP_LOCK(unit);
  18756     rv = _field_control_get(unit, &fc);
  18757     if (BCM_FAILURE(rv)) {
  18758         FP_UNLOCK(unit);
  18759         return rv;
  18760     }
  18761 
  18762     rv = fc->functions.fp_data_qualifier_ethertype_delete(unit, qual_id, 
  18763                                                           etype); 
  18764 
  18765     FP_UNLOCK(unit);
  18766     return (rv);
  18767 }
  18768 #undef _FP_L2_FORMAT_MIN
  18769 #undef _FP_L2_FORMAT_MAX
  18770 
  18771 /*
  18772  * Function:
  18773  *      bcm_esw_field_data_qualifier_ip_protocol_add
  18774  * Purpose:
  18775  *      Add ip protocol based offset to data qualifier object.
  18776  * Parameters:
  18777  *      unit        - (IN) bcm device.
  18778  *      qual_id     - (IN) Data qualifier id.
  18779  *      ip_protocol - (IN) Ethertype based offset specification.                 
  18780  * Returns:
  18781  *      BCM_E_XXX
  18782  */
  18783 int
  18784 bcm_esw_field_data_qualifier_ip_protocol_add(int unit, int qual_id,
  18785                                  bcm_field_data_ip_protocol_t *ip_protocol)
  18786 {
  18787     _field_control_t  *fc;             /* Field control structure.  */
  18788     int               rv = BCM_E_NONE; /* Operation return status.  */
  18789 
  18790     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18791        return BCM_E_UNAVAIL;
  18792     }
  18793 
  18794     /* Input parameters check. */
  18795     if (NULL == ip_protocol) {
  18796         return (BCM_E_PARAM);
  18797     }
  18798 
  18799     /* Relative offset Calculation. */
  18800     if (SOC_MEM_FIELD_VALID(unit, FP_UDF_OFFSETm, UDF1_OFFSET4f)) {
  18801         if (0 != ip_protocol->relative_offset % 2)  {
  18802             return (BCM_E_PARAM);
  18803         }
  18804     } else if (0 != ip_protocol->relative_offset % 4)  {
  18805         return (BCM_E_PARAM);
  18806     }
  18807 
  18808     
  18809     FP_LOCK(unit);
  18810     rv = _field_control_get(unit, &fc);
  18811     if (BCM_FAILURE(rv)) {
  18812         FP_UNLOCK(unit);
  18813         return rv;
  18814     }
  18815     rv = fc->functions.fp_data_qualifier_ip_protocol_add(unit, qual_id, 
  18816                                                          ip_protocol); 
  18817     FP_UNLOCK(unit);
  18818     return (rv);
  18819 }
  18820 
  18821 
  18822 /*
  18823  * Function:
  18824  *      bcm_esw_field_data_qualifier_ip_protocol_delete
  18825  * Purpose:
  18826  *      Remove ip protocol based offset from data qualifier object. 
  18827  * Parameters:
  18828  *      unit        - (IN) bcm device.
  18829  *      qual_id     - (IN) Data qualifier id.
  18830  *      ip_protocol - (IN) Ethertype based offset specification.                 
  18831  * Returns:
  18832  *      BCM_E_XXX
  18833  */
  18834 int
  18835 bcm_esw_field_data_qualifier_ip_protocol_delete(int unit, int qual_id,
  18836                                  bcm_field_data_ip_protocol_t *ip_protocol)
  18837 {
  18838     _field_control_t  *fc;             /* Field control structure.  */
  18839     int               rv = BCM_E_NONE; /* Operation return status.  */
  18840 
  18841     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18842        return BCM_E_UNAVAIL;
  18843     }
  18844 
  18845     /* Input parameters check. */
  18846     if (NULL == ip_protocol) {
  18847         return (BCM_E_PARAM);
  18848     }
  18849     
  18850     FP_LOCK(unit);
  18851     rv = _field_control_get(unit, &fc);
  18852     if (BCM_FAILURE(rv)) {
  18853         FP_UNLOCK(unit);
  18854         return rv;
  18855     }
  18856 
  18857     rv = fc->functions.fp_data_qualifier_ip_protocol_delete(unit, qual_id, 
  18858                                                             ip_protocol); 
  18859     FP_UNLOCK(unit);
  18860     return (rv);
  18861 }
  18862 
  18863 /*
  18864  * Function:
  18865  *      bcm_esw_field_data_qualifier_packet_format_add
  18866  * Purpose:
  18867  *      Add packet format based offset to data qualifier object.
  18868  * Parameters:
  18869  *      unit          - (IN) bcm device.
  18870  *      qual_id       - (IN) Data qualifier id.
  18871  *      packet_format - (IN) Ethertype based offset specification.                 
  18872  * Returns:
  18873  *      BCM_E_XXX
  18874  */
  18875 int
  18876 bcm_esw_field_data_qualifier_packet_format_add(int unit, int qual_id,
  18877                                  bcm_field_data_packet_format_t *packet_format)
  18878 {
  18879     _field_control_t          *fc;   /* Field control structure.  */
  18880     int                       rv;    /* Operation return status.  */
  18881 
  18882     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18883        return BCM_E_UNAVAIL;
  18884     }
  18885 
  18886     /* Input parameters check. */
  18887     if (NULL == packet_format) {
  18888         return (BCM_E_PARAM);
  18889     }
  18890 
  18891     /* Relative offset calculation. */
  18892     if (SOC_MEM_FIELD_VALID(unit, FP_UDF_OFFSETm, UDF1_OFFSET4f)) {
  18893         if (0 != packet_format->relative_offset % 2)  {
  18894             return (BCM_E_PARAM);
  18895         }
  18896     } else if (0 != packet_format->relative_offset % 4)  {
  18897         return (BCM_E_PARAM);
  18898     }
  18899 
  18900     
  18901     FP_LOCK(unit);
  18902     rv = _field_control_get(unit, &fc);
  18903     if (BCM_FAILURE(rv)) {
  18904         FP_UNLOCK(unit);
  18905         return rv;
  18906     }
  18907 
  18908     rv = fc->functions.fp_data_qualifier_packet_format_add(unit, qual_id, 
  18909                                                            packet_format);
  18910 
  18911     FP_UNLOCK(unit);
  18912     return (rv);
  18913 }
  18914 
  18915 /*
  18916  * Function:
  18917  *      bcm_esw_field_data_qualifier_packet_format_delete
  18918  * Purpose:
  18919  *      Remove packet format based offset from data qualifier object. 
  18920  * Parameters:
  18921  *      unit           - (IN) bcm device.
  18922  *      qual_id        - (IN) Data qualifier id.
  18923  *      packet_format  - (IN) Ethertype based offset specification.                 
  18924  * Returns:
  18925  *      BCM_E_XXX
  18926  */
  18927 int
  18928 bcm_esw_field_data_qualifier_packet_format_delete(int unit, int qual_id,
  18929                                  bcm_field_data_packet_format_t *packet_format)
  18930 {
  18931     _field_control_t           *fc;   /* Field control structure.  */
  18932     int                        rv;    /* Operation return status.  */
  18933 
  18934     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  18935        return BCM_E_UNAVAIL;
  18936     }
  18937 
  18938     /* Input parameters check. */
  18939     if (NULL == packet_format) {
  18940         return (BCM_E_PARAM);
  18941     }
  18942     
  18943     FP_LOCK(unit);
  18944     rv = _field_control_get(unit, &fc);
  18945     if (BCM_FAILURE(rv)) {
  18946         FP_UNLOCK(unit);
  18947         return rv;
  18948     }
  18949 
  18950     rv = fc->functions.fp_data_qualifier_packet_format_delete(unit, qual_id, 
  18951                                                               packet_format);
  18952 
  18953     FP_UNLOCK(unit);
  18954     return (rv);
  18955 }
  18956 
  18957 /*
  18958  * Function:
  18959  *      bcm_esw_field_qualify_data_get
  18960  * Purpose:
  18961  *      Get data/mask in the search engine for entry field data qualifier.
  18962  * Parameters:
  18963  *      unit          - (IN) bcm device.
  18964  *      eid           - (IN) Entry id. 
  18965  *      qual_id       - (IN) Data qualifier id.
  18966  *      length_max    - (IN) Length of data & mask arrays.
  18967  *      data          - (OUT) Match data.
  18968  *      mask          - (OUT) Match mask.
  18969  *      length        - (OUT) Length of data & mask arrays.
  18970  * Returns:
  18971  *      BCM_E_XXX
  18972  */
  18973 int
  18974 bcm_esw_field_qualify_data_get(int unit, bcm_field_entry_t eid, int qual_id,
  18975                                uint16 length_max,  uint8 *data, uint8 *mask,
  18976                                uint16 *length)
  18977 {
  18978     _field_stage_t          *stage_fc;  /* Stage field control.       */
  18979     _field_data_qualifier_t *f_dq;      /* Data qualifier descriptor. */
  18980     _field_entry_t          *f_ent = NULL;
  18981     _field_group_t          *fg;
  18982     bcm_field_qset_t        *qset; 
  18983     int  num_elems = 0;
  18984     int  qualifier_id = 0;
  18985     int idx;        /* HW bitmap iteration index. */
  18986     int rv;         /* Operation return status.   */
  18987     int copy_len;
  18988     int len = 0;
  18989     int off = 0;
  18990     int max_elems = 0;
  18991     int min_elems = 0;
  18992     int udf1_elems = 0; /* elements in UDF1 */
  18993     int udf2_elems = 0; /* elements in UDF2 */
  18994     _bcm_field_qual_data_t udf_data; /* UDF full data */
  18995     _bcm_field_qual_data_t udf_mask; /* UDF mask for full data */
  18996     _bcm_field_qual_data_t udf_data1; /* UDF full data */
  18997     _bcm_field_qual_data_t udf_mask1; /* UDF mask for full data */
  18998 #ifdef LE_HOST
  18999     _bcm_field_qual_data_t udf_data_swap; /* UDF full data */
  19000     _bcm_field_qual_data_t udf_mask_swap; /* UDF mask for full data */
  19001     int part = 0;
  19002 #endif /* LE_HOST */
  19003     /* Input parameters check. */
  19004     if ((NULL == data) || (NULL == mask) || 
  19005             (NULL == length) || (length_max == 0)) {
  19006         return (BCM_E_PARAM);
  19007     }
  19008 
  19009     if (soc_feature(unit, soc_feature_no_fp_data_qual_api_support)) {
  19010        return BCM_E_UNAVAIL;
  19011     }
  19012 
  19013     FP_LOCK(unit);
  19014 
  19015     /* Get stage field control structure. */
  19016     rv = _field_stage_control_get(unit, _BCM_FIELD_STAGE_INGRESS, &stage_fc);
  19017     if (BCM_FAILURE(rv)) {
  19018         FP_UNLOCK(unit);
  19019         return (rv);
  19020     }
  19021 
  19022     /* Get data qualifier info. */
  19023     rv = _bcm_field_data_qualifier_get(unit, stage_fc, qual_id,  &f_dq);
  19024     if (BCM_FAILURE(rv)) {
  19025         FP_UNLOCK(unit);
  19026         return (rv);
  19027     }
  19028 
  19029 #if defined(BCM_TOMAHAWK_SUPPORT)
  19030     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  19031         FP_UNLOCK(unit);
  19032         rv = _bcm_field_th_field_qualify_data_get(unit, eid, qual_id,
  19033                 length_max, data, mask, length);
  19034         return (rv);
  19035     }
  19036 #endif
  19037     /*
  19038      * If provided entry data length is less than data length used
  19039      * to create qualifier then return error
  19040      */
  19041 
  19042     if (length_max < f_dq->length) {
  19043         FP_UNLOCK(unit);
  19044         return (BCM_E_PARAM);
  19045     }
  19046 
  19047     rv = _bcm_field_entry_get_by_id(unit, eid, &f_ent);
  19048     if (BCM_FAILURE(rv)) {
  19049         FP_UNLOCK(unit);
  19050         return (rv);
  19051     }
  19052 
  19053     /* Get field group */
  19054     fg = f_ent->group;
  19055 
  19056     /* get qset */
  19057     qset = &(fg->qset);
  19058 
  19059     /* Get number of elems per UDF and elem size */
  19060     num_elems = stage_fc->data_ctrl->num_elems;
  19061 
  19062     for (idx = 0; idx < num_elems; idx++) {
  19063         if (!(f_dq->hw_bmap & (1 << idx))) {
  19064             continue;
  19065         }
  19066         udf1_elems++;
  19067     }
  19068 
  19069     for (idx = num_elems; idx < num_elems*2; idx++) {
  19070         if (!(f_dq->hw_bmap & (1 << idx))) {
  19071             continue;
  19072         }
  19073         udf2_elems++;
  19074     }
  19075 
  19076     if (udf1_elems != 0) {
  19077         qualifier_id = _bcmFieldQualifyData0;
  19078         max_elems = stage_fc->data_ctrl->num_elems;
  19079         min_elems = 0;
  19080     } else if (udf2_elems != 0) {
  19081         qualifier_id = _bcmFieldQualifyData1;
  19082         max_elems = stage_fc->data_ctrl->num_elems*2;
  19083         min_elems = stage_fc->data_ctrl->num_elems;
  19084     }
  19085 
  19086     do {
  19087         /* Qset has Data2 Data3 instead of Data0 qualifier */
  19088         if ((qualifier_id == _bcmFieldQualifyData0) &&
  19089                 (!BCM_FIELD_QSET_TEST_INTERNAL(*qset, _bcmFieldQualifyData0))) {
  19090             sal_memset(udf_data, 0, sizeof(_bcm_field_qual_data_t));
  19091             sal_memset(udf_mask, 0, sizeof(_bcm_field_qual_data_t));
  19092             if (BCM_FIELD_QSET_TEST_INTERNAL(*qset, _bcmFieldQualifyData2)) {
  19093                 rv = _field_entry_qualifier_key_get(unit, eid, _bcmFieldQualifyData2,
  19094                         udf_data1, udf_mask1);
  19095                 if (BCM_FAILURE(rv)) {
  19096                     FP_UNLOCK(unit);
  19097                     return (rv);
  19098                 }
  19099                 udf_data[0] = udf_data1[0];
  19100                 udf_mask[0] = udf_mask1[0];
  19101             }
  19102             if (BCM_FIELD_QSET_TEST_INTERNAL(*qset, _bcmFieldQualifyData3)) {
  19103                 rv = _field_entry_qualifier_key_get(unit, eid, _bcmFieldQualifyData3,
  19104                         udf_data1, udf_mask1);
  19105                 if (BCM_FAILURE(rv)) {
  19106                     FP_UNLOCK(unit);
  19107                     return (rv);
  19108                 }
  19109                 udf_data[2] = udf_data1[0];
  19110                 udf_mask[2] = udf_mask1[0];
  19111             }
  19112         } else {
  19113             rv = _field_entry_qualifier_key_get(unit, eid, qualifier_id,
  19114                     udf_data, udf_mask);
  19115             if (BCM_FAILURE(rv)) {
  19116                 FP_UNLOCK(unit);
  19117                 return (rv);
  19118             }
  19119         }
  19120 #ifdef LE_HOST
  19121         for (part = 0; part <= BCM_FIELD_USER_MAX_USER_NUM; part++) {
  19122             udf_data_swap[part]= _shr_swap32(udf_data[part]);
  19123             udf_data[part]= udf_data_swap[part];
  19124             udf_mask_swap[part]= _shr_swap32(udf_mask[part]);
  19125             udf_mask[part]= udf_mask_swap[part];
  19126         }
  19127 #endif /* LE_HOST */
  19128 
  19129         for (idx = min_elems; idx < max_elems; idx++) {
  19130             if (!(f_dq->hw_bmap & (1 << idx))) {
  19131                 continue;
  19132             }
  19133 
  19134             if ((f_dq->length - len) <= 0) {
  19135                 break;
  19136             }
  19137 
  19138             if (stage_fc->data_ctrl->elem_size == 2) {
  19139                 /*
  19140                  * Retreive the relevant data and mask from 4 words
  19141                  * (4 * 4 = 16 bytes) of data and mask.
  19142                  * For each index set  a chunk(2 bytes) are read. The way
  19143                  * information is organized is for different index values
  19144                  * data resides in following location.
  19145                  * index = 0 data in 12,13 - W = 3 offset = 0
  19146                  * index = 1 data in 14,15 - W = 3 offset = 2
  19147                  * index = 2 data in 8,9   - W = 2 offset = 0
  19148                  * index = 3 data in 10,11 - W = 2 offset = 2
  19149                  * index = 4 data in 4,5   - W = 1 offset = 0
  19150                  * index = 5 data in 6,7   - W = 1 offset = 2
  19151                  * index = 6 data is 0,1   - W = 0 offset = 0
  19152                  * index = 7 data is 2,3   - W = 0 offset = 2
  19153                  */
  19154                 off = idx % 2 * 2;
  19155                 copy_len = ((f_dq->length - len) == 1)? 1 : 2;
  19156                 if (len == 0) {
  19157                     off += f_dq->byte_offset;
  19158                     copy_len = 2 - f_dq->byte_offset;
  19159                     if (copy_len > f_dq->length) {
  19160                         copy_len = f_dq->length;
  19161                     }
  19162                 }
  19163                 sal_memcpy(data+len,
  19164                         (uint8 *)&udf_data[((max_elems - 1)
  19165                             - idx)/2]+off, copy_len);
  19166                 sal_memcpy(mask+len,
  19167                         (uint8 *)&udf_mask[((max_elems - 1)
  19168                             - idx)/2]+off, copy_len);
  19169                 len += copy_len;
  19170             } else if (stage_fc->data_ctrl->elem_size == 4) {
  19171                 /*
  19172                  * Retreive the relevant data and mask from 4 words
  19173                  * (4 * 4 = 16 bytes) of data and mask.
  19174                  * For each index set  a chunk(4 bytes) are read. The way
  19175                  * information is organized is for different index values
  19176                  * data resides in following location.
  19177                  * index = 0 data in 12,13,14,15 - W = 3 offset = 0
  19178                  * index = 1 data in 8,9,10,11   - W = 2 offset = 0
  19179                  * index = 2 data in 4,5,6,7     - W = 1 offset = 0
  19180                  * index = 3 data is 0,1,2,3     - W = 0 offset = 0
  19181                  *
  19182                  * If the data offset in first UDF is not zero,
  19183                  * the location should be shifted.
  19184                  * For example :
  19185                  * index = 0 data in 10,11,12,13 - W = 3 offset = 2
  19186                  * index = 1 data in 6,7,8,9   - W = 2 offset = 2
  19187                  * index = 2 data in 2,3,4,5     - W = 1 offset = 2
  19188                  * index = 3 data is X,X, 0,1     - W = 0 offset = 2
  19189                  */
  19190                 off = f_dq->byte_offset;
  19191                 if (len == 0) {
  19192                     /* first word */
  19193                     copy_len = 4 - off;
  19194                     /* Only one word */
  19195                     if (copy_len > f_dq->length) {
  19196                         copy_len = f_dq->length;
  19197                     }
  19198                     sal_memcpy(data+len,
  19199                             (uint8 *)&udf_data[(max_elems - 1) - idx] + off,
  19200                             copy_len);
  19201                     sal_memcpy(mask+len,
  19202                             (uint8 *)&udf_mask[(max_elems - 1) - idx] + off,
  19203                             copy_len);
  19204                     len += copy_len;
  19205                 } else if ((len + 4) > f_dq->length) {
  19206                     /* last word */
  19207                     sal_memcpy(data+len,
  19208                             (uint8 *)&udf_data[(max_elems - 1) - idx],
  19209                             (f_dq->length - len));
  19210                     sal_memcpy(mask+len,
  19211                             (uint8 *)&udf_mask[(max_elems - 1) - idx],
  19212                             (f_dq->length - len));
  19213                     len += (f_dq->length - len);
  19214                 } else {
  19215                     /* others */
  19216                     sal_memcpy(data+len,
  19217                             (uint8 *)&udf_data[(max_elems - 1) - idx], 4);
  19218                     sal_memcpy(mask+len,
  19219                             (uint8 *)&udf_mask[(max_elems - 1) - idx], 4);
  19220                     len += 4;
  19221                 }
  19222             } else {
  19223                 FP_UNLOCK(unit);
  19224                 return (BCM_E_INTERNAL);
  19225             }
  19226         }
  19227 
  19228         if ((qualifier_id == _bcmFieldQualifyData0) && (udf2_elems != 0)) {
  19229             qualifier_id = _bcmFieldQualifyData1;
  19230             max_elems = stage_fc->data_ctrl->num_elems*2;
  19231             min_elems = stage_fc->data_ctrl->num_elems;
  19232             continue;
  19233         }
  19234         *length = f_dq->length;
  19235         break;
  19236     } while (1);
  19237 
  19238     FP_UNLOCK(unit);
  19239     return rv;
  19240 }
  19241 
  19242 /*
  19243  * Function:
  19244  *      bcm_esw_field_qualify_LoopbackType_get
  19245  * Purpose:
  19246  *      Get loopback type field qualification from a field entry.
  19247  * Parameters:
  19248  *      unit - (IN) Unit number.
  19249  *      entry - (IN) Field entry id.
  19250  *      loopback_type - (OUT) Loopback type.
  19251  * Returns:
  19252  *      BCM_E_XXX
  19253  * Notes:
  19254  */
  19255 int 
  19256 bcm_esw_field_qualify_LoopbackType_get(int unit, 
  19257                                        bcm_field_entry_t entry, 
  19258                                        bcm_field_LoopbackType_t *loopback_type)
  19259 {
  19260     uint8            data; /* HW data match criteria.  */
  19261     uint8            mask; /* HW data mask.            */
  19262     int              rv;   /* Operation return status. */
  19263 
  19264     /* Input parameters check. */
  19265     if (NULL == loopback_type) {
  19266         return (BCM_E_PARAM);
  19267     }
  19268 
  19269     /* Read qualifier match value and mask. */
  19270     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  19271                                           bcmFieldQualifyLoopbackType,
  19272                                           &data, &mask);
  19273     BCM_IF_ERROR_RETURN(rv);
  19274 
  19275     if (mask == 0) {
  19276         return BCM_E_NOT_FOUND;
  19277     }
  19278 
  19279 #ifdef BCM_TRIDENT2_SUPPORT
  19280     if (SOC_IS_TD2_TT2(unit)) {
  19281 #if defined(BCM_TOMAHAWK_SUPPORT)
  19282         _field_entry_t *f_ent;  /* Field entry structure.   */
  19283         uint8 presel_entry = 0;
  19284 
  19285         if (soc_feature(unit, soc_feature_field_preselector_support) &&
  19286                         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
  19287             presel_entry = 1;
  19288         } else {
  19289             /* Get field entry part that contains the qualifier. */
  19290             rv = _bcm_field_entry_qual_get(unit, entry, bcmFieldQualifyLoopbackType, &f_ent);
  19291             BCM_IF_ERROR_RETURN(rv);
  19292         } 
  19293 
  19294 #if defined(BCM_TOMAHAWK3_SUPPORT)
  19295         if (soc_feature(unit, soc_feature_fp_no_dvp_support)) {
  19296             return (_bcm_field_th3_qualify_LoopbackType_get(data, mask, loopback_type));
  19297         } else
  19298 #endif
  19299 
  19300 #if defined(BCM_TRIDENT3_SUPPORT)
  19301         if (soc_feature(unit, soc_feature_td3_style_fp) &&
  19302             ((presel_entry == 1) || (f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS))) {
  19303             return (_bcm_field_td3_qualify_LoopbackType_get(data, mask, loopback_type));
  19304         } else
  19305 #endif
  19306         if (presel_entry == 1) {
  19307            return BCM_E_PARAM;
  19308         }
  19309 
  19310         if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  19311                 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS)) {
  19312             /*Loopback Type encoding in Tomahawk Egress is different from TD2.*/
  19313             return (_bcm_field_th_qualify_LoopbackType_get(data, mask, loopback_type)); 
  19314         }
  19315         else
  19316 #endif
  19317         {
  19318             return (_bcm_field_td2_qualify_LoopbackType_get(data, mask, loopback_type));
  19319         }
  19320     }
  19321 #endif /* BCM_TRIDENT2_SUPPORT */
  19322 #ifdef BCM_TRIUMPH3_SUPPORT
  19323     if (SOC_IS_TRIUMPH3(unit)) {
  19324         return (_bcm_field_tr3_qualify_LoopbackType_get(data, mask, loopback_type));
  19325     }
  19326 #endif
  19327 
  19328     switch (data) {
  19329       case 0x8:
  19330           *loopback_type = bcmFieldLoopbackTypeAny;
  19331           break;
  19332       case 0x9:
  19333 #ifdef BCM_KATANA2_SUPPORT
  19334           if (SOC_IS_KATANA2(unit)) {
  19335               *loopback_type = bcmFieldLoopbackTypeMirror;
  19336           } else
  19337 #endif /* BCM_KATANA2_SUPPORT */
  19338           {
  19339               *loopback_type = bcmFieldLoopbackTypeRedirect;
  19340           }
  19341           break;
  19342 #ifdef BCM_KATANA2_SUPPORT
  19343       case 0xa:
  19344           if (SOC_IS_KATANA2(unit)) {
  19345               *loopback_type = bcmFieldLoopbackTypeRedirect;
  19346           } else {
  19347               return (BCM_E_INTERNAL);
  19348           }
  19349           break;
  19350 #endif /* BCM_KATANA2_SUPPORT */
  19351       case 0xb:
  19352           *loopback_type = bcmFieldLoopbackTypeMim;
  19353           break;
  19354       case 0xc:
  19355 #ifdef BCM_TRIDENT_SUPPORT
  19356           if (SOC_IS_TD_TT(unit) || SOC_IS_KATANA(unit)) {
  19357               *loopback_type = bcmFieldLoopbackTypeTrillNetwork;
  19358           } else 
  19359 #endif /* BCM_TRIDENT_SUPPORT */
  19360           {
  19361               *loopback_type = bcmFieldLoopbackTypeWlan;
  19362           }
  19363           break;
  19364 #ifdef BCM_TRIDENT_SUPPORT
  19365       case 0xd:
  19366           if (SOC_IS_TD_TT(unit) || SOC_IS_KATANA(unit)) {
  19367               *loopback_type = bcmFieldLoopbackTypeTrillAccess;
  19368           } 
  19369           break;
  19370 #endif /* BCM_TRIDENT_SUPPORT */
  19371       case 0xe:
  19372           {
  19373               *loopback_type = bcmFieldLoopbackTypeMirror;
  19374           }
  19375           break;
  19376       default:
  19377           return (BCM_E_INTERNAL);
  19378     }
  19379     return BCM_E_NONE; 
  19380 }
  19381 
  19382 /*
  19383  * Function:
  19384  *      bcm_esw_field_qualify_TunnelType_get
  19385  * Purpose:
  19386  *      Get tunnel type field qualification from a field entry.
  19387  * Parameters:
  19388  *      unit - (IN) Unit number.
  19389  *      entry - (IN) Field entry id.
  19390  *      tunnel_type - (OUT) Tunnel type.
  19391  * Returns:
  19392  *      BCM_E_XXX
  19393  * Notes:
  19394  */
  19395 int 
  19396 bcm_esw_field_qualify_TunnelType_get(
  19397     int unit, 
  19398     bcm_field_entry_t entry, 
  19399     bcm_field_TunnelType_t *tunnel_type)
  19400 {
  19401     uint8            data; /* HW data match criteria.  */
  19402     uint8            mask; /* HW data mask.            */
  19403     int              rv;   /* Operation return status. */
  19404 
  19405     /* Input parameters check. */
  19406     if (NULL == tunnel_type) {
  19407         return (BCM_E_PARAM);
  19408     }
  19409 
  19410     /* Read qualifier match value and mask. */
  19411     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  19412                                           bcmFieldQualifyTunnelType,
  19413                                           &data, &mask);
  19414     BCM_IF_ERROR_RETURN(rv);
  19415 
  19416 #if defined(BCM_TRIDENT3_SUPPORT)
  19417     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  19418         return (_bcm_field_td3_qualify_TunnelType_get(unit, data, mask, tunnel_type));
  19419     }
  19420 #endif /* BCM_TRIDENT3_SUPPORT */
  19421 #if defined(BCM_TOMAHAWK3_SUPPORT)
  19422     if (soc_feature(unit, soc_feature_fp_no_dvp_support)) {
  19423         return (_bcm_field_th3_qualify_TunnelType_get(data, mask, tunnel_type));
  19424     }
  19425 #endif /* BCM_TOMAHAWK3_SUPPORT */
  19426 #ifdef BCM_TRIDENT2_SUPPORT
  19427     if (SOC_IS_TD2_TT2(unit)) {
  19428         return (_bcm_field_td2_qualify_TunnelType_get(data, mask, tunnel_type));
  19429     }
  19430 #endif /* BCM_TRIDENT2_SUPPORT */
  19431 #ifdef BCM_TRIUMPH3_SUPPORT
  19432     if (SOC_IS_TRIUMPH3(unit)) {
  19433         return (_bcm_field_tr3_qualify_TunnelType_get(data, mask, tunnel_type));
  19434     }
  19435 #endif
  19436 
  19437     switch (data) {
  19438       case 0x1:
  19439           *tunnel_type = bcmFieldTunnelTypeIp;
  19440           break;
  19441       case 0x2:
  19442           *tunnel_type = bcmFieldTunnelTypeMpls;
  19443           break;
  19444       case 0x3:
  19445           *tunnel_type = bcmFieldTunnelTypeMim;
  19446           break;
  19447       case 0x4:
  19448           *tunnel_type = bcmFieldTunnelTypeWlanWtpToAc;
  19449           break;
  19450       case 0x5:
  19451           *tunnel_type = bcmFieldTunnelTypeWlanAcToAc;
  19452           break;
  19453       case 0x6:
  19454           *tunnel_type = bcmFieldTunnelTypeAutoMulticast;
  19455           break;
  19456       case 0x7:
  19457           *tunnel_type = bcmFieldTunnelTypeTrill;
  19458           break;
  19459       case 0x0:
  19460           if(mask) {
  19461               *tunnel_type = bcmFieldTunnelTypeNone;
  19462               break;
  19463           }
  19464       default:
  19465           return (BCM_E_INTERNAL);
  19466     }
  19467     return BCM_E_NONE; 
  19468 }
  19469 
  19470 /*
  19471  * Function:
  19472  *      bcm_esw_field_qualify_DstL3Egress_get
  19473  * Purpose:
  19474  *      Get match criteria for bcmFieildQualifyDstL3Egress
  19475  *                     qualifier from the field entry.
  19476  * Parameters:
  19477  *      unit - (IN) Unit number.
  19478  *      entry - (IN) BCM field entry id.
  19479  *      if_id - (OUT) L3 forwarding object.
  19480  * Returns:
  19481  *      BCM_E_XXX
  19482  * Notes:
  19483  */
  19484 int 
  19485 bcm_esw_field_qualify_DstL3Egress_get(int unit, bcm_field_entry_t entry, 
  19486                                       bcm_if_t *if_id)
  19487 {
  19488     int               rv = BCM_E_UNAVAIL;  /* Operation return status. */
  19489 #if defined(INCLUDE_L3)
  19490     uint32            data; /* HW data match criteria.  */
  19491     uint32            mask; /* HW data mask.            */
  19492 
  19493     /* Input parameters check. */
  19494     if (NULL == if_id) {
  19495         return (BCM_E_PARAM);
  19496     }
  19497 
  19498     /* Read qualifier match value and mask. */ 
  19499     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  19500                                            bcmFieldQualifyDstL3Egress,
  19501                                            &data, &mask);
  19502     BCM_IF_ERROR_RETURN(rv);
  19503 
  19504     if (mask == 0) {
  19505         return BCM_E_NOT_FOUND;
  19506     }
  19507 
  19508     BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  19509         entry, bcmFieldQualifyDstL3Egress, &data, &mask));
  19510 
  19511     *if_id = data + BCM_XGS3_EGRESS_IDX_MIN(unit);
  19512 #endif /* INCLUDE_L3 */
  19513     return (rv);
  19514 }
  19515 
  19516 /*
  19517  * Function:
  19518  *      bcm_esw_field_qualify_DstMulticastGroup_get
  19519  * Purpose:
  19520  *      Get match criteria for bcmFieildQualifyDstMulticastGroup
  19521  *                     qualifier from the field entry.
  19522  * Parameters:
  19523  *      unit - (IN) Unit number.
  19524  *      entry - (IN) BCM field entry id.
  19525  *      group - (OUT) Multicast group id.
  19526  * Returns:
  19527  *      BCM_E_XXX
  19528  * Notes:
  19529  */
  19530 int 
  19531 bcm_esw_field_qualify_DstMulticastGroup_get(int unit, 
  19532                                             bcm_field_entry_t entry, 
  19533                                             bcm_multicast_t *group)
  19534 {
  19535     uint32 data;   /* HW encoded qualifier data.  */
  19536     uint32 mask;   /* HW encoding qualifier mask. */
  19537     int rv;        /* Operation return status.    */
  19538     uint8 mc_grptype_data; /* Multicast Group Type */
  19539 
  19540     /* Read qualifier match value and mask. */ 
  19541     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  19542                                             bcmFieldQualifyDstMulticastGroup,
  19543                                             &data, &mask);
  19544     BCM_IF_ERROR_RETURN(rv);
  19545 
  19546     if (mask == 0) {
  19547         return BCM_E_NOT_FOUND;
  19548     }
  19549 
  19550     /* Get Multicast group type info */
  19551     mc_grptype_data = data >> _FP_MCAST_D_TYPE_OFFSET(unit);
  19552 
  19553     BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  19554         entry, bcmFieldQualifyDstMulticastGroup, &data, &mask));
  19555 
  19556     if (_bcmFieldDestTypeL2mc == mc_grptype_data) {
  19557         /* L2 MC */
  19558         _BCM_MULTICAST_GROUP_SET(*group, _BCM_MULTICAST_TYPE_L2, data);
  19559     } else if (_bcmFieldDestTypeL3mc == mc_grptype_data)  {
  19560         /* IPMC */
  19561         _BCM_MULTICAST_GROUP_SET(*group, _BCM_MULTICAST_TYPE_L3, data);
  19562     } else {
  19563         return (BCM_E_INTERNAL);
  19564     }
  19565     return BCM_E_NONE; 
  19566 }
  19567 
  19568 /*
  19569  * Function:
  19570  *      bcm_esw_field_qualify_SrcMplsGport_get
  19571  * Purpose:
  19572  *      Get match criteria for bcmFieildQualifySrcMplsGport
  19573  *                     qualifier from the field entry.
  19574  * Parameters:
  19575  *      unit - (IN) Unit number.
  19576  *      entry - (IN) BCM field entry id.
  19577  *      mpls_port_id - (OUT) Mpls port id.
  19578  * Returns:
  19579  *      BCM_E_XXX
  19580  * Notes:
  19581  */
  19582 int 
  19583 bcm_esw_field_qualify_SrcMplsGport_get(int unit, 
  19584                                        bcm_field_entry_t entry,
  19585                                        bcm_gport_t *mpls_port_id)
  19586 {
  19587     uint32 data;   /* HW encoded qualifier data.  */
  19588     uint32 mask;   /* HW encoding qualifier mask. */
  19589     int rv;        /* Operation return status.    */
  19590 
  19591     /* Input parameters check. */
  19592     if (NULL == mpls_port_id) {
  19593         return (BCM_E_PARAM);
  19594     }
  19595 
  19596     /* Read qualifier match value and mask. */ 
  19597     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  19598                                            bcmFieldQualifySrcMplsGport,
  19599                                            &data, &mask);
  19600     BCM_IF_ERROR_RETURN(rv);
  19601 
  19602     if (mask == 0) {
  19603         return BCM_E_NOT_FOUND;
  19604     }
  19605 
  19606     data &=  0x1fff;
  19607     BCM_GPORT_MPLS_PORT_ID_SET(*mpls_port_id, data);
  19608 
  19609     return BCM_E_NONE; 
  19610 }
  19611 
  19612 /*
  19613  * Function:
  19614  *      bcm_esw_field_qualify_DstMplsGport_get
  19615  * Purpose:
  19616  *      Get match criteria for bcmFieildQualifyDstMplsGport
  19617  *                     qualifier from the field entry.
  19618  * Parameters:
  19619  *      unit - (IN) Unit number.
  19620  *      entry - (IN) BCM field entry id.
  19621  *      mpls_port_id - (OUT) Mpls port id.
  19622  * Returns:
  19623  *      BCM_E_XXX
  19624  * Notes:
  19625  */
  19626 int 
  19627 bcm_esw_field_qualify_DstMplsGport_get(int unit, 
  19628                                        bcm_field_entry_t entry, 
  19629                                        bcm_gport_t *mpls_port_id)
  19630 {
  19631     uint32 data;   /* HW encoded qualifier data.  */
  19632     uint32 mask;   /* HW encoding qualifier mask. */
  19633     int rv;        /* Operation return status.    */
  19634     _field_entry_t *f_ent; /* Field entry structure. */
  19635 
  19636     /* Input parameters check. */
  19637     if (NULL == mpls_port_id) {
  19638         return (BCM_E_PARAM);
  19639     }
  19640 
  19641     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  19642         bcmFieldQualifyDstMplsGport, &f_ent));
  19643 
  19644     /* Read qualifier match value and mask. */
  19645     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  19646                                             bcmFieldQualifyDstMplsGport,
  19647                                             &data, &mask);
  19648     BCM_IF_ERROR_RETURN(rv);
  19649 
  19650     if (mask == 0) {
  19651         return BCM_E_NOT_FOUND;
  19652     }
  19653 
  19654     /* Check if entry belongs to Egress Stage. */
  19655     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  19656          /* Clear DVP Valid bit. */
  19657          data >>= 1;
  19658     } else {
  19659         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  19660             entry, bcmFieldQualifyDstMplsGport, &data, &mask));
  19661     }
  19662 
  19663     BCM_GPORT_MPLS_PORT_ID_SET(*mpls_port_id, data);
  19664 
  19665     return BCM_E_NONE; 
  19666 }
  19667 
  19668 
  19669 
  19670 /*
  19671  * Function:
  19672  *      bcm_esw_field_qualify_SrcNivGport_get
  19673  * Purpose:
  19674  *      Get match criteria for bcmFieildQualifySrcNivGport
  19675  *                     qualifier from the field entry.
  19676  * Parameters:
  19677  *      unit - (IN) Unit number.
  19678  *      entry - (IN) BCM field entry id.
  19679  *      niv_port_id - (OUT) Niv port id.
  19680  * Returns:
  19681  *      BCM_E_XXX
  19682  * Notes:
  19683  */
  19684 int 
  19685 bcm_esw_field_qualify_SrcNivGport_get(int unit, 
  19686                                        bcm_field_entry_t entry,
  19687                                        bcm_gport_t *niv_port_id)
  19688 {
  19689     uint32 data;   /* HW encoded qualifier data.  */
  19690     uint32 mask;   /* HW encoding qualifier mask. */
  19691     int rv;        /* Operation return status.    */
  19692 
  19693     /* Input parameters check. */
  19694     if (NULL == niv_port_id) {
  19695         return (BCM_E_PARAM);
  19696     }
  19697 
  19698     /* Read qualifier match value and mask. */ 
  19699     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  19700                                            bcmFieldQualifySrcNivGport,
  19701                                            &data, &mask);
  19702     BCM_IF_ERROR_RETURN(rv);
  19703 
  19704     if (mask == 0) {
  19705         return BCM_E_NOT_FOUND;
  19706     }
  19707 
  19708     data &=  0x1fff;
  19709     BCM_GPORT_NIV_PORT_ID_SET(*niv_port_id, data);
  19710 
  19711     return BCM_E_NONE; 
  19712 }
  19713 
  19714 /*
  19715  * Function:
  19716  *      bcm_esw_field_qualify_DstNivGport_get
  19717  * Purpose:
  19718  *      Get match criteria for bcmFieildQualifyDstNivGport
  19719  *                     qualifier from the field entry.
  19720  * Parameters:
  19721  *      unit - (IN) Unit number.
  19722  *      entry - (IN) BCM field entry id.
  19723  *      niv_port_id - (OUT) Niv port id.
  19724  * Returns:
  19725  *      BCM_E_XXX
  19726  * Notes:
  19727  */
  19728 int 
  19729 bcm_esw_field_qualify_DstNivGport_get(int unit, 
  19730                                        bcm_field_entry_t entry, 
  19731                                        bcm_gport_t *niv_port_id)
  19732 {
  19733     uint32 data;   /* HW encoded qualifier data.  */
  19734     uint32 mask;   /* HW encoding qualifier mask. */
  19735     int rv;        /* Operation return status.    */
  19736     _field_entry_t *f_ent; /* Field entry structure. */
  19737 
  19738     /* Input parameters check. */
  19739     if (NULL == niv_port_id) {
  19740         return (BCM_E_PARAM);
  19741     }
  19742 
  19743     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  19744         bcmFieldQualifyDstNivGport, &f_ent));
  19745 
  19746     /* Read qualifier match value and mask. */
  19747     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  19748                                             bcmFieldQualifyDstNivGport,
  19749                                             &data, &mask);
  19750     BCM_IF_ERROR_RETURN(rv);
  19751 
  19752     if (mask == 0) {
  19753         return BCM_E_NOT_FOUND;
  19754     }
  19755 
  19756     /* Check if entry belongs to Egress Stage. */
  19757     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  19758          /* Clear DVP Valid bit. */
  19759          data >>= 1;
  19760     } else {
  19761         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  19762             entry, bcmFieldQualifyDstNivGport, &data, &mask));
  19763     }
  19764 
  19765     BCM_GPORT_NIV_PORT_ID_SET(*niv_port_id, data);
  19766 
  19767     return BCM_E_NONE; 
  19768 }
  19769 
  19770 /*
  19771  * Function:
  19772  *      bcm_esw_field_qualify_SrcMimGport_get
  19773  * Purpose:
  19774  *      Get match criteria for bcmFieildQualifySrcMimGport
  19775  *                     qualifier from the field entry.
  19776  * Parameters:
  19777  *      unit - (IN) Unit number.
  19778  *      entry - (IN) BCM field entry id.
  19779  *      mim_port_id - (OUT) Mim port id.
  19780  * Returns:
  19781  *      BCM_E_XXX
  19782  * Notes:
  19783  */
  19784 int 
  19785 bcm_esw_field_qualify_SrcMimGport_get(int unit, 
  19786                                       bcm_field_entry_t entry, 
  19787                                       bcm_gport_t *mim_port_id)
  19788 {
  19789     uint32 data;   /* HW encoded qualifier data.  */
  19790     uint32 mask;   /* HW encoding qualifier mask. */
  19791     int rv;        /* Operation return status.    */
  19792 
  19793     /* Input parameters check. */
  19794     if (NULL == mim_port_id) {
  19795         return (BCM_E_PARAM);
  19796     }
  19797 
  19798     /* Read qualifier match value and mask. */ 
  19799     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  19800                                             bcmFieldQualifySrcMimGport,
  19801                                             &data, &mask);
  19802     BCM_IF_ERROR_RETURN(rv);
  19803 
  19804     if (mask == 0) {
  19805         return BCM_E_NOT_FOUND;
  19806     }
  19807 
  19808     data &= 0x1fff;
  19809     BCM_GPORT_MIM_PORT_ID_SET(*mim_port_id, data);
  19810 
  19811     return BCM_E_NONE; 
  19812 }
  19813 
  19814 /*
  19815  * Function:
  19816  *      bcm_esw_field_qualify_DstMimGport_get
  19817  * Purpose:
  19818  *      Get match criteria for bcmFieildQualifyDstMimGport
  19819  *                     qualifier from the field entry.
  19820  * Parameters:
  19821  *      unit - (IN) Unit number.
  19822  *      entry - (IN) BCM field entry id.
  19823  *      mim_port_id - (OUT) Mim port id.
  19824  * Returns:
  19825  *      BCM_E_XXX
  19826  * Notes:
  19827  */
  19828 int 
  19829 bcm_esw_field_qualify_DstMimGport_get(int unit, 
  19830                                       bcm_field_entry_t entry, 
  19831                                       bcm_gport_t *mim_port_id)
  19832 {
  19833     uint32 data;   /* HW encoded qualifier data.  */
  19834     uint32 mask;   /* HW encoding qualifier mask. */
  19835     int rv;        /* Operation return status.    */
  19836     _field_entry_t *f_ent; /* Field entry structure. */
  19837 
  19838     /* Input parameters check. */
  19839     if (NULL == mim_port_id) {
  19840         return (BCM_E_PARAM);
  19841     }
  19842 
  19843     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  19844             bcmFieldQualifyDstMimGport, &f_ent));
  19845 
  19846     /* Read qualifier match value and mask. */
  19847     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  19848             bcmFieldQualifyDstMimGport, &data, &mask);
  19849     BCM_IF_ERROR_RETURN(rv);
  19850 
  19851     if (mask == 0) {
  19852         return BCM_E_NOT_FOUND;
  19853     }
  19854 
  19855     /* Check if entry belongs to Egress Stage. */
  19856     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  19857         /* Clear DVP Valid bit. */
  19858         data >>= 1;
  19859     } else {
  19860         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  19861             entry, bcmFieldQualifyDstMimGport, &data, &mask));
  19862     }
  19863 
  19864     BCM_GPORT_MIM_PORT_ID_SET(*mim_port_id, data);
  19865 
  19866     return BCM_E_NONE; 
  19867 }
  19868 
  19869 /*
  19870  * Function:
  19871  *      bcm_esw_field_qualify_SrcWlanGport_get
  19872  * Purpose:
  19873  *      Get match criteria for bcmFieildQualifySrcWlanGport
  19874  *                     qualifier from the field entry.
  19875  * Parameters:
  19876  *      unit - (IN) Unit number.
  19877  *      entry - (IN) BCM field entry id.
  19878  *      wlan_port_id - (OUT) Wlan port id.
  19879  * Returns:
  19880  *      BCM_E_XXX
  19881  * Notes:
  19882  */
  19883 int 
  19884 bcm_esw_field_qualify_SrcWlanGport_get(int unit, 
  19885                                        bcm_field_entry_t entry, 
  19886                                        bcm_gport_t *wlan_port_id)
  19887 {
  19888     uint32 data;   /* HW encoded qualifier data.  */
  19889     uint32 mask;   /* HW encoding qualifier mask. */
  19890     int rv;        /* Operation return status.    */
  19891 
  19892     /* Input parameters check. */
  19893     if (NULL == wlan_port_id) {
  19894         return (BCM_E_PARAM);
  19895     }
  19896 
  19897     /* Read qualifier match value and mask. */ 
  19898     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  19899                                            bcmFieldQualifySrcWlanGport,
  19900                                            &data, &mask);
  19901     BCM_IF_ERROR_RETURN(rv);
  19902 
  19903     if (mask == 0) {
  19904         return BCM_E_NOT_FOUND;
  19905     }
  19906 
  19907     data &= 0x1fff;
  19908     BCM_GPORT_WLAN_PORT_ID_SET(*wlan_port_id, data);
  19909 
  19910     return BCM_E_NONE; 
  19911 }
  19912 
  19913 /*
  19914  * Function:
  19915  *      bcm_esw_field_qualify_DstWlanGport_get
  19916  * Purpose:
  19917  *      Get match criteria for bcmFieildQualifyDstWlanGport
  19918  *                     qualifier from the field entry.
  19919  * Parameters:
  19920  *      unit - (IN) Unit number.
  19921  *      entry - (IN) BCM field entry id.
  19922  *      wlan_port_id - (OUT) Wlan port id.
  19923  * Returns:
  19924  *      BCM_E_XXX
  19925  * Notes:
  19926  */
  19927 int 
  19928 bcm_esw_field_qualify_DstWlanGport_get(int unit, 
  19929                                        bcm_field_entry_t entry, 
  19930                                        bcm_gport_t *wlan_port_id)
  19931 {
  19932     uint32 data;   /* HW encoded qualifier data.  */
  19933     uint32 mask;   /* HW encoding qualifier mask. */
  19934     int rv;        /* Operation return status.    */
  19935 
  19936     /* Input parameters check. */
  19937     if (NULL == wlan_port_id) {
  19938         return (BCM_E_PARAM);
  19939     }
  19940 
  19941     /* Read qualifier match value and mask. */
  19942     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  19943                                            bcmFieldQualifyDstWlanGport,
  19944                                            &data, &mask);
  19945     BCM_IF_ERROR_RETURN(rv);
  19946 
  19947     if (mask == 0) {
  19948         return BCM_E_NOT_FOUND;
  19949     }
  19950 
  19951     BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  19952         entry, bcmFieldQualifyDstWlanGport, &data, &mask));
  19953 
  19954     BCM_GPORT_WLAN_PORT_ID_SET(*wlan_port_id, data);
  19955 
  19956     return BCM_E_NONE; 
  19957 }
  19958 
  19959 /*
  19960  * Function:
  19961  *      bcm_esw_field_qualify_SrcVxlanGport_get
  19962  * Purpose:
  19963  *      Get match criteria for bcmFieildQualifySrcVxlanGport
  19964  *                     qualifier from the field entry.
  19965  * Parameters:
  19966  *      unit - (IN) Unit number.
  19967  *      entry - (IN) BCM field entry id.
  19968  *      vxlan_port_id - (OUT) Vxlan port id.
  19969  * Returns:
  19970  *      BCM_E_XXX
  19971  * Notes:
  19972  */
  19973 int
  19974 bcm_esw_field_qualify_SrcVxlanGport_get(int unit,
  19975                                        bcm_field_entry_t entry,
  19976                                        bcm_gport_t *vxlan_port_id)
  19977 {
  19978     uint32 data;   /* HW encoded qualifier data.  */
  19979     uint32 mask;   /* HW encoding qualifier mask. */
  19980     int rv;        /* Operation return status.    */
  19981     _field_entry_t *f_ent = NULL;  /* Field entry structure.   */
  19982 
  19983     /* Input parameters check. */
  19984     if (NULL == vxlan_port_id) {
  19985         return (BCM_E_PARAM);
  19986     }
  19987 
  19988     /* Read qualifier match value and mask. */
  19989     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  19990                                            bcmFieldQualifySrcVxlanGport,
  19991                                            &data, &mask);
  19992     BCM_IF_ERROR_RETURN(rv);
  19993 
  19994     if (mask == 0) {
  19995         return BCM_E_NOT_FOUND;
  19996     }
  19997 
  19998     data &= 0x1fff;
  19999     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  20000             bcmFieldQualifySrcVxlanGport, &f_ent));
  20001 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  20002     switch (f_ent->svp_type) {
  20003         case _bcmVpTypeFlow :
  20004             BCM_GPORT_FLOW_PORT_ID_SET(*vxlan_port_id, data);
  20005             break;
  20006         case _bcmVpTypeVxlan:
  20007             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  20008             break;
  20009         default:
  20010             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  20011     }
  20012 #else
  20013     BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  20014 #endif
  20015 
  20016     return BCM_E_NONE;
  20017 }
  20018 
  20019 /*
  20020  * Function:
  20021  *      bcm_esw_field_qualify_DstVxlanGport_get
  20022  * Purpose:
  20023  *      Get match criteria for bcmFieildQualifyDstVxlanGport
  20024  *                     qualifier from the field entry.
  20025  * Parameters:
  20026  *      unit - (IN) Unit number.
  20027  *      entry - (IN) BCM field entry id.
  20028  *      vxlan_port_id - (OUT) Vxlan port id.
  20029  * Returns:
  20030  *      BCM_E_XXX
  20031  * Notes:
  20032  */
  20033 int
  20034 bcm_esw_field_qualify_DstVxlanGport_get(int unit,
  20035                                        bcm_field_entry_t entry,
  20036                                        bcm_gport_t *vxlan_port_id)
  20037 {
  20038     uint32 data;   /* HW encoded qualifier data.  */
  20039     uint32 mask;   /* HW encoding qualifier mask. */
  20040     int rv;        /* Operation return status.    */
  20041     _field_entry_t *f_ent = NULL;  /* Field entry structure.   */
  20042 
  20043     /* Input parameters check. */
  20044     if (NULL == vxlan_port_id) {
  20045         return (BCM_E_PARAM);
  20046     }
  20047 
  20048     /* Read qualifier match value and mask. */
  20049     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  20050                                            bcmFieldQualifyDstVxlanGport,
  20051                                            &data, &mask);
  20052     BCM_IF_ERROR_RETURN(rv);
  20053 
  20054     if (mask == 0) {
  20055         return BCM_E_NOT_FOUND;
  20056     }
  20057 
  20058     BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  20059         entry, bcmFieldQualifyDstVxlanGport, &data, &mask));
  20060 
  20061     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  20062             bcmFieldQualifyDstVxlanGport, &f_ent));
  20063 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  20064     switch (f_ent->dvp_type) {
  20065         case _bcmVpTypeFlow :
  20066             BCM_GPORT_FLOW_PORT_ID_SET(*vxlan_port_id, data);
  20067             break;
  20068         case _bcmVpTypeVxlan:
  20069             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  20070             break;
  20071         default:
  20072             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  20073     }
  20074 #else
  20075     BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  20076 #endif
  20077 
  20078     return BCM_E_NONE;
  20079 }
  20080 
  20081 /*
  20082  * Function:
  20083  *      bcm_esw_field_qualify_Loopback_get
  20084  * Purpose:
  20085  *      Get loopback field qualification from  a field entry.
  20086  * Parameters:
  20087  *      unit - (IN) Unit number.
  20088  *      entry - (IN) Field entry id.
  20089  *      data - (OUT) Data to qualify with.
  20090  *      mask - (OUT) Qualifier match mask.
  20091  * Returns:
  20092  *      BCM_E_XXX
  20093  * Notes:
  20094  */
  20095 int 
  20096 bcm_esw_field_qualify_Loopback_get(
  20097     int unit, 
  20098     bcm_field_entry_t entry, 
  20099     uint8 *data, 
  20100     uint8 *mask)
  20101 {
  20102     /* Read qualifier match value and mask. */
  20103     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  20104                                             bcmFieldQualifyLoopback,
  20105                                             data, mask);
  20106 }
  20107 
  20108 /*
  20109  * Function:
  20110  *      bcm_esw_field_qualify_InPort_get
  20111  * Purpose:
  20112  *      Get match criteria for bcmFieildQualifyInPort
  20113  *                     qualifier from the field entry.
  20114  * Parameters:
  20115  *      unit - (IN) Unit number.
  20116  *      entry - (IN) BCM field entry id.
  20117  *      data - (OUT) Qualifier match data.
  20118  *      mask - (OUT) Qualifier match mask.
  20119  * Returns:
  20120  *      BCM_E_XXX
  20121  * Notes:
  20122  */
  20123 int 
  20124 bcm_esw_field_qualify_InPort_get(int unit, bcm_field_entry_t entry, 
  20125                                  bcm_port_t *data, bcm_port_t *mask)
  20126 {
  20127     _field_entry_t   *f_ent;              /* Field entry structure.      */
  20128     int              rv;                  /* Operation return status.    */
  20129     int              isGport;             /* Port format is gport.       */
  20130 #if defined(BCM_RAPTOR_SUPPORT) || defined (BCM_TRX_SUPPORT)
  20131     _field_group_t   *fg;                 /* Field group structure.      */
  20132     bcm_port_t       port = 0;            /* Port iterator.              */
  20133 #endif /* BCM_RAPTOR_SUPPORT || BCM_TRX_SUPPORT */
  20134 
  20135     /* Check requested output format. */
  20136     rv = bcm_esw_switch_control_get(unit, bcmSwitchUseGport, &isGport);
  20137     BCM_IF_ERROR_RETURN(rv);
  20138 
  20139     /* Get field control structure. */
  20140     
  20141     FP_LOCK(unit);
  20142 
  20143     /* Get field entry that contains InPort qualifier. */
  20144     rv = _bcm_field_entry_qual_get(unit, entry,
  20145                                    bcmFieldQualifyInPort, &f_ent);
  20146     if (BCM_FAILURE(rv)) {
  20147         FP_UNLOCK(unit);
  20148         return (rv);
  20149     }
  20150 
  20151 #if defined(BCM_RAPTOR_SUPPORT) || defined (BCM_TRX_SUPPORT)
  20152     fg = f_ent->group;
  20153     if ((_BCM_FIELD_STAGE_INGRESS == fg->stage_id) && 
  20154         (soc_feature(unit, soc_feature_field_ingress_ipbm))) {
  20155         BCM_PBMP_ITER(f_ent->pbmp.data, port) {
  20156             *data = *mask = port;
  20157             break;
  20158         }
  20159     } else 
  20160 #endif /* BCM_RAPTOR_SUPPORT || BCM_TRX_SUPPORT */
  20161     {
  20162         /* Read qualifier match value and mask. */ 
  20163         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  20164                                               bcmFieldQualifyInPort,
  20165                                               (uint32 *)data, (uint32 *)mask);
  20166         if (BCM_FAILURE(rv)) {
  20167             FP_UNLOCK(unit);
  20168             return (rv);
  20169         }
  20170     }
  20171     FP_UNLOCK(unit);
  20172 
  20173     if (isGport) {
  20174         rv = bcm_esw_port_gport_get(unit, *data, data);
  20175         BCM_IF_ERROR_RETURN(rv);
  20176     } 
  20177     return (BCM_E_NONE);
  20178 }
  20179 
  20180 /*
  20181  * Function:
  20182  *      bcm_esw_field_qualify_OutPort_get
  20183  * Purpose:
  20184  *      Get match criteria for bcmFieildQualifyOutPort
  20185  *                     qualifier from the field entry.
  20186  * Parameters:
  20187  *      unit - (IN) Unit number.
  20188  *      entry - (IN) BCM field entry id.
  20189  *      data - (OUT) Qualifier match data.
  20190  *      mask - (OUT) Qualifier match mask.
  20191  * Returns:
  20192  *      BCM_E_XXX
  20193  * Notes:
  20194  */
  20195 int 
  20196 bcm_esw_field_qualify_OutPort_get(
  20197     int unit, 
  20198     bcm_field_entry_t entry, 
  20199     bcm_port_t *data, 
  20200     bcm_port_t *mask)
  20201 {
  20202     int              rv;                  /* Operation return status.    */
  20203     int              isGport;             /* Port format is gport.       */
  20204 
  20205 
  20206     /* Check requested output format. */
  20207     rv = bcm_esw_switch_control_get(unit, bcmSwitchUseGport, &isGport);
  20208     BCM_IF_ERROR_RETURN(rv);
  20209 
  20210     /* Read qualifier match value and mask. */ 
  20211     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  20212                                            bcmFieldQualifyOutPort,
  20213                                            (uint32 *)data, (uint32 *)mask);
  20214     BCM_IF_ERROR_RETURN(rv);
  20215 
  20216     if (isGport) {
  20217         rv = bcm_esw_port_gport_get(unit, *data, data);
  20218         BCM_IF_ERROR_RETURN(rv);
  20219     } 
  20220     return (BCM_E_NONE);
  20221 }
  20222 
  20223 
  20224 /*
  20225  * Function:
  20226  *      bcm_esw_field_qualify_InPorts_get
  20227  * Purpose:
  20228  *      Get match criteria for bcmFieildQualifyInPorts
  20229  *                     qualifier from the field entry.
  20230  * Parameters:
  20231  *      unit - (IN) Unit number.
  20232  *      entry - (IN) BCM field entry id.
  20233  *      data - (OUT) Qualifier match data.
  20234  *      mask - (OUT) Qualifier match mask.
  20235  * Returns:
  20236  *      BCM_E_XXX
  20237  * Notes:
  20238  */
  20239 int 
  20240 bcm_esw_field_qualify_InPorts_get(
  20241     int unit, 
  20242     bcm_field_entry_t entry, 
  20243     bcm_pbmp_t *data, 
  20244     bcm_pbmp_t *mask)
  20245 {
  20246     int rv;                  /* Operation return status.    */
  20247 
  20248     if (soc_feature(unit, soc_feature_ifp_no_inports_support)) {
  20249         return (BCM_E_UNAVAIL);
  20250     }
  20251     
  20252     FP_LOCK(unit);
  20253     rv = _bcm_field_qualify_InPorts_get(unit, entry, bcmFieldQualifyInPorts,
  20254                                         data, mask);
  20255     FP_UNLOCK(unit);
  20256     return rv;
  20257 }
  20258 
  20259 /*
  20260  * Function:
  20261  *      bcm_esw_field_qualify_OutPorts_get
  20262  * Purpose:
  20263  *      Get match criteria for bcmFieildQualifyOutPorts
  20264  *                     qualifier from the field entry.
  20265  * Parameters:
  20266  *      unit - (IN) Unit number.
  20267  *      entry - (IN) BCM field entry id.
  20268  *      data - (OUT) Qualifier match data.
  20269  *      mask - (OUT) Qualifier match mask.
  20270  * Returns:
  20271  *      BCM_E_XXX
  20272  * Notes:
  20273  */
  20274 int 
  20275 bcm_esw_field_qualify_OutPorts_get(
  20276     int unit, 
  20277     bcm_field_entry_t entry, 
  20278     bcm_pbmp_t *data, 
  20279     bcm_pbmp_t *mask)
  20280 {
  20281     uint32 hw_data;          /* HW encoded qualifier data.  */
  20282     uint32 hw_mask;          /* HW encoding qualifier mask. */
  20283     int rv;                  /* Operation return status.    */
  20284 
  20285     /* Input parameters check. */
  20286     if ((NULL == data) || (NULL == mask)) {
  20287         return (BCM_E_PARAM);
  20288     }
  20289 
  20290     
  20291     FP_LOCK(unit);
  20292 
  20293     /* Read qualifier match value and mask. */ 
  20294     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  20295                                            bcmFieldQualifyOutPorts,
  20296                                            (uint32 *)&hw_data, 
  20297                                            (uint32 *)&hw_mask);
  20298     FP_UNLOCK(unit);
  20299     BCM_IF_ERROR_RETURN(rv);
  20300 
  20301     SOC_PBMP_WORD_SET(*data, 0, hw_data);
  20302     SOC_PBMP_WORD_SET(*mask, 0, hw_mask);
  20303     return (BCM_E_NONE);
  20304 }
  20305 
  20306 /*
  20307  * Function:
  20308  *      bcm_esw_field_qualify_Drop_get
  20309  * Purpose:
  20310  *      Get match criteria for bcmFieildQualifyDrop
  20311  *                     qualifier from the field entry.
  20312  * Parameters:
  20313  *      unit - (IN) Unit number.
  20314  *      entry - (IN) BCM field entry id.
  20315  *      data - (OUT) Qualifier match data.
  20316  *      mask - (OUT) Qualifier match mask.
  20317  * Returns:
  20318  *      BCM_E_XXX
  20319  * Notes:
  20320  */
  20321 int 
  20322 bcm_esw_field_qualify_Drop_get(
  20323     int unit, 
  20324     bcm_field_entry_t entry, 
  20325     uint8 *data, 
  20326     uint8 *mask)
  20327 {
  20328 #ifdef BCM_FIREBOLT2_SUPPORT
  20329     /* 
  20330      * FB2 has Drop at two places:
  20331      *     one is FIXED (always used), and the other based on selectors. 
  20332      */
  20333     if (SOC_IS_FIREBOLT2(unit)) {
  20334         _field_entry_t   *f_ent;
  20335         int              rv;
  20336 
  20337         
  20338         FP_LOCK(unit);
  20339 
  20340         rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  20341         if (BCM_FAILURE(rv)) {
  20342             FP_UNLOCK(unit);
  20343             return (rv);
  20344         }
  20345 
  20346         /* Add data & mask to entry. */
  20347         *data = f_ent->tcam.drop;
  20348         *mask = f_ent->tcam.drop_mask;
  20349 
  20350         FP_UNLOCK(unit);
  20351         return (BCM_E_NONE);
  20352     }
  20353 #endif /* BCM_FIREBOLT2_SUPPORT */    
  20354 
  20355     /* Read qualifier match value and mask. */
  20356     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  20357                                             bcmFieldQualifyDrop,
  20358                                             data, mask);
  20359 }
  20360 
  20361 /*
  20362  * Function:
  20363  *      bcm_esw_field_qualify_SrcPort_get
  20364  * Purpose:
  20365  *      Get match criteria for bcmFieildQualifySrcPort
  20366  *                     qualifier from the field entry.
  20367  * Parameters:
  20368  *      unit - (IN) Unit number.
  20369  *      entry - (IN) BCM field entry id.
  20370  *      data_modid - (OUT) Qualifier module id.
  20371  *      mask_modid - (OUT) Qualifier module id mask.
  20372  *      data_port - (OUT) Qualifier port id.
  20373  *      mask_port - (OUT) Qualifier port id mask.
  20374  * Returns:
  20375  *      BCM_E_XXX
  20376  * Notes:
  20377  */
  20378 int 
  20379 bcm_esw_field_qualify_SrcPort_get(
  20380     int unit, 
  20381     bcm_field_entry_t entry, 
  20382     bcm_module_t *data_modid, 
  20383     bcm_module_t *mask_modid, 
  20384     bcm_port_t *data_port, 
  20385     bcm_port_t *mask_port)
  20386 {
  20387     int isGport;             /* Port format is gport.       */
  20388     int isLocal;             /* Local module id flag.       */
  20389     int rv;                  /* Operation return status.    */
  20390     /* Input parameters check. */
  20391     if ((NULL == data_port) || (NULL == mask_port) ||
  20392         (NULL == data_modid) || (NULL == mask_modid)) {
  20393         return (BCM_E_PARAM);
  20394     }
  20395 
  20396 
  20397     
  20398     FP_LOCK(unit);
  20399 
  20400     rv = _field_qualify_Port_get(unit, entry,
  20401                                  data_modid, mask_modid,
  20402                                  data_port,  mask_port,
  20403                                  bcmFieldQualifySrcPort);
  20404     FP_UNLOCK(unit);
  20405     BCM_IF_ERROR_RETURN(rv);
  20406 
  20407     /* Check requested output format. */
  20408     rv = bcm_esw_switch_control_get(unit, bcmSwitchUseGport, &isGport);
  20409     BCM_IF_ERROR_RETURN(rv);
  20410 
  20411     if (isGport) {
  20412         BCM_IF_ERROR_RETURN(_bcm_esw_stk_modmap_map(unit,
  20413             BCM_STK_MODMAP_GET, *data_modid, *data_port,
  20414             data_modid, data_port));
  20415         BCM_GPORT_MODPORT_SET(*data_port, *data_modid, *data_port);
  20416         *mask_port = BCM_FIELD_EXACT_MATCH_MASK;
  20417     } else {
  20418         if ((NUM_MODID(unit) > 1) && (SOC_IS_TR_VL(unit)) ) {
  20419 #if defined(BCM_TOMAHAWK_SUPPORT)
  20420             if (soc_feature(unit, soc_feature_asymmetric_dual_modid)) {
  20421                 if ((*data_port) > (SOC_MODPORT_MAX_FIRST(unit))) {
  20422                     *data_port = (*data_port)-(SOC_MODPORT_MAX_FIRST(unit)+1);
  20423                     (*data_modid) += 1;
  20424                 }
  20425             } else
  20426 #endif
  20427             {
  20428             rv = _bcm_esw_modid_is_local(unit, *data_modid, &isLocal);
  20429             BCM_IF_ERROR_RETURN(rv);
  20430             if (isLocal) {
  20431                 (*data_modid) += ((*data_port) / (SOC_MODPORT_MAX(unit) + 1));
  20432                 *data_port = (*data_port) % (SOC_MODPORT_MAX(unit) + 1);
  20433             }
  20434         }
  20435     }
  20436     }
  20437     return (rv);
  20438 }
  20439 
  20440 /*
  20441  * Function:
  20442  *      bcm_esw_field_qualify_SrcTrunk_get
  20443  * Purpose:
  20444  *      Get match criteria for bcmFieildQualifySrcTrunk
  20445  *                     qualifier from the field entry.
  20446  * Parameters:
  20447  *      unit - (IN) Unit number.
  20448  *      entry - (IN) BCM field entry id.
  20449  *      data - (OUT) Qualifier match data.
  20450  *      mask - (OUT) Qualifier match mask.
  20451  * Returns:
  20452  *      BCM_E_XXX
  20453  * Notes:
  20454  */
  20455 int 
  20456 bcm_esw_field_qualify_SrcTrunk_get(
  20457     int unit, 
  20458     bcm_field_entry_t entry, 
  20459     bcm_trunk_t *data, 
  20460     bcm_trunk_t *mask)
  20461 {
  20462     _field_control_t *fc;    /* Field control structure.    */
  20463     int isGport;             /* Port format is gport.       */
  20464     int rv;                  /* Operation return status.    */
  20465 
  20466     /* Input parameters check. */
  20467     if ((NULL == data) || (NULL == mask)) {
  20468         return (BCM_E_PARAM);
  20469     }
  20470 
  20471     
  20472     FP_LOCK(unit);
  20473     rv = _field_control_get(unit, &fc);
  20474     if (BCM_FAILURE(rv)) {
  20475         FP_UNLOCK(unit);
  20476         return rv;
  20477     }
  20478 
  20479     rv = fc->functions.fp_qualify_trunk_get(unit, entry,
  20480                                             bcmFieldQualifySrcTrunk, 
  20481                                             data, mask);
  20482     FP_UNLOCK(unit);
  20483     BCM_IF_ERROR_RETURN(rv);
  20484 
  20485     /* Check requested output format. */
  20486     rv = bcm_esw_switch_control_get(unit, bcmSwitchUseGport, &isGport);
  20487     BCM_IF_ERROR_RETURN(rv);
  20488 
  20489     if (isGport) {
  20490         BCM_GPORT_TRUNK_SET(*data, *data);
  20491         *mask = BCM_FIELD_EXACT_MATCH_MASK;
  20492     }
  20493     return (rv);
  20494 }
  20495 
  20496 /*
  20497  * Function:
  20498  *      bcm_esw_field_qualify_SrcTrunkMemberGport_get
  20499  * Purpose:
  20500  *      Get match criteria for bcmFieildQualifySrcTrunkMemberGport
  20501  *                     qualifier from the field entry.
  20502  * Parameters:
  20503  *      unit  - (IN) Unit number.
  20504  *      entry - (IN) BCM field entry id.
  20505  *      port  - (OUT) Qualifier match gport.
  20506  * Returns:
  20507  *      BCM_E_XXX
  20508  * Notes:
  20509  */
  20510 int 
  20511 bcm_esw_field_qualify_SrcTrunkMemberGport_get(
  20512     int unit, 
  20513     bcm_field_entry_t entry, 
  20514     bcm_gport_t *port) 
  20515 {
  20516     uint32 data;   /* HW encoded qualifier data.  */
  20517     uint32 mask;   /* HW encoding qualifier mask. */
  20518     int rv;        /* Operation return status.    */
  20519 
  20520     /* Input parameters check. */
  20521     if (NULL == port) {
  20522         return (BCM_E_PARAM);
  20523     }
  20524 
  20525     /* Read qualifier match value and mask. */ 
  20526     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  20527                                            bcmFieldQualifySrcTrunkMemberGport,
  20528                                            &data, &mask);
  20529     BCM_IF_ERROR_RETURN(rv);
  20530 
  20531     if (mask == 0) {
  20532         return BCM_E_NOT_FOUND;
  20533     }
  20534 
  20535     BCM_GPORT_MODPORT_SET(*port, ((data >> _FP_PORT_BITWIDTH(unit)) & 0xff), 
  20536                           (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  20537 
  20538     return BCM_E_NONE;
  20539 
  20540 }
  20541 
  20542 /*
  20543  * Function:
  20544  *      bcm_esw_field_qualify_DstPort_get
  20545  * Purpose:
  20546  *      Get match criteria for bcmFieildQualifyDstPort
  20547  *                     qualifier from the field entry.
  20548  * Parameters:
  20549  *      unit - (IN) Unit number.
  20550  *      entry - (IN) BCM field entry id.
  20551  *      data_modid - (OUT) Qualifier module id.
  20552  *      mask_modid - (OUT) Qualifier module id mask.
  20553  *      data_port - (OUT) Qualifier port id.
  20554  *      mask_port - (OUT) Qualifier port id mask.
  20555  * Returns:
  20556  *      BCM_E_XXX
  20557  * Notes:
  20558  */
  20559 int 
  20560 bcm_esw_field_qualify_DstPort_get(
  20561     int unit, 
  20562     bcm_field_entry_t entry, 
  20563     bcm_module_t *data_modid, 
  20564     bcm_module_t *mask_modid, 
  20565     bcm_port_t *data_port, 
  20566     bcm_port_t *mask_port)
  20567 {
  20568     int isGport;             /* Port format is gport.       */
  20569     int isLocal;             /* Local module id flag.       */
  20570     int rv;                  /* Operation return status.    */
  20571 
  20572     /* Input parameters check. */
  20573     if ((NULL == data_port) || (NULL == mask_port) ||
  20574         (NULL == data_modid) || (NULL == mask_modid)) {
  20575         return (BCM_E_PARAM);
  20576     }
  20577 
  20578 
  20579     
  20580     FP_LOCK(unit);
  20581 
  20582     rv = _field_qualify_Port_get(unit, entry,
  20583                                  data_modid, mask_modid,
  20584                                  data_port,  mask_port,
  20585                                  bcmFieldQualifyDstPort);
  20586     FP_UNLOCK(unit);
  20587     BCM_IF_ERROR_RETURN(rv);
  20588 
  20589     /* Check requested output format. */
  20590     rv = bcm_esw_switch_control_get(unit, bcmSwitchUseGport, &isGport);
  20591     BCM_IF_ERROR_RETURN(rv);
  20592 
  20593     if (isGport) {
  20594         BCM_IF_ERROR_RETURN(_bcm_esw_stk_modmap_map(unit,
  20595             BCM_STK_MODMAP_GET, *data_modid, *data_port,
  20596             data_modid, data_port));
  20597         BCM_GPORT_MODPORT_SET(*data_port, *data_modid, *data_port);
  20598         *mask_port = BCM_FIELD_EXACT_MATCH_MASK;
  20599     } else {
  20600         if ((NUM_MODID(unit) > 1) && (SOC_IS_TR_VL(unit)) ) {
  20601 #if defined(BCM_TOMAHAWK_SUPPORT)
  20602             if (soc_feature(unit, soc_feature_asymmetric_dual_modid)) {
  20603                 if ((*data_port) > (SOC_MODPORT_MAX_FIRST(unit))) {
  20604                     *data_port = (*data_port)-(SOC_MODPORT_MAX_FIRST(unit)+1);
  20605                     (*data_modid) += 1;
  20606                 }
  20607             } else
  20608 #endif
  20609             {
  20610             rv = _bcm_esw_modid_is_local(unit, *data_modid, &isLocal);
  20611             BCM_IF_ERROR_RETURN(rv);
  20612             if (isLocal) {
  20613                 (*data_modid) += ((*data_port) / (SOC_MODPORT_MAX(unit) + 1));
  20614                 *data_port = (*data_port) % (SOC_MODPORT_MAX(unit) + 1);
  20615             }
  20616         }
  20617     }
  20618     }
  20619     return (rv);
  20620 }
  20621 
  20622 /*
  20623  * Function:
  20624  *      bcm_esw_field_qualify_DstTrunk_get
  20625  * Purpose:
  20626  *      Get match criteria for bcmFieildQualifyDstTrunk
  20627  *                     qualifier from the field entry.
  20628  * Parameters:
  20629  *      unit - (IN) Unit number.
  20630  *      entry - (IN) BCM field entry id.
  20631  *      data - (OUT) Qualifier match data.
  20632  *      mask - (OUT) Qualifier match mask.
  20633  * Returns:
  20634  *      BCM_E_XXX
  20635  * Notes:
  20636  */
  20637 int 
  20638 bcm_esw_field_qualify_DstTrunk_get(
  20639     int unit, 
  20640     bcm_field_entry_t entry, 
  20641     bcm_trunk_t *data, 
  20642     bcm_trunk_t *mask)
  20643 {
  20644     _field_control_t *fc;    /* Field control structure.    */
  20645     int isGport;             /* Port format is gport.       */
  20646     int rv;                  /* Operation return status.    */
  20647 
  20648     /* Input parameters check. */
  20649     if ((NULL == data) || (NULL == mask)) {
  20650         return (BCM_E_PARAM);
  20651     }
  20652 
  20653     
  20654     FP_LOCK(unit);
  20655     rv = _field_control_get(unit, &fc);
  20656     if (BCM_FAILURE(rv)) {
  20657         FP_UNLOCK(unit);
  20658         return rv;
  20659     }
  20660 
  20661     rv = fc->functions.fp_qualify_trunk_get(unit, entry, 
  20662                                             bcmFieldQualifyDstTrunk,
  20663                                             data, mask);
  20664     FP_UNLOCK(unit);
  20665     BCM_IF_ERROR_RETURN(rv);
  20666 
  20667     /* Check requested output format. */
  20668     rv = bcm_esw_switch_control_get(unit, bcmSwitchUseGport, &isGport);
  20669     BCM_IF_ERROR_RETURN(rv);
  20670 
  20671     if (isGport) {
  20672         BCM_GPORT_TRUNK_SET(*data, *data);
  20673         *mask = BCM_FIELD_EXACT_MATCH_MASK;
  20674     }
  20675     return (rv);
  20676 }
  20677 
  20678 /*
  20679  * Function:
  20680  *      bcm_esw_field_qualify_InnerL4SrcPort_get
  20681  * Purpose:
  20682  *      Get match criteria for bcmFieildQualifyInnerL4SrcPort
  20683  *                     qualifier from the field entry.
  20684  * Parameters:
  20685  *      unit - (IN) Unit number.
  20686  *      entry - (IN) BCM field entry id.
  20687  *      data - (OUT) Qualifier match data.
  20688  *      mask - (OUT) Qualifier match mask.
  20689  * Returns:
  20690  *      BCM_E_XXX
  20691  * Notes:
  20692  */
  20693 int 
  20694 bcm_esw_field_qualify_InnerL4SrcPort_get(
  20695     int unit, 
  20696     bcm_field_entry_t entry, 
  20697     bcm_l4_port_t *data, 
  20698     bcm_l4_port_t *mask)
  20699 {
  20700     /* Read qualifier match value and mask. */ 
  20701     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  20702                                              bcmFieldQualifyInnerL4SrcPort,
  20703                                              (uint32 *)data, (uint32 *)mask);
  20704 }
  20705 
  20706 /*
  20707  * Function:
  20708  *      bcm_esw_field_qualify_InnerL4DstPort_get
  20709  * Purpose:
  20710  *      Get match criteria for bcmFieildQualifyInnerL4DstPort
  20711  *                     qualifier from the field entry.
  20712  * Parameters:
  20713  *      unit - (IN) Unit number.
  20714  *      entry - (IN) BCM field entry id.
  20715  *      data - (OUT) Qualifier match data.
  20716  *      mask - (OUT) Qualifier match mask.
  20717  * Returns:
  20718  *      BCM_E_XXX
  20719  * Notes:
  20720  */
  20721 int 
  20722 bcm_esw_field_qualify_InnerL4DstPort_get(
  20723     int unit, 
  20724     bcm_field_entry_t entry, 
  20725     bcm_l4_port_t *data, 
  20726     bcm_l4_port_t *mask)
  20727 {
  20728     /* Read qualifier match value and mask. */ 
  20729     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  20730                                              bcmFieldQualifyInnerL4DstPort,
  20731                                              (uint32 *)data, (uint32 *)mask);
  20732 }
  20733 
  20734 /*
  20735  * Function:
  20736  *      bcm_esw_field_qualify_L4SrcPort_get
  20737  * Purpose:
  20738  *      Get match criteria for bcmFieildQualifyL4SrcPort
  20739  *                     qualifier from the field entry.
  20740  * Parameters:
  20741  *      unit - (IN) Unit number.
  20742  *      entry - (IN) BCM field entry id.
  20743  *      data - (OUT) Qualifier match data.
  20744  *      mask - (OUT) Qualifier match mask.
  20745  * Returns:
  20746  *      BCM_E_XXX
  20747  * Notes:
  20748  */
  20749 int 
  20750 bcm_esw_field_qualify_L4SrcPort_get(
  20751     int unit, 
  20752     bcm_field_entry_t entry, 
  20753     bcm_l4_port_t *data, 
  20754     bcm_l4_port_t *mask)
  20755 {
  20756     /* Read qualifier match value and mask. */ 
  20757     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  20758                                              bcmFieldQualifyL4SrcPort,
  20759                                              (uint32 *)data, (uint32 *)mask);
  20760 }
  20761 
  20762 /*
  20763  * Function:
  20764  *      bcm_esw_field_qualify_L4DstPort_get
  20765  * Purpose:
  20766  *      Get match criteria for bcmFieildQualifyL4DstPort
  20767  *                     qualifier from the field entry.
  20768  * Parameters:
  20769  *      unit - (IN) Unit number.
  20770  *      entry - (IN) BCM field entry id.
  20771  *      data - (OUT) Qualifier match data.
  20772  *      mask - (OUT) Qualifier match mask.
  20773  * Returns:
  20774  *      BCM_E_XXX
  20775  * Notes:
  20776  */
  20777 int 
  20778 bcm_esw_field_qualify_L4DstPort_get(
  20779     int unit, 
  20780     bcm_field_entry_t entry, 
  20781     bcm_l4_port_t *data, 
  20782     bcm_l4_port_t *mask)
  20783 {
  20784     /* Read qualifier match value and mask. */ 
  20785     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  20786                                              bcmFieldQualifyL4DstPort,
  20787                                              (uint32 *)data, (uint32 *)mask);
  20788 }
  20789 
  20790 /*
  20791  * Function:
  20792  *      bcm_esw_field_qualify_OuterVlan_get
  20793  * Purpose:
  20794  *      Get match criteria for bcmFieildQualifyOuterVlan
  20795  *                     qualifier from the field entry.
  20796  * Parameters:
  20797  *      unit - (IN) Unit number.
  20798  *      entry - (IN) BCM field entry id.
  20799  *      data - (OUT) Qualifier match data.
  20800  *      mask - (OUT) Qualifier match mask.
  20801  * Returns:
  20802  *      BCM_E_XXX
  20803  * Notes:
  20804  */
  20805 int 
  20806 bcm_esw_field_qualify_OuterVlan_get(
  20807     int unit, 
  20808     bcm_field_entry_t entry, 
  20809     bcm_vlan_t *data, 
  20810     bcm_vlan_t *mask)
  20811 {
  20812     int     rv;       /* Operation return status. */
  20813     uint8  hw_data;  /* Installed entry value.   */
  20814     uint8  hw_mask;  /* Installed entry mask.    */
  20815 
  20816     if ((NULL == data) || (NULL == mask)) {
  20817         return (BCM_E_PARAM);
  20818     }
  20819 
  20820 #if defined(BCM_TOMAHAWK_SUPPORT)
  20821     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  20822         rv = _bcm_field_is_entry_stage_valid(unit, entry,
  20823                                              _BCM_FIELD_STAGE_INGRESS);
  20824         
  20825         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
  20826             return (rv); 
  20827         }
  20828     
  20829         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
  20830             return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  20831                                                    bcmFieldQualifyOuterVlan,
  20832                                                    data, mask);
  20833         }
  20834     }
  20835 #endif
  20836 
  20837     rv = bcm_esw_field_qualify_OuterVlanId_get(unit, entry, 
  20838                                                data, mask);
  20839     BCM_IF_ERROR_RETURN(rv);
  20840 
  20841     rv = bcm_esw_field_qualify_OuterVlanCfi_get(unit, entry,
  20842                                                 &hw_data, &hw_mask); 
  20843     BCM_IF_ERROR_RETURN(rv);
  20844     *data |= (hw_data << 12);
  20845     *mask |= (hw_mask << 12);
  20846 
  20847     rv = bcm_esw_field_qualify_OuterVlanPri_get(unit, entry,
  20848                                                 &hw_data, &hw_mask);
  20849     BCM_IF_ERROR_RETURN(rv);
  20850     *data |= (hw_data << 13);
  20851     *mask |= (hw_mask << 13);
  20852     return (BCM_E_NONE);
  20853 }
  20854 
  20855 /*
  20856  * Function:
  20857  *      bcm_esw_field_qualify_InnerVlan_get
  20858  * Purpose:
  20859  *      Get match criteria for bcmFieildQualifyInnerVlan
  20860  *                     qualifier from the field entry.
  20861  * Parameters:
  20862  *      unit - (IN) Unit number.
  20863  *      entry - (IN) BCM field entry id.
  20864  *      data - (OUT) Qualifier match data.
  20865  *      mask - (OUT) Qualifier match mask.
  20866  * Returns:
  20867  *      BCM_E_XXX
  20868  * Notes:
  20869  */
  20870 int 
  20871 bcm_esw_field_qualify_InnerVlan_get(
  20872     int unit, 
  20873     bcm_field_entry_t entry, 
  20874     bcm_vlan_t *data, 
  20875     bcm_vlan_t *mask)
  20876 {
  20877     uint8  hw_data;  /* Installed entry value.   */
  20878     uint8  hw_mask;  /* Installed entry mask.    */
  20879     int    rv;       /* Operation return status. */
  20880 
  20881     if ((NULL == data) || (NULL == mask)) {
  20882         return (BCM_E_PARAM);
  20883     }
  20884 
  20885 #if defined(BCM_TOMAHAWK_SUPPORT)
  20886     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  20887         rv = _bcm_field_is_entry_stage_valid(unit, entry,
  20888                                              _BCM_FIELD_STAGE_INGRESS);
  20889         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
  20890             /*Error fetching entry*/
  20891             return (rv); 
  20892         }
  20893     
  20894         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
  20895             return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  20896                                                    bcmFieldQualifyInnerVlan,
  20897                                                    data, mask);
  20898         }
  20899     }
  20900 #endif
  20901 
  20902     rv = bcm_esw_field_qualify_InnerVlanId_get(unit, entry, 
  20903                                                data, mask);
  20904     BCM_IF_ERROR_RETURN(rv);
  20905 
  20906     rv = bcm_esw_field_qualify_InnerVlanCfi_get(unit, entry,
  20907                                                 &hw_data, &hw_mask); 
  20908     BCM_IF_ERROR_RETURN(rv);
  20909     *data |= (hw_data << 12);
  20910     *mask |= (hw_mask << 12);
  20911 
  20912     rv = bcm_esw_field_qualify_InnerVlanPri_get(unit, entry,
  20913                                                  &hw_data, &hw_mask);
  20914     BCM_IF_ERROR_RETURN(rv);
  20915     *data |= (hw_data << 13);
  20916     *mask |= (hw_mask << 13);
  20917     return (BCM_E_NONE);
  20918 }
  20919 
  20920 /*
  20921  * Function:
  20922  *      bcm_esw_field_qualify_EtherType_get
  20923  * Purpose:
  20924  *      Get match criteria for bcmFieildQualifyEtherType
  20925  *                     qualifier from the field entry.
  20926  * Parameters:
  20927  *      unit - (IN) Unit number.
  20928  *      entry - (IN) BCM field entry id.
  20929  *      data - (OUT) Qualifier match data.
  20930  *      mask - (OUT) Qualifier match mask.
  20931  * Returns:
  20932  *      BCM_E_XXX
  20933  * Notes:
  20934  */
  20935 int 
  20936 bcm_esw_field_qualify_EtherType_get(
  20937     int unit, 
  20938     bcm_field_entry_t entry, 
  20939     uint16 *data, 
  20940     uint16 *mask)
  20941 {
  20942     /* Read qualifier match value and mask. */ 
  20943     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  20944                                              bcmFieldQualifyEtherType,
  20945                                              data, mask);
  20946 }
  20947 
  20948 /*
  20949  * Function:
  20950  *      bcm_esw_field_qualify_IpProtocol_get
  20951  * Purpose:
  20952  *      Get match criteria for bcmFieildQualifyIpProtocol
  20953  *                     qualifier from the field entry.
  20954  * Parameters:
  20955  *      unit - (IN) Unit number.
  20956  *      entry - (IN) BCM field entry id.
  20957  *      data - (OUT) Qualifier match data.
  20958  *      mask - (OUT) Qualifier match mask.
  20959  * Returns:
  20960  *      BCM_E_XXX
  20961  * Notes:
  20962  */
  20963 int 
  20964 bcm_esw_field_qualify_IpProtocol_get(
  20965     int unit, 
  20966     bcm_field_entry_t entry, 
  20967     uint8 *data, 
  20968     uint8 *mask)
  20969 {
  20970     /* Read qualifier match value and mask. */
  20971     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  20972                                             bcmFieldQualifyIpProtocol,
  20973                                             data, mask);
  20974 }
  20975 
  20976 /*
  20977  * Function:
  20978  *      bcm_esw_field_qualify_IpInfo_get
  20979  * Purpose:
  20980  *      Get match criteria for bcmFieildQualifyIpInfo
  20981  *                     qualifier from the field entry.
  20982  * Parameters:
  20983  *      unit - (IN) Unit number.
  20984  *      entry - (IN) BCM field entry id.
  20985  *      data - (OUT) Qualifier match data.
  20986  *      mask - (OUT) Qualifier match mask.
  20987  * Returns:
  20988  *      BCM_E_XXX
  20989  * Notes:
  20990  */
  20991 int 
  20992 bcm_esw_field_qualify_IpInfo_get(
  20993     int unit, 
  20994     bcm_field_entry_t entry, 
  20995     uint32 *data, 
  20996     uint32 *mask)
  20997 {
  20998     int  rv;           /* Operation return status. */
  20999 #if defined(BCM_TRX_SUPPORT)
  21000     _field_entry_t      *f_ent;
  21001 #endif /* BCM_TRX_SUPPORT*/
  21002 
  21003     /* Read qualifier match value and mask. */ 
  21004     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  21005                                            bcmFieldQualifyIpInfo,
  21006                                            data, mask);
  21007 
  21008 #if defined(BCM_FIREBOLT2_SUPPORT) || defined(BCM_RAPTOR_SUPPORT) || defined(BCM_TRX_SUPPORT)
  21009     if (SOC_IS_FIREBOLT2(unit) || SOC_IS_RAVEN(unit) || \
  21010         SOC_IS_TRX(unit) || SOC_IS_HAWKEYE(unit)) {
  21011         if (*mask & BCM_FIELD_IP_HDR_FLAGS_MF) {
  21012             /* In FB2 More fragments bit replaced with whole packet bit. */
  21013             *data = ((*data & BCM_FIELD_IP_HDR_OFFSET_ZERO) | 
  21014                  (*data & BCM_FIELD_IP_CHECKSUM_OK) | 
  21015                  (*data ^ BCM_FIELD_IP_HDR_FLAGS_MF));
  21016         }
  21017     }
  21018 #endif /* BCM_FIREBOLT_SUPPORT || BCM_RAPTOR_SUPPORT || BCM_TRX_SUPPORT */
  21019 
  21020 #if defined(BCM_TRX_SUPPORT)
  21021     /* For VFP on TRX devices and for ingress and Exact match stage
  21022      * on TD2 and TH family devices, the checksum is 1-bit field and
  21023        for all other devices, IpInfo field is 3 bit
  21024      */
  21025     BCM_IF_ERROR_RETURN(_field_entry_get(unit, entry,
  21026                              _FP_ENTRY_PRIMARY, &f_ent));
  21027     if ( ((SOC_IS_TRX(unit) &&
  21028           (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id)) ||
  21029          ((SOC_IS_TD2_TT2(unit) &&
  21030            ((_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) ||
  21031             (_BCM_FIELD_STAGE_EXACTMATCH == f_ent->group->stage_id)) ))) ){
  21032         /* On Trident2 IP_INFO field is devided into two parts
  21033          * IP_FRAG_INFO(2bits) and IP_CHECKSUM_OK(1bit). IP_FRAG_INFO
  21034          * can be qualified using bcmFieldQualifyIpFrag and IP_CHECKSUM_OK
  21035          * can be qualified using bcmFieldQualifyIpInfo.
  21036          */
  21037         if (*mask & 0x1) {
  21038             *mask = BCM_FIELD_IP_CHECKSUM_OK;
  21039         }
  21040         *data = (*data & 0x1) ? BCM_FIELD_IP_CHECKSUM_OK : 0;
  21041     }
  21042 #endif /* BCM_TRX_SUPPORT */
  21043 
  21044     return rv; 
  21045 }
  21046 
  21047 
  21048 int 
  21049 bcm_esw_field_qualify_PacketRes_get(
  21050     int unit, 
  21051     bcm_field_entry_t entry, 
  21052     uint32 *data, 
  21053     uint32 *mask)
  21054 {
  21055     int  rv;            /* Operation return status. */
  21056     _field_control_t *fc = NULL;
  21057 
  21058     /* Read qualifier match value and mask. */ 
  21059     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  21060                                            bcmFieldQualifyPacketRes,
  21061                                            data, mask);
  21062     BCM_IF_ERROR_RETURN(rv);
  21063 
  21064     FP_LOCK(unit);
  21065 
  21066     rv = _field_control_get(unit, &fc);
  21067     if (BCM_FAILURE(rv)) {
  21068         FP_UNLOCK(unit);
  21069         return rv;
  21070     }
  21071 
  21072     if (NULL == fc->functions.fp_qualify_packet_res_get) {
  21073         FP_UNLOCK(unit);
  21074         return BCM_E_CONFIG;
  21075     }
  21076 
  21077     rv = fc->functions.fp_qualify_packet_res_get(unit, entry, data, mask);
  21078 
  21079     FP_UNLOCK(unit);
  21080     return rv;  
  21081 }
  21082 
  21083 /*
  21084  * Function:
  21085  *      bcm_esw_field_qualify_SrcIp_get
  21086  * Purpose:
  21087  *      Get match criteria for bcmFieildQualifySrcIp
  21088  *                     qualifier from the field entry.
  21089  * Parameters:
  21090  *      unit - (IN) Unit number.
  21091  *      entry - (IN) BCM field entry id.
  21092  *      data - (OUT) Qualifier match data.
  21093  *      mask - (OUT) Qualifier match mask.
  21094  * Returns:
  21095  *      BCM_E_XXX
  21096  * Notes:
  21097  */
  21098 int 
  21099 bcm_esw_field_qualify_SrcIp_get(
  21100     int unit, 
  21101     bcm_field_entry_t entry, 
  21102     bcm_ip_t *data, 
  21103     bcm_ip_t *mask)
  21104 {
  21105     /* Read qualifier match value and mask. */ 
  21106     return  _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  21107                                               bcmFieldQualifySrcIp,
  21108                                               data, mask);
  21109 }
  21110 
  21111 /*
  21112  * Function:
  21113  *      bcm_esw_field_qualify_DstIp_get
  21114  * Purpose:
  21115  *      Get match criteria for bcmFieildQualifyDstIp
  21116  *                     qualifier from the field entry.
  21117  * Parameters:
  21118  *      unit - (IN) Unit number.
  21119  *      entry - (IN) BCM field entry id.
  21120  *      data - (OUT) Qualifier match data.
  21121  *      mask - (OUT) Qualifier match mask.
  21122  * Returns:
  21123  *      BCM_E_XXX
  21124  * Notes:
  21125  */
  21126 int 
  21127 bcm_esw_field_qualify_DstIp_get(
  21128     int unit, 
  21129     bcm_field_entry_t entry, 
  21130     bcm_ip_t *data, 
  21131     bcm_ip_t *mask)
  21132 {
  21133     /* Read qualifier match value and mask. */ 
  21134     return  _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  21135                                               bcmFieldQualifyDstIp,
  21136                                               data, mask);
  21137 }
  21138 
  21139 /*
  21140  * Function:
  21141  *      bcm_esw_field_qualify_Tos_get
  21142  * Purpose:
  21143  *      Get match criteria for bcmFieildQualifyTos
  21144  *                     qualifier from the field entry.
  21145  * Parameters:
  21146  *      unit - (IN) Unit number.
  21147  *      entry - (IN) BCM field entry id.
  21148  *      data - (OUT) Qualifier match data.
  21149  *      mask - (OUT) Qualifier match mask.
  21150  * Returns:
  21151  *      BCM_E_XXX
  21152  * Notes:
  21153  */
  21154 int 
  21155 bcm_esw_field_qualify_Tos_get(
  21156     int unit, 
  21157     bcm_field_entry_t entry, 
  21158     uint8 *data, 
  21159     uint8 *mask)
  21160 {
  21161     /* Read qualifier match value and mask. */
  21162     return  _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  21163                                              bcmFieldQualifyTos,
  21164                                              data, mask);
  21165 }
  21166 
  21167 /*
  21168  * Function:
  21169  *      bcm_esw_field_qualify_DSCP_get
  21170  * Purpose:
  21171  *      Get match criteria for bcmFieildQualifyDSCP
  21172  *                     qualifier from the field entry.
  21173  * Parameters:
  21174  *      unit - (IN) Unit number.
  21175  *      entry - (IN) BCM field entry id.
  21176  *      data - (OUT) Qualifier match data.
  21177  *      mask - (OUT) Qualifier match mask.
  21178  * Returns:
  21179  *      BCM_E_XXX
  21180  * Notes:
  21181  */
  21182 int 
  21183 bcm_esw_field_qualify_DSCP_get(
  21184     int unit, 
  21185     bcm_field_entry_t entry, 
  21186     uint8 *data, 
  21187     uint8 *mask)
  21188 {
  21189     /* Read qualifier match value and mask. */
  21190     return  _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  21191                                              bcmFieldQualifyDSCP,
  21192                                              data, mask);
  21193 }
  21194 
  21195 /*
  21196  * Function:
  21197  *      bcm_esw_field_qualify_IpFlags_get
  21198  * Purpose:
  21199  *      Get match criteria for bcmFieildQualifyIpFlags
  21200  *                     qualifier from the field entry.
  21201  * Parameters:
  21202  *      unit - (IN) Unit number.
  21203  *      entry - (IN) BCM field entry id.
  21204  *      data - (OUT) Qualifier match data.
  21205  *      mask - (OUT) Qualifier match mask.
  21206  * Returns:
  21207  *      BCM_E_XXX
  21208  * Notes:
  21209  */
  21210 int 
  21211 bcm_esw_field_qualify_IpFlags_get(
  21212     int unit, 
  21213     bcm_field_entry_t entry, 
  21214     uint8 *data, 
  21215     uint8 *mask)
  21216 {
  21217     /* Read qualifier match value and mask. */
  21218     return  _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  21219                                              bcmFieldQualifyIpFlags,
  21220                                              data, mask);
  21221 }
  21222 
  21223 /*
  21224  * Function:
  21225  *      bcm_esw_field_qualify_TcpControl_get
  21226  * Purpose:
  21227  *      Get match criteria for bcmFieildQualifyTcpControl
  21228  *                     qualifier from the field entry.
  21229  * Parameters:
  21230  *      unit - (IN) Unit number.
  21231  *      entry - (IN) BCM field entry id.
  21232  *      data - (OUT) Qualifier match data.
  21233  *      mask - (OUT) Qualifier match mask.
  21234  * Returns:
  21235  *      BCM_E_XXX
  21236  * Notes:
  21237  */
  21238 int 
  21239 bcm_esw_field_qualify_TcpControl_get(
  21240     int unit, 
  21241     bcm_field_entry_t entry, 
  21242     uint8 *data, 
  21243     uint8 *mask)
  21244 {
  21245     /* Read qualifier match value and mask. */
  21246     return  _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  21247                                               bcmFieldQualifyTcpControl,
  21248                                               data, mask);
  21249 }
  21250 
  21251 /*
  21252  * Function:
  21253  *      bcm_esw_field_qualify_TcpSequenceZero_get
  21254  * Purpose:
  21255  *      Get match criteria for bcmFieildQualifyTcpSequenceZero
  21256  *                     qualifier from the field entry.
  21257  * Parameters:
  21258  *      unit - (IN) Unit number.
  21259  *      entry - (IN) BCM field entry id.
  21260  *      flag - (OUT) Qualifier match flags.
  21261  * Returns:
  21262  *      BCM_E_XXX
  21263  * Notes:
  21264  */
  21265 int 
  21266 bcm_esw_field_qualify_TcpSequenceZero_get(
  21267     int unit, 
  21268     bcm_field_entry_t entry, 
  21269     uint32 *flag)
  21270 {
  21271     return BCM_E_UNAVAIL; 
  21272 }
  21273 
  21274 /*
  21275  * Function:
  21276  *      bcm_esw_field_qualify_TcpHeaderSize_get
  21277  * Purpose:
  21278  *      Get match criteria for bcmFieildQualifyTcpHeaderSize
  21279  *                     qualifier from the field entry.
  21280  * Parameters:
  21281  *      unit - (IN) Unit number.
  21282  *      entry - (IN) BCM field entry id.
  21283  *      data - (OUT) Qualifier match data.
  21284  *      mask - (OUT) Qualifier match mask.
  21285  * Returns:
  21286  *      BCM_E_XXX
  21287  * Notes:
  21288  */
  21289 int 
  21290 bcm_esw_field_qualify_TcpHeaderSize_get(
  21291     int unit, 
  21292     bcm_field_entry_t entry, 
  21293     uint8 *data, 
  21294     uint8 *mask)
  21295 {
  21296     return BCM_E_UNAVAIL; 
  21297 }
  21298 
  21299 /*
  21300  * Function:
  21301  *      bcm_esw_field_qualify_Ttl_get
  21302  * Purpose:
  21303  *      Get match criteria for bcmFieildQualifyTtl
  21304  *                     qualifier from the field entry.
  21305  * Parameters:
  21306  *      unit - (IN) Unit number.
  21307  *      entry - (IN) BCM field entry id.
  21308  *      data - (OUT) Qualifier match data.
  21309  *      mask - (OUT) Qualifier match mask.
  21310  * Returns:
  21311  *      BCM_E_XXX
  21312  * Notes:
  21313  */
  21314 int 
  21315 bcm_esw_field_qualify_Ttl_get(
  21316     int unit, 
  21317     bcm_field_entry_t entry, 
  21318     uint8 *data, 
  21319     uint8 *mask)
  21320 {
  21321     int              rv;
  21322 
  21323     
  21324     FP_LOCK(unit);
  21325 
  21326 #if defined(BCM_FIREBOLT2_SUPPORT)
  21327     if (SOC_IS_FIREBOLT2(unit)) {
  21328         rv =  _bcm_field_fb2_qualify_ttl_get(unit, entry, data, mask);     
  21329     } else 
  21330 #endif /* BCM_FIREBOLT2_SUPPORT */
  21331         
  21332 #if defined(BCM_RAPTOR_SUPPORT)
  21333     if (SOC_IS_RAVEN(unit) || SOC_IS_HAWKEYE(unit)) {
  21334         rv =  _bcm_field_raven_qualify_ttl_get(unit, entry, data, mask);     
  21335     } else 
  21336 #endif /* BCM_RAPTOR_SUPPORT */
  21337     {
  21338         /* Read qualifier match value and mask. */
  21339         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  21340                                               bcmFieldQualifyTtl,
  21341                                               data, mask);
  21342     }
  21343     FP_UNLOCK(unit);
  21344     return (rv);
  21345 }
  21346 
  21347 /*
  21348  * Function:
  21349  *      bcm_esw_field_qualify_RangeCheck_get
  21350  * Purpose:
  21351  *      Get match criteria for bcmFieildQualifyRangeCheck
  21352  *                     qualifier from the field entry.
  21353  * Parameters:
  21354  *      unit - (IN) Unit number.
  21355  *      entry - (IN) BCM field entry id.
  21356  *      max_count - (IN) Max entries to fill.
  21357  *      range - (OUT) Range checkers array.
  21358  *      invert - (OUT) Range checkers invert array.
  21359  *      count - (OUT) Number of filled range checkers.
  21360  * Returns:
  21361  *      BCM_E_XXX
  21362  * Notes:
  21363  */
  21364 int 
  21365 bcm_esw_field_qualify_RangeCheck_get(
  21366     int unit, 
  21367     bcm_field_entry_t entry, 
  21368     int max_count, 
  21369     bcm_field_range_t *range, 
  21370     int *invert, 
  21371     int *count)
  21372 {
  21373     _bcm_field_qual_offset_t *q_offset;
  21374     _field_stage_t           *stage_fc;
  21375     _field_entry_t           *f_ent;
  21376     _bcm_field_qual_data_t   data;
  21377     _bcm_field_qual_data_t   mask;
  21378     _bcm_field_qual_data_t   data1;
  21379     _bcm_field_qual_data_t   mask1;
  21380     _field_range_t           *fr;
  21381     int                      idx;
  21382     int                      rv;
  21383 
  21384 
  21385     /* Input parameters check. */
  21386     if (NULL == count) {
  21387         return (BCM_E_PARAM);
  21388     }
  21389 
  21390     
  21391     FP_LOCK(unit);
  21392 
  21393     /* Get field entry part that contains qualifier. */
  21394     rv = _bcm_field_entry_qual_get(unit, entry, bcmFieldQualifyRangeCheck, &f_ent);
  21395     if (BCM_FAILURE(rv)) {
  21396         FP_UNLOCK(unit);
  21397         return rv;
  21398     }
  21399 
  21400     if (NULL == f_ent->group) {
  21401         FP_UNLOCK(unit);
  21402         return (BCM_E_INTERNAL);
  21403     }
  21404 
  21405     /* Get stage field control structure. */
  21406     rv = _field_stage_control_get(unit, f_ent->group->stage_id, &stage_fc);
  21407     if (BCM_FAILURE(rv)) {
  21408         FP_UNLOCK(unit);
  21409         return (rv);
  21410     }
  21411 
  21412 #if defined(BCM_TOMAHAWK_SUPPORT)
  21413     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  21414        /* Read qualifier match value and mask. */
  21415        rv = _field_entry_qualifier_key_get(unit, entry,
  21416                                            bcmFieldQualifyRangeCheck,
  21417                                            data, mask);
  21418     } else
  21419 #endif /* BCM_TOMAHAWK_SUPPORT */
  21420     {
  21421        /* Get qualifier offsets in the tcam. */
  21422        rv = _field_qual_offset_get(unit, f_ent, bcmFieldQualifyRangeCheck,
  21423                                    &q_offset);
  21424        if (BCM_FAILURE(rv)) {
  21425            FP_UNLOCK(unit);
  21426            return (rv);
  21427        }
  21428 
  21429        /* Read qualifier match value and mask. */
  21430        rv = _bcm_field_qual_value_get(unit, q_offset, f_ent, 
  21431                                       data, mask);
  21432        if (BCM_SUCCESS(rv) && BCM_FIELD_QSET_TEST(f_ent->group->qset,
  21433                    _bcmFieldQualifyRangeCheckBits24_31)) {
  21434            /* Get field entry part that contains qualifier. */
  21435            rv = _bcm_field_entry_qual_get(unit, entry,
  21436                    _bcmFieldQualifyRangeCheckBits24_31, &f_ent);
  21437            if (BCM_FAILURE(rv)) {
  21438                FP_UNLOCK(unit);
  21439                return rv;
  21440            }
  21441 
  21442            /* Get qualifier offsets in the tcam. */
  21443            rv = _field_qual_offset_get(unit, f_ent, _bcmFieldQualifyRangeCheckBits24_31,
  21444                    &q_offset);
  21445            if (BCM_FAILURE(rv)) {
  21446                FP_UNLOCK(unit);
  21447                return (rv);
  21448            }
  21449 
  21450            /* Read qualifier match value and mask. */
  21451            rv = _bcm_field_qual_value_get(unit, q_offset, f_ent,
  21452                    data1, mask1);
  21453            if (BCM_FAILURE(rv)) {
  21454                FP_UNLOCK(unit);
  21455                return (rv);
  21456            }
  21457            data[0] |= (data1[0] & 0xff) << 24;
  21458            mask[0] |= (mask1[0] & 0xff) << 24;
  21459        }
  21460     }
  21461 
  21462     if (BCM_FAILURE(rv)) {
  21463         FP_UNLOCK(unit);
  21464         return (rv);
  21465     }
  21466 
  21467     /* Fill range indexes. */
  21468     idx = 0;
  21469     for (fr = stage_fc->ranges; fr != NULL; fr = fr->next) {
  21470         if (mask[0] & (1 <<  fr->hw_index)) {
  21471             if (idx >=  max_count) {
  21472                 idx++;
  21473                 continue;
  21474             }
  21475             if (NULL != range) {
  21476                 range[idx] = fr->rid;
  21477             }
  21478             if (NULL != invert) {
  21479                 if (data[0] & (1 << fr->hw_index)) {
  21480                     invert[idx] = FALSE;
  21481                 } else {
  21482                     invert[idx] = TRUE;
  21483                 }
  21484             }
  21485             idx++;
  21486         }
  21487     }
  21488     *count = idx;
  21489     FP_UNLOCK(unit);
  21490     return (BCM_E_NONE);
  21491 }
  21492 
  21493 /*
  21494  * Function:
  21495  *      bcm_esw_field_qualify_SrcIp6_get
  21496  * Purpose:
  21497  *      Get match criteria for bcmFieildQualifySrcIp6
  21498  *                     qualifier from the field entry.
  21499  * Parameters:
  21500  *      unit - (IN) Unit number.
  21501  *      entry - (IN) BCM field entry id.
  21502  *      data - (OUT) Qualifier match data.
  21503  *      mask - (OUT) Qualifier match mask.
  21504  * Returns:
  21505  *      BCM_E_XXX
  21506  * Notes:
  21507  */
  21508 int 
  21509 bcm_esw_field_qualify_SrcIp6_get(
  21510     int unit, 
  21511     bcm_field_entry_t entry, 
  21512     bcm_ip6_t *data, 
  21513     bcm_ip6_t *mask)
  21514 {
  21515     return _field_qualify_ip6_get(unit, entry,
  21516                                   bcmFieldQualifySrcIp6,
  21517                                   data, mask);
  21518 }
  21519 
  21520 /*
  21521  * Function:
  21522  *      bcm_esw_field_qualify_DstIp6_get
  21523  * Purpose:
  21524  *      Get match criteria for bcmFieildQualifyDstIp6
  21525  *                     qualifier from the field entry.
  21526  * Parameters:
  21527  *      unit - (IN) Unit number.
  21528  *      entry - (IN) BCM field entry id.
  21529  *      data - (OUT) Qualifier match data.
  21530  *      mask - (OUT) Qualifier match mask.
  21531  * Returns:
  21532  *      BCM_E_XXX
  21533  * Notes:
  21534  */
  21535 int 
  21536 bcm_esw_field_qualify_DstIp6_get(
  21537     int unit, 
  21538     bcm_field_entry_t entry, 
  21539     bcm_ip6_t *data, 
  21540     bcm_ip6_t *mask)
  21541 {
  21542     return _field_qualify_ip6_get(unit, entry,
  21543                                   bcmFieldQualifyDstIp6, 
  21544                                   data, mask);
  21545 }
  21546 
  21547 /*
  21548  * Function:
  21549  *      bcm_esw_field_qualify_SrcIp6High_get
  21550  * Purpose:
  21551  *      Get match criteria for bcmFieildQualifySrcIp6High
  21552  *                     qualifier from the field entry.
  21553  * Parameters:
  21554  *      unit - (IN) Unit number.
  21555  *      entry - (IN) BCM field entry id.
  21556  *      data - (OUT) Qualifier match data.
  21557  *      mask - (OUT) Qualifier match mask.
  21558  * Returns:
  21559  *      BCM_E_XXX
  21560  * Notes:
  21561  */
  21562 int 
  21563 bcm_esw_field_qualify_SrcIp6High_get(
  21564     int unit, 
  21565     bcm_field_entry_t entry, 
  21566     bcm_ip6_t *data, 
  21567     bcm_ip6_t *mask)
  21568 {
  21569     return _field_qualify_ip6_get(unit, entry,
  21570                                   bcmFieldQualifySrcIp6High,
  21571                                   data, mask);
  21572 }
  21573 
  21574 /*
  21575  * Function:
  21576  *      bcm_esw_field_qualify_SrcIp6Low_get
  21577  * Purpose:
  21578  *      Get match criteria for bcmFieildQualifySrcIp6Low
  21579  *                     qualifier from the field entry.
  21580  * Parameters:
  21581  *      unit - (IN) Unit number.
  21582  *      entry - (IN) BCM field entry id.
  21583  *      data - (OUT) Qualifier match data.
  21584  *      mask - (OUT) Qualifier match mask.
  21585  * Returns:
  21586  *      BCM_E_XXX
  21587  * Notes:
  21588  */
  21589 int 
  21590 bcm_esw_field_qualify_SrcIp6Low_get(
  21591     int unit, 
  21592     bcm_field_entry_t entry, 
  21593     bcm_ip6_t *data, 
  21594     bcm_ip6_t *mask)
  21595 {
  21596     return _field_qualify_ip6_get(unit, entry,
  21597                                   bcmFieldQualifySrcIp6Low,
  21598                                   data, mask);
  21599 }
  21600 
  21601 /*
  21602  * Function:
  21603  *      bcm_esw_field_qualify_DstIp6Low_get
  21604  * Purpose:
  21605  *      Get match criteria for bcmFieildQualifyDstIp6Low
  21606  *                     qualifier from the field entry.
  21607  * Parameters:
  21608  *      unit - (IN) Unit number.
  21609  *      entry - (IN) BCM field entry id.
  21610  *      data - (OUT) Qualifier match data.
  21611  *      mask - (OUT) Qualifier match mask.
  21612  * Returns:
  21613  *      BCM_E_XXX
  21614  * Notes:
  21615  */
  21616 int 
  21617 bcm_esw_field_qualify_DstIp6Low_get(
  21618     int unit, 
  21619     bcm_field_entry_t entry, 
  21620     bcm_ip6_t *data, 
  21621     bcm_ip6_t *mask)
  21622 {
  21623     return _field_qualify_ip6_get(unit, entry,
  21624                                   bcmFieldQualifyDstIp6Low,
  21625                                   data, mask);
  21626 }
  21627 
  21628 /*
  21629  * Function:
  21630  *      bcm_esw_field_qualify_DstIp6High_get
  21631  * Purpose:
  21632  *      Get match criteria for bcmFieildQualifyDstIp6High
  21633  *                     qualifier from the field entry.
  21634  * Parameters:
  21635  *      unit - (IN) Unit number.
  21636  *      entry - (IN) BCM field entry id.
  21637  *      data - (OUT) Qualifier match data.
  21638  *      mask - (OUT) Qualifier match mask.
  21639  * Returns:
  21640  *      BCM_E_XXX
  21641  * Notes:
  21642  */
  21643 int 
  21644 bcm_esw_field_qualify_DstIp6High_get(
  21645     int unit, 
  21646     bcm_field_entry_t entry, 
  21647     bcm_ip6_t *data, 
  21648     bcm_ip6_t *mask)
  21649 {
  21650     return _field_qualify_ip6_get(unit, entry,
  21651                                   bcmFieldQualifyDstIp6High,
  21652                                   data, mask);
  21653 }
  21654 
  21655 /*
  21656  * Function:
  21657  *      bcm_esw_field_qualify_Ip6NextHeader_get
  21658  * Purpose:
  21659  *      Get match criteria for bcmFieildQualifyIp6NextHeader
  21660  *                     qualifier from the field entry.
  21661  * Parameters:
  21662  *      unit - (IN) Unit number.
  21663  *      entry - (IN) BCM field entry id.
  21664  *      data - (OUT) Qualifier match data.
  21665  *      mask - (OUT) Qualifier match mask.
  21666  * Returns:
  21667  *      BCM_E_XXX
  21668  * Notes:
  21669  */
  21670 int 
  21671 bcm_esw_field_qualify_Ip6NextHeader_get(
  21672     int unit, 
  21673     bcm_field_entry_t entry, 
  21674     uint8 *data, 
  21675     uint8 *mask)
  21676 {
  21677     /* Read qualifier match value and mask. */
  21678     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  21679                                             bcmFieldQualifyIp6NextHeader,
  21680                                             data, mask);
  21681 }
  21682 
  21683 /*
  21684  * Function:
  21685  *      bcm_esw_field_qualify_Ip6TrafficClass_get
  21686  * Purpose:
  21687  *      Get match criteria for bcmFieildQualifyIp6TrafficClass
  21688  *                     qualifier from the field entry.
  21689  * Parameters:
  21690  *      unit - (IN) Unit number.
  21691  *      entry - (IN) BCM field entry id.
  21692  *      data - (OUT) Qualifier match data.
  21693  *      mask - (OUT) Qualifier match mask.
  21694  * Returns:
  21695  *      BCM_E_XXX
  21696  * Notes:
  21697  */
  21698 int 
  21699 bcm_esw_field_qualify_Ip6TrafficClass_get(
  21700     int unit, 
  21701     bcm_field_entry_t entry, 
  21702     uint8 *data, 
  21703     uint8 *mask)
  21704 {
  21705     /* Read qualifier match value and mask. */
  21706     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  21707                                             bcmFieldQualifyIp6TrafficClass,
  21708                                             data, mask);
  21709 }
  21710 
  21711 /*
  21712  * Function:
  21713  *      bcm_esw_field_qualify_InnerIp6FlowLabel_get
  21714  * Purpose:
  21715  *      Get match criteria for bcmFieildQualifyInnerIp6FlowLabel
  21716  *                     qualifier from the field entry.
  21717  * Parameters:
  21718  *      unit - (IN) Unit number.
  21719  *      entry - (IN) BCM field entry id.
  21720  *      data - (OUT) Qualifier match data.
  21721  *      mask - (OUT) Qualifier match mask.
  21722  * Returns:
  21723  *      BCM_E_XXX
  21724  * Notes:
  21725  */
  21726 int 
  21727 bcm_esw_field_qualify_InnerIp6FlowLabel_get(
  21728     int unit, 
  21729     bcm_field_entry_t entry, 
  21730     uint32 *data, 
  21731     uint32 *mask)
  21732 {
  21733     /* Read qualifier match value and mask. */ 
  21734     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  21735                              bcmFieldQualifyInnerIp6FlowLabel,
  21736                              data, mask);
  21737 }
  21738 
  21739 /*
  21740  * Function:
  21741  *      bcm_esw_field_qualify_Ip6FlowLabel_get
  21742  * Purpose:
  21743  *      Get match criteria for bcmFieildQualifyIp6FlowLabel
  21744  *                     qualifier from the field entry.
  21745  * Parameters:
  21746  *      unit - (IN) Unit number.
  21747  *      entry - (IN) BCM field entry id.
  21748  *      data - (OUT) Qualifier match data.
  21749  *      mask - (OUT) Qualifier match mask.
  21750  * Returns:
  21751  *      BCM_E_XXX
  21752  * Notes:
  21753  */
  21754 int 
  21755 bcm_esw_field_qualify_Ip6FlowLabel_get(
  21756     int unit, 
  21757     bcm_field_entry_t entry, 
  21758     uint32 *data, 
  21759     uint32 *mask)
  21760 {
  21761     /* Read qualifier match value and mask. */ 
  21762     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  21763                                                  bcmFieldQualifyIp6FlowLabel,
  21764                                                  data, mask);
  21765 }
  21766 
  21767 /*
  21768  * Function:
  21769  *      bcm_esw_field_qualify_Ip6HopLimit_get
  21770  * Purpose:
  21771  *      Get match criteria for bcmFieildQualifyIp6HopLimit
  21772  *                     qualifier from the field entry.
  21773  * Parameters:
  21774  *      unit - (IN) Unit number.
  21775  *      entry - (IN) BCM field entry id.
  21776  *      data - (OUT) Qualifier match data.
  21777  *      mask - (OUT) Qualifier match mask.
  21778  * Returns:
  21779  *      BCM_E_XXX
  21780  * Notes:
  21781  */
  21782 int 
  21783 bcm_esw_field_qualify_Ip6HopLimit_get(
  21784     int unit, 
  21785     bcm_field_entry_t entry, 
  21786     uint8 *data, 
  21787     uint8 *mask)
  21788 {
  21789     return bcm_esw_field_qualify_Ttl_get(unit, entry, data, mask);
  21790 }
  21791 
  21792 /*
  21793  * Function:
  21794  *      bcm_esw_field_qualify_SrcMac_get
  21795  * Purpose:
  21796  *      Get match criteria for bcmFieildQualifySrcMac
  21797  *                     qualifier from the field entry.
  21798  * Parameters:
  21799  *      unit - (IN) Unit number.
  21800  *      entry - (IN) BCM field entry id.
  21801  *      data - (OUT) Qualifier match data.
  21802  *      mask - (OUT) Qualifier match mask.
  21803  * Returns:
  21804  *      BCM_E_XXX
  21805  * Notes:
  21806  */
  21807 int 
  21808 bcm_esw_field_qualify_SrcMac_get(
  21809     int unit, 
  21810     bcm_field_entry_t entry, 
  21811     bcm_mac_t *data, 
  21812     bcm_mac_t *mask)
  21813 {
  21814     return _field_qualify_macaddr_get(unit, entry,
  21815                                       bcmFieldQualifySrcMac, 
  21816                                       data, mask);
  21817 }
  21818 
  21819 /*
  21820  * Function:
  21821  *      bcm_esw_field_qualify_DstMac_get
  21822  * Purpose:
  21823  *      Get match criteria for bcmFieildQualifyDstMac
  21824  *                     qualifier from the field entry.
  21825  * Parameters:
  21826  *      unit - (IN) Unit number.
  21827  *      entry - (IN) BCM field entry id.
  21828  *      data - (OUT) Qualifier match data.
  21829  *      mask - (OUT) Qualifier match mask.
  21830  * Returns:
  21831  *      BCM_E_XXX
  21832  * Notes:
  21833  */
  21834 int 
  21835 bcm_esw_field_qualify_DstMac_get(
  21836     int unit, 
  21837     bcm_field_entry_t entry, 
  21838     bcm_mac_t *data, 
  21839     bcm_mac_t *mask)
  21840 {
  21841     return _field_qualify_macaddr_get(unit, entry,
  21842                                       bcmFieldQualifyDstMac, 
  21843                                       data, mask);
  21844 }
  21845 
  21846 /*
  21847  * Function:
  21848  *      bcm_esw_field_qualify_InnerIpType_get
  21849  * Purpose:
  21850  *      Get match criteria for bcmFieildQualifyInnerIpType
  21851  *                     qualifier from the field entry.
  21852  * Parameters:
  21853  *      unit - (IN) Unit number.
  21854  *      entry - (IN) BCM field entry id.
  21855  *      type - (OUT) Inner ip header ip type.
  21856  * Returns:
  21857  *      BCM_E_XXX
  21858  * Notes:
  21859  */
  21860 int 
  21861 bcm_esw_field_qualify_InnerIpType_get(
  21862     int unit, 
  21863     bcm_field_entry_t entry, 
  21864     bcm_field_IpType_t *type)
  21865 {
  21866     _field_entry_t      *f_ent;  /* Field entry structure.   */
  21867     _field_control_t    *fc;     /* Field control structure. */
  21868     int                 rv;      /* Operation return status. */
  21869 
  21870     if (NULL == type) {
  21871         return (BCM_E_PARAM);
  21872     }
  21873 
  21874     
  21875     FP_LOCK(unit);
  21876     rv = _field_control_get(unit, &fc);
  21877     if (BCM_FAILURE(rv)) {
  21878         FP_UNLOCK(unit);
  21879         return rv;
  21880     }
  21881 
  21882     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  21883     if (BCM_FAILURE(rv)) {
  21884         FP_UNLOCK(unit);
  21885         return (rv);
  21886     }
  21887 
  21888     rv = fc->functions.fp_qualify_ip_type_get(unit, entry, type, 
  21889                                               bcmFieldQualifyInnerIpType);
  21890    
  21891     FP_UNLOCK(unit);
  21892 
  21893     return rv; 
  21894 }
  21895 
  21896 /*
  21897  * Function:
  21898  *      bcm_esw_field_qualify_ForwardingType_get
  21899  * Purpose:
  21900  *      Get match criteria for bcmFieildQualifyForwardingType
  21901  *                     qualifier from the field entry.
  21902  * Parameters:
  21903  *      unit - (IN) Unit number.
  21904  *      entry - (IN) BCM field entry id.
  21905  *      type - (OUT) Qualifier match forwarding type.
  21906  * Returns:
  21907  *      BCM_E_XXX
  21908  * Notes:
  21909  */
  21910 int 
  21911 bcm_esw_field_qualify_ForwardingType_get(
  21912     int unit, 
  21913     bcm_field_entry_t entry, 
  21914     bcm_field_ForwardingType_t *type)
  21915 {
  21916     int               rv;     /* Operation return structure. */
  21917     uint32            data;   /* HW qualifier value.         */
  21918     uint32            mask;   /* HW qualifier mask.          */
  21919     _field_stage_id_t stage_id;
  21920 
  21921     /* Input parameters check. */
  21922     if (NULL == type) {
  21923         return (BCM_E_PARAM);
  21924     }
  21925 
  21926 #if defined(BCM_TOMAHAWK_SUPPORT)
  21927     if (soc_feature(unit, soc_feature_field_preselector_support) && 
  21928         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
  21929         stage_id = _BCM_FIELD_STAGE_INGRESS;
  21930     } else
  21931 #endif /* BCM_TOMAHAWK_SUPPORT */
  21932     {
  21933        _field_entry_t *f_ent;
  21934 
  21935        /* Retrieve Field entry structure. */
  21936        BCM_IF_ERROR_RETURN(_field_entry_get(unit, entry,
  21937                                _FP_ENTRY_PRIMARY, &f_ent));
  21938 
  21939        stage_id = f_ent->group->stage_id;
  21940     }
  21941 
  21942     /* Read qualifier match value and mask. */ 
  21943     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  21944                              bcmFieldQualifyForwardingType,
  21945                              &data, &mask);
  21946     BCM_IF_ERROR_RETURN(rv);
  21947 
  21948     switch (stage_id) {    
  21949     case _BCM_FIELD_STAGE_INGRESS:
  21950     case _BCM_FIELD_STAGE_EXACTMATCH:
  21951 #if defined(BCM_TOMAHAWK_SUPPORT)
  21952         if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  21953 #if defined(BCM_TRIDENT3_SUPPORT)
  21954             if(soc_feature(unit, soc_feature_td3_style_fp)) {
  21955                return _bcm_field_td3_forwardingType_get(unit, stage_id, entry, 
  21956                                                    data, mask, type);
  21957             } else
  21958 #endif
  21959 #if defined(BCM_TOMAHAWK3_SUPPORT)
  21960             if(soc_feature(unit, soc_feature_fp_no_dvp_support)) {
  21961                return _bcm_field_th3_forwardingType_get(unit, stage_id, entry, 
  21962                                                    data, mask, type);
  21963             } else
  21964 #endif
  21965             {
  21966            return _bcm_field_th_forwardingType_get(unit, stage_id, entry, 
  21967                                                    data, mask, type);
  21968         }
  21969         }
  21970 #endif /* BCM_TOMAHAWK_SUPPORT */ 
  21971         if ((0 == data) && (mask == 0)) {
  21972             *type = bcmFieldForwardingTypeAny;
  21973         } else if ((0 == data) && (mask == 6)) {
  21974             *type = bcmFieldForwardingTypeL2;
  21975         } else if ((0 == data) && (mask == 7)) {
  21976             *type = bcmFieldForwardingTypeL2Independent;
  21977         } else if ((1 == data) && (mask == 7)) {
  21978             *type = bcmFieldForwardingTypeL2Shared;
  21979         } else if ((2 == data) && (mask == 7)) {
  21980             *type =  bcmFieldForwardingTypeL2Vpn;
  21981         } else if ((3 == data) && (mask == 7)) {
  21982             *type = bcmFieldForwardingTypeL2VpnDirect;
  21983         } else if ((4 == data) && (mask == 7)) {
  21984             *type = bcmFieldForwardingTypeL3Direct;
  21985         } else if ((5 == data) && (mask == 7)) {
  21986             *type = bcmFieldForwardingTypeL3;
  21987         } else if ((7 == data) && (mask == 7)) {
  21988             *type = bcmFieldForwardingTypeMpls;
  21989         } else {
  21990             return (BCM_E_INTERNAL);
  21991         }
  21992         return (BCM_E_NONE);
  21993         
  21994     case _BCM_FIELD_STAGE_EXTERNAL:
  21995         /* N.B.  Currently only supported for Triumph2 */
  21996         
  21997         if (mask == 0) {
  21998             *type = bcmFieldForwardingTypeAny;
  21999         } else if (data == 0) {
  22000             *type = bcmFieldForwardingTypeL2;
  22001         } else {
  22002             *type = bcmFieldForwardingTypeL2Vpn;            
  22003         }
  22004 
  22005         return (BCM_E_NONE);
  22006 
  22007     case _BCM_FIELD_STAGE_EGRESS:
  22008 
  22009 #ifdef BCM_TRIUMPH3_SUPPORT
  22010 
  22011         if ((SOC_IS_KATANA2(unit)) || (SOC_IS_TRIUMPH3(unit)) ||
  22012                 (SOC_IS_TD2_TT2(unit))) {
  22013             if ((0 == data) && (mask == 0)) {
  22014                 *type = bcmFieldForwardingTypeAny;
  22015             } else if ((1 == data) && (mask == 3)) {
  22016                 *type = bcmFieldForwardingTypeL2Independent;
  22017             } else if ((2 == data) && (mask == 3)) {
  22018                 *type =  bcmFieldForwardingTypeL2Vpn;
  22019             } else if ((3 == data) && (mask == 3)) {
  22020                 *type = bcmFieldForwardingTypeL3;
  22021             } else {
  22022                 return (BCM_E_INTERNAL);
  22023             }
  22024             return (BCM_E_NONE);
  22025         }
  22026 #endif
  22027 
  22028     default:
  22029         ;
  22030     }
  22031 
  22032     return (BCM_E_INTERNAL);
  22033 }
  22034 
  22035 /*
  22036  * Function:
  22037  *      bcm_esw_field_qualify_IpType_get
  22038  * Purpose:
  22039  *      Get match criteria for bcmFieildQualifyIpType
  22040  *                     qualifier from the field entry.
  22041  * Parameters:
  22042  *      unit - (IN) Unit number.
  22043  *      entry - (IN) BCM field entry id.
  22044  *      type - (OUT) Qualifier match ip type.
  22045  * Returns: *      BCM_E_XXX * Notes: */
  22046 int 
  22047 bcm_esw_field_qualify_IpType_get(int unit, 
  22048                                  bcm_field_entry_t entry, 
  22049                                  bcm_field_IpType_t *type)
  22050 {
  22051     _field_control_t    *fc;     /* Field control structure. */
  22052     int                 rv;      /* Operation return status. */
  22053 
  22054     if (NULL == type) {
  22055         return (BCM_E_PARAM);
  22056     }
  22057 
  22058     
  22059     FP_LOCK(unit);
  22060     rv = _field_control_get(unit, &fc);
  22061     if (BCM_FAILURE(rv)) {
  22062         FP_UNLOCK(unit);
  22063         return rv;
  22064     }
  22065 
  22066     rv = fc->functions.fp_qualify_ip_type_get(unit, entry, type,
  22067                                               bcmFieldQualifyIpType);
  22068     FP_UNLOCK(unit);
  22069     return (rv);
  22070 }
  22071 
  22072 /*
  22073  * Function:
  22074  *      bcm_esw_field_qualify_L2Format_get
  22075  * Purpose:
  22076  *      Get match criteria for bcmFieildQualifyL2Format
  22077  *                     qualifier from the field entry.
  22078  * Parameters:
  22079  *      unit - (IN) Unit number.
  22080  *      entry - (IN) BCM field entry id.
  22081  *      type - (OUT) Qualifier match l2 format.
  22082  * Returns:
  22083  *      BCM_E_XXX
  22084  * Notes:
  22085  */
  22086 int 
  22087 bcm_esw_field_qualify_L2Format_get(
  22088     int unit, 
  22089     bcm_field_entry_t entry, 
  22090     bcm_field_L2Format_t *type)
  22091 {
  22092     int       rv;     /* Operation return structure. */
  22093     uint32    data = 0;/* HW qualifier value.         */
  22094     uint32    mask = 0;/* HW qualifier mask.          */
  22095 
  22096     /* Input parameters check. */
  22097     if (NULL == type) {
  22098         return (BCM_E_PARAM);
  22099     }
  22100 
  22101     /* Read qualifier match value and mask. */ 
  22102     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  22103                              bcmFieldQualifyL2Format,
  22104                              &data, &mask);
  22105     if ((0 == data) && (mask == 0)) {
  22106         *type = bcmFieldL2FormatAny;
  22107     } else if ((0 == data) && (mask == 3)) {
  22108         *type = bcmFieldL2FormatEthII;
  22109     } else if ((1 == data) && (mask == 3)) {
  22110         *type = bcmFieldL2FormatSnap;
  22111     } else if ((2 == data) && (mask == 7)) {
  22112         *type = bcmFieldL2FormatLlc;
  22113     } else {
  22114         return (BCM_E_INTERNAL);
  22115     }
  22116     return (rv);
  22117 }
  22118 
  22119 /*
  22120  * Function:
  22121  *      bcm_esw_field_qualify_VlanFormat_get
  22122  * Purpose:
  22123  *      Get match criteria for bcmFieildQualifyVlanFormat
  22124  *                     qualifier from the field entry.
  22125  * Parameters:
  22126  *      unit - (IN) Unit number.
  22127  *      entry - (IN) BCM field entry id.
  22128  *      data - (OUT) Qualifier match data.
  22129  *      mask - (OUT) Qualifier match mask.
  22130  * Returns:
  22131  *      BCM_E_XXX
  22132  * Notes:
  22133  */
  22134 int 
  22135 bcm_esw_field_qualify_VlanFormat_get(
  22136     int unit, 
  22137     bcm_field_entry_t entry, 
  22138     uint8 *data, 
  22139     uint8 *mask)
  22140 {
  22141     int              rv;        /* Operation return status. */
  22142 
  22143 
  22144     
  22145     FP_LOCK(unit);
  22146 
  22147     rv = _field_qualify_VlanFormat_get(unit, entry, 
  22148                                           bcmFieldQualifyVlanFormat,
  22149                                           data, mask);
  22150     FP_UNLOCK(unit);
  22151     return (rv);
  22152 }
  22153 
  22154 /*
  22155  * Function:
  22156  *      bcm_esw_field_qualify_MHOpcode_get
  22157  * Purpose:
  22158  *      Get match criteria for bcmFieildQualifyMHOpcode
  22159  *                     qualifier from the field entry.
  22160  * Parameters:
  22161  *      unit - (IN) Unit number.
  22162  *      entry - (IN) BCM field entry id.
  22163  *      data - (OUT) Qualifier match data.
  22164  *      mask - (OUT) Qualifier match mask.
  22165  * Returns:
  22166  *      BCM_E_XXX
  22167  * Notes:
  22168  */
  22169 int 
  22170 bcm_esw_field_qualify_MHOpcode_get(
  22171     int unit, 
  22172     bcm_field_entry_t entry, 
  22173     uint8 *data, 
  22174     uint8 *mask)
  22175 {
  22176     /* Read qualifier match value and mask. */
  22177     return  _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  22178                              bcmFieldQualifyMHOpcode,
  22179                              data, mask);
  22180 }
  22181 
  22182 /*
  22183  * Function:
  22184  *     bcm_esw_field_qualify_Decap_get
  22185  * Purpose:
  22186  *     Get match criteria for bcmFieildQualifyDecap
  22187  *     qualifier from the field entry.
  22188  * Parameters:
  22189  *     unit  - (IN) Unit number.
  22190  *     entry - (IN) BCM field entry id.
  22191  *     decap - (OUT) Qualifier Decap type.
  22192  * Returns:
  22193  *     BCM_E_XXX
  22194  * Notes:
  22195  */
  22196 int
  22197 bcm_esw_field_qualify_Decap_get(int unit, bcm_field_entry_t entry,
  22198                                 bcm_field_decap_t *decap)
  22199 {
  22200     int rv = BCM_E_UNAVAIL;
  22201 #ifdef BCM_GREYHOUND2_SUPPORT
  22202     uint8 data = 0;  /* Installed entry value */
  22203     uint8 mask = 0;  /* Installed entry mask */
  22204 
  22205     if (soc_feature(unit, soc_feature_vxlan_lite_riot)) {
  22206         /* Input parameters check. */
  22207         if (NULL == decap) {
  22208             return BCM_E_PARAM;
  22209         }
  22210 
  22211         /* Read qualifier match value and mask. */
  22212         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  22213                                                   bcmFieldQualifyDecap,
  22214                                                   &data, &mask);
  22215         BCM_IF_ERROR_RETURN(rv);
  22216 
  22217         if (data == 0) {
  22218             *decap = bcmFieldDecapNone;
  22219         } else if (data == 0x1 && mask == 0x1) {
  22220             *decap = bcmFieldDecapVxlan;
  22221         } else {
  22222             return BCM_E_INTERNAL;
  22223         }
  22224     }
  22225 #endif /* BCM_GREYHOUND2_SUPPORT */
  22226 
  22227     return rv;
  22228 }
  22229 
  22230 /*
  22231  * Function:
  22232  *      bcm_esw_field_qualify_HiGig_get
  22233  * Purpose:
  22234  *      Qualify on HiGig packets.
  22235  * Parameters:
  22236  *      unit - (IN) Unit number.
  22237  *      entry - (IN) BCM field entry id.
  22238  *      data - (OUT) Qualifier match data.
  22239  *      mask - (OUT) Qualifier match mask.
  22240  * Returns:
  22241  *      BCM_E_XXX
  22242  * Notes:
  22243  */
  22244 int 
  22245 bcm_esw_field_qualify_HiGig_get(
  22246     int unit, 
  22247     bcm_field_entry_t entry, 
  22248     uint8 *data, 
  22249     uint8 *mask)
  22250 {
  22251     _field_entry_t   *f_ent;  /* Field entry structure.   */
  22252     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
  22253 
  22254     /* Input parameters check. */
  22255     if ((NULL == data) || (NULL == mask)) {
  22256         return (BCM_E_PARAM);
  22257     }
  22258 
  22259     if (SOC_IS_TRX(unit)) {
  22260         /* Read qualifier match value and mask. */
  22261         return  _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  22262                                                      bcmFieldQualifyHiGig,
  22263                                                      data, mask);
  22264     } else if (SOC_IS_FBX(unit)) {
  22265         
  22266         FP_LOCK(unit);
  22267 
  22268         rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  22269 
  22270         FP_UNLOCK(unit);
  22271         BCM_IF_ERROR_RETURN(rv);
  22272 
  22273         /* Add data & mask to entry. */
  22274         *data = f_ent->tcam.higig;
  22275         *mask = f_ent->tcam.higig_mask;
  22276     }
  22277     return (rv);
  22278 }
  22279 
  22280 /*
  22281  * Function:
  22282  *      bcm_esw_field_qualify_InterfaceClassPort_get
  22283  * Purpose:
  22284  *      Get match criteria for bcmFieildQualifyInterfaceClassPort
  22285  *                     qualifier from the field entry.
  22286  * Parameters:
  22287  *      unit - (IN) Unit number.
  22288  *      entry - (IN) BCM field entry id.
  22289  *      data - (OUT) Qualifier match data.
  22290  *      mask - (OUT) Qualifier match mask.
  22291  * Returns:
  22292  *      BCM_E_XXX
  22293  * Notes:
  22294  */
  22295 int 
  22296 bcm_esw_field_qualify_InterfaceClassPort_get(
  22297     int unit, 
  22298     bcm_field_entry_t entry, 
  22299     uint32 *data, 
  22300     uint32 *mask)
  22301 {
  22302     /* Read qualifier match value and mask. */ 
  22303     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  22304                                                               entry, 
  22305                                                               bcmFieldQualifyInterfaceClassPort,
  22306                                                               data,
  22307                                                               mask
  22308                                                               )
  22309                         );
  22310 
  22311     return (BCM_E_NONE);
  22312 }
  22313 
  22314 /*
  22315  * Function:
  22316  *      bcm_esw_field_qualify_InterfaceClassVPort_get
  22317  * Purpose:
  22318  *      Get match criteria for bcmFieildQualifyInterfaceClassVPort
  22319  *                     qualifier from the field entry.
  22320  * Parameters:
  22321  *      unit - (IN) Unit number.
  22322  *      entry - (IN) BCM field entry id.
  22323  *      data - (OUT) Qualifier match data.
  22324  *      mask - (OUT) Qualifier match mask.
  22325  * Returns:
  22326  *      BCM_E_XXX
  22327  * Notes:
  22328  */
  22329 int
  22330 bcm_esw_field_qualify_InterfaceClassVPort_get(
  22331     int unit,
  22332     bcm_field_entry_t entry,
  22333     uint32 *data,
  22334     uint32 *mask)
  22335 {
  22336     /* Read qualifier match value and mask. */
  22337     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  22338                                                               entry,
  22339                                                               bcmFieldQualifyInterfaceClassVPort,
  22340                                                               data,
  22341                                                               mask
  22342                                                               )
  22343                         );
  22344 
  22345     return (BCM_E_NONE);
  22346 }
  22347 
  22348 /*
  22349  * Function:
  22350  *      bcm_esw_field_qualify_IngressInterfaceClassVPort
  22351  * Purpose:
  22352  *      Set match criteria for bcmFieildQualifyIngressInterfaceClassVPort
  22353  *      qualifier from the field entry.
  22354  * Parameters:
  22355  *      unit    - (IN) Unit number.
  22356  *      entry   - (IN) BCM field entry id.
  22357  *      data    - (IN) Qualifier match data.
  22358  *      mask    - (IN) Qualifier match mask.
  22359  * Returns:
  22360  *      BCM_E_XXX
  22361  * Notes:
  22362  */
  22363 int
  22364 bcm_esw_field_qualify_IngressInterfaceClassVPort(
  22365     int unit,
  22366     bcm_field_entry_t entry,
  22367     uint32 data,
  22368     uint32 mask)
  22369 {
  22370     int                    rv;
  22371 
  22372 
  22373 #if defined(BCM_TOMAHAWK_SUPPORT)
  22374     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  22375         BCM_IF_ERROR_RETURN
  22376           (_bcm_field_th_qualify_class(unit, entry,
  22377                                       bcmFieldQualifyIngressInterfaceClassVPort,
  22378                                       &data, &mask));
  22379     } else
  22380 #endif /* BCM_TOMAHAWK_SUPPORT */
  22381 #ifdef BCM_TRIDENT2_SUPPORT
  22382     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  22383         BCM_IF_ERROR_RETURN
  22384             (_bcm_field_td2_qualify_class(unit,
  22385                                           entry,
  22386                                           bcmFieldQualifyIngressInterfaceClassVPort,
  22387                                           &data,
  22388                                           &mask
  22389                                           )
  22390             );
  22391     } else
  22392 #endif
  22393 #ifdef BCM_TRIUMPH3_SUPPORT
  22394     if (SOC_IS_TRIUMPH3(unit)) {
  22395         BCM_IF_ERROR_RETURN
  22396             (_bcm_field_tr3_qualify_class(unit,
  22397                                           entry,
  22398                                           bcmFieldQualifyIngressInterfaceClassVPort,
  22399                                           &data,
  22400                                           &mask
  22401                                           )
  22402             );
  22403     } else
  22404 #endif
  22405 #ifdef BCM_KATANA2_SUPPORT
  22406     if (SOC_IS_KATANA2(unit)) {
  22407         BCM_IF_ERROR_RETURN
  22408             (_bcm_field_kt2_qualify_class(unit,
  22409                                           entry,
  22410                                           bcmFieldQualifyIngressInterfaceClassVPort,
  22411                                           &data,
  22412                                           &mask
  22413                                           ));
  22414     } else 
  22415 #endif /* BCM_KATANA2_SUPPORT */
  22416     {
  22417         /* Input parameters check. */
  22418         if (data > SOC_ADDR_CLASS_MAX(unit)) {
  22419             return (BCM_E_PARAM);
  22420         }
  22421     }
  22422 
  22423     
  22424     FP_LOCK(unit);
  22425 
  22426     rv = _field_qualify32(unit, entry, bcmFieldQualifyIngressInterfaceClassVPort,
  22427                           data, mask);
  22428     FP_UNLOCK(unit);
  22429     return (rv);
  22430 
  22431 }
  22432 
  22433 /*
  22434  * Function:
  22435  *      bcm_esw_field_qualify_IngressInterfaceClassVPort_get
  22436  * Purpose:
  22437  *      Get match criteria for bcmFieildQualifyIngressInterfaceClassVPort
  22438  *      qualifier from the field entry.
  22439  * Parameters:
  22440  *      unit    - (IN) Unit number.
  22441  *      entry   - (IN) BCM field entry id.
  22442  *      data    - (OUT) Qualifier match data.
  22443  *      mask    - (OUT) Qualifier match mask.
  22444  * Returns:
  22445  *      BCM_E_XXX
  22446  * Notes:
  22447  */
  22448 int
  22449 bcm_esw_field_qualify_IngressInterfaceClassVPort_get(
  22450     int unit,
  22451     bcm_field_entry_t entry,
  22452     uint32 *data,
  22453     uint32 *mask)
  22454 {
  22455     /*Read qualifier and match value and mask */
  22456 
  22457     BCM_IF_ERROR_RETURN
  22458         (_bcm_field_entry_qualifier_uint32_get(unit,
  22459                                                entry,
  22460                                                bcmFieldQualifyIngressInterfaceClassVPort,
  22461                                                data,
  22462                                                mask)
  22463         );
  22464 
  22465 #if defined(BCM_TOMAHAWK_SUPPORT)
  22466     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  22467         BCM_IF_ERROR_RETURN
  22468           (_bcm_field_th_qualify_class_get(unit, entry,
  22469                                       bcmFieldQualifyIngressInterfaceClassVPort,
  22470                                       data, mask));
  22471     } else
  22472 #endif /* BCM_TOMAHAWK_SUPPORT */
  22473 #ifdef BCM_TRIDENT2_SUPPORT
  22474      if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  22475          BCM_IF_ERROR_RETURN
  22476              (_bcm_field_td2_qualify_class_get(unit,
  22477                                                entry,
  22478                                                bcmFieldQualifyIngressInterfaceClassVPort,
  22479                                                data,
  22480                                                mask)
  22481              );
  22482         return (BCM_E_NONE);
  22483 
  22484      } else
  22485 #endif
  22486 #if defined BCM_KATANA2_SUPPORT
  22487     if (SOC_IS_KATANA2(unit)){
  22488         BCM_IF_ERROR_RETURN
  22489             (_bcm_field_kt2_qualify_class_get(unit,
  22490                                               entry,
  22491                                               bcmFieldQualifyIngressInterfaceClassVPort,
  22492                                               data,
  22493                                               mask
  22494                                              )
  22495             );
  22496         return (BCM_E_NONE);
  22497     } else
  22498 #endif
  22499 
  22500 #ifdef BCM_TRIUMPH3_SUPPORT
  22501      if (SOC_IS_TRIUMPH3(unit)) {
  22502          BCM_IF_ERROR_RETURN
  22503              (_bcm_field_tr3_qualify_class_get(unit,
  22504                                                entry,
  22505                                                bcmFieldQualifyIngressInterfaceClassVPort,
  22506                                                data,
  22507                                                mask)
  22508              );
  22509          return (BCM_E_NONE);
  22510 
  22511      }
  22512 #endif
  22513      return (BCM_E_NONE);
  22514 
  22515 }
  22516 
  22517 /*
  22518  * Function:
  22519  *      bcm_esw_field_qualify_InterfaceClassL2_get
  22520  * Purpose:
  22521  *      Get match criteria for bcmFieildQualifyInterfaceClassL2
  22522  *                     qualifier from the field entry.
  22523  * Parameters:
  22524  *      unit - (IN) Unit number.
  22525  *      entry - (IN) BCM field entry id.
  22526  *      data - (OUT) Qualifier match data.
  22527  *      mask - (OUT) Qualifier match mask.
  22528  * Returns:
  22529  *      BCM_E_XXX
  22530  * Notes:
  22531  */
  22532 int 
  22533 bcm_esw_field_qualify_InterfaceClassL2_get(
  22534     int unit, 
  22535     bcm_field_entry_t entry, 
  22536     uint32 *data, 
  22537     uint32 *mask)
  22538 {
  22539     /* Read qualifier match value and mask. */ 
  22540     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  22541                                                               entry, 
  22542                                                               bcmFieldQualifyInterfaceClassL2,
  22543                                                               data,
  22544                                                               mask
  22545                                                               )
  22546                         );
  22547 #if defined(BCM_TOMAHAWK_SUPPORT)
  22548     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  22549         BCM_IF_ERROR_RETURN
  22550           (_bcm_field_th_qualify_class_get(unit, entry,
  22551                                            bcmFieldQualifyInterfaceClassL2,
  22552                                            data, mask));
  22553     } else
  22554 #endif /* BCM_TOMAHAWK_SUPPORT */
  22555 #ifdef BCM_TRIDENT2_SUPPORT
  22556     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  22557         BCM_IF_ERROR_RETURN
  22558             (_bcm_field_td2_qualify_class_get(unit,
  22559                                               entry,
  22560                                               bcmFieldQualifyInterfaceClassL2,
  22561                                               data,
  22562                                               mask
  22563                                               )
  22564             );
  22565         return (BCM_E_NONE);
  22566     }
  22567 #endif
  22568 #if defined BCM_KATANA2_SUPPORT
  22569     if (SOC_IS_KATANA2(unit)){
  22570         BCM_IF_ERROR_RETURN
  22571             (_bcm_field_kt2_qualify_class_get(unit,
  22572                                               entry,
  22573                                               bcmFieldQualifyInterfaceClassL2,
  22574                                               data,
  22575                                               mask
  22576                                              )
  22577             );
  22578         return (BCM_E_NONE);
  22579     }
  22580 #endif
  22581 #ifdef BCM_TRIUMPH3_SUPPORT
  22582     if (SOC_IS_TRIUMPH3(unit)) {
  22583         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class_get(unit,
  22584                                                              entry,
  22585                                                              bcmFieldQualifyInterfaceClassL2,
  22586                                                              data,
  22587                                                              mask
  22588                                                              )
  22589                             );
  22590     }
  22591 #endif
  22592     return (BCM_E_NONE);
  22593 }
  22594 
  22595 /*
  22596  * Function:
  22597  *      bcm_esw_field_qualify_InterfaceClassL3_get
  22598  * Purpose:
  22599  *      Get match criteria for bcmFieildQualifyInterfaceClassL3
  22600  *                     qualifier from the field entry.
  22601  * Parameters:
  22602  *      unit - (IN) Unit number.
  22603  *      entry - (IN) BCM field entry id.
  22604  *      data - (OUT) Qualifier match data.
  22605  *      mask - (OUT) Qualifier match mask.
  22606  * Returns:
  22607  *      BCM_E_XXX
  22608  * Notes:
  22609  */
  22610 int 
  22611 bcm_esw_field_qualify_InterfaceClassL3_get(
  22612     int unit, 
  22613     bcm_field_entry_t entry, 
  22614     uint32 *data, 
  22615     uint32 *mask)
  22616 {
  22617     /* Read qualifier match value and mask. */ 
  22618     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  22619                                                               entry, 
  22620                                                               bcmFieldQualifyInterfaceClassL3,
  22621                                                               data,
  22622                                                               mask
  22623                                                               )
  22624                         );
  22625 #if defined(BCM_TOMAHAWK_SUPPORT)
  22626     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  22627         BCM_IF_ERROR_RETURN
  22628           (_bcm_field_th_qualify_class_get(unit, entry,
  22629                                            bcmFieldQualifyInterfaceClassL3,
  22630                                            data, mask));
  22631     } else
  22632 #endif /* BCM_TOMAHAWK_SUPPORT */
  22633 #ifdef BCM_TRIDENT2_SUPPORT
  22634     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  22635         BCM_IF_ERROR_RETURN
  22636             (_bcm_field_td2_qualify_class_get(unit,
  22637                                               entry,
  22638                                               bcmFieldQualifyInterfaceClassL3,
  22639                                               data,
  22640                                               mask
  22641                                               )
  22642             );
  22643         return (BCM_E_NONE);
  22644     }
  22645 #endif
  22646 #if defined BCM_KATANA2_SUPPORT
  22647     if (SOC_IS_KATANA2(unit)){
  22648         BCM_IF_ERROR_RETURN
  22649             (_bcm_field_kt2_qualify_class_get(unit,
  22650                                               entry,
  22651                                               bcmFieldQualifyInterfaceClassL3,
  22652                                               data,
  22653                                               mask
  22654                                              )
  22655             );
  22656         return (BCM_E_NONE);
  22657     }
  22658 #endif
  22659 #ifdef BCM_TRIUMPH3_SUPPORT
  22660     if (SOC_IS_TRIUMPH3(unit)) {
  22661         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class_get(unit,
  22662                                                              entry,
  22663                                                              bcmFieldQualifyInterfaceClassL3,
  22664                                                              data,
  22665                                                              mask
  22666                                                              )
  22667                             );
  22668     }
  22669 #endif
  22670     return (BCM_E_NONE);
  22671 }
  22672 
  22673 /*
  22674  * Function:
  22675  *      bcm_esw_field_qualify_SrcClassL2_get
  22676  * Purpose:
  22677  *      Get match criteria for bcmFieildQualifySrcClassL2
  22678  *                     qualifier from the field entry.
  22679  * Parameters:
  22680  *      unit - (IN) Unit number.
  22681  *      entry - (IN) BCM field entry id.
  22682  *      data - (OUT) Qualifier match data.
  22683  *      mask - (OUT) Qualifier match mask.
  22684  * Returns:
  22685  *      BCM_E_XXX
  22686  * Notes:
  22687  */
  22688 int 
  22689 bcm_esw_field_qualify_SrcClassL2_get(
  22690     int unit, 
  22691     bcm_field_entry_t entry, 
  22692     uint32 *data, 
  22693     uint32 *mask)
  22694 {
  22695     /* Read qualifier match value and mask. */ 
  22696     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  22697                                                               entry, 
  22698                                                               bcmFieldQualifySrcClassL2,
  22699                                                               data,
  22700                                                               mask
  22701                                                               )
  22702                         );
  22703 
  22704 #if defined(BCM_TOMAHAWK_SUPPORT)
  22705     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  22706         BCM_IF_ERROR_RETURN
  22707           (_bcm_field_th_qualify_class_get(unit, entry,
  22708                                            bcmFieldQualifySrcClassL2,
  22709                                            data, mask));
  22710     } else
  22711 #endif /* BCM_TOMAHAWK_SUPPORT */
  22712 #ifdef BCM_TRIDENT2_SUPPORT
  22713     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  22714         BCM_IF_ERROR_RETURN
  22715             (_bcm_field_td2_qualify_class_get(unit,
  22716                                               entry,
  22717                                               bcmFieldQualifySrcClassL2,
  22718                                               data,
  22719                                               mask
  22720                                               )
  22721             );
  22722         return (BCM_E_NONE);
  22723     }
  22724 #endif
  22725 #if defined BCM_KATANA2_SUPPORT
  22726     if (SOC_IS_KATANA2(unit)){
  22727         BCM_IF_ERROR_RETURN
  22728             (_bcm_field_kt2_qualify_class_get(unit,
  22729                                               entry,
  22730                                               bcmFieldQualifySrcClassL2,
  22731                                               data,
  22732                                               mask
  22733                                              )
  22734             );
  22735         return (BCM_E_NONE);
  22736     }
  22737 #endif
  22738 #ifdef BCM_TRIUMPH3_SUPPORT
  22739     if (SOC_IS_TRIUMPH3(unit)) {
  22740         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class_get(unit,
  22741                                                              entry,
  22742                                                              bcmFieldQualifySrcClassL2,
  22743                                                              data,
  22744                                                              mask
  22745                                                              )
  22746                             );
  22747     }
  22748 #endif
  22749     return (BCM_E_NONE);
  22750 }
  22751 
  22752 /*
  22753  * Function:
  22754  *      bcm_esw_field_qualify_SrcClassL3_get
  22755  * Purpose:
  22756  *      Get match criteria for bcmFieildQualifySrcClassL3
  22757  *                     qualifier from the field entry.
  22758  * Parameters:
  22759  *      unit - (IN) Unit number.
  22760  *      entry - (IN) BCM field entry id.
  22761  *      data - (OUT) Qualifier match data.
  22762  *      mask - (OUT) Qualifier match mask.
  22763  * Returns:
  22764  *      BCM_E_XXX
  22765  * Notes:
  22766  */
  22767 int 
  22768 bcm_esw_field_qualify_SrcClassL3_get(
  22769     int unit, 
  22770     bcm_field_entry_t entry, 
  22771     uint32 *data, 
  22772     uint32 *mask)
  22773 {
  22774     /* Read qualifier match value and mask. */ 
  22775     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  22776                                                               entry, 
  22777                                                               bcmFieldQualifySrcClassL3,
  22778                                                               data,
  22779                                                               mask
  22780                                                               )
  22781                         );
  22782 
  22783 #if defined(BCM_TOMAHAWK_SUPPORT)
  22784     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  22785         BCM_IF_ERROR_RETURN
  22786           (_bcm_field_th_qualify_class_get(unit, entry,
  22787                                            bcmFieldQualifySrcClassL3,
  22788                                            data, mask));
  22789     } else
  22790 #endif /* BCM_TOMAHAWK_SUPPORT */
  22791 #ifdef BCM_TRIDENT2_SUPPORT
  22792     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  22793         BCM_IF_ERROR_RETURN
  22794             (_bcm_field_td2_qualify_class_get(unit,
  22795                                               entry,
  22796                                               bcmFieldQualifySrcClassL3,
  22797                                               data,
  22798                                               mask
  22799                                               )
  22800             );
  22801         return (BCM_E_NONE);
  22802     }
  22803 #endif
  22804 #if defined BCM_KATANA2_SUPPORT
  22805     if (SOC_IS_KATANA2(unit)){
  22806         BCM_IF_ERROR_RETURN
  22807             (_bcm_field_kt2_qualify_class_get(unit,
  22808                                               entry,
  22809                                               bcmFieldQualifySrcClassL3,
  22810                                               data,
  22811                                               mask
  22812                                              )
  22813             );
  22814         return (BCM_E_NONE);
  22815     }
  22816 #endif
  22817 #ifdef BCM_TRIUMPH3_SUPPORT
  22818     if (SOC_IS_TRIUMPH3(unit)) {
  22819         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class_get(unit,
  22820                                                              entry,
  22821                                                              bcmFieldQualifySrcClassL3,
  22822                                                              data,
  22823                                                              mask
  22824                                                              )
  22825                             );
  22826     }
  22827 #endif
  22828     return (BCM_E_NONE);
  22829 }
  22830 
  22831 /*
  22832  * Function:
  22833  *      bcm_esw_field_qualify_SrcClassField_get
  22834  * Purpose:
  22835  *      Get match criteria for bcmFieildQualifySrcClassField
  22836  *                     qualifier from the field entry.
  22837  * Parameters:
  22838  *      unit - (IN) Unit number.
  22839  *      entry - (IN) BCM field entry id.
  22840  *      data - (OUT) Qualifier match data.
  22841  *      mask - (OUT) Qualifier match mask.
  22842  * Returns:
  22843  *      BCM_E_XXX
  22844  * Notes:
  22845  */
  22846 int 
  22847 bcm_esw_field_qualify_SrcClassField_get(
  22848     int unit, 
  22849     bcm_field_entry_t entry, 
  22850     uint32 *data, 
  22851     uint32 *mask)
  22852 {
  22853     /* Read qualifier match value and mask. */ 
  22854     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  22855                                                               entry, 
  22856                                                               bcmFieldQualifySrcClassField,
  22857                                                               data,
  22858                                                               mask
  22859                                                               )
  22860                         );
  22861 
  22862 #if defined(BCM_TOMAHAWK_SUPPORT)
  22863     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  22864         BCM_IF_ERROR_RETURN
  22865           (_bcm_field_th_qualify_class_get(unit, entry,
  22866                                            bcmFieldQualifySrcClassField,
  22867                                            data, mask));
  22868     } else
  22869 #endif /* BCM_TOMAHAWK_SUPPORT */
  22870 #ifdef BCM_TRIDENT2_SUPPORT
  22871     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  22872         BCM_IF_ERROR_RETURN
  22873             (_bcm_field_td2_qualify_class_get(unit,
  22874                                               entry,
  22875                                               bcmFieldQualifySrcClassField,
  22876                                               data,
  22877                                               mask
  22878                                               )
  22879             );
  22880         return (BCM_E_NONE);
  22881     }
  22882 #endif
  22883 #if defined BCM_KATANA2_SUPPORT
  22884     if (SOC_IS_KATANA2(unit)){
  22885         BCM_IF_ERROR_RETURN
  22886             (_bcm_field_kt2_qualify_class_get(unit,
  22887                                               entry,
  22888                                               bcmFieldQualifySrcClassField,
  22889                                               data,
  22890                                               mask
  22891                                              )
  22892             );
  22893         return (BCM_E_NONE);
  22894     }
  22895 #endif
  22896 #ifdef BCM_TRIUMPH3_SUPPORT
  22897     if (SOC_IS_TRIUMPH3(unit)) {
  22898         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class_get(unit,
  22899                                                              entry,
  22900                                                              bcmFieldQualifySrcClassField,
  22901                                                              data,
  22902                                                              mask
  22903                                                              )
  22904                             );
  22905     }
  22906 #endif
  22907     return (BCM_E_NONE);
  22908 }
  22909 
  22910 /*
  22911  * Function:
  22912  *      bcm_esw_field_qualify_DstClassL2_get
  22913  * Purpose:
  22914  *      Get match criteria for bcmFieildQualifyDstClassL2
  22915  *                     qualifier from the field entry.
  22916  * Parameters:
  22917  *      unit - (IN) Unit number.
  22918  *      entry - (IN) BCM field entry id.
  22919  *      data - (OUT) Qualifier match data.
  22920  *      mask - (OUT) Qualifier match mask.
  22921  * Returns:
  22922  *      BCM_E_XXX
  22923  * Notes:
  22924  */
  22925 int 
  22926 bcm_esw_field_qualify_DstClassL2_get(
  22927     int unit, 
  22928     bcm_field_entry_t entry, 
  22929     uint32 *data, 
  22930     uint32 *mask)
  22931 {
  22932     /* Read qualifier match value and mask. */ 
  22933     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  22934                                                               entry, 
  22935                                                               bcmFieldQualifyDstClassL2,
  22936                                                               data,
  22937                                                               mask
  22938                                                               )
  22939                         );
  22940 
  22941 #if defined(BCM_TOMAHAWK_SUPPORT)
  22942     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  22943         BCM_IF_ERROR_RETURN
  22944           (_bcm_field_th_qualify_class_get(unit, entry,
  22945                                            bcmFieldQualifyDstClassL2,
  22946                                            data, mask));
  22947     } else
  22948 #endif /* BCM_TOMAHAWK_SUPPORT */
  22949 #ifdef BCM_TRIDENT2_SUPPORT
  22950     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  22951         BCM_IF_ERROR_RETURN
  22952             (_bcm_field_td2_qualify_class_get(unit,
  22953                                               entry,
  22954                                               bcmFieldQualifyDstClassL2,
  22955                                               data,
  22956                                               mask
  22957                                               )
  22958             );
  22959         return (BCM_E_NONE);
  22960     }
  22961 #endif
  22962 #if defined BCM_KATANA2_SUPPORT
  22963     if (SOC_IS_KATANA2(unit)){
  22964         BCM_IF_ERROR_RETURN
  22965             (_bcm_field_kt2_qualify_class_get(unit,
  22966                                               entry,
  22967                                               bcmFieldQualifyDstClassL2,
  22968                                               data,
  22969                                               mask
  22970                                              )
  22971             );
  22972         return (BCM_E_NONE);
  22973     }
  22974 #endif
  22975 #ifdef BCM_TRIUMPH3_SUPPORT
  22976     if (SOC_IS_TRIUMPH3(unit)) {
  22977         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class_get(unit,
  22978                                                              entry,
  22979                                                              bcmFieldQualifyDstClassL2,
  22980                                                              data,
  22981                                                              mask
  22982                                                              )
  22983                             );
  22984     }
  22985 #endif
  22986     return (BCM_E_NONE);
  22987 }
  22988 
  22989 /*
  22990  * Function:
  22991  *      bcm_esw_field_qualify_DstClassL3_get
  22992  * Purpose:
  22993  *      Get match criteria for bcmFieildQualifyDstClassL3
  22994  *                     qualifier from the field entry.
  22995  * Parameters:
  22996  *      unit - (IN) Unit number.
  22997  *      entry - (IN) BCM field entry id.
  22998  *      data - (OUT) Qualifier match data.
  22999  *      mask - (OUT) Qualifier match mask.
  23000  * Returns:
  23001  *      BCM_E_XXX
  23002  * Notes:
  23003  */
  23004 int 
  23005 bcm_esw_field_qualify_DstClassL3_get(
  23006     int unit, 
  23007     bcm_field_entry_t entry, 
  23008     uint32 *data, 
  23009     uint32 *mask)
  23010 {
  23011     /* Read qualifier match value and mask. */ 
  23012     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  23013                                                               entry, 
  23014                                                               bcmFieldQualifyDstClassL3,
  23015                                                               data,
  23016                                                               mask
  23017                                                               )
  23018                         );
  23019 
  23020 #if defined(BCM_TOMAHAWK_SUPPORT)
  23021     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  23022         BCM_IF_ERROR_RETURN
  23023           (_bcm_field_th_qualify_class_get(unit, entry,
  23024                                            bcmFieldQualifyDstClassL3,
  23025                                            data, mask));
  23026     } else
  23027 #endif /* BCM_TOMAHAWK_SUPPORT */
  23028 #ifdef BCM_TRIDENT2_SUPPORT
  23029     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  23030         BCM_IF_ERROR_RETURN
  23031             (_bcm_field_td2_qualify_class_get(unit,
  23032                                               entry,
  23033                                               bcmFieldQualifyDstClassL3,
  23034                                               data,
  23035                                               mask
  23036                                               )
  23037             );
  23038         return (BCM_E_NONE);
  23039     }
  23040 #endif
  23041 #if defined BCM_KATANA2_SUPPORT
  23042     if (SOC_IS_KATANA2(unit)){
  23043         BCM_IF_ERROR_RETURN
  23044             (_bcm_field_kt2_qualify_class_get(unit,
  23045                                               entry,
  23046                                               bcmFieldQualifyDstClassL3,
  23047                                               data,
  23048                                               mask
  23049                                              )
  23050             );
  23051         return (BCM_E_NONE);
  23052     }
  23053 #endif
  23054 #ifdef BCM_TRIUMPH3_SUPPORT
  23055     if (SOC_IS_TRIUMPH3(unit)) {
  23056         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class_get(unit,
  23057                                                              entry,
  23058                                                              bcmFieldQualifyDstClassL3,
  23059                                                              data,
  23060                                                              mask
  23061                                                              )
  23062                             );
  23063     }
  23064 #endif
  23065     return (BCM_E_NONE);
  23066 }
  23067 
  23068 /*
  23069  * Function:
  23070  *      bcm_esw_field_qualify_DstClassField_get
  23071  * Purpose:
  23072  *      Get match criteria for bcmFieildQualifyDstClassField
  23073  *                     qualifier from the field entry.
  23074  * Parameters:
  23075  *      unit - (IN) Unit number.
  23076  *      entry - (IN) BCM field entry id.
  23077  *      data - (OUT) Qualifier match data.
  23078  *      mask - (OUT) Qualifier match mask.
  23079  * Returns:
  23080  *      BCM_E_XXX
  23081  * Notes:
  23082  */
  23083 int 
  23084 bcm_esw_field_qualify_DstClassField_get(
  23085     int unit, 
  23086     bcm_field_entry_t entry, 
  23087     uint32 *data, 
  23088     uint32 *mask)
  23089 {
  23090     /* Read qualifier match value and mask. */ 
  23091     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  23092                                                               entry, 
  23093                                                               bcmFieldQualifyDstClassField,
  23094                                                               data,
  23095                                                               mask
  23096                                                               )
  23097                         );
  23098 
  23099 #if defined(BCM_TOMAHAWK_SUPPORT)
  23100     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  23101         BCM_IF_ERROR_RETURN
  23102           (_bcm_field_th_qualify_class_get(unit, entry,
  23103                                            bcmFieldQualifyDstClassField,
  23104                                            data, mask));
  23105     } else
  23106 #endif /* BCM_TOMAHAWK_SUPPORT */
  23107 #ifdef BCM_TRIDENT2_SUPPORT
  23108     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  23109         BCM_IF_ERROR_RETURN
  23110             (_bcm_field_td2_qualify_class_get(unit,
  23111                                               entry,
  23112                                               bcmFieldQualifyDstClassField,
  23113                                               data,
  23114                                               mask
  23115                                               )
  23116             );
  23117         return (BCM_E_NONE);
  23118     }
  23119 #endif
  23120 #if defined BCM_KATANA2_SUPPORT
  23121     if (SOC_IS_KATANA2(unit)){
  23122         BCM_IF_ERROR_RETURN
  23123             (_bcm_field_kt2_qualify_class_get(unit,
  23124                                               entry,
  23125                                               bcmFieldQualifyDstClassField,
  23126                                               data,
  23127                                               mask
  23128                                              )
  23129             );
  23130         return (BCM_E_NONE);
  23131     }
  23132 #endif
  23133 #ifdef BCM_TRIUMPH3_SUPPORT
  23134     if (SOC_IS_TRIUMPH3(unit)) {
  23135         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class_get(unit,
  23136                                                              entry,
  23137                                                              bcmFieldQualifyDstClassField,
  23138                                                              data,
  23139                                                              mask
  23140                                                              )
  23141                             );
  23142     }
  23143 #endif
  23144     return (BCM_E_NONE);
  23145 }
  23146 
  23147 /*
  23148  * Function:
  23149  *      bcm_esw_field_qualify_IpProtocolCommon_get
  23150  * Purpose:
  23151  *      Get match criteria for bcmFieildQualifyIpProtocolCommon
  23152  *                     qualifier from the field entry.
  23153  * Parameters:
  23154  *      unit - (IN) Unit number.
  23155  *      entry - (IN) BCM field entry id.
  23156  *      protocol - (OUT) Qualifier protocol encoding.
  23157  * Returns:
  23158  *      BCM_E_XXX
  23159  * Notes:
  23160  */
  23161 int 
  23162 bcm_esw_field_qualify_IpProtocolCommon_get(
  23163     int unit, 
  23164     bcm_field_entry_t entry, 
  23165     bcm_field_IpProtocolCommon_t *protocol)
  23166 {
  23167     return _field_qualify_IpProtocolCommon_get(unit, entry, 
  23168                                     bcmFieldQualifyIpProtocolCommon,
  23169                                     protocol);
  23170 }
  23171 
  23172 /*
  23173  * Function:
  23174  *      bcm_esw_field_qualify_InnerIpProtocolCommon_get
  23175  * Purpose:
  23176  *      Get match criteria for bcmFieildQualifyInnerIpProtocolCommon
  23177  *                     qualifier from the field entry.
  23178  * Parameters:
  23179  *      unit - (IN) Unit number.
  23180  *      entry - (IN) BCM field entry id.
  23181  *      protocol - (OUT) Qualifier inner ip protocol encodnig.
  23182  * Returns:
  23183  *      BCM_E_XXX
  23184  * Notes:
  23185  */
  23186 int 
  23187 bcm_esw_field_qualify_InnerIpProtocolCommon_get(
  23188     int unit, 
  23189     bcm_field_entry_t entry, 
  23190     bcm_field_IpProtocolCommon_t *protocol)
  23191 {
  23192     return _field_qualify_IpProtocolCommon_get(unit, entry, 
  23193                                     bcmFieldQualifyInnerIpProtocolCommon,
  23194                                     protocol);
  23195 }
  23196 
  23197 /*
  23198  * Function:
  23199  *      bcm_esw_field_qualify_Snap_get
  23200  * Purpose:
  23201  *      Get match criteria for bcmFieildQualifySnap
  23202  *                     qualifier from the field entry.
  23203  * Parameters:
  23204  *      unit - (IN) Unit number.
  23205  *      entry - (IN) BCM field entry id.
  23206  *      data - (OUT) Qualifier match data.
  23207  *      mask - (OUT) Qualifier match mask.
  23208  * Returns:
  23209  *      BCM_E_XXX
  23210  * Notes:
  23211  */
  23212 int 
  23213 bcm_esw_field_qualify_Snap_get(
  23214     int unit, 
  23215     bcm_field_entry_t entry, 
  23216     bcm_field_snap_header_t *data, 
  23217     bcm_field_snap_header_t *mask)
  23218 {
  23219     _bcm_field_qual_offset_t *q_offset;
  23220     _field_entry_t           *f_ent;
  23221     uint32                   ref_data[_FP_QUAL_DATA_WORDS];
  23222     uint32                   ref_mask[_FP_QUAL_DATA_WORDS];
  23223     int                      rv;
  23224 
  23225     /* Input parameters check. */
  23226     if ((NULL == data) || (NULL == mask)) {
  23227         return (BCM_E_PARAM);
  23228     }
  23229 
  23230     /* Initialization. */
  23231     sal_memset(ref_data, 0, _FP_QUAL_DATA_WORDS * sizeof(uint32));
  23232     sal_memset(ref_mask, 0, _FP_QUAL_DATA_WORDS * sizeof(uint32));
  23233 
  23234     /* Get field entry part that contains the qualifier. */
  23235     rv = _bcm_field_entry_qual_get(unit, entry, 
  23236                                    bcmFieldQualifySnap, &f_ent);
  23237     BCM_IF_ERROR_RETURN(rv);
  23238 #if defined(BCM_TOMAHAWK_SUPPORT)
  23239     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  23240        /* Read qualifier match value and mask. */
  23241        rv = _field_entry_qualifier_key_get(unit, entry, bcmFieldQualifySnap,
  23242                                         ref_data, ref_mask);
  23243     } else
  23244 #endif /* BCM_TOMAHAWK_SUPPORT */
  23245     {
  23246       /* Get qualifier offsets in the tcam. */
  23247       rv = _field_qual_offset_get(unit, f_ent, 
  23248                                   bcmFieldQualifySnap, &q_offset);
  23249       BCM_IF_ERROR_RETURN(rv);
  23250 
  23251       /* Read qualifier match value and mask. */
  23252       rv = _bcm_field_qual_value_get(unit, q_offset, f_ent, 
  23253                                      ref_data, ref_mask);
  23254     }
  23255     BCM_IF_ERROR_RETURN(rv);
  23256 
  23257     data->org_code = (ref_data[1] << 16) | (ref_data[0] >> 16);
  23258     data->type = ref_data[0] & 0xffff;
  23259 
  23260     mask->org_code = (ref_mask[1] << 16) | (ref_mask[0] >> 16);
  23261     mask->type = ref_mask[0] & 0xffff;
  23262 
  23263     return (BCM_E_NONE);
  23264 }
  23265 
  23266 /*
  23267  * Function:
  23268  *      bcm_esw_field_qualify_Llc_get
  23269  * Purpose:
  23270  *      Get match criteria for bcmFieildQualifyLlc
  23271  *                     qualifier from the field entry.
  23272  * Parameters:
  23273  *      unit - (IN) Unit number.
  23274  *      entry - (IN) BCM field entry id.
  23275  *      data - (OUT) Qualifier match data.
  23276  *      mask - (OUT) Qualifier match mask.
  23277  * Returns:
  23278  *      BCM_E_XXX
  23279  * Notes:
  23280  */
  23281 int 
  23282 bcm_esw_field_qualify_Llc_get(
  23283     int unit, 
  23284     bcm_field_entry_t entry, 
  23285     bcm_field_llc_header_t *data, 
  23286     bcm_field_llc_header_t *mask)
  23287 {
  23288     uint32    hw_data = 0;       /* HW buffer data.             */
  23289     uint32    hw_mask = 0;       /* HW buffer mask.             */
  23290     int       rv;                /* Operation return stauts.    */
  23291 
  23292     /* Input parameters check. */
  23293     if ((NULL == data) || (NULL == mask)) {
  23294         return (BCM_E_PARAM);
  23295     }
  23296 
  23297     /* Read qualifier match value and mask. */ 
  23298     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  23299                                                bcmFieldQualifyLlc,
  23300                                                &hw_data, &hw_mask);
  23301     BCM_IF_ERROR_RETURN(rv);
  23302 
  23303     data->dsap    = (hw_data>> 16) & 0xff;
  23304     data->ssap    = (hw_data >> 8)  & 0xff;
  23305     data->control = hw_data & 0xff;
  23306 
  23307     mask->dsap    = (hw_mask >> 16) & 0xff;
  23308     mask->ssap    = (hw_mask >> 8)  & 0xff;
  23309     mask->control = hw_mask & 0xff;
  23310 
  23311     return (BCM_E_NONE);
  23312 }
  23313 
  23314 /*
  23315  * Function:
  23316  *      bcm_esw_field_qualify_InnerTpid_get
  23317  * Purpose:
  23318  *      Get match criteria for bcmFieildQualifyInnerTpid
  23319  *                     qualifier from the field entry.
  23320  * Parameters:
  23321  *      unit - (IN) Unit number.
  23322  *      entry - (IN) BCM field entry id.
  23323  *      tpid - (OUT) Qualifier tpid.
  23324  * Returns:
  23325  *      BCM_E_XXX
  23326  * Notes:
  23327  */
  23328 int 
  23329 bcm_esw_field_qualify_InnerTpid_get(
  23330     int unit, 
  23331     bcm_field_entry_t entry, 
  23332     uint16 *tpid)
  23333 {
  23334     uint32    hw_data = 0;       /* HW buffer data.             */
  23335     uint32    hw_mask = 0;       /* HW buffer mask.             */
  23336     int       rv;                /* Operation return stauts.    */
  23337 
  23338     /* Input parameters check. */
  23339     if (NULL == tpid) {
  23340         return (BCM_E_PARAM);
  23341     }
  23342 
  23343     /* Read qualifier match value and mask. */ 
  23344     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  23345                                                bcmFieldQualifyInnerTpid,
  23346                                                &hw_data, &hw_mask);
  23347     BCM_IF_ERROR_RETURN(rv);
  23348 
  23349     if (hw_mask == 0) {
  23350         return BCM_E_NOT_FOUND;
  23351     }
  23352 #if defined(BCM_TRIDENT3_SUPPORT)
  23353     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  23354         rv = _bcm_field_td3_tpid_hw_decode(unit, hw_data, 0, tpid);
  23355     } else
  23356 #endif
  23357     {
  23358     rv = _field_tpid_hw_decode(unit, hw_data, tpid);
  23359     }
  23360     return (rv);
  23361 }
  23362 
  23363 /*
  23364  * Function:
  23365  *      bcm_esw_field_qualify_OuterTpid_get
  23366  * Purpose:
  23367  *      Get match criteria for bcmFieildQualifyOuterTpid
  23368  *                     qualifier from the field entry.
  23369  * Parameters:
  23370  *      unit - (IN) Unit number.
  23371  *      entry - (IN) BCM field entry id.
  23372  *      tpid - (OUT) Qualifier tpid.
  23373  * Returns:
  23374  *      BCM_E_XXX
  23375  * Notes:
  23376  */
  23377 int 
  23378 bcm_esw_field_qualify_OuterTpid_get(
  23379     int unit, 
  23380     bcm_field_entry_t entry, 
  23381     uint16 *tpid)
  23382 {
  23383     uint32    hw_data = 0;       /* HW buffer data.             */
  23384     uint32    hw_mask = 0;       /* HW buffer mask.             */
  23385     int       rv;                /* Operation return stauts.    */
  23386 
  23387     /* Input parameters check. */
  23388     if (NULL == tpid) {
  23389         return (BCM_E_PARAM);
  23390     }
  23391 
  23392     /* Read qualifier match value and mask. */ 
  23393     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  23394                                                bcmFieldQualifyOuterTpid,
  23395                                                &hw_data, &hw_mask);
  23396     BCM_IF_ERROR_RETURN(rv);
  23397 
  23398     if (hw_mask == 0) {
  23399         return BCM_E_NOT_FOUND;
  23400     }
  23401 #if defined(BCM_TRIDENT3_SUPPORT)
  23402     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  23403         rv = _bcm_field_td3_tpid_hw_decode(unit, hw_data, 1, tpid);
  23404     } else
  23405 #endif
  23406     {
  23407     rv = _field_tpid_hw_decode(unit, hw_data, tpid);
  23408     }
  23409     return (rv);
  23410 }
  23411 
  23412 /*
  23413  * Function:
  23414  *      bcm_esw_field_qualify_L3Routable_get
  23415  * Purpose:
  23416  *      Get match criteria for bcmFieildQualifyL3Routable
  23417  *                     qualifier from the field entry.
  23418  * Parameters:
  23419  *      unit - (IN) Unit number.
  23420  *      entry - (IN) BCM field entry id.
  23421  *      data - (OUT) Qualifier match data.
  23422  *      mask - (OUT) Qualifier match mask.
  23423  * Returns:
  23424  *      BCM_E_XXX
  23425  * Notes:
  23426  */
  23427 int 
  23428 bcm_esw_field_qualify_L3Routable_get(
  23429     int unit, 
  23430     bcm_field_entry_t entry, 
  23431     uint8 *data, 
  23432     uint8 *mask)
  23433 {
  23434     /* Read qualifier match value and mask. */
  23435     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  23436                                                 bcmFieldQualifyL3Routable,
  23437                                                 data, mask);
  23438 }
  23439 
  23440 /*
  23441  * Function:
  23442  *      bcm_esw_field_qualify_IpFrag_get
  23443  * Purpose:
  23444  *      Get match criteria for bcmFieildQualifyIpFrag
  23445  *                     qualifier from the field entry.
  23446  * Parameters:
  23447  *      unit - (IN) Unit number.
  23448  *      entry - (IN) BCM field entry id.
  23449  *      frag_info - (OUT) Qualifier ip framentation encoding.
  23450  * Returns:
  23451  *      BCM_E_XXX
  23452  * Notes:
  23453  */
  23454 int 
  23455 bcm_esw_field_qualify_IpFrag_get(
  23456     int unit, 
  23457     bcm_field_entry_t entry, 
  23458     bcm_field_IpFrag_t *frag_info)
  23459 {
  23460     int             rv = BCM_E_UNAVAIL;
  23461 #if defined(BCM_FIREBOLT2_SUPPORT) || defined(BCM_TRX_SUPPORT) \
  23462     || defined(BCM_RAPTOR_SUPPORT)
  23463 
  23464     
  23465     FP_LOCK(unit);
  23466 
  23467     if (SOC_IS_FIREBOLT2(unit) || SOC_IS_TRX(unit) || 
  23468         SOC_IS_RAVEN(unit) || SOC_IS_HAWKEYE(unit)) {
  23469         rv = _field_qualify_IpFrag_get(unit, entry, 
  23470                                        bcmFieldQualifyIpFrag, 
  23471                                        frag_info);
  23472     }
  23473     FP_UNLOCK(unit);
  23474 #endif /* BCM_FIREBOLT2_SUPPORT || BCM_TRX_SUPPORT || BCM_RAPTOR_SUPPORT */
  23475     return (rv);
  23476 }
  23477 
  23478 /*
  23479  * Function:
  23480  *      bcm_esw_field_qualify_Vrf_get
  23481  * Purpose:
  23482  *      Get match criteria for bcmFieildQualifyVrf
  23483  *                     qualifier from the field entry.
  23484  * Parameters:
  23485  *      unit - (IN) Unit number.
  23486  *      entry - (IN) BCM field entry id.
  23487  *      data - (OUT) Qualifier match data.
  23488  *      mask - (OUT) Qualifier match mask.
  23489  * Returns:
  23490  *      BCM_E_XXX
  23491  * Notes:
  23492  */
  23493 int 
  23494 bcm_esw_field_qualify_Vrf_get(
  23495     int unit, 
  23496     bcm_field_entry_t entry, 
  23497     uint32 *data, 
  23498     uint32 *mask)
  23499 {
  23500     /* Read qualifier match value and mask. */ 
  23501     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  23502                                                  bcmFieldQualifyVrf,
  23503                                                  data, mask);
  23504 }
  23505 
  23506 /*
  23507  * Function:
  23508  *      bcm_esw_field_qualify_L3Ingress_get
  23509  * Purpose:
  23510  *      Get match criteria for bcmFieildQualifyL3Ingress
  23511  *                     qualifier from the field entry.
  23512  * Parameters:
  23513  *      unit - (IN) Unit number.
  23514  *      entry - (IN) BCM field entry id.
  23515  *      data - (OUT) Qualifier match data.
  23516  *      mask - (OUT) Qualifier match mask.
  23517  * Returns:
  23518  *      BCM_E_XXX
  23519  * Notes:
  23520  */
  23521 int 
  23522 bcm_esw_field_qualify_L3Ingress_get(
  23523     int unit, 
  23524     bcm_field_entry_t entry, 
  23525     uint32 *data, 
  23526     uint32 *mask)
  23527 {
  23528     /* Read qualifier match value and mask. */ 
  23529     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  23530                                                  bcmFieldQualifyL3Ingress,
  23531                                                  data, mask);
  23532 }
  23533 
  23534 /*
  23535  * Function:
  23536  *      bcm_esw_field_qualify_ExtensionHeaderType_get
  23537  * Purpose:
  23538  *      Get match criteria for bcmFieildQualifyExtensionHeaderType
  23539  *                     qualifier from the field entry.
  23540  * Parameters:
  23541  *      unit - (IN) Unit number.
  23542  *      entry - (IN) BCM field entry id.
  23543  *      data - (OUT) Qualifier match data.
  23544  *      mask - (OUT) Qualifier match mask.
  23545  * Returns:
  23546  *      BCM_E_XXX
  23547  * Notes:
  23548  */
  23549 int 
  23550 bcm_esw_field_qualify_ExtensionHeaderType_get(
  23551     int unit, 
  23552     bcm_field_entry_t entry, 
  23553     uint8 *data, 
  23554     uint8 *mask)
  23555 {
  23556     /* Read qualifier match value and mask. */
  23557     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  23558                                    bcmFieldQualifyExtensionHeaderType,
  23559                                    data, mask);
  23560 }
  23561 
  23562 /*
  23563  * Function:
  23564  *      bcm_esw_field_qualify_ExtensionHeaderSubCode_get
  23565  * Purpose:
  23566  *      Get match criteria for bcmFieildQualifyExtensionHeaderSubCode
  23567  *                     qualifier from the field entry.
  23568  * Parameters:
  23569  *      unit - (IN) Unit number.
  23570  *      entry - (IN) BCM field entry id.
  23571  *      data - (OUT) Qualifier match data.
  23572  *      mask - (OUT) Qualifier match mask.
  23573  * Returns:
  23574  *      BCM_E_XXX
  23575  * Notes:
  23576  */
  23577 int 
  23578 bcm_esw_field_qualify_ExtensionHeaderSubCode_get(
  23579     int unit, 
  23580     bcm_field_entry_t entry, 
  23581     uint8 *data, 
  23582     uint8 *mask)
  23583 {
  23584     /* Read qualifier match value and mask. */
  23585     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  23586                                    bcmFieldQualifyExtensionHeaderSubCode,
  23587                                    data, mask);
  23588 }
  23589 
  23590 /*
  23591  * Function:
  23592  *      bcm_esw_field_qualify_ExtensionHeader2Type_get
  23593  * Purpose:
  23594  *      Get match criteria for bcmFieildQualifyExtensionHeader2Type
  23595  *                     qualifier from the field entry.
  23596  * Parameters:
  23597  *      unit - (IN) Unit number.
  23598  *      entry - (IN) BCM field entry id.
  23599  *      data - (OUT) Qualifier match data.
  23600  *      mask - (OUT) Qualifier match mask.
  23601  * Returns:
  23602  *      BCM_E_XXX
  23603  * Notes:
  23604  */
  23605 int 
  23606 bcm_esw_field_qualify_ExtensionHeader2Type_get(
  23607     int unit, 
  23608     bcm_field_entry_t entry, 
  23609     uint8 *data, 
  23610     uint8 *mask)
  23611 {
  23612     /* Read qualifier match value and mask. */
  23613     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  23614                                    bcmFieldQualifyExtensionHeader2Type,
  23615                                    data, mask);
  23616 }
  23617 
  23618 /*
  23619  * Function:
  23620  *      bcm_esw_field_qualify_L4Ports_get
  23621  * Purpose:
  23622  *      Get match criteria for bcmFieildQualifyL4Ports
  23623  *                     qualifier from the field entry.
  23624  * Parameters:
  23625  *      unit - (IN) Unit number.
  23626  *      entry - (IN) BCM field entry id.
  23627  *      data - (OUT) Qualifier match data.
  23628  *      mask - (OUT) Qualifier match mask.
  23629  * Returns:
  23630  *      BCM_E_XXX
  23631  * Notes:
  23632  */
  23633 int 
  23634 bcm_esw_field_qualify_L4Ports_get(
  23635     int unit, 
  23636     bcm_field_entry_t entry, 
  23637     uint8 *data, 
  23638     uint8 *mask)
  23639 {
  23640     /* Read qualifier match value and mask. */
  23641     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  23642                                    bcmFieldQualifyL4Ports,
  23643                                    data, mask);
  23644 }
  23645 
  23646 /*
  23647  * Function:
  23648  *      bcm_esw_field_qualify_MirrorCopy_get
  23649  * Purpose:
  23650  *      Get match criteria for bcmFieildQualifyMirrorCopy
  23651  *                     qualifier from the field entry.
  23652  * Parameters:
  23653  *      unit - (IN) Unit number.
  23654  *      entry - (IN) BCM field entry id.
  23655  *      data - (OUT) Qualifier match data.
  23656  *      mask - (OUT) Qualifier match mask.
  23657  * Returns:
  23658  *      BCM_E_XXX
  23659  * Notes:
  23660  */
  23661 int 
  23662 bcm_esw_field_qualify_MirrorCopy_get(
  23663     int unit, 
  23664     bcm_field_entry_t entry, 
  23665     uint8 *data, 
  23666     uint8 *mask)
  23667 {
  23668     /* Read qualifier match value and mask. */
  23669     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  23670                                    bcmFieldQualifyMirrorCopy,
  23671                                    data, mask);
  23672 }
  23673 
  23674 /*
  23675  * Function:
  23676  *      bcm_esw_field_qualify_TunnelTerminated_get
  23677  * Purpose:
  23678  *      Get match criteria for bcmFieildQualifyTunnelTerminated
  23679  *                     qualifier from the field entry.
  23680  * Parameters:
  23681  *      unit - (IN) Unit number.
  23682  *      entry - (IN) BCM field entry id.
  23683  *      data - (OUT) Qualifier match data.
  23684  *      mask - (OUT) Qualifier match mask.
  23685  * Returns:
  23686  *      BCM_E_XXX
  23687  * Notes:
  23688  */
  23689 int 
  23690 bcm_esw_field_qualify_TunnelTerminated_get(
  23691     int unit, 
  23692     bcm_field_entry_t entry, 
  23693     uint8 *data, 
  23694     uint8 *mask)
  23695 {
  23696     /* Read qualifier match value and mask. */
  23697     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  23698                                    bcmFieldQualifyTunnelTerminated,
  23699                                    data, mask);
  23700 }
  23701 
  23702 /*
  23703  * Function:
  23704  *      bcm_esw_field_qualify_MplsTerminated_get
  23705  * Purpose:
  23706  *      Get match criteria for bcmFieildQualifyMplsTerminated
  23707  *                     qualifier from the field entry.
  23708  * Parameters:
  23709  *      unit - (IN) Unit number.
  23710  *      entry - (IN) BCM field entry id.
  23711  *      data - (OUT) Qualifier match data.
  23712  *      mask - (OUT) Qualifier match mask.
  23713  * Returns:
  23714  *      BCM_E_XXX
  23715  * Notes:
  23716  */
  23717 int 
  23718 bcm_esw_field_qualify_MplsTerminated_get(
  23719     int unit, 
  23720     bcm_field_entry_t entry, 
  23721     uint8 *data, 
  23722     uint8 *mask)
  23723 {
  23724     _field_group_t *fg;         /* Field group structure        */
  23725     int i = 0;                  /* Entry parts                  */
  23726     int rv = BCM_E_INTERNAL;    /* Operation return stauts.     */
  23727 
  23728     /* Input parameters check. */
  23729     if ((NULL == data) || (NULL == mask))  {
  23730         return (BCM_E_PARAM);
  23731     }
  23732 
  23733     /* Read qualifier match value and mask. */ 
  23734     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  23735                                     bcmFieldQualifyMplsTerminated,
  23736                                     data, mask);
  23737     BCM_IF_ERROR_RETURN(rv);
  23738     if (SOC_IS_TRIUMPH2(unit) || SOC_IS_KATANAX(unit)) {
  23739         BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
  23740         for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
  23741             if ((int8) bcmFieldTunnelTypeMpls
  23742                     == fg->sel_codes[i].loopback_type_sel) {
  23743                 if ((uint8) bcmFieldTunnelTypeMpls == (*data & *mask)) {
  23744                     *data = 0x1;
  23745                     *mask = 0x1;
  23746                 }
  23747                 break;
  23748             }
  23749         }
  23750     }
  23751     return (rv);
  23752 }
  23753 
  23754 /*
  23755  * Function:
  23756  *      bcm_esw_field_qualify_InnerSrcIp_get
  23757  * Purpose:
  23758  *      Get match criteria for bcmFieildQualifyInnerSrcIp
  23759  *                     qualifier from the field entry.
  23760  * Parameters:
  23761  *      unit - (IN) Unit number.
  23762  *      entry - (IN) BCM field entry id.
  23763  *      data - (OUT) Qualifier match data.
  23764  *      mask - (OUT) Qualifier match mask.
  23765  * Returns:
  23766  *      BCM_E_XXX
  23767  * Notes:
  23768  */
  23769 int 
  23770 bcm_esw_field_qualify_InnerSrcIp_get(
  23771     int unit, 
  23772     bcm_field_entry_t entry, 
  23773     bcm_ip_t *data, 
  23774     bcm_ip_t *mask)
  23775 {
  23776     /* Read qualifier match value and mask. */ 
  23777     return  _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  23778                                               bcmFieldQualifyInnerSrcIp,
  23779                                               data, mask);
  23780 }
  23781 
  23782 /*
  23783  * Function:
  23784  *      bcm_esw_field_qualify_InnerDstIp_get
  23785  * Purpose:
  23786  *      Get match criteria for bcmFieildQualifyInnerDstIp
  23787  *                     qualifier from the field entry.
  23788  * Parameters:
  23789  *      unit - (IN) Unit number.
  23790  *      entry - (IN) BCM field entry id.
  23791  *      data - (OUT) Qualifier match data.
  23792  *      mask - (OUT) Qualifier match mask.
  23793  * Returns:
  23794  *      BCM_E_XXX
  23795  * Notes:
  23796  */
  23797 int 
  23798 bcm_esw_field_qualify_InnerDstIp_get(
  23799     int unit, 
  23800     bcm_field_entry_t entry, 
  23801     bcm_ip_t *data, 
  23802     bcm_ip_t *mask)
  23803 {
  23804     /* Read qualifier match value and mask. */ 
  23805     return  _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  23806                                                   bcmFieldQualifyInnerDstIp,
  23807                                                   data, mask);
  23808 }
  23809 
  23810 /*
  23811  * Function:
  23812  *      bcm_esw_field_qualify_InnerSrcIp6_get
  23813  * Purpose:
  23814  *      Get match criteria for bcmFieildQualifyInnerSrcIp6
  23815  *                     qualifier from the field entry.
  23816  * Parameters:
  23817  *      unit - (IN) Unit number.
  23818  *      entry - (IN) BCM field entry id.
  23819  *      data - (OUT) Qualifier match data.
  23820  *      mask - (OUT) Qualifier match mask.
  23821  * Returns:
  23822  *      BCM_E_XXX
  23823  * Notes:
  23824  */
  23825 int 
  23826 bcm_esw_field_qualify_InnerSrcIp6_get(
  23827     int unit, 
  23828     bcm_field_entry_t entry, 
  23829     bcm_ip6_t *data, 
  23830     bcm_ip6_t *mask)
  23831 {
  23832     return _field_qualify_ip6_get(unit, entry,
  23833                                   bcmFieldQualifyInnerSrcIp6,
  23834                                   data, mask);
  23835 }
  23836 
  23837 /*
  23838  * Function:
  23839  *      bcm_esw_field_qualify_InnerDstIp6_get
  23840  * Purpose:
  23841  *      Get match criteria for bcmFieildQualifyInnerDstIp6
  23842  *                     qualifier from the field entry.
  23843  * Parameters:
  23844  *      unit - (IN) Unit number.
  23845  *      entry - (IN) BCM field entry id.
  23846  *      data - (OUT) Qualifier match data.
  23847  *      mask - (OUT) Qualifier match mask.
  23848  * Returns:
  23849  *      BCM_E_XXX
  23850  * Notes:
  23851  */
  23852 int 
  23853 bcm_esw_field_qualify_InnerDstIp6_get(
  23854     int unit, 
  23855     bcm_field_entry_t entry, 
  23856     bcm_ip6_t *data, 
  23857     bcm_ip6_t *mask)
  23858 {
  23859     return _field_qualify_ip6_get(unit, entry,
  23860                                   bcmFieldQualifyInnerDstIp6, 
  23861                                   data, mask);
  23862 }
  23863 
  23864 /*
  23865  * Function:
  23866  *      bcm_esw_field_qualify_InnerSrcIp6High_get
  23867  * Purpose:
  23868  *      Get match criteria for bcmFieildQualifyInnerSrcIp6High
  23869  *                     qualifier from the field entry.
  23870  * Parameters:
  23871  *      unit - (IN) Unit number.
  23872  *      entry - (IN) BCM field entry id.
  23873  *      data - (OUT) Qualifier match data.
  23874  *      mask - (OUT) Qualifier match mask.
  23875  * Returns:
  23876  *      BCM_E_XXX
  23877  * Notes:
  23878  */
  23879 int 
  23880 bcm_esw_field_qualify_InnerSrcIp6High_get(
  23881     int unit, 
  23882     bcm_field_entry_t entry, 
  23883     bcm_ip6_t *data, 
  23884     bcm_ip6_t *mask)
  23885 {
  23886     return _field_qualify_ip6_get(unit, entry,
  23887                                   bcmFieldQualifyInnerSrcIp6High,
  23888                                   data, mask);
  23889 }
  23890 
  23891 /*
  23892  * Function:
  23893  *      bcm_esw_field_qualify_InnerDstIp6High_get
  23894  * Purpose:
  23895  *      Get match criteria for bcmFieildQualifyInnerDstIp6High
  23896  *                     qualifier from the field entry.
  23897  * Parameters:
  23898  *      unit - (IN) Unit number.
  23899  *      entry - (IN) BCM field entry id.
  23900  *      data - (OUT) Qualifier match data.
  23901  *      mask - (OUT) Qualifier match mask.
  23902  * Returns:
  23903  *      BCM_E_XXX
  23904  * Notes:
  23905  */
  23906 int 
  23907 bcm_esw_field_qualify_InnerDstIp6High_get(
  23908     int unit, 
  23909     bcm_field_entry_t entry, 
  23910     bcm_ip6_t *data, 
  23911     bcm_ip6_t *mask)
  23912 {
  23913     return _field_qualify_ip6_get(unit, entry,
  23914                                   bcmFieldQualifyInnerDstIp6High,
  23915                                   data, mask);
  23916 }
  23917 
  23918 /*
  23919  * Function:
  23920  *      bcm_esw_field_qualify_DstMultipath
  23921  * Purpose:
  23922  *     Add a multipath egress object field qualification to a field entry.
  23923  * Parameters:
  23924  *      unit - (IN) Unit number.
  23925  *      entry - (IN) Field Entry id.
  23926  *      mpintf - (IN) Multipath egress object id. 
  23927  * Returns:
  23928  *      BCM_E_XXX
  23929  * Notes:
  23930  */
  23931 int
  23932 bcm_esw_field_qualify_DstMultipath(int               unit, 
  23933                                    bcm_field_entry_t entry, 
  23934                                    bcm_if_t          mpintf
  23935                                    )
  23936 {
  23937     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
  23938 
  23939 #if defined(INCLUDE_L3)
  23940 #if defined(BCM_TOMAHAWK_SUPPORT)
  23941     _field_control_t *fc;   /* Field control structure. */
  23942 #endif
  23943     uint32 data;            /* HW data match criteria.  */
  23944     uint32 mask;            /* HW data mask.            */
  23945     uint32 flags;           /* L3 forwarding flags      */
  23946     int nh_ecmp_id;         /* Next hop/Ecmp group id.  */
  23947 
  23948     /* Get next hop id. */
  23949     rv = bcm_xgs3_l3_egress_id_parse(unit, mpintf, &flags, &nh_ecmp_id);
  23950     BCM_IF_ERROR_RETURN(rv);
  23951 
  23952     if (!(flags & BCM_L3_MULTIPATH)) {
  23953         return (BCM_E_UNAVAIL);
  23954     }
  23955 
  23956     data = nh_ecmp_id;
  23957     mask = (BCM_FIELD_EXACT_MATCH_MASK);
  23958 
  23959     /*
  23960      * Invoke driver function for multi pipe devices.
  23961      */ 
  23962     
  23963 #if defined(BCM_TOMAHAWK_SUPPORT)
  23964     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  23965         rv = _bcm_field_is_entry_stage_valid(unit, entry,
  23966                                              _BCM_FIELD_STAGE_INGRESS);
  23967         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
  23968             /*Error fetching entry*/
  23969             return (rv); 
  23970         }
  23971         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
  23972             /* Trunk bit has to be set for this qualifier */
  23973             data = data | (1 << 16);
  23974 
  23975             FP_LOCK(unit);
  23976             rv = _field_control_get(unit, &fc);
  23977             if (BCM_FAILURE(rv)) {
  23978                 FP_UNLOCK(unit);
  23979                 return rv;
  23980             }
  23981             rv = fc->functions.fp_qualify_dvp(unit, entry,
  23982                                           bcmFieldQualifyDstMultipath,
  23983                                           data, mask, 0);
  23984             FP_UNLOCK(unit);
  23985             return (rv);
  23986         }
  23987     }
  23988 #endif /* BCM_TOMAHAWK_SUPPORT */
  23989 
  23990     BCM_IF_ERROR_RETURN(_field_dest_type_qualify(unit,
  23991                         entry, bcmFieldQualifyDstMultipath, &data, &mask, 
  23992                         _bcmFieldDestTypeNone));
  23993 
  23994     FP_LOCK(unit);
  23995 
  23996     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstMultipath, 
  23997                           data, mask);
  23998 
  23999     FP_UNLOCK(unit);
  24000 #endif /* INCLUDE_L3 */
  24001 
  24002     return (rv);
  24003 }
  24004 
  24005 /*
  24006  * Function:
  24007  *      bcm_esw_field_qualify_DstMultipath_get
  24008  * Purpose:
  24009  *      Get match criteria for bcmFieildQualifyDstMultipath
  24010  *                     qualifier from the field entry.
  24011  * Parameters:
  24012  *      unit - (IN) Unit number.
  24013  *      entry - (IN) BCM field entry id.
  24014  *      mpintf - (OUT) Multipath egress object id. 
  24015  * Returns:
  24016  *      BCM_E_XXX
  24017  * Notes:
  24018  */
  24019 int 
  24020 bcm_esw_field_qualify_DstMultipath_get(int               unit,
  24021                                        bcm_field_entry_t entry, 
  24022                                        bcm_if_t          *mpintf
  24023                                        )
  24024 {
  24025     int               rv = BCM_E_UNAVAIL;  /* Operation return status. */
  24026 #if defined(INCLUDE_L3)
  24027     uint32            data; /* HW data match criteria.  */
  24028     uint32            mask; /* HW data mask.            */
  24029 
  24030     /* Input parameters check. */
  24031     if (NULL == mpintf) {
  24032         return (BCM_E_PARAM);
  24033     }
  24034 
  24035     /* Read qualifier match value and mask. */ 
  24036     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  24037                                            bcmFieldQualifyDstMultipath,
  24038                                            &data, &mask);
  24039     BCM_IF_ERROR_RETURN(rv);
  24040 
  24041     BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  24042         entry, bcmFieldQualifyDstMultipath, &data, &mask));
  24043 
  24044     if (mask == 0) {
  24045         return BCM_E_NOT_FOUND;
  24046     }
  24047 
  24048 #if defined(BCM_TOMAHAWK_SUPPORT)
  24049     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  24050         rv = _bcm_field_is_entry_stage_valid(unit, entry,
  24051                                              _BCM_FIELD_STAGE_INGRESS);
  24052         if (BCM_SUCCESS(rv)) {
  24053             data = data & ~(1 << 16);
  24054         }
  24055     }
  24056 #endif
  24057 
  24058     *mpintf = data + BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit);
  24059 #endif /* INCLUDE_L3 */
  24060     return (rv);
  24061 }
  24062 /*
  24063  * Function:
  24064  *      bcm_esw_field_qualify_DstMultipathOverlay
  24065  * Purpose:
  24066  *      Set match criteria for bcmFieildQualifyDstMultipathOverlay
  24067  *                     qualifier from the field entry.
  24068  * Parameters:
  24069  *      unit - (IN) Unit number.
  24070  *      entry - (IN) BCM field entry id.
  24071  *      data  - (IN) ECMP interface(s) with overlay flag
  24072  *      mask  - (IN) corresponding mask
  24073  * Returns:
  24074  *      BCM_E_XXX
  24075  * Notes:
  24076  */
  24077 int
  24078 bcm_esw_field_qualify_DstMultipathOverlay(int unit, bcm_field_entry_t entry,
  24079                                           bcm_if_t data, bcm_if_t mask) {
  24080 
  24081     int rv = BCM_E_UNAVAIL;
  24082 #if defined(INCLUDE_L3) && defined(BCM_TOMAHAWK_SUPPORT)
  24083     _field_control_t *fc;   /* Field control structure. */
  24084     uint32 qual_data = 0;   /* HW data match criteria.  */
  24085     uint32 qual_mask = 0;   /* HW data mask.            */
  24086     uint32 tbl_size = 0;    /* ECMP table size to find number of entries */
  24087     int grp_id = 0, idx = 0; /* group index and loop variable */
  24088     uint32 flags;           /* L3 forwarding flags      */
  24089     int nh_ecmp_id;         /* Next hop/Ecmp group id.  */
  24090 
  24091      if (!soc_feature(unit, soc_feature_hierarchical_ecmp)) {
  24092         return rv;
  24093     }
  24094 
  24095     
  24096 
  24097     if (mask == BCM_FIELD_EXACT_MATCH_MASK) {
  24098         /* Get next hop id. */
  24099         rv = bcm_xgs3_l3_egress_id_parse(unit, data, &flags, &nh_ecmp_id);
  24100         BCM_IF_ERROR_RETURN(rv);
  24101 
  24102         if (!(flags & BCM_L3_MULTIPATH)) {
  24103             return (BCM_E_PARAM);
  24104         }
  24105         if (!(BCM_XGS3_L3_ECMP_GROUP_FLAGS_ISSET(unit,
  24106                                            data-BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit),
  24107                                            BCM_L3_ECMP_OVERLAY))) {
  24108             return BCM_E_PARAM;
  24109         }
  24110         qual_data = nh_ecmp_id;
  24111         qual_mask = (uint32) mask;
  24112 
  24113     } else {
  24114         /* Iterate through all groups and assert that groups which qualify have
  24115            overlay and multipath flags */
  24116         if (mask > 0x7ff) {
  24117             return BCM_E_PARAM;
  24118         }
  24119         qual_data = (data & mask);
  24120         tbl_size = soc_mem_index_count(unit, INITIAL_L3_ECMP_GROUPm);
  24121         for (idx = 0; idx < tbl_size; idx++) {
  24122              grp_id = BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit) + idx;
  24123              if (qual_data == (grp_id & mask)) {
  24124                  rv = bcm_xgs3_l3_egress_id_parse(unit, grp_id, &flags,
  24125                                                   &nh_ecmp_id);
  24126                  BCM_IF_ERROR_RETURN(rv);
  24127 
  24128                  if (!(flags & BCM_L3_MULTIPATH)) {
  24129                      return (BCM_E_PARAM);
  24130                  }
  24131                  if (!(BCM_XGS3_L3_ECMP_GROUP_FLAGS_ISSET(unit, idx,
  24132                                                   BCM_L3_ECMP_OVERLAY))) {
  24133                      return BCM_E_PARAM;
  24134                  }
  24135             }
  24136         }
  24137         qual_data = data - BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit);
  24138         qual_mask = mask;
  24139     }
  24140 
  24141     rv = _bcm_field_is_entry_stage_valid(unit, entry,
  24142                                          _BCM_FIELD_STAGE_INGRESS);
  24143 
  24144     if (rv == BCM_E_NONE) { /*Stage is Ingress*/
  24145         /* Trunk bit has to be set for this qualifier */
  24146         qual_data = qual_data | (1 << 16);
  24147         FP_LOCK(unit);
  24148         rv = _field_control_get(unit, &fc);
  24149         if (BCM_FAILURE(rv)) {
  24150             FP_UNLOCK(unit);
  24151             return rv;
  24152         }
  24153         rv = fc->functions.fp_qualify_dvp(unit, entry,
  24154                                           bcmFieldQualifyDstMultipathOverlay,
  24155                                           qual_data, qual_mask, 0);
  24156         FP_UNLOCK(unit);
  24157         return (rv);
  24158     }
  24159 #endif /* INCLUDE_L3 && BCM_TOMAHAWK_SUPPORT */
  24160     return rv;
  24161 }
  24162 /*
  24163  * Function:
  24164  *      bcm_esw_field_qualify_DstMultipathOverlay_get
  24165  * Purpose:
  24166  *      Get match criteria for bcmFieildQualifyDstMultipathOverlay
  24167  *                     qualifier from the field entry.
  24168  * Parameters:
  24169  *      unit - (IN) Unit number.
  24170  *      entry - (IN) BCM field entry id.
  24171  *      data  - (OUT) ECMP interface(s) with overlay flag
  24172  *      mask  - (OUT) corresponding mask
  24173  * Returns:
  24174  *      BCM_E_XXX
  24175  * Notes:
  24176  */
  24177 int
  24178 bcm_esw_field_qualify_DstMultipathOverlay_get(int unit, bcm_field_entry_t entry,
  24179                                              bcm_if_t *data, bcm_if_t *mask) {
  24180     int               rv = BCM_E_UNAVAIL;  /* Operation return status. */
  24181 #if defined(INCLUDE_L3)
  24182     uint32            qual_data; /* HW data match criteria.  */
  24183     uint32            qual_mask; /* HW data mask.            */
  24184 
  24185     /* Input parameters check. */
  24186     if ((NULL == data) || (NULL == mask)) {
  24187         return (BCM_E_PARAM);
  24188     }
  24189 
  24190     /* Read qualifier match value and mask. */
  24191     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  24192                                            bcmFieldQualifyDstMultipathOverlay,
  24193                                            &qual_data, &qual_mask);
  24194     BCM_IF_ERROR_RETURN(rv);
  24195 
  24196 #if defined(BCM_TOMAHAWK_SUPPORT)
  24197     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  24198         rv = _bcm_field_is_entry_stage_valid(unit, entry,
  24199                                              _BCM_FIELD_STAGE_INGRESS);
  24200         if (BCM_SUCCESS(rv)) {
  24201             qual_data = qual_data & ~(1 << 16);
  24202         }
  24203     }
  24204 #endif
  24205 
  24206     *data = qual_data + BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit);
  24207     *mask = qual_mask;
  24208 #endif /* INCLUDE_L3 */
  24209     return (rv);
  24210 
  24211 }
  24212 /*
  24213  * Function:
  24214  *      bcm_esw_field_qualify_DstMultipathUnderlay
  24215  * Purpose:
  24216  *      Set match criteria for bcmFieildQualifyDstMultipathUnderlay
  24217  *                     qualifier from the field entry.
  24218  * Parameters:
  24219  *      unit - (IN) Unit number.
  24220  *      entry - (IN) BCM field entry id.
  24221  *      data  - (IN) ECMP interface(s) with Underlay flag
  24222  *      mask  - (IN) corresponding mask
  24223  * Returns:
  24224  *      BCM_E_XXX
  24225  * Notes:
  24226  */
  24227 int
  24228 bcm_esw_field_qualify_DstMultipathUnderlay(int unit, bcm_field_entry_t entry,
  24229                                          bcm_if_t data, bcm_if_t mask) {
  24230     int rv = BCM_E_UNAVAIL;
  24231 #if defined(INCLUDE_L3) && defined(BCM_TOMAHAWK_SUPPORT)
  24232     _field_control_t *fc;   /* Field control structure. */
  24233     uint32 qual_data = 0;   /* HW data match criteria.  */
  24234     uint32 qual_mask = 0;   /* HW data mask.            */
  24235     uint32 tbl_size = 0;    /* ECMP table size to find number of entries */
  24236     int grp_id = 0, idx = 0; /* group index and loop variable */
  24237     uint32 flags;           /* L3 forwarding flags      */
  24238     int nh_ecmp_id;         /* Next hop/Ecmp group id.  */
  24239 
  24240     if (!soc_feature(unit, soc_feature_hierarchical_ecmp)) {
  24241         return rv;
  24242     }
  24243 
  24244     
  24245 
  24246     if (mask == BCM_FIELD_EXACT_MATCH_MASK) {
  24247         /* Get next hop id. */
  24248         rv = bcm_xgs3_l3_egress_id_parse(unit, data, &flags, &nh_ecmp_id);
  24249         BCM_IF_ERROR_RETURN(rv);
  24250 
  24251         if (!(flags & BCM_L3_MULTIPATH)) {
  24252             return (BCM_E_PARAM);
  24253         }
  24254         if (!(BCM_XGS3_L3_ECMP_GROUP_FLAGS_ISSET(unit,
  24255                 data-BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit),
  24256                 BCM_L3_ECMP_UNDERLAY))) {
  24257 
  24258             return BCM_E_PARAM;
  24259         }
  24260         qual_data = nh_ecmp_id;
  24261         qual_mask = (uint32) mask;
  24262 
  24263     } else {
  24264         /* Iterate through all groups and assert that groups which qualify have
  24265            overlay and multipath flags */
  24266         if (mask > 0x7ff) {
  24267             return BCM_E_PARAM;
  24268         }
  24269         qual_data = (data & mask);
  24270         tbl_size = soc_mem_index_count(unit, INITIAL_L3_ECMP_GROUPm);
  24271         for (idx = 0; idx < tbl_size; idx++) {
  24272              grp_id = BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit) + idx;
  24273              if (qual_data == (grp_id & mask)) {
  24274                  rv = bcm_xgs3_l3_egress_id_parse(unit, grp_id, &flags,
  24275                                                   &nh_ecmp_id);
  24276                  BCM_IF_ERROR_RETURN(rv);
  24277 
  24278                  if (!(flags & BCM_L3_MULTIPATH)) {
  24279                      return (BCM_E_PARAM);
  24280                  }
  24281                  if (!(BCM_XGS3_L3_ECMP_GROUP_FLAGS_ISSET(unit, idx,
  24282                                                   BCM_L3_ECMP_UNDERLAY))) {
  24283                      return BCM_E_PARAM;
  24284                  }
  24285             }
  24286         }
  24287         qual_data = data - BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit);
  24288         qual_mask = mask;
  24289     }
  24290 
  24291     rv = _bcm_field_is_entry_stage_valid(unit, entry,
  24292                                          _BCM_FIELD_STAGE_INGRESS);
  24293 
  24294     if (rv == BCM_E_NONE) { /*Stage is Ingress*/
  24295         /* Trunk bit has to be set for this qualifier */
  24296         qual_data = qual_data | (1 << 16);
  24297         FP_LOCK(unit);
  24298         rv = _field_control_get(unit, &fc);
  24299         if (BCM_FAILURE(rv)) {
  24300             FP_UNLOCK(unit);
  24301             return rv;
  24302         }
  24303         rv = fc->functions.fp_qualify_dvp(unit, entry,
  24304                                           bcmFieldQualifyDstMultipathUnderlay,
  24305                                           qual_data, qual_mask, 0);
  24306         FP_UNLOCK(unit);
  24307         return (rv);
  24308     }
  24309 #endif /* INCLUDE_L3 && BCM_TOMAHAWK_SUPPORT */
  24310     return rv;
  24311 }
  24312  /*
  24313  * Function:
  24314  *      bcm_esw_field_qualify_DstMultipathUnderlay_get
  24315  * Purpose:
  24316  *      Get match criteria for bcmFieildQualifyDstMultipathUnderlay
  24317  *                     qualifier from the field entry.
  24318  * Parameters:
  24319  *      unit - (IN) Unit number.
  24320  *      entry - (IN) BCM field entry id.
  24321  *      data  - (OUT) ECMP interface(s) with Underlay flag
  24322  *      mask  - (OUT) corresponding mask
  24323  * Returns:
  24324  *      BCM_E_XXX
  24325  * Notes:
  24326  */
  24327 int
  24328 bcm_esw_field_qualify_DstMultipathUnderlay_get(int unit, bcm_field_entry_t entry,
  24329                                                bcm_if_t *data, bcm_if_t *mask) {
  24330     int               rv = BCM_E_UNAVAIL;  /* Operation return status. */
  24331 #if defined(INCLUDE_L3)
  24332     uint32            qual_data = 0; /* HW data match criteria.  */
  24333     uint32            qual_mask = 0; /* HW data mask.            */
  24334 
  24335     /* Input parameters check. */
  24336     if ((NULL == data) || (NULL == mask))  {
  24337         return (BCM_E_PARAM);
  24338     }
  24339 
  24340     /* Read qualifier match value and mask. */
  24341     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  24342                                            bcmFieldQualifyDstMultipathUnderlay,
  24343                                            &qual_data, &qual_mask);
  24344     BCM_IF_ERROR_RETURN(rv);
  24345 
  24346 #if defined(BCM_TOMAHAWK_SUPPORT)
  24347     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  24348         rv = _bcm_field_is_entry_stage_valid(unit, entry,
  24349                                              _BCM_FIELD_STAGE_INGRESS);
  24350         if (BCM_SUCCESS(rv)) {
  24351             qual_data = qual_data & ~(1 << 16);
  24352         }
  24353     }
  24354 #endif
  24355 
  24356     *data = qual_data + BCM_XGS3_MPATH_EGRESS_IDX_MIN(unit);
  24357     *mask = qual_mask;
  24358 #endif /* INCLUDE_L3 */
  24359     return (rv);
  24360 
  24361 }
  24362 /*
  24363  * Function:
  24364  *      bcm_esw_field_qualify_InnerTtl_get
  24365  * Purpose:
  24366  *      Get match criteria for bcmFieildQualifyInnerTtl
  24367  *                     qualifier from the field entry.
  24368  * Parameters:
  24369  *      unit - (IN) Unit number.
  24370  *      entry - (IN) BCM field entry id.
  24371  *      data - (OUT) Qualifier match data.
  24372  *      mask - (OUT) Qualifier match mask.
  24373  * Returns:
  24374  *      BCM_E_XXX
  24375  * Notes:
  24376  */
  24377 int 
  24378 bcm_esw_field_qualify_InnerTtl_get(
  24379     int unit, 
  24380     bcm_field_entry_t entry, 
  24381     uint8 *data, 
  24382     uint8 *mask)
  24383 {
  24384     /* Read qualifier match value and mask. */
  24385     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24386                                    bcmFieldQualifyInnerTtl,
  24387                                    data, mask);
  24388 }
  24389 
  24390 /*
  24391  * Function:
  24392  *      bcm_esw_field_qualify_InnerTos_get
  24393  * Purpose:
  24394  *      Get match criteria for bcmFieildQualifyInnerDSCP
  24395  *                     qualifier from the field entry.
  24396  * Parameters:
  24397  *      unit - (IN) Unit number.
  24398  *      entry - (IN) BCM field entry id.
  24399  *      data - (OUT) Qualifier match data.
  24400  *      mask - (OUT) Qualifier match mask.
  24401  * Returns:
  24402  *      BCM_E_XXX
  24403  * Notes:
  24404  */
  24405 int 
  24406 bcm_esw_field_qualify_InnerTos_get(
  24407     int unit, 
  24408     bcm_field_entry_t entry, 
  24409     uint8 *data, 
  24410     uint8 *mask)
  24411 {
  24412     /* Read qualifier match value and mask. */
  24413     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24414                                    bcmFieldQualifyInnerTos,
  24415                                    data, mask);
  24416 }
  24417 
  24418 /*
  24419  * Function:
  24420  *      bcm_esw_field_qualify_InnerDSCP_get
  24421  * Purpose:
  24422  *      Get match criteria for bcmFieildQualifyInnerDSCP
  24423  *                     qualifier from the field entry.
  24424  * Parameters:
  24425  *      unit - (IN) Unit number.
  24426  *      entry - (IN) BCM field entry id.
  24427  *      data - (OUT) Qualifier match data.
  24428  *      mask - (OUT) Qualifier match mask.
  24429  * Returns:
  24430  *      BCM_E_XXX
  24431  * Notes:
  24432  */
  24433 int 
  24434 bcm_esw_field_qualify_InnerDSCP_get(
  24435     int unit, 
  24436     bcm_field_entry_t entry, 
  24437     uint8 *data, 
  24438     uint8 *mask)
  24439 {
  24440     /* Read qualifier match value and mask. */
  24441     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24442                                    bcmFieldQualifyInnerDSCP,
  24443                                    data, mask);
  24444 }
  24445 
  24446 /*
  24447  * Function:
  24448  *      bcm_esw_field_qualify_InnerIpProtocol_get
  24449  * Purpose:
  24450  *      Get match criteria for bcmFieildQualifyInnerIpProtocol
  24451  *                     qualifier from the field entry.
  24452  * Parameters:
  24453  *      unit - (IN) Unit number.
  24454  *      entry - (IN) BCM field entry id.
  24455  *      data - (OUT) Qualifier match data.
  24456  *      mask - (OUT) Qualifier match mask.
  24457  * Returns:
  24458  *      BCM_E_XXX
  24459  * Notes:
  24460  */
  24461 int 
  24462 bcm_esw_field_qualify_InnerIpProtocol_get(
  24463     int unit, 
  24464     bcm_field_entry_t entry, 
  24465     uint8 *data, 
  24466     uint8 *mask)
  24467 {
  24468     /* Read qualifier match value and mask. */
  24469     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24470                                    bcmFieldQualifyInnerIpProtocol,
  24471                                    data, mask);
  24472 }
  24473 
  24474 /*
  24475  * Function:
  24476  *      bcm_esw_field_qualify_InnerIp6HopLimit_get
  24477  * Purpose:
  24478  *      Get match criteria for bcmFieildQualifyInnerIp6HopLimit
  24479  *                     qualifier from the field entry.
  24480  * Parameters:
  24481  *      unit - (IN) Unit number.
  24482  *      entry - (IN) BCM field entry id.
  24483  *      data - (OUT) Qualifier match data.
  24484  *      mask - (OUT) Qualifier match mask.
  24485  * Returns:
  24486  *      BCM_E_XXX
  24487  * Notes:
  24488  */
  24489 int 
  24490 bcm_esw_field_qualify_InnerIp6HopLimit_get(
  24491     int unit, 
  24492     bcm_field_entry_t entry, 
  24493     uint8 *data, 
  24494     uint8 *mask)
  24495 {
  24496     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24497                                    bcmFieldQualifyInnerIp6HopLimit,
  24498                                    data, mask);
  24499 }
  24500 
  24501 
  24502 /*
  24503  * Function:
  24504  *      bcm_esw_field_qualify_InnerIp6NextHeader_get
  24505  * Purpose:
  24506  *      Get match criteria for bcmFieildQualifyInnerIp6NextHeader
  24507  *                     qualifier from the field entry.
  24508  * Parameters:
  24509  *      unit - (IN) Unit number.
  24510  *      entry - (IN) BCM field entry id.
  24511  *      data - (OUT) Qualifier match data.
  24512  *      mask - (OUT) Qualifier match mask.
  24513  * Returns:
  24514  *      BCM_E_XXX
  24515  * Notes:
  24516  */
  24517 int 
  24518 bcm_esw_field_qualify_InnerIp6NextHeader_get(
  24519     int unit, 
  24520     bcm_field_entry_t entry, 
  24521     uint8 *data, 
  24522     uint8 *mask)
  24523 {
  24524     /* Read qualifier match value and mask. */
  24525     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24526                                    bcmFieldQualifyInnerIp6NextHeader,
  24527                                    data, mask);
  24528 }
  24529 
  24530 
  24531 /*
  24532  * Function:
  24533  *      bcm_esw_field_qualify_InnerIpFrag_get
  24534  * Purpose:
  24535  *      Get match criteria for bcmFieildQualifyInnerIpFrag
  24536  *                     qualifier from the field entry.
  24537  * Parameters:
  24538  *      unit - (IN) Unit number.
  24539  *      entry - (IN) BCM field entry id.
  24540  *      frag_info - (OUT) Inner ip header fragmentation info.
  24541  * Returns:
  24542  *      BCM_E_XXX
  24543  * Notes:
  24544  */
  24545 int 
  24546 bcm_esw_field_qualify_InnerIpFrag_get(
  24547     int unit, 
  24548     bcm_field_entry_t entry, 
  24549     bcm_field_IpFrag_t *frag_info)
  24550 {
  24551     int             rv = BCM_E_UNAVAIL;
  24552 #if  defined(BCM_TRX_SUPPORT) 
  24553 
  24554     
  24555     FP_LOCK(unit);
  24556 
  24557     if (SOC_IS_TRX(unit)) {
  24558         rv = _field_qualify_IpFrag_get(unit, entry, 
  24559                                        bcmFieldQualifyInnerIpFrag,
  24560                                        frag_info);
  24561     }
  24562     FP_UNLOCK(unit);
  24563 #endif /* BCM_TRX_SUPPORT */
  24564     return (rv);
  24565 }
  24566 
  24567 /*
  24568  * Function:
  24569  *      bcm_esw_field_qualify_DosAttack_get
  24570  * Purpose:
  24571  *      Get match criteria for bcmFieildQualifyDosAttack
  24572  *                     qualifier from the field entry.
  24573  * Parameters:
  24574  *      unit - (IN) Unit number.
  24575  *      entry - (IN) BCM field entry id.
  24576  *      data - (OUT) Qualifier match data.
  24577  *      mask - (OUT) Qualifier match mask.
  24578  * Returns:
  24579  *      BCM_E_XXX
  24580  * Notes:
  24581  */
  24582 int 
  24583 bcm_esw_field_qualify_DosAttack_get(
  24584     int unit, 
  24585     bcm_field_entry_t entry, 
  24586     uint8 *data, 
  24587     uint8 *mask)
  24588 {
  24589     /* Read qualifier match value and mask. */
  24590     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24591                                    bcmFieldQualifyDosAttack,
  24592                                    data, mask);
  24593 }
  24594 
  24595 /*
  24596  * Function:
  24597  *      bcm_esw_field_qualify_IpmcStarGroupHit_get
  24598  * Purpose:
  24599  *      Get match criteria for bcmFieildQualifyIpmcStarGroupHit
  24600  *                     qualifier from the field entry.
  24601  * Parameters:
  24602  *      unit - (IN) Unit number.
  24603  *      entry - (IN) BCM field entry id.
  24604  *      data - (OUT) Qualifier match data.
  24605  *      mask - (OUT) Qualifier match mask.
  24606  * Returns:
  24607  *      BCM_E_XXX
  24608  * Notes:
  24609  */
  24610 int 
  24611 bcm_esw_field_qualify_IpmcStarGroupHit_get(
  24612     int unit, 
  24613     bcm_field_entry_t entry, 
  24614     uint8 *data, 
  24615     uint8 *mask)
  24616 {
  24617     /* Read qualifier match value and mask. */
  24618     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24619                                    bcmFieldQualifyIpmcStarGroupHit,
  24620                                    data, mask);
  24621 }
  24622 
  24623 /*
  24624  * Function:
  24625  *      bcm_esw_field_qualify_MyStationHit_get
  24626  * Purpose:
  24627  *      Get match criteria for bcmFieildQualifyMyStationHit
  24628  *                     qualifier from the field entry.
  24629  * Parameters:
  24630  *      unit - (IN) Unit number.
  24631  *      entry - (IN) BCM field entry id.
  24632  *      data - (OUT) Qualifier match data.
  24633  *      mask - (OUT) Qualifier match mask.
  24634  * Returns:
  24635  *      BCM_E_XXX
  24636  * Notes:
  24637  */
  24638 int 
  24639 bcm_esw_field_qualify_MyStationHit_get(
  24640     int unit, 
  24641     bcm_field_entry_t entry, 
  24642     uint8 *data, 
  24643     uint8 *mask)
  24644 {
  24645     /* Read qualifier match value and mask. */
  24646     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24647                                    bcmFieldQualifyMyStationHit,
  24648                                    data, mask);
  24649 }
  24650 
  24651 /*
  24652  * Function:
  24653  *      bcm_esw_field_qualify_L2PayloadFirstEightBytes_get
  24654  * Purpose:
  24655  *      Get match criteria for bcmFieildQualifyL2PayloadFirstEightBytes
  24656  *                     qualifier from the field entry.
  24657  * Parameters:
  24658  *      unit - (IN) Unit number.
  24659  *      entry - (IN) BCM field entry id.
  24660  *      data1 - (OUT) Qualifier first four bytes of match data.
  24661  *      data2 - (OUT) Qualifier last four bytes of match data.
  24662  *      mask1 - (OUT) Qualifier first four bytes of match mask.
  24663  *      mask2 - (OUT) Qualifier last four bytes of match mask.
  24664  *
  24665  * Note: Values returned in data1 and data2 are in actual packet data format
  24666  *       order.
  24667  * Returns:
  24668  *      BCM_E_XXX
  24669  * Notes:
  24670  */
  24671 int 
  24672 bcm_esw_field_qualify_L2PayloadFirstEightBytes_get(int unit, 
  24673                                                    bcm_field_entry_t entry,
  24674                                                    uint32 *data1, uint32 *data2,
  24675                                                    uint32 *mask1, uint32 *mask2)
  24676 {
  24677     int rv;
  24678 
  24679     /* Input parameters check. */
  24680     if ((NULL == data1) || (NULL == data2) ||
  24681         (NULL == mask1) || (NULL == mask2)) {
  24682         return (BCM_E_PARAM);
  24683     }
  24684 
  24685     rv = _field_qualify_L2PayloadFirstEightBytes_get(unit, entry, 
  24686             bcmFieldQualifyL2PayloadFirstEightBytes, data1, data2, mask1, mask2);
  24687 
  24688     return rv;
  24689 }
  24690 
  24691 /*
  24692  * Function:
  24693  *      bcm_esw_field_qualify_L3DestRouteHit_get
  24694  * Purpose:
  24695  *      Get match criteria for bcmFieildQualifyL3DestRouteHit
  24696  *                     qualifier from the field entry.
  24697  * Parameters:
  24698  *      unit - (IN) Unit number.
  24699  *      entry - (IN) BCM field entry id.
  24700  *      data - (OUT) Qualifier match data.
  24701  *      mask - (OUT) Qualifier match mask.
  24702  * Returns:
  24703  *      BCM_E_XXX
  24704  * Notes:
  24705  */
  24706 int 
  24707 bcm_esw_field_qualify_L3DestRouteHit_get(
  24708     int unit, 
  24709     bcm_field_entry_t entry, 
  24710     uint8 *data, 
  24711     uint8 *mask)
  24712 {
  24713     /* Read qualifier match value and mask. */
  24714     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24715                                    bcmFieldQualifyL3DestRouteHit,
  24716                                    data, mask);
  24717 }
  24718 
  24719 /*
  24720  * Function:
  24721  *      bcm_esw_field_qualify_L3DestHostHit_get
  24722  * Purpose:
  24723  *      Get match criteria for bcmFieildQualifyL3DestHostHit
  24724  *                     qualifier from the field entry.
  24725  * Parameters:
  24726  *      unit - (IN) Unit number.
  24727  *      entry - (IN) BCM field entry id.
  24728  *      data - (OUT) Qualifier match data.
  24729  *      mask - (OUT) Qualifier match mask.
  24730  * Returns:
  24731  *      BCM_E_XXX
  24732  * Notes:
  24733  */
  24734 int 
  24735 bcm_esw_field_qualify_L3DestHostHit_get(
  24736     int unit, 
  24737     bcm_field_entry_t entry, 
  24738     uint8 *data, 
  24739     uint8 *mask)
  24740 {
  24741     /* Read qualifier match value and mask. */
  24742     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24743                                    bcmFieldQualifyL3DestHostHit,
  24744                                    data, mask);
  24745 }
  24746 
  24747 /*
  24748  * Function:
  24749  *      bcm_esw_field_qualify_L3SrcHostHit_get
  24750  * Purpose:
  24751  *      Get match criteria for bcmFieildQualifyL3SrcHostHit
  24752  *                     qualifier from the field entry.
  24753  * Parameters:
  24754  *      unit - (IN) Unit number.
  24755  *      entry - (IN) BCM field entry id.
  24756  *      data - (OUT) Qualifier match data.
  24757  *      mask - (OUT) Qualifier match mask.
  24758  * Returns:
  24759  *      BCM_E_XXX
  24760  * Notes:
  24761  */
  24762 int 
  24763 bcm_esw_field_qualify_L3SrcHostHit_get(
  24764     int unit, 
  24765     bcm_field_entry_t entry, 
  24766     uint8 *data, 
  24767     uint8 *mask)
  24768 {
  24769     /* Read qualifier match value and mask. */
  24770     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24771                                    bcmFieldQualifyL3SrcHostHit,
  24772                                    data, mask);
  24773 }
  24774 
  24775 /*
  24776  * Function:
  24777  *      bcm_esw_field_qualify_L2CacheHit_get
  24778  * Purpose:
  24779  *      Get match criteria for bcmFieildQualifyL2CacheHit
  24780  *                     qualifier from the field entry.
  24781  * Parameters:
  24782  *      unit - (IN) Unit number.
  24783  *      entry - (IN) BCM field entry id.
  24784  *      data - (OUT) Qualifier match data.
  24785  *      mask - (OUT) Qualifier match mask.
  24786  * Returns:
  24787  *      BCM_E_XXX
  24788  * Notes:
  24789  */
  24790 int 
  24791 bcm_esw_field_qualify_L2CacheHit_get(
  24792     int unit, 
  24793     bcm_field_entry_t entry, 
  24794     uint8 *data, 
  24795     uint8 *mask)
  24796 {
  24797     /* Read qualifier match value and mask. */
  24798     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24799                                    bcmFieldQualifyL2CacheHit,
  24800                                    data, mask);
  24801 }
  24802 
  24803 /*
  24804  * Function:
  24805  *      bcm_esw_field_qualify_L2StationMove_get
  24806  * Purpose:
  24807  *      Get match criteria for bcmFieildQualifyL2StationMove
  24808  *                     qualifier from the field entry.
  24809  * Parameters:
  24810  *      unit - (IN) Unit number.
  24811  *      entry - (IN) BCM field entry id.
  24812  *      data - (OUT) Qualifier match data.
  24813  *      mask - (OUT) Qualifier match mask.
  24814  * Returns:
  24815  *      BCM_E_XXX
  24816  * Notes:
  24817  */
  24818 int 
  24819 bcm_esw_field_qualify_L2StationMove_get(
  24820     int unit, 
  24821     bcm_field_entry_t entry, 
  24822     uint8 *data, 
  24823     uint8 *mask)
  24824 {
  24825     /* Read qualifier match value and mask. */
  24826     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24827                                    bcmFieldQualifyL2StationMove,
  24828                                    data, mask);
  24829 }
  24830 
  24831 /*
  24832  * Function:
  24833  *      bcm_esw_field_qualify_L2DestHit_get
  24834  * Purpose:
  24835  *      Get match criteria for bcmFieildQualifyL2DestHit
  24836  *                     qualifier from the field entry.
  24837  * Parameters:
  24838  *      unit - (IN) Unit number.
  24839  *      entry - (IN) BCM field entry id.
  24840  *      data - (OUT) Qualifier match data.
  24841  *      mask - (OUT) Qualifier match mask.
  24842  * Returns:
  24843  *      BCM_E_XXX
  24844  * Notes:
  24845  */
  24846 int 
  24847 bcm_esw_field_qualify_L2DestHit_get(
  24848     int unit, 
  24849     bcm_field_entry_t entry, 
  24850     uint8 *data, 
  24851     uint8 *mask)
  24852 {
  24853     /* Read qualifier match value and mask. */
  24854     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24855                                    bcmFieldQualifyL2DestHit,
  24856                                    data, mask);
  24857 }
  24858 
  24859 /*
  24860  * Function:
  24861  *      bcm_esw_field_qualify_L2SrcStatic_get
  24862  * Purpose:
  24863  *      Get match criteria for bcmFieildQualifyL2SrcStatic
  24864  *                     qualifier from the field entry.
  24865  * Parameters:
  24866  *      unit - (IN) Unit number.
  24867  *      entry - (IN) BCM field entry id.
  24868  *      data - (OUT) Qualifier match data.
  24869  *      mask - (OUT) Qualifier match mask.
  24870  * Returns:
  24871  *      BCM_E_XXX
  24872  * Notes:
  24873  */
  24874 int 
  24875 bcm_esw_field_qualify_L2SrcStatic_get(
  24876     int unit, 
  24877     bcm_field_entry_t entry, 
  24878     uint8 *data, 
  24879     uint8 *mask)
  24880 {
  24881     /* Read qualifier match value and mask. */
  24882     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24883                                    bcmFieldQualifyL2SrcStatic,
  24884                                    data, mask);
  24885 }
  24886 
  24887 /*
  24888  * Function:
  24889  *      bcm_esw_field_qualify_L2SrcHit_get
  24890  * Purpose:
  24891  *      Get match criteria for bcmFieildQualifyL2SrcHit
  24892  *                     qualifier from the field entry.
  24893  * Parameters:
  24894  *      unit - (IN) Unit number.
  24895  *      entry - (IN) BCM field entry id.
  24896  *      data - (OUT) Qualifier match data.
  24897  *      mask - (OUT) Qualifier match mask.
  24898  * Returns:
  24899  *      BCM_E_XXX
  24900  * Notes:
  24901  */
  24902 int 
  24903 bcm_esw_field_qualify_L2SrcHit_get(
  24904     int unit, 
  24905     bcm_field_entry_t entry, 
  24906     uint8 *data, 
  24907     uint8 *mask)
  24908 {
  24909     /* Read qualifier match value and mask. */
  24910     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24911                                    bcmFieldQualifyL2SrcHit,
  24912                                    data, mask);
  24913 }
  24914 
  24915 /*
  24916  * Function:
  24917  *      bcm_esw_field_qualify_IngressStpState_get
  24918  * Purpose:
  24919  *      Get match criteria for bcmFieildQualifyIngressStpState
  24920  *                     qualifier from the field entry.
  24921  * Parameters:
  24922  *      unit - (IN) Unit number.
  24923  *      entry - (IN) BCM field entry id.
  24924  *      data - (OUT) Qualifier match data.
  24925  *      mask - (OUT) Qualifier match mask.
  24926  * Returns:
  24927  *      BCM_E_XXX
  24928  * Notes:
  24929  */
  24930 int 
  24931 bcm_esw_field_qualify_IngressStpState_get(
  24932     int unit, 
  24933     bcm_field_entry_t entry, 
  24934     uint8 *data, 
  24935     uint8 *mask)
  24936 {
  24937     uint32    hw_data = 0;       /* HW buffer data.             */
  24938     uint32    hw_mask = 0;       /* HW buffer mask.             */
  24939     int       rv;                /* Operation return stauts.    */
  24940 
  24941     /* Input parameters check. */
  24942     if ((NULL == data) || (NULL == mask)) {
  24943         return (BCM_E_PARAM);
  24944     }
  24945 
  24946     /* Read qualifier match value and mask. */ 
  24947     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  24948                                                bcmFieldQualifyIngressStpState,
  24949                                                &hw_data, &hw_mask);
  24950     BCM_IF_ERROR_RETURN(rv);
  24951 
  24952     switch (hw_data & hw_mask) {
  24953       case 0: 
  24954           *data = BCM_STG_STP_DISABLE;
  24955           break;
  24956       case 1: 
  24957           *data = BCM_STG_STP_BLOCK;
  24958           break;
  24959       case 2: 
  24960           *data = BCM_STG_STP_LEARN;
  24961           break;
  24962       case 3: 
  24963           *data = BCM_STG_STP_FORWARD;
  24964           break;
  24965       default:
  24966           return (BCM_E_INTERNAL);
  24967     }
  24968     *mask = (0 == hw_mask) ? 0 : 0xff;
  24969     return (BCM_E_NONE);
  24970 }
  24971 
  24972 /*
  24973  * Function:
  24974  *      bcm_esw_field_qualify_ForwardingVlanValid_get
  24975  * Purpose:
  24976  *      Get match criteria for bcmFieildQualifyForwardingVlanValid
  24977  *                     qualifier from the field entry.
  24978  * Parameters:
  24979  *      unit - (IN) Unit number.
  24980  *      entry - (IN) BCM field entry id.
  24981  *      data - (OUT) Qualifier match data.
  24982  *      mask - (OUT) Qualifier match mask.
  24983  * Returns:
  24984  *      BCM_E_XXX
  24985  * Notes:
  24986  */
  24987 int 
  24988 bcm_esw_field_qualify_ForwardingVlanValid_get(
  24989     int unit, 
  24990     bcm_field_entry_t entry, 
  24991     uint8 *data, 
  24992     uint8 *mask)
  24993 {
  24994     /* Read qualifier match value and mask. */
  24995     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  24996                                    bcmFieldQualifyForwardingVlanValid,
  24997                                    data, mask);
  24998 }
  24999 
  25000 /*
  25001  * Function:
  25002  *      bcm_esw_field_qualify_SrcVirtualPortValid_get
  25003  * Purpose:
  25004  *      Get match criteria for bcmFieldQualifySrcVirtualPortValid
  25005  *      qualifier from the field entry.
  25006  * Parameters:
  25007  *      unit    - (IN) Unit number.
  25008  *      entry   - (IN) BCM field entry id.
  25009  *      data    - (OUT) Qualifier match data.
  25010  *      mask    - (OUT) Qualifier match mask.
  25011  * Returns:
  25012  *      BCM_E_XXX
  25013  * Notes:
  25014  */
  25015 int 
  25016 bcm_esw_field_qualify_SrcVirtualPortValid_get(
  25017     int unit,
  25018     bcm_field_entry_t entry,
  25019     uint8 *data,
  25020     uint8 *mask)
  25021 {
  25022     /* Read qualifier match value and mask. */
  25023     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  25024                                     bcmFieldQualifySrcVirtualPortValid,
  25025                                     data, mask);
  25026 }
  25027 
  25028 /*
  25029  * Function:
  25030  *      bcm_esw_field_qualify_DstL3EgressNextHops_get
  25031  * Purpose:
  25032  *      Get match criteria for bcmFieldQualifyDstL3EgressNextHops
  25033  *      qualifier from the field entry.
  25034  * Parameters:
  25035  *      unit    - (IN) Unit number.
  25036  *      entry   - (IN) BCM field entry id.
  25037  *      data    - (OUT) Qualifier match data.
  25038  *      mask    - (OUT) Qualifier match mask.
  25039  * Returns:
  25040  *      BCM_E_XXX
  25041  * Notes:
  25042  */
  25043 int 
  25044 bcm_esw_field_qualify_DstL3EgressNextHops_get(int unit,
  25045     bcm_field_entry_t entry,
  25046     uint32 *data,
  25047     uint32 *mask)
  25048 {
  25049     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  25050 
  25051 #if defined(INCLUDE_L3)
  25052     int i, size_bit_len = 0;
  25053 
  25054     /* Check if L3 feature is supported on the device */
  25055     if (!soc_feature(unit, soc_feature_l3)) {
  25056         return (rv);
  25057     }
  25058 
  25059     /*  Make sure module was initialized. */
  25060     if (!BCM_XGS3_L3_INITIALIZED(unit)) {
  25061         return (rv);
  25062     }
  25063 
  25064     /* Read qualifier match value and mask. */ 
  25065     rv =  _bcm_field_entry_qualifier_uint32_get(unit, entry,
  25066                 bcmFieldQualifyDstL3EgressNextHops,
  25067                 data, mask);
  25068     BCM_IF_ERROR_RETURN(rv);
  25069 
  25070 
  25071     /* Retrieve the mask value according to the table size */
  25072     for (i = 0; i < 32; i++) {
  25073         if (BCM_XGS3_L3_NH_TBL_SIZE(unit) <= (1 << i)) {
  25074             size_bit_len = i;
  25075             break;
  25076         }
  25077     }
  25078     
  25079     *mask = *mask & ((1 << size_bit_len) - 1);
  25080 
  25081     /* Clear destination type in data and mask */
  25082     BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  25083         entry, bcmFieldQualifyDstL3EgressNextHops, data, mask));
  25084 #endif
  25085     return (rv);
  25086 
  25087 }
  25088 
  25089 /*
  25090  * Function:
  25091  *      bcm_esw_field_qualify_VlanTranslationHit_get
  25092  * Purpose:
  25093  *      Get match criteria for bcmFieildQualifyVlanTranslationHit
  25094  *                     qualifier from the field entry.
  25095  * Parameters:
  25096  *      unit - (IN) Unit number.
  25097  *      entry - (IN) BCM field entry id.
  25098  *      data - (OUT) Qualifier match data.
  25099  *      mask - (OUT) Qualifier match mask.
  25100  * Returns:
  25101  *      BCM_E_XXX
  25102  * Notes:
  25103  */
  25104 int 
  25105 bcm_esw_field_qualify_VlanTranslationHit_get(
  25106     int unit, 
  25107     bcm_field_entry_t entry, 
  25108     uint8 *data, 
  25109     uint8 *mask)
  25110 {
  25111     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  25112     int (*func)(int, bcm_field_entry_t, uint8 *, uint8 *) =
  25113                                      _field_qualify_VlanTranslationHit_get;
  25114 
  25115     /* Read qualifier match value and mask. */
  25116     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25117                                    bcmFieldQualifyVlanTranslationHit,
  25118                                    data, mask);
  25119 
  25120     BCM_IF_ERROR_RETURN(rv);
  25121 
  25122 #ifdef BCM_TRIDENT2_SUPPORT
  25123     if (SOC_IS_TD2_TT2(unit)) {
  25124         func = _bcm_field_td2_qualify_VlanTranslationHit_get;
  25125     }
  25126 #endif
  25127 
  25128     BCM_IF_ERROR_RETURN((*func)(unit, entry, data, mask));
  25129 
  25130     return BCM_E_NONE;
  25131 }
  25132 
  25133 /*
  25134  * Function:
  25135  *      bcm_esw_field_qualify_IcmpTypeCode_get
  25136  * Purpose:
  25137  *      Get match criteria for bcmFieildQualifyIcmpTypeCode
  25138  *                     qualifier from the field entry.
  25139  * Parameters:
  25140  *      unit - (IN) Unit number.
  25141  *      entry - (IN) BCM field entry id.
  25142  *      data - (OUT) Qualifier match data.
  25143  *      mask - (OUT) Qualifier match mask.
  25144  * Returns:
  25145  *      BCM_E_XXX
  25146  * Notes:
  25147  */
  25148 int 
  25149 bcm_esw_field_qualify_IcmpTypeCode_get(
  25150     int unit, 
  25151     bcm_field_entry_t entry, 
  25152     uint16 *data, 
  25153     uint16 *mask)
  25154 {
  25155     int rv = BCM_E_INTERNAL;
  25156     uint32 data_hw = 0, mask_hw = 0;
  25157 
  25158     /* Read qualifier match value and mask. */
  25159     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  25160                                              bcmFieldQualifyIcmpTypeCode,
  25161                                              &data_hw, &mask_hw);
  25162     *data = (uint16) data_hw;
  25163     *mask = (uint16) mask_hw;
  25164     return rv;
  25165 }
  25166 
  25167 /*
  25168  * Function:
  25169  *      bcm_esw_field_qualify_TranslatedVlanFormat_get
  25170  * Purpose:
  25171  *      Get match criteria for bcmFieildQualifyTranslatedVlanFormat
  25172  *                     qualifier from the field entry.
  25173  * Parameters:
  25174  *      unit - (IN) Unit number.
  25175  *      entry - (IN) BCM field entry id.
  25176  *      data - (OUT) Qualifier match data.
  25177  *      mask - (OUT) Qualifier match mask.
  25178  * Returns:
  25179  *      BCM_E_XXX
  25180  * Notes:
  25181  */
  25182 int 
  25183 bcm_esw_field_qualify_TranslatedVlanFormat_get(
  25184     int unit, 
  25185     bcm_field_entry_t entry, 
  25186     uint8 *data, 
  25187     uint8 *mask)
  25188 {
  25189     int              rv;        /* Operation return status. */
  25190     
  25191     FP_LOCK(unit);
  25192 
  25193     rv = _field_qualify_VlanFormat_get(unit, entry, 
  25194                                           bcmFieldQualifyTranslatedVlanFormat,
  25195                                           data, mask);
  25196     FP_UNLOCK(unit);
  25197     return (rv);
  25198 }
  25199 
  25200 /*
  25201  * Function:
  25202  *      bcm_esw_field_qualify_IntPriority_get
  25203  * Purpose:
  25204  *      Get match criteria for bcmFieildQualifyIntPriority
  25205  *                     qualifier from the field entry.
  25206  * Parameters:
  25207  *      unit - (IN) Unit number.
  25208  *      entry - (IN) BCM field entry id.
  25209  *      data - (OUT) Qualifier match data.
  25210  *      mask - (OUT) Qualifier match mask.
  25211  * Returns:
  25212  *      BCM_E_XXX
  25213  * Notes:
  25214  */
  25215 int 
  25216 bcm_esw_field_qualify_IntPriority_get(int unit, bcm_field_entry_t entry,
  25217                                       uint8 *data, uint8 *mask)
  25218 {
  25219     /* Read qualifier match value and mask. */
  25220     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25221                                             bcmFieldQualifyIntPriority,
  25222                                             data, mask);
  25223 }
  25224 
  25225 /*
  25226  * Function:
  25227  *      bcm_esw_field_qualify_Color_get
  25228  * Purpose:
  25229  *      Get match criteria for bcmFieildQualifyColor
  25230  *                     qualifier from the field entry.
  25231  * Parameters:
  25232  *      unit - (IN) Unit number.
  25233  *      entry - (IN) BCM field entry id.
  25234  *      color - (OUT) Qualifier match color.
  25235  * Returns:
  25236  *      BCM_E_XXX
  25237  * Notes:
  25238  */
  25239 int 
  25240 bcm_esw_field_qualify_Color_get(int unit, bcm_field_entry_t entry, 
  25241                                 uint8 *color)
  25242 {
  25243     int rv;          /* Operation return status. */
  25244     uint8 data;      /* Qualifier data.          */
  25245     uint8 mask;      /* Qualifier mask.          */
  25246 
  25247     /* Read qualifier match value and mask. */
  25248     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, bcmFieldQualifyColor,
  25249                                           &data, &mask);
  25250     BCM_IF_ERROR_RETURN(rv);
  25251 
  25252     if (mask == 0) {
  25253         return BCM_E_NOT_FOUND;
  25254     }
  25255 
  25256     switch (data) {
  25257       case 0:
  25258           *color = BCM_FIELD_COLOR_GREEN;
  25259           break;
  25260       case 1:
  25261           *color = BCM_FIELD_COLOR_RED;
  25262           break;
  25263       case 3:
  25264           *color = BCM_FIELD_COLOR_YELLOW;
  25265           break;
  25266       default:
  25267           rv = BCM_E_INTERNAL;
  25268     }
  25269     return (rv);
  25270 }
  25271 
  25272 /*
  25273  * Function:
  25274  *      bcm_esw_field_qualify_FibreChannOuter_get
  25275  * Purpose:
  25276  *      Get Fibre Channel outer header type field qualification from a field entry.
  25277  * Parameters:
  25278  *      unit - (IN) Unit number.
  25279  *      entry - (IN) Field entry id.
  25280  *      fibre_chan_type - (OUT) Fibre Channel header type.
  25281  * Returns:
  25282  *      BCM_E_XXX
  25283  * Notes:
  25284  */
  25285 int 
  25286 bcm_esw_field_qualify_FibreChanOuter_get(
  25287     int unit, 
  25288     bcm_field_entry_t entry, 
  25289     bcm_field_FibreChan_t *fibre_chan_type)
  25290 {
  25291     uint8            data; /* HW data match criteria.  */
  25292     uint8            mask; /* HW data mask.            */
  25293     int              rv;   /* Operation return status. */
  25294 
  25295     /* Input parameters check. */
  25296     if (NULL == fibre_chan_type) {
  25297         return (BCM_E_PARAM);
  25298     }
  25299 
  25300     /* Read qualifier match value and mask. */
  25301     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25302                                           bcmFieldQualifyFibreChanOuter,
  25303                                           &data, &mask);
  25304     BCM_IF_ERROR_RETURN(rv);
  25305 
  25306     switch (data) {
  25307       case 0x1:
  25308           *fibre_chan_type = bcmFieldFibreChan;
  25309           break;
  25310       case 0x2:
  25311           *fibre_chan_type = bcmFieldFibreChanVirtual;
  25312           break;
  25313       case 0x3:
  25314           *fibre_chan_type = bcmFieldFibreChanEncap;
  25315           break;
  25316       case 0x4:
  25317           *fibre_chan_type = bcmFieldFibreChanRouted;
  25318           break;
  25319       default:
  25320           return (BCM_E_INTERNAL);
  25321     }
  25322     return BCM_E_NONE; 
  25323 }
  25324 
  25325 /*
  25326  * Function:
  25327  *      bcm_esw_field_qualify_FibreChannInner_get
  25328  * Purpose:
  25329  *      Get Fibre Channel inner header type field qualification from a field entry.
  25330  * Parameters:
  25331  *      unit - (IN) Unit number.
  25332  *      entry - (IN) Field entry id.
  25333  *      fibre_chan_type - (OUT) Fibre Channel header type.
  25334  * Returns:
  25335  *      BCM_E_XXX
  25336  * Notes:
  25337  */
  25338 int 
  25339 bcm_esw_field_qualify_FibreChanInner_get(
  25340     int unit, 
  25341     bcm_field_entry_t entry, 
  25342     bcm_field_FibreChan_t *fibre_chan_type)
  25343 {
  25344     uint8            data; /* HW data match criteria.  */
  25345     uint8            mask; /* HW data mask.            */
  25346     int              rv;   /* Operation return status. */
  25347 
  25348     /* Input parameters check. */
  25349     if (NULL == fibre_chan_type) {
  25350         return (BCM_E_PARAM);
  25351     }
  25352 
  25353     /* Read qualifier match value and mask. */
  25354     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25355                                           bcmFieldQualifyFibreChanInner,
  25356                                           &data, &mask);
  25357     BCM_IF_ERROR_RETURN(rv);
  25358 
  25359     switch (data) {
  25360       case 0x1:
  25361           *fibre_chan_type = bcmFieldFibreChan;
  25362           break;
  25363       case 0x2:
  25364           *fibre_chan_type = bcmFieldFibreChanVirtual;
  25365           break;
  25366       case 0x3:
  25367           *fibre_chan_type = bcmFieldFibreChanEncap;
  25368           break;
  25369       case 0x4:
  25370           *fibre_chan_type = bcmFieldFibreChanRouted;
  25371           break;
  25372       default:
  25373           return (BCM_E_INTERNAL);
  25374     }
  25375     return BCM_E_NONE; 
  25376 }
  25377 
  25378 /*
  25379  * Function:
  25380  *      bcm_esw_field_qualify_VnTag_get
  25381  * Purpose:
  25382  *      Get match criteria for bcmFieldQualifyVnTag
  25383  *      qualifier from the field entry.
  25384  * Parameters:
  25385  *      unit - (IN) Unit number.
  25386  *      entry - (IN) BCM field entry id.
  25387  *      data - (OUT) Qualifier match data.
  25388  *      mask - (OUT) Qualifier match mask.
  25389  * Returns:
  25390  *      BCM_E_XXX
  25391  * Notes:
  25392  */
  25393 int 
  25394 bcm_esw_field_qualify_VnTag_get(
  25395     int unit, 
  25396     bcm_field_entry_t entry, 
  25397     uint32 *data, 
  25398     uint32 *mask)
  25399 {
  25400     /* Read qualifier match value and mask. */ 
  25401     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  25402                                                  bcmFieldQualifyVnTag,
  25403                                                  data, mask);
  25404 }
  25405 
  25406 /*
  25407  * Function:
  25408  *  bcm_esw_field_qualify_ETag_get
  25409  * Purpose:
  25410  *  Get match criteria for bcmFieldQualifyETag
  25411  *  qualifier from the field entry.
  25412  * Parameters:
  25413  *  unit - (IN) Unit number.
  25414  *  entry - (IN) BCM field entry id.
  25415  *  data - (OUT) Qualifier match data.
  25416  *  mask - (OUT) Qualifier match mask.
  25417  * Returns:
  25418  *  BCM_E_XXX
  25419  * Notes:
  25420  */
  25421 int
  25422 bcm_esw_field_qualify_ETag_get(int unit, bcm_field_entry_t entry,
  25423                                        uint64 *data, uint64 *mask)
  25424 {
  25425     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  25426 
  25427     /* Read qualifier match value and mask. */
  25428     uint32 edata = 0;
  25429     uint32 emask = 0;
  25430 
  25431     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  25432                                                bcmFieldQualifyETag,
  25433                                                &edata, &emask);
  25434     if (BCM_SUCCESS(rv)) {
  25435         COMPILER_64_SET(*data, 0, edata);
  25436         COMPILER_64_SET(*mask, 0, emask);
  25437     }
  25438 
  25439     return (rv);
  25440 }
  25441 
  25442 /*
  25443  * Function:
  25444  *      bcm_esw_field_qualify_SubportPktTag_get
  25445  * Purpose:
  25446  *      Get match criteria for bcmFieldQualifySubportPktTag
  25447  *      qualifier from the field entry.
  25448  * Parameters:
  25449  *      unit - (IN) Unit number.
  25450  *      entry - (IN) BCM field entry id.
  25451  *      data - (OUT) Qualifier match data.
  25452  *      mask - (OUT) Qualifier match mask.
  25453  * Returns:
  25454  *      BCM_E_XXX
  25455  * Notes:
  25456  */
  25457 int 
  25458 bcm_esw_field_qualify_SubportPktTag_get(
  25459     int unit, 
  25460     bcm_field_entry_t entry, 
  25461     uint16 *data, 
  25462     uint16 *mask)
  25463 {
  25464     /* Read qualifier match value and mask. */ 
  25465     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  25466                                                  bcmFieldQualifySubportPktTag,
  25467                                                  data, mask);
  25468 }
  25469 
  25470 
  25471 /*
  25472  * Function:
  25473  *      bcm_esw_field_qualify_CnTag_get
  25474  * Purpose:
  25475  *      Get match criteria for bcmFieldQualifyCnTag
  25476  *      qualifier from the field entry.
  25477  * Parameters:
  25478  *      unit - (IN) Unit number.
  25479  *      entry - (IN) BCM field entry id.
  25480  *      data - (OUT) Qualifier match data.
  25481  *      mask - (OUT) Qualifier match mask.
  25482  * Returns:
  25483  *      BCM_E_XXX
  25484  * Notes:
  25485  */
  25486 int 
  25487 bcm_esw_field_qualify_CnTag_get(
  25488     int unit, 
  25489     bcm_field_entry_t entry, 
  25490     uint32 *data, 
  25491     uint32 *mask)
  25492 {
  25493     /* Read qualifier match value and mask. */ 
  25494     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  25495                                                  bcmFieldQualifyCnTag,
  25496                                                  data, mask);
  25497 }
  25498 
  25499 /*
  25500  * Function:
  25501  *      bcm_esw_field_qualify_FabricQueueTag_get
  25502  * Purpose:
  25503  *      Get match criteria for bcmFieldQualifyFabricQueueTag
  25504  *      qualifier from the field entry.
  25505  * Parameters:
  25506  *      unit - (IN) Unit number.
  25507  *      entry - (IN) BCM field entry id.
  25508  *      data - (OUT) Qualifier match data.
  25509  *      mask - (OUT) Qualifier match mask.
  25510  * Returns:
  25511  *      BCM_E_XXX
  25512  * Notes:
  25513  */
  25514 int 
  25515 bcm_esw_field_qualify_FabricQueueTag_get(
  25516     int unit, 
  25517     bcm_field_entry_t entry, 
  25518     uint32 *data, 
  25519     uint32 *mask)
  25520 {
  25521     /* Read qualifier match value and mask. */ 
  25522     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  25523                                                  bcmFieldQualifyFabricQueueTag,
  25524                                                  data, mask);
  25525 }
  25526 
  25527 /*
  25528  * Function:
  25529  *      bcm_esw_field_qualify_SrcModPortGport_get
  25530  * Purpose:
  25531  *      Get match criteria for bcmFieildQualifySrcModPortGport
  25532  *                     qualifier from the field entry.
  25533  * Parameters:
  25534  *      unit  - (IN) Unit number.
  25535  *      entry - (IN) BCM field entry id.
  25536  *      port  - (OUT) Qualifier match gport.
  25537  * Returns:
  25538  *      BCM_E_XXX
  25539  * Notes:
  25540  */
  25541 int 
  25542 bcm_esw_field_qualify_SrcModPortGport_get(int unit, 
  25543                                           bcm_field_entry_t entry, 
  25544                                           bcm_gport_t *port)
  25545 {
  25546     uint32 data;   /* HW encoded qualifier data.  */
  25547     uint32 mask;   /* HW encoding qualifier mask. */
  25548     int rv;        /* Operation return status.    */
  25549 
  25550     /* Input parameters check. */
  25551     if (NULL == port) {
  25552         return (BCM_E_PARAM);
  25553     }
  25554 
  25555     /* Read qualifier match value and mask. */ 
  25556     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  25557                                            bcmFieldQualifySrcModPortGport,
  25558                                            &data, &mask);
  25559     BCM_IF_ERROR_RETURN(rv);
  25560 
  25561     if (mask == 0) {
  25562         return BCM_E_NOT_FOUND;
  25563     }
  25564 
  25565     BCM_GPORT_MODPORT_SET(*port, ((data >> _FP_PORT_BITWIDTH(unit)) & 0xff), 
  25566                           (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  25567 
  25568     return BCM_E_NONE; 
  25569 }
  25570 
  25571 /*
  25572  * Function:
  25573  *      bcm_esw_field_qualify_SrcModuleGport_get
  25574  * Purpose:
  25575  *      Get match criteria for bcmFieildQualifySrcModuleGport
  25576  *                     qualifier from the field entry.
  25577  * Parameters:
  25578  *      unit  - (IN) Unit number.
  25579  *      entry - (IN) BCM field entry id.
  25580  *      port  - (OUT) Qualifier match gport.
  25581  * Returns:
  25582  *      BCM_E_XXX
  25583  * Notes:
  25584  */
  25585 int 
  25586 bcm_esw_field_qualify_SrcModuleGport_get(int unit, 
  25587                                           bcm_field_entry_t entry,
  25588                                           bcm_gport_t *port)
  25589 {
  25590     uint32 data;   /* HW encoded qualifier data.  */
  25591     uint32 mask;   /* HW encoding qualifier mask. */
  25592     int rv;        /* Operation return status.    */
  25593 
  25594     /* Input parameters check. */
  25595     if (NULL == port) {
  25596         return (BCM_E_PARAM);
  25597     }
  25598 
  25599     /* Read qualifier match value and mask. */ 
  25600     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  25601                                            bcmFieldQualifySrcModuleGport,
  25602                                            &data, &mask);
  25603     BCM_IF_ERROR_RETURN(rv);
  25604 
  25605     if (mask == 0) {
  25606         return BCM_E_NOT_FOUND;
  25607     }
  25608 
  25609     BCM_GPORT_MODPORT_SET(*port, (data & 0xff), 0);
  25610 
  25611     return BCM_E_NONE; 
  25612 }
  25613 
  25614 /*
  25615  * Function:
  25616  *      bcm_esw_field_qualify_CpuQueue
  25617  * Purpose:
  25618  *      Set match criteria for bcmFieldQualifyCpuQueue 
  25619  *      qualifier for this field entry.
  25620  * Parameters:
  25621  *      unit    - (IN) Unit number.
  25622  *      entry   - (IN) BCM field entry id.
  25623  *      data    - (IN) CPU COS queue value.
  25624  *      mask    - (IN) CPU COS match mask value.
  25625  * Returns:
  25626  *      BCM_E_XXX
  25627  * Notes:
  25628  */
  25629 int
  25630 bcm_esw_field_qualify_CpuQueue(int unit,
  25631                                bcm_field_entry_t entry,
  25632                                uint8 data,
  25633                                uint8 mask)
  25634 {
  25635     int              rv;    /* Operation return status */
  25636 
  25637     
  25638     FP_LOCK(unit);
  25639 
  25640     /* Qualify CpuQueue */
  25641     rv = _field_qualify_cpu_queue(unit, entry,
  25642                                   bcmFieldQualifyCpuQueue,
  25643                                   data, mask);
  25644     FP_UNLOCK(unit);
  25645     return (rv);
  25646 }
  25647 
  25648 /*
  25649  * Function:
  25650  *      bcm_esw_field_qualify_CpuQueue_get
  25651  * Purpose:
  25652  *      Get match criteria for bcmFieldQualifyCpuQueue
  25653  *      qualifier from the field entry.
  25654  * Parameters:
  25655  *      unit  - (IN) Unit number.
  25656  *      entry - (IN) BCM field entry id.
  25657  *      data  - (OUT) CPU COS Queue matched value.
  25658  *      mask  - (OUT) CPU COS Queue matched mask value.
  25659  * Returns:
  25660  *      BCM_E_XXX
  25661  * Notes:
  25662  */
  25663 int
  25664 bcm_esw_field_qualify_CpuQueue_get(int unit,
  25665                                    bcm_field_entry_t entry,
  25666                                    uint8 *data,
  25667                                    uint8 *mask)
  25668 {
  25669     /* Read qualifier match value and mask. */
  25670     return _field_qualify_cpu_queue_get(unit, entry,
  25671                 bcmFieldQualifyCpuQueue, data, mask);
  25672 }
  25673 
  25674 int
  25675 bcm_esw_field_qualify_DstIpLocal(int unit, bcm_field_entry_t entry,
  25676                                 uint8 data, uint8 mask)
  25677 {
  25678     int              rv;       /* Operation return status. */
  25679 
  25680     /* Input data validation, it should not be more 1 bit */
  25681     if (data & ~(1)) {
  25682        return BCM_E_PARAM;
  25683     }
  25684 
  25685     
  25686     FP_LOCK(unit);
  25687 
  25688     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstIpLocal,
  25689                           data, mask);
  25690 
  25691     FP_UNLOCK(unit);
  25692     return (rv);
  25693 }
  25694 
  25695 
  25696 int 
  25697 bcm_esw_field_qualify_DstIpLocal_get(
  25698     int unit, 
  25699     bcm_field_entry_t entry, 
  25700     uint8 *data, 
  25701     uint8 *mask)
  25702 {
  25703     int              rv;       /* Operation return status. */
  25704 
  25705     /* Read qualifier match value and mask. */ 
  25706     rv = (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25707                                                bcmFieldQualifyDstIpLocal,
  25708                                                data, mask));
  25709     return rv;
  25710 }
  25711 
  25712 
  25713 int
  25714 bcm_esw_field_qualify_GenericAssociatedChannelLabelValid(int unit, bcm_field_entry_t entry,
  25715                                 uint8 data, uint8 mask)
  25716 {
  25717     int              rv;       /* Operation return status. */
  25718 
  25719     
  25720     FP_LOCK(unit);
  25721 
  25722     rv = _field_qualify32(unit, entry, bcmFieldQualifyGenericAssociatedChannelLabelValid,
  25723                           data, mask);
  25724 
  25725     FP_UNLOCK(unit);
  25726     return (rv);
  25727 }
  25728 
  25729 
  25730 int 
  25731 bcm_esw_field_qualify_GenericAssociatedChannelLabelValid_get(
  25732     int unit, 
  25733     bcm_field_entry_t entry, 
  25734     uint8 *data, 
  25735     uint8 *mask)
  25736 {
  25737     /* Read qualifier match value and mask. */ 
  25738     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25739                                                  bcmFieldQualifyGenericAssociatedChannelLabelValid,
  25740                                                  data, mask
  25741                                                  )
  25742             );
  25743 }
  25744 
  25745 
  25746 int
  25747 bcm_esw_field_qualify_IpAddrsNormalized(int unit, bcm_field_entry_t entry,
  25748                                 uint8 data, uint8 mask)
  25749 {
  25750     int              rv;       /* Operation return status. */
  25751 
  25752     
  25753     FP_LOCK(unit);
  25754 
  25755     rv = _field_qualify32(unit, entry, bcmFieldQualifyIpAddrsNormalized,
  25756                           data, mask);
  25757 
  25758     FP_UNLOCK(unit);
  25759     return (rv);
  25760 }
  25761 
  25762 
  25763 int 
  25764 bcm_esw_field_qualify_IpAddrsNormalized_get(
  25765     int unit, 
  25766     bcm_field_entry_t entry, 
  25767     uint8 *data, 
  25768     uint8 *mask)
  25769 {
  25770     /* Read qualifier match value and mask. */ 
  25771     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25772                                                   bcmFieldQualifyIpAddrsNormalized,
  25773                                                   data, mask
  25774                                                   )
  25775              );
  25776  }
  25777 
  25778 
  25779  int
  25780  bcm_esw_field_qualify_IpTunnelHit(int unit, bcm_field_entry_t entry,
  25781                                  uint8 data, uint8 mask)
  25782  {
  25783      int              rv;       /* Operation return status. */
  25784 
  25785      
  25786      FP_LOCK(unit);
  25787 
  25788      rv = _field_qualify32(unit, entry, bcmFieldQualifyIpTunnelHit,
  25789                            data, mask);
  25790 
  25791      FP_UNLOCK(unit);
  25792      return (rv);
  25793  }
  25794 
  25795 
  25796  int 
  25797  bcm_esw_field_qualify_IpTunnelHit_get(
  25798      int unit, 
  25799      bcm_field_entry_t entry, 
  25800      uint8 *data, 
  25801      uint8 *mask)
  25802  {
  25803      /* Read qualifier match value and mask. */ 
  25804      return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25805                                                   bcmFieldQualifyIpTunnelHit,
  25806                                                   data, mask
  25807                                                   )
  25808              );
  25809  }
  25810 
  25811 int
  25812 bcm_esw_field_qualify_L2GreVsid(int unit, bcm_field_entry_t entry,
  25813                                 uint32 data, uint32 mask)
  25814 {
  25815     int rv = BCM_E_UNAVAIL;
  25816 #ifdef BCM_TOMAHAWK_SUPPORT
  25817 
  25818     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  25819         
  25820         FP_LOCK(unit);
  25821 
  25822         rv = _field_qualify32(unit, entry, bcmFieldQualifyL2GreVsid,
  25823                                             data, mask);
  25824 
  25825         FP_UNLOCK(unit);
  25826     }
  25827 #endif
  25828     return rv;
  25829 }
  25830 int
  25831 bcm_esw_field_qualify_L2GreVsid_get(int unit, bcm_field_entry_t entry,
  25832                                 uint32 *data, uint32 *mask)
  25833 {
  25834     int rv = BCM_E_UNAVAIL;
  25835 #ifdef BCM_TOMAHAWK_SUPPORT
  25836     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  25837         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  25838                                             bcmFieldQualifyL2GreVsid,
  25839                                             data, mask);
  25840     }
  25841 #endif
  25842     return rv;
  25843 }
  25844 int
  25845  bcm_esw_field_qualify_L2GreSrcIpHit(int unit, bcm_field_entry_t entry,
  25846                                  uint8 data, uint8 mask)
  25847  {
  25848      int              rv;       /* Operation return status. */
  25849 
  25850      
  25851      FP_LOCK(unit);
  25852 
  25853      rv = _field_qualify32(unit, entry, bcmFieldQualifyL2GreSrcIpHit,
  25854                            data, mask);
  25855 
  25856      FP_UNLOCK(unit);
  25857      return (rv);
  25858  }
  25859 
  25860 
  25861  int 
  25862  bcm_esw_field_qualify_L2GreSrcIpHit_get(
  25863      int unit, 
  25864      bcm_field_entry_t entry, 
  25865      uint8 *data, 
  25866      uint8 *mask)
  25867  {
  25868      /* Read qualifier match value and mask. */ 
  25869      return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25870                                                   bcmFieldQualifyL2GreSrcIpHit,
  25871                                                   data, mask
  25872                                                   )
  25873              );
  25874  }
  25875 
  25876 
  25877  int
  25878  bcm_esw_field_qualify_L2GreVfiHit(int unit, bcm_field_entry_t entry,
  25879                                  uint8 data, uint8 mask)
  25880  {
  25881      int              rv;       /* Operation return status. */
  25882 
  25883      
  25884      FP_LOCK(unit);
  25885 
  25886      rv = _field_qualify32(unit, entry, bcmFieldQualifyL2GreVfiHit,
  25887                            data, mask);
  25888 
  25889      FP_UNLOCK(unit);
  25890      return (rv);
  25891  }
  25892 
  25893 
  25894  int 
  25895  bcm_esw_field_qualify_L2GreVfiHit_get(
  25896      int unit, 
  25897      bcm_field_entry_t entry, 
  25898      uint8 *data, 
  25899      uint8 *mask)
  25900  {
  25901      /* Read qualifier match value and mask. */ 
  25902      return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25903                                                   bcmFieldQualifyL2GreVfiHit,
  25904                                                   data, mask
  25905                                                   )
  25906              );
  25907  }
  25908 
  25909 
  25910  int
  25911  bcm_esw_field_qualify_MacAddrsNormalized(int unit, bcm_field_entry_t entry,
  25912                                  uint8 data, uint8 mask)
  25913  {
  25914      int              rv;       /* Operation return status. */
  25915 
  25916      
  25917      FP_LOCK(unit);
  25918 
  25919      rv = _field_qualify32(unit, entry, bcmFieldQualifyMacAddrsNormalized,
  25920                            data, mask);
  25921 
  25922      FP_UNLOCK(unit);
  25923      return (rv);
  25924  }
  25925 
  25926 
  25927  int 
  25928  bcm_esw_field_qualify_MacAddrsNormalized_get(
  25929      int unit, 
  25930      bcm_field_entry_t entry, 
  25931      uint8 *data, 
  25932      uint8 *mask)
  25933  {
  25934      /* Read qualifier match value and mask. */ 
  25935      return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25936                                                   bcmFieldQualifyMacAddrsNormalized,
  25937                                                   data, mask
  25938                                                   )
  25939              );
  25940  }
  25941 
  25942 
  25943  int
  25944  bcm_esw_field_qualify_MimSrcGportHit(int unit, bcm_field_entry_t entry,
  25945                                  uint8 data, uint8 mask)
  25946  {
  25947      int              rv;       /* Operation return status. */
  25948 
  25949      
  25950      FP_LOCK(unit);
  25951 
  25952      rv = _field_qualify32(unit, entry, bcmFieldQualifyMimSrcGportHit,
  25953                            data, mask);
  25954 
  25955      FP_UNLOCK(unit);
  25956      return (rv);
  25957  }
  25958 
  25959 
  25960  int 
  25961  bcm_esw_field_qualify_MimSrcGportHit_get(
  25962      int unit, 
  25963      bcm_field_entry_t entry, 
  25964      uint8 *data, 
  25965      uint8 *mask)
  25966  {
  25967      /* Read qualifier match value and mask. */ 
  25968      return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  25969                                                   bcmFieldQualifyMimSrcGportHit,
  25970                                                   data, mask
  25971                                                   )
  25972              );
  25973  }
  25974 
  25975 
  25976  int
  25977  bcm_esw_field_qualify_MimVfiHit(int unit, bcm_field_entry_t entry,
  25978                                  uint8 data, uint8 mask)
  25979  {
  25980      int              rv;       /* Operation return status. */
  25981 
  25982      
  25983      FP_LOCK(unit);
  25984 
  25985      rv = _field_qualify32(unit, entry, bcmFieldQualifyMimVfiHit,
  25986                            data, mask);
  25987 
  25988      FP_UNLOCK(unit);
  25989      return (rv);
  25990  }
  25991 
  25992 
  25993  int 
  25994  bcm_esw_field_qualify_MimVfiHit_get(
  25995      int unit, 
  25996      bcm_field_entry_t entry, 
  25997      uint8 *data, 
  25998      uint8 *mask)
  25999  {
  26000      /* Read qualifier match value and mask. */ 
  26001      return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26002                                                   bcmFieldQualifyMimVfiHit,
  26003                                                   data, mask
  26004                                                   )
  26005             );
  26006 }
  26007 
  26008 
  26009 int
  26010 bcm_esw_field_qualify_MplsControlWord(int unit, bcm_field_entry_t entry,
  26011                                 uint32 data, uint32 mask)
  26012 {
  26013     int              rv;       /* Operation return status. */
  26014 
  26015     
  26016     FP_LOCK(unit);
  26017 
  26018     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsControlWord,
  26019                           data, mask);
  26020 
  26021     FP_UNLOCK(unit);
  26022     return (rv);
  26023 }
  26024 
  26025 
  26026 int 
  26027 bcm_esw_field_qualify_MplsControlWord_get(
  26028     int unit, 
  26029     bcm_field_entry_t entry, 
  26030     uint32 *data, 
  26031     uint32 *mask)
  26032 {
  26033     /* Read qualifier match value and mask. */ 
  26034     return (_bcm_field_entry_qualifier_uint32_get(unit, entry, 
  26035                                                  bcmFieldQualifyMplsControlWord,
  26036                                                  data, mask
  26037                                                  )
  26038             );
  26039 }
  26040 
  26041 
  26042 int
  26043 bcm_esw_field_qualify_MplsControlWordValid(int unit, bcm_field_entry_t entry,
  26044                                 uint8 data, uint8 mask)
  26045 {
  26046     int              rv;       /* Operation return status. */
  26047 
  26048     
  26049     FP_LOCK(unit);
  26050 
  26051     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsControlWordValid,
  26052                           data, mask);
  26053 
  26054     FP_UNLOCK(unit);
  26055     return (rv);
  26056 }
  26057 
  26058 
  26059 int 
  26060 bcm_esw_field_qualify_MplsControlWordValid_get(
  26061     int unit, 
  26062     bcm_field_entry_t entry, 
  26063     uint8 *data, 
  26064     uint8 *mask)
  26065 {
  26066     /* Read qualifier match value and mask. */ 
  26067     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26068                                                  bcmFieldQualifyMplsControlWordValid,
  26069                                                  data, mask
  26070                                                  )
  26071             );
  26072 }
  26073 
  26074 
  26075 int
  26076 bcm_esw_field_qualify_MplsForwardingLabel(int unit, bcm_field_entry_t entry,
  26077                                 uint32 data, uint32 mask)
  26078 {
  26079     return (_bcm_esw_field_qualify_aux_tag(unit,
  26080                                            entry,
  26081                                            bcmFieldQualifyMplsForwardingLabel,
  26082                                            data,
  26083                                            mask
  26084                                            )
  26085             );
  26086 }
  26087 
  26088 
  26089 int 
  26090 bcm_esw_field_qualify_MplsForwardingLabel_get(
  26091     int unit, 
  26092     bcm_field_entry_t entry, 
  26093     uint32 *data, 
  26094     uint32 *mask)
  26095 {
  26096     /* Read qualifier match value and mask. */ 
  26097     return (_bcm_field_entry_qualifier_uint32_get(unit, entry, 
  26098                                                   bcmFieldQualifyMplsForwardingLabel,
  26099                                                   data, mask
  26100                                                   )
  26101             );
  26102 }
  26103 
  26104 
  26105 int
  26106 bcm_esw_field_qualify_MplsForwardingLabelAction(int unit, bcm_field_entry_t entry,
  26107                                 uint8 mplslabelaction, uint8 mask)
  26108 {
  26109     int              rv;       /* Operation return status. */
  26110     uint8            data;     /* Mpls label action data */
  26111 
  26112     switch (mplslabelaction) {
  26113         case BCM_FIELD_MPLS_FORWARDING_LABEL_ACTION_PHP:
  26114             data = 2;
  26115             break;
  26116         case BCM_FIELD_MPLS_FORWARDING_LABEL_ACTION_SWAP:
  26117             data = 3;
  26118             break;
  26119         case BCM_FIELD_MPLS_FORWARDING_LABEL_ACTION_POP:
  26120             data = 4;
  26121             break;
  26122         case BCM_FIELD_MPLS_FORWARDING_LABEL_ACTION_POP_USE_L2_VPN:
  26123             data = 5;
  26124             break;
  26125         case BCM_FIELD_MPLS_FORWARDING_LABEL_ACTION_POP_USE_L3_VPN:
  26126             data = 6;
  26127             break;
  26128         case BCM_FIELD_MPLS_FORWARDING_LABEL_ACTION_POP_USE_ENTROPY:
  26129             data = 7;
  26130             break;
  26131         default:
  26132             return (BCM_E_PARAM);
  26133     }
  26134 
  26135     FP_LOCK(unit);
  26136 
  26137     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsForwardingLabelAction,
  26138                           data, mask);
  26139 
  26140     FP_UNLOCK(unit);
  26141     return (rv);
  26142 }
  26143 
  26144 
  26145 int 
  26146 bcm_esw_field_qualify_MplsForwardingLabelAction_get(
  26147     int unit, 
  26148     bcm_field_entry_t entry, 
  26149     uint8 *data, 
  26150     uint8 *mask)
  26151 {
  26152     /* Read qualifier match value and mask. */ 
  26153     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26154                                                  bcmFieldQualifyMplsForwardingLabelAction,
  26155                                                  data, mask
  26156                                                  )
  26157             );
  26158 }
  26159 
  26160 
  26161 int
  26162 bcm_esw_field_qualify_MplsForwardingLabelBos(int unit, bcm_field_entry_t entry,
  26163                                 uint8 data, uint8 mask)
  26164 {
  26165     int              rv;       /* Operation return status. */
  26166 
  26167     /* Skip the Aux tag settings for Multi Pipe devices */
  26168     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26169        /* Add in AUX_TAG_VALID */
  26170        data |= 1 << 1;
  26171        mask |= 1 << 1;
  26172     }
  26173 
  26174     
  26175     FP_LOCK(unit);
  26176 
  26177     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsForwardingLabelBos,
  26178                           data, mask);
  26179 
  26180     FP_UNLOCK(unit);
  26181     return (rv);
  26182 }
  26183 
  26184 
  26185 int 
  26186 bcm_esw_field_qualify_MplsForwardingLabelBos_get(
  26187     int unit, 
  26188     bcm_field_entry_t entry, 
  26189     uint8 *data, 
  26190     uint8 *mask)
  26191 {
  26192     /* Read qualifier match value and mask. */ 
  26193     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint8_get(
  26194                             unit,
  26195                             entry, 
  26196                             bcmFieldQualifyMplsForwardingLabelBos,
  26197                             data,
  26198                             mask
  26199                                                              )
  26200                         );
  26201 
  26202     /* Skip the Aux tag settings for Multi Pipe devices */
  26203     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26204         /* Mask off AUX_TAG_VALID */
  26205         *data &= 1;
  26206         *mask &= 1;
  26207     }
  26208 
  26209     return (BCM_E_NONE);
  26210 }
  26211 
  26212 
  26213 int
  26214 bcm_esw_field_qualify_MplsForwardingLabelExp(int unit, bcm_field_entry_t entry,
  26215                                 uint8 data, uint8 mask)
  26216 {
  26217     int              rv;       /* Operation return status. */
  26218 
  26219     /* Skip the Aux tag settings for Multi Pipe devices */
  26220     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26221        /* Add in AUX_TAG_VALID */
  26222        data |= 1 << 3;
  26223        mask |= 1 << 3;
  26224     }
  26225 
  26226     
  26227     FP_LOCK(unit);
  26228 
  26229     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsForwardingLabelExp,
  26230                           data, mask);
  26231 
  26232     FP_UNLOCK(unit);
  26233     return (rv);
  26234 }
  26235 
  26236 
  26237 int 
  26238 bcm_esw_field_qualify_MplsForwardingLabelExp_get(
  26239     int unit, 
  26240     bcm_field_entry_t entry, 
  26241     uint8 *data, 
  26242     uint8 *mask)
  26243 {
  26244     /* Read qualifier match value and mask. */ 
  26245     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint8_get(
  26246                             unit,
  26247                             entry, 
  26248                             bcmFieldQualifyMplsForwardingLabelExp,
  26249                             data,
  26250                             mask
  26251                                                              )
  26252                         );
  26253 
  26254     /* Skip the Aux tag settings for Multi Pipe devices */
  26255     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26256        /* Mask off AUX_TAG_VALID */
  26257        *data &= (1 << 3) - 1;
  26258        *mask &= (1 << 3) - 1;
  26259     }
  26260 
  26261     return (BCM_E_NONE);
  26262 }
  26263 
  26264 
  26265 int
  26266 bcm_esw_field_qualify_MplsForwardingLabelId(int unit, bcm_field_entry_t entry,
  26267                                 uint32 data, uint32 mask)
  26268 {
  26269     int              rv;       /* Operation return status. */
  26270 
  26271     /* Skip the Aux tag settings for Multi Pipe devices */
  26272     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26273        /* Add in AUX_TAG_VALID */
  26274        data |= 1 << 20;
  26275        mask |= 1 << 20;
  26276     }
  26277 
  26278     
  26279     FP_LOCK(unit);
  26280 
  26281     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsForwardingLabelId,
  26282                           data, mask);
  26283 
  26284     FP_UNLOCK(unit);
  26285     return (rv);
  26286 }
  26287 
  26288 
  26289 int 
  26290 bcm_esw_field_qualify_MplsForwardingLabelId_get(
  26291     int unit, 
  26292     bcm_field_entry_t entry, 
  26293     uint32 *data, 
  26294     uint32 *mask)
  26295 {
  26296     /* Read qualifier match value and mask. */ 
  26297     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(
  26298                             unit,
  26299                             entry, 
  26300                             bcmFieldQualifyMplsForwardingLabelId,
  26301                             data,
  26302                             mask
  26303                                                               )
  26304                         );
  26305 
  26306     /* Skip the Aux tag settings for Multi Pipe devices */
  26307     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26308        /* Mask off AUX_TAG_VALID */
  26309        *data &= (1 << 20) - 1;
  26310        *mask &= (1 << 20) - 1;
  26311     }
  26312 
  26313     return (BCM_E_NONE);
  26314 }
  26315 
  26316 
  26317 int
  26318 bcm_esw_field_qualify_MplsForwardingLabelTtl(int unit, bcm_field_entry_t entry,
  26319                                 uint8 data, uint8 mask)
  26320 {
  26321     int              rv;       /* Operation return status. */
  26322 
  26323     /* Skip the Aux tag settings for Multi Pipe devices */
  26324     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26325        /* Add in AUX_TAG_VALID (1 << 8)*/
  26326        data = data | (1 << 8);
  26327        mask = mask | (1 << 8);
  26328     }
  26329 
  26330     
  26331     FP_LOCK(unit);
  26332 
  26333     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsForwardingLabelTtl,
  26334                           data, mask);
  26335 
  26336     FP_UNLOCK(unit);
  26337     return (rv);
  26338 }
  26339 
  26340 
  26341 int 
  26342 bcm_esw_field_qualify_MplsForwardingLabelTtl_get(
  26343     int unit, 
  26344     bcm_field_entry_t entry, 
  26345     uint8 *data, 
  26346     uint8 *mask)
  26347 {
  26348     /* Read qualifier match value and mask. */ 
  26349     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint8_get(
  26350                             unit,
  26351                             entry, 
  26352                             bcmFieldQualifyMplsForwardingLabelTtl,
  26353                             data,
  26354                             mask
  26355                                                              )
  26356                         );
  26357 
  26358     /* Skip the Aux tag settings for Multi Pipe devices */
  26359     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26360        /* Mask off AUX_TAG_VALID */
  26361        *data &= (1 << 8) - 1;
  26362        *mask &= (1 << 8) - 1;
  26363     }
  26364 
  26365     return (BCM_E_NONE);
  26366 }
  26367 
  26368 
  26369 int
  26370 bcm_esw_field_qualify_MplsLabel1Hit(int unit, bcm_field_entry_t entry,
  26371                                 uint8 data, uint8 mask)
  26372 {
  26373     int              rv;       /* Operation return status. */
  26374 
  26375     
  26376     FP_LOCK(unit);
  26377 
  26378     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsLabel1Hit,
  26379                           data, mask);
  26380 
  26381     FP_UNLOCK(unit);
  26382     return (rv);
  26383 }
  26384 
  26385 
  26386 int 
  26387 bcm_esw_field_qualify_MplsLabel1Hit_get(
  26388     int unit, 
  26389     bcm_field_entry_t entry, 
  26390     uint8 *data, 
  26391     uint8 *mask)
  26392 {
  26393     /* Read qualifier match value and mask. */ 
  26394     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26395                                                  bcmFieldQualifyMplsLabel1Hit,
  26396                                                  data, mask
  26397                                                  )
  26398             );
  26399 }
  26400 
  26401 
  26402 int
  26403 bcm_esw_field_qualify_MplsLabel2Hit(int unit, bcm_field_entry_t entry,
  26404                                 uint8 data, uint8 mask)
  26405 {
  26406     int              rv;       /* Operation return status. */
  26407 
  26408     
  26409     FP_LOCK(unit);
  26410 
  26411     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsLabel2Hit,
  26412                           data, mask);
  26413 
  26414     FP_UNLOCK(unit);
  26415     return (rv);
  26416 }
  26417 
  26418 
  26419 int 
  26420 bcm_esw_field_qualify_MplsLabel2Hit_get(
  26421     int unit, 
  26422     bcm_field_entry_t entry, 
  26423     uint8 *data, 
  26424     uint8 *mask)
  26425 {
  26426     /* Read qualifier match value and mask. */ 
  26427     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26428                                                  bcmFieldQualifyMplsLabel2Hit,
  26429                                                  data, mask
  26430                                                  )
  26431             );
  26432 }
  26433 
  26434 
  26435 int
  26436 bcm_esw_field_qualify_RecoverableDrop(int unit, bcm_field_entry_t entry,
  26437                                 uint8 data, uint8 mask)
  26438 {
  26439     int              rv;       /* Operation return status. */
  26440 
  26441     
  26442     FP_LOCK(unit);
  26443 
  26444     rv = _field_qualify32(unit, entry, bcmFieldQualifyRecoverableDrop,
  26445                           data, mask);
  26446 
  26447     FP_UNLOCK(unit);
  26448     return (rv);
  26449 }
  26450 
  26451 
  26452 int 
  26453 bcm_esw_field_qualify_RecoverableDrop_get(
  26454     int unit, 
  26455     bcm_field_entry_t entry, 
  26456     uint8 *data, 
  26457     uint8 *mask)
  26458 {
  26459     /* Read qualifier match value and mask. */ 
  26460     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26461                                                  bcmFieldQualifyRecoverableDrop,
  26462                                                  data, mask
  26463                                                  )
  26464             );
  26465 }
  26466 
  26467 
  26468 int
  26469 bcm_esw_field_qualify_RepCopy(int unit, bcm_field_entry_t entry,
  26470                                 uint8 data, uint8 mask)
  26471 {
  26472     int              rv;       /* Operation return status. */
  26473 
  26474     
  26475     FP_LOCK(unit);
  26476 
  26477     rv = _field_qualify32(unit, entry, bcmFieldQualifyRepCopy,
  26478                           data, mask);
  26479 
  26480     FP_UNLOCK(unit);
  26481     return (rv);
  26482 }
  26483 
  26484 
  26485 int 
  26486 bcm_esw_field_qualify_RepCopy_get(
  26487     int unit, 
  26488     bcm_field_entry_t entry, 
  26489     uint8 *data, 
  26490     uint8 *mask)
  26491 {
  26492     /* Read qualifier match value and mask. */ 
  26493     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26494                                                  bcmFieldQualifyRepCopy,
  26495                                                  data, mask
  26496                                                  )
  26497             );
  26498 }
  26499 
  26500 
  26501 int
  26502 bcm_esw_field_qualify_RouterAlertLabelValid(int unit, bcm_field_entry_t entry,
  26503                                 uint8 data, uint8 mask)
  26504 {
  26505     int              rv;       /* Operation return status. */
  26506 
  26507     
  26508     FP_LOCK(unit);
  26509 
  26510     rv = _field_qualify32(unit, entry, bcmFieldQualifyRouterAlertLabelValid,
  26511                           data, mask);
  26512 
  26513     FP_UNLOCK(unit);
  26514     return (rv);
  26515 }
  26516 
  26517 
  26518 int 
  26519 bcm_esw_field_qualify_RouterAlertLabelValid_get(
  26520     int unit, 
  26521     bcm_field_entry_t entry, 
  26522     uint8 *data, 
  26523     uint8 *mask)
  26524 {
  26525     /* Read qualifier match value and mask. */ 
  26526     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26527                                                  bcmFieldQualifyRouterAlertLabelValid,
  26528                                                  data, mask
  26529                                                  )
  26530             );
  26531 }
  26532 
  26533 
  26534 int
  26535 bcm_esw_field_qualify_Rtag7AHashLower(int unit, bcm_field_entry_t entry,
  26536                                 uint16 data, uint16 mask)
  26537 {
  26538     int              rv;       /* Operation return status. */
  26539     uint32           ref_data, ref_mask;
  26540 
  26541     ref_data = (uint32) data;
  26542     ref_mask = (uint32) mask;
  26543 
  26544     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26545        /* AUX_TAG_VALID_1/2 field needs to be set in TCAM table */
  26546        ref_data |= 1 << (sizeof(data) * 8);
  26547        ref_mask |= 1 << (sizeof(data) * 8);
  26548     } 
  26549 
  26550     
  26551     FP_LOCK(unit);
  26552 
  26553     rv = _field_qualify32(unit, entry, bcmFieldQualifyRtag7AHashLower,
  26554                           ref_data, ref_mask);
  26555 
  26556     FP_UNLOCK(unit);
  26557     return (rv);
  26558 }
  26559 
  26560 
  26561 int 
  26562 bcm_esw_field_qualify_Rtag7AHashLower_get(
  26563     int unit, 
  26564     bcm_field_entry_t entry, 
  26565     uint16 *data, 
  26566     uint16 *mask)
  26567 {
  26568     /* Read qualifier match value and mask. */ 
  26569     return (_bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26570                                                   bcmFieldQualifyRtag7AHashLower,
  26571                                                   data, mask
  26572                                                   )
  26573             );
  26574 }
  26575 
  26576 
  26577 int
  26578 bcm_esw_field_qualify_Rtag7AHashUpper(int unit, bcm_field_entry_t entry,
  26579                                 uint16 data, uint16 mask)
  26580 {
  26581     int              rv;       /* Operation return status. */
  26582     uint32           ref_data, ref_mask;
  26583 
  26584     ref_data = (uint32) data;
  26585     ref_mask = (uint32) mask;
  26586 
  26587     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26588        /* AUX_TAG_VALID_1/2 field needs to be set in TCAM table */
  26589        ref_data |= 1 << (sizeof(data) * 8);
  26590        ref_mask |= 1 << (sizeof(data) * 8);
  26591     }
  26592 
  26593     
  26594     FP_LOCK(unit);
  26595 
  26596     rv = _field_qualify32(unit, entry, bcmFieldQualifyRtag7AHashUpper,
  26597                           ref_data, ref_mask);
  26598 
  26599     FP_UNLOCK(unit);
  26600     return (rv);
  26601 }
  26602 
  26603 
  26604 int 
  26605 bcm_esw_field_qualify_Rtag7AHashUpper_get(
  26606     int unit, 
  26607     bcm_field_entry_t entry, 
  26608     uint16 *data, 
  26609     uint16 *mask)
  26610 {
  26611     /* Read qualifier match value and mask. */ 
  26612     return (_bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26613                                                   bcmFieldQualifyRtag7AHashUpper,
  26614                                                   data, mask
  26615                                                   )
  26616             );
  26617 }
  26618 
  26619 
  26620 int
  26621 bcm_esw_field_qualify_Rtag7BHashLower(int unit, bcm_field_entry_t entry,
  26622                                 uint16 data, uint16 mask)
  26623 {
  26624     int              rv;       /* Operation return status. */
  26625     uint32           ref_data, ref_mask;
  26626 
  26627     ref_data = (uint32) data;
  26628     ref_mask = (uint32) mask;
  26629 
  26630     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26631        /* AUX_TAG_VALID_1/2 field needs to be set in TCAM table */
  26632        ref_data |= 1 << (sizeof(data) * 8);
  26633        ref_mask |= 1 << (sizeof(data) * 8);
  26634     }
  26635 
  26636     
  26637     FP_LOCK(unit);
  26638 
  26639     rv = _field_qualify32(unit, entry, bcmFieldQualifyRtag7BHashLower,
  26640                           ref_data, ref_mask);
  26641 
  26642     FP_UNLOCK(unit);
  26643     return (rv);
  26644 }
  26645 
  26646 
  26647 int 
  26648 bcm_esw_field_qualify_Rtag7BHashLower_get(
  26649     int unit, 
  26650     bcm_field_entry_t entry, 
  26651     uint16 *data, 
  26652     uint16 *mask)
  26653 {
  26654     /* Read qualifier match value and mask. */ 
  26655     return (_bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26656                                                   bcmFieldQualifyRtag7BHashLower,
  26657                                                   data, mask
  26658                                                   )
  26659             );
  26660 }
  26661 
  26662 
  26663 int
  26664 bcm_esw_field_qualify_Rtag7BHashUpper(int unit, bcm_field_entry_t entry,
  26665                                 uint16 data, uint16 mask)
  26666 {
  26667     int              rv;       /* Operation return status. */
  26668     uint32           ref_data, ref_mask;
  26669 
  26670     ref_data = (uint32) data;
  26671     ref_mask = (uint32) mask;
  26672 
  26673     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  26674        /* AUX_TAG_VALID_1/2 field needs to be set in TCAM table */
  26675        ref_data |= 1 << (sizeof(data) * 8);
  26676        ref_mask |= 1 << (sizeof(data) * 8);
  26677     }
  26678 
  26679     
  26680     FP_LOCK(unit);
  26681 
  26682     rv = _field_qualify32(unit, entry, bcmFieldQualifyRtag7BHashUpper,
  26683                           ref_data, ref_mask);
  26684 
  26685     FP_UNLOCK(unit);
  26686     return (rv);
  26687 }
  26688 
  26689 
  26690 int 
  26691 bcm_esw_field_qualify_Rtag7BHashUpper_get(
  26692     int unit, 
  26693     bcm_field_entry_t entry, 
  26694     uint16 *data, 
  26695     uint16 *mask)
  26696 {
  26697     /* Read qualifier match value and mask. */ 
  26698     return (_bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26699                                                   bcmFieldQualifyRtag7BHashUpper,
  26700                                                   data, mask
  26701                                                   )
  26702             );
  26703 }
  26704 
  26705 
  26706 int
  26707 bcm_esw_field_qualify_TrillEgressRbridgeHit(int unit, bcm_field_entry_t entry,
  26708                                 uint8 data, uint8 mask)
  26709 {
  26710     int              rv;       /* Operation return status. */
  26711 
  26712     
  26713     FP_LOCK(unit);
  26714 
  26715     rv = _field_qualify32(unit, entry, bcmFieldQualifyTrillEgressRbridgeHit,
  26716                           data, mask);
  26717 
  26718     FP_UNLOCK(unit);
  26719     return (rv);
  26720 }
  26721 
  26722 
  26723 int 
  26724 bcm_esw_field_qualify_TrillEgressRbridgeHit_get(
  26725     int unit, 
  26726     bcm_field_entry_t entry, 
  26727     uint8 *data, 
  26728     uint8 *mask)
  26729 {
  26730     /* Read qualifier match value and mask. */ 
  26731     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26732                                                  bcmFieldQualifyTrillEgressRbridgeHit,
  26733                                                  data, mask
  26734                                                  )
  26735             );
  26736 }
  26737 
  26738 
  26739 int
  26740 bcm_esw_field_qualify_TrillIngressRbridgeHit(int unit, bcm_field_entry_t entry,
  26741                                 uint8 data, uint8 mask)
  26742 {
  26743     int              rv;       /* Operation return status. */
  26744 
  26745     
  26746     FP_LOCK(unit);
  26747 
  26748     rv = _field_qualify32(unit, entry, bcmFieldQualifyTrillIngressRbridgeHit,
  26749                           data, mask);
  26750 
  26751     FP_UNLOCK(unit);
  26752     return (rv);
  26753 }
  26754 
  26755 
  26756 int 
  26757 bcm_esw_field_qualify_TrillIngressRbridgeHit_get(
  26758     int unit, 
  26759     bcm_field_entry_t entry, 
  26760     uint8 *data, 
  26761     uint8 *mask)
  26762 {
  26763     /* Read qualifier match value and mask. */ 
  26764     return (_bcm_field_entry_qualifier_uint8_get(unit, entry, 
  26765                                                  bcmFieldQualifyTrillIngressRbridgeHit,
  26766                                                  data, mask
  26767                                                  )
  26768             );
  26769 }
  26770 
  26771 
  26772 int
  26773 bcm_esw_field_qualify_EgressClass(int unit, bcm_field_entry_t entry,
  26774                                 uint16 data, uint16 mask)
  26775 {
  26776     int              rv;       /* Operation return status. */
  26777 
  26778     
  26779     FP_LOCK(unit);
  26780 
  26781     rv = _field_qualify32(unit, entry, bcmFieldQualifyEgressClass,
  26782                           data, mask);
  26783 
  26784     FP_UNLOCK(unit);
  26785     return (rv);
  26786 }
  26787 
  26788 
  26789 int 
  26790 bcm_esw_field_qualify_EgressClass_get(
  26791     int unit, 
  26792     bcm_field_entry_t entry, 
  26793     uint16 *data, 
  26794     uint16 *mask)
  26795 {
  26796     /* Read qualifier match value and mask. */ 
  26797     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26798                                              bcmFieldQualifyEgressClass,
  26799                                              data, mask);
  26800 }
  26801 
  26802 
  26803 int
  26804 bcm_esw_field_qualify_EgressClassL2Gre(int unit, bcm_field_entry_t entry,
  26805                                 uint16 data, uint16 mask)
  26806 {
  26807     int              rv;       /* Operation return status. */
  26808 
  26809     
  26810     FP_LOCK(unit);
  26811 
  26812     rv = _field_qualify32(unit, entry, bcmFieldQualifyEgressClassL2Gre,
  26813                           data, mask);
  26814 
  26815     FP_UNLOCK(unit);
  26816     return (rv);
  26817 }
  26818 
  26819 
  26820 int 
  26821 bcm_esw_field_qualify_EgressClassL2Gre_get(
  26822     int unit, 
  26823     bcm_field_entry_t entry, 
  26824     uint16 *data, 
  26825     uint16 *mask)
  26826 {
  26827     /* Read qualifier match value and mask. */ 
  26828     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26829                                              bcmFieldQualifyEgressClassL2Gre,
  26830                                              data, mask);
  26831 }
  26832 
  26833 
  26834 int
  26835 bcm_esw_field_qualify_EgressClassL3Interface(int unit, bcm_field_entry_t entry,
  26836                                 uint16 data, uint16 mask)
  26837 {
  26838     int              rv;       /* Operation return status. */
  26839 
  26840     
  26841     FP_LOCK(unit);
  26842 
  26843     rv = _field_qualify32(unit, entry, bcmFieldQualifyEgressClassL3Interface,
  26844                           data, mask);
  26845 
  26846     FP_UNLOCK(unit);
  26847     return (rv);
  26848 }
  26849 
  26850 
  26851 int 
  26852 bcm_esw_field_qualify_EgressClassL3Interface_get(
  26853     int unit, 
  26854     bcm_field_entry_t entry, 
  26855     uint16 *data, 
  26856     uint16 *mask)
  26857 {
  26858     /* Read qualifier match value and mask. */ 
  26859     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26860                                              bcmFieldQualifyEgressClassL3Interface,
  26861                                              data, mask);
  26862 }
  26863 
  26864 
  26865 int
  26866 bcm_esw_field_qualify_EgressClassTrill(int unit, bcm_field_entry_t entry,
  26867                                 uint16 data, uint16 mask)
  26868 {
  26869     int              rv;       /* Operation return status. */
  26870 
  26871     
  26872     FP_LOCK(unit);
  26873 
  26874     rv = _field_qualify32(unit, entry, bcmFieldQualifyEgressClassTrill,
  26875                           data, mask);
  26876 
  26877     FP_UNLOCK(unit);
  26878     return (rv);
  26879 }
  26880 
  26881 
  26882 int 
  26883 bcm_esw_field_qualify_EgressClassTrill_get(
  26884     int unit, 
  26885     bcm_field_entry_t entry, 
  26886     uint16 *data, 
  26887     uint16 *mask)
  26888 {
  26889     /* Read qualifier match value and mask. */ 
  26890     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26891                                              bcmFieldQualifyEgressClassTrill,
  26892                                              data, mask);
  26893 }
  26894 
  26895 
  26896 int
  26897 bcm_esw_field_qualify_EgressClassWlan(int unit, bcm_field_entry_t entry,
  26898                                 uint16 data, uint16 mask)
  26899 {
  26900     int              rv;       /* Operation return status. */
  26901 
  26902     
  26903     FP_LOCK(unit);
  26904 
  26905     rv = _field_qualify32(unit, entry, bcmFieldQualifyEgressClassWlan,
  26906                           data, mask);
  26907 
  26908     FP_UNLOCK(unit);
  26909     return (rv);
  26910 }
  26911 
  26912 
  26913 int 
  26914 bcm_esw_field_qualify_EgressClassWlan_get(
  26915     int unit, 
  26916     bcm_field_entry_t entry, 
  26917     uint16 *data, 
  26918     uint16 *mask)
  26919 {
  26920     /* Read qualifier match value and mask. */ 
  26921     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26922                                              bcmFieldQualifyEgressClassWlan,
  26923                                              data, mask);
  26924 }
  26925 
  26926 /* 
  26927  * Set match criteria for EgressClassVxlan
  26928  *                qualifier.
  26929  */
  26930 int bcm_esw_field_qualify_EgressClassVxlan(
  26931     int unit, 
  26932     bcm_field_entry_t entry, 
  26933     uint16 data, 
  26934     uint16 mask)
  26935 {
  26936     int              rv;       /* Operation return status. */
  26937 
  26938     
  26939     FP_LOCK(unit);
  26940 
  26941     rv = _field_qualify32(unit, entry, bcmFieldQualifyEgressClassVxlan,
  26942                           data, mask);
  26943 
  26944     FP_UNLOCK(unit);
  26945     return (rv);
  26946 }
  26947 
  26948 
  26949 /* 
  26950  * Get match criteria for EgressClassVxlan
  26951  *                qualifier.
  26952  */
  26953 int bcm_esw_field_qualify_EgressClassVxlan_get(
  26954     int unit, 
  26955     bcm_field_entry_t entry, 
  26956     uint16 *data, 
  26957     uint16 *mask)
  26958 {
  26959       /* Read qualifier match value and mask. */ 
  26960     return _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  26961                                              bcmFieldQualifyEgressClassVxlan,
  26962                                              data, mask);
  26963 }
  26964 
  26965 /*
  26966  * Function:
  26967  *     bcm_esw_field_qualify_SrcGport
  26968  * Purpose:
  26969  *     Add Source ModPort or MPLS/MiM/WLAN/Niv/extender port qualification to a
  26970  *     field entry.
  26971  * Parameters:
  26972  *     unit     - (IN) BCM device number
  26973  *     entry    - (IN) Field Entry id.
  26974  *     port_id  - (IN) ModPort Gport or MPLS/MiM/WLAN/Niv/extender Gport ID.
  26975  * Returns:
  26976  *      BCM_E_XXX
  26977  */
  26978 int 
  26979 bcm_esw_field_qualify_SrcGport(int unit, 
  26980                                bcm_field_entry_t entry, 
  26981                                bcm_gport_t port_id)
  26982 {
  26983     int rv = BCM_E_UNAVAIL; /* Operation return status. */
  26984 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  26985     _field_control_t *fc;   /* Field control structure. */
  26986     uint32 data;            /* HW data match value.     */
  26987     uint32 mask;            /* HW data mask value.      */
  26988     bcm_module_t modid;     /* Source Module ID.        */
  26989     bcm_port_t port;        /* Source Port.             */
  26990     int ingress_entity = 0;
  26991 
  26992     /* Input parameters check. */
  26993     /* coverity[dead_error_line : FALSE] */ 
  26994     if ((0 == BCM_GPORT_IS_MPLS_PORT(port_id))
  26995         && (0 == BCM_GPORT_IS_MIM_PORT(port_id)
  26996         && (0 == BCM_GPORT_IS_WLAN_PORT(port_id))
  26997         && (0 == BCM_GPORT_IS_NIV_PORT(port_id))
  26998         && (!soc_feature(unit, soc_feature_niv) && (BCM_GPORT_IS_NIV_PORT(port_id)))
  26999         && (0 == BCM_GPORT_IS_VLAN_PORT(port_id))
  27000         && (0 == BCM_GPORT_IS_MODPORT(port_id))
  27001         && (0 == BCM_GPORT_IS_EXTENDER_PORT(port_id))
  27002         && (0 == BCM_GPORT_IS_TRUNK(port_id)))
  27003         && (0 == BCM_GPORT_IS_FLOW_PORT(port_id))
  27004         && (0 == BCM_GPORT_IS_VXLAN_PORT(port_id))) {
  27005         return (BCM_E_PARAM);
  27006     }
  27007 
  27008     
  27009 
  27010     FP_LOCK(unit);
  27011     rv = _field_control_get(unit, &fc);
  27012     if (BCM_FAILURE(rv)) {
  27013         FP_UNLOCK(unit);
  27014         return rv;
  27015     }
  27016 
  27017     /* Include all bits for mask value */
  27018     mask = BCM_FIELD_EXACT_MATCH_MASK;
  27019 
  27020 
  27021     /* Check if source port is a generic logical port. */
  27022     if (BCM_GPORT_IS_MODPORT(port_id)) {
  27023 
  27024         /* Get the Mod/Port pair value for the given Gport value. */
  27025         rv = _field_qualifier_gport_resolve(unit, port_id, mask,
  27026                                             &port, &modid, NULL);
  27027         if (BCM_FAILURE(rv)) {
  27028             FP_UNLOCK(unit);
  27029             return (rv);
  27030         }
  27031 
  27032         /* Qualify the source port value. */
  27033         rv = _field_qualify_Port(unit, entry, modid,
  27034                                  mask, port,
  27035                                  mask, bcmFieldQualifySrcGport);
  27036     } else if (BCM_GPORT_IS_TRUNK(port_id)) {
  27037 
  27038         /* Get the Mod/Port pair value for the given Gport value. */
  27039         rv = _field_qualifier_gport_resolve(unit, port_id, mask, 
  27040                                            NULL, NULL, (bcm_trunk_t *)&data);
  27041         if (BCM_FAILURE(rv)) {
  27042             FP_UNLOCK(unit);
  27043             return (rv);
  27044         }
  27045 
  27046         /* Qualify the source trunk value. */
  27047         rv = fc->functions.fp_qualify_trunk(unit, entry, 
  27048                                             bcmFieldQualifySrcGport, 
  27049                                             data, mask);
  27050     } else {
  27051         _field_entry_t *f_ent;   /* Field entry information. */
  27052 
  27053         /*
  27054          * Source port is a virtual port.
  27055          */
  27056     
  27057         /* Get field entry part that contains the qualifier. */
  27058         rv = _bcm_field_entry_qual_get(unit, entry,
  27059                                    bcmFieldQualifySrcGport, &f_ent);
  27060         if (BCM_FAILURE(rv)) {
  27061             FP_UNLOCK(unit);
  27062             return (rv);
  27063         }
  27064 
  27065         /* Get the source virtual port value */
  27066         if (BCM_GPORT_IS_MPLS_PORT(port_id)) {
  27067             data = BCM_GPORT_MPLS_PORT_ID_GET(port_id);
  27068             f_ent->svp_type = _bcmVpTypeMpls;
  27069         } else if (BCM_GPORT_IS_MIM_PORT(port_id)) {
  27070             data = BCM_GPORT_MIM_PORT_ID_GET(port_id);
  27071             f_ent->svp_type = _bcmVpTypeMim;
  27072         } else if (BCM_GPORT_IS_NIV_PORT(port_id)) {
  27073             data = BCM_GPORT_NIV_PORT_ID_GET(port_id);
  27074             f_ent->svp_type = _bcmVpTypeNiv;
  27075         } else if (BCM_GPORT_IS_VLAN_PORT(port_id)) {
  27076             data = BCM_GPORT_VLAN_PORT_ID_GET(port_id);
  27077             f_ent->svp_type = _bcmVpTypeVlan;
  27078         } else if (BCM_GPORT_IS_EXTENDER_PORT(port_id)) {
  27079             data = BCM_GPORT_EXTENDER_PORT_ID_GET(port_id);
  27080             f_ent->svp_type = _bcmVpTypeExtender;
  27081         } else if (BCM_GPORT_IS_VXLAN_PORT(port_id)) {
  27082             data = BCM_GPORT_VXLAN_PORT_ID_GET(port_id);
  27083             f_ent->svp_type = _bcmVpTypeVxlan;
  27084         } else if (BCM_GPORT_IS_FLOW_PORT(port_id)) {
  27085             data = BCM_GPORT_FLOW_PORT_ID_GET(port_id);
  27086             f_ent->svp_type = _bcmVpTypeFlow;
  27087         }else {
  27088             data = BCM_GPORT_WLAN_PORT_ID_GET(port_id);
  27089             f_ent->svp_type = _bcmVpTypeWlan;
  27090         }
  27091 
  27092 #if defined(BCM_TOMAHAWK_SUPPORT)
  27093        /*
  27094         * Invoke driver function for multi pipe supported devices.
  27095         */ 
  27096         if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  27097             rv = _bcm_field_is_entry_stage_valid(unit, entry,
  27098                                                  _BCM_FIELD_STAGE_INGRESS);
  27099 
  27100             if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
  27101                 FP_UNLOCK(unit);
  27102                 return (rv); 
  27103             }
  27104     
  27105             if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
  27106                 rv = fc->functions.fp_qualify_svp(unit, entry,
  27107                                               bcmFieldQualifySrcGports,
  27108                                               data, mask, 1);
  27109                 FP_UNLOCK(unit);
  27110                 return (rv);
  27111             }
  27112         }
  27113 #endif /* BCM_TOMAHAWK_SUPPORT */
  27114 
  27115 #ifdef BCM_TRIDENT2_SUPPORT
  27116         if (SOC_IS_TD2_TT2(unit)) {
  27117             /* Internal qualifier to set SVP valid bit in Fixed field */
  27118             rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
  27119 
  27120             if (BCM_FAILURE(rv)) {
  27121                 FP_UNLOCK(unit);
  27122                 return (rv);
  27123             }
  27124             ingress_entity = 1;
  27125         }
  27126 #endif /* BCM_TRIDENT2_SUPPORT */
  27127 
  27128         /* Qualify Source Virtual Port */
  27129         rv = _field_qualify_source_virtual_port(unit, entry,
  27130                                                 bcmFieldQualifySrcGport,
  27131                                                 data, mask, ingress_entity);
  27132     }
  27133 
  27134     FP_UNLOCK(unit);
  27135 #endif
  27136     return (rv);
  27137 }
  27138 
  27139 /*
  27140  * Function:
  27141  *     bcm_esw_field_qualify_SrcGport_get
  27142  * Purpose:
  27143  *     Get Source ModPort or MPLS/MiM/WLAN/extender gport value from a
  27144  *     field entry.
  27145  * Parameters:
  27146  *     unit     - (IN) BCM device number
  27147  *     entry    - (IN) Field Entry id.
  27148  *     port_id  - (OUT) ModPort Gport or MPLS/MiM/WLAN/extender Gport ID.
  27149  * Returns:
  27150  *      BCM_E_XXX
  27151  */
  27152 int 
  27153 bcm_esw_field_qualify_SrcGport_get(int unit,
  27154                                    bcm_field_entry_t entry,
  27155                                    bcm_gport_t *port_id)
  27156 {
  27157     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  27158 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  27159     uint32 data;             /* HW encoded qualifier data.    */
  27160     uint32 mask;             /* HW encoding qualifier mask.   */
  27161     bcm_module_t data_modid; /* Module ID.                    */
  27162     bcm_port_t data_port;    /* Port ID.                      */
  27163     bcm_module_t modid;      /* Module ID.                    */
  27164     bcm_port_t port;         /* Port ID.                      */
  27165     uint8 num_bits_for_port; /* Port bitmap bits count.       */
  27166     uint8 trunk_bit_pos;     /* Trunk indicator bit position. */
  27167     _bcm_field_qual_offset_t *q_offset; /* Qualifier offset.  */
  27168     _field_entry_t *f_ent;   /* Field entry information.      */
  27169 
  27170     /* Input parameters check. */
  27171     if (NULL == port_id) {
  27172         return (BCM_E_PARAM);
  27173     }
  27174 
  27175     
  27176     FP_LOCK(unit);
  27177 
  27178     /* Read qualifier match value and mask. */
  27179     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  27180                                                bcmFieldQualifySrcGport,
  27181                                                &data, &mask);
  27182     FP_UNLOCK(unit);
  27183     BCM_IF_ERROR_RETURN(rv);
  27184 
  27185     if (mask == 0) {
  27186         return BCM_E_NOT_FOUND;
  27187     }
  27188 
  27189     /* Get field entry part that contains the qualifier. */
  27190     rv = _bcm_field_entry_qual_get(unit, entry,
  27191                                    bcmFieldQualifySrcGport, &f_ent);
  27192     BCM_IF_ERROR_RETURN(rv);
  27193 
  27194     /* Get qualifier offsets in the tcam. */
  27195     rv = _field_qual_offset_get(unit, f_ent,
  27196                                 bcmFieldQualifySrcGport, &q_offset);
  27197     BCM_IF_ERROR_RETURN(rv);
  27198 
  27199     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  27200        /* Clear SVP valid bit. */
  27201        data &= ((1 << (q_offset->width[0] - 1)) - 1);
  27202     }
  27203 
  27204     if (f_ent->svp_type == _bcmVpTypeMpls) {
  27205         BCM_GPORT_MPLS_PORT_ID_SET(*port_id, data);
  27206     } else if (f_ent->svp_type == _bcmVpTypeMim) {
  27207         BCM_GPORT_MIM_PORT_ID_SET(*port_id, data);
  27208     } else if (f_ent->svp_type == _bcmVpTypeNiv) {
  27209         BCM_GPORT_NIV_PORT_ID_SET(*port_id, data);
  27210     } else if (f_ent->svp_type == _bcmVpTypeVlan) {
  27211         BCM_GPORT_VLAN_PORT_ID_SET(*port_id, data);
  27212     } else if (f_ent->svp_type == _bcmVpTypeExtender) {
  27213         BCM_GPORT_EXTENDER_PORT_ID_SET(*port_id, data);
  27214     } else if (f_ent->svp_type == _bcmVpTypeVxlan) {
  27215         BCM_GPORT_VXLAN_PORT_ID_SET(*port_id, data);
  27216     } else if (f_ent->svp_type == _bcmVpTypeFlow) {
  27217         BCM_GPORT_FLOW_PORT_ID_SET(*port_id, data);
  27218     } else if (f_ent->svp_type == _bcmVpTypeWlan) {
  27219         BCM_GPORT_WLAN_PORT_ID_SET(*port_id, data);
  27220     } else {
  27221         /* ModPort Gport type. */
  27222         if (soc_feature(unit, soc_feature_trunk_group_overlay)) {
  27223             num_bits_for_port
  27224                 = _shr_popcount((unsigned int)SOC_PORT_ADDR_MAX(unit));
  27225         /* SrcPort and DstPort are programmed as 0 - 7 bits are used to store port and 7 - 14 are for Module ID
  27226            num_bits_for_port is increased by 2 as SOC_PORT_ADDR_MAX returns 5 for Metrolite.
  27227         */
  27228 
  27229 #if defined(BCM_METROLITE_SUPPORT)
  27230         if (SOC_IS_METROLITE(unit)) {
  27231             num_bits_for_port += 2;
  27232         }
  27233 #endif
  27234 
  27235             data_modid = data >> num_bits_for_port;
  27236             data_port = data & ((1 << num_bits_for_port) - 1);
  27237         } else {
  27238              /* Get the trunk bit position */
  27239             trunk_bit_pos = SOC_TRUNK_BIT_POS(unit);
  27240             data_modid = data >> (trunk_bit_pos + 1);
  27241             data_port = data & ((1 << trunk_bit_pos) - 1);
  27242         }
  27243 
  27244         BCM_IF_ERROR_RETURN
  27245             (_bcm_esw_stk_modmap_map(unit, BCM_STK_MODMAP_GET, data_modid,
  27246                                      data_port, &modid, &port));
  27247         BCM_GPORT_MODPORT_SET(*port_id, modid, port);
  27248     }
  27249 #endif
  27250     return (rv);
  27251 }
  27252 
  27253 
  27254 
  27255 /*
  27256  * Function:
  27257  *     bcm_esw_field_qualify_DstGport
  27258  * Purpose:
  27259  *     Add Destination Gport qualification to a
  27260  *     field entry.
  27261  * Parameters:
  27262  *     unit     - (IN) BCM device number
  27263  *     entry    - (IN) Field Entry id.
  27264  *     port_id  - (IN) Gport ID.
  27265  * Returns:
  27266  *      BCM_E_XXX
  27267  */
  27268 int 
  27269 bcm_esw_field_qualify_DstGport(int unit, 
  27270                                bcm_field_entry_t entry, 
  27271                                bcm_gport_t port_id)
  27272 {
  27273     _field_control_t *fc;   /* Field control structure. */
  27274     uint32 data;            /* HW data match criteria.  */
  27275     uint32 mask;            /* HW data mask.            */
  27276     int rv = 0;             /* Operation return status. */
  27277     _field_entry_t *f_ent;  /* Field entry structure.   */
  27278     bcm_module_t modid;     /* Source Module ID.        */
  27279     bcm_port_t port;        /* Source Port.             */
  27280 
  27281     /* Input parameters check. */
  27282     /* coverity[dead_error_line : FALSE] */  
  27283     if ((0 == BCM_GPORT_IS_MPLS_PORT(port_id))
  27284         && (0 == BCM_GPORT_IS_MIM_PORT(port_id)
  27285         && (0 == BCM_GPORT_IS_WLAN_PORT(port_id))
  27286         && (0 == BCM_GPORT_IS_NIV_PORT(port_id))
  27287         && (!soc_feature(unit, soc_feature_niv) && (BCM_GPORT_IS_NIV_PORT(port_id)))
  27288         && (0 == BCM_GPORT_IS_VLAN_PORT(port_id))
  27289         && (0 == BCM_GPORT_IS_EXTENDER_PORT(port_id))
  27290         && (0 == BCM_GPORT_IS_MODPORT(port_id))
  27291         && (0 == BCM_GPORT_IS_TRUNK(port_id))
  27292         && (0 == BCM_GPORT_IS_FLOW_PORT(port_id))
  27293         && (0 == BCM_GPORT_IS_VXLAN_PORT(port_id)))) {
  27294         return (BCM_E_PARAM);
  27295     }
  27296 
  27297     /* Include all bits for mask value */
  27298     mask = BCM_FIELD_EXACT_MATCH_MASK;
  27299 
  27300     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  27301                          bcmFieldQualifyDstGport, &f_ent));
  27302 
  27303     FP_LOCK(unit);
  27304     rv = _field_control_get(unit, &fc);
  27305     if (BCM_FAILURE(rv)) {
  27306         FP_UNLOCK(unit);
  27307         return rv;
  27308     }
  27309 
  27310     /* Check if entry belongs to Egress Stage. */
  27311     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  27312         /* 
  27313          * LSB is DVP valid bit.
  27314   * Shift DVP value by 1-bit,
  27315          */
  27316 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  27317         /* Get the source virtual port value */
  27318         if (BCM_GPORT_IS_MPLS_PORT(port_id)) {
  27319             data = BCM_GPORT_MPLS_PORT_ID_GET(port_id);
  27320             f_ent->dvp_type = _bcmVpTypeMpls;
  27321         } else if (BCM_GPORT_IS_MIM_PORT(port_id)) {
  27322             data = BCM_GPORT_MIM_PORT_ID_GET(port_id);
  27323             f_ent->dvp_type = _bcmVpTypeMim;
  27324         } else if (BCM_GPORT_IS_NIV_PORT(port_id)) {
  27325             data = BCM_GPORT_NIV_PORT_ID_GET(port_id);
  27326             f_ent->dvp_type = _bcmVpTypeNiv;
  27327         } else if (BCM_GPORT_IS_VLAN_PORT(port_id)) {
  27328             data = BCM_GPORT_VLAN_PORT_ID_GET(port_id);
  27329             f_ent->dvp_type = _bcmVpTypeVlan;
  27330         } else if (BCM_GPORT_IS_EXTENDER_PORT(port_id)) {
  27331             data = BCM_GPORT_EXTENDER_PORT_ID_GET(port_id);
  27332             f_ent->dvp_type = _bcmVpTypeExtender;
  27333         } else if (BCM_GPORT_IS_VXLAN_PORT(port_id)) {
  27334             data = BCM_GPORT_VXLAN_PORT_ID_GET(port_id);
  27335             f_ent->dvp_type = _bcmVpTypeVxlan;
  27336         } else if (BCM_GPORT_IS_FLOW_PORT(port_id)) {
  27337             data = BCM_GPORT_FLOW_PORT_ID_GET(port_id);
  27338             f_ent->dvp_type = _bcmVpTypeFlow;
  27339         } else if (BCM_GPORT_IS_WLAN_PORT(port_id)) {
  27340             data = BCM_GPORT_WLAN_PORT_ID_GET(port_id);
  27341             f_ent->dvp_type = _bcmVpTypeWlan;
  27342         } else
  27343 #endif /* INCLUDE_L3 & TRX_SUPPORT */
  27344         {
  27345             if (BCM_GPORT_IS_MODPORT(port_id)) {
  27346                 rv = _field_qualifier_gport_resolve(unit, port_id, mask,
  27347                                                 &port, &modid, NULL);
  27348                 if (BCM_FAILURE(rv)) {
  27349                     FP_UNLOCK(unit);
  27350                     return (rv);
  27351                 }
  27352 
  27353                 /* Qualify the source port value. */
  27354                 rv = _field_qualify_Port(unit, entry, modid,
  27355                                      mask, port,
  27356                                      mask, bcmFieldQualifyDstGport);
  27357                 f_ent->dvp_type = _BCM_GPORT_TYPE_MOD_PORT;
  27358                 FP_UNLOCK(unit);
  27359                 return (rv);
  27360             } else {
  27361                 FP_UNLOCK(unit);
  27362                 return (BCM_E_PARAM);
  27363             }
  27364         }
  27365 
  27366         data <<= 1;
  27367 
  27368         /* Set DVP Valid bit. */
  27369         data |= 1;
  27370         rv = _field_qualify32(unit, entry, bcmFieldQualifyDstGport,
  27371                               data, mask);
  27372     } else {
  27373         /* Check if source port is a generic logical port. */
  27374         if (BCM_GPORT_IS_MODPORT(port_id)) {
  27375 
  27376             /* Get the Mod/Port pair value for the given Gport value. */
  27377             rv = _field_qualifier_gport_resolve(unit, port_id, mask,
  27378                                                 &port, &modid, NULL);
  27379             if (BCM_FAILURE(rv)) {
  27380                 FP_UNLOCK(unit);
  27381                 return (rv);
  27382             }
  27383 
  27384             /* Qualify the source port value. */
  27385             rv = _field_qualify_Port(unit, entry, modid,
  27386                                      mask, port,
  27387                                      mask, bcmFieldQualifyDstGport);
  27388         } else if (BCM_GPORT_IS_TRUNK(port_id)) {
  27389 
  27390             /* Get the Mod/Port pair value for the given Gport value. */
  27391             rv = _field_qualifier_gport_resolve(unit, port_id, mask,
  27392                                                NULL, NULL, (bcm_trunk_t *)&data);
  27393             if (BCM_FAILURE(rv)) {
  27394                 FP_UNLOCK(unit);
  27395                 return (rv);
  27396             }
  27397 
  27398             /* Qualify the source trunk value. */
  27399             rv = fc->functions.fp_qualify_trunk(unit, entry, 
  27400                                                 bcmFieldQualifyDstGport, 
  27401                                                 data, mask);
  27402         } else {
  27403             /*
  27404              * Destination port is a virtual port.
  27405              */
  27406 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  27407 
  27408             /* Get the source virtual port value */
  27409             if (BCM_GPORT_IS_MPLS_PORT(port_id)) {
  27410                 data = BCM_GPORT_MPLS_PORT_ID_GET(port_id);
  27411                 f_ent->dvp_type = _bcmVpTypeMpls;
  27412             } else if (BCM_GPORT_IS_MIM_PORT(port_id)) {
  27413                 data = BCM_GPORT_MIM_PORT_ID_GET(port_id);
  27414                 f_ent->dvp_type = _bcmVpTypeMim;
  27415             } else if (BCM_GPORT_IS_NIV_PORT(port_id)) {
  27416                 data = BCM_GPORT_NIV_PORT_ID_GET(port_id);
  27417                 f_ent->dvp_type = _bcmVpTypeNiv;
  27418             } else if (BCM_GPORT_IS_VLAN_PORT(port_id)) {
  27419                 data = BCM_GPORT_VLAN_PORT_ID_GET(port_id);
  27420                 f_ent->dvp_type = _bcmVpTypeVlan;
  27421             } else if (BCM_GPORT_IS_EXTENDER_PORT(port_id)) {
  27422                 data = BCM_GPORT_EXTENDER_PORT_ID_GET(port_id);
  27423                 f_ent->dvp_type = _bcmVpTypeExtender;
  27424             } else if (BCM_GPORT_IS_VXLAN_PORT(port_id)) {
  27425                 data = BCM_GPORT_VXLAN_PORT_ID_GET(port_id);
  27426                 f_ent->dvp_type = _bcmVpTypeVxlan;
  27427             } else if (BCM_GPORT_IS_FLOW_PORT(port_id)) {
  27428                 data = BCM_GPORT_FLOW_PORT_ID_GET(port_id);
  27429                 f_ent->dvp_type = _bcmVpTypeFlow;
  27430             } else {
  27431                 data = BCM_GPORT_WLAN_PORT_ID_GET(port_id);
  27432                 f_ent->dvp_type = _bcmVpTypeWlan;
  27433             }
  27434 
  27435            /*
  27436             * Invoke driver function for multi pipe supported devices.
  27437             */
  27438 #if defined(BCM_TOMAHAWK_SUPPORT)
  27439             if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  27440                 _BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) {
  27441                   rv = fc->functions.fp_qualify_dvp(unit, entry,
  27442                                           bcmFieldQualifyDstGport,
  27443                                           data, mask, 1);
  27444                   FP_UNLOCK(unit);
  27445                   return (rv);
  27446             }
  27447 #endif /* BCM_TOMAHAWK_SUPPORT */
  27448 
  27449             /* Qualify the destination type qualifier */
  27450             rv = _field_dest_type_qualify(unit, entry,
  27451                                           bcmFieldQualifyDstGport, 
  27452                                           &data, &mask, 
  27453                                           _bcmFieldDestTypeDvp);
  27454             if (BCM_FAILURE(rv)) {
  27455                 FP_UNLOCK(unit);
  27456                 return (rv);
  27457             }
  27458             rv = _field_qualify32(unit, entry, bcmFieldQualifyDstGport,
  27459                                   data, mask);
  27460 #endif /* INCLUDE_L3 & TRX_SUPPORT */ 
  27461         }
  27462     }
  27463     FP_UNLOCK(unit);
  27464     return (rv);
  27465 }
  27466 /*
  27467  * Function:
  27468  *     bcm_esw_field_qualify_DstGport_get
  27469  * Purpose:
  27470  *     Get Destination Gport value from a
  27471  *     field entry.
  27472  * Parameters:
  27473  *     unit     - (IN) BCM device number
  27474  *     entry    - (IN) Field Entry id.
  27475  *     port_id  - (OUT) Gport ID.
  27476  * Returns:
  27477  *      BCM_E_XXX
  27478  */
  27479 
  27480 int 
  27481 bcm_esw_field_qualify_DstGport_get(int unit,
  27482                                    bcm_field_entry_t entry,
  27483                                    bcm_gport_t *port_id)
  27484 {
  27485     uint32 data;   /* HW encoded qualifier data.  */
  27486     uint32 mask;   /* HW encoding qualifier mask. */
  27487     int rv;        /* Operation return status.    */
  27488     _field_entry_t *f_ent; /* Field entry structure. */
  27489     bcm_module_t data_modid; /* Module ID.                    */
  27490     bcm_port_t data_port;    /* Port ID.                      */
  27491     bcm_module_t modid;      /* Module ID.                    */
  27492     bcm_port_t port;         /* Port ID.                      */
  27493     uint8 num_bits_for_port; /* Port bitmap bits count.       */
  27494     uint8 trunk_bit_pos;
  27495 
  27496     /* Input parameters check. */
  27497     if (NULL == port_id) {
  27498         return (BCM_E_PARAM);
  27499     }
  27500 
  27501     /* Read qualifier match value and mask. */ 
  27502     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  27503                                             bcmFieldQualifyDstGport,
  27504                                             &data, &mask);
  27505     BCM_IF_ERROR_RETURN(rv);
  27506 
  27507     if (mask == 0) {
  27508         return BCM_E_NOT_FOUND;
  27509     }
  27510 
  27511     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  27512         bcmFieldQualifyDstGport, &f_ent));
  27513 
  27514     /* Check if entry belongs to Egress Stage. */
  27515     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  27516          /* Clear DVP Valid bit. */
  27517         if (f_ent->dvp_type != _BCM_GPORT_TYPE_MOD_PORT)  {
  27518             data >>= 1;
  27519         }
  27520     } else {
  27521 
  27522         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  27523             entry, bcmFieldQualifyDstGport, &data, &mask));
  27524     }
  27525 
  27526     /* Get the trunk bit position */
  27527     trunk_bit_pos = SOC_TRUNK_BIT_POS(unit);
  27528 
  27529     if (data >> trunk_bit_pos != 1) {
  27530 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  27531         if (f_ent->dvp_type == _bcmVpTypeMpls) {
  27532             BCM_GPORT_MPLS_PORT_ID_SET(*port_id, data);
  27533         } else if (f_ent->dvp_type == _bcmVpTypeMim) {
  27534             BCM_GPORT_MIM_PORT_ID_SET(*port_id, data);
  27535         } else if (f_ent->dvp_type == _bcmVpTypeNiv) {
  27536             BCM_GPORT_NIV_PORT_ID_SET(*port_id, data);
  27537         } else if (f_ent->dvp_type == _bcmVpTypeVlan) {
  27538             BCM_GPORT_VLAN_PORT_ID_SET(*port_id, data);
  27539         } else if (f_ent->dvp_type == _bcmVpTypeExtender) {
  27540             BCM_GPORT_EXTENDER_PORT_ID_SET(*port_id, data);
  27541         } else if (f_ent->dvp_type == _bcmVpTypeWlan) {
  27542             BCM_GPORT_WLAN_PORT_ID_SET(*port_id, data);
  27543         } else if (f_ent->dvp_type == _bcmVpTypeVxlan) {
  27544             BCM_GPORT_VXLAN_PORT_ID_SET(*port_id, data);
  27545         } else if (f_ent->dvp_type == _bcmVpTypeFlow) {
  27546             BCM_GPORT_FLOW_PORT_ID_SET(*port_id, data);
  27547         } else
  27548 #endif /* INCLUDE_L3 & TRX_SUPPORT */
  27549             {
  27550 
  27551                 /* ModPort Gport type. */
  27552                 if (soc_feature(unit, soc_feature_trunk_group_overlay)) {
  27553                     num_bits_for_port
  27554                         = _shr_popcount((unsigned int)SOC_PORT_ADDR_MAX(unit));
  27555 
  27556                     /* SrcPort and DstPort are programmed as 0 - 7 bits are used to store port and 7 - 14 are for Module ID
  27557                        num_bits_for_port is increased by 2 as SOC_PORT_ADDR_MAX returns 5 for Metrolite.
  27558                     */
  27559 #if defined(BCM_METROLITE_SUPPORT)
  27560                     if (SOC_IS_METROLITE(unit)) {
  27561                         num_bits_for_port += 2;
  27562                     }
  27563 #endif
  27564                     data_modid = data >> num_bits_for_port;
  27565                     data_port = data & ((1 << num_bits_for_port) - 1);
  27566                     BCM_IF_ERROR_RETURN
  27567                        (_bcm_esw_stk_modmap_map(unit, BCM_STK_MODMAP_GET, data_modid,
  27568                                          data_port, &modid, &port));
  27569                     BCM_GPORT_MODPORT_SET(*port_id, modid, port);
  27570                 }
  27571             }
  27572     } else {
  27573         data = (data & ( ~( 1 << trunk_bit_pos)));
  27574         BCM_GPORT_TRUNK_SET(*port_id, data);
  27575     }
  27576 
  27577     return BCM_E_NONE; 
  27578 }
  27579 
  27580 
  27581 /*
  27582  * Function:
  27583  *      bcm_esw_field_qualify_SrcVlanGport_get
  27584  * Purpose:
  27585  *      Get match criteria for bcmFieildQualifySrcVlanGport
  27586  *                     qualifier from the field entry.
  27587  * Parameters:
  27588  *      unit - (IN) Unit number.
  27589  *      entry - (IN) BCM field entry id.
  27590  *      vlan_port_id - (OUT) Vlan port id.
  27591  * Returns:
  27592  *      BCM_E_XXX
  27593  * Notes:
  27594  */
  27595 int
  27596 bcm_esw_field_qualify_SrcVlanGport_get(int unit,
  27597         bcm_field_entry_t entry,
  27598         bcm_gport_t *vlan_port_id)
  27599 {
  27600     uint32 data;   /* HW encoded qualifier data.  */
  27601     uint32 mask;   /* HW encoding qualifier mask. */
  27602     int rv;        /* Operation return status.    */
  27603 
  27604     /* Input parameters check. */
  27605     if (NULL == vlan_port_id) {
  27606         return (BCM_E_PARAM);
  27607     }
  27608 
  27609     /* Read qualifier match value and mask. */
  27610     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  27611             bcmFieldQualifySrcVlanGport,
  27612             &data, &mask);
  27613     BCM_IF_ERROR_RETURN(rv);
  27614 
  27615     if (mask == 0) {
  27616         return BCM_E_NOT_FOUND;
  27617     }
  27618 
  27619     data &=  0x1fff;
  27620     BCM_GPORT_VLAN_PORT_ID_SET(*vlan_port_id, data);
  27621 
  27622     return BCM_E_NONE;
  27623 }
  27624 
  27625 /*
  27626  * Function:
  27627  *      bcm_esw_field_qualify_DstVlanGport_get
  27628  * Purpose:
  27629  *      Get match criteria for bcmFieildQualifyDstVlanGport
  27630  *                     qualifier from the field entry.
  27631  * Parameters:
  27632  *      unit - (IN) Unit number.
  27633  *      entry - (IN) BCM field entry id.
  27634  *      vlan_port_id - (OUT) Vlan port id.
  27635  * Returns:
  27636  *      BCM_E_XXX
  27637  * Notes:
  27638  */
  27639 int
  27640 bcm_esw_field_qualify_DstVlanGport_get(int unit,
  27641         bcm_field_entry_t entry,
  27642         bcm_gport_t *vlan_port_id)
  27643 {
  27644     uint32 data;   /* HW encoded qualifier data.  */
  27645     uint32 mask;   /* HW encoding qualifier mask. */
  27646     int rv;        /* Operation return status.    */
  27647     _field_entry_t *f_ent; /* Field entry structure. */
  27648 
  27649     /* Input parameters check. */
  27650     if (NULL == vlan_port_id) {
  27651         return (BCM_E_PARAM);
  27652     }
  27653 
  27654     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  27655                 bcmFieldQualifyDstVlanGport, &f_ent));
  27656 
  27657     /* Read qualifier match value and mask. */
  27658     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  27659             bcmFieldQualifyDstVlanGport,
  27660             &data, &mask);
  27661     BCM_IF_ERROR_RETURN(rv);
  27662 
  27663     if (mask == 0) {
  27664         return BCM_E_NOT_FOUND;
  27665     }
  27666 
  27667     /* Check if entry belongs to Egress Stage. */
  27668     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  27669         /* Clear DVP Valid bit. */
  27670         data >>= 1;
  27671     } else {
  27672         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  27673                     entry, bcmFieldQualifyDstVlanGport, &data, &mask));
  27674     }
  27675 
  27676     BCM_GPORT_VLAN_PORT_ID_SET(*vlan_port_id, data);
  27677 
  27678     return BCM_E_NONE;
  27679 }
  27680 
  27681 
  27682 /*
  27683  * Function:
  27684  *      bcm_esw_field_qualify_MplsOuterLabelPop
  27685  * Purpose:
  27686  *      Set match criteria for bcmFieildQualifyMplsOuterLabelPop
  27687  *                     qualifier from the field entry.
  27688  * Parameters:
  27689  *      unit - (IN) Unit number.
  27690  *      entry - (IN) BCM field entry id.
  27691  *      data - (IN) Qualifier match data.
  27692  *      mask - (IN) Qualifier match mask.
  27693  * Returns:
  27694  *      BCM_E_XXX
  27695  * Notes:
  27696  */
  27697 int 
  27698 bcm_esw_field_qualify_MplsOuterLabelPop(
  27699     int unit, 
  27700     bcm_field_entry_t entry, 
  27701     uint8 data, 
  27702     uint8 mask) 
  27703 {
  27704     int rv;
  27705 
  27706     
  27707     FP_LOCK(unit);
  27708 
  27709     rv = _field_qualify32(unit, entry,
  27710                 bcmFieldQualifyMplsOuterLabelPop, data, mask);
  27711     FP_UNLOCK(unit);
  27712     return (rv);
  27713 }
  27714 
  27715 /*
  27716  * Function:
  27717  *      bcm_esw_field_qualify_MplsStationHitTunnelUnterminated
  27718  * Purpose:
  27719  *      Set match criteria for bcmFieildQualifyMplsStationHitTunnelUnterminated
  27720  *                     qualifier from the field entry.
  27721  * Parameters:
  27722  *      unit - (IN) Unit number.
  27723  *      entry - (IN) BCM field entry id.
  27724  *      data - (IN) Qualifier match data.
  27725  *      mask - (IN) Qualifier match mask.
  27726  * Returns:
  27727  *      BCM_E_XXX
  27728  * Notes:
  27729  */
  27730 int
  27731 bcm_esw_field_qualify_MplsStationHitTunnelUnterminated(
  27732     int unit,
  27733     bcm_field_entry_t entry,
  27734     uint8 data,
  27735     uint8 mask)
  27736 {
  27737     int rv;
  27738 
  27739     
  27740     FP_LOCK(unit);
  27741 
  27742     rv = _field_qualify32(unit, entry,
  27743                 bcmFieldQualifyMplsStationHitTunnelUnterminated, data, mask);
  27744     FP_UNLOCK(unit);
  27745     return (rv);
  27746 }
  27747 
  27748 /*
  27749  * Function:
  27750  *      bcm_esw_field_qualify_MplsOuterLabelPop_get
  27751  * Purpose:
  27752  *      Get match criteria for bcmFieildQualifyMplsOuterLabelPop
  27753  *                     qualifier from the field entry.
  27754  * Parameters:
  27755  *      unit - (IN) Unit number.
  27756  *      entry - (IN) BCM field entry id.
  27757  *      data - (OUT) Qualifier match data.
  27758  *      mask - (OUT) Qualifier match mask.
  27759  * Returns:
  27760  *      BCM_E_XXX
  27761  * Notes:
  27762  */
  27763 int
  27764 bcm_esw_field_qualify_MplsOuterLabelPop_get(
  27765     int unit,
  27766     bcm_field_entry_t entry,
  27767     uint8 *data,
  27768     uint8 *mask)
  27769 {
  27770     /* Read qualifier match value and mask. */
  27771     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  27772                 bcmFieldQualifyMplsOuterLabelPop, data, mask);
  27773 }
  27774 
  27775 /*
  27776  * Function:
  27777  *      bcm_esw_field_qualify_MplsStationHitTunnelUnterminated_get
  27778  * Purpose:
  27779  *      Get match criteria for bcmFieildQualifyMplsStationHitTunnelUnterminated
  27780  *                     qualifier from the field entry.
  27781  * Parameters:
  27782  *      unit - (IN) Unit number.
  27783  *      entry - (IN) BCM field entry id.
  27784  *      data - (OUT) Qualifier match data.
  27785  *      mask - (OUT) Qualifier match mask.
  27786  * Returns:
  27787  *      BCM_E_XXX
  27788  * Notes:
  27789  */
  27790 int
  27791 bcm_esw_field_qualify_MplsStationHitTunnelUnterminated_get(
  27792     int unit,
  27793     bcm_field_entry_t entry,
  27794     uint8 *data,
  27795     uint8 *mask)
  27796 {
  27797     /* Read qualifier match value and mask. */
  27798     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  27799                 bcmFieldQualifyMplsStationHitTunnelUnterminated, data, mask);
  27800 }
  27801 
  27802 /*
  27803  * Function:
  27804  *      bcm_esw_field_qualify_IngressClassField
  27805  * Purpose:
  27806  *      Set match criteria for bcmFieildQualifyIngressClassField
  27807  *      qualifier from the field entry.
  27808  * Parameters:
  27809  *      unit    - (IN) Unit number.
  27810  *      entry   - (IN) BCM field entry id.
  27811  *      data    - (IN) Qualifier match data.
  27812  *      mask    - (IN) Qualifier match mask.
  27813  * Returns:
  27814  *      BCM_E_XXX
  27815  * Notes:
  27816  */
  27817 int 
  27818 bcm_esw_field_qualify_IngressClassField(
  27819     int unit, 
  27820     bcm_field_entry_t entry, 
  27821     uint32 data, 
  27822     uint32 mask) 
  27823 {
  27824     int                    rv;
  27825 
  27826 
  27827 #if defined(BCM_TOMAHAWK_SUPPORT)
  27828     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  27829         BCM_IF_ERROR_RETURN
  27830           (_bcm_field_th_qualify_class(unit, entry,
  27831                                        bcmFieldQualifyIngressClassField,
  27832                                        &data, &mask));
  27833     } else
  27834 #endif /* BCM_TOMAHAWK_SUPPORT */
  27835 #ifdef BCM_TRIDENT2_SUPPORT
  27836     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  27837         BCM_IF_ERROR_RETURN
  27838             (_bcm_field_td2_qualify_class(unit,
  27839                                           entry,
  27840                                           bcmFieldQualifyIngressClassField,
  27841                                           &data,
  27842                                           &mask
  27843                                           )
  27844             );
  27845     } else
  27846 #endif
  27847 #ifdef BCM_TRIUMPH3_SUPPORT
  27848     if (SOC_IS_TRIUMPH3(unit)) {
  27849         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
  27850                                                          entry,
  27851                                                          bcmFieldQualifyIngressClassField,
  27852                                                          &data,
  27853                                                          &mask
  27854                                                          )
  27855                             );
  27856     } else
  27857 #endif
  27858 #ifdef BCM_KATANA2_SUPPORT
  27859     if (SOC_IS_KATANA2(unit)) {
  27860         BCM_IF_ERROR_RETURN
  27861             (_bcm_field_kt2_qualify_class(unit,
  27862                                           entry,
  27863                                           bcmFieldQualifyIngressClassField,
  27864                                           &data,
  27865                                           &mask
  27866                                           ));
  27867     } else
  27868 #endif /* BCM_KATANA2_SUPPORT */
  27869     {
  27870         /* Input parameters check. */
  27871         if (data > SOC_ADDR_CLASS_MAX(unit)) {
  27872             return (BCM_E_PARAM);
  27873         }
  27874     }
  27875 
  27876     
  27877     FP_LOCK(unit);
  27878 
  27879     rv = _field_qualify32(unit, entry, bcmFieldQualifyIngressClassField, 
  27880                           data, mask);
  27881     FP_UNLOCK(unit);
  27882     return (rv);
  27883 }
  27884 
  27885 /*
  27886  * Function:
  27887  *      bcm_esw_field_qualify_IngressClassField_get
  27888  * Purpose:
  27889  *      Get match criteria for bcmFieildQualifyIngressClassField
  27890  *      qualifier from the field entry.
  27891  * Parameters:
  27892  *      unit    - (IN) Unit number.
  27893  *      entry   - (IN) BCM field entry id.
  27894  *      data    - (OUT) Qualifier match data.
  27895  *      mask    - (OUT) Qualifier match mask.
  27896  * Returns:
  27897  *      BCM_E_XXX
  27898  * Notes:
  27899  */
  27900 int
  27901 bcm_esw_field_qualify_IngressClassField_get(
  27902     int unit,
  27903     bcm_field_entry_t entry,
  27904     uint32 *data,
  27905     uint32 *mask)
  27906 {
  27907     /* Read qualifier match value and mask. */
  27908     BCM_IF_ERROR_RETURN
  27909        (_bcm_field_entry_qualifier_uint32_get(unit,
  27910                                               entry,
  27911                                               bcmFieldQualifyIngressClassField,
  27912                                               data,
  27913                                               mask
  27914                                               )
  27915        );
  27916 #if defined(BCM_TOMAHAWK_SUPPORT)
  27917     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  27918         BCM_IF_ERROR_RETURN
  27919           (_bcm_field_th_qualify_class_get(unit, entry,
  27920                                            bcmFieldQualifyIngressClassField,
  27921                                            data, mask));
  27922     } else
  27923 #endif /* BCM_TOMAHAWK_SUPPORT */
  27924 #ifdef BCM_TRIDENT2_SUPPORT
  27925     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  27926         BCM_IF_ERROR_RETURN
  27927             (_bcm_field_td2_qualify_class_get(unit,
  27928                                               entry,
  27929                                               bcmFieldQualifyIngressClassField,
  27930                                               data,
  27931                                               mask
  27932                                               )
  27933             );
  27934         return (BCM_E_NONE);
  27935     }
  27936 #endif
  27937 #if defined BCM_KATANA2_SUPPORT
  27938     if (SOC_IS_KATANA2(unit)){
  27939         BCM_IF_ERROR_RETURN
  27940             (_bcm_field_kt2_qualify_class_get(unit,
  27941                                               entry,
  27942                                               bcmFieldQualifyIngressClassField,
  27943                                               data,
  27944                                               mask
  27945                                              )
  27946             );
  27947         return (BCM_E_NONE);
  27948     }
  27949 #endif
  27950 #ifdef BCM_TRIUMPH3_SUPPORT
  27951     if (SOC_IS_TRIUMPH3(unit)) {
  27952         BCM_IF_ERROR_RETURN
  27953             (_bcm_field_tr3_qualify_class_get(unit,
  27954                                               entry,
  27955                                               bcmFieldQualifyIngressClassField,
  27956                                               data,
  27957                                               mask
  27958                                              )
  27959             );
  27960         return (BCM_E_NONE);
  27961     }
  27962 #endif
  27963 #if defined BCM_KATANA2_SUPPORT
  27964     if (SOC_IS_KATANA2(unit)){
  27965         BCM_IF_ERROR_RETURN
  27966             (_bcm_field_kt2_qualify_class_get(unit,
  27967                                               entry,
  27968                                               bcmFieldQualifyIngressClassField,
  27969                                               data,
  27970                                               mask
  27971                                              )
  27972             );
  27973         return (BCM_E_NONE);
  27974     }
  27975 #endif
  27976     return (BCM_E_NONE);
  27977 
  27978 }
  27979 
  27980 /*
  27981  * Function:
  27982  *      bcm_esw_field_qualify_IngressInterfaceClassPort
  27983  * Purpose:
  27984  *      Set match criteria for bcmFieildQualifyIngressInterfaceClassPort
  27985  *      qualifier from the field entry.
  27986  * Parameters:
  27987  *      unit    - (IN) Unit number.
  27988  *      entry   - (IN) BCM field entry id.
  27989  *      data    - (IN) Qualifier match data.
  27990  *      mask    - (IN) Qualifier match mask.
  27991  * Returns:
  27992  *      BCM_E_XXX
  27993  * Notes:
  27994  */
  27995 int 
  27996 bcm_esw_field_qualify_IngressInterfaceClassPort(
  27997     int unit, 
  27998     bcm_field_entry_t entry, 
  27999     uint32 data, 
  28000     uint32 mask) 
  28001 {
  28002     int                    rv;
  28003 
  28004 #if defined(BCM_TOMAHAWK_SUPPORT)
  28005     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  28006         BCM_IF_ERROR_RETURN
  28007           (_bcm_field_th_qualify_class(unit, entry,
  28008                                        bcmFieldQualifyIngressInterfaceClassPort,
  28009                                        &data, &mask));
  28010     } else
  28011 #endif /* BCM_TOMAHAWK_SUPPORT */
  28012 #ifdef BCM_TRIDENT2_SUPPORT
  28013     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  28014         BCM_IF_ERROR_RETURN
  28015             (_bcm_field_td2_qualify_class(unit,
  28016                                           entry,
  28017                                           bcmFieldQualifyIngressInterfaceClassPort,
  28018                                           &data,
  28019                                           &mask
  28020                                           )
  28021             );
  28022     } else
  28023 #endif
  28024 #ifdef BCM_TRIUMPH3_SUPPORT
  28025     if (SOC_IS_TRIUMPH3(unit)) {
  28026         BCM_IF_ERROR_RETURN(_bcm_field_tr3_qualify_class(unit,
  28027                                                          entry,
  28028                                                          bcmFieldQualifyIngressInterfaceClassPort,
  28029                                                          &data,
  28030                                                          &mask
  28031                                                          )
  28032                             );
  28033     } else
  28034 #endif
  28035 #ifdef BCM_KATANA2_SUPPORT
  28036     if (SOC_IS_KATANA2(unit)) {
  28037         BCM_IF_ERROR_RETURN
  28038             (_bcm_field_kt2_qualify_class(unit,
  28039                                           entry,
  28040                                           bcmFieldQualifyIngressInterfaceClassPort,
  28041                                           &data,
  28042                                           &mask
  28043                                           ));
  28044     } else
  28045 #endif /* BCM_KATANA2_SUPPORT */
  28046 
  28047     {
  28048         /* Input parameters check. */
  28049         if (data > SOC_ADDR_CLASS_MAX(unit)) {
  28050             return (BCM_E_PARAM);
  28051         }
  28052     }
  28053 
  28054     
  28055     FP_LOCK(unit);
  28056 
  28057     rv = _field_qualify32(unit, entry, bcmFieldQualifyIngressInterfaceClassPort, 
  28058                           data, mask);
  28059     FP_UNLOCK(unit);
  28060     return (rv);
  28061 }
  28062 
  28063 /*
  28064  * Function:
  28065  *      bcm_esw_field_qualify_IngressInterfaceClassPort_get
  28066  * Purpose:
  28067  *      Get match criteria for bcmFieildQualifyIngressInterfaceClassPort
  28068  *      qualifier from the field entry.
  28069  * Parameters:
  28070  *      unit    - (IN) Unit number.
  28071  *      entry   - (IN) BCM field entry id.
  28072  *      data    - (OUT) Qualifier match data.
  28073  *      mask    - (OUT) Qualifier match mask.
  28074  * Returns:
  28075  *      BCM_E_XXX
  28076  * Notes:
  28077  */
  28078 int
  28079 bcm_esw_field_qualify_IngressInterfaceClassPort_get(
  28080     int unit,
  28081     bcm_field_entry_t entry,
  28082     uint32 *data,
  28083     uint32 *mask)
  28084 {
  28085     /*Read qualifier and match value and mask */
  28086 
  28087     BCM_IF_ERROR_RETURN
  28088         (_bcm_field_entry_qualifier_uint32_get(
  28089                                       unit, entry,
  28090                                       bcmFieldQualifyIngressInterfaceClassPort,
  28091                                       data, mask)
  28092                                       );
  28093 
  28094 #if defined(BCM_TOMAHAWK_SUPPORT)
  28095     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  28096         BCM_IF_ERROR_RETURN
  28097           (_bcm_field_th_qualify_class_get(unit, entry,
  28098                                       bcmFieldQualifyIngressInterfaceClassPort,
  28099                                       data, mask));
  28100     } else
  28101 #endif /* BCM_TOMAHAWK_SUPPORT */
  28102 #ifdef BCM_TRIDENT2_SUPPORT
  28103      if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  28104          BCM_IF_ERROR_RETURN
  28105              (_bcm_field_td2_qualify_class_get(
  28106                                        unit, entry,
  28107                                        bcmFieldQualifyIngressInterfaceClassPort,
  28108                                        data, mask)
  28109              );
  28110         return (BCM_E_NONE);
  28111 
  28112      } else
  28113 #endif
  28114 #if defined BCM_KATANA2_SUPPORT
  28115     if (SOC_IS_KATANA2(unit)){
  28116         BCM_IF_ERROR_RETURN
  28117              (_bcm_field_kt2_qualify_class_get(
  28118                                        unit, entry,
  28119                                        bcmFieldQualifyIngressInterfaceClassPort,
  28120                                        data, mask)
  28121              );
  28122         return (BCM_E_NONE);
  28123     } else
  28124 #endif
  28125 
  28126 #ifdef BCM_TRIUMPH3_SUPPORT
  28127      if (SOC_IS_TRIUMPH3(unit)) {
  28128          BCM_IF_ERROR_RETURN
  28129              (_bcm_field_tr3_qualify_class_get(
  28130                                        unit, entry,
  28131                                        bcmFieldQualifyIngressInterfaceClassPort,
  28132                                        data, mask)
  28133              );
  28134          return (BCM_E_NONE);
  28135 
  28136      }
  28137 #endif
  28138      return (BCM_E_NONE);
  28139 
  28140 }
  28141 
  28142 /*
  28143  * Function:
  28144  *      bcm_esw_field_qualify_VxlanFlags
  28145  * Purpose:
  28146  *      Set match criteria for bcmFieildQualifyVxlanFlags
  28147  *      qualifier from the field entry.
  28148  * Parameters:
  28149  *      unit    - (IN) Unit number.
  28150  *      entry   - (IN) BCM field entry id.
  28151  *      data    - (IN) Qualifier match data.
  28152  *      mask    - (IN) Qualifier match mask.
  28153  * Returns:
  28154  *      BCM_E_XXX
  28155  * Notes:
  28156  */
  28157 int
  28158 bcm_esw_field_qualify_VxlanFlags(
  28159     int unit,
  28160     bcm_field_entry_t entry,
  28161     uint8 data,
  28162     uint8 mask)
  28163 {
  28164     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28165 
  28166     if (soc_feature(unit, soc_feature_vxlan) ||
  28167         soc_feature(unit, soc_feature_flex_flow)) {
  28168         
  28169         FP_LOCK(unit);
  28170         rv = _field_qualify32(unit, entry, bcmFieldQualifyVxlanFlags,
  28171                               data, mask);
  28172         FP_UNLOCK(unit);
  28173     }
  28174     return(rv);
  28175 }
  28176 
  28177 /*
  28178  * Function:
  28179  *      bcm_esw_field_qualify_VxlanFlags_get
  28180  * Purpose:
  28181  *      Get match criteria for bcmFieildQualifyVxlanFlags
  28182  *      qualifier from the field entry.
  28183  * Parameters:
  28184  *      unit    - (IN) Unit number.
  28185  *      entry   - (IN) BCM field entry id.
  28186  *      data    - (OUT) Qualifier match data.
  28187  *      mask    - (OUT) Qualifier match mask.
  28188  * Returns:
  28189  *      BCM_E_XXX
  28190  * Notes:
  28191  */
  28192 int
  28193 bcm_esw_field_qualify_VxlanFlags_get(
  28194     int unit,
  28195     bcm_field_entry_t entry,
  28196     uint8 *data,
  28197     uint8 *mask)
  28198 {
  28199     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28200 
  28201     /* Read qualifier match value and mask. */
  28202     if (soc_feature(unit, soc_feature_vxlan) ||
  28203         soc_feature(unit, soc_feature_flex_flow)) {
  28204         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  28205                     bcmFieldQualifyVxlanFlags, data, mask);
  28206     }
  28207     return(rv);
  28208 }
  28209 
  28210 /*
  28211  * Function:
  28212  *      bcm_esw_field_qualify_VxlanNetworkId
  28213  * Purpose:
  28214  *      Set match criteria for bcmFieildQualifyVxlanNetworkId
  28215  *      qualifier from the field entry.
  28216  * Parameters:
  28217  *      unit    - (IN) Unit number.
  28218  *      entry   - (IN) BCM field entry id.
  28219  *      data    - (IN) Qualifier match data.
  28220  *      mask    - (IN) Qualifier match mask.
  28221  * Returns:
  28222  *      BCM_E_XXX
  28223  * Notes:
  28224  */
  28225 int
  28226 bcm_esw_field_qualify_VxlanNetworkId(
  28227     int unit,
  28228     bcm_field_entry_t entry,
  28229     uint32 data,
  28230     uint32 mask)
  28231 {
  28232     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28233 
  28234     if (soc_feature(unit, soc_feature_vxlan) ||
  28235         soc_feature(unit, soc_feature_vxlan_lite) ||
  28236         soc_feature(unit, soc_feature_flex_flow)) {
  28237         
  28238         FP_LOCK(unit);
  28239         rv = _field_qualify32(unit, entry, bcmFieldQualifyVxlanNetworkId,
  28240                               data, mask);
  28241         FP_UNLOCK(unit);
  28242     }
  28243     return(rv);
  28244 }
  28245 
  28246 /*
  28247  * Function:
  28248  *      bcm_esw_field_qualify_VxlanNetworkId_get
  28249  * Purpose:
  28250  *      Get match criteria for bcmFieildQualifyVxlanNetworkId
  28251  *      qualifier from the field entry.
  28252  * Parameters:
  28253  *      unit    - (IN) Unit number.
  28254  *      entry   - (IN) BCM field entry id.
  28255  *      data    - (OUT) Qualifier match data.
  28256  *      mask    - (OUT) Qualifier match mask.
  28257  * Returns:
  28258  *      BCM_E_XXX
  28259  * Notes:
  28260  */
  28261 int
  28262 bcm_esw_field_qualify_VxlanNetworkId_get(
  28263     int unit,
  28264     bcm_field_entry_t entry,
  28265     uint32 *data,
  28266     uint32 *mask)
  28267 {
  28268     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28269 
  28270     /* Read qualifier match value and mask. */
  28271     if (soc_feature(unit, soc_feature_vxlan) ||
  28272         soc_feature(unit, soc_feature_vxlan_lite) ||
  28273         soc_feature(unit, soc_feature_flex_flow)) {
  28274         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  28275                     bcmFieldQualifyVxlanNetworkId, data, mask);
  28276     }
  28277     return(rv);
  28278 }
  28279 
  28280 /*
  28281  * Function:
  28282  *      bcm_esw_field_qualify_NatNeeded
  28283  * Purpose:
  28284  *      Set match criteria for bcmFieildQualifyNatNeeded
  28285  *      qualifier from the field entry.
  28286  * Parameters:
  28287  *      unit    - (IN) Unit number.
  28288  *      entry   - (IN) BCM field entry id.
  28289  *      data    - (IN) Qualifier match data.
  28290  *      mask    - (IN) Qualifier match mask.
  28291  * Returns:
  28292  *      BCM_E_XXX
  28293  * Notes:
  28294  */
  28295 int
  28296 bcm_esw_field_qualify_NatNeeded(
  28297     int unit,
  28298     bcm_field_entry_t entry,
  28299     uint8 data,
  28300     uint8 mask)
  28301 {
  28302     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28303 
  28304     if (soc_feature(unit, soc_feature_nat)) {
  28305         
  28306         FP_LOCK(unit);
  28307         rv = _field_qualify32(unit, entry, bcmFieldQualifyNatNeeded,
  28308                               data, mask);
  28309         FP_UNLOCK(unit);
  28310     }
  28311     return(rv);
  28312 }
  28313 
  28314 /*
  28315  * Function:
  28316  *      bcm_esw_field_qualify_NatNeeded_get
  28317  * Purpose:
  28318  *      Get match criteria for bcmFieildQualifyNatNeeded
  28319  *      qualifier from the field entry.
  28320  * Parameters:
  28321  *      unit    - (IN) Unit number.
  28322  *      entry   - (IN) BCM field entry id.
  28323  *      data    - (OUT) Qualifier match data.
  28324  *      mask    - (OUT) Qualifier match mask.
  28325  * Returns:
  28326  *      BCM_E_XXX
  28327  * Notes:
  28328  */
  28329 int
  28330 bcm_esw_field_qualify_NatNeeded_get(
  28331     int unit,
  28332     bcm_field_entry_t entry,
  28333     uint8 *data,
  28334     uint8 *mask)
  28335 {
  28336     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28337 
  28338     /* Read qualifier match value and mask. */
  28339     if (soc_feature(unit, soc_feature_nat)) {
  28340         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  28341                     bcmFieldQualifyNatNeeded, data, mask);
  28342     }
  28343     return(rv);
  28344 }
  28345 
  28346 /*
  28347  * Function:
  28348  *      bcm_esw_field_qualify_NatDstRealmId
  28349  * Purpose:
  28350  *      Set match criteria for bcmFieildQualifyNatDstRealmId
  28351  *      qualifier from the field entry.
  28352  * Parameters:
  28353  *      unit    - (IN) Unit number.
  28354  *      entry   - (IN) BCM field entry id.
  28355  *      data    - (IN) Qualifier match data.
  28356  *      mask    - (IN) Qualifier match mask.
  28357  * Returns:
  28358  *      BCM_E_XXX
  28359  * Notes:
  28360  */
  28361 int
  28362 bcm_esw_field_qualify_NatDstRealmId(
  28363     int unit,
  28364     bcm_field_entry_t entry,
  28365     uint8 data,
  28366     uint8 mask)
  28367 {
  28368     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28369 
  28370     if (soc_feature(unit, soc_feature_nat)) {
  28371         
  28372         FP_LOCK(unit);
  28373         rv = _field_qualify32(unit, entry, bcmFieldQualifyNatDstRealmId,
  28374                               data, mask);
  28375         FP_UNLOCK(unit);
  28376     }
  28377     return(rv);
  28378 }
  28379 
  28380 /*
  28381  * Function:
  28382  *      bcm_esw_field_qualify_NatDstRealmId_get
  28383  * Purpose:
  28384  *      Get match criteria for bcmFieildQualifyNatDstRealmId
  28385  *      qualifier from the field entry.
  28386  * Parameters:
  28387  *      unit    - (IN) Unit number.
  28388  *      entry   - (IN) BCM field entry id.
  28389  *      data    - (OUT) Qualifier match data.
  28390  *      mask    - (OUT) Qualifier match mask.
  28391  * Returns:
  28392  *      BCM_E_XXX
  28393  * Notes:
  28394  */
  28395 int
  28396 bcm_esw_field_qualify_NatDstRealmId_get(
  28397     int unit,
  28398     bcm_field_entry_t entry,
  28399     uint8 *data,
  28400     uint8 *mask)
  28401 {
  28402     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28403 
  28404     /* Read qualifier match value and mask. */
  28405     if (soc_feature(unit, soc_feature_nat)) {
  28406         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  28407                     bcmFieldQualifyNatDstRealmId, data, mask);
  28408     }
  28409     return(rv);
  28410 }
  28411 
  28412 /*
  28413  * Function:
  28414  *      bcm_esw_field_qualify_NatSrcRealmId
  28415  * Purpose:
  28416  *      Set match criteria for bcmFieildQualifyNatSrcRealmId
  28417  *      qualifier from the field entry.
  28418  * Parameters:
  28419  *      unit    - (IN) Unit number.
  28420  *      entry   - (IN) BCM field entry id.
  28421  *      data    - (IN) Qualifier match data.
  28422  *      mask    - (IN) Qualifier match mask.
  28423  * Returns:
  28424  *      BCM_E_XXX
  28425  * Notes:
  28426  */
  28427 int
  28428 bcm_esw_field_qualify_NatSrcRealmId(
  28429     int unit,
  28430     bcm_field_entry_t entry,
  28431     uint8 data,
  28432     uint8 mask)
  28433 {
  28434     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28435 
  28436     if (soc_feature(unit, soc_feature_nat)) {
  28437         
  28438         FP_LOCK(unit);
  28439         rv = _field_qualify32(unit, entry, bcmFieldQualifyNatSrcRealmId,
  28440                               data, mask);
  28441         FP_UNLOCK(unit);
  28442     }
  28443     return(rv);
  28444 }
  28445 
  28446 /*
  28447  * Function:
  28448  *      bcm_esw_field_qualify_NatSrcRealmId_get
  28449  * Purpose:
  28450  *      Get match criteria for bcmFieildQualifyNatSrcRealmId
  28451  *      qualifier from the field entry.
  28452  * Parameters:
  28453  *      unit    - (IN) Unit number.
  28454  *      entry   - (IN) BCM field entry id.
  28455  *      data    - (OUT) Qualifier match data.
  28456  *      mask    - (OUT) Qualifier match mask.
  28457  * Returns:
  28458  *      BCM_E_XXX
  28459  * Notes:
  28460  */
  28461 int
  28462 bcm_esw_field_qualify_NatSrcRealmId_get(
  28463     int unit,
  28464     bcm_field_entry_t entry,
  28465     uint8 *data,
  28466     uint8 *mask)
  28467 {
  28468     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28469 
  28470     /* Read qualifier match value and mask. */
  28471     if (soc_feature(unit, soc_feature_nat)) {
  28472         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  28473                     bcmFieldQualifyNatSrcRealmId, data, mask);
  28474     }
  28475     return(rv);
  28476 }
  28477 
  28478 /*
  28479  * Function:
  28480  *      bcm_esw_field_qualify_IcmpError
  28481  * Purpose:
  28482  *      Set match criteria for bcmFieildQualifyIcmpError
  28483  *      qualifier from the field entry.
  28484  * Parameters:
  28485  *      unit    - (IN) Unit number.
  28486  *      entry   - (IN) BCM field entry id.
  28487  *      data    - (IN) Qualifier match data.
  28488  *      mask    - (IN) Qualifier match mask.
  28489  * Returns:
  28490  *      BCM_E_XXX
  28491  * Notes:
  28492  */
  28493 int
  28494 bcm_esw_field_qualify_IcmpError(
  28495     int unit,
  28496     bcm_field_entry_t entry,
  28497     uint8 data,
  28498     uint8 mask)
  28499 {
  28500     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28501 
  28502     if (soc_feature(unit, soc_feature_nat)) {
  28503         
  28504         FP_LOCK(unit);
  28505         rv = _field_qualify32(unit, entry, bcmFieldQualifyIcmpError,
  28506                               data, mask);
  28507         FP_UNLOCK(unit);
  28508     }
  28509     return(rv);
  28510 }
  28511 
  28512 /*
  28513  * Function:
  28514  *      bcm_esw_field_qualify_IcmpError_get
  28515  * Purpose:
  28516  *      Get match criteria for bcmFieildQualifyIcmpError
  28517  *      qualifier from the field entry.
  28518  * Parameters:
  28519  *      unit    - (IN) Unit number.
  28520  *      entry   - (IN) BCM field entry id.
  28521  *      data    - (OUT) Qualifier match data.
  28522  *      mask    - (OUT) Qualifier match mask.
  28523  * Returns:
  28524  *      BCM_E_XXX
  28525  * Notes:
  28526  */
  28527 int
  28528 bcm_esw_field_qualify_IcmpError_get(
  28529     int unit,
  28530     bcm_field_entry_t entry,
  28531     uint8 *data,
  28532     uint8 *mask)
  28533 {
  28534     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28535 
  28536     /* Read qualifier match value and mask. */
  28537     if (soc_feature(unit, soc_feature_nat)) {
  28538         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  28539                     bcmFieldQualifyIcmpError, data, mask);
  28540     }
  28541     return(rv);
  28542 }
  28543 
  28544 /*
  28545  * Function:
  28546  *      bcm_esw_field_qualify_FibreChanRCtl
  28547  * Purpose:
  28548  *      Set match criteria for bcmFieildQualifyFibreChanRCtl
  28549  *      qualifier from the field entry.
  28550  * Parameters:
  28551  *      unit    - (IN) Unit number.
  28552  *      entry   - (IN) BCM field entry id.
  28553  *      data    - (IN) Qualifier match data.
  28554  *      mask    - (IN) Qualifier match mask.
  28555  * Returns:
  28556  *      BCM_E_XXX
  28557  * Notes:
  28558  */
  28559 int
  28560 bcm_esw_field_qualify_FibreChanRCtl(
  28561     int unit,
  28562     bcm_field_entry_t entry,
  28563     uint8 data,
  28564     uint8 mask)
  28565 {
  28566     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28567 #if defined(BCM_TRIDENT2_SUPPORT)
  28568 
  28569     if (SOC_IS_TD2_TT2(unit)) {
  28570         
  28571         FP_LOCK(unit);
  28572         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanRCtl,
  28573                               data, mask);
  28574         FP_UNLOCK(unit);
  28575     }
  28576 #endif
  28577 
  28578     return(rv);
  28579 }
  28580 
  28581 /*
  28582  * Function:
  28583  *      bcm_esw_field_qualify_FibreChanRCtl_get
  28584  * Purpose:
  28585  *      Get match criteria for bcmFieildQualifyFibreChanRCtl
  28586  *      qualifier from the field entry.
  28587  * Parameters:
  28588  *      unit    - (IN) Unit number.
  28589  *      entry   - (IN) BCM field entry id.
  28590  *      data    - (OUT) Qualifier match data.
  28591  *      mask    - (OUT) Qualifier match mask.
  28592  * Returns:
  28593  *      BCM_E_XXX
  28594  * Notes:
  28595  */
  28596 int
  28597 bcm_esw_field_qualify_FibreChanRCtl_get(
  28598     int unit,
  28599     bcm_field_entry_t entry,
  28600     uint8 *data,
  28601     uint8 *mask)
  28602 {
  28603     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28604 #if defined(BCM_TRIDENT2_SUPPORT)
  28605     /* Read qualifier match value and mask. */
  28606     if (SOC_IS_TD2_TT2(unit)) {
  28607         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  28608                     bcmFieldQualifyFibreChanRCtl, data, mask);
  28609     }
  28610 #endif
  28611     return(rv);
  28612 }
  28613 
  28614 /*
  28615  * Function:
  28616  *      bcm_esw_field_qualify_FibreChanFCtl
  28617  * Purpose:
  28618  *      Set match criteria for bcmFieildQualifyFibreChanFCtl
  28619  *      qualifier from the field entry.
  28620  * Parameters:
  28621  *      unit    - (IN) Unit number.
  28622  *      entry   - (IN) BCM field entry id.
  28623  *      data    - (IN) Qualifier match data.
  28624  *      mask    - (IN) Qualifier match mask.
  28625  * Returns:
  28626  *      BCM_E_XXX
  28627  * Notes:
  28628  */
  28629 int
  28630 bcm_esw_field_qualify_FibreChanFCtl(
  28631     int unit,
  28632     bcm_field_entry_t entry,
  28633     uint32 data,
  28634     uint32 mask)
  28635 {
  28636     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28637 #if defined(BCM_TRIDENT2_SUPPORT)
  28638 
  28639     if (SOC_IS_TD2_TT2(unit)) {
  28640         
  28641         FP_LOCK(unit);
  28642         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanFCtl,
  28643                               data, mask);
  28644         FP_UNLOCK(unit);
  28645     }
  28646 #endif
  28647 
  28648     return(rv);
  28649 }
  28650 
  28651 /*
  28652  * Function:
  28653  *      bcm_esw_field_qualify_FibreChanFCtl_get
  28654  * Purpose:
  28655  *      Get match criteria for bcmFieildQualifyFibreChanFCtl
  28656  *      qualifier from the field entry.
  28657  * Parameters:
  28658  *      unit    - (IN) Unit number.
  28659  *      entry   - (IN) BCM field entry id.
  28660  *      data    - (OUT) Qualifier match data.
  28661  *      mask    - (OUT) Qualifier match mask.
  28662  * Returns:
  28663  *      BCM_E_XXX
  28664  * Notes:
  28665  */
  28666 int
  28667 bcm_esw_field_qualify_FibreChanFCtl_get(
  28668     int unit,
  28669     bcm_field_entry_t entry,
  28670     uint32 *data,
  28671     uint32 *mask)
  28672 {
  28673     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28674 #if defined(BCM_TRIDENT2_SUPPORT)
  28675     /* Read qualifier match value and mask. */
  28676     if (SOC_IS_TD2_TT2(unit)) {
  28677         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  28678                     bcmFieldQualifyFibreChanFCtl, data, mask);
  28679     }
  28680 #endif
  28681     return(rv);
  28682 }
  28683 
  28684 /*
  28685  * Function:
  28686  *      bcm_esw_field_qualify_FibreChanCSCtl
  28687  * Purpose:
  28688  *      Set match criteria for bcmFieildQualifyFibreChanCSCtl
  28689  *      qualifier from the field entry.
  28690  * Parameters:
  28691  *      unit    - (IN) Unit number.
  28692  *      entry   - (IN) BCM field entry id.
  28693  *      data    - (IN) Qualifier match data.
  28694  *      mask    - (IN) Qualifier match mask.
  28695  * Returns:
  28696  *      BCM_E_XXX
  28697  * Notes:
  28698  */
  28699 int
  28700 bcm_esw_field_qualify_FibreChanCSCtl(
  28701     int unit,
  28702     bcm_field_entry_t entry,
  28703     uint8 data,
  28704     uint8 mask)
  28705 {
  28706     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28707 #if defined(BCM_TRIDENT2_SUPPORT)
  28708 
  28709     if (SOC_IS_TD2_TT2(unit)) {
  28710         
  28711         FP_LOCK(unit);
  28712         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanCSCtl,
  28713                               data, mask);
  28714         FP_UNLOCK(unit);
  28715     }
  28716 #endif
  28717 
  28718     return(rv);
  28719 }
  28720 
  28721 /*
  28722  * Function:
  28723  *      bcm_esw_field_qualify_FibreChanCSCtl_get
  28724  * Purpose:
  28725  *      Get match criteria for bcmFieildQualifyFibreChanCSCtl
  28726  *      qualifier from the field entry.
  28727  * Parameters:
  28728  *      unit    - (IN) Unit number.
  28729  *      entry   - (IN) BCM field entry id.
  28730  *      data    - (OUT) Qualifier match data.
  28731  *      mask    - (OUT) Qualifier match mask.
  28732  * Returns:
  28733  *      BCM_E_XXX
  28734  * Notes:
  28735  */
  28736 int
  28737 bcm_esw_field_qualify_FibreChanCSCtl_get(
  28738     int unit,
  28739     bcm_field_entry_t entry,
  28740     uint8 *data,
  28741     uint8 *mask)
  28742 {
  28743     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28744 #if defined(BCM_TRIDENT2_SUPPORT)
  28745     /* Read qualifier match value and mask. */
  28746     if (SOC_IS_TD2_TT2(unit)) {
  28747         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  28748                     bcmFieldQualifyFibreChanCSCtl, data, mask);
  28749     }
  28750 #endif
  28751     return(rv);
  28752 }
  28753 
  28754 /*
  28755  * Function:
  28756  *      bcm_esw_field_qualify_FibreChanDFCtl
  28757  * Purpose:
  28758  *      Set match criteria for bcmFieildQualifyFibreChanDFCtl
  28759  *      qualifier from the field entry.
  28760  * Parameters:
  28761  *      unit    - (IN) Unit number.
  28762  *      entry   - (IN) BCM field entry id.
  28763  *      data    - (IN) Qualifier match data.
  28764  *      mask    - (IN) Qualifier match mask.
  28765  * Returns:
  28766  *      BCM_E_XXX
  28767  * Notes:
  28768  */
  28769 int
  28770 bcm_esw_field_qualify_FibreChanDFCtl(
  28771     int unit,
  28772     bcm_field_entry_t entry,
  28773     uint8 data,
  28774     uint8 mask)
  28775 {
  28776     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28777 #if defined(BCM_TRIDENT2_SUPPORT)
  28778 
  28779     if (SOC_IS_TD2_TT2(unit)) {
  28780         
  28781         FP_LOCK(unit);
  28782         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanDFCtl,
  28783                               data, mask);
  28784         FP_UNLOCK(unit);
  28785     }
  28786 #endif
  28787 
  28788     return(rv);
  28789 }
  28790 
  28791 /*
  28792  * Function:
  28793  *      bcm_esw_field_qualify_FibreChanDFCtl_get
  28794  * Purpose:
  28795  *      Get match criteria for bcmFieildQualifyFibreChanDFCtl
  28796  *      qualifier from the field entry.
  28797  * Parameters:
  28798  *      unit    - (IN) Unit number.
  28799  *      entry   - (IN) BCM field entry id.
  28800  *      data    - (OUT) Qualifier match data.
  28801  *      mask    - (OUT) Qualifier match mask.
  28802  * Returns:
  28803  *      BCM_E_XXX
  28804  * Notes:
  28805  */
  28806 int
  28807 bcm_esw_field_qualify_FibreChanDFCtl_get(
  28808     int unit,
  28809     bcm_field_entry_t entry,
  28810     uint8 *data,
  28811     uint8 *mask)
  28812 {
  28813     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28814 #if defined(BCM_TRIDENT2_SUPPORT)
  28815     /* Read qualifier match value and mask. */
  28816     if (SOC_IS_TD2_TT2(unit)) {
  28817         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  28818                     bcmFieldQualifyFibreChanDFCtl, data, mask);
  28819     }
  28820 #endif
  28821     return(rv);
  28822 }
  28823 
  28824 /*
  28825  * Function:
  28826  *      bcm_esw_field_qualify_FibreChanType
  28827  * Purpose:
  28828  *      Set match criteria for bcmFieildQualifyFibreChanType
  28829  *      qualifier from the field entry.
  28830  * Parameters:
  28831  *      unit    - (IN) Unit number.
  28832  *      entry   - (IN) BCM field entry id.
  28833  *      data    - (IN) Qualifier match data.
  28834  *      mask    - (IN) Qualifier match mask.
  28835  * Returns:
  28836  *      BCM_E_XXX
  28837  * Notes:
  28838  */
  28839 int
  28840 bcm_esw_field_qualify_FibreChanType(
  28841     int unit,
  28842     bcm_field_entry_t entry,
  28843     uint8 data,
  28844     uint8 mask)
  28845 {
  28846     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28847 #if defined(BCM_TRIDENT2_SUPPORT)
  28848 
  28849     if (SOC_IS_TD2_TT2(unit)) {
  28850         
  28851         FP_LOCK(unit);
  28852         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanType,
  28853                               data, mask);
  28854         FP_UNLOCK(unit);
  28855     }
  28856 #endif
  28857 
  28858     return(rv);
  28859 }
  28860 
  28861 /*
  28862  * Function:
  28863  *      bcm_esw_field_qualify_FibreChanType_get
  28864  * Purpose:
  28865  *      Get match criteria for bcmFieildQualifyFibreChanType
  28866  *      qualifier from the field entry.
  28867  * Parameters:
  28868  *      unit    - (IN) Unit number.
  28869  *      entry   - (IN) BCM field entry id.
  28870  *      data    - (OUT) Qualifier match data.
  28871  *      mask    - (OUT) Qualifier match mask.
  28872  * Returns:
  28873  *      BCM_E_XXX
  28874  * Notes:
  28875  */
  28876 int
  28877 bcm_esw_field_qualify_FibreChanType_get(
  28878     int unit,
  28879     bcm_field_entry_t entry,
  28880     uint8 *data,
  28881     uint8 *mask)
  28882 {
  28883     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28884 #if defined(BCM_TRIDENT2_SUPPORT)
  28885     /* Read qualifier match value and mask. */
  28886     if (SOC_IS_TD2_TT2(unit)) {
  28887         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  28888                     bcmFieldQualifyFibreChanType, data, mask);
  28889     }
  28890 #endif
  28891     return(rv);
  28892 }
  28893 
  28894 /*
  28895  * Function:
  28896  *      bcm_esw_field_qualify_FibreChanSrcId
  28897  * Purpose:
  28898  *      Set match criteria for bcmFieildQualifyFibreChanSrcId
  28899  *      qualifier from the field entry.
  28900  * Parameters:
  28901  *      unit    - (IN) Unit number.
  28902  *      entry   - (IN) BCM field entry id.
  28903  *      data    - (IN) Qualifier match data.
  28904  *      mask    - (IN) Qualifier match mask.
  28905  * Returns:
  28906  *      BCM_E_XXX
  28907  * Notes:
  28908  */
  28909 int
  28910 bcm_esw_field_qualify_FibreChanSrcId(
  28911     int unit,
  28912     bcm_field_entry_t entry,
  28913     uint32 data,
  28914     uint32 mask)
  28915 {
  28916     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28917 #if defined(BCM_TRIDENT2_SUPPORT)
  28918 
  28919     if (SOC_IS_TD2_TT2(unit)) {
  28920         
  28921         FP_LOCK(unit);
  28922         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanSrcId,
  28923                               data, mask);
  28924         FP_UNLOCK(unit);
  28925     }
  28926 #endif
  28927 
  28928     return(rv);
  28929 }
  28930 
  28931 /*
  28932  * Function:
  28933  *      bcm_esw_field_qualify_FibreChanSrcId_get
  28934  * Purpose:
  28935  *      Get match criteria for bcmFieildQualifyFibreChanSrcId
  28936  *      qualifier from the field entry.
  28937  * Parameters:
  28938  *      unit    - (IN) Unit number.
  28939  *      entry   - (IN) BCM field entry id.
  28940  *      data    - (OUT) Qualifier match data.
  28941  *      mask    - (OUT) Qualifier match mask.
  28942  * Returns:
  28943  *      BCM_E_XXX
  28944  * Notes:
  28945  */
  28946 int
  28947 bcm_esw_field_qualify_FibreChanSrcId_get(
  28948     int unit,
  28949     bcm_field_entry_t entry,
  28950     uint32 *data,
  28951     uint32 *mask)
  28952 {
  28953     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28954 #if defined(BCM_TRIDENT2_SUPPORT)
  28955     /* Read qualifier match value and mask. */
  28956     if (SOC_IS_TD2_TT2(unit)) {
  28957         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  28958                     bcmFieldQualifyFibreChanSrcId, data, mask);
  28959     }
  28960 #endif
  28961     return(rv);
  28962 }
  28963 
  28964 /*
  28965  * Function:
  28966  *      bcm_esw_field_qualify_FibreChanDstId
  28967  * Purpose:
  28968  *      Set match criteria for bcmFieildQualifyFibreChanDstId
  28969  *      qualifier from the field entry.
  28970  * Parameters:
  28971  *      unit    - (IN) Unit number.
  28972  *      entry   - (IN) BCM field entry id.
  28973  *      data    - (IN) Qualifier match data.
  28974  *      mask    - (IN) Qualifier match mask.
  28975  * Returns:
  28976  *      BCM_E_XXX
  28977  * Notes:
  28978  */
  28979 int
  28980 bcm_esw_field_qualify_FibreChanDstId(
  28981     int unit,
  28982     bcm_field_entry_t entry,
  28983     uint32 data,
  28984     uint32 mask)
  28985 {
  28986     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  28987 #if defined(BCM_TRIDENT2_SUPPORT)
  28988 
  28989     if (SOC_IS_TD2_TT2(unit)) {
  28990         
  28991         FP_LOCK(unit);
  28992         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanDstId,
  28993                               data, mask);
  28994         FP_UNLOCK(unit);
  28995     }
  28996 #endif
  28997 
  28998     return(rv);
  28999 }
  29000 
  29001 /*
  29002  * Function:
  29003  *      bcm_esw_field_qualify_FibreChanDstId_get
  29004  * Purpose:
  29005  *      Get match criteria for bcmFieildQualifyFibreChanDstId
  29006  *      qualifier from the field entry.
  29007  * Parameters:
  29008  *      unit    - (IN) Unit number.
  29009  *      entry   - (IN) BCM field entry id.
  29010  *      data    - (OUT) Qualifier match data.
  29011  *      mask    - (OUT) Qualifier match mask.
  29012  * Returns:
  29013  *      BCM_E_XXX
  29014  * Notes:
  29015  */
  29016 int
  29017 bcm_esw_field_qualify_FibreChanDstId_get(
  29018     int unit,
  29019     bcm_field_entry_t entry,
  29020     uint32 *data,
  29021     uint32 *mask)
  29022 {
  29023     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29024 #if defined(BCM_TRIDENT2_SUPPORT)
  29025     /* Read qualifier match value and mask. */
  29026     if (SOC_IS_TD2_TT2(unit)) {
  29027         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  29028                     bcmFieldQualifyFibreChanDstId, data, mask);
  29029     }
  29030 #endif
  29031     return(rv);
  29032 }
  29033 
  29034 /*
  29035  * Function:
  29036  *      bcm_esw_field_qualify_FibreChanZoneCheck
  29037  * Purpose:
  29038  *      Set match criteria for bcmFieildQualifyFibreChanZoneCheck
  29039  *      qualifier from the field entry.
  29040  * Parameters:
  29041  *      unit    - (IN) Unit number.
  29042  *      entry   - (IN) BCM field entry id.
  29043  *      data    - (IN) Qualifier match data.
  29044  *      mask    - (IN) Qualifier match mask.
  29045  * Returns:
  29046  *      BCM_E_XXX
  29047  * Notes:
  29048  */
  29049 int
  29050 bcm_esw_field_qualify_FibreChanZoneCheck(
  29051     int unit,
  29052     bcm_field_entry_t entry,
  29053     uint8 data,
  29054     uint8 mask)
  29055 {
  29056     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29057 #if defined(BCM_TRIDENT2_SUPPORT)
  29058 
  29059     if (SOC_IS_TD2_TT2(unit)) {
  29060         
  29061         FP_LOCK(unit);
  29062         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanZoneCheck,
  29063                               data, mask);
  29064         FP_UNLOCK(unit);
  29065     }
  29066 #endif
  29067 
  29068     return(rv);
  29069 }
  29070 
  29071 /*
  29072  * Function:
  29073  *      bcm_esw_field_qualify_FibreChanZoneCheck_get
  29074  * Purpose:
  29075  *      Get match criteria for bcmFieildQualifyFibreChanZoneCheck
  29076  *      qualifier from the field entry.
  29077  * Parameters:
  29078  *      unit    - (IN) Unit number.
  29079  *      entry   - (IN) BCM field entry id.
  29080  *      data    - (OUT) Qualifier match data.
  29081  *      mask    - (OUT) Qualifier match mask.
  29082  * Returns:
  29083  *      BCM_E_XXX
  29084  * Notes:
  29085  */
  29086 int
  29087 bcm_esw_field_qualify_FibreChanZoneCheck_get(
  29088     int unit,
  29089     bcm_field_entry_t entry,
  29090     uint8 *data,
  29091     uint8 *mask)
  29092 {
  29093     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29094 #if defined(BCM_TRIDENT2_SUPPORT)
  29095     /* Read qualifier match value and mask. */
  29096     if (SOC_IS_TD2_TT2(unit)) {
  29097         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29098                     bcmFieldQualifyFibreChanZoneCheck, data, mask);
  29099     }
  29100 #endif
  29101     return(rv);
  29102 }
  29103 
  29104 /*
  29105  * Function:
  29106  *      bcm_esw_field_qualify_FibreChanSrcFpmaCheck
  29107  * Purpose:
  29108  *      Set match criteria for bcmFieildQualifyFibreChanSrcFpmaCheck
  29109  *      qualifier from the field entry.
  29110  * Parameters:
  29111  *      unit    - (IN) Unit number.
  29112  *      entry   - (IN) BCM field entry id.
  29113  *      data    - (IN) Qualifier match data.
  29114  *      mask    - (IN) Qualifier match mask.
  29115  * Returns:
  29116  *      BCM_E_XXX
  29117  * Notes:
  29118  */
  29119 int
  29120 bcm_esw_field_qualify_FibreChanSrcFpmaCheck(
  29121     int unit,
  29122     bcm_field_entry_t entry,
  29123     uint8 data,
  29124     uint8 mask)
  29125 {
  29126     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29127 #if defined(BCM_TRIDENT2_SUPPORT)
  29128 
  29129     if (SOC_IS_TD2_TT2(unit)) {
  29130         
  29131         FP_LOCK(unit);
  29132         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanSrcFpmaCheck,
  29133                               data, mask);
  29134         FP_UNLOCK(unit);
  29135     }
  29136 #endif
  29137 
  29138     return(rv);
  29139 }
  29140 
  29141 /*
  29142  * Function:
  29143  *      bcm_esw_field_qualify_FibreChanSrcFpmaCheck_get
  29144  * Purpose:
  29145  *      Get match criteria for bcmFieildQualifyFibreChanSrcFpmaCheck
  29146  *      qualifier from the field entry.
  29147  * Parameters:
  29148  *      unit    - (IN) Unit number.
  29149  *      entry   - (IN) BCM field entry id.
  29150  *      data    - (OUT) Qualifier match data.
  29151  *      mask    - (OUT) Qualifier match mask.
  29152  * Returns:
  29153  *      BCM_E_XXX
  29154  * Notes:
  29155  */
  29156 int
  29157 bcm_esw_field_qualify_FibreChanSrcFpmaCheck_get(
  29158     int unit,
  29159     bcm_field_entry_t entry,
  29160     uint8 *data,
  29161     uint8 *mask)
  29162 {
  29163     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29164 #if defined(BCM_TRIDENT2_SUPPORT)
  29165     /* Read qualifier match value and mask. */
  29166     if (SOC_IS_TD2_TT2(unit)) {
  29167         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29168                     bcmFieldQualifyFibreChanSrcFpmaCheck, data, mask);
  29169     }
  29170 #endif
  29171     return(rv);
  29172 }
  29173 
  29174 /*
  29175  * Function:
  29176  *      bcm_esw_field_qualify_FibreChanSrcBindCheck
  29177  * Purpose:
  29178  *      Set match criteria for bcmFieildQualifyFibreChanSrcBindCheck
  29179  *      qualifier from the field entry.
  29180  * Parameters:
  29181  *      unit    - (IN) Unit number.
  29182  *      entry   - (IN) BCM field entry id.
  29183  *      data    - (IN) Qualifier match data.
  29184  *      mask    - (IN) Qualifier match mask.
  29185  * Returns:
  29186  *      BCM_E_XXX
  29187  * Notes:
  29188  */
  29189 int
  29190 bcm_esw_field_qualify_FibreChanSrcBindCheck(
  29191     int unit,
  29192     bcm_field_entry_t entry,
  29193     uint8 data,
  29194     uint8 mask)
  29195 {
  29196     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29197 #if defined(BCM_TRIDENT2_SUPPORT)
  29198 
  29199     if (SOC_IS_TD2_TT2(unit)) {
  29200         
  29201         FP_LOCK(unit);
  29202         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanSrcBindCheck,
  29203                               data, mask);
  29204         FP_UNLOCK(unit);
  29205     }
  29206 #endif
  29207 
  29208     return(rv);
  29209 }
  29210 
  29211 /*
  29212  * Function:
  29213  *      bcm_esw_field_qualify_FibreChanSrcBindCheck_get
  29214  * Purpose:
  29215  *      Get match criteria for bcmFieildQualifyFibreChanSrcBindCheck
  29216  *      qualifier from the field entry.
  29217  * Parameters:
  29218  *      unit    - (IN) Unit number.
  29219  *      entry   - (IN) BCM field entry id.
  29220  *      data    - (OUT) Qualifier match data.
  29221  *      mask    - (OUT) Qualifier match mask.
  29222  * Returns:
  29223  *      BCM_E_XXX
  29224  * Notes:
  29225  */
  29226 int
  29227 bcm_esw_field_qualify_FibreChanSrcBindCheck_get(
  29228     int unit,
  29229     bcm_field_entry_t entry,
  29230     uint8 *data,
  29231     uint8 *mask)
  29232 {
  29233     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29234 #if defined(BCM_TRIDENT2_SUPPORT)
  29235     /* Read qualifier match value and mask. */
  29236     if (SOC_IS_TD2_TT2(unit)) {
  29237         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29238                     bcmFieldQualifyFibreChanSrcBindCheck, data, mask);
  29239     }
  29240 #endif
  29241     return(rv);
  29242 }
  29243 
  29244 /*
  29245  * Function:
  29246  *      bcm_esw_field_qualify_FibreChanVFTVersion
  29247  * Purpose:
  29248  *      Set match criteria for bcmFieildQualifyFibreChanVFTVersion
  29249  *      qualifier from the field entry.
  29250  * Parameters:
  29251  *      unit    - (IN) Unit number.
  29252  *      entry   - (IN) BCM field entry id.
  29253  *      data    - (IN) Qualifier match data.
  29254  *      mask    - (IN) Qualifier match mask.
  29255  * Returns:
  29256  *      BCM_E_XXX
  29257  * Notes:
  29258  */
  29259 int
  29260 bcm_esw_field_qualify_FibreChanVFTVersion(
  29261     int unit,
  29262     bcm_field_entry_t entry,
  29263     uint8 data,
  29264     uint8 mask)
  29265 {
  29266     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29267 #if defined(BCM_TRIDENT2_SUPPORT)
  29268 
  29269     if (SOC_IS_TD2_TT2(unit)) {
  29270         
  29271         FP_LOCK(unit);
  29272         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanVFTVersion,
  29273                               data, mask);
  29274         FP_UNLOCK(unit);
  29275     }
  29276 #endif
  29277 
  29278     return(rv);
  29279 }
  29280 
  29281 /*
  29282  * Function:
  29283  *      bcm_esw_field_qualify_FibreChanVFTVersion_get
  29284  * Purpose:
  29285  *      Get match criteria for bcmFieildQualifyFibreChanVFTVersion
  29286  *      qualifier from the field entry.
  29287  * Parameters:
  29288  *      unit    - (IN) Unit number.
  29289  *      entry   - (IN) BCM field entry id.
  29290  *      data    - (OUT) Qualifier match data.
  29291  *      mask    - (OUT) Qualifier match mask.
  29292  * Returns:
  29293  *      BCM_E_XXX
  29294  * Notes:
  29295  */
  29296 int
  29297 bcm_esw_field_qualify_FibreChanVFTVersion_get(
  29298     int unit,
  29299     bcm_field_entry_t entry,
  29300     uint8 *data,
  29301     uint8 *mask)
  29302 {
  29303     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29304 #if defined(BCM_TRIDENT2_SUPPORT)
  29305     /* Read qualifier match value and mask. */
  29306     if (SOC_IS_TD2_TT2(unit)) {
  29307         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29308                     bcmFieldQualifyFibreChanVFTVersion, data, mask);
  29309     }
  29310 #endif
  29311     return(rv);
  29312 }
  29313 
  29314 /*
  29315  * Function:
  29316  *      bcm_esw_field_qualify_FibreChanVFTPri
  29317  * Purpose:
  29318  *      Set match criteria for bcmFieildQualifyFibreChanVFTPri
  29319  *      qualifier from the field entry.
  29320  * Parameters:
  29321  *      unit    - (IN) Unit number.
  29322  *      entry   - (IN) BCM field entry id.
  29323  *      data    - (IN) Qualifier match data.
  29324  *      mask    - (IN) Qualifier match mask.
  29325  * Returns:
  29326  *      BCM_E_XXX
  29327  * Notes:
  29328  */
  29329 int
  29330 bcm_esw_field_qualify_FibreChanVFTPri(
  29331     int unit,
  29332     bcm_field_entry_t entry,
  29333     uint8 data,
  29334     uint8 mask)
  29335 {
  29336     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29337 #if defined(BCM_TRIDENT2_SUPPORT)
  29338 
  29339     if (SOC_IS_TD2_TT2(unit)) {
  29340         
  29341         FP_LOCK(unit);
  29342         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanVFTPri,
  29343                               data, mask);
  29344         FP_UNLOCK(unit);
  29345     }
  29346 #endif
  29347 
  29348     return(rv);
  29349 }
  29350 
  29351 /*
  29352  * Function:
  29353  *      bcm_esw_field_qualify_FibreChanVFTPri_get
  29354  * Purpose:
  29355  *      Get match criteria for bcmFieildQualifyFibreChanVFTPri
  29356  *      qualifier from the field entry.
  29357  * Parameters:
  29358  *      unit    - (IN) Unit number.
  29359  *      entry   - (IN) BCM field entry id.
  29360  *      data    - (OUT) Qualifier match data.
  29361  *      mask    - (OUT) Qualifier match mask.
  29362  * Returns:
  29363  *      BCM_E_XXX
  29364  * Notes:
  29365  */
  29366 int
  29367 bcm_esw_field_qualify_FibreChanVFTPri_get(
  29368     int unit,
  29369     bcm_field_entry_t entry,
  29370     uint8 *data,
  29371     uint8 *mask)
  29372 {
  29373     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29374 #if defined(BCM_TRIDENT2_SUPPORT)
  29375     /* Read qualifier match value and mask. */
  29376     if (SOC_IS_TD2_TT2(unit)) {
  29377         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29378                     bcmFieldQualifyFibreChanVFTPri, data, mask);
  29379     }
  29380 #endif
  29381     return(rv);
  29382 }
  29383 
  29384 /*
  29385  * Function:
  29386  *      bcm_esw_field_qualify_FibreChanVFTFabricId
  29387  * Purpose:
  29388  *      Set match criteria for bcmFieildQualifyFibreChanVFTFabricId
  29389  *      qualifier from the field entry.
  29390  * Parameters:
  29391  *      unit    - (IN) Unit number.
  29392  *      entry   - (IN) BCM field entry id.
  29393  *      data    - (IN) Qualifier match data.
  29394  *      mask    - (IN) Qualifier match mask.
  29395  * Returns:
  29396  *      BCM_E_XXX
  29397  * Notes:
  29398  */
  29399 int
  29400 bcm_esw_field_qualify_FibreChanVFTFabricId(
  29401     int unit,
  29402     bcm_field_entry_t entry,
  29403     uint16 data,
  29404     uint16 mask)
  29405 {
  29406     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29407 #if defined(BCM_TRIDENT2_SUPPORT)
  29408     if (soc_feature(unit, soc_feature_fcoe)) {
  29409         FP_LOCK(unit);
  29410         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanVFTFabricId,
  29411                               data, mask);
  29412         FP_UNLOCK(unit);
  29413     }
  29414 #endif
  29415 
  29416     return(rv);
  29417 }
  29418 
  29419 /*
  29420  * Function:
  29421  *      bcm_esw_field_qualify_FibreChanVFTFabricId_get
  29422  * Purpose:
  29423  *      Get match criteria for bcmFieildQualifyFibreChanVFTFabricId
  29424  *      qualifier from the field entry.
  29425  * Parameters:
  29426  *      unit    - (IN) Unit number.
  29427  *      entry   - (IN) BCM field entry id.
  29428  *      data    - (OUT) Qualifier match data.
  29429  *      mask    - (OUT) Qualifier match mask.
  29430  * Returns:
  29431  *      BCM_E_XXX
  29432  * Notes:
  29433  */
  29434 int
  29435 bcm_esw_field_qualify_FibreChanVFTFabricId_get(
  29436     int unit,
  29437     bcm_field_entry_t entry,
  29438     uint16 *data,
  29439     uint16 *mask)
  29440 {
  29441     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29442 #if defined(BCM_TRIDENT2_SUPPORT)
  29443     /* Read qualifier match value and mask. */
  29444     if (soc_feature(unit, soc_feature_fcoe)) {
  29445         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  29446                     bcmFieldQualifyFibreChanVFTFabricId, data, mask);
  29447     }
  29448 #endif
  29449     return(rv);
  29450 }
  29451 
  29452 /*
  29453  * Function:
  29454  *      bcm_esw_field_qualify_FibreChanVFTHopCount
  29455  * Purpose:
  29456  *      Set match criteria for bcmFieildQualifyFibreChanVFTHopCount
  29457  *      qualifier from the field entry.
  29458  * Parameters:
  29459  *      unit    - (IN) Unit number.
  29460  *      entry   - (IN) BCM field entry id.
  29461  *      data    - (IN) Qualifier match data.
  29462  *      mask    - (IN) Qualifier match mask.
  29463  * Returns:
  29464  *      BCM_E_XXX
  29465  * Notes:
  29466  */
  29467 int
  29468 bcm_esw_field_qualify_FibreChanVFTHopCount(
  29469     int unit,
  29470     bcm_field_entry_t entry,
  29471     uint8 data,
  29472     uint8 mask)
  29473 {
  29474     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29475 #if defined(BCM_TRIDENT2_SUPPORT)
  29476     if (soc_feature(unit, soc_feature_fcoe)) {
  29477         FP_LOCK(unit);
  29478         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanVFTHopCount,
  29479                               data, mask);
  29480         FP_UNLOCK(unit);
  29481     }
  29482 #endif
  29483 
  29484     return(rv);
  29485 }
  29486 
  29487 /*
  29488  * Function:
  29489  *      bcm_esw_field_qualify_FibreChanVFTHopCount_get
  29490  * Purpose:
  29491  *      Get match criteria for bcmFieildQualifyFibreChanVFTHopCount
  29492  *      qualifier from the field entry.
  29493  * Parameters:
  29494  *      unit    - (IN) Unit number.
  29495  *      entry   - (IN) BCM field entry id.
  29496  *      data    - (OUT) Qualifier match data.
  29497  *      mask    - (OUT) Qualifier match mask.
  29498  * Returns:
  29499  *      BCM_E_XXX
  29500  * Notes:
  29501  */
  29502 int
  29503 bcm_esw_field_qualify_FibreChanVFTHopCount_get(
  29504     int unit,
  29505     bcm_field_entry_t entry,
  29506     uint8 *data,
  29507     uint8 *mask)
  29508 {
  29509     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29510 #if defined(BCM_TRIDENT2_SUPPORT)
  29511     /* Read qualifier match value and mask. */
  29512     if (soc_feature(unit, soc_feature_fcoe)) {
  29513         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29514                     bcmFieldQualifyFibreChanVFTHopCount, data, mask);
  29515     }
  29516 #endif
  29517     return(rv);
  29518 }
  29519 
  29520 /*
  29521  * Function:
  29522  *      bcm_esw_field_qualify_FibreChanVFTVsanId
  29523  * Purpose:
  29524  *      Set match criteria for bcmFieildQualifyFibreChanVFTVsanId
  29525  *      qualifier from the field entry.
  29526  * Parameters:
  29527  *      unit    - (IN) Unit number.
  29528  *      entry   - (IN) BCM field entry id.
  29529  *      data    - (IN) Qualifier match data.
  29530  *      mask    - (IN) Qualifier match mask.
  29531  * Returns:
  29532  *      BCM_E_XXX
  29533  * Notes:
  29534  */
  29535 int
  29536 bcm_esw_field_qualify_FibreChanVFTVsanId(
  29537     int unit,
  29538     bcm_field_entry_t entry,
  29539     uint16 data,
  29540     uint16 mask)
  29541 {
  29542     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29543 #if defined(BCM_TRIDENT2_SUPPORT)
  29544     if (soc_feature(unit, soc_feature_fcoe)) {
  29545         FP_LOCK(unit);
  29546         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanVFTVsanId,
  29547                               data, mask);
  29548         FP_UNLOCK(unit);
  29549     }
  29550 #endif
  29551 
  29552     return(rv);
  29553 }
  29554 
  29555 /*
  29556  * Function:
  29557  *      bcm_esw_field_qualify_FibreChanVFTVsanId_get
  29558  * Purpose:
  29559  *      Get match criteria for bcmFieildQualifyFibreChanVFTVsanId
  29560  *      qualifier from the field entry.
  29561  * Parameters:
  29562  *      unit    - (IN) Unit number.
  29563  *      entry   - (IN) BCM field entry id.
  29564  *      data    - (OUT) Qualifier match data.
  29565  *      mask    - (OUT) Qualifier match mask.
  29566  * Returns:
  29567  *      BCM_E_XXX
  29568  * Notes:
  29569  */
  29570 int
  29571 bcm_esw_field_qualify_FibreChanVFTVsanId_get(
  29572     int unit,
  29573     bcm_field_entry_t entry,
  29574     uint16 *data,
  29575     uint16 *mask)
  29576 {
  29577     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29578 #if defined(BCM_TRIDENT2_SUPPORT)
  29579     /* Read qualifier match value and mask. */
  29580     if (soc_feature(unit, soc_feature_fcoe)) {
  29581         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  29582                     bcmFieldQualifyFibreChanVFTVsanId, data, mask);
  29583     }
  29584 #endif
  29585     return(rv);
  29586 }
  29587 
  29588 /*
  29589  * Function:
  29590  *      bcm_esw_field_qualify_FibreChanVFTVsanPri
  29591  * Purpose:
  29592  *      Set match criteria for bcmFieildQualifyFibreChanVFTVsanPri
  29593  *      qualifier from the field entry.
  29594  * Parameters:
  29595  *      unit    - (IN) Unit number.
  29596  *      entry   - (IN) BCM field entry id.
  29597  *      data    - (IN) Qualifier match data.
  29598  *      mask    - (IN) Qualifier match mask.
  29599  * Returns:
  29600  *      BCM_E_XXX
  29601  * Notes:
  29602  */
  29603 int
  29604 bcm_esw_field_qualify_FibreChanVFTVsanPri(
  29605     int unit,
  29606     bcm_field_entry_t entry,
  29607     uint8 data,
  29608     uint8 mask)
  29609 {
  29610     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29611 #if defined(BCM_TRIDENT2_SUPPORT)
  29612     if (soc_feature(unit, soc_feature_fcoe)) {
  29613         FP_LOCK(unit);
  29614         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanVFTVsanPri,
  29615                               data, mask);
  29616         FP_UNLOCK(unit);
  29617     }
  29618 #endif
  29619 
  29620     return(rv);
  29621 }
  29622 
  29623 /*
  29624  * Function:
  29625  *      bcm_esw_field_qualify_FibreChanVFTVsanPri_get
  29626  * Purpose:
  29627  *      Get match criteria for bcmFieildQualifyFibreChanVFTVsanPri
  29628  *      qualifier from the field entry.
  29629  * Parameters:
  29630  *      unit    - (IN) Unit number.
  29631  *      entry   - (IN) BCM field entry id.
  29632  *      data    - (OUT) Qualifier match data.
  29633  *      mask    - (OUT) Qualifier match mask.
  29634  * Returns:
  29635  *      BCM_E_XXX
  29636  * Notes:
  29637  */
  29638 int
  29639 bcm_esw_field_qualify_FibreChanVFTVsanPri_get(
  29640     int unit,
  29641     bcm_field_entry_t entry,
  29642     uint8 *data,
  29643     uint8 *mask)
  29644 {
  29645     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29646 #if defined(BCM_TRIDENT2_SUPPORT)
  29647     /* Read qualifier match value and mask. */
  29648     if (soc_feature(unit, soc_feature_fcoe)) {
  29649         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29650                     bcmFieldQualifyFibreChanVFTVsanPri, data, mask);
  29651     }
  29652 #endif
  29653     return(rv);
  29654 }
  29655 
  29656 /*
  29657  * Function:
  29658  *      bcm_esw_field_qualify_FibreChanVFTValid
  29659  * Purpose:
  29660  *      Set match criteria for bcmFieildQualifyFibreChanVFTValid
  29661  *      qualifier from the field entry.
  29662  * Parameters:
  29663  *      unit    - (IN) Unit number.
  29664  *      entry   - (IN) BCM field entry id.
  29665  *      data    - (IN) Qualifier match data.
  29666  *      mask    - (IN) Qualifier match mask.
  29667  * Returns:
  29668  *      BCM_E_XXX
  29669  * Notes:
  29670  */
  29671 int
  29672 bcm_esw_field_qualify_FibreChanVFTValid(
  29673     int unit,
  29674     bcm_field_entry_t entry,
  29675     uint8 data,
  29676     uint8 mask)
  29677 {
  29678     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29679 #if defined(BCM_TRIDENT2_SUPPORT)
  29680     if (soc_feature(unit, soc_feature_fcoe)) {
  29681         FP_LOCK(unit);
  29682         rv = _field_qualify32(unit, entry, bcmFieldQualifyFibreChanVFTValid,
  29683                               data, mask);
  29684         FP_UNLOCK(unit);
  29685     }
  29686 #endif
  29687 
  29688     return(rv);
  29689 }
  29690 
  29691 /*
  29692  * Function:
  29693  *      bcm_esw_field_qualify_FibreChanVFTValid_get
  29694  * Purpose:
  29695  *      Get match criteria for bcmFieildQualifyFibreChanVFTValid
  29696  *      qualifier from the field entry.
  29697  * Parameters:
  29698  *      unit    - (IN) Unit number.
  29699  *      entry   - (IN) BCM field entry id.
  29700  *      data    - (OUT) Qualifier match data.
  29701  *      mask    - (OUT) Qualifier match mask.
  29702  * Returns:
  29703  *      BCM_E_XXX
  29704  * Notes:
  29705  */
  29706 int
  29707 bcm_esw_field_qualify_FibreChanVFTValid_get(
  29708     int unit,
  29709     bcm_field_entry_t entry,
  29710     uint8 *data,
  29711     uint8 *mask)
  29712 {
  29713     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29714 #if defined(BCM_TRIDENT2_SUPPORT)
  29715     /* Read qualifier match value and mask. */
  29716     if (soc_feature(unit, soc_feature_fcoe)) {
  29717         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29718                     bcmFieldQualifyFibreChanVFTValid, data, mask);
  29719     }
  29720 #endif
  29721     return(rv);
  29722 }
  29723 
  29724 /*
  29725  * Function:
  29726  *      bcm_esw_field_qualify_FcoeSOF
  29727  * Purpose:
  29728  *      Set match criteria for bcmFieildQualifyFcoeSOF
  29729  *      qualifier from the field entry.
  29730  * Parameters:
  29731  *      unit    - (IN) Unit number.
  29732  *      entry   - (IN) BCM field entry id.
  29733  *      data    - (IN) Qualifier match data.
  29734  *      mask    - (IN) Qualifier match mask.
  29735  * Returns:
  29736  *      BCM_E_XXX
  29737  * Notes:
  29738  */
  29739 int
  29740 bcm_esw_field_qualify_FcoeSOF(
  29741     int unit,
  29742     bcm_field_entry_t entry,
  29743     uint8 data,
  29744     uint8 mask)
  29745 {
  29746     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29747 #if defined(BCM_TRIDENT2_SUPPORT)
  29748     if (soc_feature(unit, soc_feature_fcoe)) {
  29749         FP_LOCK(unit);
  29750         rv = _field_qualify32(unit, entry, bcmFieldQualifyFcoeSOF,
  29751                               data, mask);
  29752         FP_UNLOCK(unit);
  29753     }
  29754 #endif
  29755     return(rv);
  29756 }
  29757 
  29758 /*
  29759  * Function:
  29760  *      bcm_esw_field_qualify_FcoeSOF_get
  29761  * Purpose:
  29762  *      Get match criteria for bcmFieildQualifyFcoeSOF
  29763  *      qualifier from the field entry.
  29764  * Parameters:
  29765  *      unit    - (IN) Unit number.
  29766  *      entry   - (IN) BCM field entry id.
  29767  *      data    - (OUT) Qualifier match data.
  29768  *      mask    - (OUT) Qualifier match mask.
  29769  * Returns:
  29770  *      BCM_E_XXX
  29771  * Notes:
  29772  */
  29773 int
  29774 bcm_esw_field_qualify_FcoeSOF_get(
  29775     int unit,
  29776     bcm_field_entry_t entry,
  29777     uint8 *data,
  29778     uint8 *mask)
  29779 {
  29780     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29781     
  29782     /* Read qualifier match value and mask. */
  29783 #if defined(BCM_TRIDENT2_SUPPORT)
  29784     if (soc_feature(unit, soc_feature_fcoe)) {
  29785         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29786                     bcmFieldQualifyFcoeSOF, data, mask);
  29787     }
  29788 #endif
  29789     return(rv);
  29790 }
  29791 
  29792 /*
  29793  * Function:
  29794  *      bcm_esw_field_qualify_FcoeVersionIsZero
  29795  * Purpose:
  29796  *      Set match criteria for bcmFieildQualifyFcoeVersionIsZero
  29797  *      qualifier from the field entry.
  29798  * Parameters:
  29799  *      unit    - (IN) Unit number.
  29800  *      entry   - (IN) BCM field entry id.
  29801  *      data    - (IN) Qualifier match data.
  29802  *      mask    - (IN) Qualifier match mask.
  29803  * Returns:
  29804  *      BCM_E_XXX
  29805  * Notes:
  29806  */
  29807 int
  29808 bcm_esw_field_qualify_FcoeVersionIsZero(
  29809     int unit,
  29810     bcm_field_entry_t entry,
  29811     uint8 data,
  29812     uint8 mask)
  29813 {
  29814     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29815 #if defined(BCM_TRIDENT2_SUPPORT)
  29816     if (soc_feature(unit, soc_feature_fcoe)) {
  29817         FP_LOCK(unit);
  29818         rv = _field_qualify32(unit, entry, bcmFieldQualifyFcoeVersionIsZero,
  29819                               data, mask);
  29820         FP_UNLOCK(unit);
  29821     }
  29822 #endif
  29823     return(rv);
  29824 }
  29825 
  29826 /*
  29827  * Function:
  29828  *      bcm_esw_field_qualify_FcoeVersionIsZero_get
  29829  * Purpose:
  29830  *      Get match criteria for bcmFieildQualifyFcoeVersionIsZero
  29831  *      qualifier from the field entry.
  29832  * Parameters:
  29833  *      unit    - (IN) Unit number.
  29834  *      entry   - (IN) BCM field entry id.
  29835  *      data    - (OUT) Qualifier match data.
  29836  *      mask    - (OUT) Qualifier match mask.
  29837  * Returns:
  29838  *      BCM_E_XXX
  29839  * Notes:
  29840  */
  29841 int
  29842 bcm_esw_field_qualify_FcoeVersionIsZero_get(
  29843     int unit,
  29844     bcm_field_entry_t entry,
  29845     uint8 *data,
  29846     uint8 *mask)
  29847 {
  29848     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  29849     
  29850     /* Read qualifier match value and mask. */
  29851 #if defined(BCM_TRIDENT2_SUPPORT)
  29852     if (soc_feature(unit, soc_feature_fcoe)) {
  29853         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29854                     bcmFieldQualifyFcoeVersionIsZero, data, mask);
  29855     }
  29856 #endif
  29857     return(rv);
  29858 }
  29859 
  29860 /*
  29861  * Function:
  29862  *     bcm_esw_field_entry_operation
  29863  * Purpose:
  29864  *     Perform entry backup, restore and backup copy free operations
  29865  * Parameters:
  29866  *     unit       - (IN) BCM device number.
  29867  *     entry_oper - (IN) Pointer to field entry operation structure
  29868  * Returns:
  29869  *     BCM_E_XXX
  29870  */
  29871 int
  29872 bcm_esw_field_entry_operation(int unit, bcm_field_entry_oper_t *entry_oper)
  29873 {
  29874     /* Input parameter check. */
  29875     if (entry_oper == NULL) {
  29876         return (BCM_E_PARAM);
  29877     }
  29878 
  29879     /* Invalid operation check. */
  29880     if (entry_oper->flags & (~BCM_FIELD_ENTRY_OPER_MASK)) {
  29881         return (BCM_E_PARAM);
  29882     }
  29883 
  29884     if (entry_oper->flags & BCM_FIELD_ENTRY_OPER_BACKUP) {
  29885         BCM_IF_ERROR_RETURN(_bcm_field_entry_backup(unit,
  29886             entry_oper->entry_id));
  29887     }
  29888 
  29889     if (entry_oper->flags & BCM_FIELD_ENTRY_OPER_RESTORE) {
  29890         BCM_IF_ERROR_RETURN(_bcm_field_entry_restore(unit,
  29891             entry_oper->entry_id));
  29892     }
  29893 
  29894     if (entry_oper->flags & BCM_FIELD_ENTRY_OPER_CLEANUP) {
  29895         BCM_IF_ERROR_RETURN(_bcm_field_entry_cleanup(unit,
  29896             entry_oper->entry_id));
  29897     }
  29898 
  29899     return (BCM_E_NONE);
  29900 }
  29901 
  29902 /*
  29903  * Function:
  29904  *      bcm_esw_field_qualify_OamMdl
  29905  * Purpose:
  29906  *      Set match criteria for bcmFieildQualifyOamMdl
  29907  *      qualifier from the field entry.
  29908  * Parameters:
  29909  *      unit    - (IN) Unit number.
  29910  *      entry   - (IN) BCM field entry id.
  29911  *      data    - (IN) Qualifier match data.
  29912  *      mask    - (IN) Qualifier match mask.
  29913  * Returns:
  29914  *      BCM_E_XXX
  29915  * Notes:
  29916  */
  29917 int
  29918 bcm_esw_field_qualify_OamMdl(
  29919     int unit,
  29920     bcm_field_entry_t entry,
  29921     uint8 data,
  29922     uint8 mask)
  29923 {
  29924     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  29925 
  29926     
  29927     FP_LOCK(unit);
  29928     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamMdl,
  29929                           data, mask);
  29930     FP_UNLOCK(unit);
  29931 
  29932     return(rv);
  29933 }
  29934 
  29935 /*
  29936  * Function:
  29937  *      bcm_esw_field_qualify_OamMdl_get
  29938  * Purpose:
  29939  *      Get match criteria for bcmFieildQualifyOamMdl
  29940  *      qualifier from the field entry.
  29941  * Parameters:
  29942  *      unit    - (IN) Unit number.
  29943  *      entry   - (IN) BCM field entry id.
  29944  *      data    - (OUT) Qualifier match data.
  29945  *      mask    - (OUT) Qualifier match mask.
  29946  * Returns:
  29947  *      BCM_E_XXX
  29948  * Notes:
  29949  */
  29950 int
  29951 bcm_esw_field_qualify_OamMdl_get(
  29952     int unit,
  29953     bcm_field_entry_t entry,
  29954     uint8 *data,
  29955     uint8 *mask)
  29956 {
  29957     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  29958 
  29959     /* Read qualifier match value and mask. */
  29960     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  29961                 bcmFieldQualifyOamMdl, data, mask);
  29962 
  29963     return(rv);
  29964 }
  29965 
  29966 /*
  29967  * Function:
  29968  *      bcm_esw_field_qualify_OamType
  29969  * Purpose:
  29970  *      Set match criteria for bcmFieildQualifyOamType
  29971  *      qualifier from the field entry.
  29972  * Parameters:
  29973  *      unit    - (IN) Unit number.
  29974  *      entry   - (IN) BCM field entry id.
  29975  *      data    - (IN) Qualifier match data.
  29976  *      mask    - (IN) Qualifier match mask.
  29977  * Returns:
  29978  *      BCM_E_XXX
  29979  * Notes:
  29980  */
  29981 int
  29982 bcm_esw_field_qualify_OamType(
  29983     int unit,
  29984     bcm_field_entry_t entry,
  29985     bcm_field_oam_type_t oam_type)
  29986 {
  29987     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  29988     uint32 mask = 0;
  29989 
  29990     
  29991     FP_LOCK(unit);
  29992 
  29993     /* Include all bits for mask value */
  29994     mask = BCM_FIELD_EXACT_MATCH_MASK;
  29995 
  29996     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamType,
  29997            oam_type, mask);
  29998     FP_UNLOCK(unit);
  29999 
  30000     return(rv);
  30001 }
  30002 
  30003 /*
  30004  * Function:
  30005  *      bcm_esw_field_qualify_OamType_get
  30006  * Purpose:
  30007  *      Get match criteria for bcmFieildQualifyOamType
  30008  *      qualifier from the field entry.
  30009  * Parameters:
  30010  *      unit    - (IN) Unit number.
  30011  *      entry   - (IN) BCM field entry id.
  30012  *      data    - (OUT) Qualifier match data.
  30013  *      mask    - (OUT) Qualifier match mask.
  30014  * Returns:
  30015  *      BCM_E_XXX
  30016  * Notes:
  30017  */
  30018 int
  30019 bcm_esw_field_qualify_OamType_get(
  30020     int unit,
  30021     bcm_field_entry_t entry,
  30022     bcm_field_oam_type_t *oam_type)
  30023 {
  30024     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  30025     uint8 mask = 0;
  30026     uint8 data = 0;
  30027 
  30028     if (oam_type == NULL) {
  30029         return BCM_E_PARAM;
  30030     }
  30031 
  30032     /* Read qualifier match value and mask. */
  30033     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  30034             bcmFieldQualifyOamType, &data, &mask);
  30035 
  30036     if (mask == 0) {
  30037         return BCM_E_NOT_FOUND;
  30038     }
  30039 
  30040     *oam_type = data;
  30041 
  30042     return(rv);
  30043 }
  30044 
  30045 
  30046 
  30047 /*
  30048  * Function:
  30049  *     bcm_esw_field_qualify_OamHeaderBits0_31
  30050  * Purpose:
  30051  *      Set match criteria for bcmFieldQualifyOamHeaderBits0_31
  30052  *      qualifier from the field entry.
  30053  * Parameters:
  30054  *      unit    - (IN) Unit number.
  30055  *      entry   - (IN) BCM field entry id.
  30056  *      data    - (IN) Qualifies on First 4 Bytes of OAM Header
  30057                        in Egress Pipeline.
  30058  *      mask    - (IN) Qualifier match mask.
  30059  * Returns:
  30060  *      BCM_E_XXX
  30061  * Notes:
  30062  */
  30063 int
  30064 bcm_esw_field_qualify_OamHeaderBits0_31(
  30065     int unit, bcm_field_entry_t entry,
  30066     uint32 data, uint32 mask)
  30067 {
  30068     int rv;                 /* Operation return status. */
  30069 
  30070     /* Input range check */
  30071     rv = _field_qualifier32_input_range_check(unit,
  30072             bcmFieldQualifyOamHeaderBits0_31, entry,
  30073             (uint8 *)&data, sizeof (data));
  30074 
  30075     if (BCM_FAILURE(rv)) {
  30076         LOG_ERROR(BSL_LS_BCM_FP,
  30077                 (BSL_META_U(unit,
  30078                             "FP(unit %d) Error: data=%#x "
  30079                             "out-of-range\n"), unit, data));
  30080         return rv;
  30081     }
  30082 
  30083     
  30084     FP_LOCK(unit);
  30085 
  30086     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamHeaderBits0_31,
  30087             data, mask);
  30088 
  30089     FP_UNLOCK(unit);
  30090     return (rv);
  30091 }
  30092 
  30093 
  30094 /*
  30095  * Function:
  30096  *     bcm_esw_field_qualify_OamHeaderBits0_31_get
  30097  * Purpose:
  30098  *      Get match criteria for bcmFieldQualifyOamHeaderBits0_31
  30099  *      qualifier from the field entry.
  30100  * Parameters:
  30101  *      unit    - (IN)  Unit number.
  30102  *      entry   - (IN)  BCM field entry id.
  30103  *      data    - (OUT) First 4 Bytes of OAM Header
  30104                         in Egress Pipeline.
  30105  *      mask    - (OUT) Qualifier match mask.
  30106  * Returns:
  30107  *      BCM_E_XXX
  30108  * Notes:
  30109  */
  30110 int
  30111 bcm_esw_field_qualify_OamHeaderBits0_31_get(
  30112     int unit, bcm_field_entry_t entry, uint32 *data,
  30113     uint32 *mask)
  30114 {
  30115     if ((data == NULL) || (mask == NULL)) {
  30116         return BCM_E_PARAM;
  30117     }
  30118 
  30119     /* Read qualifier match value and mask. */
  30120     BCM_IF_ERROR_RETURN(
  30121             _bcm_field_entry_qualifier_uint32_get(unit, entry,
  30122                 bcmFieldQualifyOamHeaderBits0_31,
  30123                 data, mask));
  30124 
  30125     return BCM_E_NONE;
  30126 }
  30127 
  30128 
  30129 /*
  30130  * Function:
  30131  *     bcm_esw_field_qualify_OamHeaderBits32_63
  30132  * Purpose:
  30133  *      Set match criteria for bcmFieldQualifyOamHeaderBits32_63
  30134  *      qualifier from the field entry.
  30135  * Parameters:
  30136  *      unit    - (IN) Unit number.
  30137  *      entry   - (IN) BCM field entry id.
  30138  *      data    - (IN) Qualifies on Second 4 Bytes of OAM Header
  30139                        in Egress Pipeline.
  30140  *      mask    - (IN) Qualifier match mask.
  30141  * Returns:
  30142  *      BCM_E_XXX
  30143  * Notes:
  30144  */
  30145 int bcm_esw_field_qualify_OamHeaderBits32_63(
  30146     int unit,
  30147     bcm_field_entry_t entry,
  30148     uint32 data,
  30149     uint32 mask)
  30150 {
  30151     int rv;                 /* Operation return status. */
  30152 
  30153     /* Input range check */
  30154     rv = _field_qualifier32_input_range_check(unit,
  30155             bcmFieldQualifyOamHeaderBits32_63, entry,
  30156             (uint8 *)&data, sizeof (data));
  30157 
  30158     if (BCM_FAILURE(rv)) {
  30159         LOG_ERROR(BSL_LS_BCM_FP,
  30160                 (BSL_META_U(unit,
  30161                             "FP(unit %d) Error: data=%#x "
  30162                             "out-of-range\n"), unit, data));
  30163         return rv;
  30164     }
  30165 
  30166     
  30167     FP_LOCK(unit);
  30168 
  30169     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamHeaderBits32_63,
  30170             data, mask);
  30171 
  30172     FP_UNLOCK(unit);
  30173     return (rv);
  30174 }
  30175 
  30176 /*
  30177  * Function:
  30178  *     bcm_esw_field_qualify_OamHeaderBits32_63_get
  30179  * Purpose:
  30180  *      Get match criteria for bcmFieldQualifyOamHeaderBits32_63
  30181  *      qualifier from the field entry.
  30182  * Parameters:
  30183  *      unit    - (IN)  Unit number.
  30184  *      entry   - (IN)  BCM field entry id.
  30185  *      data    - (OUT) Second 4 Bytes of OAM Header
  30186                         in Egress Pipeline.
  30187  *      mask    - (OUT) Qualifier match mask.
  30188  * Returns:
  30189  *      BCM_E_XXX
  30190  * Notes:
  30191  */
  30192 int bcm_esw_field_qualify_OamHeaderBits32_63_get(
  30193     int unit,
  30194     bcm_field_entry_t entry,
  30195     uint32 *data,
  30196     uint32 *mask)
  30197 {
  30198     if ((data == NULL) || (mask == NULL)) {
  30199         return BCM_E_PARAM;
  30200     }
  30201 
  30202     /* Read qualifier match value and mask. */
  30203     BCM_IF_ERROR_RETURN(
  30204             _bcm_field_entry_qualifier_uint32_get(unit, entry,
  30205                 bcmFieldQualifyOamHeaderBits32_63,
  30206                 data, mask));
  30207 
  30208     return BCM_E_NONE;
  30209 }
  30210 
  30211 /*
  30212  * Function:
  30213  *     bcm_esw_field_qualify_OamEgressClassPort
  30214  * Purpose:
  30215  *      Set match criteria for bcmFieldQualifyOamEgressClassPort
  30216  *      qualifier from the field entry.
  30217  * Parameters:
  30218  *      unit    - (IN) Unit number.
  30219  *      entry   - (IN) BCM field entry id.
  30220  *      data    - (IN) Qualify the OAM ClassId obtained from EGR_PORT table
  30221                        in Egress Pipeline.
  30222  *      mask    - (IN) Qualifier match mask.
  30223  * Returns:
  30224  *      BCM_E_XXX
  30225  * Notes:
  30226  */
  30227 int bcm_esw_field_qualify_OamEgressClassPort(
  30228     int unit,
  30229     bcm_field_entry_t entry,
  30230     uint16 data,
  30231     uint16 mask)
  30232 {
  30233     int rv;                 /* Operation return status. */
  30234 
  30235     /* Input range check */
  30236     rv = _field_qualifier32_input_range_check(unit,
  30237             bcmFieldQualifyOamEgressClassPort, entry,
  30238             (uint8 *)&data, sizeof (data));
  30239 
  30240     if (BCM_FAILURE(rv)) {
  30241         LOG_ERROR(BSL_LS_BCM_FP,
  30242                 (BSL_META_U(unit,
  30243                             "FP(unit %d) Error: data=%#x "
  30244                             "out-of-range\n"), unit, data));
  30245         return rv;
  30246     }
  30247 
  30248 
  30249     
  30250     FP_LOCK(unit);
  30251 
  30252     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamEgressClassPort,
  30253             data, mask);
  30254     FP_UNLOCK(unit);
  30255     return (rv);
  30256 }
  30257 
  30258 /*
  30259  * Function:
  30260  *     bcm_esw_field_qualify_OamEgressClassPort_get
  30261  * Purpose:
  30262  *      Get match criteria for bcmFieldQualifyOamEgressClassPort
  30263  *      qualifier from the field entry.
  30264  * Parameters:
  30265  *      unit    - (IN)  Unit number.
  30266  *      entry   - (IN)  BCM field entry id.
  30267  *      data    - (OUT) OAM ClassId obtained from EGR_PORT table
  30268                         in Egress Pipeline.
  30269  *      mask    - (OUT) Qualifier match mask.
  30270  * Returns:
  30271  *      BCM_E_XXX
  30272  * Notes:
  30273  */
  30274 int bcm_esw_field_qualify_OamEgressClassPort_get(
  30275     int unit,
  30276     bcm_field_entry_t entry,
  30277     uint16 *data,
  30278     uint16 *mask)
  30279 {
  30280     if ((data == NULL) || (mask == NULL)) {
  30281         return BCM_E_PARAM;
  30282     }
  30283 
  30284     /* Read qualifier match value and mask. */
  30285     BCM_IF_ERROR_RETURN(
  30286             _bcm_field_entry_qualifier_uint16_get(unit, entry,
  30287                 bcmFieldQualifyOamEgressClassPort,
  30288                 data, mask));
  30289 
  30290     return (BCM_E_NONE);
  30291 }
  30292 
  30293 /*
  30294  * Function:
  30295  *     bcm_esw_field_qualify_OamEgressClassVxlt
  30296  * Purpose:
  30297  *      Set match criteria for bcmFieldQualifyOamEgressClassVxlt
  30298  *      qualifier from the field entry.
  30299  * Parameters:
  30300  *      unit    - (IN) Unit number.
  30301  *      entry   - (IN) BCM field entry id.
  30302  *      data    - (IN) Qualify the OAM ClassId obtained from Vlan_Xlate table
  30303                        in Egress Pipeline.
  30304  *      mask    - (IN) Qualifier match mask.
  30305  * Returns:
  30306  *      BCM_E_XXX
  30307  * Notes:
  30308  */
  30309 
  30310 int bcm_esw_field_qualify_OamEgressClassVxlt(
  30311     int unit,
  30312     bcm_field_entry_t entry,
  30313     uint16 data,
  30314     uint16 mask)
  30315 {
  30316     int rv;                 /* Operation return status. */
  30317 
  30318     /* Input range check */
  30319     rv = _field_qualifier32_input_range_check(unit,
  30320             bcmFieldQualifyOamEgressClassVxlt, entry,
  30321             (uint8 *)&data, sizeof (data));
  30322 
  30323     if (BCM_FAILURE(rv)) {
  30324         LOG_ERROR(BSL_LS_BCM_FP,
  30325                 (BSL_META_U(unit,
  30326                             "FP(unit %d) Error: data=%#x "
  30327                             "out-of-range\n"), unit, data));
  30328         return rv;
  30329     }
  30330 
  30331     
  30332     FP_LOCK(unit);
  30333 
  30334     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamEgressClassVxlt,
  30335             data, mask);
  30336     FP_UNLOCK(unit);
  30337     return (rv);
  30338 }
  30339 /*
  30340  * Function:
  30341  *     bcm_esw_field_qualify_OamEgressClassVxlt_get
  30342  * Purpose:
  30343  *      Get match criteria for bcmFieldQualifyOamEgressClassVxlt
  30344  *      qualifier from the field entry.
  30345  * Parameters:
  30346  *      unit    - (IN)  Unit number.
  30347  *      entry   - (IN)  BCM field entry id.
  30348  *      data    - (OUT) OAM ClassId obtained from Vlan_Xlate table
  30349                         in Egress Pipeline.
  30350  *      mask    - (OUT) Qualifier match mask.
  30351  * Returns:
  30352  *      BCM_E_XXX
  30353  * Notes:
  30354  */
  30355 
  30356 int bcm_esw_field_qualify_OamEgressClassVxlt_get(
  30357     int unit,
  30358     bcm_field_entry_t entry,
  30359     uint16 *data,
  30360     uint16 *mask)
  30361 {
  30362     if ((data == NULL) || (mask == NULL)) {
  30363         return BCM_E_PARAM;
  30364     }
  30365 
  30366     /* Read qualifier match value and mask. */
  30367     BCM_IF_ERROR_RETURN(
  30368             _bcm_field_entry_qualifier_uint16_get(unit, entry,
  30369                 bcmFieldQualifyOamEgressClassVxlt,
  30370                 data, mask));
  30371 
  30372     return (BCM_E_NONE);
  30373 }
  30374 
  30375 /*
  30376  * Function:
  30377  *    bcm_esw_field_qualify_EthernetOamHeaderBits0_31
  30378  * Purpose:
  30379  *      Set match criteria for bcmFieldQualifyEthernetOamHeaderBits0_31
  30380  *      qualifier from the field entry.
  30381  * Parameters:
  30382  *      unit    - (IN) Unit number.
  30383  *      entry   - (IN) BCM field entry id.
  30384  *      data    - (IN) Qualifies on First 4 Bytes of Ethernet OAM Header.
  30385  *      mask    - (IN) Qualifier match mask.
  30386  * Returns:
  30387  *      BCM_E_XXX
  30388  * Notes:
  30389  */
  30390 int bcm_esw_field_qualify_EthernetOamHeaderBits0_31(
  30391     int unit,
  30392     bcm_field_entry_t entry,
  30393     uint32 data,
  30394     uint32 mask)
  30395 {
  30396     int rv;                 /* Operation return status. */
  30397 
  30398     /* Input range check */
  30399     rv = _field_qualifier32_input_range_check(unit,
  30400             bcmFieldQualifyEthernetOamHeaderBits0_31, entry,
  30401             (uint8 *)&data, sizeof (data));
  30402 
  30403     if (BCM_FAILURE(rv)) {
  30404         LOG_ERROR(BSL_LS_BCM_FP,
  30405                 (BSL_META_U(unit,
  30406                             "FP(unit %d) Error: data=%#x "
  30407                             "out-of-range\n"), unit, data));
  30408         return rv;
  30409     }
  30410 
  30411     
  30412     FP_LOCK(unit);
  30413 
  30414     rv = _field_qualify32(unit, entry,
  30415             bcmFieldQualifyEthernetOamHeaderBits0_31,
  30416             data, mask);
  30417 
  30418     FP_UNLOCK(unit);
  30419     return (rv);
  30420 }
  30421 
  30422 /*
  30423  * Function:
  30424  *     bcm_esw_field_qualify_EthernetOamHeaderBits0_31_get
  30425  * Purpose:
  30426  *      Get match criteria for bcmFieldQualifyEthernetOamHeaderBits0_31
  30427  *      qualifier from the field entry.
  30428  * Parameters:
  30429  *      unit    - (IN)  Unit number.
  30430  *      entry   - (IN)  BCM field entry id.
  30431  *      data    - (OUT) First 4 Bytes of Ethernet OAM Header.
  30432  *      mask    - (OUT) Qualifier match mask.
  30433  * Returns:
  30434  *      BCM_E_XXX
  30435  * Notes:
  30436  */
  30437 int bcm_esw_field_qualify_EthernetOamHeaderBits0_31_get(
  30438     int unit,
  30439     bcm_field_entry_t entry,
  30440     uint32 *data,
  30441     uint32 *mask)
  30442 {
  30443     if ((data == NULL) || (mask == NULL)) {
  30444         return BCM_E_PARAM;
  30445     }
  30446 
  30447     /* Read qualifier match value and mask. */
  30448     BCM_IF_ERROR_RETURN(
  30449             _bcm_field_entry_qualifier_uint32_get(unit, entry,
  30450                 bcmFieldQualifyEthernetOamHeaderBits0_31,
  30451                 data, mask));
  30452 
  30453     return (BCM_E_NONE);
  30454 }
  30455 
  30456 /*
  30457  * Function:
  30458  *     bcm_esw_field_qualify_EthernetOamHeaderBits32_63
  30459  * Purpose:
  30460  *      Set match criteria for bcmFieldQualifyEthernetOamHeaderBits32_63
  30461  *      qualifier from the field entry.
  30462  * Parameters:
  30463  *      unit    - (IN) Unit number.
  30464  *      entry   - (IN) BCM field entry id.
  30465  *      data    - (IN) Qualifies on Second 4 Bytes of Ethernet OAM Header.
  30466  *      mask    - (IN) Qualifier match mask.
  30467  * Returns:
  30468  *      BCM_E_XXX
  30469  * Notes:
  30470  */
  30471 
  30472 int bcm_esw_field_qualify_EthernetOamHeaderBits32_63(
  30473     int unit,
  30474     bcm_field_entry_t entry,
  30475     uint32 data,
  30476     uint32 mask)
  30477 {
  30478     int rv;                 /* Operation return status. */
  30479 
  30480     /* Input range check */
  30481     rv = _field_qualifier32_input_range_check(unit,
  30482             bcmFieldQualifyEthernetOamHeaderBits32_63, entry,
  30483             (uint8 *)&data, sizeof (data));
  30484 
  30485     if (BCM_FAILURE(rv)) {
  30486         LOG_ERROR(BSL_LS_BCM_FP,
  30487                 (BSL_META_U(unit,
  30488                             "FP(unit %d) Error: data=%#x "
  30489                             "out-of-range\n"), unit, data));
  30490         return rv;
  30491     }
  30492 
  30493     
  30494     FP_LOCK(unit);
  30495 
  30496     rv = _field_qualify32(unit, entry,
  30497             bcmFieldQualifyEthernetOamHeaderBits32_63,
  30498             data, mask);
  30499 
  30500     FP_UNLOCK(unit);
  30501     return (rv);
  30502 
  30503 }
  30504 /*
  30505  * Function:
  30506  *     bcm_esw_field_qualify_EthernetOamHeaderBits32_63_get
  30507  * Purpose:
  30508  *      Get match criteria for bcmFieldQualifyEthernetOamHeaderBit32_63
  30509  *      qualifier from the field entry.
  30510  * Parameters:
  30511  *      unit    - (IN)  Unit number.
  30512  *      entry   - (IN)  BCM field entry id.
  30513  *      data    - (OUT) Second 4 Bytes of Ethernet OAM Header.
  30514  *      mask    - (OUT) Qualifier match mask.
  30515  * Returns:
  30516  *      BCM_E_XXX
  30517  * Notes:
  30518  */
  30519 
  30520 int bcm_esw_field_qualify_EthernetOamHeaderBits32_63_get(
  30521     int unit,
  30522     bcm_field_entry_t entry,
  30523     uint32 *data,
  30524     uint32 *mask)
  30525 {
  30526     if ((data == NULL) || (mask == NULL)) {
  30527         return BCM_E_PARAM;
  30528     }
  30529 
  30530     /* Read qualifier match value and mask. */
  30531     BCM_IF_ERROR_RETURN(
  30532             _bcm_field_entry_qualifier_uint32_get(unit, entry,
  30533                 bcmFieldQualifyEthernetOamHeaderBits32_63,
  30534                 data, mask));
  30535 
  30536     return (BCM_E_NONE);
  30537 }
  30538 /*
  30539  * Function:
  30540  *     bcm_esw_field_qualifyEthernetOamDstClassL2
  30541  * Purpose:
  30542  *      Set match criteria for bcmFieldQualifyEthernetOamDstClassL2
  30543  *      qualifier from the field entry.
  30544  * Parameters:
  30545  *      unit    - (IN) Unit number.
  30546  *      entry   - (IN) BCM field entry id.
  30547  *      data    - (IN) Qualifies on Class Id obtained from
  30548                        DstMac lookup in L2 table.
  30549  *      mask    - (IN) Qualifier match mask.
  30550  * Returns:
  30551  *      BCM_E_XXX
  30552  * Notes:
  30553  */
  30554 int bcm_esw_field_qualify_EthernetOamDstClassL2(
  30555     int unit,
  30556     bcm_field_entry_t entry,
  30557     uint8 data,
  30558     uint8 mask)
  30559 {
  30560     int rv;                 /* Operation return status. */
  30561 
  30562     /* Input range check */
  30563     rv = _field_qualifier32_input_range_check(unit,
  30564                 bcmFieldQualifyEthernetOamDstClassL2, entry,
  30565                 &data, sizeof (data));
  30566 
  30567     if (BCM_FAILURE(rv)) {
  30568         LOG_ERROR(BSL_LS_BCM_FP,
  30569                 (BSL_META_U(unit,
  30570                             "FP(unit %d) Error: data=%#x "
  30571                             "out-of-range\n"), unit, data));
  30572         return rv;
  30573     }
  30574 
  30575     
  30576     FP_LOCK(unit);
  30577 
  30578     rv = _field_qualify32(unit, entry, bcmFieldQualifyEthernetOamDstClassL2,
  30579             data, mask);
  30580 
  30581     FP_UNLOCK(unit);
  30582     return (rv);
  30583 }
  30584 
  30585 /*
  30586  * Function:
  30587  *     bcm_esw_field_qualify_EthernetOamDstClassL2_get
  30588  * Purpose:
  30589  *      Get match criteria for bcmFieldQualifyEthernetOamDstClassL2
  30590  *      qualifier from the field entry.
  30591  * Parameters:
  30592  *      unit    - (IN)  Unit number.
  30593  *      entry   - (IN)  BCM field entry id.
  30594  *      data    - (OUT) Class Id obtained from DstMac lookup in L2 table.
  30595  *      mask    - (OUT) Qualifier match mask.
  30596  * Returns:
  30597  *      BCM_E_XXX
  30598  * Notes:
  30599  */
  30600 
  30601 int bcm_esw_field_qualify_EthernetOamDstClassL2_get(
  30602     int unit,
  30603     bcm_field_entry_t entry,
  30604     uint8 *data,
  30605     uint8 *mask)
  30606 {
  30607     if ((data == NULL) || (mask == NULL)) {
  30608         return BCM_E_PARAM;
  30609     }
  30610 
  30611     /* Read qualifier match value and mask. */
  30612     BCM_IF_ERROR_RETURN(
  30613             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  30614                 bcmFieldQualifyEthernetOamDstClassL2,
  30615                 data, mask));
  30616 
  30617     return (BCM_E_NONE);
  30618 }
  30619 /*
  30620  * Function:
  30621  *     bcm_esw_field_qualify_EthernetOamTxPktUPMEP
  30622  * Purpose:
  30623  *      Set match criteria for bcmFieldQualifyEthernetOamTxPktUPMEP
  30624  *      qualifier from the field entry.
  30625  * Parameters:
  30626  *      unit    - (IN) Unit number.
  30627  *      entry   - (IN) BCM field entry id.
  30628  *      data    - (IN) Qualifies on Ethernet OAM UP-MEP Tx Pkt.
  30629  *      mask    - (IN) Qualifier match mask.
  30630  * Returns:
  30631  *      BCM_E_XXX
  30632  * Notes:
  30633  */
  30634 int bcm_esw_field_qualify_EthernetOamTxPktUPMEP(
  30635     int unit,
  30636     bcm_field_entry_t entry,
  30637     uint8 data,
  30638     uint8 mask)
  30639 {
  30640     int rv;                 /* Operation return status. */
  30641 
  30642     /* Input range check */
  30643     rv = _field_qualifier32_input_range_check(unit,
  30644             bcmFieldQualifyEthernetOamTxPktUPMEP, entry,
  30645             (uint8 *)&data, sizeof (data));
  30646 
  30647     if (BCM_FAILURE(rv)) {
  30648         LOG_ERROR(BSL_LS_BCM_FP,
  30649                 (BSL_META_U(unit,
  30650                             "FP(unit %d) Error: data=%#x "
  30651                             "out-of-range\n"), unit, data));
  30652         return rv;
  30653     }
  30654 
  30655 
  30656     
  30657     FP_LOCK(unit);
  30658 
  30659     rv = _field_qualify32(unit, entry, bcmFieldQualifyEthernetOamTxPktUPMEP,
  30660             data, mask);
  30661     FP_UNLOCK(unit);
  30662     return (rv);
  30663 }
  30664 
  30665 /*
  30666  * Function:
  30667  *     bcm_esw_field_qualify_EthernetOamTxPktUPMEP_get
  30668  * Purpose:
  30669  *      Get match criteria for bcmFieldQualifyEthernetOamTxPktUPMEP
  30670  *      qualifier from the field entry.
  30671  * Parameters:
  30672  *      unit    - (IN)  Unit number.
  30673  *      entry   - (IN)  BCM field entry id.
  30674  *      data    - (OUT) Ethernet OAM UP-MEP Tx Pkt.
  30675  *      mask    - (OUT) Qualifier match mask.
  30676  * Returns:
  30677  *      BCM_E_XXX
  30678  * Notes:
  30679  */
  30680 int bcm_esw_field_qualify_EthernetOamTxPktUPMEP_get(
  30681     int unit,
  30682     bcm_field_entry_t entry,
  30683     uint8 *data,
  30684     uint8 *mask)
  30685 {
  30686     if ((data == NULL) || (mask == NULL)) {
  30687         return BCM_E_PARAM;
  30688     }
  30689 
  30690     /* Read qualifier match value and mask. */
  30691     BCM_IF_ERROR_RETURN(
  30692             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  30693                 bcmFieldQualifyEthernetOamTxPktUPMEP,
  30694                 data, mask));
  30695 
  30696     return (BCM_E_NONE);
  30697 }
  30698 
  30699 /*
  30700  * Function:
  30701  *     bcm_esw_field_qualifyEthernetOamInterfaceClassPort
  30702  * Purpose:
  30703  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassPort
  30704  *      qualifier from the field entry.
  30705  * Parameters:
  30706  *      unit    - (IN) Unit number.
  30707  *      entry   - (IN) BCM field entry id.
  30708  *      data    - (IN) Qualifies on Class Id obtained from
  30709                        Source trunk map table.
  30710  *      mask    - (IN) Qualifier match mask.
  30711  * Returns:
  30712  *      BCM_E_XXX
  30713  * Notes:
  30714  */
  30715 int bcm_esw_field_qualify_EthernetOamInterfaceClassPort(
  30716     int unit,
  30717     bcm_field_entry_t entry,
  30718     uint8 data,
  30719     uint8 mask)
  30720 {
  30721     int rv;                 /* Operation return status. */
  30722 
  30723     /* Input range check */
  30724     rv = _field_qualifier32_input_range_check(unit,
  30725             bcmFieldQualifyEthernetOamInterfaceClassPort, entry,
  30726             (uint8 *)&data, sizeof (data));
  30727 
  30728     if (BCM_FAILURE(rv)) {
  30729         LOG_ERROR(BSL_LS_BCM_FP,
  30730                 (BSL_META_U(unit,
  30731                             "FP(unit %d) Error: data=%#x "
  30732                             "out-of-range\n"), unit, data));
  30733         return rv;
  30734     }
  30735 
  30736     
  30737     FP_LOCK(unit);
  30738 
  30739     rv = _field_qualify32(unit, entry,
  30740             bcmFieldQualifyEthernetOamInterfaceClassPort,
  30741             data, mask);
  30742     FP_UNLOCK(unit);
  30743     return (rv);
  30744 }
  30745 
  30746 /*
  30747  * Function:
  30748  *     bcm_esw_field_qualify_EthernetOamInterfaceClassPort_get
  30749  * Purpose:
  30750  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassPort
  30751  *      qualifier from the field entry.
  30752  * Parameters:
  30753  *      unit    - (IN)  Unit number.
  30754  *      entry   - (IN)  BCM field entry id.
  30755  *      data    - (OUT) Class Id obtained from Source trunk map table.
  30756  *      mask    - (OUT) Qualifier match mask.
  30757  * Returns:
  30758  *      BCM_E_XXX
  30759  * Notes:
  30760  */
  30761 int bcm_esw_field_qualify_EthernetOamInterfaceClassPort_get(
  30762     int unit,
  30763     bcm_field_entry_t entry,
  30764     uint8 *data,
  30765     uint8 *mask)
  30766 {
  30767     if ((data == NULL) || (mask == NULL)) {
  30768         return BCM_E_PARAM;
  30769     }
  30770 
  30771     /* Read qualifier match value and mask. */
  30772     BCM_IF_ERROR_RETURN(
  30773             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  30774                 bcmFieldQualifyEthernetOamInterfaceClassPort,
  30775                 data, mask));
  30776 
  30777     return (BCM_E_NONE);
  30778 }
  30779 
  30780 /*
  30781  * Function:
  30782  *     bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeyFirst
  30783  * Purpose:
  30784  *      Set match criteria for bcmFieldQualifyEthernetOamClassVxlt1
  30785  *      qualifier from the field entry.
  30786  * Parameters:
  30787  *      unit    - (IN) Unit number.
  30788  *      entry   - (IN) BCM field entry id.
  30789  *      data    - (IN) Qualifies on Class Id obtained from
  30790                        1st Lookup of Vlan_Xlate table.
  30791  *      mask    - (IN) Qualifier match mask.
  30792  * Returns:
  30793  *      BCM_E_XXX
  30794  * Notes:
  30795  */
  30796 int bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeyFirst(
  30797     int unit,
  30798     bcm_field_entry_t entry,
  30799     uint8 data,
  30800     uint8 mask)
  30801 {
  30802     int rv;                 /* Operation return status. */
  30803 
  30804     /* Input range check */
  30805     rv = _field_qualifier32_input_range_check(unit,
  30806             bcmFieldQualifyEthernetOamClassVlanTranslateKeyFirst, entry,
  30807             (uint8 *)&data, sizeof (data));
  30808 
  30809     if (BCM_FAILURE(rv)) {
  30810         LOG_ERROR(BSL_LS_BCM_FP,
  30811                 (BSL_META_U(unit,
  30812                             "FP(unit %d) Error: data=%#x "
  30813                             "out-of-range\n"), unit, data));
  30814         return rv;
  30815     }
  30816 
  30817     
  30818     FP_LOCK(unit);
  30819 
  30820     rv = _field_qualify32(unit, entry,
  30821             bcmFieldQualifyEthernetOamClassVlanTranslateKeyFirst,
  30822             data, mask);
  30823     FP_UNLOCK(unit);
  30824     return (rv);
  30825 }
  30826 
  30827 /*
  30828  * Function:
  30829  *     bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeyFirst_get
  30830  * Purpose:
  30831  *      Get match criteria for bcmFieldQualifyEthernetOamClassVxlt1
  30832  *      qualifier from the field entry.
  30833  * Parameters:
  30834  *      unit    - (IN)  Unit number.
  30835  *      entry   - (IN)  BCM field entry id.
  30836  *      data    - (OUT) Class Id obtained from 1st Lookup of Vlan_Xlate table.
  30837  *      mask    - (OUT) Qualifier match mask.
  30838  * Returns:
  30839  *      BCM_E_XXX
  30840  * Notes:
  30841  */
  30842 int bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeyFirst_get(
  30843     int unit,
  30844     bcm_field_entry_t entry,
  30845     uint8 *data,
  30846     uint8 *mask)
  30847 {
  30848     if ((data == NULL) || (mask == NULL)) {
  30849         return BCM_E_PARAM;
  30850     }
  30851 
  30852     /* Read qualifier match value and mask. */
  30853     BCM_IF_ERROR_RETURN(
  30854             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  30855                 bcmFieldQualifyEthernetOamClassVlanTranslateKeyFirst,
  30856                 data, mask));
  30857 
  30858     return (BCM_E_NONE);
  30859 }
  30860 
  30861 /*
  30862  * Function:
  30863  *     bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeySecond
  30864  * Purpose:
  30865  *      Set match criteria for bcmFieldQualifyEthernetOamClassVxlt2
  30866  *      qualifier from the field entry.
  30867  * Parameters:
  30868  *      unit    - (IN) Unit number.
  30869  *      entry   - (IN) BCM field entry id.
  30870  *      data    - (IN) Qualifies on Class Id obtained from
  30871                        2nd Lookup of Vlan_Xlate table.
  30872  *      mask    - (IN) Qualifier match mask.
  30873  * Returns:
  30874  *      BCM_E_XXX
  30875  * Notes:
  30876  */
  30877 int bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeySecond(
  30878     int unit,
  30879     bcm_field_entry_t entry,
  30880     uint8 data,
  30881     uint8 mask)
  30882 {
  30883     int rv;                 /* Operation return status. */
  30884 
  30885     /* Input range check */
  30886     rv = _field_qualifier32_input_range_check(unit,
  30887             bcmFieldQualifyEthernetOamClassVlanTranslateKeySecond, entry,
  30888             (uint8 *)&data, sizeof (data));
  30889 
  30890     if (BCM_FAILURE(rv)) {
  30891         LOG_ERROR(BSL_LS_BCM_FP,
  30892                 (BSL_META_U(unit,
  30893                             "FP(unit %d) Error: data=%#x "
  30894                             "out-of-range\n"), unit, data));
  30895         return rv;
  30896     }
  30897 
  30898     
  30899     FP_LOCK(unit);
  30900 
  30901     rv = _field_qualify32(unit, entry,
  30902             bcmFieldQualifyEthernetOamClassVlanTranslateKeySecond,
  30903             data, mask);
  30904     FP_UNLOCK(unit);
  30905     return (rv);
  30906 }
  30907 
  30908 /*
  30909  * Function:
  30910  *     bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeySecond_get
  30911  * Purpose:
  30912  *      Get match criteria for bcmFieldQualifyEthernetOamClassVxlt2
  30913  *      qualifier from the field entry.
  30914  * Parameters:
  30915  *      unit    - (IN)  Unit number.
  30916  *      entry   - (IN)  BCM field entry id.
  30917  *      data    - (OUT) Class Id obtained from 2nd Lookup of Vlan_Xlate table.
  30918  *      mask    - (OUT) Qualifier match mask.
  30919  * Returns:
  30920  *      BCM_E_XXX
  30921  * Notes:
  30922  */
  30923 int bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeySecond_get(
  30924     int unit,
  30925     bcm_field_entry_t entry,
  30926     uint8 *data,
  30927     uint8 *mask)
  30928 {
  30929     if ((data == NULL) || (mask == NULL)) {
  30930         return BCM_E_PARAM;
  30931     }
  30932 
  30933     /* Read qualifier match value and mask. */
  30934     BCM_IF_ERROR_RETURN(
  30935             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  30936                 bcmFieldQualifyEthernetOamClassVlanTranslateKeySecond,
  30937                 data, mask));
  30938 
  30939     return (BCM_E_NONE);
  30940 }
  30941 
  30942 /*
  30943  * Function:
  30944  *     bcm_esw_field_qualify_EthernetOamInterfaceClassVlan
  30945  * Purpose:
  30946  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassVlan
  30947  *      qualifier from the field entry.
  30948  * Parameters:
  30949  *      unit    - (IN) Unit number.
  30950  *      entry   - (IN) BCM field entry id.
  30951  *      data    - (IN) Qualifies on Class Id obtained from
  30952  SVP table.
  30953  *      mask    - (IN) Qualifier match mask.
  30954  * Returns:
  30955  *      BCM_E_XXX
  30956  * Notes:
  30957  */
  30958 int bcm_esw_field_qualify_EthernetOamInterfaceClassVlan(
  30959     int unit,
  30960     bcm_field_entry_t entry,
  30961     uint8 data,
  30962     uint8 mask)
  30963 {
  30964     int rv;                 /* Operation return status. */
  30965 
  30966     /* Input range check */
  30967     rv = _field_qualifier32_input_range_check(unit,
  30968             bcmFieldQualifyEthernetOamInterfaceClassVlan, entry,
  30969             (uint8 *)&data, sizeof (data));
  30970 
  30971     if (BCM_FAILURE(rv)) {
  30972         LOG_ERROR(BSL_LS_BCM_FP,
  30973                 (BSL_META_U(unit,
  30974                             "FP(unit %d) Error: data=%#x "
  30975                             "out-of-range\n"), unit, data));
  30976         return rv;
  30977     }
  30978 
  30979     
  30980     FP_LOCK(unit);
  30981 
  30982     rv = _field_qualify32(unit, entry,
  30983             bcmFieldQualifyEthernetOamInterfaceClassVlan,
  30984             data, mask);
  30985     FP_UNLOCK(unit);
  30986     return (rv);
  30987 }
  30988 
  30989 /*
  30990  * Function:
  30991  *     bcm_esw_field_qualify_EthernetOamInterfaceClassVlan_get
  30992  * Purpose:
  30993  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassVlan
  30994  *      qualifier from the field entry.
  30995  * Parameters:
  30996  *      unit    - (IN)  Unit number.
  30997  *      entry   - (IN)  BCM field entry id.
  30998  *      data    - (OUT) Class Id obtained from SVP table.
  30999  *      mask    - (OUT) Qualifier match mask.
  31000  * Returns:
  31001  *      BCM_E_XXX
  31002  * Notes:
  31003  */
  31004 int bcm_esw_field_qualify_EthernetOamInterfaceClassVlan_get(
  31005     int unit,
  31006     bcm_field_entry_t entry,
  31007     uint8 *data,
  31008     uint8 *mask)
  31009 {
  31010     if ((data == NULL) || (mask == NULL)) {
  31011         return BCM_E_PARAM;
  31012     }
  31013 
  31014     /* Read qualifier match value and mask. */
  31015     BCM_IF_ERROR_RETURN(
  31016             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  31017                 bcmFieldQualifyEthernetOamInterfaceClassVlan,
  31018                 data, mask));
  31019 
  31020     return (BCM_E_NONE);
  31021 }
  31022 
  31023 /*
  31024  * Function:
  31025  *     bcm_esw_field_qualify_EthernetOamInterfaceClassVxlan
  31026  * Purpose:
  31027  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassVxlan
  31028  *      qualifier from the field entry.
  31029  * Parameters:
  31030  *      unit    - (IN) Unit number.
  31031  *      entry   - (IN) BCM field entry id.
  31032  *      data    - (IN) Qualifies on Class Id obtained from
  31033                        SVP table.
  31034  *      mask    - (IN) Qualifier match mask.
  31035  * Returns:
  31036  *      BCM_E_XXX
  31037  * Notes:
  31038  */
  31039 int bcm_esw_field_qualify_EthernetOamInterfaceClassVxlan(
  31040     int unit,
  31041     bcm_field_entry_t entry,
  31042     uint8 data,
  31043     uint8 mask)
  31044 {
  31045     int rv;                 /* Operation return status. */
  31046 
  31047     /* Input range check */
  31048     rv = _field_qualifier32_input_range_check(unit,
  31049             bcmFieldQualifyEthernetOamInterfaceClassVxlan, entry,
  31050             (uint8 *)&data, sizeof (data));
  31051 
  31052     if (BCM_FAILURE(rv)) {
  31053         LOG_ERROR(BSL_LS_BCM_FP,
  31054                 (BSL_META_U(unit,
  31055                             "FP(unit %d) Error: data=%#x "
  31056                             "out-of-range\n"), unit, data));
  31057         return rv;
  31058     }
  31059 
  31060     
  31061     FP_LOCK(unit);
  31062 
  31063     rv = _field_qualify32(unit, entry,
  31064             bcmFieldQualifyEthernetOamInterfaceClassVxlan,
  31065             data, mask);
  31066     FP_UNLOCK(unit);
  31067     return (rv);
  31068 }
  31069 
  31070 /*
  31071  * Function:
  31072  *     bcm_esw_field_qualify_EthernetOamInterfaceClassVxlan_get
  31073  * Purpose:
  31074  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassVxlan
  31075  *      qualifier from the field entry.
  31076  * Parameters:
  31077  *      unit    - (IN)  Unit number.
  31078  *      entry   - (IN)  BCM field entry id.
  31079  *      data    - (OUT) Class Id obtained from SVP table.
  31080  *      mask    - (OUT) Qualifier match mask.
  31081  * Returns:
  31082  *      BCM_E_XXX
  31083  * Notes:
  31084  */
  31085 int bcm_esw_field_qualify_EthernetOamInterfaceClassVxlan_get(
  31086     int unit,
  31087     bcm_field_entry_t entry,
  31088     uint8 *data,
  31089     uint8 *mask)
  31090 {
  31091     if ((data == NULL) || (mask == NULL)) {
  31092         return BCM_E_PARAM;
  31093     }
  31094 
  31095     /* Read qualifier match value and mask. */
  31096     BCM_IF_ERROR_RETURN(
  31097             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  31098                 bcmFieldQualifyEthernetOamInterfaceClassVxlan,
  31099                 data, mask));
  31100 
  31101     return (BCM_E_NONE);
  31102 }
  31103 
  31104 /*
  31105  * Function:
  31106  *     bcm_esw_field_qualify_EthernetOamInterfaceClassMim
  31107  * Purpose:
  31108  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassMim
  31109  *      qualifier from the field entry.
  31110  * Parameters:
  31111  *      unit    - (IN) Unit number.
  31112  *      entry   - (IN) BCM field entry id.
  31113  *      data    - (IN) Qualifies on Class Id obtained from
  31114  SVP table.
  31115  *      mask    - (IN) Qualifier match mask.
  31116  * Returns:
  31117  *      BCM_E_XXX
  31118  * Notes:
  31119  */
  31120 int bcm_esw_field_qualify_EthernetOamInterfaceClassMim(
  31121     int unit,
  31122     bcm_field_entry_t entry,
  31123     uint8 data,
  31124     uint8 mask)
  31125 {
  31126     int rv;                 /* Operation return status. */
  31127 
  31128     /* Input range check */
  31129     rv = _field_qualifier32_input_range_check(unit,
  31130             bcmFieldQualifyEthernetOamInterfaceClassMim, entry,
  31131             (uint8 *)&data, sizeof (data));
  31132 
  31133     if (BCM_FAILURE(rv)) {
  31134         LOG_ERROR(BSL_LS_BCM_FP,
  31135                 (BSL_META_U(unit,
  31136                             "FP(unit %d) Error: data=%#x "
  31137                             "out-of-range\n"), unit, data));
  31138         return rv;
  31139     }
  31140 
  31141     
  31142     FP_LOCK(unit);
  31143 
  31144     rv = _field_qualify32(unit, entry,
  31145             bcmFieldQualifyEthernetOamInterfaceClassMim,
  31146             data, mask);
  31147     FP_UNLOCK(unit);
  31148     return (rv);
  31149 }
  31150 
  31151 /*
  31152  * Function:
  31153  *     bcm_esw_field_qualify_EthernetOamInterfaceClassMim_get
  31154  * Purpose:
  31155  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassMim
  31156  *      qualifier from the field entry.
  31157  * Parameters:
  31158  *      unit    - (IN)  Unit number.
  31159  *      entry   - (IN)  BCM field entry id.
  31160  *      data    - (OUT) Class Id obtained from SVP table.
  31161  *      mask    - (OUT) Qualifier match mask.
  31162  * Returns:
  31163  *      BCM_E_XXX
  31164  * Notes:
  31165  */
  31166 int bcm_esw_field_qualify_EthernetOamInterfaceClassMim_get(
  31167     int unit,
  31168     bcm_field_entry_t entry,
  31169     uint8 *data,
  31170     uint8 *mask)
  31171 {
  31172     if ((data == NULL) || (mask == NULL)) {
  31173         return BCM_E_PARAM;
  31174     }
  31175 
  31176     /* Read qualifier match value and mask. */
  31177     BCM_IF_ERROR_RETURN(
  31178             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  31179                 bcmFieldQualifyEthernetOamInterfaceClassMim,
  31180                 data, mask));
  31181 
  31182     return (BCM_E_NONE);
  31183 }
  31184 
  31185 /*
  31186  * Function:
  31187  *     bcm_esw_field_qualify_EthernetOamInterfaceClassNiv
  31188  * Purpose:
  31189  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassNiv
  31190  *      qualifier from the field entry.
  31191  * Parameters:
  31192  *      unit    - (IN) Unit number.
  31193  *      entry   - (IN) BCM field entry id.
  31194  *      data    - (IN) Qualifies on Class Id obtained from
  31195  SVP table.
  31196  *      mask    - (IN) Qualifier match mask.
  31197  * Returns:
  31198  *      BCM_E_XXX
  31199  * Notes:
  31200  */
  31201 int bcm_esw_field_qualify_EthernetOamInterfaceClassNiv(
  31202     int unit,
  31203     bcm_field_entry_t entry,
  31204     uint8 data,
  31205     uint8 mask)
  31206 {
  31207     int rv;                 /* Operation return status. */
  31208 
  31209     /* Input range check */
  31210     rv = _field_qualifier32_input_range_check(unit,
  31211             bcmFieldQualifyEthernetOamInterfaceClassNiv, entry,
  31212             (uint8 *)&data, sizeof (data));
  31213 
  31214     if (BCM_FAILURE(rv)) {
  31215         LOG_ERROR(BSL_LS_BCM_FP,
  31216                 (BSL_META_U(unit,
  31217                             "FP(unit %d) Error: data=%#x "
  31218                             "out-of-range\n"), unit, data));
  31219         return rv;
  31220     }
  31221 
  31222     
  31223     FP_LOCK(unit);
  31224 
  31225     rv = _field_qualify32(unit, entry,
  31226             bcmFieldQualifyEthernetOamInterfaceClassNiv,
  31227             data, mask);
  31228     FP_UNLOCK(unit);
  31229     return (rv);
  31230 }
  31231 
  31232 /*
  31233  * Function:
  31234  *     bcm_esw_field_qualify_EthernetOamInterfaceClassNiv_get
  31235  * Purpose:
  31236  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassNiv
  31237  *      qualifier from the field entry.
  31238  * Parameters:
  31239  *      unit    - (IN)  Unit number.
  31240  *      entry   - (IN)  BCM field entry id.
  31241  *      data    - (OUT) Class Id obtained from SVP table.
  31242  *      mask    - (OUT) Qualifier match mask.
  31243  * Returns:
  31244  *      BCM_E_XXX
  31245  * Notes:
  31246  */
  31247 int bcm_esw_field_qualify_EthernetOamInterfaceClassNiv_get(
  31248     int unit,
  31249     bcm_field_entry_t entry,
  31250     uint8 *data,
  31251     uint8 *mask)
  31252 {
  31253     if ((data == NULL) || (mask == NULL)) {
  31254         return BCM_E_PARAM;
  31255     }
  31256 
  31257     /* Read qualifier match value and mask. */
  31258     BCM_IF_ERROR_RETURN(
  31259             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  31260                 bcmFieldQualifyEthernetOamInterfaceClassNiv,
  31261                 data, mask));
  31262 
  31263     return (BCM_E_NONE);
  31264 }
  31265 
  31266 /*
  31267  * Function:
  31268  *     bcm_esw_field_qualify_EthernetOamInterfaceClassMpls
  31269  * Purpose:
  31270  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassMpls
  31271  *      qualifier from the field entry.
  31272  * Parameters:
  31273  *      unit    - (IN) Unit number.
  31274  *      entry   - (IN) BCM field entry id.
  31275  *      data    - (IN) Qualifies on Class Id obtained from
  31276  SVP table.
  31277  *      mask    - (IN) Qualifier match mask.
  31278  * Returns:
  31279  *      BCM_E_XXX
  31280  * Notes:
  31281  */
  31282 int bcm_esw_field_qualify_EthernetOamInterfaceClassMpls(
  31283     int unit,
  31284     bcm_field_entry_t entry,
  31285     uint8 data,
  31286     uint8 mask)
  31287 {
  31288     int rv;                 /* Operation return status. */
  31289 
  31290     /* Input range check */
  31291     rv = _field_qualifier32_input_range_check(unit,
  31292             bcmFieldQualifyEthernetOamInterfaceClassMpls, entry,
  31293             (uint8 *)&data, sizeof (data));
  31294 
  31295     if (BCM_FAILURE(rv)) {
  31296         LOG_ERROR(BSL_LS_BCM_FP,
  31297                 (BSL_META_U(unit,
  31298                             "FP(unit %d) Error: data=%#x "
  31299                             "out-of-range\n"), unit, data));
  31300         return rv;
  31301     }
  31302 
  31303     
  31304     FP_LOCK(unit);
  31305 
  31306     rv = _field_qualify32(unit, entry,
  31307             bcmFieldQualifyEthernetOamInterfaceClassMpls,
  31308             data, mask);
  31309     FP_UNLOCK(unit);
  31310     return (rv);
  31311 }
  31312 
  31313 /*
  31314  * Function:
  31315  *     bcm_esw_field_qualify_EthernetOamInterfaceClassMpls_get
  31316  * Purpose:
  31317  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassMpls
  31318  *      qualifier from the field entry.
  31319  * Parameters:
  31320  *      unit    - (IN)  Unit number.
  31321  *      entry   - (IN)  BCM field entry id.
  31322  *      data    - (OUT) Class Id obtained from SVP table.
  31323  *      mask    - (OUT) Qualifier match mask.
  31324  * Returns:
  31325  *      BCM_E_XXX
  31326  * Notes:
  31327  */
  31328 int bcm_esw_field_qualify_EthernetOamInterfaceClassMpls_get(
  31329     int unit,
  31330     bcm_field_entry_t entry,
  31331     uint8 *data,
  31332     uint8 *mask)
  31333 {
  31334     if ((data == NULL) || (mask == NULL)) {
  31335         return BCM_E_PARAM;
  31336     }
  31337 
  31338     /* Read qualifier match value and mask. */
  31339     BCM_IF_ERROR_RETURN(
  31340             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  31341                 bcmFieldQualifyEthernetOamInterfaceClassMpls,
  31342                 data, mask));
  31343 
  31344     return (BCM_E_NONE);
  31345 }
  31346 
  31347 
  31348 /*
  31349  * Function:
  31350  *     bcm_esw_field_qualifyEthernetOamClassVpn
  31351  * Purpose:
  31352  *      Set match criteria for bcmFieldQualifyEthernetOamClassVpn
  31353  *      qualifier from the field entry.
  31354  * Parameters:
  31355  *      unit    - (IN) Unit number.
  31356  *      entry   - (IN) BCM field entry id.
  31357  *      data    - (IN) Qualifies on Class Id obtained from
  31358                        VFI table.
  31359  *      mask    - (IN) Qualifier match mask.
  31360  * Returns:
  31361  *      BCM_E_XXX
  31362  * Notes:
  31363  */
  31364 int bcm_esw_field_qualify_EthernetOamClassVpn(
  31365     int unit,
  31366     bcm_field_entry_t entry,
  31367     uint8 data,
  31368     uint8 mask)
  31369 {
  31370     int rv;                 /* Operation return status. */
  31371 
  31372     /* Input range check */
  31373     rv = _field_qualifier32_input_range_check(unit,
  31374             bcmFieldQualifyEthernetOamClassVpn, entry,
  31375             (uint8 *)&data, sizeof (data));
  31376 
  31377     if (BCM_FAILURE(rv)) {
  31378         LOG_ERROR(BSL_LS_BCM_FP,
  31379                 (BSL_META_U(unit,
  31380                             "FP(unit %d) Error: data=%#x "
  31381                             "out-of-range\n"), unit, data));
  31382         return rv;
  31383     }
  31384 
  31385     
  31386     FP_LOCK(unit);
  31387 
  31388     rv = _field_qualify32(unit, entry,
  31389             bcmFieldQualifyEthernetOamClassVpn,
  31390             data, mask);
  31391     FP_UNLOCK(unit);
  31392     return (rv);
  31393 }
  31394 
  31395 /*
  31396  * Function:
  31397  *     bcm_esw_field_qualify_EthernetOamClassVpn_get
  31398  * Purpose:
  31399  *      Get match criteria for bcmFieldQualifyEthernetOamClassVpn
  31400  *      qualifier from the field entry.
  31401  * Parameters:
  31402  *      unit    - (IN)  Unit number.
  31403  *      entry   - (IN)  BCM field entry id.
  31404  *      data    - (OUT) Class Id obtained from VFI table.
  31405  *      mask    - (OUT) Qualifier match mask.
  31406  * Returns:
  31407  *      BCM_E_XXX
  31408  * Notes:
  31409  */
  31410 
  31411 int bcm_esw_field_qualify_EthernetOamClassVpn_get(
  31412     int unit,
  31413     bcm_field_entry_t entry,
  31414     uint8 *data,
  31415     uint8 *mask)
  31416 {
  31417     if ((data == NULL) || (mask == NULL)) {
  31418         return BCM_E_PARAM;
  31419     }
  31420 
  31421     /* Read qualifier match value and mask. */
  31422     BCM_IF_ERROR_RETURN(
  31423             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  31424                 bcmFieldQualifyEthernetOamClassVpn,
  31425                 data, mask));
  31426 
  31427     return (BCM_E_NONE);
  31428 }
  31429 
  31430 /*
  31431  * Function:
  31432  *    bcm_esw_field_qualify_MplsOamHeaderBits0_31
  31433  * Purpose:
  31434  *      Set match criteria for bcmFieldQualifyMplsOamHeaderBits0_31
  31435  *      qualifier from the field entry.
  31436  * Parameters:
  31437  *      unit    - (IN) Unit number.
  31438  *      entry   - (IN) BCM field entry id.
  31439  *      data    - (IN) Qualifies on First 4 Bytes of MPLS OAM Header.
  31440  *      mask    - (IN) Qualifier match mask.
  31441  * Returns:
  31442  *      BCM_E_XXX
  31443  * Notes:
  31444  */
  31445 int bcm_esw_field_qualify_MplsOamHeaderBits0_31(
  31446     int unit,
  31447     bcm_field_entry_t entry,
  31448     uint32 data,
  31449     uint32 mask)
  31450 {
  31451     int rv;                 /* Operation return status. */
  31452 
  31453     /* Input range check */
  31454     rv = _field_qualifier32_input_range_check(unit,
  31455             bcmFieldQualifyMplsOamHeaderBits0_31, entry,
  31456             (uint8 *)&data, sizeof (data));
  31457 
  31458     if (BCM_FAILURE(rv)) {
  31459         LOG_ERROR(BSL_LS_BCM_FP,
  31460                 (BSL_META_U(unit,
  31461                             "FP(unit %d) Error: data=%#x "
  31462                             "out-of-range\n"), unit, data));
  31463         return rv;
  31464     }
  31465 
  31466     
  31467     FP_LOCK(unit);
  31468 
  31469     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsOamHeaderBits0_31,
  31470             data, mask);
  31471 
  31472     FP_UNLOCK(unit);
  31473     return (rv);
  31474 }
  31475 
  31476 /*
  31477  * Function:
  31478  *     bcm_esw_field_qualify_MplsOamHeaderBits0_31_get
  31479  * Purpose:
  31480  *      Get match criteria for bcmFieldQualifyMplsOamHeaderBits0_31
  31481  *      qualifier from the field entry.
  31482  * Parameters:
  31483  *      unit    - (IN)  Unit number.
  31484  *      entry   - (IN)  BCM field entry id.
  31485  *      data    - (OUT) First 4 Bytes of MPLS OAM Header.
  31486  *      mask    - (OUT) Qualifier match mask.
  31487  * Returns:
  31488  *      BCM_E_XXX
  31489  * Notes:
  31490  */
  31491 int bcm_esw_field_qualify_MplsOamHeaderBits0_31_get(
  31492     int unit,
  31493     bcm_field_entry_t entry,
  31494     uint32 *data,
  31495     uint32 *mask)
  31496 {
  31497     if ((data == NULL) || (mask == NULL)) {
  31498         return BCM_E_PARAM;
  31499     }
  31500 
  31501     /* Read qualifier match value and mask. */
  31502     BCM_IF_ERROR_RETURN(
  31503             _bcm_field_entry_qualifier_uint32_get(unit, entry,
  31504                 bcmFieldQualifyMplsOamHeaderBits0_31,
  31505                 data, mask));
  31506 
  31507     return BCM_E_NONE;
  31508 }
  31509 
  31510 
  31511 /*
  31512  * Function:
  31513  *     bcm_esw_field_qualify_MplsOamHeaderBits32_63
  31514  * Purpose:
  31515  *      Set match criteria for bcmFieldQualifyMplsOamHeaderBits32_63
  31516  *      qualifier from the field entry.
  31517  * Parameters:
  31518  *      unit    - (IN) Unit number.
  31519  *      entry   - (IN) BCM field entry id.
  31520  *      data    - (IN) Qualifies on Second 4 Bytes of MPLS OAM Header.
  31521  *      mask    - (IN) Qualifier match mask.
  31522  * Returns:
  31523  *      BCM_E_XXX
  31524  * Notes:
  31525  */
  31526 int bcm_esw_field_qualify_MplsOamHeaderBits32_63(
  31527     int unit,
  31528     bcm_field_entry_t entry,
  31529     uint32 data,
  31530     uint32 mask)
  31531 {
  31532     int rv;                 /* Operation return status. */
  31533 
  31534     /* Input range check */
  31535     rv = _field_qualifier32_input_range_check(unit,
  31536             bcmFieldQualifyMplsOamHeaderBits32_63, entry,
  31537             (uint8 *)&data, sizeof (data));
  31538 
  31539     if (BCM_FAILURE(rv)) {
  31540         LOG_ERROR(BSL_LS_BCM_FP,
  31541                 (BSL_META_U(unit,
  31542                             "FP(unit %d) Error: data=%#x "
  31543                             "out-of-range\n"), unit, data));
  31544         return rv;
  31545     }
  31546 
  31547     
  31548     FP_LOCK(unit);
  31549 
  31550     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsOamHeaderBits32_63,
  31551             data, mask);
  31552 
  31553     FP_UNLOCK(unit);
  31554     return (rv);
  31555 }
  31556 
  31557 /*
  31558  * Function:
  31559  *     bcm_esw_field_qualify_MplsOamHeaderBits32_63_get
  31560  * Purpose:
  31561  *      Get match criteria for bcmFieldQualifyOamHeaderBits32_63
  31562  *      qualifier from the field entry.
  31563  * Parameters:
  31564  *      unit    - (IN)  Unit number.
  31565  *      entry   - (IN)  BCM field entry id.
  31566  *      data    - (OUT) Second 4 Bytes of MPLS OAM Header.
  31567  *      mask    - (OUT) Qualifier match mask.
  31568  * Returns:
  31569  *      BCM_E_XXX
  31570  * Notes:
  31571  */
  31572 int bcm_esw_field_qualify_MplsOamHeaderBits32_63_get(
  31573     int unit,
  31574     bcm_field_entry_t entry,
  31575     uint32 *data,
  31576     uint32 *mask)
  31577 {
  31578     if ((data == NULL) || (mask == NULL)) {
  31579         return BCM_E_PARAM;
  31580     }
  31581 
  31582     /* Read qualifier match value and mask. */
  31583     BCM_IF_ERROR_RETURN(
  31584             _bcm_field_entry_qualifier_uint32_get(unit, entry,
  31585                 bcmFieldQualifyMplsOamHeaderBits32_63,
  31586                 data, mask));
  31587 
  31588     return BCM_E_NONE;
  31589 }
  31590 
  31591 /*
  31592  * Function:
  31593  *    bcm_esw_field_qualify_MplsOamGALLabelOnly
  31594  * Purpose:
  31595  *      Set match criteria for bcmFieldQualifyMplsOamGALLabelOnly
  31596  *      qualifier from the field entry.
  31597  * Parameters:
  31598  *      unit    - (IN) Unit number.
  31599  *      entry   - (IN) BCM field entry id.
  31600  *      data    - (IN) Qualifies MPLS OAM packets with
  31601                        single label only that is GAL label.
  31602  *      mask    - (IN) Qualifier match mask.
  31603  * Returns:
  31604  *      BCM_E_XXX
  31605  * Notes:
  31606  */
  31607 int bcm_esw_field_qualify_MplsOamGALLabelOnly(
  31608     int unit,
  31609     bcm_field_entry_t entry,
  31610     uint8 data,
  31611     uint8 mask)
  31612 {
  31613     int rv;                 /* Operation return status. */
  31614 
  31615     /* Input range check */
  31616     rv = _field_qualifier32_input_range_check(unit,
  31617             bcmFieldQualifyMplsOamGALLabelOnly, entry,
  31618             (uint8 *)&data, sizeof (data));
  31619 
  31620     if (BCM_FAILURE(rv)) {
  31621         LOG_ERROR(BSL_LS_BCM_FP,
  31622                 (BSL_META_U(unit,
  31623                             "FP(unit %d) Error: data=%#x "
  31624                             "out-of-range\n"), unit, data));
  31625         return rv;
  31626     }
  31627 
  31628     
  31629     FP_LOCK(unit);
  31630 
  31631     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsOamGALLabelOnly,
  31632             data, mask);
  31633     FP_UNLOCK(unit);
  31634     return (rv);
  31635 }
  31636 
  31637 /*
  31638  * Function:
  31639  *     bcm_esw_field_qualify_MplsOamGALLabelOnly_get
  31640  * Purpose:
  31641  *      Get match criteria for bcmFieldQualifyMplsOamGALLabelOnly
  31642  *      qualifier from the field entry.
  31643  * Parameters:
  31644  *      unit    - (IN)  Unit number.
  31645  *      entry   - (IN)  BCM field entry id.
  31646  *      data    - (OUT) MPLS OAM packets with
  31647                         single label only that is GAL label.
  31648  *      mask    - (OUT) Qualifier match mask.
  31649  * Returns:
  31650  *      BCM_E_XXX
  31651  * Notes:
  31652  */
  31653 int bcm_esw_field_qualify_MplsOamGALLabelOnly_get(
  31654     int unit,
  31655     bcm_field_entry_t entry,
  31656     uint8 *data,
  31657     uint8 *mask)
  31658 {
  31659     if ((data == NULL) || (mask == NULL)) {
  31660         return BCM_E_PARAM;
  31661     }
  31662 
  31663     /* Read qualifier match value and mask. */
  31664     BCM_IF_ERROR_RETURN(
  31665             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  31666                 bcmFieldQualifyMplsOamGALLabelOnly,
  31667                 data, mask));
  31668 
  31669     return (BCM_E_NONE);
  31670 }
  31671 
  31672 /*
  31673  * Function:
  31674  *    bcm_esw_field_qualify_MplsOamUpperLabelDataDrop 
  31675  * Purpose:
  31676  *      Set match criteria for bcmFieldQualifyMplsOamUpperLabelDataDrop
  31677  *      qualifier from the field entry.
  31678  * Parameters:
  31679  *      unit    - (IN) Unit number.
  31680  *      entry   - (IN) BCM field entry id.
  31681  *      data    - (IN) Qualifies on Class Id obtained from
  31682  SVP table.
  31683  *      mask    - (IN) Qualifier match mask.
  31684  * Returns:
  31685  *      BCM_E_XXX
  31686  * Notes:
  31687  */
  31688 int bcm_esw_field_qualify_MplsOamUpperLabelDataDrop(
  31689     int unit,
  31690     bcm_field_entry_t entry,
  31691     uint8 data,
  31692     uint8 mask)
  31693 {
  31694     int rv;                 /* Operation return status. */
  31695 
  31696     /* Input range check */
  31697     rv = _field_qualifier32_input_range_check(unit,
  31698             bcmFieldQualifyMplsOamUpperLabelDataDrop, entry,
  31699             (uint8 *)&data, sizeof (data));
  31700 
  31701     if (BCM_FAILURE(rv)) {
  31702         LOG_ERROR(BSL_LS_BCM_FP,
  31703                 (BSL_META_U(unit,
  31704                             "FP(unit %d) Error: data=%#x "
  31705                             "out-of-range\n"), unit, data));
  31706         return rv;
  31707     }
  31708 
  31709 
  31710     
  31711     FP_LOCK(unit);
  31712 
  31713     rv = _field_qualify32(unit, entry,
  31714             bcmFieldQualifyMplsOamUpperLabelDataDrop,
  31715             data, mask);
  31716     FP_UNLOCK(unit);
  31717     return (rv);
  31718 }
  31719 
  31720 /*
  31721  * Function:
  31722  *     bcm_esw_field_qualify_MplsOamUpperLabelDataDrop_get
  31723  * Purpose:
  31724  *      Get match criteria for bcmFieldQualifyMplsOamUpperLabelDataDrop
  31725  *      qualifier from the field entry.
  31726  * Parameters:
  31727  *      unit    - (IN)  Unit number.
  31728  *      entry   - (IN)  BCM field entry id.
  31729  *      data    - (OUT) Class Id obtained from SVP table.
  31730  *      mask    - (OUT) Qualifier match mask.
  31731  * Returns:
  31732  *      BCM_E_XXX
  31733  * Notes:
  31734  */
  31735 int bcm_esw_field_qualify_MplsOamUpperLabelDataDrop_get(
  31736     int unit,
  31737     bcm_field_entry_t entry,
  31738     uint8 *data,
  31739     uint8 *mask)
  31740 {
  31741     if ((data == NULL) || (mask == NULL)) {
  31742         return BCM_E_PARAM;
  31743     }
  31744 
  31745     /* Read qualifier match value and mask. */
  31746     BCM_IF_ERROR_RETURN(
  31747             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  31748                 bcmFieldQualifyMplsOamUpperLabelDataDrop,
  31749                 data, mask));
  31750 
  31751     return (BCM_E_NONE);
  31752 }
  31753 
  31754 /*
  31755  * Function:
  31756  *    bcm_esw_field_qualify_MplsOamGALExposed
  31757  * Purpose:
  31758  *      Set match criteria for bcmFieldQualifyMplsOamGALExposed
  31759  *      qualifier from the field entry.
  31760  * Parameters:
  31761  *      unit    - (IN) Unit number.
  31762  *      entry   - (IN) BCM field entry id.
  31763  *      data    - (IN) Qualifies MPLS OAM packets which has GAL Exposed.
  31764  *      mask    - (IN) Qualifier match mask.
  31765  * Returns:
  31766  *      BCM_E_XXX
  31767  * Notes:
  31768  */
  31769 int bcm_esw_field_qualify_MplsOamGALExposed(
  31770     int unit,
  31771     bcm_field_entry_t entry,
  31772     uint8 data,
  31773     uint8 mask)
  31774 {
  31775     int rv;                 /* Operation return status. */
  31776 
  31777     /* Input range check */
  31778     rv = _field_qualifier32_input_range_check(unit,
  31779             bcmFieldQualifyMplsOamGALExposed, entry,
  31780             (uint8 *)&data, sizeof (data));
  31781 
  31782     if (BCM_FAILURE(rv)) {
  31783         LOG_ERROR(BSL_LS_BCM_FP,
  31784                 (BSL_META_U(unit,
  31785                             "FP(unit %d) Error: data=%#x "
  31786                             "out-of-range\n"), unit, data));
  31787         return rv;
  31788     }
  31789 
  31790     
  31791     FP_LOCK(unit);
  31792 
  31793     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsOamGALExposed,
  31794             data, mask);
  31795     FP_UNLOCK(unit);
  31796     return (rv);
  31797 }
  31798 
  31799 /*
  31800  * Function:
  31801  *     bcm_esw_field_qualify_MplsOamGALExposed_get
  31802  * Purpose:
  31803  *      Get match criteria for bcmFieldQualifyMplsOamGALExposed
  31804  *      qualifier from the field entry.
  31805  * Parameters:
  31806  *      unit    - (IN)  Unit number.
  31807  *      entry   - (IN)  BCM field entry id.
  31808  *      data    - (OUT) MPLS OAM packets which has GAL Exposed.
  31809  *      mask    - (OUT) Qualifier match mask.
  31810  * Returns:
  31811  *      BCM_E_XXX
  31812  * Notes:
  31813  */
  31814 int bcm_esw_field_qualify_MplsOamGALExposed_get(
  31815     int unit,
  31816     bcm_field_entry_t entry,
  31817     uint8 *data,
  31818     uint8 *mask)
  31819 {
  31820     if ((data == NULL) || (mask == NULL)) {
  31821         return BCM_E_PARAM;
  31822     }
  31823 
  31824     /* Read qualifier match value and mask. */
  31825     BCM_IF_ERROR_RETURN(
  31826             _bcm_field_entry_qualifier_uint8_get(unit, entry,
  31827                 bcmFieldQualifyMplsOamGALExposed,
  31828                 data, mask));
  31829 
  31830     return (BCM_E_NONE);
  31831 }
  31832 
  31833 /*
  31834  * Function:
  31835  *    bcm_esw_field_qualify_MplsOamACH
  31836  * Purpose:
  31837  *      Set match criteria for bcmFieldQualifyMplsOamACH
  31838  *      qualifier from the field entry.
  31839  * Parameters:
  31840  *      unit    - (IN) Unit number.
  31841  *      entry   - (IN) BCM field entry id.
  31842  *      data    - (IN) Qualifies MPLS OAM ACH Header.
  31843  *      mask    - (IN) Qualifier match mask.
  31844  * Returns:
  31845  *      BCM_E_XXX
  31846  * Notes:
  31847  */
  31848 int bcm_esw_field_qualify_MplsOamACH(
  31849     int unit,
  31850     bcm_field_entry_t entry,
  31851     uint32 data,
  31852     uint32 mask)
  31853 {
  31854     int rv;                 /* Operation return status. */
  31855 
  31856     /* Input range check */
  31857     rv = _field_qualifier32_input_range_check(unit,
  31858             bcmFieldQualifyMplsOamACH, entry,
  31859             (uint8 *)&data, sizeof (data));
  31860 
  31861     if (BCM_FAILURE(rv)) {
  31862         LOG_ERROR(BSL_LS_BCM_FP,
  31863                 (BSL_META_U(unit,
  31864                             "FP(unit %d) Error: data=%#x "
  31865                             "out-of-range\n"), unit, data));
  31866         return rv;
  31867     }
  31868 
  31869     
  31870     FP_LOCK(unit);
  31871 
  31872     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsOamACH,
  31873             data, mask);
  31874     FP_UNLOCK(unit);
  31875     return (rv);
  31876 }
  31877 
  31878 /*
  31879  * Function:
  31880  *     bcm_esw_field_qualify_MplsOamACH_get
  31881  * Purpose:
  31882  *      Get match criteria for bcmFieldQualifyMplsOamACH
  31883  *      qualifier from the field entry.
  31884  * Parameters:
  31885  *      unit    - (IN)  Unit number.
  31886  *      entry   - (IN)  BCM field entry id.
  31887  *      data    - (OUT) MPLS OAM ACH Header.
  31888  *      mask    - (OUT) Qualifier match mask.
  31889  * Returns:
  31890  *      BCM_E_XXX
  31891  * Notes:
  31892  */
  31893 int bcm_esw_field_qualify_MplsOamACH_get(
  31894     int unit,
  31895     bcm_field_entry_t entry,
  31896     uint32 *data,
  31897     uint32 *mask)
  31898 {
  31899     if ((data == NULL) || (mask == NULL)) {
  31900         return BCM_E_PARAM;
  31901     }
  31902 
  31903     /* Read qualifier match value and mask. */
  31904     BCM_IF_ERROR_RETURN(
  31905             _bcm_field_entry_qualifier_uint32_get(unit, entry,
  31906                 bcmFieldQualifyMplsOamACH,
  31907                 data, mask));
  31908 
  31909     return (BCM_E_NONE);
  31910 }
  31911 
  31912 /*
  31913  * Function:
  31914  *    bcm_esw_field_qualify_MplsOamControlPktType
  31915  * Purpose:
  31916  *      Set match criteria for bcmFieldQualifyMplsOamControlPktType
  31917  *      qualifier from the field entry.
  31918  * Parameters:
  31919  *      unit    - (IN) Unit number.
  31920  *      entry   - (IN) BCM field entry id.
  31921  *      data    - (IN) Qualify the MPLS OAM Control Packets
  31922                        based on packet type.
  31923  *      mask    - (IN) Qualifier match mask.
  31924  * Returns:
  31925  *      BCM_E_XXX
  31926  * Notes:
  31927  */
  31928 int bcm_esw_field_qualify_MplsOamControlPktType(
  31929     int unit,
  31930     bcm_field_entry_t entry,
  31931     bcm_field_MplsOam_Control_pktType_t data)
  31932 {
  31933     int rv;                 /* Operation return status. */
  31934     uint32 mask = 0;
  31935 
  31936     
  31937     FP_LOCK(unit);
  31938 
  31939     mask = BCM_FIELD_EXACT_MATCH_MASK;
  31940 
  31941     rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsOamControlPktType,
  31942             data, mask);
  31943     FP_UNLOCK(unit);
  31944     return (rv);
  31945 }
  31946 
  31947 /*
  31948  * Function:
  31949  *     bcm_esw_field_qualify_MplsOamControlPktType_get
  31950  * Purpose:
  31951  *      Get match criteria for bcmFieldQualifyMplsOamControlPktType
  31952  *      qualifier from the field entry.
  31953  * Parameters:
  31954  *      unit    - (IN)  Unit number.
  31955  *      entry   - (IN)  BCM field entry id.
  31956  *      data    - (OUT) MPLS OAM Control Packets based on packet type.
  31957  *      mask    - (OUT) Qualifier match mask.
  31958  * Returns:
  31959  *      BCM_E_XXX
  31960  * Notes:
  31961  */
  31962 
  31963 int bcm_esw_field_qualify_MplsOamControlPktType_get(
  31964     int unit,
  31965     bcm_field_entry_t entry,
  31966     bcm_field_MplsOam_Control_pktType_t *data)
  31967 {
  31968     uint32 mask = 0;
  31969     int rv = BCM_E_NONE;
  31970 
  31971     if (data == NULL) {
  31972         return BCM_E_PARAM;
  31973     }
  31974 
  31975     /* Read qualifier match value and mask. */
  31976     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  31977             bcmFieldQualifyMplsOamControlPktType,
  31978             data, &mask);
  31979 
  31980     if (mask == 0) {
  31981         return BCM_E_NOT_FOUND;
  31982     }
  31983 
  31984     return (rv);
  31985 }
  31986 
  31987 /*
  31988  * Function:
  31989  *     bcm_esw_field_qualify_MplsOamClassMplsSwitchLabel
  31990  * Purpose:
  31991  *      Set match criteria for bcmFieldQualifyMplsOamClassMpls
  31992  *      qualifier from the field entry.
  31993  * Parameters:
  31994  *      unit    - (IN) Unit number.
  31995  *      entry   - (IN) BCM field entry id.
  31996  *      data    - (IN) Qualifies on Class Id obtained from 
  31997                        MPLS_ENTRY table.
  31998  *      mask    - (IN) Qualifier match mask.
  31999  * Returns:
  32000  *      BCM_E_XXX
  32001  * Notes:
  32002  */
  32003 int bcm_esw_field_qualify_MplsOamClassMplsSwitchLabel(
  32004     int unit,
  32005     bcm_field_entry_t entry,
  32006     uint16 data,
  32007     uint16 mask)
  32008 {
  32009     int rv;                 /* Operation return status. */
  32010 
  32011     /* Input range check */
  32012     rv = _field_qualifier32_input_range_check(unit,
  32013                 bcmFieldQualifyMplsOamClassMplsSwitchLabel, entry,
  32014                 (uint8 *)&data, sizeof (data));
  32015     if (BCM_FAILURE(rv)) {
  32016         LOG_ERROR(BSL_LS_BCM_FP,
  32017                 (BSL_META_U(unit,
  32018                             "FP(unit %d) Error: data=%#x "
  32019                             "out-of-range\n"), unit, data));
  32020         return rv;
  32021     }
  32022 
  32023     
  32024     FP_LOCK(unit);
  32025 
  32026     rv = _field_qualify32(unit, entry,
  32027             bcmFieldQualifyMplsOamClassMplsSwitchLabel,
  32028             data, mask);
  32029     FP_UNLOCK(unit);
  32030     return (rv);
  32031 }
  32032 
  32033 /*
  32034  * Function:
  32035  *     bcm_esw_field_qualify_MplsOamClassMplsSwitchLabel_get
  32036  * Purpose:
  32037  *      Get match criteria for bcmFieldQualifyMplsOamClassMpls
  32038  *      qualifier from the field entry.
  32039  * Parameters:
  32040  *      unit    - (IN)  Unit number.
  32041  *      entry   - (IN)  BCM field entry id.
  32042  *      data    - (OUT) Class Id obtained from MPLS_ENTRY table.
  32043  *      mask    - (OUT) Qualifier match mask.
  32044  * Returns:
  32045  *      BCM_E_XXX
  32046  * Notes:
  32047  */
  32048 int bcm_esw_field_qualify_MplsOamClassMplsSwitchLabel_get(
  32049     int unit,
  32050     bcm_field_entry_t entry,
  32051     uint16 *data,
  32052     uint16 *mask)
  32053 {
  32054     if ((data == NULL) || (mask == NULL)) {
  32055         return BCM_E_PARAM;
  32056     }
  32057 
  32058     /* Read qualifier match value and mask. */
  32059     BCM_IF_ERROR_RETURN(
  32060             _bcm_field_entry_qualifier_uint16_get(unit, entry,
  32061                 bcmFieldQualifyMplsOamClassMplsSwitchLabel,
  32062                 data, mask));
  32063 
  32064     return (BCM_E_NONE);
  32065 }
  32066 
  32067 /*
  32068  * Function:
  32069  *      bcm_esw_field_qset_id_multi_set
  32070  * Purpose:
  32071  *      Add qualifier objects to field group qset.
  32072  * Parameters:
  32073  *      unit                - (IN) Unit number.
  32074  *      qualifier           - (IN) Type of objects.
  32075  *      num_objects         - (IN)  Number of objects.
  32076  *      object_list         - (IN)  Number of objects (Ex; UDF ids).
  32077  *      qset                - (OUT) Qualifier set.
  32078  * Returns:
  32079  *      BCM_E_xxx
  32080  * Notes:
  32081  */
  32082 int
  32083 bcm_esw_field_qset_id_multi_set(
  32084     int unit,
  32085     bcm_field_qualify_t qualifier,
  32086     int num_objects,
  32087     int objects_list[],
  32088     bcm_field_qset_t *qset
  32089     )
  32090 {
  32091 
  32092     FIELD_IS_INIT(unit);
  32093 
  32094     /* Input parameters check. */
  32095     if (NULL == qset) {
  32096         return (BCM_E_PARAM);
  32097     }
  32098 
  32099     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  32100         _field_control_t *fc;
  32101         int rv = BCM_E_UNAVAIL;
  32102 
  32103         _BCM_UDF_INIT_CHECK(unit);
  32104 
  32105         FP_LOCK(unit);
  32106         rv = _field_control_get(unit, &fc);
  32107         if (BCM_FAILURE(rv)) {
  32108             FP_UNLOCK(unit);
  32109             return rv;
  32110         }
  32111   
  32112         if (fc->functions.fp_qset_id_multi_set != NULL) {
  32113            _BCM_UDF_LOCK(unit);  
  32114            rv = fc->functions.fp_qset_id_multi_set(unit, qualifier,
  32115                                                    num_objects,
  32116                                                    objects_list,
  32117                                                    qset);
  32118            _BCM_UDF_UNLOCK(unit);  
  32119         }
  32120         FP_UNLOCK(unit);
  32121         return (rv);
  32122     }
  32123 
  32124 #if defined(BCM_TRIUMPH2_SUPPORT)
  32125     UDF_INIT_CHECK(unit);
  32126     if (soc_feature(unit, soc_feature_udf_support)) {
  32127         if (qualifier == bcmFieldQualifyUdf) {
  32128             return bcmi_xgs4_field_qset_udf_id_multi_set(unit, 
  32129                      num_objects, objects_list, qset);
  32130         }
  32131     }
  32132 #endif /* BCM_TRIUMPH2_SUPPORT */
  32133 
  32134     return (BCM_E_UNAVAIL);
  32135 }
  32136 
  32137 /*
  32138  * Function:
  32139  *      bcm_esw_field_qset_id_multi_get
  32140  * Purpose:
  32141  *      Get qualifier objects added to the field group qset.
  32142  * Parameters:
  32143  *      unit                - (IN)  Unit number.
  32144  *      qset                - (IN)  Qualifier set.
  32145  *      max                 - (IN)  Max number of objects.
  32146  *      object_list         - (OUT) List of objects (Ex; UDF ids).
  32147  *      actual              - (OUT) Number of objects.
  32148  * Returns:
  32149  *      BCM_E_xxx
  32150  * Notes:
  32151  */
  32152 int
  32153 bcm_esw_field_qset_id_multi_get(
  32154     int unit,
  32155     bcm_field_qset_t qset,
  32156     bcm_field_qualify_t qualifier,
  32157     int max,
  32158     int *objects_list,
  32159     int *actual
  32160     )
  32161 {
  32162     FIELD_IS_INIT(unit);
  32163 
  32164     if (actual == NULL) {
  32165         return BCM_E_PARAM;
  32166     }
  32167 
  32168     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  32169         _field_control_t *fc;
  32170         int rv = BCM_E_UNAVAIL;
  32171 
  32172         _BCM_UDF_INIT_CHECK(unit);
  32173 
  32174         FP_LOCK(unit);
  32175         rv = _field_control_get(unit, &fc);
  32176         if (BCM_FAILURE(rv)) {
  32177             FP_UNLOCK(unit);
  32178             return rv;
  32179         }
  32180   
  32181         if (fc->functions.fp_qset_id_multi_get != NULL) {
  32182            _BCM_UDF_LOCK(unit);  
  32183            rv = fc->functions.fp_qset_id_multi_get(unit,
  32184                                                    qset,
  32185                                                    qualifier,
  32186                                                    max,
  32187                                                    objects_list,
  32188                                                    actual);
  32189            _BCM_UDF_UNLOCK(unit);  
  32190         }
  32191         FP_UNLOCK(unit);
  32192         return (rv);
  32193     }
  32194 
  32195 #if defined (BCM_TRIUMPH2_SUPPORT)
  32196     UDF_INIT_CHECK(unit);
  32197     if (soc_feature(unit, soc_feature_udf_support)) {
  32198         if (qualifier == bcmFieldQualifyUdf) {
  32199             return bcmi_xgs4_field_qset_udf_id_multi_get(unit, qset, max,
  32200                                                          objects_list, actual);
  32201         }
  32202     }
  32203 #endif /* BCM_TRIUMPH2_SUPPORT */
  32204 
  32205     return (BCM_E_UNAVAIL);
  32206 
  32207 }
  32208 
  32209 
  32210 /*
  32211  * Function:
  32212  *      bcm_esw_field_qset_id_multi_delete
  32213  * Purpose:
  32214  *      Delete qualifier objects to field group qset.
  32215  * Parameters:
  32216  *      unit                - (IN)  Unit number.
  32217  *      num_objects         - (IN)  Number of objects.
  32218  *      object_list         - (IN)  List of objects (Ex; UDF ids).
  32219  *      qset                - (OUT) Qualifier set.
  32220  * Returns:
  32221  *      BCM_E_xxx
  32222  * Notes:
  32223  */
  32224 int
  32225 bcm_esw_field_qset_id_multi_delete(
  32226     int unit,
  32227     bcm_field_qualify_t qualifier,
  32228     int num_objects,
  32229     int objects_list[],
  32230     bcm_field_qset_t *qset
  32231     )
  32232 {
  32233     FIELD_IS_INIT(unit);
  32234 
  32235     if (qset == NULL) {
  32236         return BCM_E_PARAM;
  32237     }
  32238 
  32239     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  32240         _field_control_t *fc;
  32241         int rv = BCM_E_UNAVAIL;
  32242 
  32243         _BCM_UDF_INIT_CHECK(unit);
  32244 
  32245         FP_LOCK(unit);
  32246         rv = _field_control_get(unit, &fc);
  32247         if (BCM_FAILURE(rv)) {
  32248             FP_UNLOCK(unit);
  32249             return rv;
  32250         }
  32251   
  32252         if (fc->functions.fp_qset_id_multi_delete != NULL) {
  32253            _BCM_UDF_LOCK(unit);  
  32254            rv = fc->functions.fp_qset_id_multi_delete(unit,
  32255                                                       qualifier,
  32256                                                       num_objects,
  32257                                                       objects_list,
  32258                                                       qset);
  32259            _BCM_UDF_UNLOCK(unit);  
  32260         }
  32261         FP_UNLOCK(unit);
  32262         return (rv);
  32263     }
  32264 
  32265 #if defined (BCM_TRIUMPH2_SUPPORT)
  32266     UDF_INIT_CHECK(unit);
  32267     if (soc_feature(unit, soc_feature_udf_support)) {
  32268         if (qualifier == bcmFieldQualifyUdf) {
  32269             return bcmi_xgs4_field_qset_udf_id_multi_delete(unit, num_objects,
  32270                                                             objects_list, qset);
  32271         }
  32272     }
  32273 #endif /* BCM_TRIUMPH2_SUPPORT */
  32274 
  32275     return (BCM_E_UNAVAIL);
  32276 }
  32277 
  32278 /*
  32279  * Function:
  32280  *      bcm_esw_field_qualify_udf
  32281  * Purpose:
  32282  *      Add UDF data that the packet must match to trigger qualifier.
  32283  * Parameters:
  32284  *      unit            - (IN)  Unit number.
  32285  *      eid             - (IN)  Field Entry.
  32286  *      udf_id          - (IN)  UDF ID.
  32287  *      length          - (IN)  Number of bytes to match in field entry.
  32288  *      data            - (IN)  Input data to qualify the entry.
  32289  *      mask            - (IN)  Input mask to qualify the entry.
  32290  * Returns:
  32291  *      BCM_E_xxx
  32292  * Notes:
  32293  */
  32294 int
  32295 bcm_esw_field_qualify_udf(int unit, bcm_field_entry_t eid, bcm_udf_id_t udf_id,
  32296                           int length, uint8 *data, uint8 *mask)
  32297 {
  32298     int rv = BCM_E_UNAVAIL;
  32299 #if defined(BCM_TOMAHAWK3_SUPPORT)
  32300     _field_entry_t      *f_ent;      /* Field entry pointer.     */
  32301 #endif
  32302 
  32303     FIELD_IS_INIT(unit);
  32304 
  32305     /* Input parameters check. */
  32306     if ((NULL == data) || (NULL == mask)) {
  32307         return (BCM_E_PARAM);
  32308     }
  32309 
  32310     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  32311         _field_control_t *fc;
  32312         int rv = BCM_E_UNAVAIL;
  32313 
  32314         _BCM_UDF_INIT_CHECK(unit);
  32315 
  32316         FP_LOCK(unit);
  32317         rv = _field_control_get(unit, &fc);
  32318         if (BCM_FAILURE(rv)) {
  32319             FP_UNLOCK(unit);
  32320             return rv;
  32321         }
  32322   
  32323         if (fc->functions.fp_qualify_udf != NULL) {
  32324            _BCM_UDF_LOCK(unit);  
  32325            rv = fc->functions.fp_qualify_udf(unit, eid, udf_id,
  32326                                             length, data, mask);
  32327            _BCM_UDF_UNLOCK(unit);  
  32328         }
  32329         FP_UNLOCK(unit);
  32330         return (rv);
  32331     }
  32332 
  32333     
  32334 #if defined(BCM_TOMAHAWK3_SUPPORT)
  32335     FP_LOCK(unit);
  32336     /* Get field entry structure pointer. */
  32337     rv = _field_entry_get(unit, eid, _FP_ENTRY_PRIMARY, &f_ent);
  32338     if (BCM_FAILURE(rv)) {
  32339         FP_UNLOCK(unit);
  32340         return rv;
  32341     }
  32342 
  32343     UDF_INIT_CHECK(unit);
  32344     if (soc_feature(unit, soc_feature_udf_selector_support) &&
  32345         ((f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) ||
  32346         (f_ent->group->stage_id == _BCM_FIELD_STAGE_LOOKUP) ||
  32347          (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXACTMATCH))) {
  32348         UDF_LOCK(unit);
  32349         rv = _bcm_field_th3_qualify_udf(unit, eid, udf_id,
  32350                                         length, data, mask);
  32351         FP_UNLOCK(unit);
  32352         UDF_UNLOCK(unit);
  32353         return rv;
  32354 
  32355     } else {
  32356         FP_UNLOCK(unit);
  32357     }
  32358 #endif /* BCM_TOMAHAWK3_SUPPORT */
  32359 
  32360 #if defined(BCM_TRIUMPH2_SUPPORT)
  32361     UDF_INIT_CHECK(unit);
  32362     if (soc_feature(unit, soc_feature_udf_support)) {
  32363         return bcmi_xgs4_field_qualify_udf_data(unit, eid, udf_id,
  32364                                               length, data, mask);
  32365     }
  32366 #endif /* BCM_TRIUMPH2_SUPPORT */
  32367 
  32368     return rv;
  32369 }
  32370 
  32371 /*
  32372  * Function:
  32373  *      bcm_esw_field_qualify_udf_get
  32374  * Purpose:
  32375  *      Get data/mask qualified on an entry corresponding to a UDF ID.
  32376  * Parameters:
  32377  *      unit            - (IN)  Unit number.
  32378  *      eid             - (IN)  Field Entry.
  32379  *      udf_id          - (IN)  UDF ID.
  32380  *      max_length      - (IN)  Length of bytes of data/mask to fetch.
  32381  *      data            - (OUT) Data to qualify the entry.
  32382  *      mask            - (OUT  Mask to qualify the entry.
  32383  *      actual_length   - (OUT) Length of bytes of data/mask fetched.
  32384  * Returns:
  32385  *      BCM_E_XXX
  32386  * Notes:
  32387  */
  32388 int
  32389 bcm_esw_field_qualify_udf_get(int unit, bcm_field_entry_t eid,
  32390                               bcm_udf_id_t udf_id, int max_length,
  32391                               uint8 *data, uint8 *mask, int *actual_length)
  32392 {
  32393     int rv = BCM_E_UNAVAIL;
  32394 #if defined(BCM_TOMAHAWK3_SUPPORT)
  32395     _field_entry_t      *f_ent;      /* Field entry pointer.     */
  32396 #endif
  32397 
  32398     FIELD_IS_INIT(unit);
  32399 
  32400     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  32401         _field_control_t *fc;
  32402         int rv = BCM_E_UNAVAIL;
  32403 
  32404         _BCM_UDF_INIT_CHECK(unit);
  32405 
  32406         FP_LOCK(unit);
  32407         rv = _field_control_get(unit, &fc);
  32408         if (BCM_FAILURE(rv)) {
  32409             FP_UNLOCK(unit);
  32410             return rv;
  32411         }
  32412   
  32413         if (fc->functions.fp_qualify_udf_get != NULL) {
  32414            _BCM_UDF_LOCK(unit);  
  32415            rv = fc->functions.fp_qualify_udf_get(unit, eid, udf_id,
  32416                                                  max_length, data, mask,
  32417                                                  actual_length);
  32418            _BCM_UDF_UNLOCK(unit);  
  32419         }
  32420         FP_UNLOCK(unit);
  32421         return (rv);
  32422     }
  32423 
  32424 #if defined (BCM_TOMAHAWK3_SUPPORT)
  32425     FP_LOCK(unit);
  32426     /* Get field entry structure pointer. */
  32427     rv = _field_entry_get(unit, eid, _FP_ENTRY_PRIMARY, &f_ent);
  32428     if (BCM_FAILURE(rv)) {
  32429         FP_UNLOCK(unit);
  32430         return rv;
  32431     }
  32432 
  32433     UDF_INIT_CHECK(unit);
  32434     if (soc_feature(unit, soc_feature_udf_selector_support) &&
  32435         ((f_ent->group->stage_id == _BCM_FIELD_STAGE_INGRESS) ||
  32436         (f_ent->group->stage_id == _BCM_FIELD_STAGE_LOOKUP) ||
  32437          (f_ent->group->stage_id == _BCM_FIELD_STAGE_EXACTMATCH))) {
  32438 
  32439         UDF_LOCK(unit);
  32440         rv = _bcm_field_th3_qualify_udf_get(unit, eid, udf_id, max_length,
  32441                                                data, mask, actual_length);
  32442         FP_UNLOCK(unit);
  32443         UDF_UNLOCK(unit);
  32444         return rv;
  32445 
  32446     } else {
  32447         FP_UNLOCK(unit);
  32448     }
  32449 #endif /* BCM_TOMAHAWK3_SUPPORT */
  32450 
  32451 #if defined (BCM_TRIUMPH2_SUPPORT)
  32452     UDF_INIT_CHECK(unit);
  32453     if (soc_feature(unit, soc_feature_udf_support)) {
  32454         return bcmi_xgs4_field_qualify_udf_get(unit, eid, udf_id, max_length,
  32455                                                data, mask, actual_length);
  32456     }
  32457 #endif /* BCM_TRIUMPH2_SUPPORT */
  32458 
  32459     return rv;
  32460 }
  32461 
  32462 /*
  32463  * Function:
  32464  *      bcm_esw_field_qualify_SrcVlanGports
  32465  * Purpose:
  32466  *      Add source vlan port field qualification to a field entry.
  32467  * Parameters:
  32468  *      unit - (IN) Unit number.
  32469  *      entry - (IN) Field Entry id.
  32470  *      vlan_port_id - (IN) Vlan virtual port id.
  32471  *      vlan_port_mask - (IN) Vlan virtual port id mask.
  32472  * Returns:
  32473  *      BCM_E_XXX
  32474  * Notes:
  32475  */
  32476 int bcm_esw_field_qualify_SrcVlanGports(
  32477     int unit,
  32478     bcm_field_entry_t entry,
  32479     bcm_gport_t vlan_port_id,
  32480     bcm_gport_t vlan_port_mask)
  32481 {
  32482 #if defined(BCM_TOMAHAWK_SUPPORT)
  32483     _field_control_t *fc;   /* Field control structure. */
  32484 #endif
  32485     _field_group_t *fg;     /* Field group structure    */
  32486     uint32 data = 0;        /* HW data match criteria.  */
  32487     uint32 mask = 0;        /* HW data mask.            */
  32488     int rv;                 /* Operation return status. */
  32489     int ingress_entity = 0; /* Ingress entity or source entity */
  32490     int i;
  32491 
  32492     /* Input parameters check. */
  32493     if (0 == BCM_GPORT_IS_VLAN_PORT(vlan_port_id)) {
  32494         return (BCM_E_PARAM);
  32495     }
  32496 
  32497     if (vlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32498         if (0 == BCM_GPORT_IS_VLAN_PORT(vlan_port_mask)) {
  32499             return (BCM_E_PARAM);
  32500         }
  32501     }
  32502 
  32503     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
  32504 
  32505     /* Get the source virtual port value and mask*/
  32506     data  = BCM_GPORT_VLAN_PORT_ID_GET(vlan_port_id);
  32507 
  32508     if (vlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32509         mask  = BCM_GPORT_VLAN_PORT_ID_GET(vlan_port_mask);
  32510     } else {
  32511         mask = BCM_FIELD_EXACT_MATCH_MASK;
  32512     }
  32513 
  32514     
  32515 #if defined(BCM_TOMAHAWK_SUPPORT)
  32516     /*
  32517      * Invoke driver function for multi pipe supported devices.
  32518      */ 
  32519     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  32520         FP_LOCK(unit);
  32521         rv = _field_control_get(unit, &fc);
  32522         if (BCM_FAILURE(rv)) {
  32523             FP_UNLOCK(unit);
  32524             return rv;
  32525         }
  32526         rv = fc->functions.fp_qualify_svp(unit, entry,
  32527                                           bcmFieldQualifySrcVlanGports,
  32528                                           data, mask, 1);
  32529         FP_UNLOCK(unit);
  32530         return (rv);
  32531     }
  32532 #endif /* BCM_TOMAHAWK_SUPPORT */
  32533 
  32534     /* Check which configuration of SrcVlanGport is in use */
  32535     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
  32536         if (fg->sel_codes[i].ingress_entity_sel ==
  32537                    _bcmFieldFwdEntityVlanGport) {
  32538             ingress_entity = 1;
  32539             break;
  32540         }
  32541     }
  32542 
  32543     FP_LOCK(unit);
  32544 
  32545     if (ingress_entity) {
  32546         /* Internal qualifier to set SVP valid bit in Fixed field */
  32547         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
  32548         if (BCM_FAILURE(rv)) {
  32549             FP_UNLOCK(unit);
  32550             return (rv);
  32551         }
  32552     }
  32553 
  32554     /* Qualify Vlan Source Virtual Port */
  32555     /* In Stage Lookup bcmFieldQualifySrcVlanGports = 20 bits
  32556        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
  32557        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp
  32558        ==> data = svp_valid|s_type_sel|s_field
  32559      */
  32560     rv = _field_qualify_source_virtual_port(unit, entry,
  32561             bcmFieldQualifySrcVlanGports, data, mask, ingress_entity);
  32562 
  32563     FP_UNLOCK(unit);
  32564     return (rv);
  32565 }
  32566 
  32567 
  32568 /*
  32569  * Function:
  32570  *      bcm_esw_field_qualify_SrcVlanGports_get
  32571  * Purpose:
  32572  *      Get match criteria for bcmFieildQualifySrcVlanGports
  32573  *                     qualifier from the field entry.
  32574  * Parameters:
  32575  *      unit - (IN) Unit number.
  32576  *      entry - (IN) BCM field entry id.
  32577  *      vlan_port_id - (OUT) Vlan port id.
  32578  *      vlan_port_mask - (OUT) Vlan port mask.
  32579  * Returns:
  32580  *      BCM_E_XXX
  32581  * Notes:
  32582  */
  32583 int bcm_esw_field_qualify_SrcVlanGports_get(
  32584     int unit,
  32585     bcm_field_entry_t entry,
  32586     bcm_gport_t *vlan_port_id,
  32587     bcm_gport_t *vlan_port_mask)
  32588 {
  32589     uint32 data = 0;   /* HW encoded qualifier data.  */
  32590     uint32 mask = 0;   /* HW encoding qualifier mask. */
  32591     int rv;        /* Operation return status.    */
  32592 
  32593     /* Input parameters check. */
  32594     if (NULL == vlan_port_id) {
  32595         return (BCM_E_PARAM);
  32596     }
  32597 
  32598     /* Read qualifier match value and mask. */
  32599     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  32600                                            bcmFieldQualifySrcVlanGports,
  32601                                            &data, &mask);
  32602     BCM_IF_ERROR_RETURN(rv);
  32603 
  32604     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  32605        data &=  0x1fff;
  32606     }
  32607     BCM_GPORT_VLAN_PORT_ID_SET(*vlan_port_id, data);
  32608     BCM_GPORT_VLAN_PORT_ID_SET(*vlan_port_mask, mask);
  32609 
  32610     return BCM_E_NONE;
  32611 }
  32612 
  32613 /*
  32614  * Function:
  32615  *      bcm_esw_field_qualify_DstVlanGports
  32616  * Purpose:
  32617  *      Add destination vlan port field qualification to a field entry.
  32618  * Parameters:
  32619  *      unit - (IN) Unit number.
  32620  *      entry - (IN) Field Entry id.
  32621  *      vlan_port_id - (IN) Vlan virtual port id.
  32622  *      vlan_port_mask - (IN) Vlan virtual port id mask.
  32623  * Returns:
  32624  *      BCM_E_XXX
  32625  * Notes:
  32626  */
  32627 int bcm_esw_field_qualify_DstVlanGports(
  32628     int unit,
  32629     bcm_field_entry_t entry,
  32630     bcm_gport_t vlan_port_id,
  32631     bcm_gport_t vlan_port_mask)
  32632 {
  32633 #if defined(BCM_TOMAHAWK_SUPPORT)
  32634     _field_control_t *fc;   /* Field control structure. */
  32635 #endif
  32636     uint32 data = 0;        /* HW data match criteria.  */
  32637     uint32 mask = 0;        /* HW data mask.            */
  32638     int rv;                 /* Operation return status. */
  32639     _field_entry_t *f_ent;  /* Field entry structure.   */
  32640 
  32641     /* Input parameters check. */
  32642     if (0 == BCM_GPORT_IS_VLAN_PORT(vlan_port_id)) {
  32643         return (BCM_E_PARAM);
  32644     }
  32645 
  32646     if (vlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32647         if (0 == BCM_GPORT_IS_VLAN_PORT(vlan_port_mask)) {
  32648             return (BCM_E_PARAM);
  32649         }
  32650     }
  32651 
  32652     data  = BCM_GPORT_VLAN_PORT_ID_GET(vlan_port_id);
  32653 
  32654     if (vlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32655         mask  = BCM_GPORT_VLAN_PORT_ID_GET(vlan_port_mask);
  32656     } else {
  32657         mask = BCM_FIELD_EXACT_MATCH_MASK;
  32658     }
  32659 
  32660     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  32661                         bcmFieldQualifyDstVlanGports, &f_ent));
  32662     /*
  32663      * Invoke driver function for multi pipe supported devices.
  32664      */
  32665      
  32666 #if defined(BCM_TOMAHAWK_SUPPORT)
  32667      if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  32668          (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id)) {
  32669         FP_LOCK(unit);
  32670         rv = _field_control_get(unit, &fc);
  32671         if (BCM_FAILURE(rv)) {
  32672             FP_UNLOCK(unit);
  32673             return rv;
  32674         }
  32675         rv = fc->functions.fp_qualify_dvp(unit, entry,
  32676                                           bcmFieldQualifyDstVlanGports,
  32677                                           data, mask, 1);
  32678         FP_UNLOCK(unit);
  32679         return (rv);
  32680      }
  32681 #endif /* BCM_TOMAHAWK_SUPPORT */
  32682 
  32683 
  32684     FP_LOCK(unit);
  32685 
  32686     /* Check if entry belongs to Egress Stage. */
  32687     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  32688         /*
  32689          * LSB is DVP valid bit.
  32690          * Shift DVP value by 1-bit ,
  32691          */
  32692         data <<= 1;
  32693 
  32694         /* Set DVP Valid bit. */
  32695         data |= 1;
  32696 
  32697         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32698             mask <<= 1;
  32699             mask |=1;
  32700         }
  32701     } else {
  32702         /* Qualify the destination type qualifier */
  32703         rv = _field_dest_type_qualify(unit, entry,
  32704                                       bcmFieldQualifyDstVlanGports, 
  32705                                       &data, &mask, 
  32706                                       _bcmFieldDestTypeNone);
  32707         if (BCM_FAILURE(rv)) {
  32708             FP_UNLOCK(unit);
  32709             return (rv);
  32710         }
  32711     }
  32712 
  32713     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstVlanGports,
  32714                           data, mask);
  32715 
  32716     FP_UNLOCK(unit);
  32717     return (rv);
  32718 }
  32719 
  32720 /*
  32721  * Function:
  32722  *      bcm_esw_field_qualify_DstVlanGports_get
  32723  * Purpose:
  32724  *      Get match criteria for bcmFieildQualifyDstVlanGports
  32725  *                     qualifier from the field entry.
  32726  * Parameters:
  32727  *      unit - (IN) Unit number.
  32728  *      entry - (IN) BCM field entry id.
  32729  *      vlan_port_id - (OUT) Vlan port id.
  32730  *      vlan_port_mask - (OUT) Vlan port mask.
  32731  * Returns:
  32732  *      BCM_E_XXX
  32733  * Notes:
  32734  */
  32735 int bcm_esw_field_qualify_DstVlanGports_get(
  32736     int unit,
  32737     bcm_field_entry_t entry,
  32738     bcm_gport_t *vlan_port_id,
  32739     bcm_gport_t *vlan_port_mask)
  32740 {
  32741     uint32 data = 0;       /* HW encoded qualifier data.  */
  32742     uint32 mask = 0;       /* HW encoding qualifier mask. */
  32743     int rv;                /* Operation return status.    */
  32744     _field_entry_t *f_ent; /* Field entry structure. */
  32745 
  32746     /* Input parameters check. */
  32747     if ((NULL == vlan_port_id) || (NULL == vlan_port_mask)) {
  32748         return (BCM_E_PARAM);
  32749     }
  32750 
  32751     /* Read qualifier match value and mask. */
  32752     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  32753                                             bcmFieldQualifyDstVlanGports,
  32754                                             &data, &mask);
  32755     BCM_IF_ERROR_RETURN(rv);
  32756 
  32757     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  32758         bcmFieldQualifyDstVlanGports, &f_ent));
  32759 
  32760     /* Check if entry belongs to Egress Stage. */
  32761     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  32762          /* Clear DVP Valid bit. */
  32763          data >>= 1;
  32764         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32765             mask >>= 1;
  32766         }
  32767     } else {
  32768         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  32769             entry, bcmFieldQualifyDstVlanGports, &data, &mask));
  32770     }
  32771 
  32772     BCM_GPORT_VLAN_PORT_ID_SET(*vlan_port_id, data);
  32773     BCM_GPORT_VLAN_PORT_ID_SET(*vlan_port_mask, mask);
  32774 
  32775     return BCM_E_NONE;
  32776 }
  32777 
  32778 /*
  32779  * Function:
  32780  *      bcm_esw_field_qualify_SrcVxlanGports
  32781  * Purpose:
  32782  *      Add source vxlan port field qualification to a field entry.
  32783  * Parameters:
  32784  *      unit - (IN) Unit number.
  32785  *      entry - (IN) Field Entry id.
  32786  *      vxlan_port_id - (IN) Vxlan virtual port id.
  32787  *      vxlan_port_mask - (IN) Vxlan virtual port id mask.
  32788  * Returns:
  32789  *      BCM_E_XXX
  32790  * Notes:
  32791  */
  32792 int bcm_esw_field_qualify_SrcVxlanGports(
  32793     int unit,
  32794     bcm_field_entry_t entry,
  32795     bcm_gport_t vxlan_port_id,
  32796     bcm_gport_t vxlan_port_mask)
  32797 {
  32798 #if defined(BCM_TOMAHAWK_SUPPORT)
  32799     _field_control_t *fc;   /* Field control structure. */
  32800 #endif
  32801     _field_group_t *fg;     /* Field group structure    */
  32802     _field_entry_t *f_ent = NULL;  /* Field entry structure.   */
  32803     uint32 data = 0;        /* HW data match criteria.  */
  32804     uint32 mask = 0;        /* HW data mask.            */
  32805     int rv;                 /* Operation return status. */
  32806     int ingress_entity = 0; /* Ingress entity or source entity */
  32807     int i;
  32808 
  32809     /* Input parameters check. */
  32810     if (0 == BCM_GPORT_IS_VXLAN_PORT(vxlan_port_id)
  32811         && (0 == BCM_GPORT_IS_FLOW_PORT(vxlan_port_id))) {
  32812         return (BCM_E_PARAM);
  32813     }
  32814 
  32815     if (vxlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32816         if ((0 == BCM_GPORT_IS_VXLAN_PORT(vxlan_port_mask)
  32817             && (0 == BCM_GPORT_IS_FLOW_PORT(vxlan_port_mask)))) {
  32818             return (BCM_E_PARAM);
  32819         }
  32820     }
  32821 
  32822     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
  32823 
  32824     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  32825             bcmFieldQualifySrcVxlanGports, &f_ent));
  32826     /* Get the source virtual port value and mask*/
  32827 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  32828     if (soc_feature(unit, soc_feature_flex_flow)
  32829         && BCM_GPORT_IS_FLOW_PORT(vxlan_port_id)) {
  32830         data  = BCM_GPORT_FLOW_PORT_ID_GET(vxlan_port_id);
  32831         f_ent->svp_type = _bcmVpTypeFlow;
  32832         if (vxlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32833             mask = BCM_GPORT_FLOW_PORT_ID_GET(vxlan_port_mask);
  32834         } else {
  32835             /* Include all bits for Mask value */
  32836             mask = BCM_FIELD_EXACT_MATCH_MASK;
  32837         }
  32838     } else {
  32839         data  = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_id);
  32840         f_ent->svp_type = _bcmVpTypeVxlan;
  32841         if (vxlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32842             mask = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_mask);
  32843         } else {
  32844             /* Include all bits for Mask value */
  32845             mask = BCM_FIELD_EXACT_MATCH_MASK;
  32846         }
  32847     }
  32848 #else
  32849     data  = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_id);
  32850     if (vxlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  32851         mask = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_mask);
  32852     } else {
  32853         /* Include all bits for Mask value */
  32854         mask = BCM_FIELD_EXACT_MATCH_MASK;
  32855     }
  32856 #endif
  32857 
  32858 #if defined(BCM_TOMAHAWK_SUPPORT)
  32859     /*
  32860      * Invoke driver function for multi pipe supported devices.
  32861      */ 
  32862     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  32863         FP_LOCK(unit);
  32864         rv = _field_control_get(unit, &fc);
  32865         if (BCM_FAILURE(rv)) {
  32866             FP_UNLOCK(unit);
  32867             return rv;
  32868         }
  32869         rv = fc->functions.fp_qualify_svp(unit, entry,
  32870                                           bcmFieldQualifySrcVxlanGports,
  32871                                           data, mask, 1);
  32872         FP_UNLOCK(unit);
  32873         return (rv);
  32874     }
  32875 #endif /* BCM_TOMAHAWK_SUPPORT */
  32876 
  32877     /* Check which configuration of SrcVlanGport is in use */
  32878     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
  32879         if (fg->sel_codes[i].ingress_entity_sel ==
  32880                     _bcmFieldFwdEntityVxlanGport) {
  32881             ingress_entity = 1;
  32882             break;
  32883         }
  32884     }
  32885 
  32886     FP_LOCK(unit);
  32887 
  32888     if (ingress_entity) {
  32889         /* Internal qualifier to set SVP valid bit in Fixed field */
  32890         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
  32891         if (BCM_FAILURE(rv)) {
  32892             FP_UNLOCK(unit);
  32893             return (rv);
  32894         }
  32895     }
  32896 
  32897     /* Qualify Vxlan Source Virtual Port */
  32898     /* In Stage Lookup bcmFieldQualifySrcVxlanGports = 20 bits
  32899        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
  32900        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp
  32901        ==> data = svp_valid|s_type_sel|s_field
  32902      */
  32903     rv = _field_qualify_source_virtual_port(unit, entry,
  32904             bcmFieldQualifySrcVxlanGports, data, mask, ingress_entity);
  32905 
  32906     FP_UNLOCK(unit);
  32907     return (rv);
  32908 }
  32909 
  32910 /*
  32911  * Function:
  32912  *      bcm_esw_field_qualify_SrcVxlanGports_get
  32913  * Purpose:
  32914  *      Get match criteria for bcmFieildQualifySrcVxlanGports
  32915  *                     qualifier from the field entry.
  32916  * Parameters:
  32917  *      unit - (IN) Unit number.
  32918  *      entry - (IN) BCM field entry id.
  32919  *      vxlan_port_id - (OUT) Vxlan port id.
  32920  *      vxlan_port_mask - (OUT) Vxlan port mask.
  32921  * Returns:
  32922  *      BCM_E_XXX
  32923  * Notes:
  32924  */
  32925 int bcm_esw_field_qualify_SrcVxlanGports_get(
  32926     int unit,
  32927     bcm_field_entry_t entry,
  32928     bcm_gport_t *vxlan_port_id,
  32929     bcm_gport_t *vxlan_port_mask)
  32930 {
  32931     uint32 data = 0;   /* HW encoded qualifier data.  */
  32932     uint32 mask = 0;   /* HW encoding qualifier mask. */
  32933     int rv;            /* Operation return status.    */
  32934     _field_entry_t *f_ent = NULL;  /* Field entry structure.   */
  32935 
  32936     /* Input parameters check. */
  32937     if (NULL == vxlan_port_id) {
  32938         return (BCM_E_PARAM);
  32939     }
  32940 
  32941     /* Read qualifier match value and mask. */
  32942     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  32943                                            bcmFieldQualifySrcVxlanGports,
  32944                                            &data, &mask);
  32945     BCM_IF_ERROR_RETURN(rv);
  32946 
  32947     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  32948        data &=  0x1fff;
  32949     }
  32950 
  32951     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  32952             bcmFieldQualifySrcVxlanGports, &f_ent));
  32953 
  32954 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  32955     switch (f_ent->svp_type) {
  32956         case _bcmVpTypeFlow :
  32957             BCM_GPORT_FLOW_PORT_ID_SET(*vxlan_port_id, data);
  32958             BCM_GPORT_FLOW_PORT_ID_SET(*vxlan_port_mask, mask);
  32959             break;
  32960         case _bcmVpTypeVxlan:
  32961             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  32962             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_mask, mask);
  32963             break;
  32964         default:
  32965             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  32966             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_mask, mask);
  32967     }
  32968 #else
  32969     BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  32970     BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_mask, mask);
  32971 #endif
  32972     return BCM_E_NONE;
  32973 }
  32974 
  32975 /*
  32976  * Function:
  32977  *      bcm_esw_field_qualify_DstVxlanGports
  32978  * Purpose:
  32979  *      Add destination vxlan port field qualification to a field entry.
  32980  * Parameters:
  32981  *      unit - (IN) Unit number.
  32982  *      entry - (IN) Field Entry id.
  32983  *      vxlan_port_id - (IN) Vxlan virtual port id.
  32984  *      vxlan_port_mask - (IN) Vxlan virtual port id mask.
  32985  * Returns:
  32986  *      BCM_E_XXX
  32987  * Notes:
  32988  */
  32989 int bcm_esw_field_qualify_DstVxlanGports(
  32990     int unit,
  32991     bcm_field_entry_t entry,
  32992     bcm_gport_t vxlan_port_id,
  32993     bcm_gport_t vxlan_port_mask)
  32994 {
  32995 #if defined(BCM_TOMAHAWK_SUPPORT)
  32996     _field_control_t *fc;   /* Field control structure. */
  32997 #endif
  32998     uint32 data = 0;        /* HW data match criteria.  */
  32999     uint32 mask = 0;        /* HW data mask.            */
  33000     int rv;                 /* Operation return status. */
  33001     _field_entry_t *f_ent;  /* Field entry structure.   */
  33002 
  33003     /* Input parameters check. */
  33004     if ((0 == BCM_GPORT_IS_VXLAN_PORT(vxlan_port_id)) &&
  33005         (0 == BCM_GPORT_IS_FLOW_PORT(vxlan_port_id))) {
  33006         return (BCM_E_PARAM);
  33007     }
  33008     if (vxlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33009         if ((0 == BCM_GPORT_IS_VXLAN_PORT(vxlan_port_mask))
  33010             && (0 == (BCM_GPORT_IS_FLOW_PORT(vxlan_port_mask)))) {
  33011             return (BCM_E_PARAM);
  33012         }
  33013     }
  33014 
  33015     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  33016                         bcmFieldQualifyDstVxlanGports, &f_ent));
  33017 
  33018 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  33019     /* Get the destiantion virtual port value and mask*/
  33020     if (soc_feature(unit, soc_feature_flex_flow)
  33021         && BCM_GPORT_IS_FLOW_PORT(vxlan_port_id)) {
  33022         data  = BCM_GPORT_FLOW_PORT_ID_GET(vxlan_port_id);
  33023         f_ent->dvp_type = _bcmVpTypeFlow;
  33024         if (vxlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33025             mask = BCM_GPORT_FLOW_PORT_ID_GET(vxlan_port_mask);
  33026         } else {
  33027             /* Include all bits for Mask value */
  33028             mask = BCM_FIELD_EXACT_MATCH_MASK;
  33029         }
  33030     } else {
  33031         data  = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_id);
  33032         f_ent->dvp_type = _bcmVpTypeVxlan;
  33033         if (vxlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33034             mask = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_mask);
  33035         } else {
  33036             /* Include all bits for Mask value */
  33037             mask = BCM_FIELD_EXACT_MATCH_MASK;
  33038         }
  33039     }
  33040 #else
  33041     data  = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_id);
  33042     if (vxlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33043         mask = BCM_GPORT_VXLAN_PORT_ID_GET(vxlan_port_mask);
  33044     } else {
  33045         /* Include all bits for Mask value */
  33046         mask = BCM_FIELD_EXACT_MATCH_MASK;
  33047     }
  33048 #endif
  33049     /*
  33050      * Invoke driver function for multi pipe supported devices.
  33051      */
  33052      
  33053 #if defined(BCM_TOMAHAWK_SUPPORT)
  33054      if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  33055          (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id)) {
  33056         FP_LOCK(unit);
  33057         rv = _field_control_get(unit, &fc);
  33058         if (BCM_FAILURE(rv)) {
  33059             FP_UNLOCK(unit);
  33060             return rv;
  33061         }
  33062             rv = fc->functions.fp_qualify_dvp(unit, entry,
  33063                                           bcmFieldQualifyDstVxlanGports,
  33064                                           data, mask, 1);
  33065         FP_UNLOCK(unit);
  33066         return (rv);
  33067      }
  33068 #endif /* BCM_TOMAHAWK_SUPPORT */
  33069 
  33070     FP_LOCK(unit);
  33071 
  33072     /* Check if entry belongs to Egress Stage. */
  33073     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  33074         /*
  33075          * LSB is DVP valid bit.
  33076          * Shift DVP value by 1-bit,
  33077          */
  33078         data <<= 1;
  33079 
  33080         /* Set DVP Valid bit. */
  33081         data |= 1;
  33082 
  33083         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33084             mask <<= 1;
  33085             mask |=1;
  33086         }
  33087 #if defined(BCM_TRIDENT2_SUPPORT)
  33088         /* Set the DVP TYPE to 2  for VxlanDstPorts */
  33089         if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  33090             data |= (2 << 17);
  33091             mask |= (3 << 17);
  33092         }
  33093 #endif
  33094     } else {
  33095         /* Qualify the destination type qualifier */
  33096         rv = _field_dest_type_qualify(unit, entry,
  33097                                       bcmFieldQualifyDstVxlanGports, 
  33098                                       &data, &mask, 
  33099                                       _bcmFieldDestTypeNone);
  33100         if (BCM_FAILURE(rv)) {
  33101             FP_UNLOCK(unit);
  33102             return (rv);
  33103         }
  33104     }
  33105 
  33106     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstVxlanGports,
  33107                           data, mask);
  33108 
  33109     FP_UNLOCK(unit);
  33110     return (rv);
  33111 }
  33112 
  33113 /*
  33114  * Function:
  33115  *      bcm_esw_field_qualify_DstVxlanGports_get
  33116  * Purpose:
  33117  *      Get match criteria for bcmFieildQualifyDstVxlanGports
  33118  *                     qualifier from the field entry.
  33119  * Parameters:
  33120  *      unit - (IN) Unit number.
  33121  *      entry - (IN) BCM field entry id.
  33122  *      vxlan_port_id - (OUT) Vxlan port id.
  33123  *      vxlan_port_mask - (OUT) Vxlan port mask.
  33124  * Returns:
  33125  *      BCM_E_XXX
  33126  * Notes:
  33127  */
  33128 int bcm_esw_field_qualify_DstVxlanGports_get(
  33129     int unit,
  33130     bcm_field_entry_t entry,
  33131     bcm_gport_t *vxlan_port_id,
  33132     bcm_gport_t *vxlan_port_mask)
  33133 {
  33134     uint32 data = 0;       /* HW encoded qualifier data.  */
  33135     uint32 mask = 0;       /* HW encoding qualifier mask. */
  33136     int rv;                /* Operation return status.    */
  33137     _field_entry_t *f_ent = NULL ; /* Field entry structure. */
  33138 
  33139     /* Input parameters check. */
  33140     if ((NULL == vxlan_port_id) || (NULL == vxlan_port_mask)) {
  33141         return (BCM_E_PARAM);
  33142     }
  33143 
  33144     /* Read qualifier match value and mask. */
  33145     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  33146                                             bcmFieldQualifyDstVxlanGports,
  33147                                             &data, &mask);
  33148     BCM_IF_ERROR_RETURN(rv);
  33149 
  33150     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  33151         bcmFieldQualifyDstVxlanGports, &f_ent));
  33152 
  33153     /* Check if entry belongs to Egress Stage. */
  33154     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  33155 #if defined(BCM_TRIDENT2_SUPPORT)
  33156         /* Clear DVP TYPE in data and mask */
  33157         if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
  33158             data &= ~(2 << 17);
  33159             mask &= ~(3 << 17);
  33160         }
  33161 #endif
  33162          /* Clear DVP Valid bit. */
  33163          data >>= 1;
  33164 
  33165         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33166             mask >>= 1;
  33167         }
  33168     } else {
  33169         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  33170             entry, bcmFieldQualifyDstVxlanGports, &data, &mask));
  33171     }
  33172 
  33173 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  33174     switch (f_ent->dvp_type) {
  33175         case _bcmVpTypeFlow :
  33176             BCM_GPORT_FLOW_PORT_ID_SET(*vxlan_port_id, data);
  33177             BCM_GPORT_FLOW_PORT_ID_SET(*vxlan_port_mask, mask);
  33178             break;
  33179         case _bcmVpTypeVxlan:
  33180             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  33181             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_mask, mask);
  33182             break;
  33183         default:
  33184             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  33185             BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_mask, mask);
  33186     }
  33187 #else
  33188     BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_id, data);
  33189     BCM_GPORT_VXLAN_PORT_ID_SET(*vxlan_port_mask, mask);
  33190 #endif
  33191 
  33192     return BCM_E_NONE;
  33193 }
  33194 
  33195 /*
  33196  * Function:
  33197  *      bcm_esw_field_qualify_SrcWlanGports
  33198  * Purpose:
  33199  *      Add source wlan port field qualification to a field entry.
  33200  * Parameters:
  33201  *      unit - (IN) Unit number.
  33202  *      entry - (IN) Field Entry id.
  33203  *      wlan_port_id - (IN) Wlan virtual port id.
  33204  *      wlan_port_mask - (IN) Wlan virtual port id mask.
  33205  * Returns:
  33206  *      BCM_E_XXX
  33207  * Notes:
  33208  */
  33209 int bcm_esw_field_qualify_SrcWlanGports(
  33210     int unit,
  33211     bcm_field_entry_t entry,
  33212     bcm_gport_t wlan_port_id,
  33213     bcm_gport_t wlan_port_mask)
  33214 {
  33215 #if defined(BCM_TOMAHAWK_SUPPORT)
  33216     _field_control_t *fc;   /* Field control structure. */
  33217 #endif
  33218     _field_group_t *fg;     /* Field group structure    */
  33219     uint32 data = 0;        /* HW data match criteria.  */
  33220     uint32 mask = 0;        /* HW data mask.            */
  33221     int rv;                 /* Operation return status. */
  33222     int ingress_entity = 0; /* Ingress entity or source entity */
  33223     int i;
  33224 
  33225     /* Input parameters check. */
  33226     if (0 == BCM_GPORT_IS_WLAN_PORT(wlan_port_id)) {
  33227         return (BCM_E_PARAM);
  33228     }
  33229 
  33230     if (wlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33231         if (0 == BCM_GPORT_IS_WLAN_PORT(wlan_port_mask)) {
  33232             return (BCM_E_PARAM);
  33233         }
  33234     }
  33235 
  33236     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
  33237 
  33238     /* Get the source virtual port value and mask*/
  33239     data  = BCM_GPORT_WLAN_PORT_ID_GET(wlan_port_id);
  33240 
  33241     if (wlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33242         mask  = BCM_GPORT_WLAN_PORT_ID_GET(wlan_port_mask);
  33243     } else {
  33244         mask = BCM_FIELD_EXACT_MATCH_MASK;
  33245     }
  33246 
  33247     
  33248 #if defined(BCM_TOMAHAWK_SUPPORT)
  33249     /*
  33250      * Invoke driver function for multi pipe supported devices.
  33251      */ 
  33252     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  33253         FP_LOCK(unit);
  33254         rv = _field_control_get(unit, &fc);
  33255         if (BCM_FAILURE(rv)) {
  33256             FP_UNLOCK(unit);
  33257             return rv;
  33258         }
  33259         rv = fc->functions.fp_qualify_svp(unit, entry,
  33260                                           bcmFieldQualifySrcWlanGports,
  33261                                           data, mask, 1);
  33262         FP_UNLOCK(unit);
  33263         return (rv);
  33264     }
  33265 #endif /* BCM_TOMAHAWK_SUPPORT */
  33266 
  33267     /* Check which configuration of SrcWlanGport is in use */
  33268     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
  33269         if (fg->sel_codes[i].ingress_entity_sel ==
  33270                 _bcmFieldFwdEntityWlanGport) {
  33271             ingress_entity = 1;
  33272             break;
  33273         }
  33274     }
  33275 
  33276     FP_LOCK(unit);
  33277 
  33278     if (ingress_entity) {
  33279         /* Internal qualifier to set SVP valid bit in Fixed field */
  33280         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
  33281         if (BCM_FAILURE(rv)) {
  33282             FP_UNLOCK(unit);
  33283             return (rv);
  33284         }
  33285     }
  33286 
  33287     /* Qualify Wlan Source Virtual Port */
  33288     /* In Stage Lookup bcmFieldQualifySrcWlanGports = 20 bits
  33289        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
  33290        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp
  33291        ==> data = svp_valid|s_type_sel|s_field
  33292      */
  33293     rv = _field_qualify_source_virtual_port(unit, entry,
  33294             bcmFieldQualifySrcWlanGports, data, mask, ingress_entity);
  33295 
  33296     FP_UNLOCK(unit);
  33297     return (rv);
  33298 }
  33299 
  33300 /*
  33301  * Function:
  33302  *      bcm_esw_field_qualify_SrcWlanGports_get
  33303  * Purpose:
  33304  *      Get match criteria for bcmFieildQualifySrcWlanGports
  33305  *                     qualifier from the field entry.
  33306  * Parameters:
  33307  *      unit - (IN) Unit number.
  33308  *      entry - (IN) BCM field entry id.
  33309  *      wlan_port_id - (OUT) Wlan port id.
  33310  *      wlan_port_mask - (OUT) Wlan port mask.
  33311  * Returns:
  33312  *      BCM_E_XXX
  33313  * Notes:
  33314  */
  33315 int bcm_esw_field_qualify_SrcWlanGports_get(
  33316     int unit,
  33317     bcm_field_entry_t entry,
  33318     bcm_gport_t *wlan_port_id,
  33319     bcm_gport_t *wlan_port_mask)
  33320 {
  33321     uint32 data = 0;   /* HW encoded qualifier data.  */
  33322     uint32 mask = 0;   /* HW encoding qualifier mask. */
  33323     int rv;            /* Operation return status.    */
  33324 
  33325     /* Input parameters check. */
  33326     if (NULL == wlan_port_id) {
  33327         return (BCM_E_PARAM);
  33328     }
  33329 
  33330     /* Read qualifier match value and mask. */
  33331     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  33332                                            bcmFieldQualifySrcWlanGports,
  33333                                            &data, &mask);
  33334     BCM_IF_ERROR_RETURN(rv);
  33335 
  33336     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  33337        data &=  0x1fff;
  33338     }
  33339     BCM_GPORT_WLAN_PORT_ID_SET(*wlan_port_id, data);
  33340     BCM_GPORT_WLAN_PORT_ID_SET(*wlan_port_mask, mask);
  33341 
  33342     return BCM_E_NONE;
  33343 }
  33344 
  33345 /*
  33346  * Function:
  33347  *      bcm_esw_field_qualify_DstWlanGports
  33348  * Purpose:
  33349  *      Add destination wlan port field qualification to a field entry.
  33350  * Parameters:
  33351  *      unit - (IN) Unit number.
  33352  *      entry - (IN) Field Entry id.
  33353  *      wlan_port_id - (IN) Wlan virtual port id.
  33354  *      wlan_port_mask - (IN) Wlan virtual port id mask.
  33355  * Returns:
  33356  *      BCM_E_XXX
  33357  * Notes:
  33358  */
  33359 int bcm_esw_field_qualify_DstWlanGports(
  33360     int unit,
  33361     bcm_field_entry_t entry,
  33362     bcm_gport_t wlan_port_id,
  33363     bcm_gport_t wlan_port_mask)
  33364 {
  33365 #if defined(BCM_TOMAHAWK_SUPPORT)
  33366     _field_control_t *fc;   /* Field control structure. */
  33367 #endif
  33368     uint32 data = 0;        /* HW data match criteria.  */
  33369     uint32 mask = 0;        /* HW data mask.            */
  33370     int rv;                 /* Operation return status. */
  33371     _field_entry_t *f_ent;  /* Field entry structure.   */
  33372 
  33373     /* Input parameters check. */
  33374     if (0 == BCM_GPORT_IS_WLAN_PORT(wlan_port_id)) {
  33375         return (BCM_E_PARAM);
  33376     }
  33377 
  33378     if (wlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33379         if (0 == BCM_GPORT_IS_WLAN_PORT(wlan_port_mask)) {
  33380             return (BCM_E_PARAM);
  33381         }
  33382     }
  33383 
  33384     data  = BCM_GPORT_WLAN_PORT_ID_GET(wlan_port_id);
  33385 
  33386     if (wlan_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33387         mask  = BCM_GPORT_WLAN_PORT_ID_GET(wlan_port_mask);
  33388     } else {
  33389         mask = BCM_FIELD_EXACT_MATCH_MASK;
  33390     }
  33391 
  33392     /*
  33393      * Invoke driver function for multi pipe supported devices.
  33394      */
  33395      
  33396 #if defined(BCM_TOMAHAWK_SUPPORT)
  33397      if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  33398         FP_LOCK(unit);
  33399         rv = _field_control_get(unit, &fc);
  33400         if (BCM_FAILURE(rv)) {
  33401             FP_UNLOCK(unit);
  33402             return rv;
  33403         }
  33404         rv = fc->functions.fp_qualify_dvp(unit, entry,
  33405                                           bcmFieldQualifyDstWlanGports,
  33406                                           data, mask, 1);
  33407         FP_UNLOCK(unit);
  33408         return (rv);
  33409      }
  33410 #endif /* BCM_TOMAHAWK_SUPPORT */
  33411 
  33412     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  33413         bcmFieldQualifyDstWlanGports, &f_ent));
  33414 
  33415     FP_LOCK(unit);
  33416 
  33417     /* Check if entry belongs to Egress Stage. */
  33418     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  33419         /*
  33420          * LSB is DVP valid bit.
  33421          * Shift DVP value by 1-bit,
  33422          */
  33423         data <<= 1;
  33424 
  33425         /* Set DVP Valid bit. */
  33426         data |= 1;
  33427 
  33428         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33429             mask <<= 1;
  33430             mask |=1;
  33431         }
  33432     } else {
  33433         /* Qualify the destination type qualifier */
  33434         rv = _field_dest_type_qualify(unit, entry,
  33435                                       bcmFieldQualifyDstWlanGports, 
  33436                                       &data, &mask, 
  33437                                       _bcmFieldDestTypeNone);
  33438         if (BCM_FAILURE(rv)) {
  33439             FP_UNLOCK(unit);
  33440             return (rv);
  33441         }
  33442     }
  33443 
  33444     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstWlanGports,
  33445                           data, mask);
  33446 
  33447     FP_UNLOCK(unit);
  33448     return (rv);
  33449 }
  33450 
  33451 
  33452 /*
  33453  * Function:
  33454  *      bcm_esw_field_qualify_DstWlanGports_get
  33455  * Purpose:
  33456  *      Get match criteria for bcmFieildQualifyDstWlanGports
  33457  *                     qualifier from the field entry.
  33458  * Parameters:
  33459  *      unit - (IN) Unit number.
  33460  *      entry - (IN) BCM field entry id.
  33461  *      wlan_port_id - (OUT) Wlan port id.
  33462  *      wlan_port_mask - (OUT) Wlan port mask.
  33463  * Returns:
  33464  *      BCM_E_XXX
  33465  * Notes:
  33466  */
  33467 int bcm_esw_field_qualify_DstWlanGports_get(
  33468     int unit,
  33469     bcm_field_entry_t entry,
  33470     bcm_gport_t *wlan_port_id,
  33471     bcm_gport_t *wlan_port_mask)
  33472 {
  33473     uint32 data = 0;       /* HW encoded qualifier data.  */
  33474     uint32 mask = 0;       /* HW encoding qualifier mask. */
  33475     int rv;                /* Operation return status.    */
  33476     _field_entry_t *f_ent; /* Field entry structure. */
  33477 
  33478     /* Input parameters check. */
  33479     if ((NULL == wlan_port_id) || (NULL == wlan_port_mask)) {
  33480         return (BCM_E_PARAM);
  33481     }
  33482 
  33483     /* Read qualifier match value and mask. */
  33484     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  33485                                             bcmFieldQualifyDstWlanGports,
  33486                                             &data, &mask);
  33487     BCM_IF_ERROR_RETURN(rv);
  33488 
  33489     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  33490         bcmFieldQualifyDstWlanGports, &f_ent));
  33491 
  33492     /* Check if entry belongs to Egress Stage. */
  33493     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  33494          /* Clear DVP Valid bit. */
  33495          data >>= 1;
  33496 
  33497         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33498             mask >>= 1;
  33499         }
  33500     } else {
  33501         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  33502             entry, bcmFieldQualifyDstWlanGports, &data, &mask));
  33503     }
  33504 
  33505     BCM_GPORT_WLAN_PORT_ID_SET(*wlan_port_id, data);
  33506     BCM_GPORT_WLAN_PORT_ID_SET(*wlan_port_mask, mask);
  33507 
  33508     return BCM_E_NONE;
  33509 }
  33510 
  33511 /*
  33512  * Function:
  33513  *      bcm_esw_field_qualify_SrcMplsGports
  33514  * Purpose:
  33515  *      Add source mpls port field qualification to a field entry.
  33516  * Parameters:
  33517  *      unit - (IN) Unit number.
  33518  *      entry - (IN) Field Entry id.
  33519  *      mpls_port_id - (IN) Mpls virtual port id.
  33520  *      mpls_port_mask - (IN) Mpls virtual port id mask.
  33521  * Returns:
  33522  *      BCM_E_XXX
  33523  * Notes:
  33524  */
  33525 
  33526 int bcm_esw_field_qualify_SrcMplsGports(
  33527     int unit,
  33528     bcm_field_entry_t entry,
  33529     bcm_gport_t mpls_port_id,
  33530     bcm_gport_t mpls_port_mask)
  33531 {
  33532 #if defined(BCM_TOMAHAWK_SUPPORT)
  33533     _field_control_t *fc;   /* Field control structure. */
  33534 #endif
  33535     _field_group_t *fg;     /* Field group structure    */
  33536     uint32 data = 0;        /* HW data match criteria.  */
  33537     uint32 mask = 0;        /* HW data mask.            */
  33538     int rv;                 /* Operation return status. */
  33539     int ingress_entity = 0; /* Ingress entity or source entity */
  33540     int i;
  33541 
  33542     /* Input parameters check. */
  33543     if (0 == BCM_GPORT_IS_MPLS_PORT(mpls_port_id)) {
  33544         return (BCM_E_PARAM);
  33545     }
  33546 
  33547     if (mpls_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33548         if (0 == BCM_GPORT_IS_MPLS_PORT(mpls_port_mask)) {
  33549             return (BCM_E_PARAM);
  33550         }
  33551     }
  33552 
  33553     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
  33554 
  33555     /* Get the source virtual port value and mask*/
  33556     data  = BCM_GPORT_MPLS_PORT_ID_GET(mpls_port_id);
  33557 
  33558     if (mpls_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33559         mask  = BCM_GPORT_MPLS_PORT_ID_GET(mpls_port_mask);
  33560     } else {
  33561         mask = BCM_FIELD_EXACT_MATCH_MASK;
  33562     }
  33563 
  33564     
  33565 #if defined(BCM_TOMAHAWK_SUPPORT)
  33566     /*
  33567      * Invoke driver function for multi pipe supported devices.
  33568      */ 
  33569     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  33570         FP_LOCK(unit);
  33571         rv = _field_control_get(unit, &fc);
  33572         if (BCM_FAILURE(rv)) {
  33573             FP_UNLOCK(unit);
  33574             return rv;
  33575         }
  33576         rv = fc->functions.fp_qualify_svp(unit, entry,
  33577                                           bcmFieldQualifySrcMplsGports,
  33578                                           data, mask, 1);
  33579         FP_UNLOCK(unit);
  33580         return (rv);
  33581     }
  33582 #endif /* BCM_TOMAHAWK_SUPPORT */
  33583 
  33584     /* Check which c nfiguration of SrcVlanGport is in use */
  33585     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
  33586         if (fg->sel_codes[i].ingress_entity_sel ==
  33587                     _bcmFieldFwdEntityMplsGport) {
  33588             ingress_entity = 1;
  33589             break;
  33590         }
  33591     }
  33592 
  33593     FP_LOCK(unit);
  33594 
  33595     if (ingress_entity) {
  33596         /* Internal qualifier to set SVP valid bit in Fixed field */
  33597         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
  33598         if (BCM_FAILURE(rv)) {
  33599             FP_UNLOCK(unit);
  33600             return (rv);
  33601         }
  33602     }
  33603 
  33604     /* Qualify Mpls Source Virtual Port */
  33605     /* In Stage Lookup bcmFieldQualifySrcMplsGports = 20 bits
  33606        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
  33607        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp
  33608        ==> data = svp_valid|s_type_sel|s_field
  33609      */
  33610     rv = _field_qualify_source_virtual_port(unit, entry,
  33611             bcmFieldQualifySrcMplsGports, data, mask, ingress_entity);
  33612 
  33613     FP_UNLOCK(unit);
  33614     return (rv);
  33615 }
  33616 
  33617 /*
  33618  * Function:
  33619  *      bcm_esw_field_qualify_SrcMplsGports_get
  33620  * Purpose:
  33621  *      Get match criteria for bcmFieildQualifySrcMplsGports
  33622  *                     qualifier from the field entry.
  33623  * Parameters:
  33624  *      unit - (IN) Unit number.
  33625  *      entry - (IN) BCM field entry id.
  33626  *      mpls_port_id - (OUT) Mpls port id.
  33627  *      mpls_port_mask - (OUT) Mpls port mask.
  33628  * Returns:
  33629  *      BCM_E_XXX
  33630  * Notes:
  33631  */
  33632 
  33633 int bcm_esw_field_qualify_SrcMplsGports_get(
  33634     int unit,
  33635     bcm_field_entry_t entry,
  33636     bcm_gport_t *mpls_port_id,
  33637     bcm_gport_t *mpls_port_mask)
  33638 {
  33639     uint32 data = 0;  /* HW encoded qualifier data.  */
  33640     uint32 mask = 0;  /* HW encoding qualifier mask. */
  33641     int rv;           /* Operation return status.    */
  33642 
  33643     /* Input parameters check. */
  33644     if (NULL == mpls_port_id) {
  33645         return (BCM_E_PARAM);
  33646     }
  33647 
  33648     /* Read qualifier match value and mask. */
  33649     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  33650                                            bcmFieldQualifySrcMplsGports,
  33651                                            &data, &mask);
  33652     BCM_IF_ERROR_RETURN(rv);
  33653 
  33654     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  33655        data &=  0x1fff;
  33656     }
  33657     BCM_GPORT_MPLS_PORT_ID_SET(*mpls_port_id, data);
  33658     BCM_GPORT_MPLS_PORT_ID_SET(*mpls_port_mask, mask);
  33659 
  33660     return BCM_E_NONE;
  33661 }
  33662 
  33663 /*
  33664  * Function:
  33665  *      bcm_esw_field_qualify_DstMplsGports
  33666  * Purpose:
  33667  *      Add source mpls port field qualification to a field entry.
  33668  * Parameters:
  33669  *      unit - (IN) Unit number.
  33670  *      entry - (IN) Field Entry id.
  33671  *      mpls_port_id - (IN) Mpls virtual port id.
  33672  *      mpls_port_mask - (IN) Mpls virtual port id mask.
  33673  * Returns:
  33674  *      BCM_E_XXX
  33675  * Notes:
  33676  */
  33677 int bcm_esw_field_qualify_DstMplsGports(
  33678     int unit,
  33679     bcm_field_entry_t entry,
  33680     bcm_gport_t mpls_port_id,
  33681     bcm_gport_t mpls_port_mask)
  33682 {
  33683 #if defined(BCM_TOMAHAWK_SUPPORT)
  33684     _field_control_t *fc;   /* Field control structure. */
  33685 #endif
  33686     uint32 data = 0;        /* HW data match criteria.  */
  33687     uint32 mask = 0;        /* HW data mask.            */
  33688     int rv;                 /* Operation return status. */
  33689     _field_entry_t *f_ent;  /* Field entry structure.   */
  33690 
  33691     /* Input parameters check. */
  33692     if (0 == BCM_GPORT_IS_MPLS_PORT(mpls_port_id)) {
  33693         return (BCM_E_PARAM);
  33694     }
  33695 
  33696     if (mpls_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33697         if (0 == BCM_GPORT_IS_MPLS_PORT(mpls_port_mask)) {
  33698             return (BCM_E_PARAM);
  33699         }
  33700     }
  33701 
  33702     data  = BCM_GPORT_MPLS_PORT_ID_GET(mpls_port_id);
  33703 
  33704     if (mpls_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33705         mask  = BCM_GPORT_MPLS_PORT_ID_GET(mpls_port_mask);
  33706     } else {
  33707         mask = BCM_FIELD_EXACT_MATCH_MASK;
  33708     }
  33709 
  33710     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  33711                         bcmFieldQualifyDstMplsGports, &f_ent));
  33712     /*
  33713      * Invoke driver function for multi pipe supported devices.
  33714      */
  33715      
  33716 #if defined(BCM_TOMAHAWK_SUPPORT)
  33717      if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  33718          (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id)) {
  33719         FP_LOCK(unit);
  33720         rv = _field_control_get(unit, &fc);
  33721         if (BCM_FAILURE(rv)) {
  33722             FP_UNLOCK(unit);
  33723             return rv;
  33724         }
  33725         rv = fc->functions.fp_qualify_dvp(unit, entry,
  33726                                           bcmFieldQualifyDstMplsGports,
  33727                                           data, mask, 1);
  33728         FP_UNLOCK(unit);
  33729         return (rv);
  33730      }
  33731 #endif /* BCM_TOMAHAWK_SUPPORT */
  33732 
  33733 
  33734     FP_LOCK(unit);
  33735 
  33736     /* Check if entry belongs to Egress Stage. */
  33737     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  33738         /*
  33739          * LSB is DVP valid bit.
  33740          * Shift DVP value by 1-bit,
  33741          */
  33742         data <<= 1;
  33743 
  33744         /* Set DVP Valid bit. */
  33745         data |= 1;
  33746 
  33747         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33748             mask <<= 1;
  33749             mask |=1;
  33750         }
  33751     } else {
  33752         /* Qualify the destination type qualifier */
  33753         rv = _field_dest_type_qualify(unit, entry,
  33754                                       bcmFieldQualifyDstMplsGports, 
  33755                                       &data, &mask, 
  33756                                       _bcmFieldDestTypeNone);
  33757         if (BCM_FAILURE(rv)) {
  33758             FP_UNLOCK(unit);
  33759             return (rv);
  33760         }
  33761     }
  33762 
  33763     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstMplsGports,
  33764                           data, mask);
  33765 
  33766     FP_UNLOCK(unit);
  33767     return (rv);
  33768 }
  33769 
  33770 
  33771 /*
  33772  * Function:
  33773  *      bcm_esw_field_qualify_DstMplsGports_get
  33774  * Purpose:
  33775  *      Get match criteria for bcmFieildQualifyDstMplsGports
  33776  *                     qualifier from the field entry.
  33777  * Parameters:
  33778  *      unit - (IN) Unit number.
  33779  *      entry - (IN) BCM field entry id.
  33780  *      mpls_port_id - (OUT) Mpls port id.
  33781  *      mpls_port_mask - (OUT) Mpls port mask.
  33782  * Returns:
  33783  *      BCM_E_XXX
  33784  * Notes:
  33785  */
  33786 int bcm_esw_field_qualify_DstMplsGports_get(
  33787     int unit,
  33788     bcm_field_entry_t entry,
  33789     bcm_gport_t *mpls_port_id,
  33790     bcm_gport_t *mpls_port_mask)
  33791 {
  33792     uint32 data = 0;       /* HW encoded qualifier data.  */
  33793     uint32 mask = 0;       /* HW encoding qualifier mask. */
  33794     int rv;                /* Operation return status.    */
  33795     _field_entry_t *f_ent; /* Field entry structure. */
  33796 
  33797     /* Input parameters check. */
  33798     if ((NULL == mpls_port_id) || (NULL == mpls_port_mask)) {
  33799         return (BCM_E_PARAM);
  33800     }
  33801 
  33802     /* Read qualifier match value and mask. */
  33803     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  33804                                             bcmFieldQualifyDstMplsGports,
  33805                                             &data, &mask);
  33806     BCM_IF_ERROR_RETURN(rv);
  33807 
  33808     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  33809         bcmFieldQualifyDstMplsGports, &f_ent));
  33810 
  33811     /* Check if entry belongs to Egress Stage. */
  33812     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  33813          /* Clear DVP Valid bit. */
  33814          data >>= 1;
  33815 
  33816         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33817             mask >>= 1;
  33818         }
  33819     } else {
  33820         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  33821             entry, bcmFieldQualifyDstMplsGports, &data, &mask));
  33822     }
  33823 
  33824     BCM_GPORT_MPLS_PORT_ID_SET(*mpls_port_id, data);
  33825     BCM_GPORT_MPLS_PORT_ID_SET(*mpls_port_mask, mask);
  33826 
  33827     return BCM_E_NONE;
  33828 }
  33829 
  33830 /*
  33831  * Function:
  33832  *      bcm_esw_field_qualify_SrcGports
  33833  * Purpose:
  33834  *      Add source  gport field qualification to a field entry.
  33835  * Parameters:
  33836  *      unit - (IN) Unit number.
  33837  *      entry - (IN) Field Entry id.
  33838  *      port_id - (IN) virtual port id.
  33839  *      port_mask - (IN)  virtual port id mask.
  33840  * Returns:
  33841  *      BCM_E_XXX
  33842  * Notes:
  33843  */
  33844 int bcm_esw_field_qualify_SrcGports(
  33845     int unit,
  33846     bcm_field_entry_t entry,
  33847     bcm_gport_t port_id,
  33848     bcm_gport_t port_mask)
  33849 {
  33850     int rv = BCM_E_UNAVAIL; /* Operation return status. */
  33851 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  33852     _field_control_t *fc;   /* Field control structure. */
  33853     uint32 data;            /* HW data match value.     */
  33854     uint32 mask = 0;        /* HW data mask value.      */
  33855     int ingress_entity = 0;
  33856     int port_gport_type = 0;
  33857     int mask_gport_type = 0;
  33858     _field_entry_t *f_ent; /* Field entry structure. */
  33859 #if defined(BCM_TRIDENT2_SUPPORT)
  33860     int svp_valid = 1;
  33861 #endif /* BCM_TRIDENT2_SUPPORT */
  33862 
  33863     /* Input parameters check. */
  33864     /* coverity[dead_error_line : FALSE] */ 
  33865     if ((0 == BCM_GPORT_IS_MODPORT(port_id))
  33866         && (0 == BCM_GPORT_IS_MPLS_PORT(port_id))
  33867         && (0 == BCM_GPORT_IS_MIM_PORT(port_id)
  33868         && (0 == BCM_GPORT_IS_WLAN_PORT(port_id))
  33869         && (0 == BCM_GPORT_IS_NIV_PORT(port_id))
  33870         && (!soc_feature(unit, soc_feature_niv) && (BCM_GPORT_IS_NIV_PORT(port_id)))
  33871         && (0 == BCM_GPORT_IS_VLAN_PORT(port_id)))) {
  33872         return (BCM_E_PARAM);
  33873     }
  33874 
  33875     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33876         if ((0 == BCM_GPORT_IS_MODPORT(port_id))
  33877             && (0 == BCM_GPORT_IS_MPLS_PORT(port_mask))
  33878             && (0 == BCM_GPORT_IS_MIM_PORT(port_mask)
  33879             && (0 == BCM_GPORT_IS_WLAN_PORT(port_mask))
  33880             && (0 == BCM_GPORT_IS_NIV_PORT(port_mask))
  33881             && (0 == BCM_GPORT_IS_VLAN_PORT(port_mask)))) {
  33882             return (BCM_E_PARAM);
  33883         }
  33884     }
  33885 
  33886     /* No mismatch between port and port_mask gport type */
  33887     port_gport_type =
  33888         ((port_id   >> _SHR_GPORT_TYPE_SHIFT) & _SHR_GPORT_TYPE_MASK);
  33889 
  33890     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33891         mask_gport_type =
  33892             ((port_mask >> _SHR_GPORT_TYPE_SHIFT) & _SHR_GPORT_TYPE_MASK);
  33893 
  33894         if (port_gport_type != mask_gport_type) {
  33895             return (BCM_E_PARAM);
  33896         }
  33897     }
  33898 
  33899     
  33900 
  33901     FP_LOCK(unit);
  33902     rv = _field_control_get(unit, &fc);
  33903     if (BCM_FAILURE(rv)) {
  33904         FP_UNLOCK(unit);
  33905         return rv;
  33906     }
  33907 
  33908     /* Get field entry part that contains the qualifier. */
  33909     rv = _bcm_field_entry_qual_get(unit, entry,
  33910                                    bcmFieldQualifySrcGports, &f_ent);
  33911     if (BCM_FAILURE(rv)) {
  33912         FP_UNLOCK(unit);
  33913         return (rv);
  33914     }
  33915 
  33916     /* Include all bits for mask value */
  33917      /*
  33918       * Source port is a virtual port.
  33919       */
  33920 
  33921      f_ent->svp_type = _bcmVpTypeAny; 
  33922      /* Get the source virtual port value */
  33923      if (BCM_GPORT_IS_MODPORT(port_id)) {
  33924          data  = BCM_GPORT_MODPORT_PORT_GET(port_id);
  33925          data |= ((BCM_GPORT_MODPORT_MODID_GET(port_id)) << _FP_PORT_BITWIDTH(unit));
  33926 #if defined(BCM_TRIDENT2_SUPPORT)
  33927          svp_valid = 0;
  33928 #endif /* BCM_TRIDENT2_SUPPORT */
  33929          ingress_entity = 1;
  33930      } else if (BCM_GPORT_IS_MPLS_PORT(port_id)) {
  33931          data = BCM_GPORT_MPLS_PORT_ID_GET(port_id);
  33932          f_ent->svp_type = _bcmVpTypeMpls; 
  33933      } else if (BCM_GPORT_IS_MIM_PORT(port_id)) {
  33934          data = BCM_GPORT_MIM_PORT_ID_GET(port_id);
  33935          f_ent->svp_type = _bcmVpTypeMim; 
  33936      } else if (BCM_GPORT_IS_NIV_PORT(port_id)) {
  33937          data = BCM_GPORT_NIV_PORT_ID_GET(port_id);
  33938          f_ent->svp_type = _bcmVpTypeNiv; 
  33939      } else if (BCM_GPORT_IS_VLAN_PORT(port_id)) {
  33940          data = BCM_GPORT_VLAN_PORT_ID_GET(port_id);
  33941          f_ent->svp_type = _bcmVpTypeVlan; 
  33942      } else {
  33943          data = BCM_GPORT_WLAN_PORT_ID_GET(port_id);
  33944          f_ent->svp_type = _bcmVpTypeWlan; 
  33945      }
  33946 
  33947      if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  33948          /* Get the source virtual port value */
  33949          if (BCM_GPORT_IS_MODPORT(port_id)) {
  33950              mask = BCM_GPORT_MODPORT_PORT_GET(port_mask);
  33951              mask |= ((BCM_GPORT_MODPORT_MODID_GET(port_mask)) << _FP_PORT_BITWIDTH(unit));
  33952          } else if (BCM_GPORT_IS_MPLS_PORT(port_mask)) {
  33953              mask = BCM_GPORT_MPLS_PORT_ID_GET(port_mask);
  33954          } else if (BCM_GPORT_IS_MIM_PORT(port_mask)) {
  33955              mask = BCM_GPORT_MIM_PORT_ID_GET(port_mask);
  33956          } else if (BCM_GPORT_IS_NIV_PORT(port_mask)) {
  33957              mask = BCM_GPORT_NIV_PORT_ID_GET(port_mask);
  33958          } else if (BCM_GPORT_IS_VLAN_PORT(port_mask)) {
  33959              mask = BCM_GPORT_VLAN_PORT_ID_GET(port_mask);
  33960          } else {
  33961              mask = BCM_GPORT_WLAN_PORT_ID_GET(port_mask);
  33962          }
  33963      } else {
  33964          mask = BCM_FIELD_EXACT_MATCH_MASK;
  33965      }
  33966 
  33967 #if defined(BCM_TOMAHAWK_SUPPORT)
  33968     /*
  33969      * Invoke driver function for multi pipe supported devices.
  33970      */ 
  33971      if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  33972          rv = fc->functions.fp_qualify_svp(unit, entry,
  33973                                            bcmFieldQualifySrcGports,
  33974                                            data, mask, svp_valid);
  33975          FP_UNLOCK(unit);
  33976          return (rv);
  33977      }
  33978 #endif /* BCM_TOMAHAWK_SUPPORT */
  33979 
  33980 #if defined(BCM_TRIDENT2_SUPPORT)
  33981      if (SOC_IS_TD2_TT2(unit) && (svp_valid == 1)) {
  33982          /* Internal qualifier to set SVP valid bit in Fixed field */
  33983          rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
  33984 
  33985          if (BCM_FAILURE(rv)) {
  33986              FP_UNLOCK(unit);
  33987              return (rv);
  33988          }
  33989          ingress_entity = 1;
  33990      }
  33991 #endif /* BCM_TRIDENT2_SUPPORT */
  33992 
  33993      /* Qualify Source Virtual Port */
  33994      rv = _field_qualify_source_virtual_port(unit, entry,
  33995                                              bcmFieldQualifySrcGports,
  33996                                              data, mask, ingress_entity);
  33997 
  33998     FP_UNLOCK(unit);
  33999 #endif
  34000     return (rv);
  34001 }
  34002 
  34003 
  34004 
  34005 /*
  34006  * Function:
  34007  *      bcm_esw_field_qualify_SrcGports_get
  34008  * Purpose:
  34009  *      Get match criteria for bcmFieildQualifySrcGports
  34010  *                     qualifier from the field entry.
  34011  * Parameters:
  34012  *      unit - (IN) Unit number.
  34013  *      entry - (IN) BCM field entry id.
  34014  *      port_id - (OUT)  port id.
  34015  *      port_mask - (OUT)  port mask.
  34016  * Returns:
  34017  *      BCM_E_XXX
  34018  * Notes:
  34019  */
  34020 int bcm_esw_field_qualify_SrcGports_get(
  34021     int unit,
  34022     bcm_field_entry_t entry,
  34023     bcm_gport_t *port_id,
  34024     bcm_gport_t *port_mask)
  34025 {
  34026     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  34027 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  34028     uint32 data = 0;         /* HW encoded qualifier data.    */
  34029     uint32 mask = 0;         /* HW encoding qualifier mask.   */
  34030     _bcm_field_qual_offset_t *q_offset; /* Qualifier offset.  */
  34031     _field_entry_t *f_ent;   /* Field entry information.      */
  34032 
  34033     /* Input parameters check. */
  34034     if ((NULL == port_id) || (NULL == port_mask)) {
  34035         return (BCM_E_PARAM);
  34036     }
  34037 
  34038     
  34039     FP_LOCK(unit);
  34040 
  34041     /* Read qualifier match value and mask. */
  34042     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  34043                                                bcmFieldQualifySrcGports,
  34044                                                &data, &mask);
  34045     if (BCM_FAILURE(rv)) {
  34046        FP_UNLOCK(unit);
  34047        return rv;
  34048     }
  34049 
  34050     /* Get field entry part that contains the qualifier. */
  34051     rv = _bcm_field_entry_qual_get(unit, entry,
  34052                                    bcmFieldQualifySrcGports, &f_ent);
  34053     if (BCM_FAILURE(rv)) {
  34054        FP_UNLOCK(unit);
  34055        return rv;
  34056     }
  34057 
  34058     /* Get qualifier offsets in the tcam. */
  34059     rv = _field_qual_offset_get(unit, f_ent,
  34060                                 bcmFieldQualifySrcGports, &q_offset);
  34061     if (BCM_FAILURE(rv)) {
  34062        FP_UNLOCK(unit);
  34063        return rv;
  34064     }
  34065 
  34066     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  34067        /* Clear SVP valid bit. */
  34068        data &= ((1 << (q_offset->width[0] - 1)) - 1);
  34069     }
  34070 
  34071     if (f_ent->svp_type == _bcmVpTypeMpls) {
  34072         BCM_GPORT_MPLS_PORT_ID_SET(*port_id, data);
  34073         BCM_GPORT_MPLS_PORT_ID_SET(*port_mask, mask);
  34074     } else if (f_ent->svp_type == _bcmVpTypeMim) {
  34075         BCM_GPORT_MIM_PORT_ID_SET(*port_id, data);
  34076         BCM_GPORT_MIM_PORT_ID_SET(*port_mask, mask);
  34077     } else if (f_ent->svp_type == _bcmVpTypeNiv) {
  34078         BCM_GPORT_NIV_PORT_ID_SET(*port_id, data);
  34079         BCM_GPORT_NIV_PORT_ID_SET(*port_mask, mask);
  34080     } else if (f_ent->svp_type == _bcmVpTypeVlan) {
  34081         BCM_GPORT_VLAN_PORT_ID_SET(*port_id, data);
  34082         BCM_GPORT_VLAN_PORT_ID_SET(*port_mask, mask);
  34083     } else if (f_ent->svp_type == _bcmVpTypeWlan) {
  34084         BCM_GPORT_WLAN_PORT_ID_SET(*port_id, data);
  34085         BCM_GPORT_WLAN_PORT_ID_SET(*port_mask, mask);
  34086     } else if (f_ent->svp_type == _bcmVpTypeVxlan) {
  34087         BCM_GPORT_VXLAN_PORT_ID_SET(*port_id, data);
  34088         BCM_GPORT_VXLAN_PORT_ID_SET(*port_mask, mask);
  34089     } else if (f_ent->svp_type == _bcmVpTypeFlow) {
  34090         BCM_GPORT_FLOW_PORT_ID_SET(*port_id, data);
  34091         BCM_GPORT_FLOW_PORT_ID_SET(*port_mask, mask);
  34092     } else {
  34093         BCM_GPORT_MODPORT_SET(*port_id, ((data >> _FP_PORT_BITWIDTH(unit)) & 0xff),
  34094                              (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  34095         BCM_GPORT_MODPORT_SET(*port_mask, ((mask >> _FP_PORT_BITWIDTH(unit)) & 0xff),
  34096                              (mask & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  34097     }
  34098     FP_UNLOCK(unit);
  34099 #endif
  34100     return (rv);
  34101 }
  34102 
  34103 /*
  34104  * Function:
  34105  *      bcm_esw_field_qualify_DstGports
  34106  * Purpose:
  34107  *      Add destination port field qualification to a field entry.
  34108  * Parameters:
  34109  *      unit - (IN) Unit number.
  34110  *      entry - (IN) Field Entry id.
  34111  *      port_id - (IN)  virtual port id.
  34112  *      port_mask - (IN) virtual port id mask.
  34113  * Returns:
  34114  *      BCM_E_XXX
  34115  * Notes:
  34116  */
  34117 int bcm_esw_field_qualify_DstGports(
  34118     int unit,
  34119     bcm_field_entry_t entry,
  34120     bcm_gport_t port_id,
  34121     bcm_gport_t port_mask)
  34122 {
  34123     int rv = BCM_E_UNAVAIL; /* Operation return status. */
  34124 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  34125 #if defined(BCM_TOMAHAWK_SUPPORT)
  34126     _field_control_t *fc;   /* Field control structure. */
  34127 #endif
  34128     uint32 data = 0;        /* HW data match criteria.  */
  34129     uint32 mask = 0;        /* HW data mask.            */
  34130     _field_entry_t *f_ent;  /* Field entry structure.   */
  34131 
  34132    /* Input parameters check. */
  34133    /* coverity[dead_error_line : FALSE] */ 
  34134    if ((0 == BCM_GPORT_IS_MODPORT(port_id))
  34135         && (0 == BCM_GPORT_IS_MPLS_PORT(port_id))
  34136         && (0 == BCM_GPORT_IS_MIM_PORT(port_id)
  34137         && (0 == BCM_GPORT_IS_WLAN_PORT(port_id))
  34138         && (0 == BCM_GPORT_IS_NIV_PORT(port_id))
  34139         && (!soc_feature(unit, soc_feature_niv) && (BCM_GPORT_IS_NIV_PORT(port_id)))
  34140         && (0 == BCM_GPORT_IS_VLAN_PORT(port_id)))) {
  34141         return (BCM_E_PARAM);
  34142     }
  34143 
  34144     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34145         if ((0 == BCM_GPORT_IS_MODPORT(port_id))
  34146             && (0 == BCM_GPORT_IS_MPLS_PORT(port_mask))
  34147             && (0 == BCM_GPORT_IS_MIM_PORT(port_mask)
  34148             && (0 == BCM_GPORT_IS_WLAN_PORT(port_mask))
  34149             && (0 == BCM_GPORT_IS_NIV_PORT(port_mask))
  34150             && (0 == BCM_GPORT_IS_VLAN_PORT(port_mask)))) {
  34151             return (BCM_E_PARAM);
  34152         }
  34153     }
  34154 
  34155 	/* Get the source virtual port value */
  34156      if (BCM_GPORT_IS_MODPORT(port_id)) {
  34157          data  = BCM_GPORT_MODPORT_PORT_GET(port_id);
  34158          data |= ((BCM_GPORT_MODPORT_MODID_GET(port_id)) << _FP_PORT_BITWIDTH(unit));
  34159      } else if (BCM_GPORT_IS_MPLS_PORT(port_id)) {
  34160          data = BCM_GPORT_MPLS_PORT_ID_GET(port_id);
  34161      } else if (BCM_GPORT_IS_MIM_PORT(port_id)) {
  34162          data = BCM_GPORT_MIM_PORT_ID_GET(port_id);
  34163      } else if (BCM_GPORT_IS_NIV_PORT(port_id)) {
  34164          data = BCM_GPORT_NIV_PORT_ID_GET(port_id);
  34165      } else if (BCM_GPORT_IS_VLAN_PORT(port_id)) {
  34166          data = BCM_GPORT_VLAN_PORT_ID_GET(port_id);
  34167      } else {
  34168          data = BCM_GPORT_WLAN_PORT_ID_GET(port_id);
  34169      }
  34170 
  34171      if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34172          /* Get the source virtual port value */
  34173          if (BCM_GPORT_IS_MODPORT(port_id)) {
  34174              mask = BCM_GPORT_MODPORT_PORT_GET(port_mask);
  34175              mask |= ((BCM_GPORT_MODPORT_MODID_GET(port_mask)) << _FP_PORT_BITWIDTH(unit));
  34176          } else if (BCM_GPORT_IS_MPLS_PORT(port_mask)) {
  34177              mask = BCM_GPORT_MPLS_PORT_ID_GET(port_mask);
  34178          } else if (BCM_GPORT_IS_MIM_PORT(port_mask)) {
  34179              mask = BCM_GPORT_MIM_PORT_ID_GET(port_mask);
  34180          } else if (BCM_GPORT_IS_NIV_PORT(port_mask)) {
  34181              mask = BCM_GPORT_NIV_PORT_ID_GET(port_mask);
  34182          } else if (BCM_GPORT_IS_VLAN_PORT(port_mask)) {
  34183              mask = BCM_GPORT_VLAN_PORT_ID_GET(port_mask);
  34184          } else {
  34185              mask = BCM_GPORT_WLAN_PORT_ID_GET(port_mask);
  34186          }
  34187      } else {
  34188          mask = BCM_FIELD_EXACT_MATCH_MASK;
  34189      }
  34190 
  34191     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  34192                         bcmFieldQualifyDstGports, &f_ent));
  34193 
  34194     /*
  34195      * Invoke driver function for multi pipe supported devices.
  34196      */
  34197      
  34198 #if defined(BCM_TOMAHAWK_SUPPORT)
  34199      if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  34200          (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id)) {
  34201         FP_LOCK(unit);
  34202         rv = _field_control_get(unit, &fc);
  34203         if (BCM_FAILURE(rv)) {
  34204             FP_UNLOCK(unit);
  34205             return rv;
  34206         }
  34207         rv = fc->functions.fp_qualify_dvp(unit, entry,
  34208                                           bcmFieldQualifyDstGports,
  34209                                           data, mask, 1);
  34210         FP_UNLOCK(unit);
  34211         return (rv);
  34212      }
  34213 #endif /* BCM_TOMAHAWK_SUPPORT */
  34214 
  34215     FP_LOCK(unit);
  34216 
  34217     /* Check if entry belongs to Egress Stage. */
  34218     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  34219         /*
  34220          * LSB is DVP valid bit.
  34221          * Shift DVP value by 1-bit,
  34222          */
  34223         data <<= 1;
  34224 
  34225         /* Set DVP Valid bit. */
  34226         data |= 1;
  34227 
  34228         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34229             mask <<= 1;
  34230             mask |=1;
  34231         }
  34232     } else {
  34233         /* Qualify the destination type qualifier */
  34234         rv = _field_dest_type_qualify(unit, entry,
  34235                                       bcmFieldQualifyDstGports, 
  34236                                       &data, &mask, 
  34237                                       _bcmFieldDestTypeNone);
  34238         if (BCM_FAILURE(rv)) {
  34239             FP_UNLOCK(unit);
  34240             return (rv);
  34241         }
  34242     }
  34243 
  34244     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstGports,
  34245                           data, mask);
  34246 
  34247     FP_UNLOCK(unit);
  34248 #endif
  34249     return (rv);
  34250 }
  34251 
  34252 
  34253 /*
  34254  * Function:
  34255  *      bcm_esw_field_qualify_DstGports_get
  34256  * Purpose:
  34257  *      Get match criteria for bcmFieildQualifyDstGports
  34258  *                     qualifier from the field entry.
  34259  * Parameters:
  34260  *      unit - (IN) Unit number.
  34261  *      entry - (IN) BCM field entry id.
  34262  *      port_id - (OUT)  port id.
  34263  *      port_mask - (OUT)  port mask.
  34264  * Returns:
  34265  *      BCM_E_XXX
  34266  * Notes:
  34267  */
  34268 int bcm_esw_field_qualify_DstGports_get(
  34269     int unit,
  34270     bcm_field_entry_t entry,
  34271     bcm_gport_t *port_id,
  34272     bcm_gport_t *port_mask)
  34273 {
  34274     int rv = BCM_E_UNAVAIL;  /* Operation return status.  */
  34275 #if defined(BCM_TRX_SUPPORT) && defined(INCLUDE_L3)
  34276     uint32 data = 0;       /* HW encoded qualifier data.  */
  34277     uint32 mask = 0;       /* HW encoding qualifier mask. */
  34278     _field_entry_t *f_ent; /* Field entry structure. */
  34279 
  34280     /* Input parameters check. */
  34281     if ((NULL == port_id) || (NULL == port_mask)) {
  34282         return (BCM_E_PARAM);
  34283     }
  34284 
  34285     /* Read qualifier match value and mask. */
  34286     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  34287                                             bcmFieldQualifyDstGports,
  34288                                             &data, &mask);
  34289     BCM_IF_ERROR_RETURN(rv);
  34290 
  34291     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  34292         bcmFieldQualifyDstGports, &f_ent));
  34293 
  34294     /* Check if entry belongs to Egress Stage. */
  34295     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  34296          /* Clear DVP Valid bit. */
  34297          data >>= 1;
  34298 
  34299         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34300             mask >>= 1;
  34301         }
  34302     } else {
  34303         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  34304             entry, bcmFieldQualifyDstGports, &data, &mask));
  34305     }
  34306 
  34307     if (_bcm_vp_used_get(unit, data, _bcmVpTypeMpls)) {
  34308         BCM_GPORT_MPLS_PORT_ID_SET(*port_id, data);
  34309         BCM_GPORT_MPLS_PORT_ID_SET(*port_mask, mask);
  34310     } else if (_bcm_vp_used_get(unit, data, _bcmVpTypeMim)) {
  34311         BCM_GPORT_MIM_PORT_ID_SET(*port_id, data);
  34312         BCM_GPORT_MIM_PORT_ID_SET(*port_mask, mask);
  34313     } else if (_bcm_vp_used_get(unit, data, _bcmVpTypeNiv)) {
  34314         BCM_GPORT_NIV_PORT_ID_SET(*port_id, data);
  34315         BCM_GPORT_NIV_PORT_ID_SET(*port_mask, mask);
  34316     } else if (_bcm_vp_used_get(unit, data, _bcmVpTypeVlan)) {
  34317         BCM_GPORT_VLAN_PORT_ID_SET(*port_id, data);
  34318         BCM_GPORT_VLAN_PORT_ID_SET(*port_mask, mask);
  34319     } else if (_bcm_vp_used_get(unit, data, _bcmVpTypeWlan)) {
  34320         BCM_GPORT_WLAN_PORT_ID_SET(*port_id, data);
  34321         BCM_GPORT_WLAN_PORT_ID_SET(*port_mask, mask);
  34322     } else if (_bcm_vp_used_get(unit, data, _bcmVpTypeVxlan)) {
  34323         BCM_GPORT_VXLAN_PORT_ID_SET(*port_id, data);
  34324         BCM_GPORT_VXLAN_PORT_ID_SET(*port_mask, mask);
  34325     } else if (_bcm_vp_used_get(unit, data, _bcmVpTypeFlow)) {
  34326         BCM_GPORT_FLOW_PORT_ID_SET(*port_id, data);
  34327         BCM_GPORT_FLOW_PORT_ID_SET(*port_mask, mask);
  34328     } else {
  34329         BCM_GPORT_MODPORT_SET(*port_id, ((data >> _FP_PORT_BITWIDTH(unit)) & 0xff),
  34330                              (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  34331         BCM_GPORT_MODPORT_SET(*port_mask, ((mask >> _FP_PORT_BITWIDTH(unit)) & 0xff),
  34332                              (mask & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  34333     }
  34334 #endif
  34335     return rv;
  34336 }
  34337 
  34338 /*
  34339  * Function:
  34340  *      bcm_esw_field_qualify_SrcMimGports
  34341  * Purpose:
  34342  *      Add source mim port field qualification to a field entry.
  34343  * Parameters:
  34344  *      unit - (IN) Unit number.
  34345  *      entry - (IN) Field Entry id.
  34346  *      mim_port_id - (IN) Mim virtual port id.
  34347  *      mim_port_mask - (IN) Mim virtual port id mask.
  34348  * Returns:
  34349  *      BCM_E_XXX
  34350  * Notes:
  34351  */
  34352 int bcm_esw_field_qualify_SrcMimGports(
  34353     int unit,
  34354     bcm_field_entry_t entry,
  34355     bcm_gport_t mim_port_id,
  34356     bcm_gport_t mim_port_mask)
  34357 {
  34358 #if defined(BCM_TOMAHAWK_SUPPORT)
  34359     _field_control_t *fc;   /* Field control structure. */
  34360 #endif
  34361     _field_group_t *fg;     /* Field group structure    */
  34362     uint32 data = 0;        /* HW data match criteria.  */
  34363     uint32 mask = 0;        /* HW data mask.            */
  34364     int rv;                 /* Operation return status. */
  34365     int ingress_entity = 0; /* Ingress entity or source entity */
  34366     int i;
  34367 
  34368     /* Input parameters check. */
  34369     if (0 == BCM_GPORT_IS_MIM_PORT(mim_port_id)) {
  34370         return (BCM_E_PARAM);
  34371     }
  34372 
  34373     if (mim_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34374         if (0 == BCM_GPORT_IS_MIM_PORT(mim_port_mask)) {
  34375             return (BCM_E_PARAM);
  34376         }
  34377     }
  34378 
  34379     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
  34380 
  34381     /* Get the source virtual port value and mask*/
  34382     data  = BCM_GPORT_MIM_PORT_ID_GET(mim_port_id);
  34383 
  34384     if (mim_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34385         mask  = BCM_GPORT_MIM_PORT_ID_GET(mim_port_mask);
  34386     } else {
  34387         mask = BCM_FIELD_EXACT_MATCH_MASK;
  34388     }
  34389 
  34390     
  34391     /*
  34392      * Invoke driver function for multi pipe supported devices.
  34393      */ 
  34394 #if defined(BCM_TOMAHAWK_SUPPORT)
  34395     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  34396         FP_LOCK(unit);
  34397         rv = _field_control_get(unit, &fc);
  34398         if (BCM_FAILURE(rv)) {
  34399             FP_UNLOCK(unit);
  34400             return rv;
  34401         }
  34402         rv = fc->functions.fp_qualify_svp(unit, entry,
  34403                                           bcmFieldQualifySrcMimGports,
  34404                                           data, mask, 1);
  34405         FP_UNLOCK(unit);
  34406         return (rv);
  34407     }
  34408 #endif /* BCM_TOMAHAWK_SUPPORT */
  34409 
  34410     /* Check which configuration of SrcVlanGport is in use */
  34411     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
  34412          if (fg->sel_codes[i].ingress_entity_sel ==
  34413                  _bcmFieldFwdEntityMimGport) {
  34414              ingress_entity = 1;
  34415              break;
  34416          }
  34417     }
  34418 
  34419     FP_LOCK(unit);
  34420 
  34421     if (ingress_entity) {
  34422         /* Internal qualifier to set SVP valid bit in Fixed field */
  34423         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
  34424         if (BCM_FAILURE(rv)) {
  34425             FP_UNLOCK(unit);
  34426             return (rv);
  34427         }
  34428     }
  34429 
  34430     /* Qualify Vlan Source Virtual Port */
  34431     /* In Stage Lookup bcmFieldQualifySrcMimGports = 20 bits
  34432        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
  34433        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp
  34434        ==> data = svp_valid|s_type_sel|s_field
  34435      */
  34436     rv = _field_qualify_source_virtual_port(unit, entry,
  34437             bcmFieldQualifySrcMimGports, data, mask, ingress_entity);
  34438 
  34439     FP_UNLOCK(unit);
  34440     return (rv);
  34441 }
  34442 
  34443 /*
  34444  * Function:
  34445  *      bcm_esw_field_qualify_SrcMimGports_get
  34446  * Purpose:
  34447  *      Get match criteria for bcmFieildQualifySrcMimGports
  34448  *                     qualifier from the field entry.
  34449  * Parameters:
  34450  *      unit - (IN) Unit number.
  34451  *      entry - (IN) BCM field entry id.
  34452  *      mim_port_id - (OUT) Mim port id.
  34453  *      mim_port_mask - (OUT) Mim port mask.
  34454  * Returns:
  34455  *      BCM_E_XXX
  34456  * Notes:
  34457  */
  34458 int bcm_esw_field_qualify_SrcMimGports_get(
  34459     int unit,
  34460     bcm_field_entry_t entry,
  34461     bcm_gport_t *mim_port_id,
  34462     bcm_gport_t *mim_port_mask)
  34463 {
  34464     uint32 data = 0;   /* HW encoded qualifier data.  */
  34465     uint32 mask = 0;   /* HW encoding qualifier mask. */
  34466     int rv;            /* Operation return status.    */
  34467 
  34468     /* Input parameters check. */
  34469     if (NULL == mim_port_id) {
  34470         return (BCM_E_PARAM);
  34471     }
  34472 
  34473     /* Read qualifier match value and mask. */
  34474     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  34475                                            bcmFieldQualifySrcMimGports,
  34476                                            &data, &mask);
  34477     BCM_IF_ERROR_RETURN(rv);
  34478 
  34479     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  34480         data &=  0x1fff;
  34481     }
  34482     BCM_GPORT_MIM_PORT_ID_SET(*mim_port_id, data);
  34483     BCM_GPORT_MIM_PORT_ID_SET(*mim_port_mask, mask);
  34484 
  34485     return BCM_E_NONE;
  34486 }
  34487 
  34488 /*
  34489  * Function:
  34490  *      bcm_esw_field_qualify_DstMimGports
  34491  * Purpose:
  34492  *      Add destination mim port field qualification to a field entry.
  34493  * Parameters:
  34494  *      unit - (IN) Unit number.
  34495  *      entry - (IN) Field Entry id.
  34496  *      mim_port_id - (IN) Mim virtual port id.
  34497  *      mim_port_mask - (IN) Mim virtual port id mask.
  34498  * Returns:
  34499  *      BCM_E_XXX
  34500  * Notes:
  34501  */
  34502 int bcm_esw_field_qualify_DstMimGports(
  34503     int unit,
  34504     bcm_field_entry_t entry,
  34505     bcm_gport_t mim_port_id,
  34506     bcm_gport_t mim_port_mask)
  34507 {
  34508 #if defined(BCM_TOMAHAWK_SUPPORT)
  34509     _field_control_t *fc;   /* Field control structure. */
  34510 #endif
  34511     uint32 data = 0;        /* HW data match criteria.  */
  34512     uint32 mask = 0;        /* HW data mask.            */
  34513     int rv;                 /* Operation return status. */
  34514     _field_entry_t *f_ent;  /* Field entry structure.   */
  34515 
  34516     /* Input parameters check. */
  34517     if (0 == BCM_GPORT_IS_MIM_PORT(mim_port_id)) {
  34518         return (BCM_E_PARAM);
  34519     }
  34520 
  34521     if (mim_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34522         if (0 == BCM_GPORT_IS_MIM_PORT(mim_port_mask)) {
  34523             return (BCM_E_PARAM);
  34524         }
  34525     }
  34526 
  34527     data  = BCM_GPORT_MIM_PORT_ID_GET(mim_port_id);
  34528 
  34529     if (mim_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34530         mask  = BCM_GPORT_MIM_PORT_ID_GET(mim_port_mask);
  34531     } else {
  34532         mask = BCM_FIELD_EXACT_MATCH_MASK;
  34533     }
  34534 
  34535     
  34536     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  34537                         bcmFieldQualifyDstMimGports, &f_ent));
  34538     /*
  34539      * Invoke driver function for multi pipe supported devices.
  34540      */ 
  34541 #if defined(BCM_TOMAHAWK_SUPPORT)
  34542     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  34543         (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id)) {
  34544 
  34545         FP_LOCK(unit);
  34546         rv = _field_control_get(unit, &fc);
  34547         if (BCM_FAILURE(rv)) {
  34548             FP_UNLOCK(unit);
  34549             return rv;
  34550         }
  34551         rv = fc->functions.fp_qualify_dvp(unit, entry,
  34552                                           bcmFieldQualifyDstMimGports,
  34553                                           data, mask, 1);
  34554         FP_UNLOCK(unit);
  34555         return (rv);
  34556     }
  34557 #endif /* BCM_TOMAHAWK_SUPPORT */
  34558 
  34559 
  34560 
  34561     FP_LOCK(unit);
  34562 
  34563     /* Check if entry belongs to Egress Stage. */
  34564     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  34565         /*
  34566          * LSB is DVP valid bit.
  34567          * Shift DVP value by 1-bit,
  34568          */
  34569         data <<= 1;
  34570 
  34571         /* Set DVP Valid bit. */
  34572         data |= 1;
  34573 
  34574         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34575             mask <<= 1;
  34576             mask |=1;
  34577         }
  34578     } else {
  34579         /* Qualify the destination type qualifier */
  34580         rv = _field_dest_type_qualify(unit, entry,
  34581                                       bcmFieldQualifyDstMimGports, 
  34582                                       &data, &mask, 
  34583                                       _bcmFieldDestTypeNone);
  34584         if (BCM_FAILURE(rv)) {
  34585             FP_UNLOCK(unit);
  34586             return (rv);
  34587         }
  34588     }
  34589 
  34590     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstMimGports,
  34591                           data, mask);
  34592 
  34593     FP_UNLOCK(unit);
  34594     return (rv);
  34595 }
  34596 
  34597 /*
  34598  * Function:
  34599  *      bcm_esw_field_qualify_DstMimGports_get
  34600  * Purpose:
  34601  *      Get match criteria for bcmFieildQualifyDstMimGports
  34602  *                     qualifier from the field entry.
  34603  * Parameters:
  34604  *      unit - (IN) Unit number.
  34605  *      entry - (IN) BCM field entry id.
  34606  *      mim_port_id - (OUT) Mim port id.
  34607  *      mim_port_mask - (OUT) Mim port mask.
  34608  * Returns:
  34609  *      BCM_E_XXX
  34610  * Notes:
  34611  */
  34612 int bcm_esw_field_qualify_DstMimGports_get(
  34613     int unit,
  34614     bcm_field_entry_t entry,
  34615     bcm_gport_t *mim_port_id,
  34616     bcm_gport_t *mim_port_mask)
  34617 {
  34618     uint32 data = 0;       /* HW encoded qualifier data.  */
  34619     uint32 mask = 0;       /* HW encoding qualifier mask. */
  34620     int rv;                /* Operation return status.    */
  34621     _field_entry_t *f_ent; /* Field entry structure. */
  34622 
  34623     /* Input parameters check. */
  34624     if ((NULL == mim_port_id) || (NULL == mim_port_mask)) {
  34625         return (BCM_E_PARAM);
  34626     }
  34627 
  34628     /* Read qualifier match value and mask. */
  34629     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  34630                                             bcmFieldQualifyDstMimGports,
  34631                                             &data, &mask);
  34632     BCM_IF_ERROR_RETURN(rv);
  34633 
  34634     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  34635         bcmFieldQualifyDstMimGports, &f_ent));
  34636 
  34637     /* Check if entry belongs to Egress Stage. */
  34638     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  34639          /* Clear DVP Valid bit. */
  34640          data >>= 1;
  34641 
  34642         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34643             mask >>= 1;
  34644         }
  34645     } else {
  34646         if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  34647            BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  34648                entry, bcmFieldQualifyDstMimGports, &data, &mask));
  34649         } 
  34650     }
  34651 
  34652     BCM_GPORT_MIM_PORT_ID_SET(*mim_port_id, data);
  34653     BCM_GPORT_MIM_PORT_ID_SET(*mim_port_mask, mask);
  34654 
  34655     return BCM_E_NONE;
  34656 }
  34657 
  34658 /*
  34659  * Function:
  34660  *      bcm_esw_field_qualify_SrcNivGports
  34661  * Purpose:
  34662  *      Add source niv port field qualification to a field entry.
  34663  * Parameters:
  34664  *      unit - (IN) Unit number.
  34665  *      entry - (IN) Field Entry id.
  34666  *      niv_port_id - (IN) Niv virtual port id.
  34667  *      niv_port_mask - (IN) Niv virtual port id mask.
  34668  * Returns:
  34669  *      BCM_E_XXX
  34670  * Notes:
  34671  */
  34672 int bcm_esw_field_qualify_SrcNivGports(
  34673     int unit,
  34674     bcm_field_entry_t entry,
  34675     bcm_gport_t niv_port_id,
  34676     bcm_gport_t niv_port_mask)
  34677 {
  34678 #if defined(BCM_TOMAHAWK_SUPPORT)
  34679     _field_control_t *fc;   /* Field control structure. */
  34680 #endif
  34681     _field_group_t *fg;     /* Field group structure    */
  34682     uint32 data = 0;        /* HW data match criteria.  */
  34683     uint32 mask = 0;        /* HW data mask.            */
  34684     int rv;                 /* Operation return status. */
  34685     int ingress_entity = 0; /* Ingress entity or source entity */
  34686     int i;
  34687 
  34688     /* Input parameters check. */
  34689     if (0 == BCM_GPORT_IS_NIV_PORT(niv_port_id)) {
  34690         return (BCM_E_PARAM);
  34691     }
  34692 
  34693     if (niv_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34694         if (0 == BCM_GPORT_IS_NIV_PORT(niv_port_mask)) {
  34695             return (BCM_E_PARAM);
  34696         }
  34697     }
  34698 
  34699     BCM_IF_ERROR_RETURN(_bcm_field_entry_group_find(unit, entry, &fg));
  34700 
  34701     /* Get the source virtual port value and mask*/
  34702     data  = BCM_GPORT_NIV_PORT_ID_GET(niv_port_id);
  34703 
  34704     if (niv_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34705         mask  = BCM_GPORT_NIV_PORT_ID_GET(niv_port_mask);
  34706     } else {
  34707         mask = BCM_FIELD_EXACT_MATCH_MASK;
  34708     }
  34709 
  34710     
  34711     /*
  34712      * Invoke driver function for multi pipe supported devices.
  34713      */ 
  34714 #if defined(BCM_TOMAHAWK_SUPPORT)
  34715     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  34716         FP_LOCK(unit);
  34717         rv = _field_control_get(unit, &fc);
  34718         if (BCM_FAILURE(rv)) {
  34719             FP_UNLOCK(unit);
  34720             return rv;
  34721         }
  34722         rv = fc->functions.fp_qualify_svp(unit, entry,
  34723                                           bcmFieldQualifySrcNivGports,
  34724                                           data, mask, 1);
  34725         FP_UNLOCK(unit);
  34726         return (rv);
  34727     }
  34728 #endif /* BCM_TOMAHAWK_SUPPORT */
  34729 
  34730     /* Check which configuration of SrcVlanGport is in use */
  34731     for (i = 0; i < _FP_MAX_ENTRY_WIDTH; i++) {
  34732          if (fg->sel_codes[i].ingress_entity_sel ==
  34733                     _bcmFieldFwdEntityNivGport) {
  34734              ingress_entity = 1;
  34735              break;
  34736          }
  34737     }
  34738 
  34739     FP_LOCK(unit);
  34740 
  34741     if (ingress_entity) {
  34742         /* Internal qualifier to set SVP valid bit in Fixed field */
  34743         rv = _field_qualify32(unit, entry, _bcmFieldQualifySvpValid, 1, 1);
  34744         if (BCM_FAILURE(rv)) {
  34745             FP_UNLOCK(unit);
  34746             return (rv);
  34747         }
  34748     }
  34749 
  34750     /* Qualify Niv Source Virtual Port */
  34751     /* In Stage Lookup bcmFieldQualifySrcNivGports = 20 bits
  34752        S_FIELD = 16 bits S_TYPE_SEL = 3 bits SVP_VALID = 1 bits
  34753        S_TYPE_SEL = 0 and SVP_VALID = 1 implies S_FIELD = svp
  34754        ==> data = svp_valid|s_type_sel|s_field
  34755      */
  34756     rv = _field_qualify_source_virtual_port(unit, entry,
  34757             bcmFieldQualifySrcNivGports, data, mask, ingress_entity);
  34758 
  34759     FP_UNLOCK(unit);
  34760     return (rv);
  34761 }
  34762 
  34763 /*
  34764  * Function:
  34765  *      bcm_esw_field_qualify_SrcNivGports_get
  34766  * Purpose:
  34767  *      Get match criteria for bcmFieildQualifyNivGports
  34768  *                     qualifier from the field entry.
  34769  * Parameters:
  34770  *      unit - (IN) Unit number.
  34771  *      entry - (IN) BCM field entry id.
  34772  *      niv_port_id - (OUT) Niv port id.
  34773  *      niv_port_mask - (OUT) Niv port mask.
  34774  * Returns:
  34775  *      BCM_E_XXX
  34776  * Notes:
  34777  */
  34778 int bcm_esw_field_qualify_SrcNivGports_get(
  34779     int unit,
  34780     bcm_field_entry_t entry,
  34781     bcm_gport_t *niv_port_id,
  34782     bcm_gport_t *niv_port_mask)
  34783 {
  34784     uint32 data = 0; /* HW encoded qualifier data.  */
  34785     uint32 mask = 0; /* HW encoding qualifier mask. */
  34786     int rv;          /* Operation return status.    */
  34787 
  34788     /* Input parameters check. */
  34789     if ((NULL == niv_port_id) || (NULL == niv_port_mask)) {
  34790         return (BCM_E_PARAM);
  34791     }
  34792 
  34793     /* Read qualifier match value and mask. */
  34794     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  34795                                            bcmFieldQualifySrcNivGports,
  34796                                            &data, &mask);
  34797     BCM_IF_ERROR_RETURN(rv);
  34798 
  34799     if (!soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  34800        data &=  0x1fff;
  34801     }
  34802     BCM_GPORT_NIV_PORT_ID_SET(*niv_port_id, data);
  34803     BCM_GPORT_NIV_PORT_ID_SET(*niv_port_mask, mask);
  34804 
  34805     return BCM_E_NONE;
  34806 }
  34807 
  34808 /*
  34809  * Function:
  34810  *      bcm_esw_field_qualify_DstNivGports
  34811  * Purpose:
  34812  *      Add destination niv port field qualification to a field entry.
  34813  * Parameters:
  34814  *      unit - (IN) Unit number.
  34815  *      entry - (IN) Field Entry id.
  34816  *      niv_port_id - (IN) Niv virtual port id.
  34817  *      niv_port_mask - (IN) Niv virtual port id mask.
  34818  * Returns:
  34819  *      BCM_E_XXX
  34820  * Notes:
  34821  */
  34822 int bcm_esw_field_qualify_DstNivGports(
  34823     int unit,
  34824     bcm_field_entry_t entry,
  34825     bcm_gport_t niv_port_id,
  34826     bcm_gport_t niv_port_mask)
  34827 {
  34828 #if defined(BCM_TOMAHAWK_SUPPORT)
  34829     _field_control_t *fc;   /* Field control structure. */
  34830 #endif
  34831     uint32 data = 0;        /* HW data match criteria.  */
  34832     uint32 mask = 0;        /* HW data mask.            */
  34833     int rv;                 /* Operation return status. */
  34834     _field_entry_t *f_ent;  /* Field entry structure.   */
  34835 
  34836     /* Input parameters check. */
  34837     if (0 == BCM_GPORT_IS_NIV_PORT(niv_port_id)) {
  34838         return (BCM_E_PARAM);
  34839     }
  34840 
  34841     if (niv_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34842         if (0 == BCM_GPORT_IS_NIV_PORT(niv_port_mask)) {
  34843             return (BCM_E_PARAM);
  34844         }
  34845     }
  34846 
  34847     data  = BCM_GPORT_NIV_PORT_ID_GET(niv_port_id);
  34848 
  34849     if (niv_port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34850         mask  = BCM_GPORT_NIV_PORT_ID_GET(niv_port_mask);
  34851     } else {
  34852         mask = BCM_FIELD_EXACT_MATCH_MASK;
  34853     }
  34854 
  34855     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  34856                         bcmFieldQualifyDstNivGports, &f_ent));
  34857     
  34858     /*
  34859      * Invoke driver function for multi pipe supported devices.
  34860      */ 
  34861 #if defined(BCM_TOMAHAWK_SUPPORT)
  34862     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  34863         (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id)) {
  34864         FP_LOCK(unit);
  34865         rv = _field_control_get(unit, &fc);
  34866         if (BCM_FAILURE(rv)) {
  34867             FP_UNLOCK(unit);
  34868             return rv;
  34869         }
  34870         rv = fc->functions.fp_qualify_dvp(unit, entry,
  34871                                           bcmFieldQualifyDstNivGports,
  34872                                           data, mask, 1);
  34873         FP_UNLOCK(unit);
  34874         return (rv);
  34875     }
  34876 #endif /* BCM_TOMAHAWK_SUPPORT */
  34877 
  34878     FP_LOCK(unit);
  34879 
  34880     /* Check if entry belongs to Egress Stage. */
  34881     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  34882         /*
  34883          * LSB is DVP valid bit.
  34884          * Shift DVP value by 1-bit,
  34885          */
  34886         data <<= 1;
  34887 
  34888         /* Set DVP Valid bit. */
  34889         data |= 1;
  34890 
  34891         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34892             mask <<= 1;
  34893             mask |=1;
  34894         }
  34895     } else {
  34896         /* Qualify the destination type qualifier */
  34897         rv = _field_dest_type_qualify(unit, entry,
  34898                                       bcmFieldQualifyDstNivGports, 
  34899                                       &data, &mask, 
  34900                                       _bcmFieldDestTypeNone);
  34901         if (BCM_FAILURE(rv)) {
  34902             FP_UNLOCK(unit);
  34903             return (rv);
  34904         }
  34905     }
  34906 
  34907     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstNivGports,
  34908                           data, mask);
  34909 
  34910     FP_UNLOCK(unit);
  34911     return (rv);
  34912 }
  34913 
  34914 /*
  34915  * Function:
  34916  *      bcm_esw_field_qualify_DstNivGports_get
  34917  * Purpose:
  34918  *      Get match criteria for bcmFieildQualifyDstNivGports
  34919  *                     qualifier from the field entry.
  34920  * Parameters:
  34921  *      unit - (IN) Unit number.
  34922  *      entry - (IN) BCM field entry id.
  34923  *      niv_port_id - (OUT) Niv port id.
  34924  *      niv_port_mask - (OUT) Niv port mask.
  34925  * Returns:
  34926  *      BCM_E_XXX
  34927  * Notes:
  34928  */
  34929 int bcm_esw_field_qualify_DstNivGports_get(
  34930     int unit,
  34931     bcm_field_entry_t entry,
  34932     bcm_gport_t *niv_port_id,
  34933     bcm_gport_t *niv_port_mask)
  34934 {
  34935     uint32 data = 0;       /* HW encoded qualifier data.  */
  34936     uint32 mask = 0;       /* HW encoding qualifier mask. */
  34937     int rv;                /* Operation return status.    */
  34938     _field_entry_t *f_ent; /* Field entry structure. */
  34939 
  34940     /* Input parameters check. */
  34941     if ((NULL == niv_port_id) || (NULL == niv_port_mask)) {
  34942         return (BCM_E_PARAM);
  34943     }
  34944 
  34945     /* Read qualifier match value and mask. */
  34946     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  34947                                             bcmFieldQualifyDstNivGports,
  34948                                             &data, &mask);
  34949     BCM_IF_ERROR_RETURN(rv);
  34950 
  34951     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry,
  34952         bcmFieldQualifyDstNivGports, &f_ent));
  34953 
  34954     /* Check if entry belongs to Egress Stage. */
  34955     if (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id) {
  34956          /* Clear DVP Valid bit. */
  34957          data >>= 1;
  34958 
  34959         if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  34960             mask >>= 1;
  34961         }
  34962     } else {
  34963         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  34964             entry, bcmFieldQualifyDstNivGports, &data, &mask));
  34965     }
  34966 
  34967     BCM_GPORT_NIV_PORT_ID_SET(*niv_port_id, data);
  34968     BCM_GPORT_NIV_PORT_ID_SET(*niv_port_mask, mask);
  34969 
  34970     return BCM_E_NONE;
  34971 }
  34972 
  34973 /*
  34974  * Function:
  34975  *      bcm_esw_field_qualify_SrcModPortGports
  34976  * Purpose:
  34977  *      Add source modport field qualification to a field entry.
  34978  * Parameters:
  34979  *      unit - (IN) Unit number.
  34980  *      entry - (IN) Field Entry id.
  34981  *      port_id - (IN) ModPort id.
  34982  *      port_mask - (IN) ModPort id mask.
  34983  * Returns:
  34984  *      BCM_E_XXX
  34985  * Notes:
  34986  */
  34987 int bcm_esw_field_qualify_SrcModPortGports(
  34988     int unit,
  34989     bcm_field_entry_t entry,
  34990     bcm_gport_t port_id,
  34991     bcm_gport_t port_mask)
  34992 {
  34993     uint32 data;            /* HW data match criteria.  */
  34994     uint32 mask;            /* HW data mask.            */
  34995     int rv;                 /* Operation return status. */
  34996 
  34997     /* Input parameters check. */
  34998     if (0 == BCM_GPORT_IS_MODPORT(port_id)) {
  34999         return (BCM_E_PARAM);
  35000     }
  35001 
  35002     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  35003         if (0 == BCM_GPORT_IS_MODPORT(port_mask)) {
  35004             return (BCM_E_PARAM);
  35005         }
  35006     }
  35007 
  35008     data  = BCM_GPORT_MODPORT_PORT_GET(port_id);
  35009     data |= ((BCM_GPORT_MODPORT_MODID_GET(port_id)) << _FP_PORT_BITWIDTH(unit));
  35010 
  35011     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  35012         mask = BCM_GPORT_MODPORT_PORT_GET(port_mask);
  35013         mask |= ((BCM_GPORT_MODPORT_MODID_GET(port_mask)) << _FP_PORT_BITWIDTH(unit));
  35014     } else {
  35015         mask = BCM_FIELD_EXACT_MATCH_MASK;
  35016     }
  35017 
  35018     
  35019     FP_LOCK(unit);
  35020 
  35021     rv = _field_qualify32(unit, entry, bcmFieldQualifySrcModPortGports,
  35022                           data, mask);
  35023 
  35024     FP_UNLOCK(unit);
  35025     return (rv);
  35026 }
  35027 
  35028 /*
  35029  * Function:
  35030  *      bcm_esw_field_qualify_SrcModPortGports_get
  35031  * Purpose:
  35032  *      Get match criteria for bcmFieildQualifySrcModPortGports
  35033  *                     qualifier from the field entry.
  35034  * Parameters:
  35035  *      unit - (IN) Unit number.
  35036  *      entry - (IN) BCM field entry id.
  35037  *      port_id - (OUT) ModPort port id.
  35038  *      port_mask - (OUT) ModPort port mask.
  35039  * Returns:
  35040  *      BCM_E_XXX
  35041  * Notes:
  35042  */
  35043 int bcm_esw_field_qualify_SrcModPortGports_get(
  35044     int unit,
  35045     bcm_field_entry_t entry,
  35046     bcm_gport_t *port_id,
  35047     bcm_gport_t *port_mask)
  35048 {
  35049     uint32 data;   /* HW encoded qualifier data.  */
  35050     uint32 mask;   /* HW encoding qualifier mask. */
  35051     int rv;        /* Operation return status.    */
  35052 
  35053     /* Input parameters check. */
  35054     if ((NULL == port_id) || (NULL == port_mask)) {
  35055         return (BCM_E_PARAM);
  35056     }
  35057 
  35058     /* Read qualifier match value and mask. */
  35059     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  35060                                            bcmFieldQualifySrcModPortGports,
  35061                                            &data, &mask);
  35062     BCM_IF_ERROR_RETURN(rv);
  35063 
  35064     BCM_GPORT_MODPORT_SET(*port_id, ((data >> _FP_PORT_BITWIDTH(unit)) & 0xff),
  35065                           (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  35066 
  35067     BCM_GPORT_MODPORT_SET(*port_mask, ((mask >> _FP_PORT_BITWIDTH(unit)) & 0xff),
  35068                           (mask & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  35069 
  35070     return BCM_E_NONE;
  35071 }
  35072 
  35073 /*
  35074  * Function:
  35075  *      bcm_esw_field_qualify_DstMulticastGroups
  35076  * Purpose:
  35077  *     Add a destination multicast group field qualification to a field entry.
  35078  * Parameters:
  35079  *      unit  - (IN) Unit number.
  35080  *      entry - (IN) Field Entry id.
  35081  *      group - (IN) Multicast group id.
  35082  *      mask  - (IN) Multicast group id mask.
  35083  * Returns:
  35084  *      BCM_E_XXX
  35085  * Notes:
  35086  */
  35087 int
  35088 bcm_esw_field_qualify_DstMulticastGroups(
  35089     int unit,
  35090     bcm_field_entry_t entry,
  35091     bcm_multicast_t group,
  35092     bcm_multicast_t mask)
  35093 {
  35094     uint32 hw_data;            /* HW data match criteria.  */
  35095     uint32 hw_mask;            /* HW data mask.            */
  35096     int rv;                 /* Operation return status. */
  35097     uint8 ipmc_grp_type = 0;/* IPMC group type. */
  35098 
  35099     /* Input parameters check. */
  35100     if (0 == BCM_MULTICAST_IS_SET(group)) {
  35101         return (BCM_E_PARAM);
  35102     }
  35103 
  35104     if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  35105         if (0 == BCM_MULTICAST_IS_SET(mask)) {
  35106             return (BCM_E_PARAM);
  35107         }
  35108     }
  35109 
  35110     if (BCM_MULTICAST_IS_L3(group)) {
  35111         ipmc_grp_type = _bcmFieldDestTypeL3mc;
  35112         hw_data = BCM_MULTICAST_L3_GET(group);
  35113     } else if (BCM_MULTICAST_IS_L2(group)) {
  35114         ipmc_grp_type = _bcmFieldDestTypeL2mc;
  35115         hw_data = BCM_MULTICAST_L2_GET(group);
  35116     } else {
  35117         return (BCM_E_PARAM);
  35118     }
  35119 
  35120     if (mask == BCM_FIELD_EXACT_MATCH_MASK) {
  35121         hw_mask = (BCM_FIELD_EXACT_MATCH_MASK);
  35122     } else {
  35123         if (ipmc_grp_type == _bcmFieldDestTypeL3mc) {
  35124             hw_mask = BCM_MULTICAST_L3_GET(mask);
  35125         } else {
  35126             hw_mask = BCM_MULTICAST_L2_GET(mask);
  35127         }
  35128     }
  35129 
  35130     BCM_IF_ERROR_RETURN(_field_dest_type_qualify(unit, entry,
  35131         bcmFieldQualifyDstMulticastGroups, &hw_data, &hw_mask, ipmc_grp_type));
  35132 
  35133     
  35134     FP_LOCK(unit);
  35135 
  35136     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstMulticastGroups,
  35137                           hw_data, hw_mask);
  35138 
  35139     FP_UNLOCK(unit);
  35140     return (rv);
  35141 }
  35142 
  35143 /*
  35144  * Function:
  35145  *      bcm_esw_field_qualify_DstMulticastGroups_get
  35146  * Purpose:
  35147  *      Get match criteria for bcmFieildQualifyDstMulticastGroups
  35148  *                     qualifier from the field entry.
  35149  * Parameters:
  35150  *      unit - (IN) Unit number.
  35151  *      entry - (IN) BCM field entry id.
  35152  *      group - (OUT) Multicast group id.
  35153  *      mask  - (OUT) Multicast group id mask.
  35154  * Returns:
  35155  *      BCM_E_XXX
  35156  * Notes:
  35157  */
  35158 
  35159 int
  35160 bcm_esw_field_qualify_DstMulticastGroups_get(
  35161     int unit,
  35162     bcm_field_entry_t entry,
  35163     bcm_multicast_t *group,
  35164     bcm_multicast_t *mask)
  35165 {
  35166     uint32 hw_data;   /* HW encoded qualifier data.  */
  35167     uint32 hw_mask;   /* HW encoding qualifier mask. */
  35168     int rv;        /* Operation return status.    */
  35169     uint8 mc_grptype_data; /* Multicast Group Type */
  35170 
  35171     /* Read qualifier match value and mask. */
  35172     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  35173                                             bcmFieldQualifyDstMulticastGroups,
  35174                                             &hw_data, &hw_mask);
  35175 
  35176     BCM_IF_ERROR_RETURN(rv);
  35177 
  35178     /* Get Multicast group type info */
  35179     mc_grptype_data = hw_data >> _FP_MCAST_D_TYPE_OFFSET(unit);
  35180 
  35181     BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  35182                 entry, bcmFieldQualifyDstMulticastGroups, &hw_data, &hw_mask));
  35183 
  35184     if (_bcmFieldDestTypeL2mc == mc_grptype_data) {
  35185         /* L2 MC */
  35186         BCM_MULTICAST_L2_SET(*group, hw_data);
  35187         BCM_MULTICAST_L2_SET(*mask, hw_mask);
  35188     } else if (_bcmFieldDestTypeL3mc == mc_grptype_data)  {
  35189         /* IPMC */
  35190         BCM_MULTICAST_L3_SET(*group, hw_data);
  35191         BCM_MULTICAST_L3_SET(*mask, hw_mask);
  35192     } else {
  35193         return (BCM_E_INTERNAL);
  35194     }
  35195 
  35196     return BCM_E_NONE;
  35197 }
  35198 
  35199 /*
  35200  * Function:
  35201  *      bcm_esw_field_qualify_VxlanHeaderBits8_31
  35202  * Purpose:
  35203  *      Qualify Reserved_1(bits 8 to 31) field in Vxlan Header.
  35204  * Parameters:
  35205  *      unit - (IN) Unit number.
  35206  *      entry - (IN) Field Entry id.
  35207  *      data - (IN) Reserved_1 field (Lower 24 bits from the 32bit data).
  35208  *      mask - (IN) mask for Reserved_1 field.
  35209  * Returns:
  35210  *      BCM_E_XXX
  35211  * Notes:
  35212  */
  35213 int bcm_esw_field_qualify_VxlanHeaderBits8_31(
  35214     int unit,
  35215     bcm_field_entry_t entry,
  35216     uint32 data,
  35217     uint32 mask)
  35218 {
  35219     int                 rv;      /* Operation return status. */
  35220 
  35221     
  35222     FP_LOCK(unit);
  35223 
  35224     rv = _field_qualify32(unit, entry, bcmFieldQualifyVxlanHeaderBits8_31,
  35225                                    data, mask);
  35226 
  35227     FP_UNLOCK(unit);
  35228     return (rv);
  35229 }
  35230 
  35231 /*
  35232  * Function:
  35233  *      bcm_esw_field_qualify_VxlanHeaderBits8_31_get
  35234  * Purpose:
  35235  *      Get match criteria for Reserved_1(Bits 8 to 31)
  35236  *      field in Vxlan Header.
  35237  * Parameters:
  35238  *      unit - (IN) Unit number.
  35239  *      entry - (IN) Field Entry id.
  35240  *      data - (OUT) Reserved_1 field (Lower 24 bits from the 32bit data).
  35241  *      mask - (OUT) mask for Reserved_1 field.
  35242  * Returns:
  35243  *      BCM_E_XXX
  35244  * Notes:
  35245  */
  35246 int bcm_esw_field_qualify_VxlanHeaderBits8_31_get(
  35247     int unit,
  35248     bcm_field_entry_t entry,
  35249     uint32 *data,
  35250     uint32 *mask)
  35251 {
  35252     int              rv;        /* Operation return status. */
  35253 
  35254 
  35255     
  35256     FP_LOCK(unit);
  35257 
  35258     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  35259                                           bcmFieldQualifyVxlanHeaderBits8_31,
  35260                                           data, mask);
  35261     FP_UNLOCK(unit);
  35262     return (rv);
  35263 }
  35264 
  35265 /*
  35266  * Function:
  35267  *      bcm_esw_field_qualify_VxlanHeaderBits56_63
  35268  * Purpose:
  35269  *      Qualify Reserved_2(bits 56 to 63) field in Vxlan Header.
  35270  * Parameters:
  35271  *      unit - (IN) Unit number.
  35272  *      entry - (IN) Field Entry id.
  35273  *      data - (IN) Reserved_2 field.
  35274  *      mask - (IN) mask for Reserved_2 field.
  35275  * Returns:
  35276  *      BCM_E_XXX
  35277  * Notes:
  35278  */
  35279 int bcm_esw_field_qualify_VxlanHeaderBits56_63(
  35280     int unit,
  35281     bcm_field_entry_t entry,
  35282     uint8 data,
  35283     uint8 mask)
  35284 {
  35285     int                 rv;      /* Operation return status. */
  35286 
  35287     
  35288     FP_LOCK(unit);
  35289 
  35290     rv = _field_qualify32(unit, entry, bcmFieldQualifyVxlanHeaderBits56_63,
  35291                                    data, mask);
  35292 
  35293     FP_UNLOCK(unit);
  35294     return (rv);
  35295 }
  35296 
  35297 /*
  35298  * Function:
  35299  *      bcm_esw_field_qualify_VxlanHeaderBits56_63_get
  35300  * Purpose:
  35301  *      Get match criteria for Reserved_2(Bits 56 to 63)
  35302  *      field in Vxlan Header.
  35303  * Parameters:
  35304  *      unit - (IN) Unit number.
  35305  *      entry - (IN) Field Entry id.
  35306  *      data - (OUT) Reserved_2 field.
  35307  *      mask - (OUT) mask for Reserved_2 field.
  35308  * Returns:
  35309  *      BCM_E_XXX
  35310  * Notes:
  35311  */
  35312 int bcm_esw_field_qualify_VxlanHeaderBits56_63_get(
  35313     int unit,
  35314     bcm_field_entry_t entry,
  35315     uint8 *data,
  35316     uint8 *mask)
  35317 {
  35318     int              rv;        /* Operation return status. */
  35319 
  35320 
  35321     
  35322     FP_LOCK(unit);
  35323 
  35324     /* Read qualifier match value and mask. */
  35325     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  35326                                             bcmFieldQualifyVxlanHeaderBits56_63,
  35327                                             data, mask);
  35328     FP_UNLOCK(unit);
  35329     return (rv);
  35330 }
  35331 /*
  35332  * Function:
  35333  *      bcm_esw_field_group_oper_mode_set
  35334  * Purpose:
  35335  *      Configure Field Processor Group operational mode
  35336  *      per-CAP stage.
  35337  * Parameters:
  35338  *      unit    - (IN) BCM Device number.
  35339  *      stage   - (IN) Field Stage Qualifier enum value.
  35340  *      mode    - (IN) Field Group Operational Mode enum value.
  35341  * Returns:
  35342  *      BCM_E_NONE   - Operation successful.
  35343  *      BCM_E_PARAM  - Invalid operational mode or Field Stage.
  35344  *      BCM_E_INIT   - BCM unit not initialized.
  35345  *      BCM_E_BUSY   - Field stage has valid group/entry configured.
  35346  *
  35347  * Notes:
  35348  *      Valid "stage" input parameter values supported by
  35349  *      this API are:
  35350  *              "bcmFieldQualifyStageLookup"
  35351  * 	            "bcmFieldQualifyStageIngress"
  35352  *              "bcmFieldQualifyStageEgress"
  35353  *              "bcmFieldQualifyStageIngressExactMatch"
  35354  *              "bcmFieldQualifyStageClass"
  35355  *              "bcmFieldQualifyStageClassExactMatch".
  35356  */
  35357 int
  35358 bcm_esw_field_group_oper_mode_set(
  35359     int unit,
  35360     bcm_field_qualify_t stage,
  35361     bcm_field_group_oper_mode_t mode)
  35362 {
  35363     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35364 
  35365 #if defined(BCM_TOMAHAWK_SUPPORT)
  35366     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  35367         (0 == soc_feature(unit, soc_feature_field_single_pipe_support))) {
  35368        
  35369 
  35370        FP_LOCK(unit);
  35371        rv = (_bcm_field_th_group_oper_mode_set(unit, stage, mode));
  35372        FP_UNLOCK(unit);
  35373     } 
  35374 #endif /* BCM_TOMAHAWK_SUPPORT */
  35375 
  35376     return rv;
  35377 }
  35378 
  35379 /*
  35380  * Function:
  35381  *      bcm_esw_field_group_oper_mode_get
  35382  * Purpose:
  35383  *      Retrieve Field Processor Group operational mode
  35384  *      per-CAP stage.
  35385  * Parameters:
  35386  *      unit    - (IN)  BCM Device number.
  35387  *      stage   - (IN)  Field Stage Qualifier enum value.
  35388  *      mode    - (OUT) Reference to Field Group Operational
  35389  *                      Mode enum value.
  35390  * Returns:
  35391  *      BCM_E_NONE   - Operation successful.
  35392  *      BCM_E_PARAM  - Invalid parameter.
  35393  *      BCM_E_INIT   - BCM unit not initialized.
  35394  *
  35395  * Notes:
  35396  *      Valid "stage" input parameter values supported by
  35397  *      this API are:
  35398  *              "bcmFieldQualifyStageLookup"
  35399  * 	            "bcmFieldQualifyStageIngress"
  35400  *              "bcmFieldQualifyStageEgress"
  35401  *              "bcmFieldQualifyStageIngressExactMatch"
  35402  *              "bcmFieldQualifyStageClass"
  35403  *              "bcmFieldQualifyStageClassExactMatch".
  35404  */
  35405 
  35406 int
  35407 bcm_esw_field_group_oper_mode_get(
  35408     int unit,
  35409     bcm_field_qualify_t stage,
  35410     bcm_field_group_oper_mode_t *mode)
  35411 {
  35412     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35413 
  35414 #if defined(BCM_TOMAHAWK_SUPPORT)
  35415     if (soc_feature(unit, soc_feature_field_multi_pipe_support) &&
  35416         (0 == soc_feature(unit, soc_feature_field_single_pipe_support))) {
  35417        rv = _bcm_field_th_group_oper_mode_get(unit, stage, mode);
  35418     }
  35419 #endif /* BCM_TOMAHAWK_SUPPORT */
  35420 
  35421     return rv;
  35422 }
  35423 
  35424 /*
  35425  * Function:
  35426  *      bcm_esw_field_qualify_DestVirtualPortValid
  35427  *      Set match criteria for bcmFieldQualifyDestVirtualPortValid
  35428  *      qualifier in the field entry.
  35429  * Parameters:
  35430  *      unit    -   (IN) Unit number.
  35431  *      entry   -   (IN) BCM field entry id.
  35432  *      data    -   (IN) Qualifier match data.
  35433  *      mask    -   (IN) Qualifier match data.
  35434  * Returns:
  35435  *      BCM_E_XXX
  35436  * Notes:
  35437  */
  35438 int 
  35439 bcm_esw_field_qualify_DestVirtualPortValid(int unit, bcm_field_entry_t entry,
  35440                                           uint8 data, uint8 mask) 
  35441 {
  35442     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35443 
  35444 #if defined(BCM_TOMAHAWK_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT)
  35445 
  35446     if (data > 0x1) {
  35447         return (BCM_E_PARAM);
  35448     }
  35449 
  35450     
  35451 
  35452     FP_LOCK(unit);
  35453     rv = _field_qualify32(unit, entry, bcmFieldQualifyDestVirtualPortValid,
  35454                           data, mask);
  35455     FP_UNLOCK(unit);
  35456 #endif /* BCM_TOMAHAWK_SUPPORT */
  35457 
  35458     return rv;
  35459 }
  35460 
  35461 /*
  35462  * Function:
  35463  *      bcm_esw_field_qualify_DestVirtualPortValid_get
  35464  * Purpose:
  35465  *      Get match criteria for bcmFieldQualifyDestVirtualPortValid
  35466  *      qualifier from the field entry.
  35467  * Parameters:
  35468  *      unit    - (IN) Unit number.
  35469  *      entry   - (IN) BCM field entry id.
  35470  *      data    - (OUT) Qualifier match data.
  35471  *      mask    - (OUT) Qualifier match mask.
  35472  * Returns:
  35473  *      BCM_E_XXX
  35474  * Notes:
  35475  */
  35476 int 
  35477 bcm_esw_field_qualify_DestVirtualPortValid_get(int unit,
  35478                                                bcm_field_entry_t entry,
  35479                                                uint8 *data,
  35480                                                uint8 *mask)
  35481 {
  35482    int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35483 
  35484 #if defined(BCM_TOMAHAWK_SUPPORT) || defined(BCM_TRIDENT2_SUPPORT)
  35485     /* Read qualifier match value and mask. */
  35486     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  35487                                     bcmFieldQualifyDestVirtualPortValid,
  35488                                     data, mask);
  35489 #endif /* BCM_TOMAHAWK_SUPPORT */
  35490 
  35491     return rv;
  35492 }
  35493 
  35494 /*
  35495  * Function:
  35496  *      bcm_esw_field_qualify_FcoeOxID
  35497  *      Set match criteria for bcmFieldQualifyFcoeOxID
  35498  *      qualifier in the field entry.
  35499  * Parameters:
  35500  *      unit    -   (IN) Unit number.
  35501  *      entry   -   (IN) BCM field entry id.
  35502  *      data    -   (IN) Qualifier match data.
  35503  *      mask    -   (IN) Qualifier match data.
  35504  * Returns:
  35505  *      BCM_E_XXX
  35506  * Notes:
  35507  */
  35508 int
  35509 bcm_esw_field_qualify_FcoeOxID(int unit, 
  35510         bcm_field_entry_t entry,
  35511         uint16 data, 
  35512         uint16 mask)
  35513 {
  35514     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35515 #if defined BCM_TRIDENT2_SUPPORT
  35516 
  35517     if (soc_feature(unit, soc_feature_field_multi_pipe_support) ||
  35518             SOC_IS_APACHE(unit)) {
  35519 
  35520         
  35521 
  35522         FP_LOCK(unit);
  35523         rv = _field_qualify32(unit, entry,
  35524                               bcmFieldQualifyFcoeOxID,
  35525                               data, mask);
  35526         FP_UNLOCK(unit);
  35527     }
  35528 #endif /* BCM_TRIDENT2_SUPPORT */
  35529 
  35530     return (rv);
  35531 }
  35532 
  35533 /*
  35534  * Function:
  35535  *      bcm_esw_field_qualify_FcoeOxID_get
  35536  * Purpose:
  35537  *      Get match criteria for bcmFieldQualifyFcoeOxID
  35538  *      qualifier from the field entry.
  35539  * Parameters:
  35540  *      unit    - (IN) Unit number.
  35541  *      entry   - (IN) BCM field entry id.
  35542  *      data    - (OUT) Qualifier match data.
  35543  *      mask    - (OUT) Qualifier match mask.
  35544  * Returns:
  35545  *      BCM_E_XXX
  35546  * Notes:
  35547  */
  35548 int
  35549 bcm_esw_field_qualify_FcoeOxID_get(int unit,
  35550         bcm_field_entry_t entry,
  35551         uint16 *data,
  35552         uint16 *mask)
  35553 {
  35554     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35555 
  35556 #if defined BCM_TRIDENT2_SUPPORT
  35557     if (soc_feature(unit, soc_feature_field_multi_pipe_support) ||
  35558             SOC_IS_APACHE(unit)) {
  35559         /* Read qualifier match value and mask. */
  35560         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  35561                                                bcmFieldQualifyFcoeOxID,
  35562                                                data, mask);
  35563     }
  35564 #endif /* BCM_TRIDENT2_SUPPORT */
  35565     return (rv);
  35566 
  35567 }
  35568 
  35569 /*
  35570  * Function:
  35571  *      bcm_esw_field_qualify_FcoeRxID
  35572  *      Set match criteria for bcmFieldQualifyFcoeRxID
  35573  *      qualifier in the field entry.
  35574  * Parameters:
  35575  *      unit    -   (IN) Unit number.
  35576  *      entry   -   (IN) BCM field entry id.
  35577  *      data    -   (IN) Qualifier match data.
  35578  *      mask    -   (IN) Qualifier match data.
  35579  * Returns:
  35580  *      BCM_E_XXX
  35581  * Notes:
  35582  */
  35583 int
  35584 bcm_esw_field_qualify_FcoeRxID(int unit, 
  35585         bcm_field_entry_t entry,
  35586         uint16 data, 
  35587         uint16 mask)
  35588 {
  35589     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35590 #if defined BCM_TRIDENT2_SUPPORT
  35591 
  35592     if (soc_feature(unit, soc_feature_field_multi_pipe_support) ||
  35593             SOC_IS_APACHE(unit)) {
  35594         
  35595 
  35596         FP_LOCK(unit);
  35597         rv = _field_qualify32(unit, entry,
  35598                               bcmFieldQualifyFcoeRxID,
  35599                               data, mask);
  35600         FP_UNLOCK(unit);
  35601     }
  35602 #endif /* BCM_TRIDENT2_SUPPORT */
  35603 
  35604     return (rv);
  35605 }
  35606 
  35607 /*
  35608  * Function:
  35609  *      bcm_esw_field_qualify_FcoeRxID_get
  35610  * Purpose:
  35611  *      Get match criteria for bcmFieldQualifyFcoeRxID
  35612  *      qualifier from the field entry.
  35613  * Parameters:
  35614  *      unit    - (IN) Unit number.
  35615  *      entry   - (IN) BCM field entry id.
  35616  *      data    - (OUT) Qualifier match data.
  35617  *      mask    - (OUT) Qualifier match mask.
  35618  * Returns:
  35619  *      BCM_E_XXX
  35620  * Notes:
  35621  */
  35622 int
  35623 bcm_esw_field_qualify_FcoeRxID_get(int unit,
  35624         bcm_field_entry_t entry,
  35625         uint16 *data,
  35626         uint16 *mask)
  35627 {
  35628     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35629 
  35630 #if defined BCM_TRIDENT2_SUPPORT
  35631     if (soc_feature(unit, soc_feature_field_multi_pipe_support) ||
  35632             SOC_IS_APACHE(unit)) {
  35633         /* Read qualifier match value and mask. */
  35634         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  35635                                                bcmFieldQualifyFcoeRxID,
  35636                                                data, mask);
  35637     }
  35638 #endif /* BCM_TRIDENT2_SUPPORT */
  35639     return (rv);
  35640 }
  35641 
  35642 /*
  35643  * Function:
  35644  *      bcm_esw_field_qualify_IpProtocolClass
  35645  *      Set match criteria for bcmFieldQualifyIpProtocolClass
  35646  *      qualifier in the field entry.
  35647  * Parameters:
  35648  *      unit    -   (IN) Unit number.
  35649  *      entry   -   (IN) BCM field entry id.
  35650  *      data    -   (IN) Qualifier match data.
  35651  *      mask    -   (IN) Qualifier match data.
  35652  * Returns:
  35653  *      BCM_E_XXX
  35654  * Notes:
  35655  */
  35656 int
  35657 bcm_esw_field_qualify_IpProtocolClass(int unit, 
  35658                                       bcm_field_entry_t entry,
  35659                                       bcm_class_t data, 
  35660                                       bcm_class_t mask)
  35661 {
  35662     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35663 #if defined BCM_TOMAHAWK_SUPPORT
  35664     uint32 cdata = 0;           /* Class Data */
  35665     uint32 cmask = 0;           /* Class Mask */
  35666     
  35667     
  35668 
  35669     COMPILER_64_TO_32_LO(cdata, data);
  35670     COMPILER_64_TO_32_LO(cmask, mask);
  35671 
  35672     FP_LOCK(unit);
  35673     rv = _field_qualify32(unit, entry, 
  35674                           bcmFieldQualifyIpProtocolClass,
  35675                           cdata, cmask);
  35676     FP_UNLOCK(unit);
  35677 #endif /* BCM_TOMAHAWK_SUPPORT */
  35678 
  35679     return (rv);
  35680 }
  35681 
  35682 /*
  35683  * Function:
  35684  *      bcm_esw_field_qualify_IpProtocolClass_get
  35685  * Purpose:
  35686  *      Get match criteria for bcmFieldQualifyIpProtocolClass
  35687  *      qualifier from the field entry.
  35688  * Parameters:
  35689  *      unit    - (IN) Unit number.
  35690  *      entry   - (IN) BCM field entry id.
  35691  *      data    - (OUT) Qualifier match data.
  35692  *      mask    - (OUT) Qualifier match mask.
  35693  * Returns:
  35694  *      BCM_E_XXX
  35695  * Notes:
  35696  */
  35697 int
  35698 bcm_esw_field_qualify_IpProtocolClass_get(int unit,
  35699         bcm_field_entry_t entry,
  35700         bcm_class_t *data,
  35701         bcm_class_t *mask)
  35702 {
  35703     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35704 
  35705 #if defined BCM_TOMAHAWK_SUPPORT
  35706     /* Read qualifier match value and mask. */
  35707     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  35708                                                bcmFieldQualifyIpProtocolClass,
  35709                                                data, mask);
  35710 #endif /* BCM_TOMAHAWK_SUPPORT */
  35711     return (rv);
  35712 }
  35713 
  35714 /*
  35715  * Function:
  35716  *      bcm_esw_field_qualify_EtherTypeClass
  35717  *      Set match criteria for bcmFieldQualifyEtherTypeClass
  35718  *      qualifier in the field entry.
  35719  * Parameters:
  35720  *      unit    -   (IN) Unit number.
  35721  *      entry   -   (IN) BCM field entry id.
  35722  *      data    -   (IN) Qualifier match data.
  35723  *      mask    -   (IN) Qualifier match data.
  35724  * Returns:
  35725  *      BCM_E_XXX
  35726  * Notes:
  35727  */
  35728 int
  35729 bcm_esw_field_qualify_EtherTypeClass(int unit, 
  35730         bcm_field_entry_t entry,
  35731         bcm_class_t data, 
  35732         bcm_class_t mask)
  35733 {
  35734     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35735 #if defined BCM_TOMAHAWK_SUPPORT
  35736     uint32 cdata = 0;           /* Class Data */
  35737     uint32 cmask = 0;           /* Class Mask */
  35738 
  35739     
  35740 
  35741     COMPILER_64_TO_32_LO(cdata, data);
  35742     COMPILER_64_TO_32_LO(cmask, mask);
  35743 
  35744     FP_LOCK(unit);
  35745     rv = _field_qualify32(unit, entry, 
  35746                           bcmFieldQualifyEtherTypeClass,
  35747                           cdata, cmask);
  35748     FP_UNLOCK(unit);
  35749 #endif /* BCM_TOMAHAWK_SUPPORT */
  35750 
  35751     return (rv);
  35752 }
  35753 
  35754 /*
  35755  * Function:
  35756  *      bcm_esw_field_qualify_EtherTypeClass_get
  35757  * Purpose:
  35758  *      Get match criteria for bcmFieldQualifyEtherTypeClass
  35759  *      qualifier from the field entry.
  35760  * Parameters:
  35761  *      unit    - (IN) Unit number.
  35762  *      entry   - (IN) BCM field entry id.
  35763  *      data    - (OUT) Qualifier match data.
  35764  *      mask    - (OUT) Qualifier match mask.
  35765  * Returns:
  35766  *      BCM_E_XXX
  35767  * Notes:
  35768  */
  35769 int
  35770 bcm_esw_field_qualify_EtherTypeClass_get(int unit,
  35771         bcm_field_entry_t entry,
  35772         bcm_class_t *data,
  35773         bcm_class_t *mask)
  35774 {
  35775     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35776 
  35777 #if defined BCM_TOMAHAWK_SUPPORT
  35778     /* Read qualifier match value and mask. */
  35779     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  35780                                                bcmFieldQualifyEtherTypeClass,
  35781                                                data, mask);
  35782 #endif /* BCM_TOMAHAWK_SUPPORT */
  35783     return (rv);
  35784 }
  35785 
  35786 /*
  35787  * Function:
  35788  *      bcm_esw_field_qualify_L4SrcPortClass
  35789  *      Set match criteria for bcmFieldQualifyL4SrcPortClass
  35790  *      qualifier in the field entry.
  35791  * Parameters:
  35792  *      unit    -   (IN) Unit number.
  35793  *      entry   -   (IN) BCM field entry id.
  35794  *      data    -   (IN) Qualifier match data.
  35795  *      mask    -   (IN) Qualifier match data.
  35796  * Returns:
  35797  *      BCM_E_XXX
  35798  * Notes:
  35799  */
  35800 int
  35801 bcm_esw_field_qualify_L4SrcPortClass(int unit, 
  35802         bcm_field_entry_t entry,
  35803         bcm_class_t data, 
  35804         bcm_class_t mask)
  35805 {
  35806     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35807 #if defined BCM_TOMAHAWK_SUPPORT
  35808     uint32 cdata = 0;           /* Class Data */
  35809     uint32 cmask = 0;           /* Class Mask */
  35810 
  35811     
  35812 
  35813     COMPILER_64_TO_32_LO(cdata, data);
  35814     COMPILER_64_TO_32_LO(cmask, mask);
  35815 
  35816     FP_LOCK(unit);
  35817     rv = _field_qualify32(unit, entry, 
  35818                           bcmFieldQualifyL4SrcPortClass,
  35819                           cdata, cmask);
  35820     FP_UNLOCK(unit);
  35821 #endif /* BCM_TOMAHAWK_SUPPORT */
  35822 
  35823     return (rv);
  35824 }
  35825 
  35826 /*
  35827  * Function:
  35828  *      bcm_esw_field_qualify_L4SrcPortClass_get
  35829  * Purpose:
  35830  *      Get match criteria for bcmFieldQualifyL4SrcPortClass
  35831  *      qualifier from the field entry.
  35832  * Parameters:
  35833  *      unit    - (IN) Unit number.
  35834  *      entry   - (IN) BCM field entry id.
  35835  *      data    - (OUT) Qualifier match data.
  35836  *      mask    - (OUT) Qualifier match mask.
  35837  * Returns:
  35838  *      BCM_E_XXX
  35839  * Notes:
  35840  */
  35841 int
  35842 bcm_esw_field_qualify_L4SrcPortClass_get(int unit,
  35843         bcm_field_entry_t entry,
  35844         bcm_class_t *data,
  35845         bcm_class_t *mask)
  35846 {
  35847     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35848 
  35849 #if defined BCM_TOMAHAWK_SUPPORT
  35850     /* Read qualifier match value and mask. */
  35851     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  35852                                                bcmFieldQualifyL4SrcPortClass,
  35853                                                data, mask);
  35854 #endif /* BCM_TOMAHAWK_SUPPORT */
  35855     return (rv);
  35856 }
  35857 
  35858 /*
  35859  * Function:
  35860  *      bcm_esw_field_qualify_L4DstPortClass
  35861  *      Set match criteria for bcmFieldQualifyL4DstPortClass
  35862  *      qualifier in the field entry.
  35863  * Parameters:
  35864  *      unit    -   (IN) Unit number.
  35865  *      entry   -   (IN) BCM field entry id.
  35866  *      data    -   (IN) Qualifier match data.
  35867  *      mask    -   (IN) Qualifier match data.
  35868  * Returns:
  35869  *      BCM_E_XXX
  35870  * Notes:
  35871  */
  35872 int
  35873 bcm_esw_field_qualify_L4DstPortClass(int unit, 
  35874         bcm_field_entry_t entry,
  35875         bcm_class_t data, 
  35876         bcm_class_t mask)
  35877 {
  35878     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35879 #if defined BCM_TOMAHAWK_SUPPORT
  35880     uint32 cdata = 0;           /* Class Data */
  35881     uint32 cmask = 0;           /* Class Mask */
  35882 
  35883     
  35884 
  35885     COMPILER_64_TO_32_LO(cdata, data);
  35886     COMPILER_64_TO_32_LO(cmask, mask);
  35887 
  35888     FP_LOCK(unit);
  35889     rv = _field_qualify32(unit, entry, 
  35890                           bcmFieldQualifyL4DstPortClass,
  35891                           cdata, cmask);
  35892     FP_UNLOCK(unit);
  35893 #endif /* BCM_TOMAHAWK_SUPPORT */
  35894 
  35895     return (rv);
  35896 }
  35897 
  35898 /*
  35899  * Function:
  35900  *      bcm_esw_field_qualify_L4DstPortClass_get
  35901  * Purpose:
  35902  *      Get match criteria for bcmFieldQualifyL4DstPortClass
  35903  *      qualifier from the field entry.
  35904  * Parameters:
  35905  *      unit    - (IN) Unit number.
  35906  *      entry   - (IN) BCM field entry id.
  35907  *      data    - (OUT) Qualifier match data.
  35908  *      mask    - (OUT) Qualifier match mask.
  35909  * Returns:
  35910  *      BCM_E_XXX
  35911  * Notes:
  35912  */
  35913 int
  35914 bcm_esw_field_qualify_L4DstPortClass_get(int unit,
  35915         bcm_field_entry_t entry,
  35916         bcm_class_t *data,
  35917         bcm_class_t *mask)
  35918 {
  35919     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35920 
  35921 #if defined BCM_TOMAHAWK_SUPPORT
  35922     /* Read qualifier match value and mask. */
  35923     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  35924                                                bcmFieldQualifyL4DstPortClass,
  35925                                                data, mask);
  35926 #endif /* BCM_TOMAHAWK_SUPPORT */
  35927     return (rv);
  35928 }
  35929 
  35930 /*
  35931  * Function:
  35932  *      bcm_esw_field_qualify_SrcIpClass
  35933  *      Set match criteria for bcmFieldQualifySrcIpClass
  35934  *      qualifier in the field entry.
  35935  * Parameters:
  35936  *      unit    -   (IN) Unit number.
  35937  *      entry   -   (IN) BCM field entry id.
  35938  *      data    -   (IN) Qualifier match data.
  35939  *      mask    -   (IN) Qualifier match data.
  35940  * Returns:
  35941  *      BCM_E_XXX
  35942  * Notes:
  35943  */
  35944 int
  35945 bcm_esw_field_qualify_SrcIpClass(int unit, 
  35946         bcm_field_entry_t entry,
  35947         bcm_class_t data, 
  35948         bcm_class_t mask)
  35949 {
  35950     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35951 #if defined BCM_TOMAHAWK_SUPPORT
  35952     uint32 ref_data[_FP_QUAL_DATA_WORDS]; 
  35953     uint32 ref_mask[_FP_QUAL_DATA_WORDS];
  35954 
  35955     
  35956 
  35957     sal_memset(&ref_data, 0, sizeof(ref_data));
  35958     sal_memset(&ref_mask, 0, sizeof(ref_mask));
  35959 
  35960     COMPILER_64_TO_32_LO(ref_data[0], data);
  35961     COMPILER_64_TO_32_HI(ref_data[1], data);
  35962     COMPILER_64_TO_32_LO(ref_mask[0], mask);
  35963     COMPILER_64_TO_32_HI(ref_mask[1], mask);
  35964     
  35965     FP_LOCK(unit);
  35966     rv = _bcm_field_th_qualify_set(unit, entry, 
  35967                                    bcmFieldQualifySrcIpClass,
  35968                                    ref_data, ref_mask,
  35969                                    _FP_QUALIFIER_ADD);
  35970     FP_UNLOCK(unit);
  35971 #endif /* BCM_TOMAHAWK_SUPPORT */
  35972 
  35973     return (rv);
  35974 }
  35975 
  35976 /*
  35977  * Function:
  35978  *      bcm_esw_field_qualify_SrcIpClass_get
  35979  * Purpose:
  35980  *      Get match criteria for bcmFieldQualifySrcIpClass
  35981  *      qualifier from the field entry.
  35982  * Parameters:
  35983  *      unit    - (IN) Unit number.
  35984  *      entry   - (IN) BCM field entry id.
  35985  *      data    - (OUT) Qualifier match data.
  35986  *      mask    - (OUT) Qualifier match mask.
  35987  * Returns:
  35988  *      BCM_E_XXX
  35989  * Notes:
  35990  */
  35991 int
  35992 bcm_esw_field_qualify_SrcIpClass_get(int unit,
  35993         bcm_field_entry_t entry,
  35994         bcm_class_t *data,
  35995         bcm_class_t *mask)
  35996 {
  35997     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  35998 
  35999 #if defined BCM_TOMAHAWK_SUPPORT
  36000     /* Read qualifier match value and mask. */
  36001     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36002                                                bcmFieldQualifySrcIpClass,
  36003                                                data, mask);
  36004 #endif /* BCM_TOMAHAWK_SUPPORT */
  36005     return (rv);
  36006 }
  36007 
  36008 /*
  36009  * Function:
  36010  *      bcm_esw_field_qualify_SrcIpClassMsbNibble
  36011  *      Set match criteria for bcmFieldQualifySrcIpClassMsbNibble
  36012  *      qualifier in the field entry.
  36013  * Parameters:
  36014  *      unit    -   (IN) Unit number.
  36015  *      entry   -   (IN) BCM field entry id.
  36016  *      data    -   (IN) Qualifier match data.
  36017  *      mask    -   (IN) Qualifier match data.
  36018  * Returns:
  36019  *      BCM_E_XXX
  36020  * Notes:
  36021  */
  36022 int
  36023 bcm_esw_field_qualify_SrcIpClassMsbNibble(int unit, 
  36024         bcm_field_entry_t entry,
  36025         bcm_class_t data, 
  36026         bcm_class_t mask)
  36027 {
  36028     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36029 #if defined BCM_TOMAHAWK_SUPPORT
  36030     uint32 cdata = 0;           /* Class Data */
  36031     uint32 cmask = 0;           /* Class Mask */
  36032 
  36033     
  36034 
  36035     COMPILER_64_TO_32_LO(cdata, data);
  36036     COMPILER_64_TO_32_LO(cmask, mask);
  36037 
  36038     FP_LOCK(unit);
  36039     rv = _field_qualify32(unit, entry, 
  36040                           bcmFieldQualifySrcIpClassMsbNibble,
  36041                           cdata, cmask);
  36042     FP_UNLOCK(unit);
  36043 #endif /* BCM_TOMAHAWK_SUPPORT */
  36044 
  36045     return (rv);
  36046 }
  36047 
  36048 /*
  36049  * Function:
  36050  *      bcm_esw_field_qualify_SrcIpClassMsbNibble_get
  36051  * Purpose:
  36052  *      Get match criteria for bcmFieldQualifySrcIpClassMsbNibble
  36053  *      qualifier from the field entry.
  36054  * Parameters:
  36055  *      unit    - (IN) Unit number.
  36056  *      entry   - (IN) BCM field entry id.
  36057  *      data    - (OUT) Qualifier match data.
  36058  *      mask    - (OUT) Qualifier match mask.
  36059  * Returns:
  36060  *      BCM_E_XXX
  36061  * Notes:
  36062  */
  36063 int
  36064 bcm_esw_field_qualify_SrcIpClassMsbNibble_get(int unit,
  36065         bcm_field_entry_t entry,
  36066         bcm_class_t *data,
  36067         bcm_class_t *mask)
  36068 {
  36069     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36070 
  36071 #if defined BCM_TOMAHAWK_SUPPORT
  36072     /* Read qualifier match value and mask. */
  36073     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36074                                            bcmFieldQualifySrcIpClassMsbNibble,
  36075                                            data, mask);
  36076 #endif /* BCM_TOMAHAWK_SUPPORT */
  36077     return (rv);
  36078 }
  36079 
  36080 /*
  36081  * Function:
  36082  *      bcm_esw_field_qualify_SrcIpClassLower
  36083  *      Set match criteria for bcmFieldQualifySrcIpClassLower
  36084  *      qualifier in the field entry.
  36085  * Parameters:
  36086  *      unit    -   (IN) Unit number.
  36087  *      entry   -   (IN) BCM field entry id.
  36088  *      data    -   (IN) Qualifier match data.
  36089  *      mask    -   (IN) Qualifier match data.
  36090  * Returns:
  36091  *      BCM_E_XXX
  36092  * Notes:
  36093  */
  36094 int
  36095 bcm_esw_field_qualify_SrcIpClassLower(int unit, 
  36096         bcm_field_entry_t entry,
  36097         bcm_class_t data, 
  36098         bcm_class_t mask)
  36099 {
  36100     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36101 #if defined BCM_TOMAHAWK_SUPPORT
  36102     uint32 cdata = 0;           /* Class Data */
  36103     uint32 cmask = 0;           /* Class Mask */
  36104 
  36105     
  36106 
  36107     COMPILER_64_TO_32_LO(cdata, data);
  36108     COMPILER_64_TO_32_LO(cmask, mask);
  36109 
  36110     FP_LOCK(unit);
  36111     rv = _field_qualify32(unit, entry, 
  36112                           bcmFieldQualifySrcIpClassLower,
  36113                           cdata, cmask);
  36114     FP_UNLOCK(unit);
  36115 #endif /* BCM_TOMAHAWK_SUPPORT */
  36116     return (rv);
  36117 }
  36118 
  36119 /*
  36120  * Function:
  36121  *      bcm_esw_field_qualify_SrcIpClassLower_get
  36122  * Purpose:
  36123  *      Get match criteria for bcmFieldQualifySrcIpClassLower
  36124  *      qualifier from the field entry.
  36125  * Parameters:
  36126  *      unit    - (IN) Unit number.
  36127  *      entry   - (IN) BCM field entry id.
  36128  *      data    - (OUT) Qualifier match data.
  36129  *      mask    - (OUT) Qualifier match mask.
  36130  * Returns:
  36131  *      BCM_E_XXX
  36132  * Notes:
  36133  */
  36134 int
  36135 bcm_esw_field_qualify_SrcIpClassLower_get(int unit,
  36136         bcm_field_entry_t entry,
  36137         bcm_class_t *data,
  36138         bcm_class_t *mask)
  36139 {
  36140     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36141 
  36142 #if defined BCM_TOMAHAWK_SUPPORT
  36143     /* Read qualifier match value and mask. */
  36144     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36145                                                bcmFieldQualifySrcIpClassLower,
  36146                                                data, mask);
  36147 #endif /* BCM_TOMAHAWK_SUPPORT */
  36148     return (rv);
  36149 }
  36150 
  36151 /*
  36152  * Function:
  36153  *      bcm_esw_field_qualify_SrcIpClassUpper
  36154  *      Set match criteria for bcmFieldQualifySrcIpClassUpper
  36155  *      qualifier in the field entry.
  36156  * Parameters:
  36157  *      unit    -   (IN) Unit number.
  36158  *      entry   -   (IN) BCM field entry id.
  36159  *      data    -   (IN) Qualifier match data.
  36160  *      mask    -   (IN) Qualifier match data.
  36161  * Returns:
  36162  *      BCM_E_XXX
  36163  * Notes:
  36164  */
  36165 int
  36166 bcm_esw_field_qualify_SrcIpClassUpper(int unit, 
  36167         bcm_field_entry_t entry,
  36168         bcm_class_t data, 
  36169         bcm_class_t mask)
  36170 {
  36171     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36172 #if defined BCM_TOMAHAWK_SUPPORT
  36173     uint32 cdata = 0;           /* Class Data */
  36174     uint32 cmask = 0;           /* Class Mask */
  36175 
  36176     
  36177 
  36178     COMPILER_64_TO_32_LO(cdata, data);
  36179     COMPILER_64_TO_32_LO(cmask, mask);
  36180 
  36181     FP_LOCK(unit);
  36182     rv = _field_qualify32(unit, entry, 
  36183                           bcmFieldQualifySrcIpClassUpper,
  36184                           cdata, cmask);
  36185     FP_UNLOCK(unit);
  36186 #endif /* BCM_TOMAHAWK_SUPPORT */
  36187     return (rv);
  36188 }
  36189 
  36190 /*
  36191  * Function:
  36192  *      bcm_esw_field_qualify_SrcIpClassUpper_get
  36193  * Purpose:
  36194  *      Get match criteria for bcmFieldQualifySrcIpClassUpper
  36195  *      qualifier from the field entry.
  36196  * Parameters:
  36197  *      unit    - (IN) Unit number.
  36198  *      entry   - (IN) BCM field entry id.
  36199  *      data    - (OUT) Qualifier match data.
  36200  *      mask    - (OUT) Qualifier match mask.
  36201  * Returns:
  36202  *      BCM_E_XXX
  36203  * Notes:
  36204  */
  36205 int
  36206 bcm_esw_field_qualify_SrcIpClassUpper_get(int unit,
  36207         bcm_field_entry_t entry,
  36208         bcm_class_t *data,
  36209         bcm_class_t *mask)
  36210 {
  36211     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36212 
  36213 #if defined BCM_TOMAHAWK_SUPPORT
  36214     /* Read qualifier match value and mask. */
  36215     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36216                                                bcmFieldQualifySrcIpClassUpper, 
  36217                                                data, mask);
  36218 #endif /* BCM_TOMAHAWK_SUPPORT */
  36219     return (rv);
  36220 }
  36221 
  36222 /*
  36223  * Function:
  36224  *      bcm_esw_field_qualify_SrcIp6Class
  36225  *      Set match criteria for bcmFieldQualifySrcIp6Class
  36226  *      qualifier in the field entry.
  36227  * Parameters:
  36228  *      unit    -   (IN) Unit number.
  36229  *      entry   -   (IN) BCM field entry id.
  36230  *      data    -   (IN) Qualifier match data.
  36231  *      mask    -   (IN) Qualifier match data.
  36232  * Returns:
  36233  *      BCM_E_XXX
  36234  * Notes:
  36235  */
  36236 int
  36237 bcm_esw_field_qualify_SrcIp6Class(int unit, 
  36238         bcm_field_entry_t entry,
  36239         bcm_class_t data, 
  36240         bcm_class_t mask)
  36241 {
  36242     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36243 #if defined BCM_TOMAHAWK_SUPPORT
  36244     uint32 ref_data[_FP_QUAL_DATA_WORDS];
  36245     uint32 ref_mask[_FP_QUAL_DATA_WORDS];
  36246 
  36247     
  36248 
  36249     sal_memset(&ref_data, 0, sizeof(ref_data));
  36250     sal_memset(&ref_mask, 0, sizeof(ref_mask));
  36251 
  36252     COMPILER_64_TO_32_LO(ref_data[0], data);
  36253     COMPILER_64_TO_32_HI(ref_data[1], data);
  36254     COMPILER_64_TO_32_LO(ref_mask[0], mask);
  36255     COMPILER_64_TO_32_HI(ref_mask[1], mask);
  36256 
  36257     FP_LOCK(unit);
  36258     rv = _bcm_field_th_qualify_set(unit, entry, 
  36259                                    bcmFieldQualifySrcIp6Class,
  36260                                    ref_data, ref_mask,
  36261                                    _FP_QUALIFIER_ADD);
  36262     FP_UNLOCK(unit);
  36263 #endif /* BCM_TOMAHAWK_SUPPORT */
  36264 
  36265     return (rv);
  36266 }
  36267 
  36268 /*
  36269  * Function:
  36270  *      bcm_esw_field_qualify_SrcIp6Class_get
  36271  * Purpose:
  36272  *      Get match criteria for bcmFieldQualifySrcIp6Class
  36273  *      qualifier from the field entry.
  36274  * Parameters:
  36275  *      unit    - (IN) Unit number.
  36276  *      entry   - (IN) BCM field entry id.
  36277  *      data    - (OUT) Qualifier match data.
  36278  *      mask    - (OUT) Qualifier match mask.
  36279  * Returns:
  36280  *      BCM_E_XXX
  36281  * Notes:
  36282  */
  36283 int
  36284 bcm_esw_field_qualify_SrcIp6Class_get(int unit,
  36285         bcm_field_entry_t entry,
  36286         bcm_class_t *data,
  36287         bcm_class_t *mask)
  36288 {
  36289     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36290 
  36291 #if defined BCM_TOMAHAWK_SUPPORT
  36292     /* Read qualifier match value and mask. */
  36293     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36294                                                bcmFieldQualifySrcIp6Class,
  36295                                                data, mask);
  36296 #endif /* BCM_TOMAHAWK_SUPPORT */
  36297     return (rv);
  36298 }
  36299 
  36300 /*
  36301  * Function:
  36302  *      bcm_esw_field_qualify_SrcIp6ClassMsbNibble
  36303  *      Set match criteria for bcmFieldQualifySrcIp6ClassMsbNibble
  36304  *      qualifier in the field entry.
  36305  * Parameters:
  36306  *      unit    -   (IN) Unit number.
  36307  *      entry   -   (IN) BCM field entry id.
  36308  *      data    -   (IN) Qualifier match data.
  36309  *      mask    -   (IN) Qualifier match data.
  36310  * Returns:
  36311  *      BCM_E_XXX
  36312  * Notes:
  36313  */
  36314     int
  36315 bcm_esw_field_qualify_SrcIp6ClassMsbNibble(int unit, 
  36316         bcm_field_entry_t entry,
  36317         bcm_class_t data, 
  36318         bcm_class_t mask)
  36319 {
  36320     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36321 #if defined BCM_TOMAHAWK_SUPPORT
  36322     uint32 cdata = 0;           /* Class Data */
  36323     uint32 cmask = 0;           /* Class Mask */
  36324 
  36325     
  36326 
  36327     COMPILER_64_TO_32_LO(cdata, data);
  36328     COMPILER_64_TO_32_LO(cmask, mask);
  36329 
  36330     FP_LOCK(unit);
  36331     rv = _field_qualify32(unit, entry, 
  36332                           bcmFieldQualifySrcIp6ClassMsbNibble,
  36333                           cdata, cmask);
  36334     FP_UNLOCK(unit);
  36335 #endif /* BCM_TOMAHAWK_SUPPORT */
  36336     return (rv);
  36337 }
  36338 
  36339 /*
  36340  * Function:
  36341  *      bcm_esw_field_qualify_SrcIp6ClassMsbNibble_get
  36342  * Purpose:
  36343  *      Get match criteria for bcmFieldQualifySrcIp6ClassMsbNibble
  36344  *      qualifier from the field entry.
  36345  * Parameters:
  36346  *      unit    - (IN) Unit number.
  36347  *      entry   - (IN) BCM field entry id.
  36348  *      data    - (OUT) Qualifier match data.
  36349  *      mask    - (OUT) Qualifier match mask.
  36350  * Returns:
  36351  *      BCM_E_XXX
  36352  * Notes:
  36353  */
  36354 int
  36355 bcm_esw_field_qualify_SrcIp6ClassMsbNibble_get(int unit,
  36356         bcm_field_entry_t entry,
  36357         bcm_class_t *data,
  36358         bcm_class_t *mask)
  36359 {
  36360     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36361 
  36362 #if defined BCM_TOMAHAWK_SUPPORT
  36363     /* Read qualifier match value and mask. */
  36364     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36365                                            bcmFieldQualifySrcIp6ClassMsbNibble,
  36366                                            data, mask);
  36367 #endif /* BCM_TOMAHAWK_SUPPORT */
  36368     return (rv);
  36369 }
  36370 
  36371 /*
  36372  * Function:
  36373  *      bcm_esw_field_qualify_SrcIp6ClassLower
  36374  *      Set match criteria for bcmFieldQualifySrcIp6ClassLower
  36375  *      qualifier in the field entry.
  36376  * Parameters:
  36377  *      unit    -   (IN) Unit number.
  36378  *      entry   -   (IN) BCM field entry id.
  36379  *      data    -   (IN) Qualifier match data.
  36380  *      mask    -   (IN) Qualifier match data.
  36381  * Returns:
  36382  *      BCM_E_XXX
  36383  * Notes:
  36384  */
  36385 int
  36386 bcm_esw_field_qualify_SrcIp6ClassLower(int unit, 
  36387         bcm_field_entry_t entry,
  36388         bcm_class_t data, 
  36389         bcm_class_t mask)
  36390 {
  36391     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36392 #if defined BCM_TOMAHAWK_SUPPORT
  36393     uint32 cdata = 0;           /* Class Data */
  36394     uint32 cmask = 0;           /* Class Mask */
  36395 
  36396     
  36397 
  36398     COMPILER_64_TO_32_LO(cdata, data);
  36399     COMPILER_64_TO_32_LO(cmask, mask);
  36400 
  36401     FP_LOCK(unit);
  36402     rv = _field_qualify32(unit, entry, 
  36403                           bcmFieldQualifySrcIp6ClassLower,
  36404                           cdata, cmask);
  36405     FP_UNLOCK(unit);
  36406 #endif /* BCM_TOMAHAWK_SUPPORT */
  36407     return (rv);
  36408 }
  36409 
  36410 /*
  36411  * Function:
  36412  *      bcm_esw_field_qualify_SrcIp6ClassLower_get
  36413  * Purpose:
  36414  *      Get match criteria for bcmFieldQualifySrcIp6ClassLower
  36415  *      qualifier from the field entry.
  36416  * Parameters:
  36417  *      unit    - (IN) Unit number.
  36418  *      entry   - (IN) BCM field entry id.
  36419  *      data    - (OUT) Qualifier match data.
  36420  *      mask    - (OUT) Qualifier match mask.
  36421  * Returns:
  36422  *      BCM_E_XXX
  36423  * Notes:
  36424  */
  36425 int
  36426 bcm_esw_field_qualify_SrcIp6ClassLower_get(int unit,
  36427         bcm_field_entry_t entry,
  36428         bcm_class_t *data,
  36429         bcm_class_t *mask)
  36430 {
  36431     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36432 
  36433 #if defined BCM_TOMAHAWK_SUPPORT
  36434     /* Read qualifier match value and mask. */
  36435     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36436                                                bcmFieldQualifySrcIp6ClassLower,
  36437                                                data, mask);
  36438 #endif /* BCM_TOMAHAWK_SUPPORT */
  36439     return (rv);
  36440 }
  36441 
  36442 /*
  36443  * Function:
  36444  *      bcm_esw_field_qualify_SrcIp6ClassUpper
  36445  *      Set match criteria for bcmFieldQualifySrcIp6ClassUpper
  36446  *      qualifier in the field entry.
  36447  * Parameters:
  36448  *      unit    -   (IN) Unit number.
  36449  *      entry   -   (IN) BCM field entry id.
  36450  *      data    -   (IN) Qualifier match data.
  36451  *      mask    -   (IN) Qualifier match data.
  36452  * Returns:
  36453  *      BCM_E_XXX
  36454  * Notes:
  36455  */
  36456 int
  36457 bcm_esw_field_qualify_SrcIp6ClassUpper(int unit, 
  36458         bcm_field_entry_t entry,
  36459         bcm_class_t data, 
  36460         bcm_class_t mask)
  36461 {
  36462     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36463 #if defined BCM_TOMAHAWK_SUPPORT
  36464     uint32 cdata = 0;           /* Class Data */
  36465     uint32 cmask = 0;           /* Class Mask */
  36466 
  36467     
  36468 
  36469     COMPILER_64_TO_32_LO(cdata, data);
  36470     COMPILER_64_TO_32_LO(cmask, mask);
  36471 
  36472     FP_LOCK(unit);
  36473     rv = _field_qualify32(unit, entry, 
  36474                           bcmFieldQualifySrcIp6ClassUpper,
  36475                           cdata, cmask);
  36476     FP_UNLOCK(unit);
  36477 #endif /* BCM_TOMAHAWK_SUPPORT */
  36478     return (rv);
  36479 }
  36480 
  36481 /*
  36482  * Function:
  36483  *      bcm_esw_field_qualify_SrcIp6ClassUpper_get
  36484  * Purpose:
  36485  *      Get match criteria for bcmFieldQualifySrcIp6ClassUpper
  36486  *      qualifier from the field entry.
  36487  * Parameters:
  36488  *      unit    - (IN) Unit number.
  36489  *      entry   - (IN) BCM field entry id.
  36490  *      data    - (OUT) Qualifier match data.
  36491  *      mask    - (OUT) Qualifier match mask.
  36492  * Returns:
  36493  *      BCM_E_XXX
  36494  * Notes:
  36495  */
  36496 int
  36497 bcm_esw_field_qualify_SrcIp6ClassUpper_get(int unit,
  36498         bcm_field_entry_t entry,
  36499         bcm_class_t *data,
  36500         bcm_class_t *mask)
  36501 {
  36502     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36503 
  36504 #if defined BCM_TOMAHAWK_SUPPORT
  36505     /* Read qualifier match value and mask. */
  36506     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36507                                                bcmFieldQualifySrcIp6ClassUpper,
  36508                                                data, mask);
  36509 #endif /* BCM_TOMAHAWK_SUPPORT */
  36510     return (rv);
  36511 }
  36512 
  36513 /*
  36514  * Function:
  36515  *      bcm_esw_field_qualify_FcoeOxIDClass
  36516  *      Set match criteria for bcmFieldQualifyFcoeOxIDClass
  36517  *      qualifier in the field entry.
  36518  * Parameters:
  36519  *      unit    -   (IN) Unit number.
  36520  *      entry   -   (IN) BCM field entry id.
  36521  *      data    -   (IN) Qualifier match data.
  36522  *      mask    -   (IN) Qualifier match data.
  36523  * Returns:
  36524  *      BCM_E_XXX
  36525  * Notes:
  36526  */
  36527 int
  36528 bcm_esw_field_qualify_FcoeOxIDClass(int unit, 
  36529         bcm_field_entry_t entry,
  36530         bcm_class_t data, 
  36531         bcm_class_t mask)
  36532 {
  36533     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36534 #if defined BCM_TOMAHAWK_SUPPORT
  36535     uint32 cdata = 0;           /* Class Data */
  36536     uint32 cmask = 0;           /* Class Mask */
  36537 
  36538     
  36539 
  36540     COMPILER_64_TO_32_LO(cdata, data);
  36541     COMPILER_64_TO_32_LO(cmask, mask);
  36542 
  36543     FP_LOCK(unit);
  36544     rv = _field_qualify32(unit, entry, 
  36545                           bcmFieldQualifyFcoeOxIDClass,
  36546                           cdata, cmask);
  36547     FP_UNLOCK(unit);
  36548 #endif /* BCM_TOMAHAWK_SUPPORT */
  36549     return (rv);
  36550 }
  36551 
  36552 /*
  36553  * Function:
  36554  *      bcm_esw_field_qualify_FcoeOxIDClass_get
  36555  * Purpose:
  36556  *      Get match criteria for bcmFieldQualifyFcoeOxIDClass
  36557  *      qualifier from the field entry.
  36558  * Parameters:
  36559  *      unit    - (IN) Unit number.
  36560  *      entry   - (IN) BCM field entry id.
  36561  *      data    - (OUT) Qualifier match data.
  36562  *      mask    - (OUT) Qualifier match mask.
  36563  * Returns:
  36564  *      BCM_E_XXX
  36565  * Notes:
  36566  */
  36567 int
  36568 bcm_esw_field_qualify_FcoeOxIDClass_get(int unit,
  36569         bcm_field_entry_t entry,
  36570         bcm_class_t *data,
  36571         bcm_class_t *mask)
  36572 {
  36573     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36574 
  36575 #if defined BCM_TOMAHAWK_SUPPORT
  36576     /* Read qualifier match value and mask. */
  36577     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36578                                                bcmFieldQualifyFcoeOxIDClass,
  36579                                                data, mask);
  36580 #endif /* BCM_TOMAHAWK_SUPPORT */
  36581     return (rv);
  36582 }
  36583 
  36584 /*
  36585  * Function:
  36586  *      bcm_esw_field_qualify_DstIpClass
  36587  *      Set match criteria for bcmFieldQualifyDstIpClass
  36588  *      qualifier in the field entry.
  36589  * Parameters:
  36590  *      unit    -   (IN) Unit number.
  36591  *      entry   -   (IN) BCM field entry id.
  36592  *      data    -   (IN) Qualifier match data.
  36593  *      mask    -   (IN) Qualifier match data.
  36594  * Returns:
  36595  *      BCM_E_XXX
  36596  * Notes:
  36597  */
  36598 int
  36599 bcm_esw_field_qualify_DstIpClass(int unit, 
  36600         bcm_field_entry_t entry,
  36601         bcm_class_t data, 
  36602         bcm_class_t mask)
  36603 {
  36604     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36605 #if defined BCM_TOMAHAWK_SUPPORT
  36606     uint32 ref_data[_FP_QUAL_DATA_WORDS];
  36607     uint32 ref_mask[_FP_QUAL_DATA_WORDS];
  36608 
  36609     
  36610 
  36611     sal_memset(&ref_data, 0, sizeof(ref_data));
  36612     sal_memset(&ref_mask, 0, sizeof(ref_mask));
  36613 
  36614     COMPILER_64_TO_32_LO(ref_data[0], data);
  36615     COMPILER_64_TO_32_HI(ref_data[1], data);
  36616     COMPILER_64_TO_32_LO(ref_mask[0], mask);
  36617     COMPILER_64_TO_32_HI(ref_mask[1], mask);
  36618 
  36619     FP_LOCK(unit);
  36620     rv = _bcm_field_th_qualify_set(unit, entry, 
  36621                                    bcmFieldQualifyDstIpClass,
  36622                                    ref_data, ref_mask, _FP_QUALIFIER_ADD);
  36623     FP_UNLOCK(unit);
  36624 #endif /* BCM_TOMAHAWK_SUPPORT */
  36625 
  36626     return (rv);
  36627 
  36628 }
  36629 
  36630 /*
  36631  * Function:
  36632  *      bcm_esw_field_qualify_DstIpClass_get
  36633  * Purpose:
  36634  *      Get match criteria for bcmFieldQualifyDstIpClass
  36635  *      qualifier from the field entry.
  36636  * Parameters:
  36637  *      unit    - (IN) Unit number.
  36638  *      entry   - (IN) BCM field entry id.
  36639  *      data    - (OUT) Qualifier match data.
  36640  *      mask    - (OUT) Qualifier match mask.
  36641  * Returns:
  36642  *      BCM_E_XXX
  36643  * Notes:
  36644  */
  36645 int
  36646 bcm_esw_field_qualify_DstIpClass_get(int unit,
  36647         bcm_field_entry_t entry,
  36648         bcm_class_t *data,
  36649         bcm_class_t *mask)
  36650 {
  36651     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36652 
  36653 #if defined BCM_TOMAHAWK_SUPPORT
  36654     /* Read qualifier match value and mask. */
  36655     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36656                                                bcmFieldQualifyDstIpClass,
  36657                                                data, mask);
  36658 #endif /* BCM_TOMAHAWK_SUPPORT */
  36659     return (rv);
  36660 }
  36661 
  36662 /*
  36663  * Function:
  36664  *      bcm_esw_field_qualify_DstIpClassMsbNibble
  36665  *      Set match criteria for bcmFieldQualifyDstIpClassMsbNibble
  36666  *      qualifier in the field entry.
  36667  * Parameters:
  36668  *      unit    -   (IN) Unit number.
  36669  *      entry   -   (IN) BCM field entry id.
  36670  *      data    -   (IN) Qualifier match data.
  36671  *      mask    -   (IN) Qualifier match data.
  36672  * Returns:
  36673  *      BCM_E_XXX
  36674  * Notes:
  36675  */
  36676 int
  36677 bcm_esw_field_qualify_DstIpClassMsbNibble(int unit, 
  36678         bcm_field_entry_t entry,
  36679         bcm_class_t data, 
  36680         bcm_class_t mask)
  36681 {
  36682     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36683 #if defined BCM_TOMAHAWK_SUPPORT
  36684     uint32 cdata = 0;           /* Class Data */
  36685     uint32 cmask = 0;           /* Class Mask */
  36686 
  36687     
  36688 
  36689     COMPILER_64_TO_32_LO(cdata, data);
  36690     COMPILER_64_TO_32_LO(cmask, mask);
  36691 
  36692     FP_LOCK(unit);
  36693     rv = _field_qualify32(unit, entry, 
  36694                           bcmFieldQualifyDstIpClassMsbNibble,
  36695                           cdata, cmask);
  36696     FP_UNLOCK(unit);
  36697 #endif /* BCM_TOMAHAWK_SUPPORT */
  36698     return (rv);
  36699 
  36700 }
  36701 
  36702 /*
  36703  * Function:
  36704  *      bcm_esw_field_qualify_DstIpClassMsbNibble_get
  36705  * Purpose:
  36706  *      Get match criteria for bcmFieldQualifyDstIpClassMsbNibble
  36707  *      qualifier from the field entry.
  36708  * Parameters:
  36709  *      unit    - (IN) Unit number.
  36710  *      entry   - (IN) BCM field entry id.
  36711  *      data    - (OUT) Qualifier match data.
  36712  *      mask    - (OUT) Qualifier match mask.
  36713  * Returns:
  36714  *      BCM_E_XXX
  36715  * Notes:
  36716  */
  36717 int
  36718 bcm_esw_field_qualify_DstIpClassMsbNibble_get(int unit,
  36719         bcm_field_entry_t entry,
  36720         bcm_class_t *data,
  36721         bcm_class_t *mask)
  36722 {
  36723     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36724 
  36725 #if defined BCM_TOMAHAWK_SUPPORT
  36726     /* Read qualifier match value and mask. */
  36727     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36728                                            bcmFieldQualifyDstIpClassMsbNibble,
  36729                                            data, mask);
  36730 #endif /* BCM_TOMAHAWK_SUPPORT */
  36731     return (rv);
  36732 }
  36733 
  36734 /*
  36735  * Function:
  36736  *      bcm_esw_field_qualify_DstIpClassLower
  36737  *      Set match criteria for bcmFieldQualifyDstIpClassLower
  36738  *      qualifier in the field entry.
  36739  * Parameters:
  36740  *      unit    -   (IN) Unit number.
  36741  *      entry   -   (IN) BCM field entry id.
  36742  *      data    -   (IN) Qualifier match data.
  36743  *      mask    -   (IN) Qualifier match data.
  36744  * Returns:
  36745  *      BCM_E_XXX
  36746  * Notes:
  36747  */
  36748 int
  36749 bcm_esw_field_qualify_DstIpClassLower(int unit, 
  36750         bcm_field_entry_t entry,
  36751         bcm_class_t data, 
  36752         bcm_class_t mask)
  36753 {
  36754     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36755 #if defined BCM_TOMAHAWK_SUPPORT
  36756     uint32 cdata = 0;           /* Class Data */
  36757     uint32 cmask = 0;           /* Class Mask */
  36758 
  36759     
  36760 
  36761     COMPILER_64_TO_32_LO(cdata, data);
  36762     COMPILER_64_TO_32_LO(cmask, mask);
  36763 
  36764     FP_LOCK(unit);
  36765     rv = _field_qualify32(unit, entry, 
  36766                           bcmFieldQualifyDstIpClassLower,
  36767                           cdata, cmask);
  36768     FP_UNLOCK(unit);
  36769 #endif /* BCM_TOMAHAWK_SUPPORT */
  36770     return (rv);
  36771 }
  36772 
  36773 /*
  36774  * Function:
  36775  *      bcm_esw_field_qualify_DstIpClassLower_get
  36776  * Purpose:
  36777  *      Get match criteria for bcmFieldQualifyDstIpClassLower
  36778  *      qualifier from the field entry.
  36779  * Parameters:
  36780  *      unit    - (IN) Unit number.
  36781  *      entry   - (IN) BCM field entry id.
  36782  *      data    - (OUT) Qualifier match data.
  36783  *      mask    - (OUT) Qualifier match mask.
  36784  * Returns:
  36785  *      BCM_E_XXX
  36786  * Notes:
  36787  */
  36788 int
  36789 bcm_esw_field_qualify_DstIpClassLower_get(int unit,
  36790         bcm_field_entry_t entry,
  36791         bcm_class_t *data,
  36792         bcm_class_t *mask)
  36793 {
  36794     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36795 
  36796 #if defined BCM_TOMAHAWK_SUPPORT
  36797     /* Read qualifier match value and mask. */
  36798     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36799                                                bcmFieldQualifyDstIpClassLower,
  36800                                                data, mask);
  36801 #endif /* BCM_TOMAHAWK_SUPPORT */
  36802     return (rv);
  36803 }
  36804 
  36805 /*
  36806  * Function:
  36807  *      bcm_esw_field_qualify_DstIpClassUpper
  36808  *      Set match criteria for bcmFieldQualifyDstIpClassUpper
  36809  *      qualifier in the field entry.
  36810  * Parameters:
  36811  *      unit    -   (IN) Unit number.
  36812  *      entry   -   (IN) BCM field entry id.
  36813  *      data    -   (IN) Qualifier match data.
  36814  *      mask    -   (IN) Qualifier match data.
  36815  * Returns:
  36816  *      BCM_E_XXX
  36817  * Notes:
  36818  */
  36819 int
  36820 bcm_esw_field_qualify_DstIpClassUpper(int unit, 
  36821         bcm_field_entry_t entry,
  36822         bcm_class_t data,
  36823         bcm_class_t mask)
  36824 {
  36825     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36826 #if defined BCM_TOMAHAWK_SUPPORT
  36827     uint32 cdata = 0;           /* Class Data */
  36828     uint32 cmask = 0;           /* Class Mask */
  36829 
  36830     
  36831 
  36832     COMPILER_64_TO_32_LO(cdata, data);
  36833     COMPILER_64_TO_32_LO(cmask, mask);
  36834 
  36835     FP_LOCK(unit);
  36836     rv = _field_qualify32(unit, entry, 
  36837                           bcmFieldQualifyDstIpClassUpper, 
  36838                           cdata, cmask);
  36839     FP_UNLOCK(unit);
  36840 #endif /* BCM_TOMAHAWK_SUPPORT */
  36841     return (rv);
  36842 
  36843 }
  36844 
  36845 /*
  36846  * Function:
  36847  *      bcm_esw_field_qualify_DstIpClassUpper_get
  36848  * Purpose:
  36849  *      Get match criteria for bcmFieldQualifyDstIpClassUpper
  36850  *      qualifier from the field entry.
  36851  * Parameters:
  36852  *      unit    - (IN) Unit number.
  36853  *      entry   - (IN) BCM field entry id.
  36854  *      data    - (OUT) Qualifier match data.
  36855  *      mask    - (OUT) Qualifier match mask.
  36856  * Returns:
  36857  *      BCM_E_XXX
  36858  * Notes:
  36859  */
  36860 int
  36861 bcm_esw_field_qualify_DstIpClassUpper_get(int unit,
  36862         bcm_field_entry_t entry,
  36863         bcm_class_t *data,
  36864         bcm_class_t *mask)
  36865 {
  36866     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36867 
  36868 #if defined BCM_TOMAHAWK_SUPPORT
  36869     /* Read qualifier match value and mask. */
  36870     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36871                                                bcmFieldQualifyDstIpClassUpper,
  36872                                                data, mask);
  36873 #endif /* BCM_TOMAHAWK_SUPPORT */
  36874     return (rv);
  36875 }
  36876 
  36877 /*
  36878  * Function:
  36879  *      bcm_esw_field_qualify_DstIp6Class
  36880  *      Set match criteria for bcmFieldQualifyDstIp6Class
  36881  *      qualifier in the field entry.
  36882  * Parameters:
  36883  *      unit    -   (IN) Unit number.
  36884  *      entry   -   (IN) BCM field entry id.
  36885  *      data    -   (IN) Qualifier match data.
  36886  *      mask    -   (IN) Qualifier match data.
  36887  * Returns:
  36888  *      BCM_E_XXX
  36889  * Notes:
  36890  */
  36891 int
  36892 bcm_esw_field_qualify_DstIp6Class(int unit, 
  36893         bcm_field_entry_t entry,
  36894         bcm_class_t data, 
  36895         bcm_class_t mask)
  36896 {
  36897     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36898 #if defined BCM_TOMAHAWK_SUPPORT
  36899     uint32 ref_data[_FP_QUAL_DATA_WORDS];
  36900     uint32 ref_mask[_FP_QUAL_DATA_WORDS];
  36901 
  36902     
  36903 
  36904     sal_memset(&ref_data, 0, sizeof(ref_data));
  36905     sal_memset(&ref_mask, 0, sizeof(ref_mask));
  36906 
  36907     COMPILER_64_TO_32_LO(ref_data[0], data);
  36908     COMPILER_64_TO_32_HI(ref_data[1], data);
  36909     COMPILER_64_TO_32_LO(ref_mask[0], mask);
  36910     COMPILER_64_TO_32_HI(ref_mask[1], mask);
  36911 
  36912     FP_LOCK(unit);
  36913     rv = _bcm_field_th_qualify_set(unit, entry, 
  36914                                    bcmFieldQualifyDstIp6Class,
  36915                                    ref_data, ref_mask, 
  36916                                    _FP_QUALIFIER_ADD);
  36917     FP_UNLOCK(unit);
  36918 #endif /* BCM_TOMAHAWK_SUPPORT */
  36919 
  36920     return (rv);
  36921 }
  36922 
  36923 /*
  36924  * Function:
  36925  *      bcm_esw_field_qualify_DstIp6Class_get
  36926  * Purpose:
  36927  *      Get match criteria for bcmFieldQualifyDstIp6Class
  36928  *      qualifier from the field entry.
  36929  * Parameters:
  36930  *      unit    - (IN) Unit number.
  36931  *      entry   - (IN) BCM field entry id.
  36932  *      data    - (OUT) Qualifier match data.
  36933  *      mask    - (OUT) Qualifier match mask.
  36934  * Returns:
  36935  *      BCM_E_XXX
  36936  * Notes:
  36937  */
  36938 int
  36939 bcm_esw_field_qualify_DstIp6Class_get(int unit,
  36940         bcm_field_entry_t entry,
  36941         bcm_class_t *data,
  36942         bcm_class_t *mask)
  36943 {
  36944     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36945 
  36946 #if defined BCM_TOMAHAWK_SUPPORT
  36947     /* Read qualifier match value and mask. */
  36948     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  36949                                                bcmFieldQualifyDstIp6Class,
  36950                                                data, mask);
  36951 #endif /* BCM_TOMAHAWK_SUPPORT */
  36952     return (rv);
  36953 }
  36954 
  36955 /*
  36956  * Function:
  36957  *      bcm_esw_field_qualify_DstIp6ClassMsbNibble
  36958  *      Set match criteria for bcmFieldQualifyDstIp6ClassMsbNibble
  36959  *      qualifier in the field entry.
  36960  * Parameters:
  36961  *      unit    -   (IN) Unit number.
  36962  *      entry   -   (IN) BCM field entry id.
  36963  *      data    -   (IN) Qualifier match data.
  36964  *      mask    -   (IN) Qualifier match data.
  36965  * Returns:
  36966  *      BCM_E_XXX
  36967  * Notes:
  36968  */
  36969     int
  36970 bcm_esw_field_qualify_DstIp6ClassMsbNibble(int unit, 
  36971         bcm_field_entry_t entry,
  36972         bcm_class_t data, 
  36973         bcm_class_t mask)
  36974 {
  36975     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  36976 #if defined BCM_TOMAHAWK_SUPPORT
  36977     uint32 cdata = 0;           /* Class Data */
  36978     uint32 cmask = 0;           /* Class Mask */
  36979 
  36980     
  36981 
  36982     COMPILER_64_TO_32_LO(cdata, data);
  36983     COMPILER_64_TO_32_LO(cmask, mask);
  36984 
  36985     FP_LOCK(unit);
  36986     rv = _field_qualify32(unit, entry, 
  36987                           bcmFieldQualifyDstIp6ClassMsbNibble,
  36988                           cdata, cmask);
  36989     FP_UNLOCK(unit);
  36990 #endif /* BCM_TOMAHAWK_SUPPORT */
  36991     return (rv);
  36992 }
  36993 
  36994 /*
  36995  * Function:
  36996  *      bcm_esw_field_qualify_DstIp6ClassMsbNibble_get
  36997  * Purpose:
  36998  *      Get match criteria for bcmFieldQualifyDstIp6ClassMsbNibble
  36999  *      qualifier from the field entry.
  37000  * Parameters:
  37001  *      unit    - (IN) Unit number.
  37002  *      entry   - (IN) BCM field entry id.
  37003  *      data    - (OUT) Qualifier match data.
  37004  *      mask    - (OUT) Qualifier match mask.
  37005  * Returns:
  37006  *      BCM_E_XXX
  37007  * Notes:
  37008  */
  37009 int
  37010 bcm_esw_field_qualify_DstIp6ClassMsbNibble_get(int unit,
  37011         bcm_field_entry_t entry,
  37012         bcm_class_t *data,
  37013         bcm_class_t *mask)
  37014 {
  37015     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37016 
  37017 #if defined BCM_TOMAHAWK_SUPPORT
  37018     /* Read qualifier match value and mask. */
  37019     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37020                                            bcmFieldQualifyDstIp6ClassMsbNibble,
  37021                                            data, mask);
  37022 #endif /* BCM_TOMAHAWK_SUPPORT */
  37023     return (rv);
  37024 }
  37025 
  37026 /*
  37027  * Function:
  37028  *      bcm_esw_field_qualify_DstIp6ClassLower
  37029  *      Set match criteria for bcmFieldQualifyDstIp6ClassLower
  37030  *      qualifier in the field entry.
  37031  * Parameters:
  37032  *      unit    -   (IN) Unit number.
  37033  *      entry   -   (IN) BCM field entry id.
  37034  *      data    -   (IN) Qualifier match data.
  37035  *      mask    -   (IN) Qualifier match data.
  37036  * Returns:
  37037  *      BCM_E_XXX
  37038  * Notes:
  37039  */
  37040 int
  37041 bcm_esw_field_qualify_DstIp6ClassLower(int unit, 
  37042         bcm_field_entry_t entry,
  37043         bcm_class_t data, 
  37044         bcm_class_t mask)
  37045 {
  37046     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37047 #if defined BCM_TOMAHAWK_SUPPORT
  37048     uint32 cdata = 0;           /* Class Data */
  37049     uint32 cmask = 0;           /* Class Mask */
  37050 
  37051     
  37052 
  37053     COMPILER_64_TO_32_LO(cdata, data);
  37054     COMPILER_64_TO_32_LO(cmask, mask);
  37055 
  37056     FP_LOCK(unit);
  37057     rv = _field_qualify32(unit, entry, 
  37058                           bcmFieldQualifyDstIp6ClassLower, 
  37059                           cdata, cmask);
  37060     FP_UNLOCK(unit);
  37061 #endif /* BCM_TOMAHAWK_SUPPORT */
  37062     return (rv);
  37063 }
  37064 
  37065 /*
  37066  * Function:
  37067  *      bcm_esw_field_qualify_DstIp6ClassLower_get
  37068  * Purpose:
  37069  *      Get match criteria for bcmFieldQualifyDstIp6ClassLower
  37070  *      qualifier from the field entry.
  37071  * Parameters:
  37072  *      unit    - (IN) Unit number.
  37073  *      entry   - (IN) BCM field entry id.
  37074  *      data    - (OUT) Qualifier match data.
  37075  *      mask    - (OUT) Qualifier match mask.
  37076  * Returns:
  37077  *      BCM_E_XXX
  37078  * Notes:
  37079  */
  37080 int
  37081 bcm_esw_field_qualify_DstIp6ClassLower_get(int unit,
  37082         bcm_field_entry_t entry,
  37083         bcm_class_t *data,
  37084         bcm_class_t *mask)
  37085 {
  37086     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37087 
  37088 #if defined BCM_TOMAHAWK_SUPPORT
  37089     /* Read qualifier match value and mask. */
  37090     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37091                                                bcmFieldQualifyDstIp6ClassLower,
  37092                                                data, mask);
  37093 #endif /* BCM_TOMAHAWK_SUPPORT */
  37094     return (rv);
  37095 }
  37096 
  37097 /*
  37098  * Function:
  37099  *      bcm_esw_field_qualify_DstIp6ClassUpper
  37100  *      Set match criteria for bcmFieldQualifyDstIp6ClassUpper
  37101  *      qualifier in the field entry.
  37102  * Parameters:
  37103  *      unit    -   (IN) Unit number.
  37104  *      entry   -   (IN) BCM field entry id.
  37105  *      data    -   (IN) Qualifier match data.
  37106  *      mask    -   (IN) Qualifier match data.
  37107  * Returns:
  37108  *      BCM_E_XXX
  37109  * Notes:
  37110  */
  37111 int
  37112 bcm_esw_field_qualify_DstIp6ClassUpper(int unit, 
  37113         bcm_field_entry_t entry,
  37114         bcm_class_t data, 
  37115         bcm_class_t mask)
  37116 {
  37117     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37118 #if defined BCM_TOMAHAWK_SUPPORT
  37119     uint32 cdata = 0;           /* Class Data */
  37120     uint32 cmask = 0;           /* Class Mask */
  37121 
  37122     
  37123 
  37124     COMPILER_64_TO_32_LO(cdata, data);
  37125     COMPILER_64_TO_32_LO(cmask, mask);
  37126 
  37127     FP_LOCK(unit);
  37128     rv = _field_qualify32(unit, entry, 
  37129                           bcmFieldQualifyDstIp6ClassUpper,
  37130                           cdata, cmask);
  37131     FP_UNLOCK(unit);
  37132 #endif /* BCM_TOMAHAWK_SUPPORT */
  37133     return (rv);
  37134 
  37135 }
  37136 
  37137 /*
  37138  * Function:
  37139  *      bcm_esw_field_qualify_DstIp6ClassUpper_get
  37140  * Purpose:
  37141  *      Get match criteria for bcmFieldQualifyDstIp6ClassUpper
  37142  *      qualifier from the field entry.
  37143  * Parameters:
  37144  *      unit    - (IN) Unit number.
  37145  *      entry   - (IN) BCM field entry id.
  37146  *      data    - (OUT) Qualifier match data.
  37147  *      mask    - (OUT) Qualifier match mask.
  37148  * Returns:
  37149  *      BCM_E_XXX
  37150  * Notes:
  37151  */
  37152 int
  37153 bcm_esw_field_qualify_DstIp6ClassUpper_get(int unit,
  37154         bcm_field_entry_t entry,
  37155         bcm_class_t *data,
  37156         bcm_class_t *mask)
  37157 {
  37158     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37159 
  37160 #if defined BCM_TOMAHAWK_SUPPORT
  37161     /* Read qualifier match value and mask. */
  37162     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37163                                                bcmFieldQualifyDstIp6ClassUpper,
  37164                                                data, mask);
  37165 #endif /* BCM_TOMAHAWK_SUPPORT */
  37166     return (rv);
  37167 }
  37168 
  37169 /*
  37170  * Function:
  37171  *      bcm_esw_field_qualify_FcoeRxIDClass
  37172  *      Set match criteria for bcmFieldQualifyFcoeRxIDClass
  37173  *      qualifier in the field entry.
  37174  * Parameters:
  37175  *      unit    -   (IN) Unit number.
  37176  *      entry   -   (IN) BCM field entry id.
  37177  *      data    -   (IN) Qualifier match data.
  37178  *      mask    -   (IN) Qualifier match data.
  37179  * Returns:
  37180  *      BCM_E_XXX
  37181  * Notes:
  37182  */
  37183     int
  37184 bcm_esw_field_qualify_FcoeRxIDClass(int unit, 
  37185         bcm_field_entry_t entry,
  37186         bcm_class_t data, 
  37187         bcm_class_t mask)
  37188 {
  37189     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37190 #if defined BCM_TOMAHAWK_SUPPORT
  37191     uint32 cdata = 0;           /* Class Data */
  37192     uint32 cmask = 0;           /* Class Mask */
  37193 
  37194     
  37195 
  37196     COMPILER_64_TO_32_LO(cdata, data);
  37197     COMPILER_64_TO_32_LO(cmask, mask);
  37198 
  37199     FP_LOCK(unit);
  37200     rv = _field_qualify32(unit, entry, 
  37201                           bcmFieldQualifyFcoeRxIDClass,
  37202                           cdata, cmask);
  37203     FP_UNLOCK(unit);
  37204 #endif /* BCM_TOMAHAWK_SUPPORT */
  37205     return (rv);
  37206 }
  37207 
  37208 /*
  37209  * Function:
  37210  *      bcm_esw_field_qualify_FcoeRxIDClass_get
  37211  * Purpose:
  37212  *      Get match criteria for bcmFieldQualifyFcoeRxIDClass
  37213  *      qualifier from the field entry.
  37214  * Parameters:
  37215  *      unit    - (IN) Unit number.
  37216  *      entry   - (IN) BCM field entry id.
  37217  *      data    - (OUT) Qualifier match data.
  37218  *      mask    - (OUT) Qualifier match mask.
  37219  * Returns:
  37220  *      BCM_E_XXX
  37221  * Notes:
  37222  */
  37223 int
  37224 bcm_esw_field_qualify_FcoeRxIDClass_get(int unit,
  37225         bcm_field_entry_t entry,
  37226         bcm_class_t *data,
  37227         bcm_class_t *mask)
  37228 {
  37229     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37230 
  37231 #if defined BCM_TOMAHAWK_SUPPORT
  37232     /* Read qualifier match value and mask. */
  37233     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37234                                                bcmFieldQualifyFcoeRxIDClass,
  37235                                                data, mask);
  37236 #endif /* BCM_TOMAHAWK_SUPPORT */
  37237     return (rv);
  37238 }
  37239 
  37240 /*
  37241  * Function:
  37242  *      bcm_esw_field_qualify_FibreChanSrcIdClass
  37243  *      Set match criteria for bcmFieldQualifyFibreChanSrcIdClass
  37244  *      qualifier in the field entry.
  37245  * Parameters:
  37246  *      unit    -   (IN) Unit number.
  37247  *      entry   -   (IN) BCM field entry id.
  37248  *      data    -   (IN) Qualifier match data.
  37249  *      mask    -   (IN) Qualifier match data.
  37250  * Returns:
  37251  *      BCM_E_XXX
  37252  * Notes:
  37253  */
  37254 int
  37255 bcm_esw_field_qualify_FibreChanSrcIdClass(int unit, 
  37256         bcm_field_entry_t entry,
  37257         bcm_class_t data, 
  37258         bcm_class_t mask)
  37259 {
  37260     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37261 #if defined BCM_TOMAHAWK_SUPPORT
  37262     uint32 ref_data[_FP_QUAL_DATA_WORDS];
  37263     uint32 ref_mask[_FP_QUAL_DATA_WORDS];
  37264 
  37265     
  37266 
  37267     sal_memset(&ref_data, 0, sizeof(ref_data));
  37268     sal_memset(&ref_mask, 0, sizeof(ref_mask));
  37269 
  37270     COMPILER_64_TO_32_LO(ref_data[0], data);
  37271     COMPILER_64_TO_32_HI(ref_data[1], data);
  37272     COMPILER_64_TO_32_LO(ref_mask[0], mask);
  37273     COMPILER_64_TO_32_HI(ref_mask[1], mask);
  37274 
  37275     FP_LOCK(unit);
  37276     rv = _bcm_field_th_qualify_set(unit, entry, 
  37277                                    bcmFieldQualifyFibreChanSrcIdClass,
  37278                                    ref_data, ref_mask,
  37279                                    _FP_QUALIFIER_ADD);
  37280     FP_UNLOCK(unit);
  37281 #endif /* BCM_TOMAHAWK_SUPPORT */
  37282 
  37283     return (rv);
  37284 }
  37285 
  37286 /*
  37287  * Function:
  37288  *      bcm_esw_field_qualify_FibreChanSrcIdClass_get
  37289  * Purpose:
  37290  *      Get match criteria for bcmFieldQualifyFibreChanSrcIdClass
  37291  *      qualifier from the field entry.
  37292  * Parameters:
  37293  *      unit    - (IN) Unit number.
  37294  *      entry   - (IN) BCM field entry id.
  37295  *      data    - (OUT) Qualifier match data.
  37296  *      mask    - (OUT) Qualifier match mask.
  37297  * Returns:
  37298  *      BCM_E_XXX
  37299  * Notes:
  37300  */
  37301 int
  37302 bcm_esw_field_qualify_FibreChanSrcIdClass_get(int unit,
  37303         bcm_field_entry_t entry,
  37304         bcm_class_t *data,
  37305         bcm_class_t *mask)
  37306 {
  37307     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37308 
  37309 #if defined BCM_TOMAHAWK_SUPPORT
  37310     /* Read qualifier match value and mask. */
  37311     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37312                                            bcmFieldQualifyFibreChanSrcIdClass,
  37313                                            data, mask);
  37314 #endif /* BCM_TOMAHAWK_SUPPORT */
  37315     return (rv);
  37316 }
  37317 
  37318 /*
  37319  * Function:
  37320  *      bcm_esw_field_qualify_FibreChanSrcIdClassMsbNibble
  37321  *      Set match criteria for bcmFieldQualifyFibreChanSrcIdClassMsbNibble
  37322  *      qualifier in the field entry.
  37323  * Parameters:
  37324  *      unit    -   (IN) Unit number.
  37325  *      entry   -   (IN) BCM field entry id.
  37326  *      data    -   (IN) Qualifier match data.
  37327  *      mask    -   (IN) Qualifier match data.
  37328  * Returns:
  37329  *      BCM_E_XXX
  37330  * Notes:
  37331  */
  37332     int
  37333 bcm_esw_field_qualify_FibreChanSrcIdClassMsbNibble(int unit, 
  37334         bcm_field_entry_t entry,
  37335         bcm_class_t data, 
  37336         bcm_class_t mask)
  37337 {
  37338     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37339 #if defined BCM_TOMAHAWK_SUPPORT
  37340     uint32 cdata = 0;           /* Class Data */
  37341     uint32 cmask = 0;           /* Class Mask */
  37342 
  37343     
  37344 
  37345     COMPILER_64_TO_32_LO(cdata, data);
  37346     COMPILER_64_TO_32_LO(cmask, mask);
  37347 
  37348     FP_LOCK(unit);
  37349     rv = _field_qualify32(unit, entry, 
  37350                           bcmFieldQualifyFibreChanSrcIdClassMsbNibble,
  37351                           cdata, cmask);
  37352     FP_UNLOCK(unit);
  37353 #endif /* BCM_TOMAHAWK_SUPPORT */
  37354     return (rv);
  37355 }
  37356 
  37357 /*
  37358  * Function:
  37359  *      bcm_esw_field_qualify_FibreChanSrcIdClassMsbNibble_get
  37360  * Purpose:
  37361  *      Get match criteria for bcmFieldQualifyFibreChanSrcIdClassMsbNibble
  37362  *      qualifier from the field entry.
  37363  * Parameters:
  37364  *      unit    - (IN) Unit number.
  37365  *      entry   - (IN) BCM field entry id.
  37366  *      data    - (OUT) Qualifier match data.
  37367  *      mask    - (OUT) Qualifier match mask.
  37368  * Returns:
  37369  *      BCM_E_XXX
  37370  * Notes:
  37371  */
  37372 int
  37373 bcm_esw_field_qualify_FibreChanSrcIdClassMsbNibble_get(int unit,
  37374         bcm_field_entry_t entry,
  37375         bcm_class_t *data,
  37376         bcm_class_t *mask)
  37377 {
  37378     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37379 
  37380 #if defined BCM_TOMAHAWK_SUPPORT
  37381     /* Read qualifier match value and mask. */
  37382     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37383                                   bcmFieldQualifyFibreChanSrcIdClassMsbNibble,
  37384                                   data, mask);
  37385 #endif /* BCM_TOMAHAWK_SUPPORT */
  37386     return (rv);
  37387 }
  37388 
  37389 /*
  37390  * Function:
  37391  *      bcm_esw_field_qualify_FibreChanSrcIdClassLower
  37392  *      Set match criteria for bcmFieldQualifyFibreChanSrcIdClassLower
  37393  *      qualifier in the field entry.
  37394  * Parameters:
  37395  *      unit    -   (IN) Unit number.
  37396  *      entry   -   (IN) BCM field entry id.
  37397  *      data    -   (IN) Qualifier match data.
  37398  *      mask    -   (IN) Qualifier match data.
  37399  * Returns:
  37400  *      BCM_E_XXX
  37401  * Notes:
  37402  */
  37403 int
  37404 bcm_esw_field_qualify_FibreChanSrcIdClassLower(int unit, 
  37405         bcm_field_entry_t entry,
  37406         bcm_class_t data, 
  37407         bcm_class_t mask)
  37408 {
  37409     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37410 #if defined BCM_TOMAHAWK_SUPPORT
  37411     uint32 cdata = 0;           /* Class Data */
  37412     uint32 cmask = 0;           /* Class Mask */
  37413 
  37414     
  37415 
  37416     COMPILER_64_TO_32_LO(cdata, data);
  37417     COMPILER_64_TO_32_LO(cmask, mask);
  37418 
  37419     FP_LOCK(unit);
  37420     rv = _field_qualify32(unit, entry, 
  37421                           bcmFieldQualifyFibreChanSrcIdClassLower,
  37422                           cdata, cmask);
  37423     FP_UNLOCK(unit);
  37424 #endif /* BCM_TOMAHAWK_SUPPORT */
  37425     return (rv);
  37426 
  37427 }
  37428 
  37429 /*
  37430  * Function:
  37431  *      bcm_esw_field_qualify_FibreChanSrcIdClassLower_get
  37432  * Purpose:
  37433  *      Get match criteria for bcmFieldQualifyFibreChanSrcIdClassLower
  37434  *      qualifier from the field entry.
  37435  * Parameters:
  37436  *      unit    - (IN) Unit number.
  37437  *      entry   - (IN) BCM field entry id.
  37438  *      data    - (OUT) Qualifier match data.
  37439  *      mask    - (OUT) Qualifier match mask.
  37440  * Returns:
  37441  *      BCM_E_XXX
  37442  * Notes:
  37443  */
  37444 int
  37445 bcm_esw_field_qualify_FibreChanSrcIdClassLower_get(int unit,
  37446         bcm_field_entry_t entry,
  37447         bcm_class_t *data,
  37448         bcm_class_t *mask)
  37449 {
  37450     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37451 
  37452 #if defined BCM_TOMAHAWK_SUPPORT
  37453     /* Read qualifier match value and mask. */
  37454     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37455                             bcmFieldQualifyFibreChanSrcIdClassLower,
  37456                             data, mask);
  37457 #endif /* BCM_TOMAHAWK_SUPPORT */
  37458     return (rv);
  37459 }
  37460 
  37461 /*
  37462  * Function:
  37463  *      bcm_esw_field_qualify_FibreChanSrcIdClassUpper
  37464  *      Set match criteria for bcmFieldQualifyFibreChanSrcIdClassUpper
  37465  *      qualifier in the field entry.
  37466  * Parameters:
  37467  *      unit    -   (IN) Unit number.
  37468  *      entry   -   (IN) BCM field entry id.
  37469  *      data    -   (IN) Qualifier match data.
  37470  *      mask    -   (IN) Qualifier match data.
  37471  * Returns:
  37472  *      BCM_E_XXX
  37473  * Notes:
  37474  */
  37475 int
  37476 bcm_esw_field_qualify_FibreChanSrcIdClassUpper(int unit, 
  37477         bcm_field_entry_t entry,
  37478         bcm_class_t data, 
  37479         bcm_class_t mask)
  37480 {
  37481     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37482 #if defined BCM_TOMAHAWK_SUPPORT
  37483     uint32 cdata = 0;           /* Class Data */
  37484     uint32 cmask = 0;           /* Class Mask */
  37485 
  37486     
  37487 
  37488     COMPILER_64_TO_32_LO(cdata, data);
  37489     COMPILER_64_TO_32_LO(cmask, mask);
  37490 
  37491     FP_LOCK(unit);
  37492     rv = _field_qualify32(unit, entry, 
  37493                           bcmFieldQualifyFibreChanSrcIdClassUpper,
  37494                           cdata, cmask);
  37495     FP_UNLOCK(unit);
  37496 #endif /* BCM_TOMAHAWK_SUPPORT */
  37497     return (rv);
  37498 }
  37499 
  37500 /*
  37501  * Function:
  37502  *      bcm_esw_field_qualify_FibreChanSrcIdClassUpper_get
  37503  * Purpose:
  37504  *      Get match criteria for bcmFieldQualifyFibreChanSrcIdClassUpper
  37505  *      qualifier from the field entry.
  37506  * Parameters:
  37507  *      unit    - (IN) Unit number.
  37508  *      entry   - (IN) BCM field entry id.
  37509  *      data    - (OUT) Qualifier match data.
  37510  *      mask    - (OUT) Qualifier match mask.
  37511  * Returns:
  37512  *      BCM_E_XXX
  37513  * Notes:
  37514  */
  37515 int
  37516 bcm_esw_field_qualify_FibreChanSrcIdClassUpper_get(int unit,
  37517         bcm_field_entry_t entry,
  37518         bcm_class_t *data,
  37519         bcm_class_t *mask)
  37520 {
  37521     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37522 
  37523 #if defined BCM_TOMAHAWK_SUPPORT
  37524     /* Read qualifier match value and mask. */
  37525     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37526                                 bcmFieldQualifyFibreChanSrcIdClassUpper,
  37527                                 data, mask);
  37528 #endif /* BCM_TOMAHAWK_SUPPORT */
  37529     return (rv);
  37530 }
  37531 
  37532 /*
  37533  * Function:
  37534  *      bcm_esw_field_qualify_FibreChanDstIdClass
  37535  *      Set match criteria for bcmFieldQualifyFibreChanDstIdClass
  37536  *      qualifier in the field entry.
  37537  * Parameters:
  37538  *      unit    -   (IN) Unit number.
  37539  *      entry   -   (IN) BCM field entry id.
  37540  *      data    -   (IN) Qualifier match data.
  37541  *      mask    -   (IN) Qualifier match data.
  37542  * Returns:
  37543  *      BCM_E_XXX
  37544  * Notes:
  37545  */
  37546 int
  37547 bcm_esw_field_qualify_FibreChanDstIdClass(int unit, 
  37548         bcm_field_entry_t entry,
  37549         bcm_class_t data, 
  37550         bcm_class_t mask)
  37551 {
  37552     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37553 #if defined BCM_TOMAHAWK_SUPPORT
  37554     uint32 ref_data[_FP_QUAL_DATA_WORDS];
  37555     uint32 ref_mask[_FP_QUAL_DATA_WORDS];
  37556 
  37557     
  37558 
  37559     sal_memset(&ref_data, 0, sizeof(ref_data));
  37560     sal_memset(&ref_mask, 0, sizeof(ref_mask));
  37561 
  37562     COMPILER_64_TO_32_LO(ref_data[0], data);
  37563     COMPILER_64_TO_32_HI(ref_data[1], data);
  37564     COMPILER_64_TO_32_LO(ref_mask[0], mask);
  37565     COMPILER_64_TO_32_HI(ref_mask[1], mask);
  37566 
  37567     FP_LOCK(unit);
  37568     rv = _bcm_field_th_qualify_set(unit, entry, 
  37569                                    bcmFieldQualifyFibreChanDstIdClass,
  37570                                    ref_data, ref_mask,
  37571                                    _FP_QUALIFIER_ADD);
  37572     FP_UNLOCK(unit);
  37573 #endif /* BCM_TOMAHAWK_SUPPORT */
  37574 
  37575     return (rv);
  37576 }
  37577 
  37578 /*
  37579  * Function:
  37580  *      bcm_esw_field_qualify_FibreChanDstIdClass_get
  37581  * Purpose:
  37582  *      Get match criteria for bcmFieldQualifyFibreChanDstIdClass
  37583  *      qualifier from the field entry.
  37584  * Parameters:
  37585  *      unit    - (IN) Unit number.
  37586  *      entry   - (IN) BCM field entry id.
  37587  *      data    - (OUT) Qualifier match data.
  37588  *      mask    - (OUT) Qualifier match mask.
  37589  * Returns:
  37590  *      BCM_E_XXX
  37591  * Notes:
  37592  */
  37593 int
  37594 bcm_esw_field_qualify_FibreChanDstIdClass_get(int unit,
  37595         bcm_field_entry_t entry,
  37596         bcm_class_t *data,
  37597         bcm_class_t *mask)
  37598 {
  37599     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37600 
  37601 #if defined BCM_TOMAHAWK_SUPPORT
  37602     /* Read qualifier match value and mask. */
  37603     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37604                                 bcmFieldQualifyFibreChanDstIdClass,
  37605                                 data, mask);
  37606 #endif /* BCM_TOMAHAWK_SUPPORT */
  37607     return (rv);
  37608 }
  37609 
  37610 /*
  37611  * Function:
  37612  *      bcm_esw_field_qualify_FibreChanDstIdClassMsbNibble
  37613  *      Set match criteria for bcmFieldQualifyFibreChanDstIdClassMsbNibble
  37614  *      qualifier in the field entry.
  37615  * Parameters:
  37616  *      unit    -   (IN) Unit number.
  37617  *      entry   -   (IN) BCM field entry id.
  37618  *      data    -   (IN) Qualifier match data.
  37619  *      mask    -   (IN) Qualifier match data.
  37620  * Returns:
  37621  *      BCM_E_XXX
  37622  * Notes:
  37623  */
  37624 int
  37625 bcm_esw_field_qualify_FibreChanDstIdClassMsbNibble(int unit, 
  37626         bcm_field_entry_t entry,
  37627         bcm_class_t data, 
  37628         bcm_class_t mask)
  37629 {
  37630     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37631 #if defined BCM_TOMAHAWK_SUPPORT
  37632     uint32 cdata = 0;           /* Class Data */
  37633     uint32 cmask = 0;           /* Class Mask */
  37634 
  37635     
  37636 
  37637     COMPILER_64_TO_32_LO(cdata, data);
  37638     COMPILER_64_TO_32_LO(cmask, mask);
  37639 
  37640     FP_LOCK(unit);
  37641     rv = _field_qualify32(unit, entry, 
  37642                           bcmFieldQualifyFibreChanDstIdClassMsbNibble,
  37643                           cdata, cmask);
  37644     FP_UNLOCK(unit);
  37645 #endif /* BCM_TOMAHAWK_SUPPORT */
  37646     return (rv);
  37647 }
  37648 
  37649 /*
  37650  * Function:
  37651  *      bcm_esw_field_qualify_FibreChanDstIdClassMsbNibble_get
  37652  * Purpose:
  37653  *      Get match criteria for bcmFieldQualifyFibreChanDstIdClassMsbNibble
  37654  *      qualifier from the field entry.
  37655  * Parameters:
  37656  *      unit    - (IN) Unit number.
  37657  *      entry   - (IN) BCM field entry id.
  37658  *      data    - (OUT) Qualifier match data.
  37659  *      mask    - (OUT) Qualifier match mask.
  37660  * Returns:
  37661  *      BCM_E_XXX
  37662  * Notes:
  37663  */
  37664 int
  37665 bcm_esw_field_qualify_FibreChanDstIdClassMsbNibble_get(int unit,
  37666         bcm_field_entry_t entry,
  37667         bcm_class_t *data,
  37668         bcm_class_t *mask)
  37669 {
  37670     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37671 
  37672 #if defined BCM_TOMAHAWK_SUPPORT
  37673     /* Read qualifier match value and mask. */
  37674     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37675                             bcmFieldQualifyFibreChanDstIdClassMsbNibble,
  37676                             data, mask);
  37677 #endif /* BCM_TOMAHAWK_SUPPORT */
  37678     return (rv);
  37679 }
  37680 
  37681 /*
  37682  * Function:
  37683  *      bcm_esw_field_qualify_FibreChanDstIdClassLower
  37684  *      Set match criteria for bcmFieldQualifyFibreChanDstIdClassLower
  37685  *      qualifier in the field entry.
  37686  * Parameters:
  37687  *      unit    -   (IN) Unit number.
  37688  *      entry   -   (IN) BCM field entry id.
  37689  *      data    -   (IN) Qualifier match data.
  37690  *      mask    -   (IN) Qualifier match data.
  37691  * Returns:
  37692  *      BCM_E_XXX
  37693  * Notes:
  37694  */
  37695 int
  37696 bcm_esw_field_qualify_FibreChanDstIdClassLower(int unit, 
  37697         bcm_field_entry_t entry,
  37698         bcm_class_t data, 
  37699         bcm_class_t mask)
  37700 {
  37701     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37702 #if defined BCM_TOMAHAWK_SUPPORT
  37703     uint32 cdata = 0;           /* Class Data */
  37704     uint32 cmask = 0;           /* Class Mask */
  37705 
  37706     
  37707 
  37708     COMPILER_64_TO_32_LO(cdata, data);
  37709     COMPILER_64_TO_32_LO(cmask, mask);
  37710 
  37711     FP_LOCK(unit);
  37712     rv = _field_qualify32(unit, entry, 
  37713                           bcmFieldQualifyFibreChanDstIdClassLower,
  37714                           cdata, cmask);
  37715     FP_UNLOCK(unit);
  37716 #endif /* BCM_TOMAHAWK_SUPPORT */
  37717     return (rv);
  37718 }
  37719 
  37720 /*
  37721  * Function:
  37722  *      bcm_esw_field_qualify_FibreChanDstIdClassLower_get
  37723  * Purpose:
  37724  *      Get match criteria for bcmFieldQualifyFibreChanDstIdClassLower
  37725  *      qualifier from the field entry.
  37726  * Parameters:
  37727  *      unit    - (IN) Unit number.
  37728  *      entry   - (IN) BCM field entry id.
  37729  *      data    - (OUT) Qualifier match data.
  37730  *      mask    - (OUT) Qualifier match mask.
  37731  * Returns:
  37732  *      BCM_E_XXX
  37733  * Notes:
  37734  */
  37735 int
  37736 bcm_esw_field_qualify_FibreChanDstIdClassLower_get(int unit,
  37737         bcm_field_entry_t entry,
  37738         bcm_class_t *data,
  37739         bcm_class_t *mask)
  37740 {
  37741     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37742 
  37743 #if defined BCM_TOMAHAWK_SUPPORT
  37744     /* Read qualifier match value and mask. */
  37745     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37746                         bcmFieldQualifyFibreChanDstIdClassLower,
  37747                         data, mask);
  37748 #endif /* BCM_TOMAHAWK_SUPPORT */
  37749     return (rv);
  37750 }
  37751 
  37752 /*
  37753  * Function:
  37754  *      bcm_esw_field_qualify_FibreChanDstIdClassUpper
  37755  *      Set match criteria for bcmFieldQualifyFibreChanDstIdClassUpper
  37756  *      qualifier in the field entry.
  37757  * Parameters:
  37758  *      unit    -   (IN) Unit number.
  37759  *      entry   -   (IN) BCM field entry id.
  37760  *      data    -   (IN) Qualifier match data.
  37761  *      mask    -   (IN) Qualifier match data.
  37762  * Returns:
  37763  *      BCM_E_XXX
  37764  * Notes:
  37765  */
  37766 int
  37767 bcm_esw_field_qualify_FibreChanDstIdClassUpper(int unit, 
  37768         bcm_field_entry_t entry,
  37769         bcm_class_t data, 
  37770         bcm_class_t mask)
  37771 {
  37772     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37773 #if defined BCM_TOMAHAWK_SUPPORT
  37774     uint32 cdata = 0;           /* Class Data */
  37775     uint32 cmask = 0;           /* Class Mask */
  37776 
  37777     
  37778 
  37779     COMPILER_64_TO_32_LO(cdata, data);
  37780     COMPILER_64_TO_32_LO(cmask, mask);
  37781 
  37782     FP_LOCK(unit);
  37783     rv = _field_qualify32(unit, entry, 
  37784                           bcmFieldQualifyFibreChanDstIdClassUpper,
  37785                           cdata, cmask);
  37786     FP_UNLOCK(unit);
  37787 #endif /* BCM_TOMAHAWK_SUPPORT */
  37788     return (rv);
  37789 }
  37790 
  37791 /*
  37792  * Function:
  37793  *      bcm_esw_field_qualify_FibreChanDstIdClassUpper_get
  37794  * Purpose:
  37795  *      Get match criteria for bcmFieldQualifyFibreChanDstIdClassUpper
  37796  *      qualifier from the field entry.
  37797  * Parameters:
  37798  *      unit    - (IN) Unit number.
  37799  *      entry   - (IN) BCM field entry id.
  37800  *      data    - (OUT) Qualifier match data.
  37801  *      mask    - (OUT) Qualifier match mask.
  37802  * Returns:
  37803  *      BCM_E_XXX
  37804  * Notes:
  37805  */
  37806 int
  37807 bcm_esw_field_qualify_FibreChanDstIdClassUpper_get(int unit,
  37808         bcm_field_entry_t entry,
  37809         bcm_class_t *data,
  37810         bcm_class_t *mask)
  37811 {
  37812     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37813 
  37814 #if defined BCM_TOMAHAWK_SUPPORT
  37815     /* Read qualifier match value and mask. */
  37816     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37817                     bcmFieldQualifyFibreChanDstIdClassUpper, 
  37818                     data, mask);
  37819 #endif /* BCM_TOMAHAWK_SUPPORT */
  37820     return (rv);
  37821 }
  37822 
  37823 /*
  37824  * Function:
  37825  *      bcm_esw_field_qualify_TcpClassZero
  37826  *      Set match criteria for bcmFieldQualifyTcpClassZero
  37827  *      qualifier in the field entry.
  37828  * Parameters:
  37829  *      unit    -   (IN) Unit number.
  37830  *      entry   -   (IN) BCM field entry id.
  37831  *      data    -   (IN) Qualifier match data.
  37832  *      mask    -   (IN) Qualifier match data.
  37833  * Returns:
  37834  *      BCM_E_XXX
  37835  * Notes:
  37836  */
  37837 int
  37838 bcm_esw_field_qualify_TcpClassZero(int unit, 
  37839         bcm_field_entry_t entry,
  37840         bcm_class_t data, 
  37841         bcm_class_t mask)
  37842 {
  37843     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37844 #if defined BCM_TRX_SUPPORT
  37845     uint32 cdata = 0;           /* Class Data */
  37846     uint32 cmask = 0;           /* Class Mask */
  37847 
  37848     
  37849 
  37850     COMPILER_64_TO_32_LO(cdata, data);
  37851     COMPILER_64_TO_32_LO(cmask, mask);
  37852 
  37853     FP_LOCK(unit);
  37854     rv = _field_qualify32(unit, entry, 
  37855                           bcmFieldQualifyTcpClassZero,
  37856                           cdata, cmask);
  37857     FP_UNLOCK(unit);
  37858 #endif /* BCM_TRX_SUPPORT */
  37859     return (rv);
  37860 }
  37861 
  37862 /*
  37863  * Function:
  37864  *      bcm_esw_field_qualify_TcpClassZero_get
  37865  * Purpose:
  37866  *      Get match criteria for bcmFieldQualifyTcpClassZero
  37867  *      qualifier from the field entry.
  37868  * Parameters:
  37869  *      unit    - (IN) Unit number.
  37870  *      entry   - (IN) BCM field entry id.
  37871  *      data    - (OUT) Qualifier match data.
  37872  *      mask    - (OUT) Qualifier match mask.
  37873  * Returns:
  37874  *      BCM_E_XXX
  37875  * Notes:
  37876  */
  37877 int
  37878 bcm_esw_field_qualify_TcpClassZero_get(int unit,
  37879         bcm_field_entry_t entry,
  37880         bcm_class_t *data,
  37881         bcm_class_t *mask)
  37882 {
  37883     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37884 
  37885 #if defined BCM_TRX_SUPPORT
  37886     /* Read qualifier match value and mask. */
  37887     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37888                                                bcmFieldQualifyTcpClassZero,
  37889                                                data, mask);
  37890 #endif /* BCM_TRX_SUPPORT */
  37891     return (rv);
  37892 }
  37893 
  37894 /*
  37895  * Function:
  37896  *      bcm_esw_field_qualify_TosClassZero
  37897  *      Set match criteria for bcmFieldQualifyTosClassZero
  37898  *      qualifier in the field entry.
  37899  * Parameters:
  37900  *      unit    -   (IN) Unit number.
  37901  *      entry   -   (IN) BCM field entry id.
  37902  *      data    -   (IN) Qualifier match data.
  37903  *      mask    -   (IN) Qualifier match data.
  37904  * Returns:
  37905  *      BCM_E_XXX
  37906  * Notes:
  37907  */
  37908 int
  37909 bcm_esw_field_qualify_TosClassZero(int unit, 
  37910         bcm_field_entry_t entry,
  37911         bcm_class_t data, 
  37912         bcm_class_t mask)
  37913 {
  37914     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37915 #if defined BCM_TRX_SUPPORT
  37916     uint32 cdata = 0;           /* Class Data */
  37917     uint32 cmask = 0;           /* Class Mask */
  37918 
  37919     
  37920 
  37921     COMPILER_64_TO_32_LO(cdata, data);
  37922     COMPILER_64_TO_32_LO(cmask, mask);
  37923 
  37924     FP_LOCK(unit);
  37925     rv = _field_qualify32(unit, entry, 
  37926                           bcmFieldQualifyTosClassZero,
  37927                           cdata, cmask);
  37928     FP_UNLOCK(unit);
  37929 #endif /* BCM_TRX_SUPPORT */
  37930     return (rv);
  37931 }
  37932 
  37933 /*
  37934  * Function:
  37935  *      bcm_esw_field_qualify_TosClassZero_get
  37936  * Purpose:
  37937  *      Get match criteria for bcmFieldQualifyTosClassZero
  37938  *      qualifier from the field entry.
  37939  * Parameters:
  37940  *      unit    - (IN) Unit number.
  37941  *      entry   - (IN) BCM field entry id.
  37942  *      data    - (OUT) Qualifier match data.
  37943  *      mask    - (OUT) Qualifier match mask.
  37944  * Returns:
  37945  *      BCM_E_XXX
  37946  * Notes:
  37947  */
  37948 int
  37949 bcm_esw_field_qualify_TosClassZero_get(int unit,
  37950         bcm_field_entry_t entry,
  37951         bcm_class_t *data,
  37952         bcm_class_t *mask)
  37953 {
  37954     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37955 
  37956 #if defined(BCM_TRX_SUPPORT)
  37957     /* Read qualifier match value and mask. */
  37958     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  37959                                         bcmFieldQualifyTosClassZero,
  37960                                         data, mask);
  37961 #endif /* BCM_TRX_SUPPORT */
  37962     return (rv);
  37963 }
  37964 
  37965 /*
  37966  * Function:
  37967  *      bcm_esw_field_qualify_TtlClassZero
  37968  *      Set match criteria for bcmFieldQualifyTtlClassZero
  37969  *      qualifier in the field entry.
  37970  * Parameters:
  37971  *      unit    -   (IN) Unit number.
  37972  *      entry   -   (IN) BCM field entry id.
  37973  *      data    -   (IN) Qualifier match data.
  37974  *      mask    -   (IN) Qualifier match data.
  37975  * Returns:
  37976  *      BCM_E_XXX
  37977  * Notes:
  37978  */
  37979 int
  37980 bcm_esw_field_qualify_TtlClassZero(int unit, 
  37981         bcm_field_entry_t entry,
  37982         bcm_class_t data, 
  37983         bcm_class_t mask)
  37984 {
  37985     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  37986 #if defined BCM_TRX_SUPPORT
  37987     uint32 cdata = 0;           /* Class Data */
  37988     uint32 cmask = 0;           /* Class Mask */
  37989 
  37990     COMPILER_64_TO_32_LO(cdata, data);
  37991     COMPILER_64_TO_32_LO(cmask, mask);
  37992 
  37993     FP_LOCK(unit);
  37994     rv = _field_qualify32(unit, entry, 
  37995                           bcmFieldQualifyTtlClassZero,
  37996                           cdata, cmask);
  37997 
  37998     FP_UNLOCK(unit);
  37999 #endif /* BCM_TRX_SUPPORT */
  38000     return (rv);
  38001 }
  38002 
  38003 /*
  38004  * Function:
  38005  *      bcm_esw_field_qualify_TtlClassZero_get
  38006  * Purpose:
  38007  *      Get match criteria for bcmFieldQualifyTtlClassZero
  38008  *      qualifier from the field entry.
  38009  * Parameters:
  38010  *      unit    - (IN) Unit number.
  38011  *      entry   - (IN) BCM field entry id.
  38012  *      data    - (OUT) Qualifier match data.
  38013  *      mask    - (OUT) Qualifier match mask.
  38014  * Returns:
  38015  *      BCM_E_XXX
  38016  * Notes:
  38017  */
  38018 int
  38019 bcm_esw_field_qualify_TtlClassZero_get(int unit,
  38020         bcm_field_entry_t entry,
  38021         bcm_class_t *data,
  38022         bcm_class_t *mask)
  38023 {
  38024     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  38025 
  38026 #if defined BCM_TRX_SUPPORT
  38027     /* Read qualifier match value and mask. */
  38028     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  38029                                                bcmFieldQualifyTtlClassZero,
  38030                                                data, mask);
  38031 #endif /* BCM_TRX_SUPPORT */
  38032     return (rv);
  38033 }
  38034 
  38035 /*
  38036  * Function:
  38037  *      bcm_esw_field_qualify_TcpClassOne
  38038  *      Set match criteria for bcmFieldQualifyTcpClassOne
  38039  *      qualifier in the field entry.
  38040  * Parameters:
  38041  *      unit    -   (IN) Unit number.
  38042  *      entry   -   (IN) BCM field entry id.
  38043  *      data    -   (IN) Qualifier match data.
  38044  *      mask    -   (IN) Qualifier match data.
  38045  * Returns:
  38046  *      BCM_E_XXX
  38047  * Notes:
  38048  */
  38049 int
  38050 bcm_esw_field_qualify_TcpClassOne(int unit, 
  38051         bcm_field_entry_t entry,
  38052         bcm_class_t data, 
  38053         bcm_class_t mask)
  38054 {
  38055     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  38056 #if defined (BCM_TRX_SUPPORT)
  38057     uint32 cdata = 0;           /* Class Data */
  38058     uint32 cmask = 0;           /* Class Mask */
  38059 
  38060     COMPILER_64_TO_32_LO(cdata, data);
  38061     COMPILER_64_TO_32_LO(cmask, mask);
  38062 
  38063     FP_LOCK(unit);
  38064     rv = _field_qualify32(unit, entry, 
  38065                           bcmFieldQualifyTcpClassOne,
  38066                           cdata, cmask);
  38067     FP_UNLOCK(unit);
  38068 #endif /* BCM_TRX_SUPPORT */
  38069 
  38070     return (rv);
  38071 
  38072 }
  38073 
  38074 /*
  38075  * Function:
  38076  *      bcm_esw_field_qualify_TcpClassOne_get
  38077  * Purpose:
  38078  *      Get match criteria for bcmFieldQualifyTcpClassOne
  38079  *      qualifier from the field entry.
  38080  * Parameters:
  38081  *      unit    - (IN) Unit number.
  38082  *      entry   - (IN) BCM field entry id.
  38083  *      data    - (OUT) Qualifier match data.
  38084  *      mask    - (OUT) Qualifier match mask.
  38085  * Returns:
  38086  *      BCM_E_XXX
  38087  * Notes:
  38088  */
  38089 int
  38090 bcm_esw_field_qualify_TcpClassOne_get(int unit,
  38091         bcm_field_entry_t entry,
  38092         bcm_class_t *data,
  38093         bcm_class_t *mask)
  38094 {
  38095     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  38096 
  38097 #if defined BCM_TRX_SUPPORT
  38098     /* Read qualifier match value and mask. */
  38099     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  38100                                                bcmFieldQualifyTcpClassOne,
  38101                                                data, mask);
  38102 #endif /* BCM_TRX_SUPPORT */
  38103     return (rv);
  38104 }
  38105 
  38106 /*
  38107  * Function:
  38108  *      bcm_esw_field_qualify_TosClassOne
  38109  *      Set match criteria for bcmFieldQualifyTosClassOne
  38110  *      qualifier in the field entry.
  38111  * Parameters:
  38112  *      unit    -   (IN) Unit number.
  38113  *      entry   -   (IN) BCM field entry id.
  38114  *      data    -   (IN) Qualifier match data.
  38115  *      mask    -   (IN) Qualifier match data.
  38116  * Returns:
  38117  *      BCM_E_XXX
  38118  * Notes:
  38119  */
  38120 int
  38121 bcm_esw_field_qualify_TosClassOne(int unit, 
  38122         bcm_field_entry_t entry,
  38123         bcm_class_t data, 
  38124         bcm_class_t mask)
  38125 {
  38126     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  38127 #if defined BCM_TRX_SUPPORT
  38128     uint32 cdata = 0;           /* Class Data */
  38129     uint32 cmask = 0;           /* Class Mask */
  38130 
  38131     
  38132 
  38133     COMPILER_64_TO_32_LO(cdata, data);
  38134     COMPILER_64_TO_32_LO(cmask, mask);
  38135 
  38136     FP_LOCK(unit);
  38137     rv = _field_qualify32(unit, entry, 
  38138                           bcmFieldQualifyTosClassOne,
  38139                           cdata, cmask);
  38140     FP_UNLOCK(unit);
  38141 #endif /* BCM_TRX_SUPPORT */
  38142     return (rv);
  38143 }
  38144 
  38145 /*
  38146  * Function:
  38147  *      bcm_esw_field_qualify_TosClassOne_get
  38148  * Purpose:
  38149  *      Get match criteria for bcmFieldQualifyTosClassOne
  38150  *      qualifier from the field entry.
  38151  * Parameters:
  38152  *      unit    - (IN) Unit number.
  38153  *      entry   - (IN) BCM field entry id.
  38154  *      data    - (OUT) Qualifier match data.
  38155  *      mask    - (OUT) Qualifier match mask.
  38156  * Returns:
  38157  *      BCM_E_XXX
  38158  * Notes:
  38159  */
  38160 int
  38161 bcm_esw_field_qualify_TosClassOne_get(int unit,
  38162         bcm_field_entry_t entry,
  38163         bcm_class_t *data,
  38164         bcm_class_t *mask)
  38165 {
  38166     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  38167 
  38168 #if defined BCM_TRX_SUPPORT
  38169     /* Read qualifier match value and mask. */
  38170     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  38171                                                bcmFieldQualifyTosClassOne,
  38172                                                data, mask);
  38173 #endif /* BCM_TRX_SUPPORT */
  38174     return (rv);
  38175 }
  38176 
  38177 /*
  38178  * Function:
  38179  *      bcm_esw_field_qualify_TtlClassOne
  38180  *      Set match criteria for bcmFieldQualifyTtlClassOne
  38181  *      qualifier in the field entry.
  38182  * Parameters:
  38183  *      unit    -   (IN) Unit number.
  38184  *      entry   -   (IN) BCM field entry id.
  38185  *      data    -   (IN) Qualifier match data.
  38186  *      mask    -   (IN) Qualifier match data.
  38187  * Returns:
  38188  *      BCM_E_XXX
  38189  * Notes:
  38190  */
  38191 int
  38192 bcm_esw_field_qualify_TtlClassOne(int unit, 
  38193         bcm_field_entry_t entry,
  38194         bcm_class_t data, 
  38195         bcm_class_t mask)
  38196 {
  38197     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  38198 #if defined BCM_TRX_SUPPORT
  38199     uint32 cdata = 0;           /* Class Data */
  38200     uint32 cmask = 0;           /* Class Mask */
  38201 
  38202     
  38203 
  38204     COMPILER_64_TO_32_LO(cdata, data);
  38205     COMPILER_64_TO_32_LO(cmask, mask);
  38206 
  38207     FP_LOCK(unit);
  38208     rv = _field_qualify32(unit, entry, 
  38209                           bcmFieldQualifyTtlClassOne,
  38210                           cdata, cmask);
  38211     FP_UNLOCK(unit);
  38212 #endif /* BCM_TRX_SUPPORT */
  38213     return (rv);
  38214 }
  38215 
  38216 /*
  38217  * Function:
  38218  *      bcm_esw_field_qualify_TtlClassOne_get
  38219  * Purpose:
  38220  *      Get match criteria for bcmFieldQualifyTtlClassOne
  38221  *      qualifier from the field entry.
  38222  * Parameters:
  38223  *      unit    - (IN) Unit number.
  38224  *      entry   - (IN) BCM field entry id.
  38225  *      data    - (OUT) Qualifier match data.
  38226  *      mask    - (OUT) Qualifier match mask.
  38227  * Returns:
  38228  *      BCM_E_XXX
  38229  * Notes:
  38230  */
  38231 int
  38232 bcm_esw_field_qualify_TtlClassOne_get(int unit,
  38233         bcm_field_entry_t entry,
  38234         bcm_class_t *data,
  38235         bcm_class_t *mask)
  38236 {
  38237     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  38238 
  38239 #if defined BCM_TRX_SUPPORT
  38240     /* Read qualifier match value and mask. */
  38241     rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  38242                                                bcmFieldQualifyTtlClassOne,
  38243                                                data, mask);
  38244 #endif /* BCM_TRX_SUPPORT */
  38245     return (rv);
  38246 }
  38247 
  38248 /*
  38249  * Function:
  38250  *      bcm_esw_field_qualify_HiGigDstMulticast
  38251  *      Set match criteria for bcmFieldQualifyHiGigDstMulticast
  38252  *      qualifier in the field entry.
  38253  * Parameters:
  38254  *      unit    -   (IN) Unit number.
  38255  *      entry   -   (IN) BCM field entry id.
  38256  *      data    -   (IN) Qualifier match data.
  38257  *      mask    -   (IN) Qualifier match mask.
  38258  * Returns:
  38259  *      BCM_E_XXX
  38260  */
  38261 int bcm_esw_field_qualify_HiGigDstMulticast(int unit,
  38262         bcm_field_entry_t entry,
  38263         uint8 data,
  38264         uint8 mask)
  38265 {
  38266     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38267 
  38268 #if defined BCM_TOMAHAWK_SUPPORT
  38269 
  38270     
  38271     FP_LOCK(unit);
  38272     
  38273     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDstMulticast, 
  38274                           data, mask);
  38275 
  38276     FP_UNLOCK(unit);    
  38277 #endif
  38278     return rv;
  38279 }
  38280 
  38281 /*
  38282  * Function:
  38283  *      bcm_esw_field_qualify_HiGigDstMulticast_get
  38284  *      Get match criteria for bcmFieldQualifyHiGigDstMulticast
  38285  *      qualifier from the field entry.
  38286  * Parameters:
  38287  *      unit    - (IN) Unit number.
  38288  *      entry   - (IN) BCM field entry id.
  38289  *      data    - (OUT) Qualifier match data.
  38290  *      mask    - (OUT) Qualifier match mask.
  38291  * Returns:
  38292  *      BCM_E_XXX
  38293  */
  38294 int bcm_esw_field_qualify_HiGigDstMulticast_get(int unit,
  38295         bcm_field_entry_t entry,
  38296         uint8 *data,
  38297         uint8 *mask)
  38298 {
  38299     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38300 
  38301 #if defined BCM_TOMAHAWK_SUPPORT
  38302     /* Read qualifier match value and mask. */
  38303     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  38304                         bcmFieldQualifyHiGigDstMulticast, data, mask);
  38305 #endif
  38306     return rv;
  38307 }
  38308 
  38309 /*
  38310  * Function:
  38311  *      bcm_esw_field_qualify_HiGigDstMulticastGroupId
  38312  *      Set match criteria for bcmFieldQualifyHiGigDstMulticastGroupId
  38313  *      qualifier in the field entry.
  38314  * Parameters:
  38315  *      unit    -   (IN) Unit number.
  38316  *      entry   -   (IN) BCM field entry id.
  38317  *      group    -   (IN) Qualifier match group.
  38318  *      mask    -   (IN) Qualifier match mask.
  38319  * Returns:
  38320  *      BCM_E_XXX
  38321  * Notes:
  38322  */
  38323 int bcm_esw_field_qualify_HiGigDstMulticastGroupId(int unit,
  38324         bcm_field_entry_t entry,
  38325         bcm_multicast_t group, 
  38326         bcm_multicast_t mask)
  38327 {
  38328     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38329 
  38330 #if defined BCM_TOMAHAWK_SUPPORT
  38331     uint32 hw_data = 0;            /* HW data match criteria.  */
  38332     uint32 hw_mask = 0;            /* HW data mask.            */
  38333 
  38334     if (0 == BCM_MULTICAST_IS_SET(group)) {
  38335         return (BCM_E_PARAM);
  38336     }
  38337 
  38338     if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  38339         if (0 == BCM_MULTICAST_IS_SET(mask)) {
  38340             return (BCM_E_PARAM);
  38341         }
  38342     }
  38343 
  38344     if (BCM_MULTICAST_IS_L3(group)) {
  38345         hw_data = BCM_MULTICAST_L3_GET(group);
  38346     } else if (BCM_MULTICAST_IS_L2(group)) {
  38347         hw_data = BCM_MULTICAST_L2_GET(group);
  38348     } else {
  38349         return (BCM_E_PARAM);
  38350     }
  38351 
  38352     if (mask == BCM_FIELD_EXACT_MATCH_MASK) {
  38353         hw_mask = (BCM_FIELD_EXACT_MATCH_MASK);
  38354     } else {
  38355         if (BCM_MULTICAST_IS_L3(mask)) {
  38356             hw_mask = BCM_MULTICAST_L3_GET(mask);
  38357         } else if(BCM_MULTICAST_IS_L2(mask)) {
  38358             hw_mask = BCM_MULTICAST_L2_GET(mask);
  38359         }
  38360     }
  38361 
  38362    
  38363    FP_LOCK(unit);
  38364 
  38365    rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDstMulticastGroupId,
  38366            hw_data, hw_mask);
  38367 
  38368    FP_UNLOCK(unit);
  38369 #endif
  38370     return rv;
  38371 }
  38372 
  38373 /*
  38374  * Function:
  38375  *      bcm_esw_field_qualify_HiGigDstMulticastGroupId_get
  38376  *      Get match criteria for bcmFieldQualifyHiGigDstMulticastGroupId
  38377  *      qualifier from the field entry.
  38378  * Parameters:
  38379  *      unit    - (IN) Unit number.
  38380  *      entry   - (IN) BCM field entry id.
  38381  *      group    - (OUT) Qualifier match group.
  38382  *      mask    - (OUT) Qualifier match mask.
  38383  * Returns:
  38384  *      BCM_E_XXX
  38385  * Notes:
  38386  */
  38387 int bcm_esw_field_qualify_HiGigDstMulticastGroupId_get(int unit,
  38388         bcm_field_entry_t entry,
  38389         bcm_multicast_t *group,
  38390         bcm_multicast_t *mask)
  38391 {
  38392     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38393 
  38394 #if defined BCM_TOMAHAWK_SUPPORT
  38395     uint32 hw_data = 0;   /* HW encoded qualifier data.  */
  38396     uint32 hw_mask = 0;   /* HW encoding qualifier mask. */
  38397     uint8 mc_grptype_data; /* Multicast Group Type */
  38398 
  38399     /* Input parameters check. */
  38400     if ((NULL == group) || (NULL == mask)) {
  38401         return (BCM_E_PARAM);
  38402     }
  38403 
  38404     /* Read qualifier match value and mask. */
  38405     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  38406             bcmFieldQualifyHiGigDstMulticastGroupId,
  38407             &hw_data, &hw_mask);
  38408     
  38409     BCM_IF_ERROR_RETURN(rv);
  38410 
  38411     /* Get Multicast group type info */
  38412     mc_grptype_data = hw_data >> _FP_MCAST_D_TYPE_OFFSET(unit);
  38413 
  38414     if (_bcmFieldDestTypeL2mc == mc_grptype_data) {
  38415         /* L2 MC */
  38416         BCM_MULTICAST_L2_SET(*group, hw_data);
  38417         BCM_MULTICAST_L2_SET(*mask, hw_mask);
  38418     } else if (_bcmFieldDestTypeL3mc == mc_grptype_data)  {
  38419         /* IPMC */
  38420         BCM_MULTICAST_L3_SET(*group, hw_data);
  38421         BCM_MULTICAST_L3_SET(*mask, hw_mask);
  38422     } else {
  38423         return (BCM_E_INTERNAL);
  38424     }
  38425     
  38426     rv = BCM_E_NONE;
  38427 #endif
  38428     return rv;
  38429 }
  38430 
  38431 /*
  38432  * Function:
  38433  *      bcm_esw_field_qualify_HiGigTrafficClass
  38434  *      Set match criteria for bcmFieldQualifyHiGigTrafficClass
  38435  *      qualifier in the field entry.
  38436  * Parameters:
  38437  *      unit    -   (IN) Unit number.
  38438  *      entry   -   (IN) BCM field entry id.
  38439  *      data    -   (IN) Qualifier match data.
  38440  *      mask    -   (IN) Qualifier match mask.
  38441  * Returns:
  38442  *      BCM_E_XXX
  38443  * Notes:
  38444  */
  38445 int bcm_esw_field_qualify_HiGigTrafficClass(int unit,
  38446         bcm_field_entry_t entry,
  38447         uint8 data,
  38448         uint8 mask)
  38449 {
  38450     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38451 
  38452 #if defined BCM_TOMAHAWK_SUPPORT
  38453 
  38454     
  38455     FP_LOCK(unit);
  38456 
  38457     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigTrafficClass,
  38458                           data, mask);
  38459     FP_UNLOCK(unit);
  38460 #endif
  38461     return rv;
  38462 }
  38463 
  38464 /*
  38465  * Function:
  38466  *      bcm_esw_field_qualify_HiGigTrafficClass_get
  38467  *      Get match criteria for bcmFieldQualifyHiGigTrafficClass
  38468  *      qualifier from the field entry.
  38469  * Parameters:
  38470  *      unit    - (IN) Unit number.
  38471  *      entry   - (IN) BCM field entry id.
  38472  *      data    - (OUT) Qualifier match data.
  38473  *      mask    - (OUT) Qualifier match mask.
  38474  * Returns:
  38475  *      BCM_E_XXX
  38476  * Notes:
  38477  */
  38478 int bcm_esw_field_qualify_HiGigTrafficClass_get(int unit,
  38479         bcm_field_entry_t entry,
  38480         uint8 *data,
  38481         uint8 *mask)
  38482 {
  38483     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38484 
  38485 #if defined BCM_TOMAHAWK_SUPPORT
  38486     /* Read qualifier match value and mask. */
  38487     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  38488                                                 bcmFieldQualifyHiGigTrafficClass,
  38489                                                 data, mask);
  38490 #endif
  38491     return rv;
  38492 }
  38493 
  38494 /*
  38495  * Function:
  38496  *      bcm_esw_field_qualify_HiGigDstModuleGport
  38497  *      Set match criteria for bcmFieldQualifyHiGigDstModuleGport
  38498  *      qualifier in the field entry.
  38499  * Parameters:
  38500  *      unit      -   (IN) Unit number.
  38501  *      entry     -   (IN) BCM field entry id.
  38502  *      port_id   -   (IN) Qualifier match port.
  38503  *      port_mask -   (IN) Qualifier match mask.
  38504  * Returns:
  38505  *      BCM_E_XXX
  38506  * Notes:
  38507  */
  38508 int bcm_esw_field_qualify_HiGigDstModuleGport(int unit,
  38509         bcm_field_entry_t entry,
  38510         bcm_gport_t port_id,
  38511         bcm_gport_t port_mask)
  38512 {
  38513     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38514 
  38515 #if defined BCM_TOMAHAWK_SUPPORT
  38516     uint32 data = 0;            /* HW data match criteria.  */
  38517     uint32 mask = 0;            /* HW data mask.            */
  38518 
  38519     if (0 == BCM_GPORT_IS_MODPORT(port_id)) {
  38520         return (BCM_E_PARAM);
  38521     }
  38522 
  38523     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) { 
  38524         if (0 == BCM_GPORT_IS_MODPORT(port_mask)) { 
  38525             return (BCM_E_PARAM);
  38526         }
  38527     }
  38528    
  38529     data  = BCM_GPORT_MODPORT_MODID_GET(port_id);
  38530 
  38531     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  38532         mask |= BCM_GPORT_MODPORT_MODID_GET(port_mask);
  38533     } else { 
  38534         mask = BCM_FIELD_EXACT_MATCH_MASK;
  38535     }
  38536 
  38537     
  38538     FP_LOCK(unit);
  38539 
  38540     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDstModuleGport,
  38541             data, mask);
  38542     FP_UNLOCK(unit);
  38543 #endif
  38544     return rv;
  38545 }
  38546 
  38547 /*
  38548  * Function:
  38549  *      bcm_esw_field_qualify_HiGigDstModuleGport_get
  38550  *      Get match criteria for bcmFieldQualifyHiGigDstModuleGport
  38551  *      qualifier from the field entry.
  38552  * Parameters:
  38553  *      unit        - (IN) Unit number.
  38554  *      entry       - (IN) BCM field entry id.
  38555  *      port_id     - (OUT) Qualifier match port.
  38556  *      port_mask   - (OUT) Qualifier match mask.
  38557  * Returns:
  38558  *      BCM_E_XXX
  38559  * Notes:
  38560  */
  38561 int bcm_esw_field_qualify_HiGigDstModuleGport_get(int unit,
  38562         bcm_field_entry_t entry,
  38563         bcm_gport_t *port_id,
  38564         bcm_gport_t *port_mask)
  38565 {
  38566     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38567 
  38568 #if defined BCM_TOMAHAWK_SUPPORT
  38569     uint32 data = 0;   /* HW encoded qualifier data.  */
  38570     uint32 mask = 0;   /* HW encoding qualifier mask. */
  38571     
  38572     if ((NULL == port_id) || (NULL == port_mask)) {
  38573         return (BCM_E_PARAM);
  38574     }
  38575 
  38576     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  38577             bcmFieldQualifyHiGigDstModuleGport, &data, &mask);
  38578     
  38579     BCM_IF_ERROR_RETURN(rv);
  38580     BCM_GPORT_MODPORT_SET(*port_id, (data & 0xff), 0);
  38581     BCM_GPORT_MODPORT_SET(*port_mask, (data & 0xff), 0);
  38582 #endif
  38583     return rv;
  38584 }
  38585 
  38586 /*
  38587  * Function:
  38588  *      bcm_esw_field_qualify_HiGigDstPortGport
  38589  *      Set match criteria for bcmFieldQualifyHiGigDstPortGport
  38590  *      qualifier in the field entry.
  38591  * Parameters:
  38592  *      unit        -   (IN) Unit number.
  38593  *      entry       -   (IN) BCM field entry id.
  38594  *      port_id     -   (IN) Qualifier match port.
  38595  *      port_mask   -   (IN) Qualifier match mask.
  38596  * Returns:
  38597  *      BCM_E_XXX
  38598  * Notes:
  38599  */
  38600 int bcm_esw_field_qualify_HiGigDstPortGport(int unit,
  38601         bcm_field_entry_t entry,
  38602         bcm_gport_t port_id,
  38603         bcm_gport_t port_mask)
  38604 {
  38605     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38606 
  38607 #if defined BCM_TOMAHAWK_SUPPORT
  38608     uint32 data = 0;            /* HW data match criteria.  */
  38609     uint32 mask = 0;            /* HW data mask.            */
  38610 
  38611     if (0 == BCM_GPORT_IS_MODPORT(port_id)) {
  38612         return (BCM_E_PARAM);
  38613     }
  38614 
  38615     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) { 
  38616         if (0 == BCM_GPORT_IS_MODPORT(port_mask)) { 
  38617             return (BCM_E_PARAM);
  38618         }
  38619     }
  38620    
  38621     data  = BCM_GPORT_MODPORT_PORT_GET(port_id);
  38622 
  38623     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  38624         mask |= BCM_GPORT_MODPORT_PORT_GET(port_mask);
  38625     } else { 
  38626         mask = BCM_FIELD_EXACT_MATCH_MASK;
  38627     }
  38628 
  38629     
  38630     FP_LOCK(unit);
  38631 
  38632     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDstPortGport,
  38633             data, mask);
  38634     FP_UNLOCK(unit);
  38635 #endif
  38636     return rv;
  38637 }
  38638 
  38639 /*
  38640  * Function:
  38641  *      bcm_esw_field_qualify_HiGigDstPortGport_get
  38642  *      Get match criteria for bcmFieldQualifyHiGigDstPortGport
  38643  *      qualifier from the field entry.
  38644  * Parameters:
  38645  *      unit       - (IN) Unit number.
  38646  *      entry      - (IN) BCM field entry id.
  38647  *      port_id    - (OUT) Qualifier match port.
  38648  *      port_mask  - (OUT) Qualifier match mask.
  38649  * Returns:
  38650  *      BCM_E_XXX
  38651  * Notes:
  38652  */
  38653 int bcm_esw_field_qualify_HiGigDstPortGport_get(int unit,
  38654         bcm_field_entry_t entry,
  38655         bcm_gport_t *port_id,
  38656         bcm_gport_t *port_mask)
  38657 {
  38658     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38659 
  38660 #if defined BCM_TOMAHAWK_SUPPORT
  38661     uint32 data = 0;   /* HW encoded qualifier data.  */
  38662     uint32 mask = 0;   /* HW encoding qualifier mask. */
  38663     
  38664     if ((NULL == port_id) || (NULL == port_mask)) {
  38665         return (BCM_E_PARAM);
  38666     }
  38667 
  38668     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  38669             bcmFieldQualifyHiGigDstPortGport, &data, &mask);
  38670     
  38671     BCM_IF_ERROR_RETURN(rv);
  38672     BCM_GPORT_MODPORT_SET(*port_id, 0, 
  38673             (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  38674     BCM_GPORT_MODPORT_SET(*port_mask, 0, 
  38675             (mask & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  38676 #endif
  38677     return rv;
  38678 }
  38679 
  38680 /*
  38681  * Function:
  38682  *      bcm_esw_field_qualify_HiGigDstModPortGport
  38683  *      Set match criteria for bcmFieldQualifyHiGigDstModPortGport
  38684  *      qualifier in the field entry.
  38685  * Parameters:
  38686  *      unit        - (IN) Unit number.
  38687  *      entry       - (IN) BCM field entry id.
  38688  *      port_id     - (IN) Qualifier match port.
  38689  *      port_mask   - (IN) Qualifier match mask.
  38690  * Returns:
  38691  *      BCM_E_XXX
  38692  * Notes:
  38693  */
  38694 int bcm_esw_field_qualify_HiGigDstModPortGport(int unit,
  38695         bcm_field_entry_t entry,
  38696         bcm_gport_t port_id,
  38697         bcm_gport_t port_mask)
  38698 {
  38699     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38700 
  38701 #if defined BCM_TOMAHAWK_SUPPORT
  38702     uint32 data = 0;            /* HW data match criteria.  */
  38703     uint32 mask = 0;            /* HW data mask.            */
  38704 
  38705     if (0 == BCM_GPORT_IS_MODPORT(port_id)) {
  38706         return (BCM_E_PARAM);
  38707     }
  38708 
  38709     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) { 
  38710         if (0 == BCM_GPORT_IS_MODPORT(port_mask)) { 
  38711             return (BCM_E_PARAM);
  38712         }
  38713     }
  38714    
  38715     data  = BCM_GPORT_MODPORT_PORT_GET(port_id);
  38716     data |= ((BCM_GPORT_MODPORT_MODID_GET(port_id)) << _FP_PORT_BITWIDTH(unit));
  38717 
  38718     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  38719         mask = BCM_GPORT_MODPORT_PORT_GET(port_mask);
  38720         mask |= ((BCM_GPORT_MODPORT_MODID_GET(port_mask)) << _FP_PORT_BITWIDTH(unit));
  38721     } else { 
  38722         mask = BCM_FIELD_EXACT_MATCH_MASK;
  38723     }
  38724 
  38725     
  38726     FP_LOCK(unit);
  38727 
  38728     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDstModPortGport,
  38729             data, mask);
  38730     FP_UNLOCK(unit);
  38731 #endif
  38732     return rv;
  38733 }
  38734 
  38735 /*
  38736  * Function:
  38737  *      bcm_esw_field_qualify_HiGigDstModPortGport_get
  38738  *      Get match criteria for bcmFieldQualifyHiGigDstModPortGport
  38739  *      qualifier from the field entry.
  38740  * Parameters:
  38741  *      unit        - (IN) Unit number.
  38742  *      entry       - (IN) BCM field entry id.
  38743  *      port_id     - (OUT) Qualifier match data.
  38744  *      port_mask   - (OUT) Qualifier match mask.
  38745  * Returns:
  38746  *      BCM_E_XXX
  38747  * Notes:
  38748  */
  38749 int bcm_esw_field_qualify_HiGigDstModPortGport_get(int unit,
  38750         bcm_field_entry_t entry,
  38751         bcm_gport_t *port_id,
  38752         bcm_gport_t *port_mask)
  38753 {
  38754     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38755 
  38756 #if defined BCM_TOMAHAWK_SUPPORT
  38757     uint32 data = 0;   /* HW encoded qualifier data.  */
  38758     uint32 mask = 0;   /* HW encoding qualifier mask. */
  38759     
  38760     if ((NULL == port_id) || (NULL == port_mask)) {
  38761         return (BCM_E_PARAM);
  38762     }
  38763 
  38764     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  38765             bcmFieldQualifyHiGigDstModPortGport, &data, &mask);
  38766     
  38767     BCM_IF_ERROR_RETURN(rv);
  38768     BCM_GPORT_MODPORT_SET(*port_id, ((data >> _FP_PORT_BITWIDTH(unit)) & 0xff), 
  38769             (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  38770     BCM_GPORT_MODPORT_SET(*port_mask, ((mask >> _FP_PORT_BITWIDTH(unit)) & 0xff), 
  38771             (mask & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  38772 #endif
  38773     return rv;
  38774 }
  38775 
  38776 /*
  38777  * Function:
  38778  *      bcm_esw_field_qualify_HiGigSrcModuleGport
  38779  *      Set match criteria for bcmFieldQualifyHiGigSrcModuleGport
  38780  *      qualifier in the field entry.
  38781  * Parameters:
  38782  *      unit        -   (IN) Unit number.
  38783  *      entry       -   (IN) BCM field entry id.
  38784  *      port_id     -   (IN) Qualifier match port.
  38785  *      port_mask   -   (IN) Qualifier match mask.
  38786  * Returns:
  38787  *      BCM_E_XXX
  38788  * Notes:
  38789  */
  38790 int bcm_esw_field_qualify_HiGigSrcModuleGport(int unit,
  38791         bcm_field_entry_t entry,
  38792         bcm_gport_t port_id,
  38793         bcm_gport_t port_mask)
  38794 {
  38795     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38796 
  38797 #if defined BCM_TOMAHAWK_SUPPORT
  38798     uint32 data = 0;            /* HW data match criteria.  */
  38799     uint32 mask = 0;            /* HW data mask.            */
  38800 
  38801     if (0 == BCM_GPORT_IS_MODPORT(port_id)) {
  38802         return (BCM_E_PARAM);
  38803     }
  38804 
  38805     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) { 
  38806         if (0 == BCM_GPORT_IS_MODPORT(port_mask)) { 
  38807             return (BCM_E_PARAM);
  38808         }
  38809     }
  38810    
  38811     data  = BCM_GPORT_MODPORT_MODID_GET(port_id);
  38812 
  38813     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  38814         mask |= BCM_GPORT_MODPORT_MODID_GET(port_mask);
  38815     } else { 
  38816         mask = BCM_FIELD_EXACT_MATCH_MASK;
  38817     }
  38818 
  38819     
  38820     FP_LOCK(unit);
  38821 
  38822     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigSrcModuleGport,
  38823             data, mask);
  38824     FP_UNLOCK(unit);
  38825 #endif
  38826     return rv;
  38827 }
  38828 
  38829 /*
  38830  * Function:
  38831  *      bcm_esw_field_qualify_HiGigSrcModuleGport_get
  38832  *      Get match criteria for bcmFieldQualifyHiGigSrcModuleGport
  38833  *      qualifier from the field entry.
  38834  * Parameters:
  38835  *      unit    - (IN) Unit number.
  38836  *      entry   - (IN) BCM field entry id.
  38837  *      data    - (OUT) Qualifier match port.
  38838  *      mask    - (OUT) Qualifier match mask.
  38839  * Returns:
  38840  *      BCM_E_XXX
  38841  * Notes:
  38842  */
  38843 int bcm_esw_field_qualify_HiGigSrcModuleGport_get(int unit,
  38844         bcm_field_entry_t entry,
  38845         bcm_gport_t *port_id,
  38846         bcm_gport_t *port_mask)
  38847 {
  38848     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38849 
  38850 #if defined BCM_TOMAHAWK_SUPPORT
  38851     uint32 data = 0;   /* HW encoded qualifier data.  */
  38852     uint32 mask = 0;   /* HW encoding qualifier mask. */
  38853     
  38854     if ((NULL == port_id) || (NULL == port_mask)) {
  38855         return (BCM_E_PARAM);
  38856     }
  38857 
  38858     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  38859             bcmFieldQualifyHiGigSrcModuleGport, &data, &mask);
  38860     
  38861     BCM_IF_ERROR_RETURN(rv);
  38862     BCM_GPORT_MODPORT_SET(*port_id, (data & 0xff), 0);
  38863     BCM_GPORT_MODPORT_SET(*port_mask, (data & 0xff), 0);
  38864 #endif
  38865     return rv;
  38866 }
  38867 
  38868 /*
  38869  * Function:
  38870  *      bcm_esw_field_qualify_HiGigSrcPortGport
  38871  *      Set match criteria for bcmFieldQualifyHiGigSrcPortGport
  38872  *      qualifier in the field entry.
  38873  * Parameters:
  38874  *      unit    -   (IN) Unit number.
  38875  *      entry   -   (IN) BCM field entry id.
  38876  *      data    -   (IN) Qualifier match port.
  38877  *      mask    -   (IN) Qualifier match mask.
  38878  * Returns:
  38879  *      BCM_E_XXX
  38880  * Notes:
  38881  */
  38882 int bcm_esw_field_qualify_HiGigSrcPortGport(int unit,
  38883         bcm_field_entry_t entry,
  38884         bcm_gport_t port_id,
  38885         bcm_gport_t port_mask)
  38886 {
  38887     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38888 
  38889 #if defined BCM_TOMAHAWK_SUPPORT
  38890     uint32 data = 0;            /* HW data match criteria.  */
  38891     uint32 mask = 0;            /* HW data mask.            */
  38892 
  38893     if (0 == BCM_GPORT_IS_MODPORT(port_id)) {
  38894         return (BCM_E_PARAM);
  38895     }
  38896 
  38897     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) { 
  38898         if (0 == BCM_GPORT_IS_MODPORT(port_mask)) { 
  38899             return (BCM_E_PARAM);
  38900         }
  38901     }
  38902    
  38903     data  = BCM_GPORT_MODPORT_PORT_GET(port_id);
  38904 
  38905     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  38906         mask |= BCM_GPORT_MODPORT_PORT_GET(port_mask);
  38907     } else { 
  38908         mask = BCM_FIELD_EXACT_MATCH_MASK;
  38909     }
  38910 
  38911     
  38912     FP_LOCK(unit);
  38913 
  38914     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigSrcPortGport,
  38915             data, mask);
  38916     FP_UNLOCK(unit);
  38917 #endif
  38918     return rv;
  38919 }
  38920 
  38921 /*
  38922  * Function:
  38923  *      bcm_esw_field_qualify_HiGigSrcPortGport_get
  38924  *      Get match criteria for bcmFieldQualifyHiGigSrcPortGport
  38925  *      qualifier from the field entry.
  38926  * Parameters:
  38927  *      unit    - (IN) Unit number.
  38928  *      entry   - (IN) BCM field entry id.
  38929  *      data    - (OUT) Qualifier match port.
  38930  *      mask    - (OUT) Qualifier match mask.
  38931  * Returns:
  38932  *      BCM_E_XXX
  38933  * Notes:
  38934  */
  38935 int bcm_esw_field_qualify_HiGigSrcPortGport_get(int unit,
  38936         bcm_field_entry_t entry,
  38937         bcm_gport_t *port_id,
  38938         bcm_gport_t *port_mask)
  38939 {
  38940     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38941 
  38942 #if defined BCM_TOMAHAWK_SUPPORT
  38943     uint32 data = 0;   /* HW encoded qualifier data.  */
  38944     uint32 mask = 0;   /* HW encoding qualifier mask. */
  38945     
  38946     if ((NULL == port_id) || (NULL == port_mask)) {
  38947         return (BCM_E_PARAM);
  38948     }
  38949 
  38950     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  38951             bcmFieldQualifyHiGigSrcPortGport, &data, &mask);
  38952     
  38953     BCM_IF_ERROR_RETURN(rv);
  38954     BCM_GPORT_MODPORT_SET(*port_id, 0, 
  38955                           (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  38956     BCM_GPORT_MODPORT_SET(*port_mask, 0, 
  38957                           (mask & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  38958 #endif
  38959     return rv;
  38960 }
  38961 
  38962 /*
  38963  * Function:
  38964  *      bcm_esw_field_qualify_HiGigSrcModPortGport
  38965  *      Set match criteria for bcmFieldQualifyHiGigSrcModPortGport
  38966  *      qualifier in the field entry.
  38967  * Parameters:
  38968  *      unit    -   (IN) Unit number.
  38969  *      entry   -   (IN) BCM field entry id.
  38970  *      data    -   (IN) Qualifier match port.
  38971  *      mask    -   (IN) Qualifier match mask.
  38972  * Returns:
  38973  *      BCM_E_XXX
  38974  * Notes:
  38975  */
  38976 int bcm_esw_field_qualify_HiGigSrcModPortGport(int unit,
  38977         bcm_field_entry_t entry,
  38978         bcm_gport_t port_id,
  38979         bcm_gport_t port_mask)
  38980 {
  38981     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  38982 
  38983 #if defined BCM_TOMAHAWK_SUPPORT
  38984     uint32 data = 0;            /* HW data match criteria.  */
  38985     uint32 mask = 0;            /* HW data mask.            */
  38986 
  38987     if (0 == BCM_GPORT_IS_MODPORT(port_id)) {
  38988         return (BCM_E_PARAM);
  38989     }
  38990 
  38991     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) { 
  38992         if (0 == BCM_GPORT_IS_MODPORT(port_mask)) { 
  38993             return (BCM_E_PARAM);
  38994         }
  38995     }
  38996    
  38997     data  = BCM_GPORT_MODPORT_PORT_GET(port_id);
  38998     data |= ((BCM_GPORT_MODPORT_MODID_GET(port_id)) << _FP_PORT_BITWIDTH(unit));
  38999 
  39000     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  39001         mask = BCM_GPORT_MODPORT_PORT_GET(port_mask);
  39002         mask |= ((BCM_GPORT_MODPORT_MODID_GET(port_mask)) << _FP_PORT_BITWIDTH(unit));
  39003     } else { 
  39004         mask = BCM_FIELD_EXACT_MATCH_MASK;
  39005     }
  39006 
  39007     
  39008     FP_LOCK(unit);
  39009 
  39010     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigSrcModPortGport,
  39011             data, mask);
  39012     FP_UNLOCK(unit);
  39013 #endif
  39014     return rv;
  39015 }
  39016 
  39017 /*
  39018  * Function:
  39019  *      bcm_esw_field_qualify_HiGigSrcModPortGport_get
  39020  *      Get match criteria for bcmFieldQualifyHiGigSrcModPortGport
  39021  *      qualifier from the field entry.
  39022  * Parameters:
  39023  *      unit    - (IN) Unit number.
  39024  *      entry   - (IN) BCM field entry id.
  39025  *      data    - (OUT) Qualifier match port.
  39026  *      mask    - (OUT) Qualifier match mask.
  39027  * Returns:
  39028  *      BCM_E_XXX
  39029  * Notes:
  39030  */
  39031 int bcm_esw_field_qualify_HiGigSrcModPortGport_get(int unit,
  39032         bcm_field_entry_t entry,
  39033         bcm_gport_t *port_id,
  39034         bcm_gport_t *port_mask)
  39035 {
  39036     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39037 
  39038 #if defined BCM_TOMAHAWK_SUPPORT
  39039     uint32 data = 0;   /* HW encoded qualifier data.  */
  39040     uint32 mask = 0;   /* HW encoding qualifier mask. */
  39041     
  39042     if ((NULL == port_id) || (NULL == port_mask)) {
  39043         return (BCM_E_PARAM);
  39044     }
  39045 
  39046     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  39047             bcmFieldQualifyHiGigSrcModPortGport, &data, &mask);
  39048     
  39049     BCM_IF_ERROR_RETURN(rv);
  39050     BCM_GPORT_MODPORT_SET(*port_id, ((data >> _FP_PORT_BITWIDTH(unit)) & 0xff), 
  39051             (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  39052     BCM_GPORT_MODPORT_SET(*port_mask, ((mask >> _FP_PORT_BITWIDTH(unit)) & 0xff), 
  39053             (mask & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  39054 #endif
  39055     return rv;
  39056 }
  39057 
  39058 /*
  39059  * Function:
  39060  *      bcm_esw_field_qualify_HiGigLoadBalanceID
  39061  *      Set match criteria for bcmFieldQualifyHiGigLoadBalanceID
  39062  *      qualifier in the field entry.
  39063  * Parameters:
  39064  *      unit    -   (IN) Unit number.
  39065  *      entry   -   (IN) BCM field entry id.
  39066  *      data    -   (IN) Qualifier match data.
  39067  *      mask    -   (IN) Qualifier match mask.
  39068  * Returns:
  39069  *      BCM_E_XXX
  39070  * Notes:
  39071  */
  39072 int bcm_esw_field_qualify_HiGigLoadBalanceID(int unit,
  39073         bcm_field_entry_t entry,
  39074         uint8 data,
  39075         uint8 mask)
  39076 {
  39077     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39078 
  39079 #if defined BCM_TOMAHAWK_SUPPORT
  39080 
  39081     
  39082     FP_LOCK(unit);
  39083     
  39084     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigLoadBalanceID, 
  39085                           data, mask);
  39086 
  39087     FP_UNLOCK(unit);    
  39088 #endif
  39089     return rv;
  39090 }
  39091 
  39092 /*
  39093  * Function:
  39094  *      bcm_esw_field_qualify_HiGigLoadBalanceID_get
  39095  *      Get match criteria for bcmFieldQualifyHiGigLoadBalanceID
  39096  *      qualifier from the field entry.
  39097  * Parameters:
  39098  *      unit    - (IN) Unit number.
  39099  *      entry   - (IN) BCM field entry id.
  39100  *      data    - (OUT) Qualifier match data.
  39101  *      mask    - (OUT) Qualifier match mask.
  39102  * Returns:
  39103  *      BCM_E_XXX
  39104  * Notes:
  39105  */
  39106 int bcm_esw_field_qualify_HiGigLoadBalanceID_get(int unit,
  39107         bcm_field_entry_t entry,
  39108         uint8 *data,
  39109         uint8 *mask)
  39110 {
  39111     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39112 
  39113 #if defined BCM_TOMAHAWK_SUPPORT
  39114     /* Read qualifier match value and mask. */
  39115     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  39116                         bcmFieldQualifyHiGigLoadBalanceID, data, mask);
  39117 #endif
  39118     return rv;
  39119 }
  39120 
  39121 /*
  39122  * Function:
  39123  *      bcm_esw_field_qualify_HiGigColor
  39124  *      Set match criteria for bcmFieldQualifyHiGigColor
  39125  *      qualifier in the field entry.
  39126  * Parameters:
  39127  *      unit    -   (IN) Unit number.
  39128  *      entry   -   (IN) BCM field entry id.
  39129  *      data    -   (IN) Qualifier match data.
  39130  *      mask    -   (IN) Qualifier match mask.
  39131  * Returns:
  39132  *      BCM_E_XXX
  39133  * Notes:
  39134  */
  39135 int bcm_esw_field_qualify_HiGigColor(int unit,
  39136         bcm_field_entry_t entry,
  39137         uint8 color)
  39138 {
  39139     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39140 
  39141 #if defined BCM_TOMAHAWK_SUPPORT
  39142     uint8 data = 0;           /* Qualifier data.          */
  39143     uint8 mask = 0x3;     /* Qualifier mask.          */
  39144 
  39145     switch (color) {
  39146         case BCM_FIELD_COLOR_GREEN:
  39147             data = 0;
  39148             break;
  39149         case BCM_FIELD_COLOR_RED:
  39150             data = 1;
  39151             break;
  39152         case BCM_FIELD_COLOR_YELLOW:
  39153             data = 3;
  39154             break;
  39155         default:
  39156             return (BCM_E_PARAM);
  39157     }
  39158 
  39159     
  39160     FP_LOCK(unit);
  39161 
  39162     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigColor, data, mask);
  39163 
  39164     FP_UNLOCK(unit);
  39165 #endif
  39166     return rv;
  39167 }
  39168 
  39169 /*
  39170  * Function:
  39171  *      bcm_esw_field_qualify_HiGigColor_get
  39172  *      Get match criteria for bcmFieldQualifyHiGigColor
  39173  *      qualifier from the field entry.
  39174  * Parameters:
  39175  *      unit    - (IN) Unit number.
  39176  *      entry   - (IN) BCM field entry id.
  39177  *      data    - (OUT) Qualifier match data.
  39178  *      mask    - (OUT) Qualifier match mask.
  39179  * Returns:
  39180  *      BCM_E_XXX
  39181  * Notes:
  39182  */
  39183 int bcm_esw_field_qualify_HiGigColor_get(int unit,
  39184         bcm_field_entry_t entry,
  39185         uint8 *color)
  39186 {
  39187     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39188 
  39189 #if defined BCM_TOMAHAWK_SUPPORT
  39190     uint8 data = 0;      /* Qualifier data.          */
  39191     uint8 mask = 0;      /* Qualifier mask.          */
  39192 
  39193     if (NULL == color) {
  39194         return (BCM_E_PARAM);
  39195     }
  39196 
  39197     /* Read qualifier match value and mask. */
  39198     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, bcmFieldQualifyHiGigColor,
  39199             &data, &mask);
  39200 
  39201     BCM_IF_ERROR_RETURN(rv);
  39202 
  39203     if (mask == 0) {
  39204         return BCM_E_NOT_FOUND;
  39205     }
  39206 
  39207     switch (data) {
  39208         case 0:
  39209             *color = BCM_FIELD_COLOR_GREEN;
  39210             break;
  39211         case 1:
  39212             *color = BCM_FIELD_COLOR_RED;
  39213             break;
  39214         case 3:
  39215             *color = BCM_FIELD_COLOR_YELLOW;
  39216             break;
  39217         default:
  39218             rv = BCM_E_INTERNAL;
  39219     }
  39220 #endif
  39221     return rv;
  39222 }
  39223 
  39224 /*
  39225  * Function:
  39226  *      bcm_esw_field_qualify_HiGigIntCongestionNotification
  39227  *      Set match criteria for bcmFieldQualifyHiGigIntCongestionNotification
  39228  *      qualifier in the field entry.
  39229  * Parameters:
  39230  *      unit    -   (IN) Unit number.
  39231  *      entry   -   (IN) BCM field entry id.
  39232  *      data    -   (IN) Qualifier match data.
  39233  *      mask    -   (IN) Qualifier match mask.
  39234  * Returns:
  39235  *      BCM_E_XXX
  39236  * Notes:
  39237  */
  39238 int bcm_esw_field_qualify_HiGigIntCongestionNotification(int unit,
  39239         bcm_field_entry_t entry,
  39240         uint8 data,
  39241         uint8 mask)
  39242 {
  39243     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39244 
  39245 #if defined BCM_TOMAHAWK_SUPPORT
  39246 
  39247     if (soc_feature(unit, soc_feature_ecn_wred)) {
  39248         
  39249         if ((data > _BCM_ECN_INT_CN_VALUE_MAX) ||
  39250             (mask > _BCM_ECN_INT_CN_VALUE_MAX)) {
  39251             return BCM_E_PARAM;
  39252         }
  39253 
  39254         
  39255         FP_LOCK(unit);
  39256         
  39257         rv = _field_qualify32(unit, entry,
  39258                 bcmFieldQualifyHiGigIntCongestionNotification,
  39259                 data, mask);
  39260         FP_UNLOCK(unit);
  39261     }
  39262 #endif
  39263     return rv;
  39264 }
  39265 
  39266 /*
  39267  * Function:
  39268  *      bcm_esw_field_qualify_HiGigIntCongestionNotification_get
  39269  *      Get match criteria for bcmFieldQualifyHiGigIntCongestionNotification
  39270  *      qualifier from the field entry.
  39271  * Parameters:
  39272  *      unit    - (IN) Unit number.
  39273  *      entry   - (IN) BCM field entry id.
  39274  *      data    - (OUT) Qualifier match data.
  39275  *      mask    - (OUT) Qualifier match mask.
  39276  * Returns:
  39277  *      BCM_E_XXX
  39278  * Notes:
  39279  */
  39280 int bcm_esw_field_qualify_HiGigIntCongestionNotification_get(int unit,
  39281         bcm_field_entry_t entry,
  39282         uint8 *data,
  39283         uint8 *mask)
  39284 {
  39285     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39286 
  39287 #if defined BCM_TOMAHAWK_SUPPORT
  39288     if (soc_feature(unit, soc_feature_ecn_wred)) {
  39289         /* Read qualifier match value and mask. */
  39290         return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  39291                         bcmFieldQualifyHiGigIntCongestionNotification,
  39292                         data, mask);
  39293     }
  39294 #endif
  39295     return rv;
  39296 }
  39297 
  39298 /*
  39299  * Function:
  39300  *      bcm_esw_field_qualify_HiGigIngressTagged
  39301  *      Set match criteria for bcmFieldQualifyHiGigIngressTagged
  39302  *      qualifier in the field entry.
  39303  * Parameters:
  39304  *      unit    -   (IN) Unit number.
  39305  *      entry   -   (IN) BCM field entry id.
  39306  *      data    -   (IN) Qualifier match data.
  39307  *      mask    -   (IN) Qualifier match mask.
  39308  * Returns:
  39309  *      BCM_E_XXX
  39310  * Notes:
  39311  */
  39312 int bcm_esw_field_qualify_HiGigIngressTagged(int unit,
  39313         bcm_field_entry_t entry,
  39314         uint8 data,
  39315         uint8 mask)
  39316 {
  39317     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39318 
  39319 #if defined BCM_TOMAHAWK_SUPPORT
  39320 
  39321     
  39322     FP_LOCK(unit);
  39323     
  39324     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigIngressTagged, 
  39325                           data, mask);
  39326 
  39327     FP_UNLOCK(unit);    
  39328 #endif
  39329     return rv;
  39330 }
  39331 
  39332 /*
  39333  * Function:
  39334  *      bcm_esw_field_qualify_HiGigIngressTagged_get
  39335  *      Get match criteria for bcmFieldQualifyHiGigIngressTagged
  39336  *      qualifier from the field entry.
  39337  * Parameters:
  39338  *      unit    - (IN) Unit number.
  39339  *      entry   - (IN) BCM field entry id.
  39340  *      data    - (OUT) Qualifier match data.
  39341  *      mask    - (OUT) Qualifier match mask.
  39342  * Returns:
  39343  *      BCM_E_XXX
  39344  * Notes:
  39345  */
  39346 int bcm_esw_field_qualify_HiGigIngressTagged_get(int unit,
  39347         bcm_field_entry_t entry,
  39348         uint8 *data,
  39349         uint8 *mask)
  39350 {
  39351     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39352 
  39353 #if defined BCM_TOMAHAWK_SUPPORT
  39354     /* Read qualifier match value and mask. */
  39355     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  39356                         bcmFieldQualifyHiGigIngressTagged, data, mask);
  39357 #endif
  39358     return rv;
  39359 }
  39360 
  39361 /*
  39362  * Function:
  39363  *      bcm_esw_field_qualify_HiGigDstTrunk
  39364  *      Set match criteria for bcmFieldQualifyHiGigDstTrunk
  39365  *      qualifier in the field entry.
  39366  * Parameters:
  39367  *      unit    -   (IN) Unit number.
  39368  *      entry   -   (IN) BCM field entry id.
  39369  *      data    -   (IN) Qualifier match data.
  39370  *      mask    -   (IN) Qualifier match mask.
  39371  * Returns:
  39372  *      BCM_E_XXX
  39373  * Notes:
  39374  */
  39375 int bcm_esw_field_qualify_HiGigDstTrunk(int unit,
  39376         bcm_field_entry_t entry,
  39377         uint8 data,
  39378         uint8 mask)
  39379 {
  39380     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39381 
  39382 #if defined BCM_TOMAHAWK_SUPPORT
  39383 
  39384     
  39385     FP_LOCK(unit);
  39386     
  39387     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDstTrunk, 
  39388                           data, mask);
  39389 
  39390     FP_UNLOCK(unit);    
  39391 #endif
  39392     return rv;
  39393 }
  39394 
  39395 /*
  39396  * Function:
  39397  *      bcm_esw_field_qualify_HiGigDstTrunk_get
  39398  *      Get match criteria for bcmFieldQualifyHiGigDstTrunk
  39399  *      qualifier from the field entry.
  39400  * Parameters:
  39401  *      unit    - (IN) Unit number.
  39402  *      entry   - (IN) BCM field entry id.
  39403  *      data    - (OUT) Qualifier match data.
  39404  *      mask    - (OUT) Qualifier match mask.
  39405  * Returns:
  39406  *      BCM_E_XXX
  39407  * Notes:
  39408  */
  39409 int bcm_esw_field_qualify_HiGigDstTrunk_get(int unit,
  39410         bcm_field_entry_t entry,
  39411         uint8 *data,
  39412         uint8 *mask)
  39413 {
  39414     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39415 
  39416 #if defined BCM_TOMAHAWK_SUPPORT
  39417     /* Read qualifier match value and mask. */
  39418     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  39419                         bcmFieldQualifyHiGigDstTrunk, data, mask);
  39420 #endif
  39421     return rv;
  39422 }
  39423 
  39424 /*
  39425  * Function:
  39426  *      bcm_esw_field_qualify_HiGigDstTrunkId
  39427  *      Set match criteria for bcmFieldQualifyHiGigDstTrunkId
  39428  *      qualifier in the field entry.
  39429  * Parameters:
  39430  *      unit    -   (IN) Unit number.
  39431  *      entry   -   (IN) BCM field entry id.
  39432  *      data    -   (IN) Qualifier match data.
  39433  *      mask    -   (IN) Qualifier match mask.
  39434  * Returns:
  39435  *      BCM_E_XXX
  39436  * Notes:
  39437  */
  39438 int bcm_esw_field_qualify_HiGigDstTrunkId(int unit,
  39439         bcm_field_entry_t entry,
  39440         bcm_trunk_t data,
  39441         bcm_trunk_t mask)
  39442 {
  39443     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39444 
  39445 #if defined BCM_TOMAHAWK_SUPPORT
  39446 
  39447     if (BCM_GPORT_IS_SET(data)) {
  39448         rv = _field_qualifier_gport_resolve(unit, data, mask,
  39449                 NULL, NULL, &data);
  39450         BCM_IF_ERROR_RETURN(rv);
  39451     }
  39452 
  39453     
  39454     FP_LOCK(unit);
  39455     
  39456     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDstTrunkId,
  39457                           data, mask);
  39458     FP_UNLOCK(unit);
  39459 #endif
  39460     return rv;
  39461 }
  39462 
  39463 /*
  39464  * Function:
  39465  *      bcm_esw_field_qualify_HiGigDstTrunkId_get
  39466  *      Get match criteria for bcmFieldQualifyHiGigDstTrunkId
  39467  *      qualifier from the field entry.
  39468  * Parameters:
  39469  *      unit    - (IN) Unit number.
  39470  *      entry   - (IN) BCM field entry id.
  39471  *      data    - (OUT) Qualifier match data.
  39472  *      mask    - (OUT) Qualifier match mask.
  39473  * Returns:
  39474  *      BCM_E_XXX
  39475  * Notes:
  39476  */
  39477 int bcm_esw_field_qualify_HiGigDstTrunkId_get(int unit,
  39478         bcm_field_entry_t entry,
  39479         bcm_trunk_t *data,
  39480         bcm_trunk_t *mask)
  39481 {
  39482     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39483 
  39484 #if defined BCM_TOMAHAWK_SUPPORT
  39485     int isGport;             /* Port format is gport.       */
  39486     uint8 hw_data = 0;
  39487     uint8 hw_mask = 0;
  39488 
  39489     /* Input parameters check. */
  39490     if ((NULL == data) || (NULL == mask)) {
  39491         return (BCM_E_PARAM);
  39492     }
  39493 
  39494     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  39495                     bcmFieldQualifyHiGigDstTrunkId, &hw_data, &hw_mask);
  39496     BCM_IF_ERROR_RETURN(rv);
  39497 
  39498     /* Check requested output format. */
  39499     rv = bcm_esw_switch_control_get(unit, bcmSwitchUseGport, &isGport);
  39500     BCM_IF_ERROR_RETURN(rv);
  39501 
  39502     if (isGport) {
  39503         BCM_GPORT_TRUNK_SET(hw_data, hw_data);
  39504         hw_mask = BCM_FIELD_EXACT_MATCH_MASK;
  39505     }
  39506     *data = hw_data;
  39507     *mask = hw_mask;
  39508 #endif
  39509     return rv;
  39510 }
  39511 
  39512 /*
  39513  * Function:
  39514  *      bcm_esw_field_qualify_HiGigIngressL3SwitchPkt
  39515  *      Set match criteria for bcmFieldQualifyHiGigIngressL3SwitchPkt
  39516  *      qualifier in the field entry.
  39517  * Parameters:
  39518  *      unit    -   (IN) Unit number.
  39519  *      entry   -   (IN) BCM field entry id.
  39520  *      data    -   (IN) Qualifier match data.
  39521  *      mask    -   (IN) Qualifier match mask.
  39522  * Returns:
  39523  *      BCM_E_XXX
  39524  * Notes:
  39525  */
  39526 int bcm_esw_field_qualify_HiGigIngressL3SwitchPkt(int unit,
  39527         bcm_field_entry_t entry,
  39528         uint8 data,
  39529         uint8 mask)
  39530 {
  39531     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39532 
  39533 #if defined BCM_TOMAHAWK_SUPPORT
  39534 
  39535     
  39536     FP_LOCK(unit);
  39537     
  39538     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigIngressL3SwitchPkt, 
  39539                           data, mask);
  39540 
  39541     FP_UNLOCK(unit);    
  39542 #endif
  39543     return rv;
  39544 }
  39545 
  39546 /*
  39547  * Function:
  39548  *      bcm_esw_field_qualify_HiGigIngressL3SwitchPkt_get
  39549  *      Get match criteria for bcmFieldQualifyHiGigIngressL3SwitchPkt
  39550  *      qualifier from the field entry.
  39551  * Parameters:
  39552  *      unit    - (IN) Unit number.
  39553  *      entry   - (IN) BCM field entry id.
  39554  *      data    - (OUT) Qualifier match data.
  39555  *      mask    - (OUT) Qualifier match mask.
  39556  * Returns:
  39557  *      BCM_E_XXX
  39558  * Notes:
  39559  */
  39560 int bcm_esw_field_qualify_HiGigIngressL3SwitchPkt_get(int unit,
  39561         bcm_field_entry_t entry,
  39562         uint8 *data,
  39563         uint8 *mask)
  39564 {
  39565     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39566 
  39567 #if defined BCM_TOMAHAWK_SUPPORT
  39568     /* Read qualifier match value and mask. */
  39569     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  39570                         bcmFieldQualifyHiGigIngressL3SwitchPkt, data, mask);
  39571 #endif
  39572     return rv;
  39573 }
  39574 
  39575 /*
  39576  * Function:
  39577  *      bcm_esw_field_qualify_HiGigLabel
  39578  *      Set match criteria for bcmFieldQualifyHiGigLabel
  39579  *      qualifier in the field entry.
  39580  * Parameters:
  39581  *      unit    -   (IN) Unit number.
  39582  *      entry   -   (IN) BCM field entry id.
  39583  *      data    -   (IN) Qualifier match data.
  39584  *      mask    -   (IN) Qualifier match mask.
  39585  * Returns:
  39586  *      BCM_E_XXX
  39587  * Notes:
  39588  */
  39589 int bcm_esw_field_qualify_HiGigLabel(int unit,
  39590         bcm_field_entry_t entry,
  39591         uint32 data,
  39592         uint32 mask)
  39593 {
  39594     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39595 
  39596 #if defined BCM_TOMAHAWK_SUPPORT
  39597 
  39598     
  39599     FP_LOCK(unit);
  39600     
  39601     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigLabel, 
  39602                           data, mask);
  39603 
  39604     FP_UNLOCK(unit);    
  39605 #endif
  39606     return rv;
  39607 }
  39608 
  39609 /*
  39610  * Function:
  39611  *      bcm_esw_field_qualify_HiGigLabel_get
  39612  *      Get match criteria for bcmFieldQualifyHiGigLabel
  39613  *      qualifier from the field entry.
  39614  * Parameters:
  39615  *      unit    - (IN) Unit number.
  39616  *      entry   - (IN) BCM field entry id.
  39617  *      data    - (OUT) Qualifier match data.
  39618  *      mask    - (OUT) Qualifier match mask.
  39619  * Returns:
  39620  *      BCM_E_XXX
  39621  * Notes:
  39622  */
  39623 int bcm_esw_field_qualify_HiGigLabel_get(int unit,
  39624         bcm_field_entry_t entry,
  39625         uint32 *data,
  39626         uint32 *mask)
  39627 {
  39628     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39629 
  39630 #if defined BCM_TOMAHAWK_SUPPORT
  39631     /* Read qualifier match value and mask. */
  39632     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  39633                         bcmFieldQualifyHiGigLabel, data, mask);
  39634 #endif
  39635     return rv;
  39636 }
  39637 
  39638 /*
  39639  * Function:
  39640  *      bcm_esw_field_qualify_HiGigReplicationId
  39641  *      Set match criteria for bcmFieldQualifyHiGigReplicationId
  39642  *      qualifier in the field entry.
  39643  * Parameters:
  39644  *      unit    -   (IN) Unit number.
  39645  *      entry   -   (IN) BCM field entry id.
  39646  *      data    -   (IN) Qualifier match data.
  39647  *      mask    -   (IN) Qualifier match mask.
  39648  * Returns:
  39649  *      BCM_E_XXX
  39650  * Notes:
  39651  */
  39652 int bcm_esw_field_qualify_HiGigReplicationId(int unit,
  39653         bcm_field_entry_t entry,
  39654         uint32 data,
  39655         uint32 mask)
  39656 {
  39657     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39658 
  39659 #if defined BCM_TOMAHAWK_SUPPORT
  39660 
  39661     
  39662     FP_LOCK(unit);
  39663     
  39664     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigReplicationId, 
  39665                           data, mask);
  39666 
  39667     FP_UNLOCK(unit);    
  39668 #endif
  39669     return rv;
  39670 }
  39671 
  39672 /*
  39673  * Function:
  39674  *      bcm_esw_field_qualify_HiGigReplicationId_get
  39675  *      Get match criteria for bcmFieldQualifyHiGigReplicationId
  39676  *      qualifier from the field entry.
  39677  * Parameters:
  39678  *      unit    - (IN) Unit number.
  39679  *      entry   - (IN) BCM field entry id.
  39680  *      data    - (OUT) Qualifier match data.
  39681  *      mask    - (OUT) Qualifier match mask.
  39682  * Returns:
  39683  *      BCM_E_XXX
  39684  * Notes:
  39685  */
  39686 int bcm_esw_field_qualify_HiGigReplicationId_get(int unit,
  39687         bcm_field_entry_t entry,
  39688         uint32 *data,
  39689         uint32 *mask)
  39690 {
  39691     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39692 
  39693 #if defined BCM_TOMAHAWK_SUPPORT
  39694     /* Read qualifier match value and mask. */
  39695     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  39696                         bcmFieldQualifyHiGigReplicationId, data, mask);
  39697 #endif
  39698     return rv;
  39699 }
  39700 
  39701 /*
  39702  * Function:
  39703  *      bcm_esw_field_qualify_HiGigVlan
  39704  *      Set match criteria for bcmFieldQualifyHiGigVlan
  39705  *      qualifier in the field entry.
  39706  * Parameters:
  39707  *      unit    -   (IN) Unit number.
  39708  *      entry   -   (IN) BCM field entry id.
  39709  *      data    -   (IN) Qualifier match data.
  39710  *      mask    -   (IN) Qualifier match mask.
  39711  * Returns:
  39712  *      BCM_E_XXX
  39713  * Notes:
  39714  */
  39715 int bcm_esw_field_qualify_HiGigVlan(int unit,
  39716         bcm_field_entry_t entry,
  39717         uint16 data,
  39718         uint16 mask)
  39719 {
  39720     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39721 
  39722 #if defined BCM_TOMAHAWK_SUPPORT
  39723     
  39724     
  39725     FP_LOCK(unit);
  39726 
  39727     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigVlan, 
  39728                                    data, mask);
  39729     FP_UNLOCK(unit);
  39730 #endif
  39731     return rv;
  39732 }
  39733 
  39734 /*
  39735  * Function:
  39736  *      bcm_esw_field_qualify_HiGigVlan_get
  39737  *      Get match criteria for bcmFieldQualifyHiGigVlan
  39738  *      qualifier from the field entry.
  39739  * Parameters:
  39740  *      unit    - (IN) Unit number.
  39741  *      entry   - (IN) BCM field entry id.
  39742  *      data    - (OUT) Qualifier match data.
  39743  *      mask    - (OUT) Qualifier match mask.
  39744  * Returns:
  39745  *      BCM_E_XXX
  39746  * Notes:
  39747  */
  39748 int bcm_esw_field_qualify_HiGigVlan_get(int unit,
  39749         bcm_field_entry_t entry,
  39750         uint16 *data,
  39751         uint16 *mask)
  39752 {
  39753     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39754 
  39755 #if defined BCM_TOMAHAWK_SUPPORT
  39756    rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  39757                                               bcmFieldQualifyHiGigVlan,
  39758                                               data, mask);
  39759 #endif
  39760     return rv;
  39761 }
  39762 
  39763 /*
  39764  * Function:
  39765  *      bcm_esw_field_qualify_HiGigPortFilteringMode
  39766  *      Set match criteria for bcmFieldQualifyHiGigPortFilteringMode
  39767  *      qualifier in the field entry.
  39768  * Parameters:
  39769  *      unit    -   (IN) Unit number.
  39770  *      entry   -   (IN) BCM field entry id.
  39771  *      data    -   (IN) Qualifier match data.
  39772  *      mask    -   (IN) Qualifier match mask.
  39773  * Returns:
  39774  *      BCM_E_XXX
  39775  * Notes:
  39776  */
  39777 int bcm_esw_field_qualify_HiGigPortFilteringMode(int unit,
  39778         bcm_field_entry_t entry,
  39779         uint8 data,
  39780         uint8 mask)
  39781 {
  39782     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39783 
  39784 #if defined BCM_TOMAHAWK_SUPPORT
  39785 
  39786     
  39787     FP_LOCK(unit);
  39788     
  39789     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigPortFilteringMode, 
  39790                           data, mask);
  39791 
  39792     FP_UNLOCK(unit);    
  39793 #endif
  39794     return rv;
  39795 }
  39796 
  39797 /*
  39798  * Function:
  39799  *      bcm_esw_field_qualify_HiGigPortFilteringMode_get
  39800  *      Get match criteria for bcmFieldQualifyHiGigPortFilteringMode
  39801  *      qualifier from the field entry.
  39802  * Parameters:
  39803  *      unit    - (IN) Unit number.
  39804  *      entry   - (IN) BCM field entry id.
  39805  *      data    - (OUT) Qualifier match data.
  39806  *      mask    - (OUT) Qualifier match mask.
  39807  * Returns:
  39808  *      BCM_E_XXX
  39809  * Notes:
  39810  */
  39811 int bcm_esw_field_qualify_HiGigPortFilteringMode_get(int unit,
  39812         bcm_field_entry_t entry,
  39813         uint8 *data,
  39814         uint8 *mask)
  39815 {
  39816     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39817 
  39818 #if defined BCM_TOMAHAWK_SUPPORT
  39819     /* Read qualifier match value and mask. */
  39820     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  39821                         bcmFieldQualifyHiGigPortFilteringMode, data, mask);
  39822 
  39823 #endif
  39824     return rv;
  39825 }
  39826 
  39827 /*
  39828  * Function:
  39829  *      bcm_esw_field_qualify_HiGigSrcTrunk
  39830  *      Set match criteria for bcmFieldQualifyHiGigSrcTrunk
  39831  *      qualifier in the field entry.
  39832  * Parameters:
  39833  *      unit    -   (IN) Unit number.
  39834  *      entry   -   (IN) BCM field entry id.
  39835  *      data    -   (IN) Qualifier match data.
  39836  *      mask    -   (IN) Qualifier match mask.
  39837  * Returns:
  39838  *      BCM_E_XXX
  39839  * Notes:
  39840  */
  39841 int bcm_esw_field_qualify_HiGigSrcTrunk(int unit,
  39842         bcm_field_entry_t entry,
  39843         uint8 data,
  39844         uint8 mask)
  39845 {
  39846     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39847 
  39848 #if defined BCM_TOMAHAWK_SUPPORT
  39849 
  39850     
  39851     FP_LOCK(unit);
  39852     
  39853     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigSrcTrunk, 
  39854                           data, mask);
  39855 
  39856     FP_UNLOCK(unit);    
  39857 #endif
  39858     return rv;
  39859 }
  39860 
  39861 /*
  39862  * Function:
  39863  *      bcm_esw_field_qualify_HiGigSrcTrunk_get
  39864  *      Get match criteria for bcmFieldQualifyHiGigSrcTrunk
  39865  *      qualifier from the field entry.
  39866  * Parameters:
  39867  *      unit    - (IN) Unit number.
  39868  *      entry   - (IN) BCM field entry id.
  39869  *      data    - (OUT) Qualifier match data.
  39870  *      mask    - (OUT) Qualifier match mask.
  39871  * Returns:
  39872  *      BCM_E_XXX
  39873  * Notes:
  39874  */
  39875 int bcm_esw_field_qualify_HiGigSrcTrunk_get(int unit,
  39876         bcm_field_entry_t entry,
  39877         uint8 *data,
  39878         uint8 *mask)
  39879 {
  39880     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39881 
  39882 #if defined BCM_TOMAHAWK_SUPPORT
  39883     /* Read qualifier match value and mask. */
  39884     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  39885                         bcmFieldQualifyHiGigSrcTrunk, data, mask);
  39886 #endif
  39887     return rv;
  39888 }
  39889 
  39890 /*
  39891  * Function:
  39892  *      bcm_esw_field_qualify_HiGigIngressClassificationTag
  39893  *      Set match criteria for bcmFieldQualifyHiGigIngressClassificationTag
  39894  *      qualifier in the field entry.
  39895  * Parameters:
  39896  *      unit    -   (IN) Unit number.
  39897  *      entry   -   (IN) BCM field entry id.
  39898  *      data    -   (IN) Qualifier match data.
  39899  *      mask    -   (IN) Qualifier match mask.
  39900  * Returns:
  39901  *      BCM_E_XXX
  39902  * Notes:
  39903  */
  39904 int bcm_esw_field_qualify_HiGigIngressClassificationTag(int unit,
  39905         bcm_field_entry_t entry,
  39906         uint16 data,
  39907         uint16 mask)
  39908 {
  39909     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39910 
  39911 #if defined BCM_TOMAHAWK_SUPPORT
  39912 
  39913     
  39914     FP_LOCK(unit);
  39915     
  39916     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigIngressClassificationTag, 
  39917                           data, mask);
  39918 
  39919     FP_UNLOCK(unit);    
  39920 #endif
  39921     return rv;
  39922 }
  39923 
  39924 /*
  39925  * Function:
  39926  *      bcm_esw_field_qualify_HiGigIngressClassificationTag_get
  39927  *      Get match criteria for bcmFieldQualifyHiGigIngressClassificationTag
  39928  *      qualifier from the field entry.
  39929  * Parameters:
  39930  *      unit    - (IN) Unit number.
  39931  *      entry   - (IN) BCM field entry id.
  39932  *      data    - (OUT) Qualifier match data.
  39933  *      mask    - (OUT) Qualifier match mask.
  39934  * Returns:
  39935  *      BCM_E_XXX
  39936  * Notes:
  39937  */
  39938 int bcm_esw_field_qualify_HiGigIngressClassificationTag_get(int unit,
  39939         bcm_field_entry_t entry,
  39940         uint16 *data,
  39941         uint16 *mask)
  39942 {
  39943     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39944 
  39945 #if defined BCM_TOMAHAWK_SUPPORT
  39946     /* Read qualifier match value and mask. */
  39947     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  39948                         bcmFieldQualifyHiGigIngressClassificationTag, data, mask);
  39949 #endif
  39950     return rv;
  39951 }
  39952 
  39953 /*
  39954  * Function:
  39955  *      bcm_esw_field_qualify_HiGigEgressMcast
  39956  *      Set match criteria for bcmFieldQualifyHiGigEgressMcast
  39957  *      qualifier in the field entry.
  39958  * Parameters:
  39959  *      unit    -   (IN) Unit number.
  39960  *      entry   -   (IN) BCM field entry id.
  39961  *      data    -   (IN) Qualifier match data.
  39962  *      mask    -   (IN) Qualifier match mask.
  39963  * Returns:
  39964  *      BCM_E_XXX
  39965  * Notes:
  39966  */
  39967 int bcm_esw_field_qualify_HiGigEgressMcast(int unit,
  39968         bcm_field_entry_t entry,
  39969         uint8 data,
  39970         uint8 mask)
  39971 {
  39972     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  39973 
  39974 #if defined BCM_TOMAHAWK_SUPPORT
  39975 
  39976 
  39977     FP_LOCK(unit);
  39978     
  39979     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigEgressMcast, 
  39980                           data, mask);
  39981 
  39982     FP_UNLOCK(unit);    
  39983 #endif
  39984     return rv;
  39985 }
  39986 
  39987 /*
  39988  * Function:
  39989  *      bcm_esw_field_qualify_HiGigEgressMcast_get
  39990  *      Get match criteria for bcmFieldQualifyHiGigEgressMcast
  39991  *      qualifier from the field entry.
  39992  * Parameters:
  39993  *      unit    - (IN) Unit number.
  39994  *      entry   - (IN) BCM field entry id.
  39995  *      data    - (OUT) Qualifier match data.
  39996  *      mask    - (OUT) Qualifier match mask.
  39997  * Returns:
  39998  *      BCM_E_XXX
  39999  * Notes:
  40000  */
  40001 int bcm_esw_field_qualify_HiGigEgressMcast_get(int unit,
  40002         bcm_field_entry_t entry,
  40003         uint8 *data,
  40004         uint8 *mask)
  40005 {
  40006     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40007 
  40008 #if defined BCM_TOMAHAWK_SUPPORT
  40009     /* Read qualifier match value and mask. */
  40010     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  40011                         bcmFieldQualifyHiGigEgressMcast, data, mask);
  40012 #endif
  40013     return rv;
  40014 }
  40015 
  40016 /*
  40017  * Function:
  40018  *      bcm_esw_field_qualify_HiGigVni
  40019  *      Set match criteria for bcmFieldQualifyHiGigVni
  40020  *      qualifier in the field entry.
  40021  * Parameters:
  40022  *      unit    -   (IN) Unit number.
  40023  *      entry   -   (IN) BCM field entry id.
  40024  *      data    -   (IN) Qualifier match data.
  40025  *      mask    -   (IN) Qualifier match mask.
  40026  * Returns:
  40027  *      BCM_E_XXX
  40028  * Notes:
  40029  */
  40030 int bcm_esw_field_qualify_HiGigVni(int unit,
  40031         bcm_field_entry_t entry,
  40032         uint16 data,
  40033         uint16 mask)
  40034 {
  40035     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40036 
  40037 #if defined BCM_TOMAHAWK_SUPPORT
  40038 
  40039     FP_LOCK(unit);
  40040     
  40041     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigVni, 
  40042                           data, mask);
  40043 
  40044     FP_UNLOCK(unit);    
  40045 #endif
  40046     return rv;
  40047 }
  40048 
  40049 /*
  40050  * Function:
  40051  *      bcm_esw_field_qualify_HiGigVni_get
  40052  *      Get match criteria for bcmFieldQualifyHiGigVni
  40053  *      qualifier from the field entry.
  40054  * Parameters:
  40055  *      unit    - (IN) Unit number.
  40056  *      entry   - (IN) BCM field entry id.
  40057  *      data    - (OUT) Qualifier match data.
  40058  *      mask    - (OUT) Qualifier match mask.
  40059  * Returns:
  40060  *      BCM_E_XXX
  40061  * Notes:
  40062  */
  40063 int bcm_esw_field_qualify_HiGigVni_get(int unit,
  40064         bcm_field_entry_t entry,
  40065         uint16 *data,
  40066         uint16 *mask)
  40067 {
  40068     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40069 
  40070 #if defined BCM_TOMAHAWK_SUPPORT
  40071     /* Read qualifier match value and mask. */
  40072     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  40073                         bcmFieldQualifyHiGigVni, data, mask);
  40074 #endif
  40075     return rv;
  40076 }
  40077 
  40078 /*
  40079  * Function:
  40080  *      bcm_esw_field_qualify_HiGigDstGport
  40081  *      Set match criteria for bcmFieldQualifyHiGigDstGport
  40082  *      qualifier in the field entry.
  40083  * Parameters:
  40084  *      unit    -   (IN) Unit number.
  40085  *      entry   -   (IN) BCM field entry id.
  40086  *      data    -   (IN) Qualifier match port.
  40087  *      mask    -   (IN) Qualifier match mask.
  40088  * Returns:
  40089  *      BCM_E_XXX
  40090  * Notes:
  40091  */
  40092 int bcm_esw_field_qualify_HiGigDstGport(int unit,
  40093         bcm_field_entry_t entry,
  40094         bcm_gport_t port_id,
  40095         bcm_gport_t port_mask)
  40096 {
  40097     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40098     uint32 data = 0;       /* HW encoded qualifier data.  */
  40099     uint32 mask = 0;       /* HW encoding qualifier mask. */
  40100 
  40101     /* Input parameters check. */
  40102     if (0 == BCM_GPORT_IS_MODPORT(port_id)) {
  40103         return BCM_E_PARAM;
  40104     }
  40105 
  40106     data = BCM_GPORT_MODPORT_PORT_GET(port_id);
  40107     data |= ((BCM_GPORT_MODPORT_MODID_GET(port_id)) << _FP_PORT_BITWIDTH(unit));
  40108 
  40109     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  40110         data = BCM_GPORT_MODPORT_PORT_GET(port_mask);
  40111         data |= ((BCM_GPORT_MODPORT_MODID_GET(port_mask)) << _FP_PORT_BITWIDTH(unit));
  40112     } else {
  40113         mask = BCM_FIELD_EXACT_MATCH_MASK;
  40114     }
  40115 
  40116     FP_LOCK(unit);
  40117     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDstGport, data, mask);
  40118     FP_UNLOCK(unit);
  40119     return rv;
  40120 }
  40121 
  40122 /*
  40123  * Function:
  40124  *      bcm_esw_field_qualify_HiGigDstGport_get
  40125  *      Get match criteria for bcmFieldQualifyHiGigDstGport
  40126  *      qualifier from the field entry.
  40127  * Parameters:
  40128  *      unit    - (IN) Unit number.
  40129  *      entry   - (IN) BCM field entry id.
  40130  *      data    - (OUT) Qualifier match port.
  40131  *      mask    - (OUT) Qualifier match mask.
  40132  * Returns:
  40133  *      BCM_E_XXX
  40134  * Notes:
  40135  */
  40136 int bcm_esw_field_qualify_HiGigDstGport_get(int unit,
  40137         bcm_field_entry_t entry,
  40138         bcm_gport_t *port_id,
  40139         bcm_gport_t *port_mask)
  40140 {
  40141     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40142     uint32 data = 0;       /* HW encoded qualifier data.  */
  40143     uint32 mask = 0;       /* HW encoding qualifier mask. */
  40144 
  40145     /* Input parameters check. */
  40146     if ((NULL == port_id) || (NULL == port_mask)) {
  40147         return (BCM_E_PARAM);
  40148     }
  40149 
  40150     FP_LOCK(unit);
  40151 
  40152     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  40153                         bcmFieldQualifyHiGigDstGport,
  40154                         &data, &mask);
  40155     FP_UNLOCK(unit);
  40156     BCM_IF_ERROR_RETURN(rv);
  40157 
  40158     BCM_GPORT_MODPORT_SET(*port_id, ((data >> _FP_PORT_BITWIDTH(unit)) & 0xff),
  40159                           (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  40160     BCM_GPORT_MODPORT_SET(*port_mask, ((mask >> _FP_PORT_BITWIDTH(unit)) & 0xff),
  40161                           (mask & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  40162     return rv;
  40163 }
  40164 
  40165 /*
  40166  * Function:
  40167  *      bcm_esw_field_qualify_HiGigMulticastIndex
  40168  *      Set match criteria for bcmFieldQualifyHiGigMulticastIndex
  40169  *      qualifier in the field entry.
  40170  * Parameters:
  40171  *      unit    -   (IN) Unit number.
  40172  *      entry   -   (IN) BCM field entry id.
  40173  *      data    -   (IN) Qualifier match data.
  40174  *      mask    -   (IN) Qualifier match mask.
  40175  * Returns:
  40176  *      BCM_E_XXX
  40177  * Notes:
  40178  */
  40179 int bcm_esw_field_qualify_HiGigMulticastIndex(int unit,
  40180         bcm_field_entry_t entry,
  40181         uint16 data,
  40182         uint16 mask)
  40183 {
  40184     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40185 
  40186 #if defined BCM_TOMAHAWK_SUPPORT
  40187 
  40188     
  40189     FP_LOCK(unit);
  40190     
  40191     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigMulticastIndex, 
  40192                           data, mask);
  40193 
  40194     FP_UNLOCK(unit);    
  40195 #endif
  40196     return rv;
  40197 }
  40198 
  40199 /*
  40200  * Function:
  40201  *      bcm_esw_field_qualify_HiGigMulticastIndex_get
  40202  *      Get match criteria for bcmFieldQualifyHiGigMulticastIndex
  40203  *      qualifier from the field entry.
  40204  * Parameters:
  40205  *      unit    - (IN) Unit number.
  40206  *      entry   - (IN) BCM field entry id.
  40207  *      data    - (OUT) Qualifier match data.
  40208  *      mask    - (OUT) Qualifier match mask.
  40209  * Returns:
  40210  *      BCM_E_XXX
  40211  * Notes:
  40212  */
  40213 int bcm_esw_field_qualify_HiGigMulticastIndex_get(int unit,
  40214         bcm_field_entry_t entry,
  40215         uint16 *data,
  40216         uint16 *mask)
  40217 {
  40218     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40219 
  40220 #if defined BCM_TOMAHAWK_SUPPORT
  40221     /* Read qualifier match value and mask. */
  40222     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  40223                         bcmFieldQualifyHiGigMulticastIndex, data, mask);
  40224 #endif
  40225     return rv;
  40226 }
  40227 
  40228 /*
  40229  * Function:
  40230  *      bcm_esw_field_qualify_HiGigVpReplicationId
  40231  *      Set match criteria for bcmFieldQualifyHiGigVpReplicationId
  40232  *      qualifier in the field entry.
  40233  * Parameters:
  40234  *      unit    -   (IN) Unit number.
  40235  *      entry   -   (IN) BCM field entry id.
  40236  *      data    -   (IN) Qualifier match data.
  40237  *      mask    -   (IN) Qualifier match mask.
  40238  * Returns:
  40239  *      BCM_E_XXX
  40240  * Notes:
  40241  */
  40242 int bcm_esw_field_qualify_HiGigVpReplicationId(int unit,
  40243         bcm_field_entry_t entry,
  40244         uint32 data,
  40245         uint32 mask)
  40246 {
  40247     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40248 
  40249 #if defined BCM_TOMAHAWK_SUPPORT
  40250 
  40251     
  40252     FP_LOCK(unit);
  40253     
  40254     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigVpReplicationId, 
  40255                           data, mask);
  40256 
  40257     FP_UNLOCK(unit);    
  40258 #endif
  40259     return rv;
  40260 }
  40261 
  40262 /*
  40263  * Function:
  40264  *      bcm_esw_field_qualify_HiGigVpReplicationId_get
  40265  *      Get match criteria for bcmFieldQualifyHiGigVpReplicationId
  40266  *      qualifier from the field entry.
  40267  * Parameters:
  40268  *      unit    - (IN) Unit number.
  40269  *      entry   - (IN) BCM field entry id.
  40270  *      data    - (OUT) Qualifier match data.
  40271  *      mask    - (OUT) Qualifier match mask.
  40272  * Returns:
  40273  *      BCM_E_XXX
  40274  * Notes:
  40275  */
  40276 int bcm_esw_field_qualify_HiGigVpReplicationId_get(int unit,
  40277         bcm_field_entry_t entry,
  40278         uint32 *data,
  40279         uint32 *mask)
  40280 {
  40281     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40282 
  40283 #if defined BCM_TOMAHAWK_SUPPORT
  40284     /* Read qualifier match value and mask. */
  40285     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  40286                         bcmFieldQualifyHiGigVpReplicationId, data, mask);
  40287 #endif
  40288     return rv;
  40289 }
  40290 
  40291 /*
  40292  * Function:
  40293  *      bcm_esw_field_qualify_HiGigSrcGport
  40294  *      Set match criteria for bcmFieldQualifyHiGigSrcGport
  40295  *      qualifier in the field entry.
  40296  * Parameters:
  40297  *      unit    -   (IN) Unit number.
  40298  *      entry   -   (IN) BCM field entry id.
  40299  *      data    -   (IN) Qualifier match data.
  40300  *      mask    -   (IN) Qualifier match mask.
  40301  * Returns:
  40302  *      BCM_E_XXX
  40303  * Notes:
  40304  */
  40305 int bcm_esw_field_qualify_HiGigSrcGport(int unit,
  40306         bcm_field_entry_t entry,
  40307         bcm_gport_t port_id,
  40308         bcm_gport_t port_mask)
  40309 {
  40310     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40311 
  40312 #if defined BCM_TOMAHAWK_SUPPORT && defined(INCLUDE_L3)
  40313     uint32 data = 0;        /* HW data match value.     */
  40314     uint32 mask = 0;        /* HW data mask value.      */
  40315     int port_gport_type = 0;
  40316     int mask_gport_type = 0;
  40317     _field_entry_t *f_ent;   /* Field entry information. */
  40318 
  40319     /* Input parameters check. */
  40320     if ((0 == BCM_GPORT_IS_MPLS_PORT(port_id))
  40321             && (0 == BCM_GPORT_IS_MIM_PORT(port_id))
  40322             && (0 == BCM_GPORT_IS_WLAN_PORT(port_id))
  40323             && (0 == BCM_GPORT_IS_NIV_PORT(port_id))
  40324             && (0 == BCM_GPORT_IS_VLAN_PORT(port_id))
  40325             && (0 == BCM_GPORT_IS_FLOW_PORT(port_id))
  40326             && (0 == BCM_GPORT_IS_VXLAN_PORT(port_id))) {
  40327         return (BCM_E_PARAM);
  40328     }
  40329 
  40330     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  40331         if ((0 == BCM_GPORT_IS_MPLS_PORT(port_mask))
  40332             && (0 == BCM_GPORT_IS_MIM_PORT(port_mask))
  40333             && (0 == BCM_GPORT_IS_WLAN_PORT(port_mask))
  40334             && (0 == BCM_GPORT_IS_NIV_PORT(port_mask))
  40335             && (0 == BCM_GPORT_IS_VLAN_PORT(port_mask))
  40336             && (0 == BCM_GPORT_IS_FLOW_PORT(port_mask))
  40337             && (0 == BCM_GPORT_IS_VXLAN_PORT(port_id))) {
  40338             return (BCM_E_PARAM);
  40339         }
  40340     }
  40341     
  40342     /* No mismatch between port and port_mask gport type */
  40343     port_gport_type =
  40344         ((port_id   >> _SHR_GPORT_TYPE_SHIFT) & _SHR_GPORT_TYPE_MASK);
  40345 
  40346     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  40347         mask_gport_type =
  40348             ((port_mask >> _SHR_GPORT_TYPE_SHIFT) & _SHR_GPORT_TYPE_MASK);
  40349 
  40350         if (port_gport_type != mask_gport_type) {
  40351             return (BCM_E_PARAM);
  40352         }
  40353     }
  40354 
  40355     
  40356     FP_LOCK(unit);
  40357     /* Get field entry part that contains the qualifier. */
  40358     rv = _bcm_field_entry_qual_get(unit, entry,
  40359                                   bcmFieldQualifyHiGigSrcGport, &f_ent);
  40360     if (BCM_FAILURE(rv)) {
  40361        FP_UNLOCK(unit);
  40362        return rv;
  40363     }
  40364 
  40365     /* Get the source virtual port value */
  40366     if (BCM_GPORT_IS_MPLS_PORT(port_id)) {
  40367         data = BCM_GPORT_MPLS_PORT_ID_GET(port_id);
  40368         f_ent->svp_type = _bcmVpTypeMpls;
  40369     } else if (BCM_GPORT_IS_MIM_PORT(port_id)) {
  40370         data = BCM_GPORT_MIM_PORT_ID_GET(port_id);
  40371         f_ent->svp_type = _bcmVpTypeMim;
  40372     } else if (BCM_GPORT_IS_NIV_PORT(port_id)) {
  40373         data = BCM_GPORT_NIV_PORT_ID_GET(port_id);
  40374         f_ent->svp_type = _bcmVpTypeNiv;
  40375     } else if (BCM_GPORT_IS_VLAN_PORT(port_id)) {
  40376         data = BCM_GPORT_VLAN_PORT_ID_GET(port_id);
  40377         f_ent->svp_type = _bcmVpTypeVlan;
  40378     } else if (BCM_GPORT_IS_VXLAN_PORT(port_id)) {
  40379         data = BCM_GPORT_VXLAN_PORT_ID_GET(port_id);
  40380         f_ent->svp_type = _bcmVpTypeVxlan;
  40381     } else if (BCM_GPORT_IS_FLOW_PORT(port_id)) {
  40382         data = BCM_GPORT_FLOW_PORT_ID_GET(port_id);
  40383         f_ent->svp_type = _bcmVpTypeFlow;
  40384     }else {
  40385         data = BCM_GPORT_WLAN_PORT_ID_GET(port_id);
  40386         f_ent->svp_type = _bcmVpTypeWlan;
  40387     }
  40388 
  40389     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  40390         /* Get the source virtual port value */
  40391         if (BCM_GPORT_IS_MPLS_PORT(port_mask)) {
  40392             mask = BCM_GPORT_MPLS_PORT_ID_GET(port_mask);
  40393         } else if (BCM_GPORT_IS_MIM_PORT(port_mask)) {
  40394             mask = BCM_GPORT_MIM_PORT_ID_GET(port_mask);
  40395         } else if (BCM_GPORT_IS_NIV_PORT(port_mask)) {
  40396             mask = BCM_GPORT_NIV_PORT_ID_GET(port_mask);
  40397         } else if (BCM_GPORT_IS_VLAN_PORT(port_mask)) {
  40398             mask = BCM_GPORT_VLAN_PORT_ID_GET(port_mask);
  40399         } else if (BCM_GPORT_IS_VXLAN_PORT(port_mask)) {
  40400             mask = BCM_GPORT_VXLAN_PORT_ID_GET(port_mask);
  40401         } else if (BCM_GPORT_IS_FLOW_PORT(port_mask)) {
  40402             mask = BCM_GPORT_FLOW_PORT_ID_GET(port_mask);
  40403         } else {         
  40404             mask = BCM_GPORT_WLAN_PORT_ID_GET(port_mask);
  40405         }
  40406     } else {
  40407         mask = BCM_FIELD_EXACT_MATCH_MASK;
  40408     }
  40409        
  40410     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigSrcGport, data, mask);
  40411     FP_UNLOCK(unit);
  40412 #endif
  40413     return rv;
  40414 }
  40415 
  40416 /*
  40417  * Function:
  40418  *      bcm_esw_field_qualify_HiGigSrcGport_get
  40419  *      Get match criteria for bcmFieldQualifyHiGigSrcGport
  40420  *      qualifier from the field entry.
  40421  * Parameters:
  40422  *      unit    - (IN) Unit number.
  40423  *      entry   - (IN) BCM field entry id.
  40424  *      data    - (OUT) Qualifier match data.
  40425  *      mask    - (OUT) Qualifier match mask.
  40426  * Returns:
  40427  *      BCM_E_XXX
  40428  * Notes:
  40429  */
  40430 int bcm_esw_field_qualify_HiGigSrcGport_get(int unit,
  40431         bcm_field_entry_t entry,
  40432         bcm_gport_t *port_id,
  40433         bcm_gport_t *port_mask)
  40434 {
  40435     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40436 
  40437 #if defined BCM_TOMAHAWK_SUPPORT && defined(INCLUDE_L3)
  40438     uint32 data = 0;         /* HW encoded qualifier data.    */
  40439     uint32 mask = 0;         /* HW encoding qualifier mask.   */
  40440     _field_entry_t *f_ent;   /* Field entry information. */
  40441 
  40442     /* Input parameters check. */
  40443     if ((NULL == port_id) || (NULL == port_mask)) {
  40444         return (BCM_E_PARAM);
  40445     }
  40446 
  40447     
  40448     FP_LOCK(unit);
  40449     /* Get field entry part that contains the qualifier. */
  40450     rv = _bcm_field_entry_qual_get(unit, entry,
  40451                                    bcmFieldQualifyHiGigSrcGport, &f_ent);
  40452     if (BCM_FAILURE(rv)) {
  40453        FP_UNLOCK(unit);
  40454        return rv;
  40455     }
  40456     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  40457                         bcmFieldQualifyHiGigSrcGport,
  40458                         &data, &mask);
  40459     if (BCM_FAILURE(rv)) {
  40460        FP_UNLOCK(unit);
  40461        return rv;
  40462     }
  40463 
  40464     if (f_ent->svp_type == _bcmVpTypeMpls) {
  40465         BCM_GPORT_MPLS_PORT_ID_SET(*port_id, data);
  40466         BCM_GPORT_MPLS_PORT_ID_SET(*port_mask, mask);
  40467     } else if (f_ent->svp_type == _bcmVpTypeMim) {
  40468         BCM_GPORT_MIM_PORT_ID_SET(*port_id, data);
  40469         BCM_GPORT_MIM_PORT_ID_SET(*port_mask, mask);
  40470     } else if (f_ent->svp_type == _bcmVpTypeNiv) {
  40471         BCM_GPORT_NIV_PORT_ID_SET(*port_id, data);
  40472         BCM_GPORT_NIV_PORT_ID_SET(*port_mask, mask);
  40473     } else if (f_ent->svp_type == _bcmVpTypeVlan) {
  40474         BCM_GPORT_VLAN_PORT_ID_SET(*port_id, data);
  40475         BCM_GPORT_VLAN_PORT_ID_SET(*port_mask, mask);
  40476     } else if (f_ent->svp_type == _bcmVpTypeWlan) {
  40477         BCM_GPORT_WLAN_PORT_ID_SET(*port_id, data);
  40478         BCM_GPORT_WLAN_PORT_ID_SET(*port_mask, mask);
  40479     } else if (f_ent->svp_type == _bcmVpTypeVxlan) {
  40480         BCM_GPORT_VXLAN_PORT_ID_SET(*port_id, data);
  40481         BCM_GPORT_VXLAN_PORT_ID_SET(*port_mask, mask);
  40482     } else if (f_ent->svp_type == _bcmVpTypeFlow) {
  40483         BCM_GPORT_FLOW_PORT_ID_SET(*port_id, data);
  40484         BCM_GPORT_FLOW_PORT_ID_SET(*port_mask, mask);
  40485     } else {
  40486         rv = BCM_E_NOT_FOUND;
  40487     }
  40488     FP_UNLOCK(unit);
  40489 #endif
  40490     return rv;
  40491 }
  40492 
  40493 /*
  40494  * Function:
  40495  *      bcm_esw_field_qualify_HiGigProtectionSwitchingStatus
  40496  *      Set match criteria for bcmFieldQualifyHiGigProtectionSwitchingStatus
  40497  *      qualifier in the field entry.
  40498  * Parameters:
  40499  *      unit    -   (IN) Unit number.
  40500  *      entry   -   (IN) BCM field entry id.
  40501  *      data    -   (IN) Qualifier match data.
  40502  *      mask    -   (IN) Qualifier match mask.
  40503  * Returns:
  40504  *      BCM_E_XXX
  40505  * Notes:
  40506  */
  40507 int bcm_esw_field_qualify_HiGigProtectionSwitchingStatus(int unit,
  40508         bcm_field_entry_t entry,
  40509         uint8 data,
  40510         uint8 mask)
  40511 {
  40512     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40513 
  40514 #if defined BCM_TOMAHAWK_SUPPORT
  40515 
  40516     
  40517     FP_LOCK(unit);
  40518     
  40519     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigProtectionSwitchingStatus, 
  40520                           data, mask);
  40521 
  40522     FP_UNLOCK(unit);
  40523 #endif
  40524     return rv;
  40525 }
  40526 
  40527 /*
  40528  * Function:
  40529  *      bcm_esw_field_qualify_HiGigProtectionSwitchingStatus_get
  40530  *      Get match criteria for bcmFieldQualifyHiGigProtectionSwitchingStatus
  40531  *      qualifier from the field entry.
  40532  * Parameters:
  40533  *      unit    - (IN) Unit number.
  40534  *      entry   - (IN) BCM field entry id.
  40535  *      data    - (OUT) Qualifier match data.
  40536  *      mask    - (OUT) Qualifier match mask.
  40537  * Returns:
  40538  *      BCM_E_XXX
  40539  * Notes:
  40540  */
  40541 int bcm_esw_field_qualify_HiGigProtectionSwitchingStatus_get(int unit,
  40542         bcm_field_entry_t entry,
  40543         uint8 *data,
  40544         uint8 *mask)
  40545 {
  40546     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40547 
  40548 #if defined BCM_TOMAHAWK_SUPPORT
  40549     /* Read qualifier match value and mask. */
  40550     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  40551                         bcmFieldQualifyHiGigProtectionSwitchingStatus, data, mask);
  40552 #endif
  40553     return rv;
  40554 }
  40555 
  40556 /*
  40557  * Function:
  40558  *      bcm_esw_field_qualify_HiGigMirrorToVp
  40559  *      Set match criteria for bcmFieldQualifyHiGigMirrorToVp
  40560  *      qualifier in the field entry.
  40561  * Parameters:
  40562  *      unit    -   (IN) Unit number.
  40563  *      entry   -   (IN) BCM field entry id.
  40564  *      data    -   (IN) Qualifier match data.
  40565  *      mask    -   (IN) Qualifier match mask.
  40566  * Returns:
  40567  *      BCM_E_XXX
  40568  * Notes:
  40569  */
  40570 int bcm_esw_field_qualify_HiGigMirrorToVp(int unit,
  40571         bcm_field_entry_t entry,
  40572         uint8 data,
  40573         uint8 mask)
  40574 {
  40575     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40576 
  40577 #if defined BCM_TOMAHAWK_SUPPORT
  40578 
  40579     
  40580     FP_LOCK(unit);
  40581     
  40582     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigMirrorToVp, 
  40583                           data, mask);
  40584 
  40585     FP_UNLOCK(unit);    
  40586 #endif
  40587     return rv;
  40588 }
  40589 
  40590 /*
  40591  * Function:
  40592  *      bcm_esw_field_qualify_HiGigMirrorToVp_get
  40593  *      Get match criteria for bcmFieldQualifyHiGigMirrorToVp
  40594  *      qualifier from the field entry.
  40595  * Parameters:
  40596  *      unit    - (IN) Unit number.
  40597  *      entry   - (IN) BCM field entry id.
  40598  *      data    - (OUT) Qualifier match data.
  40599  *      mask    - (OUT) Qualifier match mask.
  40600  * Returns:
  40601  *      BCM_E_XXX
  40602  * Notes:
  40603  */
  40604 int bcm_esw_field_qualify_HiGigMirrorToVp_get(int unit,
  40605         bcm_field_entry_t entry,
  40606         uint8 *data,
  40607         uint8 *mask)
  40608 {
  40609     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40610 
  40611 #if defined BCM_TOMAHAWK_SUPPORT
  40612     /* Read qualifier match value and mask. */
  40613     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  40614                         bcmFieldQualifyHiGigMirrorToVp, data, mask);
  40615 #endif
  40616     return rv;
  40617 }
  40618 
  40619 /*
  40620  * Function:
  40621  *      bcm_esw_field_qualify_HiGigDstType
  40622  *      Set match criteria for bcmFieldQualifyHiGigDstType
  40623  *      qualifier in the field entry.
  40624  * Parameters:
  40625  *      unit    -   (IN) Unit number.
  40626  *      entry   -   (IN) BCM field entry id.
  40627  *      data    -   (IN) Qualifier match data.
  40628  *      mask    -   (IN) Qualifier match mask.
  40629  * Returns:
  40630  *      BCM_E_XXX
  40631  * Notes:
  40632  */
  40633 int bcm_esw_field_qualify_HiGigDstType(int unit,
  40634         bcm_field_entry_t entry,
  40635         uint8 data,
  40636         uint8 mask)
  40637 {
  40638     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40639 
  40640 #if defined BCM_TOMAHAWK_SUPPORT
  40641 
  40642     
  40643     FP_LOCK(unit);
  40644     
  40645     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDstType, 
  40646                           data, mask);
  40647 
  40648     FP_UNLOCK(unit);    
  40649 #endif
  40650     return rv;
  40651 }
  40652 
  40653 /*
  40654  * Function:
  40655  *      bcm_esw_field_qualify_HiGigDstType_get
  40656  *      Get match criteria for bcmFieldQualifyHiGigDstType
  40657  *      qualifier from the field entry.
  40658  * Parameters:
  40659  *      unit    - (IN) Unit number.
  40660  *      entry   - (IN) BCM field entry id.
  40661  *      data    - (OUT) Qualifier match data.
  40662  *      mask    - (OUT) Qualifier match mask.
  40663  * Returns:
  40664  *      BCM_E_XXX
  40665  * Notes:
  40666  */
  40667 int bcm_esw_field_qualify_HiGigDstType_get(int unit,
  40668         bcm_field_entry_t entry,
  40669         uint8 *data,
  40670         uint8 *mask)
  40671 {
  40672     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40673 
  40674 #if defined BCM_TOMAHAWK_SUPPORT
  40675     /* Read qualifier match value and mask. */
  40676     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  40677                         bcmFieldQualifyHiGigDstType, data, mask);
  40678 #endif
  40679     return rv;
  40680 }
  40681 
  40682 /*
  40683  * Function:
  40684  *      bcm_esw_field_qualify_HiGigSrcType
  40685  *      Set match criteria for bcmFieldQualifyHiGigSrcType
  40686  *      qualifier in the field entry.
  40687  * Parameters:
  40688  *      unit    -   (IN) Unit number.
  40689  *      entry   -   (IN) BCM field entry id.
  40690  *      data    -   (IN) Qualifier match data.
  40691  *      mask    -   (IN) Qualifier match mask.
  40692  * Returns:
  40693  *      BCM_E_XXX
  40694  * Notes:
  40695  */
  40696 int bcm_esw_field_qualify_HiGigSrcType(int unit,
  40697         bcm_field_entry_t entry,
  40698         uint8 data,
  40699         uint8 mask)
  40700 {
  40701     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40702 
  40703 #if defined BCM_TOMAHAWK_SUPPORT
  40704 
  40705     
  40706     FP_LOCK(unit);
  40707     
  40708     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigSrcType, 
  40709                           data, mask);
  40710 
  40711     FP_UNLOCK(unit);    
  40712 #endif
  40713     return rv;
  40714 }
  40715 
  40716 /*
  40717  * Function:
  40718  *      bcm_esw_field_qualify_HiGigSrcType_get
  40719  *      Get match criteria for bcmFieldQualifyHiGigSrcType
  40720  *      qualifier from the field entry.
  40721  * Parameters:
  40722  *      unit    - (IN) Unit number.
  40723  *      entry   - (IN) BCM field entry id.
  40724  *      data    - (OUT) Qualifier match data.
  40725  *      mask    - (OUT) Qualifier match mask.
  40726  * Returns:
  40727  *      BCM_E_XXX
  40728  * Notes:
  40729  */
  40730 int bcm_esw_field_qualify_HiGigSrcType_get(int unit,
  40731         bcm_field_entry_t entry,
  40732         uint8 *data,
  40733         uint8 *mask)
  40734 {
  40735     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40736 
  40737 #if defined BCM_TOMAHAWK_SUPPORT
  40738     /* Read qualifier match value and mask. */
  40739     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  40740                         bcmFieldQualifyHiGigSrcType, data, mask);
  40741 #endif
  40742     return rv;
  40743 }
  40744 
  40745 /*
  40746  * Function:
  40747  *      bcm_esw_field_qualify_HiGigOffloadEngineClassificationTag
  40748  *      Set match criteria for bcmFieldQualifyHiGigOffloadEngineClassificationTag
  40749  *      qualifier in the field entry.
  40750  * Parameters:
  40751  *      unit    -   (IN) Unit number.
  40752  *      entry   -   (IN) BCM field entry id.
  40753  *      data    -   (IN) Qualifier match data.
  40754  *      mask    -   (IN) Qualifier match mask.
  40755  * Returns:
  40756  *      BCM_E_XXX
  40757  * Notes:
  40758  */
  40759 int bcm_esw_field_qualify_HiGigOffloadEngineClassificationTag(int unit,
  40760         bcm_field_entry_t entry,
  40761         uint16 data,
  40762         uint16 mask)
  40763 {
  40764     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40765 
  40766 #if defined BCM_TOMAHAWK_SUPPORT
  40767 
  40768     
  40769     FP_LOCK(unit);
  40770     
  40771     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigOffloadEngineClassificationTag, 
  40772                           data, mask);
  40773 
  40774     FP_UNLOCK(unit);    
  40775 #endif
  40776     return rv;
  40777 }
  40778 
  40779 /*
  40780  * Function:
  40781  *      bcm_esw_field_qualify_HiGigOffloadEngineClassificationTag_get
  40782  *      Get match criteria for bcmFieldQualifyHiGigOffloadEngineClassificationTag
  40783  *      qualifier from the field entry.
  40784  * Parameters:
  40785  *      unit    - (IN) Unit number.
  40786  *      entry   - (IN) BCM field entry id.
  40787  *      data    - (OUT) Qualifier match data.
  40788  *      mask    - (OUT) Qualifier match mask.
  40789  * Returns:
  40790  *      BCM_E_XXX
  40791  * Notes:
  40792  */
  40793 int bcm_esw_field_qualify_HiGigOffloadEngineClassificationTag_get(int unit,
  40794         bcm_field_entry_t entry,
  40795         uint16 *data,
  40796         uint16 *mask)
  40797 {
  40798     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40799 
  40800 #if defined BCM_TOMAHAWK_SUPPORT
  40801     /* Read qualifier match value and mask. */
  40802     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  40803                         bcmFieldQualifyHiGigOffloadEngineClassificationTag, data, mask);
  40804 #endif
  40805     return rv;
  40806 }
  40807 
  40808 /*
  40809  * Function:
  40810  *      bcm_esw_field_qualify_HiGigOffloadEnginePktPriNew
  40811  *      Set match criteria for bcmFieldQualifyHiGigOffloadEnginePktPriNew
  40812  *      qualifier in the field entry.
  40813  * Parameters:
  40814  *      unit    -   (IN) Unit number.
  40815  *      entry   -   (IN) BCM field entry id.
  40816  *      data    -   (IN) Qualifier match data.
  40817  *      mask    -   (IN) Qualifier match mask.
  40818  * Returns:
  40819  *      BCM_E_XXX
  40820  * Notes:
  40821  */
  40822 int bcm_esw_field_qualify_HiGigOffloadEnginePktPriNew(int unit,
  40823         bcm_field_entry_t entry,
  40824         uint8 data,
  40825         uint8 mask)
  40826 {
  40827     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40828 
  40829 #if defined BCM_TOMAHAWK_SUPPORT
  40830 
  40831     
  40832     FP_LOCK(unit);
  40833     
  40834     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigOffloadEnginePktPriNew, 
  40835                           data, mask);
  40836 
  40837     FP_UNLOCK(unit);    
  40838 #endif
  40839     return rv;
  40840 }
  40841 
  40842 /*
  40843  * Function:
  40844  *      bcm_esw_field_qualify_HiGigOffloadEnginePktPriNew_get
  40845  *      Get match criteria for bcmFieldQualifyHiGigOffloadEnginePktPriNew
  40846  *      qualifier from the field entry.
  40847  * Parameters:
  40848  *      unit    - (IN) Unit number.
  40849  *      entry   - (IN) BCM field entry id.
  40850  *      data    - (OUT) Qualifier match data.
  40851  *      mask    - (OUT) Qualifier match mask.
  40852  * Returns:
  40853  *      BCM_E_XXX
  40854  * Notes:
  40855  */
  40856 int bcm_esw_field_qualify_HiGigOffloadEnginePktPriNew_get(int unit,
  40857         bcm_field_entry_t entry,
  40858         uint8 *data,
  40859         uint8 *mask)
  40860 {
  40861     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40862 
  40863 #if defined BCM_TOMAHAWK_SUPPORT
  40864     /* Read qualifier match value and mask. */
  40865     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  40866                         bcmFieldQualifyHiGigOffloadEnginePktPriNew, data, mask);
  40867 #endif
  40868     return rv;
  40869 }
  40870 
  40871 /*
  40872  * Function:
  40873  *      bcm_esw_field_qualify_HiGigOffloadEngineDscpNew
  40874  *      Set match criteria for bcmFieldQualifyHiGigOffloadEngineDscpNew
  40875  *      qualifier in the field entry.
  40876  * Parameters:
  40877  *      unit    -   (IN) Unit number.
  40878  *      entry   -   (IN) BCM field entry id.
  40879  *      data    -   (IN) Qualifier match data.
  40880  *      mask    -   (IN) Qualifier match mask.
  40881  * Returns:
  40882  *      BCM_E_XXX
  40883  * Notes:
  40884  */
  40885 int bcm_esw_field_qualify_HiGigOffloadEngineDscpNew(int unit,
  40886         bcm_field_entry_t entry,
  40887         uint8 data,
  40888         uint8 mask)
  40889 {
  40890     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40891 
  40892 #if defined BCM_TOMAHAWK_SUPPORT
  40893 
  40894     
  40895     FP_LOCK(unit);
  40896     
  40897     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigOffloadEngineDscpNew, 
  40898                           data, mask);
  40899 
  40900     FP_UNLOCK(unit);    
  40901 #endif
  40902     return rv;
  40903 }
  40904 
  40905 /*
  40906  * Function:
  40907  *      bcm_esw_field_qualify_HiGigOffloadEngineDscpNew_get
  40908  *      Get match criteria for bcmFieldQualifyHiGigOffloadEngineDscpNew
  40909  *      qualifier from the field entry.
  40910  * Parameters:
  40911  *      unit    - (IN) Unit number.
  40912  *      entry   - (IN) BCM field entry id.
  40913  *      data    - (OUT) Qualifier match data.
  40914  *      mask    - (OUT) Qualifier match mask.
  40915  * Returns:
  40916  *      BCM_E_XXX
  40917  * Notes:
  40918  */
  40919 int bcm_esw_field_qualify_HiGigOffloadEngineDscpNew_get(int unit,
  40920         bcm_field_entry_t entry,
  40921         uint8 *data,
  40922         uint8 *mask)
  40923 {
  40924     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40925 
  40926 #if defined BCM_TOMAHAWK_SUPPORT
  40927     /* Read qualifier match value and mask. */
  40928     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  40929                         bcmFieldQualifyHiGigOffloadEngineDscpNew, data, mask);
  40930 #endif
  40931     return rv;
  40932 }
  40933 
  40934 /*
  40935  * Function:
  40936  *      bcm_esw_field_qualify_LoopBackQueue
  40937  *      Set match criteria for bcmFieldQualifyLoopBackQueue
  40938  *      qualifier in the field entry.
  40939  * Parameters:
  40940  *      unit    -   (IN) Unit number.
  40941  *      entry   -   (IN) BCM field entry id.
  40942  *      data    -   (IN) Qualifier match data.
  40943  *      mask    -   (IN) Qualifier match mask.
  40944  * Returns:
  40945  *      BCM_E_XXX
  40946  * Notes:
  40947  */
  40948 int bcm_esw_field_qualify_LoopBackQueue(int unit,
  40949         bcm_field_entry_t entry,
  40950         uint8 data,
  40951         uint8 mask)
  40952 {
  40953     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40954 
  40955 #if defined BCM_TOMAHAWK_SUPPORT
  40956 
  40957     
  40958     FP_LOCK(unit);
  40959     
  40960     rv = _field_qualify32(unit, entry, bcmFieldQualifyLoopBackQueue, 
  40961                           data, mask);
  40962 
  40963     FP_UNLOCK(unit);    
  40964 #endif
  40965     return rv;
  40966 }
  40967 
  40968 /*
  40969  * Function:
  40970  *      bcm_esw_field_qualify_LoopBackQueue_get
  40971  *      Get match criteria for bcmFieldQualifyLoopBackQueue
  40972  *      qualifier from the field entry.
  40973  * Parameters:
  40974  *      unit    - (IN) Unit number.
  40975  *      entry   - (IN) BCM field entry id.
  40976  *      data    - (OUT) Qualifier match data.
  40977  *      mask    - (OUT) Qualifier match mask.
  40978  * Returns:
  40979  *      BCM_E_XXX
  40980  * Notes:
  40981  */
  40982 int bcm_esw_field_qualify_LoopBackQueue_get(int unit,
  40983         bcm_field_entry_t entry,
  40984         uint8 *data,
  40985         uint8 *mask)
  40986 {
  40987     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  40988 
  40989 #if defined BCM_TOMAHAWK_SUPPORT
  40990     /* Read qualifier match value and mask. */
  40991     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  40992                         bcmFieldQualifyLoopBackQueue, data, mask);
  40993 #endif
  40994     return rv;
  40995 }
  40996 
  40997 /*
  40998  * Function:
  40999  *      bcm_esw_field_qualify_LoopBackSrcGport
  41000  *      Set match criteria for bcmFieldQualifyLoopBackSrcGport
  41001  *      qualifier in the field entry.
  41002  * Parameters:
  41003  *      unit    -   (IN) Unit number.
  41004  *      entry   -   (IN) BCM field entry id.
  41005  *      data    -   (IN) Qualifier match data.
  41006  *      mask    -   (IN) Qualifier match mask.
  41007  * Returns:
  41008  *      BCM_E_XXX
  41009  * Notes:
  41010  */
  41011 int bcm_esw_field_qualify_LoopBackSrcGport(int unit,
  41012         bcm_field_entry_t entry,
  41013         bcm_gport_t port_id,
  41014         bcm_gport_t port_mask)
  41015 {
  41016     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41017 
  41018 #if defined BCM_TOMAHAWK_SUPPORT && defined(INCLUDE_L3)
  41019     uint32 data = 0;        /* HW data match value.     */
  41020     uint32 mask = 0;        /* HW data mask value.      */
  41021     int port_gport_type = 0;
  41022     int mask_gport_type = 0;
  41023     _field_entry_t *f_ent;   /* Field entry information. */
  41024 
  41025     /* Input parameters check. */
  41026     if ((0 == BCM_GPORT_IS_MPLS_PORT(port_id))
  41027             && (0 == BCM_GPORT_IS_MIM_PORT(port_id))
  41028             && (0 == BCM_GPORT_IS_WLAN_PORT(port_id))
  41029             && (0 == BCM_GPORT_IS_NIV_PORT(port_id))
  41030             && (0 == BCM_GPORT_IS_VLAN_PORT(port_id))
  41031             && (0 == BCM_GPORT_IS_VXLAN_PORT(port_id))
  41032             && (0 == BCM_GPORT_IS_FLOW_PORT(port_id))
  41033             && (0 == BCM_GPORT_IS_MODPORT(port_id))) {
  41034         return (BCM_E_PARAM);
  41035     }
  41036 
  41037     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  41038         if ((0 == BCM_GPORT_IS_MPLS_PORT(port_mask))
  41039             && (0 == BCM_GPORT_IS_MIM_PORT(port_mask))
  41040             && (0 == BCM_GPORT_IS_WLAN_PORT(port_mask))
  41041             && (0 == BCM_GPORT_IS_NIV_PORT(port_mask))
  41042             && (0 == BCM_GPORT_IS_VLAN_PORT(port_mask))
  41043             && (0 == BCM_GPORT_IS_VXLAN_PORT(port_mask))
  41044             && (0 == BCM_GPORT_IS_FLOW_PORT(port_mask))
  41045             && (0 == BCM_GPORT_IS_MODPORT(port_mask))) {
  41046             return (BCM_E_PARAM);
  41047         }
  41048     }
  41049     
  41050     /* No mismatch between port and port_mask gport type */
  41051     port_gport_type =
  41052         ((port_id   >> _SHR_GPORT_TYPE_SHIFT) & _SHR_GPORT_TYPE_MASK);
  41053 
  41054     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  41055         mask_gport_type =
  41056             ((port_mask >> _SHR_GPORT_TYPE_SHIFT) & _SHR_GPORT_TYPE_MASK);
  41057 
  41058         if (port_gport_type != mask_gport_type) {
  41059             return (BCM_E_PARAM);
  41060         }
  41061     }
  41062 
  41063      
  41064      FP_LOCK(unit);
  41065      /* Get field entry part that contains the qualifier. */
  41066      rv = _bcm_field_entry_qual_get(unit, entry,
  41067                                bcmFieldQualifyLoopBackSrcGport, &f_ent);
  41068      if (BCM_FAILURE(rv)) {
  41069         FP_UNLOCK(unit);
  41070         return rv;
  41071      }
  41072 
  41073      f_ent->svp_type = _bcmVpTypeAny;
  41074      /* Get the source virtual port value */
  41075      if (BCM_GPORT_IS_MPLS_PORT(port_id)) {
  41076          data = BCM_GPORT_MPLS_PORT_ID_GET(port_id);
  41077          f_ent->svp_type = _bcmVpTypeMpls;
  41078      } else if (BCM_GPORT_IS_MIM_PORT(port_id)) {
  41079          data = BCM_GPORT_MIM_PORT_ID_GET(port_id);
  41080          f_ent->svp_type = _bcmVpTypeMim;
  41081      } else if (BCM_GPORT_IS_NIV_PORT(port_id)) {
  41082          data = BCM_GPORT_NIV_PORT_ID_GET(port_id);
  41083          f_ent->svp_type = _bcmVpTypeNiv;
  41084      } else if (BCM_GPORT_IS_VLAN_PORT(port_id)) {
  41085          data = BCM_GPORT_VLAN_PORT_ID_GET(port_id);
  41086          f_ent->svp_type = _bcmVpTypeVlan;
  41087      } else if (BCM_GPORT_IS_VXLAN_PORT(port_id)) {
  41088          data = BCM_GPORT_VXLAN_PORT_ID_GET(port_id);
  41089          f_ent->svp_type = _bcmVpTypeVxlan;
  41090      } else if (BCM_GPORT_IS_FLOW_PORT(port_id)) {
  41091          data = BCM_GPORT_FLOW_PORT_ID_GET(port_id);
  41092          f_ent->svp_type = _bcmVpTypeFlow;
  41093      } else if (BCM_GPORT_IS_MODPORT(port_id)) {
  41094          data = BCM_GPORT_MODPORT_PORT_GET(port_id);
  41095          data |= ((BCM_GPORT_MODPORT_MODID_GET(port_id)) << _FP_PORT_BITWIDTH(unit));
  41096      } else {
  41097          data = BCM_GPORT_WLAN_PORT_ID_GET(port_id);
  41098      }
  41099 
  41100      if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  41101          /* Get the source virtual port value */
  41102          if (BCM_GPORT_IS_MPLS_PORT(port_mask)) {
  41103              mask = BCM_GPORT_MPLS_PORT_ID_GET(port_mask);
  41104          } else if (BCM_GPORT_IS_MIM_PORT(port_mask)) {
  41105              mask = BCM_GPORT_MIM_PORT_ID_GET(port_mask);
  41106          } else if (BCM_GPORT_IS_NIV_PORT(port_mask)) {
  41107              mask = BCM_GPORT_NIV_PORT_ID_GET(port_mask);
  41108          } else if (BCM_GPORT_IS_VLAN_PORT(port_mask)) {
  41109              mask = BCM_GPORT_VLAN_PORT_ID_GET(port_mask);
  41110          } else if (BCM_GPORT_IS_VXLAN_PORT(port_mask)) {
  41111              mask = BCM_GPORT_VXLAN_PORT_ID_GET(port_mask);
  41112          } else if (BCM_GPORT_IS_FLOW_PORT(port_mask)) {
  41113              mask = BCM_GPORT_FLOW_PORT_ID_GET(port_mask);
  41114          } else if (BCM_GPORT_IS_MODPORT(port_mask)) {
  41115              mask = BCM_GPORT_MODPORT_PORT_GET(port_mask);
  41116              mask |= ((BCM_GPORT_MODPORT_MODID_GET(port_mask)) << _FP_PORT_BITWIDTH(unit));
  41117          } else {
  41118              mask = BCM_GPORT_WLAN_PORT_ID_GET(port_mask);
  41119          }
  41120      } else {
  41121          mask = BCM_FIELD_EXACT_MATCH_MASK;
  41122      }
  41123 
  41124      rv = _field_qualify32(unit, entry, bcmFieldQualifyLoopBackSrcGport, data, mask);
  41125 
  41126      FP_UNLOCK(unit);
  41127 #endif
  41128     return rv;
  41129 }
  41130 
  41131 /*
  41132  * Function:
  41133  *      bcm_esw_field_qualify_LoopBackSrcGport_get
  41134  *      Get match criteria for bcmFieldQualifyLoopBackSrcGport
  41135  *      qualifier from the field entry.
  41136  * Parameters:
  41137  *      unit    - (IN) Unit number.
  41138  *      entry   - (IN) BCM field entry id.
  41139  *      data    - (OUT) Qualifier match data.
  41140  *      mask    - (OUT) Qualifier match mask.
  41141  * Returns:
  41142  *      BCM_E_XXX
  41143  * Notes:
  41144  */
  41145 int bcm_esw_field_qualify_LoopBackSrcGport_get(int unit,
  41146         bcm_field_entry_t entry,
  41147         bcm_gport_t *port_id,
  41148         bcm_gport_t *port_mask)
  41149 {
  41150     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41151 
  41152 #if defined BCM_TOMAHAWK_SUPPORT && defined(INCLUDE_L3)
  41153     uint32 data = 0;         /* HW encoded qualifier data.    */
  41154     uint32 mask = 0;         /* HW encoding qualifier mask.   */
  41155     _field_entry_t *f_ent;   /* Field entry information. */
  41156 
  41157     /* Input parameters check. */
  41158     if ((NULL == port_id) || (NULL == port_mask)) {
  41159         return (BCM_E_PARAM);
  41160     }
  41161 
  41162     
  41163     FP_LOCK(unit);
  41164     /* Get field entry part that contains the qualifier. */
  41165     rv = _bcm_field_entry_qual_get(unit, entry,
  41166                                bcmFieldQualifyLoopBackSrcGport, &f_ent);
  41167     if (BCM_FAILURE(rv)) {
  41168        FP_UNLOCK(unit);
  41169        return rv;
  41170     }
  41171     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  41172                         bcmFieldQualifyLoopBackSrcGport,
  41173                         &data, &mask);
  41174     if (BCM_FAILURE(rv)) {
  41175        FP_UNLOCK(unit);
  41176        return rv;
  41177     }
  41178 
  41179     if (f_ent->svp_type == _bcmVpTypeMpls) {
  41180         BCM_GPORT_MPLS_PORT_ID_SET(*port_id, data);
  41181         BCM_GPORT_MPLS_PORT_ID_SET(*port_mask, mask);
  41182     } else if (f_ent->svp_type == _bcmVpTypeMim) {
  41183         BCM_GPORT_MIM_PORT_ID_SET(*port_id, data);
  41184         BCM_GPORT_MIM_PORT_ID_SET(*port_mask, mask);
  41185     } else if (f_ent->svp_type == _bcmVpTypeNiv) {
  41186         BCM_GPORT_NIV_PORT_ID_SET(*port_id, data);
  41187         BCM_GPORT_NIV_PORT_ID_SET(*port_mask, mask);
  41188     } else if (f_ent->svp_type == _bcmVpTypeVlan) {
  41189         BCM_GPORT_VLAN_PORT_ID_SET(*port_id, data);
  41190         BCM_GPORT_VLAN_PORT_ID_SET(*port_mask, mask);
  41191     } else if (f_ent->svp_type == _bcmVpTypeWlan) {
  41192         BCM_GPORT_WLAN_PORT_ID_SET(*port_id, data);
  41193         BCM_GPORT_WLAN_PORT_ID_SET(*port_mask, mask);
  41194     } else if (f_ent->svp_type == _bcmVpTypeVxlan) {
  41195         BCM_GPORT_VXLAN_PORT_ID_SET(*port_id, data);
  41196         BCM_GPORT_VXLAN_PORT_ID_SET(*port_mask, mask);
  41197     } else if (f_ent->svp_type == _bcmVpTypeFlow) {
  41198         BCM_GPORT_FLOW_PORT_ID_SET(*port_id, data);
  41199         BCM_GPORT_FLOW_PORT_ID_SET(*port_mask, mask);
  41200     } else {
  41201         rv = BCM_E_NOT_FOUND;
  41202     }
  41203     FP_UNLOCK(unit);
  41204 #endif
  41205     return rv;
  41206 }
  41207 
  41208 /*
  41209  * Function:
  41210  *      bcm_esw_field_qualify_PktIsVisible
  41211  *      Set match criteria for bcmFieldQualifyPktIsVisible
  41212  *      qualifier in the field entry.
  41213  * Parameters:
  41214  *      unit    -   (IN) Unit number.
  41215  *      entry   -   (IN) BCM field entry id.
  41216  *      data    -   (IN) Qualifier match data.
  41217  *      mask    -   (IN) Qualifier match mask.
  41218  * Returns:
  41219  *      BCM_E_XXX
  41220  * Notes:
  41221  */
  41222 int bcm_esw_field_qualify_PktIsVisible(int unit,
  41223         bcm_field_entry_t entry,
  41224         uint8 data,
  41225         uint8 mask)
  41226 {
  41227     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41228 
  41229 #if defined BCM_TOMAHAWK_SUPPORT
  41230 
  41231     
  41232     FP_LOCK(unit);
  41233     
  41234     rv = _field_qualify32(unit, entry, bcmFieldQualifyPktIsVisible, 
  41235                           data, mask);
  41236 
  41237     FP_UNLOCK(unit);    
  41238 #endif
  41239     return rv;
  41240 }
  41241 
  41242 /*
  41243  * Function:
  41244  *      bcm_esw_field_qualify_PktIsVisible_get
  41245  *      Get match criteria for bcmFieldQualifyPktIsVisible
  41246  *      qualifier from the field entry.
  41247  * Parameters:
  41248  *      unit    - (IN) Unit number.
  41249  *      entry   - (IN) BCM field entry id.
  41250  *      data    - (OUT) Qualifier match data.
  41251  *      mask    - (OUT) Qualifier match mask.
  41252  * Returns:
  41253  *      BCM_E_XXX
  41254  * Notes:
  41255  */
  41256 int bcm_esw_field_qualify_PktIsVisible_get(int unit,
  41257         bcm_field_entry_t entry,
  41258         uint8 *data,
  41259         uint8 *mask)
  41260 {
  41261     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41262 
  41263 #if defined BCM_TOMAHAWK_SUPPORT
  41264     /* Read qualifier match value and mask. */
  41265     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  41266                         bcmFieldQualifyPktIsVisible, data, mask);
  41267 #endif
  41268     return rv;
  41269 }
  41270 
  41271 /*
  41272  * Function:
  41273  *      bcm_esw_field_qualify_LoopBackCpuMasqueradePktProfile
  41274  *      Set match criteria for bcmFieldQualifyLoopBackCpuMasqueradePktProfile
  41275  *      qualifier in the field entry.
  41276  * Parameters:
  41277  *      unit    -   (IN) Unit number.
  41278  *      entry   -   (IN) BCM field entry id.
  41279  *      data    -   (IN) Qualifier match data.
  41280  *      mask    -   (IN) Qualifier match mask.
  41281  * Returns:
  41282  *      BCM_E_XXX
  41283  * Notes:
  41284  */
  41285 int bcm_esw_field_qualify_LoopBackCpuMasqueradePktProfile(int unit,
  41286         bcm_field_entry_t entry,
  41287         uint8 data,
  41288         uint8 mask)
  41289 {
  41290     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41291 
  41292 #if defined BCM_TOMAHAWK_SUPPORT
  41293 
  41294     
  41295     FP_LOCK(unit);
  41296     
  41297     rv = _field_qualify32(unit, entry, bcmFieldQualifyLoopBackCpuMasqueradePktProfile, 
  41298                           data, mask);
  41299 
  41300     FP_UNLOCK(unit);    
  41301 #endif
  41302     return rv;
  41303 }
  41304 
  41305 /*
  41306  * Function:
  41307  *      bcm_esw_field_qualify_LoopBackCpuMasqueradePktProfile_get
  41308  *      Get match criteria for bcmFieldQualifyLoopBackCpuMasqueradePktProfile
  41309  *      qualifier from the field entry.
  41310  * Parameters:
  41311  *      unit    - (IN) Unit number.
  41312  *      entry   - (IN) BCM field entry id.
  41313  *      data    - (OUT) Qualifier match data.
  41314  *      mask    - (OUT) Qualifier match mask.
  41315  * Returns:
  41316  *      BCM_E_XXX
  41317  * Notes:
  41318  */
  41319 int bcm_esw_field_qualify_LoopBackCpuMasqueradePktProfile_get(int unit,
  41320         bcm_field_entry_t entry,
  41321         uint8 *data,
  41322         uint8 *mask)
  41323 {
  41324     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41325 
  41326 #if defined BCM_TOMAHAWK_SUPPORT
  41327     /* Read qualifier match value and mask. */
  41328     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  41329                         bcmFieldQualifyLoopBackCpuMasqueradePktProfile, data, mask);
  41330 #endif
  41331     return rv;
  41332 }
  41333 
  41334 /*
  41335  * Function:
  41336  *      bcm_esw_field_qualify_LoopBackColor
  41337  *      Set match criteria for bcmFieldQualifyLoopBackColor
  41338  *      qualifier in the field entry.
  41339  * Parameters:
  41340  *      unit    -   (IN) Unit number.
  41341  *      entry   -   (IN) BCM field entry id.
  41342  *      data    -   (IN) Qualifier match data.
  41343  *      mask    -   (IN) Qualifier match mask.
  41344  * Returns:
  41345  *      BCM_E_XXX
  41346  * Notes:
  41347  */
  41348 int bcm_esw_field_qualify_LoopBackColor(int unit,
  41349         bcm_field_entry_t entry,
  41350         uint8 color)
  41351 {
  41352     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41353 
  41354 #if defined BCM_TOMAHAWK_SUPPORT
  41355     uint8 data;           /* Qualifier data.          */
  41356     uint8 mask = 0x3;     /* Qualifier mask.          */
  41357 
  41358     switch (color) {
  41359         case BCM_FIELD_COLOR_GREEN:
  41360             data = 0;
  41361             break;
  41362         case BCM_FIELD_COLOR_RED:
  41363             data = 1;
  41364             break;
  41365         case BCM_FIELD_COLOR_YELLOW:
  41366             data = 3;
  41367             break;
  41368         default:
  41369             return (BCM_E_PARAM);
  41370     }
  41371 
  41372     
  41373     FP_LOCK(unit);
  41374 
  41375     rv = _field_qualify32(unit, entry, bcmFieldQualifyLoopBackColor, data, mask);
  41376 
  41377     FP_UNLOCK(unit);
  41378 #endif
  41379     return rv;
  41380 }
  41381 
  41382 /*
  41383  * Function:
  41384  *      bcm_esw_field_qualify_LoopBackColor_get
  41385  *      Get match criteria for bcmFieldQualifyLoopBackColor
  41386  *      qualifier from the field entry.
  41387  * Parameters:
  41388  *      unit    - (IN) Unit number.
  41389  *      entry   - (IN) BCM field entry id.
  41390  *      data    - (OUT) Qualifier match data.
  41391  *      mask    - (OUT) Qualifier match mask.
  41392  * Returns:
  41393  *      BCM_E_XXX
  41394  * Notes:
  41395  */
  41396 int bcm_esw_field_qualify_LoopBackColor_get(int unit,
  41397         bcm_field_entry_t entry,
  41398         uint8 *color)
  41399 {
  41400     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41401 
  41402 #if defined BCM_TOMAHAWK_SUPPORT
  41403     uint8 data = 0;      /* Qualifier data.          */
  41404     uint8 mask = 0;      /* Qualifier mask.          */
  41405 
  41406     if (NULL == color) {
  41407         return (BCM_E_PARAM);
  41408     }
  41409     /* Read qualifier match value and mask. */
  41410     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, bcmFieldQualifyLoopBackColor,
  41411             &data, &mask);
  41412 
  41413     BCM_IF_ERROR_RETURN(rv);
  41414 
  41415     if (mask == 0) {
  41416         return BCM_E_NOT_FOUND;
  41417     }
  41418 
  41419     switch (data) {
  41420         case 0:
  41421             *color = BCM_FIELD_COLOR_GREEN;
  41422             break;
  41423         case 1:
  41424             *color = BCM_FIELD_COLOR_RED;
  41425             break;
  41426         case 3:
  41427             *color = BCM_FIELD_COLOR_YELLOW;
  41428             break;
  41429         default:
  41430             rv = BCM_E_INTERNAL;
  41431     }
  41432 
  41433 #endif
  41434     return rv;
  41435 }
  41436 
  41437 /*
  41438  * Function:
  41439  *      bcm_esw_field_qualify_LoopBackTrafficClass
  41440  *      Set match criteria for bcmFieldQualifyLoopBackTrafficClass
  41441  *      qualifier in the field entry.
  41442  * Parameters:
  41443  *      unit    -   (IN) Unit number.
  41444  *      entry   -   (IN) BCM field entry id.
  41445  *      data    -   (IN) Qualifier match data.
  41446  *      mask    -   (IN) Qualifier match mask.
  41447  * Returns:
  41448  *      BCM_E_XXX
  41449  * Notes:
  41450  */
  41451 int bcm_esw_field_qualify_LoopBackTrafficClass(int unit,
  41452         bcm_field_entry_t entry,
  41453         uint8 data,
  41454         uint8 mask)
  41455 {
  41456     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41457 
  41458 #if defined BCM_TOMAHAWK_SUPPORT
  41459 
  41460     
  41461     FP_LOCK(unit);
  41462 
  41463     rv = _field_qualify32(unit, entry, bcmFieldQualifyLoopBackTrafficClass,
  41464                           data, mask);
  41465     FP_UNLOCK(unit);
  41466 #endif
  41467     return rv;
  41468 }
  41469 
  41470 /*
  41471  * Function:
  41472  *      bcm_esw_field_qualify_LoopBackTrafficClass_get
  41473  *      Get match criteria for bcmFieldQualifyLoopBackTrafficClass
  41474  *      qualifier from the field entry.
  41475  * Parameters:
  41476  *      unit    - (IN) Unit number.
  41477  *      entry   - (IN) BCM field entry id.
  41478  *      data    - (OUT) Qualifier match data.
  41479  *      mask    - (OUT) Qualifier match mask.
  41480  * Returns:
  41481  *      BCM_E_XXX
  41482  * Notes:
  41483  */
  41484 int bcm_esw_field_qualify_LoopBackTrafficClass_get(int unit,
  41485         bcm_field_entry_t entry,
  41486         uint8 *data,
  41487         uint8 *mask)
  41488 {
  41489     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41490 
  41491 #if defined BCM_TOMAHAWK_SUPPORT
  41492     /* Read qualifier match value and mask. */
  41493     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  41494                                                 bcmFieldQualifyLoopBackTrafficClass,
  41495                                                 data, mask);
  41496 #endif
  41497     return rv;
  41498 }
  41499 
  41500 /*
  41501  * Function:
  41502  *      bcm_esw_field_qualify_LoopBackPacketProcessingPort
  41503  *      Set match criteria for bcmFieldQualifyLoopBackPacketProcessingPort
  41504  *      qualifier in the field entry.
  41505  * Parameters:
  41506  *      unit    -   (IN) Unit number.
  41507  *      entry   -   (IN) BCM field entry id.
  41508  *      data    -   (IN) Qualifier match port.
  41509  *      mask    -   (IN) Qualifier match mask.
  41510  * Returns:
  41511  *      BCM_E_XXX
  41512  * Notes:
  41513  */
  41514 int bcm_esw_field_qualify_LoopBackPacketProcessingPort(int unit,
  41515         bcm_field_entry_t entry,
  41516         bcm_gport_t port_id,
  41517         bcm_gport_t port_mask)
  41518 {
  41519     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41520 
  41521 #if defined BCM_TOMAHAWK_SUPPORT
  41522     uint32 data = 0;            /* HW data match criteria.  */
  41523     uint32 mask = 0;            /* HW data mask.            */
  41524 
  41525     if (0 == BCM_GPORT_IS_MODPORT(port_id)) {
  41526         return (BCM_E_PARAM);
  41527     }
  41528 
  41529     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  41530         if (0 == BCM_GPORT_IS_MODPORT(port_mask)) {
  41531             return (BCM_E_PARAM);
  41532         }
  41533     }
  41534 
  41535     data  = BCM_GPORT_MODPORT_PORT_GET(port_id);
  41536 
  41537     if (port_mask != BCM_FIELD_EXACT_MATCH_MASK) {
  41538         mask = BCM_GPORT_MODPORT_PORT_GET(port_mask);
  41539     } else { 
  41540         mask = BCM_FIELD_EXACT_MATCH_MASK;
  41541     }
  41542 
  41543     
  41544     FP_LOCK(unit);
  41545 
  41546     rv = _field_qualify32(unit, entry, bcmFieldQualifyLoopBackPacketProcessingPort, 
  41547             data, mask);
  41548     FP_UNLOCK(unit);
  41549 #endif
  41550     return rv;
  41551 }
  41552 
  41553 /*
  41554  * Function:
  41555  *      bcm_esw_field_qualify_LoopBackPacketProcessingPort_get
  41556  *      Get match criteria for bcmFieldQualifyLoopBackPacketProcessingPort
  41557  *      qualifier from the field entry.
  41558  * Parameters:
  41559  *      unit    - (IN) Unit number.
  41560  *      entry   - (IN) BCM field entry id.
  41561  *      data    - (OUT) Qualifier match port.
  41562  *      mask    - (OUT) Qualifier match mask.
  41563  * Returns:
  41564  *      BCM_E_XXX
  41565  * Notes:
  41566  */
  41567 int bcm_esw_field_qualify_LoopBackPacketProcessingPort_get(int unit,
  41568         bcm_field_entry_t entry,
  41569         bcm_gport_t *port_id,
  41570         bcm_gport_t *port_mask)
  41571 {
  41572     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  41573 
  41574 #if defined BCM_TOMAHAWK_SUPPORT
  41575     uint32 data = 0;   /* HW encoded qualifier data.  */
  41576     uint32 mask = 0;   /* HW encoding qualifier mask. */
  41577 
  41578     if ((NULL == port_id) || (NULL == port_mask)) {
  41579         return (BCM_E_PARAM);
  41580     }
  41581 
  41582     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  41583             bcmFieldQualifyLoopBackPacketProcessingPort, &data, &mask);
  41584     
  41585     BCM_IF_ERROR_RETURN(rv);
  41586     BCM_GPORT_MODPORT_SET(*port_id, ((data >> _FP_PORT_BITWIDTH(unit)) & 0xff), 
  41587             (data & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  41588     BCM_GPORT_MODPORT_SET(*port_mask, ((mask >> _FP_PORT_BITWIDTH(unit)) & 0xff), 
  41589             (mask & ((1 << _FP_PORT_BITWIDTH(unit)) - 1)));
  41590 #endif
  41591     return rv;
  41592 }
  41593 
  41594 /*
  41595  * Function:
  41596  *      bcm_esw_field_qualify_HiGigMirrorOrSwitchPkt
  41597  *      Set match criteria for bcmFieldQualifyHiGigMirrorOrSwitchPkt
  41598  *      qualifier in the field entry.
  41599  * Parameters:
  41600  *      unit    -   (IN) Unit number.
  41601  *      entry   -   (IN) BCM field entry id.
  41602  *      data    -   (IN) Qualifier match data.
  41603  *      mask    -   (IN) Qualifier match mask.
  41604  * Returns:
  41605  *      BCM_E_XXX
  41606  * Notes:
  41607  */
  41608 int bcm_esw_field_qualify_HiGigMirrorOrSwitchPkt(
  41609     int unit, 
  41610     bcm_field_entry_t entry, 
  41611     uint8 data, 
  41612     uint8 mask) 
  41613 {
  41614     int rv = BCM_E_UNAVAIL; 
  41615 
  41616 #if defined BCM_TOMAHAWK_SUPPORT
  41617  
  41618     
  41619     FP_LOCK(unit);
  41620     
  41621     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigMirrorOrSwitchPkt, 
  41622                           data, mask);
  41623     FP_UNLOCK(unit);    
  41624 #endif
  41625     return rv;
  41626 }
  41627 
  41628 /*
  41629  * Function:
  41630  *      bcm_esw_field_qualify_HiGigMirrorOrSwitchPkt_get
  41631  *      Get match criteria for bcmFieldQualifyHiGigMirrorOrSwitchPkt
  41632  *      qualifier from the field entry.
  41633  * Parameters:
  41634  *      unit    - (IN) Unit number.
  41635  *      entry   - (IN) BCM field entry id.
  41636  *      data    - (OUT) Qualifier match data.
  41637  *      mask    - (OUT) Qualifier match mask.
  41638  * Returns:
  41639  *      BCM_E_XXX
  41640  * Notes:
  41641  */
  41642 int bcm_esw_field_qualify_HiGigMirrorOrSwitchPkt_get(
  41643     int unit, 
  41644     bcm_field_entry_t entry, 
  41645     uint8 *data, 
  41646     uint8 *mask)
  41647 {
  41648     int rv = BCM_E_UNAVAIL; 
  41649 
  41650 #if defined BCM_TOMAHAWK_SUPPORT
  41651     if((data == NULL) || (mask == NULL)) {
  41652         return BCM_E_PARAM; 
  41653      }
  41654  
  41655     /* Read qualifier match value and mask. */
  41656     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  41657                         bcmFieldQualifyHiGigMirrorOrSwitchPkt, data, mask);
  41658 #endif
  41659     return rv;
  41660 }
  41661 
  41662 /*
  41663  * Function:
  41664  *      bcm_esw_field_qualify_HiGigMplsPkt
  41665  *      Set match criteria for bcmFieldQualifyHiGigMplsPkt
  41666  *      qualifier in the field entry.
  41667  * Parameters:
  41668  *      unit    -   (IN) Unit number.
  41669  *      entry   -   (IN) BCM field entry id.
  41670  *      data    -   (IN) Qualifier match data.
  41671  *      mask    -   (IN) Qualifier match mask.
  41672  * Returns:
  41673  *      BCM_E_XXX
  41674  * Notes:
  41675  */
  41676 int bcm_esw_field_qualify_HiGigMplsPkt(
  41677     int unit, 
  41678     bcm_field_entry_t entry, 
  41679     uint8 data, 
  41680     uint8 mask) 
  41681 {
  41682     int rv = BCM_E_UNAVAIL; 
  41683 
  41684 #if defined BCM_TOMAHAWK_SUPPORT
  41685 
  41686     
  41687     FP_LOCK(unit);
  41688    
  41689     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigMplsPkt, 
  41690                           data, mask);
  41691 
  41692     FP_UNLOCK(unit);    
  41693 #endif
  41694     return rv;
  41695 }
  41696 
  41697 /*
  41698  * Function:
  41699  *      bcm_esw_field_qualify_HiGigMplsPkt_get
  41700  *      Get match criteria for bcmFieldQualifyHiGigMplsPkt
  41701  *      qualifier from the field entry.
  41702  * Parameters:
  41703  *      unit    - (IN) Unit number.
  41704  *      entry   - (IN) BCM field entry id.
  41705  *      data    - (OUT) Qualifier match data.
  41706  *      mask    - (OUT) Qualifier match mask.
  41707  * Returns:
  41708  *      BCM_E_XXX
  41709  * Notes:
  41710  */
  41711 int bcm_esw_field_qualify_HiGigMplsPkt_get(
  41712     int unit, 
  41713     bcm_field_entry_t entry, 
  41714     uint8 *data, 
  41715     uint8 *mask)
  41716 {
  41717     int rv = BCM_E_UNAVAIL; 
  41718 
  41719 #if defined BCM_TOMAHAWK_SUPPORT
  41720     /* Read qualifier match value and mask. */
  41721     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  41722                         bcmFieldQualifyHiGigMplsPkt, data, mask);
  41723 
  41724 #endif
  41725     return rv;
  41726 }
  41727 
  41728 /*
  41729  * Function:
  41730  *      bcm_esw_field_qualify_HiGigDoNotFlags
  41731  *      Set match criteria for bcmFieldQualifyHiGigDoNotFlags
  41732  *      qualifier in the field entry.
  41733  * Parameters:
  41734  *      unit    -   (IN) Unit number.
  41735  *      entry   -   (IN) BCM field entry id.
  41736  *      data    -   (IN) Qualifier match data.
  41737  *      mask    -   (IN) Qualifier match mask.
  41738  * Returns:
  41739  *      BCM_E_XXX
  41740  * Notes:
  41741  */
  41742 int bcm_esw_field_qualify_HiGigDoNotFlags(
  41743     int unit, 
  41744     bcm_field_entry_t entry, 
  41745     uint8 data, 
  41746     uint8 mask) 
  41747 {
  41748     int rv = BCM_E_UNAVAIL; 
  41749 
  41750 #if defined BCM_TOMAHAWK_SUPPORT
  41751     const uint32  data_max = BCM_FIELD_HIGIG_DONOT_LEARN | 
  41752                              BCM_FIELD_HIGIG_DONOT_MODIFY;
  41753 
  41754     /*Input parameters check.*/
  41755     if (data > data_max) {
  41756         return (BCM_E_PARAM);
  41757     }
  41758 
  41759     
  41760     FP_LOCK(unit);
  41761     
  41762     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigDoNotFlags, 
  41763                           data, mask);
  41764 
  41765     FP_UNLOCK(unit);    
  41766 #endif
  41767     return rv;
  41768 }
  41769 
  41770 /*
  41771  * Function:
  41772  *      bcm_esw_field_qualify_HiGigDoNotFlags_get
  41773  *      Get match criteria for bcmFieldQualifyHiGigDoNotFlags
  41774  *      qualifier from the field entry.
  41775  * Parameters:
  41776  *      unit    - (IN) Unit number.
  41777  *      entry   - (IN) BCM field entry id.
  41778  *      data    - (OUT) Qualifier match data.
  41779  *      mask    - (OUT) Qualifier match mask.
  41780  * Returns:
  41781  *      BCM_E_XXX
  41782  * Notes:
  41783  */
  41784 int bcm_esw_field_qualify_HiGigDoNotFlags_get(
  41785     int unit, 
  41786     bcm_field_entry_t entry, 
  41787     uint8 *data, 
  41788     uint8 *mask)
  41789 {
  41790     int rv = BCM_E_UNAVAIL; 
  41791 
  41792 #if defined BCM_TOMAHAWK_SUPPORT
  41793     /* Read qualifier match value and mask. */
  41794     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  41795                         bcmFieldQualifyHiGigDoNotFlags, data, mask);
  41796 
  41797 #endif
  41798     return rv;
  41799 }
  41800 
  41801 /*
  41802  * Function:
  41803  *      bcm_esw_field_qualify_HiGigPreserveFlags
  41804  *      Set match criteria for bcmFieldQualifyHiGigPreserveFlags
  41805  *      qualifier in the field entry.
  41806  * Parameters:
  41807  *      unit    -   (IN) Unit number.
  41808  *      entry   -   (IN) BCM field entry id.
  41809  *      data    -   (IN) Qualifier match data.
  41810  *      mask    -   (IN) Qualifier match mask.
  41811  * Returns:
  41812  *      BCM_E_XXX
  41813  * Notes:
  41814  */
  41815 int bcm_esw_field_qualify_HiGigPreserveFlags(
  41816     int unit, 
  41817     bcm_field_entry_t entry, 
  41818     uint8 data, 
  41819     uint8 mask) 
  41820 {
  41821     int rv = BCM_E_UNAVAIL; 
  41822 
  41823 #if defined BCM_TOMAHAWK_SUPPORT
  41824     const uint32  data_max = BCM_FIELD_HIGIG_PRESERVE_DSCP | 
  41825                              BCM_FIELD_HIGIG_PRESERVE_DOT1P;
  41826 
  41827     /*Input parameters check.*/
  41828     if (data > data_max) {
  41829         return (BCM_E_PARAM);
  41830     }
  41831 
  41832     
  41833     FP_LOCK(unit);
  41834     
  41835     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigPreserveFlags, 
  41836                           data, mask);
  41837 
  41838     FP_UNLOCK(unit);    
  41839 #endif
  41840     return rv;
  41841 }
  41842 
  41843 /*
  41844  * Function:
  41845  *      bcm_esw_field_qualify_HiGigPreserveFlags_get
  41846  *      Get match criteria for bcmFieldQualifyHiGigPreserveFlags
  41847  *      qualifier from the field entry.
  41848  * Parameters:
  41849  *      unit    - (IN) Unit number.
  41850  *      entry   - (IN) BCM field entry id.
  41851  *      data    - (OUT) Qualifier match data.
  41852  *      mask    - (OUT) Qualifier match mask.
  41853  * Returns:
  41854  *      BCM_E_XXX
  41855  * Notes:
  41856  */
  41857 int bcm_esw_field_qualify_HiGigPreserveFlags_get(
  41858     int unit, 
  41859     bcm_field_entry_t entry, 
  41860     uint8 *data, 
  41861     uint8 *mask)
  41862 {
  41863     int rv = BCM_E_UNAVAIL; 
  41864 
  41865 #if defined BCM_TOMAHAWK_SUPPORT
  41866     /* Read qualifier match value and mask. */
  41867     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  41868                         bcmFieldQualifyHiGigPreserveFlags, data, mask);
  41869 #endif
  41870     return rv;
  41871 }
  41872 
  41873 /*
  41874  * Function:
  41875  *      bcm_esw_field_qualify_HiGigLabelType
  41876  *      Set match criteria for bcmFieldQualifyHiGigLabelType
  41877  *      qualifier in the field entry.
  41878  * Parameters:
  41879  *      unit    -   (IN) Unit number.
  41880  *      entry   -   (IN) BCM field entry id.
  41881  *      data    -   (IN) Qualifier match data.
  41882  *      mask    -   (IN) Qualifier match mask.
  41883  * Returns:
  41884  *      BCM_E_XXX
  41885  * Notes:
  41886  */
  41887 int bcm_esw_field_qualify_HiGigLabelType(
  41888     int unit, 
  41889     bcm_field_entry_t entry, 
  41890     uint8 data, 
  41891     uint8 mask) 
  41892 {
  41893     int rv = BCM_E_UNAVAIL; 
  41894 
  41895 #if defined BCM_TOMAHAWK_SUPPORT
  41896 
  41897     
  41898      FP_LOCK(unit);
  41899    
  41900     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigLabelType, 
  41901                           data, mask);
  41902  
  41903     FP_UNLOCK(unit);    
  41904 #endif
  41905     return rv;
  41906 }
  41907 
  41908 /*
  41909  * Function:
  41910  *      bcm_esw_field_qualify_HiGigLabelType_get
  41911  *      Get match criteria for bcmFieldQualifyHiGigLabelType
  41912  *      qualifier from the field entry.
  41913  * Parameters:
  41914  *      unit    - (IN) Unit number.
  41915  *      entry   - (IN) BCM field entry id.
  41916  *      data    - (OUT) Qualifier match data.
  41917  *      mask    - (OUT) Qualifier match mask.
  41918  * Returns:
  41919  *      BCM_E_XXX
  41920  * Notes:
  41921  */
  41922 int bcm_esw_field_qualify_HiGigLabelType_get(
  41923     int unit, 
  41924     bcm_field_entry_t entry, 
  41925     uint8 *data, 
  41926     uint8 *mask)
  41927 {
  41928     int rv = BCM_E_UNAVAIL; 
  41929 
  41930 #if defined BCM_TOMAHAWK_SUPPORT
  41931     /* Read qualifier match value and mask. */
  41932     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  41933                         bcmFieldQualifyHiGigLabelType, data, mask);         
  41934 #endif
  41935     return rv;
  41936 }
  41937 
  41938 /*
  41939  * Function:
  41940  *      bcm_esw_field_qualify_HiGigVpPreserveFlags
  41941  *      Set match criteria for bcmFieldQualifyHiGigVpPreserveFlags
  41942  *      qualifier in the field entry.
  41943  * Parameters:
  41944  *      unit    -   (IN) Unit number.
  41945  *      entry   -   (IN) BCM field entry id.
  41946  *      data    -   (IN) Qualifier match data.
  41947  *      mask    -   (IN) Qualifier match mask.
  41948  * Returns:
  41949  *      BCM_E_XXX
  41950  * Notes:
  41951  */
  41952 int bcm_esw_field_qualify_HiGigVpPreserveFlags(
  41953     int unit, 
  41954     bcm_field_entry_t entry, 
  41955     uint8 data, 
  41956     uint8 mask) 
  41957 {
  41958     int rv = BCM_E_UNAVAIL; 
  41959 
  41960 #if defined BCM_TOMAHAWK_SUPPORT
  41961     const uint32  data_max = BCM_FIELD_HIGIG_PRESERVE_DSCP | 
  41962                              BCM_FIELD_HIGIG_PRESERVE_DOT1P;
  41963 
  41964     /*Input parameters check.*/
  41965     if (data > data_max) {
  41966         return (BCM_E_PARAM);
  41967     }
  41968 
  41969     
  41970     FP_LOCK(unit);
  41971     
  41972     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigVpPreserveFlags, 
  41973                           data, mask);
  41974 
  41975     FP_UNLOCK(unit);    
  41976 #endif
  41977     return rv;
  41978 }
  41979 
  41980 /*
  41981  * Function:
  41982  *      bcm_esw_field_qualify_HiGigVpPreserveFlags_get
  41983  *      Get match criteria for bcmFieldQualifyHiGigVpPreserveFlags
  41984  *      qualifier from the field entry.
  41985  * Parameters:
  41986  *      unit    - (IN) Unit number.
  41987  *      entry   - (IN) BCM field entry id.
  41988  *      data    - (OUT) Qualifier match data.
  41989  *      mask    - (OUT) Qualifier match mask.
  41990  * Returns:
  41991  *      BCM_E_XXX
  41992  * Notes:
  41993  */
  41994 int bcm_esw_field_qualify_HiGigVpPreserveFlags_get(
  41995     int unit, 
  41996     bcm_field_entry_t entry, 
  41997     uint8 *data, 
  41998     uint8 *mask)
  41999 {
  42000     int rv = BCM_E_UNAVAIL; 
  42001 
  42002 #if defined BCM_TOMAHAWK_SUPPORT
  42003     /* Read qualifier match value and mask. */
  42004     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  42005                         bcmFieldQualifyHiGigVpPreserveFlags, data, mask);
  42006 #endif
  42007     return rv;
  42008 }
  42009 
  42010 /*
  42011  * Function:
  42012  *      bcm_esw_field_qualify_HiGigOffloadEnginePreserveDscp
  42013  *      Set match criteria for bcmFieldQualifyHiGigOffloadEnginePreserveDscp
  42014  *      qualifier in the field entry.
  42015  * Parameters:
  42016  *      unit    -   (IN) Unit number.
  42017  *      entry   -   (IN) BCM field entry id.
  42018  *      data    -   (IN) Qualifier match data.
  42019  *      mask    -   (IN) Qualifier match mask.
  42020  * Returns:
  42021  *      BCM_E_XXX
  42022  * Notes:
  42023  */
  42024 int bcm_esw_field_qualify_HiGigOffloadEnginePreserveDscp(
  42025     int unit, 
  42026     bcm_field_entry_t entry, 
  42027     uint8 data, 
  42028     uint8 mask) 
  42029 {
  42030     int rv = BCM_E_UNAVAIL; 
  42031 
  42032 #if defined BCM_TOMAHAWK_SUPPORT
  42033 
  42034     
  42035     FP_LOCK(unit);
  42036     
  42037     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigOffloadEnginePreserveDscp, 
  42038                           data, mask);
  42039 
  42040     FP_UNLOCK(unit);    
  42041 #endif
  42042     return rv;
  42043 }
  42044 
  42045 /*
  42046  * Function:
  42047  *      bcm_esw_field_qualify_HiGigOffloadEnginePreserveDscp_get
  42048  *      Get match criteria for bcmFieldQualifyHiGigOffloadEnginePreserveDscp
  42049  *      qualifier from the field entry.
  42050  * Parameters:
  42051  *      unit    - (IN) Unit number.
  42052  *      entry   - (IN) BCM field entry id.
  42053  *      data    - (OUT) Qualifier match data.
  42054  *      mask    - (OUT) Qualifier match mask.
  42055  * Returns:
  42056  *      BCM_E_XXX
  42057  * Notes:
  42058  */
  42059 int bcm_esw_field_qualify_HiGigOffloadEnginePreserveDscp_get(
  42060     int unit, 
  42061     bcm_field_entry_t entry, 
  42062     uint8 *data, 
  42063     uint8 *mask)
  42064 {
  42065     int rv = BCM_E_UNAVAIL; 
  42066 
  42067 #if defined BCM_TOMAHAWK_SUPPORT
  42068     /* Read qualifier match value and mask. */
  42069     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  42070                         bcmFieldQualifyHiGigOffloadEnginePreserveDscp, data, mask);
  42071 
  42072 #endif
  42073     return rv;
  42074 }
  42075 
  42076 /*
  42077  * Function:
  42078  *      bcm_esw_field_qualify_HiGigOffloadEnginePreserveDot1p
  42079  *      Set match criteria for bcmFieldQualifyHiGigOffloadEnginePreserveDot1p
  42080  *      qualifier in the field entry.
  42081  * Parameters:
  42082  *      unit    -   (IN) Unit number.
  42083  *      entry   -   (IN) BCM field entry id.
  42084  *      data    -   (IN) Qualifier match data.
  42085  *      mask    -   (IN) Qualifier match mask.
  42086  * Returns:
  42087  *      BCM_E_XXX
  42088  * Notes:
  42089  */
  42090 int bcm_esw_field_qualify_HiGigOffloadEnginePreserveDot1p(
  42091     int unit, 
  42092     bcm_field_entry_t entry, 
  42093     uint8 data, 
  42094     uint8 mask) 
  42095 {
  42096     int rv = BCM_E_UNAVAIL; 
  42097 
  42098 #if defined BCM_TOMAHAWK_SUPPORT
  42099 
  42100     
  42101     FP_LOCK(unit);
  42102     
  42103     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigOffloadEnginePreserveDot1p, 
  42104                           data, mask);
  42105 
  42106     FP_UNLOCK(unit);    
  42107 #endif
  42108     return rv;
  42109 }
  42110 
  42111 /*
  42112  * Function:
  42113  *      bcm_esw_field_qualify_HiGigOffloadEnginePreserveDot1p_get
  42114  *      Get match criteria for bcmFieldQualifyHiGigOffloadEnginePreserveDot1p
  42115  *      qualifier from the field entry.
  42116  * Parameters:
  42117  *      unit    - (IN) Unit number.
  42118  *      entry   - (IN) BCM field entry id.
  42119  *      data    - (OUT) Qualifier match data.
  42120  *      mask    - (OUT) Qualifier match mask.
  42121  * Returns:
  42122  *      BCM_E_XXX
  42123  * Notes:
  42124  */
  42125 int bcm_esw_field_qualify_HiGigOffloadEnginePreserveDot1p_get(
  42126     int unit, 
  42127     bcm_field_entry_t entry, 
  42128     uint8 *data, 
  42129     uint8 *mask)
  42130 {
  42131     int rv = BCM_E_UNAVAIL; 
  42132 
  42133 #if defined BCM_TOMAHAWK_SUPPORT
  42134     /* Read qualifier match value and mask. */
  42135     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  42136                         bcmFieldQualifyHiGigOffloadEnginePreserveDot1p, data, mask);
  42137 #endif
  42138     return rv;
  42139 }
  42140 
  42141 /*
  42142  * Function:
  42143  *      bcm_esw_field_qualify_HiGigOffloadEngineSrcType
  42144  *      Set match criteria for bcmFieldQualifyHiGigOffloadEngineSrcType
  42145  *      qualifier in the field entry.
  42146  * Parameters:
  42147  *      unit    -   (IN) Unit number.
  42148  *      entry   -   (IN) BCM field entry id.
  42149  *      data    -   (IN) Qualifier match data.
  42150  *      mask    -   (IN) Qualifier match mask.
  42151  * Returns:
  42152  *      BCM_E_XXX
  42153  * Notes:
  42154  */
  42155 int bcm_esw_field_qualify_HiGigOffloadEngineSrcType(
  42156     int unit, 
  42157     bcm_field_entry_t entry, 
  42158     uint8 data, 
  42159     uint8 mask) 
  42160 {
  42161     int rv = BCM_E_UNAVAIL; 
  42162 
  42163 #if defined BCM_TOMAHAWK_SUPPORT
  42164 
  42165     
  42166     FP_LOCK(unit);
  42167     
  42168     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigOffloadEngineSrcType, 
  42169                           data, mask);
  42170 
  42171     FP_UNLOCK(unit);    
  42172 #endif
  42173     return rv;
  42174 }
  42175 
  42176 /*
  42177  * Function:
  42178  *      bcm_esw_field_qualify_HiGigOffloadEngineSrcType_get
  42179  *      Get match criteria for bcmFieldQualifyHiGigOffloadEngineSrcType
  42180  *      qualifier from the field entry.
  42181  * Parameters:
  42182  *      unit    - (IN) Unit number.
  42183  *      entry   - (IN) BCM field entry id.
  42184  *      data    - (OUT) Qualifier match data.
  42185  *      mask    - (OUT) Qualifier match mask.
  42186  * Returns:
  42187  *      BCM_E_XXX
  42188  * Notes:
  42189  */
  42190 int bcm_esw_field_qualify_HiGigOffloadEngineSrcType_get(
  42191     int unit, 
  42192     bcm_field_entry_t entry, 
  42193     uint8 *data, 
  42194     uint8 *mask)
  42195 {
  42196     int rv = BCM_E_UNAVAIL; 
  42197 
  42198 #if defined BCM_TOMAHAWK_SUPPORT
  42199     /* Read qualifier match value and mask. */
  42200     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  42201                         bcmFieldQualifyHiGigOffloadEngineSrcType, data, mask);
  42202 #endif
  42203     return rv;
  42204 }
  42205 
  42206 /*
  42207  * Function:
  42208  *      bcm_esw_field_qualify_HiGigExtendedHeaderPresent
  42209  *      Set match criteria for bcmFieldQualifyHiGigExtendedHeaderPresent
  42210  *      qualifier in the field entry.
  42211  * Parameters:
  42212  *      unit    -   (IN) Unit number.
  42213  *      entry   -   (IN) BCM field entry id.
  42214  *      data    -   (IN) Qualifier match data.
  42215  *      mask    -   (IN) Qualifier match mask.
  42216  * Returns:
  42217  *      BCM_E_XXX
  42218  * Notes:
  42219  */
  42220 int bcm_esw_field_qualify_HiGigExtendedHeaderPresent(
  42221     int unit, 
  42222     bcm_field_entry_t entry, 
  42223     uint8 data, 
  42224     uint8 mask) 
  42225 {
  42226     int rv = BCM_E_UNAVAIL; 
  42227 
  42228 #if defined BCM_TOMAHAWK_SUPPORT
  42229 
  42230     
  42231     FP_LOCK(unit);
  42232     
  42233     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigExtendedHeaderPresent, 
  42234                           data, mask);
  42235 
  42236     FP_UNLOCK(unit);    
  42237 #endif
  42238     return rv;
  42239 }
  42240 
  42241 /*
  42242  * Function:
  42243  *      bcm_esw_field_qualify_HiGigExtendedHeaderPresent_get
  42244  *      Get match criteria for bcmFieldQualifyHiGigExtendedHeaderPresent
  42245  *      qualifier from the field entry.
  42246  * Parameters:
  42247  *      unit    - (IN) Unit number.
  42248  *      entry   - (IN) BCM field entry id.
  42249  *      data    - (OUT) Qualifier match data.
  42250  *      mask    - (OUT) Qualifier match mask.
  42251  * Returns:
  42252  *      BCM_E_XXX
  42253  * Notes:
  42254  */
  42255 int bcm_esw_field_qualify_HiGigExtendedHeaderPresent_get(
  42256     int unit, 
  42257     bcm_field_entry_t entry, 
  42258     uint8 *data, 
  42259     uint8 *mask)
  42260 {
  42261     int rv = BCM_E_UNAVAIL; 
  42262 
  42263 #if defined BCM_TOMAHAWK_SUPPORT
  42264     /* Read qualifier match value and mask. */
  42265     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  42266                         bcmFieldQualifyHiGigExtendedHeaderPresent, data, mask);
  42267 #endif
  42268     return rv;
  42269 }
  42270 
  42271 /*
  42272  * Function:
  42273  *      bcm_esw_field_qualify_HiGigVpLagFailoverPacket
  42274  *      Set match criteria for bcmFieldQualifyHiGigVpLagFailoverPacket
  42275  *      qualifier in the field entry.
  42276  * Parameters:
  42277  *      unit    -   (IN) Unit number.
  42278  *      entry   -   (IN) BCM field entry id.
  42279  *      data    -   (IN) Qualifier match data.
  42280  *      mask    -   (IN) Qualifier match mask.
  42281  * Returns:
  42282  *      BCM_E_XXX
  42283  * Notes:
  42284  */
  42285 int bcm_esw_field_qualify_HiGigVpLagFailoverPacket(
  42286     int unit, 
  42287     bcm_field_entry_t entry, 
  42288     uint8 data, 
  42289     uint8 mask) 
  42290 {
  42291     int rv = BCM_E_UNAVAIL; 
  42292 
  42293 #if defined BCM_TOMAHAWK_SUPPORT
  42294 
  42295     
  42296     FP_LOCK(unit);
  42297     
  42298     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigVpLagFailoverPacket, 
  42299                           data, mask);
  42300 
  42301     FP_UNLOCK(unit);    
  42302 #endif
  42303     return rv;
  42304 }
  42305 
  42306 /*
  42307  * Function:
  42308  *      bcm_esw_field_qualify_HiGigVpLagFailoverPacket_get
  42309  *      Get match criteria for bcmFieldQualifyHiGigVpLagFailoverPacket
  42310  *      qualifier from the field entry.
  42311  * Parameters:
  42312  *      unit    - (IN) Unit number.
  42313  *      entry   - (IN) BCM field entry id.
  42314  *      data    - (OUT) Qualifier match data.
  42315  *      mask    - (OUT) Qualifier match mask.
  42316  * Returns:
  42317  *      BCM_E_XXX
  42318  * Notes:
  42319  */
  42320 int bcm_esw_field_qualify_HiGigVpLagFailoverPacket_get(
  42321     int unit, 
  42322     bcm_field_entry_t entry, 
  42323     uint8 *data, 
  42324     uint8 *mask)
  42325 {
  42326     int rv = BCM_E_UNAVAIL; 
  42327 
  42328 #if defined BCM_TOMAHAWK_SUPPORT
  42329     /* Read qualifier match value and mask. */
  42330     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  42331                         bcmFieldQualifyHiGigVpLagFailoverPacket, data, mask);
  42332 #endif
  42333     return rv;
  42334 }
  42335 
  42336 /*
  42337  * Function:
  42338  *      bcm_esw_field_qualify_HiGigForwardingType
  42339  *      Set match criteria for bcmFieldQualifyHiGigForwardingType
  42340  *      qualifier in the field entry.
  42341  * Parameters:
  42342  *      unit    -   (IN) Unit number.
  42343  *      entry   -   (IN) BCM field entry id.
  42344  *      data    -   (IN) Qualifier match data.
  42345  *      mask    -   (IN) Qualifier match mask.
  42346  * Returns:
  42347  *      BCM_E_XXX
  42348  * Notes:
  42349  */
  42350 int bcm_esw_field_qualify_HiGigForwardingType(
  42351     int unit, 
  42352     bcm_field_entry_t entry, 
  42353     bcm_field_HiGigForwardingType_t type) 
  42354 {
  42355     int rv = BCM_E_UNAVAIL; 
  42356 
  42357 #if defined BCM_TOMAHAWK_SUPPORT
  42358     uint32            data = 0; /* HW qualifier value.         */
  42359     uint32            mask = 0; /* HW qualifier mask.          */
  42360     
  42361     if (type >= bcmFieldHiGigForwardingTypeCount) {
  42362         return (BCM_E_PARAM);
  42363     }
  42364 
  42365     
  42366     
  42367     switch (type) {
  42368         case bcmFieldHiGigForwardingTypeControlPacket:
  42369             data = 0;
  42370             mask = 7;
  42371             break;
  42372         case bcmFieldHiGigForwardingTypeKnownL2:
  42373             data = 4;
  42374             mask = 7;
  42375             break;
  42376         case bcmFieldHiGigForwardingTypeKnownL3:
  42377             data = 2;
  42378             mask = 7;
  42379             break;
  42380         case bcmFieldHiGigForwardingTypeUnknownL2Multicast:
  42381             data = 5;
  42382             mask = 7;
  42383             break;
  42384         case bcmFieldHiGigForwardingTypeUnknownL3Multicast:
  42385             data = 3;
  42386             mask = 7;
  42387             break;
  42388         case bcmFieldHiGigForwardingTypeBroadcastOnUnknownL2Unicast:
  42389             data = 6;
  42390             mask = 7;
  42391             break;
  42392         case bcmFieldHiGigForwardingTypeBroadcast:
  42393             data = 7;
  42394             mask = 7;
  42395             break;
  42396         default:
  42397             return (BCM_E_PARAM);
  42398     }
  42399     
  42400     FP_LOCK(unit);
  42401 
  42402     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigForwardingType,
  42403                           data, mask);
  42404 
  42405     FP_UNLOCK(unit);
  42406 #endif
  42407     return rv;
  42408 }
  42409 
  42410 /*
  42411  * Function:
  42412  *      bcm_esw_field_qualify_HiGigForwardingType_get
  42413  *      Get match criteria for bcmFieldQualifyHiGigForwardingType
  42414  *      qualifier from the field entry.
  42415  * Parameters:
  42416  *      unit    - (IN) Unit number.
  42417  *      entry   - (IN) BCM field entry id.
  42418  *      data    - (OUT) Qualifier match data.
  42419  *      mask    - (OUT) Qualifier match mask.
  42420  * Returns:
  42421  *      BCM_E_XXX
  42422  * Notes:
  42423  */
  42424 int bcm_esw_field_qualify_HiGigForwardingType_get(
  42425     int unit, 
  42426     bcm_field_entry_t entry, 
  42427     bcm_field_HiGigForwardingType_t *type)
  42428 {
  42429     int rv = BCM_E_UNAVAIL; 
  42430 
  42431 #if defined BCM_TOMAHAWK_SUPPORT
  42432     uint32            data;   /* HW qualifier value.         */
  42433     uint32            mask;   /* HW qualifier mask.          */
  42434 
  42435     /* Input parameters check. */
  42436     if (NULL == type) {
  42437         return (BCM_E_PARAM);
  42438     }
  42439 
  42440     /* Read qualifier match value and mask. */
  42441     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  42442                             bcmFieldQualifyHiGigForwardingType,
  42443                             &data, &mask);
  42444     BCM_IF_ERROR_RETURN(rv);
  42445 
  42446     if ((0 == data) && (mask == 7)) {
  42447         *type = bcmFieldHiGigForwardingTypeControlPacket;
  42448     } else if ((4 == data) && (mask == 7)) {
  42449         *type = bcmFieldHiGigForwardingTypeKnownL2;
  42450     } else if ((2 == data) && (mask == 7)) {
  42451         *type = bcmFieldHiGigForwardingTypeKnownL3;
  42452     } else if ((5 == data) && (mask == 7)) {
  42453         *type = bcmFieldHiGigForwardingTypeUnknownL2Multicast;
  42454     } else if ((3 == data) && (mask == 7)) {
  42455         *type = bcmFieldHiGigForwardingTypeUnknownL3Multicast;
  42456     } else if ((6 == data) && (mask == 7)) {
  42457         *type = bcmFieldHiGigForwardingTypeBroadcastOnUnknownL2Unicast;
  42458     } else if ((7 == data) && (mask == 7)) {
  42459         *type = bcmFieldHiGigForwardingTypeBroadcast;
  42460     } else {
  42461         return (BCM_E_INTERNAL);
  42462     }
  42463     rv = BCM_E_NONE;
  42464 #endif
  42465     return rv;
  42466 }
  42467 
  42468 /*
  42469  * Function:
  42470  *      bcm_esw_field_qualify_HiGigOffloadEngineDeferredFlags
  42471  *      Set match criteria for bcmFieldQualifyHiGigOffloadEngineDeferredFlags
  42472  *      qualifier in the field entry.
  42473  * Parameters:
  42474  *      unit    -   (IN) Unit number.
  42475  *      entry   -   (IN) BCM field entry id.
  42476  *      data    -   (IN) Qualifier match data.
  42477  *      mask    -   (IN) Qualifier match mask.
  42478  * Returns:
  42479  *      BCM_E_XXX
  42480  * Notes:
  42481  */
  42482 int bcm_esw_field_qualify_HiGigOffloadEngineDeferredFlags(
  42483     int unit, 
  42484     bcm_field_entry_t entry, 
  42485     uint8 data, 
  42486     uint8 mask) 
  42487 {
  42488     int rv = BCM_E_UNAVAIL; 
  42489 
  42490 #if defined BCM_TOMAHAWK_SUPPORT
  42491     uint32 hw_data = 0;
  42492     uint32 hw_mask = 0;
  42493     const uint32  data_max = BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_DROP | 
  42494                              BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_CHANGE_PKT_PRIORITY |
  42495                              BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_CHANGE_DSCP;
  42496 
  42497     /*Input parameters check.*/
  42498     if (data > data_max) {
  42499         return (BCM_E_PARAM);
  42500     }
  42501 
  42502     if (data & BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_DROP) {
  42503         hw_data |= 1;
  42504         hw_mask |= 1;
  42505     }
  42506     
  42507     if (data & BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_CHANGE_PKT_PRIORITY) {
  42508         hw_data |= 1 << 1;
  42509         hw_mask |= 1 << 1;
  42510     }
  42511     
  42512     if (data & BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_CHANGE_DSCP) {
  42513         hw_data |= 1 << 2;
  42514         hw_mask |= 1 << 2;
  42515     }
  42516     
  42517     
  42518     FP_LOCK(unit);
  42519     
  42520     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigOffloadEngineDeferredFlags, 
  42521                           hw_data, hw_mask);
  42522 
  42523     FP_UNLOCK(unit);    
  42524 #endif
  42525     return rv;
  42526 }
  42527 
  42528 /*
  42529  * Function:
  42530  *      bcm_esw_field_qualify_HiGigOffloadEngineDeferredFlags_get
  42531  *      Get match criteria for bcmFieldQualifyHiGigOffloadEngineDeferredFlags
  42532  *      qualifier from the field entry.
  42533  * Parameters:
  42534  *      unit    - (IN) Unit number.
  42535  *      entry   - (IN) BCM field entry id.
  42536  *      data    - (OUT) Qualifier match data.
  42537  *      mask    - (OUT) Qualifier match mask.
  42538  * Returns:
  42539  *      BCM_E_XXX
  42540  * Notes:
  42541  */
  42542 int bcm_esw_field_qualify_HiGigOffloadEngineDeferredFlags_get(
  42543     int unit, 
  42544     bcm_field_entry_t entry, 
  42545     uint8 *data, 
  42546     uint8 *mask)
  42547 {
  42548     int rv = BCM_E_UNAVAIL; 
  42549 
  42550 #if defined BCM_TOMAHAWK_SUPPORT
  42551     uint8 hw_data = 0;
  42552     uint8 hw_mask = 0;
  42553 
  42554     if((data == NULL) || (mask == NULL)) {
  42555         return BCM_E_PARAM; 
  42556     }
  42557 
  42558     /* Read qualifier match value and mask. */
  42559     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  42560                         bcmFieldQualifyHiGigOffloadEngineDeferredFlags, &hw_data, &hw_mask);
  42561     
  42562     if ((hw_data & 1) && (hw_mask & 1))  {
  42563         *data |= BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_DROP;
  42564         *mask |= BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_DROP;
  42565     }
  42566     if ((hw_data & (1 << 1)) && (hw_mask & (1 << 1))) {
  42567         *data |= BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_CHANGE_PKT_PRIORITY;
  42568         *mask |= BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_CHANGE_PKT_PRIORITY;
  42569     }
  42570     if ((hw_data & (1 << 2)) && (hw_mask & (1 << 2))) {
  42571         *data |= BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_CHANGE_DSCP;
  42572         *mask |= BCM_FIELD_HIGIG_OFFLOAD_ENGINE_DEFERRED_CHANGE_DSCP;
  42573     }
  42574 #endif
  42575     return rv;
  42576 }
  42577 
  42578 /*
  42579  * Function:
  42580  *      bcm_esw_field_qualify_HiGigOffloadEngineVxltStatus
  42581  *      Set match criteria for bcmFieldQualifyHiGigOffloadEngineVxltStatus
  42582  *      qualifier in the field entry.
  42583  * Parameters:
  42584  *      unit    -   (IN) Unit number.
  42585  *      entry   -   (IN) BCM field entry id.
  42586  *      data    -   (IN) Qualifier match data.
  42587  *      mask    -   (IN) Qualifier match mask.
  42588  * Returns:
  42589  *      BCM_E_XXX
  42590  * Notes:
  42591  */
  42592 int bcm_esw_field_qualify_HiGigOffloadEngineVxltStatus(
  42593     int unit, 
  42594     bcm_field_entry_t entry, 
  42595     uint8 data, 
  42596     uint8 mask) 
  42597 {
  42598     int rv = BCM_E_UNAVAIL; 
  42599 
  42600 #if defined BCM_TOMAHAWK_SUPPORT
  42601 
  42602     
  42603     FP_LOCK(unit);
  42604 
  42605     rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigOffloadEngineVxltStatus,
  42606             data, mask);
  42607     FP_UNLOCK(unit);
  42608 #endif
  42609     return rv;
  42610 }
  42611 
  42612 /*
  42613  * Function:
  42614  *      bcm_esw_field_qualify_HiGigOffloadEngineVxltStatus_get
  42615  *      Get match criteria for bcmFieldQualifyHiGigOffloadEngineVxltStatus
  42616  *      qualifier from the field entry.
  42617  * Parameters:
  42618  *      unit    - (IN) Unit number.
  42619  *      entry   - (IN) BCM field entry id.
  42620  *      data    - (OUT) Qualifier match data.
  42621  *      mask    - (OUT) Qualifier match mask.
  42622  * Returns:
  42623  *      BCM_E_XXX
  42624  * Notes:
  42625  */
  42626 int bcm_esw_field_qualify_HiGigOffloadEngineVxltStatus_get(
  42627     int unit, 
  42628     bcm_field_entry_t entry, 
  42629     uint8 *data, 
  42630     uint8 *mask)
  42631 {
  42632     int rv = BCM_E_UNAVAIL; 
  42633 
  42634 #if defined BCM_TOMAHAWK_SUPPORT
  42635     /* Read qualifier match value and mask. */
  42636     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  42637                         bcmFieldQualifyHiGigOffloadEngineVxltStatus, 
  42638                         data, mask);
  42639 #endif
  42640     return rv;
  42641 }
  42642 
  42643 
  42644 /*
  42645  * Function: bcm_esw_field_presel_get
  42646  *
  42647  * Purpose:
  42648  *     Retrieve the set of preselectors associated with the given group.
  42649  *
  42650  * Parameters:
  42651  *     unit      - (IN)  BCM device number.
  42652  *     group     - (IN)  Group Id.
  42653  *     presel    - (OUT) Reference to the set of preselectors. 
  42654  *
  42655  * Returns:
  42656  *     BCM_E_PARAM    - if presel_id == NULL or given group Id is not valid.
  42657  *     BCM_E_UNAVAIL  - not supported
  42658  *     BCM_E_NONE     - Success
  42659  */
  42660 
  42661 int
  42662 bcm_esw_field_group_presel_get(
  42663     int unit,
  42664     bcm_field_group_t group,
  42665     bcm_field_presel_set_t *presel)
  42666 {
  42667     int                  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  42668 
  42669 #if defined(BCM_TOMAHAWK_SUPPORT)
  42670     if (soc_feature(unit, soc_feature_field_preselector_support)) {
  42671 
  42672        /* Get field control structure. */
  42673        
  42674        FP_LOCK(unit);
  42675        rv = (_bcm_field_th_group_presel_get(unit, group, presel));
  42676        FP_UNLOCK(unit);
  42677     }
  42678 #endif /* BCM_TOMAHAWK_SUPPORT */
  42679 
  42680     return rv;
  42681 }
  42682 
  42683 /*
  42684  * Function: bcm_esw_field_presel_set
  42685  *
  42686  * Purpose:
  42687  *     Set the preselectors to the given group.
  42688  *
  42689  * Parameters:
  42690  *     unit      - (IN) BCM device number.
  42691  *     group     - (IN) Group Id.
  42692  *     presel    - (IN) Reference to the set of preselectors. 
  42693  *
  42694  * Returns:
  42695  *     BCM_E_PARAM     - if presel_id == NULL
  42696  *     BCM_E_UNAVAIL   - not supported
  42697  *     BCM_E_NOT_FOUND - if the presel Ids are not created.
  42698  *     BCM_E_INTERNAL   - in-case of internal functionality issues.
  42699  *     BCM_E_NONE      - Success
  42700  */
  42701 
  42702 int
  42703 bcm_esw_field_group_presel_set(
  42704     int unit,
  42705     bcm_field_group_t group,
  42706     bcm_field_presel_set_t *presel)
  42707 {
  42708     int                  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  42709 
  42710 #if defined(BCM_TOMAHAWK_SUPPORT)
  42711     if (soc_feature(unit, soc_feature_field_preselector_support)) {
  42712 
  42713        /* Get field control structure. */
  42714        
  42715        FP_LOCK(unit);
  42716        rv = (_bcm_field_th_group_presel_set(unit, group, presel));
  42717        FP_UNLOCK(unit);
  42718     }
  42719 #endif /* BCM_TOMAHAWK_SUPPORT */
  42720 
  42721     return rv;
  42722 }
  42723 
  42724 /*
  42725  * Function: bcm_esw_field_presel_create
  42726  *
  42727  * Purpose:
  42728  *     Create an unique new field preselector Id.
  42729  *
  42730  * Parameters:
  42731  *     unit      - (IN)  BCM device number.
  42732  *     presel_id - (OUT) Reference to a new preselector ID to be created
  42733  *
  42734  * Returns:
  42735  *     BCM_E_PARAM    - if presel_id == NULL
  42736  *     BCM_E_UNAVAIL  - not supported
  42737  *     BCM_E_NONE     - Success
  42738  */
  42739 
  42740 int
  42741 bcm_esw_field_presel_create(
  42742     int unit,
  42743     bcm_field_presel_t *presel_id)
  42744 {
  42745     int                  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  42746 
  42747 #if defined(BCM_TOMAHAWK_SUPPORT)
  42748     if (soc_feature(unit, soc_feature_field_preselector_support)) {
  42749 
  42750        /* Get field control structure. */
  42751        
  42752        FP_LOCK(unit);
  42753        rv = (_bcm_field_th_presel_create(unit, 0, presel_id));
  42754        FP_UNLOCK(unit);
  42755     }
  42756 #endif /* BCM_TOMAHAWK_SUPPORT */
  42757 
  42758     return rv;
  42759 }
  42760 
  42761 /*
  42762  * Function: bcm_esw_field_presel_create_id
  42763  *
  42764  * Purpose:
  42765  *     Create the requested field preselector Id.
  42766  *
  42767  * Parameters:
  42768  *     unit      - (IN) BCM device number.
  42769  *     presel_id - (IN) A new preselector ID to be created
  42770  *
  42771  * Returns:
  42772  *     BCM_E_PARAM    - if the given presel_id is not valid.
  42773  *     BCM_E_UNAVAIL  - not supported
  42774  *     BCM_E_NONE     - Success
  42775  */
  42776 int
  42777 bcm_esw_field_presel_create_id(
  42778     int unit,
  42779     bcm_field_presel_t presel_id)
  42780 
  42781 {
  42782     int                  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  42783 
  42784 #if defined(BCM_TOMAHAWK_SUPPORT)
  42785     if (soc_feature(unit, soc_feature_field_preselector_support)) {
  42786 
  42787        /* Get field control structure. */
  42788        
  42789        FP_LOCK(unit);
  42790 
  42791        rv = (_bcm_field_th_presel_create(unit, _bcmFieldPreselCreateWithId,
  42792                                          &presel_id));
  42793        FP_UNLOCK(unit);
  42794     }
  42795 #endif /* BCM_TOMAHAWK_SUPPORT */
  42796 
  42797     return rv;
  42798 }
  42799 
  42800 /*
  42801  * Function: bcm_esw_field_presel_destroy
  42802  *
  42803  * Purpose:
  42804  *     Destroy the requested field preselector Id.
  42805  *
  42806  * Parameters:
  42807  *     unit      - (IN) BCM device number.
  42808  *     presel_id - (IN) A new preselector ID to be destroyed
  42809  *
  42810  * Returns:
  42811  *     BCM_E_PARAM   - if the given presel_id is not valid.
  42812  *     BCM_E_UNAVAIL - not supported
  42813  *     BCM_E_BUSY    - If the presel is already in use by a group.
  42814  *     BCM_E_NONE    - Success
  42815  */
  42816 int
  42817 bcm_esw_field_presel_destroy(
  42818     int unit,
  42819     bcm_field_presel_t presel_id)
  42820 {
  42821     int                  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  42822 
  42823 #if defined(BCM_TOMAHAWK_SUPPORT)
  42824     if (soc_feature(unit, soc_feature_field_preselector_support)) {
  42825 
  42826        /* Get field control structure. */
  42827        
  42828        FP_LOCK(unit);
  42829        rv = (_bcm_field_th_presel_destroy(unit, presel_id));
  42830        FP_UNLOCK(unit);
  42831     }
  42832 #endif /* BCM_TOMAHAWK_SUPPORT */
  42833 
  42834     return rv;
  42835 }
  42836  
  42837 /*
  42838  * Function: bcm_esw_field_qualify_Stage
  42839  *
  42840  * Purpose:
  42841  *     Set match criteria for bcmFieldQualifyStage
  42842  *     qualifier in the field entry.
  42843  *
  42844  * Parameters:
  42845  *      unit  - (IN) Unit number.
  42846  *      entry - (IN) BCM field entry id.
  42847  *      data  - (IN) Stage Qualifier match data.
  42848  *
  42849  * Returns:
  42850  *      BCM_E_XXX
  42851  * Notes:
  42852  */
  42853 int
  42854 bcm_esw_field_qualify_Stage(
  42855     int unit, 
  42856     bcm_field_entry_t entry, 
  42857     bcm_field_stage_t data)
  42858 {
  42859     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  42860 
  42861 #if defined(BCM_TOMAHAWK_SUPPORT)
  42862     if (soc_feature(unit, soc_feature_field_preselector_support) &&
  42863         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
  42864        uint32               data32, mask32;
  42865 
  42866        /* Get field control structure. */
  42867        
  42868        FP_LOCK(unit);
  42869        data32 = mask32 = data;
  42870        /* coverity[address_of : FALSE] */
  42871        /* coverity[callee_ptr_arith : FALSE] */
  42872        rv = _bcm_field_presel_qualify_set(unit, entry,
  42873                                           bcmFieldQualifyStage,
  42874                                           &data32, &mask32);
  42875        FP_UNLOCK(unit);
  42876     }
  42877 #endif /* BCM_TOMAHAWK_SUPPORT */
  42878 
  42879     return rv;
  42880 }
  42881 
  42882 /*
  42883  * Function: bcm_esw_field_qualify_Stage_get
  42884  *
  42885  * Purpose:
  42886  *     Retrieve the stage qualifier configured for the given entry.
  42887  *
  42888  * Parameters:
  42889  *      unit  - (IN) Unit number.
  42890  *      entry - (IN) BCM field entry id.
  42891  *      data  - (OUT) Stage Qualifier match data.
  42892  *
  42893  * Returns:
  42894  *      BCM_E_XXX
  42895  * Notes:
  42896  */
  42897 int
  42898 bcm_esw_field_qualify_Stage_get(
  42899     int unit, 
  42900     bcm_field_entry_t entry, 
  42901     bcm_field_stage_t *data)
  42902 {
  42903     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  42904 
  42905 #if defined(BCM_TOMAHAWK_SUPPORT)
  42906     if (soc_feature(unit, soc_feature_field_preselector_support) &&
  42907         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
  42908        _bcm_field_qual_data_t q_data = {0};
  42909        _bcm_field_qual_data_t q_mask = {0};
  42910 
  42911        /* Get field control structure. */
  42912        
  42913        FP_LOCK(unit);
  42914        rv = _bcm_field_presel_qualifier_get(unit, entry,
  42915                                             bcmFieldQualifyStage,
  42916                                             q_data, q_mask);
  42917        *data = q_data[0];
  42918        FP_UNLOCK(unit);
  42919     }
  42920 #endif /* BCM_TOMAHAWK_SUPPORT */
  42921 
  42922     return rv;
  42923 }
  42924 
  42925 /* Function    : bcm_esw_field_qualify_IpFragNonOrFirst
  42926  * Description : qualify on Ip Frag Info.
  42927  * Parameters  : (IN) unit       BCM device number
  42928  *               (IN) entry      Field entry to qualify
  42929  *               (IN) data       Matching data
  42930  *               (IN) mask       Bit mask for data
  42931  * Returns     : BCM_E_XXX
  42932  */
  42933 int bcm_esw_field_qualify_IpFragNonOrFirst(int unit, bcm_field_entry_t entry,
  42934                                   uint8 data, uint8 mask)
  42935 {
  42936     int             rv = BCM_E_UNAVAIL;
  42937 #if defined(BCM_TOMAHAWK_SUPPORT)
  42938 
  42939     if (data > 0x1) {
  42940         return (BCM_E_PARAM);
  42941     }
  42942 
  42943     
  42944     FP_LOCK(unit);
  42945 
  42946     rv = _field_qualify32(unit, entry, bcmFieldQualifyIpFragNonOrFirst, data, mask);
  42947     FP_UNLOCK(unit);
  42948 #endif /* BCM_TOMAHAWK_SUPPORT */
  42949     return (rv);
  42950 }
  42951 
  42952 /* Function    : bcm_esw_field_qualify_IpFragNonOrFirst_get
  42953  * Description : qualify on Ip Frag Info.
  42954  * Parameters  : (IN) unit       BCM device number
  42955  *               (IN) entry      Field entry to qualify
  42956  *               (OUT) data       Matching data
  42957  *               (OUT) mask       Bit mask for data
  42958  * Returns     : BCM_E_XXX
  42959  */
  42960 int bcm_esw_field_qualify_IpFragNonOrFirst_get(int unit, bcm_field_entry_t entry,
  42961                                   uint8 *data, uint8 *mask)
  42962 {
  42963     int             rv = BCM_E_UNAVAIL;
  42964 #if defined(BCM_TOMAHAWK_SUPPORT)
  42965     /* Input parameters check. */
  42966     if ((NULL == data) || (NULL ==mask)) {
  42967         return (BCM_E_PARAM);
  42968     }
  42969 
  42970     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, bcmFieldQualifyIpFragNonOrFirst, data, mask);
  42971 #endif /* BCM_TOMAHAWK_SUPPORT */
  42972     return (rv);
  42973 }
  42974 
  42975 /* Function    : bcm_esw_field_qualify_PacketLength
  42976  * Description : qualify on Packet Length (excluding L2 header and VLAN TAG).
  42977  * Parameters  : (IN) unit       BCM device number
  42978  *               (IN) entry      Field entry to qualify
  42979  *               (IN) data       Matching data
  42980  *               (IN) mask       Bit mask for data
  42981  * Returns     : BCM_E_XXX
  42982  */
  42983 int bcm_esw_field_qualify_PacketLength(int unit, bcm_field_entry_t entry,
  42984                                   uint16 data, uint16 mask)
  42985 {
  42986     int             rv = BCM_E_UNAVAIL;
  42987 #if defined(BCM_TOMAHAWK_SUPPORT)
  42988 
  42989     
  42990     FP_LOCK(unit);
  42991 
  42992     rv = _field_qualify32(unit, entry, bcmFieldQualifyPacketLength, data, mask);
  42993     FP_UNLOCK(unit);
  42994 #endif /* BCM_TOMAHAWK_SUPPORT */
  42995     return (rv);
  42996 }
  42997 
  42998 /* Function    : bcm_esw_field_qualify_PacketLength_get
  42999  * Description : qualify on Packet Length (excluding L2 header and VLAN TAG).
  43000  * Parameters  : (IN) unit       BCM device number
  43001  *               (IN) entry      Field entry to qualify
  43002  *               (OUT) data       Matching data
  43003  *               (OUT) mask       Bit mask for data
  43004  * Returns     : BCM_E_XXX
  43005  */
  43006 int bcm_esw_field_qualify_PacketLength_get(int unit, bcm_field_entry_t entry,
  43007                                   uint16 *data, uint16 *mask)
  43008 {
  43009     int             rv = BCM_E_UNAVAIL;
  43010 #if defined(BCM_TOMAHAWK_SUPPORT)
  43011     /* Input parameters check. */
  43012     if ((NULL == data) || (NULL == mask)) {
  43013         return (BCM_E_PARAM);
  43014     }
  43015 
  43016     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, bcmFieldQualifyPacketLength, data, mask);
  43017 #endif /* BCM_TOMAHAWK_SUPPORT */
  43018     return (rv);
  43019 }
  43020 
  43021 /*
  43022  * Function:
  43023  *     bcm_esw_field_qualify_GroupClass
  43024  *
  43025  * Purpose:
  43026  *     Set a Group class id packet qualification on an entry.
  43027  *
  43028  * Parameters:
  43029  *     unit     - (IN) BCM unit number
  43030  *     entry    - (IN) Entry ID
  43031  *     data     - (IN) Group Class id.
  43032  *     mask     - (IN) Group Class mask.
  43033  *
  43034  * Returns:
  43035  *     BCM_E_XXX
  43036  */
  43037 int
  43038 bcm_esw_field_qualify_GroupClass(int unit, bcm_field_entry_t entry,
  43039                                          uint32 data, uint32 mask)
  43040 {
  43041 
  43042     int             rv = BCM_E_UNAVAIL;
  43043 #if defined(BCM_TOMAHAWK_SUPPORT)
  43044 
  43045     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  43046         BCM_IF_ERROR_RETURN
  43047               (_bcm_field_th_qualify_class(unit, entry,
  43048                                            bcmFieldQualifyGroupClass,
  43049                                            &data, &mask));
  43050     }
  43051 
  43052     
  43053     FP_LOCK(unit);
  43054 
  43055     rv = _field_qualify32(unit, entry, bcmFieldQualifyGroupClass,
  43056                           data, mask);
  43057     FP_UNLOCK(unit);
  43058 #endif
  43059     return (rv);
  43060 }
  43061 
  43062 /*
  43063  * Function:
  43064  *      bcm_esw_field_qualify_GroupClass_get
  43065  * Purpose:
  43066  *      Get match criteria for bcmFieildQualifGroupClass
  43067  *                     qualifier from the field entry.
  43068  * Parameters:
  43069  *      unit - (IN) Unit number.
  43070  *      entry - (IN) BCM field entry id.
  43071  *      data - (OUT) Qualifier match data.
  43072  *      mask - (OUT) Qualifier match mask.
  43073  * Returns:
  43074  *      BCM_E_XXX
  43075  * Notes:
  43076  */
  43077 int
  43078 bcm_esw_field_qualify_GroupClass_get(
  43079     int unit,
  43080     bcm_field_entry_t entry,
  43081     uint32 *data,
  43082     uint32 *mask)
  43083 {
  43084     /* Read qualifier match value and mask. */
  43085     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  43086                 entry,
  43087                 bcmFieldQualifyGroupClass,
  43088                 data,
  43089                 mask
  43090                 ));
  43091 
  43092     return (BCM_E_NONE);
  43093 }
  43094 
  43095 /*
  43096  * Function:
  43097  *     bcm_esw_field_qualify_UdfClass
  43098  *
  43099  * Purpose:
  43100  *     Set a Udf class id packet qualification on an entry.
  43101  *
  43102  * Parameters:
  43103  *     unit     - (IN) BCM unit number
  43104  *     entry    - (IN) Entry ID
  43105  *     data     - (IN) UDF Class id.
  43106  *     mask     - (IN) UDF Class mask.
  43107  *
  43108  * Returns:
  43109  *     BCM_E_XXX
  43110  */
  43111 int
  43112 bcm_esw_field_qualify_UdfClass(int unit, bcm_field_entry_t entry,
  43113                                          uint32 data, uint32 mask)
  43114 {
  43115 
  43116     int             rv = BCM_E_UNAVAIL;
  43117 #if defined(BCM_TOMAHAWK_SUPPORT)
  43118 
  43119     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  43120         BCM_IF_ERROR_RETURN
  43121               (_bcm_field_th_qualify_class(unit, entry,
  43122                                            bcmFieldQualifyUdfClass,
  43123                                            &data, &mask));
  43124     }
  43125 
  43126     
  43127     FP_LOCK(unit);
  43128 
  43129     rv = _field_qualify32(unit, entry, bcmFieldQualifyUdfClass,
  43130                           data, mask);
  43131     FP_UNLOCK(unit);
  43132 #endif
  43133     return (rv);
  43134 }
  43135 
  43136 /*
  43137  * Function:
  43138  *      bcm_esw_field_qualify_UdfClass_get
  43139  * Purpose:
  43140  *      Get match criteria for bcmFieildQualifUdfClass
  43141  *                     qualifier from the field entry.
  43142  * Parameters:
  43143  *      unit - (IN) Unit number.
  43144  *      entry - (IN) BCM field entry id.
  43145  *      data - (OUT) Qualifier match data.
  43146  *      mask - (OUT) Qualifier match mask.
  43147  * Returns:
  43148  *      BCM_E_XXX
  43149  * Notes:
  43150  */
  43151 int
  43152 bcm_esw_field_qualify_UdfClass_get(
  43153     int unit,
  43154     bcm_field_entry_t entry,
  43155     uint32 *data,
  43156     uint32 *mask)
  43157 {
  43158     /* Read qualifier match value and mask. */
  43159     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  43160                 entry,
  43161                 bcmFieldQualifyUdfClass,
  43162                 data,
  43163                 mask
  43164                 ));
  43165 
  43166     return (BCM_E_NONE);
  43167 }
  43168 
  43169 /*
  43170  * Function:
  43171  *     bcm_esw_field_qualify_InterfaceLookupClassPort
  43172  *
  43173  * Purpose:
  43174  *     Set a Port interface Lookup class id packet qualification on an entry.
  43175  *
  43176  * Parameters:
  43177  *     unit     - (IN) BCM unit number
  43178  *     entry    - (IN) Entry ID
  43179  *     data     - (IN) Interface Class id.
  43180  *     mask     - (IN) Interface Class mask.
  43181  *
  43182  * Returns:
  43183  *     BCM_E_XXX
  43184  */
  43185 int
  43186 bcm_esw_field_qualify_InterfaceLookupClassPort(int unit, bcm_field_entry_t entry,
  43187                                          uint32 data, uint32 mask)
  43188 {
  43189 
  43190     int             rv = BCM_E_UNAVAIL;
  43191 #if defined(BCM_TOMAHAWK_SUPPORT)
  43192 
  43193     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  43194         BCM_IF_ERROR_RETURN
  43195               (_bcm_field_th_qualify_class(unit, entry,
  43196                                            bcmFieldQualifyInterfaceLookupClassPort,
  43197                                            &data, &mask));
  43198     } else if (data  > SOC_INTF_CLASS_MAX(unit)) {
  43199         LOG_ERROR(BSL_LS_BCM_FP,
  43200                   (BSL_META_U(unit,
  43201                               "FP(unit %d) Error: data=%#x out-of-range\n"),
  43202                    unit, data));
  43203         return (BCM_E_PARAM);
  43204     }
  43205 
  43206     
  43207     FP_LOCK(unit);
  43208 
  43209     rv = _field_qualify32(unit, entry, bcmFieldQualifyInterfaceLookupClassPort,
  43210                           data, mask);
  43211     FP_UNLOCK(unit);
  43212 #endif
  43213     return (rv);
  43214 }
  43215 
  43216 /*
  43217  * Function:
  43218  *      bcm_esw_field_qualify_InterfaceLookupClassPort_get
  43219  * Purpose:
  43220  *      Get match criteria for bcmFieildQualifyInterfaceLookupClassPort
  43221  *                     qualifier from the field entry.
  43222  * Parameters:
  43223  *      unit - (IN) Unit number.
  43224  *      entry - (IN) BCM field entry id.
  43225  *      data - (OUT) Qualifier match data.
  43226  *      mask - (OUT) Qualifier match mask.
  43227  * Returns:
  43228  *      BCM_E_XXX
  43229  * Notes:
  43230  */
  43231 int
  43232 bcm_esw_field_qualify_InterfaceLookupClassPort_get(
  43233     int unit,
  43234     bcm_field_entry_t entry,
  43235     uint32 *data,
  43236     uint32 *mask)
  43237 {
  43238     /* Read qualifier match value and mask. */
  43239     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  43240                 entry,
  43241                 bcmFieldQualifyInterfaceLookupClassPort,
  43242                 data,
  43243                 mask
  43244                 ));
  43245 
  43246     return (BCM_E_NONE);
  43247 }
  43248 
  43249 /*
  43250  * Function:
  43251  *      bcm_esw_field_qualify_ExactMatchHitStatus
  43252  * Purpose:
  43253  *      Set a exact match hit status qualification on an entry.
  43254  * Parameters:
  43255  *      unit      - (IN) Unit number.
  43256  *      entry     - (IN) Field entry Id.
  43257  *      group_pri - (IN) Field Group Priority.
  43258  *      data      - (IN) Exact Match Hit Status.
  43259  *      mask      - (IN) Exact Match Hit Status Mask.
  43260  * Returns:
  43261  *      BCM_E_XXX
  43262  * Notes:
  43263  */
  43264 int
  43265 bcm_esw_field_qualify_ExactMatchHitStatus(int unit,
  43266                                           bcm_field_entry_t entry,
  43267                                           int group_pri,
  43268                                           uint8 data,
  43269                                           uint8 mask)
  43270 {
  43271     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  43272 #if defined BCM_TOMAHAWK_SUPPORT
  43273     uint8  lkup = 0;            /* Exact Match Group Lookup Information. */
  43274     
  43275     /* Retreive Field Control Information. */
  43276     
  43277 
  43278     /* Take Field Lock. */
  43279     FP_LOCK(unit);
  43280     
  43281     /* Get Exact Match Group Lookup Information. */
  43282     rv = _field_th_em_group_lookup_get(unit, group_pri, &lkup);
  43283     
  43284     /* If found, qualify for corresponding lookup information. */
  43285     if (BCM_SUCCESS(rv)) {
  43286         if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_0) {
  43287             rv = _field_qualify32(unit, entry, 
  43288                                   _bcmFieldQualifyExactMatchHitStatusLookup0,
  43289                                   data, mask);
  43290         } else if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_1) {
  43291             rv = _field_qualify32(unit, entry, 
  43292                                   _bcmFieldQualifyExactMatchHitStatusLookup1,
  43293                                   data, mask);
  43294         } else {
  43295             rv = BCM_E_INTERNAL; 
  43296         }
  43297     }
  43298     
  43299     /* Release Field Lock. */
  43300     FP_UNLOCK(unit);
  43301 #endif
  43302     return (rv);
  43303 }
  43304 
  43305 /*
  43306  * Function:
  43307  *      bcm_esw_field_qualify_ExactMatchHitStatus_get
  43308  * Purpose:
  43309  *      Get match criteria for bcmFieildQualifyExactMatchHitStatus
  43310  *                     qualifier from the field entry.
  43311  * Parameters:
  43312  *      unit      - (IN)  Unit number.
  43313  *      entry     - (IN)  Field entry Id.
  43314  *      group_pri - (IN)  Field Group Priority.
  43315  *      data      - (OUT) Exact Match Hit Status.
  43316  *      mask      - (OUT) Exact Match Hit Status Mask.
  43317  * Returns:
  43318  *      BCM_E_XXX
  43319  * Notes:
  43320  */
  43321 int
  43322 bcm_esw_field_qualify_ExactMatchHitStatus_get(int unit,
  43323                                               bcm_field_entry_t entry,
  43324                                               int group_pri,
  43325                                               uint8 *data,
  43326                                               uint8 *mask)
  43327 {
  43328     int rv = BCM_E_UNAVAIL;         /* Operation return status. */
  43329 #if defined BCM_TOMAHAWK_SUPPORT
  43330     uint8  lkup = 0;                /* Exact Match Group Lookup 
  43331                                        Information.             */
  43332     _bcm_field_qual_data_t q_data;  /* Qualifier match data.    */ 
  43333     _bcm_field_qual_data_t q_mask;  /* Qualifier match mask.    */
  43334 
  43335     /* Retreive Field Control Information. */
  43336     
  43337 
  43338     /* Input Parameter Check. */
  43339     if ((NULL == data) || (NULL == mask)) {
  43340         return (BCM_E_PARAM);
  43341     }
  43342 
  43343     /* Take Field Lock. */
  43344     FP_LOCK(unit);
  43345 
  43346     /* Get Exact Match Group Lookup Information. */
  43347     rv = _field_th_em_group_lookup_get(unit, group_pri, &lkup);
  43348 
  43349     /* If found, qualify for corresponding lookup information. */
  43350     if (BCM_SUCCESS(rv)) {
  43351         if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_0) {
  43352             rv = _field_entry_qualifier_key_get(unit, entry,
  43353                     _bcmFieldQualifyExactMatchHitStatusLookup0,
  43354                     q_data, q_mask);
  43355         } else if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_1) {
  43356             rv = _field_entry_qualifier_key_get(unit, entry,
  43357                     _bcmFieldQualifyExactMatchHitStatusLookup1,
  43358                     q_data, q_mask);
  43359         } else {
  43360             rv = BCM_E_INTERNAL;
  43361         }
  43362     }
  43363 
  43364     if (BCM_SUCCESS(rv)) {
  43365         *data = q_data[0];
  43366         *mask = q_mask[0];
  43367     }
  43368 
  43369     /* Release Field Lock. */
  43370     FP_UNLOCK(unit);
  43371 #endif
  43372     return (rv);
  43373 }
  43374 
  43375 /*
  43376  * Function:
  43377  *      bcm_esw_field_qualify_ExactMatchActionClassId
  43378  * Purpose:
  43379  *      Set a exact match action classid qualification on an entry.
  43380  * Parameters:
  43381  *      unit      - (IN) Unit number.
  43382  *      entry     - (IN) Field entry Id.
  43383  *      group_pri - (IN) Field Group Priority.
  43384  *      data      - (IN) Exact Match Action Class Id.
  43385  *      mask      - (IN) Exact Match Action Class Id Mask.
  43386  * Returns:
  43387  *      BCM_E_XXX
  43388  * Notes:
  43389  */
  43390 int
  43391 bcm_esw_field_qualify_ExactMatchActionClassId(int unit,
  43392                                               bcm_field_entry_t entry,
  43393                                               int group_pri,
  43394                                               uint32 data,
  43395                                               uint32 mask)
  43396 {
  43397     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  43398 #if defined BCM_TOMAHAWK_SUPPORT
  43399     uint8  lkup = 0;            /* Exact Match Group Lookup
  43400                                    Information.             */
  43401     /* Retreive Field Control Structure. */
  43402     
  43403     
  43404     FP_LOCK(unit);
  43405     
  43406     /* Retreive exact match group lookup information. */
  43407     rv = _field_th_em_group_lookup_get(unit, group_pri, &lkup);
  43408 
  43409     /* If found, qualify for corresponding lookup information. */ 
  43410     if (BCM_SUCCESS(rv)) {
  43411         if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_0) {
  43412             rv = _field_qualify32(unit, entry, 
  43413                                   _bcmFieldQualifyExactMatchActionClassIdLookup0, 
  43414                                   data, mask);
  43415         } else if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_1) {
  43416             rv = _field_qualify32(unit, entry, 
  43417                                   _bcmFieldQualifyExactMatchActionClassIdLookup1, 
  43418                                   data, mask);
  43419         } else {
  43420             rv = BCM_E_INTERNAL;
  43421         }
  43422     }
  43423     
  43424     FP_UNLOCK(unit);
  43425 #endif
  43426     return (rv);
  43427 }
  43428 
  43429 /*
  43430  * Function:
  43431  *      bcm_esw_field_qualify_ExactMatchActionClassId_get
  43432  * Purpose:
  43433  *      Get match criteria for bcmFieildQualifyExactMatchActionClassId
  43434  *                     qualifier from the field entry.
  43435  * Parameters:
  43436  *      unit      - (IN)  Unit number.
  43437  *      entry     - (IN)  Field entry Id.
  43438  *      group_pri - (IN)  Field Group Priority.
  43439  *      data      - (OUT) Exact Match Action Class Id.
  43440  *      mask      - (OUT) Exact Match Action Class Id Mask.
  43441  * Returns:
  43442  *      BCM_E_XXX
  43443  * Notes:
  43444  */
  43445 int
  43446 bcm_esw_field_qualify_ExactMatchActionClassId_get(int unit,
  43447                                                   bcm_field_entry_t entry,
  43448                                                   int group_pri,
  43449                                                   uint32 *data,
  43450                                                   uint32 *mask)
  43451 {
  43452     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  43453 #if defined BCM_TOMAHAWK_SUPPORT
  43454     uint8  lkup = 0;                 /* Exact Match Group Lookup
  43455                                         Information.             */
  43456     _bcm_field_qual_data_t q_data;   /* Qualifier match data.    */ 
  43457     _bcm_field_qual_data_t q_mask;   /* Qualifier match mask.    */
  43458 
  43459     /* Retreive field control structure. */
  43460     
  43461 
  43462     FP_LOCK(unit);
  43463 
  43464     /* Retreive exact match group lookup information. */
  43465     rv = _field_th_em_group_lookup_get(unit, group_pri, &lkup);
  43466 
  43467     /* If found, qualify for corresponding lookup information. */
  43468     if (BCM_SUCCESS(rv)) {
  43469         if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_0) {
  43470             rv = _field_entry_qualifier_key_get(unit, entry, 
  43471                                                 _bcmFieldQualifyExactMatchActionClassIdLookup0,
  43472                                                 q_data, q_mask);
  43473         } else if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_1) {
  43474             rv = _field_entry_qualifier_key_get(unit, entry, 
  43475                                                 _bcmFieldQualifyExactMatchActionClassIdLookup1,
  43476                                                 q_data, q_mask);
  43477         } else {
  43478             rv = BCM_E_INTERNAL;
  43479         }
  43480     }
  43481 
  43482     if (BCM_SUCCESS(rv)) {
  43483         *data = q_data[0];
  43484         *mask = q_mask[0];
  43485     }
  43486     FP_UNLOCK(unit);
  43487 #endif
  43488 
  43489 
  43490     return (rv);
  43491 }
  43492 
  43493 /*
  43494  * Function:
  43495  *      bcm_esw_field_qualify_ExactMatchGroupClassId
  43496  * Purpose:
  43497  *      Set a exact match group classid qualification on an entry.
  43498  * Parameters:
  43499  *      unit      - (IN) Unit number.
  43500  *      entry     - (IN) Field entry Id.
  43501  *      group_pri - (IN) Field Group Priority.
  43502  *      group     - (IN) Field group Id.
  43503  * Returns:
  43504  *      BCM_E_XXX
  43505  * Notes:
  43506  */
  43507 int
  43508 bcm_esw_field_qualify_ExactMatchGroupClassId(int unit,
  43509                                              bcm_field_entry_t entry,
  43510                                              int group_pri,
  43511                                              bcm_field_group_t group)
  43512 {
  43513     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  43514 #if defined BCM_TOMAHAWK_SUPPORT
  43515     uint8  lkup = 0;        /* Exact Match Group Lookup
  43516                                Information.             */
  43517     _field_group_t *fg;     /* Field Group Structure.   */
  43518 
  43519     /* Retreive Field Control Information. */
  43520     
  43521     
  43522     FP_LOCK(unit);
  43523    
  43524     /* Retreive exact match group lookup information. */   
  43525     rv = _field_th_em_group_lookup_get(unit, group_pri, &lkup);
  43526     
  43527     /* If found, qualify for corresponding lookup information. */
  43528     if (BCM_SUCCESS(rv)) {
  43529         rv = _field_group_get(unit, group, &fg);
  43530         if (BCM_SUCCESS(rv)) {
  43531             if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_0) {
  43532                 rv = _field_qualify32(unit, entry, 
  43533                                       _bcmFieldQualifyExactMatchGroupClassIdLookup0, 
  43534                                        fg->lt_id, -1);
  43535             } else if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_1) {
  43536                 rv = _field_qualify32(unit, entry, 
  43537                                       _bcmFieldQualifyExactMatchGroupClassIdLookup1, 
  43538                                       fg->lt_id, -1);
  43539             } else {
  43540                 rv = BCM_E_INTERNAL; 
  43541             }
  43542         }
  43543     }
  43544     
  43545     FP_UNLOCK(unit);
  43546 #endif
  43547     return (rv);
  43548 }
  43549 
  43550 /*
  43551  * Function:
  43552  *      bcm_esw_field_qualify_ExactMatchGroupClassId_get
  43553  * Purpose:
  43554  *      Get match criteria for bcmFieildQualifyExactMatchGroupClassId
  43555  *                     qualifier from the field entry.
  43556  * Parameters:
  43557  *      unit      - (IN)  Unit number.
  43558  *      entry     - (IN)  Field entry Id.
  43559  *      group_pri - (IN)  Field Group Priority.
  43560  *      group     - (OUT) Field Group Id.
  43561  * Returns:
  43562  *      BCM_E_XXX
  43563  * Notes:
  43564  */
  43565 int
  43566 bcm_esw_field_qualify_ExactMatchGroupClassId_get(int unit,
  43567                                                  bcm_field_entry_t entry,
  43568                                                  int group_pri,
  43569                                                  bcm_field_group_t *group)
  43570 {
  43571     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  43572 #if defined BCM_TOMAHAWK_SUPPORT
  43573     uint8  lkup = 0;                /* Exact Match Group Lookup
  43574                                        Information.             */
  43575     _bcm_field_qual_data_t q_data;  /* Qualifier match data.    */ 
  43576     _bcm_field_qual_data_t q_mask;  /* Qualifier match mask.    */
  43577     int ltid = -1;                  /* Logical Table Id.        */
  43578 
  43579     /* Retreive Field Control Information. */
  43580     
  43581     
  43582     FP_LOCK(unit);
  43583 
  43584     /* Retreive exact match group lookup information. */
  43585     rv = _field_th_em_group_lookup_get(unit, group_pri, &lkup);
  43586     
  43587     /* If found, qualify for corresponding lookup information. */   
  43588     if (BCM_SUCCESS(rv)) {
  43589         if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_0) {
  43590             rv = _field_entry_qualifier_key_get(unit, entry, 
  43591                                                 _bcmFieldQualifyExactMatchGroupClassIdLookup0, 
  43592                                                 q_data, q_mask);
  43593         } else if (lkup == BCM_FIELD_EXACT_MATCH_LOOKUP_1) {
  43594             rv = _field_entry_qualifier_key_get(unit, entry, 
  43595                                                 _bcmFieldQualifyExactMatchGroupClassIdLookup1, 
  43596                                                 q_data, q_mask);
  43597         } else {
  43598             rv = BCM_E_INTERNAL;
  43599         }
  43600     }
  43601 
  43602     if (BCM_SUCCESS(rv)) {
  43603         ltid = q_data[0];
  43604         /* Retreive Field Group Based on ltid. */
  43605         rv = _field_th_em_ltid_based_groupid_get(unit, ltid, group);
  43606     }
  43607 
  43608     FP_UNLOCK(unit);
  43609 #endif
  43610     return (rv);
  43611 }
  43612 
  43613 /*
  43614  * Function:
  43615  *      bcm_esw_field_source_class_mode_set
  43616  * Purpose:
  43617  *      Configure Field Processor Source Class operational mode
  43618  *      per-CAP stage.
  43619  * Parameters:
  43620  *      unit    - (IN) BCM Device number.
  43621  *      stage   - (IN) Field Stage enum value.
  43622  *      pbmp    - (IN) Device Port Bitmap value
  43623  *      mode    - (IN) Field Source Class Operational Mode enum value.
  43624  * Returns:
  43625  *      BCM_E_XXX
  43626  * Notes:
  43627  *      Valid "stage" input parameter values supported by
  43628  *      this API are:
  43629  * 	            "bcmFieldStageIngress"
  43630  *              "bcmFieldStageIngressExactMatch"
  43631  */
  43632 int
  43633 bcm_esw_field_source_class_mode_set(int unit,
  43634                                         bcm_field_stage_t stage,
  43635                                         bcm_pbmp_t pbmp,
  43636                                         bcm_field_src_class_mode_t mode)
  43637 {
  43638     int                      rv = BCM_E_UNAVAIL; /* Operation return status. */
  43639 #if defined(BCM_TOMAHAWK_SUPPORT)
  43640     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  43641        
  43642 
  43643        FP_LOCK(unit);
  43644        rv = (_bcm_field_th_source_class_mode_set(unit, stage, pbmp, mode));
  43645        FP_UNLOCK(unit);
  43646     }
  43647 #endif
  43648     return (rv);
  43649 }
  43650 
  43651 /*
  43652  * Function:
  43653  *      bcm_esw_field_source_class_mode_get
  43654  * Purpose:
  43655  *      Retrieve Field Processor Source Class operational mode
  43656  *      per-CAP stage.
  43657  * Parameters:
  43658  *      unit    - (IN)  BCM Device number.
  43659  *      stage   - (IN)  Field Stage enum value.
  43660  *      pbmp    - (IN)  Device Port Bitmap value
  43661  *      mode    - (OUT) Reference to Field Source Class Operational
  43662  *                      Mode enum value.
  43663  * Returns:
  43664  *      BCM_E_XXX
  43665  * Notes:
  43666  *      Valid "stage" input parameter values supported by
  43667  *      this API are:
  43668  * 	            "bcmFieldStageIngress"
  43669  *              "bcmFieldStageIngressExactMatch"
  43670  */
  43671 int
  43672 bcm_esw_field_source_class_mode_get(int unit,
  43673                                         bcm_field_stage_t stage,
  43674                                         bcm_pbmp_t pbmp,
  43675                                         bcm_field_src_class_mode_t *mode)
  43676 {
  43677     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  43678 
  43679 #if defined(BCM_TOMAHAWK_SUPPORT)
  43680     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  43681        rv = _bcm_field_th_source_class_mode_get(unit, stage, pbmp, mode);
  43682     }
  43683 #endif /* BCM_TOMAHAWK_SUPPORT */
  43684 
  43685     return rv;
  43686 }
  43687 
  43688  /*
  43689  * Function:
  43690  *      bcm_esw_field_qualify_MixedSrcClassId
  43691  * Purpose:
  43692  *     Add a Mixed Source Class Id field qualification to a field entry.
  43693  * Parameters:
  43694  *      unit  - (IN) Unit number.
  43695  *      entry - (IN) Field Entry id.
  43696  *      pbmp  - (IN) Device Port Bitmap value
  43697  *      data  - (IN) Mixed Source Class Id.
  43698  *      mask  - (IN) Mixed Source Class Id mask.
  43699  * Returns:
  43700  *      BCM_E_XXX
  43701  * Notes:
  43702  */
  43703 int
  43704 bcm_esw_field_qualify_MixedSrcClassId(int unit,
  43705                                         bcm_field_entry_t entry,
  43706                                         bcm_pbmp_t pbmp,
  43707                                         bcm_field_src_class_t data,
  43708                                         bcm_field_src_class_t mask)
  43709 {
  43710     int                      rv = BCM_E_UNAVAIL; /* Operation return status. */
  43711 #if defined(BCM_TOMAHAWK_SUPPORT)
  43712 
  43713     
  43714     FP_LOCK(unit);
  43715 
  43716     rv = _bcm_field_th_qualify_MixedSrcClassId(unit, entry, pbmp, data, mask);
  43717 
  43718     FP_UNLOCK(unit);
  43719 #endif /* BCM_TOMAHAWK_SUPPORT */
  43720     return (rv);
  43721 }
  43722 
  43723 /*
  43724  * Function:
  43725  *      bcm_esw_field_qualify_MixedSrcClassId_get
  43726  * Purpose:
  43727  *      Get match criteria for bcmFieildQualifyMixedSrcClassId
  43728  *                     qualifier from the field entry.
  43729  * Parameters:
  43730  *      unit  - (IN)  Unit number.
  43731  *      entry - (IN)  Field Entry id.
  43732  *      pbmp  - (IN)  Device Port Bitmap value
  43733  *      data  - (OUT) Mixed Source Class Id.
  43734  *      mask  - (OUT) Mixed Source Class Id mask.
  43735  * Returns:
  43736  *      BCM_E_XXX
  43737  * Notes:
  43738  */
  43739 int
  43740 bcm_esw_field_qualify_MixedSrcClassId_get(int unit,
  43741                                         bcm_field_entry_t entry,
  43742                                         bcm_pbmp_t pbmp,
  43743                                         bcm_field_src_class_t *data,
  43744                                         bcm_field_src_class_t *mask)
  43745 {
  43746     int                      rv = BCM_E_UNAVAIL; /* Operation return status. */
  43747 #if defined(BCM_TOMAHAWK_SUPPORT)
  43748     uint32                   hw_data;            /* HW data match criteria.  */
  43749     uint32                   hw_mask;            /* HW data mask.            */
  43750 
  43751     if ((data == NULL) || (mask == NULL)) {
  43752         return BCM_E_PARAM;
  43753     }
  43754 
  43755     /* Read qualifier match value and mask. */
  43756     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  43757                                             bcmFieldQualifyMixedSrcClassId,
  43758                                             &hw_data, &hw_mask);
  43759     BCM_IF_ERROR_RETURN(rv);
  43760 
  43761     
  43762     FP_LOCK(unit);
  43763 
  43764     rv = _bcm_field_th_qualify_MixedSrcClassId_get(unit, entry, pbmp,
  43765             hw_data, hw_mask, data, mask);
  43766 
  43767     FP_UNLOCK(unit);
  43768 #endif /* BCM_TOMAHAWK_SUPPORT */
  43769     return (rv);
  43770 }
  43771 
  43772 /*
  43773  * Function:
  43774  *     bcm_esw_field_qualify_InterfaceIngressKeySelectClassPort
  43775  *
  43776  * Purpose:
  43777  *     Set a Port interface Ingress Key Select class id packet qualification on an entry.
  43778  *
  43779  * Parameters:
  43780  *     unit     - (IN) BCM unit number
  43781  *     entry    - (IN) Entry ID
  43782  *     data     - (IN) Interface Class id.
  43783  *     mask     - (IN) Interface Class mask.
  43784  *
  43785  * Returns:
  43786  *     BCM_E_XXX
  43787  */
  43788 int
  43789 bcm_esw_field_qualify_InterfaceIngressKeySelectClassPort(int unit, bcm_field_entry_t entry,
  43790                                          uint32 data, uint32 mask)
  43791 {
  43792 
  43793     int             rv = BCM_E_UNAVAIL;
  43794 #if defined(BCM_TOMAHAWK_SUPPORT)
  43795 
  43796     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  43797         BCM_IF_ERROR_RETURN
  43798               (_bcm_field_th_qualify_class(unit, entry,
  43799                                            bcmFieldQualifyInterfaceIngressKeySelectClassPort,
  43800                                            &data, &mask));
  43801     } else if (data  > SOC_INTF_CLASS_MAX(unit)) {
  43802         LOG_ERROR(BSL_LS_BCM_FP,
  43803                   (BSL_META_U(unit,
  43804                               "FP(unit %d) Error: data=%#x out-of-range\n"),
  43805                    unit, data));
  43806         return (BCM_E_PARAM);
  43807     }
  43808 
  43809     
  43810     FP_LOCK(unit);
  43811 
  43812     rv = _field_qualify32(unit, entry, bcmFieldQualifyInterfaceIngressKeySelectClassPort,
  43813                           data, mask);
  43814     FP_UNLOCK(unit);
  43815 #endif
  43816     return (rv);
  43817 }
  43818 
  43819 /*
  43820  * Function:
  43821  *      bcm_esw_field_qualify_InterfaceIngressKeySelectClassPort_get
  43822  * Purpose:
  43823  *      Get match criteria for bcmFieildQualifyInterfaceIngressKeySelectClassPort
  43824  *                     qualifier from the field entry.
  43825  * Parameters:
  43826  *      unit - (IN) Unit number.
  43827  *      entry - (IN) BCM field entry id.
  43828  *      data - (OUT) Qualifier match data.
  43829  *      mask - (OUT) Qualifier match mask.
  43830  *
  43831  * Returns:
  43832  *     BCM_E_XXX
  43833  */
  43834 int
  43835 bcm_esw_field_qualify_InterfaceIngressKeySelectClassPort_get(
  43836     int unit,
  43837     bcm_field_entry_t entry,
  43838     uint32 *data,
  43839     uint32 *mask)
  43840 {
  43841     /* Read qualifier match value and mask. */
  43842     BCM_IF_ERROR_RETURN(_bcm_field_entry_qualifier_uint32_get(unit,
  43843                 entry,
  43844                 bcmFieldQualifyInterfaceIngressKeySelectClassPort,
  43845                 data,
  43846                 mask
  43847                 ));
  43848 
  43849     return (BCM_E_NONE);
  43850 }
  43851 
  43852 
  43853 /*
  43854  * Function:
  43855  *      bcm_esw_field_qualify_ISid
  43856  * Purpose:
  43857  *      Add Service Instance tag field qualification to a field entry.
  43858  * Parameters:
  43859  *      unit  - (IN) Unit number.
  43860  *      entry - (IN) Field entry id.
  43861  *      data  - (IN) Qualifier match data.
  43862  *      mask  - (IN) Qualifier match mask.
  43863  * Returns:
  43864  *      BCM_E_XXX
  43865  * Notes:
  43866  */
  43867 int
  43868 bcm_esw_field_qualify_ISid(int unit, bcm_field_entry_t entry,
  43869                             uint32 data, uint32 mask)
  43870 {
  43871     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  43872 
  43873 #if defined BCM_TOMAHAWK_SUPPORT
  43874 
  43875     
  43876     FP_LOCK(unit);
  43877 
  43878     rv = _field_qualify32(unit, entry, bcmFieldQualifyISid,
  43879                           data, mask);
  43880     FP_UNLOCK(unit);
  43881 #endif
  43882     return rv;
  43883 }
  43884 
  43885 /*
  43886  * Function:
  43887  *      bcm_esw_field_qualify_ISid_get
  43888  * Purpose:
  43889  *      Get match criteria for bcmFieldQualifyISid
  43890  *      qualifier from the field entry.
  43891  * Parameters:
  43892  *      unit - (IN) Unit number.
  43893  *      entry - (IN) BCM field entry id.
  43894  *      data - (OUT) Qualifier match data.
  43895  *      mask - (OUT) Qualifier match mask.
  43896  * Returns:
  43897  *      BCM_E_XXX
  43898  * Notes:
  43899  */
  43900 int
  43901 bcm_esw_field_qualify_ISid_get(
  43902     int unit,
  43903     bcm_field_entry_t entry,
  43904     uint32 *data,
  43905     uint32 *mask)
  43906 {
  43907     /* Read qualifier match value and mask. */
  43908     return _bcm_field_entry_qualifier_uint32_get(unit, entry,
  43909                                                  bcmFieldQualifyISid,
  43910                                                  data, mask);
  43911 }
  43912 
  43913 /*
  43914  * Function:
  43915  *      bcm_esw_field_qualify_ITag
  43916  * Purpose:
  43917  *      Add Service Instance tag field qualification to a field entry.
  43918  * Parameters:
  43919  *      unit  - (IN) Unit number.
  43920  *      entry - (IN) Field entry id.
  43921  *      data  - (IN) Qualifier match data.
  43922  *      mask  - (IN) Qualifier match mask.
  43923  * Returns:
  43924  *      BCM_E_XXX
  43925  * Notes:
  43926  */
  43927 int
  43928 bcm_esw_field_qualify_ITag(int unit, bcm_field_entry_t entry,
  43929                             uint32 data, uint32 mask)
  43930 {
  43931     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  43932 
  43933 #if defined BCM_TOMAHAWK_SUPPORT
  43934 
  43935     
  43936     FP_LOCK(unit);
  43937 
  43938     rv = _field_qualify32(unit, entry, bcmFieldQualifyITag,
  43939                           data, mask);
  43940     FP_UNLOCK(unit);
  43941 #endif
  43942     return rv;
  43943 }
  43944 
  43945 /*
  43946  * Function:
  43947  *      bcm_esw_field_qualify_ITag_get
  43948  * Purpose:
  43949  *      Get match criteria for bcmFieldQualifyITag
  43950  *      qualifier from the field entry.
  43951  * Parameters:
  43952  *      unit - (IN) Unit number.
  43953  *      entry - (IN) BCM field entry id.
  43954  *      data - (OUT) Qualifier match data.
  43955  *      mask - (OUT) Qualifier match mask.
  43956  * Returns:
  43957  *      BCM_E_XXX
  43958  * Notes:
  43959  */
  43960 int
  43961 bcm_esw_field_qualify_ITag_get(
  43962     int unit,
  43963     bcm_field_entry_t entry,
  43964     uint32 *data,
  43965     uint32 *mask)
  43966 {
  43967     /* Read qualifier match value and mask. */
  43968     return _bcm_field_entry_qualifier_uint32_get(unit, entry,
  43969                                                  bcmFieldQualifyITag,
  43970                                                  data, mask);
  43971 }
  43972 
  43973 /*
  43974  * Function:
  43975  *      bcm_esw_field_qualify_BfdYourDiscriminator
  43976  * Purpose:
  43977  *      Add BFD Your Discriminator field qualification to a field entry.
  43978  * Parameters:
  43979  *      unit  - (IN) Unit number.
  43980  *      entry - (IN) Field entry id.
  43981  *      data  - (IN) Qualifier match data.
  43982  *      mask  - (IN) Qualifier match mask.
  43983  * Returns:
  43984  *      BCM_E_XXX
  43985  * Notes:
  43986  */
  43987 int
  43988 bcm_esw_field_qualify_BfdYourDiscriminator(int unit, bcm_field_entry_t entry,
  43989                             uint32 data, uint32 mask)
  43990 {
  43991     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  43992 
  43993 #if defined BCM_TOMAHAWK_SUPPORT
  43994 
  43995     
  43996     FP_LOCK(unit);
  43997 
  43998     rv = _field_qualify32(unit, entry, bcmFieldQualifyBfdYourDiscriminator,
  43999                           data, mask);
  44000     FP_UNLOCK(unit);
  44001 #endif
  44002     return rv;
  44003 }
  44004 
  44005 /*
  44006  * Function:
  44007  *      bcm_esw_field_qualify_BfdYourDiscriminator_get
  44008  * Purpose:
  44009  *      Get match criteria for bcmFieldQualifyBfdYourDiscriminator
  44010  *      qualifier from the field entry.
  44011  * Parameters:
  44012  *      unit - (IN) Unit number.
  44013  *      entry - (IN) BCM field entry id.
  44014  *      data - (OUT) Qualifier match data.
  44015  *      mask - (OUT) Qualifier match mask.
  44016  * Returns:
  44017  *      BCM_E_XXX
  44018  * Notes:
  44019  */
  44020 int
  44021 bcm_esw_field_qualify_BfdYourDiscriminator_get(
  44022     int unit,
  44023     bcm_field_entry_t entry,
  44024     uint32 *data,
  44025     uint32 *mask)
  44026 {
  44027     /* Read qualifier match value and mask. */
  44028     return _bcm_field_entry_qualifier_uint32_get(unit, entry,
  44029                                                  bcmFieldQualifyBfdYourDiscriminator,
  44030                                                  data, mask);
  44031 }
  44032 
  44033 /*
  44034  * Function:
  44035  *      bcm_esw_field_qualify_CpuVisibilityPacket
  44036  * Purpose:
  44037  *      Add CPU Visibility Packet field qualification to a field entry.
  44038  * Parameters:
  44039  *      unit  - (IN) Unit number.
  44040  *      entry - (IN) Field entry id.
  44041  *      data  - (IN) Qualifier match data.
  44042  *      mask  - (IN) Qualifier match mask.
  44043  * Returns:
  44044  *      BCM_E_XXX
  44045  * Notes:
  44046  */
  44047 int
  44048 bcm_esw_field_qualify_CpuVisibilityPacket(int unit, bcm_field_entry_t entry,
  44049                             uint8 data, uint8 mask)
  44050 {
  44051     int rv = BCM_E_UNAVAIL;          /* Operation return status. */
  44052 
  44053 #if defined BCM_TOMAHAWK_SUPPORT
  44054 
  44055     if (data > 0x1) {
  44056         return (BCM_E_PARAM);
  44057     }
  44058 
  44059     
  44060     FP_LOCK(unit);
  44061 
  44062     rv = _field_qualify32(unit, entry, bcmFieldQualifyCpuVisibilityPacket,
  44063                           data, mask);
  44064     FP_UNLOCK(unit);
  44065 #endif
  44066     return rv;
  44067 }
  44068 
  44069 /*
  44070  * Function:
  44071  *      bcm_esw_field_qualify_CpuVisibilityPacket_get
  44072  * Purpose:
  44073  *      Get match criteria for bcmFieldQualifyCpuVisibilityPacket
  44074  *      qualifier from the field entry.
  44075  * Parameters:
  44076  *      unit - (IN) Unit number.
  44077  *      entry - (IN) BCM field entry id.
  44078  *      data - (OUT) Qualifier match data.
  44079  *      mask - (OUT) Qualifier match mask.
  44080  * Returns:
  44081  *      BCM_E_XXX
  44082  * Notes:
  44083  */
  44084 int
  44085 bcm_esw_field_qualify_CpuVisibilityPacket_get(
  44086     int unit,
  44087     bcm_field_entry_t entry,
  44088     uint8 *data,
  44089     uint8 *mask)
  44090 {
  44091     /* Read qualifier match value and mask. */
  44092     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  44093                                                  bcmFieldQualifyCpuVisibilityPacket,
  44094                                                  data, mask);
  44095 }
  44096 
  44097 /*
  44098  * Function:
  44099  *      bcm_esw_field_qualify_DstL2MulticastGroup
  44100  * Purpose:
  44101  *     Add a destination L2 multicast group field qualification to a field entry.
  44102  * Parameters:
  44103  *      unit - (IN) Unit number.
  44104  *      entry - (IN) Field Entry id.
  44105  *      group - (IN) L2 Multicast group id.
  44106  *      mask  - (IN) L2 Multicast group id mask.
  44107  * Returns:
  44108  *      BCM_E_XXX
  44109  * Notes:
  44110  */
  44111 int
  44112 bcm_esw_field_qualify_DstL2MulticastGroup(int unit,
  44113                                         bcm_field_entry_t entry,
  44114                                         bcm_multicast_t group,
  44115                                         bcm_multicast_t mask)
  44116 {
  44117     int rv = BCM_E_UNAVAIL;                 /* Operation return status. */
  44118 #if defined(BCM_TOMAHAWK_SUPPORT)
  44119     _field_control_t *fc;   /* Field control structure. */
  44120     uint32 data;            /* HW data match criteria.  */
  44121     uint32 hw_mask;            /* HW data mask.            */
  44122 
  44123     /* Input parameters check. */
  44124     if (0 == _BCM_MULTICAST_IS_SET(group)) {
  44125         return (BCM_E_PARAM);
  44126     }
  44127 
  44128     if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  44129         if (0 == BCM_MULTICAST_IS_SET(mask)) {
  44130             return (BCM_E_PARAM);
  44131         }
  44132         hw_mask = BCM_MULTICAST_L2_GET(mask);
  44133     } else {
  44134         hw_mask = (BCM_FIELD_EXACT_MATCH_MASK);
  44135     }
  44136 
  44137     if ( !(_BCM_MULTICAST_IS_L2(group))) {
  44138         return (BCM_E_PARAM);
  44139     }
  44140 
  44141     data  = BCM_MULTICAST_L2_GET(group);
  44142 
  44143     BCM_IF_ERROR_RETURN(_field_dest_type_qualify(unit, entry,
  44144                         bcmFieldQualifyDstL2MulticastGroup, &data, &hw_mask,
  44145                         _bcmFieldDestTypeL2mc));
  44146 
  44147     
  44148     FP_LOCK(unit);
  44149     rv = _field_control_get(unit, &fc);
  44150     if (BCM_FAILURE(rv)) {
  44151         FP_UNLOCK(unit);
  44152         return rv;
  44153     }
  44154     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  44155         rv = fc->functions.fp_qualify_dvp(unit, entry,
  44156                                           bcmFieldQualifyDstL2MulticastGroup,
  44157                                           data, hw_mask, 0);
  44158         FP_UNLOCK(unit);
  44159         return (rv);
  44160     }
  44161 
  44162     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstL2MulticastGroup,
  44163                           data, hw_mask);
  44164     FP_UNLOCK(unit);
  44165 #endif /* BCM_TOMAHAWK_SUPPORT */
  44166     return (rv);
  44167 }
  44168 
  44169 /*
  44170  * Function:
  44171  *      bcm_esw_field_qualify_DstL2MulticastGroup_get
  44172  * Purpose:
  44173  *      Get match criteria for bcmFieildQualifyDstL2MulticastGroup
  44174  *                     qualifier from the field entry.
  44175  * Parameters:
  44176  *      unit  - (IN) Unit number.
  44177  *      entry - (IN) BCM field entry id.
  44178  *      group - (OUT) L2 Multicast group id.
  44179  *      mask  - (OUT) L2 Multicast group id mask.
  44180  * Returns:
  44181  *      BCM_E_XXX
  44182  * Notes:
  44183  */
  44184 int
  44185 bcm_esw_field_qualify_DstL2MulticastGroup_get(int unit,
  44186                                             bcm_field_entry_t entry,
  44187                                             bcm_multicast_t *group,
  44188                                             bcm_multicast_t *mask)
  44189 {
  44190     uint32 data;   /* HW encoded qualifier data.  */
  44191     uint32 hw_mask;   /* HW encoding qualifier mask. */
  44192     int rv;        /* Operation return status.    */
  44193 
  44194     /* Read qualifier match value and mask. */
  44195     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  44196                                             bcmFieldQualifyDstL2MulticastGroup,
  44197                                             &data, &hw_mask);
  44198     BCM_IF_ERROR_RETURN(rv);
  44199 
  44200     BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  44201         entry, bcmFieldQualifyDstL2MulticastGroup, &data, &hw_mask));
  44202 
  44203     /* L2 MC */
  44204     BCM_MULTICAST_L2_SET(*group, data);
  44205     BCM_MULTICAST_L2_SET(*mask, hw_mask);
  44206     return BCM_E_NONE;
  44207 }
  44208 
  44209 /*
  44210  * Function:
  44211  *      bcm_esw_field_qualify_DstL3MulticastGroup
  44212  * Purpose:
  44213  *     Add a destination L3 multicast group field qualification to a field entry.
  44214  * Parameters:
  44215  *      unit - (IN) Unit number.
  44216  *      entry - (IN) Field Entry id.
  44217  *      group - (IN) L3 Multicast group id.
  44218  *      mask  - (IN) L3 Multicast group id mask.
  44219  * Returns:
  44220  *      BCM_E_XXX
  44221  * Notes:
  44222  */
  44223 int
  44224 bcm_esw_field_qualify_DstL3MulticastGroup(int unit,
  44225                                         bcm_field_entry_t entry,
  44226                                         bcm_multicast_t group,
  44227                                         bcm_multicast_t mask)
  44228 {
  44229     int rv = BCM_E_UNAVAIL;                 /* Operation return status. */
  44230 #if defined(BCM_TOMAHAWK_SUPPORT)
  44231     _field_control_t *fc;   /* Field control structure. */
  44232     uint32 data;            /* HW data match criteria.  */
  44233     uint32 hw_mask;            /* HW data mask.            */
  44234 
  44235     /* Input parameters check. */
  44236     if (0 == _BCM_MULTICAST_IS_SET(group)) {
  44237         return (BCM_E_PARAM);
  44238     }
  44239 
  44240     if (mask != BCM_FIELD_EXACT_MATCH_MASK) {
  44241         if (0 == BCM_MULTICAST_IS_SET(mask)) {
  44242             return (BCM_E_PARAM);
  44243         }
  44244         hw_mask = BCM_MULTICAST_L3_GET(mask);
  44245     } else {
  44246         hw_mask = (BCM_FIELD_EXACT_MATCH_MASK);
  44247     }
  44248 
  44249     if (!(_BCM_MULTICAST_IS_L3(group))) {
  44250         return (BCM_E_PARAM);
  44251     }
  44252 
  44253     data  = BCM_MULTICAST_L3_GET(group);
  44254 
  44255     BCM_IF_ERROR_RETURN(_field_dest_type_qualify(unit, entry,
  44256                         bcmFieldQualifyDstL3MulticastGroup, &data, &hw_mask,
  44257                         _bcmFieldDestTypeL3mc));
  44258 
  44259     
  44260     FP_LOCK(unit);
  44261     rv = _field_control_get(unit, &fc);
  44262     if (BCM_FAILURE(rv)) {
  44263         FP_UNLOCK(unit);
  44264         return rv;
  44265     }
  44266     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  44267         rv = fc->functions.fp_qualify_dvp(unit, entry,
  44268                                           bcmFieldQualifyDstL3MulticastGroup,
  44269                                           data, hw_mask, 0);
  44270         FP_UNLOCK(unit);
  44271         return (rv);
  44272     }
  44273 
  44274     rv = _field_qualify32(unit, entry, bcmFieldQualifyDstL3MulticastGroup,
  44275                           data, hw_mask);
  44276     FP_UNLOCK(unit);
  44277 #endif /* BCM_TOMAHAWK_SUPPORT */
  44278     return (rv);
  44279 }
  44280 
  44281 /*
  44282  * Function:
  44283  *      bcm_esw_field_qualify_DstL3MulticastGroup_get
  44284  * Purpose:
  44285  *      Get match criteria for bcmFieildQualifyDstL3MulticastGroup
  44286  *                     qualifier from the field entry.
  44287  * Parameters:
  44288  *      unit - (IN) Unit number.
  44289  *      entry - (IN) BCM field entry id.
  44290  *      group - (OUT) L3 Multicast group id.
  44291  *      mask  - (OUT) L3 Multicast group id mask.
  44292  * Returns:
  44293  *      BCM_E_XXX
  44294  * Notes:
  44295  */
  44296 int
  44297 bcm_esw_field_qualify_DstL3MulticastGroup_get(int unit,
  44298                                             bcm_field_entry_t entry,
  44299                                             bcm_multicast_t *group,
  44300                                             bcm_multicast_t *mask)
  44301 {
  44302     uint32 data;   /* HW encoded qualifier data.  */
  44303     uint32 hw_mask;   /* HW encoding qualifier mask. */
  44304     int rv;        /* Operation return status.    */
  44305 
  44306     /* Read qualifier match value and mask. */
  44307     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  44308                                             bcmFieldQualifyDstL3MulticastGroup,
  44309                                             &data, &hw_mask);
  44310     BCM_IF_ERROR_RETURN(rv);
  44311 
  44312     BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  44313         entry, bcmFieldQualifyDstL3MulticastGroup, &data, &hw_mask));
  44314 
  44315     /* IPMC */
  44316     BCM_MULTICAST_L3_SET(*group, data);
  44317     BCM_MULTICAST_L3_SET(*mask, hw_mask);
  44318     return BCM_E_NONE;
  44319 }
  44320 
  44321 /*
  44322  * Function:
  44323  *      bcm_esw_field_qualify_CustomHeaderPkt
  44324  * Purpose:
  44325  *       Set match criteria for bcmFieldQualifyCustomHeaderPkt
  44326  *                       qualifier in the field entry.
  44327  * Parameters:
  44328  *      unit - (IN) Unit number.
  44329  *      entry - (IN) BCM field entry id.
  44330  *      data - (IN) Qualifier match data.
  44331  *      mask - (IN) Qualifier match data.
  44332  * Returns:
  44333  *      BCM_E_XXX
  44334  * Notes:
  44335  */
  44336 int 
  44337 bcm_esw_field_qualify_CustomHeaderPkt(
  44338     int unit, 
  44339     bcm_field_entry_t entry, 
  44340     uint8 data, 
  44341     uint8 mask)
  44342 {
  44343     int              rv;       /* Operation return status. */
  44344 
  44345     /* Validate Custom header packet, should not be more than 1-bit */
  44346     if (data & ~(0x1)) {
  44347        return BCM_E_PARAM; 
  44348     }
  44349 
  44350     
  44351     FP_LOCK(unit);
  44352 
  44353     rv = _field_qualify32(unit, entry, bcmFieldQualifyCustomHeaderPkt, data, mask);
  44354 
  44355     FP_UNLOCK(unit);
  44356     return (rv);
  44357 }
  44358 
  44359 /*
  44360  * Function:
  44361  *      bcm_esw_field_qualify_CustomHeaderPkt_get
  44362  * Purpose:
  44363  *       Get match criteria for bcmFieldQualifyCustomHeaderPkt
  44364  *                       qualifier from the field entry.
  44365  * Parameters:
  44366  *      unit - (IN) Unit number.
  44367  *      entry - (IN) BCM field entry id.
  44368  *      data - (OUT) Qualifier match data.
  44369  *      mask - (OUT) Qualifier match mask.
  44370  * Returns:
  44371  *      BCM_E_XXX
  44372  * Notes:
  44373  */
  44374 int 
  44375 bcm_esw_field_qualify_CustomHeaderPkt_get(
  44376     int unit, 
  44377     bcm_field_entry_t entry, 
  44378     uint8 *data, 
  44379     uint8 *mask)
  44380 {
  44381     /* Read qualifier match value and mask. */
  44382     return _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  44383                                             bcmFieldQualifyCustomHeaderPkt,
  44384                                             data, mask);
  44385 }
  44386 
  44387 /*
  44388  * Function:
  44389  *      bcm_esw_field_qualify_CustomHeaderData
  44390  * Purpose:
  44391  *       Set match criteria for bcmFieldQualifyCustomHeaderData
  44392  *                       qualifier in the field entry.
  44393  * Parameters:
  44394  *      unit - (IN) Unit number.
  44395  *      entry - (IN) BCM field entry id.
  44396  *      data - (IN) Qualifier match data.
  44397  *      mask - (IN) Qualifier match data.
  44398  * Returns:
  44399  *      BCM_E_XXX
  44400  * Notes:
  44401  */
  44402 int 
  44403 bcm_esw_field_qualify_CustomHeaderData(
  44404     int unit, 
  44405     bcm_field_entry_t entry, 
  44406     uint32 data, 
  44407     uint32 mask)
  44408 {
  44409     int              rv;       /* Operation return status. */
  44410 
  44411 
  44412     
  44413     FP_LOCK(unit);
  44414 
  44415     rv = _field_qualify32(unit, entry, bcmFieldQualifyCustomHeaderData, data, mask);
  44416 
  44417     FP_UNLOCK(unit);
  44418     return (rv);
  44419 }
  44420 
  44421 /*
  44422  * Function:
  44423  *      bcm_esw_field_qualify_CustomHeaderData_get
  44424  * Purpose:
  44425  *       Get match criteria for bcmFieldQualifyCustomHeaderData
  44426  *                       qualifier from the field entry.
  44427  * Parameters:
  44428  *      unit - (IN) Unit number.
  44429  *      entry - (IN) BCM field entry id.
  44430  *      data - (OUT) Qualifier match data.
  44431  *      mask - (OUT) Qualifier match mask.
  44432  * Returns:
  44433  *      BCM_E_XXX
  44434  * Notes:
  44435  */
  44436 int 
  44437 bcm_esw_field_qualify_CustomHeaderData_get(
  44438     int unit, 
  44439     bcm_field_entry_t entry, 
  44440     uint32 *data, 
  44441     uint32 *mask)
  44442 {
  44443     /* Read qualifier match value and mask. */
  44444     return _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  44445                                             bcmFieldQualifyCustomHeaderData,
  44446                                             data, mask);
  44447 }
  44448 
  44449 /*
  44450  * Function:
  44451  *      bcm_esw_field_qualify_MimlPkt
  44452  * Purpose:
  44453  *      Set match criteria for bcmFieildQualifyMimlPkt
  44454  *      qualifier from the field entry.
  44455  * Parameters:
  44456  *      unit    - (IN) Unit number.
  44457  *      entry   - (IN) BCM field entry id.
  44458  *      data    - (IN) Qualifier match data. 0/1 Non-Miml/Miml packets
  44459  *      mask    - (IN) Qualifier match mask.
  44460  * Returns:
  44461  *      BCM_E_XXX
  44462  * Notes:
  44463  */
  44464 int bcm_esw_field_qualify_MimlPkt(
  44465     int unit,
  44466     bcm_field_entry_t entry,
  44467     uint8 data,
  44468     uint8 mask)
  44469 {
  44470     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44471 
  44472 #ifdef BCM_HURRICANE3_SUPPORT
  44473 
  44474     if (soc_feature(unit, soc_feature_miml)) {
  44475         
  44476         FP_LOCK(unit);
  44477     
  44478         rv = _field_qualify32(unit, entry, bcmFieldQualifyMimlPkt, data, mask);
  44479     
  44480         FP_UNLOCK(unit);
  44481     }
  44482 #endif /* BCM_HURRICANE3_SUPPORT */
  44483 
  44484     return (rv);
  44485 }
  44486 
  44487 /*
  44488  * Function:
  44489  *      bcm_esw_field_qualify_MimlPkt_get
  44490  * Purpose:
  44491  *      Get match criteria for bcmFieildQualifyMimlPkt
  44492  *      qualifier from the field entry.
  44493  * Parameters:
  44494  *      unit    - (IN) Unit number.
  44495  *      entry   - (IN) BCM field entry id.
  44496  *      data    - (OUT) Qualifier match data.
  44497  *      mask    - (OUT) Qualifier match mask.
  44498  * Returns:
  44499  *      BCM_E_XXX
  44500  * Notes:
  44501  */
  44502 int bcm_esw_field_qualify_MimlPkt_get(
  44503     int unit,
  44504     bcm_field_entry_t entry,
  44505     uint8 *data,
  44506     uint8 *mask)
  44507 {
  44508     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44509 
  44510 #ifdef BCM_HURRICANE3_SUPPORT
  44511     /* Read qualifier match value and mask. */
  44512     if (soc_feature(unit, soc_feature_miml)) {
  44513         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  44514                                    bcmFieldQualifyMimlPkt,
  44515                                    data, mask);
  44516     }
  44517 #endif /* BCM_HURRICANE3_SUPPORT */
  44518 
  44519     return (rv);
  44520 }
  44521 
  44522 /*
  44523  * Function:
  44524  *      bcm_esw_field_qualify_MimlSrcMac
  44525  * Purpose:
  44526  *      Set match criteria for bcmFieildQualifyMimlSrcMac
  44527  *      qualifier from the field entry.
  44528  * Parameters:
  44529  *      unit    - (IN) Unit number.
  44530  *      entry   - (IN) BCM field entry id.
  44531  *      data    - (IN) Qualifier match data.
  44532  *      mask    - (IN) Qualifier match mask.
  44533  * Returns:
  44534  *      BCM_E_XXX
  44535  * Notes:
  44536  */
  44537 int
  44538 bcm_esw_field_qualify_MimlSrcMac(int unit, bcm_field_entry_t entry,
  44539                              bcm_mac_t data, bcm_mac_t mask)
  44540 {
  44541     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44542 
  44543 #ifdef BCM_HURRICANE3_SUPPORT
  44544 
  44545     if (soc_feature(unit, soc_feature_miml)) {
  44546         
  44547         FP_LOCK(unit);
  44548     
  44549         rv = _field_qualify_macaddr(unit, entry, bcmFieldQualifyMimlSrcMac,
  44550                                     data, mask);
  44551         FP_UNLOCK(unit);
  44552     }
  44553 #endif /* BCM_HURRICANE3_SUPPORT */
  44554 
  44555     return (rv);
  44556 }
  44557 
  44558 /*
  44559  * Function:
  44560  *      bcm_esw_field_qualify_MimlDstMac
  44561  * Purpose:
  44562  *      Set match criteria for bcmFieildQualifyMimlDstMac
  44563  *      qualifier from the field entry.
  44564  * Parameters:
  44565  *      unit    - (IN) Unit number.
  44566  *      entry   - (IN) BCM field entry id.
  44567  *      data    - (IN) Qualifier match data.
  44568  *      mask    - (IN) Qualifier match mask.
  44569  * Returns:
  44570  *      BCM_E_XXX
  44571  * Notes:
  44572  */
  44573 int
  44574 bcm_esw_field_qualify_MimlDstMac(int unit, bcm_field_entry_t entry,
  44575                              bcm_mac_t data, bcm_mac_t mask)
  44576 {
  44577     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44578 
  44579 #ifdef BCM_HURRICANE3_SUPPORT
  44580 
  44581     if (soc_feature(unit, soc_feature_miml)) {
  44582         
  44583         FP_LOCK(unit);
  44584     
  44585         rv = _field_qualify_macaddr(unit, entry, bcmFieldQualifyMimlDstMac,
  44586                                     data, mask);
  44587         FP_UNLOCK(unit);
  44588     }
  44589 #endif /* BCM_HURRICANE3_SUPPORT */
  44590 
  44591     return (rv);
  44592 }
  44593 
  44594 /*
  44595  * Function:
  44596  *      bcm_esw_field_qualify_MimlSrcMac_get
  44597  * Purpose:
  44598  *      Get match criteria for bcmFieildQualifyMimlSrcMac
  44599  *                     qualifier from the field entry.
  44600  * Parameters:
  44601  *      unit - (IN) Unit number.
  44602  *      entry - (IN) BCM field entry id.
  44603  *      data - (OUT) Qualifier match data.
  44604  *      mask - (OUT) Qualifier match mask.
  44605  * Returns:
  44606  *      BCM_E_XXX
  44607  * Notes:
  44608  */
  44609 int 
  44610 bcm_esw_field_qualify_MimlSrcMac_get(
  44611     int unit, 
  44612     bcm_field_entry_t entry, 
  44613     bcm_mac_t *data, 
  44614     bcm_mac_t *mask)
  44615 {
  44616     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44617 
  44618 #ifdef BCM_HURRICANE3_SUPPORT
  44619     /* Read qualifier match value and mask. */
  44620     if (soc_feature(unit, soc_feature_miml)) {
  44621         rv = _field_qualify_macaddr_get(unit, entry, 
  44622                                    bcmFieldQualifyMimlSrcMac,
  44623                                    data, mask);
  44624     }
  44625 #endif /* BCM_HURRICANE3_SUPPORT */
  44626 
  44627     return (rv);
  44628 }
  44629 
  44630 /*
  44631  * Function:
  44632  *      bcm_esw_field_qualify_MimlDstMac_get
  44633  * Purpose:
  44634  *      Get match criteria for bcmFieildQualifyMimlDstMac
  44635  *                     qualifier from the field entry.
  44636  * Parameters:
  44637  *      unit - (IN) Unit number.
  44638  *      entry - (IN) BCM field entry id.
  44639  *      data - (OUT) Qualifier match data.
  44640  *      mask - (OUT) Qualifier match mask.
  44641  * Returns:
  44642  *      BCM_E_XXX
  44643  * Notes:
  44644  */
  44645 int 
  44646 bcm_esw_field_qualify_MimlDstMac_get(
  44647     int unit, 
  44648     bcm_field_entry_t entry, 
  44649     bcm_mac_t *data, 
  44650     bcm_mac_t *mask)
  44651 {
  44652     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44653 
  44654 #ifdef BCM_HURRICANE3_SUPPORT
  44655     /* Read qualifier match value and mask. */
  44656     if (soc_feature(unit, soc_feature_miml)) {
  44657         rv = _field_qualify_macaddr_get(unit, entry, 
  44658                                    bcmFieldQualifyMimlDstMac,
  44659                                    data, mask);
  44660     }
  44661 #endif /* BCM_HURRICANE3_SUPPORT */
  44662 
  44663     return (rv);
  44664 }
  44665 
  44666 /*
  44667  * Function:
  44668  *      bcm_esw_field_qualify_MimlVlan
  44669  * Purpose:
  44670  *       Set match criteria for bcmFieildQualifyMimlVlan
  44671  *                       qualifier in the field entry.
  44672  * Parameters:
  44673  *      unit - (IN) Unit number.
  44674  *      entry - (IN) BCM field entry id.
  44675  *      data - (IN) Qualifier match data.
  44676  *      mask - (IN) Qualifier match data.
  44677  * Returns:
  44678  *      BCM_E_XXX
  44679  * Notes:
  44680  */
  44681 int
  44682 bcm_esw_field_qualify_MimlVlan(
  44683     int unit, 
  44684     bcm_field_entry_t entry, 
  44685     bcm_vlan_t data, 
  44686     bcm_vlan_t mask)
  44687 {
  44688     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44689 
  44690 #ifdef BCM_HURRICANE3_SUPPORT
  44691     if (soc_feature(unit, soc_feature_miml)) {
  44692         rv = bcm_esw_field_qualify_MimlVlanId(unit, entry, 
  44693                                                (data & 0xfff), 
  44694                                                (mask & 0xfff));
  44695         BCM_IF_ERROR_RETURN(rv);
  44696     
  44697         rv = bcm_esw_field_qualify_MimlVlanCfi(unit, entry, 
  44698                                                 ((data >> 12) & 0x1),
  44699                                                 ((mask >> 12) & 0x1));
  44700         BCM_IF_ERROR_RETURN(rv);
  44701     
  44702         rv = bcm_esw_field_qualify_MimlVlanPri(unit, entry,
  44703                                                 (data >> 13),
  44704                                                 (mask >> 13));
  44705     }
  44706 #endif /* BCM_HURRICANE3_SUPPORT */
  44707 
  44708     return (rv);
  44709 }
  44710 
  44711 /*
  44712  * Function:
  44713  *      bcm_esw_field_qualify_MimlVlanId
  44714  * Purpose:
  44715  *       Set match criteria for bcmFieildQualifyMimlVlanId
  44716  *                       qualifier in the field entry.
  44717  * Parameters:
  44718  *      unit - (IN) Unit number.
  44719  *      entry - (IN) BCM field entry id.
  44720  *      data - (IN) Qualifier match data.
  44721  *      mask - (IN) Qualifier match data.
  44722  * Returns:
  44723  *      BCM_E_XXX
  44724  * Notes:
  44725  */
  44726 int 
  44727 bcm_esw_field_qualify_MimlVlanId(
  44728     int unit, 
  44729     bcm_field_entry_t entry, 
  44730     bcm_vlan_t data, 
  44731     bcm_vlan_t mask)
  44732 {
  44733     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44734 
  44735 #ifdef BCM_HURRICANE3_SUPPORT
  44736 
  44737     if (soc_feature(unit, soc_feature_miml)) {
  44738         
  44739         FP_LOCK(unit);
  44740     
  44741         rv = _field_qualify32(unit, entry, bcmFieldQualifyMimlVlanId, data, mask);
  44742     
  44743         FP_UNLOCK(unit);
  44744     }
  44745 #endif /* BCM_HURRICANE3_SUPPORT */
  44746 
  44747     return (rv);
  44748 }
  44749 
  44750 /*
  44751  * Function:
  44752  *      bcm_esw_field_qualify_MimlVlanPri
  44753  * Purpose:
  44754  *       Set match criteria for bcmFieildQualifyMimlVlanPri
  44755  *                       qualifier in the field entry.
  44756  * Parameters:
  44757  *      unit - (IN) Unit number.
  44758  *      entry - (IN) BCM field entry id.
  44759  *      data - (IN) Qualifier match data.
  44760  *      mask - (IN) Qualifier match data.
  44761  * Returns:
  44762  *      BCM_E_XXX
  44763  * Notes:
  44764  */
  44765 int 
  44766 bcm_esw_field_qualify_MimlVlanPri(
  44767     int unit, 
  44768     bcm_field_entry_t entry, 
  44769     uint8 data, 
  44770     uint8 mask)
  44771 {
  44772     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44773 
  44774 #ifdef BCM_HURRICANE3_SUPPORT
  44775 
  44776     if (soc_feature(unit, soc_feature_miml)) {
  44777         
  44778         FP_LOCK(unit);
  44779     
  44780         rv = _field_qualify32(unit, entry, bcmFieldQualifyMimlVlanPri, data, mask);
  44781     
  44782         FP_UNLOCK(unit);
  44783     }
  44784 #endif /* BCM_HURRICANE3_SUPPORT */
  44785 
  44786     return (rv);
  44787 }
  44788 
  44789 
  44790 /*
  44791  * Function:
  44792  *      bcm_esw_field_qualify_MimlVlanCfi
  44793  * Purpose:
  44794  *       Set match criteria for bcmFieildQualifyMimlVlanCfi
  44795  *                       qualifier in the field entry.
  44796  * Parameters:
  44797  *      unit - (IN) Unit number.
  44798  *      entry - (IN) BCM field entry id.
  44799  *      data - (IN) Qualifier match data.
  44800  *      mask - (IN) Qualifier match data.
  44801  * Returns:
  44802  *      BCM_E_XXX
  44803  * Notes:
  44804  */
  44805 int 
  44806 bcm_esw_field_qualify_MimlVlanCfi(
  44807     int unit, 
  44808     bcm_field_entry_t entry, 
  44809     uint8 data, 
  44810     uint8 mask)
  44811 {
  44812     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44813 
  44814 #ifdef BCM_HURRICANE3_SUPPORT
  44815 
  44816     if (soc_feature(unit, soc_feature_miml)) {
  44817         
  44818         FP_LOCK(unit);
  44819     
  44820         rv = _field_qualify32(unit, entry, bcmFieldQualifyMimlVlanCfi, data, mask);
  44821     
  44822         FP_UNLOCK(unit);
  44823     }
  44824 #endif /* BCM_HURRICANE3_SUPPORT */
  44825 
  44826     return (rv);
  44827 }
  44828 
  44829 /*
  44830  * Function:
  44831  *      bcm_esw_field_qualify_MimlVlan_get
  44832  * Purpose:
  44833  *      Get match criteria for bcmFieildQualifyMimlVlan
  44834  *                     qualifier from the field entry.
  44835  * Parameters:
  44836  *      unit - (IN) Unit number.
  44837  *      entry - (IN) BCM field entry id.
  44838  *      data - (OUT) Qualifier match data.
  44839  *      mask - (OUT) Qualifier match mask.
  44840  * Returns:
  44841  *      BCM_E_XXX
  44842  * Notes:
  44843  */
  44844 int 
  44845 bcm_esw_field_qualify_MimlVlan_get(
  44846     int unit, 
  44847     bcm_field_entry_t entry, 
  44848     bcm_vlan_t *data, 
  44849     bcm_vlan_t *mask)
  44850 {
  44851     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44852 
  44853 #ifdef BCM_HURRICANE3_SUPPORT
  44854     uint8  hw_data;  /* Installed entry value. */
  44855     uint8  hw_mask;  /* Installed entry mask. */
  44856 
  44857     if (soc_feature(unit, soc_feature_miml)) {
  44858         if ((NULL == data) || (NULL == mask)) {
  44859             return (BCM_E_PARAM);
  44860         }
  44861     
  44862         rv = bcm_esw_field_qualify_MimlVlanId_get(unit, entry, 
  44863                                                    data, mask);
  44864         BCM_IF_ERROR_RETURN(rv);
  44865     
  44866         rv = bcm_esw_field_qualify_MimlVlanCfi_get(unit, entry,
  44867                                                     &hw_data, &hw_mask); 
  44868         BCM_IF_ERROR_RETURN(rv);
  44869         *data |= (hw_data << 12);
  44870         *mask |= (hw_mask << 12);
  44871     
  44872         rv = bcm_esw_field_qualify_MimlVlanPri_get(unit, entry,
  44873                                                     &hw_data, &hw_mask);
  44874         BCM_IF_ERROR_RETURN(rv);
  44875         *data |= (hw_data << 13);
  44876         *mask |= (hw_mask << 13);
  44877     }
  44878 #endif /* BCM_HURRICANE3_SUPPORT */
  44879 
  44880     return (rv);
  44881 }
  44882 
  44883 /*
  44884  * Function:
  44885  *      bcm_esw_field_qualify_MimlVlanId_get
  44886  * Purpose:
  44887  *       Get match criteria for bcmFieildQualifyMimlVlanId
  44888  *                       qualifier from the field entry.
  44889  * Parameters:
  44890  *      unit - (IN) Unit number.
  44891  *      entry - (IN) BCM field entry id.
  44892  *      data - (OUT) Qualifier match data.
  44893  *      mask - (OUT) Qualifier match data.
  44894  * Returns:
  44895  *      BCM_E_XXX
  44896  * Notes:
  44897  */
  44898 int 
  44899 bcm_esw_field_qualify_MimlVlanId_get(
  44900     int unit, 
  44901     bcm_field_entry_t entry, 
  44902     bcm_vlan_t *data, 
  44903     bcm_vlan_t *mask)
  44904 {
  44905     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44906 
  44907 #ifdef BCM_HURRICANE3_SUPPORT
  44908     if (soc_feature(unit, soc_feature_miml)) {
  44909         /* Read qualifier match value and mask. */ 
  44910         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  44911                                             bcmFieldQualifyMimlVlanId,
  44912                                             data, mask);
  44913     }
  44914 #endif /* BCM_HURRICANE3_SUPPORT */
  44915 
  44916     return (rv);
  44917 }
  44918 
  44919 /*
  44920  * Function:
  44921  *      bcm_esw_field_qualify_MimlVlanPri_get
  44922  * Purpose:
  44923  *       Get match criteria for bcmFieildQualifyMimlVlanPri
  44924  *                       qualifier from the field entry.
  44925  * Parameters:
  44926  *      unit - (IN) Unit number.
  44927  *      entry - (IN) BCM field entry id.
  44928  *      data - (OUT) Qualifier match data.
  44929  *      mask - (OUT) Qualifier match mask.
  44930  * Returns:
  44931  *      BCM_E_XXX
  44932  * Notes:
  44933  */
  44934 int 
  44935 bcm_esw_field_qualify_MimlVlanPri_get(
  44936     int unit, 
  44937     bcm_field_entry_t entry, 
  44938     uint8 *data, 
  44939     uint8 *mask)
  44940 {
  44941     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44942 
  44943 #ifdef BCM_HURRICANE3_SUPPORT
  44944     if (soc_feature(unit, soc_feature_miml)) {
  44945         /* Read qualifier match value and mask. */ 
  44946         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  44947                                             bcmFieldQualifyMimlVlanPri,
  44948                                             data, mask);
  44949     }
  44950 #endif /* BCM_HURRICANE3_SUPPORT */
  44951 
  44952     return (rv);
  44953 }
  44954 
  44955 /*
  44956  * Function:
  44957  *      bcm_esw_field_qualify_MimlVlanCfi_get
  44958  * Purpose:
  44959  *       Get match criteria for bcmFieildQualifyMimlVlanCfi_get
  44960  *                       qualifier from the field entry.
  44961  * Parameters:
  44962  *      unit - (IN) Unit number.
  44963  *      entry - (IN) BCM field entry id.
  44964  *      data - (OUT) Qualifier match data.
  44965  *      mask - (OUT) Qualifier match mask.
  44966  * Returns:
  44967  *      BCM_E_XXX
  44968  * Notes:
  44969  */
  44970 int 
  44971 bcm_esw_field_qualify_MimlVlanCfi_get(
  44972     int unit, 
  44973     bcm_field_entry_t entry, 
  44974     uint8 *data, 
  44975     uint8 *mask)
  44976 {
  44977     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  44978 
  44979 #ifdef BCM_HURRICANE3_SUPPORT
  44980     if (soc_feature(unit, soc_feature_miml)) {
  44981         /* Read qualifier match value and mask. */ 
  44982         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  44983                                             bcmFieldQualifyMimlVlanCfi,
  44984                                             data, mask);
  44985     }
  44986 #endif /* BCM_HURRICANE3_SUPPORT */
  44987 
  44988     return (rv);
  44989 }
  44990 
  44991 /*
  44992  * Function:
  44993  *      bcm_esw_field_qualify_MimlInnerTag
  44994  * Purpose:
  44995  *       Set match criteria for bcmFieildQualifyMimlInnerTag
  44996  *                       qualifier in the field entry.
  44997  * Parameters:
  44998  *      unit - (IN) Unit number.
  44999  *      entry - (IN) BCM field entry id.
  45000  *      data - (IN) Qualifier match data.
  45001  *      mask - (IN) Qualifier match data.
  45002  * Returns:
  45003  *      BCM_E_XXX
  45004  * Notes:
  45005  */
  45006 int 
  45007 bcm_esw_field_qualify_MimlInnerTag(
  45008     int unit, 
  45009     bcm_field_entry_t entry, 
  45010     uint32 data, 
  45011     uint32 mask)
  45012 {
  45013     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45014 
  45015 #ifdef BCM_HURRICANE3_SUPPORT
  45016     if (soc_feature(unit, soc_feature_miml)) {
  45017         /* Read qualifier match value and mask. */ 
  45018         rv = _bcm_esw_field_qualify_aux_tag(unit,
  45019                                            entry,
  45020                                            bcmFieldQualifyMimlInnerTag,
  45021                                            data,
  45022                                            mask);
  45023     }
  45024 #endif /* BCM_HURRICANE3_SUPPORT */
  45025 
  45026     return (rv);
  45027 }
  45028 
  45029 /*
  45030  * Function:
  45031  *      bcm_esw_field_qualify_MimlInnerTag_get
  45032  * Purpose:
  45033  *       Get match criteria for bcmFieildQualifyMimlInnerTag_get
  45034  *                       qualifier from the field entry.
  45035  * Parameters:
  45036  *      unit - (IN) Unit number.
  45037  *      entry - (IN) BCM field entry id.
  45038  *      data - (OUT) Qualifier match data.
  45039  *      mask - (OUT) Qualifier match mask.
  45040  * Returns:
  45041  *      BCM_E_XXX
  45042  * Notes:
  45043  */
  45044 int 
  45045 bcm_esw_field_qualify_MimlInnerTag_get(
  45046     int unit, 
  45047     bcm_field_entry_t entry, 
  45048     uint32 *data, 
  45049     uint32 *mask)
  45050 {
  45051     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45052 
  45053 #ifdef BCM_HURRICANE3_SUPPORT
  45054     if (soc_feature(unit, soc_feature_miml)) {
  45055         /* Read qualifier match value and mask. */ 
  45056         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  45057                                             bcmFieldQualifyMimlInnerTag,
  45058                                             data, mask);
  45059     }
  45060 #endif /* BCM_HURRICANE3_SUPPORT */
  45061 
  45062     return (rv);
  45063 }
  45064 
  45065 /* 
  45066  * Set match criteria for bcmFieldQualifyCapwapHdrType
  45067  *                qualifier in the field entry.
  45068  */
  45069 int 
  45070 bcm_esw_field_qualify_CapwapHdrType(
  45071     int unit, 
  45072     bcm_field_entry_t entry, 
  45073     uint8 data, 
  45074     uint8 mask)
  45075 {
  45076     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  45077 #ifdef BCM_HURRICANE3_SUPPORT
  45078 
  45079     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45080 
  45081         /* Add in AUX_TAG_VALID */
  45082         data |= 1 << 1;
  45083         mask |= 1 << 1;
  45084         
  45085         
  45086         FP_LOCK(unit);
  45087     
  45088         rv = _field_qualify32(unit, entry, 
  45089             bcmFieldQualifyCapwapHdrType, data, mask);
  45090     
  45091         FP_UNLOCK(unit);
  45092     }
  45093 #endif /* BCM_HURRICANE3_SUPPORT */
  45094 
  45095     return (rv);
  45096 
  45097 }
  45098 
  45099 /* 
  45100  * Get match criteria for bcmFieldQualifyCapwapHdrType
  45101  *                qualifier from the field entry.
  45102  */
  45103 int 
  45104 bcm_esw_field_qualify_CapwapHdrType_get(
  45105     int unit, 
  45106     bcm_field_entry_t entry, 
  45107     uint8 *data, 
  45108     uint8 *mask)
  45109 {
  45110     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45111 
  45112 #ifdef BCM_HURRICANE3_SUPPORT
  45113     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45114         /* Read qualifier match value and mask. */ 
  45115         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  45116                                             bcmFieldQualifyCapwapHdrType,
  45117                                             data, mask);
  45118 
  45119         /* Mask off AUX_TAG_VALID */
  45120         *data &= 1;
  45121         *mask &= 1;
  45122     }
  45123 #endif /* BCM_HURRICANE3_SUPPORT */
  45124 
  45125     return (rv);
  45126 }
  45127 
  45128 /* 
  45129  * Set match criteria for bcmFieldQualifyCapwapHdrRid
  45130  *                qualifier in the field entry.
  45131  */
  45132 int 
  45133 bcm_esw_field_qualify_CapwapHdrRid(
  45134     int unit, 
  45135     bcm_field_entry_t entry, 
  45136     uint8 data, 
  45137     uint8 mask)
  45138 {
  45139     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  45140 #ifdef BCM_HURRICANE3_SUPPORT
  45141 
  45142     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45143 
  45144         /* Add in AUX_TAG_VALID */
  45145         data |= 1 << 5;
  45146         mask |= 1 << 5;
  45147         
  45148         
  45149         FP_LOCK(unit);
  45150     
  45151         rv = _field_qualify32(unit, entry, 
  45152             bcmFieldQualifyCapwapHdrRid, data, mask);
  45153     
  45154         FP_UNLOCK(unit);
  45155     }
  45156 #endif /* BCM_HURRICANE3_SUPPORT */
  45157 
  45158     return (rv);
  45159 }
  45160 
  45161 /* 
  45162  * Get match criteria for bcmFieldQualifyCapwapHdrRid
  45163  *                qualifier from the field entry.
  45164  */
  45165 int 
  45166 bcm_esw_field_qualify_CapwapHdrRid_get(
  45167     int unit, 
  45168     bcm_field_entry_t entry, 
  45169     uint8 *data, 
  45170     uint8 *mask)
  45171 {
  45172     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45173 
  45174 #ifdef BCM_HURRICANE3_SUPPORT
  45175     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45176         /* Read qualifier match value and mask. */ 
  45177         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  45178                                             bcmFieldQualifyCapwapHdrRid,
  45179                                             data, mask);
  45180 
  45181         /* Mask off AUX_TAG_VALID */
  45182        *data &= (1 << 5) - 1;
  45183        *mask &= (1 << 5) - 1;
  45184     }
  45185 #endif /* BCM_HURRICANE3_SUPPORT */
  45186 
  45187     return (rv);
  45188 }
  45189 
  45190 /* 
  45191  * Set match criteria for bcmFieldQualifyCapwapPayloadSOF
  45192  *                qualifier in the field entry.
  45193  */
  45194 int 
  45195 bcm_esw_field_qualify_CapwapPayloadSOF(
  45196     int unit, 
  45197     bcm_field_entry_t entry, 
  45198     uint8 data, 
  45199     uint8 mask)
  45200 {
  45201     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  45202 #ifdef BCM_HURRICANE3_SUPPORT
  45203 
  45204     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45205 
  45206         /* Add in AUX_TAG_VALID */
  45207         data |= 1 << 1;
  45208         mask |= 1 << 1;
  45209         
  45210         
  45211         FP_LOCK(unit);
  45212     
  45213         rv = _field_qualify32(unit, entry, 
  45214             bcmFieldQualifyCapwapPayloadSOF, data, mask);
  45215     
  45216         FP_UNLOCK(unit);
  45217     }
  45218 #endif /* BCM_HURRICANE3_SUPPORT */
  45219 
  45220     return (rv);
  45221 }
  45222 
  45223 /* 
  45224  * Get match criteria for bcmFieldQualifyCapwapPayloadSOF
  45225  *                qualifier from the field entry.
  45226  */
  45227 int 
  45228 bcm_esw_field_qualify_CapwapPayloadSOF_get(
  45229     int unit, 
  45230     bcm_field_entry_t entry, 
  45231     uint8 *data, 
  45232     uint8 *mask)
  45233 {
  45234     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45235 
  45236 #ifdef BCM_HURRICANE3_SUPPORT
  45237     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45238         /* Read qualifier match value and mask. */ 
  45239         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  45240                                             bcmFieldQualifyCapwapPayloadSOF,
  45241                                             data, mask);
  45242         
  45243         /* Mask off AUX_TAG_VALID */
  45244         *data &= 1;
  45245         *mask &= 1;
  45246     }
  45247 #endif /* BCM_HURRICANE3_SUPPORT */
  45248 
  45249     return (rv);
  45250 }
  45251 
  45252 /* 
  45253  * Set match criteria for bcmFieldQualifyCapwapPayloadDstMac
  45254  *                qualifier in the field entry.
  45255  */
  45256 int 
  45257 bcm_esw_field_qualify_CapwapPayloadDstMac(
  45258     int unit, 
  45259     bcm_field_entry_t entry, 
  45260     bcm_mac_t data, 
  45261     bcm_mac_t mask)
  45262 {
  45263     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  45264 #ifdef BCM_HURRICANE3_SUPPORT
  45265 
  45266     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45267         
  45268         FP_LOCK(unit);
  45269 
  45270         rv = _field_qualify_macaddr(unit, entry, 
  45271                                     bcmFieldQualifyCapwapPayloadDstMac,
  45272                                     data, mask);
  45273     
  45274         FP_UNLOCK(unit);
  45275     }
  45276 #endif /* BCM_HURRICANE3_SUPPORT */
  45277 
  45278     return (rv);
  45279 }
  45280 
  45281 /* 
  45282  * Get match criteria for CapwapPayloadDstMac
  45283  *                qualifier from the field entry.
  45284  */
  45285 int 
  45286 bcm_esw_field_qualify_CapwapPayloadDstMac_get(
  45287     int unit, 
  45288     bcm_field_entry_t entry, 
  45289     bcm_mac_t *data, 
  45290     bcm_mac_t *mask)
  45291 {
  45292     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45293 
  45294 #ifdef BCM_HURRICANE3_SUPPORT
  45295     /* Read qualifier match value and mask. */
  45296     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45297         rv = _field_qualify_macaddr_get(unit, entry, 
  45298                                    bcmFieldQualifyCapwapPayloadDstMac,
  45299                                    data, mask);
  45300     }
  45301 #endif /* BCM_HURRICANE3_SUPPORT */
  45302 
  45303     return (rv);
  45304 }
  45305 
  45306 /* 
  45307  * Set match criteria for bcmFieldQualifyCapwapPayloadSrcMac
  45308  *                qualifier in the field entry.
  45309  */
  45310 int 
  45311 bcm_esw_field_qualify_CapwapPayloadSrcMac(
  45312     int unit, 
  45313     bcm_field_entry_t entry, 
  45314     bcm_mac_t data, 
  45315     bcm_mac_t mask)
  45316 {
  45317     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  45318 #ifdef BCM_HURRICANE3_SUPPORT
  45319 
  45320     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45321         
  45322         FP_LOCK(unit);
  45323 
  45324         
  45325         rv = _field_qualify_macaddr(unit, entry, 
  45326                                    bcmFieldQualifyCapwapPayloadSrcMac,
  45327                                    data, mask);
  45328     
  45329         FP_UNLOCK(unit);
  45330     }
  45331 #endif /* BCM_HURRICANE3_SUPPORT */
  45332 
  45333     return (rv);
  45334 }
  45335 
  45336 /* 
  45337  * Get match criteria for bcmFieldQualifyCapwapPayloadSrcMac
  45338  *                qualifier from the field entry.
  45339  */
  45340 int 
  45341 bcm_esw_field_qualify_CapwapPayloadSrcMac_get(
  45342     int unit, 
  45343     bcm_field_entry_t entry, 
  45344     bcm_mac_t *data, 
  45345     bcm_mac_t *mask)
  45346 {
  45347     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45348 
  45349 #ifdef BCM_HURRICANE3_SUPPORT
  45350     /* Read qualifier match value and mask. */
  45351     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45352         rv = _field_qualify_macaddr_get(unit, entry, 
  45353                                    bcmFieldQualifyCapwapPayloadSrcMac,
  45354                                    data, mask);
  45355     }
  45356 #endif /* BCM_HURRICANE3_SUPPORT */
  45357 
  45358     return (rv);
  45359 }
  45360 
  45361 /* 
  45362  * Configure match criteria for bcmFieldQualifyCapwapPayloadEtherType
  45363  *             qualifier from the field entry.
  45364  */
  45365 int 
  45366 bcm_esw_field_qualify_CapwapPayloadEtherType(
  45367     int unit, 
  45368     bcm_field_entry_t entry, 
  45369     uint16 data, 
  45370     uint16 mask)
  45371 {
  45372     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  45373 #ifdef BCM_HURRICANE3_SUPPORT
  45374 
  45375     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45376         
  45377         FP_LOCK(unit);
  45378     
  45379         rv = _field_qualify32(unit, entry, 
  45380             bcmFieldQualifyCapwapPayloadEtherType, data, mask);
  45381     
  45382         FP_UNLOCK(unit);
  45383     }
  45384 #endif /* BCM_HURRICANE3_SUPPORT */
  45385 
  45386     return (rv);
  45387 }
  45388 
  45389 /* 
  45390  * Get match criteria for bcmFieldQualifyCapwapPayloadEtherType
  45391  *             qualifier from the field entry.
  45392  */
  45393 int 
  45394 bcm_esw_field_qualify_CapwapPayloadEtherType_get(
  45395     int unit, 
  45396     bcm_field_entry_t entry, 
  45397     uint16 *data, 
  45398     uint16 *mask)
  45399 {
  45400     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45401 
  45402 #ifdef BCM_HURRICANE3_SUPPORT
  45403     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45404         /* Read qualifier match value and mask. */ 
  45405         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  45406                                 bcmFieldQualifyCapwapPayloadEtherType,
  45407                                 data, mask);
  45408     }
  45409 #endif /* BCM_HURRICANE3_SUPPORT */
  45410 
  45411     return (rv);
  45412 }
  45413 
  45414 /* 
  45415  * Set match criteria for bcmFieldQualifyCapwapPayloadOuterVlan
  45416  *                  qualifier in the field entry.
  45417  */
  45418 int 
  45419 bcm_esw_field_qualify_CapwapPayloadOuterVlan(
  45420     int unit, 
  45421     bcm_field_entry_t entry, 
  45422     bcm_vlan_t data, 
  45423     bcm_vlan_t mask)
  45424 {
  45425     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  45426 #ifdef BCM_HURRICANE3_SUPPORT
  45427 
  45428     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45429         rv = bcm_esw_field_qualify_CapwapPayloadOuterVlanId(unit, entry, 
  45430                                                (data & 0xfff), 
  45431                                                (mask & 0xfff));
  45432         BCM_IF_ERROR_RETURN(rv);
  45433     
  45434         rv = bcm_esw_field_qualify_CapwapPayloadOuterVlanCfi(unit, entry, 
  45435                                                 ((data >> 12) & 0x1),
  45436                                                 ((mask >> 12) & 0x1));
  45437         BCM_IF_ERROR_RETURN(rv);
  45438     
  45439         rv = bcm_esw_field_qualify_CapwapPayloadOuterVlanPri(unit, entry,
  45440                                                 (data >> 13),
  45441                                                 (mask >> 13));
  45442     }
  45443 #endif /* BCM_HURRICANE3_SUPPORT */
  45444 
  45445     return (rv);
  45446 }
  45447 
  45448 /* 
  45449  * Get match criteria for bcmFieldQualifyCapwapPayloadOuterVlan
  45450  *                qualifier from the field entry.
  45451  */
  45452 int 
  45453 bcm_esw_field_qualify_CapwapPayloadOuterVlan_get(
  45454     int unit, 
  45455     bcm_field_entry_t entry, 
  45456     bcm_vlan_t *data, 
  45457     bcm_vlan_t *mask)
  45458 {
  45459     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45460 
  45461 #ifdef BCM_HURRICANE3_SUPPORT
  45462     uint8  hw_data;  /* Installed entry value. */
  45463     uint8  hw_mask;  /* Installed entry mask. */
  45464 
  45465     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45466         if ((NULL == data) || (NULL == mask)) {
  45467             return (BCM_E_PARAM);
  45468         }
  45469     
  45470         rv = bcm_esw_field_qualify_CapwapPayloadOuterVlanId_get(unit, entry, 
  45471                                                    data, mask);
  45472         BCM_IF_ERROR_RETURN(rv);
  45473     
  45474         rv = bcm_esw_field_qualify_CapwapPayloadOuterVlanCfi_get(unit, entry,
  45475                                                     &hw_data, &hw_mask); 
  45476         BCM_IF_ERROR_RETURN(rv);
  45477         *data |= (hw_data << 12);
  45478         *mask |= (hw_mask << 12);
  45479     
  45480         rv = bcm_esw_field_qualify_CapwapPayloadOuterVlanPri_get(unit, entry,
  45481                                                     &hw_data, &hw_mask);
  45482         BCM_IF_ERROR_RETURN(rv);
  45483         *data |= (hw_data << 13);
  45484         *mask |= (hw_mask << 13);
  45485     }
  45486 #endif /* BCM_HURRICANE3_SUPPORT */
  45487 
  45488     return (rv);
  45489 }
  45490 
  45491 /* 
  45492  * Set match criteria for bcmFieldQualifyCapwapPayloadOuterVlanId
  45493  *                  qualifier in the field entry.
  45494  */
  45495 int 
  45496 bcm_esw_field_qualify_CapwapPayloadOuterVlanId(
  45497     int unit, 
  45498     bcm_field_entry_t entry, 
  45499     bcm_vlan_t data, 
  45500     bcm_vlan_t mask)
  45501 {
  45502     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45503 
  45504 #ifdef BCM_HURRICANE3_SUPPORT
  45505 
  45506     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45507         
  45508         FP_LOCK(unit);
  45509     
  45510         rv = _field_qualify32(unit, entry, 
  45511             bcmFieldQualifyCapwapPayloadOuterVlanId, data, mask);
  45512     
  45513         FP_UNLOCK(unit);
  45514     }
  45515 #endif /* BCM_HURRICANE3_SUPPORT */
  45516 
  45517     return (rv);
  45518 }
  45519 
  45520 /* 
  45521  * Get match criteria for bcmFieldQualifyCapwapPayloadOuterVlanId
  45522  *                  qualifier from the field entry.
  45523  */
  45524 int 
  45525 bcm_esw_field_qualify_CapwapPayloadOuterVlanId_get(
  45526     int unit, 
  45527     bcm_field_entry_t entry, 
  45528     bcm_vlan_t *data, 
  45529     bcm_vlan_t *mask)
  45530 {
  45531     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45532 
  45533 #ifdef BCM_HURRICANE3_SUPPORT
  45534     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45535         /* Read qualifier match value and mask. */ 
  45536         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  45537                                 bcmFieldQualifyCapwapPayloadOuterVlanId,
  45538                                 data, mask);
  45539     }
  45540 #endif /* BCM_HURRICANE3_SUPPORT */
  45541 
  45542     return (rv);
  45543 }
  45544 
  45545 /* 
  45546  * Set match criteria for bcmFieldQualifyCapwapPayloadOuterVlanPri
  45547  *                  qualifier in the field entry.
  45548  */
  45549 int 
  45550 bcm_esw_field_qualify_CapwapPayloadOuterVlanPri(
  45551     int unit, 
  45552     bcm_field_entry_t entry, 
  45553     uint8 data, 
  45554     uint8 mask)
  45555 {
  45556     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45557 
  45558 #ifdef BCM_HURRICANE3_SUPPORT
  45559 
  45560     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45561         
  45562         FP_LOCK(unit);
  45563     
  45564         rv = _field_qualify32(unit, entry, 
  45565             bcmFieldQualifyCapwapPayloadOuterVlanPri, data, mask);
  45566     
  45567         FP_UNLOCK(unit);
  45568     }
  45569 #endif /* BCM_HURRICANE3_SUPPORT */
  45570 
  45571     return (rv);
  45572 }
  45573 
  45574 /* 
  45575  * Get match criteria for bcmFieldQualifyCapwapPayloadOuterVlanPri
  45576  *                  qualifier from the field entry.
  45577  */
  45578 int 
  45579 bcm_esw_field_qualify_CapwapPayloadOuterVlanPri_get(
  45580     int unit, 
  45581     bcm_field_entry_t entry, 
  45582     uint8 *data, 
  45583     uint8 *mask)
  45584 {
  45585     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45586 
  45587 #ifdef BCM_HURRICANE3_SUPPORT
  45588     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45589         /* Read qualifier match value and mask. */ 
  45590         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  45591                                 bcmFieldQualifyCapwapPayloadOuterVlanPri,
  45592                                 data, mask);
  45593     }
  45594 #endif /* BCM_HURRICANE3_SUPPORT */
  45595 
  45596     return (rv);
  45597 }
  45598 
  45599 /* 
  45600  * Set match criteria for bcmFieldQualifyCapwapPayloadOuterVlanCfi
  45601  *                  qualifier in the field entry.
  45602  */
  45603 int 
  45604 bcm_esw_field_qualify_CapwapPayloadOuterVlanCfi(
  45605     int unit, 
  45606     bcm_field_entry_t entry, 
  45607     uint8 data, 
  45608     uint8 mask)
  45609 {
  45610     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45611 
  45612 #ifdef BCM_HURRICANE3_SUPPORT
  45613 
  45614     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45615         
  45616         FP_LOCK(unit);
  45617     
  45618         rv = _field_qualify32(unit, entry, 
  45619             bcmFieldQualifyCapwapPayloadOuterVlanCfi, data, mask);
  45620     
  45621         FP_UNLOCK(unit);
  45622     }
  45623 #endif /* BCM_HURRICANE3_SUPPORT */
  45624 
  45625     return (rv);
  45626 }
  45627 
  45628 /* 
  45629  * Get match criteria for bcmFieldQualifyCapwapPayloadOuterVlanCfi_get
  45630  *                  qualifier from the field entry.
  45631  */
  45632 int 
  45633 bcm_esw_field_qualify_CapwapPayloadOuterVlanCfi_get(
  45634     int unit, 
  45635     bcm_field_entry_t entry, 
  45636     uint8 *data, 
  45637     uint8 *mask)
  45638 {
  45639     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45640 
  45641 #ifdef BCM_HURRICANE3_SUPPORT
  45642     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45643         /* Read qualifier match value and mask. */ 
  45644         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  45645                                 bcmFieldQualifyCapwapPayloadOuterVlanCfi,
  45646                                 data, mask);
  45647     }
  45648 #endif /* BCM_HURRICANE3_SUPPORT */
  45649 
  45650     return (rv);
  45651 }
  45652 
  45653 /* 
  45654  * Set match criteria for bcmFieldQualifyCapwapPayloadInnerVlan
  45655  *                  qualifier in the field entry.
  45656  */
  45657 int 
  45658 bcm_esw_field_qualify_CapwapPayloadInnerVlan(
  45659     int unit, 
  45660     bcm_field_entry_t entry, 
  45661     bcm_vlan_t data, 
  45662     bcm_vlan_t mask)
  45663 {
  45664     int  rv = BCM_E_UNAVAIL; /* Operation return status.  */
  45665 #ifdef BCM_HURRICANE3_SUPPORT
  45666 
  45667     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45668         rv = bcm_esw_field_qualify_CapwapPayloadInnerVlanId(unit, entry, 
  45669                                                (data & 0xfff), 
  45670                                                (mask & 0xfff));
  45671         BCM_IF_ERROR_RETURN(rv);
  45672     
  45673         rv = bcm_esw_field_qualify_CapwapPayloadInnerVlanCfi(unit, entry, 
  45674                                                 ((data >> 12) & 0x1),
  45675                                                 ((mask >> 12) & 0x1));
  45676         BCM_IF_ERROR_RETURN(rv);
  45677     
  45678         rv = bcm_esw_field_qualify_CapwapPayloadInnerVlanPri(unit, entry,
  45679                                                 (data >> 13),
  45680                                                 (mask >> 13));
  45681     }
  45682 #endif /* BCM_HURRICANE3_SUPPORT */
  45683 
  45684     return (rv);
  45685 }
  45686 
  45687 /* 
  45688  * Get match criteria for bcmFieldQualifyCapwapPayloadInnerVlan
  45689  *                qualifier from the field entry.
  45690  */
  45691 int 
  45692 bcm_esw_field_qualify_CapwapPayloadInnerVlan_get(
  45693     int unit, 
  45694     bcm_field_entry_t entry, 
  45695     bcm_vlan_t *data, 
  45696     bcm_vlan_t *mask)
  45697 {
  45698     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45699 
  45700 #ifdef BCM_HURRICANE3_SUPPORT
  45701     uint8  hw_data;  /* Installed entry value. */
  45702     uint8  hw_mask;  /* Installed entry mask. */
  45703 
  45704     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45705         if ((NULL == data) || (NULL == mask)) {
  45706             return (BCM_E_PARAM);
  45707         }
  45708     
  45709         rv = bcm_esw_field_qualify_CapwapPayloadInnerVlanId_get(unit, entry, 
  45710                                                    data, mask);
  45711         BCM_IF_ERROR_RETURN(rv);
  45712     
  45713         rv = bcm_esw_field_qualify_CapwapPayloadInnerVlanCfi_get(unit, entry,
  45714                                                     &hw_data, &hw_mask); 
  45715         BCM_IF_ERROR_RETURN(rv);
  45716         *data |= (hw_data << 12);
  45717         *mask |= (hw_mask << 12);
  45718     
  45719         rv = bcm_esw_field_qualify_CapwapPayloadInnerVlanPri_get(unit, entry,
  45720                                                     &hw_data, &hw_mask);
  45721         BCM_IF_ERROR_RETURN(rv);
  45722         *data |= (hw_data << 13);
  45723         *mask |= (hw_mask << 13);
  45724     }
  45725 #endif /* BCM_HURRICANE3_SUPPORT */
  45726 
  45727     return (rv);
  45728 }
  45729 
  45730 /* 
  45731  * Set match criteria for bcmFieldQualifyCapwapPayloadInnerVlanId
  45732  *                  qualifier in the field entry.
  45733  */
  45734 int 
  45735 bcm_esw_field_qualify_CapwapPayloadInnerVlanId(
  45736     int unit, 
  45737     bcm_field_entry_t entry, 
  45738     bcm_vlan_t data, 
  45739     bcm_vlan_t mask)
  45740 {
  45741     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45742 
  45743 #ifdef BCM_HURRICANE3_SUPPORT
  45744 
  45745     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45746         
  45747         /* Add in AUX_TAG_VALID */
  45748         data |= 1 << 12;
  45749         mask |= 1 << 12;
  45750         
  45751         
  45752         FP_LOCK(unit);
  45753     
  45754         rv = _field_qualify32(unit, entry, 
  45755             bcmFieldQualifyCapwapPayloadInnerVlanId, data, mask);
  45756     
  45757         FP_UNLOCK(unit);
  45758     }
  45759 #endif /* BCM_HURRICANE3_SUPPORT */
  45760 
  45761     return (rv);
  45762 }
  45763 
  45764 /* 
  45765  * Get match criteria for bcmFieldQualifyCapwapPayloadInnerVlanId
  45766  *                  qualifier from the field entry.
  45767  */
  45768 int 
  45769 bcm_esw_field_qualify_CapwapPayloadInnerVlanId_get(
  45770     int unit, 
  45771     bcm_field_entry_t entry, 
  45772     bcm_vlan_t *data, 
  45773     bcm_vlan_t *mask)
  45774 {
  45775     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45776 
  45777 #ifdef BCM_HURRICANE3_SUPPORT
  45778     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45779         /* Read qualifier match value and mask. */ 
  45780         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  45781                                 bcmFieldQualifyCapwapPayloadInnerVlanId,
  45782                                 data, mask);
  45783         /* Mask off AUX_TAG_VALID */
  45784        *data &= (1 << 12) - 1;
  45785        *mask &= (1 << 12) - 1;
  45786     }
  45787 #endif /* BCM_HURRICANE3_SUPPORT */
  45788 
  45789     return (rv);
  45790 }
  45791 
  45792 /* 
  45793  * Set match criteria for bcmFieldQualifyCapwapPayloadInnerVlanPri
  45794  *                  qualifier in the field entry.
  45795  */
  45796 int 
  45797 bcm_esw_field_qualify_CapwapPayloadInnerVlanPri(
  45798     int unit, 
  45799     bcm_field_entry_t entry, 
  45800     uint8 data, 
  45801     uint8 mask)
  45802 {
  45803     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45804 
  45805 #ifdef BCM_HURRICANE3_SUPPORT
  45806 
  45807     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45808 
  45809         /* Add in AUX_TAG_VALID */
  45810         data |= 1 << 3;
  45811         mask |= 1 << 3;
  45812         
  45813         
  45814         FP_LOCK(unit);
  45815     
  45816         rv = _field_qualify32(unit, entry, 
  45817             bcmFieldQualifyCapwapPayloadInnerVlanPri, data, mask);
  45818     
  45819         FP_UNLOCK(unit);
  45820     }
  45821 #endif /* BCM_HURRICANE3_SUPPORT */
  45822 
  45823     return (rv);
  45824 }
  45825 
  45826 /* 
  45827  * Get match criteria for bcmFieldQualifyCapwapPayloadInnerVlanPri
  45828  *                  qualifier from the field entry.
  45829  */
  45830 int 
  45831 bcm_esw_field_qualify_CapwapPayloadInnerVlanPri_get(
  45832     int unit, 
  45833     bcm_field_entry_t entry, 
  45834     uint8 *data, 
  45835     uint8 *mask)
  45836 {
  45837     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45838 
  45839 #ifdef BCM_HURRICANE3_SUPPORT
  45840     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45841         /* Read qualifier match value and mask. */ 
  45842         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  45843                                 bcmFieldQualifyCapwapPayloadInnerVlanPri,
  45844                                 data, mask);
  45845 
  45846         /* Mask off AUX_TAG_VALID */
  45847        *data &= (1 << 3) - 1;
  45848        *mask &= (1 << 3) - 1;
  45849     }
  45850 #endif /* BCM_HURRICANE3_SUPPORT */
  45851 
  45852     return (rv);
  45853 }
  45854 
  45855 /* 
  45856  * Set match criteria for bcmFieldQualifyCapwapPayloadInnerVlanCfi
  45857  *                  qualifier in the field entry.
  45858  */
  45859 int 
  45860 bcm_esw_field_qualify_CapwapPayloadInnerVlanCfi(
  45861     int unit, 
  45862     bcm_field_entry_t entry, 
  45863     uint8 data, 
  45864     uint8 mask)
  45865 {
  45866     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45867 
  45868 #ifdef BCM_HURRICANE3_SUPPORT
  45869 
  45870     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45871 
  45872         /* Add in AUX_TAG_VALID */
  45873         data |= 1 << 1;
  45874         mask |= 1 << 1;
  45875         
  45876         
  45877         FP_LOCK(unit);
  45878     
  45879         rv = _field_qualify32(unit, entry, 
  45880             bcmFieldQualifyCapwapPayloadInnerVlanCfi, data, mask);
  45881     
  45882         FP_UNLOCK(unit);
  45883     }
  45884 #endif /* BCM_HURRICANE3_SUPPORT */
  45885 
  45886     return (rv);
  45887 }
  45888 
  45889 /* 
  45890  * Get match criteria for bcmFieldQualifyCapwapPayloadInnerVlanCfi_get
  45891  *                  qualifier from the field entry.
  45892  */
  45893 int 
  45894 bcm_esw_field_qualify_CapwapPayloadInnerVlanCfi_get(
  45895     int unit, 
  45896     bcm_field_entry_t entry, 
  45897     uint8 *data, 
  45898     uint8 *mask)
  45899 {
  45900     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45901 
  45902 #ifdef BCM_HURRICANE3_SUPPORT
  45903     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45904         /* Read qualifier match value and mask. */ 
  45905         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  45906                                 bcmFieldQualifyCapwapPayloadInnerVlanCfi,
  45907                                 data, mask);
  45908 
  45909         /* Mask off AUX_TAG_VALID */
  45910         *data &= 1;
  45911         *mask &= 1;
  45912     }
  45913 #endif /* BCM_HURRICANE3_SUPPORT */
  45914 
  45915     return (rv);
  45916 }
  45917 
  45918 /* 
  45919  * Set match criteria for bcmFieldQualifyCapwapPayloadVlanFormat
  45920  *                  qualifier in the field entry.
  45921  */
  45922 int 
  45923 bcm_esw_field_qualify_CapwapPayloadVlanFormat(
  45924     int unit, 
  45925     bcm_field_entry_t entry, 
  45926     uint8 data, 
  45927     uint8 mask)
  45928 {
  45929     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45930 
  45931 #ifdef BCM_HURRICANE3_SUPPORT
  45932 
  45933     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45934 
  45935         if (soc_feature(unit, soc_feature_field_qual_vlanformat_reverse)) {
  45936             /* The position of outer and inner tagged bits are exchanged in Hw */
  45937             data = (((data & 0x2) >> 1) | ((data & 0x1) << 1)); 
  45938             mask = (((mask & 0x2) >> 1) | ((mask & 0x1) << 1));
  45939         }
  45940         
  45941         /* Add in AUX_TAG_VALID */
  45942         data |= 1 << 2;
  45943         mask |= 1 << 2;
  45944         
  45945         
  45946         FP_LOCK(unit);
  45947     
  45948         rv = _field_qualify32(unit, entry, 
  45949             bcmFieldQualifyCapwapPayloadVlanFormat, data, mask);
  45950     
  45951         FP_UNLOCK(unit);
  45952     }
  45953 #endif /* BCM_HURRICANE3_SUPPORT */
  45954 
  45955     return (rv);
  45956 }
  45957 
  45958 /* 
  45959  * Get match criteria for bcmFieldQualifyCapwapPayloadVlanFormat
  45960  *                  qualifier from the field entry.
  45961  */
  45962 int 
  45963 bcm_esw_field_qualify_CapwapPayloadVlanFormat_get(
  45964     int unit, 
  45965     bcm_field_entry_t entry, 
  45966     uint8 *data, 
  45967     uint8 *mask)
  45968 {
  45969     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  45970 
  45971 #ifdef BCM_HURRICANE3_SUPPORT
  45972     uint8  hw_data = 0;  /* Installed entry value. */
  45973     uint8  hw_mask = 0;  /* Installed entry mask. */
  45974     
  45975     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  45976         /* Read qualifier match value and mask. */ 
  45977         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  45978                                 bcmFieldQualifyCapwapPayloadVlanFormat,
  45979                                 &hw_data, &hw_mask);
  45980 
  45981         if (soc_feature(unit, soc_feature_field_qual_vlanformat_reverse)) {
  45982             /* The position of outer and inner tagged bits are exchanged in Hw */
  45983             *data = (((hw_data & 0x2) >> 1) | ((hw_data & 0x1) << 1));
  45984             *mask = (((hw_mask & 0x2) >> 1) | ((hw_mask & 0x1) << 1)); 
  45985         } else {
  45986         
  45987             /* Mask off AUX_TAG_VALID */
  45988             *data &= (1 << 2) - 1;
  45989             *mask &= (1 << 2) - 1;
  45990         }
  45991     }
  45992 #endif /* BCM_HURRICANE3_SUPPORT */
  45993 
  45994     return (rv);
  45995 }
  45996 
  45997 /* bcm_field_qualify_CapwapPayloadSip */
  45998 int 
  45999 bcm_esw_field_qualify_CapwapPayloadSip(
  46000     int unit, 
  46001     bcm_field_entry_t entry, 
  46002     bcm_ip_t data, 
  46003     bcm_ip_t mask)
  46004 {
  46005     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46006 
  46007 #ifdef BCM_HURRICANE3_SUPPORT
  46008 
  46009     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46010         
  46011         FP_LOCK(unit);
  46012     
  46013         rv = _field_qualify32(unit, entry, 
  46014             bcmFieldQualifyCapwapPayloadSip, data, mask);
  46015     
  46016         FP_UNLOCK(unit);
  46017     }
  46018 #endif /* BCM_HURRICANE3_SUPPORT */
  46019 
  46020     return (rv);
  46021 }
  46022 
  46023 /* bcm_field_qualify_CapwapPayloadDip */
  46024 int 
  46025 bcm_esw_field_qualify_CapwapPayloadDip(
  46026     int unit, 
  46027     bcm_field_entry_t entry, 
  46028     bcm_ip_t data, 
  46029     bcm_ip_t mask)
  46030 {
  46031     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46032 
  46033 #ifdef BCM_HURRICANE3_SUPPORT
  46034 
  46035     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46036         
  46037         FP_LOCK(unit);
  46038     
  46039         rv = _field_qualify32(unit, entry, 
  46040             bcmFieldQualifyCapwapPayloadDip, data, mask);
  46041     
  46042         FP_UNLOCK(unit);
  46043     }
  46044 #endif /* BCM_HURRICANE3_SUPPORT */
  46045 
  46046     return (rv);
  46047 
  46048 }
  46049 
  46050 /* 
  46051  * Get match criteria for bcmFieldQualifyCapwapPayloadSip
  46052  *                qualifier from the field entry.
  46053  */
  46054 int 
  46055 bcm_esw_field_qualify_CapwapPayloadSip_get(
  46056     int unit, 
  46057     bcm_field_entry_t entry, 
  46058     bcm_ip_t *data, 
  46059     bcm_ip_t *mask)
  46060 {
  46061     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46062 
  46063 #ifdef BCM_HURRICANE3_SUPPORT
  46064     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46065         /* Read qualifier match value and mask. */ 
  46066         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  46067                                   bcmFieldQualifyCapwapPayloadSip,
  46068                                   data, mask);
  46069     }
  46070 #endif /* BCM_HURRICANE3_SUPPORT */
  46071 
  46072     return (rv);
  46073 }
  46074 
  46075 /* 
  46076  * Get match criteria for bcmFieldQualifyCapwapPayloadDip
  46077  *                qualifier from the field entry.
  46078  */
  46079 int 
  46080 bcm_esw_field_qualify_CapwapPayloadDip_get(
  46081     int unit, 
  46082     bcm_field_entry_t entry, 
  46083     bcm_ip_t *data, 
  46084     bcm_ip_t *mask)
  46085 {
  46086     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46087 
  46088 #ifdef BCM_HURRICANE3_SUPPORT
  46089     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46090         /* Read qualifier match value and mask. */ 
  46091         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  46092                                   bcmFieldQualifyCapwapPayloadDip,
  46093                                   data, mask);
  46094     }
  46095 #endif /* BCM_HURRICANE3_SUPPORT */
  46096 
  46097     return (rv);
  46098 }
  46099 
  46100 /* bcm_field_qualify_CapwapPayloadSip6 */
  46101 int 
  46102 bcm_esw_field_qualify_CapwapPayloadSip6(
  46103     int unit, 
  46104     bcm_field_entry_t entry, 
  46105     bcm_ip6_t data, 
  46106     bcm_ip6_t mask)
  46107 {
  46108     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46109 
  46110 #ifdef BCM_HURRICANE3_SUPPORT
  46111 
  46112     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46113         
  46114         FP_LOCK(unit);
  46115     
  46116         rv = _field_qualify_ip6(unit, entry, 
  46117                             bcmFieldQualifyCapwapPayloadSip6, 
  46118                             data, mask);
  46119     
  46120         FP_UNLOCK(unit);
  46121     }
  46122 #endif /* BCM_HURRICANE3_SUPPORT */
  46123 
  46124     return (rv);
  46125 }
  46126 
  46127 /* bcm_field_qualify_CapwapPayloadDip6 */
  46128 int 
  46129 bcm_esw_field_qualify_CapwapPayloadDip6(
  46130     int unit, 
  46131     bcm_field_entry_t entry, 
  46132     bcm_ip6_t data, 
  46133     bcm_ip6_t mask)
  46134 {
  46135     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46136 
  46137 #ifdef BCM_HURRICANE3_SUPPORT
  46138 
  46139     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46140         
  46141         FP_LOCK(unit);
  46142     
  46143         rv = _field_qualify_ip6(unit, entry, 
  46144                             bcmFieldQualifyCapwapPayloadDip6, 
  46145                             data, mask);
  46146     
  46147         FP_UNLOCK(unit);
  46148     }
  46149 #endif /* BCM_HURRICANE3_SUPPORT */
  46150 
  46151     return (rv);
  46152 }
  46153 
  46154 /* 
  46155  * Get match criteria for bcmFieldQualifyCapwapPayloadSip6
  46156  *                qualifier from the field entry.
  46157  */
  46158 int 
  46159 bcm_esw_field_qualify_CapwapPayloadSip6_get(
  46160     int unit, 
  46161     bcm_field_entry_t entry, 
  46162     bcm_ip6_t *data, 
  46163     bcm_ip6_t *mask)
  46164 {
  46165     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46166 
  46167 #ifdef BCM_HURRICANE3_SUPPORT
  46168     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46169         /* Read qualifier match value and mask. */ 
  46170         rv = _field_qualify_ip6_get(unit, entry,
  46171                                   bcmFieldQualifyCapwapPayloadSip6,
  46172                                   data, mask);
  46173     }
  46174 #endif /* BCM_HURRICANE3_SUPPORT */
  46175 
  46176     return (rv);
  46177 
  46178 }
  46179 
  46180 /* 
  46181  * Get match criteria for bcmFieldQualifyCapwapPayloadDip6
  46182  *                qualifier from the field entry.
  46183  */
  46184 int 
  46185 bcm_esw_field_qualify_CapwapPayloadDip6_get(
  46186     int unit, 
  46187     bcm_field_entry_t entry, 
  46188     bcm_ip6_t *data, 
  46189     bcm_ip6_t *mask)
  46190 {
  46191     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46192 
  46193 #ifdef BCM_HURRICANE3_SUPPORT
  46194     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46195         /* Read qualifier match value and mask. */ 
  46196         rv = _field_qualify_ip6_get(unit, entry,
  46197                                   bcmFieldQualifyCapwapPayloadDip6,
  46198                                   data, mask);
  46199     }
  46200 #endif /* BCM_HURRICANE3_SUPPORT */
  46201 
  46202     return (rv);
  46203 }
  46204 
  46205 /* 
  46206  * Set match criteria for bcmFieldQualifyCapwapPayloadIpProtocol
  46207  *                  qualifier in the field entry.
  46208  */
  46209 int 
  46210 bcm_esw_field_qualify_CapwapPayloadIpProtocol(
  46211     int unit, 
  46212     bcm_field_entry_t entry, 
  46213     uint8 data, 
  46214     uint8 mask)
  46215 {
  46216     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46217 
  46218 #ifdef BCM_HURRICANE3_SUPPORT
  46219 
  46220     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46221         
  46222         FP_LOCK(unit);
  46223     
  46224         rv = _field_qualify32(unit, entry, 
  46225             bcmFieldQualifyCapwapPayloadIpProtocol, data, mask);
  46226     
  46227         FP_UNLOCK(unit);
  46228     }
  46229 #endif /* BCM_HURRICANE3_SUPPORT */
  46230 
  46231     return (rv);
  46232 }
  46233 
  46234 /* 
  46235  * Get match criteria for bcmFieldQualifyCapwapPayloadIpProtocol_get
  46236  *                  qualifier from the field entry.
  46237  */
  46238 int 
  46239 bcm_esw_field_qualify_CapwapPayloadIpProtocol_get(
  46240     int unit, 
  46241     bcm_field_entry_t entry, 
  46242     uint8 *data, 
  46243     uint8 *mask)
  46244 {
  46245     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46246 
  46247 #ifdef BCM_HURRICANE3_SUPPORT
  46248     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46249         /* Read qualifier match value and mask. */ 
  46250         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  46251                                 bcmFieldQualifyCapwapPayloadIpProtocol,
  46252                                 data, mask);
  46253     }
  46254 #endif /* BCM_HURRICANE3_SUPPORT */
  46255 
  46256     return (rv);
  46257 }
  46258 
  46259 /* 
  46260  * Set match criteria for bcmFieldQualifyCapwapPayloadTos
  46261  *                  qualifier in the field entry.
  46262  */
  46263 int 
  46264 bcm_esw_field_qualify_CapwapPayloadTos(
  46265     int unit, 
  46266     bcm_field_entry_t entry, 
  46267     uint8 data, 
  46268     uint8 mask)
  46269 {
  46270     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46271 
  46272 #ifdef BCM_HURRICANE3_SUPPORT
  46273 
  46274     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46275         
  46276         FP_LOCK(unit);
  46277     
  46278         rv = _field_qualify32(unit, entry, 
  46279             bcmFieldQualifyCapwapPayloadTos, data, mask);
  46280     
  46281         FP_UNLOCK(unit);
  46282     }
  46283 #endif /* BCM_HURRICANE3_SUPPORT */
  46284 
  46285     return (rv);
  46286 }
  46287 
  46288 /* 
  46289  * Get match criteria for bcmFieldQualifyCapwapPayloadTos_get
  46290  *                  qualifier from the field entry.
  46291  */
  46292 int 
  46293 bcm_esw_field_qualify_CapwapPayloadTos_get(
  46294     int unit, 
  46295     bcm_field_entry_t entry, 
  46296     uint8 *data, 
  46297     uint8 *mask)
  46298 {
  46299     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46300 
  46301 #ifdef BCM_HURRICANE3_SUPPORT
  46302     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46303         /* Read qualifier match value and mask. */ 
  46304         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  46305                                 bcmFieldQualifyCapwapPayloadTos,
  46306                                 data, mask);
  46307     }
  46308 #endif /* BCM_HURRICANE3_SUPPORT */
  46309 
  46310     return (rv);
  46311 }
  46312 
  46313 /* bcm_field_qualify_CapwapPayloadL4SrcPort */
  46314 int 
  46315 bcm_esw_field_qualify_CapwapPayloadL4SrcPort(
  46316     int unit, 
  46317     bcm_field_entry_t entry, 
  46318     bcm_l4_port_t data, 
  46319     bcm_l4_port_t mask)
  46320 {
  46321     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46322 
  46323 #ifdef BCM_HURRICANE3_SUPPORT
  46324 
  46325     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46326         
  46327         FP_LOCK(unit);
  46328     
  46329         rv = _field_qualify32(unit, entry, 
  46330             bcmFieldQualifyCapwapPayloadL4SrcPort, data, mask);
  46331     
  46332         FP_UNLOCK(unit);
  46333     }
  46334 #endif /* BCM_HURRICANE3_SUPPORT */
  46335 
  46336     return (rv);
  46337 }
  46338 
  46339 /* bcm_field_qualify_CapwapPayloadL4DstPort */
  46340 int 
  46341 bcm_esw_field_qualify_CapwapPayloadL4DstPort(
  46342     int unit, 
  46343     bcm_field_entry_t entry, 
  46344     bcm_l4_port_t data, 
  46345     bcm_l4_port_t mask)
  46346 {
  46347     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46348 
  46349 #ifdef BCM_HURRICANE3_SUPPORT
  46350 
  46351     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46352         
  46353         FP_LOCK(unit);
  46354     
  46355         rv = _field_qualify32(unit, entry, 
  46356             bcmFieldQualifyCapwapPayloadL4DstPort, data, mask);
  46357     
  46358         FP_UNLOCK(unit);
  46359     }
  46360 #endif /* BCM_HURRICANE3_SUPPORT */
  46361 
  46362     return (rv);
  46363 }
  46364 
  46365 /* 
  46366  * Get match criteria for bcmFieldQualifyCapwapPayloadL4SrcPort
  46367  *                qualifier from the field entry.
  46368  */
  46369 int 
  46370 bcm_esw_field_qualify_CapwapPayloadL4SrcPort_get(
  46371     int unit, 
  46372     bcm_field_entry_t entry, 
  46373     bcm_l4_port_t *data, 
  46374     bcm_l4_port_t *mask)
  46375 {
  46376     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46377 
  46378 #ifdef BCM_HURRICANE3_SUPPORT
  46379     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46380         /* Read qualifier match value and mask. */ 
  46381         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  46382                                   bcmFieldQualifyCapwapPayloadL4SrcPort,
  46383                                   (uint32 *)data, (uint32 *)mask);
  46384     }
  46385 #endif /* BCM_HURRICANE3_SUPPORT */
  46386 
  46387     return (rv);
  46388 }
  46389 
  46390 /* 
  46391  * Get match criteria for bcmFieldQualifyCapwapPayloadL4DstPort
  46392  *                qualifier from the field entry.
  46393  */
  46394 int 
  46395 bcm_esw_field_qualify_CapwapPayloadL4DstPort_get(
  46396     int unit, 
  46397     bcm_field_entry_t entry, 
  46398     bcm_l4_port_t *data, 
  46399     bcm_l4_port_t *mask)
  46400 {
  46401     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46402 
  46403 #ifdef BCM_HURRICANE3_SUPPORT
  46404     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46405         /* Read qualifier match value and mask. */ 
  46406         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  46407                                   bcmFieldQualifyCapwapPayloadL4DstPort,
  46408                                   (uint32 *)data, (uint32 *)mask);
  46409     }
  46410 #endif /* BCM_HURRICANE3_SUPPORT */
  46411 
  46412     return (rv);
  46413 }
  46414 
  46415 /* 
  46416  * Set match criteria for bcmFieldQualifyCapwapPayloadL3HdrParseable
  46417  *                  qualifier in the field entry.
  46418  */
  46419 int 
  46420 bcm_esw_field_qualify_CapwapPayloadL3HdrParseable(
  46421     int unit, 
  46422     bcm_field_entry_t entry, 
  46423     uint8 data, 
  46424     uint8 mask)
  46425 {
  46426     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46427 
  46428 #ifdef BCM_HURRICANE3_SUPPORT
  46429 
  46430     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46431 
  46432         /* Add in AUX_TAG_VALID */
  46433         data |= 1 << 1;
  46434         mask |= 1 << 1;
  46435         
  46436         
  46437         FP_LOCK(unit);
  46438     
  46439         rv = _field_qualify32(unit, entry, 
  46440             bcmFieldQualifyCapwapPayloadL3HdrParseable, data, mask);
  46441     
  46442         FP_UNLOCK(unit);
  46443     }
  46444 #endif /* BCM_HURRICANE3_SUPPORT */
  46445 
  46446     return (rv);
  46447 }
  46448 
  46449 /* 
  46450  * Get match criteria for bcmFieldQualifyCapwapPayloadL3HdrParseable_get
  46451  *                  qualifier from the field entry.
  46452  */
  46453 int 
  46454 bcm_esw_field_qualify_CapwapPayloadL3HdrParseable_get(
  46455     int unit, 
  46456     bcm_field_entry_t entry, 
  46457     uint8 *data, 
  46458     uint8 *mask)
  46459 {
  46460     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46461 
  46462 #ifdef BCM_HURRICANE3_SUPPORT
  46463     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46464         /* Read qualifier match value and mask. */ 
  46465         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  46466                                 bcmFieldQualifyCapwapPayloadL3HdrParseable,
  46467                                 data, mask);
  46468 
  46469         /* Mask off AUX_TAG_VALID */
  46470         *data &= 1;
  46471         *mask &= 1;
  46472     }
  46473 #endif /* BCM_HURRICANE3_SUPPORT */
  46474 
  46475     return (rv);
  46476 }
  46477 
  46478 /* 
  46479  * Set match criteria for bcmFieldQualifyCapwapPayloadL4HdrParseable
  46480  *                  qualifier in the field entry.
  46481  */
  46482 int 
  46483 bcm_esw_field_qualify_CapwapPayloadL4HdrParseable(
  46484     int unit, 
  46485     bcm_field_entry_t entry, 
  46486     uint8 data, 
  46487     uint8 mask)
  46488 {
  46489     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46490 
  46491 #ifdef BCM_HURRICANE3_SUPPORT
  46492 
  46493     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46494         
  46495         /* Add in AUX_TAG_VALID */
  46496         data |= 1 << 1;
  46497         mask |= 1 << 1;
  46498         
  46499         
  46500         FP_LOCK(unit);
  46501     
  46502         rv = _field_qualify32(unit, entry, 
  46503             bcmFieldQualifyCapwapPayloadL4HdrParseable, data, mask);
  46504     
  46505         FP_UNLOCK(unit);
  46506     }
  46507 #endif /* BCM_HURRICANE3_SUPPORT */
  46508 
  46509     return (rv);
  46510 }
  46511 
  46512 /* 
  46513  * Get match criteria for bcmFieldQualifyCapwapPayloadL4HdrParseable_get
  46514  *                  qualifier from the field entry.
  46515  */
  46516 int 
  46517 bcm_esw_field_qualify_CapwapPayloadL4HdrParseable_get(
  46518     int unit, 
  46519     bcm_field_entry_t entry, 
  46520     uint8 *data, 
  46521     uint8 *mask)
  46522 {
  46523     
  46524     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  46525 
  46526 #ifdef BCM_HURRICANE3_SUPPORT
  46527     if (soc_feature(unit, soc_feature_ing_capwap_parser)) {
  46528         /* Read qualifier match value and mask. */ 
  46529         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  46530                                 bcmFieldQualifyCapwapPayloadL4HdrParseable,
  46531                                 data, mask);
  46532         
  46533         /* Mask off AUX_TAG_VALID */
  46534         *data &= 1;
  46535         *mask &= 1;
  46536     }
  46537 #endif /* BCM_HURRICANE3_SUPPORT */
  46538 
  46539     return (rv);
  46540 }
  46541 
  46542 /*
  46543  * Function:
  46544  *      bcm_esw_field_qualify_DownMepSatTerminated
  46545  * Purpose:
  46546  *      Set match criteria to qualify Rx Down Mep SAT terminated hit status
  46547  *      for a given entry.
  46548  * Parameters:
  46549  *      unit  - (IN) Unit number.
  46550  *      entry - (IN) BCM field entry id.
  46551  *      data  - (IN) Qualifier match data.
  46552  *      mask  - (IN) Qualifier match mask.
  46553  * Returns:
  46554  *      BCM_E_XXX
  46555  * Notes:
  46556  */
  46557 int bcm_esw_field_qualify_DownMepSatTerminated(
  46558     int unit, 
  46559     bcm_field_entry_t entry, 
  46560     uint8 data, 
  46561     uint8 mask)
  46562 {
  46563     int rv = BCM_E_UNAVAIL;
  46564 #if defined (BCM_SABER2_SUPPORT)
  46565     if (SOC_IS_SABER2(unit)) {
  46566 
  46567         /* Validate data. */
  46568         if (data & ~(1)) {
  46569            return BCM_E_PARAM;
  46570         }
  46571 
  46572         
  46573         FP_LOCK(unit);
  46574         rv = _field_qualify32(unit, entry, bcmFieldQualifyDownMepSatTerminated,
  46575                               data, (mask ? 0x1 : 0));
  46576         FP_UNLOCK(unit);
  46577     }
  46578 #endif /* BCM_SABER2_SUPPORT */
  46579     return rv;
  46580 }
  46581 
  46582 /*
  46583  * Function:
  46584  *      bcm_esw_field_qualify_DownMepSatTerminated_get
  46585  * Purpose:
  46586  *      Get match criteria for Rx Down Mep SAT terminated hit status
  46587  *      from the given field entry.
  46588  * Parameters:
  46589  *      unit  - (IN)  Unit number.
  46590  *      entry - (IN)  BCM field entry id.
  46591  *      data  - (OUT) Reference to Qualifier match data.
  46592  *      mask  - (OUT) Reference to Qualifier match mask.
  46593  * Returns:
  46594  *      BCM_E_XXX
  46595  * Notes:
  46596  */
  46597 int bcm_esw_field_qualify_DownMepSatTerminated_get(
  46598     int unit, 
  46599     bcm_field_entry_t entry, 
  46600     uint8 *data, 
  46601     uint8 *mask)
  46602 {
  46603     int rv = BCM_E_UNAVAIL;
  46604 #if defined (BCM_SABER2_SUPPORT)
  46605     if (SOC_IS_SABER2(unit)) {
  46606         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  46607                           bcmFieldQualifyDownMepSatTerminated,
  46608                                                   data, mask);
  46609     }
  46610 #endif /* BCM_SABER2_SUPPORT */
  46611     return rv;
  46612 }
  46613 
  46614 /*
  46615  * Function:
  46616  *      bcm_esw_field_qualify_StpState
  46617  *      Set match criteria for bcmFieldQualifyStpState
  46618  *      qualifier in the field entry.
  46619  * Parameters:
  46620  *      unit    -   (IN) Unit number.
  46621  *      entry   -   (IN) BCM field entry id.
  46622  *      data    -   (IN) Qualifier match data.
  46623  * Returns:
  46624  *      BCM_E_XXX
  46625  * Notes:
  46626  */
  46627 int
  46628 bcm_esw_field_qualify_StpState(int unit, bcm_field_entry_t entry,
  46629                                          uint8 data)
  46630 {
  46631     int               value = 0;    /* HW data */
  46632     int               mask  = 0;    /* HW mask */
  46633     int               rv;           /* Return Status */   
  46634 
  46635     switch (data) {
  46636       case BCM_FIELD_STG_STP_DISABLE:
  46637            value = 0x0; 
  46638            mask  = 0x3;
  46639            break;
  46640       case BCM_FIELD_STG_STP_BLOCK:
  46641            value = 0x1;
  46642            mask  = 0x3;
  46643            break;
  46644       case BCM_FIELD_STG_STP_LEARN:
  46645            value = 0x2;
  46646            mask  = 0x3;
  46647            break;
  46648       case BCM_FIELD_STG_STP_FORWARD:
  46649            value = 0x3;
  46650            mask  = 0x3;
  46651            break;
  46652       case (BCM_FIELD_STG_STP_DISABLE|BCM_FIELD_STG_STP_BLOCK):
  46653            value = 0x0;
  46654            mask  = 0x2;
  46655            break;
  46656       case (BCM_FIELD_STG_STP_DISABLE|BCM_FIELD_STG_STP_LEARN):
  46657            value = 0x0;
  46658            mask  = 0x1;
  46659            break;
  46660       case (BCM_FIELD_STG_STP_BLOCK|BCM_FIELD_STG_STP_FORWARD):
  46661            value = 0x1;
  46662            mask  = 0x1;
  46663            break;
  46664       case (BCM_FIELD_STG_STP_LEARN|BCM_FIELD_STG_STP_FORWARD):
  46665            value = 0x2;
  46666            mask  = 0x2;
  46667            break;
  46668       default:
  46669           return (BCM_E_PARAM);
  46670     }
  46671 
  46672     
  46673     FP_LOCK(unit);
  46674 
  46675     rv = _field_qualify32(unit, entry, bcmFieldQualifyStpState,
  46676                             value, mask);
  46677     FP_UNLOCK(unit);
  46678     return (rv);
  46679 }
  46680 
  46681 /*
  46682  * Function:
  46683  *      bcm_esw_field_qualify_StpState_get
  46684  *      Get match criteria for bcmFieldQualifyStpState
  46685  *      qualifier in the field entry.
  46686  * Parameters:
  46687  *      unit    -   (IN) Unit number.
  46688  *      entry   -   (IN) BCM field entry id.
  46689  *      data    -   (IN) Qualifier match data.
  46690  * Returns:
  46691  *      BCM_E_XXX
  46692  * Notes:
  46693  */
  46694 int
  46695 bcm_esw_field_qualify_StpState_get(int unit, bcm_field_entry_t entry,
  46696                                          uint8 *data)
  46697 {
  46698     uint32    hw_data = 0;       /* HW buffer data.             */
  46699     uint32    hw_mask = 0;       /* HW buffer mask.             */
  46700     int       rv;                /* Operation return stauts.    */
  46701 
  46702     /* Input parameters check. */
  46703     if ((NULL == data)) {
  46704         return (BCM_E_PARAM);
  46705     }
  46706 
  46707     /* Read qualifier match value and mask. */ 
  46708     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  46709                                                bcmFieldQualifyStpState,
  46710                                                &hw_data, &hw_mask);
  46711     BCM_IF_ERROR_RETURN(rv);
  46712 
  46713     switch (hw_data) {
  46714       case 0: 
  46715           if (hw_mask == 0x3) {
  46716               *data = BCM_FIELD_STG_STP_DISABLE;
  46717           } else if (hw_mask == 0x2) {
  46718               *data = (BCM_FIELD_STG_STP_DISABLE|BCM_FIELD_STG_STP_BLOCK);
  46719           } else if (hw_mask == 0x1) {
  46720               *data = (BCM_FIELD_STG_STP_DISABLE|BCM_FIELD_STG_STP_LEARN);
  46721           } else {
  46722               return (BCM_E_INTERNAL);
  46723           }
  46724           break;
  46725       case 1: 
  46726           if (hw_mask == 0x3) {
  46727               *data = BCM_FIELD_STG_STP_BLOCK;
  46728           } else if (hw_mask == 0x1) {
  46729               *data =(BCM_FIELD_STG_STP_BLOCK|BCM_FIELD_STG_STP_FORWARD);
  46730           } else {
  46731               return (BCM_E_INTERNAL);
  46732           }
  46733           break;
  46734       case 2: 
  46735           if (hw_mask == 0x3) {
  46736               *data = BCM_FIELD_STG_STP_LEARN;
  46737           } else if (hw_mask == 0x2) {
  46738                *data = (BCM_FIELD_STG_STP_LEARN|BCM_FIELD_STG_STP_FORWARD);
  46739           } else {
  46740               return (BCM_E_INTERNAL);
  46741           }
  46742           break;
  46743       case 3:
  46744           if (hw_mask == 0x3) {
  46745               *data = BCM_FIELD_STG_STP_FORWARD;
  46746           } else {
  46747               return (BCM_E_INTERNAL);
  46748           }
  46749           break;
  46750       default:
  46751           return (BCM_E_INTERNAL);
  46752     }
  46753     return (BCM_E_NONE);
  46754 }
  46755 
  46756 /*
  46757  * Function:
  46758  *      bcm_esw_field_qualify_DevicePortBitmap
  46759  * Purpose:
  46760  *      Set match criteria to qualify Device Port Bitmap
  46761  *      for a given entry.
  46762  *      To qualify on a port bitmap generated from Device ingress port.
  46763  * Parameters:
  46764  *      unit  - (IN) Unit number.
  46765  *      entry - (IN) BCM field entry id.
  46766  *      data  - (IN) Qualifier match data.
  46767  *      mask  - (IN) Qualifier match mask.
  46768  * Returns:
  46769  *      BCM_E_XXX
  46770  * Notes:
  46771  */
  46772 int 
  46773 bcm_esw_field_qualify_DevicePortBitmap(
  46774     int unit,
  46775     bcm_field_entry_t entry,
  46776     bcm_pbmp_t data,
  46777     bcm_pbmp_t mask)
  46778 {
  46779     int rv = BCM_E_UNAVAIL;
  46780 #if defined (BCM_TOMAHAWK_SUPPORT)
  46781     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  46782        _field_control_t *fc;          /* Field Control Operational Structure. */
  46783 
  46784        
  46785        FP_LOCK(unit);
  46786        rv = _field_control_get(unit, &fc);
  46787        if (BCM_FAILURE(rv)) {
  46788            FP_UNLOCK(unit);
  46789            return rv;
  46790        }
  46791        rv = fc->functions.fp_qualify_inports(unit, entry, 
  46792                                              bcmFieldQualifyDevicePortBitmap,
  46793                                              data, mask);
  46794        FP_UNLOCK(unit); 
  46795     } 
  46796 #endif /* BCM_TOMAHAWK_SUPPORT */
  46797     return rv;
  46798 }
  46799 
  46800 /*
  46801  * Function:
  46802  *      bcm_esw_field_qualify_DevicePortBitmap_get
  46803  * Purpose:
  46804  *      Get match criteria for Device Port Bitmap
  46805  *      from the given field entry.
  46806  * Parameters:
  46807  *      unit  - (IN)  Unit number.
  46808  *      entry - (IN)  BCM field entry id.
  46809  *      data  - (OUT) Reference to Qualifier match data.
  46810  *      mask  - (OUT) Reference to Qualifier match mask.
  46811  * Returns:
  46812  *      BCM_E_XXX
  46813  * Notes:
  46814  */
  46815 int
  46816 bcm_esw_field_qualify_DevicePortBitmap_get(
  46817     int unit,
  46818     bcm_field_entry_t entry,
  46819     bcm_pbmp_t *data,
  46820     bcm_pbmp_t *mask)
  46821 {
  46822     int rv = BCM_E_UNAVAIL;  /* Operation return status.    */
  46823 
  46824 #if defined (BCM_TOMAHAWK_SUPPORT)
  46825     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  46826        FP_LOCK(unit);
  46827        rv = _bcm_field_qualify_InPorts_get(unit, entry,
  46828                                            bcmFieldQualifyDevicePortBitmap,
  46829                                            data, mask);
  46830        FP_UNLOCK(unit);
  46831     }
  46832 #endif /* BCM_TOMAHAWK_SUPPORT */
  46833     return rv;
  46834 }
  46835 
  46836 int
  46837 bcm_esw_field_qualify_SystemPortBitmap(
  46838     int unit,
  46839     bcm_field_entry_t entry,
  46840     bcm_pbmp_t data,
  46841     bcm_pbmp_t mask)
  46842 {
  46843     int rv = BCM_E_UNAVAIL;
  46844 #if defined (BCM_TOMAHAWK_SUPPORT)
  46845     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  46846        _field_control_t *fc;          /* Field Control Operational Structure. */
  46847 
  46848        
  46849        FP_LOCK(unit);
  46850        rv = _field_control_get(unit, &fc);
  46851        if (BCM_FAILURE(rv)) {
  46852            FP_UNLOCK(unit);
  46853            return rv;
  46854        }
  46855        rv = fc->functions.fp_qualify_inports(unit, entry, 
  46856                                              bcmFieldQualifySystemPortBitmap,
  46857                                              data, mask);
  46858        FP_UNLOCK(unit); 
  46859     } 
  46860 #endif /* BCM_TOMAHAWK_SUPPORT */
  46861     return rv;
  46862 }
  46863 
  46864 int
  46865 bcm_esw_field_qualify_SystemPortBitmap_get(
  46866     int unit,
  46867     bcm_field_entry_t entry,
  46868     bcm_pbmp_t *data,
  46869     bcm_pbmp_t *mask)
  46870 {
  46871     int rv = BCM_E_UNAVAIL;  /* Operation return status.    */
  46872 
  46873 #if defined (BCM_TOMAHAWK_SUPPORT)
  46874     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  46875        FP_LOCK(unit);
  46876        rv = _bcm_field_qualify_InPorts_get(unit, entry,
  46877                                            bcmFieldQualifySystemPortBitmap,
  46878                                            data, mask);
  46879        FP_UNLOCK(unit);
  46880     }
  46881 #endif /* BCM_TOMAHAWK_SUPPORT */
  46882     return rv;
  46883 }
  46884 
  46885 int
  46886 bcm_esw_field_qualify_SourceGportBitmap(
  46887     int unit,
  46888     bcm_field_entry_t entry,
  46889     bcm_pbmp_t data,
  46890     bcm_pbmp_t mask)
  46891 {
  46892     int rv = BCM_E_UNAVAIL;
  46893 #if defined (BCM_TOMAHAWK_SUPPORT)
  46894     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  46895        _field_control_t *fc;          /* Field Control Operational Structure. */
  46896 
  46897        
  46898        FP_LOCK(unit);
  46899        rv = _field_control_get(unit, &fc);
  46900        if (BCM_FAILURE(rv)) {
  46901            FP_UNLOCK(unit);
  46902            return rv;
  46903        }
  46904        rv = fc->functions.fp_qualify_inports(unit, entry, 
  46905                                              bcmFieldQualifySourceGportBitmap,
  46906                                              data, mask);
  46907        FP_UNLOCK(unit); 
  46908     } 
  46909 #endif /* BCM_TOMAHAWK_SUPPORT */
  46910     return rv;
  46911 }
  46912 
  46913 int
  46914 bcm_esw_field_qualify_SourceGportBitmap_get(
  46915     int unit,
  46916     bcm_field_entry_t entry,
  46917     bcm_pbmp_t *data,
  46918     bcm_pbmp_t *mask)
  46919 {
  46920     int rv = BCM_E_UNAVAIL;  /* Operation return status.    */
  46921 
  46922 #if defined (BCM_TOMAHAWK_SUPPORT)
  46923     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
  46924        FP_LOCK(unit);
  46925        rv = _bcm_field_qualify_InPorts_get(unit, entry,
  46926                                            bcmFieldQualifySourceGportBitmap,
  46927                                            data, mask);
  46928        FP_UNLOCK(unit);
  46929     }
  46930 #endif /* BCM_TOMAHAWK_SUPPORT */
  46931     return rv;
  46932 }
  46933 
  46934 /*
  46935  * Function:
  46936  *      bcm_esw_field_action_copytocpu_config_set
  46937  * Purpose:
  46938  *      Configures CopyToCpu action for a given entry.
  46939  * Parameters:
  46940  *      unit              - (IN) Unit number.
  46941  *      entry             - (IN) BCM field entry id.
  46942  *      CopyToCpu_config  - (IN) CopyToCpu Config Structure.
  46943  * Returns:
  46944  *      BCM_E_XXX
  46945  * Notes:
  46946  */
  46947 int bcm_esw_field_action_copytocpu_config_set(
  46948     int unit,
  46949     bcm_field_entry_t entry,
  46950     bcm_field_CopyToCpu_config_t CopyToCpu_config)
  46951 {
  46952     int                 rv = BCM_E_UNAVAIL;
  46953 #if defined(BCM_APACHE_SUPPORT)
  46954     _field_control_t    *fc;
  46955     _field_entry_t      *f_ent;
  46956     _field_action_t     *fa = NULL;    /* Field action descriptor. */
  46957     _field_action_t      copytocpu_action;    /* Field action descriptor. */
  46958 
  46959     /* Atleast one of color related flags needs to be set */
  46960     if ((CopyToCpu_config.flags & (~BCM_FIELD_COPYTOCPU_TRUNCATE)) == 0) {
  46961         return BCM_E_PARAM;
  46962     }
  46963     if (!soc_feature(unit, soc_feature_ep_redirect_v2)) {
  46964         return rv;
  46965     }
  46966     
  46967     FP_LOCK(unit);
  46968     rv = _field_control_get(unit, &fc);
  46969     if (BCM_FAILURE(rv)) {
  46970         FP_UNLOCK(unit);
  46971         return rv;
  46972     }
  46973 
  46974     /* Get field entry structure pointer. */
  46975     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  46976     BCM_IF_ERROR_RETURN(rv);
  46977 
  46978     if (!(SOC_IS_APACHE(unit) &&
  46979                 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS))) {
  46980         FP_UNLOCK(unit);
  46981         return BCM_E_CONFIG;
  46982     }
  46983 
  46984     /* Check if action already exists in the entry */
  46985     for (fa = f_ent->actions; fa != NULL; fa = fa->next) {
  46986         if (fa->action == bcmFieldActionCopyToCpu) {
  46987             break;
  46988         }
  46989     }
  46990 
  46991     /* Action exists do params and dependency check of new parameters
  46992        and then delete the old action */
  46993     if (fa) {
  46994         /* Check if the existing action was created
  46995            not using bcm_field_action_copytocpu_config_set */
  46996         if (fa->param[2] == 0) {
  46997             FP_UNLOCK(unit);
  46998             return BCM_E_CONFIG;
  46999         }
  47000 
  47001         sal_memset(&copytocpu_action, 0, sizeof(_field_action_t));
  47002 
  47003         copytocpu_action.action = bcmFieldActionCopyToCpu;
  47004         copytocpu_action.param[2] = CopyToCpu_config.flags;
  47005         copytocpu_action.param[3] = CopyToCpu_config.match_rule;
  47006 
  47007         /* Check action parameters. */
  47008         rv = fc->functions.fp_action_params_check(unit, f_ent, &copytocpu_action);
  47009         if (BCM_FAILURE(rv)) {
  47010             FP_UNLOCK(unit);
  47011 #ifdef BROADCOM_DEBUG
  47012             LOG_VERBOSE(BSL_LS_BCM_FP,
  47013                     (BSL_META_U(unit,
  47014                                 "FP(unit %d) Error: action=%s parameters check failed (%d)\n"),
  47015                      unit, _field_action_name(fa->action), rv));
  47016 #endif
  47017             return (rv);
  47018         }
  47019 
  47020         /* Check dependency(s) of action */
  47021         if (fc->functions.fp_action_depends_check) {
  47022             rv = (*fc->functions.fp_action_depends_check)(unit, f_ent, &copytocpu_action);
  47023             if (BCM_FAILURE(rv)) {
  47024                 FP_UNLOCK(unit);
  47025 #ifdef BROADCOM_DEBUG
  47026                 LOG_VERBOSE(BSL_LS_BCM_FP,
  47027                         (BSL_META_U(unit,
  47028                                     "FP(unit %d) Error: action=%s dependency check failed (%d)\n"),
  47029                          unit, _field_action_name(fa->action), rv));
  47030 #endif
  47031                 return (rv);
  47032             }
  47033         }
  47034 
  47035         rv = _field_action_delete(unit,
  47036                                   entry,
  47037                                   fa->action,
  47038                                   fa->param[0],
  47039                                   fa->param[1]);
  47040         if (BCM_FAILURE(rv)) {
  47041             FP_UNLOCK(unit);
  47042             return BCM_E_INTERNAL;
  47043         }
  47044         fa = NULL;
  47045     }
  47046 
  47047     /*
  47048      * Allocate the action descriptor, only param2 and param3 are valid.
  47049      */
  47050     rv = _field_action_alloc(unit, bcmFieldActionCopyToCpu, 0, 0,
  47051                              CopyToCpu_config.flags,
  47052                              CopyToCpu_config.match_rule,
  47053                              0, 0,
  47054                              &fa);
  47055     if (BCM_FAILURE(rv)) {
  47056         LOG_ERROR(BSL_LS_BCM_FP,
  47057                 (BSL_META_U(unit,
  47058                             "FP(unit %d) Error: failure in _field_action_alloc()\n"),
  47059                  unit));
  47060         FP_UNLOCK(unit);
  47061         return rv;
  47062     }
  47063 
  47064     /*
  47065      * Add action to entry actions list.
  47066      */
  47067     rv = _field_action_add(unit, fc, entry, fa);
  47068     FP_UNLOCK(unit);
  47069     if (BCM_FAILURE(rv)) {
  47070         sal_free(fa);
  47071         return rv;
  47072     }
  47073 
  47074 #endif
  47075     return rv;
  47076 }
  47077 
  47078 /*
  47079  * Function:
  47080  *      bcm_esw_field_action_copytocpu_config_get
  47081  * Purpose:
  47082  *      Gets CopyToCpu action parameters configured
  47083  *      through bcm_esw_field_action_copytocpu_config_set
  47084  *      for a given entry.
  47085  * Parameters:
  47086  *      unit              - (IN) Unit number.
  47087  *      entry             - (IN) BCM field entry id.
  47088  *      CopyToCpu_config  - (OUT) CopyToCpu Config Structure.
  47089  * Returns:
  47090  *      BCM_E_XXX
  47091  * Notes:
  47092  */
  47093 /* Get CopyToCpu action from the field entry. */
  47094 int bcm_esw_field_action_copytocpu_config_get(
  47095     int unit,
  47096     bcm_field_entry_t entry,
  47097     bcm_field_CopyToCpu_config_t *CopyToCpu_config)
  47098 {
  47099     int                 rv = BCM_E_UNAVAIL;
  47100 #if defined(BCM_APACHE_SUPPORT)
  47101     _field_entry_t      *f_ent;
  47102     _field_action_t     *fa = NULL;    /* Field action descriptor. */
  47103 
  47104     /* Input parameters check. */
  47105     if (NULL == CopyToCpu_config) {
  47106         return (BCM_E_PARAM);
  47107     }
  47108     if (!soc_feature(unit, soc_feature_ep_redirect_v2)) {
  47109         return rv;
  47110     }
  47111 
  47112     if (!soc_feature(unit, soc_feature_ep_redirect_v2)) {
  47113         return rv;
  47114     }
  47115 
  47116     /* Lock the module. */
  47117     
  47118     FP_LOCK(unit);
  47119 
  47120     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  47121     if (BCM_FAILURE(rv)) {
  47122         FP_UNLOCK(unit);
  47123         return (rv);
  47124     }
  47125 
  47126     if (!(SOC_IS_APACHE(unit) &&
  47127                 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS))) {
  47128         FP_UNLOCK(unit);
  47129         return BCM_E_CONFIG;
  47130     }
  47131 
  47132     /* Find matching action in the entry */
  47133     for (fa = f_ent->actions; fa != NULL; fa = fa->next) {
  47134         if (fa->action == bcmFieldActionCopyToCpu) {
  47135             break;
  47136         }
  47137     }
  47138 
  47139     if (fa == NULL) {
  47140         FP_UNLOCK(unit);
  47141         LOG_VERBOSE(BSL_LS_BCM_FP,
  47142                 (BSL_META_U(unit,
  47143                             "FP(unit %d) Error: action not in entry=%d\n"),
  47144                  unit, entry));
  47145         return (BCM_E_NOT_FOUND);
  47146     }
  47147 
  47148     /* Configured not using
  47149        bcm_field_action_copytocpu_config_set API */
  47150     if (fa->param[2] == 0) {
  47151         FP_UNLOCK(unit);
  47152         LOG_VERBOSE(BSL_LS_BCM_FP,
  47153                     (BSL_META_U(unit,
  47154                                 "FP(unit %d) Error: action not configured using"
  47155                                 " bcm_field_action_copytocpu_config_set in entry=%d\n"),
  47156                      unit, entry));
  47157         return (BCM_E_CONFIG);
  47158     }
  47159 
  47160     CopyToCpu_config->flags = fa->param[2];
  47161     CopyToCpu_config->match_rule = fa->param[3];
  47162 
  47163     /* Unlock the module. */
  47164     FP_UNLOCK(unit);
  47165 
  47166 #endif
  47167     return rv;
  47168 }
  47169 
  47170 /*
  47171  * Function:
  47172  *      bcm_esw_field_action_redirect_config_set
  47173  * Purpose:
  47174  *      Configures Redirect action for a given entry.
  47175  * Parameters:
  47176  *      unit              - (IN) Unit number.
  47177  *      entry             - (IN) BCM field entry id.
  47178  *      redirect_config   - (IN) Redirect Config Structure.
  47179  * Returns:
  47180  *      BCM_E_XXX
  47181  * Notes:
  47182  */
  47183 int bcm_esw_field_action_redirect_config_set(
  47184     int unit,
  47185     bcm_field_entry_t entry,
  47186     bcm_field_redirect_config_t redirect_config)
  47187 {
  47188     int                 rv = BCM_E_UNAVAIL;
  47189 #if defined(BCM_APACHE_SUPPORT)
  47190     _field_control_t    *fc;
  47191     _field_entry_t      *f_ent;
  47192     _field_action_t     *fa = NULL;    /* Field action descriptor. */
  47193     _field_action_t      redirect_action;    /* Field action descriptor. */
  47194     int                 src_port = -1;
  47195 
  47196     if (!soc_feature(unit, soc_feature_ep_redirect_v2)) {
  47197         return rv;
  47198     }
  47199 
  47200     /* Atleast one of color related flags needs to be set */
  47201     if ((redirect_config.flags &
  47202                 ~(BCM_FIELD_REDIRECT_TRUNCATE |
  47203                     BCM_FIELD_REDIRECT_SOURCE_USE_CONFIGURED |
  47204                     BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_DESTINATION |
  47205                     BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_SOURCE)) == 0) {
  47206         return BCM_E_PARAM;
  47207     }
  47208 
  47209     
  47210     FP_LOCK(unit);
  47211     rv = _field_control_get(unit, &fc);
  47212     if (BCM_FAILURE(rv)) {
  47213         FP_UNLOCK(unit);
  47214         return rv;
  47215     }
  47216 
  47217     /* Get field entry structure pointer. */
  47218     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  47219     BCM_IF_ERROR_RETURN(rv);
  47220 
  47221     if (!(SOC_IS_APACHE(unit) &&
  47222                 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS))) {
  47223         FP_UNLOCK(unit);
  47224         return BCM_E_CONFIG;
  47225     }
  47226 
  47227     /* Check if action already exists in the entry */
  47228     for (fa = f_ent->actions; fa != NULL; fa = fa->next) {
  47229         if (fa->action == bcmFieldActionRedirect) {
  47230             break;
  47231         }
  47232     }
  47233 
  47234     /* Action exists do params and dependency check of new parameters
  47235        and then delete the old action */
  47236     if (fa) {
  47237         /* Check if the existing action was created
  47238            not using bcm_field_action_redirect_config_set */
  47239         if (fa->param[2] == 0) {
  47240             FP_UNLOCK(unit);
  47241             return BCM_E_CONFIG;
  47242         }
  47243 
  47244         sal_memset(&redirect_action, 0, sizeof(_field_action_t));
  47245 
  47246         redirect_action.action = bcmFieldActionRedirect;
  47247         redirect_action.param[2] = redirect_config.flags;
  47248         redirect_action.param[3] = redirect_config.destination_type;
  47249         redirect_action.param[4] = redirect_config.destination;
  47250         redirect_action.param[5] = redirect_config.source_port;
  47251 
  47252         /* Check action parameters. */
  47253         rv = fc->functions.fp_action_params_check(unit, f_ent, &redirect_action);
  47254         if (BCM_FAILURE(rv)) {
  47255             FP_UNLOCK(unit);
  47256 #ifdef BROADCOM_DEBUG
  47257             LOG_VERBOSE(BSL_LS_BCM_FP,
  47258                     (BSL_META_U(unit,
  47259                                 "FP(unit %d) Error: action=%s parameters check failed (%d)\n"),
  47260                      unit, _field_action_name(fa->action), rv));
  47261 #endif
  47262             return (rv);
  47263         }
  47264 
  47265         /* Check dependency(s) of action */
  47266         if (fc->functions.fp_action_depends_check) {
  47267             rv = (*fc->functions.fp_action_depends_check)(unit, f_ent, &redirect_action);
  47268             if (BCM_FAILURE(rv)) {
  47269                 FP_UNLOCK(unit);
  47270 #ifdef BROADCOM_DEBUG
  47271                 LOG_VERBOSE(BSL_LS_BCM_FP,
  47272                         (BSL_META_U(unit,
  47273                                     "FP(unit %d) Error: action=%s dependency check failed (%d)\n"),
  47274                          unit, _field_action_name(fa->action), rv));
  47275 #endif
  47276                 return (rv);
  47277             }
  47278         }
  47279 
  47280         rv = _field_action_delete(unit,
  47281                                   entry,
  47282                                   fa->action,
  47283                                   fa->param[0],
  47284                                   fa->param[1]);
  47285         if (BCM_FAILURE(rv)) {
  47286             FP_UNLOCK(unit);
  47287             return BCM_E_INTERNAL;
  47288         }
  47289         fa = NULL;
  47290     }
  47291 
  47292     if (redirect_config.flags & BCM_FIELD_REDIRECT_SOURCE_USE_CONFIGURED) {
  47293         src_port = redirect_config.source_port;
  47294     }
  47295     /*
  47296      * Allocate the action descriptor, param0 and param1 are not valid.
  47297      */
  47298 
  47299     rv = _field_action_alloc(unit, bcmFieldActionRedirect, 0, 0,
  47300                              redirect_config.flags,
  47301                              redirect_config.destination_type,
  47302                              redirect_config.destination,
  47303                              src_port,
  47304                              &fa);
  47305     if (BCM_FAILURE(rv)) {
  47306         LOG_ERROR(BSL_LS_BCM_FP,
  47307                 (BSL_META_U(unit,
  47308                             "FP(unit %d) Error: failure in _field_action_alloc()\n"),
  47309                  unit));
  47310         FP_UNLOCK(unit);
  47311         return rv;
  47312     }
  47313 
  47314     /*
  47315      * Add action to entry actions list.
  47316      */
  47317     rv = _field_action_add(unit, fc, entry, fa);
  47318     FP_UNLOCK(unit);
  47319     if (BCM_FAILURE(rv)) {
  47320         sal_free(fa);
  47321         return rv;
  47322     }
  47323 
  47324 #endif
  47325     return rv;
  47326 }
  47327 
  47328 /*
  47329  * Function:
  47330  *      bcm_esw_field_action_redirect_config_get
  47331  * Purpose:
  47332  *      Gets Redirect action parameters configured
  47333  *      through bcm_esw_field_action_redirect_config_set
  47334  *      for a given entry.
  47335  * Parameters:
  47336  *      unit              - (IN) Unit number.
  47337  *      entry             - (IN) BCM field entry id.
  47338  *      redirect_config   - (OUT) Redirect Config Structure.
  47339  * Returns:
  47340  *      BCM_E_XXX
  47341  * Notes:
  47342  */
  47343 int bcm_esw_field_action_redirect_config_get(
  47344     int unit,
  47345     bcm_field_entry_t entry,
  47346     bcm_field_redirect_config_t *redirect_config)
  47347 {
  47348     int                 rv = BCM_E_UNAVAIL;
  47349 #if defined(BCM_APACHE_SUPPORT)
  47350     _field_entry_t      *f_ent;
  47351     _field_action_t     *fa = NULL;    /* Field action descriptor. */
  47352 
  47353     /* Input parameters check. */
  47354     if (NULL == redirect_config) {
  47355         return (BCM_E_PARAM);
  47356     }
  47357 
  47358     if (!soc_feature(unit, soc_feature_ep_redirect_v2)) {
  47359         return rv;
  47360     }
  47361 
  47362     /* Lock the module. */
  47363     
  47364     FP_LOCK(unit);
  47365 
  47366     rv = _field_entry_get(unit, entry, _FP_ENTRY_PRIMARY, &f_ent);
  47367     if (BCM_FAILURE(rv)) {
  47368         FP_UNLOCK(unit);
  47369         return (rv);
  47370     }
  47371 
  47372     if (!(SOC_IS_APACHE(unit) &&
  47373                 (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS))) {
  47374         FP_UNLOCK(unit);
  47375         return BCM_E_CONFIG;
  47376     }
  47377 
  47378     /* Find matching action in the entry */
  47379     for (fa = f_ent->actions; fa != NULL; fa = fa->next) {
  47380         if (fa->action == bcmFieldActionRedirect) {
  47381             break;
  47382         }
  47383     }
  47384 
  47385     if (fa == NULL) {
  47386         FP_UNLOCK(unit);
  47387         LOG_VERBOSE(BSL_LS_BCM_FP,
  47388                 (BSL_META_U(unit,
  47389                             "FP(unit %d) Error: action not in entry=%d\n"),
  47390                  unit, entry));
  47391         return (BCM_E_NOT_FOUND);
  47392     }
  47393 
  47394     /* Configured not using
  47395        bcm_field_action_redirect_config_set API */
  47396     if (fa->param[2] == 0) {
  47397         FP_UNLOCK(unit);
  47398         LOG_VERBOSE(BSL_LS_BCM_FP,
  47399                     (BSL_META_U(unit,
  47400                                 "FP(unit %d) Error: action not configured using"
  47401                                 " bcm_field_action_redirect_config_set in entry=%d\n"),
  47402                      unit, entry));
  47403         return (BCM_E_CONFIG);
  47404     }
  47405 
  47406     redirect_config->flags            = fa->param[2];
  47407     redirect_config->destination_type = fa->param[3];
  47408     redirect_config->destination      = fa->param[4];
  47409     redirect_config->source_port      = fa->param[5];
  47410 
  47411     /* Unlock the module. */
  47412     FP_UNLOCK(unit);
  47413 
  47414 #endif
  47415     return rv;
  47416 }
  47417 
  47418 /*
  47419  * Function:
  47420  *      bcm_esw_field_qualify_TosLower4Bits
  47421  * Purpose:
  47422  *      Set match criteria to qualify on Lower 4bits of TOS value
  47423  *      for a given entry.
  47424  * Parameters:
  47425  *      unit  - (IN) Unit number.
  47426  *      entry - (IN) BCM field entry id.
  47427  *      data  - (IN) Qualifier match data.
  47428  *      mask  - (IN) Qualifier match mask.
  47429  * Returns:
  47430  *      BCM_E_XXX
  47431  * Notes:
  47432  */
  47433 int
  47434 bcm_esw_field_qualify_TosLower4Bits(
  47435         int unit,
  47436         bcm_field_entry_t entry,
  47437         uint8 data,
  47438         uint8 mask)
  47439 {
  47440     int rv = BCM_E_UNAVAIL;
  47441 #if defined(BCM_APACHE_SUPPORT)
  47442 
  47443     if (data > 0xf) {
  47444         return BCM_E_PARAM;
  47445     }
  47446 
  47447     
  47448     FP_LOCK(unit);
  47449 
  47450     rv = _field_qualify32(unit, entry, bcmFieldQualifyTosLower4Bits,
  47451                           data, mask);
  47452     FP_UNLOCK(unit);
  47453 #endif
  47454     return rv;
  47455 }
  47456 
  47457 /*
  47458  * Function:
  47459  *      bcm_esw_field_qualify_TosLower4Bits_get
  47460  * Purpose:
  47461  *      Get match criteria for bcmFieldQualifyTosLower4Bits
  47462  *      qualifier from the field entry.
  47463  * Parameters:
  47464  *      unit - (IN) Unit number.
  47465  *      entry - (IN) BCM field entry id.
  47466  *      data - (OUT) Qualifier match data.
  47467  *      mask - (OUT) Qualifier match mask.
  47468  * Returns:
  47469  *      BCM_E_XXX
  47470  * Notes:
  47471  */
  47472 int
  47473 bcm_esw_field_qualify_TosLower4Bits_get(
  47474         int unit,
  47475         bcm_field_entry_t entry,
  47476         uint8 *data,
  47477         uint8 *mask)
  47478 {
  47479     /* Read qualifier match value and mask. */
  47480     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  47481                       bcmFieldQualifyTosLower4Bits,
  47482                       data, mask);
  47483 }
  47484 
  47485 /*
  47486  * Function:
  47487  *      bcm_esw_field_qualify_OamEgressClass2Vxlt
  47488  * Purpose:
  47489  *      Set match criteria to qualify on OAM Class Id assigned for packet
  47490  *      based on 2nd Lookup in EGR_VLAN_XLATE table for a given entry.
  47491  * Parameters:
  47492  *      unit  - (IN) Unit number.
  47493  *      entry - (IN) BCM field entry id.
  47494  *      data  - (IN) Qualifier match data.
  47495  *      mask  - (IN) Qualifier match mask.
  47496  * Returns:
  47497  *      BCM_E_XXX
  47498  * Notes:
  47499  */
  47500 int
  47501 bcm_esw_field_qualify_OamEgressClass2Vxlt(
  47502         int unit,
  47503         bcm_field_entry_t entry,
  47504         uint32 data,
  47505         uint32 mask)
  47506 {
  47507     int rv = BCM_E_UNAVAIL;
  47508 #if defined(BCM_APACHE_SUPPORT)
  47509 
  47510     if (data > 0xfff) {
  47511         return BCM_E_PARAM;
  47512     }
  47513 
  47514     
  47515     FP_LOCK(unit);
  47516 
  47517     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamEgressClass2Vxlt,
  47518                           data, mask);
  47519     FP_UNLOCK(unit);
  47520 #endif
  47521     return rv;
  47522 }
  47523 
  47524 /*
  47525  * Function:
  47526  *      bcm_esw_field_qualify_OamEgressClass2Vxlt_get
  47527  * Purpose:
  47528  *      Get match criteria for bcmFieldQualifyOamEgressClass2Vxlt
  47529  *      qualifier from the field entry.
  47530  * Parameters:
  47531  *      unit - (IN) Unit number.
  47532  *      entry - (IN) BCM field entry id.
  47533  *      data - (OUT) Qualifier match data.
  47534  *      mask - (OUT) Qualifier match mask.
  47535  * Returns:
  47536  *      BCM_E_XXX
  47537  * Notes:
  47538  */
  47539 int
  47540 bcm_esw_field_qualify_OamEgressClass2Vxlt_get(
  47541         int unit,
  47542         bcm_field_entry_t entry,
  47543         uint32 *data,
  47544         uint32 *mask)
  47545 {
  47546     /* Read qualifier match value and mask. */
  47547     return _bcm_field_entry_qualifier_uint32_get(unit, entry,
  47548                       bcmFieldQualifyOamEgressClass2Vxlt,
  47549                       data, mask);
  47550 }
  47551 
  47552 /*
  47553  * Function:
  47554  *      bcm_esw_field_qualify_OamEgressVxltFirstHit
  47555  * Purpose:
  47556  *      Set match criteria to qualify on First EGR_VXLT lookup hit status
  47557  *      for a given entry.
  47558  * Parameters:
  47559  *      unit  - (IN) Unit number.
  47560  *      entry - (IN) BCM field entry id.
  47561  *      data  - (IN) Qualifier match data.
  47562  *      mask  - (IN) Qualifier match mask.
  47563  * Returns:
  47564  *      BCM_E_XXX
  47565  * Notes:
  47566  */
  47567 int
  47568 bcm_esw_field_qualify_OamEgressVxltFirstHit(
  47569         int unit,
  47570         bcm_field_entry_t entry,
  47571         uint8 data,
  47572         uint8 mask)
  47573 {
  47574     int rv = BCM_E_UNAVAIL;
  47575 #if defined(BCM_APACHE_SUPPORT)
  47576 
  47577     if (data > 0x1) {
  47578         return BCM_E_PARAM;
  47579     }
  47580 
  47581     
  47582     FP_LOCK(unit);
  47583 
  47584     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamEgressVxltFirstHit,
  47585                           data, mask);
  47586     FP_UNLOCK(unit);
  47587 #endif
  47588     return rv;
  47589 }
  47590 
  47591 /*
  47592  * Function:
  47593  *      bcm_esw_field_qualify_OamEgressVxltFirstHit_get
  47594  * Purpose:
  47595  *      Get match criteria for bcmFieldQualifyOamEgressVxltFirstHit
  47596  *      qualifier from the field entry.
  47597  * Parameters:
  47598  *      unit - (IN) Unit number.
  47599  *      entry - (IN) BCM field entry id.
  47600  *      data - (OUT) Qualifier match data.
  47601  *      mask - (OUT) Qualifier match mask.
  47602  * Returns:
  47603  *      BCM_E_XXX
  47604  * Notes:
  47605  */
  47606 int
  47607 bcm_esw_field_qualify_OamEgressVxltFirstHit_get(
  47608         int unit,
  47609         bcm_field_entry_t entry,
  47610         uint8 *data,
  47611         uint8 *mask)
  47612 {
  47613     /* Read qualifier match value and mask. */
  47614     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  47615                       bcmFieldQualifyOamEgressVxltFirstHit,
  47616                       data, mask);
  47617 }
  47618 
  47619 /*
  47620  * Function:
  47621  *      bcm_esw_field_qualify_OamEgressVxltSecondHit
  47622  * Purpose:
  47623  *      Set match criteria to qualify on Second EGR_VXLT lookup hit status
  47624  *      for a given entry.
  47625  * Parameters:
  47626  *      unit  - (IN) Unit number.
  47627  *      entry - (IN) BCM field entry id.
  47628  *      data  - (IN) Qualifier match data.
  47629  *      mask  - (IN) Qualifier match mask.
  47630  * Returns:
  47631  *      BCM_E_XXX
  47632  * Notes:
  47633  */
  47634 int
  47635 bcm_esw_field_qualify_OamEgressVxltSecondHit(
  47636         int unit,
  47637         bcm_field_entry_t entry,
  47638         uint8 data,
  47639         uint8 mask)
  47640 {
  47641     int rv = BCM_E_UNAVAIL;
  47642 #if defined(BCM_APACHE_SUPPORT)
  47643 
  47644     if (data > 0x1) {
  47645         return BCM_E_PARAM;
  47646     }
  47647 
  47648     
  47649     FP_LOCK(unit);
  47650 
  47651     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamEgressVxltSecondHit,
  47652                           data, mask);
  47653     FP_UNLOCK(unit);
  47654 #endif
  47655     return rv;
  47656 }
  47657 
  47658 /*
  47659  * Function:
  47660  *      bcm_esw_field_qualify_OamEgressVxltSecondHit_get
  47661  * Purpose:
  47662  *      Get match criteria for bcmFieldQualifyOamEgressVxltSecondHit
  47663  *      qualifier from the field entry.
  47664  * Parameters:
  47665  *      unit - (IN) Unit number.
  47666  *      entry - (IN) BCM field entry id.
  47667  *      data - (OUT) Qualifier match data.
  47668  *      mask - (OUT) Qualifier match mask.
  47669  * Returns:
  47670  *      BCM_E_XXX
  47671  * Notes:
  47672  */
  47673 int
  47674 bcm_esw_field_qualify_OamEgressVxltSecondHit_get(
  47675         int unit,
  47676         bcm_field_entry_t entry,
  47677         uint8 *data,
  47678         uint8 *mask)
  47679 {
  47680     /* Read qualifier match value and mask. */
  47681     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  47682                       bcmFieldQualifyOamEgressVxltSecondHit,
  47683                       data, mask);
  47684 }
  47685 
  47686 /*
  47687  * Function:
  47688  *      bcm_esw_field_qualify_OamDownMEPLoopbackPacket
  47689  * Purpose:
  47690  *      Set match criteria to qualify on Down-MEP Loopback or
  47691  *      Down-SAT Latching Loopback packet for a given entry.
  47692  * Parameters:
  47693  *      unit  - (IN) Unit number.
  47694  *      entry - (IN) BCM field entry id.
  47695  *      data  - (IN) Qualifier match data.
  47696  *      mask  - (IN) Qualifier match mask.
  47697  * Returns:
  47698  *      BCM_E_XXX
  47699  * Notes:
  47700  */
  47701 int
  47702 bcm_esw_field_qualify_OamDownMEPLoopbackPacket(
  47703         int unit,
  47704         bcm_field_entry_t entry,
  47705         uint8 data,
  47706         uint8 mask)
  47707 {
  47708     int rv = BCM_E_UNAVAIL;
  47709 #if defined(BCM_APACHE_SUPPORT)
  47710 
  47711     if (data > 0x1) {
  47712         return BCM_E_PARAM;
  47713     }
  47714 
  47715     
  47716     FP_LOCK(unit);
  47717 
  47718     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamDownMEPLoopbackPacket,
  47719                           data, mask);
  47720     FP_UNLOCK(unit);
  47721 #endif
  47722     return rv;
  47723 }
  47724 
  47725 /*
  47726  * Function:
  47727  *      bcm_esw_field_qualify_OamDownMEPLoopbackPacket_get
  47728  * Purpose:
  47729  *      Get match criteria for bcmFieldQualifyOamDownMEPLoopbackPacket
  47730  *      qualifier from the field entry.
  47731  * Parameters:
  47732  *      unit - (IN) Unit number.
  47733  *      entry - (IN) BCM field entry id.
  47734  *      data - (OUT) Qualifier match data.
  47735  *      mask - (OUT) Qualifier match mask.
  47736  * Returns:
  47737  *      BCM_E_XXX
  47738  * Notes:
  47739  */
  47740 int
  47741 bcm_esw_field_qualify_OamDownMEPLoopbackPacket_get(
  47742         int unit,
  47743         bcm_field_entry_t entry,
  47744         uint8 *data,
  47745         uint8 *mask)
  47746 {
  47747     /* Read qualifier match value and mask. */
  47748     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  47749                       bcmFieldQualifyOamDownMEPLoopbackPacket,
  47750                       data, mask);
  47751 }
  47752 
  47753 /*
  47754  * Function:
  47755  *      bcm_esw_field_qualify_OamEgressPortUnicastDstMacHit
  47756  * Purpose:
  47757  *      Set match criteria to qualify on EGR_PORT MAC DA hit status
  47758  *      for a given entry.
  47759  * Parameters:
  47760  *      unit  - (IN) Unit number.
  47761  *      entry - (IN) BCM field entry id.
  47762  *      data  - (IN) Qualifier match data.
  47763  *      mask  - (IN) Qualifier match mask.
  47764  * Returns:
  47765  *      BCM_E_XXX
  47766  * Notes:
  47767  */
  47768 int
  47769 bcm_esw_field_qualify_OamEgressPortUnicastDstMacHit(
  47770         int unit,
  47771         bcm_field_entry_t entry,
  47772         uint8 data,
  47773         uint8 mask)
  47774 {
  47775     int rv = BCM_E_UNAVAIL;
  47776 #if defined(BCM_APACHE_SUPPORT)
  47777 
  47778     if (data > 0x1) {
  47779         return BCM_E_PARAM;
  47780     }
  47781 
  47782     
  47783     FP_LOCK(unit);
  47784 
  47785     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamEgressPortUnicastDstMacHit,
  47786                           data, mask);
  47787     FP_UNLOCK(unit);
  47788 #endif
  47789     return rv;
  47790 }
  47791 
  47792 /*
  47793  * Function:
  47794  *      bcm_esw_field_qualify_OamEgressPortUnicastDstMacHit_get
  47795  * Purpose:
  47796  *      Get match criteria for bcmFieldQualifyOamEgressPortUnicastDstMacHit
  47797  *      qualifier from the field entry.
  47798  * Parameters:
  47799  *      unit - (IN) Unit number.
  47800  *      entry - (IN) BCM field entry id.
  47801  *      data - (OUT) Qualifier match data.
  47802  *      mask - (OUT) Qualifier match mask.
  47803  * Returns:
  47804  *      BCM_E_XXX
  47805  * Notes:
  47806  */
  47807 int
  47808 bcm_esw_field_qualify_OamEgressPortUnicastDstMacHit_get(
  47809         int unit,
  47810         bcm_field_entry_t entry,
  47811         uint8 *data,
  47812         uint8 *mask)
  47813 {
  47814     /* Read qualifier match value and mask. */
  47815     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  47816                       bcmFieldQualifyOamEgressPortUnicastDstMacHit,
  47817                       data, mask);
  47818 }
  47819 
  47820 /*
  47821  * Function:
  47822  *      bcm_esw_field_qualify_IngressDropEthernetOamControl
  47823  * Purpose:
  47824  *      Set match criteria to qualify on Drop reason for
  47825  *      Ethernet OAM control packets for a given entry.
  47826  * Parameters:
  47827  *      unit  - (IN) Unit number.
  47828  *      entry - (IN) BCM field entry id.
  47829  *      mep_type  - (IN) Qualifier Mep Type.
  47830  * Returns:
  47831  *      BCM_E_XXX
  47832  * Notes:
  47833  */
  47834 int
  47835 bcm_esw_field_qualify_IngressDropEthernetOamControl(
  47836     int unit,
  47837     bcm_field_entry_t entry,
  47838     bcm_field_oam_drop_mep_type_t mep_type)
  47839 {
  47840     int rv = BCM_E_UNAVAIL;
  47841 #if defined(BCM_APACHE_SUPPORT)
  47842 
  47843     
  47844     FP_LOCK(unit);
  47845 
  47846     rv = _bcm_field_apache_qualify_OamDropReason(unit, entry,
  47847             bcmFieldQualifyIngressDropEthernetOamControl,
  47848             mep_type);
  47849 
  47850     FP_UNLOCK(unit);
  47851 #endif
  47852     return rv;
  47853 }
  47854 
  47855 /*
  47856  * Function:
  47857  *      bcm_esw_field_qualify_IngressDropEthernetOamControl_get
  47858  * Purpose:
  47859  *      Get match criteria for bcmFieldQualifyIngressDropEthernetOamControl
  47860  *      qualifier from the field entry.
  47861  * Parameters:
  47862  *      unit - (IN) Unit number.
  47863  *      entry - (IN) BCM field entry id.
  47864  *      mep_type - (OUT) Qualifier Mep Type.
  47865  * Returns:
  47866  *      BCM_E_XXX
  47867  * Notes:
  47868  */
  47869 int
  47870 bcm_esw_field_qualify_IngressDropEthernetOamControl_get(
  47871     int unit,
  47872     bcm_field_entry_t entry,
  47873     bcm_field_oam_drop_mep_type_t *mep_type)
  47874 {
  47875     int rv = BCM_E_UNAVAIL;
  47876 #if defined(BCM_APACHE_SUPPORT)
  47877     rv = _bcm_field_apache_qualify_OamDropReason_get(unit, entry,
  47878             bcmFieldQualifyIngressDropEthernetOamControl,
  47879             mep_type);
  47880 #endif
  47881     return rv;
  47882 }
  47883 
  47884 /*
  47885  * Function:
  47886  *      bcm_esw_field_qualify_IngressDropEthernetOamData
  47887  * Purpose:
  47888  *      Set match criteria to qualify on Drop reason for
  47889  *      Ethernet OAM data packets for a given entry.
  47890  * Parameters:
  47891  *      unit  - (IN) Unit number.
  47892  *      entry - (IN) BCM field entry id.
  47893  *      mep_type  - (IN) Qualifier Mep Type.
  47894  * Returns:
  47895  *      BCM_E_XXX
  47896  * Notes:
  47897  */
  47898 int
  47899 bcm_esw_field_qualify_IngressDropEthernetOamData(
  47900     int unit,
  47901     bcm_field_entry_t entry,
  47902     bcm_field_oam_drop_mep_type_t mep_type)
  47903 {
  47904     int rv = BCM_E_UNAVAIL;
  47905 #if defined(BCM_APACHE_SUPPORT)
  47906 
  47907     
  47908     FP_LOCK(unit);
  47909 
  47910     rv = _bcm_field_apache_qualify_OamDropReason(unit, entry,
  47911             bcmFieldQualifyIngressDropEthernetOamData,
  47912             mep_type);
  47913 
  47914     FP_UNLOCK(unit);
  47915 #endif
  47916     return rv;
  47917 }
  47918 
  47919 /*
  47920  * Function:
  47921  *      bcm_esw_field_qualify_IngressDropEthernetOamData_get
  47922  * Purpose:
  47923  *      Get match criteria for bcmFieldQualifyIngressDropEthernetOamData
  47924  *      qualifier from the field entry.
  47925  * Parameters:
  47926  *      unit - (IN) Unit number.
  47927  *      entry - (IN) BCM field entry id.
  47928  *      mep_type - (OUT) Qualifier Mep Type.
  47929  * Returns:
  47930  *      BCM_E_XXX
  47931  * Notes:
  47932  */
  47933 int
  47934 bcm_esw_field_qualify_IngressDropEthernetOamData_get(
  47935     int unit,
  47936     bcm_field_entry_t entry,
  47937     bcm_field_oam_drop_mep_type_t *mep_type)
  47938 {
  47939     int rv = BCM_E_UNAVAIL;
  47940 #if defined(BCM_APACHE_SUPPORT)
  47941     rv = _bcm_field_apache_qualify_OamDropReason_get(unit, entry,
  47942             bcmFieldQualifyIngressDropEthernetOamData,
  47943             mep_type);
  47944 #endif
  47945     return rv;
  47946 }
  47947 
  47948 /*
  47949  * Function:
  47950  *      bcm_esw_field_qualify_IngressDropMplsOamControl
  47951  * Purpose:
  47952  *      Set match criteria to qualify on Drop reason for
  47953  *      Mpls OAM control packets for a given entry.
  47954  * Parameters:
  47955  *      unit  - (IN) Unit number.
  47956  *      entry - (IN) BCM field entry id.
  47957  *      mep_type  - (IN) Qualifier Mep Type.
  47958  * Returns:
  47959  *      BCM_E_XXX
  47960  * Notes:
  47961  */
  47962 int
  47963 bcm_esw_field_qualify_IngressDropMplsOamControl(
  47964     int unit,
  47965     bcm_field_entry_t entry,
  47966     bcm_field_oam_drop_mep_type_t mep_type)
  47967 {
  47968     int rv = BCM_E_UNAVAIL;
  47969 #if defined(BCM_APACHE_SUPPORT)
  47970 
  47971     
  47972     FP_LOCK(unit);
  47973 
  47974     rv = _bcm_field_apache_qualify_OamDropReason(unit, entry,
  47975             bcmFieldQualifyIngressDropMplsOamControl,
  47976             mep_type);
  47977 
  47978     FP_UNLOCK(unit);
  47979 #endif
  47980     return rv;
  47981 }
  47982 
  47983 /*
  47984  * Function:
  47985  *      bcm_esw_field_qualify_IngressDropMplsOamControl_get
  47986  * Purpose:
  47987  *      Get match criteria for bcmFieldQualifyIngressDropMplsOamControl
  47988  *      qualifier from the field entry.
  47989  * Parameters:
  47990  *      unit - (IN) Unit number.
  47991  *      entry - (IN) BCM field entry id.
  47992  *      mep_type - (OUT) Qualifier Mep Type.
  47993  * Returns:
  47994  *      BCM_E_XXX
  47995  * Notes:
  47996  */
  47997 int
  47998 bcm_esw_field_qualify_IngressDropMplsOamControl_get(
  47999     int unit,
  48000     bcm_field_entry_t entry,
  48001     bcm_field_oam_drop_mep_type_t *mep_type)
  48002 {
  48003     int rv = BCM_E_UNAVAIL;
  48004 #if defined(BCM_APACHE_SUPPORT)
  48005     rv = _bcm_field_apache_qualify_OamDropReason_get(unit, entry,
  48006             bcmFieldQualifyIngressDropMplsOamControl,
  48007             mep_type);
  48008 #endif
  48009     return rv;
  48010 }
  48011 
  48012 /*
  48013  * Function:
  48014  *      bcm_esw_field_qualify_IngressDropMplsOamData
  48015  * Purpose:
  48016  *      Set match criteria to qualify on Drop reason for
  48017  *      Mpls OAM data packets for a given entry.
  48018  * Parameters:
  48019  *      unit  - (IN) Unit number.
  48020  *      entry - (IN) BCM field entry id.
  48021  *      mep_type  - (IN) Qualifier Mep Type.
  48022  * Returns:
  48023  *      BCM_E_XXX
  48024  * Notes:
  48025  */
  48026 int
  48027 bcm_esw_field_qualify_IngressDropMplsOamData(
  48028     int unit,
  48029     bcm_field_entry_t entry,
  48030     bcm_field_oam_drop_mep_type_t mep_type)
  48031 {
  48032     int rv = BCM_E_UNAVAIL;
  48033 #if defined(BCM_APACHE_SUPPORT)
  48034 
  48035     
  48036     FP_LOCK(unit);
  48037 
  48038     rv = _bcm_field_apache_qualify_OamDropReason(unit, entry,
  48039             bcmFieldQualifyIngressDropMplsOamData,
  48040             mep_type);
  48041 
  48042     FP_UNLOCK(unit);
  48043 #endif
  48044     return rv;
  48045 }
  48046 
  48047 /*
  48048  * Function:
  48049  *      bcm_esw_field_qualify_IngressDropMplsOamData_get
  48050  * Purpose:
  48051  *      Get match criteria for bcmFieldQualifyIngressDropMplsOamData
  48052  *      qualifier from the field entry.
  48053  * Parameters:
  48054  *      unit - (IN) Unit number.
  48055  *      entry - (IN) BCM field entry id.
  48056  *      mep_type - (OUT) Qualifier Mep Type.
  48057  * Returns:
  48058  *      BCM_E_XXX
  48059  * Notes:
  48060  */
  48061 int
  48062 bcm_esw_field_qualify_IngressDropMplsOamData_get(
  48063     int unit,
  48064     bcm_field_entry_t entry,
  48065     bcm_field_oam_drop_mep_type_t *mep_type)
  48066 {
  48067     int rv = BCM_E_UNAVAIL;
  48068 #if defined(BCM_APACHE_SUPPORT)
  48069     rv = _bcm_field_apache_qualify_OamDropReason_get(unit, entry,
  48070             bcmFieldQualifyIngressDropMplsOamData,
  48071             mep_type);
  48072 #endif
  48073     return rv;
  48074 }
  48075 
  48076 /*
  48077  * Function:
  48078  *      bcm_esw_field_qualify_OamEgressEtherType
  48079  * Purpose:
  48080  *      Set match criteria to qualify on OAM or SAT
  48081  *      Ethernet Type for a given entry.
  48082  *      Allowed values are 0x8902 or 0x88b7
  48083  * Parameters:
  48084  *      unit  - (IN) Unit number.
  48085  *      entry - (IN) BCM field entry id.
  48086  *      data  - (IN) Qualifier data.
  48087  * Returns:
  48088  *      BCM_E_XXX
  48089  * Notes:
  48090  */
  48091 int
  48092 bcm_esw_field_qualify_OamEgressEtherType(
  48093     int unit,
  48094     bcm_field_entry_t entry,
  48095     uint16 data)
  48096 {
  48097     int                 rv = BCM_E_UNAVAIL;
  48098 #if defined(BCM_APACHE_SUPPORT)
  48099     uint16              mask;
  48100 
  48101     if ((data != _FP_ETHOAM_ETHER_TYPE) && (data != _FP_SAT_ETHER_TYPE)) {
  48102         return BCM_E_PARAM;
  48103     }
  48104 
  48105     if (data == _FP_ETHOAM_ETHER_TYPE) {
  48106         data = _FP_EGRESS_OAM_CLASS_ID;
  48107     } else {
  48108         data = _FP_EGRESS_SAT_CLASS_ID;
  48109     }
  48110 
  48111     mask = 0x3;
  48112 
  48113     
  48114     FP_LOCK(unit);
  48115 
  48116     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamEgressEtherType,
  48117                           data, mask);
  48118     FP_UNLOCK(unit);
  48119 #endif
  48120     return rv;
  48121 }
  48122 
  48123 /*
  48124  * Function:
  48125  *      bcm_esw_field_qualify_OamEgressEtherType_get
  48126  * Purpose:
  48127  *      Get match criteria for bcmFieldQualifyOamEgressEtherType
  48128  *      qualifier from the field entry.
  48129  * Parameters:
  48130  *      unit  - (IN) Unit number.
  48131  *      entry - (IN) BCM field entry id.
  48132  *      data  - (OUT) Qualifier data.
  48133  * Returns:
  48134  *      BCM_E_XXX
  48135  * Notes:
  48136  */
  48137 int
  48138 bcm_esw_field_qualify_OamEgressEtherType_get(
  48139     int unit,
  48140     bcm_field_entry_t entry,
  48141     uint16 *data)
  48142 {
  48143     int         rv = BCM_E_UNAVAIL;
  48144 #if defined(BCM_APACHE_SUPPORT)
  48145     uint16      hw_data;
  48146     uint16      hw_mask;
  48147 
  48148     if (data == NULL) {
  48149         return BCM_E_PARAM;
  48150     }
  48151 
  48152     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  48153                           bcmFieldQualifyOamEgressEtherType,
  48154                           &hw_data, &hw_mask);
  48155 
  48156     if (BCM_SUCCESS(rv)) {
  48157         if (hw_mask == 0) {
  48158             return BCM_E_NOT_FOUND;
  48159         }
  48160 
  48161         switch(hw_data & hw_mask) {
  48162             case _FP_EGRESS_OAM_CLASS_ID:
  48163                 *data = _FP_ETHOAM_ETHER_TYPE;
  48164                 break;
  48165             case _FP_EGRESS_SAT_CLASS_ID:
  48166                 *data = _FP_SAT_ETHER_TYPE;
  48167                 break;
  48168             default:
  48169                 return BCM_E_INTERNAL;
  48170         }
  48171     }
  48172 #endif
  48173     return rv;
  48174 }
  48175 
  48176 /*
  48177  * Function:
  48178  *      bcm_esw_field_qualify_OamEgressMulticastMacHit
  48179  * Purpose:
  48180  *      Set match criteria to qualify on OAM Multicast
  48181  *      MAC Range Hit status for a given entry.
  48182  * Parameters:
  48183  *      unit  - (IN) Unit number.
  48184  *      entry - (IN) BCM field entry id.
  48185  *      data  - (IN) Qualifier data.
  48186  * Returns:
  48187  *      BCM_E_XXX
  48188  * Notes:
  48189  */
  48190 int
  48191 bcm_esw_field_qualify_OamEgressMulticastMacHit(
  48192     int unit,
  48193     bcm_field_entry_t entry,
  48194     uint8 data)
  48195 {
  48196     int                 rv = BCM_E_UNAVAIL;
  48197 #if defined(BCM_APACHE_SUPPORT)
  48198     uint8              mask;
  48199 
  48200     if ((data < BCM_FIELD_OAM_MUTLICAST_MAC_NO_HIT) ||
  48201             (data > BCM_FIELD_OAM_MUTLICAST_MAC_CLASS2_HIT)) {
  48202         return BCM_E_PARAM;
  48203     }
  48204 
  48205     if (data == BCM_FIELD_OAM_MUTLICAST_MAC_NO_HIT) {
  48206         data = 0x0;
  48207     } else if (data == BCM_FIELD_OAM_MUTLICAST_MAC_CLASS1_HIT) {
  48208         data = 0x1;
  48209     } else {
  48210         data = 0x2;
  48211     }
  48212 
  48213     mask = 0x3;
  48214 
  48215     
  48216     FP_LOCK(unit);
  48217 
  48218     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamEgressMulticastMacHit,
  48219                           data, mask);
  48220     FP_UNLOCK(unit);
  48221 #endif
  48222     return rv;
  48223 }
  48224 
  48225 /*
  48226  * Function:
  48227  *      bcm_esw_field_qualify_OamEgressMulticastMacHit_get
  48228  * Purpose:
  48229  *      Get match criteria for bcmFieldQualifyOamEgressMulticastMacHit
  48230  *      qualifier from the field entry.
  48231  * Parameters:
  48232  *      unit  - (IN) Unit number.
  48233  *      entry - (IN) BCM field entry id.
  48234  *      data  - (OUT) Qualifier data.
  48235  * Returns:
  48236  *      BCM_E_XXX
  48237  * Notes:
  48238  */
  48239 int
  48240 bcm_esw_field_qualify_OamEgressMulticastMacHit_get(
  48241     int unit,
  48242     bcm_field_entry_t entry,
  48243     uint8 *data)
  48244 {
  48245     int         rv = BCM_E_UNAVAIL;
  48246 #if defined(BCM_APACHE_SUPPORT)
  48247     uint8      hw_data = 0;
  48248     uint8      hw_mask = 0;
  48249 
  48250     if (data == NULL) {
  48251         return BCM_E_PARAM;
  48252     }
  48253 
  48254     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  48255                           bcmFieldQualifyOamEgressMulticastMacHit,
  48256                           &hw_data, &hw_mask);
  48257 
  48258     if (BCM_SUCCESS(rv)) {
  48259         if (hw_mask == 0) {
  48260             return BCM_E_NOT_FOUND;
  48261         }
  48262 
  48263         switch(hw_data & hw_mask) {
  48264             case 0x0:
  48265                 *data = BCM_FIELD_OAM_MUTLICAST_MAC_NO_HIT;
  48266                 break;
  48267             case 0x1:
  48268                 *data = BCM_FIELD_OAM_MUTLICAST_MAC_CLASS1_HIT;
  48269                 break;
  48270             case 0x2:
  48271                 *data = BCM_FIELD_OAM_MUTLICAST_MAC_CLASS2_HIT;
  48272                 break;
  48273             default:
  48274                 return BCM_E_INTERNAL;
  48275         }
  48276     }
  48277 #endif
  48278     return rv;
  48279 }
  48280 
  48281 /*
  48282  * Function:
  48283  *      bcm_esw_field_qualify_OamEgressClassSrcMac
  48284  * Purpose:
  48285  *      Set match criteria to qualify on Srouce MAC Class Id
  48286  *      assigned for packet based on Hit in
  48287  *      EGR_OAM_SAT_MISC_MAC_SA_0.15 registers for a given entry.
  48288  * Parameters:
  48289  *      unit  - (IN) Unit number.
  48290  *      entry - (IN) BCM field entry id.
  48291  *      data  - (IN) Qualifier match data.
  48292  *      mask  - (IN) Qualifier match mask.
  48293  * Returns:
  48294  *      BCM_E_XXX
  48295  * Notes:
  48296  */
  48297 int
  48298 bcm_esw_field_qualify_OamEgressClassSrcMac(
  48299         int unit,
  48300         bcm_field_entry_t entry,
  48301         uint32 data,
  48302         uint32 mask)
  48303 {
  48304     int rv = BCM_E_UNAVAIL;
  48305 #if defined(BCM_APACHE_SUPPORT)
  48306 
  48307     if (data > 0xf) {
  48308         return BCM_E_PARAM;
  48309     }
  48310 
  48311     
  48312     FP_LOCK(unit);
  48313 
  48314     rv = _field_qualify32(unit, entry, bcmFieldQualifyOamEgressClassSrcMac,
  48315                           data, mask);
  48316     FP_UNLOCK(unit);
  48317 #endif
  48318     return rv;
  48319 }
  48320 
  48321 /*
  48322  * Function:
  48323  *      bcm_esw_field_qualify_OamEgressClassSrcMac_get
  48324  * Purpose:
  48325  *      Get match criteria for bcmFieldQualifyOamEgressClassSrcMac
  48326  *      qualifier from the field entry.
  48327  * Parameters:
  48328  *      unit - (IN) Unit number.
  48329  *      entry - (IN) BCM field entry id.
  48330  *      data - (OUT) Qualifier match data.
  48331  *      mask - (OUT) Qualifier match mask.
  48332  * Returns:
  48333  *      BCM_E_XXX
  48334  * Notes:
  48335  */
  48336 int
  48337 bcm_esw_field_qualify_OamEgressClassSrcMac_get(
  48338         int unit,
  48339         bcm_field_entry_t entry,
  48340         uint32 *data,
  48341         uint32 *mask)
  48342 {
  48343     /* Read qualifier match value and mask. */
  48344     return _bcm_field_entry_qualifier_uint32_get(unit, entry,
  48345                       bcmFieldQualifyOamEgressClassSrcMac,
  48346                       data, mask);
  48347 }
  48348 
  48349 /*
  48350  * Function:
  48351  *      bcm_esw_field_qualify_MyStation2Hit
  48352  * Purpose:
  48353  *      Set match criteria to qualify on My Station tacm hit
  48354  *      based on Overlay L2 termination lookup hit for tunnel packets or
  48355  *      Routing hit for non-tunnel packets for a given entry.
  48356  * Parameters:
  48357  *      unit  - (IN) Unit number.
  48358  *      entry - (IN) BCM field entry id.
  48359  *      data  - (IN) Qualifier match data.
  48360  *      mask  - (IN) Qualifier match mask.
  48361  * Returns:
  48362  *      BCM_E_XXX
  48363  * Notes:
  48364  */
  48365 int
  48366 bcm_esw_field_qualify_MyStation2Hit(
  48367         int unit,
  48368         bcm_field_entry_t entry,
  48369         uint8 data,
  48370         uint8 mask)
  48371 {
  48372     int rv = BCM_E_UNAVAIL;
  48373 #if defined(BCM_TRIDENT2PLUS_SUPPORT)
  48374 
  48375     if (data > 0x1) {
  48376         return BCM_E_PARAM;
  48377     }
  48378 
  48379     
  48380     FP_LOCK(unit);
  48381 
  48382     rv = _field_qualify32(unit, entry, bcmFieldQualifyMyStation2Hit,
  48383                           data, mask);
  48384     FP_UNLOCK(unit);
  48385 #endif
  48386     return rv;
  48387 }
  48388 
  48389 /*
  48390  * Function:
  48391  *      bcm_esw_field_qualify_MyStation2Hit_get
  48392  * Purpose:
  48393  *      Get match criteria for bcmFieldQualifyMyStation2Hit
  48394  *      qualifier from the field entry.
  48395  * Parameters:
  48396  *      unit - (IN) Unit number.
  48397  *      entry - (IN) BCM field entry id.
  48398  *      data - (OUT) Qualifier match data.
  48399  *      mask - (OUT) Qualifier match mask.
  48400  * Returns:
  48401  *      BCM_E_XXX
  48402  * Notes:
  48403  */
  48404 int
  48405 bcm_esw_field_qualify_MyStation2Hit_get(
  48406         int unit,
  48407         bcm_field_entry_t entry,
  48408         uint8 *data,
  48409         uint8 *mask)
  48410 {
  48411     /* Read qualifier match value and mask. */
  48412     return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  48413                       bcmFieldQualifyMyStation2Hit,
  48414                       data, mask);
  48415 }
  48416 
  48417 /*
  48418  * Function:
  48419  *      bcm_esw_field_qualify_TrunkMemberSourceModuleId
  48420  * Purpose:
  48421  *      Add source trunk module field qualification to a field entry.
  48422  * Parameters:
  48423  *      unit  - (IN) Unit number.
  48424  *      entry - (IN) Field Entry id.
  48425  *      modid - (IN) Module Id
  48426  *      modid_mask - (IN) Module Id mask.
  48427  * Returns:
  48428  *      BCM_E_XXX
  48429  * Notes:
  48430  */
  48431 int
  48432 bcm_esw_field_qualify_TrunkMemberSourceModuleId(
  48433     int unit, 
  48434     bcm_field_entry_t entry, 
  48435     int modid, 
  48436     int modid_mask)
  48437 {
  48438     int rv;                 /* Operation return status. */
  48439 
  48440     /* Input parameters check. */
  48441     if ((modid < 0) && (modid > SOC_MODID_MAX(unit))) {
  48442         return (BCM_E_PARAM);
  48443     }
  48444 
  48445     
  48446     FP_LOCK(unit);
  48447 
  48448     rv = _field_qualify32(unit, entry, bcmFieldQualifyTrunkMemberSourceModuleId,
  48449                           modid, modid_mask);
  48450 
  48451     FP_UNLOCK(unit);
  48452     return (rv);
  48453 }
  48454 
  48455 /*
  48456  * Function:
  48457  *      bcm_esw_field_qualify_TrunkMemberSourceModuleId_get
  48458  * Purpose:
  48459  *      Get match criteria for bcmFieildQualifySrcTrunkModuleGport
  48460  *                     qualifier from the field entry.
  48461  * Parameters:
  48462  *      unit  - (IN)  Unit number.
  48463  *      entry - (IN)  Field Entry id.
  48464  *      modid - (OUT) Module Id.
  48465  *      modid_mask - (OUT) Module Id mask.
  48466  * Returns:
  48467  *      BCM_E_XXX
  48468  * Notes:
  48469  */
  48470 int
  48471 bcm_esw_field_qualify_TrunkMemberSourceModuleId_get(
  48472     int unit, 
  48473     bcm_field_entry_t entry, 
  48474     int *modid, 
  48475     int *modid_mask)
  48476 {
  48477     uint32 data;   /* HW encoded qualifier data.  */
  48478     uint32 mask;   /* HW encoding qualifier mask. */
  48479     int rv;        /* Operation return status.    */
  48480 
  48481     /* Input parameters check. */
  48482     if ((NULL == modid) || (NULL == modid_mask)) {
  48483         return (BCM_E_PARAM);
  48484     }
  48485 
  48486     /* Read qualifier match value and mask. */
  48487     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  48488                   bcmFieldQualifyTrunkMemberSourceModuleId,
  48489                                              &data, &mask);
  48490     BCM_IF_ERROR_RETURN(rv);
  48491 
  48492     *modid = data & 0xff;
  48493     *modid_mask = mask & 0xff;
  48494     return BCM_E_NONE;
  48495 }
  48496 
  48497 /*
  48498  * Function:
  48499  *      bcm_esw_field_action_vlan_actions_add
  48500  * Purpose:
  48501  *      Add VLAN Actions "bcmFieldActionVlanActions" to the field entry.
  48502  * Parameters:
  48503  *      unit   - (IN)  Unit number.
  48504  *      entry  - (IN)  Field Entry id.
  48505  *      action - (IN)  Field Action type.
  48506  *      vlan_action_set - (IN) Reference to bcm_vlan_action_set_t.
  48507  * Returns:
  48508  *      BCM_E_XXX
  48509  * Notes:
  48510  */
  48511 int
  48512 bcm_esw_field_action_vlan_actions_add(
  48513     int unit,
  48514     bcm_field_entry_t entry,
  48515     bcm_field_action_t action,
  48516     bcm_vlan_action_set_t *vlan_action_set)
  48517 {
  48518     int     rv = BCM_E_UNAVAIL;
  48519 
  48520 #if defined(BCM_TRIDENT3_SUPPORT)
  48521     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  48522        FP_LOCK(unit);
  48523        rv = _bcm_field_action_vlan_actions_add(unit, entry,
  48524                                     action, vlan_action_set);
  48525        FP_UNLOCK(unit);
  48526     }
  48527 #endif /* BCM_TRIDENT3_SUPPORT */
  48528     return rv;
  48529 }
  48530 
  48531 /*
  48532  * Function:
  48533  *      bcm_esw_field_action_vlan_actions_get
  48534  * Purpose:
  48535  *      Retrieve VLAN Actions associated to the field entry.
  48536  * Parameters:
  48537  *      unit   - (IN)  Unit number.
  48538  *      entry  - (IN)  Field Entry id.
  48539  *      action - (IN)  Field Action type.
  48540  *      vlan_action_set - (OUT) Reference to bcm_vlan_action_set_t.
  48541  * Returns:
  48542  *      BCM_E_XXX
  48543  * Notes:
  48544  */
  48545 
  48546 int
  48547 bcm_esw_field_action_vlan_actions_get(
  48548     int unit,
  48549     bcm_field_entry_t entry,
  48550     bcm_field_action_t action,
  48551     bcm_vlan_action_set_t *vlan_action_set)
  48552 {
  48553     int     rv = BCM_E_UNAVAIL;
  48554 
  48555 #if defined(BCM_TRIDENT3_SUPPORT)
  48556     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  48557        FP_LOCK(unit);
  48558        rv = _bcm_field_action_vlan_actions_get(unit, entry,
  48559                                   action, vlan_action_set);
  48560        FP_UNLOCK(unit);
  48561     }
  48562 #endif /* BCM_TRIDENT3_SUPPORT */
  48563     return rv;
  48564 }
  48565 
  48566 
  48567 /*
  48568  * Function:
  48569  *      bcm_esw_field_qualify_PreemptablePacket
  48570  * Purpose:
  48571  *      Set match criteria for bcmFieldQualifyPreemptablePacket 
  48572  *      qualifier in the field entry.
  48573  * Parameters:
  48574  *      unit  - (IN) Unit number.
  48575  *      entry - (IN) Field Entry id.
  48576  *      data  - (IN) Qualifier match data.
  48577  *                   The data = 1 is meant to qualify the preemptable packet
  48578  *      mask  - (IN) Qualifier match mask.
  48579  * Returns:
  48580  *      BCM_E_XXX
  48581  * Notes:
  48582  */
  48583 int
  48584 bcm_esw_field_qualify_PreemptablePacket(
  48585     int unit,
  48586     bcm_field_entry_t entry,
  48587     uint8 data,
  48588     uint8 mask)
  48589 {
  48590     int rv = BCM_E_UNAVAIL;
  48591 
  48592  #if defined(BCM_PREEMPTION_SUPPORT)
  48593     if (soc_feature(unit, soc_feature_preemption)) {
  48594         if (data > 0x1 || mask > 0x1) {
  48595             return BCM_E_PARAM;
  48596         }
  48597         FP_LOCK(unit);
  48598 
  48599         rv = _field_qualify32(unit, entry, bcmFieldQualifyPreemptablePacket,
  48600                               data, mask);
  48601         FP_UNLOCK(unit);
  48602     }
  48603  #endif /* BCM_PREEMPTION_SUPPORT */
  48604 
  48605     return rv;
  48606 }
  48607 
  48608 /*
  48609  * Function:
  48610  *      bcm_esw_field_qualify_PreemptablePacket_get
  48611  * Purpose:
  48612  *      Get match criteria for bcmFieldQualifyPreemptablePacket 
  48613  *      qualifier in the field entry.
  48614  * Parameters:
  48615  *      unit  - (IN) Unit number.
  48616  *      entry - (IN) Field Entry id.
  48617  *      data  - (OUT) Qualifier match data.
  48618  *                    The data = 1 is meant to qualify the preemptable packet
  48619  *      mask  - (OUT) Qualifier match mask.
  48620  * Returns:
  48621  *      BCM_E_XXX
  48622  * Notes:
  48623  */
  48624 int
  48625 bcm_esw_field_qualify_PreemptablePacket_get(
  48626     int unit,
  48627     bcm_field_entry_t entry,
  48628     uint8 *data,
  48629     uint8 *mask)
  48630 {
  48631     int rv = BCM_E_UNAVAIL;
  48632 
  48633 #if defined(BCM_PREEMPTION_SUPPORT)
  48634     if (soc_feature(unit, soc_feature_preemption)) {
  48635         /* Read qualifier match value and mask. */
  48636         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  48637                                                   bcmFieldQualifyPreemptablePacket,
  48638                                                   data, mask);
  48639     }
  48640 #endif /* BCM_PREEMPTION_SUPPORT */
  48641 
  48642     return rv;
  48643 }
  48644 
  48645 /*
  48646  * Function:
  48647  *      bcm_esw_field_qualify_VxlanClassValid
  48648  * Purpose:
  48649  *      Set match criteria for bcmFieildQualifyVxlanClassValid
  48650  *      qualifier from the field entry.
  48651  *      The VXLAN Class contains complete {Flags, Reserved1 and Reserved2} fields except for
  48652  *      VN_ID in VXLAN header. It is to indicate the incoming VXLAN header with pre-configured
  48653  *      value (VXLAN Class) is valid or not (TRUE or FALSE).
  48654  * Parameters:
  48655  *      unit    - (IN) Unit number.
  48656  *      entry   - (IN) BCM field entry id.
  48657  *      data    - (IN) Qualifier match data.
  48658  *                     TRUE: Valid VXLAN Class.
  48659  *                     FALSE: Invalid VXLAN Class.
  48660  *      mask    - (IN) Qualifier match mask.
  48661  * Returns:
  48662  *      BCM_E_XXX
  48663  * Notes:
  48664  */
  48665 int
  48666 bcm_esw_field_qualify_VxlanClassValid(
  48667     int unit,
  48668     bcm_field_entry_t entry,
  48669     uint8 data,
  48670     uint8 mask)
  48671 {
  48672     int rv = BCM_E_UNAVAIL;
  48673 
  48674 #ifdef BCM_GREYHOUND2_SUPPORT
  48675     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  48676         if (data > 0x1 || mask > 0x1) {
  48677             return BCM_E_PARAM;
  48678         }
  48679         FP_LOCK(unit);
  48680 
  48681         rv = _field_qualify32(unit, entry, bcmFieldQualifyVxlanClassValid,
  48682                               data, mask);
  48683         FP_UNLOCK(unit);
  48684     }
  48685 #endif /* BCM_GREYHOUND2_SUPPORT */
  48686 
  48687     return rv;
  48688 }
  48689 
  48690 /*
  48691  * Function:
  48692  *      bcm_esw_field_qualify_VxlanClassValid_get
  48693  * Purpose:
  48694  *      Get match criteria for bcmFieildQualifyVxlanClassValid
  48695  *      qualifier from the field entry.
  48696  *      The VXLAN Class contains complete {Flags, Reserved1 and Reserved2} fields except for
  48697  *      VN_ID in VXLAN header. It is to indicate the incoming VXLAN header with pre-configured
  48698  *      value (VXLAN Class) is valid or not (TRUE or FALSE).
  48699  * Parameters:
  48700  *      unit    - (IN) Unit number.
  48701  *      entry   - (IN) BCM field entry id.
  48702  *      data    - (OUT) Qualifier match data.
  48703  *                      TRUE: Valid VXLAN Class.
  48704  *                      FALSE: Invalid VXLAN Class.
  48705  *      mask    - (OUT) Qualifier match mask.
  48706  * Returns:
  48707  *      BCM_E_XXX
  48708  * Notes:
  48709  */
  48710 int
  48711 bcm_esw_field_qualify_VxlanClassValid_get(
  48712     int unit,
  48713     bcm_field_entry_t entry,
  48714     uint8 *data,
  48715     uint8 *mask)
  48716 {
  48717     int rv = BCM_E_UNAVAIL;
  48718 
  48719 #ifdef BCM_GREYHOUND2_SUPPORT
  48720     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  48721         /* Read qualifier match value and mask. */
  48722         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  48723                                                   bcmFieldQualifyVxlanClassValid,
  48724                                                   data, mask);
  48725     }
  48726 #endif /* BCM_GREYHOUND2_SUPPORT */
  48727 
  48728     return rv;
  48729 }
  48730 
  48731 /*
  48732  * Function:
  48733  *      bcm_esw_field_qualify_VxlanPacket
  48734  * Purpose:
  48735  *      Set match criteria for bcmFieildQualifyVxlanPacket
  48736  *      qualifier from the field entry.
  48737  * Parameters:
  48738  *      unit    - (IN) Unit number.
  48739  *      entry   - (IN) BCM field entry id.
  48740  *      data    - (IN) Qualifier match data.
  48741  *                     TRUE: VXLAN packet.
  48742  *                     FALSE: Non-VXLAN packet.
  48743  *      mask    - (IN) Qualifier match mask.
  48744  * Returns:
  48745  *      BCM_E_XXX
  48746  * Notes:
  48747  */
  48748 int
  48749 bcm_esw_field_qualify_VxlanPacket(
  48750     int unit,
  48751     bcm_field_entry_t entry,
  48752     uint8 data,
  48753     uint8 mask)
  48754 {
  48755     int rv = BCM_E_UNAVAIL;
  48756 
  48757 #ifdef BCM_GREYHOUND2_SUPPORT
  48758     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  48759         if (data > 0x1 || mask > 0x1) {
  48760             return BCM_E_PARAM;
  48761         }
  48762         FP_LOCK(unit);
  48763 
  48764         rv = _field_qualify32(unit, entry, bcmFieldQualifyVxlanPacket,
  48765                               data, mask);
  48766         FP_UNLOCK(unit);
  48767     }
  48768 #endif /* BCM_GREYHOUND2_SUPPORT */
  48769 
  48770     return rv;
  48771 }
  48772 
  48773 /*
  48774  * Function:
  48775  *      bcm_esw_field_qualify_VxlanPacket_get
  48776  * Purpose:
  48777  *      Get match criteria for bcmFieildQualifyVxlanPacket
  48778  *      qualifier from the field entry.
  48779  * Parameters:
  48780  *      unit    - (IN) Unit number.
  48781  *      entry   - (IN) BCM field entry id.
  48782  *      data    - (OUT) Qualifier match data.
  48783  *                      TRUE: VXLAN packet.
  48784  *                      FALSE: Non-VXLAN packet.
  48785  *      mask    - (OUT) Qualifier match mask.
  48786  * Returns:
  48787  *      BCM_E_XXX
  48788  * Notes:
  48789  */
  48790 int
  48791 bcm_esw_field_qualify_VxlanPacket_get(
  48792     int unit,
  48793     bcm_field_entry_t entry,
  48794     uint8 *data,
  48795     uint8 *mask)
  48796 {
  48797     int rv = BCM_E_UNAVAIL;
  48798 
  48799 #ifdef BCM_GREYHOUND2_SUPPORT
  48800     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  48801         /* Read qualifier match value and mask. */
  48802         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  48803                                                   bcmFieldQualifyVxlanPacket,
  48804                                                   data, mask);
  48805     }
  48806 #endif /* BCM_GREYHOUND2_SUPPORT */
  48807 
  48808     return rv;
  48809 }
  48810 
  48811 /*
  48812  * Function:
  48813  *      bcm_esw_field_qualify_VxlanVnidVlanTranslateHit
  48814  * Purpose:
  48815  *      Set match criteria for bcmFieildQualifyVxlanVnidVlanTranslateHit
  48816  *      qualifier from the field entry.
  48817  * Parameters:
  48818  *      unit    - (IN) Unit number.
  48819  *      entry   - (IN) BCM field entry id.
  48820  *      data    - (IN) Qualifier match data.
  48821  *                     VXLAN Network Identifier (VN_ID) lookup hit status (TRUE or FALSE)
  48822  *                     through VLAN Translation.
  48823  *      mask    - (IN) Qualifier match mask.
  48824  * Returns:
  48825  *      BCM_E_XXX
  48826  * Notes:
  48827  */
  48828 int
  48829 bcm_esw_field_qualify_VxlanVnidVlanTranslateHit(
  48830     int unit,
  48831     bcm_field_entry_t entry,
  48832     uint8 data,
  48833     uint8 mask)
  48834 {
  48835     int rv = BCM_E_UNAVAIL;
  48836 
  48837 #ifdef BCM_GREYHOUND2_SUPPORT
  48838     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  48839         if (data > 0x1 || mask > 0x1) {
  48840             return BCM_E_PARAM;
  48841         }
  48842         FP_LOCK(unit);
  48843 
  48844         rv = _field_qualify32(unit, entry, bcmFieldQualifyVxlanVnidVlanTranslateHit,
  48845                               data, mask);
  48846         FP_UNLOCK(unit);
  48847     }
  48848 #endif /* BCM_GREYHOUND2_SUPPORT */
  48849 
  48850     return rv;
  48851 }
  48852 
  48853 /*
  48854  * Function:
  48855  *      bcm_esw_field_qualify_VxlanVnidVlanTranslateHit_get
  48856  * Purpose:
  48857  *      Get match criteria for bcmFieildQualifyVxlanVnidVlanTranslateHit
  48858  *      qualifier from the field entry.
  48859  * Parameters:
  48860  *      unit    - (IN) Unit number.
  48861  *      entry   - (IN) BCM field entry id.
  48862  *      data    - (OUT) Qualifier match data.
  48863  *                      VXLAN Network Identifier (VN_ID) lookup hit status (TRUE or FALSE)
  48864  *                      through VLAN Translation.
  48865  *      mask    - (OUT) Qualifier match mask.
  48866  * Returns:
  48867  *      BCM_E_XXX
  48868  * Notes:
  48869  */
  48870 int
  48871 bcm_esw_field_qualify_VxlanVnidVlanTranslateHit_get(
  48872     int unit,
  48873     bcm_field_entry_t entry,
  48874     uint8 *data,
  48875     uint8 *mask)
  48876 {
  48877     int rv = BCM_E_UNAVAIL;
  48878 
  48879 #ifdef BCM_GREYHOUND2_SUPPORT
  48880     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  48881         /* Read qualifier match value and mask. */
  48882         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  48883                                                   bcmFieldQualifyVxlanVnidVlanTranslateHit,
  48884                                                   data, mask);
  48885     }
  48886 #endif /* BCM_GREYHOUND2_SUPPORT */
  48887 
  48888     return rv;
  48889 }
  48890 
  48891 /*
  48892  * Function:
  48893  *      bcm_esw_field_qualify_VxlanPayloadVlanFormat
  48894  * Purpose:
  48895  *      Set match criteria for bcmFieildQualifyVxlanPayloadVlanFormat
  48896  *      qualifier from the field entry.
  48897  * Parameters:
  48898  *      unit    - (IN) Unit number.
  48899  *      entry   - (IN) BCM field entry id.
  48900  *      data    - (IN) Qualifier match data.
  48901  *                     Incoming Vxlan L2 payload VLAN tag status:
  48902  *                     0: untagged
  48903  *                     1: single inner-tag (BCM_FIELD_VLAN_FORMAT_INNER_TAGGED = 0x2)
  48904  *                     2: single outer-tag (BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED = 0x1)
  48905  *                     3: double tagged (BCM_FIELD_VLAN_FORMAT_INNER_TAGGED |
  48906  *                                       BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED)
  48907  *      mask    - (IN) Qualifier match mask.
  48908  * Returns:
  48909  *      BCM_E_XXX
  48910  * Notes:
  48911  */
  48912 int
  48913 bcm_esw_field_qualify_VxlanPayloadVlanFormat(
  48914     int unit,
  48915     bcm_field_entry_t entry,
  48916     uint8 data,
  48917     uint8 mask)
  48918 {
  48919     int rv = BCM_E_UNAVAIL;
  48920 
  48921     if (data & ~(BCM_FIELD_VLAN_FORMAT_INNER_TAGGED |
  48922                  BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED)) {
  48923         return BCM_E_PARAM;
  48924     }
  48925 
  48926 #ifdef BCM_GREYHOUND2_SUPPORT
  48927     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  48928         if (soc_feature(unit, soc_feature_field_qual_vlanformat_reverse)) {
  48929             /* The position of outer and inner tagged bits are exchanged in Hw */
  48930             data = (((data & BCM_FIELD_VLAN_FORMAT_INNER_TAGGED) >> 1) |
  48931                    ((data & BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED) << 1));
  48932             mask = (((mask & BCM_FIELD_VLAN_FORMAT_INNER_TAGGED) >> 1) |
  48933                    ((mask & BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED) << 1));
  48934         }
  48935 
  48936         FP_LOCK(unit);
  48937 
  48938         rv = _field_qualify32(unit, entry, bcmFieldQualifyVxlanPayloadVlanFormat,
  48939                               data, mask);
  48940 
  48941         FP_UNLOCK(unit);
  48942     }
  48943 #endif /* BCM_GREYHOUND2_SUPPORT */
  48944 
  48945     return rv;
  48946 }
  48947 
  48948 /*
  48949  * Function:
  48950  *      bcm_esw_field_qualify_VxlanPayloadVlanFormat_get
  48951  * Purpose:
  48952  *      Get match criteria for bcmFieildQualifyVxlanPayloadVlanFormat
  48953  *      qualifier from the field entry.
  48954  * Parameters:
  48955  *      unit    - (IN) Unit number.
  48956  *      entry   - (IN) BCM field entry id.
  48957  *      data    - (OUT) Qualifier match data.
  48958  *                      Incoming Vxlan L2 payload VLAN tag status:
  48959  *                      0: untagged
  48960  *                      1: single inner-tag (BCM_FIELD_VLAN_FORMAT_INNER_TAGGED = 0x2)
  48961  *                      2: single outer-tag (BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED = 0x1)
  48962  *                      3: double tagged (BCM_FIELD_VLAN_FORMAT_INNER_TAGGED |
  48963  *                                        BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED)
  48964  *      mask    - (OUT) Qualifier match mask.
  48965  * Returns:
  48966  *      BCM_E_XXX
  48967  * Notes:
  48968  */
  48969 int
  48970 bcm_esw_field_qualify_VxlanPayloadVlanFormat_get(
  48971     int unit,
  48972     bcm_field_entry_t entry,
  48973     uint8 *data,
  48974     uint8 *mask)
  48975 {
  48976     int rv = BCM_E_UNAVAIL;
  48977 
  48978 #ifdef BCM_GREYHOUND2_SUPPORT
  48979     uint8  hw_data = 0;  /* Installed entry value. */
  48980     uint8  hw_mask = 0;  /* Installed entry mask. */
  48981 
  48982     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  48983         /* Read qualifier match value and mask. */
  48984         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  48985                                                   bcmFieldQualifyVxlanPayloadVlanFormat,
  48986                                                   &hw_data, &hw_mask);
  48987         if (soc_feature(unit, soc_feature_field_qual_vlanformat_reverse)) {
  48988             /* The position of outer and inner tagged bits are exchanged in Hw */
  48989             *data = (((hw_data & BCM_FIELD_VLAN_FORMAT_INNER_TAGGED) >> 1) |
  48990                     ((hw_data & BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED) << 1));
  48991             *mask = (((hw_mask & BCM_FIELD_VLAN_FORMAT_INNER_TAGGED) >> 1) |
  48992                     ((hw_mask & BCM_FIELD_VLAN_FORMAT_OUTER_TAGGED) << 1));
  48993 
  48994         }
  48995     }
  48996 #endif /* BCM_GREYHOUND2_SUPPORT */
  48997 
  48998     return rv;
  48999 }
  49000 
  49001 /*
  49002  * Function:
  49003  *      bcm_esw_field_qualify_TunnelPayloadDstMac
  49004  * Purpose:
  49005  *      Set match criteria for bcmFieildQualifyTunnelPayloadDstMac
  49006  *      qualifier from the field entry.
  49007  * Parameters:
  49008  *      unit    - (IN) Unit number.
  49009  *      entry   - (IN) BCM field entry id.
  49010  *      data    - (IN) Qualifier match data.
  49011  *                     Indicates Tunnel payload MACDA
  49012  *      mask    - (IN) Qualifier match mask.
  49013  * Returns:
  49014  *      BCM_E_XXX
  49015  * Notes:
  49016  */
  49017 int
  49018 bcm_esw_field_qualify_TunnelPayloadDstMac(
  49019     int unit,
  49020     bcm_field_entry_t entry,
  49021     bcm_mac_t  data,
  49022     bcm_mac_t  mask)
  49023 {
  49024     int rv = BCM_E_UNAVAIL;
  49025 
  49026 #ifdef BCM_GREYHOUND2_SUPPORT
  49027     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49028         FP_LOCK(unit);
  49029 
  49030         rv = _field_qualify_macaddr(unit, entry, bcmFieldQualifyTunnelPayloadDstMac,
  49031                                     data, mask);
  49032 
  49033         FP_UNLOCK(unit);
  49034     }
  49035 #endif /* BCM_GREYHOUND2_SUPPORT */
  49036 
  49037     return rv;
  49038 }
  49039 
  49040 /*
  49041  * Function:
  49042  *      bcm_esw_field_qualify_TunnelPayloadDstMac_get
  49043  * Purpose:
  49044  *      Get match criteria for bcmFieildQualifyTunnelPayloadDstMac
  49045  *      qualifier from the field entry.
  49046  * Parameters:
  49047  *      unit    - (IN) Unit number.
  49048  *      entry   - (IN) BCM field entry id.
  49049  *      data    - (OUT) Qualifier match data.
  49050  *                      Indicates Tunnel payload MACDA
  49051  *      mask    - (OUT) Qualifier match mask.
  49052  * Returns:
  49053  *      BCM_E_XXX
  49054  * Notes:
  49055  */
  49056 int
  49057 bcm_esw_field_qualify_TunnelPayloadDstMac_get(
  49058     int unit,
  49059     bcm_field_entry_t entry,
  49060     bcm_mac_t  *data,
  49061     bcm_mac_t  *mask)
  49062 {
  49063     int rv = BCM_E_UNAVAIL;
  49064 
  49065 #ifdef BCM_GREYHOUND2_SUPPORT
  49066     /* Read qualifier match value and mask. */
  49067     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49068         rv = _field_qualify_macaddr_get(unit, entry,
  49069                                         bcmFieldQualifyTunnelPayloadDstMac,
  49070                                         data, mask);
  49071     }
  49072 #endif /* BCM_GREYHOUND2_SUPPORT */
  49073 
  49074     return rv;
  49075 }
  49076 
  49077 /*
  49078  * Function:
  49079  *      bcm_esw_field_qualify_TunnelPayloadSrcMac
  49080  * Purpose:
  49081  *      Set match criteria for bcmFieildQualifyTunnelPayloadSrcMac
  49082  *      qualifier from the field entry.
  49083  * Parameters:
  49084  *      unit    - (IN) Unit number.
  49085  *      entry   - (IN) BCM field entry id.
  49086  *      data    - (IN) Qualifier match data.
  49087  *                     Indicates Tunnel payload MACSA
  49088  *      mask    - (IN) Qualifier match mask.
  49089  * Returns:
  49090  *      BCM_E_XXX
  49091  * Notes:
  49092  */
  49093 int
  49094 bcm_esw_field_qualify_TunnelPayloadSrcMac(
  49095     int unit,
  49096     bcm_field_entry_t entry,
  49097     bcm_mac_t  data,
  49098     bcm_mac_t  mask)
  49099 {
  49100     int rv = BCM_E_UNAVAIL;
  49101 
  49102 #ifdef BCM_GREYHOUND2_SUPPORT
  49103     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49104         FP_LOCK(unit);
  49105 
  49106         rv = _field_qualify_macaddr(unit, entry, bcmFieldQualifyTunnelPayloadSrcMac,
  49107                                     data, mask);
  49108 
  49109         FP_UNLOCK(unit);
  49110     }
  49111 #endif /* BCM_GREYHOUND2_SUPPORT */
  49112 
  49113     return rv;
  49114 }
  49115 
  49116 /*
  49117  * Function:
  49118  *      bcm_esw_field_qualify_TunnelPayloadSrcMac_get
  49119  * Purpose:
  49120  *      Get match criteria for bcmFieildQualifyTunnelPayloadSrcMac
  49121  *      qualifier from the field entry.
  49122  * Parameters:
  49123  *      unit    - (IN) Unit number.
  49124  *      entry   - (IN) BCM field entry id.
  49125  *      data    - (OUT) Qualifier match data.
  49126  *                      Indicates Tunnel payload MACSA
  49127  *      mask    - (OUT) Qualifier match mask.
  49128  * Returns:
  49129  *      BCM_E_XXX
  49130  * Notes:
  49131  */
  49132 int
  49133 bcm_esw_field_qualify_TunnelPayloadSrcMac_get(
  49134     int unit,
  49135     bcm_field_entry_t entry,
  49136     bcm_mac_t  *data,
  49137     bcm_mac_t  *mask)
  49138 {
  49139     int rv = BCM_E_UNAVAIL;
  49140 
  49141 #ifdef BCM_GREYHOUND2_SUPPORT
  49142     /* Read qualifier match value and mask. */
  49143     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49144         rv = _field_qualify_macaddr_get(unit, entry,
  49145                                         bcmFieldQualifyTunnelPayloadSrcMac,
  49146                                         data, mask);
  49147     }
  49148 #endif /* BCM_GREYHOUND2_SUPPORT */
  49149 
  49150     return rv;
  49151 }
  49152 
  49153 /*
  49154  * Function:
  49155  *      bcm_esw_field_qualify_TunnelPayloadEtherType
  49156  * Purpose:
  49157  *      Set match criteria for bcmFieildQualifyTunnelPayloadEtherType
  49158  *      qualifier from the field entry.
  49159  * Parameters:
  49160  *      unit    - (IN) Unit number.
  49161  *      entry   - (IN) BCM field entry id.
  49162  *      data    - (IN) Qualifier match data.
  49163  *                     Indicates Tunnel payload Ethernet Type (16 bits)
  49164  *      mask    - (IN) Qualifier match mask.
  49165  * Returns:
  49166  *      BCM_E_XXX
  49167  * Notes:
  49168  */
  49169 int
  49170 bcm_esw_field_qualify_TunnelPayloadEtherType(
  49171     int unit,
  49172     bcm_field_entry_t entry,
  49173     uint16 data,
  49174     uint16 mask)
  49175 {
  49176     int rv = BCM_E_UNAVAIL;
  49177 
  49178 #ifdef BCM_GREYHOUND2_SUPPORT
  49179     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49180         FP_LOCK(unit);
  49181 
  49182         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadEtherType,
  49183                               data, mask);
  49184 
  49185         FP_UNLOCK(unit);
  49186     }
  49187 #endif /* BCM_GREYHOUND2_SUPPORT */
  49188 
  49189     return rv;
  49190 }
  49191 
  49192 /*
  49193  * Function:
  49194  *      bcm_esw_field_qualify_TunnelPayloadEtherType_get
  49195  * Purpose:
  49196  *      Get match criteria for bcmFieildQualifyTunnelPayloadEtherType
  49197  *      qualifier from the field entry.
  49198  * Parameters:
  49199  *      unit    - (IN) Unit number.
  49200  *      entry   - (IN) BCM field entry id.
  49201  *      data    - (OUT) Qualifier match data.
  49202  *                      Indicates Tunnel payload Ethernet Type (16 bits)
  49203  *      mask    - (OUT) Qualifier match mask.
  49204  * Returns:
  49205  *      BCM_E_XXX
  49206  * Notes:
  49207  */
  49208 int
  49209 bcm_esw_field_qualify_TunnelPayloadEtherType_get(
  49210     int unit,
  49211     bcm_field_entry_t entry,
  49212     uint16 *data,
  49213     uint16 *mask)
  49214 {
  49215     int rv = BCM_E_UNAVAIL;
  49216 
  49217 #ifdef BCM_GREYHOUND2_SUPPORT
  49218     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49219         /* Read qualifier match value and mask. */
  49220         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  49221                                                    bcmFieldQualifyTunnelPayloadEtherType,
  49222                                                    data, mask);
  49223     }
  49224 #endif /* BCM_GREYHOUND2_SUPPORT */
  49225 
  49226     return rv;
  49227 }
  49228 
  49229 /*
  49230  * Function:
  49231  *      bcm_esw_field_qualify_TunnelPayloadOuterVlan
  49232  * Purpose:
  49233  *      Set match criteria for bcmFieildQualifyTunnelPayloadOuterVlan
  49234  *      qualifier from the field entry.
  49235  * Parameters:
  49236  *      unit    - (IN) Unit number.
  49237  *      entry   - (IN) BCM field entry id.
  49238  *      data    - (IN) Qualifier match data.
  49239  *                     Indicates Tunnel payload outer VLAN Tag field value (Vid, Pri, Cfi)
  49240  *      mask    - (IN) Qualifier match mask.
  49241  * Returns:
  49242  *      BCM_E_XXX
  49243  * Notes:
  49244  */
  49245 int
  49246 bcm_esw_field_qualify_TunnelPayloadOuterVlan(
  49247     int unit,
  49248     bcm_field_entry_t entry,
  49249     bcm_vlan_t data,
  49250     bcm_vlan_t mask)
  49251 {
  49252     int rv = BCM_E_UNAVAIL;
  49253 
  49254 #ifdef BCM_GREYHOUND2_SUPPORT
  49255     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49256         FP_LOCK(unit);
  49257         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadOuterVlan,
  49258                               data, mask);
  49259         FP_UNLOCK(unit);
  49260     }
  49261 #endif /* BCM_GREYHOUND2_SUPPORT */
  49262 
  49263     return rv;
  49264 }
  49265 
  49266 /*
  49267  * Function:
  49268  *      bcm_esw_field_qualify_TunnelPayloadOuterVlan_get
  49269  * Purpose:
  49270  *      Get match criteria for bcmFieildQualifyTunnelPayloadOuterVlan
  49271  *      qualifier from the field entry.
  49272  * Parameters:
  49273  *      unit    - (IN) Unit number.
  49274  *      entry   - (IN) BCM field entry id.
  49275  *      data    - (OUT) Qualifier match data.
  49276  *                      Indicates Tunnel payload outer VLAN Tag field value (Vid, Pri, Cfi)
  49277  *      mask    - (OUT) Qualifier match mask.
  49278  * Returns:
  49279  *      BCM_E_XXX
  49280  * Notes:
  49281  */
  49282 int
  49283 bcm_esw_field_qualify_TunnelPayloadOuterVlan_get(
  49284     int unit,
  49285     bcm_field_entry_t entry,
  49286     bcm_vlan_t *data,
  49287     bcm_vlan_t *mask)
  49288 {
  49289     int rv = BCM_E_UNAVAIL;
  49290 
  49291 #ifdef BCM_GREYHOUND2_SUPPORT
  49292     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49293         if ((NULL == data) || (NULL == mask)) {
  49294             return (BCM_E_PARAM);
  49295         }
  49296         /* Read qualifier match value and mask. */
  49297         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  49298                                                    bcmFieldQualifyTunnelPayloadOuterVlan,
  49299                                                                 data, mask);
  49300     }
  49301 #endif /* BCM_GREYHOUND2_SUPPORT */
  49302 
  49303     return rv;
  49304 }
  49305 
  49306 /*
  49307  * Function:
  49308  *      bcm_esw_field_qualify_TunnelPayloadOuterVlanId
  49309  * Purpose:
  49310  *      Set match criteria for bcmFieildQualifyTunnelPayloadOuterVlanId
  49311  *      qualifier from the field entry.
  49312  * Parameters:
  49313  *      unit    - (IN) Unit number.
  49314  *      entry   - (IN) BCM field entry id.
  49315  *      data    - (IN) Qualifier match data.
  49316  *                     Indicates Tunnel payload outer VLAN Tag field value (Vid)
  49317  *      mask    - (IN) Qualifier match mask.
  49318  * Returns:
  49319  *      BCM_E_XXX
  49320  * Notes:
  49321  */
  49322 int
  49323 bcm_esw_field_qualify_TunnelPayloadOuterVlanId(
  49324     int unit,
  49325     bcm_field_entry_t entry,
  49326     bcm_vlan_t data,
  49327     bcm_vlan_t mask)
  49328 {
  49329     int rv = BCM_E_UNAVAIL;
  49330 
  49331     if (!BCM_VLAN_VALID(data)) {
  49332         return BCM_E_PARAM;
  49333     }
  49334 
  49335 #ifdef BCM_GREYHOUND2_SUPPORT
  49336     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49337         FP_LOCK(unit);
  49338 
  49339         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadOuterVlanId,
  49340                               data, mask);
  49341 
  49342         FP_UNLOCK(unit);
  49343     }
  49344 #endif /* BCM_GREYHOUND2_SUPPORT */
  49345 
  49346     return rv;
  49347 }
  49348 
  49349 /*
  49350  * Function:
  49351  *      bcm_esw_field_qualify_TunnelPayloadOuterVlanId_get
  49352  * Purpose:
  49353  *      Get match criteria for bcmFieildQualifyTunnelPayloadOuterVlanId
  49354  *      qualifier from the field entry.
  49355  * Parameters:
  49356  *      unit    - (IN) Unit number.
  49357  *      entry   - (IN) BCM field entry id.
  49358  *      data    - (OUT) Qualifier match data.
  49359  *                      Indicates Tunnel payload outer VLAN Tag field value (Vid)
  49360  *      mask    - (OUT) Qualifier match mask.
  49361  * Returns:
  49362  *      BCM_E_XXX
  49363  * Notes:
  49364  */
  49365 int
  49366 bcm_esw_field_qualify_TunnelPayloadOuterVlanId_get(
  49367     int unit,
  49368     bcm_field_entry_t entry,
  49369     bcm_vlan_t *data,
  49370     bcm_vlan_t *mask)
  49371 {
  49372     int rv = BCM_E_UNAVAIL;
  49373 
  49374 #ifdef BCM_GREYHOUND2_SUPPORT
  49375     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49376         /* Read qualifier match value and mask. */
  49377         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  49378                                                    bcmFieldQualifyTunnelPayloadOuterVlanId,
  49379                                                    data, mask);
  49380     }
  49381 #endif /* BCM_GREYHOUND2_SUPPORT */
  49382 
  49383     return rv;
  49384 }
  49385 
  49386 /*
  49387  * Function:
  49388  *      bcm_esw_field_qualify_TunnelPayloadOuterVlanPri
  49389  * Purpose:
  49390  *      Set match criteria for bcmFieildQualifyTunnelPayloadOuterVlanPri
  49391  *      qualifier from the field entry.
  49392  * Parameters:
  49393  *      unit    - (IN) Unit number.
  49394  *      entry   - (IN) BCM field entry id.
  49395  *      data    - (IN) Qualifier match data.
  49396  *                     Indicates Tunnel payload outer VLAN Tag field value (Pri)
  49397  *      mask    - (IN) Qualifier match mask.
  49398  * Returns:
  49399  *      BCM_E_XXX
  49400  * Notes:
  49401  */
  49402 int
  49403 bcm_esw_field_qualify_TunnelPayloadOuterVlanPri(
  49404     int unit,
  49405     bcm_field_entry_t entry,
  49406     uint8 data,
  49407     uint8 mask)
  49408 {
  49409     int rv = BCM_E_UNAVAIL;
  49410 
  49411     if (data & ~(0x7)) {
  49412         return BCM_E_PARAM;
  49413     }
  49414 
  49415 #ifdef BCM_GREYHOUND2_SUPPORT
  49416     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49417         FP_LOCK(unit);
  49418 
  49419         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadOuterVlanPri,
  49420                               data, mask);
  49421 
  49422         FP_UNLOCK(unit);
  49423     }
  49424 #endif /* BCM_GREYHOUND2_SUPPORT */
  49425 
  49426     return rv;
  49427 }
  49428 
  49429 /*
  49430  * Function:
  49431  *      bcm_esw_field_qualify_TunnelPayloadOuterVlanPri_get
  49432  * Purpose:
  49433  *      Get match criteria for bcmFieildQualifyTunnelPayloadOuterVlanPri
  49434  *      qualifier from the field entry.
  49435  * Parameters:
  49436  *      unit    - (IN) Unit number.
  49437  *      entry   - (IN) BCM field entry id.
  49438  *      data    - (OUT) Qualifier match data.
  49439  *                      Indicates Tunnel payload outer VLAN Tag field value (Pri)
  49440  *      mask    - (OUT) Qualifier match mask.
  49441  * Returns:
  49442  *      BCM_E_XXX
  49443  * Notes:
  49444  */
  49445 int
  49446 bcm_esw_field_qualify_TunnelPayloadOuterVlanPri_get(
  49447     int unit,
  49448     bcm_field_entry_t entry,
  49449     uint8 *data,
  49450     uint8 *mask)
  49451 {
  49452     int rv = BCM_E_UNAVAIL;
  49453 
  49454 #ifdef BCM_GREYHOUND2_SUPPORT
  49455     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49456         /* Read qualifier match value and mask. */
  49457         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  49458                                                   bcmFieldQualifyTunnelPayloadOuterVlanPri,
  49459                                                   data, mask);
  49460     }
  49461 #endif /* BCM_GREYHOUND2_SUPPORT */
  49462 
  49463     return rv;
  49464 }
  49465 
  49466 /*
  49467  * Function:
  49468  *      bcm_esw_field_qualify_TunnelPayloadOuterVlanCfi
  49469  * Purpose:
  49470  *      Set match criteria for bcmFieildQualifyTunnelPayloadOuterVlanCfi
  49471  *      qualifier from the field entry.
  49472  * Parameters:
  49473  *      unit    - (IN) Unit number.
  49474  *      entry   - (IN) BCM field entry id.
  49475  *      data    - (IN) Qualifier match data.
  49476  *                     Indicates Tunnel payload outer VLAN Tag field value (Cfi)
  49477  *      mask    - (IN) Qualifier match mask.
  49478  * Returns:
  49479  *      BCM_E_XXX
  49480  * Notes:
  49481  */
  49482 int
  49483 bcm_esw_field_qualify_TunnelPayloadOuterVlanCfi(
  49484     int unit,
  49485     bcm_field_entry_t entry,
  49486     uint8 data,
  49487     uint8 mask)
  49488 {
  49489     int rv = BCM_E_UNAVAIL;
  49490 
  49491     if (data & ~(0x1)) {
  49492         return BCM_E_PARAM;
  49493     }
  49494 
  49495 #ifdef BCM_GREYHOUND2_SUPPORT
  49496     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49497         FP_LOCK(unit);
  49498 
  49499         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadOuterVlanCfi,
  49500                               data, mask);
  49501 
  49502         FP_UNLOCK(unit);
  49503     }
  49504 #endif /* BCM_GREYHOUND2_SUPPORT */
  49505 
  49506     return rv;
  49507 }
  49508 
  49509 /*
  49510  * Function:
  49511  *      bcm_esw_field_qualify_TunnelPayloadOuterVlanCfi_get
  49512  * Purpose:
  49513  *      Get match criteria for bcmFieildQualifyTunnelPayloadOuterVlanCfi
  49514  *      qualifier from the field entry.
  49515  * Parameters:
  49516  *      unit    - (IN) Unit number.
  49517  *      entry   - (IN) BCM field entry id.
  49518  *      data    - (OUT) Qualifier match data.
  49519  *                      Indicates Tunnel payload outer VLAN Tag field value (Cfi)
  49520  *      mask    - (OUT) Qualifier match mask.
  49521  * Returns:
  49522  *      BCM_E_XXX
  49523  * Notes:
  49524  */
  49525 int
  49526 bcm_esw_field_qualify_TunnelPayloadOuterVlanCfi_get(
  49527     int unit,
  49528     bcm_field_entry_t entry,
  49529     uint8 *data,
  49530     uint8 *mask)
  49531 {
  49532     int rv = BCM_E_UNAVAIL;
  49533 
  49534 #ifdef BCM_GREYHOUND2_SUPPORT
  49535     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49536         /* Read qualifier match value and mask. */
  49537         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  49538                                                   bcmFieldQualifyTunnelPayloadOuterVlanCfi,
  49539                                                   data, mask);
  49540     }
  49541 #endif /* BCM_GREYHOUND2_SUPPORT */
  49542 
  49543     return rv;
  49544 }
  49545 
  49546 /*
  49547  * Function:
  49548  *      bcm_esw_field_qualify_TunnelPayloadSip
  49549  * Purpose:
  49550  *      Set match criteria for bcmFieildQualifyTunnelPayloadSip
  49551  *      qualifier from the field entry.
  49552  * Parameters:
  49553  *      unit    - (IN) Unit number.
  49554  *      entry   - (IN) BCM field entry id.
  49555  *      data    - (IN) Qualifier match data.
  49556  *                     Indicates Tunnel payload IPv4 source IP
  49557  *      mask    - (IN) Qualifier match mask.
  49558  * Returns:
  49559  *      BCM_E_XXX
  49560  * Notes:
  49561  */
  49562 int
  49563 bcm_esw_field_qualify_TunnelPayloadSip(
  49564     int unit,
  49565     bcm_field_entry_t entry,
  49566     bcm_ip_t data,
  49567     bcm_ip_t mask)
  49568 {
  49569     int rv = BCM_E_UNAVAIL;
  49570 
  49571 #ifdef BCM_GREYHOUND2_SUPPORT
  49572     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49573         FP_LOCK(unit);
  49574 
  49575         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadSip,
  49576                               data, mask);
  49577 
  49578         FP_UNLOCK(unit);
  49579     }
  49580 #endif /* BCM_GREYHOUND2_SUPPORT */
  49581 
  49582     return rv;
  49583 }
  49584 
  49585 /*
  49586  * Function:
  49587  *      bcm_esw_field_qualify_TunnelPayloadDip
  49588  * Purpose:
  49589  *      Set match criteria for bcmFieildQualifyTunnelPayloadDip
  49590  *      qualifier from the field entry.
  49591  * Parameters:
  49592  *      unit    - (IN) Unit number.
  49593  *      entry   - (IN) BCM field entry id.
  49594  *      data    - (IN) Qualifier match data.
  49595  *                     Indicates Tunnel payload IPv4 destination IP
  49596  *      mask    - (IN) Qualifier match mask.
  49597  * Returns:
  49598  *      BCM_E_XXX
  49599  * Notes:
  49600  */
  49601 int
  49602 bcm_esw_field_qualify_TunnelPayloadDip(
  49603     int unit,
  49604     bcm_field_entry_t entry,
  49605     bcm_ip_t data,
  49606     bcm_ip_t mask)
  49607 {
  49608     int rv = BCM_E_UNAVAIL;
  49609 
  49610 #ifdef BCM_GREYHOUND2_SUPPORT
  49611     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49612         FP_LOCK(unit);
  49613 
  49614         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadDip,
  49615                               data, mask);
  49616 
  49617         FP_UNLOCK(unit);
  49618     }
  49619 #endif /* BCM_GREYHOUND2_SUPPORT */
  49620 
  49621     return rv;
  49622 }
  49623 
  49624 /*
  49625  * Function:
  49626  *      bcm_esw_field_qualify_TunnelPayloadSip_get
  49627  * Purpose:
  49628  *      Get match criteria for bcmFieildQualifyTunnelPayloadSip
  49629  *      qualifier from the field entry.
  49630  * Parameters:
  49631  *      unit    - (IN) Unit number.
  49632  *      entry   - (IN) BCM field entry id.
  49633  *      data    - (OUT) Qualifier match data.
  49634  *                      Indicates Tunnel payload IPv4 source IP
  49635  *      mask    - (OUT) Qualifier match mask.
  49636  * Returns:
  49637  *      BCM_E_XXX
  49638  * Notes:
  49639  */
  49640 int
  49641 bcm_esw_field_qualify_TunnelPayloadSip_get(
  49642     int unit,
  49643     bcm_field_entry_t entry,
  49644     bcm_ip_t *data,
  49645     bcm_ip_t *mask)
  49646 {
  49647     int rv = BCM_E_UNAVAIL;
  49648 
  49649 #ifdef BCM_GREYHOUND2_SUPPORT
  49650     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49651         /* Read qualifier match value and mask. */
  49652         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  49653                                                    bcmFieldQualifyTunnelPayloadSip,
  49654                                                    data, mask);
  49655     }
  49656 #endif /* BCM_GREYHOUND2_SUPPORT */
  49657 
  49658     return rv;
  49659 }
  49660 
  49661 /*
  49662  * Function:
  49663  *      bcm_esw_field_qualify_TunnelPayloadDip_get
  49664  * Purpose:
  49665  *      Get match criteria for bcmFieildQualifyTunnelPayloadDip
  49666  *      qualifier from the field entry.
  49667  * Parameters:
  49668  *      unit    - (IN) Unit number.
  49669  *      entry   - (IN) BCM field entry id.
  49670  *      data    - (OUT) Qualifier match data.
  49671  *                      Indicates Tunnel payload IPv4 destination IP
  49672  *      mask    - (OUT) Qualifier match mask.
  49673  * Returns:
  49674  *      BCM_E_XXX
  49675  * Notes:
  49676  */
  49677 int
  49678 bcm_esw_field_qualify_TunnelPayloadDip_get(
  49679     int unit,
  49680     bcm_field_entry_t entry,
  49681     bcm_ip_t *data,
  49682     bcm_ip_t *mask)
  49683 {
  49684     int rv = BCM_E_UNAVAIL;
  49685 
  49686 #ifdef BCM_GREYHOUND2_SUPPORT
  49687     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49688         /* Read qualifier match value and mask. */
  49689         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  49690                                                    bcmFieldQualifyTunnelPayloadDip,
  49691                                                    data, mask);
  49692     }
  49693 #endif /* BCM_GREYHOUND2_SUPPORT */
  49694 
  49695     return rv;
  49696 }
  49697 
  49698 /*
  49699  * Function:
  49700  *      bcm_esw_field_qualify_TunnelPayloadSip6
  49701  * Purpose:
  49702  *      Set match criteria for bcmFieildQualifyTunnelPayloadSip6
  49703  *      qualifier from the field entry.
  49704  * Parameters:
  49705  *      unit    - (IN) Unit number.
  49706  *      entry   - (IN) BCM field entry id.
  49707  *      data    - (IN) Qualifier match data.
  49708  *                     Indicates Tunnel payload IPv6 source IP
  49709  *      mask    - (IN) Qualifier match mask.
  49710  * Returns:
  49711  *      BCM_E_XXX
  49712  * Notes:
  49713  */
  49714 int
  49715 bcm_esw_field_qualify_TunnelPayloadSip6(
  49716     int unit,
  49717     bcm_field_entry_t entry,
  49718     bcm_ip6_t data,
  49719     bcm_ip6_t mask)
  49720 {
  49721     int rv = BCM_E_UNAVAIL;
  49722 
  49723 #ifdef BCM_GREYHOUND2_SUPPORT
  49724     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49725         FP_LOCK(unit);
  49726 
  49727         rv = _field_qualify_ip6(unit, entry, bcmFieldQualifyTunnelPayloadSip6,
  49728                                 data, mask);
  49729 
  49730         FP_UNLOCK(unit);
  49731     }
  49732 #endif /* BCM_GREYHOUND2_SUPPORT */
  49733 
  49734     return rv;
  49735 }
  49736 
  49737 /*
  49738  * Function:
  49739  *      bcm_esw_field_qualify_TunnelPayloadDip6
  49740  * Purpose:
  49741  *      Set match criteria for bcmFieildQualifyTunnelPayloadDip6
  49742  *      qualifier from the field entry.
  49743  * Parameters:
  49744  *      unit    - (IN) Unit number.
  49745  *      entry   - (IN) BCM field entry id.
  49746  *      data    - (IN) Qualifier match data.
  49747  *                     Indicates Tunnel payload IPv6 destination IP
  49748  *      mask    - (IN) Qualifier match mask.
  49749  * Returns:
  49750  *      BCM_E_XXX
  49751  * Notes:
  49752  */
  49753 int
  49754 bcm_esw_field_qualify_TunnelPayloadDip6(
  49755     int unit,
  49756     bcm_field_entry_t entry,
  49757     bcm_ip6_t data,
  49758     bcm_ip6_t mask)
  49759 {
  49760     int rv = BCM_E_UNAVAIL;
  49761 
  49762 #ifdef BCM_GREYHOUND2_SUPPORT
  49763     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49764         FP_LOCK(unit);
  49765 
  49766         rv = _field_qualify_ip6(unit, entry, bcmFieldQualifyTunnelPayloadDip6,
  49767                                 data, mask);
  49768 
  49769         FP_UNLOCK(unit);
  49770     }
  49771 #endif /* BCM_GREYHOUND2_SUPPORT */
  49772 
  49773     return rv;
  49774 }
  49775 
  49776 /*
  49777  * Function:
  49778  *      bcm_esw_field_qualify_TunnelPayloadSip6_get
  49779  * Purpose:
  49780  *      Get match criteria for bcmFieildQualifyTunnelPayloadSip6
  49781  *      qualifier from the field entry.
  49782  * Parameters:
  49783  *      unit    - (IN) Unit number.
  49784  *      entry   - (IN) BCM field entry id.
  49785  *      data    - (OUT) Qualifier match data.
  49786  *                      Indicates Tunnel payload IPv6 source IP
  49787  *      mask    - (OUT) Qualifier match mask.
  49788  * Returns:
  49789  *      BCM_E_XXX
  49790  * Notes:
  49791  */
  49792 int
  49793 bcm_esw_field_qualify_TunnelPayloadSip6_get(
  49794     int unit,
  49795     bcm_field_entry_t entry,
  49796     bcm_ip6_t *data,
  49797     bcm_ip6_t *mask)
  49798 {
  49799     int rv = BCM_E_UNAVAIL;
  49800 
  49801 #ifdef BCM_GREYHOUND2_SUPPORT
  49802     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49803         /* Read qualifier match value and mask. */
  49804         rv = _field_qualify_ip6_get(unit, entry,
  49805                                     bcmFieldQualifyTunnelPayloadSip6,
  49806                                     data, mask);
  49807     }
  49808 #endif /* BCM_GREYHOUND2_SUPPORT */
  49809 
  49810     return rv;
  49811 }
  49812 
  49813 /*
  49814  * Function:
  49815  *      bcm_esw_field_qualify_TunnelPayloadDip6_get
  49816  * Purpose:
  49817  *      Get match criteria for bcmFieildQualifyTunnelPayloadDip6
  49818  *      qualifier from the field entry.
  49819  * Parameters:
  49820  *      unit    - (IN) Unit number.
  49821  *      entry   - (IN) BCM field entry id.
  49822  *      data    - (OUT) Qualifier match data.
  49823  *                      Indicates Tunnel payload IPv6 destination IP
  49824  *      mask    - (OUT) Qualifier match mask.
  49825  * Returns:
  49826  *      BCM_E_XXX
  49827  * Notes:
  49828  */
  49829 int
  49830 bcm_esw_field_qualify_TunnelPayloadDip6_get(
  49831     int unit,
  49832     bcm_field_entry_t entry,
  49833     bcm_ip6_t *data,
  49834     bcm_ip6_t *mask)
  49835 {
  49836     int rv = BCM_E_UNAVAIL;
  49837 
  49838 #ifdef BCM_GREYHOUND2_SUPPORT
  49839     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49840         /* Read qualifier match value and mask. */
  49841         rv = _field_qualify_ip6_get(unit, entry,
  49842                                     bcmFieldQualifyTunnelPayloadDip6,
  49843                                     data, mask);
  49844     }
  49845 #endif /* BCM_GREYHOUND2_SUPPORT */
  49846 
  49847     return rv;
  49848 }
  49849 
  49850 /*
  49851  * Function:
  49852  *      bcm_esw_field_qualify_TunnelPayloadIpProtocol
  49853  * Purpose:
  49854  *      Set match criteria for bcmFieildQualifyTunnelPayloadIpProtocol
  49855  *      qualifier from the field entry.
  49856  * Parameters:
  49857  *      unit    - (IN) Unit number.
  49858  *      entry   - (IN) BCM field entry id.
  49859  *      data    - (IN) Qualifier match data.
  49860  *                     Indicates Tunnel payload IP Protocol (16 bits)
  49861  *      mask    - (IN) Qualifier match mask.
  49862  * Returns:
  49863  *      BCM_E_XXX
  49864  * Notes:
  49865  */
  49866 int
  49867 bcm_esw_field_qualify_TunnelPayloadIpProtocol(
  49868     int unit,
  49869     bcm_field_entry_t entry,
  49870     uint8 data,
  49871     uint8 mask)
  49872 {
  49873     int rv = BCM_E_UNAVAIL;
  49874 
  49875 #ifdef BCM_GREYHOUND2_SUPPORT
  49876     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49877         FP_LOCK(unit);
  49878 
  49879         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadIpProtocol,
  49880                               data, mask);
  49881 
  49882         FP_UNLOCK(unit);
  49883     }
  49884 #endif /* BCM_GREYHOUND2_SUPPORT */
  49885 
  49886     return rv;
  49887 }
  49888 
  49889 /*
  49890  * Function:
  49891  *      bcm_esw_field_qualify_TunnelPayloadIpProtocol_get
  49892  * Purpose:
  49893  *      Get match criteria for bcmFieildQualifyTunnelPayloadIpProtocol
  49894  *      qualifier from the field entry.
  49895  * Parameters:
  49896  *      unit    - (IN) Unit number.
  49897  *      entry   - (IN) BCM field entry id.
  49898  *      data    - (OUT) Qualifier match data.
  49899  *                      Indicates Tunnel payload IP Protocol (16 bits)
  49900  *      mask    - (OUT) Qualifier match mask.
  49901  * Returns:
  49902  *      BCM_E_XXX
  49903  * Notes:
  49904  */
  49905 int
  49906 bcm_esw_field_qualify_TunnelPayloadIpProtocol_get(
  49907     int unit,
  49908     bcm_field_entry_t entry,
  49909     uint8 *data,
  49910     uint8 *mask)
  49911 {
  49912     int rv = BCM_E_UNAVAIL;
  49913 
  49914 #ifdef BCM_GREYHOUND2_SUPPORT
  49915     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49916         /* Read qualifier match value and mask. */
  49917         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  49918                                                   bcmFieldQualifyTunnelPayloadIpProtocol,
  49919                                                   data, mask);
  49920     }
  49921 #endif /* BCM_GREYHOUND2_SUPPORT */
  49922 
  49923     return rv;
  49924 }
  49925 
  49926 /*
  49927  * Function:
  49928  *      bcm_esw_field_qualify_TunnelPayloadL4SrcPort
  49929  * Purpose:
  49930  *      Set match criteria for bcmFieildQualifyTunnelPayloadL4SrcPort
  49931  *      qualifier from the field entry.
  49932  * Parameters:
  49933  *      unit    - (IN) Unit number.
  49934  *      entry   - (IN) BCM field entry id.
  49935  *      data    - (IN) Qualifier match data.
  49936  *                     Indicates Tunnel payload L4 source port number
  49937  *      mask    - (IN) Qualifier match mask.
  49938  * Returns:
  49939  *      BCM_E_XXX
  49940  * Notes:
  49941  */
  49942 int
  49943 bcm_esw_field_qualify_TunnelPayloadL4SrcPort(
  49944     int unit,
  49945     bcm_field_entry_t entry,
  49946     bcm_l4_port_t data,
  49947     bcm_l4_port_t mask)
  49948 {
  49949     int rv = BCM_E_UNAVAIL;
  49950 
  49951 #ifdef BCM_GREYHOUND2_SUPPORT
  49952     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49953         FP_LOCK(unit);
  49954 
  49955         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadL4SrcPort,
  49956                               data, mask);
  49957 
  49958         FP_UNLOCK(unit);
  49959     }
  49960 #endif /* BCM_GREYHOUND2_SUPPORT */
  49961 
  49962     return rv;
  49963 }
  49964 
  49965 /*
  49966  * Function:
  49967  *      bcm_esw_field_qualify_TunnelPayloadL4DstPort
  49968  * Purpose:
  49969  *      Set match criteria for bcmFieildQualifyTunnelPayloadL4DstPort
  49970  *      qualifier from the field entry.
  49971  * Parameters:
  49972  *      unit    - (IN) Unit number.
  49973  *      entry   - (IN) BCM field entry id.
  49974  *      data    - (IN) Qualifier match data.
  49975  *                     Indicates Tunnel payload L4 destination port number
  49976  *      mask    - (IN) Qualifier match mask.
  49977  * Returns:
  49978  *      BCM_E_XXX
  49979  * Notes:
  49980  */
  49981 int
  49982 bcm_esw_field_qualify_TunnelPayloadL4DstPort(
  49983     int unit,
  49984     bcm_field_entry_t entry,
  49985     bcm_l4_port_t data,
  49986     bcm_l4_port_t mask)
  49987 {
  49988     int rv = BCM_E_UNAVAIL;
  49989 
  49990 #ifdef BCM_GREYHOUND2_SUPPORT
  49991     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  49992         FP_LOCK(unit);
  49993 
  49994         rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelPayloadL4DstPort,
  49995                               data, mask);
  49996 
  49997         FP_UNLOCK(unit);
  49998     }
  49999 #endif /* BCM_GREYHOUND2_SUPPORT */
  50000 
  50001     return rv;
  50002 }
  50003 
  50004 /*
  50005  * Function:
  50006  *      bcm_esw_field_qualify_TunnelPayloadL4SrcPort_get
  50007  * Purpose:
  50008  *      Get match criteria for bcmFieildQualifyTunnelPayloadL4SrcPort
  50009  *      qualifier from the field entry.
  50010  * Parameters:
  50011  *      unit    - (IN) Unit number.
  50012  *      entry   - (IN) BCM field entry id.
  50013  *      data    - (OUT) Qualifier match data.
  50014  *                      Indicates Tunnel payload L4 source port number
  50015  *      mask    - (OUT) Qualifier match mask.
  50016  * Returns:
  50017  *      BCM_E_XXX
  50018  * Notes:
  50019  */
  50020 int
  50021 bcm_esw_field_qualify_TunnelPayloadL4SrcPort_get(
  50022     int unit,
  50023     bcm_field_entry_t entry,
  50024     bcm_l4_port_t *data,
  50025     bcm_l4_port_t *mask)
  50026 {
  50027     int rv = BCM_E_UNAVAIL;
  50028 
  50029 #ifdef BCM_GREYHOUND2_SUPPORT
  50030     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  50031         /* Read qualifier match value and mask. */
  50032         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  50033                                                    bcmFieldQualifyTunnelPayloadL4SrcPort,
  50034                                                    (uint32 *)data, (uint32 *)mask);
  50035     }
  50036 #endif /* BCM_GREYHOUND2_SUPPORT */
  50037 
  50038     return rv;
  50039 }
  50040 
  50041 /*
  50042  * Function:
  50043  *      bcm_esw_field_qualify_TunnelPayloadL4DstPort_get
  50044  * Purpose:
  50045  *      Get match criteria for bcmFieildQualifyTunnelPayloadL4DstPort
  50046  *      qualifier from the field entry.
  50047  * Parameters:
  50048  *      unit    - (IN) Unit number.
  50049  *      entry   - (IN) BCM field entry id.
  50050  *      data    - (OUT) Qualifier match data.
  50051  *                      Indicates Tunnel payload L4 destination port number
  50052  *      mask    - (OUT) Qualifier match mask.
  50053  * Returns:
  50054  *      BCM_E_XXX
  50055  * Notes:
  50056  */
  50057 int
  50058 bcm_esw_field_qualify_TunnelPayloadL4DstPort_get(
  50059     int unit,
  50060     bcm_field_entry_t entry,
  50061     bcm_l4_port_t *data,
  50062     bcm_l4_port_t *mask)
  50063 {
  50064     int rv = BCM_E_UNAVAIL;
  50065 
  50066 #ifdef BCM_GREYHOUND2_SUPPORT
  50067     if (soc_feature(unit, soc_feature_vxlan_lite)) {
  50068         /* Read qualifier match value and mask. */
  50069         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  50070                                                    bcmFieldQualifyTunnelPayloadL4DstPort,
  50071                                                    (uint32 *)data, (uint32 *)mask);
  50072     }
  50073 #endif /* BCM_GREYHOUND2_SUPPORT */
  50074 
  50075     return rv;
  50076 }
  50077 
  50078 
  50079 /*
  50080  * Function:
  50081  *      bcm_esw_field_qualify_bcmFieldQualifyRoceBthOpcode
  50082  * Purpose:
  50083  *      Set match criteria for bcmFieldQualifyRoceBthOpcode
  50084  *      qualifier in the field entry.
  50085  * Parameters:
  50086  *      unit  - (IN) Unit number.
  50087  *      entry - (IN) Field Entry id.
  50088  *      data  - (IN) Qualifier match data.
  50089  *      mask  - (IN) Qualifier match mask.
  50090  * Returns:
  50091  *      BCM_E_XXX
  50092  * Notes:
  50093  */
  50094 int
  50095 bcm_esw_field_qualify_RoceBthOpcode(
  50096     int unit,
  50097     bcm_field_entry_t entry,
  50098     uint8 data,
  50099     uint8 mask)
  50100 {
  50101     int rv = BCM_E_UNAVAIL;
  50102 
  50103 #ifdef BCM_GREYHOUND2_SUPPORT
  50104     if (soc_feature(unit, soc_feature_rroce)) {
  50105         FP_LOCK(unit);
  50106         rv = _field_qualify32(unit, entry, bcmFieldQualifyRoceBthOpcode,
  50107                               data, mask);
  50108         FP_UNLOCK(unit);
  50109     }
  50110 #endif /* BCM_GREYHOUND2_SUPPORT */
  50111 
  50112     return rv;
  50113 }
  50114 /*
  50115  * Function:
  50116  *      bcm_esw_field_qualify_bcmFieldQualifyRoceBthOpcode_get
  50117  * Purpose:
  50118  *      Get match criteria for bcmFieldQualifyRoceBthOpcode
  50119  *      qualifier in the field entry.
  50120  * Parameters:
  50121  *      unit  - (IN) Unit number.
  50122  *      entry - (IN) Field Entry id.
  50123  *      data  - (OUT) Qualifier match data.
  50124  *      mask  - (OUT) Qualifier match mask.
  50125  * Returns:
  50126  *      BCM_E_XXX
  50127  * Notes:
  50128  */
  50129 int
  50130 bcm_esw_field_qualify_RoceBthOpcode_get(
  50131     int unit,
  50132     bcm_field_entry_t entry,
  50133     uint8 *data,
  50134     uint8 *mask)
  50135 {
  50136     int rv = BCM_E_UNAVAIL;
  50137 
  50138 #ifdef BCM_GREYHOUND2_SUPPORT
  50139     if (soc_feature(unit, soc_feature_rroce)) {
  50140         /* Read qualifier match value and mask. */
  50141         rv = _bcm_field_entry_qualifier_uint8_get(
  50142                 unit, entry, bcmFieldQualifyRoceBthOpcode, data, mask);
  50143     }
  50144 #endif /* BCM_GREYHOUND2_SUPPORT */
  50145 
  50146     return rv;
  50147 }
  50148 /*
  50149  * Function:
  50150  *      bcm_esw_field_qualify_bcmFieldQualifyRoceBthPartitionKey
  50151  * Purpose:
  50152  *      Set match criteria for bcmFieldQualifyRoceBthPartitionKey
  50153  *      qualifier in the field entry.
  50154  * Parameters:
  50155  *      unit  - (IN) Unit number.
  50156  *      entry - (IN) Field Entry id.
  50157  *      data  - (IN) Qualifier match data.
  50158  *      mask  - (IN) Qualifier match mask.
  50159  * Returns:
  50160  *      BCM_E_XXX
  50161  * Notes:
  50162  */
  50163 int
  50164 bcm_esw_field_qualify_RoceBthPartitionKey(
  50165     int unit,
  50166     bcm_field_entry_t entry,
  50167     uint16 data,
  50168     uint16 mask)
  50169 {
  50170     int rv = BCM_E_UNAVAIL;
  50171 
  50172 #ifdef BCM_GREYHOUND2_SUPPORT
  50173     if (soc_feature(unit, soc_feature_rroce)) {
  50174         FP_LOCK(unit);
  50175         rv = _field_qualify32(unit, entry, bcmFieldQualifyRoceBthPartitionKey,
  50176                               data, mask);
  50177         FP_UNLOCK(unit);
  50178     }
  50179 #endif /* BCM_GREYHOUND2_SUPPORT */
  50180 
  50181     return rv;
  50182 }
  50183 /*
  50184  * Function:
  50185  *      bcm_esw_field_qualify_bcmFieldQualifyRoceBthPartitionKey_get
  50186  * Purpose:
  50187  *      Get match criteria for bcmFieldQualifyRoceBthPartitionKey
  50188  *      qualifier in the field entry.
  50189  * Parameters:
  50190  *      unit  - (IN) Unit number.
  50191  *      entry - (IN) Field Entry id.
  50192  *      data  - (OUT) Qualifier match data.
  50193  *      mask  - (OUT) Qualifier match mask.
  50194  * Returns:
  50195  *      BCM_E_XXX
  50196  * Notes:
  50197  */
  50198 int
  50199 bcm_esw_field_qualify_RoceBthPartitionKey_get(
  50200     int unit,
  50201     bcm_field_entry_t entry,
  50202     uint16 *data,
  50203     uint16 *mask)
  50204 {
  50205     int rv = BCM_E_UNAVAIL;
  50206 
  50207 #ifdef BCM_GREYHOUND2_SUPPORT
  50208     if (soc_feature(unit, soc_feature_rroce)) {
  50209         /* Read qualifier match value and mask. */
  50210         rv = _bcm_field_entry_qualifier_uint16_get(
  50211                 unit, entry, bcmFieldQualifyRoceBthPartitionKey, data, mask);
  50212     }
  50213 #endif /* BCM_GREYHOUND2_SUPPORT */
  50214 
  50215     return rv;
  50216 }
  50217 /*
  50218  * Function:
  50219  *      bcm_esw_field_qualify_bcmFieldQualifyRoceBthDstQueuePair
  50220  * Purpose:
  50221  *      Set match criteria for bcmFieldQualifyRoceBthDstQueuePair
  50222  *      qualifier in the field entry.
  50223  * Parameters:
  50224  *      unit  - (IN) Unit number.
  50225  *      entry - (IN) Field Entry id.
  50226  *      data  - (IN) Qualifier match data.
  50227  *      mask  - (IN) Qualifier match mask.
  50228  * Returns:
  50229  *      BCM_E_XXX
  50230  * Notes:
  50231  */
  50232 int
  50233 bcm_esw_field_qualify_RoceBthDstQueuePair(
  50234     int unit,
  50235     bcm_field_entry_t entry,
  50236     uint32 data,
  50237     uint32 mask)
  50238 {
  50239     int rv = BCM_E_UNAVAIL;
  50240 
  50241 #ifdef BCM_GREYHOUND2_SUPPORT
  50242     if (soc_feature(unit, soc_feature_rroce)) {
  50243         FP_LOCK(unit);
  50244         rv = _field_qualify32(unit, entry, bcmFieldQualifyRoceBthDstQueuePair,
  50245                               data, mask);
  50246         FP_UNLOCK(unit);
  50247     }
  50248 #endif /* BCM_GREYHOUND2_SUPPORT */
  50249 
  50250     return rv;
  50251 }
  50252 /*
  50253  * Function:
  50254  *      bcm_esw_field_qualify_bcmFieldQualifyRoceBthDstQueuePair_get
  50255  * Purpose:
  50256  *      Get match criteria for bcmFieldQualifyRoceBthDstQueuePair
  50257  *      qualifier in the field entry.
  50258  * Parameters:
  50259  *      unit  - (IN) Unit number.
  50260  *      entry - (IN) Field Entry id.
  50261  *      data  - (OUT) Qualifier match data.
  50262  *      mask  - (OUT) Qualifier match mask.
  50263  * Returns:
  50264  *      BCM_E_XXX
  50265  * Notes:
  50266  */
  50267 int
  50268 bcm_esw_field_qualify_RoceBthDstQueuePair_get(
  50269     int unit,
  50270     bcm_field_entry_t entry,
  50271     uint32 *data,
  50272     uint32 *mask)
  50273 {
  50274     int rv = BCM_E_UNAVAIL;
  50275 
  50276 #ifdef BCM_GREYHOUND2_SUPPORT
  50277     if (soc_feature(unit, soc_feature_rroce)) {
  50278         /* Read qualifier match value and mask. */
  50279         rv = _bcm_field_entry_qualifier_uint32_get(
  50280                 unit, entry, bcmFieldQualifyRoceBthDstQueuePair, data, mask);
  50281     }
  50282 #endif /* BCM_GREYHOUND2_SUPPORT */
  50283 
  50284     return rv;
  50285 }
  50286 /*
  50287  * Function:
  50288  *      bcm_esw_field_qualify_bcmFieldQualifyRoceBthFlags
  50289  * Purpose:
  50290  *      Set match criteria for bcmFieldQualifyRoceBthFlags
  50291  *      qualifier in the field entry.
  50292  * Parameters:
  50293  *      unit  - (IN) Unit number.
  50294  *      entry - (IN) Field Entry id.
  50295  *      data  - (IN) Qualifier match data.
  50296  *      mask  - (IN) Qualifier match mask.
  50297  * Returns:
  50298  *      BCM_E_XXX
  50299  * Notes:
  50300  */
  50301 int
  50302 bcm_esw_field_qualify_RoceBthFlags(
  50303     int unit,
  50304     bcm_field_entry_t entry,
  50305     uint8 data,
  50306     uint8 mask)
  50307 {
  50308     int rv = BCM_E_UNAVAIL;
  50309 
  50310 #ifdef BCM_GREYHOUND2_SUPPORT
  50311     if (soc_feature(unit, soc_feature_rroce)) {
  50312         FP_LOCK(unit);
  50313         rv = _field_qualify32(unit, entry, bcmFieldQualifyRoceBthFlags,
  50314                               data, mask);
  50315         FP_UNLOCK(unit);
  50316     }
  50317 #endif /* BCM_GREYHOUND2_SUPPORT */
  50318 
  50319     return rv;
  50320 }
  50321 /*
  50322  * Function:
  50323  *      bcm_esw_field_qualify_bcmFieldQualifyRoceBthFlags_get
  50324  * Purpose:
  50325  *      Get match criteria for bcmFieldQualifyRoceBthFlags
  50326  *      qualifier in the field entry.
  50327  * Parameters:
  50328  *      unit  - (IN) Unit number.
  50329  *      entry - (IN) Field Entry id.
  50330  *      data  - (OUT) Qualifier match data.
  50331  *      mask  - (OUT) Qualifier match mask.
  50332  * Returns:
  50333  *      BCM_E_XXX
  50334  * Notes:
  50335  */
  50336 int
  50337 bcm_esw_field_qualify_RoceBthFlags_get(
  50338     int unit,
  50339     bcm_field_entry_t entry,
  50340     uint8 *data,
  50341     uint8 *mask)
  50342 {
  50343     int rv = BCM_E_UNAVAIL;
  50344 
  50345 #ifdef BCM_GREYHOUND2_SUPPORT
  50346     if (soc_feature(unit, soc_feature_rroce)) {
  50347     /* Read qualifier match value and mask. */
  50348         rv = _bcm_field_entry_qualifier_uint8_get(
  50349                 unit, entry, bcmFieldQualifyRoceBthFlags, data, mask);
  50350     }
  50351 #endif /* BCM_GREYHOUND2_SUPPORT */
  50352 
  50353     return rv;
  50354 }
  50355 /*
  50356  * Function:
  50357  *      bcm_esw_field_qualify_bcmFieldQualifyRoceVer1Pkt
  50358  * Purpose:
  50359  *      Set match criteria for bcmFieldQualifyRoceVer1Pkt
  50360  *      qualifier in the field entry.
  50361  * Parameters:
  50362  *      unit  - (IN) Unit number.
  50363  *      entry - (IN) Field Entry id.
  50364  *      data  - (IN) Qualifier match data.
  50365  *      mask  - (IN) Qualifier match mask.
  50366  * Returns:
  50367  *      BCM_E_XXX
  50368  * Notes:
  50369  */
  50370 int
  50371 bcm_esw_field_qualify_RoceVer1Pkt(
  50372     int unit,
  50373     bcm_field_entry_t entry,
  50374     uint8 data,
  50375     uint8 mask)
  50376 {
  50377     int rv = BCM_E_UNAVAIL;
  50378 
  50379 #ifdef BCM_GREYHOUND2_SUPPORT
  50380     if (soc_feature(unit, soc_feature_rroce)) {
  50381         if (data > 0x1 || mask > 0x1) {
  50382             return BCM_E_PARAM;
  50383         }
  50384         FP_LOCK(unit);
  50385         rv = _field_qualify32(unit, entry,
  50386                               bcmFieldQualifyRoceVer1Pkt, data, mask);
  50387         FP_UNLOCK(unit);
  50388     }
  50389 #endif /* BCM_GREYHOUND2_SUPPORT */
  50390 
  50391     return rv;
  50392 }
  50393 /*
  50394  * Function:
  50395  *      bcm_esw_field_qualify_bcmFieldQualifyRoceVer1Pkt_get
  50396  * Purpose:
  50397  *      Get match criteria for bcmFieldQualifyRoceVer1Pkt
  50398  *      qualifier in the field entry.
  50399  * Parameters:
  50400  *      unit  - (IN) Unit number.
  50401  *      entry - (IN) Field Entry id.
  50402  *      data  - (OUT) Qualifier match data.
  50403  *      mask  - (OUT) Qualifier match mask.
  50404  * Returns:
  50405  *      BCM_E_XXX
  50406  * Notes:
  50407  */
  50408 int
  50409 bcm_esw_field_qualify_RoceVer1Pkt_get(
  50410     int unit,
  50411     bcm_field_entry_t entry,
  50412     uint8 *data,
  50413     uint8 *mask)
  50414 {
  50415     int rv = BCM_E_UNAVAIL;
  50416 
  50417 #ifdef BCM_GREYHOUND2_SUPPORT
  50418     if (soc_feature(unit, soc_feature_rroce)) {
  50419         /* Read qualifier match value and mask. */
  50420         rv = _bcm_field_entry_qualifier_uint8_get(
  50421                 unit, entry, bcmFieldQualifyRoceVer1Pkt, data, mask);
  50422     }
  50423 #endif /* BCM_GREYHOUND2_SUPPORT */
  50424 
  50425     return rv;
  50426 }
  50427 /*
  50428  * Function:
  50429  *      bcm_esw_field_qualify_bcmFieldQualifyRoceVer2Pkt
  50430  * Purpose:
  50431  *      Set match criteria for bcmFieldQualifyRoceVer2Pkt
  50432  *      qualifier in the field entry.
  50433  * Parameters:
  50434  *      unit  - (IN) Unit number.
  50435  *      entry - (IN) Field Entry id.
  50436  *      data  - (IN) Qualifier match data.
  50437  *      mask  - (IN) Qualifier match mask.
  50438  * Returns:
  50439  *      BCM_E_XXX
  50440  * Notes:
  50441  */
  50442 int
  50443 bcm_esw_field_qualify_RoceVer2Pkt(
  50444     int unit,
  50445     bcm_field_entry_t entry,
  50446     uint8 data,
  50447     uint8 mask)
  50448 {
  50449     int rv = BCM_E_UNAVAIL;
  50450 
  50451 #ifdef BCM_GREYHOUND2_SUPPORT
  50452     if (soc_feature(unit, soc_feature_rroce)) {
  50453         if (data > 0x1 || mask > 0x1) {
  50454             return BCM_E_PARAM;
  50455         }
  50456         FP_LOCK(unit);
  50457         rv = _field_qualify32(unit, entry,
  50458                               bcmFieldQualifyRoceVer2Pkt, data, mask);
  50459         FP_UNLOCK(unit);
  50460     }
  50461 #endif /* BCM_GREYHOUND2_SUPPORT */
  50462 
  50463     return rv;
  50464 }
  50465 /*
  50466  * Function:
  50467  *      bcm_esw_field_qualify_bcmFieldQualifyRoceVer2Pkt_get
  50468  * Purpose:
  50469  *      Get match criteria for bcmFieldQualifyRoceVer2Pkt
  50470  *      qualifier in the field entry.
  50471  * Parameters:
  50472  *      unit  - (IN) Unit number.
  50473  *      entry - (IN) Field Entry id.
  50474  *      data  - (OUT) Qualifier match data.
  50475  *      mask  - (OUT) Qualifier match mask.
  50476  * Returns:
  50477  *      BCM_E_XXX
  50478  * Notes:
  50479  */
  50480 int
  50481 bcm_esw_field_qualify_RoceVer2Pkt_get(
  50482     int unit,
  50483     bcm_field_entry_t entry,
  50484     uint8 *data,
  50485     uint8 *mask)
  50486 {
  50487     int rv = BCM_E_UNAVAIL;
  50488 
  50489 #ifdef BCM_GREYHOUND2_SUPPORT
  50490     if (soc_feature(unit, soc_feature_rroce)) {
  50491         /* Read qualifier match value and mask. */
  50492         rv = _bcm_field_entry_qualifier_uint8_get(
  50493                 unit, entry, bcmFieldQualifyRoceVer2Pkt, data, mask);
  50494     }
  50495 #endif /* BCM_GREYHOUND2_SUPPORT */
  50496 
  50497     return rv;
  50498 }
  50499 
  50500 
  50501 #ifdef BROADCOM_DEBUG
  50502 
  50503 /* Section: Field Debug */
  50504 
  50505 
  50506 /*
  50507  * Function: bcm_field_show
  50508  *
  50509  * Purpose:
  50510  *     Show current S/W state if compiled in debug mode.
  50511  *
  50512  * Parameters:
  50513  *     unit - BCM device number
  50514  *     pfx - Character string to prefix output lines
  50515  *
  50516  * Returns:
  50517  *     Nothing.
  50518  */
  50519 int
  50520 bcm_esw_field_show(int unit, const char *pfx)
  50521 {
  50522     BCM_IF_ERROR_RETURN(_bcm_esw_field_udf_show(unit, pfx));
  50523     BCM_IF_ERROR_RETURN(_bcm_esw_field_range_show(unit, pfx, -1));
  50524     return _bcm_esw_field_show(unit, pfx, -1);
  50525     }
  50526 
  50527 /*
  50528  * Function: bcm_field_entry_dump
  50529  *
  50530  * Purpose:
  50531  *     Show contents of a field entry.
  50532  *
  50533  * Parameters:
  50534  *     unit  - BCM device number
  50535  *     entry - Field entry to dump
  50536  *
  50537  * Returns:
  50538  *     Nothing.
  50539  */
  50540 
  50541 int
  50542 bcm_esw_field_entry_dump(int unit, bcm_field_entry_t entry)
  50543 {
  50544     return _bcm_esw_field_entry_dump(unit, entry, -1);
  50545     }
  50546 /*
  50547  * Function: bcm_field_group_dump
  50548  *
  50549  * Purpose:
  50550  *     Show contents of a field group.
  50551  *
  50552  * Parameters:
  50553  *     unit  - BCM device number
  50554  *     group - Field group to dump
  50555  *
  50556  * Returns:
  50557  *     Nothing.
  50558  */
  50559 
  50560 int
  50561 bcm_esw_field_group_dump(int unit, bcm_field_group_t group)
  50562 {
  50563     return _bcm_esw_field_group_dump(unit, group, -1);
  50564     }
  50565 #endif /* BROADCOM_DEBUG */
  50566 
  50567 /*
  50568  * Function: bcm_esw_field_group_ports_add
  50569  *
  50570  * Purpose:
  50571  *    Add ports to the specified group.
  50572  *
  50573  * Parameters:
  50574  *     unit  - BCM device number
  50575  *     group - Field group
  50576  *     pbmp - Set of Ports
  50577  *
  50578  * Returns:
  50579  *     BCM_E_XXX - from _bcm_esw_field_group_ports_add
  50580  *     BCM_E_UNAVAIL - for Tomahawk and non TRX devices.
  50581  */
  50582 int
  50583 bcm_esw_field_group_ports_add(
  50584     int unit,
  50585     bcm_field_group_t group,
  50586     bcm_pbmp_t pbmp)
  50587 {
  50588     int rv = BCM_E_UNAVAIL;
  50589 
  50590     FP_LOCK(unit);
  50591 #if defined(BCM_TRX_SUPPORT)
  50592     if (SOC_IS_TRX(unit) && (!SOC_IS_TOMAHAWKX(unit))) {
  50593         rv = _bcm_esw_field_group_ports_add(
  50594              unit, group, pbmp);
  50595     } 
  50596 #endif
  50597     FP_UNLOCK(unit);
  50598     return rv;
  50599 }
  50600 
  50601 /*
  50602  * Function: bcm_esw_field_group_ports_remove
  50603  *
  50604  * Purpose:
  50605  *    Remove ports from the specified group.
  50606  *
  50607  * Parameters:
  50608  *     unit  - BCM device number
  50609  *     group - Field group
  50610  *     pbmp - Set of Ports
  50611  *
  50612  * Returns:
  50613  *     BCM_E_XXX - from _bcm_esw_field_group_ports_remove
  50614  *     BCM_E_UNAVAIL - for Tomahawk and non TRX devices.
  50615  */
  50616 
  50617 int
  50618 bcm_esw_field_group_ports_remove(
  50619     int unit,
  50620     bcm_field_group_t group,
  50621     bcm_pbmp_t pbmp)
  50622 {
  50623     int rv = BCM_E_UNAVAIL;
  50624 
  50625     FP_LOCK(unit);
  50626 #if defined(BCM_TRX_SUPPORT)
  50627     if (SOC_IS_TRX(unit) && (!SOC_IS_TOMAHAWKX(unit))) {
  50628         rv = _bcm_esw_field_group_ports_remove(
  50629              unit, group, pbmp);
  50630     } 
  50631 #endif
  50632     FP_UNLOCK(unit);
  50633     return rv;
  50634 }
  50635 
  50636 /*
  50637  * Function : 
  50638  *      bcm_esw_field_class_map_get
  50639  * Purpose :
  50640  *      To get the set of mapped TTL/ToS/TCP values of the packet for
  50641  *      a given set of TTL/ToS/TCP values respectively.
  50642  * Parameters :
  50643  *      unit              :   (IN) BCM device number
  50644  *      stage             :   (IN) Field Stage of type bcm_field_stage_t.                        
  50645  *      qual              :   (IN) Field qualifier of type bcm_field_qualify_t.   
  50646  *      num_entries       :   (IN) Number of entries in the Orig_values array               
  50647  *      orig_values_array :   (IN) List of TTL/TOS/TCPFlags Values
  50648  *      map_values_array  :   (OUT) List of Mapped Values for each TTL/TOS/TCPFlags
  50649  * Returns :
  50650  *      BCM_E_XXX
  50651  */
  50652 bcm_error_t
  50653 bcm_esw_field_class_map_get (int unit, 
  50654         bcm_field_stage_t stage,
  50655         bcm_field_qualify_t qual, 
  50656         uint32 num_entries,
  50657         uint32 *orig_values_array,
  50658         uint32 *map_values_array)
  50659 {
  50660     bcm_error_t rv = BCM_E_UNAVAIL;
  50661 #if defined(BCM_TRX_SUPPORT)
  50662     if (stage != bcmFieldStageIngress) {
  50663         LOG_ERROR(BSL_LS_BCM_FP,
  50664                   (BSL_META_U(unit,
  50665                               "FP(unit %d) Error: bcm_esw_field_class_map_get is "
  50666                               "supported only in Ingress based Field Processor\n"),
  50667                    unit));
  50668         return rv;
  50669     }
  50670 
  50671     if (!soc_feature(unit, soc_feature_fp_class_map_no_support)) {
  50672         FP_LOCK(unit);
  50673         rv = _bcm_esw_field_class_map_get(unit, qual, num_entries, orig_values_array,
  50674                                           map_values_array);
  50675         FP_UNLOCK(unit);
  50676     }
  50677 #endif
  50678     return rv;
  50679 }
  50680 
  50681 /*
  50682  * Function :
  50683  *      bcm_esw_field_class_map_set
  50684  * Purpose :
  50685  *      To map a given set of TTL/ToS/TCP values of the packet
  50686  *      to another set of TTL/ToS/TCP values respectively.
  50687  * Parameters :
  50688  *      unit              :   (IN) BCM device number
  50689  *      stage             :   (IN) Field Stage of type bcm_field_stage_t
  50690  *      qual              :   (IN) Field qualifier of type bcm_field_qualify_t
  50691  *      num_entries       :   (IN) Number of entries in the Orig_values array
  50692  *      orig_values_array :   (IN) List of TTL/TOS/TCPFlags Values
  50693  *      map_values_array  :   (IN) List of Mapped Values for each TTL/TOS/TCPFlags
  50694  * Returns :
  50695  *      BCM_E_XXX
  50696  */
  50697 bcm_error_t
  50698 bcm_esw_field_class_map_set (int unit, 
  50699         bcm_field_stage_t stage,
  50700         bcm_field_qualify_t qual, 
  50701         uint32 num_entries,
  50702         uint32 *orig_values_array,
  50703         uint32 *map_values_array)
  50704 {
  50705     bcm_error_t rv = BCM_E_UNAVAIL;
  50706 
  50707 #if defined(BCM_TRX_SUPPORT)
  50708     if (stage != bcmFieldStageIngress) {
  50709         LOG_ERROR(BSL_LS_BCM_FP,
  50710                   (BSL_META_U(unit,
  50711                               "FP(unit %d) Error: bcm_esw_field_class_map_set is "
  50712                               "supported only in Ingress based Field Processor\n"),
  50713                    unit));
  50714         return rv;
  50715     }
  50716 
  50717     if (!soc_feature(unit, soc_feature_fp_class_map_no_support)) {
  50718         FP_LOCK(unit);
  50719         rv = _bcm_esw_field_class_map_set(unit, qual, num_entries, orig_values_array,
  50720                                           map_values_array);
  50721         FP_UNLOCK(unit);
  50722     }
  50723 #endif
  50724     return rv;
  50725 }
  50726 
  50727 /*
  50728  * Function: bcm_esw_field_group_ports_get
  50729  *
  50730  * Purpose:
  50731  *    Retrieve bitmap of the ports associated
  50732  *    with a given field group ID
  50733  *
  50734  * Parameters:
  50735  *     unit  - BCM device number
  50736  *     group - Field group
  50737  *     pbmp -  Port bitmap of a given field group
  50738  *
  50739  * Returns:
  50740  *     BCM_E_NOT_FOUND - If given group ID is not found
  50741  */
  50742 
  50743 int
  50744 bcm_esw_field_group_ports_get(
  50745     int unit,
  50746     bcm_field_group_t group,
  50747     bcm_pbmp_t *pbmp)
  50748 {
  50749     int rv = BCM_E_NONE;
  50750     _field_group_t      *fg;  /* Field group structure. */
  50751     FP_LOCK(unit);
  50752 
  50753     rv = _field_group_get(unit, group, &fg);
  50754     if (BCM_FAILURE(rv)) {
  50755         LOG_ERROR(BSL_LS_BCM_FP,
  50756                   (BSL_META_U(unit,
  50757                               "FP(unit %d) Error: group=%d not found \n"),
  50758                    unit, group));
  50759         FP_UNLOCK(unit);
  50760         return (BCM_E_NOT_FOUND);
  50761     }
  50762 
  50763     BCM_PBMP_ASSIGN(*pbmp, fg->pbmp);
  50764 
  50765     FP_UNLOCK(unit);
  50766     return (rv);
  50767 }
  50768 
  50769 /*
  50770  * Function: bcm_esw_field_group_config_validate
  50771  *
  50772  * Purpose:
  50773  *     To verify whether a group can be created with a given qset and mode.
  50774  *
  50775  * Parameters:
  50776  *     unit  - BCM device number
  50777  *     gc    - Field group config.
  50778  *     group_mode - Field Group Mode.
  50779  *
  50780  * Returns:
  50781  *     BCM_E_XXX - from _bcm_esw_field_group_config_validate()
  50782  */
  50783 
  50784 int bcm_esw_field_group_config_validate(
  50785                           int unit,
  50786                           bcm_field_group_config_t *gc,
  50787                           bcm_field_group_mode_t *group_mode) {
  50788 
  50789     int rv = BCM_E_NONE;
  50790     FP_LOCK(unit);
  50791     rv = _bcm_esw_field_group_config_validate(unit, gc, group_mode);
  50792     FP_UNLOCK(unit);
  50793     return rv;
  50794 }
  50795 
  50796 /* 
  50797  * Set match criteria for EgressClassTunnel
  50798  *                qualifier.
  50799  */
  50800 int bcm_esw_field_qualify_EgressClassTunnel(
  50801     int unit, 
  50802     bcm_field_entry_t entry, 
  50803     uint16 data, 
  50804     uint16 mask)
  50805 {
  50806     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  50807 
  50808     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  50809         
  50810         FP_LOCK(unit);
  50811         rv = _field_qualify32(unit, entry, bcmFieldQualifyEgressClassTunnel,
  50812                               data, mask);
  50813         FP_UNLOCK(unit);
  50814     }
  50815     return(rv);
  50816 }
  50817 
  50818 /* 
  50819  * Get match criteria for EgressClassTunnel
  50820  *                qualifier.
  50821  */
  50822 int bcm_esw_field_qualify_EgressClassTunnel_get(
  50823     int unit, 
  50824     bcm_field_entry_t entry, 
  50825     uint16 *data, 
  50826     uint16 *mask)
  50827 {
  50828     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  50829 
  50830     /* Read qualifier match value and mask. */
  50831     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  50832         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  50833                       bcmFieldQualifyEgressClassTunnel,
  50834                       data, mask);
  50835     }
  50836     return(rv);
  50837 }
  50838 /* 
  50839  * Set match criteria for EgressClassL3InterfaceTunnel
  50840  *                qualifier.
  50841  */
  50842 int bcm_esw_field_qualify_EgressClassL3InterfaceTunnel(
  50843     int unit, 
  50844     bcm_field_entry_t entry, 
  50845     uint16 data, 
  50846     uint16 mask)
  50847 {
  50848     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  50849 
  50850     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  50851         
  50852         FP_LOCK(unit);
  50853         rv = _field_qualify32(unit, entry, 
  50854                               bcmFieldQualifyEgressClassL3InterfaceTunnel,
  50855                               data, mask);
  50856         FP_UNLOCK(unit);
  50857     }
  50858     return(rv);
  50859 }
  50860 
  50861 /* 
  50862  * Get match criteria for EgressClassL3InterfaceTunnel
  50863  *                qualifier.
  50864  */
  50865 int bcm_esw_field_qualify_EgressClassL3InterfaceTunnel_get(
  50866     int unit, 
  50867     bcm_field_entry_t entry, 
  50868     uint16 *data, 
  50869     uint16 *mask)
  50870 {
  50871     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  50872 
  50873     /* Read qualifier match value and mask. */
  50874     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  50875         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry, 
  50876                       bcmFieldQualifyEgressClassL3InterfaceTunnel,
  50877                       data, mask);
  50878     }
  50879     return(rv);
  50880 }
  50881 
  50882 /*
  50883  * bit 3   : ING[/EGR]_SR_ENABLE
  50884  * bit 2~0 : ING[/EGR]_SR_TYPE
  50885  */
  50886 #define _FP_SRTYPE_ENCODING_NONE        (0)
  50887 #define _FP_SRTYPE_ENCODING_ETHERNET    ((1 << 3) | 0)
  50888 #define _FP_SRTYPE_ENCODING_PRP         ((1 << 3) | 1)
  50889 #define _FP_SRTYPE_ENCODING_HSR         ((1 << 3) | 2)
  50890 #define _FP_SRTYPE_ENCODING_DOT1CB      ((1 << 3) | 3)
  50891 
  50892 /*
  50893  * Function:
  50894  *      bcm_esw_field_qualify_SrcPortSRType
  50895  * Purpose:
  50896  *      Set match criteria for bcmFieldQualifySrcPortSRType
  50897  *      qualifier in the field entry.
  50898  * Parameters:
  50899  *      unit      - (IN) Unit number.
  50900  *      entry     - (IN) Field Entry id.
  50901  *      type      - (IN) SR (Seamless Redundancy) port type.
  50902  * Returns:
  50903  *      BCM_E_XXX
  50904  * Notes:
  50905  */
  50906 int
  50907 bcm_esw_field_qualify_SrcPortSRType(int unit,
  50908                                     bcm_field_entry_t entry,
  50909                                     bcm_field_port_sr_type_t type)
  50910 {
  50911     int rv = BCM_E_UNAVAIL;
  50912 
  50913 #ifdef BCM_TSN_SR_SUPPORT
  50914     if (soc_feature(unit, soc_feature_tsn_sr)) {
  50915         uint32 data = 0;
  50916 
  50917         switch (type) {
  50918             case bcmFieldPortSRTypeNone:
  50919                 data = _FP_SRTYPE_ENCODING_NONE;
  50920                 break;
  50921             case bcmFieldPortSRTypeEthernet:
  50922                 data = _FP_SRTYPE_ENCODING_ETHERNET;
  50923                 break;
  50924             case bcmFieldPortSRTypePrp:
  50925                 data = _FP_SRTYPE_ENCODING_PRP;
  50926                 break;
  50927             case bcmFieldPortSRTypeHsr:
  50928                 data = _FP_SRTYPE_ENCODING_HSR;
  50929                 break;
  50930             case bcmFieldPortSRTypeDot1cb:
  50931                 data = _FP_SRTYPE_ENCODING_DOT1CB;
  50932                 break;
  50933             default:
  50934                 return BCM_E_PARAM;
  50935         }
  50936 
  50937         FP_LOCK(unit);
  50938         rv = _field_qualify32(unit, entry,
  50939                               bcmFieldQualifySrcPortSRType, data,
  50940                               BCM_FIELD_EXACT_MATCH_MASK);
  50941         FP_UNLOCK(unit);
  50942     }
  50943 #endif /* BCM_TSN_SR_SUPPORT */
  50944 
  50945     return rv;
  50946 }
  50947 
  50948 /*
  50949  * Function:
  50950  *      bcm_esw_field_qualify_SrcPortSRType_get
  50951  * Purpose:
  50952  *      Get match criteria for bcmFieldQualifySrcPortSRType
  50953  *      qualifier in the field entry.
  50954  * Parameters:
  50955  *      unit      - (IN) Unit number.
  50956  *      entry     - (IN) Field Entry id.
  50957  *      type      - (OUT) SR (Seamless Redundancy) port type.
  50958  * Returns:
  50959  *      BCM_E_XXX
  50960  * Notes:
  50961  */
  50962 int
  50963 bcm_esw_field_qualify_SrcPortSRType_get(int unit,
  50964                                         bcm_field_entry_t entry,
  50965                                         bcm_field_port_sr_type_t *type)
  50966 {
  50967     int rv = BCM_E_UNAVAIL;
  50968 
  50969 #ifdef BCM_TSN_SR_SUPPORT
  50970     if (soc_feature(unit, soc_feature_tsn_sr)) {
  50971         uint32 data, mask;
  50972 
  50973         if (NULL == type) {
  50974             return BCM_E_PARAM;
  50975         }
  50976 
  50977         /* Read qualifier match value and mask. */
  50978         rv = _bcm_field_entry_qualifier_uint32_get(
  50979                  unit, entry, bcmFieldQualifySrcPortSRType,
  50980                  &data, &mask);
  50981 
  50982         if (BCM_SUCCESS(rv)) {
  50983             switch (data) {
  50984                 case _FP_SRTYPE_ENCODING_NONE:
  50985                     *type = bcmFieldPortSRTypeNone;
  50986                     break;
  50987                 case _FP_SRTYPE_ENCODING_ETHERNET:
  50988                     *type = bcmFieldPortSRTypeEthernet;
  50989                     break;
  50990                 case _FP_SRTYPE_ENCODING_PRP:
  50991                     *type = bcmFieldPortSRTypePrp;
  50992                     break;
  50993                 case _FP_SRTYPE_ENCODING_HSR:
  50994                     *type = bcmFieldPortSRTypeHsr;
  50995                     break;
  50996                 case _FP_SRTYPE_ENCODING_DOT1CB:
  50997                     *type = bcmFieldPortSRTypeDot1cb;
  50998                     break;
  50999                 default:
  51000                     rv = BCM_E_INTERNAL; /* should not happen */
  51001             }
  51002         }
  51003     }
  51004 #endif /* BCM_TSN_SR_SUPPORT */
  51005 
  51006     return rv;
  51007 }
  51008 
  51009 /*
  51010  * Function:
  51011  *      bcm_esw_field_qualify_DstPortSRType
  51012  * Purpose:
  51013  *      Set match criteria for bcmFieldQualifyDstPortSRType
  51014  *      qualifier in the field entry.
  51015  * Parameters:
  51016  *      unit      - (IN) Unit number.
  51017  *      entry     - (IN) Field Entry id.
  51018  *      type      - (IN) SR (Seamless Redundancy) port type.
  51019  * Returns:
  51020  *      BCM_E_XXX
  51021  * Notes:
  51022  */
  51023 int
  51024 bcm_esw_field_qualify_DstPortSRType(int unit,
  51025                                     bcm_field_entry_t entry,
  51026                                     bcm_field_port_sr_type_t type)
  51027 {
  51028     int rv = BCM_E_UNAVAIL;
  51029 
  51030 #ifdef BCM_TSN_SR_SUPPORT
  51031     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51032         uint32 data = 0;
  51033 
  51034         switch (type) {
  51035             case bcmFieldPortSRTypeNone:
  51036                 data = _FP_SRTYPE_ENCODING_NONE;
  51037                 break;
  51038             case bcmFieldPortSRTypeEthernet:
  51039                 data = _FP_SRTYPE_ENCODING_ETHERNET;
  51040                 break;
  51041             case bcmFieldPortSRTypePrp:
  51042                 data = _FP_SRTYPE_ENCODING_PRP;
  51043                 break;
  51044             case bcmFieldPortSRTypeHsr:
  51045                 data = _FP_SRTYPE_ENCODING_HSR;
  51046                 break;
  51047             case bcmFieldPortSRTypeDot1cb:
  51048                 data = _FP_SRTYPE_ENCODING_DOT1CB;
  51049                 break;
  51050             default:
  51051                 return BCM_E_PARAM;
  51052         }
  51053 
  51054         FP_LOCK(unit);
  51055         rv = _field_qualify32(unit, entry,
  51056                               bcmFieldQualifyDstPortSRType, data,
  51057                               BCM_FIELD_EXACT_MATCH_MASK);
  51058         FP_UNLOCK(unit);
  51059     }
  51060 #endif /* BCM_TSN_SR_SUPPORT */
  51061 
  51062     return rv;
  51063 }
  51064 
  51065 /*
  51066  * Function:
  51067  *      bcm_esw_field_qualify_DstPortSRType_get
  51068  * Purpose:
  51069  *      Get match criteria for bcmFieldQualifyDstPortSRType
  51070  *      qualifier in the field entry.
  51071  * Parameters:
  51072  *      unit      - (IN) Unit number.
  51073  *      entry     - (IN) Field Entry id.
  51074  *      type      - (OUT) SR (Seamless Redundancy) port type.
  51075  * Returns:
  51076  *      BCM_E_XXX
  51077  * Notes:
  51078  */
  51079 int
  51080 bcm_esw_field_qualify_DstPortSRType_get(int unit,
  51081                                         bcm_field_entry_t entry,
  51082                                         bcm_field_port_sr_type_t *type)
  51083 {
  51084     int rv = BCM_E_UNAVAIL;
  51085 
  51086 #ifdef BCM_TSN_SR_SUPPORT
  51087     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51088         uint32 data, mask;
  51089 
  51090         if (NULL == type) {
  51091             return BCM_E_PARAM;
  51092         }
  51093 
  51094         /* Read qualifier match value and mask. */
  51095         rv = _bcm_field_entry_qualifier_uint32_get(
  51096                  unit, entry, bcmFieldQualifyDstPortSRType,
  51097                  &data, &mask);
  51098 
  51099         if (BCM_SUCCESS(rv)) {
  51100             switch (data) {
  51101                 case _FP_SRTYPE_ENCODING_NONE:
  51102                     *type = bcmFieldPortSRTypeNone;
  51103                     break;
  51104                 case _FP_SRTYPE_ENCODING_ETHERNET:
  51105                     *type = bcmFieldPortSRTypeEthernet;
  51106                     break;
  51107                 case _FP_SRTYPE_ENCODING_PRP:
  51108                     *type = bcmFieldPortSRTypePrp;
  51109                     break;
  51110                 case _FP_SRTYPE_ENCODING_HSR:
  51111                     *type = bcmFieldPortSRTypeHsr;
  51112                     break;
  51113                 case _FP_SRTYPE_ENCODING_DOT1CB:
  51114                     *type = bcmFieldPortSRTypeDot1cb;
  51115                     break;
  51116                 default:
  51117                     rv = BCM_E_INTERNAL; /* should not happen */
  51118             }
  51119         }
  51120     }
  51121 #endif /* BCM_TSN_SR_SUPPORT */
  51122 
  51123     return rv;
  51124 }
  51125 
  51126 /*
  51127  * Function:
  51128  *      bcm_esw_field_qualify_SrcPortSRRoleInterlink
  51129  * Purpose:
  51130  *      Set match criteria for bcmFieldQualifySrcPortSRRoleInterlink
  51131  *      qualifier in the field entry.
  51132  * Parameters:
  51133  *      unit      - (IN) Unit number.
  51134  *      entry     - (IN) Field Entry id.
  51135  *      data      - (IN) Qualifier match data.
  51136  * Returns:
  51137  *      BCM_E_XXX
  51138  * Notes:
  51139  */
  51140 int
  51141 bcm_esw_field_qualify_SrcPortSRRoleInterlink(int unit,
  51142                                              bcm_field_entry_t entry,
  51143                                              uint8 data)
  51144 {
  51145     int rv = BCM_E_UNAVAIL;
  51146 
  51147 #ifdef BCM_TSN_SR_SUPPORT
  51148     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51149         uint8 hw_data;
  51150 
  51151         if (0 == data) {
  51152             hw_data = 1;
  51153         } else if (1 == data) {
  51154             hw_data = 0;
  51155         } else {
  51156             return BCM_E_PARAM;
  51157         }
  51158         FP_LOCK(unit);
  51159         rv = _field_qualify32(unit, entry,
  51160                               bcmFieldQualifySrcPortSRRoleInterlink, hw_data,
  51161                               BCM_FIELD_EXACT_MATCH_MASK);
  51162         FP_UNLOCK(unit);
  51163     }
  51164 #endif /* BCM_TSN_SR_SUPPORT */
  51165 
  51166     return rv;
  51167 }
  51168 
  51169 /*
  51170  * Function:
  51171  *      bcm_esw_field_qualify_SrcPortSRRoleInterlink_get
  51172  * Purpose:
  51173  *      Get match criteria for bcmFieldQualifySrcPortSRRoleInterlink
  51174  *      qualifier in the field entry.
  51175  * Parameters:
  51176  *      unit      - (IN) Unit number.
  51177  *      entry     - (IN) Field Entry id.
  51178  *      data      - (OUT) Qualifier match data.
  51179  * Returns:
  51180  *      BCM_E_XXX
  51181  * Notes:
  51182  */
  51183 int
  51184 bcm_esw_field_qualify_SrcPortSRRoleInterlink_get(int unit,
  51185                                                  bcm_field_entry_t entry,
  51186                                                  uint8 *data)
  51187 {
  51188     int rv = BCM_E_UNAVAIL;
  51189 
  51190 #ifdef BCM_TSN_SR_SUPPORT
  51191     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51192         uint8 hw_data;
  51193         uint8 hw_mask;
  51194 
  51195         if (NULL == data) {
  51196             return BCM_E_PARAM;
  51197         }
  51198         /* Read qualifier match value and mask. */
  51199         rv = _bcm_field_entry_qualifier_uint8_get(
  51200                  unit, entry, bcmFieldQualifySrcPortSRRoleInterlink,
  51201                  &hw_data, &hw_mask);
  51202         if (BCM_SUCCESS(rv)) {
  51203             if (0 == hw_data) {
  51204                 *data = 1;
  51205             } else if (1 == hw_data) {
  51206                 *data = 0;
  51207             } else {
  51208                 rv = BCM_E_INTERNAL;
  51209             }
  51210         }
  51211     }
  51212 #endif /* BCM_TSN_SR_SUPPORT */
  51213 
  51214     return rv;
  51215 }
  51216 
  51217 /*
  51218  * Function:
  51219  *      bcm_esw_field_qualify_DstPortSRRoleInterlink
  51220  * Purpose:
  51221  *      Set match criteria for bcmFieldQualifyDstPortSRRoleInterlink
  51222  *      qualifier in the field entry.
  51223  * Parameters:
  51224  *      unit      - (IN) Unit number.
  51225  *      entry     - (IN) Field Entry id.
  51226  *      data      - (IN) Qualifier match data.
  51227  * Returns:
  51228  *      BCM_E_XXX
  51229  * Notes:
  51230  */
  51231 int
  51232 bcm_esw_field_qualify_DstPortSRRoleInterlink(int unit,
  51233                                              bcm_field_entry_t entry,
  51234                                              uint8 data)
  51235 {
  51236     int rv = BCM_E_UNAVAIL;
  51237 
  51238 #ifdef BCM_TSN_SR_SUPPORT
  51239     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51240         uint8 hw_data;
  51241 
  51242         if (0 == data) {
  51243             hw_data = 1;
  51244         } else if (1 == data) {
  51245             hw_data = 0;
  51246         } else {
  51247             return BCM_E_PARAM;
  51248         }
  51249         FP_LOCK(unit);
  51250         rv = _field_qualify32(unit, entry,
  51251                               bcmFieldQualifyDstPortSRRoleInterlink, hw_data,
  51252                               BCM_FIELD_EXACT_MATCH_MASK);
  51253         FP_UNLOCK(unit);
  51254     }
  51255 #endif /* BCM_TSN_SR_SUPPORT */
  51256 
  51257     return rv;
  51258 }
  51259 
  51260 /*
  51261  * Function:
  51262  *      bcm_esw_field_qualify_DstPortSRRoleInterlink_get
  51263  * Purpose:
  51264  *      Get match criteria for bcmFieldQualifyDstPortSRRoleInterlink
  51265  *      qualifier in the field entry.
  51266  * Parameters:
  51267  *      unit      - (IN) Unit number.
  51268  *      entry     - (IN) Field Entry id.
  51269  *      data      - (OUT) Qualifier match data.
  51270  * Returns:
  51271  *      BCM_E_XXX
  51272  * Notes:
  51273  */
  51274 int
  51275 bcm_esw_field_qualify_DstPortSRRoleInterlink_get(int unit,
  51276                                                  bcm_field_entry_t entry,
  51277                                                  uint8 *data)
  51278 {
  51279     int rv = BCM_E_UNAVAIL;
  51280 
  51281 #ifdef BCM_TSN_SR_SUPPORT
  51282     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51283         uint8 hw_data;
  51284         uint8 hw_mask;
  51285 
  51286         /* Read qualifier match value and mask. */
  51287         rv = _bcm_field_entry_qualifier_uint8_get(
  51288                  unit, entry, bcmFieldQualifyDstPortSRRoleInterlink,
  51289                  &hw_data, &hw_mask);
  51290         if (BCM_SUCCESS(rv)) {
  51291             if (0 == hw_data) {
  51292                 *data = 1;
  51293             } else if (1 == hw_data) {
  51294                 *data = 0;
  51295             } else {
  51296                 rv = BCM_E_INTERNAL;
  51297             }
  51298         }
  51299     }
  51300 #endif /* BCM_TSN_SR_SUPPORT */
  51301 
  51302     return rv;
  51303 }
  51304 
  51305 /*
  51306  * Function:
  51307  *      bcm_esw_field_qualify_SrcPortSRMode
  51308  * Purpose:
  51309  *      Set match criteria for bcmFieldQualifySrcPortSRMode
  51310  *      qualifier in the field entry.
  51311  * Parameters:
  51312  *      unit      - (IN) Unit number.
  51313  *      entry     - (IN) Field Entry id.
  51314  *      type      - (IN) SR (Seamless Redundancy) port mode.
  51315  *      mask      - (IN) Qualifier match mask.
  51316  * Returns:
  51317  *      BCM_E_XXX
  51318  * Notes:
  51319  */
  51320 int
  51321 bcm_esw_field_qualify_SrcPortSRMode(int unit,
  51322                                     bcm_field_entry_t entry,
  51323                                     bcm_field_sr_port_mode_t type,
  51324                                     uint8 mask)
  51325 {
  51326     int rv = BCM_E_UNAVAIL;
  51327 
  51328 #ifdef BCM_TSN_SR_SUPPORT
  51329     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51330         if (type < 0 || type >= bcmFieldSRPortModeCount) {
  51331             return BCM_E_PARAM;
  51332         }
  51333         FP_LOCK(unit);
  51334         rv = _field_qualify32(unit, entry,
  51335                               bcmFieldQualifySrcPortSRMode, type, mask);
  51336         FP_UNLOCK(unit);
  51337     }
  51338 #endif /* BCM_TSN_SR_SUPPORT */
  51339 
  51340     return rv;
  51341 }
  51342 
  51343 /*
  51344  * Function:
  51345  *      bcm_esw_field_qualify_SrcPortSRMode_get
  51346  * Purpose:
  51347  *      Get match criteria for bcmFieldQualifySrcPortSRMode
  51348  *      qualifier in the field entry.
  51349  * Parameters:
  51350  *      unit      - (IN) Unit number.
  51351  *      entry     - (IN) Field Entry id.
  51352  *      type      - (OUT) SR (Seamless Redundancy) port mode.
  51353  *      mask      - (OUT) Qualifier match mask.
  51354  * Returns:
  51355  *      BCM_E_XXX
  51356  * Notes:
  51357  */
  51358 int
  51359 bcm_esw_field_qualify_SrcPortSRMode_get(int unit,
  51360                                         bcm_field_entry_t entry,
  51361                                         bcm_field_sr_port_mode_t *type,
  51362                                         uint8 *mask)
  51363 {
  51364     int rv = BCM_E_UNAVAIL;
  51365 
  51366     if (NULL == type) {
  51367         return BCM_E_PARAM;
  51368     }
  51369 
  51370 #ifdef BCM_TSN_SR_SUPPORT
  51371     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51372         uint8 hw_value;
  51373 
  51374         /* Read qualifier match value and mask. */
  51375         rv = _bcm_field_entry_qualifier_uint8_get(
  51376                  unit, entry, bcmFieldQualifySrcPortSRMode,
  51377                  &hw_value, mask);
  51378         if (BCM_SUCCESS(rv)) {
  51379             if (hw_value >= bcmFieldSRPortModeCount) {
  51380                 rv = BCM_E_INTERNAL;
  51381             }
  51382         }
  51383         if (BCM_SUCCESS(rv)) {
  51384             *type = (bcm_field_sr_port_mode_t)hw_value;
  51385         }
  51386     }
  51387 #endif /* BCM_TSN_SR_SUPPORT */
  51388 
  51389     return rv;
  51390 }
  51391 
  51392 /*
  51393  * Function:
  51394  *      bcm_esw_field_qualify_DstPortSRMode
  51395  * Purpose:
  51396  *      Set match criteria for bcmFieldQualifyDstPortSRMode
  51397  *      qualifier in the field entry.
  51398  * Parameters:
  51399  *      unit      - (IN) Unit number.
  51400  *      entry     - (IN) Field Entry id.
  51401  *      type      - (IN) SR (Seamless Redundancy) port mode.
  51402  *      mask      - (IN) Qualifier match mask.
  51403  * Returns:
  51404  *      BCM_E_XXX
  51405  * Notes:
  51406  */
  51407 int
  51408 bcm_esw_field_qualify_DstPortSRMode(int unit,
  51409                                     bcm_field_entry_t entry,
  51410                                     bcm_field_sr_port_mode_t type,
  51411                                     uint8 mask)
  51412 {
  51413     int rv = BCM_E_UNAVAIL;
  51414 
  51415 #ifdef BCM_TSN_SR_SUPPORT
  51416     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51417         if (type < 0 || type >= bcmFieldSRPortModeCount) {
  51418             return BCM_E_PARAM;
  51419         }
  51420         FP_LOCK(unit);
  51421         rv = _field_qualify32(unit, entry,
  51422                               bcmFieldQualifyDstPortSRMode, type, mask);
  51423         FP_UNLOCK(unit);
  51424     }
  51425 #endif /* BCM_TSN_SR_SUPPORT */
  51426 
  51427     return rv;
  51428 }
  51429 
  51430 /*
  51431  * Function:
  51432  *      bcm_esw_field_qualify_DstPortSRMode_get
  51433  * Purpose:
  51434  *      Get match criteria for bcmFieldQualifyDstPortSRMode
  51435  *      qualifier in the field entry.
  51436  * Parameters:
  51437  *      unit      - (IN) Unit number.
  51438  *      entry     - (IN) Field Entry id.
  51439  *      type      - (OUT) SR (Seamless Redundancy) port mode.
  51440  *      mask      - (OUT) Qualifier match mask.
  51441  * Returns:
  51442  *      BCM_E_XXX
  51443  * Notes:
  51444  */
  51445 int
  51446 bcm_esw_field_qualify_DstPortSRMode_get(int unit,
  51447                                         bcm_field_entry_t entry,
  51448                                         bcm_field_sr_port_mode_t *type,
  51449                                         uint8 *mask)
  51450 {
  51451     int rv = BCM_E_UNAVAIL;
  51452 
  51453     if (NULL == type) {
  51454         return BCM_E_PARAM;
  51455     }
  51456 #ifdef BCM_TSN_SR_SUPPORT
  51457     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51458         uint8 hw_value;
  51459 
  51460         /* Read qualifier match value and mask. */
  51461         rv = _bcm_field_entry_qualifier_uint8_get(
  51462                  unit, entry, bcmFieldQualifyDstPortSRMode,
  51463                  &hw_value, mask);
  51464         if (BCM_SUCCESS(rv)) {
  51465             if (hw_value >= bcmFieldSRPortModeCount) {
  51466                 rv = BCM_E_INTERNAL;
  51467             } else {
  51468                 *type = (bcm_field_sr_port_mode_t)hw_value;
  51469             }
  51470         }
  51471     }
  51472 #endif /* BCM_TSN_SR_SUPPORT */
  51473 
  51474     return rv;
  51475 }
  51476 
  51477 /*
  51478  * Function:
  51479  *      bcm_esw_field_qualify_SrcPortSRNetId
  51480  * Purpose:
  51481  *      Set match criteria for bcmFieldQualifySrcPortSRNetId
  51482  *      qualifier in the field entry.
  51483  * Parameters:
  51484  *      unit      - (IN) Unit number.
  51485  *      entry     - (IN) Field Entry id.
  51486  *      net_id    - (IN) Net Id.
  51487  *      mask      - (IN) Qualifier match mask.
  51488  * Returns:
  51489  *      BCM_E_XXX
  51490  * Notes:
  51491  */
  51492 int
  51493 bcm_esw_field_qualify_SrcPortSRNetId(int unit,
  51494                                      bcm_field_entry_t entry,
  51495                                      uint8 net_id, uint8 mask)
  51496 {
  51497     int rv = BCM_E_UNAVAIL;
  51498 
  51499 #ifdef BCM_TSN_SR_SUPPORT
  51500     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51501         if (net_id >= 8) {
  51502             return BCM_E_PARAM;
  51503         }
  51504         FP_LOCK(unit);
  51505         rv = _field_qualify32(unit, entry,
  51506                               bcmFieldQualifySrcPortSRNetId, net_id, mask);
  51507         FP_UNLOCK(unit);
  51508     }
  51509 #endif /* BCM_TSN_SR_SUPPORT */
  51510 
  51511     return rv;
  51512 }
  51513 
  51514 /*
  51515  * Function:
  51516  *      bcm_esw_field_qualify_SrcPortSRNetId_get
  51517  * Purpose:
  51518  *      Get match criteria for bcmFieldQualifySrcPortSRNetId
  51519  *      qualifier in the field entry.
  51520  * Parameters:
  51521  *      unit      - (IN) Unit number.
  51522  *      entry     - (IN) Field Entry id.
  51523  *      net_id    - (OUT) Net Id.
  51524  *      mask      - (OUT) Qualifier match mask.
  51525  * Returns:
  51526  *      BCM_E_XXX
  51527  * Notes:
  51528  */
  51529 int bcm_esw_field_qualify_SrcPortSRNetId_get(int unit,
  51530                                              bcm_field_entry_t entry,
  51531                                              uint8 *net_id, uint8 *mask)
  51532 {
  51533     int rv = BCM_E_UNAVAIL;
  51534 
  51535 #ifdef BCM_TSN_SR_SUPPORT
  51536     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51537         /* Read qualifier match value and mask. */
  51538         rv = _bcm_field_entry_qualifier_uint8_get(
  51539                  unit, entry, bcmFieldQualifySrcPortSRNetId,
  51540                  net_id, mask);
  51541     }
  51542 #endif /* BCM_TSN_SR_SUPPORT */
  51543 
  51544     return rv;
  51545 }
  51546 
  51547 /*
  51548  * Function:
  51549  *      bcm_esw_field_qualify_DstPortSRNetId
  51550  * Purpose:
  51551  *      Set match criteria for bcmFieldQualifyDstPortSRNetId
  51552  *      qualifier in the field entry.
  51553  * Parameters:
  51554  *      unit      - (IN) Unit number.
  51555  *      entry     - (IN) Field Entry id.
  51556  *      net_id    - (IN) Net Id.
  51557  *      mask      - (IN) Qualifier match mask.
  51558  * Returns:
  51559  *      BCM_E_XXX
  51560  * Notes:
  51561  */
  51562 int
  51563 bcm_esw_field_qualify_DstPortSRNetId(int unit,
  51564                                      bcm_field_entry_t entry,
  51565                                      uint8 net_id, uint8 mask)
  51566 {
  51567     int rv = BCM_E_UNAVAIL;
  51568 
  51569 #ifdef BCM_TSN_SR_SUPPORT
  51570     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51571         if (net_id >= 8) {
  51572             return BCM_E_PARAM;
  51573         }
  51574         FP_LOCK(unit);
  51575         rv = _field_qualify32(unit, entry,
  51576                               bcmFieldQualifyDstPortSRNetId, net_id, mask);
  51577         FP_UNLOCK(unit);
  51578     }
  51579 #endif /* BCM_TSN_SR_SUPPORT */
  51580 
  51581     return rv;
  51582 }
  51583 
  51584 /*
  51585  * Function:
  51586  *      bcm_esw_field_qualify_DstPortSRNetId_get
  51587  * Purpose:
  51588  *      Get match criteria for bcmFieldQualifyDstPortSRNetId
  51589  *      qualifier in the field entry.
  51590  * Parameters:
  51591  *      unit      - (IN) Unit number.
  51592  *      entry     - (IN) Field Entry id.
  51593  *      net_id    - (OUT) Net Id.
  51594  *      mask      - (OUT) Qualifier match mask.
  51595  * Returns:
  51596  *      BCM_E_XXX
  51597  * Notes:
  51598  */
  51599 int
  51600 bcm_esw_field_qualify_DstPortSRNetId_get(int unit,
  51601                                          bcm_field_entry_t entry,
  51602                                          uint8 *net_id, uint8 *mask)
  51603 {
  51604     int rv = BCM_E_UNAVAIL;
  51605 
  51606 #ifdef BCM_TSN_SR_SUPPORT
  51607     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51608         /* Read qualifier match value and mask. */
  51609         rv = _bcm_field_entry_qualifier_uint8_get(
  51610                  unit, entry, bcmFieldQualifyDstPortSRNetId,
  51611                  net_id, mask);
  51612     }
  51613 #endif /* BCM_TSN_SR_SUPPORT */
  51614 
  51615     return rv;
  51616 }
  51617 
  51618 /*
  51619  * Function:
  51620  *      bcm_esw_field_qualify_SrcPortSRLanId
  51621  * Purpose:
  51622  *      Set match criteria for bcmFieldQualifySrcPortSRLanId
  51623  *      qualifier in the field entry.
  51624  * Parameters:
  51625  *      unit      - (IN) Unit number.
  51626  *      entry     - (IN) Field Entry id.
  51627  *      lan_id    - (IN) Lan Id.
  51628  * Returns:
  51629  *      BCM_E_XXX
  51630  * Notes:
  51631  */
  51632 int
  51633 bcm_esw_field_qualify_SrcPortSRLanId(int unit,
  51634                                      bcm_field_entry_t entry,
  51635                                      uint8 lan_id)
  51636 {
  51637     int rv = BCM_E_UNAVAIL;
  51638 
  51639 #ifdef BCM_TSN_SR_SUPPORT
  51640     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51641         if (lan_id != 0 && lan_id != 1) {
  51642             return BCM_E_PARAM;
  51643         }
  51644         FP_LOCK(unit);
  51645         rv = _field_qualify32(unit, entry,
  51646                               bcmFieldQualifySrcPortSRLanId, lan_id,
  51647                               BCM_FIELD_EXACT_MATCH_MASK);
  51648         FP_UNLOCK(unit);
  51649     }
  51650 #endif /* BCM_TSN_SR_SUPPORT */
  51651 
  51652     return rv;
  51653 }
  51654 
  51655 /*
  51656  * Function:
  51657  *      bcm_esw_field_qualify_SrcPortSRLanId_get
  51658  * Purpose:
  51659  *      Get match criteria for bcmFieldQualifySrcPortSRLanId
  51660  *      qualifier in the field entry.
  51661  * Parameters:
  51662  *      unit      - (IN) Unit number.
  51663  *      entry     - (IN) Field Entry id.
  51664  *      lan_id    - (OUT) Lan Id.
  51665  * Returns:
  51666  *      BCM_E_XXX
  51667  * Notes:
  51668  */
  51669 int
  51670 bcm_esw_field_qualify_SrcPortSRLanId_get(int unit,
  51671                                          bcm_field_entry_t entry,
  51672                                          uint8 *lan_id)
  51673 {
  51674     int rv = BCM_E_UNAVAIL;
  51675 
  51676 #ifdef BCM_TSN_SR_SUPPORT
  51677     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51678         uint8 mask;
  51679 
  51680         /* Read qualifier match value and mask. */
  51681         rv = _bcm_field_entry_qualifier_uint8_get(
  51682                  unit, entry, bcmFieldQualifySrcPortSRLanId,
  51683                  lan_id, &mask);
  51684     }
  51685 #endif /* BCM_TSN_SR_SUPPORT */
  51686 
  51687     return rv;
  51688 }
  51689 
  51690 /*
  51691  * Function:
  51692  *      bcm_esw_field_qualify_DstPortSRLanId
  51693  * Purpose:
  51694  *      Set match criteria for bcmFieldQualifyDstPortSRLanId
  51695  *      qualifier in the field entry.
  51696  * Parameters:
  51697  *      unit      - (IN) Unit number.
  51698  *      entry     - (IN) Field Entry id.
  51699  *      lan_id    - (IN) Lan Id.
  51700  * Returns:
  51701  *      BCM_E_XXX
  51702  * Notes:
  51703  */
  51704 int
  51705 bcm_esw_field_qualify_DstPortSRLanId(int unit,
  51706                                      bcm_field_entry_t entry,
  51707                                      uint8 lan_id)
  51708 {
  51709     int rv = BCM_E_UNAVAIL;
  51710 
  51711 #ifdef BCM_TSN_SR_SUPPORT
  51712     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51713         if (lan_id != 0 && lan_id != 1) {
  51714             return BCM_E_PARAM;
  51715         }
  51716         FP_LOCK(unit);
  51717         rv = _field_qualify32(unit, entry,
  51718                               bcmFieldQualifyDstPortSRLanId, lan_id,
  51719                               BCM_FIELD_EXACT_MATCH_MASK);
  51720         FP_UNLOCK(unit);
  51721     }
  51722 #endif /* BCM_TSN_SR_SUPPORT */
  51723 
  51724     return rv;
  51725 }
  51726 
  51727 /*
  51728  * Function:
  51729  *      bcm_esw_field_qualify_DstPortSRLanId_get
  51730  * Purpose:
  51731  *      Get match criteria for bcmFieldQualifyDstPortSRLanId
  51732  *      qualifier in the field entry.
  51733  * Parameters:
  51734  *      unit      - (IN) Unit number.
  51735  *      entry     - (IN) Field Entry id.
  51736  *      lan_id    - (OUT) Lan Id.
  51737  * Returns:
  51738  *      BCM_E_XXX
  51739  * Notes:
  51740  */
  51741 int
  51742 bcm_esw_field_qualify_DstPortSRLanId_get(int unit,
  51743                                          bcm_field_entry_t entry,
  51744                                          uint8 *lan_id)
  51745 {
  51746     int rv = BCM_E_UNAVAIL;
  51747 
  51748 #ifdef BCM_TSN_SR_SUPPORT
  51749     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51750         uint8 mask;
  51751 
  51752         /* Read qualifier match value and mask. */
  51753         rv = _bcm_field_entry_qualifier_uint8_get(
  51754                  unit, entry, bcmFieldQualifyDstPortSRLanId,
  51755                  lan_id, &mask);
  51756     }
  51757 #endif /* BCM_TSN_SR_SUPPORT */
  51758 
  51759     return rv;
  51760 }
  51761 
  51762 /*
  51763  * hw value PKT.SR_TYPE
  51764  */
  51765 #define _FP_SRTAGTYPE_ENCODING_NONE        (0)
  51766 #define _FP_SRTAGTYPE_ENCODING_HSR         (2)
  51767 #define _FP_SRTAGTYPE_ENCODING_PRP         (4)
  51768 #define _FP_SRTAGTYPE_ENCODING_DOT1CB      (3)
  51769 
  51770 /*
  51771  * Function:
  51772  *      bcm_esw_field_qualify_SRTagType
  51773  * Purpose:
  51774  *      Set match criteria for bcmFieldQualifySRTagType
  51775  *      qualifier in the field entry.
  51776  * Parameters:
  51777  *      unit      - (IN) Unit number.
  51778  *      entry     - (IN) Field Entry id.
  51779  *      type      - (IN) SR (Seamless Redundancy) tag type.
  51780  * Returns:
  51781  *      BCM_E_XXX
  51782  * Notes:
  51783  */
  51784 int
  51785 bcm_esw_field_qualify_SRTagType(int unit, bcm_field_entry_t entry,
  51786                                 bcm_field_sr_tag_type_t type)
  51787 {
  51788     int rv = BCM_E_UNAVAIL;
  51789 
  51790 #ifdef BCM_TSN_SR_SUPPORT
  51791     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51792         uint32 data;
  51793 
  51794         switch (type) {
  51795             case bcmFieldSRTagTypeNone:
  51796                 data = _FP_SRTAGTYPE_ENCODING_NONE;
  51797                 break;
  51798             case bcmFieldSRTagTypeHsr:
  51799                 data = _FP_SRTAGTYPE_ENCODING_HSR;
  51800                 break;
  51801             case bcmFieldSRTagTypePrp:
  51802                 data = _FP_SRTAGTYPE_ENCODING_PRP;
  51803                 break;
  51804             case bcmFieldSRTagTypeDot1cb:
  51805                 data = _FP_SRTAGTYPE_ENCODING_DOT1CB;
  51806                 break;
  51807             default:
  51808                 return BCM_E_PARAM;
  51809         }
  51810 
  51811         FP_LOCK(unit);
  51812         rv = _field_qualify32(unit, entry,
  51813                               bcmFieldQualifySRTagType, data,
  51814                               BCM_FIELD_EXACT_MATCH_MASK);
  51815         FP_UNLOCK(unit);
  51816     }
  51817 #endif /* BCM_TSN_SR_SUPPORT */
  51818 
  51819     return rv;
  51820 }
  51821 
  51822 /*
  51823  * Function:
  51824  *      bcm_esw_field_qualify_SRTagType_get
  51825  * Purpose:
  51826  *      Get match criteria for bcmFieldQualifySRTagType
  51827  *      qualifier in the field entry.
  51828  * Parameters:
  51829  *      unit      - (IN) Unit number.
  51830  *      entry     - (IN) Field Entry id.
  51831  *      type      - (OUT) SR (Seamless Redundancy) tag type.
  51832  * Returns:
  51833  *      BCM_E_XXX
  51834  * Notes:
  51835  */
  51836 int
  51837 bcm_esw_field_qualify_SRTagType_get(int unit,
  51838                                     bcm_field_entry_t entry,
  51839                                     bcm_field_sr_tag_type_t *type)
  51840 {
  51841     int rv = BCM_E_UNAVAIL;
  51842 
  51843 #ifdef BCM_TSN_SR_SUPPORT
  51844     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51845         uint32 data, mask;
  51846 
  51847         if (NULL == type) {
  51848             return BCM_E_PARAM;
  51849         }
  51850 
  51851         /* Read qualifier match value and mask. */
  51852         rv = _bcm_field_entry_qualifier_uint32_get(
  51853                  unit, entry, bcmFieldQualifySRTagType,
  51854                  &data, &mask);
  51855 
  51856         if (BCM_SUCCESS(rv)) {
  51857             switch (data) {
  51858                 case _FP_SRTAGTYPE_ENCODING_NONE:
  51859                     *type = bcmFieldSRTagTypeNone;
  51860                     break;
  51861                 case _FP_SRTAGTYPE_ENCODING_HSR:
  51862                     *type = bcmFieldSRTagTypeHsr;
  51863                     break;
  51864                 case _FP_SRTAGTYPE_ENCODING_PRP:
  51865                     *type = bcmFieldSRTagTypePrp;
  51866                     break;
  51867                 case _FP_SRTAGTYPE_ENCODING_DOT1CB:
  51868                     *type = bcmFieldSRTagTypeDot1cb;
  51869                     break;
  51870                 default:
  51871                     rv = BCM_E_INTERNAL; /* should not happen */
  51872             }
  51873         }
  51874     }
  51875 #endif /* BCM_TSN_SR_SUPPORT */
  51876 
  51877     return rv;
  51878 }
  51879 
  51880 /*
  51881  * hw value SRLanId
  51882  */
  51883 #define _FP_SRLANID_ENCODING(_lanid_) ((0x1 << 1) | ((_lanid_) & 0x1))
  51884 #define _FP_SRLANID_DECODING(_hwid_)  ((_hwid_) & 0x1)
  51885 
  51886 /*
  51887  * Function:
  51888  *      bcm_esw_field_qualify_SRLanId
  51889  * Purpose:
  51890  *      Set match criteria for bcmFieldQualifySRLanId
  51891  *      qualifier in the field entry.
  51892  * Parameters:
  51893  *      unit      - (IN) Unit number.
  51894  *      entry     - (IN) Field Entry id.
  51895  *      lan_id    - (IN) LAN Id.
  51896  * Returns:
  51897  *      BCM_E_XXX
  51898  * Notes:
  51899  */
  51900 int
  51901 bcm_esw_field_qualify_SRLanId(int unit, bcm_field_entry_t entry,
  51902                               int lan_id)
  51903 {
  51904     int rv = BCM_E_UNAVAIL;
  51905 
  51906 #ifdef BCM_TSN_SR_SUPPORT
  51907     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51908         uint32 hw_value;
  51909 
  51910         if (lan_id != 0 && lan_id != 1) {
  51911             return BCM_E_PARAM;
  51912         }
  51913         hw_value = _FP_SRLANID_ENCODING(lan_id);
  51914         FP_LOCK(unit);
  51915         rv = _field_qualify32(unit, entry,
  51916                               bcmFieldQualifySRLanId, hw_value,
  51917                               BCM_FIELD_EXACT_MATCH_MASK);
  51918         FP_UNLOCK(unit);
  51919     }
  51920 #endif /* BCM_TSN_SR_SUPPORT */
  51921 
  51922     return rv;
  51923 }
  51924 
  51925 /*
  51926  * Function:
  51927  *      bcm_esw_field_qualify_SRLanId_get
  51928  * Purpose:
  51929  *      Get match criteria for bcmFieldQualifySRLanId
  51930  *      qualifier in the field entry.
  51931  * Parameters:
  51932  *      unit      - (IN) Unit number.
  51933  *      entry     - (IN) Field Entry id.
  51934  *      lan_id    - (OUT) LAN Id.
  51935  * Returns:
  51936  *      BCM_E_XXX
  51937  * Notes:
  51938  */
  51939 int
  51940 bcm_esw_field_qualify_SRLanId_get(int unit, bcm_field_entry_t entry,
  51941                                   int *lan_id)
  51942 {
  51943     int rv = BCM_E_UNAVAIL;
  51944 
  51945 #ifdef BCM_TSN_SR_SUPPORT
  51946     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51947         uint32 hw_value;
  51948         uint32 mask;
  51949         if (NULL == lan_id) {
  51950             return BCM_E_PARAM;
  51951         }
  51952 
  51953         /* Read qualifier match value and mask. */
  51954         rv = _bcm_field_entry_qualifier_uint32_get(
  51955                  unit, entry, bcmFieldQualifySRLanId,
  51956                  &hw_value, &mask);
  51957         if (BCM_SUCCESS(rv)) {
  51958             *lan_id = _FP_SRLANID_DECODING(hw_value);
  51959         }
  51960     }
  51961 #endif /* BCM_TSN_SR_SUPPORT */
  51962 
  51963     return rv;
  51964 }
  51965 
  51966 /*
  51967  * hw value SRNetId
  51968  */
  51969 #define _FP_SRNETID_ENCODING(_netid_) ((0x1 << 3) | ((_netid_) & 0x7))
  51970 #define _FP_SRNETID_DECODING(_hwid_)  ((_hwid_) & 0x7)
  51971 
  51972 /*
  51973  * Function:
  51974  *      bcm_esw_field_qualify_SRNetId
  51975  * Purpose:
  51976  *      Set match criteria for bcmFieldQualifySRNetId
  51977  *      qualifier in the field entry.
  51978  * Parameters:
  51979  *      unit      - (IN) Unit number.
  51980  *      entry     - (IN) Field Entry id.
  51981  *      net_id    - (IN) Net Id.
  51982  * Returns:
  51983  *      BCM_E_XXX
  51984  * Notes:
  51985  */
  51986 int
  51987 bcm_esw_field_qualify_SRNetId(int unit, bcm_field_entry_t entry,
  51988                               int net_id)
  51989 {
  51990     int rv = BCM_E_UNAVAIL;
  51991 
  51992 #ifdef BCM_TSN_SR_SUPPORT
  51993     if (soc_feature(unit, soc_feature_tsn_sr)) {
  51994         uint32 hw_value;
  51995 
  51996         if (net_id < 0 || net_id > 7) {
  51997             return BCM_E_PARAM;
  51998         }
  51999         hw_value = _FP_SRNETID_ENCODING(net_id);
  52000         FP_LOCK(unit);
  52001         rv = _field_qualify32(unit, entry,
  52002                               bcmFieldQualifySRNetId, hw_value,
  52003                               BCM_FIELD_EXACT_MATCH_MASK);
  52004         FP_UNLOCK(unit);
  52005     }
  52006 #endif /* BCM_TSN_SR_SUPPORT */
  52007 
  52008     return rv;
  52009 }
  52010 
  52011 /*
  52012  * Function:
  52013  *      bcm_esw_field_qualify_SRNetId_get
  52014  * Purpose:
  52015  *      Get match criteria for bcmFieldQualifySRNetId
  52016  *      qualifier in the field entry.
  52017  * Parameters:
  52018  *      unit      - (IN) Unit number.
  52019  *      entry     - (IN) Field Entry id.
  52020  *      net_id    - (OUT) Net Id.
  52021  * Returns:
  52022  *      BCM_E_XXX
  52023  * Notes:
  52024  */
  52025 int
  52026 bcm_esw_field_qualify_SRNetId_get(int unit, bcm_field_entry_t entry,
  52027                                   int *net_id)
  52028 {
  52029     int rv = BCM_E_UNAVAIL;
  52030 
  52031 #ifdef BCM_TSN_SR_SUPPORT
  52032     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52033         uint32 hw_value;
  52034         uint32 mask;
  52035         if (NULL == net_id) {
  52036             return BCM_E_PARAM;
  52037         }
  52038 
  52039         /* Read qualifier match value and mask. */
  52040         rv = _bcm_field_entry_qualifier_uint32_get(
  52041                  unit, entry, bcmFieldQualifySRNetId,
  52042                  &hw_value, &mask);
  52043         if (BCM_SUCCESS(rv)) {
  52044             *net_id = _FP_SRNETID_DECODING(hw_value);
  52045         }
  52046     }
  52047 #endif /* BCM_TSN_SR_SUPPORT */
  52048 
  52049     return rv;
  52050 }
  52051 
  52052 /*
  52053  * Function:
  52054  *      bcm_esw_field_qualify_VlanSREnable
  52055  * Purpose:
  52056  *      Set match criteria for bcmFieldQualifyVlanSREnable
  52057  *      qualifier in the field entry.
  52058  * Parameters:
  52059  *      unit      - (IN) Unit number.
  52060  *      entry     - (IN) Field Entry id.
  52061  *      data      - (IN) Qualifier match data.
  52062  * Returns:
  52063  *      BCM_E_XXX
  52064  * Notes:
  52065  */
  52066 int
  52067 bcm_esw_field_qualify_VlanSREnable(int unit, bcm_field_entry_t entry,
  52068                                    uint8 data)
  52069 {
  52070     int rv = BCM_E_UNAVAIL;
  52071 
  52072 #ifdef BCM_TSN_SR_SUPPORT
  52073     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52074         if (data != 0 && data != 1) {
  52075             return BCM_E_PARAM;
  52076         }
  52077         FP_LOCK(unit);
  52078         rv = _field_qualify32(unit, entry,
  52079                               bcmFieldQualifyVlanSREnable, data,
  52080                               BCM_FIELD_EXACT_MATCH_MASK);
  52081         FP_UNLOCK(unit);
  52082     }
  52083 #endif /* BCM_TSN_SR_SUPPORT */
  52084 
  52085     return rv;
  52086 }
  52087 
  52088 /*
  52089  * Function:
  52090  *      bcm_esw_field_qualify_VlanSREnable_get
  52091  * Purpose:
  52092  *      Get match criteria for bcmFieldQualifyVlanSREnable
  52093  *      qualifier in the field entry.
  52094  * Parameters:
  52095  *      unit      - (IN) Unit number.
  52096  *      entry     - (IN) Field Entry id.
  52097  *      data      - (OUT) Qualifier match data.
  52098  * Returns:
  52099  *      BCM_E_XXX
  52100  * Notes:
  52101  */
  52102 int
  52103 bcm_esw_field_qualify_VlanSREnable_get(int unit,
  52104                                        bcm_field_entry_t entry,
  52105                                        uint8 *data)
  52106 {
  52107     int rv = BCM_E_UNAVAIL;
  52108 
  52109 #ifdef BCM_TSN_SR_SUPPORT
  52110     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52111         uint8 mask;
  52112 
  52113         /* Read qualifier match value and mask. */
  52114         rv = _bcm_field_entry_qualifier_uint8_get(
  52115                  unit, entry, bcmFieldQualifyVlanSREnable,
  52116                  data, &mask);
  52117     }
  52118 #endif /* BCM_TSN_SR_SUPPORT */
  52119 
  52120     return rv;
  52121 }
  52122 
  52123 /*
  52124  * Function:
  52125  *      bcm_esw_field_qualify_VlanSRLanId
  52126  * Purpose:
  52127  *      Set match criteria for bcmFieldQualifyVlanSRLanId
  52128  *      qualifier in the field entry.
  52129  * Parameters:
  52130  *      unit      - (IN) Unit number.
  52131  *      entry     - (IN) Field Entry id.
  52132  *      lan_id    - (IN) LAN Id.
  52133  * Returns:
  52134  *      BCM_E_XXX
  52135  * Notes:
  52136  */
  52137 int
  52138 bcm_esw_field_qualify_VlanSRLanId(int unit, bcm_field_entry_t entry,
  52139                                   uint8 lan_id)
  52140 {
  52141     int rv = BCM_E_UNAVAIL;
  52142 
  52143 #ifdef BCM_TSN_SR_SUPPORT
  52144     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52145         if (lan_id != 0 && lan_id != 1) {
  52146             return BCM_E_PARAM;
  52147         }
  52148         FP_LOCK(unit);
  52149         rv = _field_qualify32(unit, entry,
  52150                               bcmFieldQualifyVlanSRLanId, lan_id,
  52151                               BCM_FIELD_EXACT_MATCH_MASK);
  52152         FP_UNLOCK(unit);
  52153     }
  52154 #endif /* BCM_TSN_SR_SUPPORT */
  52155 
  52156     return rv;
  52157 }
  52158 
  52159 /*
  52160  * Function:
  52161  *      bcm_esw_field_qualify_VlanSRLanId_get
  52162  * Purpose:
  52163  *      Get match criteria for bcmFieldQualifyVlanSRLanId
  52164  *      qualifier in the field entry.
  52165  * Parameters:
  52166  *      unit      - (IN) Unit number.
  52167  *      entry     - (IN) Field Entry id.
  52168  *      lan_id    - (OUT) LAN Id.
  52169  * Returns:
  52170  *      BCM_E_XXX
  52171  * Notes:
  52172  */
  52173 int
  52174 bcm_esw_field_qualify_VlanSRLanId_get(int unit,
  52175                                       bcm_field_entry_t entry,
  52176                                       uint8 *lan_id)
  52177 {
  52178     int rv = BCM_E_UNAVAIL;
  52179 
  52180 #ifdef BCM_TSN_SR_SUPPORT
  52181     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52182         uint8 mask;
  52183 
  52184         /* Read qualifier match value and mask. */
  52185         rv = _bcm_field_entry_qualifier_uint8_get(
  52186                  unit, entry, bcmFieldQualifyVlanSRLanId,
  52187                  lan_id, &mask);
  52188     }
  52189 #endif /* BCM_TSN_SR_SUPPORT */
  52190 
  52191     return rv;
  52192 }
  52193 
  52194 /*
  52195  * Function:
  52196  *      bcm_esw_field_qualify_SRFlowId
  52197  * Purpose:
  52198  *      Set match criteria for bcmFieldQualifySRFlowId
  52199  *      qualifier in the field entry.
  52200  * Parameters:
  52201  *      unit      - (IN) Unit number.
  52202  *      entry     - (IN) Field Entry id.
  52203  *      data      - (IN) Qualifier match data.
  52204  *      mask      - (IN) Qualifier match mask.
  52205  * Returns:
  52206  *      BCM_E_XXX
  52207  * Notes:
  52208  */
  52209 int
  52210 bcm_esw_field_qualify_SRFlowId(int unit, bcm_field_entry_t entry,
  52211                                uint32 data, uint32 mask)
  52212 {
  52213     int rv = BCM_E_UNAVAIL;
  52214 
  52215 #ifdef BCM_TSN_SR_SUPPORT
  52216     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52217         uint32 hw_idx;
  52218 
  52219         BCM_IF_ERROR_RETURN(
  52220             bcmi_esw_tsn_sr_hw_flow_id_get(unit, (bcm_tsn_sr_flow_t)data,
  52221                                            &hw_idx));
  52222         FP_LOCK(unit);
  52223         rv = _field_qualify32(unit, entry,
  52224                               bcmFieldQualifySRFlowId, hw_idx, mask);
  52225         FP_UNLOCK(unit);
  52226     }
  52227 #endif /* BCM_TSN_SR_SUPPORT */
  52228 
  52229     return rv;
  52230 }
  52231 
  52232 /*
  52233  * Function:
  52234  *      bcm_esw_field_qualify_SRFlowId_get
  52235  * Purpose:
  52236  *      Get match criteria for bcmFieldQualifySRFlowId
  52237  *      qualifier in the field entry.
  52238  * Parameters:
  52239  *      unit      - (IN) Unit number.
  52240  *      entry     - (IN) Field Entry id.
  52241  *      data      - (OUT) Qualifier match data.
  52242  *      mask      - (OUT) Qualifier match mask.
  52243  * Returns:
  52244  *      BCM_E_XXX
  52245  * Notes:
  52246  */
  52247 int
  52248 bcm_esw_field_qualify_SRFlowId_get(int unit, bcm_field_entry_t entry,
  52249                                    uint32 *data, uint32 *mask)
  52250 {
  52251     int rv = BCM_E_UNAVAIL;
  52252 
  52253 #ifdef BCM_TSN_SR_SUPPORT
  52254     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52255         uint32 hw_idx;
  52256 
  52257         if (NULL == data || NULL == mask) {
  52258             return BCM_E_PARAM;
  52259         }
  52260         /* Read qualifier match value and mask. */
  52261         rv = _bcm_field_entry_qualifier_uint32_get(
  52262                  unit, entry, bcmFieldQualifySRFlowId,
  52263                  &hw_idx, mask);
  52264         if (BCM_SUCCESS(rv) && *mask != 0) {
  52265             rv = bcmi_esw_tsn_sr_sw_flow_id_get(
  52266                      unit, hw_idx, (bcm_tsn_sr_flow_t *)data);
  52267         }
  52268     }
  52269 #endif /* BCM_TSN_SR_SUPPORT */
  52270 
  52271     return rv;
  52272 }
  52273 
  52274 /*
  52275  * Function:
  52276  *      bcm_esw_field_qualify_L2DestSRNodeType
  52277  * Purpose:
  52278  *      Set match criteria for bcmFieldQualifyL2DestSRNodeType
  52279  *      qualifier in the field entry.
  52280  * Parameters:
  52281  *      unit      - (IN) Unit number.
  52282  *      entry     - (IN) Field Entry id.
  52283  *      type      - (IN) SR (Seamless Redundancy) node type.
  52284  * Returns:
  52285  *      BCM_E_XXX
  52286  * Notes:
  52287  */
  52288 int
  52289 bcm_esw_field_qualify_L2DestSRNodeType(int unit,
  52290                                        bcm_field_entry_t entry,
  52291                                        bcm_field_sr_node_type_t type)
  52292 {
  52293     int rv = BCM_E_UNAVAIL;
  52294 
  52295 #ifdef BCM_TSN_SR_SUPPORT
  52296     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52297         if (type < 0 || type >= bcmFieldSRNodeTypeCount) {
  52298             return BCM_E_PARAM;
  52299         }
  52300         FP_LOCK(unit);
  52301         rv = _field_qualify32(unit, entry,
  52302                               bcmFieldQualifyL2DestSRNodeType, type,
  52303                               BCM_FIELD_EXACT_MATCH_MASK);
  52304         FP_UNLOCK(unit);
  52305     }
  52306 #endif /* BCM_TSN_SR_SUPPORT */
  52307 
  52308     return rv;
  52309 }
  52310 
  52311 /*
  52312  * Function:
  52313  *      bcm_esw_field_qualify_L2DestSRNodeType_get
  52314  * Purpose:
  52315  *      Get match criteria for bcmFieldQualifyL2DestSRNodeType
  52316  *      qualifier in the field entry.
  52317  * Parameters:
  52318  *      unit      - (IN) Unit number.
  52319  *      entry     - (IN) Field Entry id.
  52320  *      type      - (OUT) SR (Seamless Redundancy) node type.
  52321  * Returns:
  52322  *      BCM_E_XXX
  52323  * Notes:
  52324  */
  52325 int
  52326 bcm_esw_field_qualify_L2DestSRNodeType_get(int unit,
  52327                                            bcm_field_entry_t entry,
  52328                                            bcm_field_sr_node_type_t *type)
  52329 {
  52330     int rv = BCM_E_UNAVAIL;
  52331 
  52332 #ifdef BCM_TSN_SR_SUPPORT
  52333     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52334         uint32 mask;
  52335 
  52336         /* Read qualifier match value and mask. */
  52337         rv = _bcm_field_entry_qualifier_uint32_get(
  52338                  unit, entry, bcmFieldQualifyL2DestSRNodeType,
  52339                  type, &mask);
  52340     }
  52341 #endif /* BCM_TSN_SR_SUPPORT */
  52342 
  52343     return rv;
  52344 }
  52345 
  52346 /*
  52347  * Function:
  52348  *      bcm_esw_field_qualify_SRNetIdMatched
  52349  * Purpose:
  52350  *      Set match criteria for bcmFieldQualifySRNetIdMatched
  52351  *      qualifier in the field entry.
  52352  * Parameters:
  52353  *      unit      - (IN) Unit number.
  52354  *      entry     - (IN) Field Entry id.
  52355  *      data      - (IN) Qualifier match data.
  52356  * Returns:
  52357  *      BCM_E_XXX
  52358  * Notes:
  52359  */
  52360 int
  52361 bcm_esw_field_qualify_SRNetIdMatched(int unit,
  52362                                      bcm_field_entry_t entry,
  52363                                      uint8 data)
  52364 {
  52365     int rv = BCM_E_UNAVAIL;
  52366 
  52367 #ifdef BCM_TSN_SR_SUPPORT
  52368     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52369         if (data != 0 && data != 1) {
  52370             return BCM_E_PARAM;
  52371         }
  52372         FP_LOCK(unit);
  52373         rv = _field_qualify32(unit, entry,
  52374                               bcmFieldQualifySRNetIdMatched, data,
  52375                               BCM_FIELD_EXACT_MATCH_MASK);
  52376         FP_UNLOCK(unit);
  52377     }
  52378 #endif /* BCM_TSN_SR_SUPPORT */
  52379 
  52380     return rv;
  52381 }
  52382 
  52383 /*
  52384  * Function:
  52385  *      bcm_esw_field_qualify_SRNetIdMatched_get
  52386  * Purpose:
  52387  *      Get match criteria for bcmFieldQualifySRNetIdMatched
  52388  *      qualifier in the field entry.
  52389  * Parameters:
  52390  *      unit      - (IN) Unit number.
  52391  *      entry     - (IN) Field Entry id.
  52392  *      data      - (OUT) Qualifier match data.
  52393  * Returns:
  52394  *      BCM_E_XXX
  52395  * Notes:
  52396  */
  52397 int
  52398 bcm_esw_field_qualify_SRNetIdMatched_get(int unit,
  52399                                          bcm_field_entry_t entry,
  52400                                          uint8 *data)
  52401 {
  52402     int rv = BCM_E_UNAVAIL;
  52403 
  52404 #ifdef BCM_TSN_SR_SUPPORT
  52405     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52406         uint8 mask;
  52407 
  52408         /* Read qualifier match value and mask. */
  52409         rv = _bcm_field_entry_qualifier_uint8_get(
  52410                  unit, entry, bcmFieldQualifySRNetIdMatched,
  52411                  data, &mask);
  52412     }
  52413 #endif /* BCM_TSN_SR_SUPPORT */
  52414 
  52415     return rv;
  52416 }
  52417 
  52418 /*
  52419  * Function:
  52420  *      bcm_esw_field_qualify_SRSrcNodeIsSan
  52421  * Purpose:
  52422  *      Set match criteria for bcmFieldQualifySRSrcNodeIsSan
  52423  *      qualifier in the field entry.
  52424  * Parameters:
  52425  *      unit      - (IN) Unit number.
  52426  *      entry     - (IN) Field Entry id.
  52427  *      data      - (IN) Qualifier match data.
  52428  * Returns:
  52429  *      BCM_E_XXX
  52430  * Notes:
  52431  */
  52432 int
  52433 bcm_esw_field_qualify_SRSrcNodeIsSan(int unit,
  52434                                      bcm_field_entry_t entry,
  52435                                      uint8 data)
  52436 {
  52437     int rv = BCM_E_UNAVAIL;
  52438 
  52439 #ifdef BCM_TSN_SR_SUPPORT
  52440     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52441         if (data != 0 && data != 1) {
  52442             return BCM_E_PARAM;
  52443         }
  52444         FP_LOCK(unit);
  52445         rv = _field_qualify32(unit, entry,
  52446                               bcmFieldQualifySRSrcNodeIsSan, data,
  52447                               BCM_FIELD_EXACT_MATCH_MASK);
  52448         FP_UNLOCK(unit);
  52449     }
  52450 #endif /* BCM_TSN_SR_SUPPORT */
  52451 
  52452     return rv;
  52453 }
  52454 
  52455 /*
  52456  * Function:
  52457  *      bcm_esw_field_qualify_SRSrcNodeIsSan_get
  52458  * Purpose:
  52459  *      Get match criteria for bcmFieldQualifySRSrcNodeIsSan
  52460  *      qualifier in the field entry.
  52461  * Parameters:
  52462  *      unit      - (IN) Unit number.
  52463  *      entry     - (IN) Field Entry id.
  52464  *      data      - (OUT) Qualifier match data.
  52465  * Returns:
  52466  *      BCM_E_XXX
  52467  * Notes:
  52468  */
  52469 int
  52470 bcm_esw_field_qualify_SRSrcNodeIsSan_get(int unit,
  52471                                          bcm_field_entry_t entry,
  52472                                          uint8 *data)
  52473 {
  52474     int rv = BCM_E_UNAVAIL;
  52475 
  52476 #ifdef BCM_TSN_SR_SUPPORT
  52477     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52478         uint8 mask;
  52479 
  52480         /* Read qualifier match value and mask. */
  52481         rv = _bcm_field_entry_qualifier_uint8_get(
  52482                  unit, entry, bcmFieldQualifySRSrcNodeIsSan,
  52483                  data, &mask);
  52484     }
  52485 #endif /* BCM_TSN_SR_SUPPORT */
  52486 
  52487     return rv;
  52488 }
  52489 
  52490 /*
  52491  * Function:
  52492  *      bcm_esw_field_qualify_SRSupervisionType
  52493  * Purpose:
  52494  *      Set match criteria for bcmFieldQualifySRSupervisionType
  52495  *      qualifier in the field entry.
  52496  * Parameters:
  52497  *      unit      - (IN) Unit number.
  52498  *      entry     - (IN) Field Entry id.
  52499  *      type      - (IN) SR (Seamless Redundancy) supervision type.
  52500  * Returns:
  52501  *      BCM_E_XXX
  52502  * Notes:
  52503  */
  52504 int
  52505 bcm_esw_field_qualify_SRSupervisionType(int unit,
  52506                                         bcm_field_entry_t entry,
  52507                                         bcm_field_sr_supervision_type_t type)
  52508 {
  52509     int rv = BCM_E_UNAVAIL;
  52510 
  52511 #ifdef BCM_TSN_SR_SUPPORT
  52512     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52513         if (type < 0 || type >= bcmFieldSRSupervisionTypeCount) {
  52514             return BCM_E_PARAM;
  52515         }
  52516         FP_LOCK(unit);
  52517         rv = _field_qualify32(unit, entry,
  52518                               bcmFieldQualifySRSupervisionType, type,
  52519                               BCM_FIELD_EXACT_MATCH_MASK);
  52520         FP_UNLOCK(unit);
  52521     }
  52522 #endif /* BCM_TSN_SR_SUPPORT */
  52523 
  52524     return rv;
  52525 }
  52526 
  52527 /*
  52528  * Function:
  52529  *      bcm_esw_field_qualify_SRSupervisionType_get
  52530  * Purpose:
  52531  *      Get match criteria for bcmFieldQualifySRSupervisionType
  52532  *      qualifier in the field entry.
  52533  * Parameters:
  52534  *      unit      - (IN) Unit number.
  52535  *      entry     - (IN) Field Entry id.
  52536  *      type      - (OUT) SR (Seamless Redundancy) supervision type.
  52537  * Returns:
  52538  *      BCM_E_XXX
  52539  * Notes:
  52540  */
  52541 int
  52542 bcm_esw_field_qualify_SRSupervisionType_get(int unit,
  52543                                             bcm_field_entry_t entry,
  52544                                             bcm_field_sr_supervision_type_t *type)
  52545 {
  52546     int rv = BCM_E_UNAVAIL;
  52547 
  52548 #ifdef BCM_TSN_SR_SUPPORT
  52549     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52550         uint32 mask;
  52551 
  52552         /* Read qualifier match value and mask. */
  52553         rv = _bcm_field_entry_qualifier_uint32_get(
  52554                  unit, entry, bcmFieldQualifySRSupervisionType,
  52555                  type, &mask);
  52556     }
  52557 #endif /* BCM_TSN_SR_SUPPORT */
  52558 
  52559     return rv;
  52560 }
  52561 
  52562 /*
  52563  * Function:
  52564  *      bcm_esw_field_qualify_SRError
  52565  * Purpose:
  52566  *      Set match criteria for bcmFieldQualifySRError
  52567  *      qualifier in the field entry.
  52568  * Parameters:
  52569  *      unit      - (IN) Unit number.
  52570  *      entry     - (IN) Field Entry id.
  52571  *      data      - (IN) Qualifier match data.
  52572  *      mask      - (IN) Qualifier match mask.
  52573  * Returns:
  52574  *      BCM_E_XXX
  52575  * Notes:
  52576  */
  52577 int
  52578 bcm_esw_field_qualify_SRError(int unit, bcm_field_entry_t entry,
  52579                               uint32 data, uint32 mask)
  52580 {
  52581     int rv = BCM_E_UNAVAIL;
  52582 
  52583 #ifdef BCM_TSN_SR_SUPPORT
  52584     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52585         uint32 valid_mask = BCM_FIELD_SR_ERROR_UNEXPECTED_PKT |
  52586                             BCM_FIELD_SR_ERROR_TAG_ERROR |
  52587                             BCM_FIELD_SR_ERROR_RX_ERROR;
  52588         if (data & (~valid_mask) || mask & (~valid_mask)) {
  52589             return BCM_E_PARAM;
  52590         }
  52591         FP_LOCK(unit);
  52592         rv = _field_qualify32(unit, entry,
  52593                               bcmFieldQualifySRError, data, mask);
  52594         FP_UNLOCK(unit);
  52595     }
  52596 #endif /* BCM_TSN_SR_SUPPORT */
  52597 
  52598     return rv;
  52599 }
  52600 
  52601 /*
  52602  * Function:
  52603  *      bcm_esw_field_qualify_SRError_get
  52604  * Purpose:
  52605  *      Get match criteria for bcmFieldQualifySRError
  52606  *      qualifier in the field entry.
  52607  * Parameters:
  52608  *      unit      - (IN) Unit number.
  52609  *      entry     - (IN) Field Entry id.
  52610  *      data      - (OUT) Qualifier match data.
  52611  *      mask      - (OUT) Qualifier match mask.
  52612  * Returns:
  52613  *      BCM_E_XXX
  52614  * Notes:
  52615  */
  52616 int
  52617 bcm_esw_field_qualify_SRError_get(int unit, bcm_field_entry_t entry,
  52618                                   uint32 *data, uint32 *mask)
  52619 {
  52620     int rv = BCM_E_UNAVAIL;
  52621 
  52622 #ifdef BCM_TSN_SR_SUPPORT
  52623     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52624         /* Read qualifier match value and mask. */
  52625         rv = _bcm_field_entry_qualifier_uint32_get(
  52626                  unit, entry, bcmFieldQualifySRError,
  52627                  data, mask);
  52628     }
  52629 #endif /* BCM_TSN_SR_SUPPORT */
  52630 
  52631     return rv;
  52632 }
  52633 
  52634 /*
  52635  * Function:
  52636  *      bcm_esw_field_qualify_L2SrcMulticastHit
  52637  * Purpose:
  52638  *      Set match criteria for bcmFieldQualifyL2SrcMulticastHit
  52639  *      qualifier in the field entry.
  52640  * Parameters:
  52641  *      unit      - (IN) Unit number.
  52642  *      entry     - (IN) Field Entry id.
  52643  *      data      - (IN) Qualifier match data.
  52644  *      mask      - (IN) Qualifier match mask.
  52645  * Returns:
  52646  *      BCM_E_XXX
  52647  * Notes:
  52648  */
  52649 int
  52650 bcm_esw_field_qualify_L2SrcMulticastHit(int unit,
  52651                                         bcm_field_entry_t entry,
  52652                                         uint8 data, uint8 mask)
  52653 {
  52654     int rv = BCM_E_UNAVAIL;
  52655 
  52656 #ifdef BCM_TSN_SUPPORT
  52657     if (soc_feature(unit, soc_feature_tsn)) {
  52658         uint8 hw_data;
  52659 
  52660         if (data > 0x1 || mask != 0x1) {
  52661             return BCM_E_PARAM;
  52662         }
  52663         hw_data = (data == 0) ? 0 : 3;
  52664 
  52665         FP_LOCK(unit);
  52666         rv = _field_qualify32(unit, entry,
  52667                               bcmFieldQualifyL2SrcMulticastHit, hw_data,
  52668                               BCM_FIELD_EXACT_MATCH_MASK);
  52669         FP_UNLOCK(unit);
  52670     }
  52671 #endif /* BCM_TSN_SR_SUPPORT */
  52672 
  52673     return rv;
  52674 }
  52675 
  52676 /*
  52677  * Function:
  52678  *      bcm_esw_field_qualify_L2SrcMulticastHit_get
  52679  * Purpose:
  52680  *      Get match criteria for bcmFieldQualifyL2SrcMulticastHit
  52681  *      qualifier in the field entry.
  52682  * Parameters:
  52683  *      unit      - (IN) Unit number.
  52684  *      entry     - (IN) Field Entry id.
  52685  *      data      - (OUT) Qualifier match data.
  52686  *      mask      - (OUT) Qualifier match mask.
  52687  * Returns:
  52688  *      BCM_E_XXX
  52689  * Notes:
  52690  */
  52691 int
  52692 bcm_esw_field_qualify_L2SrcMulticastHit_get(int unit,
  52693                                             bcm_field_entry_t entry,
  52694                                             uint8 *data, uint8 *mask)
  52695 {
  52696     int rv = BCM_E_UNAVAIL;
  52697 
  52698 #ifdef BCM_TSN_SUPPORT
  52699     if (soc_feature(unit, soc_feature_tsn)) {
  52700         uint8 hw_data, hw_mask;
  52701 
  52702         if (NULL == data || NULL == mask) {
  52703             return BCM_E_PARAM;
  52704         }
  52705 
  52706         /* Read qualifier match value and mask. */
  52707         rv = _bcm_field_entry_qualifier_uint8_get(
  52708                  unit, entry, bcmFieldQualifyL2SrcMulticastHit,
  52709                  &hw_data, &hw_mask);
  52710         if (BCM_SUCCESS(rv)) {
  52711             if (0 == hw_mask) {
  52712                 *data = 0;
  52713                 *mask = 0;
  52714             } else if (3 == hw_data) {
  52715                 *data = 1;
  52716                 *mask = 1;
  52717             } else if (0 == hw_data) {
  52718                 *data = 0;
  52719                 *mask = 1;
  52720             } else {
  52721                 rv = BCM_E_INTERNAL; /* should not happen */
  52722             }
  52723         }
  52724     }
  52725 #endif /* BCM_TSN_SR_SUPPORT */
  52726 
  52727     return rv;
  52728 }
  52729 
  52730 /*
  52731  * Function:
  52732  *      bcm_esw_field_qualify_L2DstMulticastHit
  52733  * Purpose:
  52734  *      Set match criteria for bcmFieldQualifyL2DstMulticastHit
  52735  *      qualifier in the field entry.
  52736  * Parameters:
  52737  *      unit      - (IN) Unit number.
  52738  *      entry     - (IN) Field Entry id.
  52739  *      data      - (IN) Qualifier match data.
  52740  *      mask      - (IN) Qualifier match mask.
  52741  * Returns:
  52742  *      BCM_E_XXX
  52743  * Notes:
  52744  */
  52745 int
  52746 bcm_esw_field_qualify_L2DstMulticastHit(int unit,
  52747                                         bcm_field_entry_t entry,
  52748                                         uint8 data, uint8 mask)
  52749 {
  52750     int rv = BCM_E_UNAVAIL;
  52751 
  52752 #ifdef BCM_TSN_SR_SUPPORT
  52753     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52754         uint8 hw_data;
  52755 
  52756         if (data > 0x1 || mask != 0x1) {
  52757             return BCM_E_PARAM;
  52758         }
  52759         hw_data = (data == 0) ? 0 : 2;
  52760 
  52761         FP_LOCK(unit);
  52762         rv = _field_qualify32(unit, entry,
  52763                               bcmFieldQualifyL2DstMulticastHit, hw_data,
  52764                               BCM_FIELD_EXACT_MATCH_MASK);
  52765         FP_UNLOCK(unit);
  52766     }
  52767 #endif /* BCM_TSN_SR_SUPPORT */
  52768 
  52769     return rv;
  52770 }
  52771 
  52772 /*
  52773  * Function:
  52774  *      bcm_esw_field_qualify_L2DstMulticastHit_get
  52775  * Purpose:
  52776  *      Get match criteria for bcmFieldQualifyL2DstMulticastHit
  52777  *      qualifier in the field entry.
  52778  * Parameters:
  52779  *      unit      - (IN) Unit number.
  52780  *      entry     - (IN) Field Entry id.
  52781  *      data      - (OUT) Qualifier match data.
  52782  *      mask      - (OUT) Qualifier match mask.
  52783  * Returns:
  52784  *      BCM_E_XXX
  52785  * Notes:
  52786  */
  52787 int
  52788 bcm_esw_field_qualify_L2DstMulticastHit_get(int unit,
  52789                                             bcm_field_entry_t entry,
  52790                                             uint8 *data, uint8 *mask)
  52791 {
  52792     int rv = BCM_E_UNAVAIL;
  52793 
  52794 #ifdef BCM_TSN_SR_SUPPORT
  52795     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52796         uint8 hw_data, hw_mask;
  52797 
  52798         if (NULL == data || NULL == mask) {
  52799             return BCM_E_PARAM;
  52800         }
  52801         /* Read qualifier match value and mask. */
  52802         rv = _bcm_field_entry_qualifier_uint8_get(
  52803                  unit, entry, bcmFieldQualifyL2DstMulticastHit,
  52804                  &hw_data, &hw_mask);
  52805         if (BCM_SUCCESS(rv)) {
  52806             if (0 == hw_mask) {
  52807                 *data = 0;
  52808                 *mask = 0;
  52809             } else if (2 == hw_data) {
  52810                 *data = 1;
  52811                 *mask = 1;
  52812             } else if (0 == hw_data) {
  52813                 *data = 0;
  52814                 *mask = 1;
  52815             } else {
  52816                 rv = BCM_E_INTERNAL; /* should not happen */
  52817             }
  52818         }
  52819     }
  52820 #endif /* BCM_TSN_SR_SUPPORT */
  52821 
  52822     return rv;
  52823 }
  52824 
  52825 /*
  52826  * Function:
  52827  *      bcm_esw_field_qualify_SRDuplicate
  52828  * Purpose:
  52829  *      Set match criteria for bcmFieldQualifySRDuplicate
  52830  *      qualifier in the field entry.
  52831  * Parameters:
  52832  *      unit      - (IN) Unit number.
  52833  *      entry     - (IN) Field Entry id.
  52834  *      data      - (IN) Qualifier match data.
  52835  * Returns:
  52836  *      BCM_E_XXX
  52837  * Notes:
  52838  */
  52839 int
  52840 bcm_esw_field_qualify_SRDuplicate(int unit, bcm_field_entry_t entry,
  52841                                   uint8 data)
  52842 {
  52843     int rv = BCM_E_UNAVAIL;
  52844 
  52845 #ifdef BCM_TSN_SR_SUPPORT
  52846     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52847         if (data != 0 && data != 1) {
  52848             return BCM_E_PARAM;
  52849         }
  52850         FP_LOCK(unit);
  52851         rv = _field_qualify32(unit, entry,
  52852                               bcmFieldQualifySRDuplicate, data,
  52853                               BCM_FIELD_EXACT_MATCH_MASK);
  52854         FP_UNLOCK(unit);
  52855     }
  52856 #endif /* BCM_TSN_SR_SUPPORT */
  52857 
  52858     return rv;
  52859 }
  52860 
  52861 /*
  52862  * Function:
  52863  *      bcm_esw_field_qualify_SRDuplicate_get
  52864  * Purpose:
  52865  *      Get match criteria for bcmFieldQualifySRDuplicate
  52866  *      qualifier in the field entry.
  52867  * Parameters:
  52868  *      unit      - (IN) Unit number.
  52869  *      entry     - (IN) Field Entry id.
  52870  *      data      - (OUT) Qualifier match data.
  52871  * Returns:
  52872  *      BCM_E_XXX
  52873  * Notes:
  52874  */
  52875 int
  52876 bcm_esw_field_qualify_SRDuplicate_get(int unit,
  52877                                       bcm_field_entry_t entry,
  52878                                       uint8 *data)
  52879 {
  52880     int rv = BCM_E_UNAVAIL;
  52881 
  52882 #ifdef BCM_TSN_SR_SUPPORT
  52883     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52884         uint8 mask;
  52885 
  52886         /* Read qualifier match value and mask. */
  52887         rv = _bcm_field_entry_qualifier_uint8_get(
  52888                  unit, entry, bcmFieldQualifySRDuplicate,
  52889                  data, &mask);
  52890     }
  52891 #endif /* BCM_TSN_SR_SUPPORT */
  52892 
  52893     return rv;
  52894 }
  52895 
  52896 /*
  52897  * Function:
  52898  *      bcm_esw_field_qualify_TsnFlowId
  52899  * Purpose:
  52900  *      Set match criteria for bcmFieldQualifyTsnFlowId
  52901  *      qualifier in the field entry.
  52902  * Parameters:
  52903  *      unit      - (IN) Unit number.
  52904  *      entry     - (IN) Field Entry id.
  52905  *      data      - (IN) Qualifier match data.
  52906  *      mask      - (IN) Qualifier match mask.
  52907  * Returns:
  52908  *      BCM_E_XXX
  52909  * Notes:
  52910  */
  52911 int
  52912 bcm_esw_field_qualify_TsnFlowId(int unit, bcm_field_entry_t entry,
  52913                                 uint32 data, uint32 mask)
  52914 {
  52915     int rv = BCM_E_UNAVAIL;
  52916 
  52917 #ifdef BCM_TSN_SR_SUPPORT
  52918     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52919         uint32 hw_idx;
  52920 
  52921         BCM_IF_ERROR_RETURN(
  52922             bcmi_esw_tsn_hw_flow_id_get(unit, (bcm_tsn_flow_t)data,
  52923                                         &hw_idx));
  52924         FP_LOCK(unit);
  52925         rv = _field_qualify32(unit, entry,
  52926                               bcmFieldQualifyTsnFlowId, hw_idx, mask);
  52927         FP_UNLOCK(unit);
  52928     }
  52929 #endif /* BCM_TSN_SR_SUPPORT */
  52930 
  52931     return rv;
  52932 }
  52933 
  52934 /*
  52935  * Function:
  52936  *      bcm_esw_field_qualify_TsnFlowId_get
  52937  * Purpose:
  52938  *      Get match criteria for bcmFieldQualifyTsnFlowId
  52939  *      qualifier in the field entry.
  52940  * Parameters:
  52941  *      unit      - (IN) Unit number.
  52942  *      entry     - (IN) Field Entry id.
  52943  *      data      - (OUT) Qualifier match data.
  52944  *      mask      - (OUT) Qualifier match mask.
  52945  * Returns:
  52946  *      BCM_E_XXX
  52947  * Notes:
  52948  */
  52949 int
  52950 bcm_esw_field_qualify_TsnFlowId_get(int unit,
  52951                                     bcm_field_entry_t entry,
  52952                                     uint32 *data, uint32 *mask)
  52953 {
  52954     int rv = BCM_E_UNAVAIL;
  52955 
  52956 #ifdef BCM_TSN_SR_SUPPORT
  52957     if (soc_feature(unit, soc_feature_tsn_sr)) {
  52958         uint32 hw_idx;
  52959 
  52960         if (NULL == data || NULL == mask) {
  52961             return BCM_E_PARAM;
  52962         }
  52963         /* Read qualifier match value and mask. */
  52964         rv = _bcm_field_entry_qualifier_uint32_get(
  52965                  unit, entry, bcmFieldQualifyTsnFlowId,
  52966                  &hw_idx, mask);
  52967         if (BCM_SUCCESS(rv) && *mask != 0) {
  52968             rv = bcmi_esw_tsn_sw_flow_id_get(
  52969                      unit, hw_idx, (bcm_tsn_flow_t *)data);
  52970         }
  52971     }
  52972 #endif /* BCM_TSN_SR_SUPPORT */
  52973 
  52974     return rv;
  52975 }
  52976 
  52977 /*
  52978  * Function:
  52979  *      bcm_esw_field_qualify_IpTunnelTtl_get
  52980  * Purpose:
  52981  *      Get match criteria for bcmFieldQualifyIpTunnelTtl
  52982  *                     qualifier from the field entry.
  52983  * Parameters:
  52984  *      unit - (IN) Unit number.
  52985  *      entry - (IN) BCM field entry id.
  52986  *      data - (OUT) Qualifier match data.
  52987  *      mask - (OUT) Qualifier match mask.
  52988  * Returns:
  52989  *      BCM_E_XXX
  52990  * Notes:
  52991  */
  52992 int 
  52993 bcm_esw_field_qualify_IpTunnelTtl_get(
  52994     int unit, 
  52995     bcm_field_entry_t entry, 
  52996     uint8 *data, 
  52997     uint8 *mask)
  52998 
  52999 {
  53000     int rv = BCM_E_UNAVAIL;
  53001     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  53002         FP_LOCK(unit);
  53003         /* Read qualifier match value and mask. */
  53004         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53005                         bcmFieldQualifyIpTunnelTtl,
  53006                         data, mask);
  53007         FP_UNLOCK(unit);
  53008     }
  53009 
  53010     return (rv);
  53011 }
  53012 
  53013 /*
  53014  * Function:
  53015  *      bcm_esw_field_qualify_IpTunnelTtl
  53016  * Purpose:
  53017  *      Set match criteria for bcmFieldQualifyIpTunnelTtl
  53018  *                     qualifier from the field entry.
  53019  * Parameters:
  53020  *      unit - (IN) Unit number.
  53021  *      entry - (IN) BCM field entry id.
  53022  *      data - (OUT) Qualifier match data.
  53023  *      mask - (OUT) Qualifier match mask.
  53024  * Returns:
  53025  *      BCM_E_XXX
  53026  * Notes:
  53027  */
  53028 int 
  53029 bcm_esw_field_qualify_IpTunnelTtl(
  53030     int unit, 
  53031     bcm_field_entry_t entry, 
  53032     uint8 data, 
  53033     uint8 mask)
  53034 
  53035 {
  53036     int rv = BCM_E_UNAVAIL;
  53037 
  53038     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  53039         FP_LOCK(unit);
  53040         rv = _field_qualify32(unit, entry,
  53041                               bcmFieldQualifyIpTunnelTtl,
  53042                               data, mask);
  53043         FP_UNLOCK(unit);
  53044     }
  53045 
  53046     return (rv);
  53047 }
  53048 
  53049 /*
  53050  * Function:
  53051  *      bcm_esw_field_qualify_IpTunnelTtlClassZero
  53052  *      Set match criteria for bcmFieldQualifyIpTunnelTtlClassZero
  53053  *      qualifier in the field entry.
  53054  * Parameters:
  53055  *      unit    -   (IN) Unit number.
  53056  *      entry   -   (IN) BCM field entry id.
  53057  *      data    -   (IN) Qualifier match data.
  53058  *      mask    -   (IN) Qualifier match data.
  53059  * Returns:
  53060  *      BCM_E_XXX
  53061  * Notes:
  53062  */
  53063 int
  53064 bcm_esw_field_qualify_IpTunnelTtlClassZero(int unit, 
  53065         bcm_field_entry_t entry,
  53066         bcm_class_t data, 
  53067         bcm_class_t mask)
  53068 {
  53069     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  53070 
  53071     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  53072         uint32 cdata = 0;           /* Class Data */
  53073         uint32 cmask = 0;           /* Class Mask */
  53074 
  53075         COMPILER_64_TO_32_LO(cdata, data);
  53076         COMPILER_64_TO_32_LO(cmask, mask);
  53077 
  53078         FP_LOCK(unit);
  53079         rv = _field_qualify32(unit, entry,
  53080                               bcmFieldQualifyIpTunnelTtlClassZero,
  53081                               cdata, cmask);
  53082 
  53083         FP_UNLOCK(unit);
  53084     }
  53085     return rv;
  53086 
  53087 }
  53088 
  53089 /*
  53090  * Function:
  53091  *      bcm_esw_field_qualify_IpTunnelTtlClassZero_get
  53092  * Purpose:
  53093  *      Get match criteria for bcmFieldQualifyIpTunnelTtlClassZero
  53094  *      qualifier from the field entry.
  53095  * Parameters:
  53096  *      unit    - (IN) Unit number.
  53097  *      entry   - (IN) BCM field entry id.
  53098  *      data    - (OUT) Qualifier match data.
  53099  *      mask    - (OUT) Qualifier match mask.
  53100  * Returns:
  53101  *      BCM_E_XXX
  53102  * Notes:
  53103  */
  53104 int
  53105 bcm_esw_field_qualify_IpTunnelTtlClassZero_get(int unit,
  53106         bcm_field_entry_t entry,
  53107         bcm_class_t *data,
  53108         bcm_class_t *mask)
  53109 {
  53110     int rv = BCM_E_UNAVAIL;     /* Operation return status. */
  53111 
  53112     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  53113         /* Read qualifier match value and mask. */
  53114         rv = _bcm_field_entry_qualifier_uint64_get(unit, entry,
  53115                         bcmFieldQualifyIpTunnelTtlClassZero,
  53116                         data, mask);
  53117     }
  53118 
  53119     return (rv);
  53120 
  53121 }
  53122 
  53123 /*
  53124  * Function:
  53125  *      bcm_esw_field_qualify_TafGateId
  53126  * Purpose:
  53127  *      Set match criteria for bcmFieildQualifyTafGateId
  53128  *      qualifier from the field entry.
  53129  * Parameters:
  53130  *      unit    - (IN) Unit number.
  53131  *      entry   - (IN) BCM field entry id.
  53132  *      data    - (IN) Qualifier match data.
  53133  *      mask    - (IN) Qualifier match mask
  53134  * Returns:
  53135  *      BCM_E_XXX
  53136  * Notes:
  53137  */
  53138 int
  53139 bcm_esw_field_qualify_TafGateId(int unit, bcm_field_entry_t entry,
  53140                                 uint32 data, uint32 mask)
  53141 {
  53142     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  53143 
  53144 #if defined(BCM_TSN_SUPPORT)
  53145     if (soc_feature(unit, soc_feature_tsn_taf)) {
  53146         FP_LOCK(unit);
  53147         rv = _field_qualify32(unit, entry, bcmFieldQualifyTafGateId,
  53148                               data, mask);
  53149         FP_UNLOCK(unit);
  53150     }
  53151 #endif /* BCM_TSN_SUPPORT */
  53152 
  53153     return (rv);
  53154 }
  53155 
  53156 /*
  53157  * Function:
  53158  *      bcm_esw_field_qualify_TafGateId_get
  53159  * Purpose:
  53160  *      Get match criteria for bcmFieildQualifyTafGateId
  53161  *      qualifier from the field entry.
  53162  * Parameters:
  53163  *      unit   - (IN) Unit number.
  53164  *      entry  - (IN) BCM field entry id.
  53165  *      data   - (OUT) Qualifier match data.
  53166  *      mask   - (OUT) Qualifier match mask.
  53167  * Returns:
  53168  *      BCM_E_XXX
  53169  * Notes:
  53170  */
  53171 int
  53172 bcm_esw_field_qualify_TafGateId_get(
  53173     int unit,
  53174     bcm_field_entry_t entry,
  53175     uint32 *data, uint32 *mask)
  53176 {
  53177     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  53178 
  53179 #if defined(BCM_TSN_SUPPORT)
  53180     if (soc_feature(unit, soc_feature_tsn_taf)) {
  53181         rv = _bcm_field_entry_qualifier_uint32_get(
  53182                  unit, entry, bcmFieldQualifyTafGateId,
  53183                  data, mask);
  53184     }
  53185 #endif /* BCM_TSN_SUPPORT */
  53186 
  53187     return (rv);
  53188 }
  53189 
  53190 /*
  53191  * Function:
  53192  *      bcm_esw_field_qualify_TafEnable
  53193  * Purpose:
  53194  *      Set match criteria for bcmFieildQualifyTafEnable
  53195  *      qualifier from the field entry.
  53196  * Parameters:
  53197  *      unit    - (IN) Unit number.
  53198  *      entry   - (IN) BCM field entry id.
  53199  *      enable  - (IN) Qualifier match data.
  53200  * Returns:
  53201  *      BCM_E_XXX
  53202  * Notes:
  53203  */
  53204 int
  53205 bcm_esw_field_qualify_TafEnable(int unit, bcm_field_entry_t entry,
  53206                                 uint8 enable)
  53207 {
  53208     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  53209 
  53210 #if defined(BCM_TSN_SUPPORT)
  53211     if (soc_feature(unit, soc_feature_tsn_taf)) {
  53212         FP_LOCK(unit);
  53213         rv = _field_qualify32(unit, entry, bcmFieldQualifyTafEnable,
  53214                               enable, BCM_FIELD_EXACT_MATCH_MASK);
  53215         FP_UNLOCK(unit);
  53216     }
  53217 #endif /* BCM_TSN_SUPPORT */
  53218 
  53219     return (rv);
  53220 }
  53221 
  53222 /*
  53223  * Function:
  53224  *      bcm_esw_field_qualify_TafEnable_get
  53225  * Purpose:
  53226  *      Get match criteria for bcmFieildQualifyTafEnable
  53227  *      qualifier from the field entry.
  53228  * Parameters:
  53229  *      unit   - (IN) Unit number.
  53230  *      entry  - (IN) BCM field entry id.
  53231  *      enable - (OUT) Qualifier match data.
  53232  * Returns:
  53233  *      BCM_E_XXX
  53234  * Notes:
  53235  */
  53236 int
  53237 bcm_esw_field_qualify_TafEnable_get(
  53238     int unit,
  53239     bcm_field_entry_t entry,
  53240     uint8* enable)
  53241 {
  53242     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  53243 
  53244 #if defined(BCM_TSN_SUPPORT)
  53245     if (soc_feature(unit, soc_feature_tsn_taf)) {
  53246         uint8 hw_mask;
  53247 
  53248         rv = _bcm_field_entry_qualifier_uint8_get(
  53249                  unit, entry, bcmFieldQualifyTafEnable,
  53250                  enable, &hw_mask);
  53251     }
  53252 #endif /* BCM_TSN_SUPPORT */
  53253 
  53254     return (rv);
  53255 }
  53256 
  53257 /*
  53258  * Function:
  53259  *      bcm_esw_field_qualify_TafGateState
  53260  * Purpose:
  53261  *      Set match criteria for bcmFieildQualifyTafGateState
  53262  *      qualifier from the field entry.
  53263  * Parameters:
  53264  *      unit    - (IN) Unit number.
  53265  *      entry   - (IN) BCM field entry id.
  53266  *      state   - (IN) Qualifier match data.
  53267  * Returns:
  53268  *      BCM_E_XXX
  53269  * Notes:
  53270  */
  53271 int
  53272 bcm_esw_field_qualify_TafGateState(int unit, bcm_field_entry_t entry,
  53273                                 uint8 state)
  53274 {
  53275     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  53276 
  53277 #if defined(BCM_TSN_SUPPORT)
  53278     if (soc_feature(unit, soc_feature_tsn_taf)) {
  53279         FP_LOCK(unit);
  53280         rv = _field_qualify32(unit, entry, bcmFieldQualifyTafGateState,
  53281                               state, BCM_FIELD_EXACT_MATCH_MASK);
  53282         FP_UNLOCK(unit);
  53283     }
  53284 #endif /* BCM_TSN_SUPPORT */
  53285 
  53286     return (rv);
  53287 }
  53288 
  53289 /*
  53290  * Function:
  53291  *      bcm_esw_field_qualify_TafGateState_get
  53292  * Purpose:
  53293  *      Get match criteria for bcmFieildQualifyTafGateState
  53294  *      qualifier from the field entry.
  53295  * Parameters:
  53296  *      unit   - (IN) Unit number.
  53297  *      entry  - (IN) BCM field entry id.
  53298  *      state  - (OUT) Qualifier match data.
  53299  * Returns:
  53300  *      BCM_E_XXX
  53301  * Notes:
  53302  */
  53303 int
  53304 bcm_esw_field_qualify_TafGateState_get(
  53305     int unit,
  53306     bcm_field_entry_t entry,
  53307     uint8* state)
  53308 {
  53309     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  53310 
  53311 #if defined(BCM_TSN_SUPPORT)
  53312     if (soc_feature(unit, soc_feature_tsn_taf)) {
  53313         uint8 hw_mask;
  53314 
  53315         rv = _bcm_field_entry_qualifier_uint8_get(
  53316                  unit, entry, bcmFieldQualifyTafGateState,
  53317                  state, &hw_mask);
  53318     }
  53319 #endif /* BCM_TSN_SUPPORT */
  53320 
  53321     return (rv);
  53322 }
  53323 
  53324 /*
  53325  * Function:
  53326  *      bcm_esw_field_qualify_TafCosProfile
  53327  * Purpose:
  53328  *      Set match criteria for bcmFieildQualifyTafCosProfile
  53329  *      qualifier from the field entry.
  53330  * Parameters:
  53331  *      unit    - (IN) Unit number.
  53332  *      entry   - (IN) BCM field entry id.
  53333  *      data    - (IN) Qualifier match data.
  53334  *      mask    - (IN) Qualifier match mask
  53335  * Returns:
  53336  *      BCM_E_XXX
  53337  * Notes:
  53338  */
  53339 int
  53340 bcm_esw_field_qualify_TafCosProfile(int unit, bcm_field_entry_t entry,
  53341                                 uint32 data, uint32 mask)
  53342 {
  53343     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  53344 
  53345 #if defined(BCM_TSN_SUPPORT)
  53346     if (soc_feature(unit, soc_feature_tsn_taf)) {
  53347         FP_LOCK(unit);
  53348         rv = _field_qualify32(unit, entry, bcmFieldQualifyTafCosProfile,
  53349                               data, mask);
  53350         FP_UNLOCK(unit);
  53351     }
  53352 #endif /* BCM_TSN_SUPPORT */
  53353 
  53354     return (rv);
  53355 }
  53356 
  53357 /*
  53358  * Function:
  53359  *      bcm_esw_field_qualify_TafCosProfile_get
  53360  * Purpose:
  53361  *      Get match criteria for bcmFieildQualifyTafCosProfile
  53362  *      qualifier from the field entry.
  53363  * Parameters:
  53364  *      unit   - (IN) Unit number.
  53365  *      entry  - (IN) BCM field entry id.
  53366  *      data   - (OUT) Qualifier match data.
  53367  *      mask   - (OUT) Qualifier match mask.
  53368  * Returns:
  53369  *      BCM_E_XXX
  53370  * Notes:
  53371  */
  53372 int
  53373 bcm_esw_field_qualify_TafCosProfile_get(
  53374     int unit,
  53375     bcm_field_entry_t entry,
  53376     uint32 *data, uint32 *mask)
  53377 {
  53378     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  53379 
  53380 #if defined(BCM_TSN_SUPPORT)
  53381     if (soc_feature(unit, soc_feature_tsn_taf)) {
  53382         rv = _bcm_field_entry_qualifier_uint32_get(
  53383                  unit, entry, bcmFieldQualifyTafCosProfile,
  53384                  data, mask);
  53385     }
  53386 #endif /* BCM_TSN_SUPPORT */
  53387 
  53388     return (rv);
  53389 }
  53390 
  53391 
  53392 
  53393 int
  53394 bcm_esw_field_qualify_CnTagPresent(
  53395     int unit,
  53396     bcm_field_entry_t entry,
  53397     uint8 data,
  53398     uint8 mask)
  53399 {
  53400     int rv = BCM_E_UNAVAIL;
  53401 
  53402 #if defined(BCM_TRIDENT3_SUPPORT)
  53403     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53404        FP_LOCK(unit);
  53405        rv = _field_qualify32(unit, entry, bcmFieldQualifyCnTagPresent,
  53406                              data, mask);
  53407        FP_UNLOCK(unit);
  53408     }
  53409 #endif /* BCM_TRIDENT3_SUPPORT */
  53410     return (rv);
  53411 }
  53412 
  53413 int
  53414 bcm_esw_field_qualify_CnTagPresent_get(
  53415     int unit,
  53416     bcm_field_entry_t entry,
  53417     uint8 *data,
  53418     uint8 *mask)
  53419 {
  53420     int rv = BCM_E_UNAVAIL;
  53421 
  53422 #if defined(BCM_TRIDENT3_SUPPORT)
  53423     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53424       /* Read qualifier match value and mask. */
  53425       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53426                                             bcmFieldQualifyCnTagPresent,
  53427                                             data, mask);
  53428     }
  53429 #endif /* BCM_TRIDENT3_SUPPORT */
  53430     return (rv);
  53431 }
  53432 
  53433 int
  53434 bcm_esw_field_qualify_FrontPanelPkt(
  53435     int unit,
  53436     bcm_field_entry_t entry,
  53437     uint8 data,
  53438     uint8 mask)
  53439 {
  53440     int rv = BCM_E_UNAVAIL;
  53441 
  53442 #if defined(BCM_TRIDENT3_SUPPORT)
  53443     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53444        uint8 tcam_data;
  53445        uint8 tcam_mask;
  53446 
  53447        BCM_IF_ERROR_RETURN(_bcm_field_td3_qualify_flow_type(unit,
  53448                                               bcmFieldQualifyFrontPanelPkt,
  53449                                               data, mask, &tcam_data, &tcam_mask));
  53450        FP_LOCK(unit);
  53451        rv = _field_qualify32(unit, entry, bcmFieldQualifyFrontPanelPkt,
  53452                              tcam_data, tcam_mask);
  53453        FP_UNLOCK(unit);
  53454     }
  53455 #endif /* BCM_TRIDENT3_SUPPORT */
  53456     return (rv);
  53457 }
  53458 
  53459 int
  53460 bcm_esw_field_qualify_FrontPanelPkt_get(
  53461     int unit,
  53462     bcm_field_entry_t entry,
  53463     uint8 *data,
  53464     uint8 *mask)
  53465 {
  53466     int rv = BCM_E_UNAVAIL;
  53467 
  53468 #if defined(BCM_TRIDENT3_SUPPORT)
  53469     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53470        uint8 tcam_data;
  53471        uint8 tcam_mask;
  53472        /* Read qualifier match value and mask. */
  53473        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53474                                             bcmFieldQualifyFrontPanelPkt,
  53475                                             &tcam_data, &tcam_mask);
  53476        BCM_IF_ERROR_RETURN(rv);
  53477 
  53478        BCM_IF_ERROR_RETURN(_bcm_field_td3_qualify_flow_type_get(unit,
  53479                                               bcmFieldQualifyFrontPanelPkt,
  53480                                               tcam_data, tcam_mask, data, mask));
  53481     }
  53482 #endif /* BCM_TRIDENT3_SUPPORT */
  53483     return rv;
  53484 }
  53485 
  53486 int
  53487 bcm_esw_field_qualify_IpChecksumOkPkt(
  53488     int unit,
  53489     bcm_field_entry_t entry,
  53490     uint8 data,
  53491     uint8 mask)
  53492 {
  53493     int rv = BCM_E_UNAVAIL;
  53494 
  53495 #if defined(BCM_TRIDENT3_SUPPORT)
  53496     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53497        FP_LOCK(unit);
  53498        rv = _field_qualify32(unit, entry,
  53499                              bcmFieldQualifyIpChecksumOkPkt,
  53500                              data, mask);
  53501        FP_UNLOCK(unit);
  53502     }
  53503 #endif /* BCM_TRIDENT3_SUPPORT */
  53504     return (rv);
  53505 }
  53506 
  53507 int
  53508 bcm_esw_field_qualify_IpChecksumOkPkt_get(
  53509     int unit,
  53510     bcm_field_entry_t entry,
  53511     uint8 *data,
  53512     uint8 *mask)
  53513 {
  53514     int rv = BCM_E_UNAVAIL;
  53515 
  53516 #if defined(BCM_TRIDENT3_SUPPORT)
  53517     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53518       /* Read qualifier match value and mask. */
  53519       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53520                                             bcmFieldQualifyIpChecksumOkPkt,
  53521                                             data, mask);
  53522     }
  53523 #endif /* BCM_TRIDENT3_SUPPORT */
  53524     return rv;
  53525 }
  53526 
  53527 int
  53528 bcm_esw_field_qualify_IpFragPkt(
  53529     int unit,
  53530     bcm_field_entry_t entry,
  53531     uint8 data,
  53532     uint8 mask)
  53533 {
  53534     int rv = BCM_E_UNAVAIL;
  53535 
  53536 #if defined(BCM_TRIDENT3_SUPPORT)
  53537     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53538        FP_LOCK(unit);
  53539        rv = _field_qualify32(unit, entry,
  53540                              bcmFieldQualifyIpFragPkt,
  53541                              data, mask);
  53542        FP_UNLOCK(unit);
  53543     }
  53544 #endif /* BCM_TRIDENT3_SUPPORT */
  53545     return (rv);
  53546 }
  53547 
  53548 int
  53549 bcm_esw_field_qualify_IpFragPkt_get(
  53550     int unit,
  53551     bcm_field_entry_t entry,
  53552     uint8 *data,
  53553     uint8 *mask)
  53554 {
  53555     int rv = BCM_E_UNAVAIL;
  53556 
  53557 #if defined(BCM_TRIDENT3_SUPPORT)
  53558     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53559       /* Read qualifier match value and mask. */
  53560       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53561                                             bcmFieldQualifyIpFragPkt,
  53562                                             data, mask);
  53563     }
  53564 #endif /* BCM_TRIDENT3_SUPPORT */
  53565     return rv;
  53566 }
  53567 
  53568 int
  53569 bcm_esw_field_qualify_OuterPriTaggedPkt(
  53570     int unit,
  53571     bcm_field_entry_t entry,
  53572     uint8 data,
  53573     uint8 mask)
  53574 {
  53575     int rv = BCM_E_UNAVAIL;
  53576 
  53577 #if defined(BCM_TRIDENT3_SUPPORT)
  53578     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53579        FP_LOCK(unit);
  53580        rv = _field_qualify32(unit, entry,
  53581                              bcmFieldQualifyOuterPriTaggedPkt,
  53582                              data, mask);
  53583        FP_UNLOCK(unit);
  53584     }
  53585 #endif /* BCM_TRIDENT3_SUPPORT */
  53586     return (rv);
  53587 }
  53588 
  53589 int
  53590 bcm_esw_field_qualify_OuterPriTaggedPkt_get(
  53591     int unit,
  53592     bcm_field_entry_t entry,
  53593     uint8 *data,
  53594     uint8 *mask)
  53595 {
  53596     int rv = BCM_E_UNAVAIL;
  53597 
  53598 #if defined(BCM_TRIDENT3_SUPPORT)
  53599     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53600       /* Read qualifier match value and mask. */
  53601       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53602                                             bcmFieldQualifyOuterPriTaggedPkt,
  53603                                             data, mask);
  53604     }
  53605 #endif /* BCM_TRIDENT3_SUPPORT */
  53606     return rv;
  53607 }
  53608 
  53609 int
  53610 bcm_esw_field_qualify_IpInIpPkt(
  53611     int unit,
  53612     bcm_field_entry_t entry,
  53613     uint8 data,
  53614     uint8 mask)
  53615 {
  53616     int rv = BCM_E_UNAVAIL;
  53617 
  53618 #if defined(BCM_TRIDENT3_SUPPORT)
  53619     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53620        FP_LOCK(unit);
  53621        rv = _field_qualify32(unit, entry, bcmFieldQualifyIpInIpPkt, data, mask);
  53622        FP_UNLOCK(unit);
  53623     }
  53624 #endif /* BCM_TRIDENT3_SUPPORT */
  53625     return (rv);
  53626 
  53627 }
  53628 
  53629 int
  53630 bcm_esw_field_qualify_IpInIpPkt_get(
  53631     int unit,
  53632     bcm_field_entry_t entry,
  53633     uint8 *data,
  53634     uint8 *mask)
  53635 {
  53636     int rv = BCM_E_UNAVAIL;
  53637 
  53638 #if defined(BCM_TRIDENT3_SUPPORT)
  53639     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53640       /* Read qualifier match value and mask. */
  53641       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53642                                             bcmFieldQualifyIpInIpPkt,
  53643                                             data, mask);
  53644     }
  53645 #endif /* BCM_TRIDENT3_SUPPORT */
  53646     return rv;
  53647 }
  53648 
  53649 int
  53650 bcm_esw_field_qualify_IpTtlZeroPkt(
  53651     int unit,
  53652     bcm_field_entry_t entry,
  53653     uint8 data,
  53654     uint8 mask)
  53655 {
  53656     int rv = BCM_E_UNAVAIL;
  53657 
  53658 #if defined(BCM_TRIDENT3_SUPPORT)
  53659     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53660        FP_LOCK(unit);
  53661        rv = _field_qualify32(unit, entry, bcmFieldQualifyIpTtlZeroPkt,
  53662                              data, mask);
  53663        FP_UNLOCK(unit);
  53664     }
  53665 #endif /* BCM_TRIDENT3_SUPPORT */
  53666 
  53667     return (rv);
  53668 }
  53669 
  53670 int
  53671 bcm_esw_field_qualify_IpTtlZeroPkt_get(
  53672     int unit,
  53673     bcm_field_entry_t entry,
  53674     uint8 *data,
  53675     uint8 *mask)
  53676 {
  53677     int rv = BCM_E_UNAVAIL;
  53678 
  53679 #if defined(BCM_TRIDENT3_SUPPORT)
  53680     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53681       /* Read qualifier match value and mask. */
  53682       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53683                                             bcmFieldQualifyIpTtlZeroPkt,
  53684                                             data, mask);
  53685     }
  53686 #endif /* BCM_TRIDENT3_SUPPORT */
  53687 
  53688     return rv;
  53689 }
  53690 
  53691 int
  53692 bcm_esw_field_qualify_IpmcV4Pkt(
  53693     int unit,
  53694     bcm_field_entry_t entry,
  53695     uint8 data,
  53696     uint8 mask)
  53697 {
  53698     int rv = BCM_E_UNAVAIL;
  53699 
  53700 #if defined(BCM_TRIDENT3_SUPPORT)
  53701     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53702        FP_LOCK(unit);
  53703        rv = _field_qualify32(unit, entry, bcmFieldQualifyIpmcV4Pkt,
  53704                              data, mask);
  53705        FP_UNLOCK(unit);
  53706     }
  53707 #endif /* BCM_TRIDENT3_SUPPORT */
  53708     return (rv);
  53709 }
  53710 
  53711 int
  53712 bcm_esw_field_qualify_IpmcV4Pkt_get(
  53713     int unit,
  53714     bcm_field_entry_t entry,
  53715     uint8 *data,
  53716     uint8 *mask)
  53717 {
  53718     int rv = BCM_E_UNAVAIL;
  53719 
  53720 #if defined(BCM_TRIDENT3_SUPPORT)
  53721     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53722       /* Read qualifier match value and mask. */
  53723       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53724                                                   bcmFieldQualifyIpmcV4Pkt,
  53725                                                   data, mask);
  53726     }
  53727 #endif /* BCM_TRIDENT3_SUPPORT */	
  53728     return rv;
  53729 }
  53730 
  53731 int
  53732 bcm_esw_field_qualify_IpmcV6Pkt(
  53733     int unit,
  53734     bcm_field_entry_t entry,
  53735     uint8 data,
  53736     uint8 mask)
  53737 {
  53738     int rv = BCM_E_UNAVAIL;
  53739 
  53740 #if defined(BCM_TRIDENT3_SUPPORT)
  53741     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53742        FP_LOCK(unit);
  53743        rv = _field_qualify32(unit, entry, bcmFieldQualifyIpmcV6Pkt, data, mask);
  53744        FP_UNLOCK(unit);
  53745     }
  53746 #endif /* BCM_TRIDENT3_SUPPORT */
  53747     return (rv);
  53748 }
  53749 
  53750 int
  53751 bcm_esw_field_qualify_IpmcV6Pkt_get(
  53752     int unit,
  53753     bcm_field_entry_t entry,
  53754     uint8 *data,
  53755     uint8 *mask)
  53756 {
  53757     int rv = BCM_E_UNAVAIL;
  53758 
  53759 #if defined(BCM_TRIDENT3_SUPPORT)
  53760     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53761        /* Read qualifier match value and mask. */
  53762        return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53763                                             bcmFieldQualifyIpmcV6Pkt,
  53764                                             data, mask);
  53765     }
  53766 #endif /* BCM_TRIDENT3_SUPPORT */	
  53767     return rv;
  53768 }
  53769 
  53770 int
  53771 bcm_esw_field_qualify_Ipv4OptionHdrType(
  53772     int unit,
  53773     bcm_field_entry_t entry,
  53774     bcm_field_ip_option_hdr_type_t type)
  53775 {
  53776     int rv = BCM_E_UNAVAIL;
  53777 
  53778 #if defined(BCM_TRIDENT3_SUPPORT)
  53779     uint8 data;
  53780     uint8 mask;
  53781 
  53782     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53783        FP_LOCK(unit);
  53784        rv = _bcm_field_td3_qualify_IpOptionHdrType(unit,
  53785                               bcmFieldQualifyIpv4OptionHdrType,
  53786                               type, &data, &mask);
  53787        if (BCM_FAILURE(rv)) {
  53788           FP_UNLOCK(unit);
  53789           return rv;
  53790        }
  53791 
  53792        rv = _field_qualify32(unit, entry,
  53793                              bcmFieldQualifyIpv4OptionHdrType,
  53794                              data, mask);
  53795        FP_UNLOCK(unit);
  53796      }
  53797 #endif /* BCM_TRIDENT3_SUPPORT */
  53798     return rv;
  53799 }
  53800 
  53801 int
  53802 bcm_esw_field_qualify_Ipv4OptionHdrType_get(
  53803     int unit,
  53804     bcm_field_entry_t entry,
  53805     bcm_field_ip_option_hdr_type_t *type)
  53806 {
  53807     int rv = BCM_E_UNAVAIL;
  53808 
  53809 #if defined(BCM_TRIDENT3_SUPPORT)
  53810     uint8 data;
  53811     uint8 mask;
  53812 
  53813     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53814        /* Read qualifier match value and mask. */
  53815        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53816                                   bcmFieldQualifyIpv4OptionHdrType,
  53817                                   &data, &mask);
  53818        BCM_IF_ERROR_RETURN(rv);
  53819        rv = _bcm_field_td3_qualify_IpOptionHdrType_get(unit,
  53820                                   bcmFieldQualifyIpv4OptionHdrType,
  53821                                   data, mask, type);
  53822     }
  53823 #endif /* BCM_TRIDENT3_SUPPORT */
  53824 
  53825     return rv;
  53826 }
  53827 
  53828 int
  53829 bcm_esw_field_qualify_Ipv6ExtensionHdrType(
  53830     int unit,
  53831     bcm_field_entry_t entry,
  53832     bcm_field_ip_option_hdr_type_t type)
  53833 {
  53834     int rv = BCM_E_UNAVAIL;
  53835 #if defined(BCM_TRIDENT3_SUPPORT)
  53836     uint8 data;
  53837     uint8 mask;
  53838 
  53839     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53840        FP_LOCK(unit);
  53841        rv = _bcm_field_td3_qualify_IpOptionHdrType(unit,
  53842                                bcmFieldQualifyIpv6ExtensionHdrType,
  53843                                type, &data, &mask);
  53844        if (BCM_FAILURE(rv)) {
  53845           FP_UNLOCK(unit);
  53846           return rv;
  53847        }
  53848 
  53849        rv = _field_qualify32(unit, entry,
  53850                              bcmFieldQualifyIpv6ExtensionHdrType,
  53851                              data, mask);
  53852        FP_UNLOCK(unit);
  53853      }
  53854 #endif /* BCM_TRIDENT3_SUPPORT */
  53855 
  53856     return rv;
  53857 }
  53858 
  53859 int
  53860 bcm_esw_field_qualify_Ipv6ExtensionHdrType_get(
  53861     int unit,
  53862     bcm_field_entry_t entry,
  53863     bcm_field_ip_option_hdr_type_t *type)
  53864 {
  53865     int rv = BCM_E_UNAVAIL;
  53866 
  53867 #if defined(BCM_TRIDENT3_SUPPORT)
  53868     uint8 data;
  53869     uint8 mask;
  53870 
  53871     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53872        /* Read qualifier match value and mask. */
  53873        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53874                                   bcmFieldQualifyIpv6ExtensionHdrType,
  53875                                   &data, &mask);
  53876        BCM_IF_ERROR_RETURN(rv);
  53877        rv = _bcm_field_td3_qualify_IpOptionHdrType_get(unit,
  53878                                   bcmFieldQualifyIpv6ExtensionHdrType,
  53879                                   data, mask, type);
  53880     }
  53881 #endif /* BCM_TRIDENT3_SUPPORT */
  53882 
  53883     return rv;
  53884 }
  53885 
  53886 int
  53887 bcm_esw_field_qualify_L2PktType(
  53888     int unit,
  53889     bcm_field_entry_t entry,
  53890     bcm_field_l2_pkt_type_t type)
  53891 {
  53892     int rv = BCM_E_UNAVAIL;
  53893 
  53894 #if defined(BCM_TRIDENT3_SUPPORT)
  53895     uint8 data;
  53896     uint8 mask;
  53897 
  53898     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53899        FP_LOCK(unit);
  53900        rv = _bcm_field_td3_qualify_L2PktType(unit, type, &data, &mask);
  53901        if (BCM_FAILURE(rv)) {
  53902           FP_UNLOCK(unit);
  53903           return rv;
  53904        }
  53905 
  53906        rv = _field_qualify32(unit, entry,
  53907                              bcmFieldQualifyL2PktType,
  53908                              data, mask);
  53909        FP_UNLOCK(unit);
  53910      }
  53911 #endif /* BCM_TRIDENT3_SUPPORT */
  53912     return (rv);
  53913 }
  53914 
  53915 int
  53916 bcm_esw_field_qualify_L2PktType_get(
  53917     int unit,
  53918     bcm_field_entry_t entry,
  53919     bcm_field_l2_pkt_type_t *type)
  53920 {
  53921     int rv = BCM_E_UNAVAIL;
  53922 
  53923 #if defined(BCM_TRIDENT3_SUPPORT)
  53924     uint8 data;
  53925     uint8 mask;
  53926 
  53927     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53928        /* Read qualifier match value and mask. */
  53929        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53930                                             bcmFieldQualifyL2PktType,
  53931                                             &data, &mask);
  53932        BCM_IF_ERROR_RETURN(rv);
  53933        rv = _bcm_field_td3_qualify_L2PktType_get(unit, data, mask, type);
  53934     }
  53935 #endif /* BCM_TRIDENT3_SUPPORT */
  53936     return (rv);
  53937 }
  53938 
  53939 int
  53940 bcm_esw_field_qualify_MplsCwPresent(
  53941     int unit,
  53942     bcm_field_entry_t entry,
  53943     uint8 data,
  53944     uint8 mask)
  53945 {
  53946     int rv = BCM_E_UNAVAIL;
  53947 
  53948 #if defined(BCM_TRIDENT3_SUPPORT)
  53949     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53950        uint8 hw_data;
  53951        uint8 hw_mask;
  53952 
  53953        rv = _bcm_field_td3_qualify_MplsType(unit, bcmFieldQualifyMplsCwPresent,
  53954                                                data, mask, &hw_data, &hw_mask);
  53955        BCM_IF_ERROR_RETURN(rv);
  53956        FP_LOCK(unit);
  53957        rv = _field_qualify32(unit, entry, bcmFieldQualifyMplsCwPresent,
  53958                              hw_data, hw_mask);
  53959        FP_UNLOCK(unit);
  53960     }
  53961 #endif /* BCM_TRIDENT3_SUPPORT */
  53962     return (rv);
  53963 }
  53964 
  53965 int
  53966 bcm_esw_field_qualify_MplsCwPresent_get(
  53967     int unit,
  53968     bcm_field_entry_t entry,
  53969     uint8 *data,
  53970     uint8 *mask)
  53971 {
  53972     int rv = BCM_E_UNAVAIL;
  53973 	
  53974 #if defined(BCM_TRIDENT3_SUPPORT)
  53975     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  53976        uint8 hw_data;
  53977        uint8 hw_mask;
  53978 
  53979        FP_LOCK(unit);
  53980        /* Read qualifier match value and mask. */
  53981        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  53982                                             bcmFieldQualifyMplsCwPresent,
  53983                                             &hw_data, &hw_mask);
  53984        FP_UNLOCK(unit);
  53985        if (BCM_SUCCESS(rv)) {
  53986           rv = _bcm_field_td3_qualify_MplsType_get(unit,
  53987                            bcmFieldQualifyMplsCwPresent,
  53988                           hw_data, hw_mask, data, mask);
  53989        }
  53990     }
  53991 #endif /* BCM_TRIDENT3_SUPPORT */
  53992     return (rv);
  53993 }
  53994 
  53995 int
  53996 bcm_esw_field_qualify_MplsMcastEthertypePresent(
  53997     int unit,
  53998     bcm_field_entry_t entry,
  53999     uint8 data,
  54000     uint8 mask)
  54001 {
  54002     int rv = BCM_E_UNAVAIL;
  54003 
  54004 #if defined(BCM_TRIDENT3_SUPPORT)
  54005     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54006        uint8 hw_data;
  54007        uint8 hw_mask;
  54008 
  54009        rv = _bcm_field_td3_qualify_MplsType
  54010               (unit,
  54011                bcmFieldQualifyMplsMcastEthertypePresent,
  54012                data, mask, &hw_data, &hw_mask);
  54013        BCM_IF_ERROR_RETURN(rv);
  54014 
  54015        FP_LOCK(unit);
  54016        rv = _field_qualify32
  54017                (unit, entry,
  54018                 bcmFieldQualifyMplsMcastEthertypePresent,
  54019                 hw_data, hw_mask);
  54020        FP_UNLOCK(unit);
  54021     }
  54022 #endif /* BCM_TRIDENT3_SUPPORT */
  54023 
  54024     return (rv);
  54025 }
  54026 
  54027 int
  54028 bcm_esw_field_qualify_MplsMcastEthertypePresent_get(
  54029     int unit,
  54030     bcm_field_entry_t entry,
  54031     uint8 *data,
  54032     uint8 *mask)
  54033 {
  54034     int rv = BCM_E_UNAVAIL;
  54035 	
  54036 #if defined(BCM_TRIDENT3_SUPPORT)
  54037     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54038        uint8 hw_data;
  54039        uint8 hw_mask;
  54040 
  54041        FP_LOCK(unit);
  54042        /* Read qualifier match value and mask. */
  54043        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54044                     bcmFieldQualifyMplsMcastEthertypePresent,
  54045                                          &hw_data, &hw_mask);
  54046 
  54047        FP_UNLOCK(unit);
  54048        if (BCM_SUCCESS(rv)) {
  54049           rv = _bcm_field_td3_qualify_MplsType_get
  54050                    (unit,
  54051                     bcmFieldQualifyMplsMcastEthertypePresent,
  54052                     hw_data, hw_mask, data, mask);
  54053        }
  54054     }
  54055 #endif /* BCM_TRIDENT3_SUPPORT */
  54056  
  54057     return (rv);
  54058 }
  54059 
  54060 int
  54061 bcm_esw_field_qualify_NetworkTagMulticastPkt(
  54062     int unit,
  54063     bcm_field_entry_t entry,
  54064     uint8 data,
  54065     uint8 mask)
  54066 {
  54067     int rv = BCM_E_UNAVAIL;
  54068 
  54069 #if defined(BCM_TRIDENT3_SUPPORT)
  54070     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54071        FP_LOCK(unit);
  54072        rv = _field_qualify32(unit, entry, bcmFieldQualifyNetworkTagMulticastPkt,
  54073                              data, mask);
  54074        FP_UNLOCK(unit);
  54075     }
  54076 #endif /* BCM_TRIDENT3_SUPPORT */
  54077     return (rv);
  54078 }
  54079 
  54080 int
  54081 bcm_esw_field_qualify_NetworkTagMulticastPkt_get(
  54082     int unit,
  54083     bcm_field_entry_t entry,
  54084     uint8 *data,
  54085     uint8 *mask)
  54086 {
  54087     int rv = BCM_E_UNAVAIL;
  54088 	
  54089 #if defined(BCM_TRIDENT3_SUPPORT)
  54090     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54091        /* Read qualifier match value and mask. */
  54092        return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54093                                             bcmFieldQualifyNetworkTagMulticastPkt,
  54094                                             data, mask);
  54095     }
  54096 #endif /* BCM_TRIDENT3_SUPPORT */
  54097     return (rv);
  54098 }
  54099 
  54100 int
  54101 bcm_esw_field_qualify_HiGigProxyTunnelType(
  54102     int unit,
  54103     bcm_field_entry_t entry,
  54104     bcm_field_higig_proxy_tunnel_type_t type)
  54105 {
  54106     int rv = BCM_E_UNAVAIL;
  54107 	
  54108 #if defined(BCM_TRIDENT3_SUPPORT)
  54109     uint8 data;
  54110     uint8 mask;
  54111 
  54112     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54113        int qual_id = bcmFieldQualifyHiGigProxyTunnelType; 
  54114 
  54115        FP_LOCK(unit);
  54116        rv =  _bcm_field_td3_qualify_HiGigProxyTunnelType(type, &data, &mask);
  54117        if (BCM_FAILURE(rv)) {
  54118           FP_UNLOCK(unit);
  54119           return rv;
  54120        }
  54121 
  54122        rv = _field_qualify32(unit, entry, qual_id,
  54123                              data, mask);
  54124        FP_UNLOCK(unit);
  54125      }
  54126 #endif /* BCM_TRIDENT3_SUPPORT */
  54127     return (rv);
  54128 }
  54129 
  54130 int
  54131 bcm_esw_field_qualify_HiGigProxyTunnelType_get(
  54132     int unit,
  54133     bcm_field_entry_t entry,
  54134     bcm_field_higig_proxy_tunnel_type_t *type)
  54135 {
  54136     int rv = BCM_E_UNAVAIL;
  54137 
  54138 #if defined(BCM_TRIDENT3_SUPPORT)
  54139     uint8 data;
  54140     uint8 mask;
  54141 
  54142     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54143        int qual_id = bcmFieldQualifyHiGigProxyTunnelType;
  54144  
  54145        /* Read qualifier match value and mask. */
  54146        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, qual_id,
  54147                                                  &data, &mask);
  54148        BCM_IF_ERROR_RETURN(rv);  
  54149        rv = _bcm_field_td3_qualify_HiGigProxyTunnelType_get(data, mask, type);
  54150     }
  54151 #endif /* BCM_TRIDENT3_SUPPORT */
  54152     return (rv);
  54153 }
  54154 
  54155 int
  54156 bcm_esw_field_qualify_NetworkTagType(
  54157     int unit,
  54158     bcm_field_entry_t entry,
  54159     bcm_field_network_tag_type_t type)
  54160 {
  54161     int rv = BCM_E_UNAVAIL;
  54162 	
  54163 #if defined(BCM_TRIDENT3_SUPPORT)
  54164     uint8 data;
  54165     uint8 mask;
  54166 
  54167     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54168        FP_LOCK(unit);
  54169        rv = _bcm_field_td3_qualify_NetworkTagType(unit, type, &data, &mask);
  54170        if (BCM_FAILURE(rv)) {
  54171           FP_UNLOCK(unit);
  54172           return rv;
  54173        }
  54174 
  54175        rv = _field_qualify32(unit, entry, bcmFieldQualifyNetworkTagType,
  54176                              data, mask);
  54177        FP_UNLOCK(unit);
  54178      }
  54179 #endif /* BCM_TRIDENT3_SUPPORT */
  54180     return (rv);
  54181 }
  54182 
  54183 int
  54184 bcm_esw_field_qualify_NetworkTagType_get(
  54185     int unit,
  54186     bcm_field_entry_t entry,
  54187     bcm_field_network_tag_type_t *type)
  54188 {
  54189     int rv = BCM_E_UNAVAIL;
  54190 
  54191 #if defined(BCM_TRIDENT3_SUPPORT)
  54192     uint8 data;
  54193     uint8 mask;
  54194 
  54195     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54196        /* Read qualifier match value and mask. */
  54197        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54198                                             bcmFieldQualifyNetworkTagType,
  54199                                             &data, &mask);
  54200        BCM_IF_ERROR_RETURN(rv);  
  54201        rv = _bcm_field_td3_qualify_NetworkTagType_get(unit, data, mask, type);
  54202     }
  54203 #endif /* BCM_TRIDENT3_SUPPORT */
  54204     return (rv);
  54205 }
  54206 
  54207 int
  54208 bcm_esw_field_qualify_OverlayIpv4OptionHdrType(
  54209     int unit,
  54210     bcm_field_entry_t entry,
  54211     bcm_field_ip_option_hdr_type_t type)
  54212 {
  54213     int rv = BCM_E_UNAVAIL;
  54214 
  54215 #if defined(BCM_TRIDENT3_SUPPORT)
  54216     uint8 data;
  54217     uint8 mask;
  54218 
  54219     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54220        FP_LOCK(unit);
  54221        rv = _bcm_field_td3_qualify_IpOptionHdrType(unit,
  54222                              bcmFieldQualifyOverlayIpv4OptionHdrType,
  54223                              type, &data, &mask);
  54224        if (BCM_FAILURE(rv)) {
  54225           FP_UNLOCK(unit);
  54226           return rv;
  54227        }
  54228 
  54229        rv = _field_qualify32(unit, entry,
  54230                              bcmFieldQualifyOverlayIpv4OptionHdrType,
  54231                              data, mask);
  54232        FP_UNLOCK(unit);
  54233      }
  54234 #endif /* BCM_TRIDENT3_SUPPORT */
  54235     return (rv);
  54236 }
  54237 
  54238 int
  54239 bcm_esw_field_qualify_OverlayIpv4OptionHdrType_get(
  54240     int unit,
  54241     bcm_field_entry_t entry,
  54242     bcm_field_ip_option_hdr_type_t *type)
  54243 {
  54244     int rv = BCM_E_UNAVAIL;
  54245 
  54246 #if defined(BCM_TRIDENT3_SUPPORT)
  54247     uint8 data;
  54248     uint8 mask;
  54249 
  54250     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54251        /* Read qualifier match value and mask. */
  54252        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54253                                   bcmFieldQualifyOverlayIpv4OptionHdrType,
  54254                                   &data, &mask);
  54255        BCM_IF_ERROR_RETURN(rv);
  54256        rv = _bcm_field_td3_qualify_IpOptionHdrType_get(unit,
  54257                               bcmFieldQualifyOverlayIpv4OptionHdrType,
  54258                               data, mask, type);
  54259     }
  54260 #endif /* BCM_TRIDENT3_SUPPORT */
  54261     return (rv);
  54262 }
  54263 
  54264 int
  54265 bcm_esw_field_qualify_OverlayIpv6ExtensionHdrType(
  54266     int unit,
  54267     bcm_field_entry_t entry,
  54268     bcm_field_ip_option_hdr_type_t type)
  54269 {
  54270     int rv = BCM_E_UNAVAIL;
  54271 #if defined(BCM_TRIDENT3_SUPPORT)
  54272     uint8 data;
  54273     uint8 mask;
  54274 
  54275     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54276        FP_LOCK(unit);
  54277        rv = _bcm_field_td3_qualify_IpOptionHdrType(unit,
  54278                              bcmFieldQualifyOverlayIpv6ExtensionHdrType,
  54279                              type, &data, &mask);
  54280        if (BCM_FAILURE(rv)) {
  54281           FP_UNLOCK(unit);
  54282           return rv;
  54283        }
  54284 
  54285        rv = _field_qualify32(unit, entry,
  54286                              bcmFieldQualifyOverlayIpv6ExtensionHdrType,
  54287                              data, mask);
  54288        FP_UNLOCK(unit);
  54289      }
  54290 #endif /* BCM_TRIDENT3_SUPPORT */
  54291 
  54292     return (rv);
  54293 }
  54294 
  54295 int
  54296 bcm_esw_field_qualify_OverlayIpv6ExtensionHdrType_get(
  54297     int unit,
  54298     bcm_field_entry_t entry,
  54299     bcm_field_ip_option_hdr_type_t *type)
  54300 {
  54301     int rv = BCM_E_UNAVAIL;
  54302 
  54303 #if defined(BCM_TRIDENT3_SUPPORT)
  54304     uint8 data;
  54305     uint8 mask;
  54306 
  54307     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54308        /* Read qualifier match value and mask. */
  54309        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54310                                   bcmFieldQualifyOverlayIpv6ExtensionHdrType,
  54311                                   &data, &mask);
  54312        BCM_IF_ERROR_RETURN(rv);
  54313        rv = _bcm_field_td3_qualify_IpOptionHdrType_get(unit,
  54314                                   bcmFieldQualifyOverlayIpv6ExtensionHdrType,
  54315                                   data, mask, type);
  54316     }
  54317 #endif /* BCM_TRIDENT3_SUPPORT */
  54318 
  54319     return (rv);
  54320 }
  54321 
  54322 int
  54323 bcm_esw_field_qualify_OverlayL2PktType(
  54324     int unit,
  54325     bcm_field_entry_t entry,
  54326     bcm_field_l2_pkt_type_t type)
  54327 {
  54328     int rv = BCM_E_UNAVAIL;
  54329 
  54330 #if defined(BCM_TRIDENT3_SUPPORT)
  54331     uint8 data;
  54332     uint8 mask;
  54333     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54334        FP_LOCK(unit);
  54335        rv = _bcm_field_td3_qualify_L2PktType(unit, type, &data, &mask);
  54336        if (BCM_FAILURE(rv)) {
  54337           FP_UNLOCK(unit);
  54338           return rv;
  54339        }
  54340 
  54341        rv = _field_qualify32(unit, entry,
  54342                              bcmFieldQualifyOverlayL2PktType,
  54343                              data, mask);
  54344        FP_UNLOCK(unit);
  54345      }
  54346 #endif /* BCM_TRIDENT3_SUPPORT */
  54347     return (rv);
  54348 }
  54349 
  54350 int
  54351 bcm_esw_field_qualify_OverlayL2PktType_get(
  54352     int unit,
  54353     bcm_field_entry_t entry,
  54354     bcm_field_l2_pkt_type_t *type)
  54355 {
  54356     int rv = BCM_E_UNAVAIL;
  54357 
  54358 #if defined(BCM_TRIDENT3_SUPPORT)
  54359     uint8 data;
  54360     uint8 mask;
  54361 
  54362     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54363        /* Read qualifier match value and mask. */
  54364        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54365                                             bcmFieldQualifyOverlayL2PktType,
  54366                                             &data, &mask);
  54367        BCM_IF_ERROR_RETURN(rv);
  54368        rv = _bcm_field_td3_qualify_L2PktType_get(unit, data, mask, type);
  54369     }
  54370 #endif /* BCM_TRIDENT3_SUPPORT */
  54371     return (rv);
  54372 }
  54373 
  54374 int
  54375 bcm_esw_field_qualify_OverlayPktType(
  54376     int unit,
  54377     bcm_field_entry_t entry,
  54378     bcm_field_pkt_type_t type)
  54379 {
  54380     int rv = BCM_E_UNAVAIL;
  54381 
  54382 #if defined (BCM_TRIDENT3_SUPPORT)
  54383     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54384        uint32 data, mask;
  54385 
  54386        /* Overlay fields doesn't support MPLS and FCoE packet types */
  54387        if ((type >= bcmFieldPktTypeMplsNot) && (type <= bcmFieldPktTypeFCoEFip)) {
  54388           return BCM_E_PARAM;
  54389        }
  54390 
  54391        BCM_IF_ERROR_RETURN(_bcm_field_td3_qualify_PktType(unit, type,
  54392                                                           &data, &mask));
  54393        FP_LOCK(unit);
  54394        rv = _field_qualify32(unit, entry, bcmFieldQualifyOverlayPktType, data, mask);
  54395        FP_UNLOCK(unit);
  54396     }
  54397 #endif /* BCM_TRIDENT3_SUPPORT */
  54398 
  54399     return rv;
  54400 }
  54401 
  54402 int
  54403 bcm_esw_field_qualify_OverlayPktType_get(
  54404     int unit,
  54405     bcm_field_entry_t entry,
  54406     bcm_field_pkt_type_t *type)
  54407 {
  54408     int rv = BCM_E_UNAVAIL;
  54409 
  54410 #if defined (BCM_TRIDENT3_SUPPORT)
  54411     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54412        uint32 data, mask;
  54413 
  54414        /* Read qualifier match value and mask. */ 
  54415        rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  54416                                            bcmFieldQualifyOverlayPktType,
  54417                                            &data, &mask);
  54418        BCM_IF_ERROR_RETURN(rv);
  54419 
  54420        rv = (_bcm_field_td3_qualify_PktType_get(unit, data, mask, type));
  54421     }
  54422 #endif /* BCM_TRIDENT3_SUPPORT */
  54423 
  54424     return rv;
  54425 }
  54426 
  54427 int
  54428 bcm_esw_field_qualify_OverlayVlanFormat(
  54429     int unit,
  54430     bcm_field_entry_t entry,
  54431     uint8 data,
  54432     uint8 mask)
  54433 {
  54434     int rv = BCM_E_UNAVAIL;
  54435 
  54436 #if defined(BCM_TRIDENT3_SUPPORT)
  54437     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54438        uint8 hw_data, hw_mask;
  54439        FP_LOCK(unit);
  54440 
  54441        rv = (_bcm_field_td3_qualify_VlanFormat(
  54442                             unit, bcmFieldQualifyOverlayVlanFormat,
  54443                             data, mask,
  54444                             &hw_data, &hw_mask));
  54445 
  54446        if (BCM_SUCCESS(rv)) {
  54447           rv = _field_qualify32(unit, entry,
  54448                                 bcmFieldQualifyOverlayVlanFormat,
  54449                                 hw_data, hw_mask);
  54450        }
  54451        FP_UNLOCK(unit);
  54452     }
  54453 #endif /* BCM_TRIDENT3_SUPPORT */
  54454 
  54455     return (rv);
  54456 }
  54457 
  54458 
  54459 int
  54460 bcm_esw_field_qualify_OverlayVlanFormat_get(
  54461     int unit,
  54462     bcm_field_entry_t entry,
  54463     uint8 *data,
  54464     uint8 *mask)
  54465 {
  54466     int rv = BCM_E_UNAVAIL;
  54467 #if defined(BCM_TRIDENT3_SUPPORT)
  54468     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54469        uint8 hw_data, hw_mask;
  54470        FP_LOCK(unit);
  54471 
  54472        /* Read qualifier match value and mask. */
  54473        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54474                                                  bcmFieldQualifyOverlayVlanFormat,
  54475                                                  &hw_data, &hw_mask);
  54476 
  54477        if (BCM_SUCCESS(rv)) {
  54478            rv = (_bcm_field_td3_qualify_VlanFormat_get(
  54479                             unit, bcmFieldQualifyOverlayVlanFormat,
  54480                             hw_data, hw_mask,
  54481                             data, mask));
  54482        }
  54483        FP_UNLOCK(unit);
  54484     }
  54485 #endif /* BCM_TRIDENT3_SUPPORT */
  54486     return (rv);
  54487 
  54488 }
  54489 
  54490 int
  54491 bcm_esw_field_qualify_PimBidirDfStatus(
  54492     int unit,
  54493     bcm_field_entry_t entry,
  54494     uint8 data,
  54495     uint8 mask)
  54496 {
  54497     int rv = BCM_E_UNAVAIL;
  54498 
  54499 #if defined(BCM_TRIDENT3_SUPPORT)
  54500     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54501        FP_LOCK(unit);
  54502        data = (data & 1) ? 0 : 1;
  54503        rv = _field_qualify32(unit, entry, bcmFieldQualifyPimBidirDfStatus,
  54504                              data, mask);
  54505        FP_UNLOCK(unit);
  54506     }
  54507 #endif /* BCM_TRIDENT3_SUPPORT */
  54508     return (rv);
  54509 }
  54510 
  54511 int
  54512 bcm_esw_field_qualify_PimBidirDfStatus_get(
  54513     int unit,
  54514     bcm_field_entry_t entry,
  54515     uint8 *data,
  54516     uint8 *mask)
  54517 {
  54518     int rv = BCM_E_UNAVAIL;
  54519 	
  54520 #if defined(BCM_TRIDENT3_SUPPORT)
  54521     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54522        /* Read qualifier match value and mask. */
  54523        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54524                                             bcmFieldQualifyPimBidirDfStatus,
  54525                                             data, mask);
  54526        BCM_IF_ERROR_RETURN(rv);
  54527        *data = (*data == 1) ? 0 : 1;
  54528     }
  54529 #endif /* BCM_TRIDENT3_SUPPORT */
  54530     return (rv);
  54531 }
  54532 
  54533 int
  54534 bcm_esw_field_qualify_PktType(
  54535     int unit,
  54536     bcm_field_entry_t entry,
  54537     bcm_field_pkt_type_t type)
  54538 {
  54539     int rv = BCM_E_UNAVAIL;
  54540 
  54541 #if defined (BCM_TRIDENT3_SUPPORT)
  54542     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54543        uint32 data, mask;
  54544 
  54545        BCM_IF_ERROR_RETURN(_bcm_field_td3_qualify_PktType(unit, type,
  54546                                                           &data, &mask));
  54547        FP_LOCK(unit);
  54548        rv = _field_qualify32(unit, entry, bcmFieldQualifyPktType, data, mask);
  54549        FP_UNLOCK(unit);
  54550     }
  54551 #endif /* BCM_TRIDENT3_SUPPORT */
  54552     return (rv);
  54553 }
  54554 
  54555 int
  54556 bcm_esw_field_qualify_PktType_get(
  54557     int unit,
  54558     bcm_field_entry_t entry,
  54559     bcm_field_pkt_type_t *type)
  54560 {
  54561     int rv = BCM_E_UNAVAIL;
  54562 
  54563 #if defined (BCM_TRIDENT3_SUPPORT)
  54564     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54565        uint32 data, mask;
  54566 
  54567        /* Read qualifier match value and mask. */ 
  54568        rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  54569                                                   bcmFieldQualifyPktType,
  54570                                                   &data, &mask);
  54571        BCM_IF_ERROR_RETURN(rv);
  54572 
  54573        rv = (_bcm_field_td3_qualify_PktType_get(unit, data, mask, type));
  54574     }
  54575 #endif /* BCM_TRIDENT3_SUPPORT */
  54576     return rv;
  54577 }
  54578 
  54579 
  54580 int
  54581 bcm_esw_field_qualify_SubportTagPresent(
  54582     int unit,
  54583     bcm_field_entry_t entry,
  54584     uint8 data,
  54585     uint8 mask)
  54586 {
  54587     int rv = BCM_E_UNAVAIL;
  54588 
  54589 #if defined(BCM_TRIDENT3_SUPPORT)
  54590     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54591        FP_LOCK(unit);
  54592        rv = _field_qualify32(unit, entry, bcmFieldQualifySubportTagPresent,
  54593                              data, mask);
  54594        FP_UNLOCK(unit);
  54595     }
  54596 #endif /* BCM_TRIDENT3_SUPPORT */
  54597     return (rv);
  54598 }
  54599 
  54600 int
  54601 bcm_esw_field_qualify_SubportTagPresent_get(
  54602     int unit,
  54603     bcm_field_entry_t entry,
  54604     uint8 *data,
  54605     uint8 *mask)
  54606 {
  54607     int rv = BCM_E_UNAVAIL;
  54608 	
  54609 #if defined(BCM_TRIDENT3_SUPPORT)
  54610     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54611       /* Read qualifier match value and mask. */
  54612       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54613                                             bcmFieldQualifySubportTagPresent,
  54614                                             data, mask);
  54615     }
  54616 #endif /* BCM_TRIDENT3_SUPPORT */
  54617     return (rv);
  54618 }
  54619 
  54620 int
  54621 bcm_esw_field_qualify_SysHdrType(
  54622     int unit,
  54623     bcm_field_entry_t entry,
  54624     bcm_field_sys_hdr_type_t type)
  54625 {
  54626     int rv = BCM_E_UNAVAIL;
  54627 
  54628 #if defined(BCM_TRIDENT3_SUPPORT)
  54629     uint8 data;
  54630     uint8 mask;
  54631 
  54632     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54633        FP_LOCK(unit);
  54634        rv = _bcm_field_td3_qualify_SysHdrType(unit, type, &data, &mask);
  54635        if (BCM_FAILURE(rv)) {
  54636           FP_UNLOCK(unit);
  54637           return rv;
  54638        }
  54639 
  54640        rv = _field_qualify32(unit, entry, bcmFieldQualifySysHdrType,
  54641                              data, mask);
  54642        FP_UNLOCK(unit);
  54643      }
  54644 #endif /* BCM_TRIDENT3_SUPPORT */
  54645     return (rv);
  54646 }
  54647 
  54648 int
  54649 bcm_esw_field_qualify_SysHdrType_get(
  54650     int unit,
  54651     bcm_field_entry_t entry,
  54652     bcm_field_sys_hdr_type_t *type)
  54653 {
  54654     int rv = BCM_E_UNAVAIL;
  54655 
  54656 #if defined(BCM_TRIDENT3_SUPPORT)
  54657     uint8 data;
  54658     uint8 mask;
  54659 
  54660     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54661        /* Read qualifier match value and mask. */
  54662        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54663                                                  bcmFieldQualifySysHdrType,
  54664                                                  &data, &mask);
  54665        BCM_IF_ERROR_RETURN(rv);
  54666        rv = _bcm_field_td3_qualify_SysHdrType_get(unit, data, mask, type);
  54667     }
  54668 #endif /* BCM_TRIDENT3_SUPPORT */
  54669     return (rv);
  54670 }
  54671 
  54672 int
  54673 bcm_esw_field_qualify_InterfaceClassL2Type(
  54674     int unit,
  54675     bcm_field_entry_t entry,
  54676     bcm_field_interface_class_l2_type_t type)
  54677 {
  54678     int rv = BCM_E_UNAVAIL;
  54679 	
  54680 #if defined(BCM_TRIDENT3_SUPPORT)
  54681     uint8 data;
  54682     uint8 mask;
  54683 
  54684     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54685        int qual_id = bcmFieldQualifyInterfaceClassL2Type; 
  54686 
  54687        rv =  _bcm_field_td3_qualify_InterfaceClassL2Type(type, &data, &mask);
  54688        BCM_IF_ERROR_RETURN(rv);  
  54689 
  54690        FP_LOCK(unit);
  54691        rv = _field_qualify32(unit, entry, qual_id,
  54692                              data, mask);
  54693        FP_UNLOCK(unit);
  54694      }
  54695 #endif /* BCM_TRIDENT3_SUPPORT */
  54696     return (rv);
  54697 }
  54698 
  54699 int
  54700 bcm_esw_field_qualify_InterfaceClassL2Type_get(
  54701     int unit,
  54702     bcm_field_entry_t entry,
  54703     bcm_field_interface_class_l2_type_t *type)
  54704 {
  54705     int rv = BCM_E_UNAVAIL;
  54706 
  54707 #if defined(BCM_TRIDENT3_SUPPORT)
  54708     uint8 data;
  54709     uint8 mask;
  54710 
  54711     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54712        int qual_id = bcmFieldQualifyInterfaceClassL2Type;
  54713  
  54714        FP_LOCK(unit);
  54715        /* Read qualifier match value and mask. */
  54716        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, qual_id,
  54717                                                  &data, &mask);
  54718        FP_UNLOCK(unit);
  54719        BCM_IF_ERROR_RETURN(rv);  
  54720        rv = _bcm_field_td3_qualify_InterfaceClassL2Type_get(data, mask, type);
  54721     }
  54722 #endif /* BCM_TRIDENT3_SUPPORT */
  54723     return (rv);
  54724 }
  54725 
  54726 int 
  54727 bcm_esw_field_qualify_IntPktFinalHop(
  54728     int unit, 
  54729     bcm_field_entry_t entry, 
  54730     uint8 data, 
  54731     uint8 mask)
  54732 {
  54733     int rv = BCM_E_UNAVAIL;
  54734 
  54735 #if defined(BCM_TRIDENT3_SUPPORT)
  54736     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54737        uint8 d;
  54738 
  54739        if (data & ~1) {
  54740           return BCM_E_PARAM;
  54741        }
  54742 
  54743        d = (data == 0) ? 1 : 0;
  54744 
  54745        FP_LOCK(unit);
  54746        rv = _field_qualify32(unit, entry,
  54747                              bcmFieldQualifyIntPktFinalHop,
  54748                              d, mask);
  54749        FP_UNLOCK(unit);
  54750     }
  54751 #endif /* BCM_TRIDENT3_SUPPORT */
  54752     return rv;
  54753 
  54754 }
  54755 
  54756 int 
  54757 bcm_esw_field_qualify_IntPktFinalHop_get(
  54758     int unit, 
  54759     bcm_field_entry_t entry, 
  54760     uint8 *data, 
  54761     uint8 *mask)
  54762 {
  54763     int rv = BCM_E_UNAVAIL;
  54764 
  54765 #if defined(BCM_TRIDENT3_SUPPORT)
  54766     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54767        FP_LOCK(unit);
  54768        /* Read qualifier match value and mask. */
  54769        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54770                                             bcmFieldQualifyIntPktFinalHop,
  54771                                             data, mask);
  54772        FP_UNLOCK(unit);
  54773 
  54774        if (BCM_SUCCESS(rv) && (*mask & 1)) {
  54775           *data = (*data == 0) ? 1 : 0;
  54776        }
  54777     }
  54778 #endif /* BCM_TRIDENT3_SUPPORT */
  54779 
  54780     return rv;
  54781 }
  54782 
  54783 int 
  54784 bcm_esw_field_qualify_IntPktType(
  54785     int unit, 
  54786     bcm_field_entry_t entry, 
  54787     bcm_field_int_pkt_type_t type)
  54788 {
  54789     int rv = BCM_E_UNAVAIL;
  54790 
  54791 #if defined(BCM_TRIDENT3_SUPPORT)
  54792     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54793        uint32 data, mask;
  54794  
  54795        FP_LOCK(unit);
  54796        if (type == bcmFieldIntPktTypeProbeRequest) {
  54797           data = 0x1;
  54798        } else {
  54799           data = 0x0;
  54800        }
  54801        mask = 0x1;
  54802         
  54803        rv = _field_qualify32(unit, entry,
  54804                              bcmFieldQualifyIntPktType,
  54805                              data, mask);
  54806        FP_UNLOCK(unit);
  54807     }
  54808 #endif /* BCM_TRIDENT3_SUPPORT */
  54809     return rv;
  54810 
  54811 }
  54812 
  54813 int 
  54814 bcm_esw_field_qualify_IntPktType_get(
  54815     int unit, 
  54816     bcm_field_entry_t entry, 
  54817     bcm_field_int_pkt_type_t *type)
  54818 {
  54819     int rv = BCM_E_UNAVAIL;
  54820 
  54821 #if defined(BCM_TRIDENT3_SUPPORT)
  54822     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54823        uint8 data = 0;
  54824        uint8 mask = 0;
  54825 
  54826        if (type == NULL) {
  54827           return BCM_E_PARAM;
  54828        }
  54829 
  54830        FP_LOCK(unit);
  54831        /* Read qualifier match value and mask. */
  54832        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54833                                             bcmFieldQualifyIntPktType,
  54834                                             &data, &mask);
  54835        FP_UNLOCK(unit);
  54836        BCM_IF_ERROR_RETURN(rv);
  54837 
  54838        if (mask == 0x1) {
  54839           if (data == 0x1) {
  54840              *type = bcmFieldIntPktTypeProbeRequest;
  54841           } else if (data == 0x0) {
  54842              *type = bcmFieldIntPktTypeProbeReply;
  54843           }
  54844        } 
  54845     }
  54846 #endif /* BCM_TRIDENT3_SUPPORT */
  54847 
  54848     return rv;
  54849 }
  54850 
  54851 int 
  54852 bcm_esw_field_qualify_IntPktOverflowed(
  54853     int unit, 
  54854     bcm_field_entry_t entry, 
  54855     uint8 data, 
  54856     uint8 mask)
  54857 {
  54858     int rv = BCM_E_UNAVAIL;
  54859 
  54860 #if defined(BCM_TRIDENT3_SUPPORT)
  54861     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54862        uint8 d;
  54863  
  54864        if (data & ~1) {
  54865           return BCM_E_PARAM;
  54866        }
  54867 
  54868        d = (data == 0) ? 1 : 0;       
  54869  
  54870        FP_LOCK(unit);
  54871        rv = _field_qualify32(unit, entry,
  54872                              bcmFieldQualifyIntPktOverflowed,
  54873                              d, mask);
  54874        FP_UNLOCK(unit);
  54875     }
  54876 #endif /* BCM_TRIDENT3_SUPPORT */
  54877     return rv;
  54878 
  54879 }
  54880 
  54881 int 
  54882 bcm_esw_field_qualify_IntPktOverflowed_get(
  54883     int unit, 
  54884     bcm_field_entry_t entry, 
  54885     uint8 *data, 
  54886     uint8 *mask)
  54887 {
  54888     int rv = BCM_E_UNAVAIL;
  54889 
  54890 #if defined(BCM_TRIDENT3_SUPPORT)
  54891     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54892        FP_LOCK(unit);
  54893        /* Read qualifier match value and mask. */
  54894        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54895                                             bcmFieldQualifyIntPktOverflowed,
  54896                                             data, mask);
  54897        FP_UNLOCK(unit);
  54898 
  54899        if (BCM_SUCCESS(rv) && (*mask & 1)) {
  54900           *data = (*data == 0) ? 1 : 0;
  54901        }
  54902     }
  54903 #endif /* BCM_TRIDENT3_SUPPORT */
  54904 
  54905     return rv;
  54906 }
  54907 int 
  54908 bcm_esw_field_qualify_IntPktLengthValid(
  54909     int unit, 
  54910     bcm_field_entry_t entry, 
  54911     uint8 data, 
  54912     uint8 mask)
  54913 {
  54914     int rv = BCM_E_UNAVAIL;
  54915 
  54916 #if defined(BCM_TRIDENT3_SUPPORT)
  54917     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54918        FP_LOCK(unit);
  54919        rv = _field_qualify32(unit, entry,
  54920                              bcmFieldQualifyIntPktLengthValid,
  54921                              data, mask);
  54922        FP_UNLOCK(unit);
  54923     }
  54924 #endif /* BCM_TRIDENT3_SUPPORT */
  54925     return rv;
  54926 
  54927 }
  54928 
  54929 int 
  54930 bcm_esw_field_qualify_IntPktLengthValid_get(
  54931     int unit, 
  54932     bcm_field_entry_t entry, 
  54933     uint8 *data, 
  54934     uint8 *mask)
  54935 {
  54936     int rv = BCM_E_UNAVAIL;
  54937 
  54938 #if defined(BCM_TRIDENT3_SUPPORT)
  54939     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54940        FP_LOCK(unit);
  54941        /* Read qualifier match value and mask. */
  54942        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54943                                             bcmFieldQualifyIntPktLengthValid,
  54944                                             data, mask);
  54945        FP_UNLOCK(unit);
  54946     }
  54947 #endif /* BCM_TRIDENT3_SUPPORT */
  54948 
  54949     return rv;
  54950 }
  54951 
  54952 int 
  54953 bcm_esw_field_qualify_IntPktVersionOne(
  54954     int unit, 
  54955     bcm_field_entry_t entry, 
  54956     uint8 data, 
  54957     uint8 mask)
  54958 {
  54959     int rv = BCM_E_UNAVAIL;
  54960 
  54961 #if defined(BCM_TRIDENT3_SUPPORT)
  54962     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54963        FP_LOCK(unit);
  54964        rv = _field_qualify32(unit, entry,
  54965                              bcmFieldQualifyIntPktVersionOne,
  54966                              data, mask);
  54967        FP_UNLOCK(unit);
  54968     }
  54969 #endif /* BCM_TRIDENT3_SUPPORT */
  54970     return rv;
  54971 }
  54972 
  54973 int 
  54974 bcm_esw_field_qualify_IntPktVersionOne_get(
  54975     int unit, 
  54976     bcm_field_entry_t entry, 
  54977     uint8 *data, 
  54978     uint8 *mask)
  54979 {
  54980     int rv = BCM_E_UNAVAIL;
  54981 
  54982 #if defined(BCM_TRIDENT3_SUPPORT)
  54983     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  54984        FP_LOCK(unit);
  54985        /* Read qualifier match value and mask. */
  54986        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  54987                                             bcmFieldQualifyIntPktVersionOne,
  54988                                             data, mask);
  54989        FP_UNLOCK(unit);
  54990     }
  54991 #endif /* BCM_TRIDENT3_SUPPORT */
  54992 
  54993     return rv;
  54994 }
  54995 
  54996 int
  54997 bcm_esw_field_qualify_NshServiceIndex(
  54998     int unit,
  54999     bcm_field_entry_t entry,
  55000     uint32 data,
  55001     uint32 mask)
  55002 {
  55003     int rv = BCM_E_UNAVAIL;
  55004 
  55005 #if defined(BCM_TRIDENT3_SUPPORT)
  55006     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55007         if (data >> 8) {
  55008             return BCM_E_PARAM;
  55009         }
  55010         FP_LOCK(unit);
  55011         rv = _field_qualify32(unit, entry,
  55012                 bcmFieldQualifyNshServiceIndex,
  55013                 data, mask);
  55014         FP_UNLOCK(unit);
  55015     }
  55016 #endif /* BCM_TRIDENT3_SUPPORT */
  55017     return rv;
  55018 }
  55019 
  55020 int
  55021 bcm_esw_field_qualify_NshServiceIndex_get(
  55022     int unit,
  55023     bcm_field_entry_t entry,
  55024     uint32 *data,
  55025     uint32 *mask)
  55026 {
  55027     int rv = BCM_E_UNAVAIL;
  55028 
  55029 #if defined(BCM_TRIDENT3_SUPPORT)
  55030     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55031         uint8 d,m;
  55032         FP_LOCK(unit);
  55033         /* Read qualifier match value and mask. */
  55034         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55035                                             bcmFieldQualifyNshServiceIndex,
  55036                                             &d, &m);
  55037         *data = d;
  55038         *mask = m;
  55039         FP_UNLOCK(unit);
  55040     }
  55041 #endif /* BCM_TRIDENT3_SUPPORT */
  55042 
  55043     return rv;
  55044 }
  55045 
  55046 int
  55047 bcm_esw_field_qualify_NshServicePathId(
  55048     int unit,
  55049     bcm_field_entry_t entry,
  55050     uint32 data,
  55051     uint32 mask)
  55052 {
  55053     int rv = BCM_E_UNAVAIL;
  55054 
  55055 #if defined(BCM_TRIDENT3_SUPPORT)
  55056     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55057         if (data >> 24) {
  55058             return BCM_E_PARAM;
  55059         }
  55060        FP_LOCK(unit);
  55061        rv = _field_qualify32(unit, entry,
  55062                              bcmFieldQualifyNshServicePathId,
  55063                              data, mask);
  55064        FP_UNLOCK(unit);
  55065     }
  55066 #endif /* BCM_TRIDENT3_SUPPORT */
  55067     return rv;
  55068 }
  55069 
  55070 int
  55071 bcm_esw_field_qualify_NshServicePathId_get(
  55072     int unit,
  55073     bcm_field_entry_t entry,
  55074     uint32 *data,
  55075     uint32 *mask)
  55076 {
  55077     int rv = BCM_E_UNAVAIL;
  55078 
  55079 #if defined(BCM_TRIDENT3_SUPPORT)
  55080     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55081        FP_LOCK(unit);
  55082        /* Read qualifier match value and mask. */
  55083        rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  55084                                             bcmFieldQualifyNshServicePathId,
  55085                                             data, mask);
  55086        FP_UNLOCK(unit);
  55087     }
  55088 #endif /* BCM_TRIDENT3_SUPPORT */
  55089 
  55090     return rv;
  55091 }
  55092 
  55093 int
  55094 bcm_esw_field_qualify_TunnelSubType(
  55095     int unit,
  55096     bcm_field_entry_t entry,
  55097     bcm_field_TunnelSubType_t type)
  55098 {
  55099     int               rv;   /* Operation return status. */
  55100     uint32            data; /* HW data match criteria.  */
  55101     uint32            mask; /* HW data mask.            */
  55102 
  55103 #if defined(BCM_TRIDENT3_SUPPORT)
  55104     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55105         BCM_IF_ERROR_RETURN(_bcm_field_td3_qualify_TunnelSubType(unit,
  55106                                                                  type,
  55107                                                                  &data,
  55108                                                                  &mask));
  55109     } else
  55110 #endif /* BCM_TRIDENT3_SUPPORT */
  55111     {
  55112         return BCM_E_UNAVAIL;
  55113     }
  55114 
  55115     FP_LOCK(unit);
  55116     rv = _field_qualify32(unit, entry, bcmFieldQualifyTunnelSubType, 
  55117                           data, mask);
  55118 
  55119     FP_UNLOCK(unit);
  55120     return (rv);
  55121 }
  55122 
  55123 int
  55124 bcm_esw_field_qualify_TunnelSubType_get(
  55125     int unit,
  55126     bcm_field_entry_t entry,
  55127     bcm_field_TunnelSubType_t *type)
  55128 {
  55129     uint8            data; /* HW data match criteria.  */
  55130     uint8            mask; /* HW data mask.            */
  55131     int              rv;   /* Operation return status. */
  55132 
  55133     /* Input parameters check. */
  55134     if (NULL == type) {
  55135         return (BCM_E_PARAM);
  55136     }
  55137 
  55138     FP_LOCK(unit);
  55139     /* Read qualifier match value and mask. */
  55140     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry, 
  55141                                           bcmFieldQualifyTunnelSubType,
  55142                                           &data, &mask);
  55143     FP_UNLOCK(unit);
  55144     BCM_IF_ERROR_RETURN(rv);
  55145 
  55146 #if defined(BCM_TRIDENT3_SUPPORT)
  55147     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55148         return (_bcm_field_td3_qualify_TunnelSubType_get(unit, data, mask, type));
  55149     }
  55150 #endif /* BCM_TRIDENT3_SUPPORT */
  55151 
  55152     return BCM_E_UNAVAIL;
  55153 }
  55154 
  55155 int
  55156 bcm_esw_field_qualify_BfdGoodPkt(
  55157     int unit,
  55158     bcm_field_entry_t entry,
  55159     uint8 data,
  55160     uint8 mask)
  55161 {
  55162     int rv = BCM_E_UNAVAIL;
  55163 
  55164 #if defined(BCM_TRIDENT3_SUPPORT)
  55165     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55166        FP_LOCK(unit);
  55167        rv = _field_qualify32(unit, entry,
  55168                              bcmFieldQualifyBfdGoodPkt,
  55169                              data, mask);
  55170        FP_UNLOCK(unit);
  55171     }
  55172 #endif /* BCM_TRIDENT3_SUPPORT */
  55173     return rv;
  55174 }
  55175 
  55176 int
  55177 bcm_esw_field_qualify_BfdGoodPkt_get(
  55178     int unit,
  55179     bcm_field_entry_t entry,
  55180     uint8 *data,
  55181     uint8 *mask)
  55182 {
  55183     int rv = BCM_E_UNAVAIL;
  55184 
  55185 #if defined(BCM_TRIDENT3_SUPPORT)
  55186     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55187        FP_LOCK(unit);
  55188        /* Read qualifier match value and mask. */
  55189        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55190                                           bcmFieldQualifyBfdGoodPkt,
  55191                                           data, mask);
  55192        FP_UNLOCK(unit);
  55193     }
  55194 #endif /* BCM_TRIDENT3_SUPPORT */
  55195 
  55196     return rv;
  55197 }
  55198 
  55199 int
  55200 bcm_esw_field_qualify_BfdPktWithDstIpLoopbackAddr(
  55201     int unit,
  55202     bcm_field_entry_t entry,
  55203     uint8 data,
  55204     uint8 mask)
  55205 {
  55206     int rv = BCM_E_UNAVAIL;
  55207 
  55208 #if defined(BCM_TRIDENT3_SUPPORT)
  55209     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55210        FP_LOCK(unit);
  55211        rv = _field_qualify32(unit, entry,
  55212                              bcmFieldQualifyBfdPktWithDstIpLoopbackAddr,
  55213                              data, mask);
  55214        FP_UNLOCK(unit);
  55215     }
  55216 #endif /* BCM_TRIDENT3_SUPPORT */
  55217     return rv;
  55218 }
  55219 
  55220 int
  55221 bcm_esw_field_qualify_BfdPktWithDstIpLoopbackAddr_get(
  55222     int unit,
  55223     bcm_field_entry_t entry,
  55224     uint8 *data,
  55225     uint8 *mask)
  55226 {
  55227     int rv = BCM_E_UNAVAIL;
  55228 
  55229 #if defined(BCM_TRIDENT3_SUPPORT)
  55230     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55231        FP_LOCK(unit);
  55232        /* Read qualifier match value and mask. */
  55233        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55234                                           bcmFieldQualifyBfdPktWithDstIpLoopbackAddr,
  55235                                           data, mask);
  55236        FP_UNLOCK(unit);
  55237     }
  55238 #endif /* BCM_TRIDENT3_SUPPORT */
  55239 
  55240     return rv;
  55241 
  55242 }
  55243 
  55244 int
  55245 bcm_esw_field_qualify_MplsControlPkt(
  55246     int unit,
  55247     bcm_field_entry_t entry,
  55248     uint8 data,
  55249     uint8 mask)
  55250 {
  55251     int rv = BCM_E_UNAVAIL;
  55252 
  55253 #if defined(BCM_TRIDENT3_SUPPORT)
  55254     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55255        FP_LOCK(unit);
  55256        rv = _field_qualify32(unit, entry,
  55257                              bcmFieldQualifyMplsControlPkt,
  55258                              data, mask);
  55259        FP_UNLOCK(unit);
  55260     }
  55261 #endif /* BCM_TRIDENT3_SUPPORT */
  55262     return rv;
  55263 }
  55264 
  55265 int
  55266 bcm_esw_field_qualify_MplsControlPkt_get(
  55267     int unit,
  55268     bcm_field_entry_t entry,
  55269     uint8 *data,
  55270     uint8 *mask)
  55271 {
  55272     int rv = BCM_E_UNAVAIL;
  55273 
  55274 #if defined(BCM_TRIDENT3_SUPPORT)
  55275     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55276        FP_LOCK(unit);
  55277        /* Read qualifier match value and mask. */
  55278        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55279                                           bcmFieldQualifyMplsControlPkt,
  55280                                           data, mask);
  55281        FP_UNLOCK(unit);
  55282     }
  55283 #endif /* BCM_TRIDENT3_SUPPORT */
  55284 
  55285     return rv;
  55286 }
  55287 
  55288 int
  55289 bcm_esw_field_qualify_BfdPktVersionOne(
  55290     int unit,
  55291     bcm_field_entry_t entry,
  55292     uint8 data,
  55293     uint8 mask)
  55294 {
  55295     int rv = BCM_E_UNAVAIL;
  55296 
  55297 #if defined(BCM_TRIDENT3_SUPPORT)
  55298     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55299        FP_LOCK(unit);
  55300        rv = _field_qualify32(unit, entry,
  55301                              bcmFieldQualifyBfdPktVersionOne,
  55302                              data, mask);
  55303        FP_UNLOCK(unit);
  55304     }
  55305 #endif /* BCM_TRIDENT3_SUPPORT */
  55306 
  55307     return rv;
  55308 }
  55309 
  55310 int
  55311 bcm_esw_field_qualify_BfdPktVersionOne_get(
  55312     int unit,
  55313     bcm_field_entry_t entry,
  55314     uint8 *data,
  55315     uint8 *mask)
  55316 {
  55317     int rv = BCM_E_UNAVAIL;
  55318 
  55319 #if defined(BCM_TRIDENT3_SUPPORT)
  55320     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55321        FP_LOCK(unit);
  55322        /* Read qualifier match value and mask. */
  55323        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55324                                           bcmFieldQualifyBfdPktVersionOne,
  55325                                           data, mask);
  55326        FP_UNLOCK(unit);
  55327     }
  55328 #endif /* BCM_TRIDENT3_SUPPORT */
  55329 
  55330     return rv;
  55331 }
  55332 
  55333 int
  55334 bcm_esw_field_qualify_GenevePktVersionZero(
  55335     int unit,
  55336     bcm_field_entry_t entry,
  55337     uint8 data,
  55338     uint8 mask)
  55339 {
  55340     int rv = BCM_E_UNAVAIL;
  55341 
  55342 #if defined(BCM_TRIDENT3_SUPPORT)
  55343     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55344        FP_LOCK(unit);
  55345        rv = _field_qualify32(unit, entry,
  55346                              bcmFieldQualifyGenevePktVersionZero,
  55347                              data, mask);
  55348        FP_UNLOCK(unit);
  55349     }
  55350 #endif /* BCM_TRIDENT3_SUPPORT */
  55351 
  55352     return rv;
  55353 }
  55354 
  55355 int
  55356 bcm_esw_field_qualify_GenevePktVersionZero_get(
  55357     int unit,
  55358     bcm_field_entry_t entry,
  55359     uint8 *data,
  55360     uint8 *mask)
  55361 {
  55362     int rv = BCM_E_UNAVAIL;
  55363 
  55364 #if defined(BCM_TRIDENT3_SUPPORT)
  55365     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55366        FP_LOCK(unit);
  55367        /* Read qualifier match value and mask. */
  55368        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55369                                           bcmFieldQualifyGenevePktVersionZero,
  55370                                           data, mask);
  55371        FP_UNLOCK(unit);
  55372     }
  55373 #endif /* BCM_TRIDENT3_SUPPORT */
  55374 
  55375     return rv;
  55376 }
  55377 
  55378 int
  55379 bcm_esw_field_qualify_GenevePktWithOam(
  55380     int unit,
  55381     bcm_field_entry_t entry,
  55382     uint8 data,
  55383     uint8 mask)
  55384 {
  55385     int rv = BCM_E_UNAVAIL;
  55386 
  55387 #if defined(BCM_TRIDENT3_SUPPORT)
  55388     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55389        FP_LOCK(unit);
  55390        rv = _field_qualify32(unit, entry,
  55391                              bcmFieldQualifyGenevePktWithOam,
  55392                              data, mask);
  55393        FP_UNLOCK(unit);
  55394     }
  55395 #endif /* BCM_TRIDENT3_SUPPORT */
  55396 
  55397     return rv;
  55398 }
  55399 
  55400 int
  55401 bcm_esw_field_qualify_GenevePktWithOam_get(
  55402     int unit,
  55403     bcm_field_entry_t entry,
  55404     uint8 *data,
  55405     uint8 *mask)
  55406 {
  55407     int rv = BCM_E_UNAVAIL;
  55408 
  55409 #if defined(BCM_TRIDENT3_SUPPORT)
  55410     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55411        FP_LOCK(unit);
  55412        /* Read qualifier match value and mask. */
  55413        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55414                                           bcmFieldQualifyGenevePktWithOam,
  55415                                           data, mask);
  55416        FP_UNLOCK(unit);
  55417     }
  55418 #endif /* BCM_TRIDENT3_SUPPORT */
  55419 
  55420     return rv;
  55421 }
  55422 
  55423 int
  55424 bcm_esw_field_qualify_GpePktVersionZero(
  55425     int unit,
  55426     bcm_field_entry_t entry,
  55427     uint8 data,
  55428     uint8 mask)
  55429 {
  55430     int rv = BCM_E_UNAVAIL;
  55431 
  55432 #if defined(BCM_TRIDENT3_SUPPORT)
  55433     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55434        FP_LOCK(unit);
  55435        rv = _field_qualify32(unit, entry,
  55436                              bcmFieldQualifyGpePktVersionZero,
  55437                              data, mask);
  55438        FP_UNLOCK(unit);
  55439     }
  55440 #endif /* BCM_TRIDENT3_SUPPORT */
  55441 
  55442     return rv;
  55443 }
  55444 
  55445 int
  55446 bcm_esw_field_qualify_GpePktVersionZero_get(
  55447     int unit,
  55448     bcm_field_entry_t entry,
  55449     uint8 *data,
  55450     uint8 *mask)
  55451 {
  55452     int rv = BCM_E_UNAVAIL;
  55453 
  55454 #if defined(BCM_TRIDENT3_SUPPORT)
  55455     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55456        FP_LOCK(unit);
  55457        /* Read qualifier match value and mask. */
  55458        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55459                                           bcmFieldQualifyGpePktVersionZero,
  55460                                           data, mask);
  55461        FP_UNLOCK(unit);
  55462     }
  55463 #endif /* BCM_TRIDENT3_SUPPORT */
  55464 
  55465     return rv;
  55466 }
  55467 
  55468 int
  55469 bcm_esw_field_qualify_GpePktWithOam(
  55470     int unit,
  55471     bcm_field_entry_t entry,
  55472     uint8 data,
  55473     uint8 mask)
  55474 {
  55475     int rv = BCM_E_UNAVAIL;
  55476 
  55477 #if defined(BCM_TRIDENT3_SUPPORT)
  55478     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55479        FP_LOCK(unit);
  55480        rv = _field_qualify32(unit, entry,
  55481                              bcmFieldQualifyGpePktWithOam,
  55482                              data, mask);
  55483        FP_UNLOCK(unit);
  55484     }
  55485 #endif /* BCM_TRIDENT3_SUPPORT */
  55486 
  55487     return rv;
  55488 }
  55489 
  55490 int
  55491 bcm_esw_field_qualify_GpePktWithOam_get(
  55492     int unit,
  55493     bcm_field_entry_t entry,
  55494     uint8 *data,
  55495     uint8 *mask)
  55496 {
  55497     int rv = BCM_E_UNAVAIL;
  55498 
  55499 #if defined(BCM_TRIDENT3_SUPPORT)
  55500     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55501        FP_LOCK(unit);
  55502        /* Read qualifier match value and mask. */
  55503        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55504                                           bcmFieldQualifyGpePktWithOam,
  55505                                           data, mask);
  55506        FP_UNLOCK(unit);
  55507     }
  55508 #endif /* BCM_TRIDENT3_SUPPORT */
  55509 
  55510     return rv;
  55511 }
  55512 
  55513 int
  55514 bcm_esw_field_qualify_InnerBfdPktVersionOne(
  55515     int unit,
  55516     bcm_field_entry_t entry,
  55517     uint8 data,
  55518     uint8 mask)
  55519 {
  55520     int rv = BCM_E_UNAVAIL;
  55521 
  55522 #if defined(BCM_TRIDENT3_SUPPORT)
  55523     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55524        FP_LOCK(unit);
  55525        rv = _field_qualify32(unit, entry,
  55526                              bcmFieldQualifyInnerBfdPktVersionOne,
  55527                              data, mask);
  55528        FP_UNLOCK(unit);
  55529     }
  55530 #endif /* BCM_TRIDENT3_SUPPORT */
  55531 
  55532     return rv;
  55533 }
  55534 
  55535 int
  55536 bcm_esw_field_qualify_InnerBfdPktVersionOne_get(
  55537     int unit,
  55538     bcm_field_entry_t entry,
  55539     uint8 *data,
  55540     uint8 *mask)
  55541 {
  55542     int rv = BCM_E_UNAVAIL;
  55543 
  55544 #if defined(BCM_TRIDENT3_SUPPORT)
  55545     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  55546        FP_LOCK(unit);
  55547        /* Read qualifier match value and mask. */
  55548        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55549                                           bcmFieldQualifyInnerBfdPktVersionOne,
  55550                                           data, mask);
  55551        FP_UNLOCK(unit);
  55552     }
  55553 #endif /* BCM_TRIDENT3_SUPPORT */
  55554 
  55555     return rv;
  55556 }
  55557 
  55558 int
  55559 bcm_esw_field_qualify_PktDstAddrType(
  55560     int unit,
  55561     bcm_field_entry_t entry,
  55562     uint32 dst_addr_type)
  55563 {
  55564     int               rv = BCM_E_NONE;      /* Operation return status. */
  55565     uint32            hw_data = 0;          /* HW data match criteria.  */
  55566     uint32            hw_mask = 0;          /* HW data mask.            */
  55567 
  55568 #if defined(BCM_FLOWTRACKER_SUPPORT)
  55569     if (soc_feature(unit, soc_feature_field_flowtracker_support)) {
  55570         BCM_IF_ERROR_RETURN(_bcm_field_hx5_qualify_PktDstAddrType(unit,
  55571                     bcmFieldQualifyPktDstAddrType, dst_addr_type,
  55572                     &hw_data, &hw_mask));
  55573     } else
  55574 #endif /* BCM_FLOWTRACKER_SUPPORT */
  55575     {
  55576         return BCM_E_UNAVAIL;
  55577     }
  55578 
  55579     FP_LOCK(unit);
  55580     rv = _field_qualify32(unit, entry,
  55581             bcmFieldQualifyPktDstAddrType, hw_data, hw_mask);
  55582 
  55583     FP_UNLOCK(unit);
  55584 
  55585     return (rv);
  55586 }
  55587 
  55588 int
  55589 bcm_esw_field_qualify_PktDstAddrType_get(
  55590     int unit,
  55591     bcm_field_entry_t entry,
  55592     uint32 *dst_addr_type)
  55593 {
  55594     int              rv = BCM_E_NONE;      /* Operation return status. */
  55595     uint32           hw_data = 0;          /* HW data match criteria.  */
  55596     uint32           hw_mask = 0;          /* HW data mask.            */
  55597 
  55598     /* Input parameters check. */
  55599     if (NULL == dst_addr_type) {
  55600         return (BCM_E_PARAM);
  55601     }
  55602 
  55603     FP_LOCK(unit);
  55604     /* Read qualifier match value and mask. */
  55605     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  55606                                           bcmFieldQualifyPktDstAddrType,
  55607                                           &hw_data, &hw_mask);
  55608     FP_UNLOCK(unit);
  55609     BCM_IF_ERROR_RETURN(rv);
  55610 
  55611 #if defined(BCM_FLOWTRACKER_SUPPORT)
  55612     if (soc_feature(unit, soc_feature_field_flowtracker_support)) {
  55613         return (_bcm_field_hx5_qualify_PktDstAddrType_get(unit,
  55614                         bcmFieldQualifyPktDstAddrType,
  55615                         hw_data, hw_mask, dst_addr_type));
  55616     }
  55617 #endif /* BCM_FLOWTRACKER_SUPPORT */
  55618 
  55619     return BCM_E_UNAVAIL;
  55620 }
  55621 
  55622 int
  55623 bcm_esw_field_qualify_PktInnerDstAddrType(
  55624     int unit,
  55625     bcm_field_entry_t entry,
  55626     uint32 dst_addr_type)
  55627 {
  55628     int               rv = BCM_E_NONE;      /* Operation return status. */
  55629     uint32            hw_data = 0;          /* HW data match criteria.  */
  55630     uint32            hw_mask = 0;          /* HW data mask.            */
  55631 
  55632 #if defined(BCM_FLOWTRACKER_SUPPORT)
  55633     if (soc_feature(unit, soc_feature_field_flowtracker_support)) {
  55634         BCM_IF_ERROR_RETURN(_bcm_field_hx5_qualify_PktDstAddrType(unit,
  55635                     bcmFieldQualifyPktInnerDstAddrType,
  55636                     dst_addr_type, &hw_data, &hw_mask));
  55637     } else
  55638 #endif /* BCM_FLOWTRACKER_SUPPORT */
  55639     {
  55640         return BCM_E_UNAVAIL;
  55641     }
  55642 
  55643     FP_LOCK(unit);
  55644     rv = _field_qualify32(unit, entry,
  55645             bcmFieldQualifyPktInnerDstAddrType, hw_data, hw_mask);
  55646 
  55647     FP_UNLOCK(unit);
  55648 
  55649     return (rv);
  55650 }
  55651 
  55652 int
  55653 bcm_esw_field_qualify_PktInnerDstAddrType_get(
  55654     int unit,
  55655     bcm_field_entry_t entry,
  55656     uint32 *dst_addr_type)
  55657 {
  55658     int               rv = BCM_E_NONE;      /* Operation return status. */
  55659     uint32            hw_data = 0;          /* HW data match criteria.  */
  55660     uint32            hw_mask = 0;          /* HW data mask.            */
  55661 
  55662     /* Input parameters check. */
  55663     if (NULL == dst_addr_type) {
  55664         return (BCM_E_PARAM);
  55665     }
  55666 
  55667     FP_LOCK(unit);
  55668     /* Read qualifier match value and mask. */
  55669     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  55670             bcmFieldQualifyPktInnerDstAddrType,
  55671             &hw_data, &hw_mask);
  55672     FP_UNLOCK(unit);
  55673     BCM_IF_ERROR_RETURN(rv);
  55674 
  55675 #if defined(BCM_FLOWTRACKER_SUPPORT)
  55676     if (soc_feature(unit, soc_feature_field_flowtracker_support)) {
  55677         return (_bcm_field_hx5_qualify_PktDstAddrType_get(unit,
  55678                     bcmFieldQualifyPktInnerDstAddrType,
  55679                     hw_data, hw_mask, dst_addr_type));
  55680     }
  55681 #endif /* BCM_FLOWTRACKER_SUPPORT */
  55682 
  55683     return BCM_E_UNAVAIL;
  55684 }
  55685 
  55686 int
  55687 bcm_esw_field_qualify_InnerL4Ports(
  55688     int unit,
  55689     bcm_field_entry_t entry,
  55690     uint8 data,
  55691     uint8 mask)
  55692 {
  55693     int rv = BCM_E_UNAVAIL;
  55694 
  55695     FP_LOCK(unit);
  55696 
  55697 #if defined(BCM_FLOWTRACKER_SUPPORT)
  55698     if (soc_feature(unit, soc_feature_field_flowtracker_support)) {
  55699         rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerL4Ports,
  55700                         data, mask);
  55701     }
  55702 #endif  /* BCM_FLOWTRACKER_SUPPORT */
  55703     FP_UNLOCK(unit);
  55704 
  55705     return (rv);
  55706 }
  55707 
  55708 int
  55709 bcm_esw_field_qualify_InnerL4Ports_get(
  55710     int unit,
  55711     bcm_field_entry_t entry,
  55712     uint8 *data,
  55713     uint8 *mask)
  55714 {
  55715     int rv = BCM_E_UNAVAIL;
  55716 
  55717 #if defined(BCM_FLOWTRACKER_SUPPORT)
  55718     /* Read qualifier match value and mask. */
  55719     if (soc_feature(unit, soc_feature_field_flowtracker_support)) {
  55720         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55721                 bcmFieldQualifyInnerL4Ports,
  55722                 data, mask);
  55723     }
  55724 #endif
  55725 
  55726     return rv;
  55727 }
  55728 
  55729 int
  55730 bcm_esw_field_qualify_Ip6PktNextHeader(
  55731     int unit,
  55732     bcm_field_entry_t entry,
  55733     uint8 data,
  55734     uint8 mask)
  55735 {
  55736     int rv = BCM_E_UNAVAIL;
  55737 
  55738 #if defined(BCM_HELIX5_SUPPORT)
  55739     FP_LOCK(unit);
  55740 
  55741     rv = _field_qualify32(unit, entry, bcmFieldQualifyIp6PktNextHeader,
  55742                             data, mask);
  55743     FP_UNLOCK(unit);
  55744 #endif
  55745 
  55746     return (rv);
  55747 }
  55748 
  55749 int
  55750 bcm_esw_field_qualify_Ip6PktNextHeader_get(
  55751     int unit,
  55752     bcm_field_entry_t entry,
  55753     uint8 *data,
  55754     uint8 *mask)
  55755 {
  55756     int rv = BCM_E_UNAVAIL;
  55757 
  55758 #if defined(BCM_HELIX5_SUPPORT)
  55759     /* Read qualifier match value and mask. */
  55760     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55761                                             bcmFieldQualifyIp6PktNextHeader,
  55762                                             data, mask);
  55763 #endif
  55764 
  55765     return (rv);
  55766 }
  55767 
  55768 int
  55769 bcm_esw_field_qualify_Ip6PktHopLimit(
  55770     int unit,
  55771     bcm_field_entry_t entry,
  55772     uint8 data,
  55773     uint8 mask)
  55774 {
  55775     int rv = BCM_E_UNAVAIL;
  55776 
  55777 #if defined(BCM_HELIX5_SUPPORT)
  55778     FP_LOCK(unit);
  55779 
  55780     rv = _field_qualify32(unit, entry, bcmFieldQualifyIp6PktHopLimit,
  55781                             data, mask);
  55782     FP_UNLOCK(unit);
  55783 #endif
  55784 
  55785     return (rv);
  55786 }
  55787 
  55788 int
  55789 bcm_esw_field_qualify_Ip6PktHopLimit_get(
  55790     int unit,
  55791     bcm_field_entry_t entry,
  55792     uint8 *data,
  55793     uint8 *mask)
  55794 {
  55795     int rv = BCM_E_UNAVAIL;
  55796 
  55797 #if defined(BCM_HELIX5_SUPPORT)
  55798     /* Read qualifier match value and mask. */
  55799     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55800                                             bcmFieldQualifyIp6PktHopLimit,
  55801                                             data, mask);
  55802 #endif
  55803 
  55804     return (rv);
  55805 }
  55806 
  55807 int
  55808 bcm_esw_field_qualify_Ip6PktTrafficClass(
  55809     int unit,
  55810     bcm_field_entry_t entry,
  55811     uint8 data,
  55812     uint8 mask)
  55813 {
  55814     int rv = BCM_E_UNAVAIL;
  55815 
  55816 #if defined(BCM_HELIX5_SUPPORT)
  55817     FP_LOCK(unit);
  55818 
  55819     rv = _field_qualify32(unit, entry, bcmFieldQualifyIp6PktTrafficClass,
  55820                             data, mask);
  55821     FP_UNLOCK(unit);
  55822 #endif
  55823 
  55824     return (rv);
  55825 }
  55826 
  55827 int
  55828 bcm_esw_field_qualify_Ip6PktTrafficClass_get(
  55829     int unit,
  55830     bcm_field_entry_t entry,
  55831     uint8 *data,
  55832     uint8 *mask)
  55833 {
  55834     int rv = BCM_E_UNAVAIL;
  55835 
  55836 #if defined(BCM_HELIX5_SUPPORT)
  55837     /* Read qualifier match value and mask. */
  55838     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55839                                             bcmFieldQualifyIp6PktTrafficClass,
  55840                                             data, mask);
  55841 #endif
  55842 
  55843     return (rv);
  55844 }
  55845 
  55846 int
  55847 bcm_esw_field_qualify_InnerIp6PktNextHeader(
  55848     int unit,
  55849     bcm_field_entry_t entry,
  55850     uint8 data,
  55851     uint8 mask)
  55852 {
  55853     int rv = BCM_E_UNAVAIL;
  55854 
  55855 #if defined(BCM_HELIX5_SUPPORT)
  55856     FP_LOCK(unit);
  55857 
  55858     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerIp6PktNextHeader,
  55859                             data, mask);
  55860     FP_UNLOCK(unit);
  55861 #endif
  55862 
  55863     return (rv);
  55864 }
  55865 
  55866 int
  55867 bcm_esw_field_qualify_InnerIp6PktNextHeader_get(
  55868     int unit,
  55869     bcm_field_entry_t entry,
  55870     uint8 *data,
  55871     uint8 *mask)
  55872 {
  55873     int rv = BCM_E_UNAVAIL;
  55874 
  55875 #if defined(BCM_HELIX5_SUPPORT)
  55876     /* Read qualifier match value and mask. */
  55877     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55878                                             bcmFieldQualifyInnerIp6PktNextHeader,
  55879                                             data, mask);
  55880 #endif
  55881 
  55882     return (rv);
  55883 }
  55884 
  55885 int
  55886 bcm_esw_field_qualify_InnerIp6PktHopLimit(
  55887     int unit,
  55888     bcm_field_entry_t entry,
  55889     uint8 data,
  55890     uint8 mask)
  55891 {
  55892     int rv = BCM_E_UNAVAIL;
  55893 
  55894 #if defined(BCM_HELIX5_SUPPORT)
  55895     FP_LOCK(unit);
  55896 
  55897     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerIp6PktHopLimit,
  55898                             data, mask);
  55899     FP_UNLOCK(unit);
  55900 #endif
  55901 
  55902     return (rv);
  55903 }
  55904 
  55905 int
  55906 bcm_esw_field_qualify_InnerIp6PktHopLimit_get(
  55907     int unit,
  55908     bcm_field_entry_t entry,
  55909     uint8 *data,
  55910     uint8 *mask)
  55911 {
  55912     int rv = BCM_E_UNAVAIL;
  55913 
  55914 #if defined(BCM_HELIX5_SUPPORT)
  55915     /* Read qualifier match value and mask. */
  55916     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55917                                             bcmFieldQualifyInnerIp6PktHopLimit,
  55918                                             data, mask);
  55919 #endif
  55920 
  55921     return (rv);
  55922 }
  55923 
  55924 int
  55925 bcm_esw_field_qualify_InnerIp6PktTrafficClass(
  55926     int unit,
  55927     bcm_field_entry_t entry,
  55928     uint8 data,
  55929     uint8 mask)
  55930 {
  55931     int rv = BCM_E_UNAVAIL;
  55932 
  55933 #if defined(BCM_HELIX5_SUPPORT)
  55934     FP_LOCK(unit);
  55935 
  55936     rv = _field_qualify32(unit, entry, bcmFieldQualifyInnerIp6PktTrafficClass,
  55937                             data, mask);
  55938     FP_UNLOCK(unit);
  55939 #endif
  55940 
  55941     return (rv);
  55942 }
  55943 
  55944 int
  55945 bcm_esw_field_qualify_InnerIp6PktTrafficClass_get(
  55946     int unit,
  55947     bcm_field_entry_t entry,
  55948     uint8 *data,
  55949     uint8 *mask)
  55950 {
  55951     int rv = BCM_E_UNAVAIL;
  55952 
  55953 #if defined(BCM_HELIX5_SUPPORT)
  55954     /* Read qualifier match value and mask. */
  55955     rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  55956                                             bcmFieldQualifyInnerIp6PktTrafficClass,
  55957                                             data, mask);
  55958 #endif
  55959 
  55960     return (rv);
  55961 }
  55962 
  55963 int
  55964 bcm_esw_field_action_config_info_add(
  55965     int unit,
  55966     bcm_field_entry_t entry,
  55967     bcm_field_action_t action,
  55968     bcm_field_action_params_t *params,
  55969     bcm_field_action_match_config_t *match_config)
  55970 {
  55971     _field_control_t    *fc;           /* Field control structure. */
  55972     _field_action_t     *fa = NULL;    /* Field action descriptor. */
  55973     int                 rv;            /* Operation return status. */
  55974  
  55975     if ((NULL == params) || (NULL == match_config)) {
  55976         return (BCM_E_PARAM);
  55977     }
  55978 
  55979     if (!(soc_feature(unit, soc_feature_th3_style_fp))) {
  55980          return BCM_E_UNAVAIL;
  55981     }
  55982 
  55983 #ifdef BROADCOM_DEBUG
  55984     LOG_DEBUG(BSL_LS_BCM_FP,
  55985               (BSL_META_U(unit,
  55986                           "FP(unit %d) vverb: bcm_field_action_add(entry=%d, action=%s, "
  55987                           "p0=%d, p1=%d)\n"), unit, entry,
  55988                _field_action_name(action), params->param0, params->param1));
  55989 #endif
  55990 
  55991     FP_LOCK(unit);
  55992     rv = _field_control_get(unit, &fc);
  55993     if (BCM_FAILURE(rv)) {
  55994         FP_UNLOCK(unit);
  55995         return rv;
  55996     }
  55997 
  55998     fa = NULL;
  55999 
  56000     /* 
  56001      * Allocate the action descriptor, param2 to param5 are not valid here.
  56002      */
  56003     rv = _field_action_alloc(unit, action, params->param0, params->param1,
  56004                              0, 0, 0, 0, &fa);
  56005     if (BCM_FAILURE(rv)) {
  56006         LOG_ERROR(BSL_LS_BCM_FP,
  56007                   (BSL_META_U(unit,
  56008                               "FP(unit %d) Error: failure in _field_action_alloc()\n"),
  56009                    unit));
  56010         FP_UNLOCK(unit);
  56011         return rv;
  56012     }
  56013 
  56014     rv = _field_action_match_config_alloc (unit, match_config, fa);
  56015     if (BCM_FAILURE(rv)) {
  56016         LOG_ERROR(BSL_LS_BCM_FP,
  56017                   (BSL_META_U(unit,
  56018                               "FP(unit %d) Error: failure in _field_action_match_config_alloc ()\n"),
  56019                    unit));
  56020         FP_UNLOCK(unit);
  56021         sal_free(fa);
  56022         return rv;
  56023     }
  56024 
  56025 
  56026     /*
  56027      * Add action to entry actions list.
  56028      */
  56029     rv = _field_action_add(unit, fc, entry, fa);
  56030     FP_UNLOCK(unit);
  56031     if (BCM_FAILURE(rv)) {
  56032         if (NULL != (fa->egress_pbmp)) {
  56033             sal_free(fa->egress_pbmp);
  56034         }
  56035         sal_free(fa);
  56036         return rv;
  56037     }
  56038 
  56039     return (BCM_E_NONE);
  56040 
  56041 }
  56042 
  56043 int bcm_esw_field_action_config_info_get(
  56044     int unit,
  56045     bcm_field_entry_t entry,
  56046     bcm_field_action_t action,
  56047     bcm_field_action_params_t *params,
  56048     bcm_field_action_match_config_t *match_config)
  56049 {
  56050 
  56051     _field_action_t     *fa = NULL;    /* Field action descriptor. */
  56052     int                 rv = 0;        /* Operation return status. */
  56053     _field_entry_t      *f_ent = NULL; /* Field Entry Structure */
  56054     int                 parts_count = 0;
  56055     int                 idx = 0;
  56056 
  56057     if ((NULL == params) || (NULL == match_config)) {
  56058         return (BCM_E_PARAM);
  56059     }
  56060 
  56061     /* Lock the module. */
  56062     FP_LOCK(unit);
  56063 
  56064     rv = _bcm_field_entry_get_by_id(unit, entry, &f_ent);
  56065     if (BCM_FAILURE(rv)) {
  56066         FP_UNLOCK(unit);
  56067         return (rv);
  56068     }
  56069 
  56070     rv = _bcm_field_entry_tcam_parts_count (unit, f_ent->group->stage_id,
  56071                                        f_ent->group->flags, &parts_count);
  56072     if (BCM_FAILURE(rv)) {
  56073         FP_UNLOCK(unit);
  56074         return (rv);
  56075     }
  56076 
  56077 
  56078     /* Find matching action in the entry */
  56079     for (idx = 0; idx < parts_count; idx++) {
  56080         fa = f_ent[idx].actions;
  56081         while (fa != NULL) {
  56082         if (fa->action == action) {
  56083                 /* if match found, jump out of searching loop */
  56084                 goto action_found;
  56085             }
  56086             fa = fa->next;
  56087         }
  56088     }
  56089 
  56090 action_found:
  56091     if (fa == NULL) {
  56092         FP_UNLOCK(unit);
  56093         LOG_VERBOSE(BSL_LS_BCM_FP,
  56094                     (BSL_META_U(unit,
  56095                                 "FP(unit %d) Error: action not in entry=%d\n"),
  56096                      unit, entry));
  56097         return (BCM_E_NOT_FOUND);
  56098     }
  56099 
  56100     if (NULL != (fa->egress_pbmp)) {
  56101          BCM_PBMP_ASSIGN((match_config->egr_pbmp), *(fa->egress_pbmp));
  56102     }
  56103 
  56104     (match_config->elephant_pkt_only) = (fa->elephant_pkts_only);
  56105     params->param0 = fa->param[0];
  56106     params->param1 = fa->param[1];
  56107 
  56108 
  56109     /* Unlock the module. */
  56110     FP_UNLOCK(unit);
  56111     return rv;
  56112 }
  56113 
  56114 /* 
  56115  * Configure match criteria for bcmFieldQualifyRangeCheckGroup
  56116  *         qualifier from the field entry.
  56117  */
  56118 int bcm_esw_field_qualify_RangeCheckGroup(
  56119     int unit, 
  56120     bcm_field_entry_t entry, 
  56121     uint8 data, 
  56122     uint8 mask)
  56123 {
  56124     int rv = BCM_E_UNAVAIL;
  56125     uint16 hw_data = 0;
  56126     uint16 hw_mask = 0;
  56127     uint8 hw_index = 0;
  56128     _field_entry_t *f_ent = NULL;
  56129 
  56130     if (soc_feature(unit, soc_feature_range_check_group_support)) {
  56131 
  56132         FP_LOCK(unit);
  56133 
  56134         rv = _bcm_field_entry_get_by_id(unit, entry, &f_ent);
  56135         if (BCM_FAILURE(rv)) {
  56136             FP_UNLOCK(unit);
  56137             return (rv);
  56138         }
  56139 
  56140 #if defined (BCM_TOMAHAWK_SUPPORT)
  56141         /* Validate Range Group  and get the HW index */
  56142         rv = bcmi_xgs5_range_group_hw_idx_get(unit,
  56143                        data, f_ent->group->instance,
  56144                        &hw_index);
  56145 
  56146         if (BCM_FAILURE(rv)) {
  56147             FP_UNLOCK(unit);
  56148             return (rv);
  56149         }
  56150 #endif
  56151 
  56152         hw_data = (1 << hw_index);
  56153         hw_mask = 0xff;
  56154 #if defined (BCM_TOMAHAWK_SUPPORT)
  56155         if (mask != 0xff) {
  56156             /* Validate Range Group  and get the HW index */
  56157             rv = bcmi_xgs5_range_group_hw_idx_get(unit,
  56158                                                   mask, f_ent->group->instance,
  56159                                                   &hw_index);
  56160 
  56161             if (BCM_FAILURE(rv)) {
  56162                 FP_UNLOCK(unit);
  56163                 return (rv);
  56164             }
  56165             hw_mask = (1 << hw_index);
  56166         }
  56167 #endif
  56168         rv = _field_qualify32(unit, entry,
  56169                               bcmFieldQualifyRangeCheckGroup,
  56170                               hw_data, hw_mask);
  56171         FP_UNLOCK(unit);
  56172     }
  56173     return (rv);
  56174 }
  56175 
  56176 
  56177 /* 
  56178  * Get match criteria for bcmFieldQualifyRangeCheckGroup
  56179  *                qualifier from the field entry.
  56180  */
  56181 int bcm_esw_field_qualify_RangeCheckGroup_get(
  56182     int unit, 
  56183     bcm_field_entry_t entry, 
  56184     uint8 *data, 
  56185     uint8 *mask)
  56186 {
  56187     int rv = BCM_E_UNAVAIL;
  56188     uint16 hw_data = 0;
  56189     uint16 hw_mask = 0;
  56190     _field_entry_t *f_ent = NULL;
  56191 
  56192     if (soc_feature(unit, soc_feature_range_check_group_support)) {
  56193         FP_LOCK(unit);
  56194         *mask = 0xff;
  56195         /* Read qualifier match value and mask. */
  56196         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  56197                         bcmFieldQualifyRangeCheckGroup,
  56198                         &hw_data, &hw_mask);
  56199 
  56200         *data = 0;
  56201         if (hw_data) {
  56202             while ((hw_data & 0x1) == 0) {
  56203                 *data = *data + 1;
  56204                 hw_data = hw_data >> 1;
  56205             }
  56206         }
  56207 
  56208         rv = _bcm_field_entry_get_by_id(unit, entry, &f_ent);
  56209         if (BCM_FAILURE(rv)) {
  56210             FP_UNLOCK(unit);
  56211             return (rv);
  56212         }
  56213 
  56214 #if defined (BCM_TOMAHAWK_SUPPORT)
  56215         /* Validate HW index  and get the Range Group Id */
  56216         rv = bcmi_xgs5_range_group_id_get(unit,
  56217                                   f_ent->group->instance,
  56218                                   data);
  56219         if (BCM_SUCCESS(rv) && (hw_mask != 0xff)) {
  56220             *mask = 0;
  56221             if (hw_mask) {
  56222                 while ((hw_mask & 0x1) == 0) {
  56223                     *mask = *mask + 1;
  56224                     hw_mask = hw_mask >> 1;
  56225                 }
  56226             }
  56227 
  56228             rv = bcmi_xgs5_range_group_id_get(unit,
  56229                                               f_ent->group->instance,
  56230                                               mask);
  56231         }
  56232 #endif
  56233 
  56234         FP_UNLOCK(unit);
  56235     }
  56236 
  56237     return (rv);
  56238 }
  56239 
  56240 /* Qualifies on the tag type configured for opaque tags. */
  56241 int bcm_esw_field_qualify_OpaqueTagType(
  56242     int unit, 
  56243     bcm_field_entry_t entry, 
  56244     uint8 data, 
  56245     uint8 mask)
  56246 {
  56247     int rv = BCM_E_UNAVAIL;
  56248 
  56249 #if defined(BCM_TOMAHAWK3_SUPPORT)
  56250     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  56251        FP_LOCK(unit);
  56252        rv = _field_qualify32(unit, entry,
  56253                              bcmFieldQualifyOpaqueTagType,
  56254                              data, mask);
  56255        FP_UNLOCK(unit);
  56256     }
  56257 #endif /* BCM_TOMAHAWK3_SUPPORT */
  56258 
  56259     return rv;
  56260 
  56261 }
  56262 
  56263 /* 
  56264  * To get the qualified inputs on the tag type configured for opaque
  56265  * tags.
  56266  */
  56267 int bcm_esw_field_qualify_OpaqueTagType_get(
  56268     int unit, 
  56269     bcm_field_entry_t entry, 
  56270     uint8 *data, 
  56271     uint8 *mask)
  56272 {
  56273     int rv = BCM_E_UNAVAIL;
  56274 
  56275 #if defined(BCM_TOMAHAWK3_SUPPORT)
  56276     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  56277        FP_LOCK(unit);
  56278        /* Read qualifier match value and mask. */
  56279        rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  56280                                           bcmFieldQualifyOpaqueTagType,
  56281                                           data, mask);
  56282        FP_UNLOCK(unit);
  56283     }
  56284 #endif /* BCM_TOMAHAWK3_SUPPORT */
  56285 
  56286     return rv;
  56287 
  56288 }
  56289 
  56290 /* Qualifies on the higher 32 bits of opaque tag allowed in the system */
  56291 int bcm_esw_field_qualify_OpaqueTagHigh(
  56292     int unit, 
  56293     bcm_field_entry_t entry, 
  56294     uint32 data, 
  56295     uint32 mask)
  56296 {
  56297     int rv = BCM_E_UNAVAIL;
  56298 
  56299 #if defined(BCM_TOMAHAWK3_SUPPORT)
  56300     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  56301        FP_LOCK(unit);
  56302        rv = _field_qualify32(unit, entry,
  56303                              bcmFieldQualifyOpaqueTagHigh,
  56304                              data, mask);
  56305        FP_UNLOCK(unit);
  56306     }
  56307 #endif /* BCM_TOMAHAWK3_SUPPORT */
  56308 
  56309     return rv;
  56310 }
  56311 
  56312 /* 
  56313  * To get the qualified inputs on the higher 32 bits of opaque tag
  56314  * allowed in the system.
  56315  */
  56316 int bcm_esw_field_qualify_OpaqueTagHigh_get(
  56317     int unit, 
  56318     bcm_field_entry_t entry, 
  56319     uint32 *data, 
  56320     uint32 *mask)
  56321 {
  56322     int rv = BCM_E_UNAVAIL;
  56323 
  56324 #if defined(BCM_TOMAHAWK3_SUPPORT)
  56325     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  56326        FP_LOCK(unit);
  56327        /* Read qualifier match value and mask. */
  56328        rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  56329                                           bcmFieldQualifyOpaqueTagHigh,
  56330                                           data, mask);
  56331        FP_UNLOCK(unit);
  56332     }
  56333 #endif /* BCM_TOMAHAWK3_SUPPORT */
  56334 
  56335     return rv;
  56336 }
  56337 
  56338 /* Qualifies on the lower 32 bits of opaque tag allowed in the system */
  56339 int bcm_esw_field_qualify_OpaqueTagLow(
  56340     int unit, 
  56341     bcm_field_entry_t entry, 
  56342     uint32 data, 
  56343     uint32 mask)
  56344 {
  56345     int rv = BCM_E_UNAVAIL;
  56346 
  56347 #if defined(BCM_TOMAHAWK3_SUPPORT)
  56348     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  56349        FP_LOCK(unit);
  56350        rv = _field_qualify32(unit, entry,
  56351                              bcmFieldQualifyOpaqueTagLow,
  56352                              data, mask);
  56353        FP_UNLOCK(unit);
  56354     }
  56355 #endif /* BCM_TOMAHAWK3_SUPPORT */
  56356 
  56357     return rv;
  56358 }
  56359 
  56360 /* 
  56361  * To get the qualified inputs on the lower 32 bits of opaque tag allowed
  56362  * in the system.
  56363  */
  56364 int bcm_esw_field_qualify_OpaqueTagLow_get(
  56365     int unit, 
  56366     bcm_field_entry_t entry, 
  56367     uint32 *data, 
  56368     uint32 *mask)
  56369 {
  56370     int rv = BCM_E_UNAVAIL;
  56371 
  56372 #if defined(BCM_TOMAHAWK3_SUPPORT)
  56373     if (soc_feature(unit, soc_feature_th3_style_fp)) {
  56374        FP_LOCK(unit);
  56375        /* Read qualifier match value and mask. */
  56376        rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  56377                                           bcmFieldQualifyOpaqueTagLow,
  56378                                           data, mask);
  56379        FP_UNLOCK(unit);
  56380     }
  56381 #endif /* BCM_TOMAHAWK3_SUPPORT */
  56382 
  56383     return rv;
  56384 }
  56385 
  56386 /*
  56387  * Set qualification to define packet flow for a given entry. This API is
  56388  * normally used for preselectors.
  56389  */
  56390 int bcm_esw_field_qualify_PktFlowType(
  56391     int unit,
  56392     bcm_field_entry_t entry,
  56393     bcm_field_pkt_flow_type_t type)
  56394 {
  56395     int rv = BCM_E_UNAVAIL;
  56396 #if defined(BCM_TRIDENT3_SUPPORT)
  56397     if (soc_feature(unit, soc_feature_td3_style_fp) &&
  56398         soc_feature(unit, soc_feature_field_preselector_support) &&
  56399         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
  56400        uint32  data32, mask32;
  56401 
  56402        FP_LOCK(unit);
  56403        data32 = mask32 = type;
  56404        /* coverity[address_of : FALSE] */
  56405        /* coverity[callee_ptr_arith : FALSE] */
  56406        rv = _bcm_field_presel_qualify_set(unit, entry,
  56407                                           bcmFieldQualifyPktFlowType,
  56408                                           &data32, &mask32);
  56409        FP_UNLOCK(unit);
  56410     }
  56411 #endif /* BCM_TRIDENT3_SUPPORT */
  56412     return (rv);
  56413 }
  56414 
  56415 /* 
  56416  * Retrieve packet flow type configured for given entry id. This API is
  56417  * normally used for preselectors.
  56418  */
  56419 int bcm_esw_field_qualify_PktFlowType_get(
  56420     int unit,
  56421     bcm_field_entry_t entry,
  56422     bcm_field_pkt_flow_type_t *type)
  56423 {
  56424     int rv = BCM_E_UNAVAIL;
  56425 
  56426 #if defined(BCM_TRIDENT3_SUPPORT)
  56427     if (soc_feature(unit, soc_feature_td3_style_fp) &&
  56428         soc_feature(unit, soc_feature_field_preselector_support) &&
  56429         (_BCM_FIELD_IS_PRESEL_ENTRY(entry) == TRUE)) {
  56430        _bcm_field_qual_data_t q_data = {0};
  56431        _bcm_field_qual_data_t q_mask = {0};
  56432 
  56433        /* Get field control structure. */
  56434        FP_LOCK(unit);
  56435        rv = _bcm_field_presel_qualifier_get(unit, entry,
  56436                                             bcmFieldQualifyPktFlowType,
  56437                                             q_data, q_mask);
  56438        *type = q_data[0];
  56439        FP_UNLOCK(unit);
  56440     }
  56441 #endif /* BCM_TRIDENT3_SUPPORT */
  56442     return (rv);
  56443 }
  56444 
  56445 int
  56446 bcm_esw_field_qualify_InnerDosAttack(
  56447     int unit,
  56448     bcm_field_entry_t entry,
  56449     uint8 data,
  56450     uint8 mask)
  56451 {
  56452     int rv = BCM_E_UNAVAIL;
  56453 
  56454 #if defined(BCM_HELIX5_SUPPORT)
  56455     if (soc_feature(unit, soc_feature_broadscan_dos_ctrl)) {
  56456         FP_LOCK(unit);
  56457 
  56458         rv = _field_qualify32(unit, entry,
  56459                 bcmFieldQualifyInnerDosAttack, data, mask);
  56460         FP_UNLOCK(unit);
  56461     }
  56462 #endif
  56463 
  56464     return (rv);
  56465 }
  56466 
  56467 /*
  56468  * Function:
  56469  *    bcm_esw_field_qualify_InnerDosAttack_get
  56470  *
  56471  * Purpose:
  56472  *    To get match criteria for bcmFieldQualifyInnerDosAttack
  56473  *    qualifier from the field entry.
  56474  *
  56475  * Parameters:
  56476  *    unit     BCM device number.
  56477  *    entry    Field entry ID.
  56478  *    data     Qualifier match data.
  56479  *    mask     Qualifier match mask.
  56480  *
  56481  * Returns:
  56482  *    BCM_E_NONE        Operation completed successfully.
  56483  *    BCM_E_INIT        BCM unit not initialized.
  56484  *    BCM_E_NOT_FOUND   Entry ID not found.
  56485  *    BCM_E_UNAVAIL     Qualifier not supported.
  56486  */
  56487 int
  56488 bcm_esw_field_qualify_InnerDosAttack_get(
  56489     int unit,
  56490     bcm_field_entry_t entry,
  56491     uint8 *data,
  56492     uint8 *mask)
  56493 {
  56494     int rv = BCM_E_UNAVAIL;
  56495 
  56496     /* Read qualifier match value and mask. */
  56497 #if defined(BCM_HELIX5_SUPPORT)
  56498     if (soc_feature(unit, soc_feature_broadscan_dos_ctrl)) {
  56499         rv =  _bcm_field_entry_qualifier_uint8_get(unit, entry,
  56500                 bcmFieldQualifyInnerDosAttack,
  56501                 data, mask);
  56502     }
  56503 #endif
  56504     return rv;
  56505 }
  56506 
  56507 /*
  56508  * Function:
  56509  *    bcm_esw_field_qualify_DosAttackEvents
  56510  *
  56511  * Purpose:
  56512  *    Configure match criteria for bcmFieldQualifyInnerDosAttack
  56513  *    qualifier for the field entry.
  56514  *
  56515  * Parameters:
  56516  *    unit     BCM device number.
  56517  *    entry    Field entry ID.
  56518  *    data     Qualifier match data.
  56519  *    mask     Qualifier match mask.
  56520  *
  56521  * Returns:
  56522  *    BCM_E_NONE        Operation completed successfully.
  56523  *    BCM_E_INIT        BCM unit not initialized.
  56524  *    BCM_E_NOT_FOUND   Entry ID not found.
  56525  *    BCM_E_UNAVAIL     Qualifier not supported.
  56526  */
  56527 int
  56528 bcm_esw_field_qualify_DosAttackEvents(
  56529     int unit,
  56530     bcm_field_entry_t entry,
  56531     uint32 data,
  56532     uint32 mask)
  56533 {
  56534     int rv = BCM_E_UNAVAIL;
  56535 
  56536 #if defined(BCM_HELIX5_SUPPORT)
  56537     if (soc_feature(unit, soc_feature_broadscan_dos_ctrl)) {
  56538         FP_LOCK(unit);
  56539 
  56540         rv = _field_qualify32(unit, entry,
  56541                 bcmFieldQualifyDosAttackEvents,
  56542                 data, mask);
  56543         FP_UNLOCK(unit);
  56544     }
  56545 #endif
  56546 
  56547     return (rv);
  56548 }
  56549 
  56550 /*
  56551  * Function:
  56552  *    bcm_esw_field_qualify_DosAttackEvents_get
  56553  *
  56554  * Purpose:
  56555  *    To get match criteria for bcmFieldQualifyDosAttackEvents
  56556  *    qualifier from the field entry.
  56557  *
  56558  * Parameters:
  56559  *    unit     BCM device number.
  56560  *    entry    Field entry ID.
  56561  *    data     Qualifier match data.
  56562  *    mask     Qualifier match mask.
  56563  *
  56564  * Returns:
  56565  *    BCM_E_NONE        Operation completed successfully.
  56566  *    BCM_E_INIT        BCM unit not initialized.
  56567  *    BCM_E_NOT_FOUND   Entry ID not found.
  56568  *    BCM_E_UNAVAIL     Qualifier not supported.
  56569  */
  56570 int
  56571 bcm_esw_field_qualify_DosAttackEvents_get(
  56572     int unit,
  56573     bcm_field_entry_t entry,
  56574     uint32 *data,
  56575     uint32 *mask)
  56576 {
  56577     int rv = BCM_E_UNAVAIL;
  56578 
  56579     /* Read qualifier match value and mask. */
  56580 #if defined(BCM_HELIX5_SUPPORT)
  56581     if (soc_feature(unit, soc_feature_broadscan_dos_ctrl)) {
  56582         rv =  _bcm_field_entry_qualifier_uint32_get(unit, entry,
  56583                 bcmFieldQualifyDosAttackEvents, data, mask);
  56584     }
  56585 #endif
  56586 
  56587     return rv;
  56588 }
  56589 
  56590 /*
  56591  * Function:
  56592  *    bcm_esw_field_qualify_InnerDosAttackEvents
  56593  *
  56594  * Purpose:
  56595  *    Configure match criteria for bcmFieldQualifyInnerDosAttackEvents
  56596  *    qualifier for the field entry.
  56597  *
  56598  * Parameters:
  56599  *    unit     BCM device number.
  56600  *    entry    Field entry ID.
  56601  *    data     Qualifier match data.
  56602  *    mask     Qualifier match mask.
  56603  *
  56604  * Returns:
  56605  *    BCM_E_NONE        Operation completed successfully.
  56606  *    BCM_E_INIT        BCM unit not initialized.
  56607  *    BCM_E_NOT_FOUND   Entry ID not found.
  56608  *    BCM_E_UNAVAIL     Qualifier not supported.
  56609  */
  56610 int
  56611 bcm_esw_field_qualify_InnerDosAttackEvents(
  56612     int unit,
  56613     bcm_field_entry_t entry,
  56614     uint32 data,
  56615     uint32 mask)
  56616 {
  56617     int rv = BCM_E_UNAVAIL;
  56618 
  56619 #if defined(BCM_HELIX5_SUPPORT)
  56620     if (soc_feature(unit, soc_feature_broadscan_dos_ctrl)) {
  56621         FP_LOCK(unit);
  56622 
  56623         rv = _field_qualify32(unit, entry,
  56624                 bcmFieldQualifyInnerDosAttackEvents,
  56625                 data, mask);
  56626         FP_UNLOCK(unit);
  56627     }
  56628 #endif
  56629 
  56630     return (rv);
  56631 }
  56632 
  56633 /*
  56634  * Function:
  56635  *    bcm_esw_field_qualify_InnerDosAttackEvents_get
  56636  *
  56637  * Purpose:
  56638  *    To get match criteria for bcmFieldQualifyInnerDosAttackEvents
  56639  *    qualifier from the field entry.
  56640  *
  56641  * Parameters:
  56642  *    unit     BCM device number.
  56643  *    entry    Field entry ID.
  56644  *    data     Qualifier match data.
  56645  *    mask     Qualifier match mask.
  56646  *
  56647  * Returns:
  56648  *    BCM_E_NONE        Operation completed successfully.
  56649  *    BCM_E_INIT        BCM unit not initialized.
  56650  *    BCM_E_NOT_FOUND   Entry ID not found.
  56651  *    BCM_E_UNAVAIL     Qualifier not supported.
  56652  */
  56653 int
  56654 bcm_esw_field_qualify_InnerDosAttackEvents_get(
  56655     int unit,
  56656     bcm_field_entry_t entry,
  56657     uint32 *data,
  56658     uint32 *mask)
  56659 {
  56660     int rv = BCM_E_UNAVAIL;
  56661 
  56662     /* Read qualifier match value and mask. */
  56663 #if defined(BCM_HELIX5_SUPPORT)
  56664     if (soc_feature(unit, soc_feature_broadscan_dos_ctrl)) {
  56665         rv =  _bcm_field_entry_qualifier_uint32_get(unit, entry,
  56666                 bcmFieldQualifyInnerDosAttackEvents, data, mask);
  56667     }
  56668 #endif
  56669 
  56670     return rv;
  56671 }
  56672 
  56673 /*
  56674  * Function:
  56675  *     bcm_esw_field_qualify_EgressForwardingClassId
  56676  *
  56677  * Purpose:
  56678  *    To Qualify on Class identifier assigned by Egress adaptation forwarding tables
  56679  *
  56680  * Parameters:
  56681  *    unit     BCM device number
  56682  *    entry    Field entry ID
  56683  *    data     Qualifier match data
  56684  *    mask     Qualifier match mask
  56685  *
  56686  * Returns:
  56687  *    BCM_E_NONE        Operation completed successfully
  56688  *    BCM_E_INIT        BCM unit not initialized
  56689  *    BCM_E_PARAM       Invalid Parameter passed
  56690  *    BCM_E_NOT_FOUND   Entry ID not found
  56691  */
  56692 int
  56693 bcm_esw_field_qualify_EgressForwardingClassId(
  56694         int unit,
  56695         bcm_field_entry_t entry,
  56696         int data,
  56697         int mask)
  56698 {
  56699     int              rv = BCM_E_UNAVAIL;       /* Operation return status. */
  56700 
  56701 #if defined(BCM_TRIDENT3_SUPPORT)
  56702     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  56703         FP_LOCK(unit);
  56704 
  56705         rv = _field_qualify32(unit, entry, bcmFieldQualifyEgressForwardingClassId,
  56706                               data, mask);
  56707         FP_UNLOCK(unit);
  56708     }
  56709 #endif
  56710     return (rv);
  56711 }
  56712 
  56713 /*
  56714  * Function:
  56715  *     bcm_esw_field_qualify_EgressForwardingClassId
  56716  *
  56717  * Purpose:
  56718  *    To get the qualified inputs on Class identifier assigned by Egress adaptation forwarding tables
  56719  *
  56720  * Parameters:
  56721  *    unit     BCM device number
  56722  *    entry    Field entry ID
  56723  *    data     Qualifier match data
  56724  *    mask     Qualifier match mask
  56725  *
  56726  * Returns:
  56727  *    BCM_E_NONE        Operation completed successfully
  56728  *    BCM_E_INIT        BCM unit not initialized
  56729  *    BCM_E_PARAM       Invalid Parameter passed
  56730  *    BCM_E_NOT_FOUND   Entry ID not found
  56731  */
  56732 int
  56733 bcm_esw_field_qualify_EgressForwardingClassId_get(
  56734         int unit,
  56735         bcm_field_entry_t entry,
  56736         int *data,
  56737         int *mask)
  56738 {
  56739     int rv = BCM_E_UNAVAIL;
  56740 #if defined(BCM_TRIDENT3_SUPPORT)
  56741     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  56742         FP_LOCK(unit);
  56743         /* Read qualifier match value and mask. */ 
  56744         rv = _bcm_field_entry_qualifier_uint32_get(unit,
  56745                                                    entry,
  56746                                                    bcmFieldQualifyEgressForwardingClassId,
  56747                                                    (uint32 *)data,
  56748                                                    (uint32 *)mask);
  56749         FP_UNLOCK(unit);
  56750     }
  56751 #endif
  56752     return rv;
  56753 }
  56754 
  56755 /*
  56756  * Function:
  56757  *     bcm_esw_field_qualify_VlanTranslateClassId
  56758  *
  56759  * Purpose:
  56760  *    To qualify on Class identifier assigned by Vlan Translation tables 
  56761  *
  56762  * Parameters:
  56763  *    unit     BCM device number
  56764  *    entry    Field entry ID
  56765  *    data     Qualifier match data
  56766  *    mask     Qualifier match mask
  56767  *
  56768  * Returns:
  56769  *    BCM_E_NONE        Operation completed successfully
  56770  *    BCM_E_INIT        BCM unit not initialized
  56771  *    BCM_E_PARAM       Invalid Parameter passed
  56772  *    BCM_E_NOT_FOUND   Entry ID not found
  56773  */
  56774 int
  56775 bcm_esw_field_qualify_VlanTranslateClassId(
  56776         int unit,
  56777         bcm_field_entry_t entry,
  56778         uint16 data,
  56779         uint16 mask)
  56780 {
  56781     int rv = BCM_E_UNAVAIL;
  56782 #if defined(BCM_TRIDENT3_SUPPORT)
  56783     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  56784         if (data >> 12) {
  56785             return (BCM_E_PARAM);
  56786         }
  56787         FP_LOCK(unit);
  56788         rv = _field_qualify32(unit,
  56789                               entry,
  56790                               bcmFieldQualifyVlanTranslateClassId,
  56791                               data,
  56792                               mask);
  56793         FP_UNLOCK(unit);
  56794     }
  56795 #endif
  56796     return rv;
  56797 }
  56798 
  56799 /*
  56800  * Function:
  56801  *     bcm_esw_field_qualify_VlanTranslateClassId_get
  56802  *
  56803  * Purpose:
  56804  *    To get qualified inputs on Class identifier assigned by Vlan Translation tables 
  56805  *
  56806  * Parameters:
  56807  *    unit     BCM device number
  56808  *    entry    Field entry ID
  56809  *    data     Qualifier match data
  56810  *    mask     Qualifier match mask
  56811  *
  56812  * Returns:
  56813  *    BCM_E_NONE        Operation completed successfully
  56814  *    BCM_E_INIT        BCM unit not initialized
  56815  *    BCM_E_PARAM       Invalid Parameter passed
  56816  *    BCM_E_NOT_FOUND   Entry ID not found
  56817  */
  56818 int
  56819 bcm_esw_field_qualify_VlanTranslateClassId_get(
  56820         int unit,
  56821         bcm_field_entry_t entry,
  56822         uint16 *data,
  56823         uint16 *mask)
  56824 {
  56825     int rv = BCM_E_UNAVAIL;
  56826 #if defined(BCM_TRIDENT3_SUPPORT)
  56827     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  56828         FP_LOCK(unit);
  56829         /* Read qualifier match value and mask. */ 
  56830         rv = _bcm_field_entry_qualifier_uint16_get(unit,
  56831                                                    entry, 
  56832                                                    bcmFieldQualifyVlanTranslateClassId,
  56833                                                    data,
  56834                                                    mask);
  56835         FP_UNLOCK(unit);
  56836     }
  56837 #endif
  56838     return rv;
  56839 }
  56840 
  56841 /* To Qualify on identifier field available in IP header. */
  56842 int bcm_esw_field_qualify_IpIdentifier(
  56843     int unit,
  56844     bcm_field_entry_t entry,
  56845     uint16 data,
  56846     uint16 mask)
  56847 {
  56848     int rv = BCM_E_UNAVAIL;
  56849 #if defined(BCM_TRIDENT3_SUPPORT)
  56850     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  56851         FP_LOCK(unit);
  56852         rv = _field_qualify32(unit,
  56853                               entry,
  56854                               bcmFieldQualifyIpIdentifier,
  56855                               data,
  56856                               mask);
  56857         FP_UNLOCK(unit);
  56858     }
  56859 #endif
  56860     return rv;
  56861 }
  56862 
  56863 /* To get the qualified inputs on IP identifier. */
  56864 int bcm_esw_field_qualify_IpIdentifier_get(
  56865     int unit,
  56866     bcm_field_entry_t entry,
  56867     uint16 *data,
  56868     uint16 *mask)
  56869 {
  56870     int rv = BCM_E_UNAVAIL;
  56871 #if defined(BCM_TRIDENT3_SUPPORT)
  56872     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  56873         FP_LOCK(unit);
  56874         /* Read qualifier match value and mask. */ 
  56875         rv = _bcm_field_entry_qualifier_uint16_get(unit,
  56876                                                    entry, 
  56877                                                    bcmFieldQualifyIpIdentifier,
  56878                                                    data,
  56879                                                    mask);
  56880         FP_UNLOCK(unit);
  56881     }
  56882 #endif
  56883     return rv;
  56884 }
  56885 
  56886 /*
  56887  * Function:
  56888  *     bcm_esw_field_qualify_Ip4Length
  56889  *
  56890  * Purpose:
  56891  *    Configure match criteria for bcmFieldQualifyIp4Length
  56892  *    qualifier for the field entry.
  56893  *
  56894  * Parameters:
  56895  *    unit     BCM device number
  56896  *    entry    Field entry ID
  56897  *    data     Qualifier match data
  56898  *    mask     Qualifier match mask
  56899  *
  56900  * Returns:
  56901  *    BCM_E_NONE        Operation completed successfully
  56902  *    BCM_E_INIT        BCM unit not initialized
  56903  *    BCM_E_PARAM       Invalid Parameter passed
  56904  *    BCM_E_NOT_FOUND   Entry ID not found
  56905  *    BCM_E_UNAVAIL     Qualifier unavailable
  56906  */
  56907 int
  56908 bcm_esw_field_qualify_Ip4Length(
  56909     int unit,
  56910     bcm_field_entry_t entry,
  56911     uint16 data,
  56912     uint16 mask)
  56913 {
  56914     int rv = BCM_E_UNAVAIL;
  56915 
  56916 #if defined(BCM_HELIX5_SUPPORT)
  56917     FP_LOCK(unit);
  56918     rv = _field_qualify32(unit, entry,
  56919             bcmFieldQualifyIp4Length,
  56920             data, mask);
  56921     FP_UNLOCK(unit);
  56922 #endif
  56923 
  56924     return rv;
  56925 }
  56926 
  56927 /*
  56928  * Function:
  56929  *     bcm_esw_field_qualify_Ip4Length_get
  56930  *
  56931  * Purpose:
  56932  *    Get match criteria for bcmFieldQualifyIp4Length
  56933  *    qualifier from the field entry.
  56934  *
  56935  * Parameters:
  56936  *    unit     BCM device number
  56937  *    entry    Field entry ID
  56938  *    data     Qualifier match data
  56939  *    mask     Qualifier match mask
  56940  *
  56941  * Returns:
  56942  *    BCM_E_NONE        Operation completed successfully
  56943  *    BCM_E_INIT        BCM unit not initialized
  56944  *    BCM_E_PARAM       Invalid Parameter passed
  56945  *    BCM_E_NOT_FOUND   Entry ID not found
  56946  *    BCM_E_UNAVAIL     Qualifier unavailable
  56947  */
  56948 int
  56949 bcm_esw_field_qualify_Ip4Length_get(
  56950     int unit,
  56951     bcm_field_entry_t entry,
  56952     uint16 *data,
  56953     uint16 *mask)
  56954 {
  56955     int rv = BCM_E_UNAVAIL;
  56956 
  56957 #if defined(BCM_HELIX5_SUPPORT)
  56958     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  56959             bcmFieldQualifyIp4Length, data, mask);
  56960 #endif
  56961 
  56962     return rv;
  56963 }
  56964 
  56965 /*
  56966  * Function:
  56967  *     bcm_esw_field_qualify_Ip6Length
  56968  *
  56969  * Purpose:
  56970  *    Configure match criteria for bcmFieldQualifyIp6Length
  56971  *    qualifier for the field entry.
  56972  *
  56973  * Parameters:
  56974  *    unit     BCM device number
  56975  *    entry    Field entry ID
  56976  *    data     Qualifier match data
  56977  *    mask     Qualifier match mask
  56978  *
  56979  * Returns:
  56980  *    BCM_E_NONE        Operation completed successfully
  56981  *    BCM_E_INIT        BCM unit not initialized
  56982  *    BCM_E_PARAM       Invalid Parameter passed
  56983  *    BCM_E_NOT_FOUND   Entry ID not found
  56984  *    BCM_E_UNAVAIL     Qualifier unavailable
  56985  */
  56986 int
  56987 bcm_esw_field_qualify_Ip6Length(
  56988     int unit,
  56989     bcm_field_entry_t entry,
  56990     uint16 data,
  56991     uint16 mask)
  56992 {
  56993     int rv = BCM_E_UNAVAIL;
  56994 
  56995 #if defined(BCM_HELIX5_SUPPORT)
  56996     FP_LOCK(unit);
  56997     rv = _field_qualify32(unit, entry,
  56998             bcmFieldQualifyIp6Length,
  56999             data, mask);
  57000     FP_UNLOCK(unit);
  57001 #endif
  57002 
  57003     return rv;
  57004 }
  57005 
  57006 /*
  57007  * Function:
  57008  *     bcm_esw_field_qualify_Ip6Length_get
  57009  *
  57010  * Purpose:
  57011  *    Get match criteria for bcmFieldQualifyIp6Length
  57012  *    qualifier from the field entry.
  57013  *
  57014  * Parameters:
  57015  *    unit     BCM device number
  57016  *    entry    Field entry ID
  57017  *    data     Qualifier match data
  57018  *    mask     Qualifier match mask
  57019  *
  57020  * Returns:
  57021  *    BCM_E_NONE        Operation completed successfully
  57022  *    BCM_E_INIT        BCM unit not initialized
  57023  *    BCM_E_PARAM       Invalid Parameter passed
  57024  *    BCM_E_NOT_FOUND   Entry ID not found
  57025  *    BCM_E_UNAVAIL     Qualifier unavailable
  57026  */
  57027 int
  57028 bcm_esw_field_qualify_Ip6Length_get(
  57029     int unit,
  57030     bcm_field_entry_t entry,
  57031     uint16 *data,
  57032     uint16 *mask)
  57033 {
  57034     int rv = BCM_E_UNAVAIL;
  57035 
  57036 #if defined(BCM_HELIX5_SUPPORT)
  57037     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57038             bcmFieldQualifyIp6Length, data, mask);
  57039 #endif
  57040 
  57041     return rv;
  57042 }
  57043 
  57044 /*
  57045  * Function:
  57046  *     bcm_esw_field_qualify_TunnelPayloadIp4Length
  57047  *
  57048  * Purpose:
  57049  *    Configure match criteria for bcmFieldQualifyTunnelPayloadIp4Length
  57050  *    qualifier for the field entry.
  57051  *
  57052  * Parameters:
  57053  *    unit     BCM device number
  57054  *    entry    Field entry ID
  57055  *    data     Qualifier match data
  57056  *    mask     Qualifier match mask
  57057  *
  57058  * Returns:
  57059  *    BCM_E_NONE        Operation completed successfully
  57060  *    BCM_E_INIT        BCM unit not initialized
  57061  *    BCM_E_PARAM       Invalid Parameter passed
  57062  *    BCM_E_NOT_FOUND   Entry ID not found
  57063  *    BCM_E_UNAVAIL     Qualifier unavailable
  57064  */
  57065 int
  57066 bcm_esw_field_qualify_TunnelPayloadIp4Length(
  57067     int unit,
  57068     bcm_field_entry_t entry,
  57069     uint16 data,
  57070     uint16 mask)
  57071 {
  57072     int rv = BCM_E_UNAVAIL;
  57073 
  57074 #if defined(BCM_HELIX5_SUPPORT)
  57075     FP_LOCK(unit);
  57076     rv = _field_qualify32(unit, entry,
  57077             bcmFieldQualifyTunnelPayloadIp4Length,
  57078             data, mask);
  57079     FP_UNLOCK(unit);
  57080 #endif
  57081 
  57082     return rv;
  57083 }
  57084 
  57085 /*
  57086  * Function:
  57087  *     bcm_esw_field_qualify_TunnelPayloadIp4Length_get
  57088  *
  57089  * Purpose:
  57090  *    Get match criteria for bcmFieldQualifyTunnelPayloadIp4Length
  57091  *    qualifier from the field entry.
  57092  *
  57093  * Parameters:
  57094  *    unit     BCM device number
  57095  *    entry    Field entry ID
  57096  *    data     Qualifier match data
  57097  *    mask     Qualifier match mask
  57098  *
  57099  * Returns:
  57100  *    BCM_E_NONE        Operation completed successfully
  57101  *    BCM_E_INIT        BCM unit not initialized
  57102  *    BCM_E_PARAM       Invalid Parameter passed
  57103  *    BCM_E_NOT_FOUND   Entry ID not found
  57104  *    BCM_E_UNAVAIL     Qualifier unavailable
  57105  */
  57106 int
  57107 bcm_esw_field_qualify_TunnelPayloadIp4Length_get(
  57108     int unit,
  57109     bcm_field_entry_t entry,
  57110     uint16 *data,
  57111     uint16 *mask)
  57112 {
  57113     int rv = BCM_E_UNAVAIL;
  57114 
  57115 #if defined(BCM_HELIX5_SUPPORT)
  57116     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57117             bcmFieldQualifyTunnelPayloadIp4Length, data, mask);
  57118 #endif
  57119 
  57120     return rv;
  57121 }
  57122 
  57123 /*
  57124  * Function:
  57125  *     bcm_esw_field_qualify_TunnelPayloadIp6Length
  57126  *
  57127  * Purpose:
  57128  *    Configure match criteria for bcmFieldQualifyTunnelPayloadIp6Length
  57129  *    qualifier for the field entry.
  57130  *
  57131  * Parameters:
  57132  *    unit     BCM device number
  57133  *    entry    Field entry ID
  57134  *    data     Qualifier match data
  57135  *    mask     Qualifier match mask
  57136  *
  57137  * Returns:
  57138  *    BCM_E_NONE        Operation completed successfully
  57139  *    BCM_E_INIT        BCM unit not initialized
  57140  *    BCM_E_PARAM       Invalid Parameter passed
  57141  *    BCM_E_NOT_FOUND   Entry ID not found
  57142  *    BCM_E_UNAVAIL     Qualifier unavailable
  57143  */
  57144 int
  57145 bcm_esw_field_qualify_TunnelPayloadIp6Length(
  57146     int unit,
  57147     bcm_field_entry_t entry,
  57148     uint16 data,
  57149     uint16 mask)
  57150 {
  57151     int rv = BCM_E_UNAVAIL;
  57152 
  57153 #if defined(BCM_HELIX5_SUPPORT)
  57154     FP_LOCK(unit);
  57155     rv = _field_qualify32(unit, entry,
  57156             bcmFieldQualifyTunnelPayloadIp6Length,
  57157             data, mask);
  57158     FP_UNLOCK(unit);
  57159 #endif
  57160 
  57161     return rv;
  57162 }
  57163 
  57164 /*
  57165  * Function:
  57166  *     bcm_esw_field_qualify_TunnelPayloadIp6Length_get
  57167  *
  57168  * Purpose:
  57169  *    Get match criteria for bcmFieldQualifyTunnelPayloadIp6Length
  57170  *    qualifier from the field entry.
  57171  *
  57172  * Parameters:
  57173  *    unit     BCM device number
  57174  *    entry    Field entry ID
  57175  *    data     Qualifier match data
  57176  *    mask     Qualifier match mask
  57177  *
  57178  * Returns:
  57179  *    BCM_E_NONE        Operation completed successfully
  57180  *    BCM_E_INIT        BCM unit not initialized
  57181  *    BCM_E_PARAM       Invalid Parameter passed
  57182  *    BCM_E_NOT_FOUND   Entry ID not found
  57183  *    BCM_E_UNAVAIL     Qualifier unavailable
  57184  */
  57185 int
  57186 bcm_esw_field_qualify_TunnelPayloadIp6Length_get(
  57187     int unit,
  57188     bcm_field_entry_t entry,
  57189     uint16 *data,
  57190     uint16 *mask)
  57191 {
  57192     int rv = BCM_E_UNAVAIL;
  57193 
  57194 #if defined(BCM_HELIX5_SUPPORT)
  57195     rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57196             bcmFieldQualifyTunnelPayloadIp6Length, data, mask);
  57197 #endif
  57198 
  57199     return rv;
  57200 }
  57201 
  57202 int
  57203 bcm_esw_field_qualify_GbpPresent(
  57204         int unit,
  57205         bcm_field_entry_t entry,
  57206         uint8 data,
  57207         uint8 mask)
  57208 {
  57209     int rv = BCM_E_UNAVAIL;
  57210 
  57211 #if defined(BCM_HELIX5_SUPPORT)
  57212     if (SOC_IS_HELIX5(unit)) {
  57213        FP_LOCK(unit);
  57214        rv = _field_qualify32(unit, entry, bcmFieldQualifyGbpPresent,
  57215                              data, mask);
  57216        FP_UNLOCK(unit);
  57217     }
  57218 #endif /* BCM_HELIX5_SUPPORT */
  57219     return (rv);
  57220 }
  57221 
  57222 int
  57223 bcm_esw_field_qualify_GbpPresent_get(
  57224         int unit,
  57225         bcm_field_entry_t entry,
  57226         uint8 *data,
  57227         uint8 *mask)
  57228 {
  57229     int rv = BCM_E_UNAVAIL;
  57230 
  57231 #if defined(BCM_HELIX5_SUPPORT)
  57232     if (SOC_IS_HELIX5(unit)) {
  57233       /* Read qualifier match value and mask. */
  57234       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  57235                                             bcmFieldQualifyGbpPresent,
  57236                                             data, mask);
  57237     }
  57238 #endif /* BCM_HELIX5_SUPPORT */
  57239     return (rv);
  57240 }
  57241 
  57242 int
  57243 bcm_esw_field_qualify_HiGigGbpPresent(
  57244         int unit,
  57245         bcm_field_entry_t entry,
  57246         uint8 data,
  57247         uint8 mask)
  57248 {
  57249     int rv = BCM_E_UNAVAIL;
  57250 
  57251 #if defined(BCM_HELIX5_SUPPORT)
  57252     if (SOC_IS_HELIX5(unit)) {
  57253        FP_LOCK(unit);
  57254        rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigGbpPresent,
  57255                              data, mask);
  57256        FP_UNLOCK(unit);
  57257     }
  57258 #endif /* BCM_HELIX5_SUPPORT */
  57259     return (rv);
  57260 }
  57261 
  57262 int
  57263 bcm_esw_field_qualify_HiGigGbpPresent_get(
  57264         int unit,
  57265         bcm_field_entry_t entry,
  57266         uint8 *data,
  57267         uint8 *mask)
  57268 {
  57269     int rv = BCM_E_UNAVAIL;
  57270 
  57271 #if defined(BCM_HELIX5_SUPPORT)
  57272     if (SOC_IS_HELIX5(unit)) {
  57273       /* Read qualifier match value and mask. */
  57274       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  57275                                             bcmFieldQualifyHiGigGbpPresent,
  57276                                             data, mask);
  57277     }
  57278 #endif /* BCM_HELIX5_SUPPORT */
  57279     return (rv);
  57280 }
  57281 
  57282 int
  57283 bcm_esw_field_qualify_VxlanGbpPresent(
  57284         int unit,
  57285         bcm_field_entry_t entry,
  57286         uint8 data,
  57287         uint8 mask)
  57288 {
  57289     int rv = BCM_E_UNAVAIL;
  57290 
  57291 #if defined(BCM_TRIDENT3_SUPPORT)
  57292     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57293        FP_LOCK(unit);
  57294        rv = _field_qualify32(unit, entry, bcmFieldQualifyVxlanGbpPresent,
  57295                              data, mask);
  57296        FP_UNLOCK(unit);
  57297     }
  57298 #endif /* BCM_TRIDENT3_SUPPORT*/
  57299     return (rv);
  57300 }
  57301 
  57302 int
  57303 bcm_esw_field_qualify_VxlanGbpPresent_get(
  57304         int unit,
  57305         bcm_field_entry_t entry,
  57306         uint8 *data,
  57307         uint8 *mask)
  57308 {
  57309     int rv = BCM_E_UNAVAIL;
  57310 
  57311 #if defined(BCM_TRIDENT3_SUPPORT)
  57312     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57313       /* Read qualifier match value and mask. */
  57314       return _bcm_field_entry_qualifier_uint8_get(unit, entry,
  57315                                             bcmFieldQualifyVxlanGbpPresent,
  57316                                             data, mask);
  57317     }
  57318 #endif /* BCM_TRIDENT3_SUPPORT*/
  57319     return (rv);
  57320 }
  57321 
  57322 int
  57323 bcm_esw_field_qualify_HiGigGbpSrcId(
  57324         int unit,
  57325         bcm_field_entry_t entry,
  57326         uint16 data,
  57327         uint16 mask)
  57328 {
  57329     int rv = BCM_E_UNAVAIL;
  57330 
  57331 #if defined(BCM_TRIDENT3_SUPPORT)
  57332     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57333         FP_LOCK(unit);
  57334         rv = _field_qualify32(unit, entry, bcmFieldQualifyHiGigGbpSrcId,
  57335                 data, mask);
  57336         FP_UNLOCK(unit);
  57337     }
  57338 #endif /* BCM_TRIDENT3_SUPPORT */
  57339     return (rv);
  57340 }
  57341 
  57342 int
  57343 bcm_esw_field_qualify_HiGigGbpSrcId_get(
  57344         int unit,
  57345         bcm_field_entry_t entry,
  57346         uint16 *data,
  57347         uint16 *mask)
  57348 {
  57349     int rv = BCM_E_UNAVAIL;
  57350 
  57351 #if defined(BCM_TRIDENT3_SUPPORT)
  57352     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57353       /* Read qualifier match value and mask. */
  57354       return _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57355                                             bcmFieldQualifyHiGigGbpSrcId,
  57356                                             data, mask);
  57357     }
  57358 #endif /* BCM_TRIDENT3_SUPPORT */
  57359     return (rv);
  57360 }
  57361 
  57362 int
  57363 bcm_esw_field_qualify_GbpSrcId(
  57364         int unit,
  57365         bcm_field_entry_t entry,
  57366         uint16 data,
  57367         uint16 mask)
  57368 {
  57369     int rv = BCM_E_UNAVAIL;
  57370 
  57371 #if defined(BCM_TRIDENT3_SUPPORT)
  57372     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57373         FP_LOCK(unit);
  57374         rv = _field_qualify32(unit, entry, bcmFieldQualifyGbpSrcId,
  57375                 data, mask);
  57376         FP_UNLOCK(unit);
  57377     }
  57378 #endif /* BCM_TRIDENT3_SUPPORT */
  57379     return (rv);
  57380 }
  57381 
  57382 int
  57383 bcm_esw_field_qualify_GbpSrcId_get(
  57384         int unit,
  57385         bcm_field_entry_t entry,
  57386         uint16 *data,
  57387         uint16 *mask)
  57388 {
  57389     int rv = BCM_E_UNAVAIL;
  57390 
  57391 #if defined(BCM_TRIDENT3_SUPPORT)
  57392     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57393       /* Read qualifier match value and mask. */
  57394       return _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57395                                             bcmFieldQualifyGbpSrcId,
  57396                                             data, mask);
  57397     }
  57398 #endif /* BCM_TRIDENT3_SUPPORT */
  57399     return (rv);
  57400 }
  57401 
  57402 int
  57403 bcm_esw_field_qualify_GbpDstId(
  57404         int unit,
  57405         bcm_field_entry_t entry,
  57406         uint16 data,
  57407         uint16 mask)
  57408 {
  57409     int rv = BCM_E_UNAVAIL;
  57410 
  57411 #if defined(BCM_TRIDENT3_SUPPORT)
  57412     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57413         FP_LOCK(unit);
  57414         rv = _field_qualify32(unit, entry, bcmFieldQualifyGbpDstId,
  57415                 data, mask);
  57416         FP_UNLOCK(unit);
  57417     }
  57418 #endif /* BCM_TRIDENT3_SUPPORT */
  57419     return (rv);
  57420 }
  57421 
  57422 int
  57423 bcm_esw_field_qualify_GbpDstId_get(
  57424         int unit,
  57425         bcm_field_entry_t entry,
  57426         uint16 *data,
  57427         uint16 *mask)
  57428 {
  57429     int rv = BCM_E_UNAVAIL;
  57430 
  57431 #if defined(BCM_TRIDENT3_SUPPORT)
  57432     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57433       /* Read qualifier match value and mask. */
  57434       return _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57435                                             bcmFieldQualifyGbpDstId,
  57436                                             data, mask);
  57437     }
  57438 #endif /* BCM_TRIDENT3_SUPPORT */
  57439     return (rv);
  57440 }
  57441 
  57442 int
  57443 bcm_esw_field_qualify_FlowtrackerCheck(
  57444         int unit,
  57445         bcm_field_entry_t entry,
  57446         bcm_flowtracker_group_t  flow_group_id,
  57447         uint32 num_checks,
  57448         bcm_field_flowtrackercheck_t *list_of_check_ids)
  57449 {
  57450     int rv = BCM_E_UNAVAIL;
  57451 
  57452 #if defined(BCM_HELIX5_SUPPORT)
  57453 
  57454     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  57455         uint32 data = 0, mask = 0;
  57456         /* Parameters Check */
  57457         if ((NULL == list_of_check_ids) || (0 == num_checks)) {
  57458             return BCM_E_PARAM;
  57459         }
  57460         /* Check Whether FlowtrackerGroupId qualifier is already configured or not */
  57461         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  57462                                                bcmFieldQualifyFlowtrackerGroupId,
  57463                                                &data, &mask);
  57464         BCM_IF_ERROR_RETURN(rv);
  57465         if (flow_group_id != data) {
  57466            LOG_ERROR(BSL_LS_BCM_FP,
  57467                       (BSL_META_U(unit,
  57468                       "(unit %d) Error: FlowtrackerCheck qualifier should be"
  57469                       "qualified with same Flowtracker Group Id %d as in"
  57470                       "Qualifier FlowtrackerGroupId"),
  57471                       unit, data));
  57472            return BCM_E_PARAM;
  57473         }
  57474         data = mask = 0;
  57475         rv = _bcm_field_ft_group_checkbmp_get(unit, flow_group_id,
  57476                                               num_checks,
  57477                                               list_of_check_ids,
  57478                                               &data, &mask);
  57479         BCM_IF_ERROR_RETURN(rv);
  57480         FP_LOCK(unit);
  57481 
  57482         rv = _field_qualify32(unit, entry,
  57483                               bcmFieldQualifyFlowtrackerCheck,
  57484                               data, mask);
  57485         FP_UNLOCK(unit);
  57486     }
  57487 #endif
  57488 
  57489     return (rv);
  57490 }
  57491 int
  57492 bcm_esw_field_qualify_FlowtrackerCheck_get(
  57493         int unit,
  57494         bcm_field_entry_t entry,
  57495         bcm_flowtracker_group_t  flow_group_id,
  57496         uint32 num_checks,
  57497         bcm_field_flowtrackercheck_t *list_of_check_ids,
  57498         uint32 *actual_num_checks)
  57499 {
  57500     int rv = BCM_E_UNAVAIL;
  57501 
  57502 #if defined(BCM_HELIX5_SUPPORT)
  57503 
  57504     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  57505         uint32 data = 0, mask = 0;
  57506         /* Parameters Check */
  57507         if ((NULL == list_of_check_ids) || (0 == num_checks)
  57508             || (NULL == actual_num_checks)) {
  57509             return BCM_E_PARAM;
  57510         }
  57511         /* Check Whether FlowtrackerGroupId qualifier is already configured or not */
  57512         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  57513                                                bcmFieldQualifyFlowtrackerGroupId,
  57514                                                &data, &mask);
  57515         BCM_IF_ERROR_RETURN(rv);
  57516         if (flow_group_id != data) {
  57517            LOG_ERROR(BSL_LS_BCM_FP,
  57518                       (BSL_META_U(unit,
  57519                       "(unit %d) Error: FlowtrackerCheck qualifier should be"
  57520                       "qualified with same Flowtracker Group Id %d as in"
  57521                       "Qualifier FlowtrackerGroupId"),
  57522                       unit, data));
  57523            return BCM_E_PARAM;
  57524         }
  57525         data = mask = 0;
  57526         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  57527                                                bcmFieldQualifyFlowtrackerCheck,
  57528                                                &data, &mask);
  57529         BCM_IF_ERROR_RETURN(rv);
  57530         rv = _bcm_field_ft_group_checklist_get(unit, flow_group_id,
  57531                                                data, mask,
  57532                                                num_checks,
  57533                                                list_of_check_ids,
  57534                                                actual_num_checks);
  57535         BCM_IF_ERROR_RETURN(rv);
  57536     }
  57537 #endif
  57538 
  57539     return (rv);
  57540 }
  57541 int
  57542 bcm_esw_field_qualify_FlowtrackerLearn(
  57543         int unit,
  57544         bcm_field_entry_t entry,
  57545         uint8 data,
  57546         uint8 mask)
  57547 {
  57548     int rv = BCM_E_UNAVAIL;
  57549 
  57550 #if defined(BCM_HELIX5_SUPPORT)
  57551     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  57552         if (data >> 1) {
  57553             return BCM_E_PARAM;
  57554         }
  57555 
  57556         FP_LOCK(unit);
  57557 
  57558         rv = _field_qualify32(unit, entry,
  57559                               bcmFieldQualifyFlowtrackerLearn,
  57560                               data, mask);
  57561         FP_UNLOCK(unit);
  57562     }
  57563 #endif
  57564     return rv;
  57565 }
  57566 
  57567 int
  57568 bcm_esw_field_qualify_FlowtrackerLearn_get(
  57569         int unit,
  57570         bcm_field_entry_t entry,
  57571         uint8 *data,
  57572         uint8 *mask)
  57573 {
  57574     int rv = BCM_E_UNAVAIL;
  57575 
  57576 #if defined(BCM_HELIX5_SUPPORT)
  57577     if (soc_feature(unit, soc_feature_flex_flowtracker_ver_1)) {
  57578         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  57579                                                bcmFieldQualifyFlowtrackerLearn,
  57580                                                data, mask);
  57581     }
  57582 #endif
  57583 
  57584     return rv;
  57585 }
  57586 
  57587 int
  57588 bcm_esw_field_qualify_CosMapSelect(
  57589         int unit,
  57590         bcm_field_entry_t entry,
  57591         bcm_field_cos_map_select_t cos_map_select)
  57592 {
  57593     int rv = BCM_E_UNAVAIL;
  57594 
  57595 #if defined(BCM_HELIX5_SUPPORT)
  57596     if (SOC_IS_HELIX5(unit)) {
  57597         FP_LOCK(unit);
  57598         rv = _field_qualify32(unit, entry,
  57599                               bcmFieldQualifyCosMapSelect,
  57600                               cos_map_select, -1);
  57601         FP_UNLOCK(unit);
  57602     }
  57603 #endif
  57604     return rv;
  57605 }
  57606 
  57607 int
  57608 bcm_esw_field_qualify_CosMapSelect_get(
  57609         int unit,
  57610         bcm_field_entry_t entry,
  57611         bcm_field_cos_map_select_t *cos_map_select)
  57612 {
  57613     int rv = BCM_E_UNAVAIL;
  57614 
  57615 #if defined(BCM_HELIX5_SUPPORT)
  57616     uint32 mask =0;
  57617     if (SOC_IS_HELIX5(unit)) {
  57618         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  57619                                                bcmFieldQualifyCosMapSelect,
  57620                                                cos_map_select, &mask);
  57621     }
  57622 #endif
  57623 
  57624     return rv;
  57625 }
  57626 
  57627 int
  57628 bcm_esw_field_qualify_OpaqueObject1(
  57629         int unit,
  57630         bcm_field_entry_t entry,
  57631         uint16 data,
  57632         uint16 mask)
  57633 {
  57634     int rv = BCM_E_UNAVAIL;
  57635 
  57636 #if defined(BCM_TRIDENT3_SUPPORT)
  57637     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57638        FP_LOCK(unit);
  57639        rv = _field_qualify32(unit, entry, bcmFieldQualifyOpaqueObject1,
  57640                              data, mask);
  57641        FP_UNLOCK(unit);
  57642     }
  57643 #endif
  57644     return (rv);
  57645 }
  57646 
  57647 int
  57648 bcm_esw_field_qualify_OpaqueObject1_get(
  57649         int unit,
  57650         bcm_field_entry_t entry,
  57651         uint16 *data,
  57652         uint16 *mask)
  57653 {
  57654     int rv = BCM_E_UNAVAIL;
  57655 
  57656 #if defined(BCM_TRIDENT3_SUPPORT)
  57657     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57658       /* Read qualifier match value and mask. */
  57659       return _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57660                                             bcmFieldQualifyOpaqueObject1,
  57661                                             data, mask);
  57662     }
  57663 #endif
  57664     return (rv);
  57665 }
  57666 
  57667 
  57668 int
  57669 bcm_esw_field_qualify_OpaqueObject2(
  57670         int unit,
  57671         bcm_field_entry_t entry,
  57672         uint16 data,
  57673         uint16 mask)
  57674 {
  57675     int rv = BCM_E_UNAVAIL;
  57676 
  57677 #if defined(BCM_TRIDENT3_SUPPORT)
  57678     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57679        FP_LOCK(unit);
  57680        rv = _field_qualify32(unit, entry, bcmFieldQualifyOpaqueObject2,
  57681                              data, mask);
  57682        FP_UNLOCK(unit);
  57683     }
  57684 #endif
  57685     return (rv);
  57686 }
  57687 
  57688 int
  57689 bcm_esw_field_qualify_OpaqueObject2_get(
  57690         int unit,
  57691         bcm_field_entry_t entry,
  57692         uint16 *data,
  57693         uint16 *mask)
  57694 {
  57695     int rv = BCM_E_UNAVAIL;
  57696 
  57697 #if defined(BCM_TRIDENT3_SUPPORT)
  57698     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57699       /* Read qualifier match value and mask. */
  57700       return _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57701                                             bcmFieldQualifyOpaqueObject2,
  57702                                             data, mask);
  57703     }
  57704 #endif
  57705     return (rv);
  57706 }
  57707 
  57708 
  57709 int
  57710 bcm_esw_field_qualify_OpaqueObject3(
  57711         int unit,
  57712         bcm_field_entry_t entry,
  57713         uint16 data,
  57714         uint16 mask)
  57715 {
  57716     int rv = BCM_E_UNAVAIL;
  57717 
  57718 #if defined(BCM_TRIDENT3_SUPPORT)
  57719     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57720        FP_LOCK(unit);
  57721        rv = _field_qualify32(unit, entry, bcmFieldQualifyOpaqueObject3,
  57722                              data, mask);
  57723        FP_UNLOCK(unit);
  57724     }
  57725 #endif
  57726     return (rv);
  57727 }
  57728 
  57729 int
  57730 bcm_esw_field_qualify_OpaqueObject3_get(
  57731         int unit,
  57732         bcm_field_entry_t entry,
  57733         uint16 *data,
  57734         uint16 *mask)
  57735 {
  57736     int rv = BCM_E_UNAVAIL;
  57737 
  57738 #if defined(BCM_TRIDENT3_SUPPORT)
  57739     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57740       /* Read qualifier match value and mask. */
  57741       return _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57742                                             bcmFieldQualifyOpaqueObject3,
  57743                                             data, mask);
  57744     }
  57745 #endif
  57746     return (rv);
  57747 }
  57748 
  57749 
  57750 int
  57751 bcm_esw_field_qualify_OpaqueObject4(
  57752         int unit,
  57753         bcm_field_entry_t entry,
  57754         uint16 data,
  57755         uint16 mask)
  57756 {
  57757     int rv = BCM_E_UNAVAIL;
  57758 
  57759 #if defined(BCM_TRIDENT3_SUPPORT)
  57760     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57761        FP_LOCK(unit);
  57762        rv = _field_qualify32(unit, entry, bcmFieldQualifyOpaqueObject4,
  57763                              data, mask);
  57764        FP_UNLOCK(unit);
  57765     }
  57766 #endif
  57767     return (rv);
  57768 }
  57769 
  57770 int
  57771 bcm_esw_field_qualify_OpaqueObject4_get(
  57772         int unit,
  57773         bcm_field_entry_t entry,
  57774         uint16 *data,
  57775         uint16 *mask)
  57776 {
  57777     int rv = BCM_E_UNAVAIL;
  57778 
  57779 #if defined(BCM_TRIDENT3_SUPPORT)
  57780     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57781       /* Read qualifier match value and mask. */
  57782       return _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57783                                             bcmFieldQualifyOpaqueObject4,
  57784                                             data, mask);
  57785     }
  57786 #endif
  57787     return (rv);
  57788 }
  57789 
  57790 int 
  57791 bcm_esw_field_qualify_IncomingOuterVlanId(
  57792     int unit, 
  57793     bcm_field_entry_t entry, 
  57794     bcm_vlan_t data, 
  57795     bcm_vlan_t mask)
  57796 {
  57797     int rv = BCM_E_UNAVAIL;
  57798 
  57799     if (!BCM_VLAN_VALID(data)) {
  57800         return BCM_E_PARAM;
  57801     }
  57802 
  57803 #ifdef BCM_TRIDENT3_SUPPORT
  57804     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57805         FP_LOCK(unit);
  57806 
  57807         rv = _field_qualify32(unit, entry, bcmFieldQualifyIncomingOuterVlanId,
  57808                               data, mask);
  57809 
  57810         FP_UNLOCK(unit);
  57811     }
  57812 #endif /* BCM_TRIDENT3_SUPPORT */
  57813 
  57814     return rv;
  57815 }
  57816 
  57817 int 
  57818 bcm_esw_field_qualify_IncomingOuterVlanId_get(
  57819     int unit, 
  57820     bcm_field_entry_t entry, 
  57821     bcm_vlan_t *data, 
  57822     bcm_vlan_t *mask)
  57823 {
  57824     int rv = BCM_E_UNAVAIL;
  57825 
  57826 #ifdef BCM_TRIDENT3_SUPPORT
  57827     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57828         /* Read qualifier match value and mask. */
  57829         rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  57830                                                    bcmFieldQualifyIncomingOuterVlanId,
  57831                                                    data, mask);
  57832     }
  57833 #endif /* BCM_TRIDENT3_SUPPORT */
  57834 
  57835     return rv;
  57836 }
  57837 
  57838 int
  57839 bcm_esw_field_qualify_LoopbackSubtype(
  57840         int unit,
  57841         bcm_field_entry_t entry, 
  57842         bcm_field_loopback_subtype_t lb_subtype)
  57843 {
  57844     int    rv = BCM_E_UNAVAIL;
  57845 
  57846 #ifdef BCM_TRIDENT3_SUPPORT
  57847     uint32 data = 0;
  57848     uint32 mask = 0;
  57849 
  57850     if (bcmFieldLoopbackSubtypeCount <= lb_subtype) {
  57851         return BCM_E_PARAM;
  57852     }
  57853 
  57854     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57855         rv = _bcm_field_td3_qualify_LoopbackSubtype(unit, lb_subtype, &data, &mask);
  57856         BCM_IF_ERROR_RETURN(rv);
  57857 
  57858         FP_LOCK(unit);
  57859 
  57860         rv = _field_qualify32(unit, entry, bcmFieldQualifyLoopbackSubtype,
  57861                               data, mask);
  57862 
  57863         FP_UNLOCK(unit);
  57864     }
  57865 #endif /* BCM_TRIDENT3_SUPPORT */
  57866 
  57867     return rv;
  57868 }
  57869 
  57870 int
  57871 bcm_esw_field_qualify_LoopbackSubtype_get(
  57872         int unit,
  57873         bcm_field_entry_t entry,
  57874         bcm_field_loopback_subtype_t *lb_subtype)
  57875 {
  57876     int rv = BCM_E_UNAVAIL;
  57877 
  57878 #ifdef BCM_TRIDENT3_SUPPORT
  57879     uint8 data = 0;
  57880     uint8 mask = 0;
  57881     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57882         /* Read qualifier match value and mask. */
  57883         rv = _bcm_field_entry_qualifier_uint8_get(unit, entry,
  57884                                                    bcmFieldQualifyLoopbackSubtype,
  57885                                                    &data, &mask);
  57886         BCM_IF_ERROR_RETURN(rv);
  57887         rv = _bcm_field_td3_qualify_LoopbackSubtype_get(unit, data, mask, lb_subtype);
  57888     }
  57889 #endif /* BCM_TRIDENT3_SUPPORT */
  57890 
  57891     return rv;
  57892 }
  57893 
  57894 
  57895 int 
  57896 bcm_esw_field_qualify_DstL3EgressUnderlay(int unit, 
  57897                                         bcm_field_entry_t entry, 
  57898                                         bcm_if_t if_id)
  57899 {
  57900     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
  57901 #if defined(INCLUDE_L3)
  57902 #if defined(BCM_TRIDENT3_SUPPORT)
  57903     _field_control_t *fc;   /* Field control structure. */
  57904     uint32 data;            /* HW data match criteria.  */
  57905     uint32 mask;            /* HW data mask.            */
  57906     uint32 flags;           /* L3 forwarding flags      */
  57907     int nh_ecmp_id;         /* Next hop/Ecmp group id.  */
  57908 
  57909     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57910         /* Get next hop id. */
  57911         rv = bcm_xgs3_l3_egress_id_parse(unit, if_id, &flags, &nh_ecmp_id);
  57912         BCM_IF_ERROR_RETURN(rv);
  57913 
  57914         if (flags & BCM_L3_MULTIPATH) {
  57915             return (BCM_E_UNAVAIL);
  57916         }
  57917 
  57918         data = nh_ecmp_id;
  57919         mask = (BCM_FIELD_EXACT_MATCH_MASK);
  57920         rv = _bcm_field_is_entry_stage_valid(unit, entry,
  57921                                             _BCM_FIELD_STAGE_INGRESS);
  57922         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
  57923             /*Error fetching entry*/
  57924             return (rv);
  57925         }
  57926 
  57927         if (rv == BCM_E_NONE) { /*Stage is Ingress*/
  57928             FP_LOCK(unit);
  57929             rv = _field_control_get(unit, &fc);
  57930             if (BCM_FAILURE(rv)) {
  57931                 FP_UNLOCK(unit);
  57932                 return rv;
  57933             }
  57934             rv = fc->functions.fp_qualify_dvp(unit, entry,
  57935                                           bcmFieldQualifyDstL3EgressUnderlay,
  57936                                           data, mask, 0);
  57937             FP_UNLOCK(unit);
  57938             return (rv);
  57939         }
  57940     }
  57941 
  57942 #endif /* BCM_TRIDENT3_SUPPORT */
  57943 #endif /* INCLUDE_L3 */
  57944 
  57945     return (rv);
  57946 }
  57947 
  57948 int 
  57949 bcm_esw_field_qualify_DstL3EgressUnderlay_get(int unit, 
  57950                                         bcm_field_entry_t entry, 
  57951                                         bcm_if_t *if_id)
  57952 {
  57953     int               rv = BCM_E_UNAVAIL;  /* Operation return status. */
  57954 #if defined(INCLUDE_L3)
  57955 #if defined(BCM_TRIDENT3_SUPPORT)
  57956     uint32            data; /* HW data match criteria.  */
  57957     uint32            mask; /* HW data mask.            */
  57958 
  57959     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  57960         /* Input parameters check. */
  57961         if (NULL == if_id) {
  57962             return (BCM_E_PARAM);
  57963         }
  57964 
  57965         /* Read qualifier match value and mask. */ 
  57966         rv = _bcm_field_entry_qualifier_uint32_get(unit, entry, 
  57967                                         bcmFieldQualifyDstL3EgressUnderlay,
  57968                                         &data, &mask);
  57969         BCM_IF_ERROR_RETURN(rv);
  57970 
  57971         if (mask == 0) {
  57972             return BCM_E_NOT_FOUND;
  57973         }
  57974 
  57975         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  57976                                             entry,
  57977                                             bcmFieldQualifyDstL3EgressUnderlay,
  57978                                             &data, &mask));
  57979 
  57980         *if_id = data + BCM_XGS3_EGRESS_IDX_MIN(unit);
  57981     }
  57982 #endif /* BCM_TRIDENT3_SUPPORT */
  57983 #endif /* INCLUDE_L3 */
  57984     return (rv);
  57985 }
  57986 
  57987 int 
  57988 bcm_esw_field_qualify_DstL3EgressNextHopsUnderlay(int unit, 
  57989                                                 bcm_field_entry_t entry, 
  57990                                                 uint32 data,
  57991                                                 uint32 mask)
  57992 {
  57993     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  57994 #if defined(INCLUDE_L3)
  57995 #ifdef BCM_TRIDENT3_SUPPORT
  57996     _field_control_t *fc;
  57997     uint32 max_nexthop_index = 0;
  57998 
  57999     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  58000         /* Check if L3 feature is supported on the device */
  58001         if (!soc_feature(unit, soc_feature_l3)) {
  58002             return (rv);
  58003         }
  58004 
  58005         /*  Make sure module was initialized. */
  58006         if (!BCM_XGS3_L3_INITIALIZED(unit)) {
  58007             return (rv);
  58008         }
  58009 
  58010         max_nexthop_index = (BCM_XGS3_L3_NH_TBL_SIZE(unit) - 1);
  58011 
  58012         /* Check if mask is greater than possible table index value */
  58013         if ((mask != BCM_FIELD_EXACT_MATCH_MASK) && (mask > max_nexthop_index)) {
  58014             return (BCM_E_PARAM);
  58015         }
  58016 
  58017         /* Check if data is greater than possible table index value */
  58018         if (data > max_nexthop_index) {
  58019             return (BCM_E_PARAM);
  58020         }
  58021 
  58022 
  58023         FP_LOCK(unit);
  58024         rv = _field_control_get(unit, &fc);
  58025         if (BCM_FAILURE(rv)) {
  58026             FP_UNLOCK(unit);
  58027             return rv;
  58028         }
  58029 
  58030         rv = _bcm_field_is_entry_stage_valid(unit, entry,
  58031                                         _BCM_FIELD_STAGE_INGRESS);
  58032 
  58033         if ((rv != BCM_E_NONE) && (rv != BCM_E_CONFIG)) {
  58034             /*Error fetching entry*/
  58035             FP_UNLOCK(unit);
  58036             return (rv);
  58037         }
  58038 
  58039         if (rv == BCM_E_NONE) { /*Stage is Ingress*/ 
  58040             rv = fc->functions.fp_qualify_dvp(unit, entry,
  58041                                           bcmFieldQualifyDstL3EgressNextHopsUnderlay,
  58042                                           data, mask, 0);
  58043             FP_UNLOCK(unit);
  58044             return (rv);
  58045         }
  58046     }
  58047 #endif /* BCM_TRIDENT3_SUPPORT */
  58048 #endif /* INCLUDE_L3 */
  58049 
  58050     return (rv);
  58051 
  58052 }
  58053 
  58054 int 
  58055 bcm_esw_field_qualify_DstL3EgressNextHopsUnderlay_get(int unit, 
  58056                                                 bcm_field_entry_t entry, 
  58057                                                 uint32 *data,
  58058                                                 uint32 *mask)
  58059 {
  58060     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  58061 
  58062 #if defined(INCLUDE_L3)
  58063 #if defined(BCM_TRIDENT3_SUPPORT)
  58064     int i, size_bit_len = 0;
  58065 
  58066     if (soc_feature(unit, soc_feature_td3_style_fp)) {
  58067         /* Check if L3 feature is supported on the device */
  58068         if (!soc_feature(unit, soc_feature_l3)) {
  58069             return (rv);
  58070         }
  58071 
  58072         /*  Make sure module was initialized. */
  58073         if (!BCM_XGS3_L3_INITIALIZED(unit)) {
  58074             return (rv);
  58075         }
  58076 
  58077         /* Read qualifier match value and mask. */ 
  58078         rv =  _bcm_field_entry_qualifier_uint32_get(unit, entry,
  58079                 bcmFieldQualifyDstL3EgressNextHopsUnderlay,
  58080                 data, mask);
  58081         BCM_IF_ERROR_RETURN(rv);
  58082 
  58083 
  58084         /* Retrieve the mask value according to the table size */
  58085         for (i = 0; i < 32; i++) {
  58086             if (BCM_XGS3_L3_NH_TBL_SIZE(unit) <= (1 << i)) {
  58087                 size_bit_len = i;
  58088                 break;
  58089             }
  58090         }
  58091 
  58092         *mask = *mask & ((1 << size_bit_len) - 1);
  58093 
  58094         /* Clear destination type in data and mask */
  58095         BCM_IF_ERROR_RETURN(_field_dest_type_clear(unit,
  58096                     entry, bcmFieldQualifyDstL3EgressNextHopsUnderlay, data, mask));
  58097     }
  58098 #endif
  58099 #endif /* BCM_TRIDENT3_SUPPORT */
  58100     return (rv);
  58101 
  58102 }
  58103 
  58104 int bcm_esw_field_qualify_EgressClassPort(
  58105     int unit,
  58106     bcm_field_entry_t entry,
  58107     uint16 data,
  58108     uint16 mask)
  58109 {
  58110     int              rv = BCM_E_UNAVAIL;       /* Operation return status. */
  58111 
  58112 #if defined(BCM_HELIX5_SUPPORT)
  58113     if (SOC_IS_HELIX5(unit)) {
  58114         FP_LOCK(unit);
  58115 
  58116         rv = _field_qualify32(unit, entry, bcmFieldQualifyEgressClassPort,
  58117                               data, mask);
  58118         FP_UNLOCK(unit);
  58119     }
  58120 #endif
  58121     return (rv);
  58122 }
  58123 
  58124 int bcm_esw_field_qualify_EgressClassPort_get(
  58125     int unit,
  58126     bcm_field_entry_t entry,
  58127     uint16 *data,
  58128     uint16 *mask)
  58129 {
  58130     int rv = BCM_E_UNAVAIL;
  58131 #if defined(BCM_HELIX5_SUPPORT)
  58132     if (SOC_IS_HELIX5(unit)) {
  58133         FP_LOCK(unit);
  58134         /* Read qualifier match value and mask. */ 
  58135         rv = _bcm_field_entry_qualifier_uint16_get(unit,
  58136                                                    entry,
  58137                                                    bcmFieldQualifyEgressClassPort,
  58138                                                    data,
  58139                                                    mask);
  58140         FP_UNLOCK(unit);
  58141     }
  58142 #endif
  58143     return rv;
  58144 }
  58145 
  58146 int
  58147 bcm_esw_field_qualify_INTProbeMarker1(int unit,
  58148                                       bcm_field_entry_t entry,
  58149                                       uint32 data,
  58150                                       uint32 mask)
  58151 {
  58152     int rv = BCM_E_UNAVAIL;                 /* Operation return status. */
  58153 
  58154     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  58155         FP_LOCK(unit);
  58156         rv = _field_qualify32(unit, entry,
  58157                               bcmFieldQualifyINTProbeMarker1,
  58158                               data, mask);
  58159         FP_UNLOCK(unit);
  58160     }
  58161     return (rv);
  58162 }
  58163 
  58164 int
  58165 bcm_esw_field_qualify_INTProbeMarker1_get(int unit,
  58166                                           bcm_field_entry_t entry,
  58167                                           uint32 *data,
  58168                                           uint32 *mask)
  58169 {
  58170     int rv = BCM_E_UNAVAIL;                 /* Operation return status. */
  58171 
  58172     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  58173         if ((data == NULL) || (mask == NULL)) {
  58174             return BCM_E_PARAM;
  58175         }
  58176         FP_LOCK(unit);
  58177         /* Read qualifier match value and mask. */
  58178         rv = (_bcm_field_entry_qualifier_uint32_get(unit, entry,
  58179                                  bcmFieldQualifyINTProbeMarker1,
  58180                                  data, mask));
  58181         FP_UNLOCK(unit);
  58182     }
  58183     return (rv);
  58184 }
  58185 
  58186 int
  58187 bcm_esw_field_qualify_INTProbeMarker2(int unit,
  58188                                       bcm_field_entry_t entry,
  58189                                       uint32 data,
  58190                                       uint32 mask)
  58191 {
  58192     int rv = BCM_E_UNAVAIL;                 /* Operation return status. */
  58193 
  58194     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  58195         FP_LOCK(unit);
  58196         rv = _field_qualify32(unit, entry,
  58197                               bcmFieldQualifyINTProbeMarker2,
  58198                               data, mask);
  58199         FP_UNLOCK(unit);
  58200     }
  58201     return (rv);
  58202 }
  58203 
  58204 int
  58205 bcm_esw_field_qualify_INTProbeMarker2_get(int unit,
  58206                                           bcm_field_entry_t entry,
  58207                                           uint32 *data,
  58208                                           uint32 *mask)
  58209 {
  58210     int rv = BCM_E_UNAVAIL;                 /* Operation return status. */
  58211 
  58212     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  58213         if ((data == NULL) || (mask == NULL)) {
  58214             return BCM_E_PARAM;
  58215         }
  58216         FP_LOCK(unit);
  58217         /* Read qualifier match value and mask. */
  58218         rv = (_bcm_field_entry_qualifier_uint32_get(unit, entry,
  58219                                  bcmFieldQualifyINTProbeMarker2,
  58220                                  data, mask));
  58221         FP_UNLOCK(unit);
  58222     }
  58223     return (rv);
  58224 }
  58225 
  58226 int
  58227 bcm_esw_field_qualify_INTReserved4Bytes(int unit,
  58228                                         bcm_field_entry_t entry,
  58229                                         uint32 data,
  58230                                         uint32 mask)
  58231 {
  58232     int rv = BCM_E_UNAVAIL;                 /* Operation return status. */
  58233 
  58234     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  58235         FP_LOCK(unit);
  58236         rv = _field_qualify32(unit, entry,
  58237                               bcmFieldQualifyINTReserved4Bytes,
  58238                               data, mask);
  58239         FP_UNLOCK(unit);
  58240     }
  58241     return (rv);
  58242 }
  58243 
  58244 int
  58245 bcm_esw_field_qualify_INTReserved4Bytes_get(int unit,
  58246                                             bcm_field_entry_t entry,
  58247                                             uint32 *data,
  58248                                             uint32 *mask)
  58249 {
  58250     int rv = BCM_E_UNAVAIL;                 /* Operation return status. */
  58251 
  58252     if (soc_feature(unit, soc_feature_udf_td3x_support)) {
  58253         if ((data == NULL) || (mask == NULL)) {
  58254             return BCM_E_PARAM;
  58255         }
  58256         FP_LOCK(unit);
  58257         /* Read qualifier match value and mask. */
  58258         rv = (_bcm_field_entry_qualifier_uint32_get(unit, entry,
  58259                                  bcmFieldQualifyINTReserved4Bytes,
  58260                                  data, mask));
  58261         FP_UNLOCK(unit);
  58262     }
  58263     return (rv);
  58264 }
  58265 
  58266 int
  58267 bcm_esw_field_qualify_FlowControlType(
  58268                int unit,
  58269                bcm_field_entry_t entry_id,
  58270                bcm_field_flow_control_pkt_type_t fc_type)
  58271 {
  58272     return BCM_E_UNAVAIL;
  58273 }
  58274 
  58275 int
  58276 bcm_esw_field_qualify_FlowControlType_get(
  58277                int unit,
  58278                bcm_field_entry_t entry_id,
  58279                bcm_field_flow_control_pkt_type_t *fc_type)
  58280 {
  58281     return BCM_E_UNAVAIL;
  58282 }
  58283 
  58284 int
  58285 bcm_esw_field_qualify_TimeStampTxPktType(
  58286                int unit,
  58287                bcm_field_entry_t entry,
  58288                bcm_field_timestamp_transmit_pkt_type_t ts_pkt_type)
  58289 {
  58290     bcm_error_t rv = BCM_E_UNAVAIL;
  58291 #if defined(BCM_TRIDENT3_SUPPORT)
  58292     if (soc_feature(unit, soc_feature_twamp_owamp_support)) {
  58293         uint16 data;
  58294         uint16 mask;
  58295 
  58296         if (ts_pkt_type >= bcmFieldTimestampCount) {
  58297             return BCM_E_PARAM;
  58298         }
  58299 
  58300         if (soc_feature(unit, soc_feature_td3_style_fp)) {
  58301             FP_LOCK(unit);
  58302             rv = _bcm_field_td3_qualify_TimeStampTxPktType(unit,
  58303                             ts_pkt_type, &data, &mask);
  58304             if (BCM_FAILURE(rv)) {
  58305                 FP_UNLOCK(unit);
  58306                 return rv;
  58307             }
  58308 
  58309             rv = _field_qualify32(unit, entry, bcmFieldQualifyTimeStampTxPktType,
  58310                     data, mask);
  58311             FP_UNLOCK(unit);
  58312         }
  58313     }
  58314 #endif /* BCM_TRIDENT3_SUPPORT */
  58315     return rv;
  58316 }
  58317 
  58318 int
  58319 bcm_esw_field_qualify_TimeStampTxPktType_get(
  58320                int unit,
  58321                bcm_field_entry_t entry,
  58322                bcm_field_timestamp_transmit_pkt_type_t *ts_pkt_type)
  58323 {
  58324     int rv = BCM_E_UNAVAIL;
  58325 
  58326 #if defined(BCM_TRIDENT3_SUPPORT)
  58327     if (soc_feature(unit, soc_feature_twamp_owamp_support)) {
  58328         uint16 data;
  58329         uint16 mask;
  58330 
  58331         if (soc_feature(unit, soc_feature_td3_style_fp)) {
  58332             /* Read qualifier match value and mask. */
  58333             rv = _bcm_field_entry_qualifier_uint16_get(unit, entry,
  58334                             bcmFieldQualifyTimeStampTxPktType,
  58335                     &data, &mask);
  58336             BCM_IF_ERROR_RETURN(rv);
  58337             rv = _bcm_field_td3_qualify_TimeStampTxPktType_get(unit, data,
  58338                             mask, ts_pkt_type);
  58339         }
  58340     }
  58341 #endif /* BCM_TRIDENT3_SUPPORT */
  58342     return (rv);
  58343 }
  58344 
  58345 int
  58346 bcm_esw_field_qualify_SysHdrLocalDstport(int unit,
  58347                              bcm_field_entry_t entry,
  58348                              bcm_port_t data, bcm_port_t mask)
  58349 {
  58350     int rv = BCM_E_UNAVAIL;
  58351 
  58352 #if defined(BCM_TRIDENT3_SUPPORT)
  58353     if (soc_feature(unit, soc_feature_twamp_owamp_support)) {
  58354         if (soc_feature(unit, soc_feature_td3_style_fp)) {
  58355             FP_LOCK(unit);
  58356             rv = _field_qualify32(unit, entry, bcmFieldQualifySysHdrLocalDstport,
  58357                                   data, mask);
  58358             FP_UNLOCK(unit);
  58359         }
  58360     }
  58361 #endif /* BCM_TRIDENT3_SUPPORT */
  58362     return (rv);
  58363 }
  58364 
  58365 int
  58366 bcm_esw_field_qualify_SysHdrLocalDstport_get(int unit,
  58367                              bcm_field_entry_t entry,
  58368                              bcm_port_t *data, bcm_port_t *mask)
  58369 {
  58370     int rv = BCM_E_UNAVAIL;
  58371 
  58372 #if defined(BCM_TRIDENT3_SUPPORT)
  58373     if (soc_feature(unit, soc_feature_twamp_owamp_support)) {
  58374         if (soc_feature(unit, soc_feature_td3_style_fp)) {
  58375             /* Read qualifier match value and mask. */
  58376             return _bcm_field_entry_qualifier_uint32_get(unit, entry,
  58377                               bcmFieldQualifySysHdrLocalDstport,
  58378                               (uint32 *)data, (uint32 *)mask);
  58379         }
  58380     }
  58381 #endif /* BCM_TRIDENT3_SUPPORT */
  58382     return (rv);
  58383 }
  58384 
  58385 #else  /* !BCM_FIELD_SUPPORT */
  58386 
  58387 
  58388 
  58389 int
  58390 bcm_esw_field_init(int unit)
  58391 {
  58392     return (BCM_E_UNAVAIL);
  58393 }
  58394 
  58395 int
  58396 bcm_esw_field_stage_qset_get(int unit, bcm_field_stage_t stage,
  58397                           uint8 presel, bcm_field_qset_t *qset) {
  58398     return (BCM_E_UNAVAIL);
  58399 }
  58400 
  58401 int
  58402 bcm_esw_field_detach(int unit)
  58403 {
  58404     return (BCM_E_UNAVAIL);
  58405 }
  58406 
  58407 int
  58408 bcm_esw_field_group_flush(int unit, bcm_field_group_t group)
  58409 {
  58410     return BCM_E_UNAVAIL;
  58411 }
  58412 
  58413 int
  58414 bcm_esw_field_control_get(int unit, bcm_field_control_t control, uint32 *state)
  58415 {
  58416     return (BCM_E_UNAVAIL);
  58417 }
  58418 
  58419 
  58420 int
  58421 bcm_esw_field_control_set(int unit, bcm_field_control_t control, uint32 state)
  58422 {
  58423     return (BCM_E_UNAVAIL);
  58424 }
  58425 
  58426 int
  58427 bcm_esw_field_stage_slice_count_get(
  58428     int unit,
  58429     bcm_field_stage_t stage_id,
  58430     int *slice_count) {
  58431     return BCM_E_UNAVAIL;
  58432 }
  58433 
  58434 int
  58435 bcm_esw_field_stage_slice_info_get(
  58436     int unit,
  58437     bcm_field_stage_t stage_id,
  58438     bcm_pbmp_t pbmp,
  58439     int slice_no,
  58440     bcm_field_stage_slice_info_t *slice_info) {
  58441     return BCM_E_UNAVAIL;
  58442 }
  58443 
  58444 int
  58445 bcm_esw_field_group_create(int unit,
  58446                            bcm_field_qset_t qset,
  58447                            int pri,
  58448                            bcm_field_group_t *group)
  58449 {
  58450     return (BCM_E_UNAVAIL);
  58451 }
  58452 
  58453 int
  58454 bcm_esw_field_group_create_id(int unit,
  58455                               bcm_field_qset_t qset,
  58456                               int pri,
  58457                               bcm_field_group_t group)
  58458 {
  58459     return (BCM_E_UNAVAIL);
  58460 }
  58461 
  58462 int
  58463 bcm_esw_field_group_create_mode(int unit,
  58464                                    bcm_field_qset_t qset,
  58465                                    int pri,
  58466                                    bcm_field_group_mode_t mode,
  58467                                    bcm_field_group_t *group)
  58468 {
  58469     return (BCM_E_UNAVAIL);
  58470 }
  58471 
  58472 int
  58473 bcm_esw_field_group_create_mode_id(int unit,
  58474                                    bcm_field_qset_t qset,
  58475                                    int pri,
  58476                                    bcm_field_group_mode_t mode,
  58477                                    bcm_field_group_t group)
  58478 {
  58479     return (BCM_E_UNAVAIL);
  58480 }
  58481 
  58482 int                                                                                                             
  58483 bcm_esw_field_group_expansion_enable_set(int unit,                                                              
  58484                                          bcm_field_group_t group,                                               
  58485                                          int enable)                                                            
  58486 {                                                                                                               
  58487     return (BCM_E_UNAVAIL);                                                                                     
  58488 }                                                                                                               
  58489                                                                                                                 
  58490 int                                                                                                              
  58491 bcm_esw_field_group_expansion_enable_get(int unit,                                                               
  58492                                          bcm_field_group_t group,                                                
  58493                                          int *enable)                                                            
  58494 {                                                                                                               
  58495     return (BCM_E_UNAVAIL);                                                                                     
  58496 }                                                                                                               
  58497  
  58498 int
  58499 bcm_esw_field_group_port_create_mode(int unit, bcm_port_t port,
  58500                                          bcm_field_qset_t qset, int pri,
  58501                                      bcm_field_group_mode_t mode,
  58502                                      bcm_field_group_t *group)
  58503 {
  58504     return (BCM_E_UNAVAIL);
  58505 }
  58506 
  58507 int
  58508 bcm_esw_field_group_port_create_mode_id(int unit, bcm_port_t port,
  58509                                         bcm_field_qset_t qset, int pri,
  58510                                         bcm_field_group_mode_t mode,
  58511                                         bcm_field_group_t group)
  58512 {
  58513     return (BCM_E_UNAVAIL);
  58514 }
  58515 
  58516 
  58517 int
  58518 bcm_esw_field_group_ports_create_mode(int unit, bcm_pbmp_t pbmp,
  58519                                       bcm_field_qset_t qset, int pri,
  58520                                       bcm_field_group_mode_t mode,
  58521                                       bcm_field_group_t *group)
  58522 {
  58523     return (BCM_E_UNAVAIL);
  58524 }
  58525 
  58526 int
  58527 bcm_esw_field_group_ports_create_mode_id(int unit, bcm_pbmp_t pbmp,
  58528                                          bcm_field_qset_t qset, int pri,
  58529                                          bcm_field_group_mode_t mode,
  58530                                          bcm_field_group_t group)
  58531 {
  58532     return (BCM_E_UNAVAIL);
  58533 }
  58534 
  58535 int
  58536 bcm_esw_field_group_action_set(int               unit,
  58537                                bcm_field_group_t group,
  58538                                bcm_field_aset_t  aset
  58539                                )
  58540 {
  58541     return (BCM_E_UNAVAIL);
  58542 }
  58543 
  58544 int
  58545 bcm_esw_field_group_action_get(int               unit,
  58546                                bcm_field_group_t group,
  58547                                bcm_field_aset_t  *aset
  58548                                )
  58549 {
  58550     return (BCM_E_UNAVAIL);
  58551 }
  58552 
  58553 int
  58554 bcm_esw_field_group_mode_get(int unit,
  58555                              bcm_field_group_t group,
  58556                              bcm_field_group_mode_t *mode)
  58557 {
  58558     return (BCM_E_UNAVAIL);
  58559 }
  58560 
  58561 int
  58562 bcm_esw_field_group_set(int unit,
  58563                         bcm_field_group_t group,
  58564                         bcm_field_qset_t qset)
  58565 {
  58566     return (BCM_E_UNAVAIL);
  58567 }
  58568 
  58569 int
  58570 bcm_esw_field_group_get(int unit,
  58571                         bcm_field_group_t group,
  58572                         bcm_field_qset_t *qset)
  58573 {
  58574     return (BCM_E_UNAVAIL);
  58575 }
  58576 
  58577 int
  58578 bcm_esw_field_group_destroy(int unit,
  58579                             bcm_field_group_t group)
  58580 {
  58581     return (BCM_E_UNAVAIL);
  58582 }
  58583 
  58584 int
  58585 bcm_esw_field_group_status_get(int unit,
  58586                                bcm_field_group_t group,
  58587                                bcm_field_group_status_t *status)
  58588 {
  58589     return (BCM_E_UNAVAIL);
  58590 }
  58591 
  58592     int
  58593 bcm_esw_field_group_enable_set(int unit, bcm_field_group_t group, int enable)
  58594 {
  58595     return (BCM_E_UNAVAIL);
  58596 }
  58597 
  58598 int
  58599 bcm_esw_field_group_enable_get(int unit, bcm_field_group_t group, int *enable)
  58600 {
  58601     return (BCM_E_UNAVAIL);
  58602 }
  58603 
  58604 int
  58605 bcm_esw_field_group_default_entry_set(int unit, bcm_field_group_t group,
  58606                                       bcm_field_entry_t entry,
  58607                                       int enable)
  58608 {
  58609     return (BCM_E_UNAVAIL);
  58610 }
  58611 
  58612 int
  58613 bcm_esw_field_group_default_entry_get(int unit, bcm_field_group_t group,
  58614                                       bcm_field_entry_t *entry)
  58615 {
  58616     return (BCM_E_UNAVAIL);
  58617 }
  58618 
  58619 int
  58620 bcm_esw_field_range_create_id(int unit,
  58621                               bcm_field_range_t range,
  58622                               uint32 flags,
  58623                               bcm_l4_port_t min,
  58624                               bcm_l4_port_t max)
  58625 {
  58626     return (BCM_E_UNAVAIL);
  58627 }
  58628 
  58629 int
  58630 bcm_esw_field_range_create(int unit,
  58631                            bcm_field_range_t *range,
  58632                            uint32 flags,
  58633                            bcm_l4_port_t min,
  58634                            bcm_l4_port_t max)
  58635 {
  58636     return (BCM_E_UNAVAIL);
  58637 }
  58638 
  58639 int
  58640 bcm_esw_field_range_group_create_id(int unit,
  58641                                     bcm_field_range_t range,
  58642                                     uint32 flags,
  58643                                     bcm_l4_port_t min,
  58644                                     bcm_l4_port_t max,
  58645                                     bcm_if_group_t group)
  58646 {
  58647     return (BCM_E_UNAVAIL);
  58648 }
  58649 
  58650 int
  58651 bcm_esw_field_range_group_create(int unit,
  58652                                  bcm_field_range_t *range,
  58653                                  uint32 flags,
  58654                                  bcm_l4_port_t min,
  58655                                  bcm_l4_port_t max,
  58656                                  bcm_if_group_t group)
  58657 {
  58658     return (BCM_E_UNAVAIL);
  58659 }
  58660 
  58661 int
  58662 bcm_esw_field_range_get(int unit,
  58663                         bcm_field_range_t range,
  58664                         uint32 *flags,
  58665                         bcm_l4_port_t *min,
  58666                         bcm_l4_port_t *max)
  58667 {
  58668     return (BCM_E_UNAVAIL);
  58669 }
  58670 
  58671 int
  58672 bcm_esw_field_range_destroy(int unit,
  58673                             bcm_field_range_t range)
  58674 {
  58675     return (BCM_E_UNAVAIL);
  58676 }
  58677 
  58678 int
  58679 bcm_esw_field_group_range_set(int unit,
  58680                               bcm_field_group_t group,
  58681                               uint32 flags,
  58682                               bcm_l4_port_t min,
  58683                               bcm_l4_port_t max)
  58684 {
  58685     return (BCM_E_UNAVAIL);
  58686 }
  58687 
  58688 int
  58689 bcm_esw_field_group_range_get(int unit,
  58690                               bcm_field_group_t group,
  58691                               uint32 *flags,
  58692                               bcm_l4_port_t *min,
  58693                               bcm_l4_port_t *max)
  58694 {
  58695     return (BCM_E_UNAVAIL);
  58696 }
  58697 
  58698 int
  58699 bcm_esw_field_entry_create(int unit,
  58700                            bcm_field_group_t group,
  58701                            bcm_field_entry_t *entry)
  58702 {
  58703     return (BCM_E_UNAVAIL);
  58704 }
  58705 
  58706 int
  58707 bcm_esw_field_entry_create_id(int unit,
  58708                               bcm_field_group_t group,
  58709                               bcm_field_entry_t entry)
  58710 {
  58711     return (BCM_E_UNAVAIL);
  58712 }
  58713 
  58714 int bcm_esw_field_entry_multi_get(int unit, bcm_field_group_t group,
  58715     int entry_size, bcm_field_entry_t *entry_array, int *entry_count)
  58716 {
  58717     return BCM_E_UNAVAIL;
  58718 }
  58719 
  58720 int
  58721 bcm_esw_field_entry_destroy(int unit,
  58722                             bcm_field_entry_t entry)
  58723 {
  58724     return (BCM_E_UNAVAIL);
  58725 }
  58726 
  58727 int
  58728 bcm_esw_field_entry_destroy_all(int unit)
  58729 {
  58730     return (BCM_E_UNAVAIL);
  58731 }
  58732 
  58733 int
  58734 bcm_esw_field_entry_config_copy(int unit,
  58735                          bcm_field_entry_t src_entry,
  58736                          bcm_field_entry_t *dst_entry,
  58737                          uint32 flags);
  58738 {
  58739     return (BCM_E_UNAVAIL);
  58740 }
  58741 
  58742 int
  58743 bcm_esw_field_entry_copy(int unit,
  58744                          bcm_field_entry_t src_entry,
  58745                          bcm_field_entry_t *dst_entry)
  58746 {
  58747     return (BCM_E_UNAVAIL);
  58748 }
  58749 
  58750 int
  58751 bcm_esw_field_entry_copy_id(int unit,
  58752                             bcm_field_entry_t src_entry,
  58753                             bcm_field_entry_t dst_entry)
  58754 {
  58755     return (BCM_E_UNAVAIL);
  58756 }
  58757 
  58758 int
  58759 bcm_esw_field_entry_install(int unit,
  58760                             bcm_field_entry_t entry)
  58761 {
  58762     return (BCM_E_UNAVAIL);
  58763 }
  58764 
  58765 int
  58766 bcm_esw_field_entry_reinstall(int unit,
  58767                               bcm_field_entry_t entry)
  58768 {
  58769     return (BCM_E_UNAVAIL);
  58770 }
  58771 
  58772 int
  58773 bcm_esw_field_entry_remove(int unit,
  58774                            bcm_field_entry_t entry)
  58775 {
  58776     return (BCM_E_UNAVAIL);
  58777 }
  58778 
  58779 int
  58780 bcm_esw_field_entry_enable_set(int unit,
  58781                                bcm_field_entry_t entry,
  58782                                int enable_flag)
  58783 {
  58784     return (BCM_E_UNAVAIL);
  58785 }
  58786 
  58787 int
  58788 bcm_esw_field_entry_enable_get(int unit,
  58789                                bcm_field_entry_t entry,
  58790                                int *enable_flag)
  58791 {
  58792     return (BCM_E_UNAVAIL);
  58793 }
  58794 
  58795 
  58796 int
  58797 bcm_esw_field_group_install(int unit,
  58798                            bcm_field_group_t group)
  58799 {
  58800     return (BCM_E_UNAVAIL);
  58801 }
  58802 
  58803 int
  58804 bcm_esw_field_group_remove(int unit,
  58805                            bcm_field_group_t group)
  58806 {
  58807     return (BCM_E_UNAVAIL);
  58808 }
  58809 
  58810 int
  58811 bcm_esw_field_entry_prio_get(int unit, bcm_field_entry_t entry, int *prio)
  58812 {
  58813     return (BCM_E_UNAVAIL);
  58814 }
  58815 
  58816 int
  58817 bcm_esw_field_entry_prio_set(int unit, bcm_field_entry_t entry, int prio)
  58818 {
  58819     return (BCM_E_UNAVAIL);
  58820 }
  58821 
  58822 int
  58823 bcm_esw_field_resync(int unit)
  58824 {
  58825     return (BCM_E_UNAVAIL);
  58826 }
  58827 
  58828 int
  58829 bcm_esw_field_qualify_clear(int unit, bcm_field_entry_t entry)
  58830 {
  58831     return (BCM_E_UNAVAIL);
  58832 }
  58833 
  58834 int
  58835 bcm_esw_field_qualify_InPort(int unit, bcm_field_entry_t entry,
  58836                              bcm_port_t data, bcm_port_t mask)
  58837 {
  58838     return (BCM_E_UNAVAIL);
  58839 }
  58840 
  58841 int
  58842 bcm_esw_field_qualify_OutPort(int unit, bcm_field_entry_t entry,
  58843                              bcm_port_t data, bcm_port_t mask)
  58844 {
  58845     return (BCM_E_UNAVAIL);
  58846 }
  58847 
  58848 
  58849 
  58850 int
  58851 bcm_esw_field_qualify_InPorts(int unit, bcm_field_entry_t entry,
  58852                               bcm_pbmp_t data, bcm_pbmp_t mask)
  58853 {
  58854     return (BCM_E_UNAVAIL);
  58855 }
  58856 
  58857 int
  58858 bcm_esw_field_qualify_OutPorts(int unit, bcm_field_entry_t entry,
  58859                                bcm_pbmp_t data, bcm_pbmp_t mask)
  58860 {
  58861     return (BCM_E_UNAVAIL);
  58862 }
  58863 
  58864 int
  58865 bcm_esw_field_qualify_Drop(int unit, bcm_field_entry_t entry,
  58866                            uint8 data, uint8 mask)
  58867 {
  58868     return (BCM_E_UNAVAIL);
  58869 }
  58870 
  58871 int
  58872 bcm_esw_field_qualify_SrcPort(int unit, bcm_field_entry_t entry,
  58873                               bcm_module_t data_modid,
  58874                               bcm_module_t mask_modid,
  58875                               bcm_port_t   data_port,
  58876                               bcm_port_t   mask_port)
  58877 {
  58878     return (BCM_E_UNAVAIL);
  58879 }
  58880 
  58881 int
  58882 bcm_esw_field_qualify_SrcTrunk(int unit, bcm_field_entry_t entry,
  58883                                bcm_trunk_t data, bcm_trunk_t mask)
  58884 {
  58885     return (BCM_E_UNAVAIL);
  58886 }
  58887 
  58888 int
  58889 bcm_esw_field_qualify_SrcTrunkMemberGport(int unit,
  58890         bcm_field_entry_t entry ,bcm_gport_t port)
  58891 {
  58892     return (BCM_E_UNAVAIL);
  58893 }
  58894 
  58895 int
  58896 bcm_esw_field_qualify_DstPort(int unit, bcm_field_entry_t entry,
  58897                               bcm_module_t data_modid,
  58898                               bcm_module_t mask_modid,
  58899                               bcm_port_t   data_port,
  58900                               bcm_port_t   mask_port)
  58901 {
  58902     return (BCM_E_UNAVAIL);
  58903 }
  58904 
  58905 int
  58906 bcm_esw_field_qualify_DstTrunk(int unit, bcm_field_entry_t entry,
  58907                                bcm_trunk_t data, bcm_trunk_t mask)
  58908 {
  58909     return (BCM_E_UNAVAIL);
  58910 }
  58911 
  58912 int
  58913 bcm_esw_field_qualify_L4SrcPort(int unit, bcm_field_entry_t entry,
  58914                                 bcm_l4_port_t data, bcm_l4_port_t mask)
  58915 {
  58916     return (BCM_E_UNAVAIL);
  58917 }
  58918 
  58919 int
  58920 bcm_esw_field_qualify_L4DstPort(int unit, bcm_field_entry_t entry,
  58921                                 bcm_l4_port_t data, bcm_l4_port_t mask)
  58922 {
  58923     return (BCM_E_UNAVAIL);
  58924 }
  58925 
  58926 int
  58927 bcm_esw_field_qualify_InnerL4SrcPort(int unit, bcm_field_entry_t entry,
  58928                                 bcm_l4_port_t data, bcm_l4_port_t mask)
  58929 {
  58930     return (BCM_E_UNAVAIL);
  58931 }
  58932 
  58933 int
  58934 bcm_esw_field_qualify_InnerL4DstPort(int unit, bcm_field_entry_t entry,
  58935                                 bcm_l4_port_t data, bcm_l4_port_t mask)
  58936 {
  58937     return (BCM_E_UNAVAIL);
  58938 }
  58939 
  58940 int
  58941 bcm_esw_field_qualify_OuterVlan(int unit, bcm_field_entry_t entry,
  58942                                 bcm_vlan_t data, bcm_vlan_t mask)
  58943 {
  58944     return (BCM_E_UNAVAIL);
  58945 }
  58946 
  58947 int
  58948 bcm_esw_field_qualify_InnerVlan(int unit, bcm_field_entry_t entry,
  58949                                 bcm_vlan_t data, bcm_vlan_t mask)
  58950 {
  58951     return (BCM_E_UNAVAIL);
  58952 }
  58953 
  58954 int
  58955 bcm_esw_field_qualify_EtherType(int unit, bcm_field_entry_t entry,
  58956                                 uint16 data, uint16 mask)
  58957 {
  58958     return (BCM_E_UNAVAIL);
  58959 }
  58960 
  58961 int
  58962 bcm_esw_field_qualify_IpProtocol(int unit, bcm_field_entry_t entry,
  58963                                  uint8 data, uint8 mask)
  58964 {
  58965     return (BCM_E_UNAVAIL);
  58966 }
  58967 
  58968 int 
  58969 bcm_esw_field_qualify_DosAttack(int unit, bcm_field_entry_t entry, 
  58970                                 uint8 data, uint8 mask) 
  58971 {
  58972     return (BCM_E_UNAVAIL);
  58973 }
  58974 
  58975 int 
  58976 bcm_esw_field_qualify_IpmcStarGroupHit(int unit, bcm_field_entry_t entry, 
  58977                                        uint8 data, uint8 mask)
  58978 {
  58979     return (BCM_E_UNAVAIL);
  58980 }
  58981 
  58982 int 
  58983 bcm_esw_field_qualify_MyStationHit(int unit, bcm_field_entry_t entry, 
  58984                                        uint8 data, uint8 mask)
  58985 {
  58986     return (BCM_E_UNAVAIL);
  58987 }
  58988 
  58989 int 
  58990 bcm_esw_field_qualify_L2PayloadFirstEightBytes(int unit, bcm_field_entry_t entry,
  58991                                             uint32 data1, uint32 data2,
  58992                                             uint32 mask1, uint32 mask2)
  58993 {
  58994     return (BCM_E_UNAVAIL);
  58995 }
  58996 
  58997 int 
  58998 bcm_esw_field_qualify_L3DestRouteHit(int unit, bcm_field_entry_t entry, 
  58999                                 uint8 data, uint8 mask)
  59000 {
  59001     return (BCM_E_UNAVAIL);
  59002 }
  59003 
  59004 int 
  59005 bcm_esw_field_qualify_L3DestHostHit(int unit, bcm_field_entry_t entry, 
  59006                                 uint8 data, uint8 mask)
  59007 {
  59008     return (BCM_E_UNAVAIL);
  59009 }
  59010 
  59011 int 
  59012 bcm_esw_field_qualify_L3SrcHostHit(int unit, bcm_field_entry_t entry, 
  59013                                uint8 data, uint8 mask)
  59014 {
  59015     return (BCM_E_UNAVAIL);
  59016 }
  59017 
  59018 int 
  59019 bcm_esw_field_qualify_L2CacheHit(int unit, bcm_field_entry_t entry, 
  59020                                   uint8 data, uint8 mask)
  59021 {
  59022     return (BCM_E_UNAVAIL);
  59023 }
  59024 
  59025 int 
  59026 bcm_esw_field_qualify_L2StationMove(int unit, bcm_field_entry_t entry, 
  59027                                     uint8 data, uint8 mask)
  59028 {
  59029     return (BCM_E_UNAVAIL);
  59030 }
  59031 
  59032 int 
  59033 bcm_esw_field_qualify_L2DestHit(int unit, bcm_field_entry_t entry, 
  59034                                 uint8 data, uint8 mask)
  59035 {
  59036     return (BCM_E_UNAVAIL);
  59037 }
  59038 
  59039 int 
  59040 bcm_esw_field_qualify_L2SrcStatic(int unit, bcm_field_entry_t entry, 
  59041                                   uint8 data, uint8 mask) 
  59042 {
  59043     return (BCM_E_UNAVAIL);
  59044 }
  59045 
  59046 int 
  59047 bcm_esw_field_qualify_L2SrcHit(int unit, bcm_field_entry_t entry, 
  59048                                uint8 data, uint8 mask) 
  59049 {
  59050     return (BCM_E_UNAVAIL);
  59051 }
  59052 
  59053 int 
  59054 bcm_esw_field_qualify_IngressStpState(int unit,bcm_field_entry_t entry, 
  59055                                       uint8 data, uint8 mask) 
  59056 {
  59057     return (BCM_E_UNAVAIL);
  59058 }
  59059 
  59060 int 
  59061 bcm_esw_field_qualify_ForwardingVlanValid(int unit, bcm_field_entry_t entry, 
  59062                                           uint8 data, uint8 mask) 
  59063 {
  59064     return (BCM_E_UNAVAIL);
  59065 }
  59066 
  59067 int 
  59068 bcm_esw_field_qualify_SrcVirtualPortValid(int unit,
  59069                                           bcm_field_entry_t entry,
  59070                                           uint8 data,
  59071                                           uint8 mask)
  59072 {
  59073     return (BCM_E_UNAVAIL);
  59074 }
  59075 
  59076 int
  59077 bcm_esw_field_qualify_DstL3EgressNextHops(int unit,
  59078     bcm_field_entry_t entry,
  59079     uint32 data,
  59080     uint32 mask)
  59081 {
  59082     return (BCM_E_UNAVAIL);
  59083 }
  59084 
  59085 int 
  59086 bcm_esw_field_qualify_VlanTranslationHit(int unit, bcm_field_entry_t entry, 
  59087                                          uint8 data, uint8 mask) 
  59088 {
  59089     return (BCM_E_UNAVAIL);
  59090 }
  59091 
  59092 
  59093 int
  59094 bcm_esw_field_qualify_IpInfo(int unit, bcm_field_entry_t entry,
  59095                              uint32 data, uint32 mask)
  59096 {
  59097     return (BCM_E_UNAVAIL);
  59098 }
  59099 
  59100 int
  59101 bcm_esw_field_qualify_PacketRes(int unit, bcm_field_entry_t entry,
  59102                                 uint32 data, uint32 mask)
  59103 {
  59104     return (BCM_E_UNAVAIL);
  59105 }
  59106 
  59107 int
  59108 bcm_esw_field_qualify_SrcIp(int unit, bcm_field_entry_t entry,
  59109                             bcm_ip_t data, bcm_ip_t mask)
  59110 {
  59111     return (BCM_E_UNAVAIL);
  59112 }
  59113 
  59114 int
  59115 bcm_esw_field_qualify_DstIp(int unit, bcm_field_entry_t entry,
  59116                             bcm_ip_t data, bcm_ip_t mask)
  59117 {
  59118     return (BCM_E_UNAVAIL);
  59119 }
  59120 
  59121 int
  59122 bcm_esw_field_qualify_DSCP(int unit, bcm_field_entry_t entry,
  59123                            uint8 data, uint8 mask)
  59124 {
  59125     return (BCM_E_UNAVAIL);
  59126 }
  59127 
  59128 int
  59129 bcm_esw_field_qualify_Tos(int unit, bcm_field_entry_t entry,
  59130                            uint8 data, uint8 mask)
  59131 {
  59132     return (BCM_E_UNAVAIL);
  59133 }
  59134 
  59135 int
  59136 bcm_esw_field_qualify_IpFlags(int unit, bcm_field_entry_t entry,
  59137                               uint8 data, uint8 mask)
  59138 {
  59139     return (BCM_E_UNAVAIL);
  59140 }
  59141 
  59142 int
  59143 bcm_esw_field_qualify_TcpControl(int unit, bcm_field_entry_t entry,
  59144                                  uint8 data, uint8 mask)
  59145 {
  59146     return (BCM_E_UNAVAIL);
  59147 }
  59148 
  59149 int
  59150 bcm_esw_field_qualify_Ttl(int unit, bcm_field_entry_t entry,
  59151                           uint8 data, uint8 mask)
  59152 {
  59153     return (BCM_E_UNAVAIL);
  59154 }
  59155 
  59156 int
  59157 bcm_esw_field_qualify_RangeCheck(int unit, bcm_field_entry_t entry,
  59158                                  bcm_field_range_t range, int invert)
  59159 {
  59160     return (BCM_E_UNAVAIL);
  59161 }
  59162 
  59163 int
  59164 bcm_esw_field_qualify_SrcIp6(int unit, bcm_field_entry_t entry,
  59165                              bcm_ip6_t data, bcm_ip6_t mask)
  59166 {
  59167     return (BCM_E_UNAVAIL);
  59168 }
  59169 
  59170 int
  59171 bcm_esw_field_qualify_DstIp6(int unit, bcm_field_entry_t entry,
  59172                              bcm_ip6_t data, bcm_ip6_t mask)
  59173 {
  59174     return (BCM_E_UNAVAIL);
  59175 }
  59176 
  59177 int
  59178 bcm_esw_field_qualify_SrcIp6High(int unit, bcm_field_entry_t entry,
  59179                                  bcm_ip6_t data, bcm_ip6_t mask)
  59180 {
  59181     return (BCM_E_UNAVAIL);
  59182 }
  59183 
  59184 int
  59185 bcm_esw_field_qualify_DstIp6High(int unit, bcm_field_entry_t entry,
  59186                                  bcm_ip6_t data, bcm_ip6_t mask)
  59187 {
  59188     return (BCM_E_UNAVAIL);
  59189 }
  59190 
  59191 int
  59192 bcm_esw_field_qualify_SrcIp6Low(int unit, bcm_field_entry_t entry,
  59193                                  bcm_ip6_t data, bcm_ip6_t mask)
  59194 {
  59195     return (BCM_E_UNAVAIL);
  59196 }
  59197 
  59198 int
  59199 bcm_esw_field_qualify_DstIp6Low(int unit, bcm_field_entry_t entry,
  59200                                  bcm_ip6_t data, bcm_ip6_t mask)
  59201 {
  59202     return (BCM_E_UNAVAIL);
  59203 }
  59204 
  59205 int
  59206 bcm_esw_field_qualify_Ip6NextHeader(int unit, bcm_field_entry_t entry,
  59207                                     uint8 data, uint8 mask)
  59208 {
  59209     return (BCM_E_UNAVAIL);
  59210 }
  59211 
  59212 int
  59213 bcm_esw_field_qualify_InnerIp6NextHeader(int unit, bcm_field_entry_t entry,
  59214                                     uint8 data, uint8 mask)
  59215 {
  59216     return (BCM_E_UNAVAIL);
  59217 }
  59218 
  59219 int
  59220 bcm_esw_field_qualify_InnerIp6NextHeader_get(int unit, bcm_field_entry_t entry,
  59221                                     uint8 *data, uint8 *mask)
  59222 {
  59223     return (BCM_E_UNAVAIL);
  59224 }
  59225 
  59226 int
  59227 bcm_esw_field_qualify_InnerIp6FlowLabel(int unit, bcm_field_entry_t entry,
  59228                                    uint32 data, uint32 mask)
  59229 {
  59230     return (BCM_E_UNAVAIL);
  59231 }
  59232 
  59233 int
  59234 bcm_esw_field_qualify_Ip6TrafficClass(int unit, bcm_field_entry_t entry,
  59235                                       uint8 data, uint8 mask)
  59236 {
  59237     return (BCM_E_UNAVAIL);
  59238 }
  59239 
  59240 int
  59241 bcm_esw_field_qualify_Ip6FlowLabel(int unit, bcm_field_entry_t entry,
  59242                                    uint32 data, uint32 mask)
  59243 {
  59244     return (BCM_E_UNAVAIL);
  59245 }
  59246 
  59247 int
  59248 bcm_esw_field_qualify_Ip6HopLimit(int unit, bcm_field_entry_t entry,
  59249                                   uint8 data, uint8 mask)
  59250 {
  59251     return (BCM_E_UNAVAIL);
  59252 }
  59253 
  59254 int
  59255 bcm_esw_field_qualify_InnerIp6HopLimit(int unit, bcm_field_entry_t entry,
  59256                                   uint8 data, uint8 mask)
  59257 {
  59258     return (BCM_E_UNAVAIL);
  59259 }
  59260 
  59261 int
  59262 bcm_esw_field_qualify_InnerIp6HopLimit_get(int unit, bcm_field_entry_t entry,
  59263                                   uint8 *data, uint8 *mask)
  59264 {
  59265     return (BCM_E_UNAVAIL);
  59266 }
  59267 
  59268 int
  59269 bcm_esw_field_qualify_SrcMac(int unit, bcm_field_entry_t entry,
  59270                              bcm_mac_t data, bcm_mac_t mask)
  59271 {
  59272     return (BCM_E_UNAVAIL);
  59273 }
  59274 
  59275 int
  59276 bcm_esw_field_qualify_DstMac(int unit, bcm_field_entry_t entry,
  59277                              bcm_mac_t data, bcm_mac_t mask)
  59278 {
  59279     return (BCM_E_UNAVAIL);
  59280 }
  59281 
  59282 int
  59283 bcm_esw_field_qualify_IpType(int unit, bcm_field_entry_t entry,
  59284                              bcm_field_IpType_t data)
  59285 {
  59286     return (BCM_E_UNAVAIL);
  59287 }
  59288 
  59289 int
  59290 bcm_esw_field_qualify_ForwardingType(int unit, bcm_field_entry_t entry,
  59291                              bcm_field_ForwardingType_t data)
  59292 {
  59293     return (BCM_E_UNAVAIL);
  59294 }
  59295 
  59296 int
  59297 bcm_esw_field_qualify_L2Format(int unit, bcm_field_entry_t entry,
  59298                                bcm_field_L2Format_t type)
  59299 {
  59300     return (BCM_E_UNAVAIL);
  59301 }
  59302 
  59303 int
  59304 bcm_esw_field_qualify_VlanFormat(int unit, bcm_field_entry_t entry,
  59305                                  uint8 data, uint8 mask)
  59306 {
  59307     return (BCM_E_UNAVAIL);
  59308 }
  59309 
  59310 int
  59311 bcm_esw_field_qualify_MHOpcode(int unit, bcm_field_entry_t entry,
  59312                                uint8 data, uint8 mask)
  59313 {
  59314     return (BCM_E_UNAVAIL);
  59315 }
  59316 
  59317 int
  59318 bcm_esw_field_qualify_Decap(int unit, bcm_field_entry_t entry,
  59319                             bcm_field_decap_t decap)
  59320 {
  59321     return (BCM_E_UNAVAIL);
  59322 }
  59323 
  59324 int
  59325 bcm_esw_field_qualify_HiGig(int unit, bcm_field_entry_t entry,
  59326                             uint8 data, uint8 mask)
  59327 {
  59328     return (BCM_E_UNAVAIL);
  59329 }
  59330 int
  59331 bcm_esw_field_qualify_HiGigProxy(int unit, bcm_field_entry_t entry,
  59332                             uint8 data, uint8 mask)
  59333 {
  59334     return (BCM_E_UNAVAIL);
  59335 }
  59336 int
  59337 bcm_esw_field_qualify_InterfaceClassL2(int unit, bcm_field_entry_t entry,
  59338                                        uint32 data, uint32 mask)
  59339 {
  59340     return (BCM_E_UNAVAIL);
  59341 }
  59342 
  59343 int
  59344 bcm_esw_field_qualify_InterfaceClassVPort(int unit, bcm_field_entry_t entry,
  59345                                          uint32 data, uint32 mask)
  59346 {
  59347     return (BCM_E_UNAVAIL);
  59348 }
  59349 
  59350 int
  59351 bcm_esw_field_qualify_InterfaceClassL3(int unit, bcm_field_entry_t entry,
  59352                                        uint32 data, uint32 mask)
  59353 {
  59354     return (BCM_E_UNAVAIL);
  59355 }
  59356 
  59357 int
  59358 bcm_esw_field_qualify_InterfaceClassPort(int unit, bcm_field_entry_t entry,
  59359                                        uint32 data, uint32 mask)
  59360 {
  59361     return (BCM_E_UNAVAIL);
  59362 }
  59363 
  59364 int
  59365 bcm_esw_field_qualify_SrcClassL2(int unit, bcm_field_entry_t entry,
  59366                                  uint32 data, uint32 mask)
  59367 {
  59368     return (BCM_E_UNAVAIL);
  59369 }
  59370 
  59371 int
  59372 bcm_esw_field_qualify_SrcClassL3(int unit, bcm_field_entry_t entry,
  59373                                  uint32 data, uint32 mask)
  59374 {
  59375     return (BCM_E_UNAVAIL);
  59376 }
  59377 
  59378 int
  59379 bcm_esw_field_qualify_SrcClassField(int unit, bcm_field_entry_t entry,
  59380                                      uint32 data, uint32 mask)
  59381 {
  59382     return (BCM_E_UNAVAIL);
  59383 }
  59384 
  59385 int
  59386 bcm_esw_field_qualify_DstClassL2(int unit, bcm_field_entry_t entry,
  59387                                  uint32 data, uint32 mask)
  59388 {
  59389     return (BCM_E_UNAVAIL);
  59390 }
  59391 
  59392 int
  59393 bcm_esw_field_qualify_DstClassL3(int unit, bcm_field_entry_t entry,
  59394                                  uint32 data, uint32 mask)
  59395 {
  59396     return (BCM_E_UNAVAIL);
  59397 }
  59398 
  59399 int
  59400 bcm_esw_field_qualify_DstClassField(int unit, bcm_field_entry_t entry,
  59401                                      uint32 data, uint32 mask)
  59402 {
  59403     return (BCM_E_UNAVAIL);
  59404 }
  59405 
  59406 int 
  59407 bcm_esw_field_qualify_TcpSequenceZero(int unit, bcm_field_entry_t entry,
  59408                             uint32 flag)
  59409 {
  59410     return (BCM_E_UNAVAIL);
  59411 }
  59412 
  59413 int
  59414 bcm_esw_field_qualify_TcpHeaderSize(int unit, bcm_field_entry_t entry,
  59415                                  uint8 data, uint8 mask)
  59416 {
  59417     return (BCM_E_UNAVAIL);
  59418 }
  59419 
  59420 int
  59421 bcm_esw_field_qualify_IpProtocolCommon(int unit, bcm_field_entry_t entry,
  59422                                        bcm_field_IpProtocolCommon_t protocol)
  59423 {
  59424     return (BCM_E_UNAVAIL);
  59425 }
  59426 
  59427 int
  59428 bcm_esw_field_qualify_InnerIpProtocolCommon(int unit, bcm_field_entry_t entry,
  59429                                        bcm_field_IpProtocolCommon_t protocol)
  59430 {
  59431     return (BCM_E_UNAVAIL);
  59432 }
  59433 
  59434 int
  59435 bcm_esw_field_qualify_Snap(int unit, bcm_field_entry_t entry,
  59436                            bcm_field_snap_header_t data, 
  59437                            bcm_field_snap_header_t mask)
  59438 {
  59439     return (BCM_E_UNAVAIL);
  59440 }
  59441 
  59442 int
  59443 bcm_esw_field_qualify_Llc(int unit, bcm_field_entry_t entry,
  59444                           bcm_field_llc_header_t data, 
  59445                           bcm_field_llc_header_t mask)
  59446 {
  59447     return (BCM_E_UNAVAIL);
  59448 }
  59449 
  59450 int
  59451 bcm_esw_field_qualify_InnerTpid(int unit, bcm_field_entry_t entry,
  59452                                 uint16 tpid)
  59453 {
  59454     return (BCM_E_UNAVAIL);
  59455 }
  59456 
  59457 int
  59458 bcm_esw_field_qualify_OuterTpid(int unit, bcm_field_entry_t entry,
  59459                                 uint16 tpid)
  59460 {
  59461     return (BCM_E_UNAVAIL);
  59462 }
  59463 
  59464 int bcm_esw_field_qualify_L3Routable(int unit, bcm_field_entry_t entry,
  59465                                   uint8 data, uint8 mask)
  59466 {
  59467     return (BCM_E_UNAVAIL);
  59468 }
  59469 
  59470 int bcm_esw_field_qualify_IpFrag(int unit, bcm_field_entry_t entry,
  59471                                   bcm_field_IpFrag_t frag_info)
  59472 {
  59473     return (BCM_E_UNAVAIL);
  59474 }
  59475 
  59476 int bcm_esw_field_qualify_Vrf(int unit, bcm_field_entry_t entry,
  59477                               uint32 data, uint32 mask)
  59478 {
  59479     return (BCM_E_UNAVAIL);
  59480 }
  59481 
  59482 int bcm_esw_field_qualify_L3Ingress(int unit, bcm_field_entry_t entry,
  59483                               uint32 data, uint32 mask)
  59484 {
  59485     return (BCM_E_UNAVAIL);
  59486 }
  59487 
  59488 int bcm_esw_field_qualify_L4Ports(int unit, bcm_field_entry_t entry,
  59489                                   uint8 data, uint8 mask)
  59490 {
  59491     return (BCM_E_UNAVAIL);
  59492 }
  59493 
  59494 int bcm_esw_field_qualify_MirrorCopy(int unit, bcm_field_entry_t entry,
  59495                                   uint8 data, uint8 mask)
  59496 {
  59497     return (BCM_E_UNAVAIL);
  59498 }
  59499 
  59500 
  59501 int bcm_esw_field_qualify_TunnelTerminated(int unit, bcm_field_entry_t entry,
  59502                                            uint8 data, uint8 mask)
  59503 {
  59504     return (BCM_E_UNAVAIL);
  59505 }
  59506 
  59507 int bcm_esw_field_qualify_MplsTerminated(int unit, bcm_field_entry_t entry,
  59508                                            uint8 data, uint8 mask)
  59509 {
  59510     return (BCM_E_UNAVAIL);
  59511 }
  59512 
  59513 
  59514 int bcm_esw_field_qualify_ExtensionHeaderType(int unit, 
  59515                                               bcm_field_entry_t entry,
  59516                                               uint8 data, uint8 mask)
  59517 {
  59518     return (BCM_E_UNAVAIL);
  59519 }
  59520 
  59521 int bcm_esw_field_qualify_ExtensionHeaderSubCode(int unit, 
  59522                                                  bcm_field_entry_t entry,
  59523                                                  uint8 data, uint8 mask)
  59524 {
  59525     return (BCM_E_UNAVAIL);
  59526 }
  59527 
  59528 int bcm_esw_field_qualify_ExtensionHeader2Type(int unit, 
  59529                                               bcm_field_entry_t entry,
  59530                                               uint8 data, uint8 mask)
  59531 {
  59532     return (BCM_E_UNAVAIL);
  59533 }
  59534 
  59535 int
  59536 bcm_esw_field_action_add(int unit,
  59537                          bcm_field_entry_t entry,
  59538                          bcm_field_action_t action,
  59539                          uint32 param0,
  59540                          uint32 param1)
  59541 {
  59542     return (BCM_E_UNAVAIL);
  59543 }
  59544 
  59545 int
  59546 bcm_esw_field_action_ports_add(int unit,
  59547                                bcm_field_entry_t entry,
  59548                                bcm_field_action_t action,
  59549                                bcm_pbmp_t pbmp)
  59550 {
  59551     return (BCM_E_UNAVAIL);
  59552 }
  59553 
  59554 int
  59555 bcm_esw_field_action_get(int unit,
  59556                          bcm_field_entry_t entry,
  59557                          bcm_field_action_t action,
  59558                          uint32 *param0,
  59559                          uint32 *param1)
  59560 {
  59561     return (BCM_E_UNAVAIL);
  59562 }
  59563 
  59564 int
  59565 bcm_esw_field_action_ports_get(int unit,
  59566                                bcm_field_entry_t entry,
  59567                                bcm_field_action_t action,
  59568                                bcm_pbmp_t *pbmp)
  59569 {
  59570     return (BCM_E_UNAVAIL);
  59571 }
  59572 
  59573 int 
  59574 bcm_esw_field_action_delete(int unit, bcm_field_entry_t entry, 
  59575                         bcm_field_action_t action, 
  59576                         uint32 param0, uint32 param1)
  59577 {
  59578     return (BCM_E_UNAVAIL);
  59579 }
  59580 
  59581 int
  59582 bcm_esw_field_action_remove(int unit,
  59583                             bcm_field_entry_t entry,
  59584                             bcm_field_action_t action)
  59585 {
  59586     return (BCM_E_UNAVAIL);
  59587 }
  59588 
  59589 int
  59590 bcm_esw_field_action_remove_all(int unit,
  59591                                 bcm_field_entry_t entry)
  59592 {
  59593     return (BCM_E_UNAVAIL);
  59594 }
  59595 
  59596 int 
  59597 bcm_esw_field_entry_dump(int unit, 
  59598                          bcm_field_entry_t entry)
  59599 {
  59600     return (BCM_E_UNAVAIL);
  59601 }
  59602 
  59603 int
  59604 bcm_esw_field_group_dump(int unit,
  59605                          bcm_field_group_t group)
  59606 {
  59607     return (BCM_E_UNAVAIL);
  59608 }
  59609 
  59610 int
  59611 bcm_esw_field_show(int unit,
  59612                    const char *pfx)
  59613 {
  59614     return (BCM_E_UNAVAIL);
  59615 }
  59616 
  59617 int
  59618 bcm_esw_field_qualify_InnerSrcIp(int unit, bcm_field_entry_t entry,
  59619                             bcm_ip_t data, bcm_ip_t mask)
  59620 {
  59621     return (BCM_E_UNAVAIL);
  59622 }
  59623 
  59624 int
  59625 bcm_esw_field_qualify_InnerDstIp(int unit, bcm_field_entry_t entry,
  59626                             bcm_ip_t data, bcm_ip_t mask)
  59627 {
  59628     return (BCM_E_UNAVAIL);
  59629 }
  59630 
  59631 int
  59632 bcm_esw_field_qualify_InnerSrcIp6(int unit, bcm_field_entry_t entry,
  59633                              bcm_ip6_t data, bcm_ip6_t mask)
  59634 {
  59635     return (BCM_E_UNAVAIL);
  59636 }
  59637 
  59638 int
  59639 bcm_esw_field_qualify_InnerDstIp6(int unit, bcm_field_entry_t entry,
  59640                              bcm_ip6_t data, bcm_ip6_t mask)
  59641 {
  59642      return (BCM_E_UNAVAIL);
  59643 }
  59644 
  59645 int
  59646 bcm_esw_field_qualify_InnerSrcIp6High(int unit, bcm_field_entry_t entry,
  59647                                  bcm_ip6_t data, bcm_ip6_t mask)
  59648 {
  59649      return (BCM_E_UNAVAIL);
  59650 }
  59651 
  59652 int
  59653 bcm_esw_field_qualify_InnerDstIp6High(int unit, bcm_field_entry_t entry,
  59654                                  bcm_ip6_t data, bcm_ip6_t mask)
  59655 {
  59656      return (BCM_E_UNAVAIL);
  59657 }
  59658 
  59659 int
  59660 bcm_esw_field_qualify_InnerTos(int unit, bcm_field_entry_t entry,
  59661                            uint8 data, uint8 mask)
  59662 {
  59663      return (BCM_E_UNAVAIL);
  59664 }
  59665 
  59666 int
  59667 bcm_esw_field_qualify_InnerDSCP(int unit, bcm_field_entry_t entry,
  59668                            uint8 data, uint8 mask)
  59669 {
  59670      return (BCM_E_UNAVAIL);
  59671 }
  59672 
  59673 int
  59674 bcm_esw_field_qualify_InnerIpProtocol(int unit, bcm_field_entry_t entry,
  59675                                  uint8 data, uint8 mask)
  59676 {
  59677      return (BCM_E_UNAVAIL);
  59678 }
  59679 
  59680 
  59681 int bcm_esw_field_qualify_InnerIpFrag(int unit, bcm_field_entry_t entry,
  59682                                   bcm_field_IpFrag_t frag_info)
  59683 {
  59684      return (BCM_E_UNAVAIL);
  59685 }
  59686 
  59687 int
  59688 bcm_esw_field_qualify_InnerTtl(int unit, bcm_field_entry_t entry,
  59689                           uint8 data, uint8 mask)
  59690 {
  59691      return (BCM_E_UNAVAIL);
  59692 }
  59693 
  59694 int 
  59695 bcm_esw_field_qualify_IcmpTypeCode(int unit, bcm_field_entry_t entry,
  59696                                          uint16 data,uint16 mask)
  59697 {
  59698     return (BCM_E_UNAVAIL);
  59699 }
  59700 
  59701 int
  59702 bcm_esw_field_data_qualifier_create(int unit,  
  59703                                  bcm_field_data_qualifier_t *data_qualifier)
  59704 {
  59705     return (BCM_E_UNAVAIL);
  59706 }
  59707 
  59708 int
  59709 bcm_esw_field_data_qualifier_multi_get(int unit, 
  59710                                                                                 int qual_size, 
  59711                                                                                 int *qual_array, int *qual_count)
  59712 {
  59713     return (BCM_E_UNAVAIL);
  59714 }
  59715 
  59716 int
  59717 bcm_esw_field_data_qualifier_get(int unit, 
  59718                                                                         int qual_id, 
  59719                                                                         bcm_field_data_qualifier_t *qual)
  59720 {
  59721     return (BCM_E_UNAVAIL);
  59722 }
  59723 
  59724 int
  59725 bcm_esw_field_data_qualifier_destroy(int unit, int qual_id)
  59726 {
  59727     return (BCM_E_UNAVAIL);
  59728 }
  59729 
  59730 int
  59731 bcm_esw_field_data_qualifier_destroy_all(int unit)
  59732 {
  59733     return (BCM_E_UNAVAIL);
  59734 }
  59735 
  59736 int
  59737 bcm_esw_field_qset_data_qualifier_add(int unit, bcm_field_qset_t *qset,  
  59738                                       int qual_id)
  59739 {
  59740     return (BCM_E_UNAVAIL);
  59741 }
  59742 
  59743 int
  59744 bcm_esw_field_qset_data_qualifier_delete(int unit, bcm_field_qset_t *qset,  
  59745                                          int qual_id)
  59746 {
  59747     return (BCM_E_UNAVAIL);
  59748 }
  59749 
  59750 int 
  59751 bcm_esw_field_qset_data_qualifier_get(int unit, bcm_field_qset_t qset, int qual_max,
  59752                                   int *qual_arr, int *qual_count) 
  59753 {
  59754     return (BCM_E_UNAVAIL);
  59755 }
  59756 
  59757 int
  59758 bcm_esw_field_qualify_data(int unit, bcm_field_entry_t eid, int qual_id,
  59759                            uint8 *data, uint8 *mask, uint16 length)
  59760 {
  59761     return (BCM_E_UNAVAIL);
  59762 }
  59763 
  59764 int
  59765 bcm_esw_field_data_qualifier_ethertype_add(int unit, int qual_id,
  59766                                  bcm_field_data_ethertype_t *etype)
  59767 {
  59768     return (BCM_E_UNAVAIL);
  59769 }
  59770 
  59771 int
  59772 bcm_esw_field_data_qualifier_ethertype_delete(int unit, int qual_id,
  59773                                  bcm_field_data_ethertype_t *etype)
  59774 {
  59775     return (BCM_E_UNAVAIL);
  59776 }
  59777 
  59778 int
  59779 bcm_esw_field_data_qualifier_ip_protocol_add(int unit, int qual_id,
  59780                                  bcm_field_data_ip_protocol_t *ip_protocol)
  59781 {
  59782     return (BCM_E_UNAVAIL);
  59783 }
  59784 
  59785 int
  59786 bcm_esw_field_data_qualifier_ip_protocol_delete(int unit, int qual_id,
  59787                                  bcm_field_data_ip_protocol_t *ip_protocol)
  59788 {
  59789     return (BCM_E_UNAVAIL);
  59790 }
  59791 
  59792 int
  59793 bcm_esw_field_data_qualifier_packet_format_add(int unit,  int qual_id,
  59794                                  bcm_field_data_packet_format_t *packet_format)
  59795 {
  59796     return (BCM_E_UNAVAIL);
  59797 }
  59798 
  59799 int
  59800 bcm_esw_field_data_qualifier_packet_format_delete(int unit, int qual_id,
  59801                                  bcm_field_data_packet_format_t *packet_format)
  59802 {
  59803     return (BCM_E_UNAVAIL);
  59804 }
  59805 
  59806 int
  59807 bcm_esw_field_group_compress(int unit, bcm_field_group_t group)
  59808 {
  59809     return (BCM_E_UNAVAIL);
  59810 }
  59811 
  59812 int
  59813 bcm_esw_field_group_priority_set(int unit, bcm_field_group_t group,
  59814                                  int priority)
  59815 {
  59816     return (BCM_E_UNAVAIL);
  59817 }
  59818 
  59819 int
  59820 bcm_esw_field_group_priority_get(int unit, bcm_field_group_t group,
  59821                                  int *priority)
  59822 {
  59823     return (BCM_E_UNAVAIL);
  59824 }
  59825 int 
  59826 bcm_esw_policer_init(int unit)
  59827 {
  59828     return (BCM_E_UNAVAIL);
  59829 }
  59830 int 
  59831 bcm_esw_policer_get(int unit, bcm_policer_t policer_id, 
  59832                     bcm_policer_config_t *pol_cfg)
  59833 {
  59834     return (BCM_E_UNAVAIL);
  59835 }
  59836 int
  59837 bcm_esw_policer_packet_counter_get32(int unit, bcm_policer_t policer_id,
  59838                     uint32 *count)
  59839 {
  59840     return (BCM_E_UNAVAIL);
  59841 }
  59842 int
  59843 bcm_esw_policer_packet_reset_counter_get32(int unit, bcm_policer_t policer_id,
  59844                     uint32 *count)
  59845 {
  59846     return (BCM_E_UNAVAIL);
  59847 }
  59848 int 
  59849 bcm_esw_policer_set(int unit, bcm_policer_t policer_id, 
  59850                     bcm_policer_config_t *pol_cfg)
  59851 {
  59852     return (BCM_E_UNAVAIL);
  59853 }
  59854 int 
  59855 bcm_esw_field_entry_policer_attach(int unit, bcm_field_entry_t entry_id, 
  59856                                    int level, bcm_policer_t policer_id)
  59857 {
  59858     return (BCM_E_UNAVAIL);
  59859 }
  59860 int 
  59861 bcm_esw_field_entry_policer_detach(int unit, bcm_field_entry_t entry_id, 
  59862                                    int level)
  59863 {
  59864     return (BCM_E_UNAVAIL);
  59865 }
  59866 int 
  59867 bcm_esw_field_entry_policer_detach_all(int unit, bcm_field_entry_t entry_id)
  59868 {
  59869     return (BCM_E_UNAVAIL);
  59870 }
  59871 int 
  59872 bcm_esw_field_entry_policer_get(int unit, bcm_field_entry_t entry_id, 
  59873                                 int level, bcm_policer_t *policer_id)
  59874 {
  59875     return (BCM_E_UNAVAIL);
  59876 }
  59877 int 
  59878 bcm_esw_policer_create(int unit, bcm_policer_config_t *pol_cfg, 
  59879                        bcm_policer_t *policer_id)
  59880 {
  59881     return BCM_E_UNAVAIL;
  59882 }
  59883 
  59884 int 
  59885 bcm_esw_policer_destroy(int unit, bcm_policer_t policer_id)
  59886 {
  59887     return BCM_E_UNAVAIL;
  59888 }
  59889 
  59890 int 
  59891 bcm_esw_policer_destroy_all(int unit)
  59892 {
  59893     return BCM_E_UNAVAIL;
  59894 }
  59895 int 
  59896 bcm_esw_policer_traverse(int unit, bcm_policer_traverse_cb cb, 
  59897                          void *user_data)
  59898 {
  59899     return BCM_E_UNAVAIL;
  59900 }
  59901 
  59902 int 
  59903 bcm_esw_field_stat_create(int unit, bcm_field_group_t group, int nstat, 
  59904                           bcm_field_stat_t *stat_arr, int *stat_id) 
  59905 {
  59906     return (BCM_E_UNAVAIL);
  59907 }
  59908 
  59909 int 
  59910 bcm_esw_field_stat_create_id(int unit, bcm_field_group_t group, int nstat, 
  59911                           bcm_field_stat_t *stat_arr, int stat_id) 
  59912 {
  59913     return (BCM_E_UNAVAIL);
  59914 }
  59915 
  59916 int
  59917 bcm_esw_field_stat_attach(int unit, bcm_field_group_t field_group, 
  59918                           uint32 stat_counter_id, uint32 *stat_id)
  59919 {
  59920     return (BCM_E_UNAVAIL);
  59921 }
  59922 
  59923 int
  59924 bcm_esw_field_stat_detach(int unit, uint32 stat_id)
  59925 {
  59926     return (BCM_E_UNAVAIL);
  59927 }
  59928 
  59929 int
  59930 bcm_esw_field_stat_counter_get(int unit, uint32 stat_id, bcm_field_stat_t stat, 
  59931                                uint32 num_entries, uint32 *counter_indexes, 
  59932                                bcm_stat_value_t *counter_values)
  59933 {
  59934     return (BCM_E_UNAVAIL);
  59935 }
  59936 
  59937 int
  59938 bcm_esw_field_stat_counter_set(int unit, uint32 stat_id, bcm_field_stat_t stat, 
  59939                                uint32 num_entries, uint32 *counter_indexes, 
  59940                                bcm_stat_value_t *counter_values)
  59941 {
  59942     return (BCM_E_UNAVAIL);
  59943 }
  59944 
  59945 int bcm_esw_field_stat_id_get(int               unit,
  59946                               bcm_field_group_t group,
  59947                               uint32            stat_id, 
  59948                               uint32            *stat_counter_id)
  59949 {
  59950    return BCM_E_UNAVAIL;
  59951 }
  59952 
  59953 int 
  59954 bcm_esw_field_stat_destroy(int unit, int stat_id)
  59955 {
  59956     return (BCM_E_UNAVAIL);
  59957 }
  59958 
  59959 int 
  59960 bcm_esw_field_stat_size(int unit, int stat_id, int *stat_size)
  59961 {
  59962     return (BCM_E_UNAVAIL);
  59963 }
  59964 
  59965 int 
  59966 bcm_esw_field_stat_config_get(int unit, int stat_id, int nstat, 
  59967                               bcm_field_stat_t *stat_arr)
  59968 {
  59969     return (BCM_E_UNAVAIL);
  59970 }
  59971 
  59972 int 
  59973 bcm_esw_field_stat_get(int unit, int stat_id, bcm_field_stat_t stat, 
  59974                        uint64 *value)
  59975 {
  59976     return (BCM_E_UNAVAIL);
  59977 }
  59978 
  59979 int bcm_esw_field_stat_get32(int unit, int stat_id, 
  59980                              bcm_field_stat_t stat, uint32 *value)
  59981 {
  59982     return (BCM_E_UNAVAIL);
  59983 }
  59984 
  59985 int bcm_esw_field_stat_multi_get(int unit, int stat_id, int nstat, 
  59986                                  bcm_field_stat_t *stat_arr, uint64 *value_arr)
  59987 {
  59988     return (BCM_E_UNAVAIL);
  59989 }
  59990 
  59991 int bcm_esw_field_stat_multi_get32(int unit, int stat_id, int nstat, 
  59992                                    bcm_field_stat_t *stat_arr, 
  59993                                    uint32 *value_arr)
  59994 {
  59995     return (BCM_E_UNAVAIL);
  59996 }
  59997 
  59998 int bcm_esw_field_entry_stat_attach(int unit, bcm_field_entry_t entry, 
  59999                                     int stat_id)
  60000 {
  60001     return (BCM_E_UNAVAIL);
  60002 }
  60003 
  60004 int bcm_esw_field_entry_stat_extended_attach(int unit,
  60005                                            bcm_field_entry_t entry,
  60006                                            int stat_id,
  60007                                            bcm_field_stat_action_t stat_action) 
  60008 {
  60009     return BCM_E_UNAVAIL;
  60010 }
  60011 
  60012 int bcm_esw_field_entry_stat_detach(int unit, bcm_field_entry_t entry,
  60013                                     int stat_id)
  60014 {
  60015     return (BCM_E_UNAVAIL);
  60016 }
  60017 
  60018 int 
  60019 bcm_esw_field_entry_stat_get(int unit, bcm_field_entry_t entry, int *stat_id)
  60020 {
  60021     return (BCM_E_UNAVAIL);
  60022 }
  60023 
  60024 int bcm_esw_field_entry_stat_extended_get(int unit,
  60025                                           bcm_field_entry_t entry,
  60026                                           int *stat_id,
  60027                                           bcm_field_stat_action_t *stat_action)
  60028 {
  60029     return BCM_E_UNAVAIL;
  60030 }
  60031 
  60032 /* Add Oam Stat action to Field Processor entry. */
  60033 int bcm_esw_field_oam_stat_action_add(
  60034     int unit,
  60035     bcm_field_entry_t entry,
  60036     bcm_field_oam_stat_action_t *oam_stat_action)
  60037 {
  60038     return BCM_E_UNAVAIL;
  60039 }
  60040 
  60041 /* Remove Oam Stat action from Field Processor entry. */
  60042 int bcm_esw_field_oam_stat_action_delete(
  60043     int unit,
  60044     bcm_field_entry_t entry,
  60045     bcm_field_oam_stat_action_t *oam_stat_action)
  60046 {
  60047     return BCM_E_UNAVAIL;
  60048 }
  60049 
  60050 /* Remove all Oam Stat action from Field Processor entry. */
  60051 int bcm_esw_field_oam_stat_action_delete_all(
  60052     int unit,
  60053     bcm_field_entry_t entry)
  60054 {
  60055     return BCM_E_UNAVAIL;
  60056 }
  60057 
  60058 /* Get Oam Stat action from Field Processor entry. */
  60059 int bcm_esw_field_oam_stat_action_get(
  60060     int unit,
  60061     bcm_field_entry_t entry,
  60062     bcm_field_oam_stat_action_t *oam_stat_action)
  60063 {
  60064     return BCM_E_UNAVAIL;
  60065 }
  60066 
  60067 /* Get all Oam Stat action from Field Processor entry. */
  60068 int bcm_esw_field_oam_stat_action_get_all(
  60069     int unit,
  60070     bcm_field_entry_t entry,
  60071     int oam_stat_max,
  60072     bcm_field_oam_stat_action_t *oam_stat_action,
  60073     int *oam_stat_count)
  60074 {
  60075     return BCM_E_UNAVAIL;
  60076 }
  60077 
  60078 int 
  60079 bcm_esw_field_stat_set(int unit, int stat_id, bcm_field_stat_t stat, 
  60080                        uint64 value)
  60081 {
  60082     return (BCM_E_UNAVAIL);
  60083 }
  60084 
  60085 int
  60086 bcm_esw_field_stat_set32(int unit, int stat_id, bcm_field_stat_t stat, 
  60087                          uint32 value)
  60088 {
  60089     return (BCM_E_UNAVAIL);
  60090 }
  60091 
  60092 int 
  60093 bcm_esw_field_stat_all_set(int unit, int stat_id, uint64 value)
  60094 {
  60095     return (BCM_E_UNAVAIL);
  60096 }
  60097 
  60098 int 
  60099 bcm_esw_field_stat_all_set32(int unit, int stat_id, uint32 value)
  60100 {
  60101     return (BCM_E_UNAVAIL);
  60102 }
  60103 
  60104 int
  60105 bcm_esw_field_qualify_InnerIpType(int unit, bcm_field_entry_t entry,
  60106                              bcm_field_IpType_t type)
  60107 {
  60108     return (BCM_E_UNAVAIL);
  60109 }
  60110 
  60111 int 
  60112 bcm_esw_field_qualify_DstL3Egress(int unit, 
  60113                                   bcm_field_entry_t entry, 
  60114                                   bcm_if_t if_id)
  60115 {
  60116     return BCM_E_UNAVAIL; 
  60117 }
  60118 
  60119 int 
  60120 bcm_esw_field_qualify_DstMulticastGroup(int unit, 
  60121                                  bcm_field_entry_t entry, 
  60122                                  bcm_gport_t group)
  60123 {
  60124     return BCM_E_UNAVAIL; 
  60125 }
  60126 
  60127 int 
  60128 bcm_esw_field_qualify_DstMultipath(int               unit, 
  60129                                    bcm_field_entry_t entry, 
  60130                                    bcm_if_t          mpintf
  60131                                    )
  60132 {
  60133     return BCM_E_UNAVAIL; 
  60134 }
  60135 
  60136 int 
  60137 bcm_esw_field_qualify_DstMultipath_get(int               unit, 
  60138                                        bcm_field_entry_t entry, 
  60139                                        bcm_if_t          *mpintf
  60140                                        )
  60141 {
  60142     return BCM_E_UNAVAIL; 
  60143 }
  60144 
  60145 int 
  60146 bcm_esw_field_qualify_SrcMplsGport(int unit, 
  60147                                bcm_field_entry_t entry, 
  60148                                bcm_gport_t mpls_port_id)
  60149 {
  60150     return BCM_E_UNAVAIL; 
  60151 }
  60152 
  60153 
  60154 int 
  60155 bcm_esw_field_qualify_DstMplsGport(int unit, 
  60156                                bcm_field_entry_t entry, 
  60157                                bcm_gport_t mpls_port_id)
  60158 {
  60159     return BCM_E_UNAVAIL; 
  60160 }
  60161 
  60162 
  60163 int 
  60164 bcm_esw_field_qualify_SrcNivGport(int unit, 
  60165                                bcm_field_entry_t entry, 
  60166                                bcm_gport_t niv_port_id)
  60167 {
  60168     return BCM_E_UNAVAIL; 
  60169 }
  60170 
  60171 
  60172 int 
  60173 bcm_esw_field_qualify_DstNivGport(int unit, 
  60174                                bcm_field_entry_t entry, 
  60175                                bcm_gport_t niv_port_id)
  60176 {
  60177     return BCM_E_UNAVAIL; 
  60178 }
  60179 
  60180 int 
  60181 bcm_esw_field_qualify_SrcMimGport(int unit, 
  60182                               bcm_field_entry_t entry, 
  60183                               bcm_gport_t mim_port_id)
  60184 {
  60185     return BCM_E_UNAVAIL; 
  60186 }
  60187 
  60188 
  60189 int 
  60190 bcm_esw_field_qualify_DstMimGport(int unit, 
  60191                               bcm_field_entry_t entry, 
  60192                               bcm_gport_t mim_port_id)
  60193 {
  60194     return BCM_E_UNAVAIL; 
  60195 }
  60196 
  60197 
  60198 int 
  60199 bcm_esw_field_qualify_SrcWlanGport(int unit, 
  60200                                bcm_field_entry_t entry, 
  60201                                bcm_gport_t wlan_port_id)
  60202 {
  60203     return BCM_E_UNAVAIL; 
  60204 }
  60205 
  60206 int 
  60207 bcm_esw_field_qualify_DstWlanGport(int unit, 
  60208                                bcm_field_entry_t entry, 
  60209                                bcm_gport_t wlan_port_id)
  60210 {
  60211     return BCM_E_UNAVAIL; 
  60212 }
  60213 
  60214 int
  60215 bcm_esw_field_qualify_SrcVlanGport(int unit,
  60216                                bcm_field_entry_t entry,
  60217                                bcm_gport_t vlan_port_id)
  60218 {
  60219     return BCM_E_UNAVAIL;
  60220 }
  60221 
  60222 int
  60223 bcm_esw_field_qualify_DstVlanGport(int unit,
  60224                                bcm_field_entry_t entry,
  60225                                bcm_gport_t vlan_port_id)
  60226 {
  60227     return BCM_E_UNAVAIL;
  60228 }
  60229  
  60230 int 
  60231 bcm_esw_field_qualify_Loopback(int unit, 
  60232                                bcm_field_entry_t entry, 
  60233                                uint8 data, 
  60234                                uint8 mask)
  60235 {
  60236     return BCM_E_UNAVAIL; 
  60237 }
  60238 
  60239 int 
  60240 bcm_esw_field_qualify_LoopbackType(int unit, 
  60241                                    bcm_field_entry_t entry, 
  60242                                    bcm_field_LoopbackType_t loopback_type)
  60243 {
  60244     return BCM_E_UNAVAIL; 
  60245 }
  60246 
  60247 int 
  60248 bcm_esw_field_qualify_TunnelType(int unit, 
  60249                                  bcm_field_entry_t entry, 
  60250                                  bcm_field_TunnelType_t tunnel_type)
  60251 {
  60252     return BCM_E_UNAVAIL; 
  60253 }
  60254 
  60255 
  60256 /*
  60257  * Function:
  60258  *      bcm_esw_field_qualify_LoopbackType_get
  60259  * Purpose:
  60260  *      Get loopback type field qualification from a field entry.
  60261  * Parameters:
  60262  *      unit - (IN) Unit number.
  60263  *      entry - (IN) Field entry id.
  60264  *      loopback_type - (OUT) Loopback type.
  60265  * Returns:
  60266  *      BCM_E_XXX
  60267  * Notes:
  60268  */
  60269 int 
  60270 bcm_esw_field_qualify_LoopbackType_get(
  60271     int unit, 
  60272     bcm_field_entry_t entry, 
  60273     bcm_field_LoopbackType_t *loopback_type)
  60274 {
  60275     return BCM_E_UNAVAIL; 
  60276 }
  60277 
  60278 /*
  60279  * Function:
  60280  *      bcm_esw_field_qualify_TunnelType_get
  60281  * Purpose:
  60282  *      Get tunnel type field qualification from a field entry.
  60283  * Parameters:
  60284  *      unit - (IN) Unit number.
  60285  *      entry - (IN) Field entry id.
  60286  *      tunnel_type - (OUT) Tunnel type.
  60287  * Returns:
  60288  *      BCM_E_XXX
  60289  * Notes:
  60290  */
  60291 int 
  60292 bcm_esw_field_qualify_TunnelType_get(
  60293     int unit, 
  60294     bcm_field_entry_t entry, 
  60295     bcm_field_TunnelType_t *tunnel_type)
  60296 {
  60297     return BCM_E_UNAVAIL; 
  60298 }
  60299 
  60300 /*
  60301  * Function:
  60302  *      bcm_esw_field_qualify_DstL3Egress_get
  60303  * Purpose:
  60304  *      Get match criteria for bcmFieildQualifyDstL3Egress
  60305  *                     qualifier from the field entry.
  60306  * Parameters:
  60307  *      unit - (IN) Unit number.
  60308  *      entry - (IN) BCM field entry id.
  60309  *      if_id - (OUT) L3 forwarding object.
  60310  * Returns:
  60311  *      BCM_E_XXX
  60312  * Notes:
  60313  */
  60314 int 
  60315 bcm_esw_field_qualify_DstL3Egress_get(
  60316     int unit, 
  60317     bcm_field_entry_t entry, 
  60318     bcm_if_t *if_id)
  60319 {
  60320     return BCM_E_UNAVAIL; 
  60321 }
  60322 
  60323 /*
  60324  * Function:
  60325  *      bcm_esw_field_qualify_DstMulticastGroup_get
  60326  * Purpose:
  60327  *      Get match criteria for bcmFieildQualifyDstMulticastGroup
  60328  *                     qualifier from the field entry.
  60329  * Parameters:
  60330  *      unit - (IN) Unit number.
  60331  *      entry - (IN) BCM field entry id.
  60332  *      group - (OUT) Multicast group id.
  60333  * Returns:
  60334  *      BCM_E_XXX
  60335  * Notes:
  60336  */
  60337 int 
  60338 bcm_esw_field_qualify_DstMulticastGroup_get(
  60339     int unit, 
  60340     bcm_field_entry_t entry, 
  60341     bcm_gport_t *group)
  60342 {
  60343     return BCM_E_UNAVAIL; 
  60344 }
  60345 
  60346 /*
  60347  * Function:
  60348  *      bcm_esw_field_qualify_SrcMplsGport_get
  60349  * Purpose:
  60350  *      Get match criteria for bcmFieildQualifySrcMplsGport
  60351  *                     qualifier from the field entry.
  60352  * Parameters:
  60353  *      unit - (IN) Unit number.
  60354  *      entry - (IN) BCM field entry id.
  60355  *      mpls_port_id - (OUT) Mpls port id.
  60356  * Returns:
  60357  *      BCM_E_XXX
  60358  * Notes:
  60359  */
  60360 int 
  60361 bcm_esw_field_qualify_SrcMplsGport_get(
  60362     int unit, 
  60363     bcm_field_entry_t entry, 
  60364     bcm_gport_t *mpls_port_id)
  60365 {
  60366     return BCM_E_UNAVAIL; 
  60367 }
  60368 
  60369 /*
  60370  * Function:
  60371  *      bcm_esw_field_qualify_DstMplsGport_get
  60372  * Purpose:
  60373  *      Get match criteria for bcmFieildQualifyDstMplsGport
  60374  *                     qualifier from the field entry.
  60375  * Parameters:
  60376  *      unit - (IN) Unit number.
  60377  *      entry - (IN) BCM field entry id.
  60378  *      mpls_port_id - (OUT) Mpls port id.
  60379  * Returns:
  60380  *      BCM_E_XXX
  60381  * Notes:
  60382  */
  60383 int 
  60384 bcm_esw_field_qualify_DstMplsGport_get(
  60385     int unit, 
  60386     bcm_field_entry_t entry, 
  60387     bcm_gport_t *mpls_port_id)
  60388 {
  60389     return BCM_E_UNAVAIL; 
  60390 }
  60391 
  60392 
  60393 
  60394 /*
  60395  * Function:
  60396  *      bcm_esw_field_qualify_SrcNivGport_get
  60397  * Purpose:
  60398  *      Get match criteria for bcmFieildQualifySrcNivGport
  60399  *                     qualifier from the field entry.
  60400  * Parameters:
  60401  *      unit - (IN) Unit number.
  60402  *      entry - (IN) BCM field entry id.
  60403  *      niv_port_id - (OUT) Niv port id.
  60404  * Returns:
  60405  *      BCM_E_XXX
  60406  * Notes:
  60407  */
  60408 int 
  60409 bcm_esw_field_qualify_SrcNivGport_get(
  60410     int unit, 
  60411     bcm_field_entry_t entry, 
  60412     bcm_gport_t *niv_port_id)
  60413 {
  60414     return BCM_E_UNAVAIL; 
  60415 }
  60416 
  60417 /*
  60418  * Function:
  60419  *      bcm_esw_field_qualify_DstNivGport_get
  60420  * Purpose:
  60421  *      Get match criteria for bcmFieildQualifyDstNivGport
  60422  *                     qualifier from the field entry.
  60423  * Parameters:
  60424  *      unit - (IN) Unit number.
  60425  *      entry - (IN) BCM field entry id.
  60426  *      niv_port_id - (OUT) Niv port id.
  60427  * Returns:
  60428  *      BCM_E_XXX
  60429  * Notes:
  60430  */
  60431 int 
  60432 bcm_esw_field_qualify_DstNivGport_get(
  60433     int unit, 
  60434     bcm_field_entry_t entry, 
  60435     bcm_gport_t *niv_port_id)
  60436 {
  60437     return BCM_E_UNAVAIL; 
  60438 }
  60439 
  60440 
  60441 /*
  60442  * Function:
  60443  *      bcm_esw_field_qualify_SrcMimGport_get
  60444  * Purpose:
  60445  *      Get match criteria for bcmFieildQualifySrcMimGport
  60446  *                     qualifier from the field entry.
  60447  * Parameters:
  60448  *      unit - (IN) Unit number.
  60449  *      entry - (IN) BCM field entry id.
  60450  *      mim_port_id - (OUT) Mim port id.
  60451  * Returns:
  60452  *      BCM_E_XXX
  60453  * Notes:
  60454  */
  60455 int 
  60456 bcm_esw_field_qualify_SrcMimGport_get(
  60457     int unit, 
  60458     bcm_field_entry_t entry, 
  60459     bcm_gport_t *mim_port_id)
  60460 {
  60461     return BCM_E_UNAVAIL; 
  60462 }
  60463 
  60464 /*
  60465  * Function:
  60466  *      bcm_esw_field_qualify_DstMimGport_get
  60467  * Purpose:
  60468  *      Get match criteria for bcmFieildQualifyDstMimGport
  60469  *                     qualifier from the field entry.
  60470  * Parameters:
  60471  *      unit - (IN) Unit number.
  60472  *      entry - (IN) BCM field entry id.
  60473  *      mim_port_id - (OUT) Mim port id.
  60474  * Returns:
  60475  *      BCM_E_XXX
  60476  * Notes:
  60477  */
  60478 int 
  60479 bcm_esw_field_qualify_DstMimGport_get(
  60480     int unit, 
  60481     bcm_field_entry_t entry, 
  60482     bcm_gport_t *mim_port_id)
  60483 {
  60484     return BCM_E_UNAVAIL; 
  60485 }
  60486 
  60487 /*
  60488  * Function:
  60489  *      bcm_esw_field_qualify_SrcWlanGport_get
  60490  * Purpose:
  60491  *      Get match criteria for bcmFieildQualifySrcWlanGport
  60492  *                     qualifier from the field entry.
  60493  * Parameters:
  60494  *      unit - (IN) Unit number.
  60495  *      entry - (IN) BCM field entry id.
  60496  *      wlan_port_id - (OUT) Wlan port id.
  60497  * Returns:
  60498  *      BCM_E_XXX
  60499  * Notes:
  60500  */
  60501 int 
  60502 bcm_esw_field_qualify_SrcWlanGport_get(
  60503     int unit, 
  60504     bcm_field_entry_t entry, 
  60505     bcm_gport_t *wlan_port_id)
  60506 {
  60507     return BCM_E_UNAVAIL; 
  60508 }
  60509 
  60510 /*
  60511  * Function:
  60512  *      bcm_esw_field_qualify_DstWlanGport_get
  60513  * Purpose:
  60514  *      Get match criteria for bcmFieildQualifyDstWlanGport
  60515  *                     qualifier from the field entry.
  60516  * Parameters:
  60517  *      unit - (IN) Unit number.
  60518  *      entry - (IN) BCM field entry id.
  60519  *      wlan_port_id - (OUT) Wlan port id.
  60520  * Returns:
  60521  *      BCM_E_XXX
  60522  * Notes:
  60523  */
  60524 int 
  60525 bcm_esw_field_qualify_DstWlanGport_get(
  60526     int unit, 
  60527     bcm_field_entry_t entry, 
  60528     bcm_gport_t *wlan_port_id)
  60529 {
  60530     return BCM_E_UNAVAIL; 
  60531 }
  60532 
  60533 /*
  60534  * Function:
  60535  *      bcm_esw_field_qualify_SrcVlanGport_get
  60536  * Purpose:
  60537  *      Get match criteria for bcmFieildQualifySrcVlanGport
  60538  *                     qualifier from the field entry.
  60539  * Parameters:
  60540  *      unit - (IN) Unit number.
  60541  *      entry - (IN) BCM field entry id.
  60542  *      vlan_port_id - (OUT) Vlan port id.
  60543  * Returns:
  60544  *      BCM_E_XXX
  60545  * Notes:
  60546  */
  60547 int
  60548 bcm_esw_field_qualify_SrcVlanGport_get(
  60549         int unit,
  60550         bcm_field_entry_t entry,
  60551         bcm_gport_t *vlan_port_id)
  60552 {
  60553     return BCM_E_UNAVAIL;
  60554 }
  60555 
  60556 /*
  60557  * Function:
  60558  *      bcm_esw_field_qualify_DstVlanGport_get
  60559  * Purpose:
  60560  *      Get match criteria for bcmFieildQualifyDstVlanGport
  60561  *                     qualifier from the field entry.
  60562  * Parameters:
  60563  *      unit - (IN) Unit number.
  60564  *      entry - (IN) BCM field entry id.
  60565  *      vlan_port_id - (OUT) Vlan port id.
  60566  * Returns:
  60567  *      BCM_E_XXX
  60568  * Notes:
  60569  */
  60570 int
  60571 bcm_esw_field_qualify_DstVlanGport_get(
  60572         int unit,
  60573         bcm_field_entry_t entry,
  60574         bcm_gport_t *vlan_port_id)
  60575 {
  60576     return BCM_E_UNAVAIL;
  60577 }
  60578 
  60579 /*
  60580  * Function:
  60581  *      bcm_esw_field_qualify_Loopback_get
  60582  * Purpose:
  60583  *      Get loopback field qualification from  a field entry.
  60584  * Parameters:
  60585  *      unit - (IN) Unit number.
  60586  *      entry - (IN) Field entry id.
  60587  *      data - (OUT) Data to qualify with.
  60588  *      mask - (OUT) Qualifier match mask.
  60589  * Returns:
  60590  *      BCM_E_XXX
  60591  * Notes:
  60592  */
  60593 int 
  60594 bcm_esw_field_qualify_Loopback_get(
  60595     int unit, 
  60596     bcm_field_entry_t entry, 
  60597     uint8 *data, 
  60598     uint8 *mask)
  60599 {
  60600     return BCM_E_UNAVAIL; 
  60601 }
  60602 
  60603 /*
  60604  * Function:
  60605  *      bcm_esw_field_qualify_InPort_get
  60606  * Purpose:
  60607  *      Get match criteria for bcmFieildQualifyInPort
  60608  *                     qualifier from the field entry.
  60609  * Parameters:
  60610  *      unit - (IN) Unit number.
  60611  *      entry - (IN) BCM field entry id.
  60612  *      data - (OUT) Qualifier match data.
  60613  *      mask - (OUT) Qualifier match mask.
  60614  * Returns:
  60615  *      BCM_E_XXX
  60616  * Notes:
  60617  */
  60618 int 
  60619 bcm_esw_field_qualify_InPort_get(
  60620     int unit, 
  60621     bcm_field_entry_t entry, 
  60622     bcm_port_t *data, 
  60623     bcm_port_t *mask)
  60624 {
  60625     return BCM_E_UNAVAIL; 
  60626 }
  60627 
  60628 /*
  60629  * Function:
  60630  *      bcm_esw_field_qualify_OutPort_get
  60631  * Purpose:
  60632  *      Get match criteria for bcmFieildQualifyOutPort
  60633  *                     qualifier from the field entry.
  60634  * Parameters:
  60635  *      unit - (IN) Unit number.
  60636  *      entry - (IN) BCM field entry id.
  60637  *      data - (OUT) Qualifier match data.
  60638  *      mask - (OUT) Qualifier match mask.
  60639  * Returns:
  60640  *      BCM_E_XXX
  60641  * Notes:
  60642  */
  60643 int 
  60644 bcm_esw_field_qualify_OutPort_get(
  60645     int unit, 
  60646     bcm_field_entry_t entry, 
  60647     bcm_port_t *data, 
  60648     bcm_port_t *mask)
  60649 {
  60650     return BCM_E_UNAVAIL; 
  60651 }
  60652 
  60653 /*
  60654  * Function:
  60655  *      bcm_esw_field_qualify_InPorts_get
  60656  * Purpose:
  60657  *      Get match criteria for bcmFieildQualifyInPorts
  60658  *                     qualifier from the field entry.
  60659  * Parameters:
  60660  *      unit - (IN) Unit number.
  60661  *      entry - (IN) BCM field entry id.
  60662  *      data - (OUT) Qualifier match data.
  60663  *      mask - (OUT) Qualifier match mask.
  60664  * Returns:
  60665  *      BCM_E_XXX
  60666  * Notes:
  60667  */
  60668 int 
  60669 bcm_esw_field_qualify_InPorts_get(
  60670     int unit, 
  60671     bcm_field_entry_t entry, 
  60672     bcm_pbmp_t *data, 
  60673     bcm_pbmp_t *mask)
  60674 {
  60675     return BCM_E_UNAVAIL; 
  60676 }
  60677 
  60678 /*
  60679  * Function:
  60680  *      bcm_esw_field_qualify_OutPorts_get
  60681  * Purpose:
  60682  *      Get match criteria for bcmFieildQualifyOutPorts
  60683  *                     qualifier from the field entry.
  60684  * Parameters:
  60685  *      unit - (IN) Unit number.
  60686  *      entry - (IN) BCM field entry id.
  60687  *      data - (OUT) Qualifier match data.
  60688  *      mask - (OUT) Qualifier match mask.
  60689  * Returns:
  60690  *      BCM_E_XXX
  60691  * Notes:
  60692  */
  60693 int 
  60694 bcm_esw_field_qualify_OutPorts_get(
  60695     int unit, 
  60696     bcm_field_entry_t entry, 
  60697     bcm_pbmp_t *data, 
  60698     bcm_pbmp_t *mask)
  60699 {
  60700     return BCM_E_UNAVAIL; 
  60701 }
  60702 
  60703 /*
  60704  * Function:
  60705  *      bcm_esw_field_qualify_Drop_get
  60706  * Purpose:
  60707  *      Get match criteria for bcmFieildQualifyDrop
  60708  *                     qualifier from the field entry.
  60709  * Parameters:
  60710  *      unit - (IN) Unit number.
  60711  *      entry - (IN) BCM field entry id.
  60712  *      data - (OUT) Qualifier match data.
  60713  *      mask - (OUT) Qualifier match mask.
  60714  * Returns:
  60715  *      BCM_E_XXX
  60716  * Notes:
  60717  */
  60718 int 
  60719 bcm_esw_field_qualify_Drop_get(
  60720     int unit, 
  60721     bcm_field_entry_t entry, 
  60722     uint8 *data, 
  60723     uint8 *mask)
  60724 {
  60725     return BCM_E_UNAVAIL; 
  60726 }
  60727 
  60728 /*
  60729  * Function:
  60730  *      bcm_esw_field_qualify_SrcPort_get
  60731  * Purpose:
  60732  *      Get match criteria for bcmFieildQualifySrcPort
  60733  *                     qualifier from the field entry.
  60734  * Parameters:
  60735  *      unit - (IN) Unit number.
  60736  *      entry - (IN) BCM field entry id.
  60737  *      data_modid - (OUT) Qualifier module id.
  60738  *      mask_modid - (OUT) Qualifier module id mask.
  60739  *      data_port - (OUT) Qualifier port id.
  60740  *      mask_port - (OUT) Qualifier port id mask.
  60741  * Returns:
  60742  *      BCM_E_XXX
  60743  * Notes:
  60744  */
  60745 int 
  60746 bcm_esw_field_qualify_SrcPort_get(
  60747     int unit, 
  60748     bcm_field_entry_t entry, 
  60749     bcm_module_t *data_modid, 
  60750     bcm_module_t *mask_modid, 
  60751     bcm_port_t *data_port, 
  60752     bcm_port_t *mask_port)
  60753 {
  60754     return BCM_E_UNAVAIL; 
  60755 }
  60756 
  60757 /*
  60758  * Function:
  60759  *      bcm_esw_field_qualify_SrcTrunk_get
  60760  * Purpose:
  60761  *      Get match criteria for bcmFieildQualifySrcTrunk
  60762  *                     qualifier from the field entry.
  60763  * Parameters:
  60764  *      unit - (IN) Unit number.
  60765  *      entry - (IN) BCM field entry id.
  60766  *      data - (OUT) Qualifier match data.
  60767  *      mask - (OUT) Qualifier match mask.
  60768  * Returns:
  60769  *      BCM_E_XXX
  60770  * Notes:
  60771  */
  60772 int 
  60773 bcm_esw_field_qualify_SrcTrunk_get(
  60774     int unit, 
  60775     bcm_field_entry_t entry, 
  60776     bcm_trunk_t *data, 
  60777     bcm_trunk_t *mask)
  60778 {
  60779     return BCM_E_UNAVAIL; 
  60780 }
  60781 
  60782 /*
  60783  * Function:
  60784  *      bcm_esw_field_qualify_SrcTrunkMemberGport_get
  60785  * Purpose:
  60786  *      Get match criteria for bcmFieildQualifySrcTrunkMemberGport
  60787  *                     qualifier from the field entry.
  60788  * Parameters:
  60789  *      unit  - (IN) Unit number.
  60790  *      entry - (IN) BCM field entry id.
  60791  *      port  - (OUT) Qualifier match gport.
  60792  * Returns:
  60793  *      BCM_E_XXX
  60794  * Notes:
  60795  */
  60796 int 
  60797 bcm_esw_field_qualify_SrcTrunkMemberGport_get(
  60798     int unit, 
  60799     bcm_field_entry_t entry, 
  60800     bcm_gport_t *port) 
  60801 {
  60802     return (BCM_E_UNAVAIL);
  60803 }
  60804 
  60805 /*
  60806  * Function:
  60807  *      bcm_esw_field_qualify_DstPort_get
  60808  * Purpose:
  60809  *      Get match criteria for bcmFieildQualifyDstPort
  60810  *                     qualifier from the field entry.
  60811  * Parameters:
  60812  *      unit - (IN) Unit number.
  60813  *      entry - (IN) BCM field entry id.
  60814  *      data_modid - (OUT) Qualifier module id.
  60815  *      mask_modid - (OUT) Qualifier module id mask.
  60816  *      data_port - (OUT) Qualifier port id.
  60817  *      mask_port - (OUT) Qualifier port id mask.
  60818  * Returns:
  60819  *      BCM_E_XXX
  60820  * Notes:
  60821  */
  60822 int 
  60823 bcm_esw_field_qualify_DstPort_get(
  60824     int unit, 
  60825     bcm_field_entry_t entry, 
  60826     bcm_module_t *data_modid, 
  60827     bcm_module_t *mask_modid, 
  60828     bcm_port_t *data_port, 
  60829     bcm_port_t *mask_port)
  60830 {
  60831     return BCM_E_UNAVAIL; 
  60832 }
  60833 
  60834 /*
  60835  * Function:
  60836  *      bcm_esw_field_qualify_DstTrunk_get
  60837  * Purpose:
  60838  *      Get match criteria for bcmFieildQualifyDstTrunk
  60839  *                     qualifier from the field entry.
  60840  * Parameters:
  60841  *      unit - (IN) Unit number.
  60842  *      entry - (IN) BCM field entry id.
  60843  *      data - (OUT) Qualifier match data.
  60844  *      mask - (OUT) Qualifier match mask.
  60845  * Returns:
  60846  *      BCM_E_XXX
  60847  * Notes:
  60848  */
  60849 int 
  60850 bcm_esw_field_qualify_DstTrunk_get(
  60851     int unit, 
  60852     bcm_field_entry_t entry, 
  60853     bcm_trunk_t *data, 
  60854     bcm_trunk_t *mask)
  60855 {
  60856     return BCM_E_UNAVAIL; 
  60857 }
  60858 
  60859 /*
  60860  * Function:
  60861  *      bcm_esw_field_qualify_InnerL4SrcPort_get
  60862  * Purpose:
  60863  *      Get match criteria for bcmFieildQualifyInnerL4SrcPort
  60864  *                     qualifier from the field entry.
  60865  * Parameters:
  60866  *      unit - (IN) Unit number.
  60867  *      entry - (IN) BCM field entry id.
  60868  *      data - (OUT) Qualifier match data.
  60869  *      mask - (OUT) Qualifier match mask.
  60870  * Returns:
  60871  *      BCM_E_XXX
  60872  * Notes:
  60873  */
  60874 int 
  60875 bcm_esw_field_qualify_InnerL4SrcPort_get(
  60876     int unit, 
  60877     bcm_field_entry_t entry, 
  60878     bcm_l4_port_t *data, 
  60879     bcm_l4_port_t *mask)
  60880 {
  60881     return BCM_E_UNAVAIL; 
  60882 }
  60883 
  60884 /*
  60885  * Function:
  60886  *      bcm_esw_field_qualify_InnerL4DstPort_get
  60887  * Purpose:
  60888  *      Get match criteria for bcmFieildQualifyInnerL4DstPort
  60889  *                     qualifier from the field entry.
  60890  * Parameters:
  60891  *      unit - (IN) Unit number.
  60892  *      entry - (IN) BCM field entry id.
  60893  *      data - (OUT) Qualifier match data.
  60894  *      mask - (OUT) Qualifier match mask.
  60895  * Returns:
  60896  *      BCM_E_XXX
  60897  * Notes:
  60898  */
  60899 int 
  60900 bcm_esw_field_qualify_InnerL4DstPort_get(
  60901     int unit, 
  60902     bcm_field_entry_t entry, 
  60903     bcm_l4_port_t *data, 
  60904     bcm_l4_port_t *mask)
  60905 {
  60906     return BCM_E_UNAVAIL; 
  60907 }
  60908 
  60909 /*
  60910  * Function:
  60911  *      bcm_esw_field_qualify_L4SrcPort_get
  60912  * Purpose:
  60913  *      Get match criteria for bcmFieildQualifyL4SrcPort
  60914  *                     qualifier from the field entry.
  60915  * Parameters:
  60916  *      unit - (IN) Unit number.
  60917  *      entry - (IN) BCM field entry id.
  60918  *      data - (OUT) Qualifier match data.
  60919  *      mask - (OUT) Qualifier match mask.
  60920  * Returns:
  60921  *      BCM_E_XXX
  60922  * Notes:
  60923  */
  60924 int 
  60925 bcm_esw_field_qualify_L4SrcPort_get(
  60926     int unit, 
  60927     bcm_field_entry_t entry, 
  60928     bcm_l4_port_t *data, 
  60929     bcm_l4_port_t *mask)
  60930 {
  60931     return BCM_E_UNAVAIL; 
  60932 }
  60933 
  60934 /*
  60935  * Function:
  60936  *      bcm_esw_field_qualify_L4DstPort_get
  60937  * Purpose:
  60938  *      Get match criteria for bcmFieildQualifyL4DstPort
  60939  *                     qualifier from the field entry.
  60940  * Parameters:
  60941  *      unit - (IN) Unit number.
  60942  *      entry - (IN) BCM field entry id.
  60943  *      data - (OUT) Qualifier match data.
  60944  *      mask - (OUT) Qualifier match mask.
  60945  * Returns:
  60946  *      BCM_E_XXX
  60947  * Notes:
  60948  */
  60949 int 
  60950 bcm_esw_field_qualify_L4DstPort_get(
  60951     int unit, 
  60952     bcm_field_entry_t entry, 
  60953     bcm_l4_port_t *data, 
  60954     bcm_l4_port_t *mask)
  60955 {
  60956     return BCM_E_UNAVAIL; 
  60957 }
  60958 
  60959 /*
  60960  * Function:
  60961  *      bcm_esw_field_qualify_OuterVlan_get
  60962  * Purpose:
  60963  *      Get match criteria for bcmFieildQualifyOuterVlan
  60964  *                     qualifier from the field entry.
  60965  * Parameters:
  60966  *      unit - (IN) Unit number.
  60967  *      entry - (IN) BCM field entry id.
  60968  *      data - (OUT) Qualifier match data.
  60969  *      mask - (OUT) Qualifier match mask.
  60970  * Returns:
  60971  *      BCM_E_XXX
  60972  * Notes:
  60973  */
  60974 int 
  60975 bcm_esw_field_qualify_OuterVlan_get(
  60976     int unit, 
  60977     bcm_field_entry_t entry, 
  60978     bcm_vlan_t *data, 
  60979     bcm_vlan_t *mask)
  60980 {
  60981     return BCM_E_UNAVAIL; 
  60982 }
  60983 
  60984 /*
  60985  * Function:
  60986  *      bcm_esw_field_qualify_InnerVlan_get
  60987  * Purpose:
  60988  *      Get match criteria for bcmFieildQualifyInnerVlan
  60989  *                     qualifier from the field entry.
  60990  * Parameters:
  60991  *      unit - (IN) Unit number.
  60992  *      entry - (IN) BCM field entry id.
  60993  *      data - (OUT) Qualifier match data.
  60994  *      mask - (OUT) Qualifier match mask.
  60995  * Returns:
  60996  *      BCM_E_XXX
  60997  * Notes:
  60998  */
  60999 int 
  61000 bcm_esw_field_qualify_InnerVlan_get(
  61001     int unit, 
  61002     bcm_field_entry_t entry, 
  61003     bcm_vlan_t *data, 
  61004     bcm_vlan_t *mask)
  61005 {
  61006     return BCM_E_UNAVAIL; 
  61007 }
  61008 
  61009 /*
  61010  * Function:
  61011  *      bcm_esw_field_qualify_EtherType_get
  61012  * Purpose:
  61013  *      Get match criteria for bcmFieildQualifyEtherType
  61014  *                     qualifier from the field entry.
  61015  * Parameters:
  61016  *      unit - (IN) Unit number.
  61017  *      entry - (IN) BCM field entry id.
  61018  *      data - (OUT) Qualifier match data.
  61019  *      mask - (OUT) Qualifier match mask.
  61020  * Returns:
  61021  *      BCM_E_XXX
  61022  * Notes:
  61023  */
  61024 int 
  61025 bcm_esw_field_qualify_EtherType_get(
  61026     int unit, 
  61027     bcm_field_entry_t entry, 
  61028     uint16 *data, 
  61029     uint16 *mask)
  61030 {
  61031     return BCM_E_UNAVAIL; 
  61032 }
  61033 
  61034 /*
  61035  * Function:
  61036  *      bcm_esw_field_qualify_IpProtocol_get
  61037  * Purpose:
  61038  *      Get match criteria for bcmFieildQualifyIpProtocol
  61039  *                     qualifier from the field entry.
  61040  * Parameters:
  61041  *      unit - (IN) Unit number.
  61042  *      entry - (IN) BCM field entry id.
  61043  *      data - (OUT) Qualifier match data.
  61044  *      mask - (OUT) Qualifier match mask.
  61045  * Returns:
  61046  *      BCM_E_XXX
  61047  * Notes:
  61048  */
  61049 int 
  61050 bcm_esw_field_qualify_IpProtocol_get(
  61051     int unit, 
  61052     bcm_field_entry_t entry, 
  61053     uint8 *data, 
  61054     uint8 *mask)
  61055 {
  61056     return BCM_E_UNAVAIL; 
  61057 }
  61058 
  61059 /*
  61060  * Function:
  61061  *      bcm_esw_field_qualify_IpInfo_get
  61062  * Purpose:
  61063  *      Get match criteria for bcmFieildQualifyIpInfo
  61064  *                     qualifier from the field entry.
  61065  * Parameters:
  61066  *      unit - (IN) Unit number.
  61067  *      entry - (IN) BCM field entry id.
  61068  *      data - (OUT) Qualifier match data.
  61069  *      mask - (OUT) Qualifier match mask.
  61070  * Returns:
  61071  *      BCM_E_XXX
  61072  * Notes:
  61073  */
  61074 int 
  61075 bcm_esw_field_qualify_IpInfo_get(
  61076     int unit, 
  61077     bcm_field_entry_t entry, 
  61078     uint32 *data, 
  61079     uint32 *mask)
  61080 {
  61081     return BCM_E_UNAVAIL; 
  61082 }
  61083 
  61084 /*
  61085  * Function:
  61086  *      bcm_esw_field_qualify_PacketRes_get
  61087  * Purpose:
  61088  *      Get match criteria for bcmFieildQualifyPacketRes
  61089  *                     qualifier from the field entry.
  61090  * Parameters:
  61091  *      unit - (IN) Unit number.
  61092  *      entry - (IN) BCM field entry id.
  61093  *      data - (OUT) Qualifier match data.
  61094  *      mask - (OUT) Qualifier match mask.
  61095  * Returns:
  61096  *      BCM_E_XXX
  61097  * Notes:
  61098  */
  61099 int 
  61100 bcm_esw_field_qualify_PacketRes_get(
  61101     int unit, 
  61102     bcm_field_entry_t entry, 
  61103     uint32 *data, 
  61104     uint32 *mask)
  61105 {
  61106     return BCM_E_UNAVAIL; 
  61107 }
  61108 
  61109 /*
  61110  * Function:
  61111  *      bcm_esw_field_qualify_SrcIp_get
  61112  * Purpose:
  61113  *      Get match criteria for bcmFieildQualifySrcIp
  61114  *                     qualifier from the field entry.
  61115  * Parameters:
  61116  *      unit - (IN) Unit number.
  61117  *      entry - (IN) BCM field entry id.
  61118  *      data - (OUT) Qualifier match data.
  61119  *      mask - (OUT) Qualifier match mask.
  61120  * Returns:
  61121  *      BCM_E_XXX
  61122  * Notes:
  61123  */
  61124 int 
  61125 bcm_esw_field_qualify_SrcIp_get(
  61126     int unit, 
  61127     bcm_field_entry_t entry, 
  61128     bcm_ip_t *data, 
  61129     bcm_ip_t *mask)
  61130 {
  61131     return BCM_E_UNAVAIL; 
  61132 }
  61133 
  61134 /*
  61135  * Function:
  61136  *      bcm_esw_field_qualify_DstIp_get
  61137  * Purpose:
  61138  *      Get match criteria for bcmFieildQualifyDstIp
  61139  *                     qualifier from the field entry.
  61140  * Parameters:
  61141  *      unit - (IN) Unit number.
  61142  *      entry - (IN) BCM field entry id.
  61143  *      data - (OUT) Qualifier match data.
  61144  *      mask - (OUT) Qualifier match mask.
  61145  * Returns:
  61146  *      BCM_E_XXX
  61147  * Notes:
  61148  */
  61149 int 
  61150 bcm_esw_field_qualify_DstIp_get(
  61151     int unit, 
  61152     bcm_field_entry_t entry, 
  61153     bcm_ip_t *data, 
  61154     bcm_ip_t *mask)
  61155 {
  61156     return BCM_E_UNAVAIL; 
  61157 }
  61158 
  61159 /*
  61160  * Function:
  61161  *      bcm_esw_field_qualify_Tos_get
  61162  * Purpose:
  61163  *      Get match criteria for bcmFieildQualifyTos
  61164  *                     qualifier from the field entry.
  61165  * Parameters:
  61166  *      unit - (IN) Unit number.
  61167  *      entry - (IN) BCM field entry id.
  61168  *      data - (OUT) Qualifier match data.
  61169  *      mask - (OUT) Qualifier match mask.
  61170  * Returns:
  61171  *      BCM_E_XXX
  61172  * Notes:
  61173  */
  61174 int 
  61175 bcm_esw_field_qualify_Tos_get(
  61176     int unit, 
  61177     bcm_field_entry_t entry, 
  61178     uint8 *data, 
  61179     uint8 *mask)
  61180 {
  61181     return BCM_E_UNAVAIL; 
  61182 }
  61183 
  61184 /*
  61185  * Function:
  61186  *      bcm_esw_field_qualify_DSCP_get
  61187  * Purpose:
  61188  *      Get match criteria for bcmFieildQualifyDSCP
  61189  *                     qualifier from the field entry.
  61190  * Parameters:
  61191  *      unit - (IN) Unit number.
  61192  *      entry - (IN) BCM field entry id.
  61193  *      data - (OUT) Qualifier match data.
  61194  *      mask - (OUT) Qualifier match mask.
  61195  * Returns:
  61196  *      BCM_E_XXX
  61197  * Notes:
  61198  */
  61199 int 
  61200 bcm_esw_field_qualify_DSCP_get(
  61201     int unit, 
  61202     bcm_field_entry_t entry, 
  61203     uint8 *data, 
  61204     uint8 *mask)
  61205 {
  61206     return BCM_E_UNAVAIL; 
  61207 }
  61208 
  61209 /*
  61210  * Function:
  61211  *      bcm_esw_field_qualify_IpFlags_get
  61212  * Purpose:
  61213  *      Get match criteria for bcmFieildQualifyIpFlags
  61214  *                     qualifier from the field entry.
  61215  * Parameters:
  61216  *      unit - (IN) Unit number.
  61217  *      entry - (IN) BCM field entry id.
  61218  *      data - (OUT) Qualifier match data.
  61219  *      mask - (OUT) Qualifier match mask.
  61220  * Returns:
  61221  *      BCM_E_XXX
  61222  * Notes:
  61223  */
  61224 int 
  61225 bcm_esw_field_qualify_IpFlags_get(
  61226     int unit, 
  61227     bcm_field_entry_t entry, 
  61228     uint8 *data, 
  61229     uint8 *mask)
  61230 {
  61231     return BCM_E_UNAVAIL; 
  61232 }
  61233 
  61234 /*
  61235  * Function:
  61236  *      bcm_esw_field_qualify_TcpControl_get
  61237  * Purpose:
  61238  *      Get match criteria for bcmFieildQualifyTcpControl
  61239  *                     qualifier from the field entry.
  61240  * Parameters:
  61241  *      unit - (IN) Unit number.
  61242  *      entry - (IN) BCM field entry id.
  61243  *      data - (OUT) Qualifier match data.
  61244  *      mask - (OUT) Qualifier match mask.
  61245  * Returns:
  61246  *      BCM_E_XXX
  61247  * Notes:
  61248  */
  61249 int 
  61250 bcm_esw_field_qualify_TcpControl_get(
  61251     int unit, 
  61252     bcm_field_entry_t entry, 
  61253     uint8 *data, 
  61254     uint8 *mask)
  61255 {
  61256     return BCM_E_UNAVAIL; 
  61257 }
  61258 
  61259 /*
  61260  * Function:
  61261  *      bcm_esw_field_qualify_TcpSequenceZero_get
  61262  * Purpose:
  61263  *      Get match criteria for bcmFieildQualifyTcpSequenceZero
  61264  *                     qualifier from the field entry.
  61265  * Parameters:
  61266  *      unit - (IN) Unit number.
  61267  *      entry - (IN) BCM field entry id.
  61268  *      flag - (OUT) Qualifier match flags.
  61269  * Returns:
  61270  *      BCM_E_XXX
  61271  * Notes:
  61272  */
  61273 int 
  61274 bcm_esw_field_qualify_TcpSequenceZero_get(
  61275     int unit, 
  61276     bcm_field_entry_t entry, 
  61277     uint32 *flag)
  61278 {
  61279     return BCM_E_UNAVAIL; 
  61280 }
  61281 
  61282 /*
  61283  * Function:
  61284  *      bcm_esw_field_qualify_TcpHeaderSize_get
  61285  * Purpose:
  61286  *      Get match criteria for bcmFieildQualifyTcpHeaderSize
  61287  *                     qualifier from the field entry.
  61288  * Parameters:
  61289  *      unit - (IN) Unit number.
  61290  *      entry - (IN) BCM field entry id.
  61291  *      data - (OUT) Qualifier match data.
  61292  *      mask - (OUT) Qualifier match mask.
  61293  * Returns:
  61294  *      BCM_E_XXX
  61295  * Notes:
  61296  */
  61297 int 
  61298 bcm_esw_field_qualify_TcpHeaderSize_get(
  61299     int unit, 
  61300     bcm_field_entry_t entry, 
  61301     uint8 *data, 
  61302     uint8 *mask)
  61303 {
  61304     return BCM_E_UNAVAIL; 
  61305 }
  61306 
  61307 /*
  61308  * Function:
  61309  *      bcm_esw_field_qualify_Ttl_get
  61310  * Purpose:
  61311  *      Get match criteria for bcmFieildQualifyTtl
  61312  *                     qualifier from the field entry.
  61313  * Parameters:
  61314  *      unit - (IN) Unit number.
  61315  *      entry - (IN) BCM field entry id.
  61316  *      data - (OUT) Qualifier match data.
  61317  *      mask - (OUT) Qualifier match mask.
  61318  * Returns:
  61319  *      BCM_E_XXX
  61320  * Notes:
  61321  */
  61322 int 
  61323 bcm_esw_field_qualify_Ttl_get(
  61324     int unit, 
  61325     bcm_field_entry_t entry, 
  61326     uint8 *data, 
  61327     uint8 *mask)
  61328 {
  61329     return BCM_E_UNAVAIL; 
  61330 }
  61331 
  61332 /*
  61333  * Function:
  61334  *      bcm_esw_field_qualify_RangeCheck_get
  61335  * Purpose:
  61336  *      Get match criteria for bcmFieildQualifyRangeCheck
  61337  *                     qualifier from the field entry.
  61338  * Parameters:
  61339  *      unit - (IN) Unit number.
  61340  *      entry - (IN) BCM field entry id.
  61341  *      max_count - (IN) Max entries to fill.
  61342  *      range - (OUT) Range checkers array.
  61343  *      invert - (OUT) Range checkers invert array.
  61344  *      count - (OUT) Number of filled range checkers.
  61345  * Returns:
  61346  *      BCM_E_XXX
  61347  * Notes:
  61348  */
  61349 int 
  61350 bcm_esw_field_qualify_RangeCheck_get(
  61351     int unit, 
  61352     bcm_field_entry_t entry, 
  61353     int max_count, 
  61354     bcm_field_range_t *range, 
  61355     int *invert, 
  61356     int *count)
  61357 {
  61358     return BCM_E_UNAVAIL; 
  61359 }
  61360 
  61361 /*
  61362  * Function:
  61363  *      bcm_esw_field_qualify_SrcIp6_get
  61364  * Purpose:
  61365  *      Get match criteria for bcmFieildQualifySrcIp6
  61366  *                     qualifier from the field entry.
  61367  * Parameters:
  61368  *      unit - (IN) Unit number.
  61369  *      entry - (IN) BCM field entry id.
  61370  *      data - (OUT) Qualifier match data.
  61371  *      mask - (OUT) Qualifier match mask.
  61372  * Returns:
  61373  *      BCM_E_XXX
  61374  * Notes:
  61375  */
  61376 int 
  61377 bcm_esw_field_qualify_SrcIp6_get(
  61378     int unit, 
  61379     bcm_field_entry_t entry, 
  61380     bcm_ip6_t *data, 
  61381     bcm_ip6_t *mask)
  61382 {
  61383     return BCM_E_UNAVAIL; 
  61384 }
  61385 
  61386 /*
  61387  * Function:
  61388  *      bcm_esw_field_qualify_DstIp6_get
  61389  * Purpose:
  61390  *      Get match criteria for bcmFieildQualifyDstIp6
  61391  *                     qualifier from the field entry.
  61392  * Parameters:
  61393  *      unit - (IN) Unit number.
  61394  *      entry - (IN) BCM field entry id.
  61395  *      data - (OUT) Qualifier match data.
  61396  *      mask - (OUT) Qualifier match mask.
  61397  * Returns:
  61398  *      BCM_E_XXX
  61399  * Notes:
  61400  */
  61401 int 
  61402 bcm_esw_field_qualify_DstIp6_get(
  61403     int unit, 
  61404     bcm_field_entry_t entry, 
  61405     bcm_ip6_t *data, 
  61406     bcm_ip6_t *mask)
  61407 {
  61408     return BCM_E_UNAVAIL; 
  61409 }
  61410 
  61411 /*
  61412  * Function:
  61413  *      bcm_esw_field_qualify_SrcIp6High_get
  61414  * Purpose:
  61415  *      Get match criteria for bcmFieildQualifySrcIp6High
  61416  *                     qualifier from the field entry.
  61417  * Parameters:
  61418  *      unit - (IN) Unit number.
  61419  *      entry - (IN) BCM field entry id.
  61420  *      data - (OUT) Qualifier match data.
  61421  *      mask - (OUT) Qualifier match mask.
  61422  * Returns:
  61423  *      BCM_E_XXX
  61424  * Notes:
  61425  */
  61426 int 
  61427 bcm_esw_field_qualify_SrcIp6High_get(
  61428     int unit, 
  61429     bcm_field_entry_t entry, 
  61430     bcm_ip6_t *data, 
  61431     bcm_ip6_t *mask)
  61432 {
  61433     return BCM_E_UNAVAIL; 
  61434 }
  61435 
  61436 /*
  61437  * Function:
  61438  *      bcm_esw_field_qualify_SrcIp6Low_get
  61439  * Purpose:
  61440  *      Get match criteria for bcmFieildQualifySrcIp6Low
  61441  *                     qualifier from the field entry.
  61442  * Parameters:
  61443  *      unit - (IN) Unit number.
  61444  *      entry - (IN) BCM field entry id.
  61445  *      data - (OUT) Qualifier match data.
  61446  *      mask - (OUT) Qualifier match mask.
  61447  * Returns:
  61448  *      BCM_E_XXX
  61449  * Notes:
  61450  */
  61451 int 
  61452 bcm_esw_field_qualify_SrcIp6Low_get(
  61453     int unit, 
  61454     bcm_field_entry_t entry, 
  61455     bcm_ip6_t *data, 
  61456     bcm_ip6_t *mask)
  61457 {
  61458     return BCM_E_UNAVAIL; 
  61459 }
  61460 
  61461 /*
  61462  * Function:
  61463  *      bcm_esw_field_qualify_DstIp6Low_get
  61464  * Purpose:
  61465  *      Get match criteria for bcmFieildQualifyDstIp6Low
  61466  *                     qualifier from the field entry.
  61467  * Parameters:
  61468  *      unit - (IN) Unit number.
  61469  *      entry - (IN) BCM field entry id.
  61470  *      data - (OUT) Qualifier match data.
  61471  *      mask - (OUT) Qualifier match mask.
  61472  * Returns:
  61473  *      BCM_E_XXX
  61474  * Notes:
  61475  */
  61476 int 
  61477 bcm_esw_field_qualify_DstIp6Low_get(
  61478     int unit, 
  61479     bcm_field_entry_t entry, 
  61480     bcm_ip6_t *data, 
  61481     bcm_ip6_t *mask)
  61482 {
  61483     return BCM_E_UNAVAIL; 
  61484 }
  61485 
  61486 /*
  61487  * Function:
  61488  *      bcm_esw_field_qualify_DstIp6High_get
  61489  * Purpose:
  61490  *      Get match criteria for bcmFieildQualifyDstIp6High
  61491  *                     qualifier from the field entry.
  61492  * Parameters:
  61493  *      unit - (IN) Unit number.
  61494  *      entry - (IN) BCM field entry id.
  61495  *      data - (OUT) Qualifier match data.
  61496  *      mask - (OUT) Qualifier match mask.
  61497  * Returns:
  61498  *      BCM_E_XXX
  61499  * Notes:
  61500  */
  61501 int 
  61502 bcm_esw_field_qualify_DstIp6High_get(
  61503     int unit, 
  61504     bcm_field_entry_t entry, 
  61505     bcm_ip6_t *data, 
  61506     bcm_ip6_t *mask)
  61507 {
  61508     return BCM_E_UNAVAIL; 
  61509 }
  61510 
  61511 /*
  61512  * Function:
  61513  *      bcm_esw_field_qualify_Ip6NextHeader_get
  61514  * Purpose:
  61515  *      Get match criteria for bcmFieildQualifyIp6NextHeader
  61516  *                     qualifier from the field entry.
  61517  * Parameters:
  61518  *      unit - (IN) Unit number.
  61519  *      entry - (IN) BCM field entry id.
  61520  *      data - (OUT) Qualifier match data.
  61521  *      mask - (OUT) Qualifier match mask.
  61522  * Returns:
  61523  *      BCM_E_XXX
  61524  * Notes:
  61525  */
  61526 int 
  61527 bcm_esw_field_qualify_Ip6NextHeader_get(
  61528     int unit, 
  61529     bcm_field_entry_t entry, 
  61530     uint8 *data, 
  61531     uint8 *mask)
  61532 {
  61533     return BCM_E_UNAVAIL; 
  61534 }
  61535 
  61536 /*
  61537  * Function:
  61538  *      bcm_esw_field_qualify_Ip6TrafficClass_get
  61539  * Purpose:
  61540  *      Get match criteria for bcmFieildQualifyIp6TrafficClass
  61541  *                     qualifier from the field entry.
  61542  * Parameters:
  61543  *      unit - (IN) Unit number.
  61544  *      entry - (IN) BCM field entry id.
  61545  *      data - (OUT) Qualifier match data.
  61546  *      mask - (OUT) Qualifier match mask.
  61547  * Returns:
  61548  *      BCM_E_XXX
  61549  * Notes:
  61550  */
  61551 int 
  61552 bcm_esw_field_qualify_Ip6TrafficClass_get(
  61553     int unit, 
  61554     bcm_field_entry_t entry, 
  61555     uint8 *data, 
  61556     uint8 *mask)
  61557 {
  61558     return BCM_E_UNAVAIL; 
  61559 }
  61560 
  61561 /*
  61562  * Function:
  61563  *      bcm_esw_field_qualify_InnerIp6FlowLabel_get
  61564  * Purpose:
  61565  *      Get match criteria for bcmFieildQualifyInnerIp6FlowLabel
  61566  *                     qualifier from the field entry.
  61567  * Parameters:
  61568  *      unit - (IN) Unit number.
  61569  *      entry - (IN) BCM field entry id.
  61570  *      data - (OUT) Qualifier match data.
  61571  *      mask - (OUT) Qualifier match mask.
  61572  * Returns:
  61573  *      BCM_E_XXX
  61574  * Notes:
  61575  */
  61576 int 
  61577 bcm_esw_field_qualify_InnerIp6FlowLabel_get(
  61578     int unit, 
  61579     bcm_field_entry_t entry, 
  61580     uint32 *data, 
  61581     uint32 *mask)
  61582 {
  61583     return BCM_E_UNAVAIL; 
  61584 }
  61585 
  61586 /*
  61587  * Function:
  61588  *      bcm_esw_field_qualify_Ip6FlowLabel_get
  61589  * Purpose:
  61590  *      Get match criteria for bcmFieildQualifyIp6FlowLabel
  61591  *                     qualifier from the field entry.
  61592  * Parameters:
  61593  *      unit - (IN) Unit number.
  61594  *      entry - (IN) BCM field entry id.
  61595  *      data - (OUT) Qualifier match data.
  61596  *      mask - (OUT) Qualifier match mask.
  61597  * Returns:
  61598  *      BCM_E_XXX
  61599  * Notes:
  61600  */
  61601 int 
  61602 bcm_esw_field_qualify_Ip6FlowLabel_get(
  61603     int unit, 
  61604     bcm_field_entry_t entry, 
  61605     uint32 *data, 
  61606     uint32 *mask)
  61607 {
  61608     return BCM_E_UNAVAIL; 
  61609 }
  61610 
  61611 /*
  61612  * Function:
  61613  *      bcm_esw_field_qualify_Ip6HopLimit_get
  61614  * Purpose:
  61615  *      Get match criteria for bcmFieildQualifyIp6HopLimit
  61616  *                     qualifier from the field entry.
  61617  * Parameters:
  61618  *      unit - (IN) Unit number.
  61619  *      entry - (IN) BCM field entry id.
  61620  *      data - (OUT) Qualifier match data.
  61621  *      mask - (OUT) Qualifier match mask.
  61622  * Returns:
  61623  *      BCM_E_XXX
  61624  * Notes:
  61625  */
  61626 int 
  61627 bcm_esw_field_qualify_Ip6HopLimit_get(
  61628     int unit, 
  61629     bcm_field_entry_t entry, 
  61630     uint8 *data, 
  61631     uint8 *mask)
  61632 {
  61633     return BCM_E_UNAVAIL; 
  61634 }
  61635 
  61636 /*
  61637  * Function:
  61638  *      bcm_esw_field_qualify_SrcMac_get
  61639  * Purpose:
  61640  *      Get match criteria for bcmFieildQualifySrcMac
  61641  *                     qualifier from the field entry.
  61642  * Parameters:
  61643  *      unit - (IN) Unit number.
  61644  *      entry - (IN) BCM field entry id.
  61645  *      data - (OUT) Qualifier match data.
  61646  *      mask - (OUT) Qualifier match mask.
  61647  * Returns:
  61648  *      BCM_E_XXX
  61649  * Notes:
  61650  */
  61651 int 
  61652 bcm_esw_field_qualify_SrcMac_get(
  61653     int unit, 
  61654     bcm_field_entry_t entry, 
  61655     bcm_mac_t *data, 
  61656     bcm_mac_t *mask)
  61657 {
  61658     return BCM_E_UNAVAIL; 
  61659 }
  61660 
  61661 /*
  61662  * Function:
  61663  *      bcm_esw_field_qualify_DstMac_get
  61664  * Purpose:
  61665  *      Get match criteria for bcmFieildQualifyDstMac
  61666  *                     qualifier from the field entry.
  61667  * Parameters:
  61668  *      unit - (IN) Unit number.
  61669  *      entry - (IN) BCM field entry id.
  61670  *      data - (OUT) Qualifier match data.
  61671  *      mask - (OUT) Qualifier match mask.
  61672  * Returns:
  61673  *      BCM_E_XXX
  61674  * Notes:
  61675  */
  61676 int 
  61677 bcm_esw_field_qualify_DstMac_get(
  61678     int unit, 
  61679     bcm_field_entry_t entry, 
  61680     bcm_mac_t *data, 
  61681     bcm_mac_t *mask)
  61682 {
  61683     return BCM_E_UNAVAIL; 
  61684 }
  61685 
  61686 /*
  61687  * Function:
  61688  *      bcm_esw_field_qualify_InnerIpType_get
  61689  * Purpose:
  61690  *      Get match criteria for bcmFieildQualifyInnerIpType
  61691  *                     qualifier from the field entry.
  61692  * Parameters:
  61693  *      unit - (IN) Unit number.
  61694  *      entry - (IN) BCM field entry id.
  61695  *      type - (OUT) Inner ip header ip type.
  61696  * Returns:
  61697  *      BCM_E_XXX
  61698  * Notes:
  61699  */
  61700 int 
  61701 bcm_esw_field_qualify_InnerIpType_get(
  61702     int unit, 
  61703     bcm_field_entry_t entry, 
  61704     bcm_field_IpType_t *type)
  61705 {
  61706     return BCM_E_UNAVAIL; 
  61707 }
  61708 
  61709 /*
  61710  * Function:
  61711  *      bcm_esw_field_qualify_ForwardingType_get
  61712  * Purpose:
  61713  *      Get match criteria for bcmFieildQualifyForwardingType
  61714  *                     qualifier from the field entry.
  61715  * Parameters:
  61716  *      unit - (IN) Unit number.
  61717  *      entry - (IN) BCM field entry id.
  61718  *      type - (OUT) Qualifier match forwarding type.
  61719  * Returns:
  61720  *      BCM_E_XXX
  61721  * Notes:
  61722  */
  61723 int 
  61724 bcm_esw_field_qualify_ForwardingType_get(
  61725     int unit, 
  61726     bcm_field_entry_t entry, 
  61727     bcm_field_ForwardingType_t *type)
  61728 {
  61729     return BCM_E_UNAVAIL; 
  61730 }
  61731 
  61732 /*
  61733  * Function:
  61734  *      bcm_esw_field_qualify_IpType_get
  61735  * Purpose:
  61736  *      Get match criteria for bcmFieildQualifyIpType
  61737  *                     qualifier from the field entry.
  61738  * Parameters:
  61739  *      unit - (IN) Unit number.
  61740  *      entry - (IN) BCM field entry id.
  61741  *      type - (OUT) Qualifier match ip type.
  61742  * Returns:
  61743  *      BCM_E_XXX
  61744  * Notes:
  61745  */
  61746 int 
  61747 bcm_esw_field_qualify_IpType_get(
  61748     int unit, 
  61749     bcm_field_entry_t entry, 
  61750     bcm_field_IpType_t *type)
  61751 {
  61752     return BCM_E_UNAVAIL; 
  61753 }
  61754 
  61755 /*
  61756  * Function:
  61757  *      bcm_esw_field_qualify_L2Format_get
  61758  * Purpose:
  61759  *      Get match criteria for bcmFieildQualifyL2Format
  61760  *                     qualifier from the field entry.
  61761  * Parameters:
  61762  *      unit - (IN) Unit number.
  61763  *      entry - (IN) BCM field entry id.
  61764  *      type - (OUT) Qualifier match l2 format.
  61765  * Returns:
  61766  *      BCM_E_XXX
  61767  * Notes:
  61768  */
  61769 int 
  61770 bcm_esw_field_qualify_L2Format_get(
  61771     int unit, 
  61772     bcm_field_entry_t entry, 
  61773     bcm_field_L2Format_t *type)
  61774 {
  61775     return BCM_E_UNAVAIL; 
  61776 }
  61777 
  61778 /*
  61779  * Function:
  61780  *      bcm_esw_field_qualify_VlanFormat_get
  61781  * Purpose:
  61782  *      Get match criteria for bcmFieildQualifyVlanFormat
  61783  *                     qualifier from the field entry.
  61784  * Parameters:
  61785  *      unit - (IN) Unit number.
  61786  *      entry - (IN) BCM field entry id.
  61787  *      data - (OUT) Qualifier match data.
  61788  *      mask - (OUT) Qualifier match mask.
  61789  * Returns:
  61790  *      BCM_E_XXX
  61791  * Notes:
  61792  */
  61793 int 
  61794 bcm_esw_field_qualify_VlanFormat_get(
  61795     int unit, 
  61796     bcm_field_entry_t entry, 
  61797     uint8 *data, 
  61798     uint8 *mask)
  61799 {
  61800     return BCM_E_UNAVAIL; 
  61801 }
  61802 
  61803 /*
  61804  * Function:
  61805  *      bcm_esw_field_qualify_MHOpcode_get
  61806  * Purpose:
  61807  *      Get match criteria for bcmFieildQualifyMHOpcode
  61808  *                     qualifier from the field entry.
  61809  * Parameters:
  61810  *      unit - (IN) Unit number.
  61811  *      entry - (IN) BCM field entry id.
  61812  *      data - (OUT) Qualifier match data.
  61813  *      mask - (OUT) Qualifier match mask.
  61814  * Returns:
  61815  *      BCM_E_XXX
  61816  * Notes:
  61817  */
  61818 int 
  61819 bcm_esw_field_qualify_MHOpcode_get(
  61820     int unit, 
  61821     bcm_field_entry_t entry, 
  61822     uint8 *data, 
  61823     uint8 *mask)
  61824 {
  61825     return BCM_E_UNAVAIL; 
  61826 }
  61827 
  61828 /*
  61829  * Function:
  61830  *     bcm_esw_field_qualify_Decap_get
  61831  * Purpose:
  61832  *     Get match criteria for bcmFieildQualifyDecap
  61833  *     qualifier from the field entry.
  61834  * Parameters:
  61835  *     unit  - (IN) Unit number.
  61836  *     entry - (IN) BCM field entry id.
  61837  *     decap - (OUT) Qualifier decap type.
  61838  * Returns:
  61839  *     BCM_E_XXX
  61840  * Notes:
  61841  */
  61842 int
  61843 bcm_esw_field_qualify_Decap_get(int unit, bcm_field_entry_t entry,
  61844                                 bcm_field_decap_t *decap)
  61845 {
  61846     return BCM_E_UNAVAIL;
  61847 }
  61848 
  61849 /*
  61850  * Function:
  61851  *      bcm_esw_field_qualify_HiGig_get
  61852  * Purpose:
  61853  *      Qualify on HiGig packets.
  61854  * Parameters:
  61855  *      unit - (IN) Unit number.
  61856  *      entry - (IN) BCM field entry id.
  61857  *      data - (OUT) Qualifier match data.
  61858  *      mask - (OUT) Qualifier match mask.
  61859  * Returns:
  61860  *      BCM_E_XXX
  61861  * Notes:
  61862  */
  61863 int 
  61864 bcm_esw_field_qualify_HiGig_get(
  61865     int unit, 
  61866     bcm_field_entry_t entry, 
  61867     uint8 *data, 
  61868     uint8 *mask)
  61869 {
  61870     return BCM_E_UNAVAIL; 
  61871 }
  61872 
  61873 /*
  61874  * Function:
  61875  *      bcm_esw_field_qualify_HiGigProxy_get
  61876  * Purpose:
  61877  *      Qualify on HiGig lookedup packets.
  61878  * Parameters:
  61879  *      unit - (IN) Unit number.
  61880  *      entry - (IN) BCM field entry id.
  61881  *      data - (OUT) Qualifier match data.
  61882  *      mask - (OUT) Qualifier match mask.
  61883  * Returns:
  61884  *      BCM_E_XXX
  61885  * Notes:
  61886  */
  61887 int
  61888 bcm_esw_field_qualify_HiGigProxy_get(
  61889     int unit,
  61890     bcm_field_entry_t entry,
  61891     uint8 *data,
  61892     uint8 *mask)
  61893 {
  61894     return BCM_E_UNAVAIL;
  61895 }
  61896 
  61897 /*
  61898  * Function:
  61899  *      bcm_esw_field_qualify_InterfaceClassPort_get
  61900  * Purpose:
  61901  *      Get match criteria for bcmFieildQualifyInterfaceClassPort
  61902  *                     qualifier from the field entry.
  61903  * Parameters:
  61904  *      unit - (IN) Unit number.
  61905  *      entry - (IN) BCM field entry id.
  61906  *      data - (OUT) Qualifier match data.
  61907  *      mask - (OUT) Qualifier match mask.
  61908  * Returns:
  61909  *      BCM_E_XXX
  61910  * Notes:
  61911  */
  61912 int 
  61913 bcm_esw_field_qualify_InterfaceClassPort_get(
  61914     int unit, 
  61915     bcm_field_entry_t entry, 
  61916     uint32 *data, 
  61917     uint32 *mask)
  61918 {
  61919     return BCM_E_UNAVAIL; 
  61920 }
  61921 
  61922 /*
  61923  * Function:
  61924  *      bcm_esw_field_qualify_InterfaceClassVPort_get
  61925  * Purpose:
  61926  *      Get match criteria for bcmFieildQualifyInterfaceClassVPort
  61927  *                     qualifier from the field entry.
  61928  * Parameters:
  61929  *      unit - (IN) Unit number.
  61930  *      entry - (IN) BCM field entry id.
  61931  *      data - (OUT) Qualifier match data.
  61932  *      mask - (OUT) Qualifier match mask.
  61933  * Returns:
  61934  *      BCM_E_XXX
  61935  * Notes:
  61936  */
  61937 int
  61938 bcm_esw_field_qualify_InterfaceClassVPort_get(
  61939     int unit,
  61940     bcm_field_entry_t entry,
  61941     uint32 *data,
  61942     uint32 *mask)
  61943 {
  61944     return BCM_E_UNAVAIL;
  61945 }
  61946 
  61947 /*
  61948  * Function:
  61949  *      bcm_esw_field_qualify_InterfaceClassL2_get
  61950  * Purpose:
  61951  *      Get match criteria for bcmFieildQualifyInterfaceClassL2
  61952  *                     qualifier from the field entry.
  61953  * Parameters:
  61954  *      unit - (IN) Unit number.
  61955  *      entry - (IN) BCM field entry id.
  61956  *      data - (OUT) Qualifier match data.
  61957  *      mask - (OUT) Qualifier match mask.
  61958  * Returns:
  61959  *      BCM_E_XXX
  61960  * Notes:
  61961  */
  61962 int 
  61963 bcm_esw_field_qualify_InterfaceClassL2_get(
  61964     int unit, 
  61965     bcm_field_entry_t entry, 
  61966     uint32 *data, 
  61967     uint32 *mask)
  61968 {
  61969     return BCM_E_UNAVAIL; 
  61970 }
  61971 
  61972 /*
  61973  * Function:
  61974  *      bcm_esw_field_qualify_InterfaceClassL3_get
  61975  * Purpose:
  61976  *      Get match criteria for bcmFieildQualifyInterfaceClassL3
  61977  *                     qualifier from the field entry.
  61978  * Parameters:
  61979  *      unit - (IN) Unit number.
  61980  *      entry - (IN) BCM field entry id.
  61981  *      data - (OUT) Qualifier match data.
  61982  *      mask - (OUT) Qualifier match mask.
  61983  * Returns:
  61984  *      BCM_E_XXX
  61985  * Notes:
  61986  */
  61987 int 
  61988 bcm_esw_field_qualify_InterfaceClassL3_get(
  61989     int unit, 
  61990     bcm_field_entry_t entry, 
  61991     uint32 *data, 
  61992     uint32 *mask)
  61993 {
  61994     return BCM_E_UNAVAIL; 
  61995 }
  61996 
  61997 /*
  61998  * Function:
  61999  *      bcm_esw_field_qualify_SrcClassL2_get
  62000  * Purpose:
  62001  *      Get match criteria for bcmFieildQualifySrcClassL2
  62002  *                     qualifier from the field entry.
  62003  * Parameters:
  62004  *      unit - (IN) Unit number.
  62005  *      entry - (IN) BCM field entry id.
  62006  *      data - (OUT) Qualifier match data.
  62007  *      mask - (OUT) Qualifier match mask.
  62008  * Returns:
  62009  *      BCM_E_XXX
  62010  * Notes:
  62011  */
  62012 int 
  62013 bcm_esw_field_qualify_SrcClassL2_get(
  62014     int unit, 
  62015     bcm_field_entry_t entry, 
  62016     uint32 *data, 
  62017     uint32 *mask)
  62018 {
  62019     return BCM_E_UNAVAIL; 
  62020 }
  62021 
  62022 /*
  62023  * Function:
  62024  *      bcm_esw_field_qualify_SrcClassL3_get
  62025  * Purpose:
  62026  *      Get match criteria for bcmFieildQualifySrcClassL3
  62027  *                     qualifier from the field entry.
  62028  * Parameters:
  62029  *      unit - (IN) Unit number.
  62030  *      entry - (IN) BCM field entry id.
  62031  *      data - (OUT) Qualifier match data.
  62032  *      mask - (OUT) Qualifier match mask.
  62033  * Returns:
  62034  *      BCM_E_XXX
  62035  * Notes:
  62036  */
  62037 int 
  62038 bcm_esw_field_qualify_SrcClassL3_get(
  62039     int unit, 
  62040     bcm_field_entry_t entry, 
  62041     uint32 *data, 
  62042     uint32 *mask)
  62043 {
  62044     return BCM_E_UNAVAIL; 
  62045 }
  62046 
  62047 /*
  62048  * Function:
  62049  *      bcm_esw_field_qualify_SrcClassField_get
  62050  * Purpose:
  62051  *      Get match criteria for bcmFieildQualifySrcClassField
  62052  *                     qualifier from the field entry.
  62053  * Parameters:
  62054  *      unit - (IN) Unit number.
  62055  *      entry - (IN) BCM field entry id.
  62056  *      data - (OUT) Qualifier match data.
  62057  *      mask - (OUT) Qualifier match mask.
  62058  * Returns:
  62059  *      BCM_E_XXX
  62060  * Notes:
  62061  */
  62062 int 
  62063 bcm_esw_field_qualify_SrcClassField_get(
  62064     int unit, 
  62065     bcm_field_entry_t entry, 
  62066     uint32 *data, 
  62067     uint32 *mask)
  62068 {
  62069     return BCM_E_UNAVAIL; 
  62070 }
  62071 
  62072 /*
  62073  * Function:
  62074  *      bcm_esw_field_qualify_DstClassL2_get
  62075  * Purpose:
  62076  *      Get match criteria for bcmFieildQualifyDstClassL2
  62077  *                     qualifier from the field entry.
  62078  * Parameters:
  62079  *      unit - (IN) Unit number.
  62080  *      entry - (IN) BCM field entry id.
  62081  *      data - (OUT) Qualifier match data.
  62082  *      mask - (OUT) Qualifier match mask.
  62083  * Returns:
  62084  *      BCM_E_XXX
  62085  * Notes:
  62086  */
  62087 int 
  62088 bcm_esw_field_qualify_DstClassL2_get(
  62089     int unit, 
  62090     bcm_field_entry_t entry, 
  62091     uint32 *data, 
  62092     uint32 *mask)
  62093 {
  62094     return BCM_E_UNAVAIL; 
  62095 }
  62096 
  62097 /*
  62098  * Function:
  62099  *      bcm_esw_field_qualify_DstClassL3_get
  62100  * Purpose:
  62101  *      Get match criteria for bcmFieildQualifyDstClassL3
  62102  *                     qualifier from the field entry.
  62103  * Parameters:
  62104  *      unit - (IN) Unit number.
  62105  *      entry - (IN) BCM field entry id.
  62106  *      data - (OUT) Qualifier match data.
  62107  *      mask - (OUT) Qualifier match mask.
  62108  * Returns:
  62109  *      BCM_E_XXX
  62110  * Notes:
  62111  */
  62112 int 
  62113 bcm_esw_field_qualify_DstClassL3_get(
  62114     int unit, 
  62115     bcm_field_entry_t entry, 
  62116     uint32 *data, 
  62117     uint32 *mask)
  62118 {
  62119     return BCM_E_UNAVAIL; 
  62120 }
  62121 
  62122 /*
  62123  * Function:
  62124  *      bcm_esw_field_qualify_DstClassField_get
  62125  * Purpose:
  62126  *      Get match criteria for bcmFieildQualifyDstClassField
  62127  *                     qualifier from the field entry.
  62128  * Parameters:
  62129  *      unit - (IN) Unit number.
  62130  *      entry - (IN) BCM field entry id.
  62131  *      data - (OUT) Qualifier match data.
  62132  *      mask - (OUT) Qualifier match mask.
  62133  * Returns:
  62134  *      BCM_E_XXX
  62135  * Notes:
  62136  */
  62137 int 
  62138 bcm_esw_field_qualify_DstClassField_get(
  62139     int unit, 
  62140     bcm_field_entry_t entry, 
  62141     uint32 *data, 
  62142     uint32 *mask)
  62143 {
  62144     return BCM_E_UNAVAIL; 
  62145 }
  62146 
  62147 /*
  62148  * Function:
  62149  *      bcm_esw_field_qualify_IpProtocolCommon_get
  62150  * Purpose:
  62151  *      Get match criteria for bcmFieildQualifyIpProtocolCommon
  62152  *                     qualifier from the field entry.
  62153  * Parameters:
  62154  *      unit - (IN) Unit number.
  62155  *      entry - (IN) BCM field entry id.
  62156  *      protocol - (OUT) Qualifier protocol encoding.
  62157  * Returns:
  62158  *      BCM_E_XXX
  62159  * Notes:
  62160  */
  62161 int 
  62162 bcm_esw_field_qualify_IpProtocolCommon_get(
  62163     int unit, 
  62164     bcm_field_entry_t entry, 
  62165     bcm_field_IpProtocolCommon_t *protocol)
  62166 {
  62167     return BCM_E_UNAVAIL; 
  62168 }
  62169 
  62170 /*
  62171  * Function:
  62172  *      bcm_esw_field_qualify_InnerIpProtocolCommon_get
  62173  * Purpose:
  62174  *      Get match criteria for bcmFieildQualifyInnerIpProtocolCommon
  62175  *                     qualifier from the field entry.
  62176  * Parameters:
  62177  *      unit - (IN) Unit number.
  62178  *      entry - (IN) BCM field entry id.
  62179  *      protocol - (OUT) Qualifier inner ip protocol encodnig.
  62180  * Returns:
  62181  *      BCM_E_XXX
  62182  * Notes:
  62183  */
  62184 int 
  62185 bcm_esw_field_qualify_InnerIpProtocolCommon_get(
  62186     int unit, 
  62187     bcm_field_entry_t entry, 
  62188     bcm_field_IpProtocolCommon_t *protocol)
  62189 {
  62190     return BCM_E_UNAVAIL; 
  62191 }
  62192 
  62193 /*
  62194  * Function:
  62195  *      bcm_esw_field_qualify_Snap_get
  62196  * Purpose:
  62197  *      Get match criteria for bcmFieildQualifySnap
  62198  *                     qualifier from the field entry.
  62199  * Parameters:
  62200  *      unit - (IN) Unit number.
  62201  *      entry - (IN) BCM field entry id.
  62202  *      data - (OUT) Qualifier match data.
  62203  *      mask - (OUT) Qualifier match mask.
  62204  * Returns:
  62205  *      BCM_E_XXX
  62206  * Notes:
  62207  */
  62208 int 
  62209 bcm_esw_field_qualify_Snap_get(
  62210     int unit, 
  62211     bcm_field_entry_t entry, 
  62212     bcm_field_snap_header_t *data, 
  62213     bcm_field_snap_header_t *mask)
  62214 {
  62215     return BCM_E_UNAVAIL; 
  62216 }
  62217 
  62218 /*
  62219  * Function:
  62220  *      bcm_esw_field_qualify_Llc_get
  62221  * Purpose:
  62222  *      Get match criteria for bcmFieildQualifyLlc
  62223  *                     qualifier from the field entry.
  62224  * Parameters:
  62225  *      unit - (IN) Unit number.
  62226  *      entry - (IN) BCM field entry id.
  62227  *      data - (OUT) Qualifier match data.
  62228  *      mask - (OUT) Qualifier match mask.
  62229  * Returns:
  62230  *      BCM_E_XXX
  62231  * Notes:
  62232  */
  62233 int 
  62234 bcm_esw_field_qualify_Llc_get(
  62235     int unit, 
  62236     bcm_field_entry_t entry, 
  62237     bcm_field_llc_header_t *data, 
  62238     bcm_field_llc_header_t *mask)
  62239 {
  62240     return BCM_E_UNAVAIL; 
  62241 }
  62242 
  62243 /*
  62244  * Function:
  62245  *      bcm_esw_field_qualify_InnerTpid_get
  62246  * Purpose:
  62247  *      Get match criteria for bcmFieildQualifyInnerTpid
  62248  *                     qualifier from the field entry.
  62249  * Parameters:
  62250  *      unit - (IN) Unit number.
  62251  *      entry - (IN) BCM field entry id.
  62252  *      tpid - (OUT) Qualifier tpid.
  62253  * Returns:
  62254  *      BCM_E_XXX
  62255  * Notes:
  62256  */
  62257 int 
  62258 bcm_esw_field_qualify_InnerTpid_get(
  62259     int unit, 
  62260     bcm_field_entry_t entry, 
  62261     uint16 *tpid)
  62262 {
  62263     return BCM_E_UNAVAIL; 
  62264 }
  62265 
  62266 /*
  62267  * Function:
  62268  *      bcm_esw_field_qualify_OuterTpid_get
  62269  * Purpose:
  62270  *      Get match criteria for bcmFieildQualifyOuterTpid
  62271  *                     qualifier from the field entry.
  62272  * Parameters:
  62273  *      unit - (IN) Unit number.
  62274  *      entry - (IN) BCM field entry id.
  62275  *      tpid - (OUT) Qualifier tpid.
  62276  * Returns:
  62277  *      BCM_E_XXX
  62278  * Notes:
  62279  */
  62280 int 
  62281 bcm_esw_field_qualify_OuterTpid_get(
  62282     int unit, 
  62283     bcm_field_entry_t entry, 
  62284     uint16 *tpid)
  62285 {
  62286     return BCM_E_UNAVAIL; 
  62287 }
  62288 
  62289 /*
  62290  * Function:
  62291  *      bcm_esw_field_qualify_L3Routable_get
  62292  * Purpose:
  62293  *      Get match criteria for bcmFieildQualifyL3Routable
  62294  *                     qualifier from the field entry.
  62295  * Parameters:
  62296  *      unit - (IN) Unit number.
  62297  *      entry - (IN) BCM field entry id.
  62298  *      data - (OUT) Qualifier match data.
  62299  *      mask - (OUT) Qualifier match mask.
  62300  * Returns:
  62301  *      BCM_E_XXX
  62302  * Notes:
  62303  */
  62304 int 
  62305 bcm_esw_field_qualify_L3Routable_get(
  62306     int unit, 
  62307     bcm_field_entry_t entry, 
  62308     uint8 *data, 
  62309     uint8 *mask)
  62310 {
  62311     return BCM_E_UNAVAIL; 
  62312 }
  62313 
  62314 /*
  62315  * Function:
  62316  *      bcm_esw_field_qualify_IpFrag_get
  62317  * Purpose:
  62318  *      Get match criteria for bcmFieildQualifyIpFrag
  62319  *                     qualifier from the field entry.
  62320  * Parameters:
  62321  *      unit - (IN) Unit number.
  62322  *      entry - (IN) BCM field entry id.
  62323  *      frag_info - (OUT) Qualifier ip framentation encoding.
  62324  * Returns:
  62325  *      BCM_E_XXX
  62326  * Notes:
  62327  */
  62328 int 
  62329 bcm_esw_field_qualify_IpFrag_get(
  62330     int unit, 
  62331     bcm_field_entry_t entry, 
  62332     bcm_field_IpFrag_t *frag_info)
  62333 {
  62334     return BCM_E_UNAVAIL; 
  62335 }
  62336 
  62337 /*
  62338  * Function:
  62339  *      bcm_esw_field_qualify_Vrf_get
  62340  * Purpose:
  62341  *      Get match criteria for bcmFieildQualifyVrf
  62342  *                     qualifier from the field entry.
  62343  * Parameters:
  62344  *      unit - (IN) Unit number.
  62345  *      entry - (IN) BCM field entry id.
  62346  *      data - (OUT) Qualifier match data.
  62347  *      mask - (OUT) Qualifier match mask.
  62348  * Returns:
  62349  *      BCM_E_XXX
  62350  * Notes:
  62351  */
  62352 int 
  62353 bcm_esw_field_qualify_Vrf_get(
  62354     int unit, 
  62355     bcm_field_entry_t entry, 
  62356     uint32 *data, 
  62357     uint32 *mask)
  62358 {
  62359     return BCM_E_UNAVAIL; 
  62360 }
  62361 
  62362 /*
  62363  * Function:
  62364  *      bcm_esw_field_qualify_L3Ingress_get
  62365  * Purpose:
  62366  *      Get match criteria for bcmFieildQualifyVrf
  62367  *                     qualifier from the field entry.
  62368  * Parameters:
  62369  *      unit - (IN) Unit number.
  62370  *      entry - (IN) BCM field entry id.
  62371  *      data - (OUT) Qualifier match data.
  62372  *      mask - (OUT) Qualifier match mask.
  62373  * Returns:
  62374  *      BCM_E_XXX
  62375  * Notes:
  62376  */
  62377 int 
  62378 bcm_esw_field_qualify_L3Ingress_get(
  62379     int unit, 
  62380     bcm_field_entry_t entry, 
  62381     uint32 *data, 
  62382     uint32 *mask)
  62383 {
  62384     return BCM_E_UNAVAIL; 
  62385 }
  62386 
  62387 /*
  62388  * Function:
  62389  *      bcm_esw_field_qualify_ExtensionHeaderType_get
  62390  * Purpose:
  62391  *      Get match criteria for bcmFieildQualifyExtensionHeaderType
  62392  *                     qualifier from the field entry.
  62393  * Parameters:
  62394  *      unit - (IN) Unit number.
  62395  *      entry - (IN) BCM field entry id.
  62396  *      data - (OUT) Qualifier match data.
  62397  *      mask - (OUT) Qualifier match mask.
  62398  * Returns:
  62399  *      BCM_E_XXX
  62400  * Notes:
  62401  */
  62402 int 
  62403 bcm_esw_field_qualify_ExtensionHeaderType_get(
  62404     int unit, 
  62405     bcm_field_entry_t entry, 
  62406     uint8 *data, 
  62407     uint8 *mask)
  62408 {
  62409     return BCM_E_UNAVAIL; 
  62410 }
  62411 
  62412 /*
  62413  * Function:
  62414  *      bcm_esw_field_qualify_ExtensionHeaderSubCode_get
  62415  * Purpose:
  62416  *      Get match criteria for bcmFieildQualifyExtensionHeaderSubCode
  62417  *                     qualifier from the field entry.
  62418  * Parameters:
  62419  *      unit - (IN) Unit number.
  62420  *      entry - (IN) BCM field entry id.
  62421  *      data - (OUT) Qualifier match data.
  62422  *      mask - (OUT) Qualifier match mask.
  62423  * Returns:
  62424  *      BCM_E_XXX
  62425  * Notes:
  62426  */
  62427 int 
  62428 bcm_esw_field_qualify_ExtensionHeaderSubCode_get(
  62429     int unit, 
  62430     bcm_field_entry_t entry, 
  62431     uint8 *data, 
  62432     uint8 *mask)
  62433 {
  62434     return BCM_E_UNAVAIL; 
  62435 }
  62436 
  62437 /*
  62438  * Function:
  62439  *      bcm_esw_field_qualify_ExtensionHeader2Type_get
  62440  * Purpose:
  62441  *      Get match criteria for bcmFieildQualifyExtensionHeader2Type
  62442  *                     qualifier from the field entry.
  62443  * Parameters:
  62444  *      unit - (IN) Unit number.
  62445  *      entry - (IN) BCM field entry id.
  62446  *      data - (OUT) Qualifier match data.
  62447  *      mask - (OUT) Qualifier match mask.
  62448  * Returns:
  62449  *      BCM_E_XXX
  62450  * Notes:
  62451  */
  62452 int 
  62453 bcm_esw_field_qualify_ExtensionHeader2Type_get(
  62454     int unit, 
  62455     bcm_field_entry_t entry, 
  62456     uint8 *data, 
  62457     uint8 *mask)
  62458 {
  62459     return BCM_E_UNAVAIL; 
  62460 }
  62461 
  62462 /*
  62463  * Function:
  62464  *      bcm_esw_field_qualify_L4Ports_get
  62465  * Purpose:
  62466  *      Get match criteria for bcmFieildQualifyL4Ports
  62467  *                     qualifier from the field entry.
  62468  * Parameters:
  62469  *      unit - (IN) Unit number.
  62470  *      entry - (IN) BCM field entry id.
  62471  *      data - (OUT) Qualifier match data.
  62472  *      mask - (OUT) Qualifier match mask.
  62473  * Returns:
  62474  *      BCM_E_XXX
  62475  * Notes:
  62476  */
  62477 int 
  62478 bcm_esw_field_qualify_L4Ports_get(
  62479     int unit, 
  62480     bcm_field_entry_t entry, 
  62481     uint8 *data, 
  62482     uint8 *mask)
  62483 {
  62484     return BCM_E_UNAVAIL; 
  62485 }
  62486 
  62487 /*
  62488  * Function:
  62489  *      bcm_esw_field_qualify_MirrorCopy_get
  62490  * Purpose:
  62491  *      Get match criteria for bcmFieildQualifyMirrorCopy
  62492  *                     qualifier from the field entry.
  62493  * Parameters:
  62494  *      unit - (IN) Unit number.
  62495  *      entry - (IN) BCM field entry id.
  62496  *      data - (OUT) Qualifier match data.
  62497  *      mask - (OUT) Qualifier match mask.
  62498  * Returns:
  62499  *      BCM_E_XXX
  62500  * Notes:
  62501  */
  62502 int 
  62503 bcm_esw_field_qualify_MirrorCopy_get(
  62504     int unit, 
  62505     bcm_field_entry_t entry, 
  62506     uint8 *data, 
  62507     uint8 *mask)
  62508 {
  62509     return BCM_E_UNAVAIL; 
  62510 }
  62511 
  62512 /*
  62513  * Function:
  62514  *      bcm_esw_field_qualify_TunnelTerminated_get
  62515  * Purpose:
  62516  *      Get match criteria for bcmFieildQualifyTunnelTerminated
  62517  *                     qualifier from the field entry.
  62518  * Parameters:
  62519  *      unit - (IN) Unit number.
  62520  *      entry - (IN) BCM field entry id.
  62521  *      data - (OUT) Qualifier match data.
  62522  *      mask - (OUT) Qualifier match mask.
  62523  * Returns:
  62524  *      BCM_E_XXX
  62525  * Notes:
  62526  */
  62527 int 
  62528 bcm_esw_field_qualify_TunnelTerminated_get(
  62529     int unit, 
  62530     bcm_field_entry_t entry, 
  62531     uint8 *data, 
  62532     uint8 *mask)
  62533 {
  62534     return BCM_E_UNAVAIL; 
  62535 }
  62536 
  62537 /*
  62538  * Function:
  62539  *      bcm_esw_field_qualify_MplsTerminated_get
  62540  * Purpose:
  62541  *      Get match criteria for bcmFieildQualifyMplsTerminated
  62542  *                     qualifier from the field entry.
  62543  * Parameters:
  62544  *      unit - (IN) Unit number.
  62545  *      entry - (IN) BCM field entry id.
  62546  *      data - (OUT) Qualifier match data.
  62547  *      mask - (OUT) Qualifier match mask.
  62548  * Returns:
  62549  *      BCM_E_XXX
  62550  * Notes:
  62551  */
  62552 int 
  62553 bcm_esw_field_qualify_MplsTerminated_get(
  62554     int unit, 
  62555     bcm_field_entry_t entry, 
  62556     uint8 *data, 
  62557     uint8 *mask)
  62558 {
  62559     return BCM_E_UNAVAIL; 
  62560 }
  62561 
  62562 /*
  62563  * Function:
  62564  *      bcm_esw_field_qualify_InnerSrcIp_get
  62565  * Purpose:
  62566  *      Get match criteria for bcmFieildQualifyInnerSrcIp
  62567  *                     qualifier from the field entry.
  62568  * Parameters:
  62569  *      unit - (IN) Unit number.
  62570  *      entry - (IN) BCM field entry id.
  62571  *      data - (OUT) Qualifier match data.
  62572  *      mask - (OUT) Qualifier match mask.
  62573  * Returns:
  62574  *      BCM_E_XXX
  62575  * Notes:
  62576  */
  62577 int 
  62578 bcm_esw_field_qualify_InnerSrcIp_get(
  62579     int unit, 
  62580     bcm_field_entry_t entry, 
  62581     bcm_ip_t *data, 
  62582     bcm_ip_t *mask)
  62583 {
  62584     return BCM_E_UNAVAIL; 
  62585 }
  62586 
  62587 /*
  62588  * Function:
  62589  *      bcm_esw_field_qualify_InnerDstIp_get
  62590  * Purpose:
  62591  *      Get match criteria for bcmFieildQualifyInnerDstIp
  62592  *                     qualifier from the field entry.
  62593  * Parameters:
  62594  *      unit - (IN) Unit number.
  62595  *      entry - (IN) BCM field entry id.
  62596  *      data - (OUT) Qualifier match data.
  62597  *      mask - (OUT) Qualifier match mask.
  62598  * Returns:
  62599  *      BCM_E_XXX
  62600  * Notes:
  62601  */
  62602 int 
  62603 bcm_esw_field_qualify_InnerDstIp_get(
  62604     int unit, 
  62605     bcm_field_entry_t entry, 
  62606     bcm_ip_t *data, 
  62607     bcm_ip_t *mask)
  62608 {
  62609     return BCM_E_UNAVAIL; 
  62610 }
  62611 
  62612 /*
  62613  * Function:
  62614  *      bcm_esw_field_qualify_InnerSrcIp6_get
  62615  * Purpose:
  62616  *      Get match criteria for bcmFieildQualifyInnerSrcIp6
  62617  *                     qualifier from the field entry.
  62618  * Parameters:
  62619  *      unit - (IN) Unit number.
  62620  *      entry - (IN) BCM field entry id.
  62621  *      data - (OUT) Qualifier match data.
  62622  *      mask - (OUT) Qualifier match mask.
  62623  * Returns:
  62624  *      BCM_E_XXX
  62625  * Notes:
  62626  */
  62627 int 
  62628 bcm_esw_field_qualify_InnerSrcIp6_get(
  62629     int unit, 
  62630     bcm_field_entry_t entry, 
  62631     bcm_ip6_t *data, 
  62632     bcm_ip6_t *mask)
  62633 {
  62634     return BCM_E_UNAVAIL; 
  62635 }
  62636 
  62637 /*
  62638  * Function:
  62639  *      bcm_esw_field_qualify_InnerDstIp6_get
  62640  * Purpose:
  62641  *      Get match criteria for bcmFieildQualifyInnerDstIp6
  62642  *                     qualifier from the field entry.
  62643  * Parameters:
  62644  *      unit - (IN) Unit number.
  62645  *      entry - (IN) BCM field entry id.
  62646  *      data - (OUT) Qualifier match data.
  62647  *      mask - (OUT) Qualifier match mask.
  62648  * Returns:
  62649  *      BCM_E_XXX
  62650  * Notes:
  62651  */
  62652 int 
  62653 bcm_esw_field_qualify_InnerDstIp6_get(
  62654     int unit, 
  62655     bcm_field_entry_t entry, 
  62656     bcm_ip6_t *data, 
  62657     bcm_ip6_t *mask)
  62658 {
  62659     return BCM_E_UNAVAIL; 
  62660 }
  62661 
  62662 /*
  62663  * Function:
  62664  *      bcm_esw_field_qualify_InnerSrcIp6High_get
  62665  * Purpose:
  62666  *      Get match criteria for bcmFieildQualifyInnerSrcIp6High
  62667  *                     qualifier from the field entry.
  62668  * Parameters:
  62669  *      unit - (IN) Unit number.
  62670  *      entry - (IN) BCM field entry id.
  62671  *      data - (OUT) Qualifier match data.
  62672  *      mask - (OUT) Qualifier match mask.
  62673  * Returns:
  62674  *      BCM_E_XXX
  62675  * Notes:
  62676  */
  62677 int 
  62678 bcm_esw_field_qualify_InnerSrcIp6High_get(
  62679     int unit, 
  62680     bcm_field_entry_t entry, 
  62681     bcm_ip6_t *data, 
  62682     bcm_ip6_t *mask)
  62683 {
  62684     return BCM_E_UNAVAIL; 
  62685 }
  62686 
  62687 /*
  62688  * Function:
  62689  *      bcm_esw_field_qualify_InnerDstIp6High_get
  62690  * Purpose:
  62691  *      Get match criteria for bcmFieildQualifyInnerDstIp6High
  62692  *                     qualifier from the field entry.
  62693  * Parameters:
  62694  *      unit - (IN) Unit number.
  62695  *      entry - (IN) BCM field entry id.
  62696  *      data - (OUT) Qualifier match data.
  62697  *      mask - (OUT) Qualifier match mask.
  62698  * Returns:
  62699  *      BCM_E_XXX
  62700  * Notes:
  62701  */
  62702 int 
  62703 bcm_esw_field_qualify_InnerDstIp6High_get(
  62704     int unit, 
  62705     bcm_field_entry_t entry, 
  62706     bcm_ip6_t *data, 
  62707     bcm_ip6_t *mask)
  62708 {
  62709     return BCM_E_UNAVAIL; 
  62710 }
  62711 
  62712 /*
  62713  * Function:
  62714  *      bcm_esw_field_qualify_InnerTtl_get
  62715  * Purpose:
  62716  *      Get match criteria for bcmFieildQualifyInnerTtl
  62717  *                     qualifier from the field entry.
  62718  * Parameters:
  62719  *      unit - (IN) Unit number.
  62720  *      entry - (IN) BCM field entry id.
  62721  *      data - (OUT) Qualifier match data.
  62722  *      mask - (OUT) Qualifier match mask.
  62723  * Returns:
  62724  *      BCM_E_XXX
  62725  * Notes:
  62726  */
  62727 int 
  62728 bcm_esw_field_qualify_InnerTtl_get(
  62729     int unit, 
  62730     bcm_field_entry_t entry, 
  62731     uint8 *data, 
  62732     uint8 *mask)
  62733 {
  62734     return BCM_E_UNAVAIL; 
  62735 }
  62736 
  62737 /*
  62738  * Function:
  62739  *      bcm_esw_field_qualify_InnerTos_get
  62740  * Purpose:
  62741  *      Get match criteria for bcmFieildQualifyInnerDSCP
  62742  *                     qualifier from the field entry.
  62743  * Parameters:
  62744  *      unit - (IN) Unit number.
  62745  *      entry - (IN) BCM field entry id.
  62746  *      data - (OUT) Qualifier match data.
  62747  *      mask - (OUT) Qualifier match mask.
  62748  * Returns:
  62749  *      BCM_E_XXX
  62750  * Notes:
  62751  */
  62752 int 
  62753 bcm_esw_field_qualify_InnerTos_get(
  62754     int unit, 
  62755     bcm_field_entry_t entry, 
  62756     uint8 *data, 
  62757     uint8 *mask)
  62758 {
  62759     return BCM_E_UNAVAIL; 
  62760 }
  62761 
  62762 /*
  62763  * Function:
  62764  *      bcm_esw_field_qualify_InnerDSCP_get
  62765  * Purpose:
  62766  *      Get match criteria for bcmFieildQualifyInnerDSCP
  62767  *                     qualifier from the field entry.
  62768  * Parameters:
  62769  *      unit - (IN) Unit number.
  62770  *      entry - (IN) BCM field entry id.
  62771  *      data - (OUT) Qualifier match data.
  62772  *      mask - (OUT) Qualifier match mask.
  62773  * Returns:
  62774  *      BCM_E_XXX
  62775  * Notes:
  62776  */
  62777 int 
  62778 bcm_esw_field_qualify_InnerDSCP_get(
  62779     int unit, 
  62780     bcm_field_entry_t entry, 
  62781     uint8 *data, 
  62782     uint8 *mask)
  62783 {
  62784     return BCM_E_UNAVAIL; 
  62785 }
  62786 
  62787 /*
  62788  * Function:
  62789  *      bcm_esw_field_qualify_InnerIpProtocol_get
  62790  * Purpose:
  62791  *      Get match criteria for bcmFieildQualifyInnerIpProtocol
  62792  *                     qualifier from the field entry.
  62793  * Parameters:
  62794  *      unit - (IN) Unit number.
  62795  *      entry - (IN) BCM field entry id.
  62796  *      data - (OUT) Qualifier match data.
  62797  *      mask - (OUT) Qualifier match mask.
  62798  * Returns:
  62799  *      BCM_E_XXX
  62800  * Notes:
  62801  */
  62802 int 
  62803 bcm_esw_field_qualify_InnerIpProtocol_get(
  62804     int unit, 
  62805     bcm_field_entry_t entry, 
  62806     uint8 *data, 
  62807     uint8 *mask)
  62808 {
  62809     return BCM_E_UNAVAIL; 
  62810 }
  62811 
  62812 /*
  62813  * Function:
  62814  *      bcm_esw_field_qualify_InnerIpFrag_get
  62815  * Purpose:
  62816  *      Get match criteria for bcmFieildQualifyInnerIpFrag
  62817  *                     qualifier from the field entry.
  62818  * Parameters:
  62819  *      unit - (IN) Unit number.
  62820  *      entry - (IN) BCM field entry id.
  62821  *      frag_info - (OUT) Inner ip header fragmentation info.
  62822  * Returns:
  62823  *      BCM_E_XXX
  62824  * Notes:
  62825  */
  62826 int 
  62827 bcm_esw_field_qualify_InnerIpFrag_get(
  62828     int unit, 
  62829     bcm_field_entry_t entry, 
  62830     bcm_field_IpFrag_t *frag_info)
  62831 {
  62832     return BCM_E_UNAVAIL; 
  62833 }
  62834 
  62835 /*
  62836  * Function:
  62837  *      bcm_esw_field_qualify_DosAttack_get
  62838  * Purpose:
  62839  *      Get match criteria for bcmFieildQualifyDosAttack
  62840  *                     qualifier from the field entry.
  62841  * Parameters:
  62842  *      unit - (IN) Unit number.
  62843  *      entry - (IN) BCM field entry id.
  62844  *      data - (OUT) Qualifier match data.
  62845  *      mask - (OUT) Qualifier match mask.
  62846  * Returns:
  62847  *      BCM_E_XXX
  62848  * Notes:
  62849  */
  62850 int 
  62851 bcm_esw_field_qualify_DosAttack_get(
  62852     int unit, 
  62853     bcm_field_entry_t entry, 
  62854     uint8 *data, 
  62855     uint8 *mask)
  62856 {
  62857     return BCM_E_UNAVAIL; 
  62858 }
  62859 
  62860 /*
  62861  * Function:
  62862  *      bcm_esw_field_qualify_IpmcStarGroupHit_get
  62863  * Purpose:
  62864  *      Get match criteria for bcmFieildQualifyIpmcStarGroupHit
  62865  *                     qualifier from the field entry.
  62866  * Parameters:
  62867  *      unit - (IN) Unit number.
  62868  *      entry - (IN) BCM field entry id.
  62869  *      data - (OUT) Qualifier match data.
  62870  *      mask - (OUT) Qualifier match mask.
  62871  * Returns:
  62872  *      BCM_E_XXX
  62873  * Notes:
  62874  */
  62875 int 
  62876 bcm_esw_field_qualify_IpmcStarGroupHit_get(
  62877     int unit, 
  62878     bcm_field_entry_t entry, 
  62879     uint8 *data, 
  62880     uint8 *mask)
  62881 {
  62882     return BCM_E_UNAVAIL; 
  62883 }
  62884 
  62885 /*
  62886  * Function:
  62887  *      bcm_esw_field_qualify_MyStationHit_get
  62888  * Purpose:
  62889  *      Get match criteria for bcmFieildQualifyMyStationHit
  62890  *                     qualifier from the field entry.
  62891  * Parameters:
  62892  *      unit - (IN) Unit number.
  62893  *      entry - (IN) BCM field entry id.
  62894  *      data - (OUT) Qualifier match data.
  62895  *      mask - (OUT) Qualifier match mask.
  62896  * Returns:
  62897  *      BCM_E_XXX
  62898  * Notes:
  62899  */
  62900 int 
  62901 bcm_esw_field_qualify_MyStationHit_get(
  62902     int unit, 
  62903     bcm_field_entry_t entry, 
  62904     uint8 *data, 
  62905     uint8 *mask)
  62906 {
  62907     return BCM_E_UNAVAIL; 
  62908 }
  62909 
  62910 /*
  62911  * Function:
  62912  *      bcm_esw_field_qualify_L2PayloadFirstEightBytes_get
  62913  * Purpose:
  62914  *      Get match criteria for bcmFieldQualifyL2PayloadFirstEightBytes
  62915  *          qualifier from the field entry.
  62916  * Parameters:
  62917  *      unit - (IN) Unit number.
  62918  *      entry - (IN) BCM field entry id.
  62919  *      data1 - (OUT) Qualifier first four bytes of match data.
  62920  *      data2 - (OUT) Qualifier last four bytes of match data.
  62921  *      mask1 - (OUT) Qualifier first four bytes of match mask.
  62922  *      mask2 - (OUT) Qualifier last four bytes of match mask.
  62923  * Returns:
  62924  *      BCM_E_XXX
  62925  * Notes:
  62926  */
  62927 int 
  62928 bcm_esw_field_qualify_L2PayloadFirstEightBytes_get(
  62929     int unit, 
  62930     bcm_field_entry_t entry, 
  62931     uint32 *data1, uint32 *data2,
  62932     uint32 *mask1, uint32 *mask2)
  62933 {
  62934     return BCM_E_UNAVAIL; 
  62935 }
  62936 
  62937 /*
  62938  * Function:
  62939  *      bcm_esw_field_qualify_L3DestRouteHit_get
  62940  * Purpose:
  62941  *      Get match criteria for bcmFieildQualifyL3DestRouteHit
  62942  *                     qualifier from the field entry.
  62943  * Parameters:
  62944  *      unit - (IN) Unit number.
  62945  *      entry - (IN) BCM field entry id.
  62946  *      data - (OUT) Qualifier match data.
  62947  *      mask - (OUT) Qualifier match mask.
  62948  * Returns:
  62949  *      BCM_E_XXX
  62950  * Notes:
  62951  */
  62952 int 
  62953 bcm_esw_field_qualify_L3DestRouteHit_get(
  62954     int unit, 
  62955     bcm_field_entry_t entry, 
  62956     uint8 *data, 
  62957     uint8 *mask)
  62958 {
  62959     return BCM_E_UNAVAIL; 
  62960 }
  62961 
  62962 /*
  62963  * Function:
  62964  *      bcm_esw_field_qualify_L3DestHostHit_get
  62965  * Purpose:
  62966  *      Get match criteria for bcmFieildQualifyL3DestHostHit
  62967  *                     qualifier from the field entry.
  62968  * Parameters:
  62969  *      unit - (IN) Unit number.
  62970  *      entry - (IN) BCM field entry id.
  62971  *      data - (OUT) Qualifier match data.
  62972  *      mask - (OUT) Qualifier match mask.
  62973  * Returns:
  62974  *      BCM_E_XXX
  62975  * Notes:
  62976  */
  62977 int 
  62978 bcm_esw_field_qualify_L3DestHostHit_get(
  62979     int unit, 
  62980     bcm_field_entry_t entry, 
  62981     uint8 *data, 
  62982     uint8 *mask)
  62983 {
  62984     return BCM_E_UNAVAIL; 
  62985 }
  62986 
  62987 /*
  62988  * Function:
  62989  *      bcm_esw_field_qualify_L3SrcHostHit_get
  62990  * Purpose:
  62991  *      Get match criteria for bcmFieildQualifyL3SrcHostHit
  62992  *                     qualifier from the field entry.
  62993  * Parameters:
  62994  *      unit - (IN) Unit number.
  62995  *      entry - (IN) BCM field entry id.
  62996  *      data - (OUT) Qualifier match data.
  62997  *      mask - (OUT) Qualifier match mask.
  62998  * Returns:
  62999  *      BCM_E_XXX
  63000  * Notes:
  63001  */
  63002 int 
  63003 bcm_esw_field_qualify_L3SrcHostHit_get(
  63004     int unit, 
  63005     bcm_field_entry_t entry, 
  63006     uint8 *data, 
  63007     uint8 *mask)
  63008 {
  63009     return BCM_E_UNAVAIL; 
  63010 }
  63011 
  63012 /*
  63013  * Function:
  63014  *      bcm_esw_field_qualify_L2CacheHit_get
  63015  * Purpose:
  63016  *      Get match criteria for bcmFieildQualifyL2CacheHit
  63017  *                     qualifier from the field entry.
  63018  * Parameters:
  63019  *      unit - (IN) Unit number.
  63020  *      entry - (IN) BCM field entry id.
  63021  *      data - (OUT) Qualifier match data.
  63022  *      mask - (OUT) Qualifier match mask.
  63023  * Returns:
  63024  *      BCM_E_XXX
  63025  * Notes:
  63026  */
  63027 int 
  63028 bcm_esw_field_qualify_L2CacheHit_get(
  63029     int unit, 
  63030     bcm_field_entry_t entry, 
  63031     uint8 *data, 
  63032     uint8 *mask)
  63033 {
  63034     return BCM_E_UNAVAIL; 
  63035 }
  63036 
  63037 /*
  63038  * Function:
  63039  *      bcm_esw_field_qualify_L2StationMove_get
  63040  * Purpose:
  63041  *      Get match criteria for bcmFieildQualifyL2StationMove
  63042  *                     qualifier from the field entry.
  63043  * Parameters:
  63044  *      unit - (IN) Unit number.
  63045  *      entry - (IN) BCM field entry id.
  63046  *      data - (OUT) Qualifier match data.
  63047  *      mask - (OUT) Qualifier match mask.
  63048  * Returns:
  63049  *      BCM_E_XXX
  63050  * Notes:
  63051  */
  63052 int 
  63053 bcm_esw_field_qualify_L2StationMove_get(
  63054     int unit, 
  63055     bcm_field_entry_t entry, 
  63056     uint8 *data, 
  63057     uint8 *mask)
  63058 {
  63059     return BCM_E_UNAVAIL; 
  63060 }
  63061 
  63062 /*
  63063  * Function:
  63064  *      bcm_esw_field_qualify_L2DestHit_get
  63065  * Purpose:
  63066  *      Get match criteria for bcmFieildQualifyL2DestHit
  63067  *                     qualifier from the field entry.
  63068  * Parameters:
  63069  *      unit - (IN) Unit number.
  63070  *      entry - (IN) BCM field entry id.
  63071  *      data - (OUT) Qualifier match data.
  63072  *      mask - (OUT) Qualifier match mask.
  63073  * Returns:
  63074  *      BCM_E_XXX
  63075  * Notes:
  63076  */
  63077 int 
  63078 bcm_esw_field_qualify_L2DestHit_get(
  63079     int unit, 
  63080     bcm_field_entry_t entry, 
  63081     uint8 *data, 
  63082     uint8 *mask)
  63083 {
  63084     return BCM_E_UNAVAIL; 
  63085 }
  63086 
  63087 /*
  63088  * Function:
  63089  *      bcm_esw_field_qualify_L2SrcStatic_get
  63090  * Purpose:
  63091  *      Get match criteria for bcmFieildQualifyL2SrcStatic
  63092  *                     qualifier from the field entry.
  63093  * Parameters:
  63094  *      unit - (IN) Unit number.
  63095  *      entry - (IN) BCM field entry id.
  63096  *      data - (OUT) Qualifier match data.
  63097  *      mask - (OUT) Qualifier match mask.
  63098  * Returns:
  63099  *      BCM_E_XXX
  63100  * Notes:
  63101  */
  63102 int 
  63103 bcm_esw_field_qualify_L2SrcStatic_get(
  63104     int unit, 
  63105     bcm_field_entry_t entry, 
  63106     uint8 *data, 
  63107     uint8 *mask)
  63108 {
  63109     return BCM_E_UNAVAIL; 
  63110 }
  63111 
  63112 /*
  63113  * Function:
  63114  *      bcm_esw_field_qualify_L2SrcHit_get
  63115  * Purpose:
  63116  *      Get match criteria for bcmFieildQualifyL2SrcHit
  63117  *                     qualifier from the field entry.
  63118  * Parameters:
  63119  *      unit - (IN) Unit number.
  63120  *      entry - (IN) BCM field entry id.
  63121  *      data - (OUT) Qualifier match data.
  63122  *      mask - (OUT) Qualifier match mask.
  63123  * Returns:
  63124  *      BCM_E_XXX
  63125  * Notes:
  63126  */
  63127 int 
  63128 bcm_esw_field_qualify_L2SrcHit_get(
  63129     int unit, 
  63130     bcm_field_entry_t entry, 
  63131     uint8 *data, 
  63132     uint8 *mask)
  63133 {
  63134     return BCM_E_UNAVAIL; 
  63135 }
  63136 
  63137 /*
  63138  * Function:
  63139  *      bcm_esw_field_qualify_IngressStpState_get
  63140  * Purpose:
  63141  *      Get match criteria for bcmFieildQualifyIngressStpState
  63142  *                     qualifier from the field entry.
  63143  * Parameters:
  63144  *      unit - (IN) Unit number.
  63145  *      entry - (IN) BCM field entry id.
  63146  *      data - (OUT) Qualifier match data.
  63147  *      mask - (OUT) Qualifier match mask.
  63148  * Returns:
  63149  *      BCM_E_XXX
  63150  * Notes:
  63151  */
  63152 int 
  63153 bcm_esw_field_qualify_IngressStpState_get(
  63154     int unit, 
  63155     bcm_field_entry_t entry, 
  63156     uint8 *data, 
  63157     uint8 *mask)
  63158 {
  63159     return BCM_E_UNAVAIL; 
  63160 }
  63161 
  63162 /*
  63163  * Function:
  63164  *      bcm_esw_field_qualify_ForwardingVlanValid_get
  63165  * Purpose:
  63166  *      Get match criteria for bcmFieildQualifyForwardingVlanValid
  63167  *                     qualifier from the field entry.
  63168  * Parameters:
  63169  *      unit - (IN) Unit number.
  63170  *      entry - (IN) BCM field entry id.
  63171  *      data - (OUT) Qualifier match data.
  63172  *      mask - (OUT) Qualifier match mask.
  63173  * Returns:
  63174  *      BCM_E_XXX
  63175  * Notes:
  63176  */
  63177 int 
  63178 bcm_esw_field_qualify_ForwardingVlanValid_get(
  63179     int unit, 
  63180     bcm_field_entry_t entry, 
  63181     uint8 *data, 
  63182     uint8 *mask)
  63183 {
  63184     return BCM_E_UNAVAIL; 
  63185 }
  63186 
  63187 /*
  63188  * Function:
  63189  *      bcm_esw_field_qualify_SrcVirtualPortValid_get
  63190  * Purpose:
  63191  *      Get match criteria for bcmFieldQualifySrcVirtualPortValid
  63192  *      qualifier from the field entry.
  63193  * Parameters:
  63194  *      unit    - (IN) Unit number.
  63195  *      entry   - (IN) BCM field entry id.
  63196  *      data    - (OUT) Qualifier match data.
  63197  *      mask    - (OUT) Qualifier match mask.
  63198  * Returns:
  63199  *      BCM_E_XXX
  63200  * Notes:
  63201  */
  63202 int 
  63203 bcm_esw_field_qualify_SrcVirtualPortValid_get(int unit,
  63204                                               bcm_field_entry_t entry,
  63205                                               uint8 *data,
  63206                                               uint8 *mask)
  63207 {
  63208     return (BCM_E_UNAVAIL);
  63209 }
  63210 
  63211 /*
  63212  * Function:
  63213  *      bcm_esw_field_qualify_DstL3EgressNextHops_get
  63214  * Purpose:
  63215  *      Get match criteria for bcmFieldQualifyDstL3EgressNextHops
  63216  *      qualifier from the field entry.
  63217  * Parameters:
  63218  *      unit    - (IN) Unit number.
  63219  *      entry   - (IN) BCM field entry id.
  63220  *      data    - (OUT) Qualifier match data.
  63221  *      mask    - (OUT) Qualifier match mask.
  63222  * Returns:
  63223  *      BCM_E_XXX
  63224  * Notes:
  63225  */
  63226 int 
  63227 bcm_esw_field_qualify_DstL3EgressNextHops_get(int unit,
  63228     bcm_field_entry_t entry,
  63229     uint32 *data,
  63230     uint32 *mask)
  63231 {
  63232     return (BCM_E_UNAVAIL);
  63233 }
  63234 
  63235 /*
  63236  * Function:
  63237  *      bcm_esw_field_qualify_VlanTranslationHit_get
  63238  * Purpose:
  63239  *      Get match criteria for bcmFieildQualifyVlanTranslationHit
  63240  *                     qualifier from the field entry.
  63241  * Parameters:
  63242  *      unit - (IN) Unit number.
  63243  *      entry - (IN) BCM field entry id.
  63244  *      data - (OUT) Qualifier match data.
  63245  *      mask - (OUT) Qualifier match mask.
  63246  * Returns:
  63247  *      BCM_E_XXX
  63248  * Notes:
  63249  */
  63250 int 
  63251 bcm_esw_field_qualify_VlanTranslationHit_get(
  63252     int unit, 
  63253     bcm_field_entry_t entry, 
  63254     uint8 *data, 
  63255     uint8 *mask)
  63256 {
  63257     return BCM_E_UNAVAIL; 
  63258 }
  63259 
  63260 /*
  63261  * Function:
  63262  *      bcm_esw_field_qualify_IcmpTypeCode_get
  63263  * Purpose:
  63264  *      Get match criteria for bcmFieildQualifyIcmpTypeCode
  63265  *                     qualifier from the field entry.
  63266  * Parameters:
  63267  *      unit - (IN) Unit number.
  63268  *      entry - (IN) BCM field entry id.
  63269  *      data - (OUT) Qualifier match data.
  63270  *      mask - (OUT) Qualifier match mask.
  63271  * Returns:
  63272  *      BCM_E_XXX
  63273  * Notes:
  63274  */
  63275 int 
  63276 bcm_esw_field_qualify_IcmpTypeCode_get(
  63277     int unit, 
  63278     bcm_field_entry_t entry, 
  63279     uint16 *data, 
  63280     uint16 *mask)
  63281 {
  63282     return BCM_E_UNAVAIL; 
  63283 }
  63284 
  63285 /*
  63286  * Function:
  63287  *      bcm_esw_field_qualify_TranslatedVlanFormat
  63288  * Purpose:
  63289  *      Set match criteria for bcmFieildQualifyTranslatedVlanFormat
  63290  *                     qualifier in the field entry.
  63291  * Parameters:
  63292  *      unit - (IN) Unit number.
  63293  *      entry - (IN) BCM field entry id.
  63294  *      data - (IN) Qualifier match data.
  63295  *      mask - (IN) Qualifier match mask.
  63296  * Returns:
  63297  *      BCM_E_XXX
  63298  * Notes:
  63299  */
  63300 int 
  63301 bcm_esw_field_qualify_TranslatedVlanFormat(
  63302     int unit, 
  63303     bcm_field_entry_t entry, 
  63304     uint8 data, 
  63305     uint8 mask)
  63306 {
  63307     return BCM_E_UNAVAIL; 
  63308 }
  63309 
  63310 /*
  63311  * Function:
  63312  *      bcm_esw_field_qualify_IntPriority
  63313  * Purpose:
  63314  *      Set match criteria for bcmFieildQualifyIntPriority
  63315  *                     qualifier in the field entry.
  63316  * Parameters:
  63317  *      unit - (IN) Unit number.
  63318  *      entry - (IN) BCM field entry id.
  63319  *      data - (IN) Qualifier match data.
  63320  *      mask - (IN) Qualifier match mask.
  63321  * Returns:
  63322  *      BCM_E_XXX
  63323  * Notes:
  63324  */
  63325 int 
  63326 bcm_esw_field_qualify_IntPriority(
  63327     int unit, 
  63328     bcm_field_entry_t entry, 
  63329     uint8 data, 
  63330     uint8 mask)
  63331 {
  63332     return BCM_E_UNAVAIL; 
  63333 }
  63334 
  63335 
  63336 /*
  63337  * Function:
  63338  *      bcm_esw_field_qualify_Color
  63339  * Purpose:
  63340  *      Set match criteria for bcmFieildQualifyColor
  63341  *                     qualifier in the field entry.
  63342  * Parameters:
  63343  *      unit - (IN) Unit number.
  63344  *      entry - (IN) BCM field entry id.
  63345  *      color - (IN) Qualifier match color.
  63346  * Returns:
  63347  *      BCM_E_XXX
  63348  * Notes:
  63349  */
  63350 int 
  63351 bcm_esw_field_qualify_Color(int unit, bcm_field_entry_t entry, 
  63352                             uint8 color)
  63353 {
  63354     return BCM_E_UNAVAIL; 
  63355 }
  63356 
  63357 /*
  63358  * Function:
  63359  *      bcm_esw_field_qualify_FibreChanOuter
  63360  * Purpose:
  63361  *      Add Fibre Channel outer header type field qualification to a field entry.
  63362  * Parameters:
  63363  *      unit - (IN) Unit number.
  63364  *      entry - (IN) Field entry id.
  63365  *      fibre_chan_type - (IN) Data to qualify with.
  63366  * Returns:
  63367  *      BCM_E_XXX
  63368  * Notes:
  63369  */
  63370 int 
  63371 bcm_esw_field_qualify_FibreChanOuter(int unit, 
  63372                              bcm_field_entry_t entry, 
  63373                              bcm_field_FibreChan_t fibre_chan_type)
  63374 {
  63375     return BCM_E_UNAVAIL;
  63376 }
  63377 
  63378 /*
  63379  * Function:
  63380  *      bcm_esw_field_qualify_FibreChanInner
  63381  * Purpose:
  63382  *      Add Fibre Channel inner header type field qualification to a field entry.
  63383  * Parameters:
  63384  *      unit - (IN) Unit number.
  63385  *      entry - (IN) Field entry id.
  63386  *      fibre_chan_type - (IN) Data to qualify with.
  63387  * Returns:
  63388  *      BCM_E_XXX
  63389  * Notes:
  63390  */
  63391 int 
  63392 bcm_esw_field_qualify_FibreChanInner(int unit, 
  63393                              bcm_field_entry_t entry, 
  63394                              bcm_field_FibreChan_t fibre_chan_type)
  63395 {
  63396     return BCM_E_UNAVAIL;
  63397 }
  63398 
  63399 /*
  63400  * Function:
  63401  *      bcm_esw_field_qualify_VnTag
  63402  * Purpose:
  63403  *      Add NIV VN tag field qualification to a field entry.
  63404  * Parameters:
  63405  *      unit  - (IN) Unit number.
  63406  *      entry - (IN) Field entry id.
  63407  *      data  - (IN) Qualifier match data.
  63408  *      mask  - (IN) Qualifier match mask.
  63409  * Returns:
  63410  *      BCM_E_XXX
  63411  * Notes:
  63412  */
  63413 int
  63414 bcm_esw_field_qualify_VnTag(int unit, bcm_field_entry_t entry,
  63415                             uint32 data, uint32 mask)
  63416 {
  63417     return BCM_E_UNAVAIL;
  63418 }
  63419 
  63420 /*
  63421  * Function:
  63422  *  bcm_esw_field_qualify_ETag
  63423  * Purpose:
  63424  *  Add Etag field qualification to a field entry.
  63425  * Parameters:
  63426  *  unit  - (IN) Unit number.
  63427  *  entry - (IN) Field entry id.
  63428  *  data  - (IN) Qualifier match data.
  63429  *  mask  - (IN) Qualifier match mask.
  63430  * Returns:
  63431  *  BCM_E_XXX
  63432  * Notes:
  63433  */
  63434 int
  63435 bcm_esw_field_qualify_ETag(int unit, bcm_field_entry_t entry,
  63436                                      uint64 data, uint64 mask)
  63437 {
  63438     return BCM_E_UNAVAIL;
  63439 }
  63440 
  63441 /*
  63442  * Function:
  63443  *      bcm_esw_field_qualify_SubportPktTag
  63444  * Purpose:
  63445  *      Add LLTAG tag field qualification to a field entry.
  63446  * Parameters:
  63447  *      unit  - (IN) Unit number.
  63448  *      entry - (IN) Field entry id.
  63449  *      data  - (IN) Qualifier match data.
  63450  *      mask  - (IN) Qualifier match mask.
  63451  * Returns:
  63452  *      BCM_E_XXX
  63453  * Notes:
  63454  */
  63455 int
  63456 bcm_esw_field_qualify_SubportPktTag(int unit, bcm_field_entry_t entry,
  63457                             uint16 data, uint16 mask)
  63458 {
  63459     return BCM_E_UNAVAIL;
  63460 }
  63461 int
  63462 bcm_esw_field_qualify_L2GreVsid(int unit, bcm_field_entry_t entry,
  63463                                         uint32 data, uint32 mask)
  63464 {
  63465     return BCM_E_UNAVAIL;
  63466 }
  63467 
  63468 int
  63469 bcm_esw_field_qualify_L2GreVsid_get(int unit, bcm_field_entry_t entry,
  63470                                     uint32 *data, uint32 *mask) {
  63471     return BCM_E_UNAVAIL;
  63472 }
  63473 
  63474 /*
  63475  * Function:
  63476  *      bcm_esw_field_qualify_CnTag
  63477  * Purpose:
  63478  *      Add QCN CN tag field qualification to a field entry.
  63479  * Parameters:
  63480  *      unit  - (IN) Unit number.
  63481  *      entry - (IN) Field entry id.
  63482  *      data  - (IN) Qualifier match data.
  63483  *      mask  - (IN) Qualifier match mask.
  63484  * Returns:
  63485  *      BCM_E_XXX
  63486  * Notes:
  63487  */
  63488 int
  63489 bcm_esw_field_qualify_CnTag(int unit, bcm_field_entry_t entry,
  63490                             uint32 data, uint32 mask)
  63491 {
  63492     return BCM_E_UNAVAIL;
  63493 }
  63494 
  63495 /*
  63496  * Function:
  63497  *      bcm_esw_field_qualify_FabricQueueTag
  63498  * Purpose:
  63499  *      Add Fabric Queue tag field qualification to a field entry.
  63500  * Parameters:
  63501  *      unit  - (IN) Unit number.
  63502  *      entry - (IN) Field entry id.
  63503  *      data  - (IN) Qualifier match data.
  63504  *      mask  - (IN) Qualifier match mask.
  63505  * Returns:
  63506  *      BCM_E_XXX
  63507  * Notes:
  63508  */
  63509 int
  63510 bcm_esw_field_qualify_FabricQueueTag(int unit, bcm_field_entry_t entry,
  63511                                      uint32 data, uint32 mask)
  63512 {
  63513     return BCM_E_UNAVAIL;
  63514 }
  63515 
  63516 /*
  63517  * Function:
  63518  *      bcm_esw_field_qualify_SrcModPortGport
  63519  * Purpose:
  63520  *      Set match criteria for bcmFieildQualifySrcModPortGport
  63521  *                     qualifier in the field entry.
  63522  * Parameters:
  63523  *      unit - (IN) Unit number.
  63524  *      entry - (IN) BCM field entry id.
  63525  *      data - (IN) Qualifier match gport.
  63526  * Returns:
  63527  *      BCM_E_XXX
  63528  * Notes:
  63529  */
  63530 int 
  63531 bcm_esw_field_qualify_SrcModPortGport(
  63532     int unit, 
  63533     bcm_field_entry_t entry, 
  63534     bcm_gport_t data)
  63535 {
  63536     return BCM_E_UNAVAIL; 
  63537 }
  63538 
  63539 /*
  63540  * Function:
  63541  *      bcm_esw_field_qualify_SrcModuleGport
  63542  * Purpose:
  63543  *      Set match criteria for bcmFieildQualifySrcModuleGport
  63544  *                     qualifier in the field entry.
  63545  * Parameters:
  63546  *      unit - (IN) Unit number.
  63547  *      entry - (IN) BCM field entry id.
  63548  *      data - (IN) Qualifier match gport.
  63549  * Returns:
  63550  *      BCM_E_XXX
  63551  * Notes:
  63552  */
  63553 int 
  63554 bcm_esw_field_qualify_SrcModuleGport(
  63555     int unit, 
  63556     bcm_field_entry_t entry, 
  63557     bcm_gport_t data)
  63558 {
  63559     return BCM_E_UNAVAIL; 
  63560 }
  63561 
  63562 
  63563 /*
  63564  * Function:
  63565  *      bcm_esw_field_qualify_TranslatedVlanFormat_get
  63566  * Purpose:
  63567  *      Get match criteria for bcmFieildQualifyTranslatedVlanFormat
  63568  *                     qualifier from the field entry.
  63569  * Parameters:
  63570  *      unit - (IN) Unit number.
  63571  *      entry - (IN) BCM field entry id.
  63572  *      data - (OUT) Qualifier match data.
  63573  *      mask - (OUT) Qualifier match mask.
  63574  * Returns:
  63575  *      BCM_E_XXX
  63576  * Notes:
  63577  */
  63578 int 
  63579 bcm_esw_field_qualify_TranslatedVlanFormat_get(
  63580     int unit, 
  63581     bcm_field_entry_t entry, 
  63582     uint8 *data, 
  63583     uint8 *mask)
  63584 {
  63585     return BCM_E_UNAVAIL; 
  63586 }
  63587 
  63588 /*
  63589  * Function:
  63590  *      bcm_esw_field_qualify_IntPriority_get
  63591  * Purpose:
  63592  *      Get match criteria for bcmFieildQualifyIntPriority
  63593  *                     qualifier from the field entry.
  63594  * Parameters:
  63595  *      unit - (IN) Unit number.
  63596  *      entry - (IN) BCM field entry id.
  63597  *      data - (OUT) Qualifier match data.
  63598  *      mask - (OUT) Qualifier match mask.
  63599  * Returns:
  63600  *      BCM_E_XXX
  63601  * Notes:
  63602  */
  63603 int 
  63604 bcm_esw_field_qualify_IntPriority_get(
  63605     int unit, 
  63606     bcm_field_entry_t entry, 
  63607     uint8 *data, 
  63608     uint8 *mask)
  63609 {
  63610     return BCM_E_UNAVAIL; 
  63611 }
  63612 
  63613 /*
  63614  * Function:
  63615  *      bcm_esw_field_qualify_Color_get
  63616  * Purpose:
  63617  *      Get match criteria for bcmFieildQualifyColor
  63618  *                     qualifier from the field entry.
  63619  * Parameters:
  63620  *      unit - (IN) Unit number.
  63621  *      entry - (IN) BCM field entry id.
  63622  *      color - (OUT) Qualifier match color.
  63623  * Returns:
  63624  *      BCM_E_XXX
  63625  * Notes:
  63626  */
  63627 int 
  63628 bcm_esw_field_qualify_Color_get(
  63629     int unit, 
  63630     bcm_field_entry_t entry, 
  63631     uint8 *color)
  63632 {
  63633     return BCM_E_UNAVAIL; 
  63634 }
  63635 
  63636 /*
  63637  * Function:
  63638  *      bcm_esw_field_qualify_FibreChannOuter_get
  63639  * Purpose:
  63640  *      Get Fibre Channel outer header type field qualification from a field entry.
  63641  * Parameters:
  63642  *      unit - (IN) Unit number.
  63643  *      entry - (IN) Field entry id.
  63644  *      fibre_chan_type - (OUT) Fibre Channel header type.
  63645  * Returns:
  63646  *      BCM_E_XXX
  63647  * Notes:
  63648  */
  63649 int 
  63650 bcm_esw_field_qualify_FibreChanOuter_get(
  63651     int unit, 
  63652     bcm_field_entry_t entry, 
  63653     bcm_field_FibreChan_t *fibre_chan_type)
  63654 {
  63655     return BCM_E_UNAVAIL; 
  63656 }
  63657 
  63658 /*
  63659  * Function:
  63660  *      bcm_esw_field_qualify_FibreChannInner_get
  63661  * Purpose:
  63662  *      Get Fibre Channel inner header type field qualification from a field entry.
  63663  * Parameters:
  63664  *      unit - (IN) Unit number.
  63665  *      entry - (IN) Field entry id.
  63666  *      fibre_chan_type - (OUT) Fibre Channel header type.
  63667  * Returns:
  63668  *      BCM_E_XXX
  63669  * Notes:
  63670  */
  63671 int 
  63672 bcm_esw_field_qualify_FibreChanInner_get(
  63673     int unit, 
  63674     bcm_field_entry_t entry, 
  63675     bcm_field_FibreChan_t *fibre_chan_type)
  63676 {
  63677     return BCM_E_UNAVAIL; 
  63678 }
  63679 
  63680 /*
  63681  * Function:
  63682  *      bcm_esw_field_qualify_VnTag_get
  63683  * Purpose:
  63684  *      Get match criteria for bcmFieldQualifyVnTag
  63685  *      qualifier from the field entry.
  63686  * Parameters:
  63687  *      unit - (IN) Unit number.
  63688  *      entry - (IN) BCM field entry id.
  63689  *      data - (OUT) Qualifier match data.
  63690  *      mask - (OUT) Qualifier match mask.
  63691  * Returns:
  63692  *      BCM_E_XXX
  63693  * Notes:
  63694  */
  63695 int 
  63696 bcm_esw_field_qualify_VnTag_get(
  63697     int unit, 
  63698     bcm_field_entry_t entry, 
  63699     uint32 *data, 
  63700     uint32 *mask)
  63701 {
  63702     return BCM_E_UNAVAIL; 
  63703 }
  63704 
  63705 /*
  63706  * Function:
  63707  *  bcm_esw_field_qualify_ETag_get
  63708  * Purpose:
  63709  *  Get match criteria for bcmFieldQualifyETag
  63710  *  qualifier from the field entry.
  63711  * Parameters:
  63712  *  unit - (IN) Unit number.
  63713  *  entry - (IN) BCM field entry id.
  63714  *  data - (OUT) Qualifier match data.
  63715  *  mask - (OUT) Qualifier match mask.
  63716  * Returns:
  63717  *  BCM_E_XXX
  63718  * Notes:
  63719  */
  63720 int
  63721 bcm_esw_field_qualify_ETag_get(int unit, bcm_field_entry_t entry,
  63722                                       uint64 *data, uint64 *mask)
  63723 {
  63724     return BCM_E_UNAVAIL;
  63725 }
  63726 
  63727 /*
  63728  * Function:
  63729  *      bcm_esw_field_qualify_SubportPktTag_get
  63730  * Purpose:
  63731  *      Get match criteria for bcmFieldQualifySubportPktTag
  63732  *      qualifier from the field entry.
  63733  * Parameters:
  63734  *      unit - (IN) Unit number.
  63735  *      entry - (IN) BCM field entry id.
  63736  *      data - (OUT) Qualifier match data.
  63737  *      mask - (OUT) Qualifier match mask.
  63738  * Returns:
  63739  *      BCM_E_XXX
  63740  * Notes:
  63741  */
  63742 int 
  63743 bcm_esw_field_qualify_SubportPktTag_get(
  63744     int unit, 
  63745     bcm_field_entry_t entry, 
  63746     uint16 *data, 
  63747     uint16 *mask)
  63748 {
  63749     return BCM_E_UNAVAIL; 
  63750 }
  63751 
  63752 /*
  63753  * Function:
  63754  *      bcm_esw_field_qualify_CnTag_get
  63755  * Purpose:
  63756  *      Get match criteria for bcmFieldQualifyCnTag
  63757  *      qualifier from the field entry.
  63758  * Parameters:
  63759  *      unit - (IN) Unit number.
  63760  *      entry - (IN) BCM field entry id.
  63761  *      data - (OUT) Qualifier match data.
  63762  *      mask - (OUT) Qualifier match mask.
  63763  * Returns:
  63764  *      BCM_E_XXX
  63765  * Notes:
  63766  */
  63767 int 
  63768 bcm_esw_field_qualify_CnTag_get(
  63769     int unit, 
  63770     bcm_field_entry_t entry, 
  63771     uint32 *data, 
  63772     uint32 *mask)
  63773 {
  63774     return BCM_E_UNAVAIL; 
  63775 }
  63776 
  63777 /*
  63778  * Function:
  63779  *      bcm_esw_field_qualify_FabricQueueTag_get
  63780  * Purpose:
  63781  *      Get match criteria for bcmFieldQualifyFabricQueueTag
  63782  *      qualifier from the field entry.
  63783  * Parameters:
  63784  *      unit - (IN) Unit number.
  63785  *      entry - (IN) BCM field entry id.
  63786  *      data - (OUT) Qualifier match data.
  63787  *      mask - (OUT) Qualifier match mask.
  63788  * Returns:
  63789  *      BCM_E_XXX
  63790  * Notes:
  63791  */
  63792 int 
  63793 bcm_esw_field_qualify_FabricQueueTag_get(
  63794     int unit, 
  63795     bcm_field_entry_t entry, 
  63796     uint32 *data, 
  63797     uint32 *mask)
  63798 {
  63799     return BCM_E_UNAVAIL; 
  63800 }
  63801 
  63802 /*
  63803  * Function:
  63804  *      bcm_esw_field_qualify_SrcModPortGport_get
  63805  * Purpose:
  63806  *      Get match criteria for bcmFieildQualifySrcModPortGport
  63807  *                     qualifier from the field entry.
  63808  * Parameters:
  63809  *      unit - (IN) Unit number.
  63810  *      entry - (IN) BCM field entry id.
  63811  *      data - (OUT) Qualifier match gport.
  63812  * Returns:
  63813  *      BCM_E_XXX
  63814  * Notes:
  63815  */
  63816 int 
  63817 bcm_esw_field_qualify_SrcModPortGport_get(
  63818     int unit, 
  63819     bcm_field_entry_t entry, 
  63820     bcm_gport_t *data)
  63821 {
  63822     return BCM_E_UNAVAIL; 
  63823 }
  63824 
  63825 /*
  63826  * Function:
  63827  *      bcm_esw_field_qualify_SrcModuleGport_get
  63828  * Purpose:
  63829  *      Get match criteria for bcmFieildQualifySrcModuleGport
  63830  *                     qualifier from the field entry.
  63831  * Parameters:
  63832  *      unit - (IN) Unit number.
  63833  *      entry - (IN) BCM field entry id.
  63834  *      data - (OUT) Qualifier match gport.
  63835  * Returns:
  63836  *      BCM_E_XXX
  63837  * Notes:
  63838  */
  63839 int 
  63840 bcm_esw_field_qualify_SrcModuleGport_get(
  63841     int unit, 
  63842     bcm_field_entry_t entry, 
  63843     bcm_gport_t *data)
  63844 {
  63845     return BCM_E_UNAVAIL; 
  63846 }
  63847 
  63848 /*
  63849  * Function:
  63850  *      bcm_esw_field_qualifier_delete
  63851  * Purpose:
  63852  *      Remove match criteria from a field processor entry.
  63853  * Parameters:
  63854  *      unit - (IN) Unit number.
  63855  *      entry - (IN) BCM field entry id.
  63856  *      qual_id - (IN) BCM field qualifier id.
  63857  * Returns:
  63858  *      BCM_E_XXX
  63859  * Notes:
  63860  */
  63861 int 
  63862 bcm_esw_field_qualifier_delete(
  63863     int unit, 
  63864     bcm_field_entry_t entry, 
  63865     bcm_field_qualify_t qual_id)
  63866 {
  63867     return BCM_E_UNAVAIL; 
  63868 }
  63869 
  63870 
  63871 /* Function: bcm_esw_field_group_wlan_create_mode
  63872  *     
  63873  * Purpose:
  63874  *     Create a wlan field group with a mode (single, double, etc.).
  63875  *
  63876  * Parameters:
  63877  *     unit - BCM device number.
  63878  *     qset - Field qualifier set
  63879  *     pri  - Priority within allowable range,
  63880  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
  63881  *            priority; each priority value may be used only once
  63882  *    mode  - Group mode (single, double, triple or Auto-wide)
  63883  *    group - (OUT) field Group ID
  63884  *
  63885  * Returns:
  63886  *     BCM_E_INIT      - BCM unit not initialized
  63887  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
  63888  *     BCM_E_NONE      - Success
  63889  */
  63890 int
  63891 bcm_esw_field_group_wlan_create_mode(int unit, bcm_field_qset_t qset, int pri,
  63892                                      bcm_field_group_mode_t mode,
  63893                                      bcm_field_group_t *group)
  63894 {
  63895     return BCM_E_UNAVAIL; 
  63896 }
  63897 
  63898 /* Function: bcm_esw_field_group_wlan_create_mode_id
  63899  *     
  63900  * Purpose:
  63901  *     Create a wlan field group with a mode (single, double, etc.).
  63902  *
  63903  * Parameters:
  63904  *     unit - BCM device number.
  63905  *     qset - Field qualifier set
  63906  *     pri  - Priority within allowable range,
  63907  *            or BCM_FIELD_GROUP_PRIO_ANY to automatically assign a
  63908  *            priority; each priority value may be used only once
  63909  *    mode  - Group mode (single, double, triple or Auto-wide)
  63910  *    group - (OUT) field Group ID
  63911  *
  63912  * Returns:
  63913  *     BCM_E_INIT      - BCM unit not initialized
  63914  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
  63915  *     BCM_E_NONE      - Success
  63916  */
  63917 int
  63918 bcm_esw_field_group_wlan_create_mode_id(int unit, bcm_field_qset_t qset, int pri,
  63919                                         bcm_field_group_mode_t mode,
  63920                                         bcm_field_group_t group)
  63921 {
  63922     return BCM_E_UNAVAIL; 
  63923 }
  63924 
  63925 /*
  63926  * Function:
  63927  *      bcm_esw_field_qualify_OuterVlanId
  63928  * Purpose:
  63929  *       Set match criteria for bcmFieildQualifyOuterVlanId
  63930  *                       qualifier in the field entry.
  63931  * Parameters:
  63932  *      unit - (IN) Unit number.
  63933  *      entry - (IN) BCM field entry id.
  63934  *      data - (IN) Qualifier match data.
  63935  *      mask - (IN) Qualifier match data.
  63936  * Returns:
  63937  *      BCM_E_XXX
  63938  * Notes:
  63939  */
  63940 int 
  63941 bcm_esw_field_qualify_OuterVlanId(
  63942     int unit, 
  63943     bcm_field_entry_t entry, 
  63944     bcm_vlan_t data, 
  63945     bcm_vlan_t mask)
  63946 {
  63947     return BCM_E_UNAVAIL; 
  63948 }
  63949 
  63950 
  63951 /*
  63952  * Function:
  63953  *      bcm_esw_field_qualify_OuterVlanPri
  63954  * Purpose:
  63955  *       Set match criteria for bcmFieildQualifyOuterVlanPri
  63956  *                       qualifier in the field entry.
  63957  * Parameters:
  63958  *      unit - (IN) Unit number.
  63959  *      entry - (IN) BCM field entry id.
  63960  *      data - (IN) Qualifier match data.
  63961  *      mask - (IN) Qualifier match data.
  63962  * Returns:
  63963  *      BCM_E_XXX
  63964  * Notes:
  63965  */
  63966 int 
  63967 bcm_esw_field_qualify_OuterVlanPri(
  63968     int unit, 
  63969     bcm_field_entry_t entry, 
  63970     uint8 data, 
  63971     uint8 mask)
  63972 {
  63973     return BCM_E_UNAVAIL; 
  63974 }
  63975 
  63976 
  63977 /*
  63978  * Function:
  63979  *      bcm_esw_field_qualify_OuterVlanCfi
  63980  * Purpose:
  63981  *       Set match criteria for bcmFieildQualifyOuterVlanCfi
  63982  *                       qualifier in the field entry.
  63983  * Parameters:
  63984  *      unit - (IN) Unit number.
  63985  *      entry - (IN) BCM field entry id.
  63986  *      data - (IN) Qualifier match data.
  63987  *      mask - (IN) Qualifier match data.
  63988  * Returns:
  63989  *      BCM_E_XXX
  63990  * Notes:
  63991  */
  63992 int 
  63993 bcm_esw_field_qualify_OuterVlanCfi(
  63994     int unit, 
  63995     bcm_field_entry_t entry, 
  63996     uint8 data, 
  63997     uint8 mask)
  63998 {
  63999     return BCM_E_UNAVAIL; 
  64000 }
  64001 
  64002 /*
  64003  * Function:
  64004  *      bcm_esw_field_qualify_InnerVlanId
  64005  * Purpose:
  64006  *       Set match criteria for bcmFieildQualifyInnerVlanId
  64007  *                       qualifier in the field entry.
  64008  * Parameters:
  64009  *      unit - (IN) Unit number.
  64010  *      entry - (IN) BCM field entry id.
  64011  *      data - (IN) Qualifier match data.
  64012  *      mask - (IN) Qualifier match data.
  64013  * Returns:
  64014  *      BCM_E_XXX
  64015  * Notes:
  64016  */
  64017 int 
  64018 bcm_esw_field_qualify_InnerVlanId(
  64019     int unit, 
  64020     bcm_field_entry_t entry, 
  64021     bcm_vlan_t data, 
  64022     bcm_vlan_t mask)
  64023 {
  64024     return BCM_E_UNAVAIL; 
  64025 }
  64026 
  64027 
  64028 /*
  64029  * Function:
  64030  *      bcm_esw_field_qualify_InnerVlanPri
  64031  * Purpose:
  64032  *       Set match criteria for bcmFieildQualifyInnerVlanPri
  64033  *                       qualifier in the field entry.
  64034  * Parameters:
  64035  *      unit - (IN) Unit number.
  64036  *      entry - (IN) BCM field entry id.
  64037  *      data - (IN) Qualifier match data.
  64038  *      mask - (IN) Qualifier match data.
  64039  * Returns:
  64040  *      BCM_E_XXX
  64041  * Notes:
  64042  */
  64043 int 
  64044 bcm_esw_field_qualify_InnerVlanPri(
  64045     int unit, 
  64046     bcm_field_entry_t entry, 
  64047     uint8 data, 
  64048     uint8 mask)
  64049 {
  64050     return BCM_E_UNAVAIL; 
  64051 }
  64052 
  64053 /*
  64054  * Function:
  64055  *      bcm_esw_field_qualify_InnerVlanCfi
  64056  * Purpose:
  64057  *       Set match criteria for bcmFieildQualifyInnerVlanCfi
  64058  *                       qualifier in the field entry.
  64059  * Parameters:
  64060  *      unit - (IN) Unit number.
  64061  *      entry - (IN) BCM field entry id.
  64062  *      data - (IN) Qualifier match data.
  64063  *      mask - (IN) Qualifier match data.
  64064  * Returns:
  64065  *      BCM_E_XXX
  64066  * Notes:
  64067  */
  64068 int 
  64069 bcm_esw_field_qualify_InnerVlanCfi(
  64070     int unit, 
  64071     bcm_field_entry_t entry, 
  64072     uint8 data, 
  64073     uint8 mask)
  64074 {
  64075     return BCM_E_UNAVAIL; 
  64076 }
  64077 
  64078 /*
  64079  * Function:
  64080  *      bcm_esw_field_qualify_OuterVlanId_get
  64081  * Purpose:
  64082  *       Get match criteria for bcmFieildQualifyOuterVlanId
  64083  *                       qualifier from the field entry.
  64084  * Parameters:
  64085  *      unit - (IN) Unit number.
  64086  *      entry - (IN) BCM field entry id.
  64087  *      data - (OUT) Qualifier match data.
  64088  *      mask - (OUT) Qualifier match data.
  64089  * Returns:
  64090  *      BCM_E_XXX
  64091  * Notes:
  64092  */
  64093 int 
  64094 bcm_esw_field_qualify_OuterVlanId_get(
  64095     int unit, 
  64096     bcm_field_entry_t entry, 
  64097     bcm_vlan_t *data, 
  64098     bcm_vlan_t *mask)
  64099 {
  64100     return BCM_E_UNAVAIL; 
  64101 }
  64102 
  64103 
  64104 /*
  64105  * Function:
  64106  *      bcm_esw_field_qualify_OuterVlanPri_get
  64107  * Purpose:
  64108  *       Get match criteria for bcmFieildQualifyOuterVlanPri
  64109  *                       qualifier from the field entry.
  64110  * Parameters:
  64111  *      unit - (IN) Unit number.
  64112  *      entry - (IN) BCM field entry id.
  64113  *      data - (OUT) Qualifier match data.
  64114  *      mask - (OUT) Qualifier match mask.
  64115  * Returns:
  64116  *      BCM_E_XXX
  64117  * Notes:
  64118  */
  64119 int 
  64120 bcm_esw_field_qualify_OuterVlanPri_get(
  64121     int unit, 
  64122     bcm_field_entry_t entry, 
  64123     uint8 *data, 
  64124     uint8 *mask)
  64125 {
  64126     return BCM_E_UNAVAIL; 
  64127 }
  64128 
  64129 /*
  64130  * Function:
  64131  *      bcm_esw_field_qualify_OuterVlanCfi_get
  64132  * Purpose:
  64133  *       Get match criteria for bcmFieildQualifyOuterVlanCfi_get
  64134  *                       qualifier from the field entry.
  64135  * Parameters:
  64136  *      unit - (IN) Unit number.
  64137  *      entry - (IN) BCM field entry id.
  64138  *      data - (OUT) Qualifier match data.
  64139  *      mask - (OUT) Qualifier match mask.
  64140  * Returns:
  64141  *      BCM_E_XXX
  64142  * Notes:
  64143  */
  64144 int 
  64145 bcm_esw_field_qualify_OuterVlanCfi_get(
  64146     int unit, 
  64147     bcm_field_entry_t entry, 
  64148     uint8 *data, 
  64149     uint8 *mask)
  64150 {
  64151     return BCM_E_UNAVAIL; 
  64152 }
  64153 
  64154 /*
  64155  * Function:
  64156  *      bcm_esw_field_qualify_InnerVlanId_get
  64157  * Purpose:
  64158  *       Get match criteria for bcmFieildQualifyInnerVlanId
  64159  *                       qualifier from the field entry.
  64160  * Parameters:
  64161  *      unit - (IN) Unit number.
  64162  *      entry - (IN) BCM field entry id.
  64163  *      data - (OUT) Qualifier match data.
  64164  *      mask - (OUT) Qualifier match mask.
  64165  * Returns:
  64166  *      BCM_E_XXX
  64167  * Notes:
  64168  */
  64169 int 
  64170 bcm_esw_field_qualify_InnerVlanId_get(
  64171     int unit, 
  64172     bcm_field_entry_t entry, 
  64173     bcm_vlan_t *data, 
  64174     bcm_vlan_t *mask)
  64175 {
  64176     return BCM_E_UNAVAIL; 
  64177 }
  64178 
  64179 
  64180 /*
  64181  * Function:
  64182  *      bcm_esw_field_qualify_InnerVlanPri_get
  64183  * Purpose:
  64184  *       Get match criteria for bcmFieildQualifyInnerVlanPri
  64185  *                       qualifier from the field entry.
  64186  * Parameters:
  64187  *      unit - (IN) Unit number.
  64188  *      entry - (IN) BCM field entry id.
  64189  *      data - (OUT) Qualifier match data.
  64190  *      mask - (OUT) Qualifier match mask.
  64191  * Returns:
  64192  *      BCM_E_XXX
  64193  * Notes:
  64194  */
  64195 int 
  64196 bcm_esw_field_qualify_InnerVlanPri_get(
  64197     int unit, 
  64198     bcm_field_entry_t entry, 
  64199     uint8 *data, 
  64200     uint8 *mask)
  64201 {
  64202     return BCM_E_UNAVAIL; 
  64203 }
  64204 
  64205 /*
  64206  * Function:
  64207  *      bcm_esw_field_qualify_InnerVlanCfi_get
  64208  * Purpose:
  64209  *       Get match criteria for bcmFieildQualifyInnerVlanCfi_get
  64210  *                       qualifier from the field entry.
  64211  * Parameters:
  64212  *      unit - (IN) Unit number.
  64213  *      entry - (IN) BCM field entry id.
  64214  *      data - (OUT) Qualifier match data.
  64215  *      mask - (OUT) Qualifier match mask.
  64216  * Returns:
  64217  *      BCM_E_XXX
  64218  * Notes:
  64219  */
  64220 int 
  64221 bcm_esw_field_qualify_InnerVlanCfi_get(
  64222     int unit, 
  64223     bcm_field_entry_t entry, 
  64224     uint8 *data, 
  64225     uint8 *mask)
  64226 {
  64227     return BCM_E_UNAVAIL; 
  64228 }
  64229 
  64230 /*
  64231  * Function:
  64232  *      bcm_esw_field_qualify_DstHiGig
  64233  * Purpose:
  64234  *      Qualify on HiGig destination packets.
  64235  * Parameters:
  64236  *      unit - (IN) Unit number.
  64237  *      entry - (IN) BCM field entry id.
  64238  *      data - (IN) Qualifier match data.
  64239  *      mask - (IN) Qualifier match mask.
  64240  * Returns:
  64241  *      BCM_E_XXX
  64242  * Notes:
  64243  */
  64244 int 
  64245 bcm_esw_field_qualify_DstHiGig(
  64246     int unit, 
  64247     bcm_field_entry_t entry, 
  64248     uint8 data, 
  64249     uint8 mask)
  64250 {
  64251     return BCM_E_UNAVAIL; 
  64252 }
  64253 
  64254 /*
  64255  * Function:
  64256  *      bcm_esw_field_qualify_DstHiGig_get
  64257  * Purpose:
  64258  *      Get match criteria for bcmFieildQualifyDstHiGig
  64259  *                     qualifier from the field entry.
  64260  * Parameters:
  64261  *      unit - (IN) Unit number.
  64262  *      entry - (IN) BCM field entry id.
  64263  *      data - (OUT) Qualifier match data.
  64264  *      mask - (OUT) Qualifier match mask.
  64265  * Returns:
  64266  *      BCM_E_XXX
  64267  * Notes:
  64268  */
  64269 int 
  64270 bcm_esw_field_qualify_DstHiGig_get(
  64271     int unit, 
  64272     bcm_field_entry_t entry, 
  64273     uint8 *data, 
  64274     uint8 *mask)
  64275 {
  64276     return BCM_E_UNAVAIL; 
  64277 }
  64278 
  64279 /*
  64280  * Function:
  64281  *      bcm_esw_field_qualify_ForwardingVlanId_get
  64282  * Purpose:
  64283  *       Get match criteria for bcmFieildQualifyForwardingVlanId
  64284  *                       qualifier from the field entry.
  64285  * Parameters:
  64286  *      unit - (IN) Unit number.
  64287  *      entry - (IN) BCM field entry id.
  64288  *      data - (OUT) Qualifier match data.
  64289  *      mask - (OUT) Qualifier match data.
  64290  * Returns:
  64291  *      BCM_E_XXX
  64292  * Notes:
  64293  */
  64294 int 
  64295 bcm_esw_field_qualify_ForwardingVlanId_get(
  64296     int unit, 
  64297     bcm_field_entry_t entry, 
  64298     bcm_vlan_t *data, 
  64299     bcm_vlan_t *mask)
  64300 {
  64301     return BCM_E_UNAVAIL; 
  64302 }
  64303 
  64304 /*
  64305  * Function:
  64306  *      bcm_esw_field_qualify_Vpn_get
  64307  * Purpose:
  64308  *       Get match criteria for bcmFieildQualifyVpn
  64309  *                       qualifier from the field entry.
  64310  * Parameters:
  64311  *      unit - (IN) Unit number.
  64312  *      entry - (IN) BCM field entry id.
  64313  *      data - (OUT) Qualifier match data.
  64314  *      mask - (OUT) Qualifier match data.
  64315  * Returns:
  64316  *      BCM_E_XXX
  64317  * Notes:
  64318  */
  64319 int 
  64320 bcm_esw_field_qualify_Vpn_get(
  64321     int unit, 
  64322     bcm_field_entry_t entry, 
  64323     bcm_vpn_t *data, 
  64324     bcm_vpn_t *mask)
  64325 {
  64326     return BCM_E_UNAVAIL; 
  64327 }
  64328 
  64329 
  64330 /*
  64331  * Function:
  64332  *      bcm_esw_field_qualify_ForwardingVlanId
  64333  * Purpose:
  64334  *      Set match criteria for bcmFieildQualifyForwardingVlanId
  64335  *      qualifier in the field entry.
  64336  * Parameters:
  64337  *      unit - (IN) Unit number.
  64338  *      entry - (IN) BCM field entry id.
  64339  *      data - (IN) Qualifier match data.
  64340  *      mask - (IN) Qualifier match data.
  64341  * Returns:
  64342  *      BCM_E_XXX
  64343  * Notes:
  64344  */
  64345 int 
  64346 bcm_esw_field_qualify_ForwardingVlanId(
  64347     int unit, 
  64348     bcm_field_entry_t entry, 
  64349     bcm_vlan_t data, 
  64350     bcm_vlan_t mask)
  64351 {
  64352     return BCM_E_UNAVAIL; 
  64353 }
  64354 
  64355 
  64356 /*
  64357  * Function:
  64358  *      bcm_esw_field_qualify_Vpn
  64359  * Purpose:
  64360  *      Set match criteria for bcmFieildQualifyVpn
  64361  *      qualifier in the field entry.
  64362  * Parameters:
  64363  *      unit - (IN) Unit number.
  64364  *      entry - (IN) BCM field entry id.
  64365  *      data - (IN) Qualifier match data.
  64366  *      mask - (IN) Qualifier match data.
  64367  * Returns:
  64368  *      BCM_E_XXX
  64369  * Notes:
  64370  */
  64371 int 
  64372 bcm_esw_field_qualify_Vpn(
  64373     int unit, 
  64374     bcm_field_entry_t entry, 
  64375     bcm_vpn_t data, 
  64376     bcm_vpn_t mask)
  64377 {
  64378     return BCM_E_UNAVAIL; 
  64379 }
  64380 /*
  64381  * Function:
  64382  *      bcm_esw_field_qualify_FlowId
  64383  * Purpose:
  64384  *      Set match criteria for bcmFieildQualifyFlowId
  64385  *      qualifier in the field entry.
  64386  * Parameters:
  64387  *      unit - (IN) Unit number.
  64388  *      entry - (IN) BCM field entry id.
  64389  *      data - (IN) Qualifier match data.
  64390  *      mask - (IN) Qualifier match data.
  64391  * Returns:
  64392  *      BCM_E_XXX
  64393  * Notes:
  64394  */
  64395 
  64396 int 
  64397 bcm_esw_field_qualify_FlowId(int unit, bcm_field_entry_t entry,
  64398                  uint16 data, uint16 mask)
  64399 {
  64400     return BCM_E_UNAVAIL; 
  64401 }
  64402 /*
  64403  * Function:
  64404  *      bcm_esw_field_qualify_InVPort
  64405  * Purpose:
  64406  *      Set match criteria for bcmFieildQualifyInVPort
  64407  *      qualifier in the field entry.
  64408  * Parameters:
  64409  *      unit - (IN) Unit number.
  64410  *      entry - (IN) BCM field entry id.
  64411  *      data - (IN) Qualifier match data.
  64412  *      mask - (IN) Qualifier match data.
  64413  * Returns:
  64414  *      BCM_E_XXX
  64415  * Notes:
  64416  */
  64417 
  64418 int 
  64419 bcm_esw_field_qualify_InVPort(int unit, bcm_field_entry_t entry,
  64420                  uint8 data, uint8 mask)
  64421 {
  64422     return BCM_E_UNAVAIL; 
  64423 }
  64424 /*
  64425  * Function:
  64426  *      bcm_esw_field_qualify_OutVPort
  64427  * Purpose:
  64428  *      Set match criteria for bcmFieildQualifyOutVPort
  64429  *      qualifier in the field entry.
  64430  * Parameters:
  64431  *      unit - (IN) Unit number.
  64432  *      entry - (IN) BCM field entry id.
  64433  *      data - (IN) Qualifier match data.
  64434  *      mask - (IN) Qualifier match data.
  64435  * Returns:
  64436  *      BCM_E_XXX
  64437  * Notes:
  64438  */
  64439 
  64440 int 
  64441 bcm_esw_field_qualify_OutVPort(int unit, bcm_field_entry_t entry,
  64442                  uint8 data, uint8 mask)
  64443 {
  64444     return BCM_E_UNAVAIL; 
  64445 }
  64446 
  64447 /*
  64448  * Function:
  64449  *      bcm_esw_field_qualify_FlowId_get
  64450  * Purpose:
  64451  *      Get match criteria for bcmFieildQualifyFlowId
  64452  *                     qualifier from the field entry.
  64453  * Parameters:
  64454  *      unit - (IN) Unit number.
  64455  *      entry - (IN) BCM field entry id.
  64456  *      data - (OUT) Qualifier match data.
  64457  *      mask - (OUT) Qualifier match mask.
  64458  * Returns:
  64459  *      BCM_E_XXX
  64460  * Notes:
  64461  */
  64462 int 
  64463 bcm_esw_field_qualify_FlowId_get(int unit, bcm_field_entry_t entry,
  64464                  uint16 *data, uint16 *mask)
  64465 {
  64466     return BCM_E_UNAVAIL;
  64467 }
  64468 
  64469 /*
  64470  * Function:
  64471  *      bcm_esw_field_qualify_InVPort_get
  64472  * Purpose:
  64473  *      Get match criteria for bcmFieildQualifyInVPort
  64474  *                     qualifier from the field entry.
  64475  * Parameters:
  64476  *      unit - (IN) Unit number.
  64477  *      entry - (IN) BCM field entry id.
  64478  *      data - (OUT) Qualifier match data.
  64479  *      mask - (OUT) Qualifier match mask.
  64480  * Returns:
  64481  *      BCM_E_XXX
  64482  * Notes:
  64483  */
  64484 int 
  64485 bcm_esw_field_qualify_InVPort_get(int unit, bcm_field_entry_t entry,
  64486                  uint8 *data, uint8 *mask)
  64487 {
  64488     return BCM_E_UNAVAIL;
  64489 }
  64490 
  64491 /*
  64492  * Function:
  64493  *      bcm_esw_field_qualify_OutVPort_get
  64494  * Purpose:
  64495  *      Get match criteria for bcmFieildQualifyOutVPort
  64496  *                     qualifier from the field entry.
  64497  * Parameters:
  64498  *      unit - (IN) Unit number.
  64499  *      entry - (IN) BCM field entry id.
  64500  *      data - (OUT) Qualifier match data.
  64501  *      mask - (OUT) Qualifier match mask.
  64502  * Returns:
  64503  *      BCM_E_XXX
  64504  * Notes:
  64505  */
  64506 int 
  64507 bcm_esw_field_qualify_OutVPort_get(int unit, bcm_field_entry_t entry,
  64508                  uint8 *data, uint8 *mask)
  64509 {
  64510     return BCM_E_UNAVAIL;
  64511 }
  64512 
  64513 /*
  64514  * Function:
  64515  *      bcm_esw_field_qualify_IntCongestionNotification
  64516  * Purpose:
  64517  *      Set match criteria for IntCongestionNotification
  64518  *                     qualifier from the field entry.
  64519  * Parameters:
  64520  *      unit - (IN) Unit number.
  64521  *      entry - (IN) BCM field entry id.
  64522  *      data - (IN) Qualifier match data.
  64523  *      mask - (IN) Qualifier match mask.
  64524  * Returns:
  64525  *      BCM_E_XXX
  64526  * Notes:
  64527  */
  64528 
  64529 int 
  64530 bcm_esw_field_qualify_IntCongestionNotification(int unit, 
  64531     bcm_field_entry_t entry, uint8 data, uint8 mask)
  64532 {
  64533     return BCM_E_UNAVAIL;
  64534 }
  64535 
  64536 /*
  64537  * Function:
  64538  *      bcm_esw_field_qualify_IntCongestionNotification_get
  64539  * Purpose:
  64540  *      Get match criteria for IntCongestionNotification
  64541  *                     qualifier from the field entry.
  64542  * Parameters:
  64543  *      unit - (IN) Unit number.
  64544  *      entry - (IN) BCM field entry id.
  64545  *      data - (OUT) Qualifier match data.
  64546  *      mask - (OUT) Qualifier match mask.
  64547  * Returns:
  64548  *      BCM_E_XXX
  64549  * Notes:
  64550  */
  64551 
  64552 int 
  64553 bcm_esw_field_qualify_IntCongestionNotification_get(int unit, 
  64554     bcm_field_entry_t entry, uint8 *data, uint8 *mask)
  64555 {
  64556     return BCM_E_UNAVAIL;
  64557 }
  64558 
  64559 /*
  64560  * Function:
  64561  *      bcm_esw_field_action_class_add
  64562  * Purpose:
  64563  *      Add an action to a field class entry.
  64564  * Parameters:
  64565  *      unit - (IN) Unit number.
  64566  *      entry - (IN) Field entry Id.
  64567  *      class_info - (IN) Field Class Info.
  64568  * Returns:
  64569  *      BCM_E_XXX
  64570  * Notes:
  64571  */
  64572 int
  64573 bcm_esw_field_action_class_add(
  64574         int unit,
  64575         bcm_field_entry_t entry,
  64576         bcm_field_class_info_t *class_info)
  64577 {
  64578     return BCM_E_UNAVAIL;
  64579 }
  64580 
  64581 /*
  64582  * Function:
  64583  *      bcm_esw_field_action_class_get
  64584  * Purpose:
  64585  *      Retrieve the parameters for an action previously added to a
  64586  *      field entry.
  64587  * Parameters:
  64588  *      unit - (IN) Unit number.
  64589  *      entry - (IN) Field entry Id.
  64590  *      class_info - (INOUT) Field Class Info.
  64591  * Returns:
  64592  *      BCM_E_XXX
  64593  * Notes:
  64594  */
  64595 int
  64596 bcm_esw_field_action_class_get(
  64597         int unit,
  64598         bcm_field_entry_t entry,
  64599         bcm_field_class_info_t *class_info)
  64600 {
  64601     return BCM_E_UNAVAIL;
  64602 }
  64603 
  64604 /*
  64605  * Function:
  64606  *      bcm_esw_field_action_mac_add
  64607  * Purpose:
  64608  *      Add an action to a field entry.
  64609  * Parameters:
  64610  *      unit - (IN) Unit number.
  64611  *      entry - (IN) Field entry Id.
  64612  *      action - (IN) Field action id.
  64613  *      mac - (IN) Field action parameter.
  64614  * Returns:
  64615  *      BCM_E_XXX
  64616  * Notes:
  64617  */
  64618 int 
  64619 bcm_esw_field_action_mac_add(
  64620     int unit, 
  64621     bcm_field_entry_t entry, 
  64622     bcm_field_action_t action, 
  64623     bcm_mac_t mac)
  64624 {
  64625     return BCM_E_UNAVAIL; 
  64626 }
  64627 
  64628 /*
  64629  * Function:
  64630  *      bcm_esw_field_action_mac_get
  64631  * Purpose:
  64632  *      Retrieve the parameters for an action previously added to a
  64633  *      field entry.
  64634  * Parameters:
  64635  *      unit - (IN) Unit number.
  64636  *      entry - (IN) Field entry Id.
  64637  *      action - (IN) Field action id.
  64638  *      mac - (IN) Field action argument.
  64639  * Returns:
  64640  *      BCM_E_XXX
  64641  * Notes:
  64642  */
  64643 int 
  64644 bcm_esw_field_action_mac_get(
  64645     int unit, 
  64646     bcm_field_entry_t entry, 
  64647     bcm_field_action_t action, 
  64648     bcm_mac_t *mac)
  64649 {
  64650     return BCM_E_UNAVAIL; 
  64651 }
  64652 
  64653 /*
  64654  * Function:
  64655  *      bcm_esw_field_group_traverse
  64656  * Purpose:
  64657  *      Traverse all the fp groups in the system, calling a specified
  64658  *      callback for each one
  64659  * Parameters:
  64660  *      unit - (IN) Unit number.
  64661  *      callback - (IN) A pointer to the callback function to call for each fp group
  64662  *      user_data - (IN) Pointer to user data to supply in the callback
  64663  * Returns:
  64664  *      BCM_E_xxx
  64665  * Notes:
  64666  */
  64667 int 
  64668 bcm_esw_field_group_traverse(int unit, bcm_field_group_traverse_cb callback,
  64669                              void *user_data)
  64670 {
  64671     return BCM_E_UNAVAIL; 
  64672 }
  64673 
  64674 /* Function: bcm_esw_field_group_config_create
  64675  *
  64676  * Purpose:
  64677  *     Create a group with a mode (single, double, etc.), a port bitmap,
  64678  *     group size and a Group ID. 
  64679  * Parameters:
  64680  *     unit - BCM device number.
  64681  *     group_config - Group create attributes namely:
  64682  *          flags       - (IN) Bits indicate which parameters have been
  64683  *                             passed to API and should be used during group
  64684  *                             creation.
  64685  *          qset        - (IN) Field qualifier set
  64686  *          priority    - (IN) Priority within allowable range,
  64687  *                             or BCM_FIELD_GROUP_PRIO_ANY to automatically
  64688  *                             assign a priority; each priority value may be
  64689  *                             used only once
  64690  *          mode        - (IN) Group mode (single, double, triple or Auto-wide)
  64691  *          ports       - (IN) Ports where group is defined
  64692  *          group       - (IN/OUT) Requested Group ID. If Group ID is not set,
  64693  *                              then API allocates and returns the created
  64694  *                              Group ID.
  64695  * Returns:
  64696  *     BCM_E_INIT      - BCM unit not initialized
  64697  *     BCM_E_RESOURCE  - no select codes will satisfy qualifier set
  64698  *     BCM_E_NONE      - Success
  64699  */
  64700 int
  64701 bcm_esw_field_group_config_create(int unit,
  64702                                   bcm_field_group_config_t *group_config)
  64703 {
  64704     return BCM_E_UNAVAIL; 
  64705 }
  64706 
  64707 /*
  64708  * Function:
  64709  *      bcm_esw_field_qualify_CpuQueue
  64710  * Purpose:
  64711  *      Get match criteria for bcmFieldQualifyCpuQueue 
  64712  *      qualifier from the field entry.
  64713  * Parameters:
  64714  *      unit    - (IN) Unit number.
  64715  *      entry   - (IN) BCM field entry id.
  64716  *      data    - (IN) CPU COS queue value.
  64717  *      mask    - (IN) CPU COS match mask value.
  64718  * Returns:
  64719  *      BCM_E_XXX
  64720  * Notes:
  64721  */
  64722 int
  64723 bcm_esw_field_qualify_CpuQueue(int unit,
  64724                                bcm_field_entry_t entry,
  64725                                uint8 data,
  64726                                uint8 mask)
  64727 {
  64728     return BCM_E_UNAVAIL; 
  64729 }
  64730 
  64731 /*
  64732  * Function:
  64733  *      bcm_esw_field_qualify_CpuQueue_get
  64734  * Purpose:
  64735  *      Get match criteria for bcmFieldQualifyCpuQueue
  64736  *      qualifier from the field entry.
  64737  * Parameters:
  64738  *      unit  - (IN) Unit number.
  64739  *      entry - (IN) BCM field entry id.
  64740  *      data  - (OUT) CPU COS Queue matched value.
  64741  *      mask  - (OUT) CPU COS Queue matched mask value.
  64742  * Returns:
  64743  *      BCM_E_XXX
  64744  * Notes:
  64745  */
  64746 int
  64747 bcm_esw_field_qualify_CpuQueue_get(int unit,
  64748                                    bcm_field_entry_t entry,
  64749                                    uint8 *data,
  64750                                    uint8 *mask)
  64751 {
  64752     return BCM_E_UNAVAIL; 
  64753 }
  64754 
  64755 /* 
  64756  * Set match criteria for RecoverableDrop
  64757  *                qualifier.
  64758  */
  64759 int bcm_esw_field_qualify_RecoverableDrop(
  64760     int unit, 
  64761     bcm_field_entry_t entry, 
  64762     uint8 data, 
  64763     uint8 mask)
  64764 {
  64765     return BCM_E_UNAVAIL;
  64766 }
  64767 
  64768 
  64769 /* 
  64770  * Get match criteria for RecoverableDrop
  64771  *                qualifier.
  64772  */
  64773 int bcm_esw_field_qualify_RecoverableDrop_get(
  64774     int unit, 
  64775     bcm_field_entry_t entry, 
  64776     uint8 *data, 
  64777     uint8 *mask)
  64778 {
  64779     return BCM_E_UNAVAIL;
  64780 }
  64781 
  64782 
  64783 /* 
  64784  * Set match criteria for RepCopy
  64785  *                qualifier.
  64786  */
  64787 int bcm_esw_field_qualify_RepCopy(
  64788     int unit, 
  64789     bcm_field_entry_t entry, 
  64790     uint8 data, 
  64791     uint8 mask)
  64792 {
  64793     return BCM_E_UNAVAIL;
  64794 }
  64795 
  64796 
  64797 /* 
  64798  * Get match criteria for RepCopy
  64799  *                qualifier.
  64800  */
  64801 int bcm_esw_field_qualify_RepCopy_get(
  64802     int unit, 
  64803     bcm_field_entry_t entry, 
  64804     uint8 *data, 
  64805     uint8 *mask)
  64806 {
  64807     return BCM_E_UNAVAIL;
  64808 }
  64809 
  64810 
  64811 /* 
  64812  * Set match criteria for IpTunnelHit
  64813  *                qualifier.
  64814  */
  64815 int bcm_esw_field_qualify_IpTunnelHit(
  64816     int unit, 
  64817     bcm_field_entry_t entry, 
  64818     uint8 data, 
  64819     uint8 mask)
  64820 {
  64821     return BCM_E_UNAVAIL;
  64822 }
  64823 
  64824 
  64825 /* 
  64826  * Get match criteria for IpTunnelHit
  64827  *                qualifier.
  64828  */
  64829 int bcm_esw_field_qualify_IpTunnelHit_get(
  64830     int unit, 
  64831     bcm_field_entry_t entry, 
  64832     uint8 *data, 
  64833     uint8 *mask)
  64834 {
  64835     return BCM_E_UNAVAIL;
  64836 }
  64837 
  64838 
  64839 /* 
  64840  * Set match criteria for MplsLabel1Hit
  64841  *                qualifier.
  64842  */
  64843 int bcm_esw_field_qualify_MplsLabel1Hit(
  64844     int unit, 
  64845     bcm_field_entry_t entry, 
  64846     uint8 data, 
  64847     uint8 mask)
  64848 {
  64849     return BCM_E_UNAVAIL;
  64850 }
  64851 
  64852 
  64853 /* 
  64854  * Get match criteria for MplsLabel1Hit
  64855  *                qualifier.
  64856  */
  64857 int bcm_esw_field_qualify_MplsLabel1Hit_get(
  64858     int unit, 
  64859     bcm_field_entry_t entry, 
  64860     uint8 *data, 
  64861     uint8 *mask)
  64862 {
  64863     return BCM_E_UNAVAIL;
  64864 }
  64865 
  64866 
  64867 /* 
  64868  * Set match criteria for TrillEgressRbridgeHit
  64869  *                qualifier.
  64870  */
  64871 int bcm_esw_field_qualify_TrillEgressRbridgeHit(
  64872     int unit, 
  64873     bcm_field_entry_t entry, 
  64874     uint8 data, 
  64875     uint8 mask)
  64876 {
  64877     return BCM_E_UNAVAIL;
  64878 }
  64879 
  64880 
  64881 /* 
  64882  * Get match criteria for TrillEgressRbridgeHit
  64883  *                qualifier.
  64884  */
  64885 int bcm_esw_field_qualify_TrillEgressRbridgeHit_get(
  64886     int unit, 
  64887     bcm_field_entry_t entry, 
  64888     uint8 *data, 
  64889     uint8 *mask)
  64890 {
  64891     return BCM_E_UNAVAIL;
  64892 }
  64893 
  64894 
  64895 /* 
  64896  * Set match criteria for L2GreSrcIpHit
  64897  *                qualifier.
  64898  */
  64899 int bcm_esw_field_qualify_L2GreSrcIpHit(
  64900     int unit, 
  64901     bcm_field_entry_t entry, 
  64902     uint8 data, 
  64903     uint8 mask)
  64904 {
  64905     return BCM_E_UNAVAIL;
  64906 }
  64907 
  64908 
  64909 /* 
  64910  * Get match criteria for L2GreSrcIpHit
  64911  *                qualifier.
  64912  */
  64913 int bcm_esw_field_qualify_L2GreSrcIpHit_get(
  64914     int unit, 
  64915     bcm_field_entry_t entry, 
  64916     uint8 *data, 
  64917     uint8 *mask)
  64918 {
  64919     return BCM_E_UNAVAIL;
  64920 }
  64921 
  64922 
  64923 /* 
  64924  * Set match criteria for MimSrcGportHit
  64925  *                qualifier.
  64926  */
  64927 int bcm_esw_field_qualify_MimSrcGportHit(
  64928     int unit, 
  64929     bcm_field_entry_t entry, 
  64930     uint8 data, 
  64931     uint8 mask)
  64932 {
  64933     return BCM_E_UNAVAIL;
  64934 }
  64935 
  64936 
  64937 /* 
  64938  * Get match criteria for MimSrcGportHit
  64939  *                qualifier.
  64940  */
  64941 int bcm_esw_field_qualify_MimSrcGportHit_get(
  64942     int unit, 
  64943     bcm_field_entry_t entry, 
  64944     uint8 *data, 
  64945     uint8 *mask)
  64946 {
  64947     return BCM_E_UNAVAIL;
  64948 }
  64949 
  64950 
  64951 /* 
  64952  * Set match criteria for MplsLabel2Hit
  64953  *                qualifier.
  64954  */
  64955 int bcm_esw_field_qualify_MplsLabel2Hit(
  64956     int unit, 
  64957     bcm_field_entry_t entry, 
  64958     uint8 data, 
  64959     uint8 mask)
  64960 {
  64961     return BCM_E_UNAVAIL;
  64962 }
  64963 
  64964 
  64965 /* 
  64966  * Get match criteria for MplsLabel2Hit
  64967  *                qualifier.
  64968  */
  64969 int bcm_esw_field_qualify_MplsLabel2Hit_get(
  64970     int unit, 
  64971     bcm_field_entry_t entry, 
  64972     uint8 *data, 
  64973     uint8 *mask)
  64974 {
  64975     return BCM_E_UNAVAIL;
  64976 }
  64977 
  64978 
  64979 /* 
  64980  * Set match criteria for TrillIngressRbridgeHit
  64981  *                qualifier.
  64982  */
  64983 int bcm_esw_field_qualify_TrillIngressRbridgeHit(
  64984     int unit, 
  64985     bcm_field_entry_t entry, 
  64986     uint8 data, 
  64987     uint8 mask)
  64988 {
  64989     return BCM_E_UNAVAIL;
  64990 }
  64991 
  64992 
  64993 /* 
  64994  * Get match criteria for TrillIngressRbridgeHit
  64995  *                qualifier.
  64996  */
  64997 int bcm_esw_field_qualify_TrillIngressRbridgeHit_get(
  64998     int unit, 
  64999     bcm_field_entry_t entry, 
  65000     uint8 *data, 
  65001     uint8 *mask)
  65002 {
  65003     return BCM_E_UNAVAIL;
  65004 }
  65005 
  65006 
  65007 /* 
  65008  * Set match criteria for L2GreVfiHit
  65009  *                qualifier.
  65010  */
  65011 int bcm_esw_field_qualify_L2GreVfiHit(
  65012     int unit, 
  65013     bcm_field_entry_t entry, 
  65014     uint8 data, 
  65015     uint8 mask)
  65016 {
  65017     return BCM_E_UNAVAIL;
  65018 }
  65019 
  65020 
  65021 /* 
  65022  * Get match criteria for L2GreVfiHit
  65023  *                qualifier.
  65024  */
  65025 int bcm_esw_field_qualify_L2GreVfiHit_get(
  65026     int unit, 
  65027     bcm_field_entry_t entry, 
  65028     uint8 *data, 
  65029     uint8 *mask)
  65030 {
  65031     return BCM_E_UNAVAIL;
  65032 }
  65033 
  65034 
  65035 /* 
  65036  * Set match criteria for MimVfiHit
  65037  *                qualifier.
  65038  */
  65039 int bcm_esw_field_qualify_MimVfiHit(
  65040     int unit, 
  65041     bcm_field_entry_t entry, 
  65042     uint8 data, 
  65043     uint8 mask)
  65044 {
  65045     return BCM_E_UNAVAIL;
  65046 }
  65047 
  65048 
  65049 /* 
  65050  * Get match criteria for MimVfiHit
  65051  *                qualifier.
  65052  */
  65053 int bcm_esw_field_qualify_MimVfiHit_get(
  65054     int unit, 
  65055     bcm_field_entry_t entry, 
  65056     uint8 *data, 
  65057     uint8 *mask)
  65058 {
  65059     return BCM_E_UNAVAIL;
  65060 }
  65061 
  65062 
  65063 /* 
  65064  * Set match criteria for GenericAssociatedChannelLabelValid
  65065  *                qualifier.
  65066  */
  65067 int bcm_esw_field_qualify_GenericAssociatedChannelLabelValid(
  65068     int unit, 
  65069     bcm_field_entry_t entry, 
  65070     uint8 data, 
  65071     uint8 mask)
  65072 {
  65073     return BCM_E_UNAVAIL;
  65074 }
  65075 
  65076 
  65077 /* 
  65078  * Get match criteria for GenericAssociatedChannelLabelValid
  65079  *                qualifier.
  65080  */
  65081 int bcm_esw_field_qualify_GenericAssociatedChannelLabelValid_get(
  65082     int unit, 
  65083     bcm_field_entry_t entry, 
  65084     uint8 *data, 
  65085     uint8 *mask)
  65086 {
  65087     return BCM_E_UNAVAIL;
  65088 }
  65089 
  65090 
  65091 /* 
  65092  * Set match criteria for RouterAlertLabelValid
  65093  *                qualifier.
  65094  */
  65095 int bcm_esw_field_qualify_RouterAlertLabelValid(
  65096     int unit, 
  65097     bcm_field_entry_t entry, 
  65098     uint8 data, 
  65099     uint8 mask)
  65100 {
  65101     return BCM_E_UNAVAIL;
  65102 }
  65103 
  65104 
  65105 /* 
  65106  * Get match criteria for RouterAlertLabelValid
  65107  *                qualifier.
  65108  */
  65109 int bcm_esw_field_qualify_RouterAlertLabelValid_get(
  65110     int unit, 
  65111     bcm_field_entry_t entry, 
  65112     uint8 *data, 
  65113     uint8 *mask)
  65114 {
  65115     return BCM_E_UNAVAIL;
  65116 }
  65117 
  65118 
  65119 /* 
  65120  * Set match criteria for DspIpLocal
  65121  *                qualifier.
  65122  */
  65123 int bcm_esw_field_qualify_DstIpLocal(
  65124     int unit, 
  65125     bcm_field_entry_t entry, 
  65126     uint8 data, 
  65127     uint8 mask)
  65128 {
  65129     return BCM_E_UNAVAIL;
  65130 }
  65131 
  65132 
  65133 /* 
  65134  * Get match criteria for DspIpLocal
  65135  *                qualifier.
  65136  */
  65137 int bcm_esw_field_qualify_DstIpLocal_get(
  65138     int unit, 
  65139     bcm_field_entry_t entry, 
  65140     uint8 *data, 
  65141     uint8 *mask)
  65142 {
  65143     return BCM_E_UNAVAIL;
  65144 }
  65145 
  65146 
  65147 /* 
  65148  * Set match criteria for IpAddrsNormalized
  65149  *                qualifier.
  65150  */
  65151 int bcm_esw_field_qualify_IpAddrsNormalized(
  65152     int unit, 
  65153     bcm_field_entry_t entry, 
  65154     uint8 data, 
  65155     uint8 mask)
  65156 {
  65157     return BCM_E_UNAVAIL;
  65158 }
  65159 
  65160 
  65161 /* 
  65162  * Get match criteria for IpAddrsNormalized
  65163  *                qualifier.
  65164  */
  65165 int bcm_esw_field_qualify_IpAddrsNormalized_get(
  65166     int unit, 
  65167     bcm_field_entry_t entry, 
  65168     uint8 *data, 
  65169     uint8 *mask)
  65170 {
  65171     return BCM_E_UNAVAIL;
  65172 }
  65173 
  65174 
  65175 /* 
  65176  * Set match criteria for MacAddrsNormalized
  65177  *                qualifier.
  65178  */
  65179 int bcm_esw_field_qualify_MacAddrsNormalized(
  65180     int unit, 
  65181     bcm_field_entry_t entry, 
  65182     uint8 data, 
  65183     uint8 mask)
  65184 {
  65185     return BCM_E_UNAVAIL;
  65186 }
  65187 
  65188 
  65189 /* 
  65190  * Get match criteria for MacAddrsNormalized
  65191  *                qualifier.
  65192  */
  65193 int bcm_esw_field_qualify_MacAddrsNormalized_get(
  65194     int unit, 
  65195     bcm_field_entry_t entry, 
  65196     uint8 *data, 
  65197     uint8 *mask)
  65198 {
  65199     return BCM_E_UNAVAIL;
  65200 }
  65201 
  65202 
  65203 /* 
  65204  * Set match criteria for MplsForwardingLabel
  65205  *                qualifier.
  65206  */
  65207 int bcm_esw_field_qualify_MplsForwardingLabel(
  65208     int unit, 
  65209     bcm_field_entry_t entry, 
  65210     uint32 data, 
  65211     uint32 mask)
  65212 {
  65213     return BCM_E_UNAVAIL;
  65214 }
  65215 
  65216 
  65217 /* 
  65218  * Get match criteria for MplsForwardingLabel
  65219  *                qualifier.
  65220  */
  65221 int bcm_esw_field_qualify_MplsForwardingLabel_get(
  65222     int unit, 
  65223     bcm_field_entry_t entry, 
  65224     uint32 *data, 
  65225     uint32 *mask)
  65226 {
  65227     return BCM_E_UNAVAIL;
  65228 }
  65229 
  65230 
  65231 /* 
  65232  * Set match criteria for MplsForwardingLabelTtl
  65233  *                qualifier.
  65234  */
  65235 int bcm_esw_field_qualify_MplsForwardingLabelTtl(
  65236     int unit, 
  65237     bcm_field_entry_t entry, 
  65238     uint8 data, 
  65239     uint8 mask)
  65240 {
  65241     return BCM_E_UNAVAIL;
  65242 }
  65243 
  65244 
  65245 /* 
  65246  * Get match criteria for MplsForwardingLabelTtl
  65247  *                qualifier.
  65248  */
  65249 int bcm_esw_field_qualify_MplsForwardingLabelTtl_get(
  65250     int unit, 
  65251     bcm_field_entry_t entry, 
  65252     uint8 *data, 
  65253     uint8 *mask)
  65254 {
  65255     return BCM_E_UNAVAIL;
  65256 }
  65257 
  65258 
  65259 /* 
  65260  * Set match criteria for MplsForwardingLabelBos
  65261  *                qualifier.
  65262  */
  65263 int bcm_esw_field_qualify_MplsForwardingLabelBos(
  65264     int unit, 
  65265     bcm_field_entry_t entry, 
  65266     uint8 data, 
  65267     uint8 mask)
  65268 {
  65269     return BCM_E_UNAVAIL;
  65270 }
  65271 
  65272 
  65273 /* 
  65274  * Get match criteria for MplsForwardingLabelBos
  65275  *                qualifier.
  65276  */
  65277 int bcm_esw_field_qualify_MplsForwardingLabelBos_get(
  65278     int unit, 
  65279     bcm_field_entry_t entry, 
  65280     uint8 *data, 
  65281     uint8 *mask)
  65282 {
  65283     return BCM_E_UNAVAIL;
  65284 }
  65285 
  65286 
  65287 /* 
  65288  * Set match criteria for MplsForwardingLabelExp
  65289  *                qualifier.
  65290  */
  65291 int bcm_esw_field_qualify_MplsForwardingLabelExp(
  65292     int unit, 
  65293     bcm_field_entry_t entry, 
  65294     uint8 data, 
  65295     uint8 mask)
  65296 {
  65297     return BCM_E_UNAVAIL;
  65298 }
  65299 
  65300 
  65301 /* 
  65302  * Get match criteria for MplsForwardingLabelExp
  65303  *                qualifier.
  65304  */
  65305 int bcm_esw_field_qualify_MplsForwardingLabelExp_get(
  65306     int unit, 
  65307     bcm_field_entry_t entry, 
  65308     uint8 *data, 
  65309     uint8 *mask)
  65310 {
  65311     return BCM_E_UNAVAIL;
  65312 }
  65313 
  65314 
  65315 /* 
  65316  * Set match criteria for MplsForwardingLabelId
  65317  *                qualifier.
  65318  */
  65319 int bcm_esw_field_qualify_MplsForwardingLabelId(
  65320     int unit, 
  65321     bcm_field_entry_t entry, 
  65322     uint32 data, 
  65323     uint32 mask)
  65324 {
  65325     return BCM_E_UNAVAIL;
  65326 }
  65327 
  65328 
  65329 /* 
  65330  * Get match criteria for MplsForwardingLabelId
  65331  *                qualifier.
  65332  */
  65333 int bcm_esw_field_qualify_MplsForwardingLabelId_get(
  65334     int unit, 
  65335     bcm_field_entry_t entry, 
  65336     uint32 *data, 
  65337     uint32 *mask)
  65338 {
  65339     return BCM_E_UNAVAIL;
  65340 }
  65341 
  65342 
  65343 /* 
  65344  * Set match criteria for MplsControlWord
  65345  *                qualifier.
  65346  */
  65347 int bcm_esw_field_qualify_MplsControlWord(
  65348     int unit, 
  65349     bcm_field_entry_t entry, 
  65350     uint32 data, 
  65351     uint32 mask)
  65352 {
  65353     return BCM_E_UNAVAIL;
  65354 }
  65355 
  65356 
  65357 /* 
  65358  * Get match criteria for MplsControlWord
  65359  *                qualifier.
  65360  */
  65361 int bcm_esw_field_qualify_MplsControlWord_get(
  65362     int unit, 
  65363     bcm_field_entry_t entry, 
  65364     uint32 *data, 
  65365     uint32 *mask)
  65366 {
  65367     return BCM_E_UNAVAIL;
  65368 }
  65369 
  65370 
  65371 /* 
  65372  * Set match criteria for Rtag7AHashUpper
  65373  *                qualifier.
  65374  */
  65375 int bcm_esw_field_qualify_Rtag7AHashUpper(
  65376     int unit, 
  65377     bcm_field_entry_t entry, 
  65378     uint16 data, 
  65379     uint16 mask)
  65380 {
  65381     return BCM_E_UNAVAIL;
  65382 }
  65383 
  65384 
  65385 /* 
  65386  * Get match criteria for Rtag7AHashUpper
  65387  *                qualifier.
  65388  */
  65389 int bcm_esw_field_qualify_Rtag7AHashUpper_get(
  65390     int unit, 
  65391     bcm_field_entry_t entry, 
  65392     uint16 *data, 
  65393     uint16 *mask)
  65394 {
  65395     return BCM_E_UNAVAIL;
  65396 }
  65397 
  65398 
  65399 /* 
  65400  * Set match criteria for Rtag7AHashLower
  65401  *                qualifier.
  65402  */
  65403 int bcm_esw_field_qualify_Rtag7AHashLower(
  65404     int unit, 
  65405     bcm_field_entry_t entry, 
  65406     uint16 data, 
  65407     uint16 mask)
  65408 {
  65409     return BCM_E_UNAVAIL;
  65410 }
  65411 
  65412 
  65413 /* 
  65414  * Get match criteria for Rtag7AHashLower
  65415  *                qualifier.
  65416  */
  65417 int bcm_esw_field_qualify_Rtag7AHashLower_get(
  65418     int unit, 
  65419     bcm_field_entry_t entry, 
  65420     uint16 *data, 
  65421     uint16 *mask)
  65422 {
  65423     return BCM_E_UNAVAIL;
  65424 }
  65425 
  65426 
  65427 /* 
  65428  * Set match criteria for Rtag7BHashUpper
  65429  *                qualifier.
  65430  */
  65431 int bcm_esw_field_qualify_Rtag7BHashUpper(
  65432     int unit, 
  65433     bcm_field_entry_t entry, 
  65434     uint16 data, 
  65435     uint16 mask)
  65436 {
  65437     return BCM_E_UNAVAIL;
  65438 }
  65439 
  65440 
  65441 /* 
  65442  * Get match criteria for Rtag7BHashUpper
  65443  *                qualifier.
  65444  */
  65445 int bcm_esw_field_qualify_Rtag7BHashUpper_get(
  65446     int unit, 
  65447     bcm_field_entry_t entry, 
  65448     uint16 *data, 
  65449     uint16 *mask)
  65450 {
  65451     return BCM_E_UNAVAIL;
  65452 }
  65453 
  65454 
  65455 /* 
  65456  * Set match criteria for Rtag7BHashLower
  65457  *                qualifier.
  65458  */
  65459 int bcm_esw_field_qualify_Rtag7BHashLower(
  65460     int unit, 
  65461     bcm_field_entry_t entry, 
  65462     uint16 data, 
  65463     uint16 mask)
  65464 {
  65465     return BCM_E_UNAVAIL;
  65466 }
  65467 
  65468 
  65469 /* 
  65470  * Get match criteria for Rtag7BHashLower
  65471  *                qualifier.
  65472  */
  65473 int bcm_esw_field_qualify_Rtag7BHashLower_get(
  65474     int unit, 
  65475     bcm_field_entry_t entry, 
  65476     uint16 *data, 
  65477     uint16 *mask)
  65478 {
  65479     return BCM_E_UNAVAIL;
  65480 }
  65481 
  65482 
  65483 /* 
  65484  * Set match criteria for MplsForwardingLabelAction
  65485  *                qualifier.
  65486  */
  65487 int bcm_esw_field_qualify_MplsForwardingLabelAction(
  65488     int unit, 
  65489     bcm_field_entry_t entry, 
  65490     uint8 data, 
  65491     uint8 mask)
  65492 {
  65493     return BCM_E_UNAVAIL;
  65494 }
  65495 
  65496 
  65497 /* 
  65498  * Get match criteria for MplsForwardingLabelAction
  65499  *                qualifier.
  65500  */
  65501 int bcm_esw_field_qualify_MplsForwardingLabelAction_get(
  65502     int unit, 
  65503     bcm_field_entry_t entry, 
  65504     uint8 *data, 
  65505     uint8 *mask)
  65506 {
  65507     return BCM_E_UNAVAIL;
  65508 }
  65509 
  65510 
  65511 /* 
  65512  * Set match criteria for MplsControlWordValid
  65513  *                qualifier.
  65514  */
  65515 int bcm_esw_field_qualify_MplsControlWordValid(
  65516     int unit, 
  65517     bcm_field_entry_t entry, 
  65518     uint8 data, 
  65519     uint8 mask)
  65520 {
  65521     return BCM_E_UNAVAIL;
  65522 }
  65523 
  65524 
  65525 /* 
  65526  * Get match criteria for MplsControlWordValid
  65527  *                qualifier.
  65528  */
  65529 int bcm_esw_field_qualify_MplsControlWordValid_get(
  65530     int unit, 
  65531     bcm_field_entry_t entry, 
  65532     uint8 *data, 
  65533     uint8 *mask)
  65534 {
  65535     return BCM_E_UNAVAIL;
  65536 }
  65537 
  65538 
  65539 /* 
  65540  * Set match criteria for EgressClass
  65541  *                qualifier.
  65542  */
  65543 int bcm_esw_field_qualify_EgressClass(
  65544     int unit, 
  65545     bcm_field_entry_t entry, 
  65546     uint16 data, 
  65547     uint16 mask)
  65548 {
  65549     return BCM_E_UNAVAIL;
  65550 }
  65551 
  65552 
  65553 /* 
  65554  * Get match criteria for EgressClass
  65555  *                qualifier.
  65556  */
  65557 int bcm_esw_field_qualify_EgressClass_get(
  65558     int unit, 
  65559     bcm_field_entry_t entry, 
  65560     uint16 *data, 
  65561     uint16 *mask)
  65562 {
  65563     return BCM_E_UNAVAIL;
  65564 }
  65565 
  65566 
  65567 /* 
  65568  * Set match criteria for EgressClassL3Interface
  65569  *                qualifier.
  65570  */
  65571 int bcm_esw_field_qualify_EgressClassL3Interface(
  65572     int unit, 
  65573     bcm_field_entry_t entry, 
  65574     uint16 data, 
  65575     uint16 mask)
  65576 {
  65577     return BCM_E_UNAVAIL;
  65578 }
  65579 
  65580 
  65581 /* 
  65582  * Get match criteria for EgressClassL3Interface
  65583  *                qualifier.
  65584  */
  65585 int bcm_esw_field_qualify_EgressClassL3Interface_get(
  65586     int unit, 
  65587     bcm_field_entry_t entry, 
  65588     uint16 *data, 
  65589     uint16 *mask)
  65590 {
  65591     return BCM_E_UNAVAIL;
  65592 }
  65593 
  65594 
  65595 /* 
  65596  * Set match criteria for EgressClassTrill
  65597  *                qualifier.
  65598  */
  65599 int bcm_esw_field_qualify_EgressClassTrill(
  65600     int unit, 
  65601     bcm_field_entry_t entry, 
  65602     uint16 data, 
  65603     uint16 mask)
  65604 {
  65605     return BCM_E_UNAVAIL;
  65606 }
  65607 
  65608 
  65609 /* 
  65610  * Get match criteria for EgressClassTrill
  65611  *                qualifier.
  65612  */
  65613 int bcm_esw_field_qualify_EgressClassTrill_get(
  65614     int unit, 
  65615     bcm_field_entry_t entry, 
  65616     uint16 *data, 
  65617     uint16 *mask)
  65618 {
  65619     return BCM_E_UNAVAIL;
  65620 }
  65621 
  65622 
  65623 /* 
  65624  * Set match criteria for EgressClassWlan
  65625  *                qualifier.
  65626  */
  65627 int bcm_esw_field_qualify_EgressClassWlan(
  65628     int unit, 
  65629     bcm_field_entry_t entry, 
  65630     uint16 data, 
  65631     uint16 mask)
  65632 {
  65633     return BCM_E_UNAVAIL;
  65634 }
  65635 
  65636 
  65637 /* 
  65638  * Get match criteria for EgressClassWlan
  65639  *                qualifier.
  65640  */
  65641 int bcm_esw_field_qualify_EgressClassWlan_get(
  65642     int unit, 
  65643     bcm_field_entry_t entry, 
  65644     uint16 *data, 
  65645     uint16 *mask)
  65646 {
  65647     return BCM_E_UNAVAIL;
  65648 }
  65649 
  65650 
  65651 /* 
  65652  * Set match criteria for EgressClassL2Gre
  65653  *                qualifier.
  65654  */
  65655 int bcm_esw_field_qualify_EgressClassL2Gre(
  65656     int unit, 
  65657     bcm_field_entry_t entry, 
  65658     uint16 data, 
  65659     uint16 mask)
  65660 {
  65661     return BCM_E_UNAVAIL;
  65662 }
  65663 
  65664 
  65665 /* 
  65666  * Get match criteria for EgressClassL2Gre
  65667  *                qualifier.
  65668  */
  65669 int bcm_esw_field_qualify_EgressClassL2Gre_get(
  65670     int unit, 
  65671     bcm_field_entry_t entry, 
  65672     uint16 *data, 
  65673     uint16 *mask)
  65674 {
  65675     return BCM_E_UNAVAIL;
  65676 }
  65677 
  65678 /*
  65679  * Function:
  65680  *     bcm_esw_field_qualify_SrcGport
  65681  * Purpose:
  65682  *     Add Source ModPort or MPLS/MiM/WLAN port qualification to a
  65683  *     field entry.
  65684  * Parameters:
  65685  *     unit     - (IN) BCM device number
  65686  *     entry    - (IN) Field Entry id.
  65687  *     port_id  - (IN) Source Generic Logical port or virtual port id.
  65688  * Returns:
  65689  *      BCM_E_XXX
  65690  */
  65691 int 
  65692 bcm_esw_field_qualify_SrcGport(int unit, 
  65693                                bcm_field_entry_t entry, 
  65694                                bcm_gport_t mpls_port_id)
  65695 {
  65696     return BCM_E_UNAVAIL; 
  65697 }
  65698 
  65699 /*
  65700  * Function:
  65701  *     bcm_esw_field_qualify_SrcGport_get
  65702  * Purpose:
  65703  *     Get Source ModPort or MPLS/MiM/WLAN gport value from a
  65704  *     field entry.
  65705  * Parameters:
  65706  *     unit     - (IN) BCM device number
  65707  *     entry    - (IN) Field Entry id.
  65708  *     port_id  - (OUT) ModPort Gport or MPLS/MiM/WLAN Gport ID.
  65709  * Returns:
  65710  *      BCM_E_XXX
  65711  */
  65712 int 
  65713 bcm_esw_field_qualify_SrcGport_get(int unit,
  65714                                    bcm_field_entry_t entry,
  65715                                    bcm_gport_t *port_id)
  65716 {
  65717     return BCM_E_UNAVAIL; 
  65718 }
  65719 
  65720 
  65721 /*
  65722  * Function:
  65723  *     bcm_esw_field_qualify_DstGport
  65724  * Purpose:
  65725  *     Add Destination Niv port qualification to a
  65726  *     field entry.
  65727  * Parameters:
  65728  *     unit     - (IN) BCM device number
  65729  *     entry    - (IN) Field Entry id.
  65730  *     port_id  - (IN) Destination virtual port id.
  65731  * Returns:
  65732  *      BCM_E_XXX
  65733  */
  65734 int 
  65735 bcm_esw_field_qualify_DstGport(int unit, 
  65736                                bcm_field_entry_t entry, 
  65737                                bcm_gport_t port_id)
  65738 {
  65739     return BCM_E_UNAVAIL; 
  65740 }
  65741 
  65742 /*
  65743  * Function:
  65744  *     bcm_esw_field_qualify_DstGport_get
  65745  * Purpose:
  65746  *     Get Destination NIV  gport value from a
  65747  *     field entry.
  65748  * Parameters:
  65749  *     unit     - (IN) BCM device number
  65750  *     entry    - (IN) Field Entry id.
  65751  *     port_id  - (OUT) Niv Gport ID.
  65752  * Returns:
  65753  *      BCM_E_XXX
  65754  */
  65755 int 
  65756 bcm_esw_field_qualify_DstGport_get(int unit,
  65757                                    bcm_field_entry_t entry,
  65758                                    bcm_gport_t *port_id)
  65759 {
  65760     return BCM_E_UNAVAIL; 
  65761 }
  65762 
  65763 
  65764 /*
  65765  * Function:
  65766  *      bcm_esw_field_qualify_MplsOuterLabelPop
  65767  * Purpose:
  65768  *      Set match criteria for bcmFieildQualifyMplsOuterLabelPop
  65769  *                     qualifier from the field entry.
  65770  * Parameters:
  65771  *      unit - (IN) Unit number.
  65772  *      entry - (IN) BCM field entry id.
  65773  *      data - (IN) Qualifier match data.
  65774  *      mask - (IN) Qualifier match mask.
  65775  * Returns:
  65776  *      BCM_E_XXX
  65777  * Notes:
  65778  */
  65779 int
  65780 bcm_esw_field_qualify_MplsOuterLabelPop(
  65781     int unit,
  65782     bcm_field_entry_t entry,
  65783     uint8 data,
  65784     uint8 mask)
  65785 {
  65786     return BCM_E_UNAVAIL;
  65787 }
  65788 
  65789 /*
  65790  * Function:
  65791  *      bcm_esw_field_qualify_MplsStationHitTunnelUnterminated
  65792  * Purpose:
  65793  *      Set match criteria for bcmFieildQualifyMplsStationHitTunnelUnterminated
  65794  *                     qualifier from the field entry.
  65795  * Parameters:
  65796  *      unit - (IN) Unit number.
  65797  *      entry - (IN) BCM field entry id.
  65798  *      data - (IN) Qualifier match data.
  65799  *      mask - (IN) Qualifier match mask.
  65800  * Returns:
  65801  *      BCM_E_XXX
  65802  * Notes:
  65803  */
  65804 int
  65805 bcm_esw_field_qualify_MplsStationHitTunnelUnterminated(
  65806     int unit,
  65807     bcm_field_entry_t entry,
  65808     uint8 data,
  65809     uint8 mask)
  65810 {
  65811     return BCM_E_UNAVAIL;
  65812 }
  65813 
  65814 /*
  65815  * Function:
  65816  *      bcm_esw_field_qualify_MplsOuterLabelPop_get
  65817  * Purpose:
  65818  *      Get match criteria for bcmFieildQualifyMplsOuterLabelPop
  65819  *                     qualifier from the field entry.
  65820  * Parameters:
  65821  *      unit - (IN) Unit number.
  65822  *      entry - (IN) BCM field entry id.
  65823  *      data - (OUT) Qualifier match data.
  65824  *      mask - (OUT) Qualifier match mask.
  65825  * Returns:
  65826  *      BCM_E_XXX
  65827  * Notes:
  65828  */
  65829 int
  65830 bcm_esw_field_qualify_MplsOuterLabelPop_get(
  65831     int unit,
  65832     bcm_field_entry_t entry,
  65833     uint8 *data,
  65834     uint8 *mask)
  65835 {
  65836     return BCM_E_UNAVAIL;
  65837 }
  65838 
  65839 /*
  65840  * Function:
  65841  *      bcm_esw_field_qualify_MplsStationHitTunnelUnterminated_get
  65842  * Purpose:
  65843  *      Get match criteria for bcmFieildQualifyMplsStationHitTunnelUnterminated
  65844  *                     qualifier from the field entry.
  65845  * Parameters:
  65846  *      unit - (IN) Unit number.
  65847  *      entry - (IN) BCM field entry id.
  65848  *      data - (OUT) Qualifier match data.
  65849  *      mask - (OUT) Qualifier match mask.
  65850  * Returns:
  65851  *      BCM_E_XXX
  65852  * Notes:
  65853  */
  65854 int
  65855 bcm_esw_field_qualify_MplsStationHitTunnelUnterminated_get(
  65856     int unit,
  65857     bcm_field_entry_t entry,
  65858     uint8 *data,
  65859     uint8 *mask)
  65860 {
  65861     return BCM_E_UNAVAIL;
  65862 }
  65863 
  65864 /*
  65865  * Function:
  65866  *      bcm_esw_field_qualify_IngressClassField
  65867  * Purpose:
  65868  *      Set match criteria for bcmFieildQualifyIngressClassField
  65869  *      qualifier from the field entry.
  65870  * Parameters:
  65871  *      unit    - (IN) Unit number.
  65872  *      entry   - (IN) BCM field entry id.
  65873  *      data    - (IN) Qualifier match data.
  65874  *      mask    - (IN) Qualifier match mask.
  65875  * Returns:
  65876  *      BCM_E_XXX
  65877  * Notes:
  65878  */
  65879 int
  65880 bcm_esw_field_qualify_IngressClassField(
  65881     int unit,
  65882     bcm_field_entry_t entry,
  65883     uint32 data,
  65884     uint32 mask)
  65885 {
  65886     return BCM_E_UNAVAIL;
  65887 }
  65888 
  65889 /*
  65890  * Function:
  65891  *      bcm_esw_field_qualify_IngressClassField_get
  65892  * Purpose:
  65893  *      Get match criteria for bcmFieildQualifyIngressClassField
  65894  *      qualifier from the field entry.
  65895  * Parameters:
  65896  *      unit    - (IN) Unit number.
  65897  *      entry   - (IN) BCM field entry id.
  65898  *      data    - (OUT) Qualifier match data.
  65899  *      mask    - (OUT) Qualifier match mask.
  65900  * Returns:
  65901  *      BCM_E_XXX
  65902  * Notes:
  65903  */
  65904 int
  65905 bcm_esw_field_qualify_IngressClassField_get(
  65906     int unit,
  65907     bcm_field_entry_t entry,
  65908     uint32 *data,
  65909     uint32 *mask)
  65910 {
  65911     return BCM_E_UNAVAIL;
  65912 }
  65913 
  65914 /*
  65915  * Function:
  65916  *      bcm_esw_field_qualify_IngressInterfaceClassPort
  65917  * Purpose:
  65918  *      Set match criteria for bcmFieildQualifyIngressInterfaceClassPort
  65919  *      qualifier from the field entry.
  65920  * Parameters:
  65921  *      unit    - (IN) Unit number.
  65922  *      entry   - (IN) BCM field entry id.
  65923  *      data    - (IN) Qualifier match data.
  65924  *      mask    - (IN) Qualifier match mask.
  65925  * Returns:
  65926  *      BCM_E_XXX
  65927  * Notes:
  65928  */
  65929 int 
  65930 bcm_esw_field_qualify_IngressInterfaceClassPort(
  65931     int unit, 
  65932     bcm_field_entry_t entry, 
  65933     uint32 data, 
  65934     uint32 mask) 
  65935 {
  65936     return BCM_E_UNAVAIL;
  65937 }
  65938 
  65939 /*
  65940  * Function:
  65941  *      bcm_esw_field_qualify_IngressInterfaceClassPort_get
  65942  * Purpose:
  65943  *      Get match criteria for bcmFieildQualifyIngressInterfaceClassPort
  65944  *      qualifier from the field entry.
  65945  * Parameters:
  65946  *      unit    - (IN) Unit number.
  65947  *      entry   - (IN) BCM field entry id.
  65948  *      data    - (OUT) Qualifier match data.
  65949  *      mask    - (OUT) Qualifier match mask.
  65950  * Returns:
  65951  *      BCM_E_XXX
  65952  * Notes:
  65953  */
  65954 int
  65955 bcm_esw_field_qualify_IngressInterfaceClassPort_get(
  65956     int unit,
  65957     bcm_field_entry_t entry,
  65958     uint32 *data,
  65959     uint32 *mask)
  65960 {
  65961     return BCM_E_UNAVAIL;
  65962 }
  65963 
  65964 /*
  65965  * Function:
  65966  *      bcm_esw_field_qualify_VxlanFlags
  65967  * Purpose:
  65968  *      Set match criteria for bcmFieildQualifyVxlanFlags
  65969  *      qualifier from the field entry.
  65970  * Parameters:
  65971  *      unit    - (IN) Unit number.
  65972  *      entry   - (IN) BCM field entry id.
  65973  *      data    - (IN) Qualifier match data.
  65974  *      mask    - (IN) Qualifier match mask.
  65975  * Returns:
  65976  *      BCM_E_XXX
  65977  * Notes:
  65978  */
  65979 int
  65980 bcm_esw_field_qualify_VxlanFlags(
  65981     int unit,
  65982     bcm_field_entry_t entry,
  65983     uint8 data,
  65984     uint8 mask)
  65985 {
  65986     return BCM_E_UNAVAIL;
  65987 }
  65988 
  65989 /*
  65990  * Function:
  65991  *      bcm_esw_field_qualify_VxlanFlags_get
  65992  * Purpose:
  65993  *      Get match criteria for bcmFieildQualifyVxlanFlags
  65994  *      qualifier from the field entry.
  65995  * Parameters:
  65996  *      unit    - (IN) Unit number.
  65997  *      entry   - (IN) BCM field entry id.
  65998  *      data    - (OUT) Qualifier match data.
  65999  *      mask    - (OUT) Qualifier match mask.
  66000  * Returns:
  66001  *      BCM_E_XXX
  66002  * Notes:
  66003  */
  66004 int
  66005 bcm_esw_field_qualify_VxlanFlags_get(
  66006     int unit,
  66007     bcm_field_entry_t entry,
  66008     uint8 *data,
  66009     uint8 *mask)
  66010 {
  66011     return BCM_E_UNAVAIL;
  66012 }
  66013 
  66014 /*
  66015  * Function:
  66016  *      bcm_esw_field_qualify_VxlanNetworkId
  66017  * Purpose:
  66018  *      Set match criteria for bcmFieildQualifyVxlanNetworkId
  66019  *      qualifier from the field entry.
  66020  * Parameters:
  66021  *      unit    - (IN) Unit number.
  66022  *      entry   - (IN) BCM field entry id.
  66023  *      data    - (IN) Qualifier match data.
  66024  *      mask    - (IN) Qualifier match mask.
  66025  * Returns:
  66026  *      BCM_E_XXX
  66027  * Notes:
  66028  */
  66029 int
  66030 bcm_esw_field_qualify_VxlanNetworkId(
  66031     int unit,
  66032     bcm_field_entry_t entry,
  66033     uint32 data,
  66034     uint32 mask)
  66035 {
  66036     return BCM_E_UNAVAIL;
  66037 }
  66038 
  66039 /*
  66040  * Function:
  66041  *      bcm_esw_field_qualify_VxlanNetworkId_get
  66042  * Purpose:
  66043  *      Get match criteria for bcmFieildQualifyVxlanNetworkId
  66044  *      qualifier from the field entry.
  66045  * Parameters:
  66046  *      unit    - (IN) Unit number.
  66047  *      entry   - (IN) BCM field entry id.
  66048  *      data    - (OUT) Qualifier match data.
  66049  *      mask    - (OUT) Qualifier match mask.
  66050  * Returns:
  66051  *      BCM_E_XXX
  66052  * Notes:
  66053  */
  66054 int
  66055 bcm_esw_field_qualify_VxlanNetworkId_get(
  66056     int unit,
  66057     bcm_field_entry_t entry,
  66058     uint32 *data,
  66059     uint32 *mask)
  66060 {
  66061     return BCM_E_UNAVAIL;
  66062 }
  66063 
  66064 /*
  66065  * Function:
  66066  *      bcm_esw_field_qualify_NatNeeded
  66067  * Purpose:
  66068  *      Set match criteria for bcmFieildQualifyNatNeeded
  66069  *      qualifier from the field entry.
  66070  * Parameters:
  66071  *      unit    - (IN) Unit number.
  66072  *      entry   - (IN) BCM field entry id.
  66073  *      data    - (IN) Qualifier match data.
  66074  *      mask    - (IN) Qualifier match mask.
  66075  * Returns:
  66076  *      BCM_E_XXX
  66077  * Notes:
  66078  */
  66079 int
  66080 bcm_esw_field_qualify_NatNeeded(
  66081     int unit,
  66082     bcm_field_entry_t entry,
  66083     uint8 data,
  66084     uint8 mask)
  66085 {
  66086     return BCM_E_UNAVAIL;
  66087 }
  66088 
  66089 /*
  66090  * Function:
  66091  *      bcm_esw_field_qualify_NatNeeded_get
  66092  * Purpose:
  66093  *      Get match criteria for bcmFieildQualifyNatNeeded
  66094  *      qualifier from the field entry.
  66095  * Parameters:
  66096  *      unit    - (IN) Unit number.
  66097  *      entry   - (IN) BCM field entry id.
  66098  *      data    - (OUT) Qualifier match data.
  66099  *      mask    - (OUT) Qualifier match mask.
  66100  * Returns:
  66101  *      BCM_E_XXX
  66102  * Notes:
  66103  */
  66104 int
  66105 bcm_esw_field_qualify_NatNeeded_get(
  66106     int unit,
  66107     bcm_field_entry_t entry,
  66108     uint8 *data,
  66109     uint8 *mask)
  66110 {
  66111     return BCM_E_UNAVAIL;
  66112 }
  66113 
  66114 /*
  66115  * Function:
  66116  *      bcm_esw_field_qualify_NatDstRealmId
  66117  * Purpose:
  66118  *      Set match criteria for bcmFieildQualifyNatDstRealmId
  66119  *      qualifier from the field entry.
  66120  * Parameters:
  66121  *      unit    - (IN) Unit number.
  66122  *      entry   - (IN) BCM field entry id.
  66123  *      data    - (IN) Qualifier match data.
  66124  *      mask    - (IN) Qualifier match mask.
  66125  * Returns:
  66126  *      BCM_E_XXX
  66127  * Notes:
  66128  */
  66129 int
  66130 bcm_esw_field_qualify_NatDstRealmId(
  66131     int unit,
  66132     bcm_field_entry_t entry,
  66133     uint8 data,
  66134     uint8 mask)
  66135 {
  66136     return BCM_E_UNAVAIL;
  66137 }
  66138 
  66139 /*
  66140  * Function:
  66141  *      bcm_esw_field_qualify_NatDstRealmId_get
  66142  * Purpose:
  66143  *      Get match criteria for bcmFieildQualifyNatDstRealmId
  66144  *      qualifier from the field entry.
  66145  * Parameters:
  66146  *      unit    - (IN) Unit number.
  66147  *      entry   - (IN) BCM field entry id.
  66148  *      data    - (OUT) Qualifier match data.
  66149  *      mask    - (OUT) Qualifier match mask.
  66150  * Returns:
  66151  *      BCM_E_XXX
  66152  * Notes:
  66153  */
  66154 int
  66155 bcm_esw_field_qualify_NatDstRealmId_get(
  66156     int unit,
  66157     bcm_field_entry_t entry,
  66158     uint8 *data,
  66159     uint8 *mask)
  66160 {
  66161     return BCM_E_UNAVAIL;
  66162 }
  66163 
  66164 /*
  66165  * Function:
  66166  *      bcm_esw_field_qualify_NatSrcRealmId
  66167  * Purpose:
  66168  *      Set match criteria for bcmFieildQualifyNatSrcRealmId
  66169  *      qualifier from the field entry.
  66170  * Parameters:
  66171  *      unit    - (IN) Unit number.
  66172  *      entry   - (IN) BCM field entry id.
  66173  *      data    - (IN) Qualifier match data.
  66174  *      mask    - (IN) Qualifier match mask.
  66175  * Returns:
  66176  *      BCM_E_XXX
  66177  * Notes:
  66178  */
  66179 int
  66180 bcm_esw_field_qualify_NatSrcRealmId(
  66181     int unit,
  66182     bcm_field_entry_t entry,
  66183     uint8 data,
  66184     uint8 mask)
  66185 {
  66186     return BCM_E_UNAVAIL;
  66187 }
  66188 
  66189 /*
  66190  * Function:
  66191  *      bcm_esw_field_qualify_NatSrcRealmId_get
  66192  * Purpose:
  66193  *      Get match criteria for bcmFieildQualifyNatSrcRealmId
  66194  *      qualifier from the field entry.
  66195  * Parameters:
  66196  *      unit    - (IN) Unit number.
  66197  *      entry   - (IN) BCM field entry id.
  66198  *      data    - (OUT) Qualifier match data.
  66199  *      mask    - (OUT) Qualifier match mask.
  66200  * Returns:
  66201  *      BCM_E_XXX
  66202  * Notes:
  66203  */
  66204 int
  66205 bcm_esw_field_qualify_NatSrcRealmId_get(
  66206     int unit,
  66207     bcm_field_entry_t entry,
  66208     uint8 *data,
  66209     uint8 *mask)
  66210 {
  66211     return BCM_E_UNAVAIL;
  66212 }
  66213 
  66214 /*
  66215  * Function:
  66216  *      bcm_esw_field_qualify_IcmpError
  66217  * Purpose:
  66218  *      Set match criteria for bcmFieildQualifyIcmpError
  66219  *      qualifier from the field entry.
  66220  * Parameters:
  66221  *      unit    - (IN) Unit number.
  66222  *      entry   - (IN) BCM field entry id.
  66223  *      data    - (IN) Qualifier match data.
  66224  *      mask    - (IN) Qualifier match mask.
  66225  * Returns:
  66226  *      BCM_E_XXX
  66227  * Notes:
  66228  */
  66229 int
  66230 bcm_esw_field_qualify_IcmpError(
  66231     int unit,
  66232     bcm_field_entry_t entry,
  66233     uint8 data,
  66234     uint8 mask)
  66235 {
  66236     return BCM_E_UNAVAIL;
  66237 }
  66238 
  66239 /*
  66240  * Function:
  66241  *      bcm_esw_field_qualify_IcmpError_get
  66242  * Purpose:
  66243  *      Get match criteria for bcmFieildQualifyIcmpError
  66244  *      qualifier from the field entry.
  66245  * Parameters:
  66246  *      unit    - (IN) Unit number.
  66247  *      entry   - (IN) BCM field entry id.
  66248  *      data    - (OUT) Qualifier match data.
  66249  *      mask    - (OUT) Qualifier match mask.
  66250  * Returns:
  66251  *      BCM_E_XXX
  66252  * Notes:
  66253  */
  66254 int
  66255 bcm_esw_field_qualify_IcmpError_get(
  66256     int unit,
  66257     bcm_field_entry_t entry,
  66258     uint8 *data,
  66259     uint8 *mask)
  66260 {
  66261     return BCM_E_UNAVAIL;
  66262 }
  66263 
  66264 /*
  66265  * Function:
  66266  *      bcm_esw_field_qualify_FibreChanRCtl
  66267  * Purpose:
  66268  *      Set match criteria for bcmFieildQualifyFibreChanRCtl
  66269  *      qualifier from the field entry.
  66270  * Parameters:
  66271  *      unit    - (IN) Unit number.
  66272  *      entry   - (IN) BCM field entry id.
  66273  *      data    - (IN) Qualifier match data.
  66274  *      mask    - (IN) Qualifier match mask.
  66275  * Returns:
  66276  *      BCM_E_XXX
  66277  * Notes:
  66278  */
  66279 int
  66280 bcm_esw_field_qualify_FibreChanRCtl(
  66281     int unit,
  66282     bcm_field_entry_t entry,
  66283     uint8 data,
  66284     uint8 mask)
  66285 {
  66286     return BCM_E_UNAVAIL;
  66287 }
  66288 
  66289 /*
  66290  * Function:
  66291  *      bcm_esw_field_qualify_FibreChanRCtl_get
  66292  * Purpose:
  66293  *      Get match criteria for bcmFieildQualifyFibreChanRCtl
  66294  *      qualifier from the field entry.
  66295  * Parameters:
  66296  *      unit    - (IN) Unit number.
  66297  *      entry   - (IN) BCM field entry id.
  66298  *      data    - (OUT) Qualifier match data.
  66299  *      mask    - (OUT) Qualifier match mask.
  66300  * Returns:
  66301  *      BCM_E_XXX
  66302  * Notes:
  66303  */
  66304 int
  66305 bcm_esw_field_qualify_FibreChanRCtl_get(
  66306     int unit,
  66307     bcm_field_entry_t entry,
  66308     uint8 *data,
  66309     uint8 *mask)
  66310 {
  66311     return BCM_E_UNAVAIL;
  66312 }
  66313 
  66314 /*
  66315  * Function:
  66316  *      bcm_esw_field_qualify_FibreChanFCtl
  66317  * Purpose:
  66318  *      Set match criteria for bcmFieildQualifyFibreChanFCtl
  66319  *      qualifier from the field entry.
  66320  * Parameters:
  66321  *      unit    - (IN) Unit number.
  66322  *      entry   - (IN) BCM field entry id.
  66323  *      data    - (IN) Qualifier match data.
  66324  *      mask    - (IN) Qualifier match mask.
  66325  * Returns:
  66326  *      BCM_E_XXX
  66327  * Notes:
  66328  */
  66329 int
  66330 bcm_esw_field_qualify_FibreChanFCtl(
  66331     int unit,
  66332     bcm_field_entry_t entry,
  66333     uint32 data,
  66334     uint32 mask)
  66335 {
  66336     return BCM_E_UNAVAIL;
  66337 }
  66338 
  66339 /*
  66340  * Function:
  66341  *      bcm_esw_field_qualify_FibreChanFCtl_get
  66342  * Purpose:
  66343  *      Get match criteria for bcmFieildQualifyFibreChanFCtl
  66344  *      qualifier from the field entry.
  66345  * Parameters:
  66346  *      unit    - (IN) Unit number.
  66347  *      entry   - (IN) BCM field entry id.
  66348  *      data    - (OUT) Qualifier match data.
  66349  *      mask    - (OUT) Qualifier match mask.
  66350  * Returns:
  66351  *      BCM_E_XXX
  66352  * Notes:
  66353  */
  66354 int
  66355 bcm_esw_field_qualify_FibreChanFCtl_get(
  66356     int unit,
  66357     bcm_field_entry_t entry,
  66358     uint32 *data,
  66359     uint32 *mask)
  66360 {
  66361     return BCM_E_UNAVAIL;
  66362 }
  66363 
  66364 /*
  66365  * Function:
  66366  *      bcm_esw_field_qualify_FibreChanCSCtl
  66367  * Purpose:
  66368  *      Set match criteria for bcmFieildQualifyFibreChanCSCtl
  66369  *      qualifier from the field entry.
  66370  * Parameters:
  66371  *      unit    - (IN) Unit number.
  66372  *      entry   - (IN) BCM field entry id.
  66373  *      data    - (IN) Qualifier match data.
  66374  *      mask    - (IN) Qualifier match mask.
  66375  * Returns:
  66376  *      BCM_E_XXX
  66377  * Notes:
  66378  */
  66379 int
  66380 bcm_esw_field_qualify_FibreChanCSCtl(
  66381     int unit,
  66382     bcm_field_entry_t entry,
  66383     uint8 data,
  66384     uint8 mask)
  66385 {
  66386     return BCM_E_UNAVAIL;
  66387 }
  66388 
  66389 /*
  66390  * Function:
  66391  *      bcm_esw_field_qualify_FibreChanCSCtl_get
  66392  * Purpose:
  66393  *      Get match criteria for bcmFieildQualifyFibreChanCSCtl
  66394  *      qualifier from the field entry.
  66395  * Parameters:
  66396  *      unit    - (IN) Unit number.
  66397  *      entry   - (IN) BCM field entry id.
  66398  *      data    - (OUT) Qualifier match data.
  66399  *      mask    - (OUT) Qualifier match mask.
  66400  * Returns:
  66401  *      BCM_E_XXX
  66402  * Notes:
  66403  */
  66404 int
  66405 bcm_esw_field_qualify_FibreChanCSCtl_get(
  66406     int unit,
  66407     bcm_field_entry_t entry,
  66408     uint8 *data,
  66409     uint8 *mask)
  66410 {
  66411     return BCM_E_UNAVAIL;
  66412 }
  66413 
  66414 /*
  66415  * Function:
  66416  *      bcm_esw_field_qualify_FibreChanDFCtl
  66417  * Purpose:
  66418  *      Set match criteria for bcmFieildQualifyFibreChanDFCtl
  66419  *      qualifier from the field entry.
  66420  * Parameters:
  66421  *      unit    - (IN) Unit number.
  66422  *      entry   - (IN) BCM field entry id.
  66423  *      data    - (IN) Qualifier match data.
  66424  *      mask    - (IN) Qualifier match mask.
  66425  * Returns:
  66426  *      BCM_E_XXX
  66427  * Notes:
  66428  */
  66429 int
  66430 bcm_esw_field_qualify_FibreChanDFCtl(
  66431     int unit,
  66432     bcm_field_entry_t entry,
  66433     uint8 data,
  66434     uint8 mask)
  66435 {
  66436     return BCM_E_UNAVAIL;
  66437 }
  66438 
  66439 /*
  66440  * Function:
  66441  *      bcm_esw_field_qualify_FibreChanDFCtl_get
  66442  * Purpose:
  66443  *      Get match criteria for bcmFieildQualifyFibreChanDFCtl
  66444  *      qualifier from the field entry.
  66445  * Parameters:
  66446  *      unit    - (IN) Unit number.
  66447  *      entry   - (IN) BCM field entry id.
  66448  *      data    - (OUT) Qualifier match data.
  66449  *      mask    - (OUT) Qualifier match mask.
  66450  * Returns:
  66451  *      BCM_E_XXX
  66452  * Notes:
  66453  */
  66454 int
  66455 bcm_esw_field_qualify_FibreChanDFCtl_get(
  66456     int unit,
  66457     bcm_field_entry_t entry,
  66458     uint8 *data,
  66459     uint8 *mask)
  66460 {
  66461     return BCM_E_UNAVAIL;
  66462 }
  66463 
  66464 /*
  66465  * Function:
  66466  *      bcm_esw_field_qualify_FibreChanType
  66467  * Purpose:
  66468  *      Set match criteria for bcmFieildQualifyFibreChanType
  66469  *      qualifier from the field entry.
  66470  * Parameters:
  66471  *      unit    - (IN) Unit number.
  66472  *      entry   - (IN) BCM field entry id.
  66473  *      data    - (IN) Qualifier match data.
  66474  *      mask    - (IN) Qualifier match mask.
  66475  * Returns:
  66476  *      BCM_E_XXX
  66477  * Notes:
  66478  */
  66479 int
  66480 bcm_esw_field_qualify_FibreChanType(
  66481     int unit,
  66482     bcm_field_entry_t entry,
  66483     uint8 data,
  66484     uint8 mask)
  66485 {
  66486     return BCM_E_UNAVAIL;
  66487 }
  66488 
  66489 /*
  66490  * Function:
  66491  *      bcm_esw_field_qualify_FibreChanType_get
  66492  * Purpose:
  66493  *      Get match criteria for bcmFieildQualifyFibreChanType
  66494  *      qualifier from the field entry.
  66495  * Parameters:
  66496  *      unit    - (IN) Unit number.
  66497  *      entry   - (IN) BCM field entry id.
  66498  *      data    - (OUT) Qualifier match data.
  66499  *      mask    - (OUT) Qualifier match mask.
  66500  * Returns:
  66501  *      BCM_E_XXX
  66502  * Notes:
  66503  */
  66504 int
  66505 bcm_esw_field_qualify_FibreChanType_get(
  66506     int unit,
  66507     bcm_field_entry_t entry,
  66508     uint8 *data,
  66509     uint8 *mask)
  66510 {
  66511     return BCM_E_UNAVAIL;
  66512 }
  66513 
  66514 /*
  66515  * Function:
  66516  *      bcm_esw_field_qualify_FibreChanSrcId
  66517  * Purpose:
  66518  *      Set match criteria for bcmFieildQualifyFibreChanSrcId
  66519  *      qualifier from the field entry.
  66520  * Parameters:
  66521  *      unit    - (IN) Unit number.
  66522  *      entry   - (IN) BCM field entry id.
  66523  *      data    - (IN) Qualifier match data.
  66524  *      mask    - (IN) Qualifier match mask.
  66525  * Returns:
  66526  *      BCM_E_XXX
  66527  * Notes:
  66528  */
  66529 int
  66530 bcm_esw_field_qualify_FibreChanSrcId(
  66531     int unit,
  66532     bcm_field_entry_t entry,
  66533     uint32 data,
  66534     uint32 mask)
  66535 {
  66536     return BCM_E_UNAVAIL;
  66537 }
  66538 
  66539 /*
  66540  * Function:
  66541  *      bcm_esw_field_qualify_FibreChanSrcId_get
  66542  * Purpose:
  66543  *      Get match criteria for bcmFieildQualifyFibreChanSrcId
  66544  *      qualifier from the field entry.
  66545  * Parameters:
  66546  *      unit    - (IN) Unit number.
  66547  *      entry   - (IN) BCM field entry id.
  66548  *      data    - (OUT) Qualifier match data.
  66549  *      mask    - (OUT) Qualifier match mask.
  66550  * Returns:
  66551  *      BCM_E_XXX
  66552  * Notes:
  66553  */
  66554 int
  66555 bcm_esw_field_qualify_FibreChanSrcId_get(
  66556     int unit,
  66557     bcm_field_entry_t entry,
  66558     uint32 *data,
  66559     uint32 *mask)
  66560 {
  66561     return BCM_E_UNAVAIL;
  66562 }
  66563 
  66564 /*
  66565  * Function:
  66566  *      bcm_esw_field_qualify_FibreChanDstId
  66567  * Purpose:
  66568  *      Set match criteria for bcmFieildQualifyFibreChanDstId
  66569  *      qualifier from the field entry.
  66570  * Parameters:
  66571  *      unit    - (IN) Unit number.
  66572  *      entry   - (IN) BCM field entry id.
  66573  *      data    - (IN) Qualifier match data.
  66574  *      mask    - (IN) Qualifier match mask.
  66575  * Returns:
  66576  *      BCM_E_XXX
  66577  * Notes:
  66578  */
  66579 int
  66580 bcm_esw_field_qualify_FibreChanDstId(
  66581     int unit,
  66582     bcm_field_entry_t entry,
  66583     uint32 data,
  66584     uint32 mask)
  66585 {
  66586     return BCM_E_UNAVAIL;
  66587 }
  66588 
  66589 /*
  66590  * Function:
  66591  *      bcm_esw_field_qualify_FibreChanDstId_get
  66592  * Purpose:
  66593  *      Get match criteria for bcmFieildQualifyFibreChanDstId
  66594  *      qualifier from the field entry.
  66595  * Parameters:
  66596  *      unit    - (IN) Unit number.
  66597  *      entry   - (IN) BCM field entry id.
  66598  *      data    - (OUT) Qualifier match data.
  66599  *      mask    - (OUT) Qualifier match mask.
  66600  * Returns:
  66601  *      BCM_E_XXX
  66602  * Notes:
  66603  */
  66604 int
  66605 bcm_esw_field_qualify_FibreChanDstId_get(
  66606     int unit,
  66607     bcm_field_entry_t entry,
  66608     uint32 *data,
  66609     uint32 *mask)
  66610 {
  66611     return BCM_E_UNAVAIL;
  66612 }
  66613 
  66614 /*
  66615  * Function:
  66616  *      bcm_esw_field_qualify_FibreChanZoneCheck
  66617  * Purpose:
  66618  *      Set match criteria for bcmFieildQualifyFibreChanZoneCheck
  66619  *      qualifier from the field entry.
  66620  * Parameters:
  66621  *      unit    - (IN) Unit number.
  66622  *      entry   - (IN) BCM field entry id.
  66623  *      data    - (IN) Qualifier match data.
  66624  *      mask    - (IN) Qualifier match mask.
  66625  * Returns:
  66626  *      BCM_E_XXX
  66627  * Notes:
  66628  */
  66629 int
  66630 bcm_esw_field_qualify_FibreChanZoneCheck(
  66631     int unit,
  66632     bcm_field_entry_t entry,
  66633     uint8 data,
  66634     uint8 mask)
  66635 {
  66636     return BCM_E_UNAVAIL;
  66637 }
  66638 
  66639 /*
  66640  * Function:
  66641  *      bcm_esw_field_qualify_FibreChanZoneCheck_get
  66642  * Purpose:
  66643  *      Get match criteria for bcmFieildQualifyFibreChanZoneCheck
  66644  *      qualifier from the field entry.
  66645  * Parameters:
  66646  *      unit    - (IN) Unit number.
  66647  *      entry   - (IN) BCM field entry id.
  66648  *      data    - (OUT) Qualifier match data.
  66649  *      mask    - (OUT) Qualifier match mask.
  66650  * Returns:
  66651  *      BCM_E_XXX
  66652  * Notes:
  66653  */
  66654 int
  66655 bcm_esw_field_qualify_FibreChanZoneCheck_get(
  66656     int unit,
  66657     bcm_field_entry_t entry,
  66658     uint8 *data,
  66659     uint8 *mask)
  66660 {
  66661     return BCM_E_UNAVAIL;
  66662 }
  66663 
  66664 /*
  66665  * Function:
  66666  *      bcm_esw_field_qualify_FibreChanSrcFpmaCheck
  66667  * Purpose:
  66668  *      Set match criteria for bcmFieildQualifyFibreChanSrcFpmaCheck
  66669  *      qualifier from the field entry.
  66670  * Parameters:
  66671  *      unit    - (IN) Unit number.
  66672  *      entry   - (IN) BCM field entry id.
  66673  *      data    - (IN) Qualifier match data.
  66674  *      mask    - (IN) Qualifier match mask.
  66675  * Returns:
  66676  *      BCM_E_XXX
  66677  * Notes:
  66678  */
  66679 int
  66680 bcm_esw_field_qualify_FibreChanSrcFpmaCheck(
  66681     int unit,
  66682     bcm_field_entry_t entry,
  66683     uint8 data,
  66684     uint8 mask)
  66685 {
  66686     return BCM_E_UNAVAIL;
  66687 }
  66688 
  66689 /*
  66690  * Function:
  66691  *      bcm_esw_field_qualify_FibreChanSrcFpmaCheck_get
  66692  * Purpose:
  66693  *      Get match criteria for bcmFieildQualifyFibreChanSrcFpmaCheck
  66694  *      qualifier from the field entry.
  66695  * Parameters:
  66696  *      unit    - (IN) Unit number.
  66697  *      entry   - (IN) BCM field entry id.
  66698  *      data    - (OUT) Qualifier match data.
  66699  *      mask    - (OUT) Qualifier match mask.
  66700  * Returns:
  66701  *      BCM_E_XXX
  66702  * Notes:
  66703  */
  66704 int
  66705 bcm_esw_field_qualify_FibreChanSrcFpmaCheck_get(
  66706     int unit,
  66707     bcm_field_entry_t entry,
  66708     uint8 *data,
  66709     uint8 *mask)
  66710 {
  66711     return BCM_E_UNAVAIL;
  66712 }
  66713 
  66714 /*
  66715  * Function:
  66716  *      bcm_esw_field_qualify_FibreChanSrcBindCheck
  66717  * Purpose:
  66718  *      Set match criteria for bcmFieildQualifyFibreChanSrcBindCheck
  66719  *      qualifier from the field entry.
  66720  * Parameters:
  66721  *      unit    - (IN) Unit number.
  66722  *      entry   - (IN) BCM field entry id.
  66723  *      data    - (IN) Qualifier match data.
  66724  *      mask    - (IN) Qualifier match mask.
  66725  * Returns:
  66726  *      BCM_E_XXX
  66727  * Notes:
  66728  */
  66729 int
  66730 bcm_esw_field_qualify_FibreChanSrcBindCheck(
  66731     int unit,
  66732     bcm_field_entry_t entry,
  66733     uint8 data,
  66734     uint8 mask)
  66735 {
  66736     return BCM_E_UNAVAIL;
  66737 }
  66738 
  66739 /*
  66740  * Function:
  66741  *      bcm_esw_field_qualify_FibreChanSrcBindCheck_get
  66742  * Purpose:
  66743  *      Get match criteria for bcmFieildQualifyFibreChanSrcBindCheck
  66744  *      qualifier from the field entry.
  66745  * Parameters:
  66746  *      unit    - (IN) Unit number.
  66747  *      entry   - (IN) BCM field entry id.
  66748  *      data    - (OUT) Qualifier match data.
  66749  *      mask    - (OUT) Qualifier match mask.
  66750  * Returns:
  66751  *      BCM_E_XXX
  66752  * Notes:
  66753  */
  66754 int
  66755 bcm_esw_field_qualify_FibreChanSrcBindCheck_get(
  66756     int unit,
  66757     bcm_field_entry_t entry,
  66758     uint8 *data,
  66759     uint8 *mask)
  66760 {
  66761     return BCM_E_UNAVAIL;
  66762 }
  66763 
  66764 /*
  66765  * Function:
  66766  *      bcm_esw_field_qualify_FibreChanVFTVersion
  66767  * Purpose:
  66768  *      Set match criteria for bcmFieildQualifyFibreChanVFTVersion
  66769  *      qualifier from the field entry.
  66770  * Parameters:
  66771  *      unit    - (IN) Unit number.
  66772  *      entry   - (IN) BCM field entry id.
  66773  *      data    - (IN) Qualifier match data.
  66774  *      mask    - (IN) Qualifier match mask.
  66775  * Returns:
  66776  *      BCM_E_XXX
  66777  * Notes:
  66778  */
  66779 int
  66780 bcm_esw_field_qualify_FibreChanVFTVersion(
  66781     int unit,
  66782     bcm_field_entry_t entry,
  66783     uint8 data,
  66784     uint8 mask)
  66785 {
  66786     return BCM_E_UNAVAIL;
  66787 }
  66788 
  66789 /*
  66790  * Function:
  66791  *      bcm_esw_field_qualify_FibreChanVFTVersion_get
  66792  * Purpose:
  66793  *      Get match criteria for bcmFieildQualifyFibreChanVFTVersion
  66794  *      qualifier from the field entry.
  66795  * Parameters:
  66796  *      unit    - (IN) Unit number.
  66797  *      entry   - (IN) BCM field entry id.
  66798  *      data    - (OUT) Qualifier match data.
  66799  *      mask    - (OUT) Qualifier match mask.
  66800  * Returns:
  66801  *      BCM_E_XXX
  66802  * Notes:
  66803  */
  66804 int
  66805 bcm_esw_field_qualify_FibreChanVFTVersion_get(
  66806     int unit,
  66807     bcm_field_entry_t entry,
  66808     uint8 *data,
  66809     uint8 *mask)
  66810 {
  66811     return BCM_E_UNAVAIL;
  66812 }
  66813 
  66814 /*
  66815  * Function:
  66816  *      bcm_esw_field_qualify_FibreChanVFTPri
  66817  * Purpose:
  66818  *      Set match criteria for bcmFieildQualifyFibreChanVFTPri
  66819  *      qualifier from the field entry.
  66820  * Parameters:
  66821  *      unit    - (IN) Unit number.
  66822  *      entry   - (IN) BCM field entry id.
  66823  *      data    - (IN) Qualifier match data.
  66824  *      mask    - (IN) Qualifier match mask.
  66825  * Returns:
  66826  *      BCM_E_XXX
  66827  * Notes:
  66828  */
  66829 int
  66830 bcm_esw_field_qualify_FibreChanVFTPri(
  66831     int unit,
  66832     bcm_field_entry_t entry,
  66833     uint8 data,
  66834     uint8 mask)
  66835 {
  66836     return BCM_E_UNAVAIL;
  66837 }
  66838 
  66839 /*
  66840  * Function:
  66841  *      bcm_esw_field_qualify_FibreChanVFTPri_get
  66842  * Purpose:
  66843  *      Get match criteria for bcmFieildQualifyFibreChanVFTPri
  66844  *      qualifier from the field entry.
  66845  * Parameters:
  66846  *      unit    - (IN) Unit number.
  66847  *      entry   - (IN) BCM field entry id.
  66848  *      data    - (OUT) Qualifier match data.
  66849  *      mask    - (OUT) Qualifier match mask.
  66850  * Returns:
  66851  *      BCM_E_XXX
  66852  * Notes:
  66853  */
  66854 int
  66855 bcm_esw_field_qualify_FibreChanVFTPri_get(
  66856     int unit,
  66857     bcm_field_entry_t entry,
  66858     uint8 *data,
  66859     uint8 *mask)
  66860 {
  66861     return BCM_E_UNAVAIL;
  66862 }
  66863 
  66864 /*
  66865  * Function:
  66866  *      bcm_esw_field_qualify_FibreChanVFTFabricId
  66867  * Purpose:
  66868  *      Set match criteria for bcmFieildQualifyFibreChanVFTFabricId
  66869  *      qualifier from the field entry.
  66870  * Parameters:
  66871  *      unit    - (IN) Unit number.
  66872  *      entry   - (IN) BCM field entry id.
  66873  *      data    - (IN) Qualifier match data.
  66874  *      mask    - (IN) Qualifier match mask.
  66875  * Returns:
  66876  *      BCM_E_XXX
  66877  * Notes:
  66878  */
  66879 int
  66880 bcm_esw_field_qualify_FibreChanVFTFabricId(
  66881     int unit,
  66882     bcm_field_entry_t entry,
  66883     uint16 data,
  66884     uint16 mask)
  66885 {
  66886     return BCM_E_UNAVAIL;
  66887 }
  66888 
  66889 /*
  66890  * Function:
  66891  *      bcm_esw_field_qualify_FibreChanVFTFabricId_get
  66892  * Purpose:
  66893  *      Get match criteria for bcmFieildQualifyFibreChanVFTFabricId
  66894  *      qualifier from the field entry.
  66895  * Parameters:
  66896  *      unit    - (IN) Unit number.
  66897  *      entry   - (IN) BCM field entry id.
  66898  *      data    - (OUT) Qualifier match data.
  66899  *      mask    - (OUT) Qualifier match mask.
  66900  * Returns:
  66901  *      BCM_E_XXX
  66902  * Notes:
  66903  */
  66904 int
  66905 bcm_esw_field_qualify_FibreChanVFTFabricId_get(
  66906     int unit,
  66907     bcm_field_entry_t entry,
  66908     uint16 *data,
  66909     uint16 *mask)
  66910 {
  66911     return BCM_E_UNAVAIL;
  66912 }
  66913 
  66914 /*
  66915  * Function:
  66916  *      bcm_esw_field_qualify_FibreChanVFTHopCount
  66917  * Purpose:
  66918  *      Set match criteria for bcmFieildQualifyFibreChanVFTHopCount
  66919  *      qualifier from the field entry.
  66920  * Parameters:
  66921  *      unit    - (IN) Unit number.
  66922  *      entry   - (IN) BCM field entry id.
  66923  *      data    - (IN) Qualifier match data.
  66924  *      mask    - (IN) Qualifier match mask.
  66925  * Returns:
  66926  *      BCM_E_XXX
  66927  * Notes:
  66928  */
  66929 int
  66930 bcm_esw_field_qualify_FibreChanVFTHopCount(
  66931     int unit,
  66932     bcm_field_entry_t entry,
  66933     uint8 data,
  66934     uint8 mask)
  66935 {
  66936     return BCM_E_UNAVAIL;
  66937 }
  66938 
  66939 /*
  66940  * Function:
  66941  *      bcm_esw_field_qualify_FibreChanVFTHopCount_get
  66942  * Purpose:
  66943  *      Get match criteria for bcmFieildQualifyFibreChanVFTHopCount
  66944  *      qualifier from the field entry.
  66945  * Parameters:
  66946  *      unit    - (IN) Unit number.
  66947  *      entry   - (IN) BCM field entry id.
  66948  *      data    - (OUT) Qualifier match data.
  66949  *      mask    - (OUT) Qualifier match mask.
  66950  * Returns:
  66951  *      BCM_E_XXX
  66952  * Notes:
  66953  */
  66954 int
  66955 bcm_esw_field_qualify_FibreChanVFTHopCount_get(
  66956     int unit,
  66957     bcm_field_entry_t entry,
  66958     uint8 *data,
  66959     uint8 *mask)
  66960 {
  66961     return BCM_E_UNAVAIL;
  66962 }
  66963 
  66964 /*
  66965  * Function:
  66966  *      bcm_esw_field_qualify_FibreChanVFTVsanId
  66967  * Purpose:
  66968  *      Set match criteria for bcmFieildQualifyFibreChanVFTVsanId
  66969  *      qualifier from the field entry.
  66970  * Parameters:
  66971  *      unit    - (IN) Unit number.
  66972  *      entry   - (IN) BCM field entry id.
  66973  *      data    - (IN) Qualifier match data.
  66974  *      mask    - (IN) Qualifier match mask.
  66975  * Returns:
  66976  *      BCM_E_XXX
  66977  * Notes:
  66978  */
  66979 int
  66980 bcm_esw_field_qualify_FibreChanVFTVsanId(
  66981     int unit,
  66982     bcm_field_entry_t entry,
  66983     uint16 data,
  66984     uint16 mask)
  66985 {
  66986     return BCM_E_UNAVAIL;
  66987 }
  66988 
  66989 /*
  66990  * Function:
  66991  *      bcm_esw_field_qualify_FibreChanVFTVsanId_get
  66992  * Purpose:
  66993  *      Get match criteria for bcmFieildQualifyFibreChanVFTVsanId
  66994  *      qualifier from the field entry.
  66995  * Parameters:
  66996  *      unit    - (IN) Unit number.
  66997  *      entry   - (IN) BCM field entry id.
  66998  *      data    - (OUT) Qualifier match data.
  66999  *      mask    - (OUT) Qualifier match mask.
  67000  * Returns:
  67001  *      BCM_E_XXX
  67002  * Notes:
  67003  */
  67004 int
  67005 bcm_esw_field_qualify_FibreChanVFTVsanId_get(
  67006     int unit,
  67007     bcm_field_entry_t entry,
  67008     uint16 *data,
  67009     uint16 *mask)
  67010 {
  67011     return BCM_E_UNAVAIL;
  67012 }
  67013 
  67014 /*
  67015  * Function:
  67016  *      bcm_esw_field_qualify_FibreChanVFTVsanPri
  67017  * Purpose:
  67018  *      Set match criteria for bcmFieildQualifyFibreChanVFTVsanPri
  67019  *      qualifier from the field entry.
  67020  * Parameters:
  67021  *      unit    - (IN) Unit number.
  67022  *      entry   - (IN) BCM field entry id.
  67023  *      data    - (IN) Qualifier match data.
  67024  *      mask    - (IN) Qualifier match mask.
  67025  * Returns:
  67026  *      BCM_E_XXX
  67027  * Notes:
  67028  */
  67029 int
  67030 bcm_esw_field_qualify_FibreChanVFTVsanPri(
  67031     int unit,
  67032     bcm_field_entry_t entry,
  67033     uint8 data,
  67034     uint8 mask)
  67035 {
  67036     return BCM_E_UNAVAIL;
  67037 }
  67038 
  67039 /*
  67040  * Function:
  67041  *      bcm_esw_field_qualify_FibreChanVFTVsanPri_get
  67042  * Purpose:
  67043  *      Get match criteria for bcmFieildQualifyFibreChanVFTVsanPri
  67044  *      qualifier from the field entry.
  67045  * Parameters:
  67046  *      unit    - (IN) Unit number.
  67047  *      entry   - (IN) BCM field entry id.
  67048  *      data    - (OUT) Qualifier match data.
  67049  *      mask    - (OUT) Qualifier match mask.
  67050  * Returns:
  67051  *      BCM_E_XXX
  67052  * Notes:
  67053  */
  67054 int
  67055 bcm_esw_field_qualify_FibreChanVFTVsanPri_get(
  67056     int unit,
  67057     bcm_field_entry_t entry,
  67058     uint8 *data,
  67059     uint8 *mask)
  67060 {
  67061     return BCM_E_UNAVAIL;
  67062 }
  67063 
  67064 /*
  67065  * Function:
  67066  *      bcm_esw_field_qualify_FibreChanVFTValid
  67067  * Purpose:
  67068  *      Set match criteria for bcmFieildQualifyFibreChanVFTValid
  67069  *      qualifier from the field entry.
  67070  * Parameters:
  67071  *      unit    - (IN) Unit number.
  67072  *      entry   - (IN) BCM field entry id.
  67073  *      data    - (IN) Qualifier match data.
  67074  *      mask    - (IN) Qualifier match mask.
  67075  * Returns:
  67076  *      BCM_E_XXX
  67077  * Notes:
  67078  */
  67079 int
  67080 bcm_esw_field_qualify_FibreChanVFTValid(
  67081     int unit,
  67082     bcm_field_entry_t entry,
  67083     uint8 data,
  67084     uint8 mask)
  67085 {
  67086     return BCM_E_UNAVAIL;
  67087 }
  67088 
  67089 /*
  67090  * Function:
  67091  *      bcm_esw_field_qualify_FibreChanVFTValid_get
  67092  * Purpose:
  67093  *      Get match criteria for bcmFieildQualifyFibreChanVFTValid
  67094  *      qualifier from the field entry.
  67095  * Parameters:
  67096  *      unit    - (IN) Unit number.
  67097  *      entry   - (IN) BCM field entry id.
  67098  *      data    - (OUT) Qualifier match data.
  67099  *      mask    - (OUT) Qualifier match mask.
  67100  * Returns:
  67101  *      BCM_E_XXX
  67102  * Notes:
  67103  */
  67104 int
  67105 bcm_esw_field_qualify_FibreChanVFTValid_get(
  67106     int unit,
  67107     bcm_field_entry_t entry,
  67108     uint8 *data,
  67109     uint8 *mask)
  67110 {
  67111     return BCM_E_UNAVAIL;
  67112 }
  67113 
  67114 /*
  67115  * Function:
  67116  *      bcm_esw_field_qualify_FcoeSOF
  67117  * Purpose:
  67118  *      Set match criteria for bcmFieildQualifyFcoeSOF
  67119  *      qualifier from the field entry.
  67120  * Parameters:
  67121  *      unit    - (IN) Unit number.
  67122  *      entry   - (IN) BCM field entry id.
  67123  *      data    - (IN) Qualifier match data.
  67124  *      mask    - (IN) Qualifier match mask.
  67125  * Returns:
  67126  *      BCM_E_XXX
  67127  * Notes:
  67128  */
  67129 int
  67130 bcm_esw_field_qualify_FcoeSOF(
  67131     int unit,
  67132     bcm_field_entry_t entry,
  67133     uint8 data,
  67134     uint8 mask)
  67135 {
  67136     return BCM_E_UNAVAIL;
  67137 }
  67138 
  67139 /*
  67140  * Function:
  67141  *      bcm_esw_field_qualify_FcoeSOF_get
  67142  * Purpose:
  67143  *      Get match criteria for bcmFieildQualifyFcoeSOF
  67144  *      qualifier from the field entry.
  67145  * Parameters:
  67146  *      unit    - (IN) Unit number.
  67147  *      entry   - (IN) BCM field entry id.
  67148  *      data    - (OUT) Qualifier match data.
  67149  *      mask    - (OUT) Qualifier match mask.
  67150  * Returns:
  67151  *      BCM_E_XXX
  67152  * Notes:
  67153  */
  67154 int
  67155 bcm_esw_field_qualify_FcoeSOF_get(
  67156     int unit,
  67157     bcm_field_entry_t entry,
  67158     uint8 *data,
  67159     uint8 *mask)
  67160 {
  67161     return BCM_E_UNAVAIL;
  67162 }
  67163 
  67164 /*
  67165  * Function:
  67166  *      bcm_esw_field_qualify_FcoeVersionIsZero
  67167  * Purpose:
  67168  *      Set match criteria for bcmFieildQualifyFcoeVersionIsZero
  67169  *      qualifier from the field entry.
  67170  * Parameters:
  67171  *      unit    - (IN) Unit number.
  67172  *      entry   - (IN) BCM field entry id.
  67173  *      data    - (IN) Qualifier match data.
  67174  *      mask    - (IN) Qualifier match mask.
  67175  * Returns:
  67176  *      BCM_E_XXX
  67177  * Notes:
  67178  */
  67179 int
  67180 bcm_esw_field_qualify_FcoeVersionIsZero(
  67181     int unit,
  67182     bcm_field_entry_t entry,
  67183     uint8 data,
  67184     uint8 mask)
  67185 {
  67186     return BCM_E_UNAVAIL;
  67187 }
  67188 
  67189 /*
  67190  * Function:
  67191  *      bcm_esw_field_qualify_FcoeVersionIsZero_get
  67192  * Purpose:
  67193  *      Get match criteria for bcmFieildQualifyFcoeVersionIsZero
  67194  *      qualifier from the field entry.
  67195  * Parameters:
  67196  *      unit    - (IN) Unit number.
  67197  *      entry   - (IN) BCM field entry id.
  67198  *      data    - (OUT) Qualifier match data.
  67199  *      mask    - (OUT) Qualifier match mask.
  67200  * Returns:
  67201  *      BCM_E_XXX
  67202  * Notes:
  67203  */
  67204 int
  67205 bcm_esw_field_qualify_FcoeVersionIsZero_get(
  67206     int unit,
  67207     bcm_field_entry_t entry,
  67208     uint8 *data,
  67209     uint8 *mask)
  67210 {
  67211     return BCM_E_UNAVAIL ;
  67212 }
  67213 
  67214 /*
  67215  * Function:
  67216  *     bcm_esw_field_entry_operation
  67217  * Purpose:
  67218  *     Perform entry backup, restore and backup copy free operations
  67219  * Parameters:
  67220  *     unit       - (IN) BCM device number.
  67221  *     entry_oper - (IN) Pointer to field entry operation structure
  67222  * Returns:
  67223  *     BCM_E_XXX
  67224  */
  67225 int
  67226 bcm_esw_field_entry_operation(int unit, bcm_field_entry_oper_t *entry_oper)
  67227 {
  67228     return (BCM_E_UNAVAIL);
  67229 }
  67230 
  67231 int
  67232 bcm_esw_field_qualify_OamMdl(
  67233     int unit,
  67234     bcm_field_entry_t entry,
  67235     uint8 data,
  67236     uint8 mask)
  67237 {
  67238     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  67239 }
  67240 
  67241 int
  67242 bcm_esw_field_qualify_OamMdl_get(
  67243     int unit,
  67244     bcm_field_entry_t entry,
  67245     uint8 *data,
  67246     uint8 *mask)
  67247 {
  67248     int rv = BCM_E_UNAVAIL;  /* Operation return status.      */
  67249 }
  67250 
  67251 /*
  67252  * Function:
  67253  *      bcm_esw_field_qualify_IngressInterfaceClassVPort
  67254  * Purpose:
  67255  *      Set match criteria for bcmFieildQualifyIngressInterfaceClassVPort
  67256  *      qualifier from the field entry.
  67257  * Parameters:
  67258  *      unit    - (IN) Unit number.
  67259  *      entry   - (IN) BCM field entry id.
  67260  *      data    - (IN) Qualifier match data.
  67261  *      mask    - (IN) Qualifier match mask.
  67262  * Returns:
  67263  *      BCM_E_XXX
  67264  * Notes:
  67265  */
  67266 int 
  67267 bcm_esw_field_qualify_IngressInterfaceClassVPort(
  67268     int unit, 
  67269     bcm_field_entry_t entry,  
  67270     uint32 data, 
  67271     uint32 mask) 
  67272 {
  67273     return BCM_E_UNAVAIL;
  67274 }
  67275 
  67276 /*
  67277  * Function:
  67278  *      bcm_esw_field_qualify_IngressInterfaceClassVPort_get
  67279  * Purpose:
  67280  *      Get match criteria for bcmFieildQualifyIngressInterfaceClassVPort
  67281  *      qualifier from the field entry.
  67282  * Parameters:
  67283  *      unit    - (IN) Unit number. 
  67284  *      entry   - (IN) BCM field entry id.
  67285  *      data    - (OUT) Qualifier match data.
  67286  *      mask    - (OUT) Qualifier match mask.
  67287  * Returns:
  67288  *      BCM_E_XXX
  67289  * Notes:
  67290  */
  67291 int
  67292 bcm_esw_field_qualify_IngressInterfaceClassVPort_get(
  67293     int unit,
  67294     bcm_field_entry_t entry,
  67295     uint32 *data,
  67296     uint32 *mask)
  67297 {
  67298     return BCM_E_UNAVAIL;
  67299 }
  67300 
  67301 
  67302 
  67303 /* bcm_esw_field_qualify_SrcVlanGports */
  67304 int bcm_esw_field_qualify_SrcVlanGports(
  67305     int unit,
  67306     bcm_field_entry_t entry,
  67307     bcm_gport_t vlan_port_id,
  67308     bcm_gport_t vlan_port_mask)
  67309 {
  67310     return BCM_E_UNAVAIL;
  67311 }
  67312 
  67313 /* bcm_esw_field_qualify_DstVlanGports */
  67314 int bcm_esw_field_qualify_DstVlanGports(
  67315     int unit,
  67316     bcm_field_entry_t entry,
  67317     bcm_gport_t vlan_port_id,
  67318     bcm_gport_t vlan_port_mask)
  67319 {
  67320     return BCM_E_UNAVAIL;
  67321 }
  67322 /*
  67323  * Get match criteria for bcmFieldQualifySrcVlanGports
  67324  *                qualifier from the field entry.
  67325  */
  67326 int bcm_esw_field_qualify_SrcVlanGports_get(
  67327     int unit,
  67328     bcm_field_entry_t entry,
  67329     bcm_gport_t *vlan_port_id,
  67330     bcm_gport_t *vlan_port_mask)
  67331 {
  67332     return BCM_E_UNAVAIL;
  67333 }
  67334 
  67335 /*
  67336  * Get match criteria for bcmFieldQualifyDstVlanGports
  67337  *                qualifier from the field entry.
  67338  */
  67339 int bcm_esw_field_qualify_DstVlanGports_get(
  67340     int unit,
  67341     bcm_field_entry_t entry,
  67342     bcm_gport_t *vlan_port_id,
  67343     bcm_gport_t *vlan_port_mask)
  67344 {
  67345     return BCM_E_UNAVAIL;
  67346 }
  67347 
  67348 /* bcm_esw_field_qualify_SrcVxlanGports */
  67349 int bcm_esw_field_qualify_SrcVxlanGports(
  67350     int unit,
  67351     bcm_field_entry_t entry,
  67352     bcm_gport_t vxlan_port_id,
  67353     bcm_gport_t vxlan_port_mask)
  67354 {
  67355     return BCM_E_UNAVAIL;
  67356 }
  67357 
  67358 /* bcm_esw_field_qualify_DstVxlanGports */
  67359 int bcm_esw_field_qualify_DstVxlanGports(
  67360     int unit,
  67361     bcm_field_entry_t entry,
  67362     bcm_gport_t vxlan_port_id,
  67363     bcm_gport_t vxlan_port_mask)
  67364 {
  67365     return BCM_E_UNAVAIL;
  67366 }
  67367 
  67368 /*
  67369  * Get match criteria for bcmFieldQualifySrcVxlanGports
  67370  *                qualifier from the field entry.
  67371  */
  67372 int bcm_esw_field_qualify_SrcVxlanGports_get(
  67373     int unit,
  67374     bcm_field_entry_t entry,
  67375     bcm_gport_t *vxlan_port_id,
  67376     bcm_gport_t *vxlan_port_mask)
  67377 {
  67378     return BCM_E_UNAVAIL;
  67379 }
  67380 
  67381 /*
  67382  * Get match criteria for bcmFieldQualifyDstVxlanGports
  67383  *                qualifier from the field entry.
  67384  */
  67385 int bcm_esw_field_qualify_DstVxlanGports_get(
  67386     int unit,
  67387     bcm_field_entry_t entry,
  67388     bcm_gport_t *vxlan_port_id,
  67389     bcm_gport_t *vxlan_port_mask)
  67390 {
  67391     return BCM_E_UNAVAIL;
  67392 }
  67393 
  67394 /* bcm_esw_field_qualify_SrcWlanGports */
  67395 int bcm_esw_field_qualify_SrcWlanGports(
  67396     int unit,
  67397     bcm_field_entry_t entry,
  67398     bcm_gport_t wlan_port_id,
  67399     bcm_gport_t wlan_port_mask)
  67400 {
  67401     return BCM_E_UNAVAIL;
  67402 }
  67403 
  67404 /* bcm_esw_field_qualify_DstWlanGports */
  67405 int bcm_esw_field_qualify_DstWlanGports(
  67406     int unit,
  67407     bcm_field_entry_t entry,
  67408     bcm_gport_t wlan_port_id,
  67409     bcm_gport_t wlan_port_mask)
  67410 {
  67411     return BCM_E_UNAVAIL;
  67412 }
  67413 
  67414 /*
  67415  * Get match criteria for bcmFieldQualifySrcWlanGports
  67416  *                qualifier from the field entry.
  67417  */
  67418 int bcm_esw_field_qualify_SrcWlanGports_get(
  67419     int unit,
  67420     bcm_field_entry_t entry,
  67421     bcm_gport_t *wlan_port_id,
  67422     bcm_gport_t *wlan_port_mask)
  67423 {
  67424     return BCM_E_UNAVAIL;
  67425 }
  67426 
  67427 /*
  67428  * Get match criteria for bcmFieldQualifyDstWlanGports
  67429  *                qualifier from the field entry.
  67430  */
  67431 int bcm_esw_field_qualify_DstWlanGports_get(
  67432     int unit,
  67433     bcm_field_entry_t entry,
  67434     bcm_gport_t *wlan_port_id,
  67435     bcm_gport_t *wlan_port_mask)
  67436 {
  67437     return BCM_E_UNAVAIL;
  67438 }
  67439 
  67440 /* bcm_esw_field_qualify_SrcMplsGports */
  67441 int bcm_esw_field_qualify_SrcMplsGports(
  67442     int unit,
  67443     bcm_field_entry_t entry,
  67444     bcm_gport_t mpls_port_id,
  67445     bcm_gport_t mpls_port_mask)
  67446 {
  67447     return BCM_E_UNAVAIL;
  67448 }
  67449 
  67450 /* bcm_esw_field_qualify_DstMplsGports */
  67451 int bcm_esw_field_qualify_DstMplsGports(
  67452     int unit,
  67453     bcm_field_entry_t entry,
  67454     bcm_gport_t mpls_port_id,
  67455     bcm_gport_t mpls_port_mask)
  67456 {
  67457     return BCM_E_UNAVAIL;
  67458 }
  67459 
  67460 /*
  67461  * Get match criteria for bcmFieldQualifySrcMplsGports
  67462  *                qualifier from the field entry.
  67463  */
  67464 int bcm_esw_field_qualify_SrcMplsGports_get(
  67465     int unit,
  67466     bcm_field_entry_t entry,
  67467     bcm_gport_t *mpls_port_id,
  67468     bcm_gport_t *mpls_port_mask)
  67469 {
  67470     return BCM_E_UNAVAIL;
  67471 }
  67472 
  67473 /*
  67474  * Get match criteria for bcmFieldQualifyDstMplsGports
  67475  *                qualifier from the field entry.
  67476  */
  67477 int bcm_esw_field_qualify_DstMplsGports_get(
  67478     int unit,
  67479     bcm_field_entry_t entry,
  67480     bcm_gport_t *mpls_port_id,
  67481     bcm_gport_t *mpls_port_mask)
  67482 {
  67483     return BCM_E_UNAVAIL;
  67484 }
  67485 
  67486 /* bcm_esw_field_qualify_SrcGports */
  67487 int bcm_esw_field_qualify_SrcGports(
  67488     int unit,
  67489     bcm_field_entry_t entry,
  67490     bcm_gport_t port_id,
  67491     bcm_gport_t port_mask)
  67492 {
  67493     return BCM_E_UNAVAIL;
  67494 }
  67495 
  67496 /* bcm_esw_field_qualify_DstGports */
  67497 int bcm_esw_field_qualify_DstGports(
  67498     int unit,
  67499     bcm_field_entry_t entry,
  67500     bcm_gport_t port_id,
  67501     bcm_gport_t port_mask)
  67502 {
  67503     return BCM_E_UNAVAIL;
  67504 }
  67505 
  67506 /*
  67507  * Get match criteria for bcmFieldQualifySrcGports
  67508  *                qualifier from the field entry.
  67509  */
  67510 int bcm_esw_field_qualify_SrcGports_get(
  67511     int unit,
  67512     bcm_field_entry_t entry,
  67513     bcm_gport_t *port_id,
  67514     bcm_gport_t *port_mask)
  67515 {
  67516     return BCM_E_UNAVAIL;
  67517 }
  67518 
  67519 /*
  67520  * Get match criteria for bcmFieldQualifyDstGports
  67521  *                qualifier from the field entry.
  67522  */
  67523 int bcm_esw_field_qualify_DstGports_get(
  67524     int unit,
  67525     bcm_field_entry_t entry,
  67526     bcm_gport_t *port_id,
  67527     bcm_gport_t *port_mask)
  67528 {
  67529     return BCM_E_UNAVAIL;
  67530 }
  67531 
  67532 /* bcm_esw_field_qualify_SrcMimGports */
  67533 int bcm_esw_field_qualify_SrcMimGports(
  67534     int unit,
  67535     bcm_field_entry_t entry,
  67536     bcm_gport_t mim_port_id,
  67537     bcm_gport_t mim_port_mask)
  67538 {
  67539     return BCM_E_UNAVAIL;
  67540 }
  67541 
  67542 /* bcm_esw_field_qualify_DstMimGports */
  67543 int bcm_esw_field_qualify_DstMimGports(
  67544     int unit,
  67545     bcm_field_entry_t entry,
  67546     bcm_gport_t mim_port_id,
  67547     bcm_gport_t mim_port_mask)
  67548 {
  67549     return BCM_E_UNAVAIL;
  67550 }
  67551 
  67552 /*
  67553  * Get match criteria for bcmFieldQualifySrcMimGports
  67554  *                qualifier from the field entry.
  67555  */
  67556 int bcm_esw_field_qualify_SrcMimGports_get(
  67557     int unit,
  67558     bcm_field_entry_t entry,
  67559     bcm_gport_t *mim_port_id,
  67560     bcm_gport_t *mim_port_mask)
  67561 {
  67562     return BCM_E_UNAVAIL;
  67563 }
  67564 
  67565 /*
  67566  * Get match criteria for bcmFieldQualifyDstMimGports
  67567  *                qualifier from the field entry.
  67568  */
  67569 int bcm_esw_field_qualify_DstMimGports_get(
  67570     int unit,
  67571     bcm_field_entry_t entry,
  67572     bcm_gport_t *mim_port_id,
  67573     bcm_gport_t *mim_port_mask)
  67574 {
  67575     return BCM_E_UNAVAIL;
  67576 }
  67577 
  67578 /* bcm_esw_field_qualify_SrcNivGports */
  67579 int bcm_esw_field_qualify_SrcNivGports(
  67580     int unit,
  67581     bcm_field_entry_t entry,
  67582     bcm_gport_t niv_port_id,
  67583     bcm_gport_t niv_port_mask)
  67584 {
  67585     return BCM_E_UNAVAIL;
  67586 }
  67587 
  67588 /* bcm_esw_field_qualify_DstNivGports */
  67589 int bcm_esw_field_qualify_DstNivGports(
  67590     int unit,
  67591     bcm_field_entry_t entry,
  67592     bcm_gport_t niv_port_id,
  67593     bcm_gport_t niv_port_mask)
  67594 {
  67595     return BCM_E_UNAVAIL;
  67596 }
  67597 
  67598 /*
  67599  * Get match criteria for bcmFieldQualifySrcNivGports
  67600  *                qualifier from the field entry.
  67601  */
  67602 int bcm_esw_field_qualify_SrcNivGports_get(
  67603     int unit,
  67604     bcm_field_entry_t entry,
  67605     bcm_gport_t *niv_port_id,
  67606     bcm_gport_t *niv_port_mask)
  67607 {
  67608     return BCM_E_UNAVAIL;
  67609 }
  67610 
  67611 /*
  67612  * Get match criteria for bcmFieldQualifyDstNivGports
  67613  *                qualifier from the field entry.
  67614  */
  67615 int bcm_esw_field_qualify_DstNivGports_get(
  67616     int unit,
  67617     bcm_field_entry_t entry,
  67618     bcm_gport_t *niv_port_id,
  67619     bcm_gport_t *niv_port_mask)
  67620 {
  67621     return BCM_E_UNAVAIL;
  67622 }
  67623 
  67624 /* bcm_esw_field_qualify_SrcModPortGports */
  67625 int bcm_esw_field_qualify_SrcModPortGports(
  67626     int unit,
  67627     bcm_field_entry_t entry,
  67628     bcm_gport_t port_id,
  67629     bcm_gport_t port_mask)
  67630 {
  67631     return BCM_E_UNAVAIL;
  67632 }
  67633 
  67634 /*
  67635  * Get match criteria for bcmFieldQualifySrcModPortGports
  67636  *                qualifier from the field entry.
  67637  */
  67638 int bcm_esw_field_qualify_SrcModPortGports_get(
  67639     int unit,
  67640     bcm_field_entry_t entry,
  67641     bcm_gport_t *port_id,
  67642     bcm_gport_t *port_mask)
  67643 {
  67644     return BCM_E_UNAVAIL;
  67645 }
  67646 
  67647 /* Qualify Reserved_1 field in Vxlan Header */
  67648 int bcm_esw_field_qualify_VxlanHeaderBits8_31(
  67649     int unit,
  67650     bcm_field_entry_t entry,
  67651     uint32 data,
  67652     uint32 mask)
  67653 {
  67654     return BCM_E_UNAVAIL;
  67655 }
  67656 
  67657 /* Get match criteria for Reserved_1 field in Vxlan Header */
  67658 int bcm_esw_field_qualify_VxlanHeaderBits8_31_get(
  67659     int unit,
  67660     bcm_field_entry_t entry,
  67661     uint32 *data,
  67662     uint32 *mask)
  67663 {
  67664     return BCM_E_UNAVAIL;
  67665 }
  67666 
  67667 /* Qualify Reserved_2 field in Vxlan Header */
  67668 int bcm_esw_field_qualify_VxlanHeaderBits56_63(
  67669     int unit,
  67670     bcm_field_entry_t entry,
  67671     uint8 data,
  67672     uint8 mask)
  67673 {
  67674     return BCM_E_UNAVAIL;
  67675 }
  67676 
  67677 /* Get match criteria for Reserved_2 field in Vxlan Header */
  67678 int bcm_esw_field_qualify_VxlanHeaderBits56_63_get(
  67679     int unit,
  67680     bcm_field_entry_t entry,
  67681     uint8 *data,
  67682     uint8 *mask)
  67683 {
  67684     return BCM_E_UNAVAIL;
  67685 }
  67686 
  67687 /* Create a hint id. */
  67688 int bcm_esw_field_hints_create(int unit,
  67689                            bcm_field_hintid_t *hint_id)
  67690 {
  67691     return BCM_E_UNAVAIL;
  67692 }
  67693 
  67694 /* Add bcm_field_hint_t structure to a hint_id */
  67695 int bcm_esw_field_hints_add(int unit,
  67696                         bcm_field_hintid_t hint_id,
  67697                         bcm_field_hint_t *hint)
  67698 {
  67699     return BCM_E_UNAVAIL;
  67700 }
  67701 
  67702 /* Delete bcm_field_hint_t structure from a hint_id */
  67703 int bcm_esw_field_hints_delete(int unit,
  67704                            bcm_field_hintid_t hint_id,
  67705                            bcm_field_hint_t *hint)
  67706 {
  67707     return BCM_E_UNAVAIL;
  67708 }
  67709 
  67710 /* Delete all the bcm_field_hint_t structures from a hint_id */
  67711 int bcm_esw_field_hints_delete_all(int unit,
  67712                                bcm_field_hintid_t hint_id)
  67713 {
  67714     return BCM_E_UNAVAIL;
  67715 }
  67716 
  67717 /* Delete bcm_field_hint_t structure from a hint_id */
  67718 int bcm_esw_field_hints_get(int unit,
  67719                         bcm_field_hintid_t hint_id,
  67720                         bcm_field_hint_t *hint)
  67721 {
  67722     return BCM_E_UNAVAIL;
  67723 }
  67724 
  67725 /* Delete all the bcm_field_hint_t structures from a hint_id */
  67726 int bcm_esw_field_hints_destroy(int unit,
  67727                             bcm_field_hintid_t hint_id)
  67728 {
  67729     return BCM_E_UNAVAIL;
  67730 }
  67731 
  67732 /*
  67733  * Function:
  67734  *      bcm_esw_field_qualify_OamType
  67735  * Purpose:
  67736  *      Set match criteria for bcmFieildQualifyOamType
  67737  *      qualifier from the field entry.
  67738  * Parameters:
  67739  *      unit    - (IN) Unit number.
  67740  *      entry   - (IN) BCM field entry id.
  67741  *      data    - (IN) Qualifier match data.
  67742  *      mask    - (IN) Qualifier match mask.
  67743  * Returns:
  67744  *      BCM_E_XXX
  67745  * Notes:
  67746  */
  67747 int
  67748 bcm_esw_field_qualify_OamType(
  67749     int unit,
  67750     bcm_field_entry_t entry,
  67751     bcm_field_oam_type_t oam_type)
  67752 {
  67753     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  67754     return(rv);
  67755 }
  67756 
  67757 /*
  67758  * Function:
  67759  *      bcm_esw_field_qualify_OamType_get
  67760  * Purpose:
  67761  *      Get match criteria for bcmFieildQualifyOamType
  67762  *      qualifier from the field entry.
  67763  * Parameters:
  67764  *      unit    - (IN) Unit number.
  67765  *      entry   - (IN) BCM field entry id.
  67766  *      data    - (OUT) Qualifier match data.
  67767  *      mask    - (OUT) Qualifier match mask.
  67768  * Returns:
  67769  *      BCM_E_XXX
  67770  * Notes:
  67771  */
  67772 int
  67773 bcm_esw_field_qualify_OamType_get(
  67774     int unit,
  67775     bcm_field_entry_t entry,
  67776     bcm_field_oam_type_t *oam_type)
  67777 {
  67778     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  67779     return(rv);
  67780 }
  67781 
  67782 
  67783 
  67784 /*
  67785  * Function:
  67786  *     bcm_esw_field_qualify_OamHeaderBits0_31
  67787  * Purpose:
  67788  *      Set match criteria for bcmFieldQualifyOamHeaderBits0_31
  67789  *      qualifier from the field entry.
  67790  * Parameters:
  67791  *      unit    - (IN) Unit number.
  67792  *      entry   - (IN) BCM field entry id.
  67793  *      data    - (IN) Qualifies on First 4 Bytes of OAM Header
  67794                        in Egress Pipeline.
  67795  *      mask    - (IN) Qualifier match mask.
  67796  * Returns:
  67797  *      BCM_E_XXX
  67798  * Notes:
  67799  */
  67800 int
  67801 bcm_esw_field_qualify_OamHeaderBits0_31(
  67802     int unit, bcm_field_entry_t entry,
  67803     uint32 data, uint32 mask)
  67804 {
  67805     return BCM_E_UNAVAIL;
  67806 }
  67807 
  67808 
  67809 /*
  67810  * Function:
  67811  *     bcm_esw_field_qualify_OamHeaderBits0_31_get
  67812  * Purpose:
  67813  *      Get match criteria for bcmFieldQualifyOamHeaderBits0_31
  67814  *      qualifier from the field entry.
  67815  * Parameters:
  67816  *      unit    - (IN)  Unit number.
  67817  *      entry   - (IN)  BCM field entry id.
  67818  *      data    - (OUT) First 4 Bytes of OAM Header
  67819                         in Egress Pipeline.
  67820  *      mask    - (OUT) Qualifier match mask.
  67821  * Returns:
  67822  *      BCM_E_XXX
  67823  * Notes:
  67824  */
  67825 int
  67826 bcm_esw_field_qualify_OamHeaderBits0_31_get(
  67827     int unit, bcm_field_entry_t entry, uint32 *data,
  67828     uint32 *mask)
  67829 {
  67830     return BCM_E_UNAVAIL;
  67831 }
  67832 
  67833 
  67834 /*
  67835  * Function:
  67836  *     bcm_esw_field_qualify_OamHeaderBits32_63
  67837  * Purpose:
  67838  *      Set match criteria for bcmFieldQualifyOamHeaderBits32_63
  67839  *      qualifier from the field entry.
  67840  * Parameters:
  67841  *      unit    - (IN) Unit number.
  67842  *      entry   - (IN) BCM field entry id.
  67843  *      data    - (IN) Qualifies on Second 4 Bytes of OAM Header
  67844                        in Egress Pipeline.
  67845  *      mask    - (IN) Qualifier match mask.
  67846  * Returns:
  67847  *      BCM_E_XXX
  67848  * Notes:
  67849  */
  67850 int bcm_esw_field_qualify_OamHeaderBits32_63(
  67851     int unit,
  67852     bcm_field_entry_t entry,
  67853     uint32 data,
  67854     uint32 mask)
  67855 {
  67856     return BCM_E_UNAVAIL;
  67857 }
  67858 
  67859 /*
  67860  * Function:
  67861  *     bcm_esw_field_qualify_OamHeaderBits32_63_get
  67862  * Purpose:
  67863  *      Get match criteria for bcmFieldQualifyOamHeaderBits32_63
  67864  *      qualifier from the field entry.
  67865  * Parameters:
  67866  *      unit    - (IN)  Unit number.
  67867  *      entry   - (IN)  BCM field entry id.
  67868  *      data    - (OUT) Second 4 Bytes of OAM Header
  67869                         in Egress Pipeline.
  67870  *      mask    - (OUT) Qualifier match mask.
  67871  * Returns:
  67872  *      BCM_E_XXX
  67873  * Notes:
  67874  */
  67875 int bcm_esw_field_qualify_OamHeaderBits32_63_get(
  67876     int unit,
  67877     bcm_field_entry_t entry,
  67878     uint32 *data,
  67879     uint32 *mask)
  67880 {
  67881     return BCM_E_UNAVAIL;
  67882 }
  67883 
  67884 /*
  67885  * Function:
  67886  *     bcm_esw_field_qualify_OamEgressClassPort
  67887  * Purpose:
  67888  *      Set match criteria for bcmFieldQualifyOamEgressClassPort
  67889  *      qualifier from the field entry.
  67890  * Parameters:
  67891  *      unit    - (IN) Unit number.
  67892  *      entry   - (IN) BCM field entry id.
  67893  *      data    - (IN) Qualify the OAM ClassId obtained from EGR_PORT table
  67894                        in Egress Pipeline.
  67895  *      mask    - (IN) Qualifier match mask.
  67896  * Returns:
  67897  *      BCM_E_XXX
  67898  * Notes:
  67899  */
  67900 int bcm_esw_field_qualify_OamEgressClassPort(
  67901     int unit,
  67902     bcm_field_entry_t entry,
  67903     uint16 data,
  67904     uint16 mask)
  67905 {
  67906     return BCM_E_UNAVAIL;
  67907 }
  67908 
  67909 /*
  67910  * Function:
  67911  *     bcm_esw_field_qualify_OamEgressClassPort_get
  67912  * Purpose:
  67913  *      Get match criteria for bcmFieldQualifyOamEgressClassPort
  67914  *      qualifier from the field entry.
  67915  * Parameters:
  67916  *      unit    - (IN)  Unit number.
  67917  *      entry   - (IN)  BCM field entry id.
  67918  *      data    - (OUT) OAM ClassId obtained from EGR_PORT table
  67919                         in Egress Pipeline.
  67920  *      mask    - (OUT) Qualifier match mask.
  67921  * Returns:
  67922  *      BCM_E_XXX
  67923  * Notes:
  67924  */
  67925 int bcm_esw_field_qualify_OamEgressClassPort_get(
  67926     int unit,
  67927     bcm_field_entry_t entry,
  67928     uint16 *data,
  67929     uint16 *mask)
  67930 {
  67931     return BCM_E_UNAVAIL;
  67932 }
  67933 
  67934 /*
  67935  * Function:
  67936  *     bcm_esw_field_qualify_OamEgressClassVxlt
  67937  * Purpose:
  67938  *      Set match criteria for bcmFieldQualifyOamEgressClassVxlt
  67939  *      qualifier from the field entry.
  67940  * Parameters:
  67941  *      unit    - (IN) Unit number.
  67942  *      entry   - (IN) BCM field entry id.
  67943  *      data    - (IN) Qualify the OAM ClassId obtained from Vlan_Xlate table
  67944                        in Egress Pipeline.
  67945  *      mask    - (IN) Qualifier match mask.
  67946  * Returns:
  67947  *      BCM_E_XXX
  67948  * Notes:
  67949  */
  67950 
  67951 int bcm_esw_field_qualify_OamEgressClassVxlt(
  67952     int unit,
  67953     bcm_field_entry_t entry,
  67954     uint16 data,
  67955     uint16 mask)
  67956 {
  67957     return BCM_E_UNAVAIL;
  67958 }
  67959 /*
  67960  * Function:
  67961  *     bcm_esw_field_qualify_OamEgressClassVxlt_get
  67962  * Purpose:
  67963  *      Get match criteria for bcmFieldQualifyOamEgressClassVxlt
  67964  *      qualifier from the field entry.
  67965  * Parameters:
  67966  *      unit    - (IN)  Unit number.
  67967  *      entry   - (IN)  BCM field entry id.
  67968  *      data    - (OUT) OAM ClassId obtained from Vlan_Xlate table
  67969                         in Egress Pipeline.
  67970  *      mask    - (OUT) Qualifier match mask.
  67971  * Returns:
  67972  *      BCM_E_XXX
  67973  * Notes:
  67974  */
  67975 
  67976 int bcm_esw_field_qualify_OamEgressClassVxlt_get(
  67977     int unit,
  67978     bcm_field_entry_t entry,
  67979     uint16 *data,
  67980     uint16 *mask)
  67981 {
  67982     return BCM_E_UNAVAIL;
  67983 }
  67984 
  67985 /*
  67986  * Function:
  67987  *    bcm_esw_field_qualify_EthernetOamHeaderBits0_31
  67988  * Purpose:
  67989  *      Set match criteria for bcmFieldQualifyEthernetOamHeaderBits0_31
  67990  *      qualifier from the field entry.
  67991  * Parameters:
  67992  *      unit    - (IN) Unit number.
  67993  *      entry   - (IN) BCM field entry id.
  67994  *      data    - (IN) Qualifies on First 4 Bytes of Ethernet OAM Header.
  67995  *      mask    - (IN) Qualifier match mask.
  67996  * Returns:
  67997  *      BCM_E_XXX
  67998  * Notes:
  67999  */
  68000 int bcm_esw_field_qualify_EthernetOamHeaderBits0_31(
  68001     int unit,
  68002     bcm_field_entry_t entry,
  68003     uint32 data,
  68004     uint32 mask)
  68005 {
  68006     return BCM_E_UNAVAIL;
  68007 }
  68008 
  68009 /*
  68010  * Function:
  68011  *     bcm_esw_field_qualify_EthernetOamHeaderBits0_31_get
  68012  * Purpose:
  68013  *      Get match criteria for bcmFieldQualifyEthernetOamHeaderBits0_31
  68014  *      qualifier from the field entry.
  68015  * Parameters:
  68016  *      unit    - (IN)  Unit number.
  68017  *      entry   - (IN)  BCM field entry id.
  68018  *      data    - (OUT) First 4 Bytes of Ethernet OAM Header.
  68019  *      mask    - (OUT) Qualifier match mask.
  68020  * Returns:
  68021  *      BCM_E_XXX
  68022  * Notes:
  68023  */
  68024 int bcm_esw_field_qualify_EthernetOamHeaderBits0_31_get(
  68025     int unit,
  68026     bcm_field_entry_t entry,
  68027     uint32 *data,
  68028     uint32 *mask)
  68029 {
  68030     return BCM_E_UNAVAIL;
  68031 }
  68032 
  68033 /*
  68034  * Function:
  68035  *     bcm_esw_field_qualify_EthernetOamHeaderBits32_63
  68036  * Purpose:
  68037  *      Set match criteria for bcmFieldQualifyEthernetOamHeaderBits32_63
  68038  *      qualifier from the field entry.
  68039  * Parameters:
  68040  *      unit    - (IN) Unit number.
  68041  *      entry   - (IN) BCM field entry id.
  68042  *      data    - (IN) Qualifies on Second 4 Bytes of Ethernet OAM Header.
  68043  *      mask    - (IN) Qualifier match mask.
  68044  * Returns:
  68045  *      BCM_E_XXX
  68046  * Notes:
  68047  */
  68048 
  68049 int bcm_esw_field_qualify_EthernetOamHeaderBits32_63(
  68050     int unit,
  68051     bcm_field_entry_t entry,
  68052     uint32 data,
  68053     uint32 mask)
  68054 {
  68055     return BCM_E_UNAVAIL;
  68056 }
  68057 /*
  68058  * Function:
  68059  *     bcm_esw_field_qualify_EthernetOamHeaderBits32_63_get
  68060  * Purpose:
  68061  *      Get match criteria for bcmFieldQualifyEthernetOamHeaderBit32_63
  68062  *      qualifier from the field entry.
  68063  * Parameters:
  68064  *      unit    - (IN)  Unit number.
  68065  *      entry   - (IN)  BCM field entry id.
  68066  *      data    - (OUT) Second 4 Bytes of Ethernet OAM Header.
  68067  *      mask    - (OUT) Qualifier match mask.
  68068  * Returns:
  68069  *      BCM_E_XXX
  68070  * Notes:
  68071  */
  68072 
  68073 int bcm_esw_field_qualify_EthernetOamHeaderBits32_63_get(
  68074     int unit,
  68075     bcm_field_entry_t entry,
  68076     uint32 *data,
  68077     uint32 *mask)
  68078 {
  68079     return BCM_E_UNAVAIL;
  68080 }
  68081 /*
  68082  * Function:
  68083  *     bcm_esw_field_qualifyEthernetOamDstClassL2
  68084  * Purpose:
  68085  *      Set match criteria for bcmFieldQualifyEthernetOamDstClassL2
  68086  *      qualifier from the field entry.
  68087  * Parameters:
  68088  *      unit    - (IN) Unit number.
  68089  *      entry   - (IN) BCM field entry id.
  68090  *      data    - (IN) Qualifies on Class Id obtained from
  68091                        DstMac lookup in L2 table.
  68092  *      mask    - (IN) Qualifier match mask.
  68093  * Returns:
  68094  *      BCM_E_XXX
  68095  * Notes:
  68096  */
  68097 int bcm_esw_field_qualify_EthernetOamDstClassL2(
  68098     int unit,
  68099     bcm_field_entry_t entry,
  68100     uint8 data,
  68101     uint8 mask)
  68102 {
  68103     return BCM_E_UNAVAIL;
  68104 }
  68105 
  68106 /*
  68107  * Function:
  68108  *     bcm_esw_field_qualify_EthernetOamDstClassL2_get
  68109  * Purpose:
  68110  *      Get match criteria for bcmFieldQualifyEthernetOamDstClassL2
  68111  *      qualifier from the field entry.
  68112  * Parameters:
  68113  *      unit    - (IN)  Unit number.
  68114  *      entry   - (IN)  BCM field entry id.
  68115  *      data    - (OUT) Class Id obtained from DstMac lookup in L2 table.
  68116  *      mask    - (OUT) Qualifier match mask.
  68117  * Returns:
  68118  *      BCM_E_XXX
  68119  * Notes:
  68120  */
  68121 int bcm_esw_field_qualify_EthernetOamDstClassL2_get(
  68122     int unit,
  68123     bcm_field_entry_t entry,
  68124     uint8 *data,
  68125     uint8 *mask)
  68126 {
  68127     return BCM_E_UNAVAIL;
  68128 }
  68129 
  68130 /*
  68131  * Function:
  68132  *     bcm_esw_field_qualify_EthernetOamTxPktUPMEP
  68133  * Purpose:
  68134  *      Set match criteria for bcmFieldQualifyEthernetOamTxPktUPMEP
  68135  *      qualifier from the field entry.
  68136  * Parameters:
  68137  *      unit    - (IN) Unit number.
  68138  *      entry   - (IN) BCM field entry id.
  68139  *      data    - (IN) Qualifies on Ethernet OAM UP-MEP Tx Pkt.
  68140  *      mask    - (IN) Qualifier match mask.
  68141  * Returns:
  68142  *      BCM_E_XXX
  68143  * Notes:
  68144  */
  68145 int bcm_esw_field_qualify_EthernetOamTxPktUPMEP(
  68146     int unit,
  68147     bcm_field_entry_t entry,
  68148     uint8 data,
  68149     uint8 mask)
  68150 {
  68151     return BCM_E_UNAVAIL;
  68152 }
  68153 
  68154 /*
  68155  * Function:
  68156  *     bcm_esw_field_qualify_EthernetOamTxPktUPMEP_get
  68157  * Purpose:
  68158  *      Get match criteria for bcmFieldQualifyEthernetOamTxPktUPMEP
  68159  *      qualifier from the field entry.
  68160  * Parameters:
  68161  *      unit    - (IN)  Unit number.
  68162  *      entry   - (IN)  BCM field entry id.
  68163  *      data    - (OUT) Ethernet OAM UP-MEP Tx Pkt.
  68164  *      mask    - (OUT) Qualifier match mask.
  68165  * Returns:
  68166  *      BCM_E_XXX
  68167  * Notes:
  68168  */
  68169 int bcm_esw_field_qualify_EthernetOamTxPktUPMEP_get(
  68170     int unit,
  68171     bcm_field_entry_t entry,
  68172     uint8 *data,
  68173     uint8 *mask)
  68174 {
  68175     return BCM_E_UNAVAIL;
  68176 }
  68177 
  68178 /*
  68179  * Function:
  68180  *     bcm_esw_field_qualifyEthernetOamInterfaceClassPort
  68181  * Purpose:
  68182  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassPort
  68183  *      qualifier from the field entry.
  68184  * Parameters:
  68185  *      unit    - (IN) Unit number.
  68186  *      entry   - (IN) BCM field entry id.
  68187  *      data    - (IN) Qualifies on Class Id obtained from
  68188                        Source trunk map table.
  68189  *      mask    - (IN) Qualifier match mask.
  68190  * Returns:
  68191  *      BCM_E_XXX
  68192  * Notes:
  68193  */
  68194 int bcm_esw_field_qualify_EthernetOamInterfaceClassPort(
  68195     int unit,
  68196     bcm_field_entry_t entry,
  68197     uint8 data,
  68198     uint8 mask)
  68199 {
  68200     return BCM_E_UNAVAIL;
  68201 }
  68202 
  68203 /*
  68204  * Function:
  68205  *     bcm_esw_field_qualify_EthernetOamInterfaceClassPort_get
  68206  * Purpose:
  68207  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassPort
  68208  *      qualifier from the field entry.
  68209  * Parameters:
  68210  *      unit    - (IN)  Unit number.
  68211  *      entry   - (IN)  BCM field entry id.
  68212  *      data    - (OUT) Class Id obtained from Source trunk map table.
  68213  *      mask    - (OUT) Qualifier match mask.
  68214  * Returns:
  68215  *      BCM_E_XXX
  68216  * Notes:
  68217  */
  68218 int bcm_esw_field_qualify_EthernetOamInterfaceClassPort_get(
  68219     int unit,
  68220     bcm_field_entry_t entry,
  68221     uint8 *data,
  68222     uint8 *mask)
  68223 {
  68224     return BCM_E_UNAVAIL;
  68225 }
  68226 
  68227 /*
  68228  * Function:
  68229  *     bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeyFirst
  68230  * Purpose:
  68231  *      Set match criteria for
  68232                      bcmFieldQualifyEthernetOamClassVlanTranslateKeyFirst
  68233  *      qualifier from the field entry.
  68234  * Parameters:
  68235  *      unit    - (IN) Unit number.
  68236  *      entry   - (IN) BCM field entry id.
  68237  *      data    - (IN) Qualifies on Class Id obtained from
  68238                        1st Lookup of Vlan_Xlate table.
  68239  *      mask    - (IN) Qualifier match mask.
  68240  * Returns:
  68241  *      BCM_E_XXX
  68242  * Notes:
  68243  */
  68244 int bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeyFirst(
  68245     int unit,
  68246     bcm_field_entry_t entry,
  68247     uint8 data,
  68248     uint8 mask)
  68249 {
  68250     return BCM_E_UNAVAIL;
  68251 }
  68252 
  68253 /*
  68254  * Function:
  68255  *     bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeyFirst_get
  68256  * Purpose:
  68257  *      Get match criteria for
  68258                   bcmFieldQualifyEthernetOamClassVlanTranslateKeyFirst
  68259  *      qualifier from the field entry.
  68260  * Parameters:
  68261  *      unit    - (IN)  Unit number.
  68262  *      entry   - (IN)  BCM field entry id.
  68263  *      data    - (OUT) Class Id obtained from 1st Lookup of Vlan_Xlate table.
  68264  *      mask    - (OUT) Qualifier match mask.
  68265  * Returns:
  68266  *      BCM_E_XXX
  68267  * Notes:
  68268  */
  68269 int bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeyFirst_get(
  68270     int unit,
  68271     bcm_field_entry_t entry,
  68272     uint8 *data,
  68273     uint8 *mask)
  68274 {
  68275     return BCM_E_UNAVAIL;
  68276 }
  68277 
  68278 /*
  68279  * Function:
  68280  *     bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeySecond
  68281  * Purpose:
  68282  *      Set match criteria for
  68283                    bcmFieldQualifyEthernetOamClassVlanTranslateKeySecond
  68284  *      qualifier from the field entry.
  68285  * Parameters:
  68286  *      unit    - (IN) Unit number.
  68287  *      entry   - (IN) BCM field entry id.
  68288  *      data    - (IN) Qualifies on Class Id obtained from
  68289                        2nd Lookup of Vlan_Xlate table.
  68290  *      mask    - (IN) Qualifier match mask.
  68291  * Returns:
  68292  *      BCM_E_XXX
  68293  * Notes:
  68294  */
  68295 int bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeySecond(
  68296     int unit,
  68297     bcm_field_entry_t entry,
  68298     uint8 data,
  68299     uint8 mask)
  68300 {
  68301     return BCM_E_UNAVAIL;
  68302 }
  68303 
  68304 /*
  68305  * Function:
  68306  *     bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeySecond_get
  68307  * Purpose:
  68308  *      Get match criteria for
  68309                   bcmFieldQualifyEthernetOamClassVlanTranslateKeySecond
  68310  *      qualifier from the field entry.
  68311  * Parameters:
  68312  *      unit    - (IN)  Unit number.
  68313  *      entry   - (IN)  BCM field entry id.
  68314  *      data    - (OUT) Class Id obtained from 2nd Lookup of Vlan_Xlate table.
  68315  *      mask    - (OUT) Qualifier match mask.
  68316  * Returns:
  68317  *      BCM_E_XXX
  68318  * Notes:
  68319  */
  68320 int bcm_esw_field_qualify_EthernetOamClassVlanTranslateKeySecond_get(
  68321     int unit,
  68322     bcm_field_entry_t entry,
  68323     uint8 *data,
  68324     uint8 *mask)
  68325 {
  68326     return BCM_E_UNAVAIL;
  68327 }
  68328 
  68329 /*
  68330  * Function:
  68331  *     bcm_esw_field_qualify_EthernetOamInterfaceClassVlan
  68332  * Purpose:
  68333  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassVlan
  68334  *      qualifier from the field entry.
  68335  * Parameters:
  68336  *      unit    - (IN) Unit number.
  68337  *      entry   - (IN) BCM field entry id.
  68338  *      data    - (IN) Qualifies on Class Id obtained from
  68339  SVP table.
  68340  *      mask    - (IN) Qualifier match mask.
  68341  * Returns:
  68342  *      BCM_E_XXX
  68343  * Notes:
  68344  */
  68345 int bcm_esw_field_qualify_EthernetOamInterfaceClassVlan(
  68346     int unit,
  68347     bcm_field_entry_t entry,
  68348     uint8 data,
  68349     uint8 mask)
  68350 {
  68351     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
  68352     return (rv);
  68353 }
  68354 
  68355 /*
  68356  * Function:
  68357  *     bcm_esw_field_qualify_EthernetOamInterfaceClassVlan_get
  68358  * Purpose:
  68359  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassVlan
  68360  *      qualifier from the field entry.
  68361  * Parameters:
  68362  *      unit    - (IN)  Unit number.
  68363  *      entry   - (IN)  BCM field entry id.
  68364  *      data    - (OUT) Class Id obtained from SVP table.
  68365  *      mask    - (OUT) Qualifier match mask.
  68366  * Returns:
  68367  *      BCM_E_XXX
  68368  * Notes:
  68369  */
  68370 int bcm_esw_field_qualify_EthernetOamInterfaceClassVlan_get(
  68371     int unit,
  68372     bcm_field_entry_t entry,
  68373     uint8 *data,
  68374     uint8 *mask)
  68375 {
  68376     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  68377     return (rv);
  68378 }
  68379 
  68380 /*
  68381  * Function:
  68382  *     bcm_esw_field_qualify_EthernetOamInterfaceClassVxlan
  68383  * Purpose:
  68384  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassVxlan
  68385  *      qualifier from the field entry.
  68386  * Parameters:
  68387  *      unit    - (IN) Unit number.
  68388  *      entry   - (IN) BCM field entry id.
  68389  *      data    - (IN) Qualifies on Class Id obtained from
  68390                        SVP table.
  68391  *      mask    - (IN) Qualifier match mask.
  68392  * Returns:
  68393  *      BCM_E_XXX
  68394  * Notes:
  68395  */
  68396 int bcm_esw_field_qualify_EthernetOamInterfaceClassVxlan(
  68397     int unit,
  68398     bcm_field_entry_t entry,
  68399     uint8 data,
  68400     uint8 mask)
  68401 {
  68402     return BCM_E_UNAVAIL;
  68403 }
  68404 
  68405 /*
  68406  * Function:
  68407  *     bcm_esw_field_qualify_EthernetOamInterfaceClassVxlan_get
  68408  * Purpose:
  68409  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassVxlan
  68410  *      qualifier from the field entry.
  68411  * Parameters:
  68412  *      unit    - (IN)  Unit number.
  68413  *      entry   - (IN)  BCM field entry id.
  68414  *      data    - (OUT) Class Id obtained from SVP table.
  68415  *      mask    - (OUT) Qualifier match mask.
  68416  * Returns:
  68417  *      BCM_E_XXX
  68418  * Notes:
  68419  */
  68420 int bcm_esw_field_qualify_EthernetOamInterfaceClassVxlan_get(
  68421     int unit,
  68422     bcm_field_entry_t entry,
  68423     uint8 *data,
  68424     uint8 *mask)
  68425 {
  68426     return BCM_E_UNAVAIL;
  68427 }
  68428 
  68429 /*
  68430  * Function:
  68431  *     bcm_esw_field_qualify_EthernetOamInterfaceClassMim
  68432  * Purpose:
  68433  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassMim
  68434  *      qualifier from the field entry.
  68435  * Parameters:
  68436  *      unit    - (IN) Unit number.
  68437  *      entry   - (IN) BCM field entry id.
  68438  *      data    - (IN) Qualifies on Class Id obtained from
  68439  SVP table.
  68440  *      mask    - (IN) Qualifier match mask.
  68441  * Returns:
  68442  *      BCM_E_XXX
  68443  * Notes:
  68444  */
  68445 int bcm_esw_field_qualify_EthernetOamInterfaceClassMim(
  68446     int unit,
  68447     bcm_field_entry_t entry,
  68448     uint8 data,
  68449     uint8 mask)
  68450 {
  68451     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
  68452     return (rv);
  68453 }
  68454 
  68455 /*
  68456  * Function:
  68457  *     bcm_esw_field_qualify_EthernetOamInterfaceClassMim_get
  68458  * Purpose:
  68459  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassMim
  68460  *      qualifier from the field entry.
  68461  * Parameters:
  68462  *      unit    - (IN)  Unit number.
  68463  *      entry   - (IN)  BCM field entry id.
  68464  *      data    - (OUT) Class Id obtained from SVP table.
  68465  *      mask    - (OUT) Qualifier match mask.
  68466  * Returns:
  68467  *      BCM_E_XXX
  68468  * Notes:
  68469  */
  68470 int bcm_esw_field_qualify_EthernetOamInterfaceClassMim_get(
  68471     int unit,
  68472     bcm_field_entry_t entry,
  68473     uint8 *data,
  68474     uint8 *mask)
  68475 {
  68476     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  68477     return (rv);
  68478 }
  68479 
  68480 /*
  68481  * Function:
  68482  *     bcm_esw_field_qualify_EthernetOamInterfaceClassNiv
  68483  * Purpose:
  68484  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassNiv
  68485  *      qualifier from the field entry.
  68486  * Parameters:
  68487  *      unit    - (IN) Unit number.
  68488  *      entry   - (IN) BCM field entry id.
  68489  *      data    - (IN) Qualifies on Class Id obtained from
  68490  SVP table.
  68491  *      mask    - (IN) Qualifier match mask.
  68492  * Returns:
  68493  *      BCM_E_XXX
  68494  * Notes:
  68495  */
  68496 int bcm_esw_field_qualify_EthernetOamInterfaceClassNiv(
  68497     int unit,
  68498     bcm_field_entry_t entry,
  68499     uint8 data,
  68500     uint8 mask)
  68501 {
  68502     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
  68503     return (rv);
  68504 }
  68505 
  68506 /*
  68507  * Function:
  68508  *     bcm_esw_field_qualify_EthernetOamInterfaceClassNiv_get
  68509  * Purpose:
  68510  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassNiv
  68511  *      qualifier from the field entry.
  68512  * Parameters:
  68513  *      unit    - (IN)  Unit number.
  68514  *      entry   - (IN)  BCM field entry id.
  68515  *      data    - (OUT) Class Id obtained from SVP table.
  68516  *      mask    - (OUT) Qualifier match mask.
  68517  * Returns:
  68518  *      BCM_E_XXX
  68519  * Notes:
  68520  */
  68521 int bcm_esw_field_qualify_EthernetOamInterfaceClassNiv_get(
  68522     int unit,
  68523     bcm_field_entry_t entry,
  68524     uint8 *data,
  68525     uint8 *mask)
  68526 {
  68527     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  68528     return (rv);
  68529 }
  68530 
  68531 /*
  68532  * Function:
  68533  *     bcm_esw_field_qualify_EthernetOamInterfaceClassMpls
  68534  * Purpose:
  68535  *      Set match criteria for bcmFieldQualifyEthernetOamInterfaceClassMpls
  68536  *      qualifier from the field entry.
  68537  * Parameters:
  68538  *      unit    - (IN) Unit number.
  68539  *      entry   - (IN) BCM field entry id.
  68540  *      data    - (IN) Qualifies on Class Id obtained from
  68541  SVP table.
  68542  *      mask    - (IN) Qualifier match mask.
  68543  * Returns:
  68544  *      BCM_E_XXX
  68545  * Notes:
  68546  */
  68547 int bcm_esw_field_qualify_EthernetOamInterfaceClassMpls(
  68548     int unit,
  68549     bcm_field_entry_t entry,
  68550     uint8 data,
  68551     uint8 mask)
  68552 {
  68553     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
  68554     return (rv);
  68555 }
  68556 
  68557 /*
  68558  * Function:
  68559  *     bcm_esw_field_qualify_EthernetOamInterfaceClassMpls_get
  68560  * Purpose:
  68561  *      Get match criteria for bcmFieldQualifyEthernetOamInterfaceClassMpls
  68562  *      qualifier from the field entry.
  68563  * Parameters:
  68564  *      unit    - (IN)  Unit number.
  68565  *      entry   - (IN)  BCM field entry id.
  68566  *      data    - (OUT) Class Id obtained from SVP table.
  68567  *      mask    - (OUT) Qualifier match mask.
  68568  * Returns:
  68569  *      BCM_E_XXX
  68570  * Notes:
  68571  */
  68572 int bcm_esw_field_qualify_EthernetOamInterfaceClassMpls_get(
  68573     int unit,
  68574     bcm_field_entry_t entry,
  68575     uint8 *data,
  68576     uint8 *mask)
  68577 {
  68578     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  68579     return (rv);
  68580 }
  68581 
  68582 
  68583 /*
  68584  * Function:
  68585  *     bcm_esw_field_qualify_EthernetOamClassVpn
  68586  * Purpose:
  68587  *      Set match criteria for bcmFieldQualifyEthernetOamClassVpn
  68588  *      qualifier from the field entry.
  68589  * Parameters:
  68590  *      unit    - (IN) Unit number.
  68591  *      entry   - (IN) BCM field entry id.
  68592  *      data    - (IN) Qualifies on Class Id obtained from
  68593                        VFI table.
  68594  *      mask    - (IN) Qualifier match mask.
  68595  * Returns:
  68596  *      BCM_E_XXX
  68597  * Notes:
  68598  */
  68599 int bcm_esw_field_qualify_EthernetOamClassVpn(
  68600     int unit,
  68601     bcm_field_entry_t entry,
  68602     uint8 data,
  68603     uint8 mask)
  68604 {
  68605     return BCM_E_UNAVAIL;
  68606 }
  68607 
  68608 /*
  68609  * Function:
  68610  *     bcm_esw_field_qualify_EthernetOamClassVpn_get
  68611  * Purpose:
  68612  *      Get match criteria for bcmFieldQualifyEthernetOamClassVpn
  68613  *      qualifier from the field entry.
  68614  * Parameters:
  68615  *      unit    - (IN)  Unit number.
  68616  *      entry   - (IN)  BCM field entry id.
  68617  *      data    - (OUT) Class Id obtained from VFI table.
  68618  *      mask    - (OUT) Qualifier match mask.
  68619  * Returns:
  68620  *      BCM_E_XXX
  68621  * Notes:
  68622  */
  68623 
  68624 int bcm_esw_field_qualify_EthernetOamClassVpn_get(
  68625     int unit,
  68626     bcm_field_entry_t entry,
  68627     uint8 *data,
  68628     uint8 *mask)
  68629 {
  68630     return BCM_E_UNAVAIL;
  68631 }
  68632 
  68633 /*
  68634  * Function:
  68635  *    bcm_esw_field_qualify_MplsOamHeaderBits0_31
  68636  * Purpose:
  68637  *      Set match criteria for bcmFieldQualifyMplsOamHeaderBits0_31
  68638  *      qualifier from the field entry.
  68639  * Parameters:
  68640  *      unit    - (IN) Unit number.
  68641  *      entry   - (IN) BCM field entry id.
  68642  *      data    - (IN) Qualifies on First 4 Bytes of MPLS OAM Header.
  68643  *      mask    - (IN) Qualifier match mask.
  68644  * Returns:
  68645  *      BCM_E_XXX
  68646  * Notes:
  68647  */
  68648 int bcm_esw_field_qualify_MplsOamHeaderBits0_31(
  68649     int unit,
  68650     bcm_field_entry_t entry,
  68651     uint32 data,
  68652     uint32 mask)
  68653 {
  68654     return BCM_E_UNAVAIL;
  68655 }
  68656 
  68657 /*
  68658  * Function:
  68659  *     bcm_esw_field_qualify_MplsOamHeaderBits0_31_get
  68660  * Purpose:
  68661  *      Get match criteria for bcmFieldQualifyMplsOamHeaderBits0_31
  68662  *      qualifier from the field entry.
  68663  * Parameters:
  68664  *      unit    - (IN)  Unit number.
  68665  *      entry   - (IN)  BCM field entry id.
  68666  *      data    - (OUT) First 4 Bytes of MPLS OAM Header.
  68667  *      mask    - (OUT) Qualifier match mask.
  68668  * Returns:
  68669  *      BCM_E_XXX
  68670  * Notes:
  68671  */
  68672 int bcm_esw_field_qualify_MplsOamHeaderBits0_31_get(
  68673     int unit,
  68674     bcm_field_entry_t entry,
  68675     uint32 *data,
  68676     uint32 *mask)
  68677 {
  68678     return BCM_E_UNAVAIL;
  68679 }
  68680 
  68681 
  68682 /*
  68683  * Function:
  68684  *     bcm_esw_field_qualify_MplsOamHeaderBits32_63
  68685  * Purpose:
  68686  *      Set match criteria for bcmFieldQualifyMplsOamHeaderBits32_63
  68687  *      qualifier from the field entry.
  68688  * Parameters:
  68689  *      unit    - (IN) Unit number.
  68690  *      entry   - (IN) BCM field entry id.
  68691  *      data    - (IN) Qualifies on Second 4 Bytes of MPLS OAM Header.
  68692  *      mask    - (IN) Qualifier match mask.
  68693  * Returns:
  68694  *      BCM_E_XXX
  68695  * Notes:
  68696  */
  68697 int bcm_esw_field_qualify_MplsOamHeaderBits32_63(
  68698     int unit,
  68699     bcm_field_entry_t entry,
  68700     uint32 data,
  68701     uint32 mask)
  68702 {
  68703     return BCM_E_UNAVAIL;
  68704 }
  68705 
  68706 /*
  68707  * Function:
  68708  *     bcm_esw_field_qualify_MplsOamHeaderBits32_63_get
  68709  * Purpose:
  68710  *      Get match criteria for bcmFieldQualifyOamHeaderBits32_63
  68711  *      qualifier from the field entry.
  68712  * Parameters:
  68713  *      unit    - (IN)  Unit number.
  68714  *      entry   - (IN)  BCM field entry id.
  68715  *      data    - (OUT) Second 4 Bytes of MPLS OAM Header.
  68716  *      mask    - (OUT) Qualifier match mask.
  68717  * Returns:
  68718  *      BCM_E_XXX
  68719  * Notes:
  68720  */
  68721 int bcm_esw_field_qualify_MplsOamHeaderBits32_63_get(
  68722     int unit,
  68723     bcm_field_entry_t entry,
  68724     uint32 *data,
  68725     uint32 *mask)
  68726 {
  68727     return BCM_E_UNAVAIL;
  68728 }
  68729 
  68730 /*
  68731  * Function:
  68732  *    bcm_esw_field_qualify_MplsOamGALLabelOnly
  68733  * Purpose:
  68734  *      Set match criteria for bcmFieldQualifyMplsOamGALLabelOnly
  68735  *      qualifier from the field entry.
  68736  * Parameters:
  68737  *      unit    - (IN) Unit number.
  68738  *      entry   - (IN) BCM field entry id.
  68739  *      data    - (IN) Qualifies MPLS OAM packets with
  68740                        single label only that is GAL label.
  68741  *      mask    - (IN) Qualifier match mask.
  68742  * Returns:
  68743  *      BCM_E_XXX
  68744  * Notes:
  68745  */
  68746 int bcm_esw_field_qualify_MplsOamGALLabelOnly(
  68747     int unit,
  68748     bcm_field_entry_t entry,
  68749     uint8 data,
  68750     uint8 mask)
  68751 {
  68752     return BCM_E_UNAVAIL;
  68753 }
  68754 
  68755 /*
  68756  * Function:
  68757  *     bcm_esw_field_qualify_MplsOamGALLabelOnly_get
  68758  * Purpose:
  68759  *      Get match criteria for bcmFieldQualifyMplsOamGALLabelOnly
  68760  *      qualifier from the field entry.
  68761  * Parameters:
  68762  *      unit    - (IN)  Unit number.
  68763  *      entry   - (IN)  BCM field entry id.
  68764  *      data    - (OUT) MPLS OAM packets with
  68765                         single label only that is GAL label.
  68766  *      mask    - (OUT) Qualifier match mask.
  68767  * Returns:
  68768  *      BCM_E_XXX
  68769  * Notes:
  68770  */
  68771 int bcm_esw_field_qualify_MplsOamGALLabelOnly_get(
  68772     int unit,
  68773     bcm_field_entry_t entry,
  68774     uint8 *data,
  68775     uint8 *mask)
  68776 {
  68777     return BCM_E_UNAVAIL;
  68778 }
  68779 
  68780 /*
  68781  * Function:
  68782  *    bcm_esw_field_qualify_MplsOamGALExposed
  68783  * Purpose:
  68784  *      Set match criteria for bcmFieldQualifyMplsOamGALExposed
  68785  *      qualifier from the field entry.
  68786  * Parameters:
  68787  *      unit    - (IN) Unit number.
  68788  *      entry   - (IN) BCM field entry id.
  68789  *      data    - (IN) Qualifies MPLS OAM packets which has GAL Exposed.
  68790  *      mask    - (IN) Qualifier match mask.
  68791  * Returns:
  68792  *      BCM_E_XXX
  68793  * Notes:
  68794  */
  68795 int bcm_esw_field_qualify_MplsOamGALExposed(
  68796     int unit,
  68797     bcm_field_entry_t entry,
  68798     uint8 data,
  68799     uint8 mask)
  68800 {
  68801     return BCM_E_UNAVAIL;
  68802 }
  68803 
  68804 /*
  68805  * Function:
  68806  *     bcm_esw_field_qualify_MplsOamGALExposed_get
  68807  * Purpose:
  68808  *      Get match criteria for bcmFieldQualifyMplsOamGALExposed
  68809  *      qualifier from the field entry.
  68810  * Parameters:
  68811  *      unit    - (IN)  Unit number.
  68812  *      entry   - (IN)  BCM field entry id.
  68813  *      data    - (OUT) MPLS OAM packets which has GAL Exposed.
  68814  *      mask    - (OUT) Qualifier match mask.
  68815  * Returns:
  68816  *      BCM_E_XXX
  68817  * Notes:
  68818  */
  68819 int bcm_esw_field_qualify_MplsOamGALExposed_get(
  68820     int unit,
  68821     bcm_field_entry_t entry,
  68822     uint8 *data,
  68823     uint8 *mask)
  68824 {
  68825     return BCM_E_UNAVAIL;
  68826 }
  68827 
  68828 /*
  68829  * Function:
  68830  *    bcm_esw_field_qualify_MplsOamUpperLabelDataDrop 
  68831  * Purpose:
  68832  *      Set match criteria for bcmFieldQualifyMplsOamUpperLabelDataDrop
  68833  *      qualifier from the field entry.
  68834  * Parameters:
  68835  *      unit    - (IN) Unit number.
  68836  *      entry   - (IN) BCM field entry id.
  68837  *      data    - (IN) Qualifies on Class Id obtained from
  68838  SVP table.
  68839  *      mask    - (IN) Qualifier match mask.
  68840  * Returns:
  68841  *      BCM_E_XXX
  68842  * Notes:
  68843  */
  68844 int bcm_esw_field_qualify_MplsOamUpperLabelDataDrop(
  68845     int unit,
  68846     bcm_field_entry_t entry,
  68847     uint8 data,
  68848     uint8 mask)
  68849 {
  68850     int rv = BCM_E_UNAVAIL;   /* Operation return status. */
  68851     return (rv);
  68852 }
  68853 
  68854 /*
  68855  * Function:
  68856  *     bcm_esw_field_qualify_MplsOamUpperLabelDataDrop_get
  68857  * Purpose:
  68858  *      Get match criteria for bcmFieldQualifyMplsOamUpperLabelDataDrop
  68859  *      qualifier from the field entry.
  68860  * Parameters:
  68861  *      unit    - (IN)  Unit number.
  68862  *      entry   - (IN)  BCM field entry id.
  68863  *      data    - (OUT) Class Id obtained from SVP table.
  68864  *      mask    - (OUT) Qualifier match mask.
  68865  * Returns:
  68866  *      BCM_E_XXX
  68867  * Notes:
  68868  */
  68869 int bcm_esw_field_qualify_MplsOamUpperLabelDataDrop_get(
  68870     int unit,
  68871     bcm_field_entry_t entry,
  68872     uint8 *data,
  68873     uint8 *mask)
  68874 {
  68875     int rv = BCM_E_UNAVAIL;  /* Operation return status. */
  68876     return (rv);
  68877 }
  68878 
  68879 /*
  68880  * Function:
  68881  *    bcm_esw_field_qualify_MplsOamACH
  68882  * Purpose:
  68883  *      Set match criteria for bcmFieldQualifyMplsOamACH
  68884  *      qualifier from the field entry.
  68885  * Parameters:
  68886  *      unit    - (IN) Unit number.
  68887  *      entry   - (IN) BCM field entry id.
  68888  *      data    - (IN) Qualifies MPLS OAM ACH Header.
  68889  *      mask    - (IN) Qualifier match mask.
  68890  * Returns:
  68891  *      BCM_E_XXX
  68892  * Notes:
  68893  */
  68894 int bcm_esw_field_qualify_MplsOamACH(
  68895     int unit,
  68896     bcm_field_entry_t entry,
  68897     uint32 data,
  68898     uint32 mask)
  68899 {
  68900     return BCM_E_UNAVAIL;
  68901 }
  68902 
  68903 /*
  68904  * Function:
  68905  *     bcm_esw_field_qualify_MplsOamACH_get
  68906  * Purpose:
  68907  *      Get match criteria for bcmFieldQualifyMplsOamACH
  68908  *      qualifier from the field entry.
  68909  * Parameters:
  68910  *      unit    - (IN)  Unit number.
  68911  *      entry   - (IN)  BCM field entry id.
  68912  *      data    - (OUT) MPLS OAM ACH Header.
  68913  *      mask    - (OUT) Qualifier match mask.
  68914  * Returns:
  68915  *      BCM_E_XXX
  68916  * Notes:
  68917  */
  68918 int bcm_esw_field_qualify_MplsOamACH_get(
  68919     int unit,
  68920     bcm_field_entry_t entry,
  68921     uint32 *data,
  68922     uint32 *mask)
  68923 {
  68924     return BCM_E_UNAVAIL;
  68925 }
  68926 
  68927 /*
  68928  * Function:
  68929  *    bcm_esw_field_qualify_MplsOamControlPktType
  68930  * Purpose:
  68931  *      Set match criteria for bcmFieldQualifyMplsOamControlPktType
  68932  *      qualifier from the field entry.
  68933  * Parameters:
  68934  *      unit    - (IN) Unit number.
  68935  *      entry   - (IN) BCM field entry id.
  68936  *      data    - (IN) Qualify the MPLS OAM Control Packets
  68937                        based on packet type.
  68938  *      mask    - (IN) Qualifier match mask.
  68939  * Returns:
  68940  *      BCM_E_XXX
  68941  * Notes:
  68942  */
  68943 int bcm_esw_field_qualify_MplsOamControlPktType(
  68944     int unit,
  68945     bcm_field_entry_t entry,
  68946     bcm_field_MplsOam_Control_pktType_t data)
  68947 {
  68948     return BCM_E_UNAVAIL;
  68949 }
  68950 
  68951 /*
  68952  * Function:
  68953  *     bcm_esw_field_qualify_MplsOamControlPktType_get
  68954  * Purpose:
  68955  *      Get match criteria for bcmFieldQualifyMplsOamControlPktType
  68956  *      qualifier from the field entry.
  68957  * Parameters:
  68958  *      unit    - (IN)  Unit number.
  68959  *      entry   - (IN)  BCM field entry id.
  68960  *      data    - (OUT) MPLS OAM Control Packets based on packet type.
  68961  *      mask    - (OUT) Qualifier match mask.
  68962  * Returns:
  68963  *      BCM_E_XXX
  68964  * Notes:
  68965  */
  68966 
  68967 int bcm_esw_field_qualify_MplsOamControlPktType_get(
  68968     int unit,
  68969     bcm_field_entry_t entry,
  68970     bcm_field_MplsOam_Control_pktType_t *data)
  68971 {
  68972     return BCM_E_UNAVAIL;
  68973 }
  68974 
  68975 /*
  68976  * Function:
  68977  *     bcm_esw_field_qualify_MplsOamClassMplsSwitchLabel
  68978  * Purpose:
  68979  *      Set match criteria for bcmFieldQualifyMplsOamClassMplsSwitchLabel
  68980  *      qualifier from the field entry.
  68981  * Parameters:
  68982  *      unit    - (IN) Unit number.
  68983  *      entry   - (IN) BCM field entry id.
  68984  *      data    - (IN) Qualifies on Class Id obtained from 
  68985                        MPLS_ENTRY table.
  68986  *      mask    - (IN) Qualifier match mask.
  68987  * Returns:
  68988  *      BCM_E_XXX
  68989  * Notes:
  68990  */
  68991 int bcm_esw_field_qualify_MplsOamClassMplsSwitchLabel(
  68992     int unit,
  68993     bcm_field_entry_t entry,
  68994     uint16 data,
  68995     uint16 mask)
  68996 {
  68997     return BCM_E_UNAVAIL;
  68998 }
  68999 
  69000 /*
  69001  * Function:
  69002  *     bcm_esw_field_qualify_MplsOamClassMplsSwitchLabel_get
  69003  * Purpose:
  69004  *      Get match criteria for bcmFieldQualifyMplsOamClassMplsSwitchLabel
  69005  *      qualifier from the field entry.
  69006  * Parameters:
  69007  *      unit    - (IN)  Unit number.
  69008  *      entry   - (IN)  BCM field entry id.
  69009  *      data    - (OUT) Class Id obtained from MPLS_ENTRY table.
  69010  *      mask    - (OUT) Qualifier match mask.
  69011  * Returns:
  69012  *      BCM_E_XXX
  69013  * Notes:
  69014  */
  69015 int bcm_esw_field_qualify_MplsOamClassMplsSwitchLabel_get(
  69016     int unit,
  69017     bcm_field_entry_t entry,
  69018     uint16 *data,
  69019     uint16 *mask)
  69020 {
  69021     return BCM_E_UNAVAIL;
  69022 }
  69023 
  69024 
  69025 int 
  69026 bcm_esw_field_group_presel_get(
  69027     int unit, 
  69028     bcm_field_group_t group, 
  69029     bcm_field_presel_set_t *presel)
  69030 {
  69031     return BCM_E_UNAVAIL;
  69032 }
  69033 
  69034 int 
  69035 bcm_esw_field_group_presel_set(
  69036     int unit, 
  69037     bcm_field_group_t group, 
  69038     bcm_field_presel_set_t *presel)
  69039 {
  69040     return BCM_E_UNAVAIL;
  69041 }
  69042 
  69043 int 
  69044 bcm_esw_field_presel_create(
  69045     int unit, 
  69046     bcm_field_presel_t *presel_id)
  69047 {
  69048     return BCM_E_UNAVAIL;
  69049 }
  69050 
  69051 int 
  69052 bcm_esw_field_presel_create_id(
  69053     int unit, 
  69054     bcm_field_presel_t presel_id)
  69055 {
  69056     return BCM_E_UNAVAIL;
  69057 }
  69058 
  69059 int 
  69060 bcm_esw_field_presel_destroy(
  69061     int unit, 
  69062     bcm_field_presel_t presel_id)
  69063 {
  69064     return BCM_E_UNAVAIL;
  69065 }
  69066 
  69067 int
  69068 bcm_esw_field_qualify_DstMulticastGroups(
  69069     int unit,
  69070     bcm_field_entry_t entry,
  69071     bcm_multicast_t group,
  69072     bcm_multicast_t mask)
  69073 {
  69074     return BCM_E_UNAVAIL;
  69075 }
  69076 
  69077 int
  69078 bcm_esw_field_qualify_DstMulticastGroups_get(
  69079     int unit,
  69080     bcm_field_entry_t entry,
  69081     bcm_multicast_t *group,
  69082     bcm_multicast_t *mask)
  69083 {
  69084     return BCM_E_UNAVAIL;
  69085 }
  69086 
  69087 /*
  69088  * Field Operation Mode Set
  69089  */
  69090 int
  69091 bcm_esw_field_group_oper_mode_set(
  69092     int unit,
  69093     bcm_field_qualify_t stage,
  69094     bcm_field_group_oper_mode_t mode)
  69095 {
  69096     return BCM_E_UNAVAIL;
  69097 }
  69098 
  69099 /*
  69100  * Field Operation Mode Get
  69101  */ 
  69102 int
  69103 bcm_esw_field_group_oper_mode_get(
  69104     int unit,
  69105     bcm_field_qualify_t stage,
  69106     bcm_field_group_oper_mode_t *mode)
  69107 {
  69108     return BCM_E_UNAVAIL;
  69109 }
  69110 
  69111 int 
  69112 bcm_esw_field_qualify_DestVirtualPortValid(int unit,
  69113                                            bcm_field_entry_t entry,
  69114                                            uint8 data,
  69115                                            uint8 mask)
  69116 {
  69117     return (BCM_E_UNAVAIL);
  69118 }
  69119 
  69120 int 
  69121 bcm_esw_field_qualify_DestVirtualPortValid_get(int unit,
  69122                                                bcm_field_entry_t entry,
  69123                                                uint8 *data,
  69124                                                uint8 *mask)
  69125 {
  69126     return (BCM_E_UNAVAIL);
  69127 }
  69128 
  69129 int
  69130 bcm_esw_field_qualify_FcoeOxID(int unit, bcm_field_entry_t entry,
  69131         uint16 data, uint16 mask)
  69132 {
  69133     return BCM_E_UNAVAIL;
  69134 }
  69135 
  69136 int
  69137 bcm_esw_field_qualify_FcoeOxID_get(int unit,
  69138         bcm_field_entry_t entry,
  69139         uint16 *data,
  69140         uint16 *mask)
  69141 {
  69142     return BCM_E_UNAVAIL;
  69143 }
  69144 
  69145     int
  69146 bcm_esw_field_qualify_FcoeRxID(int unit, bcm_field_entry_t entry,
  69147         uint16 data, uint16 mask)
  69148 {
  69149     return BCM_E_UNAVAIL;
  69150 }
  69151 
  69152     int
  69153 bcm_esw_field_qualify_FcoeRxID_get(int unit,
  69154         bcm_field_entry_t entry,
  69155         uint16 *data,
  69156         uint16 *mask)
  69157 {
  69158     return BCM_E_UNAVAIL;
  69159 }
  69160 
  69161     int
  69162 bcm_esw_field_qualify_IpProtocolClass(int unit, bcm_field_entry_t entry,
  69163         bcm_class_t data, bcm_class_t mask)
  69164 {
  69165     return BCM_E_UNAVAIL;
  69166 }
  69167 
  69168     int
  69169 bcm_esw_field_qualify_IpProtocolClass_get(int unit,
  69170         bcm_field_entry_t entry,
  69171         bcm_class_t *data,
  69172         bcm_class_t *mask)
  69173 {
  69174     return BCM_E_UNAVAIL;
  69175 }
  69176 
  69177     int
  69178 bcm_esw_field_qualify_EtherTypeClass(int unit, bcm_field_entry_t entry,
  69179         bcm_class_t data, bcm_class_t mask)
  69180 {
  69181     return BCM_E_UNAVAIL;
  69182 }
  69183 
  69184     int
  69185 bcm_esw_field_qualify_EtherTypeClass_get(int unit,
  69186         bcm_field_entry_t entry,
  69187         bcm_class_t *data,
  69188         bcm_class_t *mask)
  69189 {
  69190     return BCM_E_UNAVAIL;
  69191 }
  69192 
  69193     int
  69194 bcm_esw_field_qualify_L4SrcPortClass(int unit, bcm_field_entry_t entry,
  69195         bcm_class_t data, bcm_class_t mask)
  69196 {
  69197     return BCM_E_UNAVAIL;
  69198 }
  69199 
  69200     int
  69201 bcm_esw_field_qualify_L4SrcPortClass_get(int unit,
  69202         bcm_field_entry_t entry,
  69203         bcm_class_t *data,
  69204         bcm_class_t *mask)
  69205 {
  69206     return BCM_E_UNAVAIL;
  69207 }
  69208 
  69209     int
  69210 bcm_esw_field_qualify_L4DstPortClass(int unit, bcm_field_entry_t entry,
  69211         bcm_class_t data, bcm_class_t mask)
  69212 {
  69213     return BCM_E_UNAVAIL;
  69214 }
  69215 
  69216     int
  69217 bcm_esw_field_qualify_L4DstPortClass_get(int unit,
  69218         bcm_field_entry_t entry,
  69219         bcm_class_t *data,
  69220         bcm_class_t *mask)
  69221 {
  69222     return BCM_E_UNAVAIL;
  69223 }
  69224 
  69225     int
  69226 bcm_esw_field_qualify_SrcIpClass(int unit, bcm_field_entry_t entry,
  69227         bcm_class_t data, bcm_class_t mask)
  69228 {
  69229     return BCM_E_UNAVAIL;
  69230 }
  69231 
  69232     int
  69233 bcm_esw_field_qualify_SrcIpClass_get(int unit,
  69234         bcm_field_entry_t entry,
  69235         bcm_class_t *data,
  69236         bcm_class_t *mask)
  69237 {
  69238     return BCM_E_UNAVAIL;
  69239 }
  69240 
  69241     int
  69242 bcm_esw_field_qualify_SrcIpClassMsbNibble(int unit, bcm_field_entry_t entry,
  69243         bcm_class_t data, bcm_class_t mask)
  69244 {
  69245     return BCM_E_UNAVAIL;
  69246 }
  69247 
  69248     int
  69249 bcm_esw_field_qualify_SrcIpClassMsbNibble_get(int unit,
  69250         bcm_field_entry_t entry,
  69251         bcm_class_t *data,
  69252         bcm_class_t *mask)
  69253 {
  69254     return BCM_E_UNAVAIL;
  69255 }
  69256 
  69257     int
  69258 bcm_esw_field_qualify_SrcIpClassLower(int unit, bcm_field_entry_t entry,
  69259         bcm_class_t data, bcm_class_t mask)
  69260 {
  69261     return BCM_E_UNAVAIL;
  69262 }
  69263 
  69264     int
  69265 bcm_esw_field_qualify_SrcIpClassLower_get(int unit,
  69266         bcm_field_entry_t entry,
  69267         bcm_class_t *data,
  69268         bcm_class_t *mask)
  69269 {
  69270     return BCM_E_UNAVAIL;
  69271 }
  69272 
  69273     int
  69274 bcm_esw_field_qualify_SrcIpClassUpper(int unit, bcm_field_entry_t entry,
  69275         bcm_class_t data, bcm_class_t mask)
  69276 {
  69277     return BCM_E_UNAVAIL;
  69278 }
  69279 
  69280     int
  69281 bcm_esw_field_qualify_SrcIpClassUpper_get(int unit,
  69282         bcm_field_entry_t entry,
  69283         bcm_class_t *data,
  69284         bcm_class_t *mask)
  69285 {
  69286     return BCM_E_UNAVAIL;
  69287 }
  69288 
  69289     int
  69290 bcm_esw_field_qualify_SrcIp6Class(int unit, bcm_field_entry_t entry,
  69291         bcm_class_t data, bcm_class_t mask)
  69292 {
  69293     return BCM_E_UNAVAIL;
  69294 }
  69295 
  69296     int
  69297 bcm_esw_field_qualify_SrcIp6Class_get(int unit,
  69298         bcm_field_entry_t entry,
  69299         bcm_class_t *data,
  69300         bcm_class_t *mask)
  69301 {
  69302     return BCM_E_UNAVAIL;
  69303 }
  69304 
  69305     int
  69306 bcm_esw_field_qualify_SrcIp6ClassMsbNibble(int unit, bcm_field_entry_t entry,
  69307         bcm_class_t data, bcm_class_t mask)
  69308 {
  69309     return BCM_E_UNAVAIL;
  69310 }
  69311 
  69312     int
  69313 bcm_esw_field_qualify_SrcIp6ClassMsbNibble_get(int unit,
  69314         bcm_field_entry_t entry,
  69315         bcm_class_t *data,
  69316         bcm_class_t *mask)
  69317 {
  69318     return BCM_E_UNAVAIL;
  69319 }
  69320 
  69321     int
  69322 bcm_esw_field_qualify_SrcIp6ClassLower(int unit, bcm_field_entry_t entry,
  69323         bcm_class_t data, bcm_class_t mask)
  69324 {
  69325     return BCM_E_UNAVAIL;
  69326 }
  69327 
  69328     int
  69329 bcm_esw_field_qualify_SrcIp6ClassLower_get(int unit,
  69330         bcm_field_entry_t entry,
  69331         bcm_class_t *data,
  69332         bcm_class_t *mask)
  69333 {
  69334     return BCM_E_UNAVAIL;
  69335 }
  69336 
  69337     int
  69338 bcm_esw_field_qualify_SrcIp6ClassUpper(int unit, bcm_field_entry_t entry,
  69339         bcm_class_t data, bcm_class_t mask)
  69340 {
  69341     return BCM_E_UNAVAIL;
  69342 }
  69343 
  69344     int
  69345 bcm_esw_field_qualify_SrcIp6ClassUpper_get(int unit,
  69346         bcm_field_entry_t entry,
  69347         bcm_class_t *data,
  69348         bcm_class_t *mask)
  69349 {
  69350     return BCM_E_UNAVAIL;
  69351 }
  69352 
  69353     int
  69354 bcm_esw_field_qualify_FcoeOxIDClass(int unit, bcm_field_entry_t entry,
  69355         bcm_class_t data, bcm_class_t mask)
  69356 {
  69357     return BCM_E_UNAVAIL;
  69358 }
  69359 
  69360     int
  69361 bcm_esw_field_qualify_FcoeOxIDClass_get(int unit,
  69362         bcm_field_entry_t entry,
  69363         bcm_class_t *data,
  69364         bcm_class_t *mask)
  69365 {
  69366     return BCM_E_UNAVAIL;
  69367 }
  69368 
  69369     int
  69370 bcm_esw_field_qualify_DstIpClass(int unit, bcm_field_entry_t entry,
  69371         bcm_class_t data, bcm_class_t mask)
  69372 {
  69373     return BCM_E_UNAVAIL;
  69374 }
  69375 
  69376     int
  69377 bcm_esw_field_qualify_DstIpClass_get(int unit,
  69378         bcm_field_entry_t entry,
  69379         bcm_class_t *data,
  69380         bcm_class_t *mask)
  69381 {
  69382     return BCM_E_UNAVAIL;
  69383 }
  69384 
  69385     int
  69386 bcm_esw_field_qualify_DstIpClassMsbNibble(int unit, bcm_field_entry_t entry,
  69387         bcm_class_t data, bcm_class_t mask)
  69388 {
  69389     return BCM_E_UNAVAIL;
  69390 }
  69391 
  69392     int
  69393 bcm_esw_field_qualify_DstIpClassMsbNibble_get(int unit,
  69394         bcm_field_entry_t entry,
  69395         bcm_class_t *data,
  69396         bcm_class_t *mask)
  69397 {
  69398     return BCM_E_UNAVAIL;
  69399 }
  69400 
  69401     int
  69402 bcm_esw_field_qualify_DstIpClassLower(int unit, bcm_field_entry_t entry,
  69403         bcm_class_t data, bcm_class_t mask)
  69404 {
  69405     return BCM_E_UNAVAIL;
  69406 }
  69407 
  69408     int
  69409 bcm_esw_field_qualify_DstIpClassLower_get(int unit,
  69410         bcm_field_entry_t entry,
  69411         bcm_class_t *data,
  69412         bcm_class_t *mask)
  69413 {
  69414     return BCM_E_UNAVAIL;
  69415 }
  69416 
  69417     int
  69418 bcm_esw_field_qualify_DstIpClassUpper(int unit, bcm_field_entry_t entry,
  69419         bcm_class_t data, bcm_class_t mask)
  69420 {
  69421     return BCM_E_UNAVAIL;
  69422 }
  69423 
  69424     int
  69425 bcm_esw_field_qualify_DstIpClassUpper_get(int unit,
  69426         bcm_field_entry_t entry,
  69427         bcm_class_t *data,
  69428         bcm_class_t *mask)
  69429 {
  69430     return BCM_E_UNAVAIL;
  69431 }
  69432 
  69433     int
  69434 bcm_esw_field_qualify_DstIp6Class(int unit, bcm_field_entry_t entry,
  69435         bcm_class_t data, bcm_class_t mask)
  69436 {
  69437     return BCM_E_UNAVAIL;
  69438 }
  69439 
  69440     int
  69441 bcm_esw_field_qualify_DstIp6Class_get(int unit,
  69442         bcm_field_entry_t entry,
  69443         bcm_class_t *data,
  69444         bcm_class_t *mask)
  69445 {
  69446     return BCM_E_UNAVAIL;
  69447 }
  69448 
  69449     int
  69450 bcm_esw_field_qualify_DstIp6ClassMsbNibble(int unit, bcm_field_entry_t entry,
  69451         bcm_class_t data, bcm_class_t mask)
  69452 {
  69453     return BCM_E_UNAVAIL;
  69454 }
  69455 
  69456     int
  69457 bcm_esw_field_qualify_DstIp6ClassMsbNibble_get(int unit,
  69458         bcm_field_entry_t entry,
  69459         bcm_class_t *data,
  69460         bcm_class_t *mask)
  69461 {
  69462     return BCM_E_UNAVAIL;
  69463 }
  69464 
  69465     int
  69466 bcm_esw_field_qualify_DstIp6ClassLower(int unit, bcm_field_entry_t entry,
  69467         bcm_class_t data, bcm_class_t mask)
  69468 {
  69469     return BCM_E_UNAVAIL;
  69470 }
  69471 
  69472     int
  69473 bcm_esw_field_qualify_DstIp6ClassLower_get(int unit,
  69474         bcm_field_entry_t entry,
  69475         bcm_class_t *data,
  69476         bcm_class_t *mask)
  69477 {
  69478     return BCM_E_UNAVAIL;
  69479 }
  69480 
  69481     int
  69482 bcm_esw_field_qualify_DstIp6ClassUpper(int unit, bcm_field_entry_t entry,
  69483         bcm_class_t data, bcm_class_t mask)
  69484 {
  69485     return BCM_E_UNAVAIL;
  69486 }
  69487 
  69488     int
  69489 bcm_esw_field_qualify_DstIp6ClassUpper_get(int unit,
  69490         bcm_field_entry_t entry,
  69491         bcm_class_t *data,
  69492         bcm_class_t *mask)
  69493 {
  69494     return BCM_E_UNAVAIL;
  69495 }
  69496 
  69497     int
  69498 bcm_esw_field_qualify_FcoeRxIDClass(int unit, bcm_field_entry_t entry,
  69499         bcm_class_t data, bcm_class_t mask)
  69500 {
  69501     return BCM_E_UNAVAIL;
  69502 }
  69503 
  69504     int
  69505 bcm_esw_field_qualify_FcoeRxIDClass_get(int unit,
  69506         bcm_field_entry_t entry,
  69507         bcm_class_t *data,
  69508         bcm_class_t *mask)
  69509 {
  69510     return BCM_E_UNAVAIL;
  69511 }
  69512 
  69513     int
  69514 bcm_esw_field_qualify_FibreChanSrcIdClass(int unit, bcm_field_entry_t entry,
  69515         bcm_class_t data, bcm_class_t mask)
  69516 {
  69517     return BCM_E_UNAVAIL;
  69518 }
  69519 
  69520     int
  69521 bcm_esw_field_qualify_FibreChanSrcIdClass_get(int unit,
  69522         bcm_field_entry_t entry,
  69523         bcm_class_t *data,
  69524         bcm_class_t *mask)
  69525 {
  69526     return BCM_E_UNAVAIL;
  69527 }
  69528 
  69529     int
  69530 bcm_esw_field_qualify_FibreChanSrcIdClassMsbNibble(int unit, 
  69531         bcm_field_entry_t entry, bcm_class_t data, bcm_class_t mask)
  69532 {
  69533     return BCM_E_UNAVAIL;
  69534 }
  69535 
  69536     int
  69537 bcm_esw_field_qualify_FibreChanSrcIdClassMsbNibble_get(int unit,
  69538         bcm_field_entry_t entry,
  69539         bcm_class_t *data,
  69540         bcm_class_t *mask)
  69541 {
  69542     return BCM_E_UNAVAIL;
  69543 }
  69544 
  69545     int
  69546 bcm_esw_field_qualify_FibreChanSrcIdClassLower(int unit, 
  69547         bcm_field_entry_t entry,
  69548         bcm_class_t data, bcm_class_t mask)
  69549 {
  69550     return BCM_E_UNAVAIL;
  69551 }
  69552 
  69553     int
  69554 bcm_esw_field_qualify_FibreChanSrcIdClassLower_get(int unit,
  69555         bcm_field_entry_t entry,
  69556         bcm_class_t *data,
  69557         bcm_class_t *mask)
  69558 {
  69559     return BCM_E_UNAVAIL;
  69560 }
  69561 
  69562     int
  69563 bcm_esw_field_qualify_FibreChanSrcIdClassUpper(int unit, 
  69564         bcm_field_entry_t entry,
  69565         bcm_class_t data, bcm_class_t mask)
  69566 {
  69567     return BCM_E_UNAVAIL;
  69568 }
  69569 
  69570     int
  69571 bcm_esw_field_qualify_FibreChanSrcIdClassUpper_get(int unit,
  69572         bcm_field_entry_t entry,
  69573         bcm_class_t *data,
  69574         bcm_class_t *mask)
  69575 {
  69576     return BCM_E_UNAVAIL;
  69577 }
  69578 
  69579     int
  69580 bcm_esw_field_qualify_FibreChanDstIdClass(int unit, 
  69581         bcm_field_entry_t entry,
  69582         bcm_class_t data, bcm_class_t mask)
  69583 {
  69584     return BCM_E_UNAVAIL;
  69585 }
  69586 
  69587     int
  69588 bcm_esw_field_qualify_FibreChanDstIdClass_get(int unit,
  69589         bcm_field_entry_t entry,
  69590         bcm_class_t *data,
  69591         bcm_class_t *mask)
  69592 {
  69593     return BCM_E_UNAVAIL;
  69594 }
  69595 
  69596     int
  69597 bcm_esw_field_qualify_FibreChanDstIdClassMsbNibble(int unit,
  69598         bcm_field_entry_t entry,
  69599         bcm_class_t data, bcm_class_t mask)
  69600 {
  69601     return BCM_E_UNAVAIL;
  69602 }
  69603 
  69604     int
  69605 bcm_esw_field_qualify_FibreChanDstIdClassMsbNibble_get(int unit,
  69606         bcm_field_entry_t entry,
  69607         bcm_class_t *data,
  69608         bcm_class_t *mask)
  69609 {
  69610     return BCM_E_UNAVAIL;
  69611 }
  69612 
  69613     int
  69614 bcm_esw_field_qualify_FibreChanDstIdClassLower(int unit,
  69615         bcm_field_entry_t entry,
  69616         bcm_class_t data, bcm_class_t mask)
  69617 {
  69618     return BCM_E_UNAVAIL;
  69619 }
  69620 
  69621     int
  69622 bcm_esw_field_qualify_FibreChanDstIdClassLower_get(int unit,
  69623         bcm_field_entry_t entry,
  69624         bcm_class_t *data,
  69625         bcm_class_t *mask)
  69626 {
  69627     return BCM_E_UNAVAIL;
  69628 }
  69629 
  69630     int
  69631 bcm_esw_field_qualify_FibreChanDstIdClassUpper(int unit, 
  69632         bcm_field_entry_t entry,
  69633         bcm_class_t data, bcm_class_t mask)
  69634 {
  69635     return BCM_E_UNAVAIL;
  69636 }
  69637 
  69638     int
  69639 bcm_esw_field_qualify_FibreChanDstIdClassUpper_get(int unit,
  69640         bcm_field_entry_t entry,
  69641         bcm_class_t *data,
  69642         bcm_class_t *mask)
  69643 {
  69644     return BCM_E_UNAVAIL;
  69645 }
  69646 
  69647     int
  69648 bcm_esw_field_qualify_TcpClassZero(int unit, bcm_field_entry_t entry,
  69649         bcm_class_t data, bcm_class_t mask)
  69650 {
  69651     return BCM_E_UNAVAIL;
  69652 }
  69653 
  69654     int
  69655 bcm_esw_field_qualify_TcpClassZero_get(int unit,
  69656         bcm_field_entry_t entry,
  69657         bcm_class_t *data,
  69658         bcm_class_t *mask)
  69659 {
  69660     return BCM_E_UNAVAIL;
  69661 }
  69662 
  69663     int
  69664 bcm_esw_field_qualify_TosClassZero(int unit, bcm_field_entry_t entry,
  69665         bcm_class_t data, bcm_class_t mask)
  69666 {
  69667     return BCM_E_UNAVAIL;
  69668 }
  69669 
  69670     int
  69671 bcm_esw_field_qualify_TosClassZero_get(int unit,
  69672         bcm_field_entry_t entry,
  69673         bcm_class_t *data,
  69674         bcm_class_t *mask)
  69675 {
  69676     return BCM_E_UNAVAIL;
  69677 }
  69678 
  69679     int
  69680 bcm_esw_field_qualify_TtlClassZero(int unit, bcm_field_entry_t entry,
  69681         bcm_class_t data, bcm_class_t mask)
  69682 {
  69683     return BCM_E_UNAVAIL;
  69684 }
  69685 
  69686     int
  69687 bcm_esw_field_qualify_TtlClassZero_get(int unit,
  69688         bcm_field_entry_t entry,
  69689         bcm_class_t *data,
  69690         bcm_class_t *mask)
  69691 {
  69692     return BCM_E_UNAVAIL;
  69693 }
  69694 
  69695     int
  69696 bcm_esw_field_qualify_TcpClassOne(int unit, bcm_field_entry_t entry,
  69697         bcm_class_t data, bcm_class_t mask)
  69698 {
  69699     return BCM_E_UNAVAIL;
  69700 }
  69701 
  69702     int
  69703 bcm_esw_field_qualify_TcpClassOne_get(int unit,
  69704         bcm_field_entry_t entry,
  69705         bcm_class_t *data,
  69706         bcm_class_t *mask)
  69707 {
  69708     return BCM_E_UNAVAIL;
  69709 }
  69710 
  69711     int
  69712 bcm_esw_field_qualify_TosClassOne(int unit, bcm_field_entry_t entry,
  69713         bcm_class_t data, bcm_class_t mask)
  69714 {
  69715     return BCM_E_UNAVAIL;
  69716 }
  69717 
  69718     int
  69719 bcm_esw_field_qualify_TosClassOne_get(int unit,
  69720         bcm_field_entry_t entry,
  69721         bcm_class_t *data,
  69722         bcm_class_t *mask)
  69723 {
  69724     return BCM_E_UNAVAIL;
  69725 }
  69726 
  69727     int
  69728 bcm_esw_field_qualify_TtlClassOne(int unit, bcm_field_entry_t entry,
  69729         bcm_class_t data, bcm_class_t mask)
  69730 {
  69731     return BCM_E_UNAVAIL;
  69732 }
  69733 
  69734     int
  69735 bcm_esw_field_qualify_TtlClassOne_get(int unit,
  69736         bcm_field_entry_t entry,
  69737         bcm_class_t *data,
  69738         bcm_class_t *mask)
  69739 {
  69740     return BCM_E_UNAVAIL;
  69741 }
  69742 
  69743 int 
  69744 bcm_esw_field_qualify_Stage(
  69745     int unit, 
  69746     bcm_field_entry_t entry, 
  69747     bcm_field_stage_t data)
  69748 {
  69749     return BCM_E_UNAVAIL;
  69750 }
  69751 
  69752 int 
  69753 bcm_esw_field_qualify_Stage_get(
  69754     int unit, 
  69755     bcm_field_entry_t entry, 
  69756     bcm_field_stage_t *data)
  69757 {
  69758     return BCM_E_UNAVAIL;
  69759 }
  69760 
  69761 int
  69762 bcm_esw_field_qualify_IpFragNonOrFirst(
  69763     int unit, bcm_field_entry_t entry,
  69764     uint8 data, uint8 mask)
  69765 {
  69766     return BCM_E_UNAVAIL;
  69767 }
  69768 
  69769 int
  69770 bcm_esw_field_qualify_IpFragNonOrFirst_get(
  69771     int unit, bcm_field_entry_t entry,
  69772     uint8 *data, uint8 *mask)
  69773 {
  69774     return BCM_E_UNAVAIL;
  69775 }
  69776 
  69777 int
  69778 bcm_esw_field_qualify_PacketLength(
  69779     int unit, bcm_field_entry_t entry,
  69780     uint16 data, uint16 mask)
  69781 {
  69782     return BCM_E_UNAVAIL;
  69783 }
  69784 
  69785 int
  69786 bcm_esw_field_qualify_PacketLength_get(
  69787     int unit, bcm_field_entry_t entry,
  69788     uint16 *data, uint16 *mask)
  69789 {
  69790     return BCM_E_UNAVAIL;
  69791 }
  69792 
  69793 int
  69794 bcm_esw_field_qualify_GroupClass(
  69795     int unit, bcm_field_entry_t entry,
  69796     uint32 data, uint32 mask)
  69797 {
  69798     return BCM_E_UNAVAIL;
  69799 }
  69800 
  69801 int
  69802 bcm_esw_field_qualify_GroupClass_get(
  69803     int unit, bcm_field_entry_t entry,
  69804     uint32 *data, uint32 *mask)
  69805 {
  69806     return BCM_E_UNAVAIL;
  69807 }
  69808 
  69809 int
  69810 bcm_esw_field_qualify_UdfClass(
  69811     int unit, bcm_field_entry_t entry,
  69812     uint32 data, uint32 mask)
  69813 {
  69814     return BCM_E_UNAVAIL;
  69815 }
  69816 
  69817 int
  69818 bcm_esw_field_qualify_UdfClass_get(
  69819     int unit, bcm_field_entry_t entry,
  69820     uint32 *data, uint32 *mask)
  69821 {
  69822     return BCM_E_UNAVAIL;
  69823 }
  69824 
  69825 int
  69826 bcm_esw_field_qualify_InterfaceLookupClassPort(
  69827     int unit, bcm_field_entry_t entry,
  69828     uint32 data, uint32 mask)
  69829 {
  69830     return BCM_E_UNAVAIL;
  69831 }
  69832 
  69833 int
  69834 bcm_esw_field_qualify_InterfaceLookupClassPort_get(
  69835     int unit, bcm_field_entry_t entry,
  69836     uint32 *data, uint32 *mask)
  69837 {
  69838     return BCM_E_UNAVAIL;
  69839 }
  69840 
  69841 int bcm_esw_field_qualify_ExactMatchHitStatus(int unit,
  69842                                               bcm_field_entry_t entry,
  69843                                               int group_pri,
  69844                                               uint8 data,
  69845                                               uint8 mask)
  69846 {
  69847     return BCM_E_UNAVAIL;
  69848 }
  69849 
  69850 int bcm_esw_field_qualify_ExactMatchHitStatus_get(int unit,
  69851                                                   bcm_field_entry_t entry,
  69852                                                   int group_pri,
  69853                                                   uint8 *data,
  69854                                                   uint8 *mask)
  69855 {
  69856     return BCM_E_UNAVAIL;
  69857 }
  69858 
  69859 int bcm_esw_field_qualify_ExactMatchActionClassId(int unit,
  69860                                                   bcm_field_entry_t entry,
  69861                                                   int group_pri,
  69862                                                   uint32 data,
  69863                                                   uint32 mask)
  69864 {
  69865     return BCM_E_UNAVAIL;
  69866 }
  69867 
  69868 int bcm_esw_field_qualify_ExactMatchActionClassId_get(int unit,
  69869                                                       bcm_field_entry_t entry,
  69870                                                       int group_pri,
  69871                                                       uint32 *data,
  69872                                                       uint32 *mask)
  69873 {
  69874     return BCM_E_UNAVAIL;
  69875 }
  69876 
  69877 int bcm_esw_field_qualify_ExactMatchGroupClassId(int unit,
  69878                                                  bcm_field_entry_t entry,
  69879                                                  int group_pri,
  69880                                                  bcm_field_group_t group)
  69881 {
  69882     return BCM_E_UNAVAIL;
  69883 }
  69884 
  69885 int bcm_esw_field_qualify_ExactMatchGroupClassId_get(int unit,
  69886                                                       bcm_field_entry_t entry,
  69887                                                       int group_pri,
  69888                                                       bcm_field_group_t *group)
  69889 {
  69890     return BCM_E_UNAVAIL;
  69891 }
  69892 
  69893 int bcm_esw_field_qualify_HiGigDstMulticast(int unit,
  69894         bcm_field_entry_t entry,
  69895         uint8 data,
  69896         uint8 mask)
  69897 {
  69898     return BCM_E_UNAVAIL;
  69899 }
  69900 
  69901 int bcm_esw_field_qualify_HiGigDstMulticast_get(int unit,
  69902         bcm_field_entry_t entry,
  69903         uint8 *data,
  69904         uint8 *mask)
  69905 {
  69906     return BCM_E_UNAVAIL;
  69907 }
  69908 
  69909 int bcm_esw_field_qualify_HiGigDstMulticastGroupId(int unit,
  69910         bcm_field_entry_t entry,
  69911         bcm_multicast_t group, 
  69912         bcm_multicast_t mask)
  69913 {
  69914     return BCM_E_UNAVAIL;
  69915 }
  69916 
  69917 int bcm_esw_field_qualify_HiGigDstMulticastGroupId_get(int unit,
  69918         bcm_field_entry_t entry,
  69919         bcm_multicast_t *group,
  69920         bcm_multicast_t *mask)
  69921 {
  69922     return BCM_E_UNAVAIL;
  69923 }
  69924 
  69925 int bcm_esw_field_qualify_HiGigTrafficClass(int unit,
  69926         bcm_field_entry_t entry,
  69927         uint8 data,
  69928         uint8 mask)
  69929 {
  69930     return BCM_E_UNAVAIL;
  69931 }
  69932 
  69933 int bcm_esw_field_qualify_HiGigTrafficClass_get(int unit,
  69934         bcm_field_entry_t entry,
  69935         uint8 *data,
  69936         uint8 *mask)
  69937 {
  69938     return BCM_E_UNAVAIL;
  69939 }
  69940 
  69941 int bcm_esw_field_qualify_HiGigDstModuleGport(int unit,
  69942         bcm_field_entry_t entry,
  69943         bcm_gport_t port_id,
  69944         bcm_gport_t port_mask)
  69945 {
  69946     return BCM_E_UNAVAIL;
  69947 }
  69948 
  69949 int bcm_esw_field_qualify_HiGigDstModuleGport_get(int unit,
  69950         bcm_field_entry_t entry,
  69951         bcm_gport_t *port_id,
  69952         bcm_gport_t *port_mask)
  69953 {
  69954     return BCM_E_UNAVAIL;
  69955 }
  69956 
  69957 int bcm_esw_field_qualify_HiGigDstPortGport(int unit,
  69958         bcm_field_entry_t entry,
  69959         bcm_gport_t port_id,
  69960         bcm_gport_t port_mask)
  69961 {
  69962     return BCM_E_UNAVAIL;
  69963 }
  69964 
  69965 int bcm_esw_field_qualify_HiGigDstPortGport_get(int unit,
  69966         bcm_field_entry_t entry,
  69967         bcm_gport_t *port_id,
  69968         bcm_gport_t *port_mask)
  69969 {
  69970     return BCM_E_UNAVAIL;
  69971 }
  69972 
  69973 int bcm_esw_field_qualify_HiGigDstModPortGport(int unit,
  69974         bcm_field_entry_t entry,
  69975         bcm_gport_t port_id,
  69976         bcm_gport_t port_mask)
  69977 {
  69978     return BCM_E_UNAVAIL;
  69979 }
  69980 
  69981 int bcm_esw_field_qualify_HiGigDstModPortGport_get(int unit,
  69982         bcm_field_entry_t entry,
  69983         bcm_gport_t *port_id,
  69984         bcm_gport_t *port_mask)
  69985 {
  69986     return BCM_E_UNAVAIL;
  69987 }
  69988 
  69989 int bcm_esw_field_qualify_HiGigSrcModuleGport(int unit,
  69990         bcm_field_entry_t entry,
  69991         bcm_gport_t port_id,
  69992         bcm_gport_t port_mask)
  69993 {
  69994     return BCM_E_UNAVAIL;
  69995 }
  69996 
  69997 int bcm_esw_field_qualify_HiGigSrcModuleGport_get(int unit,
  69998         bcm_field_entry_t entry,
  69999         bcm_gport_t *port_id,
  70000         bcm_gport_t *port_mask)
  70001 {
  70002     return BCM_E_UNAVAIL;
  70003 }
  70004 
  70005 int bcm_esw_field_qualify_HiGigSrcPortGport(int unit,
  70006         bcm_field_entry_t entry,
  70007         bcm_gport_t port_id,
  70008         bcm_gport_t port_mask)
  70009 {
  70010     return BCM_E_UNAVAIL;
  70011 }
  70012 
  70013 int bcm_esw_field_qualify_HiGigSrcPortGport_get(int unit,
  70014         bcm_field_entry_t entry,
  70015         bcm_gport_t *port_id,
  70016         bcm_gport_t *port_mask)
  70017 {
  70018     return BCM_E_UNAVAIL;
  70019 }
  70020 
  70021 int bcm_esw_field_qualify_HiGigSrcModPortGport(int unit,
  70022         bcm_field_entry_t entry,
  70023         bcm_gport_t port_id,
  70024         bcm_gport_t port_mask)
  70025 {
  70026     return BCM_E_UNAVAIL;
  70027 }
  70028 
  70029 int bcm_esw_field_qualify_HiGigSrcModPortGport_get(int unit,
  70030         bcm_field_entry_t entry,
  70031         bcm_gport_t *port_id,
  70032         bcm_gport_t *port_mask)
  70033 {
  70034     return BCM_E_UNAVAIL;
  70035 }
  70036 
  70037 int bcm_esw_field_qualify_HiGigLoadBalanceID(int unit,
  70038         bcm_field_entry_t entry,
  70039         uint8 data,
  70040         uint8 mask)
  70041 {
  70042     return BCM_E_UNAVAIL;
  70043 }
  70044 
  70045 int bcm_esw_field_qualify_HiGigLoadBalanceID_get(int unit,
  70046         bcm_field_entry_t entry,
  70047         uint8 *data,
  70048         uint8 *mask)
  70049 {
  70050     return BCM_E_UNAVAIL;
  70051 }
  70052 
  70053 int bcm_esw_field_qualify_HiGigColor(int unit,
  70054         bcm_field_entry_t entry,
  70055         uint8 color)
  70056 {
  70057     return BCM_E_UNAVAIL;
  70058 }
  70059 
  70060 int bcm_esw_field_qualify_HiGigColor_get(int unit,
  70061         bcm_field_entry_t entry,
  70062         uint8 *color)
  70063 {
  70064     return BCM_E_UNAVAIL;
  70065 }
  70066 
  70067 int bcm_esw_field_qualify_HiGigIntCongestionNotification(int unit,
  70068         bcm_field_entry_t entry,
  70069         uint8 data,
  70070         uint8 mask)
  70071 {
  70072     return BCM_E_UNAVAIL;
  70073 }
  70074 
  70075 int bcm_esw_field_qualify_HiGigIntCongestionNotification_get(int unit,
  70076         bcm_field_entry_t entry,
  70077         uint8 *data,
  70078         uint8 *mask)
  70079 {
  70080     return BCM_E_UNAVAIL;
  70081 }
  70082 
  70083 int bcm_esw_field_qualify_HiGigIngressTagged(int unit,
  70084         bcm_field_entry_t entry,
  70085         uint8 data,
  70086         uint8 mask)
  70087 {
  70088     return BCM_E_UNAVAIL;
  70089 }
  70090 
  70091 int bcm_esw_field_qualify_HiGigIngressTagged_get(int unit,
  70092         bcm_field_entry_t entry,
  70093         uint8 *data,
  70094         uint8 *mask)
  70095 {
  70096     return BCM_E_UNAVAIL;
  70097 }
  70098 
  70099 int bcm_esw_field_qualify_HiGigDstTrunk(int unit
  70100         bcm_field_entry_t entry,
  70101         uint8 data,
  70102         uint8 mask)
  70103 {
  70104     return BCM_E_UNAVAIL;
  70105 }
  70106 
  70107 int bcm_esw_field_qualify_HiGigDstTrunk_get(int unit,
  70108         bcm_field_entry_t entry,
  70109         uint8 *data,
  70110         uint8 *mask)
  70111 {
  70112     return BCM_E_UNAVAIL;
  70113 }
  70114 
  70115 int bcm_esw_field_qualify_HiGigDstTrunkId(int unit,
  70116         bcm_field_entry_t entry,
  70117         bcm_trunk_t data,
  70118         bcm_trunk_t mask)
  70119 {
  70120     return BCM_E_UNAVAIL;
  70121 }
  70122 
  70123 int bcm_esw_field_qualify_HiGigDstTrunkId_get(int unit,
  70124         bcm_field_entry_t entry,
  70125         bcm_trunk_t *data,
  70126         bcm_trunk_t *mask)
  70127 {
  70128     return BCM_E_UNAVAIL;
  70129 }
  70130 
  70131 int bcm_esw_field_qualify_HiGigIngressL3SwitchPkt(int unit,
  70132         bcm_field_entry_t entry,
  70133         uint8 data,
  70134         uint8 mask)
  70135 {
  70136     return BCM_E_UNAVAIL;
  70137 }
  70138 
  70139 int bcm_esw_field_qualify_HiGigIngressL3SwitchPkt_get(int unit,
  70140         bcm_field_entry_t entry,
  70141         uint8 *data,
  70142         uint8 *mask)
  70143 {
  70144     return BCM_E_UNAVAIL;
  70145 }
  70146 
  70147 int bcm_esw_field_qualify_HiGigLabel(int unit,
  70148         bcm_field_entry_t entry,
  70149         uint32 data,
  70150         uint32 mask)
  70151 {
  70152     return BCM_E_UNAVAIL;
  70153 }
  70154 
  70155 int bcm_esw_field_qualify_HiGigLabel_get(int unit,
  70156         bcm_field_entry_t entry,
  70157         uint32 *data,
  70158         uint32 *mask)
  70159 {
  70160     return BCM_E_UNAVAIL;
  70161 }
  70162 
  70163 int bcm_esw_field_qualify_HiGigReplicationId(int unit,
  70164         bcm_field_entry_t entry,
  70165         uint32 data,
  70166         uint32 mask)
  70167 {
  70168     return BCM_E_UNAVAIL;
  70169 }
  70170 
  70171 int bcm_esw_field_qualify_HiGigReplicationId_get(int unit,
  70172         bcm_field_entry_t entry,
  70173         uint32 *data,
  70174         uint32 *mask)
  70175 {
  70176     return BCM_E_UNAVAIL;
  70177 }
  70178 
  70179 int bcm_esw_field_qualify_HiGigVlan(int unit,
  70180         bcm_field_entry_t entry,
  70181         uint16 data,
  70182         uint16 mask)
  70183 {
  70184     return BCM_E_UNAVAIL;
  70185 }
  70186 
  70187 int bcm_esw_field_qualify_HiGigVlan_get(int unit,
  70188         bcm_field_entry_t entry,
  70189         uint16 *data,
  70190         uint16 *mask)
  70191 {
  70192     return BCM_E_UNAVAIL;
  70193 }
  70194 
  70195 int bcm_esw_field_qualify_HiGigPortFilteringMode(int unit,
  70196         bcm_field_entry_t entry,
  70197         uint8 data,
  70198         uint8 mask)
  70199 {
  70200     return BCM_E_UNAVAIL;
  70201 }
  70202 
  70203 int bcm_esw_field_qualify_HiGigPortFilteringMode_get(int unit,
  70204         bcm_field_entry_t entry,
  70205         uint8 *data,
  70206         uint8 *mask)
  70207 {
  70208     return BCM_E_UNAVAIL;
  70209 }
  70210 
  70211 int bcm_esw_field_qualify_HiGigSrcTrunk(int unit,
  70212         bcm_field_entry_t entry,
  70213         uint8 data,
  70214         uint8 mask)
  70215 {
  70216     return BCM_E_UNAVAIL;
  70217 }
  70218 
  70219 int bcm_esw_field_qualify_HiGigSrcTrunk_get(int unit,
  70220         bcm_field_entry_t entry,
  70221         uint8 *data,
  70222         uint8 *mask)
  70223 {
  70224     return BCM_E_UNAVAIL;
  70225 }
  70226 
  70227 int bcm_esw_field_qualify_HiGigIngressClassificationTag(int unit,
  70228         bcm_field_entry_t entry,
  70229         uint16 data,
  70230         uint16 mask)
  70231 {
  70232     return BCM_E_UNAVAIL;
  70233 }
  70234 
  70235 int bcm_esw_field_qualify_HiGigIngressClassificationTag_get(int unit,
  70236         bcm_field_entry_t entry,
  70237         uint16 *data,
  70238         uint16 *mask)
  70239 {
  70240     return BCM_E_UNAVAIL;
  70241 }
  70242 
  70243 int bcm_esw_field_qualify_HiGigEgressMcast(int unit,
  70244         bcm_field_entry_t entry,
  70245         uint8 data,
  70246         uint8 mask)
  70247 {
  70248     return BCM_E_UNAVAIL;
  70249 }
  70250 
  70251 int bcm_esw_field_qualify_HiGigEgressMcast_get(int unit,
  70252         bcm_field_entry_t entry,
  70253         uint8 *data,
  70254         uint8 *mask)
  70255 {
  70256     return BCM_E_UNAVAIL;
  70257 }
  70258 
  70259 int bcm_esw_field_qualify_HiGigVni(int unit,
  70260         bcm_field_entry_t entry,
  70261         uint16 data,
  70262         uint16 mask)
  70263 {
  70264     return BCM_E_UNAVAIL;
  70265 }
  70266 
  70267 int bcm_esw_field_qualify_HiGigVni_get(int unit,
  70268         bcm_field_entry_t entry,
  70269         uint16 *data,
  70270         uint16 *mask)
  70271 {
  70272     return BCM_E_UNAVAIL;
  70273 }
  70274 
  70275 int bcm_esw_field_qualify_HiGigDstGport(int unit,
  70276         bcm_field_entry_t entry,
  70277         bcm_gport_t port_id,
  70278         bcm_gport_t port_mask)
  70279 {
  70280     return BCM_E_UNAVAIL;
  70281 }
  70282 
  70283 int bcm_esw_field_qualify_HiGigDstGport_get(int unit,
  70284         bcm_field_entry_t entry,
  70285         bcm_gport_t *port_id,
  70286         bcm_gport_t *port_mask)
  70287 {
  70288     return BCM_E_UNAVAIL;
  70289 }
  70290 
  70291 int bcm_esw_field_qualify_HiGigMulticastIndex(int unit,
  70292         bcm_field_entry_t entry,
  70293         uint16 data,
  70294         uint16 mask)
  70295 {
  70296     return BCM_E_UNAVAIL;
  70297 }
  70298 
  70299 int bcm_esw_field_qualify_HiGigMulticastIndex_get(int unit,
  70300         bcm_field_entry_t entry,
  70301         uint16 *data,
  70302         uint16 *mask)
  70303 {
  70304     return BCM_E_UNAVAIL;
  70305 }
  70306 
  70307 int bcm_esw_field_qualify_HiGigVpReplicationId(int unit,
  70308         bcm_field_entry_t entry,
  70309         uint32 data,
  70310         uint32 mask)
  70311 {
  70312     return BCM_E_UNAVAIL;
  70313 }
  70314 
  70315 int bcm_esw_field_qualify_HiGigVpReplicationId_get(int unit,
  70316         bcm_field_entry_t entry,
  70317         uint32 *data,
  70318         uint32 *mask)
  70319 {
  70320     return BCM_E_UNAVAIL;
  70321 }
  70322 
  70323 int bcm_esw_field_qualify_HiGigSrcGport(int unit,
  70324         bcm_field_entry_t entry,
  70325         bcm_gport_t port_id,
  70326         bcm_gport_t port_mask)
  70327 {
  70328     return BCM_E_UNAVAIL;
  70329 }
  70330 
  70331 int bcm_esw_field_qualify_HiGigSrcGport_get(int unit,
  70332         bcm_field_entry_t entry,
  70333         bcm_gport_t *port_id,
  70334         bcm_gport_t *port_mask)
  70335 {
  70336     return BCM_E_UNAVAIL;
  70337 }
  70338 
  70339 int bcm_esw_field_qualify_HiGigProtectionSwitchingStatus(int unit,
  70340         bcm_field_entry_t entry,
  70341         uint8 data,
  70342         uint8 mask)
  70343 {
  70344     return BCM_E_UNAVAIL;
  70345 }
  70346 
  70347 int bcm_esw_field_qualify_HiGigProtectionSwitchingStatus_get(int unit,
  70348         bcm_field_entry_t entry,
  70349         uint8 *data,
  70350         uint8 *mask)
  70351 {
  70352     return BCM_E_UNAVAIL;
  70353 }
  70354 
  70355 int bcm_esw_field_qualify_HiGigMirrorToVp(int unit,
  70356         bcm_field_entry_t entry,
  70357         uint8 data,
  70358         uint8 mask)
  70359 {
  70360     return BCM_E_UNAVAIL;
  70361 }
  70362 
  70363 int bcm_esw_field_qualify_HiGigMirrorToVp_get(int unit,
  70364         bcm_field_entry_t entry,
  70365         uint8 *data,
  70366         uint8 *mask)
  70367 {
  70368     return BCM_E_UNAVAIL;
  70369 }
  70370 
  70371 int bcm_esw_field_qualify_HiGigDstType(int unit,
  70372         bcm_field_entry_t entry,
  70373         uint8 data,
  70374         uint8 mask)
  70375 {
  70376     return BCM_E_UNAVAIL;
  70377 }
  70378 
  70379 int bcm_esw_field_qualify_HiGigDstType_get(int unit,
  70380         bcm_field_entry_t entry,
  70381         uint8 *data,
  70382         uint8 *mask)
  70383 {
  70384     return BCM_E_UNAVAIL;
  70385 }
  70386 
  70387 int bcm_esw_field_qualify_HiGigSrcType(int unit,
  70388         bcm_field_entry_t entry,
  70389         uint8 data,
  70390         uint8 mask)
  70391 {
  70392     return BCM_E_UNAVAIL;
  70393 }
  70394 
  70395 int bcm_esw_field_qualify_HiGigSrcType_get(int unit,
  70396         bcm_field_entry_t entry,
  70397         uint8 *data,
  70398         uint8 *mask)
  70399 {
  70400     return BCM_E_UNAVAIL;
  70401 }
  70402 
  70403 int bcm_esw_field_qualify_HiGigOffloadEngineClassificationTag(int unit,
  70404         bcm_field_entry_t entry,
  70405         uint16 data,
  70406         uint16 mask)
  70407 {
  70408     return BCM_E_UNAVAIL;
  70409 }
  70410 
  70411 int bcm_esw_field_qualify_HiGigOffloadEngineClassificationTag_get(int unit,
  70412         bcm_field_entry_t entry,
  70413         uint16 *data,
  70414         uint16 *mask)
  70415 {
  70416     return BCM_E_UNAVAIL;
  70417 }
  70418 
  70419 int bcm_esw_field_qualify_HiGigOffloadEnginePktPriNew(int unit,
  70420         bcm_field_entry_t entry,
  70421         uint8 data,
  70422         uint8 mask)
  70423 {
  70424     return BCM_E_UNAVAIL;
  70425 }
  70426 
  70427 int bcm_esw_field_qualify_HiGigOffloadEnginePktPriNew_get(int unit,
  70428         bcm_field_entry_t entry,
  70429         uint8 *data,
  70430         uint8 *mask)
  70431 {
  70432     return BCM_E_UNAVAIL;
  70433 }
  70434 
  70435 int bcm_esw_field_qualify_HiGigOffloadEngineDscpNew(int unit,
  70436         bcm_field_entry_t entry,
  70437         uint8 data,
  70438         uint8 mask)
  70439 {
  70440     return BCM_E_UNAVAIL;
  70441 }
  70442 
  70443 int bcm_esw_field_qualify_HiGigOffloadEngineDscpNew_get(int unit,
  70444         bcm_field_entry_t entry,
  70445         uint8 *data,
  70446         uint8 *mask)
  70447 {
  70448     return BCM_E_UNAVAIL;
  70449 }
  70450 
  70451 int bcm_esw_field_qualify_LoopBackQueue(int unit,
  70452         bcm_field_entry_t entry,
  70453         uint8 data,
  70454         uint8 mask)
  70455 {
  70456     return BCM_E_UNAVAIL;
  70457 }
  70458 
  70459 int bcm_esw_field_qualify_LoopBackQueue_get(int unit,
  70460         bcm_field_entry_t entry,
  70461         uint8 *data,
  70462         uint8 *mask)
  70463 {
  70464     return BCM_E_UNAVAIL;
  70465 }
  70466 
  70467 int bcm_esw_field_qualify_LoopBackSrcGport(int unit,
  70468         bcm_field_entry_t entry,
  70469         bcm_gport_t port_id,
  70470         bcm_gport_t port_mask)
  70471 {
  70472     return BCM_E_UNAVAIL;
  70473 }
  70474 
  70475 int bcm_esw_field_qualify_LoopBackSrcGport_get(int unit,
  70476         bcm_field_entry_t entry,
  70477         bcm_gport_t *port_id,
  70478         bcm_gport_t *port_mask)
  70479 {
  70480     return BCM_E_UNAVAIL;
  70481 }
  70482 
  70483 int bcm_esw_field_qualify_PktIsVisible(int unit,
  70484         bcm_field_entry_t entry,
  70485         uint8 data,
  70486         uint8 mask)
  70487 {
  70488     return BCM_E_UNAVAIL;
  70489 }
  70490 
  70491 int bcm_esw_field_qualify_PktIsVisible_get(int unit,
  70492         bcm_field_entry_t entry,
  70493         uint8 *data,
  70494         uint8 *mask)
  70495 {
  70496     return BCM_E_UNAVAIL;
  70497 }
  70498 
  70499 int bcm_esw_field_qualify_LoopBackCpuMasqueradePktProfile(int unit,
  70500         bcm_field_entry_t entry,
  70501         uint8 data,
  70502         uint8 mask)
  70503 {
  70504     return BCM_E_UNAVAIL;
  70505 }
  70506 
  70507 int bcm_esw_field_qualify_LoopBackCpuMasqueradePktProfile_get(int unit,
  70508         bcm_field_entry_t entry,
  70509         uint8 *data,
  70510         uint8 *mask)
  70511 {
  70512     return BCM_E_UNAVAIL;
  70513 }
  70514 
  70515 int bcm_esw_field_qualify_LoopBackColor(int unit,
  70516         bcm_field_entry_t entry,
  70517         uint8 color)
  70518 {
  70519     return BCM_E_UNAVAIL;
  70520 }
  70521 
  70522 int bcm_esw_field_qualify_LoopBackColor_get(int unit,
  70523         bcm_field_entry_t entry,
  70524         uint8 *color)
  70525 {
  70526     return BCM_E_UNAVAIL;
  70527 }
  70528 
  70529 int bcm_esw_field_qualify_LoopBackTrafficClass(int unit,
  70530         bcm_field_entry_t entry,
  70531         uint8 data,
  70532         uint8 mask)
  70533 {
  70534     return BCM_E_UNAVAIL;
  70535 }
  70536 
  70537 int bcm_esw_field_qualify_LoopBackTrafficClass_get(int unit,
  70538         bcm_field_entry_t entry,
  70539         uint8 *data,
  70540         uint8 *mask)
  70541 {
  70542     return BCM_E_UNAVAIL;
  70543 }
  70544 
  70545 int bcm_esw_field_qualify_LoopBackPacketProcessingPort(int unit,
  70546         bcm_field_entry_t entry,
  70547         bcm_gport_t port_id,
  70548         bcm_gport_t port_mask)
  70549 {
  70550     return BCM_E_UNAVAIL;
  70551 }
  70552 
  70553 int bcm_esw_field_qualify_LoopBackPacketProcessingPort_get(int unit,
  70554         bcm_field_entry_t entry,
  70555         bcm_gport_t *port_id,
  70556         bcm_gport_t *port_mask)
  70557 {
  70558     return BCM_E_UNAVAIL; 
  70559 }
  70560 
  70561 
  70562 int 
  70563 bcm_esw_field_qualify_CustomHeaderPkt(
  70564     int unit, 
  70565     bcm_field_entry_t entry, 
  70566     uint8 data, 
  70567     uint8 mask)
  70568 {
  70569     return BCM_E_UNAVAIL;
  70570 }
  70571 
  70572 int 
  70573 bcm_esw_field_qualify_CustomHeaderPkt_get(
  70574     int unit, 
  70575     bcm_field_entry_t entry, 
  70576     uint8 *data, 
  70577     uint8 *mask)
  70578 {
  70579     return BCM_E_UNAVAIL;
  70580 }
  70581 
  70582 int 
  70583 bcm_esw_field_qualify_CustomHeaderData(
  70584     int unit, 
  70585     bcm_field_entry_t entry, 
  70586     uint32 data, 
  70587     uint32 mask)
  70588 {
  70589     return BCM_E_UNAVAIL;
  70590 }
  70591 
  70592 int 
  70593 bcm_esw_field_qualify_CustomHeaderData_get(
  70594     int unit, 
  70595     bcm_field_entry_t entry, 
  70596     uint32 *data, 
  70597     uint32 *mask)
  70598 {
  70599     return BCM_E_UNAVAIL;
  70600 }
  70601 
  70602 /*
  70603  * Set match criteria for bcmFieildQualifyMimlPkt
  70604  *                qualifier from the field entry.
  70605  */
  70606 int bcm_esw_field_qualify_MimlPkt(
  70607     int unit,
  70608     bcm_field_entry_t entry,
  70609     uint8 data,
  70610     uint8 mask)
  70611 {
  70612     return BCM_E_UNAVAIL;
  70613 }
  70614 
  70615 /*
  70616  * Get match criteria for bcmFieildQualifyMiml
  70617  *                qualifier from the field entry.
  70618  */
  70619 int bcm_esw_field_qualify_MimlPkt_get(
  70620     int unit,
  70621     bcm_field_entry_t entry,
  70622     uint8 *data,
  70623     uint8 *mask)
  70624 {
  70625     return BCM_E_UNAVAIL;
  70626 }
  70627 
  70628 /*
  70629  * Set match criteria for bcmFieildQualifyMimlSrcMac
  70630  *                qualifier from the field entry.
  70631  */
  70632 int
  70633 bcm_esw_field_qualify_MimlSrcMac(int unit, bcm_field_entry_t entry,
  70634                              bcm_mac_t data, bcm_mac_t mask)
  70635 {
  70636     return BCM_E_UNAVAIL;
  70637 }
  70638 
  70639 /*
  70640  * Set match criteria for bcmFieildQualifyMimlDstMac
  70641  *                qualifier from the field entry.
  70642  */
  70643 int
  70644 bcm_esw_field_qualify_MimlDstMac(int unit, bcm_field_entry_t entry,
  70645                              bcm_mac_t data, bcm_mac_t mask)
  70646 {
  70647     return BCM_E_UNAVAIL;
  70648 }
  70649 
  70650 /*
  70651  * Get match criteria for bcmFieildQualifyMimlSrcMac
  70652  *                qualifier from the field entry.
  70653  */
  70654 int 
  70655 bcm_esw_field_qualify_MimlSrcMac_get(
  70656     int unit, 
  70657     bcm_field_entry_t entry, 
  70658     bcm_mac_t *data, 
  70659     bcm_mac_t *mask)
  70660 {
  70661     return BCM_E_UNAVAIL;
  70662 }
  70663 
  70664 /*
  70665  * Get match criteria for bcmFieildQualifyMimlDstMac
  70666  *                qualifier from the field entry.
  70667  */
  70668 int 
  70669 bcm_esw_field_qualify_MimlDstMac_get(
  70670     int unit, 
  70671     bcm_field_entry_t entry, 
  70672     bcm_mac_t *data, 
  70673     bcm_mac_t *mask)
  70674 {
  70675     return BCM_E_UNAVAIL;
  70676 }
  70677 
  70678 /*
  70679  * Set match criteria for bcmFieildQualifyMimlVlan
  70680  *                qualifier in the field entry.
  70681  */
  70682 int 
  70683 bcm_esw_field_qualify_MimlVlan(
  70684     int unit, 
  70685     bcm_field_entry_t entry, 
  70686     bcm_vlan_t data, 
  70687     bcm_vlan_t mask)
  70688 {
  70689     return BCM_E_UNAVAIL;
  70690 }
  70691 
  70692 /*
  70693  * Set match criteria for bcmFieildQualifyMimlVlanId
  70694  *                qualifier in the field entry.
  70695  */
  70696 int 
  70697 bcm_esw_field_qualify_MimlVlanId(
  70698     int unit, 
  70699     bcm_field_entry_t entry, 
  70700     bcm_vlan_t data, 
  70701     bcm_vlan_t mask)
  70702 {
  70703     return BCM_E_UNAVAIL;
  70704 }
  70705 
  70706 /*
  70707  * Set match criteria for bcmFieildQualifyMimlVlanPri
  70708  *                qualifier in the field entry.
  70709  */
  70710 int 
  70711 bcm_esw_field_qualify_MimlVlanPri(
  70712     int unit, 
  70713     bcm_field_entry_t entry, 
  70714     uint8 data, 
  70715     uint8 mask)
  70716 {
  70717     return BCM_E_UNAVAIL;
  70718 }
  70719 
  70720 
  70721 /*
  70722  * Set match criteria for bcmFieildQualifyMimlVlanCfi
  70723  *                qualifier in the field entry.
  70724  */
  70725 int 
  70726 bcm_esw_field_qualify_MimlVlanCfi(
  70727     int unit, 
  70728     bcm_field_entry_t entry, 
  70729     uint8 data, 
  70730     uint8 mask)
  70731 {
  70732     return BCM_E_UNAVAIL;
  70733 }
  70734 
  70735 /*
  70736  * Get match criteria for bcmFieildQualifyMimlVlan
  70737  *                qualifier from the field entry.
  70738  */
  70739 int 
  70740 bcm_esw_field_qualify_MimlVlan_get(
  70741     int unit, 
  70742     bcm_field_entry_t entry, 
  70743     bcm_vlan_t *data, 
  70744     bcm_vlan_t *mask)
  70745 {
  70746     return BCM_E_UNAVAIL;
  70747 }
  70748 
  70749 /*
  70750  * Get match criteria for bcmFieildQualifyMimlVlanVid
  70751  *                qualifier from the field entry.
  70752  */
  70753 int 
  70754 bcm_esw_field_qualify_MimlVlanId_get(
  70755     int unit, 
  70756     bcm_field_entry_t entry, 
  70757     bcm_vlan_t *data, 
  70758     bcm_vlan_t *mask)
  70759 {
  70760     return BCM_E_UNAVAIL;
  70761 }
  70762 
  70763 /*
  70764  * Get match criteria for bcmFieildQualifyMimlVlanPri
  70765  *                qualifier from the field entry.
  70766  */
  70767 int 
  70768 bcm_esw_field_qualify_MimlVlanPri_get(
  70769     int unit, 
  70770     bcm_field_entry_t entry, 
  70771     uint8 *data, 
  70772     uint8 *mask)
  70773 {
  70774     return BCM_E_UNAVAIL;
  70775 }
  70776 
  70777 /*
  70778  * Get match criteria for bcmFieildQualifyMimlVlanCfi_get
  70779  *                qualifier from the field entry.
  70780  */
  70781 int 
  70782 bcm_esw_field_qualify_MimlVlanCfi_get(
  70783     int unit, 
  70784     bcm_field_entry_t entry, 
  70785     uint8 *data, 
  70786     uint8 *mask)
  70787 {
  70788     return BCM_E_UNAVAIL;
  70789 }
  70790 
  70791 /*
  70792  * Set match criteria for bcmFieildQualifyMimlInnerTag
  70793  *                qualifier in the field entry.
  70794  */
  70795 int 
  70796 bcm_esw_field_qualify_MimlInnerTag(
  70797     int unit, 
  70798     bcm_field_entry_t entry, 
  70799     uint32 data, 
  70800     uint32 mask)
  70801 {
  70802     return BCM_E_UNAVAIL;
  70803 }
  70804 
  70805 /*
  70806  * Get match criteria for bcmFieildQualifyMimlInnerTag_get
  70807  *                qualifier from the field entry.
  70808  */
  70809 int 
  70810 bcm_esw_field_qualify_MimlInnerTag_get(
  70811     int unit, 
  70812     bcm_field_entry_t entry, 
  70813     uint32 *data, 
  70814     uint32 *mask)
  70815 {
  70816     return BCM_E_UNAVAIL;
  70817 }
  70818 
  70819 /* 
  70820  * Set match criteria for bcmFieldQualifyCapwapHdrType
  70821  *                qualifier in the field entry.
  70822  */
  70823 int 
  70824 bcm_esw_field_qualify_CapwapHdrType(
  70825     int unit, 
  70826     bcm_field_entry_t entry, 
  70827     uint8 data, 
  70828     uint8 mask)
  70829 {
  70830     return BCM_E_UNAVAIL;
  70831 }
  70832 
  70833 /* 
  70834  * Get match criteria for bcmFieldQualifyCapwapHdrType
  70835  *                qualifier from the field entry.
  70836  */
  70837 int 
  70838 bcm_esw_field_qualify_CapwapHdrType_get(
  70839     int unit, 
  70840     bcm_field_entry_t entry, 
  70841     uint8 *data, 
  70842     uint8 *mask)
  70843 {
  70844     return BCM_E_UNAVAIL;
  70845 }
  70846 
  70847 /* 
  70848  * Set match criteria for bcmFieldQualifyCapwapHdrRid
  70849  *                qualifier in the field entry.
  70850  */
  70851 int 
  70852 bcm_esw_field_qualify_CapwapHdrRid(
  70853     int unit, 
  70854     bcm_field_entry_t entry, 
  70855     uint8 data, 
  70856     uint8 mask)
  70857 {
  70858     return BCM_E_UNAVAIL;
  70859 }
  70860 
  70861 /* 
  70862  * Get match criteria for bcmFieldQualifyCapwapHdrRid
  70863  *                qualifier from the field entry.
  70864  */
  70865 int 
  70866 bcm_esw_field_qualify_CapwapHdrRid_get(
  70867     int unit, 
  70868     bcm_field_entry_t entry, 
  70869     uint8 *data, 
  70870     uint8 *mask)
  70871 {
  70872     return BCM_E_UNAVAIL;
  70873 }
  70874 
  70875 /* 
  70876  * Set match criteria for bcmFieldQualifyCapwapPayloadSOF
  70877  *                qualifier in the field entry.
  70878  */
  70879 int 
  70880 bcm_esw_field_qualify_CapwapPayloadSOF(
  70881     int unit, 
  70882     bcm_field_entry_t entry, 
  70883     uint8 data, 
  70884     uint8 mask)
  70885 {
  70886     return BCM_E_UNAVAIL;
  70887 }
  70888 
  70889 /* 
  70890  * Get match criteria for bcmFieldQualifyCapwapPayloadSOF
  70891  *                qualifier from the field entry.
  70892  */
  70893 int 
  70894 bcm_esw_field_qualify_CapwapPayloadSOF_get(
  70895     int unit, 
  70896     bcm_field_entry_t entry, 
  70897     uint8 *data, 
  70898     uint8 *mask)
  70899 {
  70900     return BCM_E_UNAVAIL;
  70901 }
  70902 
  70903 /* 
  70904  * Set match criteria for bcmFieldQualifyCapwapPayloadDstMac
  70905  *                qualifier in the field entry.
  70906  */
  70907 int 
  70908 bcm_esw_field_qualify_CapwapPayloadDstMac(
  70909     int unit, 
  70910     bcm_field_entry_t entry, 
  70911     bcm_mac_t data, 
  70912     bcm_mac_t mask)
  70913 {
  70914     return BCM_E_UNAVAIL;
  70915 }
  70916 
  70917 /* 
  70918  * Get match criteria for CapwapPayloadDstMac
  70919  *                qualifier from the field entry.
  70920  */
  70921 int 
  70922 bcm_esw_field_qualify_CapwapPayloadDstMac_get(
  70923     int unit, 
  70924     bcm_field_entry_t entry, 
  70925     bcm_mac_t *data, 
  70926     bcm_mac_t *mask)
  70927 {
  70928     return BCM_E_UNAVAIL;
  70929 }
  70930 
  70931 /* 
  70932  * Set match criteria for bcmFieldQualifyCapwapPayloadSrcMac
  70933  *                qualifier in the field entry.
  70934  */
  70935 int 
  70936 bcm_esw_field_qualify_CapwapPayloadSrcMac(
  70937     int unit, 
  70938     bcm_field_entry_t entry, 
  70939     bcm_mac_t data, 
  70940     bcm_mac_t mask)
  70941 {
  70942     return BCM_E_UNAVAIL;
  70943 }
  70944 
  70945 /* 
  70946  * Get match criteria for bcmFieldQualifyCapwapPayloadSrcMac
  70947  *                qualifier from the field entry.
  70948  */
  70949 int 
  70950 bcm_esw_field_qualify_CapwapPayloadSrcMac_get(
  70951     int unit, 
  70952     bcm_field_entry_t entry, 
  70953     bcm_mac_t *data, 
  70954     bcm_mac_t *mask)
  70955 {
  70956     return BCM_E_UNAVAIL;
  70957 }
  70958 
  70959 /* 
  70960  * Configure match criteria for bcmFieldQualifyCapwapPayloadEtherType
  70961  *             qualifier from the field entry.
  70962  */
  70963 int 
  70964 bcm_esw_field_qualify_CapwapPayloadEtherType(
  70965     int unit, 
  70966     bcm_field_entry_t entry, 
  70967     uint16 data, 
  70968     uint16 mask)
  70969 {
  70970     return BCM_E_UNAVAIL;
  70971 }
  70972 
  70973 /* 
  70974  * Get match criteria for bcmFieldQualifyCapwapPayloadEtherType
  70975  *             qualifier from the field entry.
  70976  */
  70977 int 
  70978 bcm_esw_field_qualify_CapwapPayloadEtherType_get(
  70979     int unit, 
  70980     bcm_field_entry_t entry, 
  70981     uint16 *data, 
  70982     uint16 *mask)
  70983 {
  70984     return BCM_E_UNAVAIL;
  70985 }
  70986 
  70987 /* 
  70988  * Set match criteria for bcmFieldQualifyCapwapPayloadOuterVlan
  70989  *                  qualifier in the field entry.
  70990  */
  70991 int 
  70992 bcm_esw_field_qualify_CapwapPayloadOuterVlan(
  70993     int unit, 
  70994     bcm_field_entry_t entry, 
  70995     bcm_vlan_t data, 
  70996     bcm_vlan_t mask)
  70997 {
  70998     return BCM_E_UNAVAIL;
  70999 }
  71000 
  71001 /* 
  71002  * Get match criteria for bcmFieldQualifyCapwapPayloadOuterVlan
  71003  *                qualifier from the field entry.
  71004  */
  71005 int 
  71006 bcm_esw_field_qualify_CapwapPayloadOuterVlan_get(
  71007     int unit, 
  71008     bcm_field_entry_t entry, 
  71009     bcm_vlan_t *data, 
  71010     bcm_vlan_t *mask)
  71011 {
  71012     return BCM_E_UNAVAIL;
  71013 }
  71014 
  71015 /* 
  71016  * Set match criteria for bcmFieldQualifyCapwapPayloadOuterVlanId
  71017  *                  qualifier in the field entry.
  71018  */
  71019 int 
  71020 bcm_esw_field_qualify_CapwapPayloadOuterVlanId(
  71021     int unit, 
  71022     bcm_field_entry_t entry, 
  71023     bcm_vlan_t data, 
  71024     bcm_vlan_t mask)
  71025 {
  71026     return BCM_E_UNAVAIL;
  71027 }
  71028 
  71029 /* 
  71030  * Get match criteria for bcmFieldQualifyCapwapPayloadOuterVlanId
  71031  *                  qualifier from the field entry.
  71032  */
  71033 int 
  71034 bcm_esw_field_qualify_CapwapPayloadOuterVlanId_get(
  71035     int unit, 
  71036     bcm_field_entry_t entry, 
  71037     bcm_vlan_t *data, 
  71038     bcm_vlan_t *mask)
  71039 {
  71040     return BCM_E_UNAVAIL;
  71041 }
  71042 
  71043 /* 
  71044  * Set match criteria for bcmFieldQualifyCapwapPayloadOuterVlanPri
  71045  *                  qualifier in the field entry.
  71046  */
  71047 int 
  71048 bcm_esw_field_qualify_CapwapPayloadOuterVlanPri(
  71049     int unit, 
  71050     bcm_field_entry_t entry, 
  71051     uint8 data, 
  71052     uint8 mask)
  71053 {
  71054     return BCM_E_UNAVAIL;
  71055 }
  71056 
  71057 /* 
  71058  * Get match criteria for bcmFieldQualifyCapwapPayloadOuterVlanPri
  71059  *                  qualifier from the field entry.
  71060  */
  71061 int 
  71062 bcm_esw_field_qualify_CapwapPayloadOuterVlanPri_get(
  71063     int unit, 
  71064     bcm_field_entry_t entry, 
  71065     uint8 *data, 
  71066     uint8 *mask)
  71067 {
  71068     return BCM_E_UNAVAIL;
  71069 }
  71070 
  71071 /* 
  71072  * Set match criteria for bcmFieldQualifyCapwapPayloadOuterVlanCfi
  71073  *                  qualifier in the field entry.
  71074  */
  71075 int 
  71076 bcm_esw_field_qualify_CapwapPayloadOuterVlanCfi(
  71077     int unit, 
  71078     bcm_field_entry_t entry, 
  71079     uint8 data, 
  71080     uint8 mask)
  71081 {
  71082     return BCM_E_UNAVAIL;
  71083 }
  71084 
  71085 /* 
  71086  * Get match criteria for bcmFieldQualifyCapwapPayloadOuterVlanCfi_get
  71087  *                  qualifier from the field entry.
  71088  */
  71089 int 
  71090 bcm_esw_field_qualify_CapwapPayloadOuterVlanCfi_get(
  71091     int unit, 
  71092     bcm_field_entry_t entry, 
  71093     uint8 *data, 
  71094     uint8 *mask)
  71095 {
  71096     return BCM_E_UNAVAIL;
  71097 }
  71098 
  71099 /* 
  71100  * Set match criteria for bcmFieldQualifyCapwapPayloadInnerVlan
  71101  *                  qualifier in the field entry.
  71102  */
  71103 int 
  71104 bcm_esw_field_qualify_CapwapPayloadInnerVlan(
  71105     int unit, 
  71106     bcm_field_entry_t entry, 
  71107     bcm_vlan_t data, 
  71108     bcm_vlan_t mask)
  71109 {
  71110     return BCM_E_UNAVAIL;
  71111 }
  71112 
  71113 /* 
  71114  * Get match criteria for bcmFieldQualifyCapwapPayloadInnerVlan
  71115  *                qualifier from the field entry.
  71116  */
  71117 int 
  71118 bcm_esw_field_qualify_CapwapPayloadInnerVlan_get(
  71119     int unit, 
  71120     bcm_field_entry_t entry, 
  71121     bcm_vlan_t *data, 
  71122     bcm_vlan_t *mask)
  71123 {
  71124     return BCM_E_UNAVAIL;
  71125 }
  71126 
  71127 /* 
  71128  * Set match criteria for bcmFieldQualifyCapwapPayloadInnerVlanId
  71129  *                  qualifier in the field entry.
  71130  */
  71131 int 
  71132 bcm_esw_field_qualify_CapwapPayloadInnerVlanId(
  71133     int unit, 
  71134     bcm_field_entry_t entry, 
  71135     bcm_vlan_t data, 
  71136     bcm_vlan_t mask)
  71137 {
  71138     return BCM_E_UNAVAIL;
  71139 }
  71140 
  71141 /* 
  71142  * Get match criteria for bcmFieldQualifyCapwapPayloadInnerVlanId
  71143  *                  qualifier from the field entry.
  71144  */
  71145 int 
  71146 bcm_esw_field_qualify_CapwapPayloadInnerVlanId_get(
  71147     int unit, 
  71148     bcm_field_entry_t entry, 
  71149     bcm_vlan_t *data, 
  71150     bcm_vlan_t *mask)
  71151 {
  71152     return BCM_E_UNAVAIL;
  71153 }
  71154 
  71155 /* 
  71156  * Set match criteria for bcmFieldQualifyCapwapPayloadInnerVlanPri
  71157  *                  qualifier in the field entry.
  71158  */
  71159 int 
  71160 bcm_esw_field_qualify_CapwapPayloadInnerVlanPri(
  71161     int unit, 
  71162     bcm_field_entry_t entry, 
  71163     uint8 data, 
  71164     uint8 mask)
  71165 {
  71166     return BCM_E_UNAVAIL;
  71167 }
  71168 
  71169 /* 
  71170  * Get match criteria for bcmFieldQualifyCapwapPayloadInnerVlanPri
  71171  *                  qualifier from the field entry.
  71172  */
  71173 int 
  71174 bcm_esw_field_qualify_CapwapPayloadInnerVlanPri_get(
  71175     int unit, 
  71176     bcm_field_entry_t entry, 
  71177     uint8 *data, 
  71178     uint8 *mask)
  71179 {
  71180     return BCM_E_UNAVAIL;
  71181 }
  71182 
  71183 /* 
  71184  * Set match criteria for bcmFieldQualifyCapwapPayloadInnerVlanCfi
  71185  *                  qualifier in the field entry.
  71186  */
  71187 int 
  71188 bcm_esw_field_qualify_CapwapPayloadInnerVlanCfi(
  71189     int unit, 
  71190     bcm_field_entry_t entry, 
  71191     uint8 data, 
  71192     uint8 mask)
  71193 {
  71194     return BCM_E_UNAVAIL;
  71195 }
  71196 
  71197 /* 
  71198  * Get match criteria for bcmFieldQualifyCapwapPayloadInnerVlanCfi_get
  71199  *                  qualifier from the field entry.
  71200  */
  71201 int 
  71202 bcm_esw_field_qualify_CapwapPayloadInnerVlanCfi_get(
  71203     int unit, 
  71204     bcm_field_entry_t entry, 
  71205     uint8 *data, 
  71206     uint8 *mask)
  71207 {
  71208     return BCM_E_UNAVAIL;
  71209 }
  71210 
  71211 /* 
  71212  * Set match criteria for bcmFieldQualifyCapwapPayloadVlanFormat
  71213  *                  qualifier in the field entry.
  71214  */
  71215 int 
  71216 bcm_esw_field_qualify_CapwapPayloadVlanFormat(
  71217     int unit, 
  71218     bcm_field_entry_t entry, 
  71219     uint8 data, 
  71220     uint8 mask)
  71221 {
  71222     return BCM_E_UNAVAIL;
  71223 }
  71224 
  71225 /* 
  71226  * Get match criteria for bcmFieldQualifyCapwapPayloadVlanFormat
  71227  *                  qualifier from the field entry.
  71228  */
  71229 int 
  71230 bcm_esw_field_qualify_CapwapPayloadVlanFormat_get(
  71231     int unit, 
  71232     bcm_field_entry_t entry, 
  71233     uint8 *data, 
  71234     uint8 *mask)
  71235 {
  71236     return BCM_E_UNAVAIL;
  71237 }
  71238 
  71239 /* bcm_field_qualify_CapwapPayloadSip */
  71240 int 
  71241 bcm_esw_field_qualify_CapwapPayloadSip(
  71242     int unit, 
  71243     bcm_field_entry_t entry, 
  71244     bcm_ip_t data, 
  71245     bcm_ip_t mask)
  71246 {
  71247     return BCM_E_UNAVAIL;
  71248 }
  71249 
  71250 /* bcm_field_qualify_CapwapPayloadDip */
  71251 int 
  71252 bcm_esw_field_qualify_CapwapPayloadDip(
  71253     int unit, 
  71254     bcm_field_entry_t entry, 
  71255     bcm_ip_t data, 
  71256     bcm_ip_t mask)
  71257 {
  71258     return BCM_E_UNAVAIL;
  71259 }
  71260 
  71261 /* 
  71262  * Get match criteria for bcmFieldQualifyCapwapPayloadSip
  71263  *                qualifier from the field entry.
  71264  */
  71265 int 
  71266 bcm_esw_field_qualify_CapwapPayloadSip_get(
  71267     int unit, 
  71268     bcm_field_entry_t entry, 
  71269     bcm_ip_t *data, 
  71270     bcm_ip_t *mask)
  71271 {
  71272     return BCM_E_UNAVAIL;
  71273 }
  71274 
  71275 /* 
  71276  * Get match criteria for bcmFieldQualifyCapwapPayloadDip
  71277  *                qualifier from the field entry.
  71278  */
  71279 int 
  71280 bcm_esw_field_qualify_CapwapPayloadDip_get(
  71281     int unit, 
  71282     bcm_field_entry_t entry, 
  71283     bcm_ip_t *data, 
  71284     bcm_ip_t *mask)
  71285 {
  71286     return BCM_E_UNAVAIL;
  71287 }
  71288 
  71289 /* bcm_field_qualify_CapwapPayloadSip6 */
  71290 int 
  71291 bcm_esw_field_qualify_CapwapPayloadSip6(
  71292     int unit, 
  71293     bcm_field_entry_t entry, 
  71294     bcm_ip6_t data, 
  71295     bcm_ip6_t mask)
  71296 {
  71297     return BCM_E_UNAVAIL;
  71298 }
  71299 
  71300 /* bcm_field_qualify_CapwapPayloadDip6 */
  71301 int 
  71302 bcm_esw_field_qualify_CapwapPayloadDip6(
  71303     int unit, 
  71304     bcm_field_entry_t entry, 
  71305     bcm_ip6_t data, 
  71306     bcm_ip6_t mask)
  71307 {
  71308     return BCM_E_UNAVAIL;
  71309 }
  71310 
  71311 /* 
  71312  * Get match criteria for bcmFieldQualifyCapwapPayloadSip6
  71313  *                qualifier from the field entry.
  71314  */
  71315 int 
  71316 bcm_esw_field_qualify_CapwapPayloadSip6_get(
  71317     int unit, 
  71318     bcm_field_entry_t entry, 
  71319     bcm_ip6_t *data, 
  71320     bcm_ip6_t *mask)
  71321 {
  71322     return BCM_E_UNAVAIL;
  71323 }
  71324 
  71325 /* 
  71326  * Get match criteria for bcmFieldQualifyCapwapPayloadDip6
  71327  *                qualifier from the field entry.
  71328  */
  71329 int 
  71330 bcm_esw_field_qualify_CapwapPayloadDip6_get(
  71331     int unit, 
  71332     bcm_field_entry_t entry, 
  71333     bcm_ip6_t *data, 
  71334     bcm_ip6_t *mask)
  71335 {
  71336     return BCM_E_UNAVAIL;
  71337 }
  71338 
  71339 /* 
  71340  * Set match criteria for bcmFieldQualifyCapwapPayloadIpProtocol
  71341  *                  qualifier in the field entry.
  71342  */
  71343 int 
  71344 bcm_esw_field_qualify_CapwapPayloadIpProtocol(
  71345     int unit, 
  71346     bcm_field_entry_t entry, 
  71347     uint8 data, 
  71348     uint8 mask)
  71349 {
  71350     return BCM_E_UNAVAIL;
  71351 }
  71352 
  71353 /* 
  71354  * Get match criteria for bcmFieldQualifyCapwapPayloadIpProtocol_get
  71355  *                  qualifier from the field entry.
  71356  */
  71357 int 
  71358 bcm_esw_field_qualify_CapwapPayloadIpProtocol_get(
  71359     int unit, 
  71360     bcm_field_entry_t entry, 
  71361     uint8 *data, 
  71362     uint8 *mask)
  71363 {
  71364     return BCM_E_UNAVAIL;
  71365 }
  71366 
  71367 /* 
  71368  * Set match criteria for bcmFieldQualifyCapwapPayloadTos
  71369  *                  qualifier in the field entry.
  71370  */
  71371 int 
  71372 bcm_esw_field_qualify_CapwapPayloadTos(
  71373     int unit, 
  71374     bcm_field_entry_t entry, 
  71375     uint8 data, 
  71376     uint8 mask)
  71377 {
  71378     return BCM_E_UNAVAIL;
  71379 }
  71380 
  71381 /* 
  71382  * Get match criteria for bcmFieldQualifyCapwapPayloadTos_get
  71383  *                  qualifier from the field entry.
  71384  */
  71385 int 
  71386 bcm_esw_field_qualify_CapwapPayloadTos_get(
  71387     int unit, 
  71388     bcm_field_entry_t entry, 
  71389     uint8 *data, 
  71390     uint8 *mask)
  71391 {
  71392     return BCM_E_UNAVAIL;
  71393 }
  71394 
  71395 /* bcm_field_qualify_CapwapPayloadL4SrcPort */
  71396 int 
  71397 bcm_esw_field_qualify_CapwapPayloadL4SrcPort(
  71398     int unit, 
  71399     bcm_field_entry_t entry, 
  71400     bcm_l4_port_t data, 
  71401     bcm_l4_port_t mask)
  71402 {
  71403     return BCM_E_UNAVAIL;
  71404 }
  71405 
  71406 /* bcm_field_qualify_CapwapPayloadL4DstPort */
  71407 int 
  71408 bcm_esw_field_qualify_CapwapPayloadL4DstPort(
  71409     int unit, 
  71410     bcm_field_entry_t entry, 
  71411     bcm_l4_port_t data, 
  71412     bcm_l4_port_t mask)
  71413 {
  71414     return BCM_E_UNAVAIL;
  71415 }
  71416 
  71417 /* 
  71418  * Get match criteria for bcmFieldQualifyCapwapPayloadL4SrcPort
  71419  *                qualifier from the field entry.
  71420  */
  71421 int 
  71422 bcm_esw_field_qualify_CapwapPayloadL4SrcPort_get(
  71423     int unit, 
  71424     bcm_field_entry_t entry, 
  71425     bcm_l4_port_t *data, 
  71426     bcm_l4_port_t *mask)
  71427 {
  71428     return BCM_E_UNAVAIL;
  71429 }
  71430 
  71431 /* 
  71432  * Get match criteria for bcmFieldQualifyCapwapPayloadL4DstPort
  71433  *                qualifier from the field entry.
  71434  */
  71435 int 
  71436 bcm_esw_field_qualify_CapwapPayloadL4DstPort_get(
  71437     int unit, 
  71438     bcm_field_entry_t entry, 
  71439     bcm_l4_port_t *data, 
  71440     bcm_l4_port_t *mask)
  71441 {
  71442     return BCM_E_UNAVAIL;
  71443 }
  71444 
  71445 /* 
  71446  * Set match criteria for bcmFieldQualifyCapwapPayloadL3HdrParseable
  71447  *                  qualifier in the field entry.
  71448  */
  71449 int 
  71450 bcm_esw_field_qualify_CapwapPayloadL3HdrParseable(
  71451     int unit, 
  71452     bcm_field_entry_t entry, 
  71453     uint8 data, 
  71454     uint8 mask)
  71455 {
  71456     return BCM_E_UNAVAIL;
  71457 }
  71458 
  71459 /* 
  71460  * Get match criteria for bcmFieldQualifyCapwapPayloadL3HdrParseable_get
  71461  *                  qualifier from the field entry.
  71462  */
  71463 int 
  71464 bcm_esw_field_qualify_CapwapPayloadL3HdrParseable_get(
  71465     int unit, 
  71466     bcm_field_entry_t entry, 
  71467     uint8 *data, 
  71468     uint8 *mask)
  71469 {
  71470     return BCM_E_UNAVAIL;
  71471 }
  71472 
  71473 /* 
  71474  * Set match criteria for bcmFieldQualifyCapwapPayloadL4HdrParseable
  71475  *                  qualifier in the field entry.
  71476  */
  71477 int 
  71478 bcm_esw_field_qualify_CapwapPayloadL4HdrParseable(
  71479     int unit, 
  71480     bcm_field_entry_t entry, 
  71481     uint8 data, 
  71482     uint8 mask)
  71483 {
  71484     return BCM_E_UNAVAIL;
  71485 }
  71486 
  71487 /* 
  71488  * Get match criteria for bcmFieldQualifyCapwapPayloadL4HdrParseable_get
  71489  *                  qualifier from the field entry.
  71490  */
  71491 int
  71492 bcm_esw_field_qualify_CapwapPayloadL4HdrParseable_get(
  71493     int unit, 
  71494     bcm_field_entry_t entry, 
  71495     uint8 *data, 
  71496     uint8 *mask)
  71497 {
  71498     return BCM_E_UNAVAIL;
  71499 }
  71500 
  71501 int
  71502 bcm_esw_field_qualify_InterfaceIngressKeySelectClassPort(
  71503     int unit, bcm_field_entry_t entry,
  71504     uint32 data, uint32 mask)
  71505 {
  71506     return BCM_E_UNAVAIL;
  71507 }
  71508 
  71509 int
  71510 bcm_esw_field_qualify_InterfaceIngressKeySelectClassPort_get(
  71511     int unit, bcm_field_entry_t entry,
  71512     uint32 *data, uint32 *mask)
  71513 {
  71514     return BCM_E_UNAVAIL;
  71515 }
  71516 
  71517 int
  71518 bcm_esw_field_qualify_ISid(
  71519     int unit, bcm_field_entry_t entry,
  71520     uint32 data, uint32 mask)
  71521 {
  71522     return BCM_E_UNAVAIL;
  71523 }
  71524 
  71525 int
  71526 bcm_esw_field_qualify_ISid_get(
  71527     int unit, bcm_field_entry_t entry,
  71528     uint32 *data, uint32 *mask)
  71529 {
  71530     return BCM_E_UNAVAIL;
  71531 }
  71532 
  71533 int
  71534 bcm_esw_field_qualify_ITag(
  71535     int unit, bcm_field_entry_t entry,
  71536     uint32 data, uint32 mask)
  71537 {
  71538     return BCM_E_UNAVAIL;
  71539 }
  71540 
  71541 int
  71542 bcm_esw_field_qualify_ITag_get(
  71543     int unit, bcm_field_entry_t entry,
  71544     uint32 *data, uint32 *mask)
  71545 {
  71546     return BCM_E_UNAVAIL;
  71547 }
  71548 
  71549 int
  71550 bcm_esw_field_qualify_BfdYourDiscriminator(
  71551     int unit, bcm_field_entry_t entry,
  71552     uint32 data, uint32 mask)
  71553 {
  71554     return BCM_E_UNAVAIL;
  71555 }
  71556 
  71557 int
  71558 bcm_esw_field_qualify_BfdYourDiscriminator_get(
  71559     int unit, bcm_field_entry_t entry,
  71560     uint32 *data, uint32 *mask)
  71561 {
  71562     return BCM_E_UNAVAIL;
  71563 }
  71564 
  71565 int
  71566 bcm_esw_field_qualify_CpuVisibilityPacket(
  71567     int unit, bcm_field_entry_t entry,
  71568     uint8 data, uint8 mask)
  71569 {
  71570     return BCM_E_UNAVAIL;
  71571 }
  71572 
  71573 int
  71574 bcm_esw_field_qualify_CpuVisibilityPacket_get(
  71575     int unit, bcm_field_entry_t entry,
  71576     uint8 *data, uint8 *mask)
  71577 {
  71578     return BCM_E_UNAVAIL;
  71579 }
  71580 
  71581 int
  71582 bcm_esw_field_qualify_DstL2MulticastGroup(
  71583     int unit, bcm_field_entry_t entry,
  71584     bcm_multicast_t group, bcm_multicast_t mask)
  71585 {
  71586     return BCM_E_UNAVAIL;
  71587 }
  71588 
  71589 int
  71590 bcm_esw_field_qualify_DstL2MulticastGroup_get(
  71591     int unit, bcm_field_entry_t entry,
  71592     bcm_multicast_t *group, bcm_multicast_t *mask)
  71593 {
  71594     return BCM_E_UNAVAIL;
  71595 }
  71596 
  71597 int
  71598 bcm_esw_field_qualify_DstL3MulticastGroup(
  71599     int unit, bcm_field_entry_t entry,
  71600     bcm_multicast_t group, bcm_multicast_t mask)
  71601 {
  71602     return BCM_E_UNAVAIL;
  71603 }
  71604 
  71605 int
  71606 bcm_esw_field_qualify_DstL3MulticastGroup_get(
  71607     int unit, bcm_field_entry_t entry,
  71608     bcm_multicast_t *group, bcm_multicast_t *mask)
  71609 {
  71610     return BCM_E_UNAVAIL;
  71611 }
  71612 
  71613 /* Set match criteria to qualify Rx Down Mep SAT terminated hit status. */
  71614 int bcm_esw_field_qualify_DownMepSatTerminated(
  71615     int unit, 
  71616     bcm_field_entry_t entry, 
  71617     uint8 data, 
  71618     uint8 mask)
  71619 {
  71620     return BCM_E_UNAVAIL;
  71621 }
  71622 
  71623 /* Get match criteria for Rx Down Mep SAT terminated hit status. */
  71624 int bcm_esw_field_qualify_DownMepSatTerminated_get(
  71625     int unit, 
  71626     bcm_field_entry_t entry, 
  71627     uint8 *data, 
  71628     uint8 *mask)
  71629 {
  71630     return BCM_E_UNAVAIL;
  71631 }
  71632 /*
  71633  * Function:
  71634  *      bcm_esw_field_qualify_DstMultipathOverlay
  71635  * Purpose:
  71636  *      Set match criteria for bcmFieildQualifyDstMultipathOverlay
  71637  *                     qualifier from the field entry.
  71638  * Parameters:
  71639  *      unit - (IN) Unit number.
  71640  *      entry - (IN) BCM field entry id.
  71641  *      data  - (IN) ECMP interface(s) with overlay flag
  71642  *      mask  - (IN) corresponding mask
  71643  * Returns:
  71644  *      BCM_E_XXX
  71645  * Notes:
  71646  */
  71647 int
  71648 bcm_esw_field_qualify_DstMultipathOverlay(int unit, bcm_field_entry_t entry,
  71649                                            bcm_if_t data, bcm_if_t mask) {
  71650     return BCM_E_UNAVAIL;
  71651 }
  71652  
  71653  /*
  71654  * Function:
  71655  *      bcm_esw_field_qualify_DstMultipathOverlay_get
  71656  * Purpose:
  71657  *      Get match criteria for bcmFieildQualifyDstMultipathOverlay
  71658  *                     qualifier from the field entry.
  71659  * Parameters:
  71660  *      unit - (IN) Unit number.
  71661  *      entry - (IN) BCM field entry id.
  71662  *      data  - (OUT) ECMP interface(s) with overlay flag
  71663  *      mask  - (OUT) corresponding mask
  71664  * Returns:
  71665  *      BCM_E_XXX
  71666  * Notes:
  71667  */
  71668 int
  71669 bcm_esw_field_qualify_DstMultipathOverlay_get(int unit, bcm_field_entry_t entry,
  71670                                                bcm_if_t *data, bcm_if_t *mask) {
  71671     return BCM_E_UNAVAIL;
  71672 }
  71673  /*
  71674  * Function:
  71675  *      bcm_esw_field_qualify_DstMultipathUnderlay
  71676  * Purpose:
  71677  *      Set match criteria for bcmFieildQualifyDstMultipathUnderlay
  71678  *                     qualifier from the field entry.
  71679  * Parameters:
  71680  *      unit - (IN) Unit number.
  71681  *      entry - (IN) BCM field entry id.
  71682  *      data  - (IN) ECMP interface(s) with Underlay flag
  71683  *      mask  - (IN) corresponding mask
  71684  * Returns:
  71685  *      BCM_E_XXX
  71686  * Notes:
  71687  */
  71688 int
  71689 bcm_esw_field_qualify_DstMultipathUnderlay(int unit, bcm_field_entry_t entry,
  71690                                            bcm_if_t data, bcm_if_t mask) {
  71691         return BCM_E_UNAVAIL;
  71692 }
  71693  /*
  71694  * Function:
  71695  *      bcm_esw_field_qualify_DstMultipathUnderlay_get
  71696  * Purpose:
  71697  *      Get match criteria for bcmFieildQualifyDstMultipathUnderlay
  71698  *                     qualifier from the field entry.
  71699  * Parameters:
  71700  *      unit - (IN) Unit number.
  71701  *      entry - (IN) BCM field entry id.
  71702  *      data  - (OUT) ECMP interface(s) with Underlay flag
  71703  *      mask  - (OUT) corresponding mask
  71704  * Returns:
  71705  *      BCM_E_XXX
  71706  * Notes:
  71707  */
  71708 int
  71709 bcm_esw_field_qualify_DstMultipathUnderlay_get(int unit, bcm_field_entry_t entry,
  71710                                                bcm_if_t *data, bcm_if_t *mask) {
  71711     return BCM_E_UNAVAIL;
  71712 }
  71713 
  71714 
  71715 int
  71716 bcm_esw_field_source_class_mode_set(
  71717     int unit, bcm_field_stage_t stage,
  71718     bcm_pbmp_t pbm,
  71719     bcm_field_src_class_mode_t mode)
  71720 {
  71721     return BCM_E_UNAVAIL;
  71722 }
  71723 
  71724 int
  71725 bcm_esw_field_source_class_mode_get(
  71726     int unit, bcm_field_stage_t stage,
  71727     bcm_pbmp_t pbm,
  71728     bcm_field_src_class_mode_t *mode)
  71729 {
  71730     return BCM_E_UNAVAIL;
  71731 }
  71732 
  71733 int
  71734 bcm_esw_field_qualify_MixedSrcClassId(
  71735     int unit, bcm_field_entry_t entry,
  71736     bcm_pbmp_t pbm,
  71737     bcm_field_src_class_t data,
  71738     bcm_field_src_class_t mask)
  71739 {
  71740     return BCM_E_UNAVAIL;
  71741 }
  71742 
  71743 int
  71744 bcm_esw_field_qualify_MixedSrcClassId_get(
  71745     int unit, bcm_field_entry_t entry,
  71746     bcm_pbmp_t pbm,
  71747     bcm_field_src_class_t *data,
  71748     bcm_field_src_class_t *mask)
  71749 {
  71750     return BCM_E_UNAVAIL;
  71751 }
  71752 
  71753 int
  71754 bcm_esw_field_qualify_StpState(
  71755     int unit, bcm_field_entry_t entry,
  71756     uint8 data)
  71757 {
  71758     return BCM_E_UNAVAIL;
  71759 }
  71760 
  71761 int
  71762 bcm_esw_field_qualify_StpState_get(
  71763     int unit, bcm_field_entry_t entry,
  71764     uint8 *data)
  71765 {
  71766     return BCM_E_UNAVAIL;
  71767 }
  71768 
  71769 int bcm_esw_field_qualify_HiGigMirrorOrSwitchPkt(
  71770     int unit, 
  71771     bcm_field_entry_t entry, 
  71772     uint8 data, 
  71773     uint8 mask) 
  71774 {
  71775     return BCM_E_UNAVAIL;
  71776 }
  71777 
  71778 int bcm_esw_field_qualify_HiGigMirrorOrSwitchPkt_get(
  71779     int unit, 
  71780     bcm_field_entry_t entry, 
  71781     uint8 *data, 
  71782     uint8 *mask)
  71783 {
  71784     return BCM_E_UNAVAIL;
  71785 }
  71786 
  71787 int bcm_esw_field_qualify_HiGigMplsPkt(
  71788     int unit, 
  71789     bcm_field_entry_t entry, 
  71790     uint8 data, 
  71791     uint8 mask) 
  71792 {
  71793     return BCM_E_UNAVAIL;
  71794 }
  71795 
  71796 int bcm_esw_field_qualify_HiGigMplsPkt_get(
  71797     int unit, 
  71798     bcm_field_entry_t entry, 
  71799     uint8 *data, 
  71800     uint8 *mask)
  71801 {
  71802     return BCM_E_UNAVAIL;
  71803 }
  71804 
  71805 int bcm_esw_field_qualify_HiGigDoNotFlags(
  71806     int unit, 
  71807     bcm_field_entry_t entry, 
  71808     uint8 data, 
  71809     uint8 mask) 
  71810 {
  71811     return BCM_E_UNAVAIL;
  71812 }
  71813 
  71814 int bcm_esw_field_qualify_HiGigDoNotFlags_get(
  71815     int unit, 
  71816     bcm_field_entry_t entry, 
  71817     uint8 *data, 
  71818     uint8 *mask)
  71819 {
  71820     return BCM_E_UNAVAIL;
  71821 }
  71822 
  71823 int bcm_esw_field_qualify_HiGigPreserveFlags(
  71824     int unit, 
  71825     bcm_field_entry_t entry, 
  71826     uint8 data, 
  71827     uint8 mask) 
  71828 {
  71829     return BCM_E_UNAVAIL;
  71830 }
  71831 
  71832 int bcm_esw_field_qualify_HiGigPreserveFlags_get(
  71833     int unit, 
  71834     bcm_field_entry_t entry, 
  71835     uint8 *data, 
  71836     uint8 *mask)
  71837 {
  71838     return BCM_E_UNAVAIL;
  71839 }
  71840 
  71841 int bcm_esw_field_qualify_HiGigLabelType(
  71842     int unit, 
  71843     bcm_field_entry_t entry, 
  71844     uint8 data, 
  71845     uint8 mask) 
  71846 {
  71847     return BCM_E_UNAVAIL;
  71848 }
  71849 int bcm_esw_field_qualify_HiGigLabelType_get(
  71850     int unit, 
  71851     bcm_field_entry_t entry, 
  71852     uint8 *data, 
  71853     uint8 *mask)
  71854 {
  71855     return BCM_E_UNAVAIL;
  71856 }
  71857 
  71858 int bcm_esw_field_qualify_HiGigVpPreserveFlags(
  71859     int unit, 
  71860     bcm_field_entry_t entry, 
  71861     uint8 data, 
  71862     uint8 mask) 
  71863 {
  71864     return BCM_E_UNAVAIL;
  71865 }
  71866 
  71867 int bcm_esw_field_qualify_HiGigVpPreserveFlags_get(
  71868     int unit, 
  71869     bcm_field_entry_t entry, 
  71870     uint8 *data, 
  71871     uint8 *mask)
  71872 {
  71873     return BCM_E_UNAVAIL;
  71874 }
  71875 
  71876 int bcm_esw_field_qualify_HiGigOffloadEnginePreserveDscp(
  71877     int unit, 
  71878     bcm_field_entry_t entry, 
  71879     uint8 data, 
  71880     uint8 mask) 
  71881 {
  71882     return BCM_E_UNAVAIL;
  71883 }
  71884 
  71885 int bcm_esw_field_qualify_HiGigOffloadEnginePreserveDscp_get(
  71886     int unit, 
  71887     bcm_field_entry_t entry, 
  71888     uint8 *data, 
  71889     uint8 *mask)
  71890 {
  71891     return BCM_E_UNAVAIL;
  71892 }
  71893 
  71894 int bcm_esw_field_qualify_HiGigOffloadEnginePreserveDot1p(
  71895     int unit, 
  71896     bcm_field_entry_t entry, 
  71897     uint8 data, 
  71898     uint8 mask) 
  71899 {
  71900     return BCM_E_UNAVAIL;
  71901 }
  71902 
  71903 int bcm_esw_field_qualify_HiGigOffloadEnginePreserveDot1p_get(
  71904     int unit, 
  71905     bcm_field_entry_t entry, 
  71906     uint8 *data, 
  71907     uint8 *mask)
  71908 {
  71909     return BCM_E_UNAVAIL;
  71910 }
  71911 
  71912 int bcm_esw_field_qualify_HiGigOffloadEngineSrcType(
  71913     int unit, 
  71914     bcm_field_entry_t entry, 
  71915     uint8 data, 
  71916     uint8 mask) 
  71917 {
  71918     return BCM_E_UNAVAIL;
  71919 }
  71920 
  71921 int bcm_esw_field_qualify_HiGigOffloadEngineSrcType_get(
  71922     int unit, 
  71923     bcm_field_entry_t entry, 
  71924     uint8 *data, 
  71925     uint8 *mask)
  71926 {
  71927     return BCM_E_UNAVAIL;
  71928 }
  71929 
  71930 int bcm_esw_field_qualify_HiGigExtendedHeaderPresent(
  71931     int unit, 
  71932     bcm_field_entry_t entry, 
  71933     uint8 data, 
  71934     uint8 mask) 
  71935 {
  71936     return BCM_E_UNAVAIL;
  71937 }
  71938 
  71939 int bcm_esw_field_qualify_HiGigExtendedHeaderPresent_get(
  71940     int unit, 
  71941     bcm_field_entry_t entry, 
  71942     uint8 *data, 
  71943     uint8 *mask)
  71944 {
  71945     return BCM_E_UNAVAIL;
  71946 }
  71947 
  71948 int bcm_esw_field_qualify_HiGigVpLagFailoverPacket(
  71949     int unit, 
  71950     bcm_field_entry_t entry, 
  71951     uint8 data, 
  71952     uint8 mask) 
  71953 {
  71954     return BCM_E_UNAVAIL;
  71955 }
  71956 
  71957 int bcm_esw_field_qualify_HiGigVpLagFailoverPacket_get(
  71958     int unit, 
  71959     bcm_field_entry_t entry, 
  71960     uint8 *data, 
  71961     uint8 *mask)
  71962 {
  71963     return BCM_E_UNAVAIL;
  71964 }
  71965 
  71966 int bcm_esw_field_qualify_HiGigForwardingType(
  71967     int unit, 
  71968     bcm_field_entry_t entry, 
  71969     bcm_field_HiGigForwardingType_t type) 
  71970 {
  71971     return BCM_E_UNAVAIL;
  71972 }
  71973 
  71974 int bcm_esw_field_qualify_HiGigForwardingType_get(
  71975     int unit, 
  71976     bcm_field_entry_t entry, 
  71977     bcm_field_HiGigForwardingType_t *type)
  71978 {
  71979     return BCM_E_UNAVAIL;
  71980 }
  71981 
  71982 int bcm_esw_field_qualify_HiGigOffloadEngineDeferredFlags(
  71983     int unit, 
  71984     bcm_field_entry_t entry, 
  71985     uint8 data, 
  71986     uint8 mask) 
  71987 {
  71988     return BCM_E_UNAVAIL;
  71989 }
  71990 
  71991 int bcm_esw_field_qualify_HiGigOffloadEngineDeferredFlags_get(
  71992     int unit, 
  71993     bcm_field_entry_t entry, 
  71994     uint8 *data, 
  71995     uint8 *mask)
  71996 {
  71997     return BCM_E_UNAVAIL;
  71998 }
  71999 
  72000 int bcm_esw_field_qualify_HiGigOffloadEngineVxltStatus(
  72001     int unit, 
  72002     bcm_field_entry_t entry, 
  72003     uint8 data, 
  72004     uint8 mask) 
  72005 {
  72006     return BCM_E_UNAVAIL;
  72007 }
  72008 
  72009 int bcm_esw_field_qualify_HiGigOffloadEngineVxltStatus_get(
  72010     int unit, 
  72011     bcm_field_entry_t entry, 
  72012     uint8 *data, 
  72013     uint8 *mask)
  72014 {
  72015     return BCM_E_UNAVAIL;
  72016 }
  72017 
  72018 
  72019 
  72020 int 
  72021 bcm_esw_field_qualify_DevicePortBitmap(
  72022     int unit,
  72023     bcm_field_entry_t entry,
  72024     bcm_pbmp_t data,
  72025     bcm_pbmp_t mask)
  72026 {
  72027     return BCM_E_UNAVAIL;
  72028 }
  72029 
  72030 int
  72031 bcm_esw_field_qualify_DevicePortBitmap_get(
  72032     int unit,
  72033     bcm_field_entry_t entry,
  72034     bcm_pbmp_t *data,
  72035     bcm_pbmp_t *mask)
  72036 {
  72037     return BCM_E_UNAVAIL;
  72038 }
  72039 
  72040 int
  72041 bcm_esw_field_qualify_SystemPortBitmap(
  72042     int unit,
  72043     bcm_field_entry_t entry,
  72044     bcm_pbmp_t data,
  72045     bcm_pbmp_t mask)
  72046 {
  72047     return BCM_E_UNAVAIL;
  72048 }
  72049 
  72050 int
  72051 bcm_esw_field_qualify_SystemPortBitmap_get(
  72052     int unit,
  72053     bcm_field_entry_t entry,
  72054     bcm_pbmp_t *data,
  72055     bcm_pbmp_t *mask)
  72056 {
  72057     return BCM_E_UNAVAIL;
  72058 }
  72059 
  72060 int
  72061 bcm_esw_field_qualify_SourceGportBitmap(
  72062     int unit,
  72063     bcm_field_entry_t entry,
  72064     bcm_pbmp_t data,
  72065     bcm_pbmp_t mask)
  72066 {
  72067     return BCM_E_UNAVAIL;
  72068 }
  72069 
  72070 int
  72071 bcm_esw_field_qualify_SourceGportBitmap_get(
  72072     int unit,
  72073     bcm_field_entry_t entry,
  72074     bcm_pbmp_t *data,
  72075     bcm_pbmp_t *mask)
  72076 {
  72077     return BCM_E_UNAVAIL;
  72078 }
  72079 
  72080 /* Configure CopyToCpu action for the field entry. */
  72081 int bcm_esw_field_action_copytocpu_config_set(
  72082     int unit,
  72083     bcm_field_entry_t entry,
  72084     bcm_field_CopyToCpu_config_t CopyToCpu_config)
  72085 {
  72086     return BCM_E_UNAVAIL;
  72087 }
  72088 
  72089 /* Get CopyToCpu action from the field entry. */
  72090 int bcm_esw_field_action_copytocpu_config_get(
  72091     int unit,
  72092     bcm_field_entry_t entry,
  72093     bcm_field_CopyToCpu_config_t *CopyToCpu_config)
  72094 {
  72095     return BCM_E_UNAVAIL;
  72096 }
  72097 
  72098 /* Configure Redirect action for the field entry. */
  72099 int bcm_esw_field_action_redirect_config_set(
  72100     int unit,
  72101     bcm_field_entry_t entry,
  72102     bcm_field_redirect_config_t redirect_config)
  72103 {
  72104     return BCM_E_UNAVAIL;
  72105 }
  72106 
  72107 /* Get Redirect action from the field entry. */
  72108 int bcm_esw_field_action_redirect_config_get(
  72109     int unit,
  72110     bcm_field_entry_t entry,
  72111     bcm_field_redirect_config_t *redirect_config)
  72112 {
  72113     return BCM_E_UNAVAIL;
  72114 }
  72115 
  72116 int
  72117 bcm_esw_field_qualify_TosLower4Bits(
  72118         int unit,
  72119         bcm_field_entry_t entry,
  72120         uint8 data,
  72121         uint8 mask)
  72122 {
  72123     return BCM_E_UNAVAIL;
  72124 }
  72125 
  72126 int
  72127 bcm_esw_field_qualify_TosLower4Bits_get(
  72128         int unit,
  72129         bcm_field_entry_t entry,
  72130         uint8 *data,
  72131         uint8 *mask)
  72132 {
  72133     return BCM_E_UNAVAIL;
  72134 }
  72135 
  72136 int
  72137 bcm_esw_field_qualify_OamEgressClass2Vxlt(
  72138         int unit,
  72139         bcm_field_entry_t entry,
  72140         uint32 data,
  72141         uint32 mask)
  72142 {
  72143     return BCM_E_UNAVAIL;
  72144 }
  72145 
  72146 int
  72147 bcm_esw_field_qualify_OamEgressClass2Vxlt_get(
  72148         int unit,
  72149         bcm_field_entry_t entry,
  72150         uint32 *data,
  72151         uint32 *mask)
  72152 {
  72153     return BCM_E_UNAVAIL;
  72154 }
  72155 
  72156 int
  72157 bcm_esw_field_qualify_OamEgressVxltFirstHit(
  72158         int unit,
  72159         bcm_field_entry_t entry,
  72160         uint8 data,
  72161         uint8 mask)
  72162 {
  72163     return BCM_E_UNAVAIL;
  72164 }
  72165 
  72166 int
  72167 bcm_esw_field_qualify_OamEgressVxltFirstHit_get(
  72168         int unit,
  72169         bcm_field_entry_t entry,
  72170         uint8 *data,
  72171         uint8 *mask)
  72172 {
  72173     return BCM_E_UNAVAIL;
  72174 }
  72175 
  72176 int
  72177 bcm_esw_field_qualify_OamEgressVxltSecondHit(
  72178         int unit,
  72179         bcm_field_entry_t entry,
  72180         uint8 data,
  72181         uint8 mask)
  72182 {
  72183     return BCM_E_UNAVAIL;
  72184 }
  72185 
  72186 int
  72187 bcm_esw_field_qualify_OamEgressVxltSecondHit_get(
  72188         int unit,
  72189         bcm_field_entry_t entry,
  72190         uint8 *data,
  72191         uint8 *mask)
  72192 {
  72193     return BCM_E_UNAVAIL;
  72194 }
  72195 
  72196 int
  72197 bcm_esw_field_qualify_OamDownMEPLoopbackPacket(
  72198         int unit,
  72199         bcm_field_entry_t entry,
  72200         uint8 data,
  72201         uint8 mask)
  72202 {
  72203     return BCM_E_UNAVAIL;
  72204 }
  72205 
  72206 int
  72207 bcm_esw_field_qualify_OamDownMEPLoopbackPacket_get(
  72208         int unit,
  72209         bcm_field_entry_t entry,
  72210         uint8 *data,
  72211         uint8 *mask)
  72212 {
  72213     return BCM_E_UNAVAIL;
  72214 }
  72215 
  72216 int
  72217 bcm_esw_field_qualify_OamEgressPortUnicastDstMacHit(
  72218         int unit,
  72219         bcm_field_entry_t entry,
  72220         uint8 data,
  72221         uint8 mask)
  72222 {
  72223     return BCM_E_UNAVAIL;
  72224 }
  72225 
  72226 int
  72227 bcm_esw_field_qualify_OamEgressPortUnicastDstMacHit_get(
  72228         int unit,
  72229         bcm_field_entry_t entry,
  72230         uint8 *data,
  72231         uint8 *mask)
  72232 {
  72233     return BCM_E_UNAVAIL;
  72234 }
  72235 
  72236 int bcm_esw_field_qualify_IngressDropEthernetOamControl(
  72237     int unit,
  72238     bcm_field_entry_t entry,
  72239     bcm_field_oam_drop_mep_type_t mep_type)
  72240 {
  72241     return BCM_E_UNAVAIL;
  72242 }
  72243 
  72244 int bcm_esw_field_qualify_IngressDropEthernetOamControl_get(
  72245     int unit,
  72246     bcm_field_entry_t entry,
  72247     bcm_field_oam_drop_mep_type_t *mep_type)
  72248 {
  72249     return BCM_E_UNAVAIL;
  72250 }
  72251 
  72252 int bcm_esw_field_qualify_IngressDropEthernetOamData(
  72253     int unit,
  72254     bcm_field_entry_t entry,
  72255     bcm_field_oam_drop_mep_type_t mep_type)
  72256 {
  72257     return BCM_E_UNAVAIL;
  72258 }
  72259 
  72260 int bcm_esw_field_qualify_IngressDropEthernetOamData_get(
  72261     int unit,
  72262     bcm_field_entry_t entry,
  72263     bcm_field_oam_drop_mep_type_t *mep_type)
  72264 {
  72265     return BCM_E_UNAVAIL;
  72266 }
  72267 
  72268 int bcm_esw_field_qualify_IngressDropMplsOamControl(
  72269     int unit,
  72270     bcm_field_entry_t entry,
  72271     bcm_field_oam_drop_mep_type_t mep_type)
  72272 {
  72273     return BCM_E_UNAVAIL;
  72274 }
  72275 
  72276 int bcm_esw_field_qualify_IngressDropMplsOamControl_get(
  72277     int unit,
  72278     bcm_field_entry_t entry,
  72279     bcm_field_oam_drop_mep_type_t *mep_type)
  72280 {
  72281     return BCM_E_UNAVAIL;
  72282 }
  72283 
  72284 int bcm_esw_field_qualify_IngressDropMplsOamData(
  72285     int unit,
  72286     bcm_field_entry_t entry,
  72287     bcm_field_oam_drop_mep_type_t mep_type)
  72288 {
  72289     return BCM_E_UNAVAIL;
  72290 }
  72291 
  72292 int bcm_esw_field_qualify_IngressDropMplsOamData_get(
  72293     int unit,
  72294     bcm_field_entry_t entry,
  72295     bcm_field_oam_drop_mep_type_t *mep_type)
  72296 {
  72297     return BCM_E_UNAVAIL;
  72298 }
  72299 
  72300 /* 
  72301  * Set match criteria for EgressClassVxlan
  72302  *                qualifier.
  72303  */
  72304 int bcm_esw_field_qualify_EgressClassVxlan(
  72305     int unit, 
  72306     bcm_field_entry_t entry, 
  72307     uint16 data, 
  72308     uint16 mask)
  72309 {
  72310     return BCM_E_UNAVAIL;
  72311 }
  72312 
  72313 
  72314 /* 
  72315  * Get match criteria for EgressClassVxlan
  72316  *                qualifier.
  72317  */
  72318 int bcm_esw_field_qualify_EgressClassVxlan_get(
  72319     int unit, 
  72320     bcm_field_entry_t entry, 
  72321     uint16 *data, 
  72322     uint16 *mask)
  72323 {
  72324     return BCM_E_UNAVAIL;
  72325 }
  72326 
  72327 /*
  72328  * Set match criteria for bcmFieldQualifyOamEgressEtherType
  72329  *             qualifier in the field entry.
  72330  */
  72331 int bcm_esw_field_qualify_OamEgressEtherType(
  72332     int unit,
  72333     bcm_field_entry_t entry,
  72334     uint16 data)
  72335 {
  72336     return BCM_E_UNAVAIL;
  72337 }
  72338 
  72339 /*
  72340  * Get match criteria for bcmFieldQualifyOamEgressEtherType
  72341  *             qualifier from the field entry.
  72342  */
  72343 int bcm_esw_field_qualify_OamEgressEtherType_get(
  72344     int unit,
  72345     bcm_field_entry_t entry,
  72346     uint16 *data)
  72347 {
  72348     return BCM_E_UNAVAIL;
  72349 }
  72350 
  72351 /*
  72352  * Set match criteria for bcmFieldQualifyOamEgressMulticastMacHit
  72353  *             qualifier in the field entry.
  72354  */
  72355 int bcm_esw_field_qualify_OamEgressMulticastMacHit(
  72356     int unit,
  72357     bcm_field_entry_t entry,
  72358     uint8 data)
  72359 {
  72360     return BCM_E_UNAVAIL;
  72361 }
  72362 
  72363 /*
  72364  * Get match criteria for bcmFieldQualifyOamEgressMulticastMacHit
  72365  *             qualifier from the field entry.
  72366  */
  72367 int bcm_esw_field_qualify_OamEgressMulticastMacHit_get(
  72368     int unit,
  72369     bcm_field_entry_t entry,
  72370     uint8 *data)
  72371 {
  72372     return BCM_E_UNAVAIL;
  72373 }
  72374 
  72375 int 
  72376 bcm_esw_field_qualify_TrunkMemberSourceModuleId(
  72377     int unit, 
  72378     bcm_field_entry_t entry, 
  72379     int modid, 
  72380     int modid_mask)
  72381 {
  72382     return BCM_E_UNAVAIL;
  72383 }
  72384 
  72385 int 
  72386 bcm_esw_field_qualify_TrunkMemberSourceModuleId_get(
  72387     int unit, 
  72388     bcm_field_entry_t entry, 
  72389     int *modid, 
  72390     int *modid_mask)
  72391 {
  72392     return BCM_E_UNAVAIL;
  72393 }
  72394 
  72395 int
  72396 bcm_esw_field_qualify_OamEgressClassSrcMac(
  72397         int unit,
  72398         bcm_field_entry_t entry,
  72399         uint32 data,
  72400         uint32 mask)
  72401 {
  72402     return BCM_E_UNAVAIL;
  72403 }
  72404 
  72405 int
  72406 bcm_esw_field_qualify_OamEgressClassSrcMac_get(
  72407         int unit,
  72408         bcm_field_entry_t entry,
  72409         uint32 *data,
  72410         uint32 *mask)
  72411 {
  72412     return BCM_E_UNAVAIL;
  72413 }
  72414 
  72415 int
  72416 bcm_esw_field_qualify_MyStation2Hit(
  72417     int unit,
  72418     bcm_field_entry_t entry,
  72419     uint8 data,
  72420     uint8 mask)
  72421 {
  72422     return BCM_E_UNAVAIL;
  72423 }
  72424 
  72425 int
  72426 bcm_esw_field_qualify_MyStation2Hit_get(
  72427     int unit,
  72428     bcm_field_entry_t entry,
  72429     uint8 *data,
  72430     uint8 *mask)
  72431 {
  72432     return BCM_E_UNAVAIL;
  72433 }
  72434 
  72435 int
  72436 bcm_esw_field_qualify_VxlanClassValid(
  72437     int unit,
  72438     bcm_field_entry_t entry,
  72439     uint8 data,
  72440     uint8 mask)
  72441 {
  72442     return BCM_E_UNAVAIL;
  72443 }
  72444 
  72445 int
  72446 bcm_esw_field_qualify_VxlanClassValid_get(
  72447     int unit,
  72448     bcm_field_entry_t entry,
  72449     uint8 *data,
  72450     uint8 *mask)
  72451 {
  72452     return BCM_E_UNAVAIL;
  72453 }
  72454 
  72455 int
  72456 bcm_esw_field_qualify_VxlanPacket(
  72457     int unit,
  72458     bcm_field_entry_t entry,
  72459     uint8 data,
  72460     uint8 mask)
  72461 {
  72462     return BCM_E_UNAVAIL;
  72463 }
  72464 
  72465 int
  72466 bcm_esw_field_qualify_VxlanPacket_get(
  72467     int unit,
  72468     bcm_field_entry_t entry,
  72469     uint8 *data,
  72470     uint8 *mask)
  72471 {
  72472     return BCM_E_UNAVAIL;
  72473 }
  72474 
  72475 int
  72476 bcm_esw_field_qualify_VxlanVnidVlanTranslateHit(
  72477     int unit,
  72478     bcm_field_entry_t entry,
  72479     uint8 data,
  72480     uint8 mask)
  72481 {
  72482     return BCM_E_UNAVAIL;
  72483 }
  72484 
  72485 int
  72486 bcm_esw_field_qualify_VxlanVnidVlanTranslateHit_get(
  72487     int unit,
  72488     bcm_field_entry_t entry,
  72489     uint8 *data,
  72490     uint8 *mask)
  72491 {
  72492     return BCM_E_UNAVAIL;
  72493 }
  72494 
  72495 int
  72496 bcm_esw_field_qualify_VxlanPayloadVlanFormat(
  72497     int unit,
  72498     bcm_field_entry_t entry,
  72499     uint8 data,
  72500     uint8 mask)
  72501 {
  72502     return BCM_E_UNAVAIL;
  72503 }
  72504 
  72505 int
  72506 bcm_esw_field_qualify_VxlanPayloadVlanFormat_get(
  72507     int unit,
  72508     bcm_field_entry_t entry,
  72509     uint8 *data,
  72510     uint8 *mask)
  72511 {
  72512     return BCM_E_UNAVAIL;
  72513 }
  72514 
  72515 int
  72516 bcm_esw_field_qualify_TunnelPayloadDstMac(
  72517     int unit,
  72518     bcm_field_entry_t entry,
  72519     bcm_mac_t  data,
  72520     bcm_mac_t  mask)
  72521 {
  72522     return BCM_E_UNAVAIL;
  72523 }
  72524 
  72525 int
  72526 bcm_esw_field_qualify_TunnelPayloadDstMac_get(
  72527     int unit,
  72528     bcm_field_entry_t entry,
  72529     bcm_mac_t  *data,
  72530     bcm_mac_t  *mask)
  72531 {
  72532     return BCM_E_UNAVAIL;
  72533 }
  72534 
  72535 int
  72536 bcm_esw_field_qualify_TunnelPayloadSrcMac(
  72537     int unit,
  72538     bcm_field_entry_t entry,
  72539     bcm_mac_t  data,
  72540     bcm_mac_t  mask)
  72541 {
  72542     return BCM_E_UNAVAIL;
  72543 }
  72544 
  72545 int
  72546 bcm_esw_field_qualify_TunnelPayloadSrcMac_get(
  72547     int unit,
  72548     bcm_field_entry_t entry,
  72549     bcm_mac_t  *data,
  72550     bcm_mac_t  *mask)
  72551 {
  72552     return BCM_E_UNAVAIL;
  72553 }
  72554 
  72555 int
  72556 bcm_esw_field_qualify_TunnelPayloadEtherType(
  72557     int unit,
  72558     bcm_field_entry_t entry,
  72559     uint16 data,
  72560     uint16 mask)
  72561 {
  72562     return BCM_E_UNAVAIL;
  72563 }
  72564 
  72565 int
  72566 bcm_esw_field_qualify_TunnelPayloadEtherType_get(
  72567     int unit,
  72568     bcm_field_entry_t entry,
  72569     uint16 *data,
  72570     uint16 *mask)
  72571 {
  72572     return BCM_E_UNAVAIL;
  72573 }
  72574 
  72575 int
  72576 bcm_esw_field_qualify_TunnelPayloadOuterVlan(
  72577     int unit,
  72578     bcm_field_entry_t entry,
  72579     bcm_vlan_t data,
  72580     bcm_vlan_t mask)
  72581 {
  72582     return BCM_E_UNAVAIL;
  72583 }
  72584 
  72585 int
  72586 bcm_esw_field_qualify_TunnelPayloadOuterVlan_get(
  72587     int unit,
  72588     bcm_field_entry_t entry,
  72589     bcm_vlan_t *data,
  72590     bcm_vlan_t *mask)
  72591 {
  72592     return BCM_E_UNAVAIL;
  72593 }
  72594 
  72595 int
  72596 bcm_esw_field_qualify_TunnelPayloadOuterVlanId(
  72597     int unit,
  72598     bcm_field_entry_t entry,
  72599     bcm_vlan_t data,
  72600     bcm_vlan_t mask)
  72601 {
  72602     return BCM_E_UNAVAIL;
  72603 }
  72604 
  72605 int
  72606 bcm_esw_field_qualify_TunnelPayloadOuterVlanId_get(
  72607     int unit,
  72608     bcm_field_entry_t entry,
  72609     bcm_vlan_t *data,
  72610     bcm_vlan_t *mask)
  72611 {
  72612     return BCM_E_UNAVAIL;
  72613 }
  72614 
  72615 int
  72616 bcm_esw_field_qualify_TunnelPayloadOuterVlanPri(
  72617     int unit,
  72618     bcm_field_entry_t entry,
  72619     uint8 data,
  72620     uint8 mask)
  72621 {
  72622     return BCM_E_UNAVAIL;
  72623 }
  72624 
  72625 int
  72626 bcm_esw_field_qualify_TunnelPayloadOuterVlanPri_get(
  72627     int unit,
  72628     bcm_field_entry_t entry,
  72629     uint8 *data,
  72630     uint8 *mask)
  72631 {
  72632     return BCM_E_UNAVAIL;
  72633 }
  72634 
  72635 int
  72636 bcm_esw_field_qualify_TunnelPayloadOuterVlanCfi(
  72637     int unit,
  72638     bcm_field_entry_t entry,
  72639     uint8 data,
  72640     uint8 mask)
  72641 {
  72642     return BCM_E_UNAVAIL;
  72643 }
  72644 
  72645 int
  72646 bcm_esw_field_qualify_TunnelPayloadOuterVlanCfi_get(
  72647     int unit,
  72648     bcm_field_entry_t entry,
  72649     uint8 *data,
  72650     uint8 *mask)
  72651 {
  72652     return BCM_E_UNAVAIL;
  72653 }
  72654 
  72655 int
  72656 bcm_esw_field_qualify_TunnelPayloadSip(
  72657     int unit,
  72658     bcm_field_entry_t entry,
  72659     bcm_ip_t data,
  72660     bcm_ip_t mask)
  72661 {
  72662     return BCM_E_UNAVAIL;
  72663 }
  72664 
  72665 int
  72666 bcm_esw_field_qualify_TunnelPayloadDip(
  72667     int unit,
  72668     bcm_field_entry_t entry,
  72669     bcm_ip_t data,
  72670     bcm_ip_t mask)
  72671 {
  72672     return BCM_E_UNAVAIL;
  72673 }
  72674 
  72675 int
  72676 bcm_esw_field_qualify_TunnelPayloadSip_get(
  72677     int unit,
  72678     bcm_field_entry_t entry,
  72679     bcm_ip_t *data,
  72680     bcm_ip_t *mask)
  72681 {
  72682     return BCM_E_UNAVAIL;
  72683 }
  72684 
  72685 int
  72686 bcm_esw_field_qualify_TunnelPayloadDip_get(
  72687     int unit,
  72688     bcm_field_entry_t entry,
  72689     bcm_ip_t *data,
  72690     bcm_ip_t *mask)
  72691 {
  72692     return BCM_E_UNAVAIL;
  72693 }
  72694 
  72695 int
  72696 bcm_esw_field_qualify_TunnelPayloadSip6(
  72697     int unit,
  72698     bcm_field_entry_t entry,
  72699     bcm_ip6_t data,
  72700     bcm_ip6_t mask)
  72701 {
  72702     return BCM_E_UNAVAIL;
  72703 }
  72704 
  72705 int
  72706 bcm_esw_field_qualify_TunnelPayloadDip6(
  72707     int unit,
  72708     bcm_field_entry_t entry,
  72709     bcm_ip6_t data,
  72710     bcm_ip6_t mask)
  72711 {
  72712     return BCM_E_UNAVAIL;
  72713 }
  72714 
  72715 int
  72716 bcm_esw_field_qualify_TunnelPayloadSip6_get(
  72717     int unit,
  72718     bcm_field_entry_t entry,
  72719     bcm_ip6_t *data,
  72720     bcm_ip6_t *mask)
  72721 {
  72722     return BCM_E_UNAVAIL;
  72723 }
  72724 
  72725 int
  72726 bcm_esw_field_qualify_TunnelPayloadDip6_get(
  72727     int unit,
  72728     bcm_field_entry_t entry,
  72729     bcm_ip6_t *data,
  72730     bcm_ip6_t *mask)
  72731 {
  72732     return BCM_E_UNAVAIL;
  72733 }
  72734 
  72735 int
  72736 bcm_esw_field_qualify_TunnelPayloadIpProtocol(
  72737     int unit,
  72738     bcm_field_entry_t entry,
  72739     uint8 data,
  72740     uint8 mask)
  72741 {
  72742     return BCM_E_UNAVAIL;
  72743 }
  72744 
  72745 int
  72746 bcm_esw_field_qualify_TunnelPayloadIpProtocol_get(
  72747     int unit,
  72748     bcm_field_entry_t entry,
  72749     uint8 *data,
  72750     uint8 *mask)
  72751 {
  72752     return BCM_E_UNAVAIL;
  72753 }
  72754 
  72755 int
  72756 bcm_esw_field_qualify_TunnelPayloadL4SrcPort(
  72757     int unit,
  72758     bcm_field_entry_t entry,
  72759     bcm_l4_port_t data,
  72760     bcm_l4_port_t mask)
  72761 {
  72762     return BCM_E_UNAVAIL;
  72763 }
  72764 
  72765 int
  72766 bcm_esw_field_qualify_TunnelPayloadL4DstPort(
  72767     int unit,
  72768     bcm_field_entry_t entry,
  72769     bcm_l4_port_t data,
  72770     bcm_l4_port_t mask)
  72771 {
  72772     return BCM_E_UNAVAIL;
  72773 }
  72774 
  72775 int
  72776 bcm_esw_field_qualify_TunnelPayloadL4SrcPort_get(
  72777     int unit,
  72778     bcm_field_entry_t entry,
  72779     bcm_l4_port_t *data,
  72780     bcm_l4_port_t *mask)
  72781 {
  72782     return BCM_E_UNAVAIL;
  72783 }
  72784 
  72785 int
  72786 bcm_esw_field_qualify_TunnelPayloadL4DstPort_get(
  72787     int unit,
  72788     bcm_field_entry_t entry,
  72789     bcm_l4_port_t *data,
  72790     bcm_l4_port_t *mask)
  72791 {
  72792     return BCM_E_UNAVAIL;
  72793 }
  72794 
  72795 int
  72796 bcm_esw_field_group_ports_add(
  72797     int unit,
  72798     bcm_field_group_t group,
  72799     bcm_pbmp_t pbmp)
  72800 {
  72801     return BCM_E_UNAVAIL;
  72802 }
  72803 
  72804 int
  72805 bcm_esw_field_group_ports_remove(
  72806     int unit,
  72807     bcm_field_group_t group,
  72808     bcm_pbmp_t pbmp)
  72809 {
  72810     return BCM_E_UNAVAIL;
  72811 }
  72812 
  72813 int bcm_esw_field_group_config_validate(
  72814                           int unit,
  72815                           bcm_field_group_config_t *group_config,
  72816                           bcm_field_group_mode_t *group_mode) {
  72817     return BCM_E_UNAVAIL;
  72818 }
  72819 
  72820 int
  72821 bcm_esw_field_group_ports_get(
  72822     int unit,
  72823     bcm_field_group_t group,
  72824     bcm_pbmp_t *pbmp)
  72825 {
  72826     return BCM_E_UNAVAIL;
  72827 }
  72828 
  72829 /* 
  72830  * Set match criteria for EgressClassTunnel
  72831  *                qualifier.
  72832  */
  72833 int bcm_esw_field_qualify_EgressClassTunnel(
  72834     int unit, 
  72835     bcm_field_entry_t entry, 
  72836     uint16 data, 
  72837     uint16 mask)
  72838 {
  72839     return BCM_E_UNAVAIL;
  72840 }
  72841 
  72842 /* 
  72843  * Get match criteria for EgressClassTunnel
  72844  *                qualifier.
  72845  */
  72846 int bcm_esw_field_qualify_EgressClassTunnel_get(
  72847     int unit, 
  72848     bcm_field_entry_t entry, 
  72849     uint16 *data, 
  72850     uint16 *mask)
  72851 {
  72852     return BCM_E_UNAVAIL;
  72853 }
  72854 /* 
  72855  * Set match criteria for EgressClassL3InterfaceTunnel
  72856  *                qualifier.
  72857  */
  72858 int bcm_esw_field_qualify_EgressClassL3InterfaceTunnel(
  72859     int unit, 
  72860     bcm_field_entry_t entry, 
  72861     uint16 data, 
  72862     uint16 mask)
  72863 {
  72864     return BCM_E_UNAVAIL;
  72865 }
  72866 
  72867 
  72868 /* 
  72869  * Get match criteria for EgressClassL3InterfaceTunnel
  72870  *                qualifier.
  72871  */
  72872 int bcm_esw_field_qualify_EgressClassL3InterfaceTunnel_get(
  72873     int unit, 
  72874     bcm_field_entry_t entry, 
  72875     uint16 *data, 
  72876     uint16 *mask)
  72877 
  72878 int bcm_esw_field_group_config_validate(
  72879                           int unit,
  72880                           bcm_field_group_config_t *group_config,
  72881                           bcm_field_group_mode_t *group_mode) {
  72882     return BCM_E_UNAVAIL;
  72883 }
  72884 
  72885 bcm_error_t
  72886 bcm_esw_field_class_map_set(
  72887         int unit, 
  72888         bcm_field_stage_t stage,
  72889         bcm_field_qualify_t qual, 
  72890         uint32 num_entries,
  72891         uint32 *orig_values_array,
  72892         uint32 *map_values_array)
  72893 {
  72894     return BCM_E_UNAVAIL;
  72895 }
  72896 
  72897 /* Add VLAN actions to a field entry. */
  72898 int bcm_esw_field_action_vlan_actions_add(
  72899     int unit,
  72900     bcm_field_entry_t entry,
  72901     bcm_field_action_t action,
  72902     bcm_vlan_action_set_t *vlan_action_set)
  72903 {
  72904     return BCM_E_UNAVAIL;
  72905 }
  72906 
  72907 /* Retrieve VLAN actions configured to a field entry. */
  72908 int bcm_esw_field_action_vlan_actions_get(
  72909     int unit,
  72910     bcm_field_entry_t entry,
  72911     bcm_field_action_t action,
  72912     bcm_vlan_action_set_t *vlan_action_set)
  72913 {
  72914     return BCM_E_UNAVAIL;
  72915 }
  72916 
  72917 bcm_error_t
  72918 bcm_esw_field_class_map_get(
  72919         int unit, 
  72920         bcm_field_stage_t stage,
  72921         bcm_field_qualify_t qual, 
  72922         uint32 num_entries,
  72923         uint32 *orig_values_array,
  72924         uint32 *map_values_array)
  72925 {
  72926     return BCM_E_UNAVAIL;
  72927 }
  72928 
  72929 int
  72930 bcm_esw_field_qualify_PreemptablePacket(
  72931     int unit,
  72932     bcm_field_entry_t entry,
  72933     uint8 data,
  72934     uint8 mask)
  72935 {
  72936     return BCM_E_UNAVAIL;
  72937 }
  72938 
  72939 int
  72940 bcm_esw_field_qualify_PreemptablePacket_get(
  72941     int unit,
  72942     bcm_field_entry_t entry,
  72943     uint8 *data,
  72944     uint8 *mask)
  72945 {
  72946     return BCM_E_UNAVAIL;
  72947 }
  72948 
  72949 int
  72950 bcm_esw_field_qualify_RoceBthOpcode(
  72951     int unit,
  72952     bcm_field_entry_t entry,
  72953     uint8 data,
  72954     uint8 mask)
  72955 {
  72956     return BCM_E_UNAVAIL;
  72957 }
  72958 int
  72959 bcm_esw_field_qualify_RoceBthOpcode_get(
  72960     int unit,
  72961     bcm_field_entry_t entry,
  72962     uint8 data,
  72963     uint8 mask)
  72964 {
  72965     return BCM_E_UNAVAIL;
  72966 }
  72967 int
  72968 bcm_esw_field_qualify_RoceBthPartitionKey(
  72969     int unit,
  72970     bcm_field_entry_t entry,
  72971     uint16 data,
  72972     uint16 mask)
  72973 {
  72974     return BCM_E_UNAVAIL;
  72975 }
  72976 int
  72977 bcm_esw_field_qualify_RoceBthPartitionKey_get(
  72978     int unit,
  72979     bcm_field_entry_t entry,
  72980     uint16 data,
  72981     uint16 mask)
  72982 {
  72983     return BCM_E_UNAVAIL;
  72984 }
  72985 int
  72986 bcm_esw_field_qualify_RoceBthDstQueuePair(
  72987     int unit,
  72988     bcm_field_entry_t entry,
  72989     uint32 data,
  72990     uint32 mask)
  72991 {
  72992     return BCM_E_UNAVAIL;
  72993 }
  72994 int
  72995 bcm_esw_field_qualify_RoceBthDstQueuePair_get(
  72996     int unit,
  72997     bcm_field_entry_t entry,
  72998     uint32 data,
  72999     uint32 mask)
  73000 {
  73001     return BCM_E_UNAVAIL;
  73002 }
  73003 int
  73004 bcm_esw_field_qualify_RoceBthFlags(
  73005     int unit,
  73006     bcm_field_entry_t entry,
  73007     uint8 data,
  73008     uint8 mask)
  73009 {
  73010     return BCM_E_UNAVAIL;
  73011 }
  73012 int
  73013 bcm_esw_field_qualify_RoceBthFlags_get(
  73014     int unit,
  73015     bcm_field_entry_t entry,
  73016     uint8 data,
  73017     uint8 mask)
  73018 {
  73019     return BCM_E_UNAVAIL;
  73020 }
  73021 int
  73022 bcm_esw_field_qualify_RoceVer1Pkt(
  73023     int unit,
  73024     bcm_field_entry_t entry,
  73025     uint8 data,
  73026     uint8 mask)
  73027 {
  73028     return BCM_E_UNAVAIL;
  73029 }
  73030 int
  73031 bcm_esw_field_qualify_RoceVer1Pkt_get(
  73032     int unit,
  73033     bcm_field_entry_t entry,
  73034     uint8 data,
  73035     uint8 mask)
  73036 {
  73037     return BCM_E_UNAVAIL;
  73038 }
  73039 int
  73040 bcm_esw_field_qualify_RoceVer2Pkt(
  73041     int unit,
  73042     bcm_field_entry_t entry,
  73043     uint8 data,
  73044     uint8 mask)
  73045 {
  73046     return BCM_E_UNAVAIL;
  73047 }
  73048 int
  73049 bcm_esw_field_qualify_RoceVer2Pkt_get(
  73050     int unit,
  73051     bcm_field_entry_t entry,
  73052     uint8 data,
  73053     uint8 mask)
  73054 {
  73055     return BCM_E_UNAVAIL;
  73056 }
  73057 
  73058 int bcm_esw_field_group_config_validate(
  73059                           int unit,
  73060                           bcm_field_group_config_t *group_config,
  73061                           bcm_field_group_mode_t *group_mode) {
  73062     return BCM_E_UNAVAIL;
  73063 }
  73064 
  73065 bcm_error_t
  73066 bcm_esw_field_class_map_set(
  73067         int unit, 
  73068         bcm_field_stage_t stage,
  73069         bcm_field_qualify_t qual, 
  73070         uint32 num_entries,
  73071         uint32 *orig_values_array,
  73072         uint32 *map_values_array)
  73073 {
  73074     return BCM_E_UNAVAIL;
  73075 }
  73076 
  73077 
  73078 bcm_error_t
  73079 bcm_esw_field_class_map_get(
  73080         int unit, 
  73081         bcm_field_stage_t stage,
  73082         bcm_field_qualify_t qual, 
  73083         uint32 num_entries,
  73084         uint32 *orig_values_array,
  73085         uint32 *map_values_array)
  73086 {
  73087     return BCM_E_UNAVAIL;
  73088 }
  73089 int
  73090 bcm_esw_field_qualify_MacSecTagPresent(
  73091                int unit,
  73092                bcm_field_entry_t entry_id,
  73093                uint8 data,
  73094                uint8 mask)
  73095 {
  73096     return BCM_E_UNAVAIL;
  73097 }
  73098 
  73099 
  73100 int
  73101 bcm_esw_field_qualify_MacSecTag(
  73102                int unit,
  73103                bcm_field_entry_t entry_id,
  73104                uint8 data,
  73105                uint8 mask)
  73106 {
  73107     return BCM_E_UNAVAIL;
  73108 }
  73109 
  73110 
  73111 
  73112 int
  73113 bcm_esw_field_qualify_MacSecDstMacRangeHit_get(
  73114                int unit,
  73115                bcm_field_entry_t entry_id,
  73116                uint8 *data,
  73117                uint8 *mask)
  73118 {
  73119     return BCM_E_UNAVAIL;
  73120 }
  73121 
  73122 int
  73123 bcm_esw_field_macsec_DstMacRange_set(
  73124                int unit,
  73125                bcm_mac_t lower_limit,
  73126                bcm_mac_t upper_limit)
  73127 {
  73128     return BCM_E_UNAVAIL;
  73129 }
  73130 
  73131 int
  73132 bcm_esw_field_macsec_DstMacRange_get(
  73133                int unit,
  73134                bcm_mac_t *lower_limit,
  73135                bcm_mac_t *upper_limit)
  73136 {
  73137     return BCM_E_UNAVAIL;
  73138 }
  73139 
  73140 int
  73141 bcm_esw_field_qualify_FromMacSecPort(
  73142                int unit,
  73143                bcm_field_entry_t entry_id,
  73144                uint8 data,
  73145                uint8 mask)
  73146 {
  73147     return BCM_E_UNAVAIL;
  73148 }
  73149 
  73150 int
  73151 bcm_esw_field_qualify_FromMacSecPort_get(
  73152                int unit,
  73153                bcm_field_entry_t entry_id,
  73154                uint8 *data,
  73155                uint8 *mask)
  73156 {
  73157     return BCM_E_UNAVAIL;
  73158 }
  73159 
  73160 int
  73161 bcm_esw_field_qualify_MacSecFlow(
  73162                int unit,
  73163                bcm_field_entry_t entry_id,
  73164                uint8 data,
  73165                uint8 mask)
  73166 {
  73167     return BCM_E_UNAVAIL;
  73168 }
  73169 
  73170 int
  73171 bcm_esw_field_qualify_MacSecFlow_get(
  73172                int unit,
  73173                bcm_field_entry_t entry_id,
  73174                uint8 *data,
  73175                uint8 *mask)
  73176 {
  73177     return BCM_E_UNAVAIL;
  73178 }
  73179 int
  73180 bcm_esw_field_qualify_SrcPortSRType(int unit,
  73181                                     bcm_field_entry_t entry,
  73182                                     bcm_field_port_sr_type_t type)
  73183 {
  73184     return BCM_E_UNAVAIL;
  73185 }
  73186 int
  73187 bcm_esw_field_qualify_SrcPortSRType_get(int unit,
  73188                                         bcm_field_entry_t entry,
  73189                                         bcm_field_port_sr_type_t *type)
  73190 {
  73191     return BCM_E_UNAVAIL;
  73192 }
  73193 int
  73194 bcm_esw_field_qualify_DstPortSRType(int unit,
  73195                                     bcm_field_entry_t entry,
  73196                                     bcm_field_port_sr_type_t type)
  73197 {
  73198     return BCM_E_UNAVAIL;
  73199 }
  73200 int
  73201 bcm_esw_field_qualify_DstPortSRType_get(int unit,
  73202                                         bcm_field_entry_t entry,
  73203                                         bcm_field_port_sr_type_t *type)
  73204 {
  73205     return BCM_E_UNAVAIL;
  73206 }
  73207 int
  73208 bcm_esw_field_qualify_SrcPortSRRoleInterlink(int unit,
  73209                                              bcm_field_entry_t entry,
  73210                                              uint8 data)
  73211 {
  73212     return BCM_E_UNAVAIL;
  73213 }
  73214 int
  73215 bcm_esw_field_qualify_SrcPortSRRoleInterlink_get(int unit,
  73216                                                  bcm_field_entry_t entry,
  73217                                                  uint8 *data)
  73218 {
  73219     return BCM_E_UNAVAIL;
  73220 }
  73221 int
  73222 bcm_esw_field_qualify_DstPortSRRoleInterlink(int unit,
  73223                                              bcm_field_entry_t entry,
  73224                                              uint8 data)
  73225 {
  73226     return BCM_E_UNAVAIL;
  73227 }
  73228 int
  73229 bcm_esw_field_qualify_DstPortSRRoleInterlink_get(int unit,
  73230                                                  bcm_field_entry_t entry,
  73231                                                  uint8 *data)
  73232 {
  73233     return BCM_E_UNAVAIL;
  73234 }
  73235 int
  73236 bcm_esw_field_qualify_SrcPortSRMode(int unit,
  73237                                     bcm_field_entry_t entry,
  73238                                     bcm_field_sr_port_mode_t type,
  73239                                     uint8 mask)
  73240 {
  73241     return BCM_E_UNAVAIL;
  73242 }
  73243 int
  73244 bcm_esw_field_qualify_SrcPortSRMode_get(int unit,
  73245                                         bcm_field_entry_t entry,
  73246                                         bcm_field_sr_port_mode_t *type,
  73247                                         uint8 *mask)
  73248 {
  73249     return BCM_E_UNAVAIL;
  73250 }
  73251 int
  73252 bcm_esw_field_qualify_DstPortSRMode(int unit,
  73253                                     bcm_field_entry_t entry,
  73254                                     bcm_field_sr_port_mode_t type,
  73255                                     uint8 mask)
  73256 {
  73257     return BCM_E_UNAVAIL;
  73258 }
  73259 int
  73260 bcm_esw_field_qualify_DstPortSRMode_get(int unit,
  73261                                         bcm_field_entry_t entry,
  73262                                         bcm_field_sr_port_mode_t *type,
  73263                                         uint8 *mask)
  73264 {
  73265     return BCM_E_UNAVAIL;
  73266 }
  73267 int
  73268 bcm_esw_field_qualify_SrcPortSRNetId(int unit,
  73269                                      bcm_field_entry_t entry,
  73270                                      uint8 net_id, uint8 mask)
  73271 {
  73272     return BCM_E_UNAVAIL;
  73273 }
  73274 int
  73275 bcm_esw_field_qualify_SrcPortSRNetId_get(int unit,
  73276                                          bcm_field_entry_t entry,
  73277                                          uint8 *net_id, uint8 *mask)
  73278 {
  73279     return BCM_E_UNAVAIL;
  73280 }
  73281 int
  73282 bcm_esw_field_qualify_DstPortSRNetId(int unit,
  73283                                      bcm_field_entry_t entry,
  73284                                      uint8 net_id, uint8 mask)
  73285 {
  73286     return BCM_E_UNAVAIL;
  73287 }
  73288 int
  73289 bcm_esw_field_qualify_DstPortSRNetId_get(int unit,
  73290                                          bcm_field_entry_t entry,
  73291                                          uint8 *net_id, uint8 *mask)
  73292 {
  73293     return BCM_E_UNAVAIL;
  73294 }
  73295 int
  73296 bcm_esw_field_qualify_SrcPortSRLanId(int unit,
  73297                                      bcm_field_entry_t entry,
  73298                                      uint8 net_id)
  73299 {
  73300     return BCM_E_UNAVAIL;
  73301 }
  73302 int
  73303 bcm_esw_field_qualify_SrcPortSRLanId_get(int unit,
  73304                                          bcm_field_entry_t entry,
  73305                                          uint8 *net_id)
  73306 {
  73307     return BCM_E_UNAVAIL;
  73308 }
  73309 int
  73310 bcm_esw_field_qualify_DstPortSRLanId(int unit,
  73311                                      bcm_field_entry_t entry,
  73312                                      uint8 net_id)
  73313 {
  73314     return BCM_E_UNAVAIL;
  73315 }
  73316 int
  73317 bcm_esw_field_qualify_DstPortSRLanId_get(int unit,
  73318                                          bcm_field_entry_t entry,
  73319                                          uint8 *net_id)
  73320 {
  73321     return BCM_E_UNAVAIL;
  73322 }
  73323 int
  73324 bcm_esw_field_qualify_SRTagType(int unit, bcm_field_entry_t entry,
  73325                                 bcm_field_sr_tag_type_t type)
  73326 {
  73327     return BCM_E_UNAVAIL;
  73328 }
  73329 int
  73330 bcm_esw_field_qualify_SRTagType_get(int unit,
  73331                                     bcm_field_entry_t entry,
  73332                                     bcm_field_sr_tag_type_t *type)
  73333 {
  73334     return BCM_E_UNAVAIL;
  73335 }
  73336 int
  73337 bcm_esw_field_qualify_SRLanId(int unit, bcm_field_entry_t entry,
  73338                               int lan_id)
  73339 {
  73340     return BCM_E_UNAVAIL;
  73341 }
  73342 int
  73343 bcm_esw_field_qualify_SRLanId_get(int unit, bcm_field_entry_t entry,
  73344                                   int *lan_id)
  73345 {
  73346     return BCM_E_UNAVAIL;
  73347 }
  73348 int
  73349 bcm_esw_field_qualify_SRNetId(int unit, bcm_field_entry_t entry,
  73350                               int net_id)
  73351 {
  73352     return BCM_E_UNAVAIL;
  73353 }
  73354 int
  73355 bcm_esw_field_qualify_SRNetId_get(int unit, bcm_field_entry_t entry,
  73356                                   int *net_id)
  73357 {
  73358     return BCM_E_UNAVAIL;
  73359 }
  73360 int
  73361 bcm_esw_field_qualify_VlanSREnable(int unit, bcm_field_entry_t entry,
  73362                                    uint8 data)
  73363 {
  73364     return BCM_E_UNAVAIL;
  73365 }
  73366 int
  73367 bcm_esw_field_qualify_VlanSREnable_get(int unit,
  73368                                        bcm_field_entry_t entry,
  73369                                        uint8 *data)
  73370 {
  73371     return BCM_E_UNAVAIL;
  73372 }
  73373 int
  73374 bcm_esw_field_qualify_VlanSRLanId(int unit, bcm_field_entry_t entry,
  73375                                   uint8 lan_id)
  73376 {
  73377     return BCM_E_UNAVAIL;
  73378 }
  73379 int
  73380 bcm_esw_field_qualify_VlanSRLanId_get(int unit,
  73381                                       bcm_field_entry_t entry,
  73382                                       uint8 *lan_id)
  73383 {
  73384     return BCM_E_UNAVAIL;
  73385 }
  73386 int
  73387 bcm_esw_field_qualify_SRFlowId(int unit, bcm_field_entry_t entry,
  73388                                uint32 data, uint32 mask)
  73389 {
  73390     return BCM_E_UNAVAIL;
  73391 }
  73392 int
  73393 bcm_esw_field_qualify_SRFlowId_get(int unit, bcm_field_entry_t entry,
  73394                                    uint32 *data, uint32 *mask)
  73395 {
  73396     return BCM_E_UNAVAIL;
  73397 }
  73398 int
  73399 bcm_esw_field_qualify_L2DestSRNodeType(int unit,
  73400                                        bcm_field_entry_t entry,
  73401                                        bcm_field_sr_node_type_t type)
  73402 {
  73403     return BCM_E_UNAVAIL;
  73404 }
  73405 int
  73406 bcm_esw_field_qualify_L2DestSRNodeType_get(int unit,
  73407                                            bcm_field_entry_t entry,
  73408                                            bcm_field_sr_node_type_t *type)
  73409 {
  73410     return BCM_E_UNAVAIL;
  73411 }
  73412 int
  73413 bcm_esw_field_qualify_SRNetIdMatched(int unit,
  73414                                      bcm_field_entry_t entry,
  73415                                      uint8 data)
  73416 {
  73417     return BCM_E_UNAVAIL;
  73418 }
  73419 int
  73420 bcm_esw_field_qualify_SRNetIdMatched_get(int unit,
  73421                                          bcm_field_entry_t entry,
  73422                                          uint8 *data)
  73423 {
  73424     return BCM_E_UNAVAIL;
  73425 }
  73426 int
  73427 bcm_esw_field_qualify_SRSrcNodeIsSan(int unit,
  73428                                      bcm_field_entry_t entry,
  73429                                      uint8 data)
  73430 {
  73431     return BCM_E_UNAVAIL;
  73432 }
  73433 int
  73434 bcm_esw_field_qualify_SRSrcNodeIsSan_get(int unit,
  73435                                          bcm_field_entry_t entry,
  73436                                          uint8 *data)
  73437 {
  73438     return BCM_E_UNAVAIL;
  73439 }
  73440 int
  73441 bcm_esw_field_qualify_SRSupervisionType(int unit,
  73442                                         bcm_field_entry_t entry,
  73443                                         bcm_field_sr_supervision_type_t type)
  73444 {
  73445     return BCM_E_UNAVAIL;
  73446 }
  73447 int
  73448 bcm_esw_field_qualify_SRSupervisionType_get(int unit,
  73449                                             bcm_field_entry_t entry,
  73450                                             bcm_field_sr_supervision_type_t *type)
  73451 {
  73452     return BCM_E_UNAVAIL;
  73453 }
  73454 int
  73455 bcm_esw_field_qualify_SRError(int unit, bcm_field_entry_t entry,
  73456                               uint32 data, uint32 mask)
  73457 {
  73458     return BCM_E_UNAVAIL;
  73459 }
  73460 int
  73461 bcm_esw_field_qualify_SRError_get(int unit, bcm_field_entry_t entry,
  73462                                   uint32 *data, uint32 *mask)
  73463 {
  73464     return BCM_E_UNAVAIL;
  73465 }
  73466 int
  73467 bcm_esw_field_qualify_L2SrcMulticastHit(int unit,
  73468                                         bcm_field_entry_t entry,
  73469                                         uint8 data, uint8 mask)
  73470 {
  73471     return BCM_E_UNAVAIL;
  73472 }
  73473 int
  73474 bcm_esw_field_qualify_L2SrcMulticastHit_get(int unit,
  73475                                             bcm_field_entry_t entry,
  73476                                             uint8 *data, uint8 *mask)
  73477 {
  73478     return BCM_E_UNAVAIL;
  73479 }
  73480 int
  73481 bcm_esw_field_qualify_L2DstMulticastHit(int unit,
  73482                                         bcm_field_entry_t entry,
  73483                                         uint8 data, uint8 mask)
  73484 {
  73485     return BCM_E_UNAVAIL;
  73486 }
  73487 int
  73488 bcm_esw_field_qualify_L2DstMulticastHit_get(int unit,
  73489                                             bcm_field_entry_t entry,
  73490                                             uint8 *data, uint8 *mask)
  73491 {
  73492     return BCM_E_UNAVAIL;
  73493 }
  73494 int
  73495 bcm_esw_field_qualify_SRDuplicate(int unit, bcm_field_entry_t entry,
  73496                                   uint8 data)
  73497 {
  73498     return BCM_E_UNAVAIL;
  73499 }
  73500 int
  73501 bcm_esw_field_qualify_SRDuplicate_get(int unit,
  73502                                       bcm_field_entry_t entry,
  73503                                       uint8 *data)
  73504 {
  73505     return BCM_E_UNAVAIL;
  73506 }
  73507 int
  73508 bcm_esw_field_qualify_TsnFlowId(int unit, bcm_field_entry_t entry,
  73509                                 uint32 data, uint32 mask)
  73510 {
  73511     return BCM_E_UNAVAIL;
  73512 }
  73513 int
  73514 bcm_esw_field_qualify_TsnFlowId_get(int unit,
  73515                                     bcm_field_entry_t entry,
  73516                                     uint32 *data, uint32 *mask)
  73517 {
  73518     return BCM_E_UNAVAIL;
  73519 }
  73520 int 
  73521 bcm_esw_field_qualify_CnTagPresent(
  73522     int unit, 
  73523     bcm_field_entry_t entry, 
  73524     uint8 data, 
  73525     uint8 mask)
  73526 {
  73527     return BCM_E_UNAVAIL;
  73528 }
  73529 
  73530 int 
  73531 bcm_esw_field_qualify_CnTagPresent_get(
  73532     int unit, 
  73533     bcm_field_entry_t entry, 
  73534     uint8 *data, 
  73535     uint8 *mask)
  73536 {
  73537     return BCM_E_UNAVAIL;
  73538 }
  73539 
  73540 int 
  73541 bcm_esw_field_qualify_FrontPanelPkt(
  73542     int unit, 
  73543     bcm_field_entry_t entry, 
  73544     uint8 data, 
  73545     uint8 mask)
  73546 {
  73547     return BCM_E_UNAVAIL;
  73548 }
  73549 
  73550 int 
  73551 bcm_esw_field_qualify_FrontPanelPkt_get(
  73552     int unit, 
  73553     bcm_field_entry_t entry, 
  73554     uint8 *data, 
  73555     uint8 *mask)
  73556 {
  73557     return BCM_E_UNAVAIL;
  73558 }
  73559 
  73560 int 
  73561 bcm_esw_field_qualify_HiGigProxyTunnelType(
  73562     int unit, 
  73563     bcm_field_entry_t entry, 
  73564     bcm_field_higig_proxy_tunnel_type_t type)
  73565 {
  73566     return BCM_E_UNAVAIL;
  73567 }
  73568 
  73569 int 
  73570 bcm_esw_field_qualify_HiGigProxyTunnelType_get(
  73571     int unit, 
  73572     bcm_field_entry_t entry, 
  73573     bcm_field_higig_proxy_tunnel_type_t *type)
  73574 {
  73575     return BCM_E_UNAVAIL;
  73576 }
  73577 
  73578 int 
  73579 bcm_esw_field_qualify_InterfaceClassL2Type(
  73580     int unit, 
  73581     bcm_field_entry_t entry, 
  73582     bcm_field_interface_class_l2_type_t type)
  73583 {
  73584     return BCM_E_UNAVAIL;
  73585 }
  73586 
  73587 int 
  73588 bcm_esw_field_qualify_InterfaceClassL2Type_get(
  73589     int unit, 
  73590     bcm_field_entry_t entry, 
  73591     bcm_field_interface_class_l2_type_t *type)
  73592 {
  73593     return BCM_E_UNAVAIL;
  73594 }
  73595 
  73596 int 
  73597 bcm_esw_field_qualify_IpChecksumOkPkt(
  73598     int unit, 
  73599     bcm_field_entry_t entry, 
  73600     uint8 data, 
  73601     uint8 mask)
  73602 {
  73603     return BCM_E_UNAVAIL;
  73604 }
  73605 
  73606 int 
  73607 bcm_esw_field_qualify_IpChecksumOkPkt_get(
  73608     int unit, 
  73609     bcm_field_entry_t entry, 
  73610     uint8 *data, 
  73611     uint8 *mask)
  73612 {
  73613     return BCM_E_UNAVAIL;
  73614 }
  73615 
  73616 int 
  73617 bcm_esw_field_qualify_IpFragPkt(
  73618     int unit, 
  73619     bcm_field_entry_t entry, 
  73620     uint8 data, 
  73621     uint8 mask)
  73622 {
  73623     return BCM_E_UNAVAIL;
  73624 }
  73625 
  73626 int 
  73627 bcm_esw_field_qualify_IpFragPkt_get(
  73628     int unit, 
  73629     bcm_field_entry_t entry, 
  73630     uint8 *data, 
  73631     uint8 *mask)
  73632 {
  73633     return BCM_E_UNAVAIL;
  73634 }
  73635 
  73636 int 
  73637 bcm_esw_field_qualify_IpInIpPkt(
  73638     int unit, 
  73639     bcm_field_entry_t entry, 
  73640     uint8 data, 
  73641     uint8 mask)
  73642 {
  73643     return BCM_E_UNAVAIL;
  73644 }
  73645 
  73646 int 
  73647 bcm_esw_field_qualify_IpInIpPkt_get(
  73648     int unit, 
  73649     bcm_field_entry_t entry, 
  73650     uint8 *data, 
  73651     uint8 *mask)
  73652 {
  73653     return BCM_E_UNAVAIL;
  73654 }
  73655 
  73656 bcm_error_t
  73657 bcm_esw_field_class_map_get(
  73658         int unit, 
  73659         bcm_field_stage_t stage,
  73660         bcm_field_qualify_t qual, 
  73661         uint32 num_entries,
  73662         uint32 *orig_values_array,
  73663         uint32 *map_values_array)
  73664 {
  73665     return BCM_E_UNAVAIL;
  73666 }
  73667 
  73668 int 
  73669 bcm_esw_field_qualify_IpTtlZeroPkt(
  73670     int unit, 
  73671     bcm_field_entry_t entry, 
  73672     uint8 data, 
  73673     uint8 mask)
  73674 {
  73675     return BCM_E_UNAVAIL;
  73676 }
  73677 
  73678 int
  73679 bcm_esw_field_qualify_FlowtrackerGroupId(
  73680                int unit,
  73681                bcm_field_entry_t entry_id,
  73682                int data,
  73683                int mask)
  73684 {
  73685     return BCM_E_UNAVAIL;
  73686 }
  73687 
  73688 int
  73689 bcm_esw_field_qualify_FlowtrackerGroupId_get(
  73690                int unit,
  73691                bcm_field_entry_t entry_id,
  73692                int *data,
  73693                int *mask)
  73694 {
  73695     return BCM_E_UNAVAIL;
  73696 }
  73697 
  73698 int
  73699 bcm_esw_field_qualify_FlowtrackerClassId(
  73700                int unit,
  73701                bcm_field_entry_t entry_id,
  73702                int data,
  73703                int mask)
  73704 {
  73705     return BCM_E_UNAVAIL;
  73706 }
  73707 
  73708 int
  73709 bcm_esw_field_qualify_FlowtrackerClassId_get(
  73710                int unit,
  73711                bcm_field_entry_t entry_id,
  73712                int *data,
  73713                int *mask)
  73714 {
  73715     return BCM_E_UNAVAIL;
  73716 }
  73717 
  73718 int
  73719 bcm_esw_field_qualify_FlowtrackerGroupValid(
  73720                int unit,
  73721                bcm_field_entry_t entry_id,
  73722                uint8 data,
  73723                uint8 mask)
  73724 {
  73725     return BCM_E_UNAVAIL;
  73726 }
  73727 
  73728 int
  73729 bcm_esw_field_qualify_FlowtrackerGroupValid_get(
  73730                int unit,
  73731                bcm_field_entry_t entry_id,
  73732                uint8 *data,
  73733                uint8 *mask)
  73734 {
  73735     return BCM_E_UNAVAIL;
  73736 }
  73737 
  73738 int
  73739 bcm_esw_field_qualify_FlowtrackerDisabled(
  73740                int unit,
  73741                bcm_field_entry_t entry_id,
  73742                uint8 data,
  73743                uint8 mask)
  73744 {
  73745     return BCM_E_UNAVAIL;
  73746 }
  73747 
  73748 int
  73749 bcm_esw_field_qualify_FlowtrackerDisabled_get(
  73750                int unit,
  73751                bcm_field_entry_t entry_id,
  73752                uint8 *data,
  73753                uint8 *mask)
  73754 {
  73755     return BCM_E_UNAVAIL;
  73756 }
  73757 
  73758 int
  73759 bcm_esw_field_qualify_FlowtrackerMeteringExceeded(
  73760                int unit,
  73761                bcm_field_entry_t entry_id,
  73762                uint8 data,
  73763                uint8 mask)
  73764 {
  73765     return BCM_E_UNAVAIL;
  73766 }
  73767 
  73768 int
  73769 bcm_esw_field_qualify_FlowtrackerMeteringExceeded_get(
  73770                int unit,
  73771                bcm_field_entry_t entry_id,
  73772                uint8 *data,
  73773                uint8 *mask)
  73774 {
  73775     return BCM_E_UNAVAIL;
  73776 }
  73777 
  73778 int
  73779 bcm_esw_field_qualify_FlowtrackerCollectorCopy(
  73780                int unit,
  73781                bcm_field_entry_t entry_id,
  73782                uint8 data,
  73783                uint8 mask)
  73784 {
  73785     return BCM_E_UNAVAIL;
  73786 }
  73787 
  73788 int
  73789 bcm_esw_field_qualify_FlowtrackerCollectorCopy_get(
  73790                int unit,
  73791                bcm_field_entry_t entry_id,
  73792                uint8 *data,
  73793                uint8 *mask)
  73794 {
  73795     return BCM_E_UNAVAIL;
  73796 }
  73797 
  73798 int
  73799 bcm_esw_field_qualify_FlowtrackerFlowTableFull(
  73800                int unit,
  73801                bcm_field_entry_t entry_id,
  73802                uint8 data,
  73803                uint8 mask)
  73804 {
  73805     return BCM_E_UNAVAIL;
  73806 }
  73807 
  73808 int
  73809 bcm_esw_field_qualify_FlowtrackerFlowTableFull_get(
  73810                int unit,
  73811                bcm_field_entry_t entry_id,
  73812                uint8 *data,
  73813                uint8 *mask)
  73814 {
  73815     return BCM_E_UNAVAIL;
  73816 }
  73817 
  73818 int
  73819 bcm_esw_field_qualify_FlowtrackerGroupFlowExceeded(
  73820                int unit,
  73821                bcm_field_entry_t entry_id,
  73822                uint8 data,
  73823                uint8 mask)
  73824 {
  73825     return BCM_E_UNAVAIL;
  73826 }
  73827 
  73828 int
  73829 bcm_esw_field_qualify_FlowtrackerGroupFlowExceeded_get(
  73830                int unit,
  73831                bcm_field_entry_t entry_id,
  73832                uint8 *data,
  73833                uint8 *mask)
  73834 {
  73835     return BCM_E_UNAVAIL;
  73836 }
  73837 
  73838 int
  73839 bcm_esw_field_qualify_FlowtrackerExportQueueFull(
  73840                int unit,
  73841                bcm_field_entry_t entry_id,
  73842                uint8 data,
  73843                uint8 mask)
  73844 {
  73845     return BCM_E_UNAVAIL;
  73846 }
  73847 
  73848 int
  73849 bcm_esw_field_qualify_FlowtrackerExportQueueFull_get(
  73850                int unit,
  73851                bcm_field_entry_t entry_id,
  73852                uint8 *data,
  73853                uint8 *mask)
  73854 {
  73855     return BCM_E_UNAVAIL;
  73856 }
  73857 
  73858 int
  73859 bcm_esw_field_qualify_MacSecTagPresent(
  73860                int unit,
  73861                bcm_field_entry_t entry_id,
  73862                uint8 data,
  73863                uint8 mask)
  73864 {
  73865     return BCM_E_UNAVAIL;
  73866 }
  73867 
  73868 int
  73869 bcm_esw_field_qualify_MacSecTagPresent_get(
  73870                int unit,
  73871                bcm_field_entry_t entry_id,
  73872                uint8 *data,
  73873                uint8 *mask)
  73874 {
  73875     return BCM_E_UNAVAIL;
  73876 }
  73877 
  73878 int
  73879 bcm_esw_field_qualify_MacSecTag(
  73880                int unit,
  73881                bcm_field_entry_t entry_id,
  73882                uint8 data,
  73883                uint8 mask)
  73884 {
  73885     return BCM_E_UNAVAIL;
  73886 }
  73887 
  73888 int
  73889 bcm_esw_field_qualify_MacSecTag_get(
  73890                int unit,
  73891                bcm_field_entry_t entry_id,
  73892                uint8 *data,
  73893                uint8 *mask)
  73894 {
  73895     return BCM_E_UNAVAIL;
  73896 }
  73897 
  73898 int
  73899 bcm_esw_field_qualify_MacSecDstMacRangeHit(
  73900                int unit,
  73901                bcm_field_entry_t entry_id,
  73902                uint8 data,
  73903                uint8 mask)
  73904 {
  73905     return BCM_E_UNAVAIL;
  73906 }
  73907 
  73908 int
  73909 bcm_esw_field_qualify_MacSecDstMacRangeHit_get(
  73910                int unit,
  73911                bcm_field_entry_t entry_id,
  73912                uint8 *data,
  73913                uint8 *mask)
  73914 {
  73915     return BCM_E_UNAVAIL;
  73916 }
  73917 
  73918 int
  73919 bcm_esw_field_macsec_DstMacRange_set(
  73920                int unit,
  73921                bcm_mac_t lower_limit,
  73922                bcm_mac_t upper_limit)
  73923 {
  73924     return BCM_E_UNAVAIL;
  73925 }
  73926 
  73927 int
  73928 bcm_esw_field_macsec_DstMacRange_get(
  73929                int unit,
  73930                bcm_mac_t *lower_limit,
  73931                bcm_mac_t *upper_limit)
  73932 {
  73933     return BCM_E_UNAVAIL;
  73934 }
  73935 
  73936 int
  73937 bcm_esw_field_qualify_FromMacSecPort(
  73938                int unit,
  73939                bcm_field_entry_t entry_id,
  73940                uint8 data,
  73941                uint8 mask)
  73942 {
  73943     return BCM_E_UNAVAIL;
  73944 }
  73945 
  73946 int
  73947 bcm_esw_field_qualify_FromMacSecPort_get(
  73948                int unit,
  73949                bcm_field_entry_t entry_id,
  73950                uint8 *data,
  73951                uint8 *mask)
  73952 {
  73953     return BCM_E_UNAVAIL;
  73954 }
  73955 
  73956 int
  73957 bcm_esw_field_qualify_MacSecFlow(
  73958                int unit,
  73959                bcm_field_entry_t entry_id,
  73960                uint8 data,
  73961                uint8 mask)
  73962 {
  73963     return BCM_E_UNAVAIL;
  73964 }
  73965 
  73966 int
  73967 bcm_esw_field_qualify_MacSecFlow_get(
  73968                int unit,
  73969                bcm_field_entry_t entry_id,
  73970                uint8 *data,
  73971                uint8 *mask)
  73972 {
  73973     return BCM_E_UNAVAIL;
  73974 }
  73975 
  73976 int
  73977 bcm_esw_field_qualify_SrcPortSRType(int unit,
  73978                                     bcm_field_entry_t entry,
  73979                                     bcm_field_port_sr_type_t type)
  73980 {
  73981     return BCM_E_UNAVAIL;
  73982 }
  73983 
  73984 int 
  73985 bcm_esw_field_qualify_IpTtlZeroPkt_get(
  73986     int unit, 
  73987     bcm_field_entry_t entry, 
  73988     uint8 *data, 
  73989     uint8 *mask)
  73990 {
  73991     return BCM_E_UNAVAIL;
  73992 }
  73993 
  73994 int 
  73995 bcm_esw_field_qualify_IpmcV4Pkt(
  73996     int unit, 
  73997     bcm_field_entry_t entry, 
  73998     uint8 data, 
  73999     uint8 mask)
  74000 {
  74001     return BCM_E_UNAVAIL;
  74002 }
  74003 
  74004 int 
  74005 bcm_esw_field_qualify_IpmcV4Pkt_get(
  74006     int unit, 
  74007     bcm_field_entry_t entry, 
  74008     uint8 *data, 
  74009     uint8 *mask)
  74010 {
  74011     return BCM_E_UNAVAIL;
  74012 }
  74013 
  74014 int 
  74015 bcm_esw_field_qualify_IpmcV6Pkt(
  74016     int unit, 
  74017     bcm_field_entry_t entry, 
  74018     uint8 data, 
  74019     uint8 mask)
  74020 {
  74021     return BCM_E_UNAVAIL;
  74022 }
  74023 
  74024 int 
  74025 bcm_esw_field_qualify_IpmcV6Pkt_get(
  74026     int unit, 
  74027     bcm_field_entry_t entry, 
  74028     uint8 *data, 
  74029     uint8 *mask)
  74030 {
  74031     return BCM_E_UNAVAIL;
  74032 }
  74033 
  74034 int 
  74035 bcm_esw_field_qualify_Ipv4OptionHdrType(
  74036     int unit, 
  74037     bcm_field_entry_t entry, 
  74038     bcm_field_ip_option_hdr_type_t type)
  74039 {
  74040     return BCM_E_UNAVAIL;
  74041 }
  74042 
  74043 int 
  74044 bcm_esw_field_qualify_Ipv4OptionHdrType_get(
  74045     int unit, 
  74046     bcm_field_entry_t entry, 
  74047     bcm_field_ip_option_hdr_type_t *type)
  74048 {
  74049     return BCM_E_UNAVAIL;
  74050 }
  74051 
  74052 int 
  74053 bcm_esw_field_qualify_Ipv6ExtensionHdrType(
  74054     int unit, 
  74055     bcm_field_entry_t entry, 
  74056     bcm_field_ip_option_hdr_type_t type)
  74057 {
  74058     return BCM_E_UNAVAIL;
  74059 }
  74060 
  74061 int 
  74062 bcm_esw_field_qualify_Ipv6ExtensionHdrType_get(
  74063     int unit, 
  74064     bcm_field_entry_t entry, 
  74065     bcm_field_ip_option_hdr_type_t *type)
  74066 {
  74067     return BCM_E_UNAVAIL;
  74068 }
  74069 
  74070 int 
  74071 bcm_esw_field_qualify_L2PayloadTypePkt(
  74072     int unit, 
  74073     bcm_field_entry_t entry, 
  74074     uint8 data, 
  74075     uint8 mask)
  74076 {
  74077     return BCM_E_UNAVAIL;
  74078 }
  74079 
  74080 int 
  74081 bcm_esw_field_qualify_L2PayloadTypePkt_get(
  74082     int unit, 
  74083     bcm_field_entry_t entry, 
  74084     uint8 *data, 
  74085     uint8 *mask)
  74086 {
  74087     return BCM_E_UNAVAIL;
  74088 }
  74089 
  74090 int 
  74091 bcm_esw_field_qualify_L2PktType(
  74092     int unit, 
  74093     bcm_field_entry_t entry, 
  74094     bcm_field_l2_pkt_type_t type)
  74095 {
  74096     return BCM_E_UNAVAIL;
  74097 }
  74098 
  74099 int 
  74100 bcm_esw_field_qualify_L2PktType_get(
  74101     int unit, 
  74102     bcm_field_entry_t entry, 
  74103     bcm_field_l2_pkt_type_t *type)
  74104 {
  74105     return BCM_E_UNAVAIL;
  74106 }
  74107 
  74108 int 
  74109 bcm_esw_field_qualify_MplsCwPresent(
  74110     int unit, 
  74111     bcm_field_entry_t entry, 
  74112     uint8 data, 
  74113     uint8 mask)
  74114 {
  74115     return BCM_E_UNAVAIL;
  74116 }
  74117 
  74118 int 
  74119 bcm_esw_field_qualify_MplsCwPresent_get(
  74120     int unit, 
  74121     bcm_field_entry_t entry, 
  74122     uint8 *data, 
  74123     uint8 *mask)
  74124 {
  74125     return BCM_E_UNAVAIL;
  74126 }
  74127 
  74128 int 
  74129 bcm_esw_field_qualify_MplsMcastEthertypePresent(
  74130     int unit, 
  74131     bcm_field_entry_t entry, 
  74132     uint8 data, 
  74133     uint8 mask)
  74134 {
  74135     return BCM_E_UNAVAIL;
  74136 }
  74137 
  74138 int 
  74139 bcm_esw_field_qualify_MplsMcastEthertypePresent_get(
  74140     int unit, 
  74141     bcm_field_entry_t entry, 
  74142     uint8 *data, 
  74143     uint8 *mask)
  74144 {
  74145     return BCM_E_UNAVAIL;
  74146 }
  74147 
  74148 
  74149 int 
  74150 bcm_esw_field_qualify_NetworkTagMulticastPkt(
  74151     int unit, 
  74152     bcm_field_entry_t entry, 
  74153     uint8 data, 
  74154     uint8 mask)
  74155 {
  74156     return BCM_E_UNAVAIL;
  74157 }
  74158 
  74159 int 
  74160 bcm_esw_field_qualify_NetworkTagMulticastPkt_get(
  74161     int unit, 
  74162     bcm_field_entry_t entry, 
  74163     uint8 *data, 
  74164     uint8 *mask)
  74165 {
  74166     return BCM_E_UNAVAIL;
  74167 }
  74168 
  74169 int
  74170 bcm_esw_field_qualify_SrcPortSRLanId(int unit,
  74171                                      bcm_field_entry_t entry,
  74172                                      uint8 lan_id)
  74173 {
  74174     return BCM_E_UNAVAIL;
  74175 }
  74176 int
  74177 bcm_esw_field_qualify_SrcPortSRLanId_get(int unit,
  74178                                          bcm_field_entry_t entry,
  74179                                          uint8 *lan_id)
  74180 {
  74181     return BCM_E_UNAVAIL;
  74182 }
  74183 int
  74184 bcm_esw_field_qualify_DstPortSRLanId(int unit,
  74185                                      bcm_field_entry_t entry,
  74186                                      uint8 lan_id)
  74187 {
  74188     return BCM_E_UNAVAIL;
  74189 }
  74190 int
  74191 bcm_esw_field_qualify_DstPortSRLanId_get(int unit,
  74192                                          bcm_field_entry_t entry,
  74193                                          uint8 *lan_id)
  74194 {
  74195     return BCM_E_UNAVAIL;
  74196 }
  74197 
  74198 int 
  74199 bcm_esw_field_qualify_NetworkTagType(
  74200     int unit, 
  74201     bcm_field_entry_t entry, 
  74202     bcm_field_network_tag_type_t type)
  74203 {
  74204     return BCM_E_UNAVAIL;
  74205 }
  74206 
  74207 int 
  74208 bcm_esw_field_qualify_NetworkTagType_get(
  74209     int unit, 
  74210     bcm_field_entry_t entry, 
  74211     bcm_field_network_tag_type_t *type)
  74212 {
  74213     return BCM_E_UNAVAIL;
  74214 }
  74215 
  74216 
  74217 int 
  74218 bcm_esw_field_qualify_OuterPriTaggedPkt(
  74219     int unit, 
  74220     bcm_field_entry_t entry, 
  74221     uint8 data, 
  74222     uint8 mask)
  74223 {
  74224     return BCM_E_UNAVAIL;
  74225 }
  74226 
  74227 int 
  74228 bcm_esw_field_qualify_OuterPriTaggedPkt_get(
  74229     int unit, 
  74230     bcm_field_entry_t entry, 
  74231     uint8 *data, 
  74232     uint8 *mask)
  74233 {
  74234     return BCM_E_UNAVAIL;
  74235 }
  74236 
  74237 
  74238 int 
  74239 bcm_esw_field_qualify_OverlayCnTagPresent(
  74240     int unit, 
  74241     bcm_field_entry_t entry, 
  74242     uint8 data, 
  74243     uint8 mask)
  74244 {
  74245     return BCM_E_UNAVAIL;
  74246 }
  74247 
  74248 int 
  74249 bcm_esw_field_qualify_OverlayCnTagPresent_get(
  74250     int unit, 
  74251     bcm_field_entry_t entry, 
  74252     uint8 *data, 
  74253     uint8 *mask)
  74254 {
  74255     return BCM_E_UNAVAIL;
  74256 }
  74257 
  74258 int 
  74259 bcm_esw_field_qualify_OverlayIpv4OptionHdrType(
  74260     int unit, 
  74261     bcm_field_entry_t entry, 
  74262     bcm_field_ip_option_hdr_type_t type)
  74263 {
  74264     return BCM_E_UNAVAIL;
  74265 }
  74266 
  74267 int 
  74268 bcm_esw_field_qualify_OverlayIpv4OptionHdrType_get(
  74269     int unit, 
  74270     bcm_field_entry_t entry, 
  74271     bcm_field_ip_option_hdr_type_t *type)
  74272 {
  74273     return BCM_E_UNAVAIL;
  74274 }
  74275 
  74276 int 
  74277 bcm_esw_field_qualify_OverlayIpv6ExtensionHdrType(
  74278     int unit, 
  74279     bcm_field_entry_t entry, 
  74280     bcm_field_ip_option_hdr_type_t type)
  74281 {
  74282     return BCM_E_UNAVAIL;
  74283 }
  74284 
  74285 int 
  74286 bcm_esw_field_qualify_OverlayIpv6ExtensionHdrType_get(
  74287     int unit, 
  74288     bcm_field_entry_t entry, 
  74289     bcm_field_ip_option_hdr_type_t *type)
  74290 {
  74291     return BCM_E_UNAVAIL;
  74292 }
  74293 
  74294 int 
  74295 bcm_esw_field_qualify_OverlayL2PktType(
  74296     int unit, 
  74297     bcm_field_entry_t entry, 
  74298     bcm_field_l2_pkt_type_t type)
  74299 {
  74300     return BCM_E_UNAVAIL;
  74301 }
  74302 
  74303 int 
  74304 bcm_esw_field_qualify_OverlayL2PktType_get(
  74305     int unit, 
  74306     bcm_field_entry_t entry, 
  74307     bcm_field_l2_pkt_type_t *type)
  74308 {
  74309     return BCM_E_UNAVAIL;
  74310 }
  74311 
  74312 int 
  74313 bcm_esw_field_qualify_OverlayNetworkTagType(
  74314     int unit, 
  74315     bcm_field_entry_t entry, 
  74316     bcm_field_network_tag_type_t type)
  74317 {
  74318     return BCM_E_UNAVAIL;
  74319 }
  74320 
  74321 int 
  74322 bcm_esw_field_qualify_OverlayNetworkTagType_get(
  74323     int unit, 
  74324     bcm_field_entry_t entry, 
  74325     bcm_field_network_tag_type_t *type)
  74326 {
  74327     return BCM_E_UNAVAIL;
  74328 }
  74329 
  74330 int 
  74331 bcm_esw_field_qualify_OverlayPktType(
  74332     int unit, 
  74333     bcm_field_entry_t entry, 
  74334     bcm_field_pkt_type_t type)
  74335 {
  74336     return BCM_E_UNAVAIL;
  74337 }
  74338 
  74339 int 
  74340 bcm_esw_field_qualify_OverlayPktType_get(
  74341     int unit, 
  74342     bcm_field_entry_t entry, 
  74343     bcm_field_pkt_type_t *type)
  74344 {
  74345     return BCM_E_UNAVAIL;
  74346 }
  74347 
  74348 int 
  74349 bcm_esw_field_qualify_OverlaySubportTagPresent(
  74350     int unit, 
  74351     bcm_field_entry_t entry, 
  74352     uint8 data, 
  74353     uint8 mask)
  74354 {
  74355     return BCM_E_UNAVAIL;
  74356 }
  74357 
  74358 int 
  74359 bcm_esw_field_qualify_OverlaySubportTagPresent_get(
  74360     int unit, 
  74361     bcm_field_entry_t entry, 
  74362     uint8 *data, 
  74363     uint8 *mask)
  74364 {
  74365     return BCM_E_UNAVAIL;
  74366 }
  74367 
  74368 int 
  74369 bcm_esw_field_qualify_OverlayVlanFormat(
  74370     int unit, 
  74371     bcm_field_entry_t entry, 
  74372     uint8 data, 
  74373     uint8 mask)
  74374 {
  74375     return BCM_E_UNAVAIL;
  74376 }
  74377 
  74378 int 
  74379 bcm_esw_field_qualify_OverlayVlanFormat_get(
  74380     int unit, 
  74381     bcm_field_entry_t entry, 
  74382     uint8 *data, 
  74383     uint8 *mask)
  74384 {
  74385     return BCM_E_UNAVAIL;
  74386 }
  74387 
  74388 int 
  74389 bcm_esw_field_qualify_PimBidirDfStatus(
  74390     int unit, 
  74391     bcm_field_entry_t entry, 
  74392     uint8 data, 
  74393     uint8 mask)
  74394 {
  74395     return BCM_E_UNAVAIL;
  74396 }
  74397 
  74398 int 
  74399 bcm_esw_field_qualify_PimBidirDfStatus_get(
  74400     int unit, 
  74401     bcm_field_entry_t entry, 
  74402     uint8 *data, 
  74403     uint8 *mask)
  74404 {
  74405     return BCM_E_UNAVAIL;
  74406 }
  74407 
  74408 
  74409 int 
  74410 bcm_esw_field_qualify_PktType(
  74411     int unit, 
  74412     bcm_field_entry_t entry, 
  74413     bcm_field_pkt_type_t type)
  74414 {
  74415     return BCM_E_UNAVAIL;
  74416 }
  74417 
  74418 int 
  74419 bcm_esw_field_qualify_PktType_get(
  74420     int unit, 
  74421     bcm_field_entry_t entry, 
  74422     bcm_field_pkt_type_t *type)
  74423 {
  74424     return BCM_E_UNAVAIL;
  74425 }
  74426 
  74427 int 
  74428 bcm_esw_field_qualify_SubportTagPresent(
  74429     int unit, 
  74430     bcm_field_entry_t entry, 
  74431     uint8 data, 
  74432     uint8 mask)
  74433 {
  74434     return BCM_E_UNAVAIL;
  74435 }
  74436 
  74437 int 
  74438 bcm_esw_field_qualify_SubportTagPresent_get(
  74439     int unit, 
  74440     bcm_field_entry_t entry, 
  74441     uint8 *data, 
  74442     uint8 *mask)
  74443 {
  74444     return BCM_E_UNAVAIL;
  74445 }
  74446 
  74447 int 
  74448 bcm_esw_field_qualify_SysHdrType(
  74449     int unit, 
  74450     bcm_field_entry_t entry, 
  74451     bcm_field_sys_hdr_type_t type)
  74452 {
  74453     return BCM_E_UNAVAIL;
  74454 }
  74455 
  74456 int 
  74457 bcm_esw_field_qualify_SysHdrType_get(
  74458     int unit, 
  74459     bcm_field_entry_t entry, 
  74460     bcm_field_sys_hdr_type_t *type)
  74461 {
  74462     return BCM_E_UNAVAIL;
  74463 }
  74464 
  74465 int 
  74466 bcm_esw_field_qualify_IntPktFinalHop(
  74467     int unit, 
  74468     bcm_field_entry_t entry, 
  74469     uint8 data, 
  74470     uint8 mask)
  74471 {
  74472     return BCM_E_UNAVAIL;
  74473 }
  74474 
  74475 int 
  74476 bcm_esw_field_qualify_IntPktFinalHop_get(
  74477     int unit, 
  74478     bcm_field_entry_t entry, 
  74479     uint8 *data, 
  74480     uint8 *mask)
  74481 {
  74482     return BCM_E_UNAVAIL;
  74483 }
  74484 
  74485 int 
  74486 bcm_esw_field_qualify_IntPktType(
  74487     int unit, 
  74488     bcm_field_entry_t entry, 
  74489     bcm_field_int_pkt_type_t type)
  74490 {
  74491     return BCM_E_UNAVAIL;
  74492 }
  74493 
  74494 int 
  74495 bcm_esw_field_qualify_IntPktType_get(
  74496     int unit, 
  74497     bcm_field_entry_t entry, 
  74498     bcm_field_int_pkt_type_t *type)
  74499 {
  74500     return BCM_E_UNAVAIL;
  74501 }
  74502 
  74503 int 
  74504 bcm_esw_field_qualify_IntPktOverflowed(
  74505     int unit, 
  74506     bcm_field_entry_t entry, 
  74507     uint8 data, 
  74508     uint8 mask)
  74509 {
  74510     return BCM_E_UNAVAIL;
  74511 }
  74512 
  74513 int 
  74514 bcm_esw_field_qualify_IntPktOverflowed_get(
  74515     int unit, 
  74516     bcm_field_entry_t entry, 
  74517     uint8 *data, 
  74518     uint8 *mask)
  74519 {
  74520     return BCM_E_UNAVAIL;
  74521 }
  74522 int 
  74523 bcm_esw_field_qualify_IntPktLengthValid(
  74524     int unit, 
  74525     bcm_field_entry_t entry, 
  74526     uint8 data, 
  74527     uint8 mask)
  74528 {
  74529     return BCM_E_UNAVAIL;
  74530 }
  74531 
  74532 int 
  74533 bcm_esw_field_qualify_IntPktLengthValid_get(
  74534     int unit, 
  74535     bcm_field_entry_t entry, 
  74536     uint8 *data, 
  74537     uint8 *mask)
  74538 {
  74539     return BCM_E_UNAVAIL;
  74540 }
  74541 
  74542 int 
  74543 bcm_esw_field_qualify_IntPktVersionOne(
  74544     int unit, 
  74545     bcm_field_entry_t entry, 
  74546     uint8 data, 
  74547     uint8 mask)
  74548 {
  74549     return BCM_E_UNAVAIL;
  74550 }
  74551 
  74552 int 
  74553 bcm_esw_field_qualify_IntPktVersionOne_get(
  74554     int unit, 
  74555     bcm_field_entry_t entry, 
  74556     uint8 *data, 
  74557     uint8 *mask)
  74558 {
  74559     return BCM_E_UNAVAIL;
  74560 }
  74561 
  74562 int
  74563 bcm_esw_field_qualify_MplsTransit(
  74564     int unit,
  74565     bcm_field_entry_t entry,
  74566     uint8 data,
  74567     uint8 mask)
  74568 {
  74569     return BCM_E_UNAVAIL;
  74570 }
  74571 
  74572 int
  74573 bcm_esw_field_qualify_MplsTransit_get(
  74574     int unit,
  74575     bcm_field_entry_t entry,
  74576     uint8 *data,
  74577     uint8 *mask)
  74578 {
  74579     return BCM_E_UNAVAIL;
  74580 }
  74581 int
  74582 bcm_esw_field_qualify_NshServiceIndex(
  74583     int unit,
  74584     bcm_field_entry_t entry,
  74585     uint32 data,
  74586     uint32 mask)
  74587 {
  74588     return BCM_E_UNAVAIL;
  74589 }
  74590 
  74591 int
  74592 bcm_esw_field_qualify_NshServiceIndex_get(
  74593     int unit,
  74594     bcm_field_entry_t entry,
  74595     uint32 *data,
  74596     uint32 *mask)
  74597 {
  74598     return BCM_E_UNAVAIL;
  74599 }
  74600 
  74601 int
  74602 bcm_esw_field_qualify_NshServicePathId(
  74603     int unit,
  74604     bcm_field_entry_t entry,
  74605     uint32 data,
  74606     uint32 mask)
  74607 {
  74608     return BCM_E_UNAVAIL;
  74609 }
  74610 
  74611 int
  74612 bcm_esw_field_qualify_NshServicePathId_get(
  74613     int unit,
  74614     bcm_field_entry_t entry,
  74615     uint32 *data,
  74616     uint32 *mask)
  74617 {
  74618     return BCM_E_UNAVAIL;
  74619 }
  74620 int
  74621 bcm_esw_field_qualify_TunnelSubType(
  74622     int unit,
  74623     bcm_field_entry_t entry,
  74624     bcm_field_TunnelSubType_t type)
  74625 {
  74626     return BCM_E_UNAVAIL;
  74627 }
  74628 
  74629 int
  74630 bcm_esw_field_qualify_TunnelSubType_get(
  74631     int unit,
  74632     bcm_field_entry_t entry,
  74633     bcm_field_TunnelSubType_t *type)
  74634 {
  74635     return BCM_E_UNAVAIL;
  74636 }
  74637 
  74638 int
  74639 bcm_esw_field_qualify_BfdGoodPkt(
  74640     int unit,
  74641     bcm_field_entry_t entry,
  74642     uint8 data,
  74643     uint8 mask)
  74644 {
  74645     return BCM_E_UNAVAIL;
  74646 }
  74647 
  74648 int
  74649 bcm_esw_field_qualify_BfdGoodPkt_get(
  74650     int unit,
  74651     bcm_field_entry_t entry,
  74652     uint8 *data,
  74653     uint8 *mask)
  74654 {
  74655     return BCM_E_UNAVAIL;
  74656 }
  74657 
  74658 int
  74659 bcm_esw_field_qualify_TafGateId(int unit, bcm_field_entry_t entry,
  74660                                 uint32 data, uint32 mask)
  74661 {
  74662     return BCM_E_UNAVAIL;
  74663 }
  74664 int
  74665 bcm_esw_field_qualify_TafGateId_get(
  74666     int unit,
  74667     bcm_field_entry_t entry,
  74668     uint32 *data, uint32 *mask)
  74669 {
  74670     return BCM_E_UNAVAIL;
  74671 }
  74672 
  74673 int
  74674 bcm_esw_field_qualify_TafEnable(int unit, bcm_field_entry_t entry,
  74675                                 uint8 enable)
  74676 {
  74677     return BCM_E_UNAVAIL;
  74678 }
  74679 
  74680 int
  74681 bcm_esw_field_qualify_TafEnable_get(
  74682     int unit,
  74683     bcm_field_entry_t entry,
  74684     uint8* enable)
  74685 {
  74686     return BCM_E_UNAVAIL;
  74687 }
  74688 
  74689 int
  74690 bcm_esw_field_qualify_TafGateState(int unit, bcm_field_entry_t entry,
  74691                                 uint8 state)
  74692 {
  74693     return BCM_E_UNAVAIL;
  74694 }
  74695 
  74696 int
  74697 bcm_esw_field_qualify_TafGateState_get(
  74698     int unit,
  74699     bcm_field_entry_t entry,
  74700     uint8* state)
  74701 {
  74702     return BCM_E_UNAVAIL;
  74703 }
  74704 
  74705 int
  74706 bcm_esw_field_qualify_TafCosProfile(int unit, bcm_field_entry_t entry,
  74707                                 uint32 data, uint32 mask)
  74708 {
  74709     return BCM_E_UNAVAIL;
  74710 }
  74711 
  74712 int
  74713 bcm_esw_field_qualify_TafCosProfile_get(
  74714     int unit,
  74715     bcm_field_entry_t entry,
  74716     uint32 *data, uint32 *mask)
  74717 {
  74718     return BCM_E_UNAVAIL;
  74719 }
  74720 
  74721 int
  74722 bcm_esw_field_qualify_BfdPktWithDstIpLoopbackAddr(
  74723     int unit,
  74724     bcm_field_entry_t entry,
  74725     uint8 data,
  74726     uint8 mask)
  74727 {
  74728     return BCM_E_UNAVAIL;
  74729 }
  74730 
  74731 int
  74732 bcm_esw_field_qualify_BfdPktWithDstIpLoopbackAddr_get(
  74733     int unit,
  74734     bcm_field_entry_t entry,
  74735     uint8 *data,
  74736     uint8 *mask)
  74737 {
  74738     return BCM_E_UNAVAIL;
  74739 }
  74740 
  74741 int
  74742 bcm_esw_field_qualify_MplsControlPkt(
  74743     int unit,
  74744     bcm_field_entry_t entry,
  74745     uint8 data,
  74746     uint8 mask)
  74747 {
  74748     return BCM_E_UNAVAIL;
  74749 }
  74750 
  74751 int
  74752 bcm_esw_field_qualify_MplsControlPkt_get(
  74753     int unit,
  74754     bcm_field_entry_t entry,
  74755     uint8 *data,
  74756     uint8 *mask)
  74757 {
  74758     return BCM_E_UNAVAIL;
  74759 }
  74760 
  74761 int
  74762 bcm_esw_field_qualify_IpTunnelTtl_get(
  74763     int unit,
  74764     bcm_field_entry_t entry,
  74765     uint8 *data,
  74766     uint8 *mask)
  74767 
  74768 {
  74769     return BCM_E_UNAVAIL;
  74770 
  74771 }
  74772 
  74773 int
  74774 bcm_esw_field_qualify_IpTunnelTtl(
  74775     int unit,
  74776     bcm_field_entry_t entry,
  74777     uint8 data,
  74778     uint8 mask)
  74779 
  74780 {
  74781     return BCM_E_UNAVAIL;
  74782 
  74783 }
  74784 
  74785 int
  74786 bcm_esw_field_qualify_IpTunnelTtlClassZero(int unit,
  74787         bcm_field_entry_t entry,
  74788         bcm_class_t data,
  74789         bcm_class_t mask)
  74790 {
  74791     return BCM_E_UNAVAIL;
  74792 }
  74793 
  74794 int
  74795 bcm_esw_field_qualify_InterfaceClassMplsLookup1_get(
  74796                         int unit,
  74797                         bcm_field_entry_t entry_id,
  74798                         uint16 *data,
  74799                         uint16 *mask)
  74800 {
  74801     return BCM_E_UNAVAIL;
  74802 }
  74803 
  74804 int
  74805 bcm_esw_field_qualify_InterfaceClassMplsLookup2_get(
  74806         int unit,
  74807         bcm_field_entry_t entry_id,
  74808         uint16 *data,
  74809         uint16 *mask)
  74810 {
  74811     return BCM_E_UNAVAIL;
  74812 }
  74813 
  74814 int
  74815 bcm_esw_field_qualify_InterfaceClassMplsLookup3_get(
  74816         int unit,
  74817         bcm_field_entry_t entry_id,
  74818         uint16 *data,
  74819         uint16 *mask)
  74820 {
  74821     return BCM_E_UNAVAIL;
  74822 }
  74823 
  74824 int
  74825 bcm_esw_field_qualify_InterfaceClassL3Tunnel_get(
  74826         int unit,
  74827         bcm_field_entry_t entry_id,
  74828         uint16 *data,
  74829         uint16 *mask)
  74830 {
  74831     return BCM_E_UNAVAIL;
  74832 }
  74833 
  74834 int
  74835 bcm_esw_field_qualify_InterfaceClassMplsLookup1(
  74836         int unit,
  74837         bcm_field_entry_t entry_id,
  74838         uint16 data,
  74839         uint16 mask)
  74840 {
  74841     return BCM_E_UNAVAIL;
  74842 }
  74843 
  74844 int
  74845 bcm_esw_field_qualify_InterfaceClassMplsLookup2(
  74846         int unit,
  74847         bcm_field_entry_t entry_id,
  74848         uint16 data,
  74849         uint16 mask)
  74850 {
  74851     return BCM_E_UNAVAIL;
  74852 }
  74853 
  74854 int
  74855 bcm_esw_field_qualify_InterfaceClassMplsLookup3(
  74856         int unit,
  74857         bcm_field_entry_t entry_id,
  74858         uint16 data,
  74859         uint16 mask)
  74860 {
  74861     return BCM_E_UNAVAIL;
  74862 }
  74863 
  74864 int
  74865 bcm_esw_field_qualify_InterfaceClassL3Tunnel(
  74866         int unit,
  74867         bcm_field_entry_t entry_id,
  74868         uint16 data,
  74869         uint16 mask)
  74870 {
  74871     return BCM_E_UNAVAIL;
  74872 }
  74873 
  74874 int
  74875 bcm_esw_field_qualify_BfdPktVersionOne(
  74876     int unit,
  74877     bcm_field_entry_t entry,
  74878     uint8 data,
  74879     uint8 mask)
  74880 {
  74881     return BCM_E_UNAVAIL;
  74882 }
  74883 
  74884 int
  74885 bcm_esw_field_qualify_BfdPktVersionOne_get(
  74886     int unit,
  74887     bcm_field_entry_t entry,
  74888     uint8 *data,
  74889     uint8 *mask)
  74890 {
  74891     return BCM_E_UNAVAIL;
  74892 }
  74893 int
  74894 bcm_esw_field_qualify_GenevePktVersionZero(
  74895     int unit,
  74896     bcm_field_entry_t entry,
  74897     uint8 data,
  74898     uint8 mask)
  74899 {
  74900     return BCM_E_UNAVAIL;
  74901 }
  74902 
  74903 int
  74904 bcm_esw_field_qualify_GenevePktVersionZero_get(
  74905     int unit,
  74906     bcm_field_entry_t entry,
  74907     uint8 *data,
  74908     uint8 *mask)
  74909 {
  74910     return BCM_E_UNAVAIL;
  74911 }
  74912 
  74913 int
  74914 bcm_esw_field_qualify_GenevePktWithOam(
  74915     int unit,
  74916     bcm_field_entry_t entry,
  74917     uint8 data,
  74918     uint8 mask)
  74919 {
  74920     return BCM_E_UNAVAIL;
  74921 }
  74922 
  74923 int
  74924 bcm_esw_field_qualify_GenevePktWithOam_get(
  74925     int unit,
  74926     bcm_field_entry_t entry,
  74927     uint8 *data,
  74928     uint8 *mask)
  74929 {
  74930     return BCM_E_UNAVAIL;
  74931 }
  74932 
  74933 int
  74934 bcm_esw_field_qualify_GpePktVersionZero(
  74935     int unit,
  74936     bcm_field_entry_t entry,
  74937     uint8 data,
  74938     uint8 mask)
  74939 {
  74940     return BCM_E_UNAVAIL;
  74941 }
  74942 
  74943 int
  74944 bcm_esw_field_qualify_GpePktVersionZero_get(
  74945     int unit,
  74946     bcm_field_entry_t entry,
  74947     uint8 *data,
  74948     uint8 *mask)
  74949 {
  74950     return BCM_E_UNAVAIL;
  74951 }
  74952 
  74953 int
  74954 bcm_esw_field_qualify_GpePktWithOam(
  74955     int unit,
  74956     bcm_field_entry_t entry,
  74957     uint8 data,
  74958     uint8 mask)
  74959 {
  74960     return BCM_E_UNAVAIL;
  74961 }
  74962 
  74963 int
  74964 bcm_esw_field_qualify_GpePktWithOam_get(
  74965     int unit,
  74966     bcm_field_entry_t entry,
  74967     uint8 *data,
  74968     uint8 *mask)
  74969 {
  74970     return BCM_E_UNAVAIL;
  74971 }
  74972 
  74973 int
  74974 bcm_esw_field_qualify_IpTunnelTtlClassZero_get(int unit,
  74975         bcm_field_entry_t entry,
  74976         bcm_class_t *data,
  74977         bcm_class_t *mask)
  74978 {
  74979     return BCM_E_UNAVAIL;
  74980 }
  74981 
  74982 int
  74983 bcm_esw_field_qualify_PktDstAddrType(
  74984     int unit,
  74985     bcm_field_entry_t entry,
  74986     uint32 dst_addr_type)
  74987 {
  74988     return BCM_E_UNAVAIL;
  74989 }
  74990 
  74991 int
  74992 bcm_esw_field_qualify_PktDstAddrType_get(
  74993     int unit,
  74994     bcm_field_entry_t entry,
  74995     uint32 *dst_addr_type)
  74996 {
  74997     return BCM_E_UNAVAIL;
  74998 }
  74999 
  75000 int
  75001 bcm_esw_field_qualify_PktInnerDstAddrType(
  75002     int unit,
  75003     bcm_field_entry_t entry,
  75004     uint32 dst_addr_type)
  75005 {
  75006     return BCM_E_UNAVAIL;
  75007 }
  75008 
  75009 int
  75010 bcm_esw_field_qualify_PktInnerDstAddrType_get(
  75011     int unit,
  75012     bcm_field_entry_t entry,
  75013     uint32 *dst_addr_type)
  75014 {
  75015     return BCM_E_UNAVAIL;
  75016 }
  75017 
  75018 int
  75019 bcm_esw_field_qualify_InnerL4Ports(
  75020     int unit,
  75021     bcm_field_entry_t entry,
  75022     uint8 data,
  75023     uint8 mask)
  75024 {
  75025     return BCM_E_UNAVAIL;
  75026 }
  75027 
  75028 int
  75029 bcm_esw_field_qualify_InnerL4Ports_get(
  75030     int unit,
  75031     bcm_field_entry_t entry,
  75032     uint8 *data,
  75033     uint8 *mask)
  75034 {
  75035     return BCM_E_UNAVAIL;
  75036 }
  75037 
  75038 int
  75039 bcm_esw_field_qualify_Ip6PktNextHeader(
  75040     int unit,
  75041     bcm_field_entry_t entry,
  75042     uint8 data,
  75043     uint8 mask)
  75044 {
  75045     return BCM_E_UNAVAIL;
  75046 }
  75047 
  75048 int
  75049 bcm_esw_field_qualify_Ip6PktNextHeader_get(
  75050     int unit,
  75051     bcm_field_entry_t entry,
  75052     uint8 *data,
  75053     uint8 *mask)
  75054 {
  75055     return BCM_E_UNAVAIL;
  75056 }
  75057 
  75058 int
  75059 bcm_esw_field_qualify_Ip6PktHopLimit(
  75060     int unit,
  75061     bcm_field_entry_t entry,
  75062     uint8 data,
  75063     uint8 mask)
  75064 {
  75065     return BCM_E_UNAVAIL;
  75066 }
  75067 
  75068 int
  75069 bcm_esw_field_qualify_Ip6PktHopLimit_get(
  75070     int unit,
  75071     bcm_field_entry_t entry,
  75072     uint8 *data,
  75073     uint8 *mask)
  75074 {
  75075     return BCM_E_UNAVAIL;
  75076 }
  75077 
  75078 int
  75079 bcm_esw_field_qualify_Ip6PktTrafficClass(
  75080     int unit,
  75081     bcm_field_entry_t entry,
  75082     uint8 data,
  75083     uint8 mask)
  75084 {
  75085     return BCM_E_UNAVAIL;
  75086 }
  75087 
  75088 int
  75089 bcm_esw_field_qualify_Ip6PktTrafficClass_get(
  75090     int unit,
  75091     bcm_field_entry_t entry,
  75092     uint8 *data,
  75093     uint8 *mask)
  75094 {
  75095     return BCM_E_UNAVAIL;
  75096 }
  75097 
  75098 int
  75099 bcm_esw_field_qualify_InnerIp6PktNextHeader(
  75100     int unit,
  75101     bcm_field_entry_t entry,
  75102     uint8 data,
  75103     uint8 mask)
  75104 {
  75105     return BCM_E_UNAVAIL;
  75106 }
  75107 
  75108 int
  75109 bcm_esw_field_qualify_InnerIp6PktNextHeader_get(
  75110     int unit,
  75111     bcm_field_entry_t entry,
  75112     uint8 *data,
  75113     uint8 *mask)
  75114 {
  75115     return BCM_E_UNAVAIL;
  75116 }
  75117 
  75118 int
  75119 bcm_esw_field_qualify_InnerIp6PktHopLimit(
  75120     int unit,
  75121     bcm_field_entry_t entry,
  75122     uint8 data,
  75123     uint8 mask)
  75124 {
  75125     return BCM_E_UNAVAIL;
  75126 }
  75127 
  75128 int
  75129 bcm_esw_field_qualify_InnerIp6PktHopLimit_get(
  75130     int unit,
  75131     bcm_field_entry_t entry,
  75132     uint8 *data,
  75133     uint8 *mask)
  75134 {
  75135     return BCM_E_UNAVAIL;
  75136 }
  75137 
  75138 int
  75139 bcm_esw_field_qualify_InnerIp6PktTrafficClass(
  75140     int unit,
  75141     bcm_field_entry_t entry,
  75142     uint8 data,
  75143     uint8 mask)
  75144 {
  75145     return BCM_E_UNAVAIL;
  75146 }
  75147 
  75148 int
  75149 bcm_esw_field_qualify_InnerIp6PktTrafficClass_get(
  75150     int unit,
  75151     bcm_field_entry_t entry,
  75152     uint8 *data,
  75153     uint8 *mask)
  75154 {
  75155     return BCM_E_UNAVAIL;
  75156 }
  75157 
  75158 int
  75159 bcm_esw_field_action_config_info_add(
  75160     int unit,
  75161     bcm_field_entry_t entry,
  75162     bcm_field_action_t action,
  75163     bcm_field_action_params_t *params,
  75164     bcm_field_action_match_config_t *match_config)
  75165 {
  75166     return BCM_E_UNAVAIL;
  75167 }
  75168 
  75169 int bcm_esw_field_action_config_info_get(
  75170     int unit,
  75171     bcm_field_entry_t entry,
  75172     bcm_field_action_t action,
  75173     bcm_field_action_params_t *params,
  75174     bcm_field_action_match_config_t *match_config)
  75175 {
  75176     return BCM_E_UNAVAIL;
  75177 }
  75178 
  75179  
  75180 /* 
  75181  * Configure match criteria for bcmFieldQualifyRangeCheckGroup
  75182  *         qualifier from the field entry.
  75183  */
  75184 int bcm_esw_field_qualify_RangeCheckGroup(
  75185     int unit, 
  75186     bcm_field_entry_t entry, 
  75187     uint8 data, 
  75188     uint8 mask)
  75189 {
  75190     return BCM_E_UNAVAIL;
  75191 }
  75192 
  75193 
  75194 /* 
  75195  * Get match criteria for bcmFieldQualifyRangeCheckGroup
  75196  *                qualifier from the field entry.
  75197  */
  75198 int bcm_esw_field_qualify_RangeCheckGroup_get(
  75199     int unit, 
  75200     bcm_field_entry_t entry, 
  75201     uint8 *data, 
  75202     uint8 *mask)
  75203 {
  75204     return BCM_E_UNAVAIL;
  75205 }
  75206 
  75207 /* Qualifies on the tag type configured for opaque tags. */
  75208 int bcm_esw_field_qualify_OpaqueTagType(
  75209     int unit, 
  75210     bcm_field_entry_t entry, 
  75211     uint8 data, 
  75212     uint8 mask)
  75213 {
  75214     return BCM_E_UNAVAIL;
  75215 }
  75216 
  75217 /* 
  75218  * To get the qualified inputs on the tag type configured for opaque
  75219  * tags.
  75220  */
  75221 int bcm_esw_field_qualify_OpaqueTagType_get(
  75222     int unit, 
  75223     bcm_field_entry_t entry, 
  75224     uint8 *data, 
  75225     uint8 *mask)
  75226 {
  75227     return BCM_E_UNAVAIL;
  75228 }
  75229 
  75230 /* Qualifies on the higher 32 bits of opaque tag allowed in the system */
  75231 int bcm_esw_field_qualify_OpaqueTagHigh(
  75232     int unit, 
  75233     bcm_field_entry_t entry, 
  75234     uint32 data, 
  75235     uint32 mask)
  75236 {
  75237     return BCM_E_UNAVAIL;
  75238 }
  75239 
  75240 /* 
  75241  * To get the qualified inputs on the higher 32 bits of opaque tag
  75242  * allowed in the system.
  75243  */
  75244 int bcm_esw_field_qualify_OpaqueTagHigh_get(
  75245     int unit, 
  75246     bcm_field_entry_t entry, 
  75247     uint32 *data, 
  75248     uint32 *mask)
  75249 {
  75250     return BCM_E_UNAVAIL;
  75251 }
  75252 
  75253 /* Qualifies on the lower 32 bits of opaque tag allowed in the system */
  75254 int bcm_esw_field_qualify_OpaqueTagLow(
  75255     int unit, 
  75256     bcm_field_entry_t entry, 
  75257     uint32 data, 
  75258     uint32 mask)
  75259 {
  75260     return BCM_E_UNAVAIL;
  75261 }
  75262 
  75263 /* 
  75264  * To get the qualified inputs on the lower 32 bits of opaque tag allowed
  75265  * in the system.
  75266  */
  75267 int bcm_esw_field_qualify_OpaqueTagLow_get(
  75268     int unit, 
  75269     bcm_field_entry_t entry, 
  75270     uint32 *data, 
  75271     uint32 *mask)
  75272 {
  75273     return BCM_E_UNAVAIL;
  75274 }
  75275 
  75276 int
  75277 bcm_esw_field_qualify_InnerDosAttack(
  75278     int unit,
  75279     bcm_field_entry_t entry,
  75280     uint8 data,
  75281     uint8 mask)
  75282 {
  75283     return BCM_E_UNAVAIL;
  75284 }
  75285 
  75286 int
  75287 bcm_esw_field_qualify_InnerDosAttack_get(
  75288     int unit,
  75289     bcm_field_entry_t entry,
  75290     uint8 *data,
  75291     uint8 *mask)
  75292 {
  75293     return BCM_E_UNAVAIL;
  75294 }
  75295 
  75296 int
  75297 bcm_esw_field_qualify_DosAttackEvents(
  75298     int unit,
  75299     bcm_field_entry_t entry,
  75300     uint32 data,
  75301     uint32 mask)
  75302 {
  75303     return BCM_E_UNAVAIL;
  75304 }
  75305 
  75306 int
  75307 bcm_esw_field_qualify_DosAttackEvents_get(
  75308     int unit,
  75309     bcm_field_entry_t entry,
  75310     uint32 *data,
  75311     uint32 *mask)
  75312 {
  75313     return BCM_E_UNAVAIL;
  75314 }
  75315 
  75316 int
  75317 bcm_esw_field_qualify_InnerDosAttackEvents(
  75318     int unit,
  75319     bcm_field_entry_t entry,
  75320     uint32 data,
  75321     uint32 mask)
  75322 {
  75323     return BCM_E_UNAVAIL;
  75324 }
  75325 
  75326 int
  75327 bcm_esw_field_qualify_InnerDosAttackEvents_get(
  75328     int unit,
  75329     bcm_field_entry_t entry,
  75330     uint32 *data,
  75331     uint32 *mask)
  75332 {
  75333     return BCM_E_UNAVAIL;
  75334 }
  75335 
  75336 int
  75337 bcm_esw_field_qualify_EgressForwardingClassId(
  75338         int unit,
  75339         bcm_field_entry_t entry,
  75340         int data,
  75341         int mask)
  75342 {
  75343     return BCM_E_UNAVAIL;
  75344 }
  75345 
  75346 int
  75347 bcm_esw_field_qualify_EgressForwardingClassId_get(
  75348         int unit,
  75349         bcm_field_entry_t entry,
  75350         int *data,
  75351         int *mask)
  75352 {
  75353     return BCM_E_UNAVAIL;
  75354 }
  75355 
  75356 /*
  75357  * Set qualification to define packet flow for a given entry. This API is
  75358  * normally used for preselectors.
  75359  */
  75360 int bcm_esw_field_qualify_PktFlowType(
  75361     int unit,
  75362     bcm_field_entry_t entry,
  75363     bcm_field_pkt_flow_type_t type)
  75364 {
  75365     return BCM_E_UNAVAIL;
  75366 }
  75367 
  75368 int bcm_esw_field_qualify_PktFlowType_get(
  75369     int unit,
  75370     bcm_field_entry_t entry,
  75371     bcm_field_pkt_flow_type_t *type)
  75372 {
  75373     return BCM_E_UNAVAIL;
  75374 }
  75375 
  75376 int
  75377 bcm_esw_field_qualify_VlanTranslateClassId(
  75378         int unit,
  75379         bcm_field_entry_t entry,
  75380         uint16 data,
  75381         uint16 mask)
  75382 {
  75383     return BCM_E_UNAVAIL;
  75384 }
  75385 
  75386 int
  75387 bcm_esw_field_qualify_VlanTranslateClassId_get(
  75388         int unit,
  75389         bcm_field_entry_t entry,
  75390         uint16 *data,
  75391         uint16 *mask)
  75392 {
  75393     return BCM_E_UNAVAIL;
  75394 }
  75395 
  75396 int
  75397 bcm_esw_field_qualify_IpIdentifier(
  75398         int unit,
  75399         bcm_field_entry_t entry,
  75400         uint16 data,
  75401         uint16 mask)
  75402 {
  75403     return BCM_E_UNAVAIL;
  75404 }
  75405 
  75406 int
  75407 bcm_esw_field_qualify_IpIdentifier_get(
  75408         int unit,
  75409         bcm_field_entry_t entry,
  75410         uint16 *data,
  75411         uint16 *mask)
  75412 {
  75413     return BCM_E_UNAVAIL;
  75414 }
  75415 
  75416 int
  75417 bcm_esw_field_qualify_Ip4Length(
  75418     int unit,
  75419     bcm_field_entry_t entry,
  75420     uint16 data,
  75421     uint16 mask)
  75422 {
  75423     return BCM_E_UNAVAIL;
  75424 }
  75425 
  75426 int
  75427 bcm_esw_field_qualify_Ip4Length_get(
  75428     int unit,
  75429     bcm_field_entry_t entry,
  75430     uint16 *data,
  75431     uint16 *mask)
  75432 {
  75433     return BCM_E_UNAVAIL;
  75434 }
  75435 
  75436 int
  75437 bcm_esw_field_qualify_Ip6Length(
  75438     int unit,
  75439     bcm_field_entry_t entry,
  75440     uint16 data,
  75441     uint16 mask)
  75442 {
  75443     return BCM_E_UNAVAIL;
  75444 }
  75445 
  75446 int
  75447 bcm_esw_field_qualify_Ip6Length_get(
  75448     int unit,
  75449     bcm_field_entry_t entry,
  75450     uint16 *data,
  75451     uint16 *mask)
  75452 {
  75453     return BCM_E_UNAVAIL;
  75454 }
  75455 
  75456 int
  75457 bcm_esw_field_qualify_TunnelPayloadIp4Length(
  75458     int unit,
  75459     bcm_field_entry_t entry,
  75460     uint16 data,
  75461     uint16 mask)
  75462 {
  75463     return BCM_E_UNAVAIL;
  75464 }
  75465 
  75466 int
  75467 bcm_esw_field_qualify_TunnelPayloadIp4Length_get(
  75468     int unit,
  75469     bcm_field_entry_t entry,
  75470     uint16 *data,
  75471     uint16 *mask)
  75472 {
  75473     return BCM_E_UNAVAIL;
  75474 }
  75475 
  75476 int
  75477 bcm_esw_field_qualify_TunnelPayloadIp6Length(
  75478     int unit,
  75479     bcm_field_entry_t entry,
  75480     uint16 data,
  75481     uint16 mask)
  75482 {
  75483     return BCM_E_UNAVAIL;
  75484 }
  75485 
  75486 int
  75487 bcm_esw_field_qualify_TunnelPayloadIp6Length_get(
  75488     int unit,
  75489     bcm_field_entry_t entry,
  75490     uint16 *data,
  75491     uint16 *mask)
  75492 {
  75493     return BCM_E_UNAVAIL;
  75494 }
  75495 
  75496 int
  75497 bcm_esw_field_qualify_GbpPresent(
  75498         int unit,
  75499         bcm_field_entry_t entry,
  75500         uint8 data,
  75501         uint8 mask)
  75502 {
  75503     return  BCM_E_UNAVAIL;
  75504 }
  75505 
  75506 int
  75507 bcm_esw_field_qualify_GbpPresent_get(
  75508         int unit,
  75509         bcm_field_entry_t entry,
  75510         uint8 *data,
  75511         uint8 *mask)
  75512 {
  75513     return BCM_E_UNAVAIL;
  75514 }
  75515 
  75516 int
  75517 bcm_esw_field_qualify_HiGigGbpPresent(
  75518         int unit,
  75519         bcm_field_entry_t entry,
  75520         uint8 data,
  75521         uint8 mask)
  75522 {
  75523     return  BCM_E_UNAVAIL;
  75524 }
  75525 
  75526 int
  75527 bcm_esw_field_qualify_HiGigGbpPresent_get(
  75528         int unit,
  75529         bcm_field_entry_t entry,
  75530         uint8 *data,
  75531         uint8 *mask)
  75532 {
  75533     return BCM_E_UNAVAIL;
  75534 }
  75535 
  75536 int
  75537 bcm_esw_field_qualify_VxlanGbpPresent(
  75538         int unit,
  75539         bcm_field_entry_t entry,
  75540         uint8 data,
  75541         uint8 mask)
  75542 {
  75543     return  BCM_E_UNAVAIL;
  75544 }
  75545 
  75546 int
  75547 bcm_esw_field_qualify_VxlanGbpPresent_get(
  75548         int unit,
  75549         bcm_field_entry_t entry,
  75550         uint8 *data,
  75551         uint8 *mask)
  75552 {
  75553     return BCM_E_UNAVAIL;
  75554 }
  75555 
  75556 int
  75557 bcm_esw_field_qualify_HiGigGbpSrcId(
  75558         int unit,
  75559         bcm_field_entry_t entry,
  75560         uint16 data,
  75561         uint16 mask)
  75562 {
  75563     return  BCM_E_UNAVAIL;
  75564 }
  75565 
  75566 int
  75567 bcm_esw_field_qualify_HiGigGbpSrcId_get(
  75568         int unit,
  75569         bcm_field_entry_t entry,
  75570         uint16 *data,
  75571         uint16 *mask)
  75572 {
  75573     return BCM_E_UNAVAIL;
  75574 }
  75575 
  75576 int
  75577 bcm_esw_field_qualify_GbpSrcId(
  75578         int unit,
  75579         bcm_field_entry_t entry,
  75580         uint16 data,
  75581         uint16 mask)
  75582 {
  75583     return  BCM_E_UNAVAIL;
  75584 }
  75585 
  75586 int
  75587 bcm_esw_field_qualify_GbpSrcId_get(
  75588         int unit,
  75589         bcm_field_entry_t entry,
  75590         uint16 *data,
  75591         uint16 *mask)
  75592 {
  75593     return BCM_E_UNAVAIL;
  75594 }
  75595 
  75596 int
  75597 bcm_esw_field_qualify_GbpDstId(
  75598         int unit,
  75599         bcm_field_entry_t entry,
  75600         uint16 data,
  75601         uint16 mask)
  75602 {
  75603     return  BCM_E_UNAVAIL;
  75604 }
  75605 
  75606 int
  75607 bcm_esw_field_qualify_GbpDstId_get(
  75608         int unit,
  75609         bcm_field_entry_t entry,
  75610         uint16 *data,
  75611         uint16 *mask)
  75612 {
  75613     return BCM_E_UNAVAIL;
  75614 }
  75615 
  75616 int
  75617 bcm_esw_field_qualify_FlowtrackerCheck(
  75618         int unit,
  75619         bcm_field_entry_t entry,
  75620         bcm_flowtracker_group_t  flow_group_id,
  75621         uint32 num_checks,
  75622         bcm_field_flowtrackercheck_t *list_of_check_ids)
  75623 {
  75624     return BCM_E_UNAVAIL;
  75625 }
  75626 
  75627 int
  75628 bcm_esw_field_qualify_FlowtrackerCheck_get(
  75629         int unit,
  75630         bcm_field_entry_t entry,
  75631         bcm_flowtracker_group_t  flow_group_id,
  75632         uint32 num_checks,
  75633         bcm_field_flowtrackercheck_t *list_of_check_ids,
  75634         uint32 *actual_num_checks)
  75635 {
  75636     return BCM_E_UNAVAIL;
  75637 }
  75638 
  75639 int
  75640 bcm_esw_field_qualify_FlowtrackerLearn(
  75641         int unit,
  75642         bcm_field_entry_t entry,
  75643         uint8 data,
  75644         uint8 mask)
  75645 {
  75646     return BCM_E_UNAVAIL;
  75647 }
  75648 
  75649 int
  75650 bcm_esw_field_qualify_FlowtrackerLearn_get(
  75651         int unit,
  75652         bcm_field_entry_t entry,
  75653         uint8 *data,
  75654         uint8 *mask)
  75655 {
  75656     return BCM_E_UNAVAIL;
  75657 }
  75658 
  75659 int
  75660 bcm_esw_field_qualify_CosMapSelect(
  75661         int unit,
  75662         bcm_field_entry_t entry,
  75663         bcm_field_cos_map_select_t cos_map_select)
  75664 {
  75665     return BCM_E_UNAVAIL;
  75666 }
  75667 
  75668 int
  75669 bcm_esw_field_qualify_CosMapSelect_get(
  75670         int unit,
  75671         bcm_field_entry_t entry,
  75672         bcm_field_cos_map_select_t *cos_map_select)
  75673 {
  75674     return BCM_E_UNAVAIL;
  75675 }
  75676 
  75677 int
  75678 bcm_esw_field_qualify_OpaqueObject1(
  75679         int unit,
  75680         bcm_field_entry_t entry,
  75681         uint16 data,
  75682         uint16 mask)
  75683 {
  75684     return BCM_E_UNAVAIL;
  75685 }
  75686 
  75687 int
  75688 bcm_esw_field_qualify_OpaqueObject1_get(
  75689         int unit,
  75690         bcm_field_entry_t entry,
  75691         uint16 *data,
  75692         uint16 *mask)
  75693 {
  75694     return BCM_E_UNAVAIL;
  75695 }
  75696 
  75697 int
  75698 bcm_esw_field_qualify_OpaqueObject2(
  75699         int unit,
  75700         bcm_field_entry_t entry,
  75701         uint16 data,
  75702         uint16 mask)
  75703 {
  75704     return BCM_E_UNAVAIL;
  75705 }
  75706 
  75707 int
  75708 bcm_esw_field_qualify_OpaqueObject2_get(
  75709         int unit,
  75710         bcm_field_entry_t entry,
  75711         uint16 *data,
  75712         uint16 *mask)
  75713 {
  75714     return BCM_E_UNAVAIL;
  75715 }
  75716 
  75717 int
  75718 bcm_esw_field_qualify_OpaqueObject3(
  75719         int unit,
  75720         bcm_field_entry_t entry,
  75721         uint16 data,
  75722         uint16 mask)
  75723 {
  75724     return BCM_E_UNAVAIL;
  75725 }
  75726 
  75727 int
  75728 bcm_esw_field_qualify_OpaqueObject3_get(
  75729         int unit,
  75730         bcm_field_entry_t entry,
  75731         uint16 *data,
  75732         uint16 *mask)
  75733 {
  75734     return BCM_E_UNAVAIL;
  75735 }
  75736 
  75737 int
  75738 bcm_esw_field_qualify_OpaqueObject4(
  75739         int unit,
  75740         bcm_field_entry_t entry,
  75741         uint16 data,
  75742         uint16 mask)
  75743 {
  75744     return BCM_E_UNAVAIL;
  75745 }
  75746 
  75747 int
  75748 bcm_esw_field_qualify_OpaqueObject4_get(
  75749         int unit,
  75750         bcm_field_entry_t entry,
  75751         uint16 *data,
  75752         uint16 *mask)
  75753 {
  75754     return BCM_E_UNAVAIL;
  75755 }
  75756 
  75757 int 
  75758 bcm_esw_field_qualify_IncomingOuterVlanId(
  75759     int unit, 
  75760     bcm_field_entry_t entry, 
  75761     bcm_vlan_t data, 
  75762     bcm_vlan_t mask)
  75763 {
  75764     return BCM_E_UNAVAIL;
  75765 }
  75766 
  75767 int 
  75768 bcm_esw_field_qualify_IncomingOuterVlanId_get(
  75769     int unit, 
  75770     bcm_field_entry_t entry, 
  75771     bcm_vlan_t *data, 
  75772     bcm_vlan_t *mask)
  75773 {
  75774     return BCM_E_UNAVAIL;
  75775 }
  75776 
  75777 int
  75778 bcm_esw_field_qualify_LoopbackSubtype(
  75779         int unit,
  75780         bcm_field_entry_t entry, 
  75781         bcm_field_loopback_subtype_t lb_subtype)
  75782 {
  75783     return (BCM_E_UNAVAIL);
  75784 }
  75785 
  75786 int
  75787 bcm_esw_field_qualify_LoopbackSubtype_get(
  75788         int unit,
  75789         bcm_field_entry_t entry,
  75790         bcm_field_loopback_subtype_t *lb_subtype)
  75791 {
  75792     return (BCM_E_UNAVAIL);
  75793 }
  75794 
  75795 int 
  75796 bcm_esw_field_qualify_DstL3EgressUnderlay(int unit, 
  75797                                         bcm_field_entry_t entry, 
  75798                                         bcm_if_t if_id)
  75799 {
  75800     return BCM_E_UNAVAIL;
  75801 }
  75802 
  75803 int 
  75804 bcm_esw_field_qualify_DstL3EgressNextHopsUnderlay_get(int unit, 
  75805                                         bcm_field_entry_t entry, 
  75806                                         bcm_if_t *if_id)
  75807 {
  75808     return BCM_E_UNAVAIL;
  75809 }
  75810 
  75811 int 
  75812 bcm_esw_field_qualify_DstL3EgressNextHopsUnderlay(int unit, 
  75813                                                 bcm_field_entry_t entry, 
  75814                                                 uint32 data,
  75815                                                 uint32 mask)
  75816 {
  75817     return BCM_E_UNAVAIL;
  75818 }
  75819 
  75820 int 
  75821 bcm_esw_field_qualify_DstL3EgressNextHopsUnderlay_get(int unit, 
  75822                                                 bcm_field_entry_t entry, 
  75823                                                 uint32 *data,
  75824                                                 uint32 *mask)
  75825 {
  75826     return BCM_E_UNAVAIL;
  75827 }
  75828 
  75829 int bcm_esw_field_qualify_EgressClassPort(
  75830     int unit,
  75831     bcm_field_entry_t entry,
  75832     uint16 data,
  75833     uint16 mask)
  75834 {
  75835     return BCM_E_UNAVAIL;
  75836 }
  75837 
  75838 
  75839 int bcm_esw_field_qualify_EgressClassPort_get(
  75840     int unit,
  75841     bcm_field_entry_t entry,
  75842     uint16 *data,
  75843     uint16 *mask)
  75844 {
  75845     return BCM_E_UNAVAIL;
  75846 }
  75847 
  75848 int
  75849 bcm_esw_field_qualify_INTProbeMarker1(int unit,
  75850                                       bcm_field_entry_t entry,
  75851                                       uint32 data,
  75852                                       uint32 mask)
  75853 {
  75854     return BCM_E_UNAVAIL;
  75855 }
  75856 int
  75857 bcm_esw_field_qualify_INTProbeMarker2(int unit,
  75858                                       bcm_field_entry_t entry,
  75859                                       uint32 data,
  75860                                       uint32 mask)
  75861 {
  75862     return BCM_E_UNAVAIL;
  75863 }
  75864 int
  75865 bcm_esw_field_qualify_INTReserved4Bytes(int unit,
  75866                                         bcm_field_entry_t entry,
  75867                                         uint32 data,
  75868                                         uint32 mask)
  75869 {
  75870     return BCM_E_UNAVAIL;
  75871 }
  75872 
  75873 int
  75874 bcm_esw_field_qualify_INTProbeMarker1_get(int unit,
  75875                                           bcm_field_entry_t entry,
  75876                                           uint32 *data,
  75877                                           uint32 *mask)
  75878 {
  75879     return BCM_E_UNAVAIL;
  75880 }
  75881 int
  75882 bcm_esw_field_qualify_INTProbeMarker2_get(int unit,
  75883                                           bcm_field_entry_t entry,
  75884                                           uint32 *data,
  75885                                           uint32 *mask)
  75886 {
  75887     return BCM_E_UNAVAIL;
  75888 }
  75889 int
  75890 bcm_esw_field_qualify_INTReserved4Bytes_get(int unit,
  75891                                           bcm_field_entry_t entry,
  75892                                           uint32 *data,
  75893                                           uint32 *mask)
  75894 {
  75895     return BCM_E_UNAVAIL;
  75896 }
  75897 
  75898 int
  75899 bcm_esw_field_qualify_FlowControlType(
  75900                int unit,
  75901                bcm_field_entry_t entry_id,
  75902                bcm_field_flow_control_pkt_type_t fc_type)
  75903 {
  75904     return BCM_E_UNAVAIL;
  75905 }
  75906 
  75907 int
  75908 bcm_esw_field_qualify_FlowControlType_get(
  75909                int unit,
  75910                bcm_field_entry_t entry_id,
  75911                bcm_field_flow_control_pkt_type_t *fc_type)
  75912 {
  75913     return BCM_E_UNAVAIL;
  75914 }
  75915 
  75916 int
  75917 bcm_esw_field_qualify_TimeStampTxPktType(
  75918                int unit,
  75919                bcm_field_entry_t entry_id,
  75920                bcm_field_timestamp_transmit_pkt_type_t ts_pkt_type)
  75921 {
  75922     return BCM_E_UNAVAIL;
  75923 }
  75924 
  75925 int
  75926 bcm_esw_field_qualify_TimeStampTxPktType_get(
  75927                int unit,
  75928                bcm_field_entry_t entry_id,
  75929                bcm_field_timestamp_transmit_pkt_type_t *ts_pkt_type)
  75930 {
  75931     return BCM_E_UNAVAIL;
  75932 }
  75933 
  75934 int
  75935 bcm_esw_field_qualify_SysHdrLocalDstport(int unit,
  75936                              bcm_field_entry_t entry,
  75937                              bcm_port_t data, bcm_port_t mask)
  75938 {
  75939     return (BCM_E_UNAVAIL);
  75940 }
  75941 
  75942 int
  75943 bcm_esw_field_qualify_SysHdrLocalDstport_get(int unit,
  75944                              bcm_field_entry_t entry,
  75945                              bcm_port_t *data, bcm_port_t *mask)
  75946 {
  75947     return (BCM_E_UNAVAIL);
  75948 }
  75949 
  75950 #endif  /* !BCM_FIELD_SUPPORT */
  75951 #endif  /* !BCM_ESW_SUPPORT */