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 (612614B)


      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  * File:        field.c
      7  * Purpose:     BCM56850 Field Processor installation functions.
      8  */
      9 
     10 #include <shared/bsl.h>
     11 
     12 #include <soc/defs.h>
     13 #if defined(BCM_TRIDENT2_SUPPORT) && defined(BCM_FIELD_SUPPORT)
     14 
     15 #include <soc/mem.h>
     16 #include <soc/drv.h>
     17 #include <soc/trident2.h>
     18 #include <soc/triumph3.h>
     19 
     20 #include <bcm/error.h>
     21 #include <bcm/l3.h>
     22 #include <bcm/field.h>
     23 #include <bcm/tunnel.h>
     24 
     25 #include <bcm_int/common/multicast.h>
     26 
     27 #include <bcm_int/esw_dispatch.h>
     28 #include <bcm_int/esw/field.h>
     29 #include <bcm_int/esw/l3.h>
     30 #include <bcm_int/esw/policer.h>
     31 #include <bcm_int/esw/trx.h>
     32 #include <bcm_int/esw/triumph.h>
     33 #include <bcm_int/esw/triumph2.h>
     34 #include <bcm_int/esw/trident.h>
     35 #include <bcm_int/esw/trident2.h>
     36 #include <bcm_int/esw/tomahawk.h>
     37 #include <bcm_int/esw/nat.h>
     38 #include <bcm_int/esw/oam.h>
     39 #include <soc/scache.h>
     40 
     41 #define ALIGN32(x)      (((x) + 31) & ~31)
     42 
     43 /*
     44  * Function:
     45  *     _field_sc960_ingress_qualifiers_init
     46  * Purpose:
     47  *     Initialize device stage ingress qualifiers
     48  *     select codes & offsets
     49  * Parameters:
     50  *     unit       - (IN) BCM device number.
     51  *     stage_fc   - (IN) Field Processor stage control structure.
     52  *
     53  * Returns:
     54  *     BCM_E_NONE
     55  */
     56 STATIC int
     57 _field_sc960_ingress_qualifiers_init(int unit, _field_stage_t *stage_fc)
     58 {
     59     const unsigned
     60         f2_offset = 10 - 2,
     61         fixed_offset = 138 - 2,
     62         fp_global_mask_tcam_ofs = ALIGN32(soc_mem_field_length(unit, 
     63                                                         FP_TCAMm, KEYf)),
     64         f3_offset = 2 - 2,
     65         f1_offset = 51 - 2;
     66 
     67     _FP_QUAL_DECL;
     68 
     69     /* Handled outside normal qualifier set/get scheme */
     70 
     71     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStage,
     72                  _bcmFieldSliceSelDisable, 0,
     73                  0, 0
     74                  );
     75     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageIngress,
     76                  _bcmFieldSliceSelDisable, 0,
     77                  0, 0
     78                  );
     79     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
     80                  _bcmFieldSliceSelDisable, 0,
     81                  0, 0
     82                  );
     83     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPorts,
     84                  _bcmFieldSliceSelDisable, 0,
     85                  0, 0
     86                  );
     87     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNormalizeMacAddrs,
     88                  _bcmFieldSliceSelDisable, 0,
     89                  0, 0
     90                  );
     91 
     92 /* FPF1 single wide */
     93 /* Present in Global Mask Field */
     94     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
     95                                _bcmFieldSliceSelFpf1, 0,
     96                                _bcmFieldSliceDstClassSelect, 0,
     97                                fp_global_mask_tcam_ofs + f1_offset, 10);
     98     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
     99                                _bcmFieldSliceSelFpf1, 0,
    100                                _bcmFieldSliceDstClassSelect, 2,
    101                                fp_global_mask_tcam_ofs + f1_offset, 10);
    102     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    103                                _bcmFieldSliceSelFpf1, 0,
    104                                _bcmFieldSliceDstClassSelect, 3,
    105                                fp_global_mask_tcam_ofs + f1_offset, 10);
    106     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    107                                _bcmFieldSliceSelFpf1, 0,
    108                                _bcmFieldSliceSrcClassSelect, 0,
    109                                fp_global_mask_tcam_ofs + f1_offset + 10, 10);
    110     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    111                                _bcmFieldSliceSelFpf1, 0,
    112                                _bcmFieldSliceSrcClassSelect, 2,
    113                                fp_global_mask_tcam_ofs + f1_offset + 10, 10);
    114     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    115                                _bcmFieldSliceSelFpf1, 0,
    116                                _bcmFieldSliceSrcClassSelect, 3,
    117                                fp_global_mask_tcam_ofs + f1_offset + 10, 10);
    118     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
    119                                _bcmFieldSliceSelFpf1, 0,
    120                                _bcmFieldSliceFwdFieldSelect,
    121                                _bcmFieldFwdFieldVlan,
    122                                fp_global_mask_tcam_ofs + f1_offset + 20, 13);
    123 
    124 
    125     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    126                                _bcmFieldSliceSelFpf1, 1,
    127                                _bcmFieldSliceDstFwdEntitySelect,
    128                                _bcmFieldFwdEntityGlp,
    129                                fp_global_mask_tcam_ofs + f1_offset, 21);
    130     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    131                                _bcmFieldSliceSelFpf1, 1,
    132                                _bcmFieldSliceDstFwdEntitySelect,
    133                                _bcmFieldFwdEntityGlp,
    134                                fp_global_mask_tcam_ofs + f1_offset, 21);
    135     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    136                                _bcmFieldSliceSelFpf1, 1,
    137                                _bcmFieldSliceDstFwdEntitySelect,
    138                                _bcmFieldFwdEntityMulticastGroup,
    139                                fp_global_mask_tcam_ofs + f1_offset, 21);
    140     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    141                                _bcmFieldSliceSelFpf1, 1,
    142                                _bcmFieldSliceDstFwdEntitySelect,
    143                                _bcmFieldFwdEntityCommonGport,
    144                                fp_global_mask_tcam_ofs + f1_offset, 21);
    145     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    146                                _bcmFieldSliceSelFpf1, 1,
    147                                _bcmFieldSliceIngressEntitySelect,
    148                                _bcmFieldFwdEntityGlp,
    149                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
    150     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    151                                _bcmFieldSliceSelFpf1, 1,
    152                                _bcmFieldSliceIngressEntitySelect,
    153                                _bcmFieldFwdEntityGlp,
    154                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
    155     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    156                                _bcmFieldSliceSelFpf1, 1,
    157                                _bcmFieldSliceIngressEntitySelect,
    158                                _bcmFieldFwdEntityModPortGport,
    159                                fp_global_mask_tcam_ofs + f1_offset + 21, 15);
    160     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport,
    161                                _bcmFieldSliceSelFpf1, 1,
    162                                _bcmFieldSliceIngressEntitySelect,
    163                                _bcmFieldFwdEntityModPortGport,
    164                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
    165     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    166                                _bcmFieldSliceSelFpf1, 1,
    167                                _bcmFieldSliceIngressEntitySelect,
    168                                _bcmFieldFwdEntityModPortGport,
    169                                fp_global_mask_tcam_ofs + f1_offset + 28, 8);
    170     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
    171                                _bcmFieldSliceSelFpf1, 1,
    172                                _bcmFieldSliceIngressEntitySelect,
    173                                _bcmFieldFwdEntityModPortGport,
    174                                fp_global_mask_tcam_ofs + f1_offset + 28, 8);
    175     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
    176                                _bcmFieldSliceSelFpf1, 1,
    177                                _bcmFieldSliceIngressEntitySelect,
    178                                _bcmFieldFwdEntityCommonGport,
    179                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
    180     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    181                  _bcmFieldSliceSelFpf1, 1,
    182                  fp_global_mask_tcam_ofs + f1_offset + 37, 3);
    183 
    184 
    185 
    186     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    187                                _bcmFieldSliceSelFpf1, 2,
    188                                _bcmFieldSliceDstFwdEntitySelect,
    189                                _bcmFieldFwdEntityGlp,
    190                                fp_global_mask_tcam_ofs + f1_offset, 21);
    191     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    192                                _bcmFieldSliceSelFpf1, 2,
    193                                _bcmFieldSliceDstFwdEntitySelect,
    194                                _bcmFieldFwdEntityGlp,
    195                                fp_global_mask_tcam_ofs + f1_offset, 21);
    196     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    197                                _bcmFieldSliceSelFpf1, 2,
    198                                _bcmFieldSliceDstFwdEntitySelect,
    199                                _bcmFieldFwdEntityCommonGport,
    200                                fp_global_mask_tcam_ofs + f1_offset, 21);
    201     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    202                                bcmFieldQualifyDstMulticastGroup,
    203                                _bcmFieldSliceSelFpf1, 2,
    204                                _bcmFieldSliceDstFwdEntitySelect,
    205                                _bcmFieldFwdEntityMulticastGroup,
    206                                fp_global_mask_tcam_ofs + f1_offset, 21);
    207     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    208                  _bcmFieldSliceSelFpf1, 2,
    209                  fp_global_mask_tcam_ofs + f1_offset + 21, 3);
    210     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    211                                _bcmFieldSliceSelFpf1, 2,
    212                                _bcmFieldSliceDstClassSelect, 0,
    213                                fp_global_mask_tcam_ofs + f1_offset + 24, 10);
    214     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    215                                _bcmFieldSliceSelFpf1, 2,
    216                                _bcmFieldSliceDstClassSelect, 2,
    217                                fp_global_mask_tcam_ofs + f1_offset + 24, 10);
    218     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    219                                _bcmFieldSliceSelFpf1, 2,
    220                                _bcmFieldSliceDstClassSelect, 3,
    221                                fp_global_mask_tcam_ofs + f1_offset + 24, 10);
    222     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    223                                _bcmFieldSliceSelFpf1, 2,
    224                                _bcmFieldSliceSrcClassSelect, 0,
    225                                fp_global_mask_tcam_ofs + f1_offset + 34, 10);
    226     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    227                                _bcmFieldSliceSelFpf1, 2,
    228                                _bcmFieldSliceSrcClassSelect, 2,
    229                                fp_global_mask_tcam_ofs + f1_offset + 34, 10);
    230     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    231                                _bcmFieldSliceSelFpf1, 2,
    232                                _bcmFieldSliceSrcClassSelect, 3,
    233                                fp_global_mask_tcam_ofs + f1_offset + 34, 10);
    234 
    235 
    236     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    237                  _bcmFieldSliceSelFpf1, 3,
    238                  fp_global_mask_tcam_ofs + f1_offset, 16);
    239     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    240                  _bcmFieldSliceSelFpf1, 3,
    241                  fp_global_mask_tcam_ofs + f1_offset, 12);
    242     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    243                  _bcmFieldSliceSelFpf1, 3,
    244                  fp_global_mask_tcam_ofs + f1_offset + 12, 1);
    245     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    246                  _bcmFieldSliceSelFpf1, 3,
    247                  fp_global_mask_tcam_ofs + f1_offset + 13, 3);
    248     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    249                  _bcmFieldSliceSelFpf1, 3,
    250                  fp_global_mask_tcam_ofs + f1_offset + 16, 16);
    251     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    252                  _bcmFieldSliceSelFpf1, 3,
    253                  fp_global_mask_tcam_ofs + f1_offset + 16, 12);
    254     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    255                  _bcmFieldSliceSelFpf1, 3,
    256                  fp_global_mask_tcam_ofs + f1_offset + 28, 1);
    257     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    258                  _bcmFieldSliceSelFpf1, 3,
    259                  fp_global_mask_tcam_ofs + f1_offset + 29, 3);
    260     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
    261                  _bcmFieldSliceSelFpf1, 3,
    262                  fp_global_mask_tcam_ofs + f1_offset + 32, 2);
    263 
    264 
    265     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    266                  _bcmFieldSliceSelFpf1, 4,
    267                  fp_global_mask_tcam_ofs + f1_offset, 16);
    268     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    269                  _bcmFieldSliceSelFpf1, 4,
    270                  fp_global_mask_tcam_ofs + f1_offset, 12);
    271     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    272                  _bcmFieldSliceSelFpf1, 4,
    273                  fp_global_mask_tcam_ofs + f1_offset + 12, 1);
    274     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    275                  _bcmFieldSliceSelFpf1, 4,
    276                  fp_global_mask_tcam_ofs + f1_offset + 13, 3);
    277     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    278                  _bcmFieldSliceSelFpf1, 4,
    279                  fp_global_mask_tcam_ofs + f1_offset + 16, 16);
    280 
    281 
    282     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
    283                  _bcmFieldSliceSelFpf1, 5,
    284                  fp_global_mask_tcam_ofs + f1_offset + 0, 3);
    285     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
    286                  _bcmFieldSliceSelFpf1, 5,
    287                  fp_global_mask_tcam_ofs + f1_offset + 3, 1);
    288     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
    289                  _bcmFieldSliceSelFpf1, 5,
    290                  fp_global_mask_tcam_ofs + f1_offset + 4, 2);
    291     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
    292                  _bcmFieldSliceSelFpf1, 5,
    293                  fp_global_mask_tcam_ofs + f1_offset + 6, 1);
    294     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
    295                  _bcmFieldSliceSelFpf1, 5,
    296                  fp_global_mask_tcam_ofs + f1_offset + 7, 1);
    297     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
    298                  _bcmFieldSliceSelFpf1, 5,
    299                  fp_global_mask_tcam_ofs + f1_offset + 8, 1);
    300     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
    301                  _bcmFieldSliceSelFpf1, 5,
    302                  fp_global_mask_tcam_ofs + f1_offset + 9, 1);
    303     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
    304                  _bcmFieldSliceSelFpf1, 5,
    305                  fp_global_mask_tcam_ofs + f1_offset + 13, 1);
    306     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
    307                  _bcmFieldSliceSelFpf1, 5,
    308                  fp_global_mask_tcam_ofs + f1_offset + 14, 1);
    309 
    310     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
    311                  _bcmFieldSliceSelFpf1, 5,
    312                  fp_global_mask_tcam_ofs + f1_offset + 20, 6);
    313     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    314                  _bcmFieldSliceSelFpf1, 5,
    315                  fp_global_mask_tcam_ofs + f1_offset + 26, 16);
    316     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    317                  _bcmFieldSliceSelFpf1, 5,
    318                  fp_global_mask_tcam_ofs + f1_offset + 26, 12);
    319     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    320                  _bcmFieldSliceSelFpf1, 5,
    321                  fp_global_mask_tcam_ofs + f1_offset + 38, 1);
    322     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    323                  _bcmFieldSliceSelFpf1, 5,
    324                  fp_global_mask_tcam_ofs + f1_offset + 39, 3);
    325     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
    326                  _bcmFieldSliceSelFpf1, 5,
    327                  fp_global_mask_tcam_ofs + f1_offset + 42, 2);
    328 
    329 
    330     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    331                  _bcmFieldSliceSelFpf1, 6,
    332                  fp_global_mask_tcam_ofs + f1_offset, 16);
    333     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    334                  _bcmFieldSliceSelFpf1, 6,
    335                  fp_global_mask_tcam_ofs + f1_offset, 12);
    336     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    337                  _bcmFieldSliceSelFpf1, 6,
    338                  fp_global_mask_tcam_ofs + f1_offset + 12, 1);
    339     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    340                  _bcmFieldSliceSelFpf1, 6,
    341                  fp_global_mask_tcam_ofs + f1_offset + 13, 3);
    342     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    343                  _bcmFieldSliceSelFpf1, 6,
    344                  fp_global_mask_tcam_ofs + f1_offset + 16, 2);
    345     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    346                  _bcmFieldSliceSelFpf1, 6,
    347                  fp_global_mask_tcam_ofs + f1_offset + 18, 2);
    348     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    349                  _bcmFieldSliceSelFpf1, 6,
    350                  fp_global_mask_tcam_ofs + f1_offset + 20, 2);
    351     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    352                  _bcmFieldSliceSelFpf1, 6,
    353                  fp_global_mask_tcam_ofs + f1_offset + 22, 3);
    354     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
    355                  _bcmFieldSliceSelFpf1, 6,
    356                  fp_global_mask_tcam_ofs + f1_offset + 25, 6);
    357     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    358                  _bcmFieldSliceSelFpf1, 6,
    359                  fp_global_mask_tcam_ofs + f1_offset + 33, 16);
    360 
    361 
    362     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    363                  _bcmFieldSliceSelFpf1, 7,
    364                  fp_global_mask_tcam_ofs + f1_offset, 16);
    365     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    366                  _bcmFieldSliceSelFpf1, 7,
    367                  fp_global_mask_tcam_ofs + f1_offset, 12);
    368     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    369                  _bcmFieldSliceSelFpf1, 7,
    370                  fp_global_mask_tcam_ofs + f1_offset + 12, 1);
    371     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    372                  _bcmFieldSliceSelFpf1, 7,
    373                  fp_global_mask_tcam_ofs + f1_offset + 13, 3);
    374     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    375                                _bcmFieldSliceSelFpf1, 7,
    376                                _bcmFieldSliceSrcClassSelect, 0,
    377                                 fp_global_mask_tcam_ofs + f1_offset + 16,
    378                                10);
    379     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    380                                bcmFieldQualifyDstClassField,
    381                                _bcmFieldSliceSelFpf1, 7,
    382                                _bcmFieldSliceSrcClassSelect, 2,
    383                                fp_global_mask_tcam_ofs + f1_offset + 16,
    384                                10);
    385     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    386                                bcmFieldQualifySrcClassField,
    387                                _bcmFieldSliceSelFpf1, 7,
    388                                _bcmFieldSliceSrcClassSelect, 3,
    389                                fp_global_mask_tcam_ofs + f1_offset + 16,
    390                                10);
    391     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    392                                bcmFieldQualifyForwardingVlanId,
    393                                _bcmFieldSliceSelFpf1, 7,
    394                                _bcmFieldSliceFwdFieldSelect,
    395                                _bcmFieldFwdFieldVlan,
    396                                fp_global_mask_tcam_ofs + f1_offset + 26,
    397                                13);
    398 
    399 
    400     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    401                                _bcmFieldSliceSelFpf1, 8,
    402                                _bcmFieldSliceSrcClassSelect, 0,
    403                                fp_global_mask_tcam_ofs + f1_offset + 16,
    404                                10);
    405     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    406                                bcmFieldQualifyDstClassField,
    407                                _bcmFieldSliceSelFpf1, 8,
    408                                _bcmFieldSliceSrcClassSelect, 2,
    409                                fp_global_mask_tcam_ofs + f1_offset + 16,
    410                                10);
    411     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    412                                bcmFieldQualifySrcClassField,
    413                                _bcmFieldSliceSelFpf1, 8,
    414                                _bcmFieldSliceSrcClassSelect, 3,
    415                                fp_global_mask_tcam_ofs + f1_offset + 16,
    416                                10);
    417     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    418                                bcmFieldQualifyForwardingVlanId,
    419                                _bcmFieldSliceSelFpf1, 8,
    420                                _bcmFieldSliceFwdFieldSelect,
    421                                _bcmFieldFwdFieldVlan,
    422                                fp_global_mask_tcam_ofs + f1_offset + 26,
    423                                13);
    424     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized,
    425                  _bcmFieldSliceSelFpf1, 8,
    426                  fp_global_mask_tcam_ofs + f1_offset + 40, 1
    427                  );
    428 
    429     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData2,
    430                  _bcmFieldSliceSelFpf1, 9,
    431                  fp_global_mask_tcam_ofs + f1_offset, 32);
    432 
    433     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress,
    434                  _bcmFieldSliceSelFpf1, 9,
    435                  fp_global_mask_tcam_ofs + f1_offset + 36 , 13);
    436 
    437     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    438                                _bcmFieldSliceSelFpf1, 10,
    439                                _bcmFieldSliceDstFwdEntitySelect,
    440                                _bcmFieldFwdEntityGlp,
    441                                fp_global_mask_tcam_ofs + f1_offset, 21);
    442     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    443                                _bcmFieldSliceSelFpf1, 10,
    444                                _bcmFieldSliceDstFwdEntitySelect,
    445                                _bcmFieldFwdEntityGlp,
    446                                fp_global_mask_tcam_ofs + f1_offset, 21);
    447     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    448                                _bcmFieldSliceSelFpf1, 10,
    449                                _bcmFieldSliceDstFwdEntitySelect,
    450                                _bcmFieldFwdEntityCommonGport,
    451                                fp_global_mask_tcam_ofs + f1_offset, 21);
    452     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    453                                bcmFieldQualifyDstMulticastGroup,
    454                                _bcmFieldSliceSelFpf1, 10,
    455                                _bcmFieldSliceDstFwdEntitySelect,
    456                                _bcmFieldFwdEntityMulticastGroup,
    457                                fp_global_mask_tcam_ofs + f1_offset, 21);
    458     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    459                  _bcmFieldSliceSelFpf1, 10,
    460                  fp_global_mask_tcam_ofs + f1_offset + 21, 16);
    461     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    462                  _bcmFieldSliceSelFpf1, 10,
    463                  fp_global_mask_tcam_ofs + f1_offset + 21, 16);
    464 
    465 
    466 
    467     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    468                  _bcmFieldSliceSelFpf1, 11,
    469                  fp_global_mask_tcam_ofs + f1_offset, 16);
    470     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    471                  _bcmFieldSliceSelFpf1, 11,
    472                  fp_global_mask_tcam_ofs + f1_offset, 16);
    473     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    474                  _bcmFieldSliceSelFpf1, 11,
    475                  fp_global_mask_tcam_ofs + f1_offset, 15);
    476     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    477                  _bcmFieldSliceSelFpf1, 11,
    478                  fp_global_mask_tcam_ofs + f1_offset + 7, 8);
    479     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
    480                        _bcmFieldSliceSelFpf1, 11,
    481                        fp_global_mask_tcam_ofs + f1_offset + 32, 4);
    482     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
    483                        _bcmFieldSliceSelFpf1, 11,
    484                        fp_global_mask_tcam_ofs + f1_offset + 36, 2);
    485 
    486 
    487     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    488                  _bcmFieldSliceSelFpf1, 12,
    489                  fp_global_mask_tcam_ofs + f1_offset, 12);
    490     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    491                                _bcmFieldSliceSelFpf1, 12,
    492                                _bcmFieldSliceSrcClassSelect, 0,
    493                                fp_global_mask_tcam_ofs + f1_offset + 12,
    494                                10);
    495     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    496                                bcmFieldQualifyDstClassField,
    497                                _bcmFieldSliceSelFpf1, 12,
    498                                _bcmFieldSliceSrcClassSelect, 2,
    499                                fp_global_mask_tcam_ofs + f1_offset + 12,
    500                                10);
    501     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    502                                bcmFieldQualifySrcClassField,
    503                                _bcmFieldSliceSelFpf1, 12,
    504                                _bcmFieldSliceSrcClassSelect, 3,
    505                                fp_global_mask_tcam_ofs + f1_offset + 12,
    506                                10);
    507     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    508                                _bcmFieldSliceSelFpf1, 12,
    509                                _bcmFieldSliceDstClassSelect, 0,
    510                                fp_global_mask_tcam_ofs + f1_offset + 38,
    511                                10);
    512     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    513                                bcmFieldQualifyDstClassField,
    514                                _bcmFieldSliceSelFpf1, 12,
    515                                _bcmFieldSliceDstClassSelect, 2,
    516                                fp_global_mask_tcam_ofs + f1_offset + 38,
    517                                10);
    518     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    519                                bcmFieldQualifySrcClassField,
    520                                _bcmFieldSliceSelFpf1, 12,
    521                                _bcmFieldSliceDstClassSelect, 3,
    522                                fp_global_mask_tcam_ofs + f1_offset + 38,
    523                                10);
    524 
    525 
    526     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
    527                  _bcmFieldSliceSelFpf1, 13,
    528                  fp_global_mask_tcam_ofs + f1_offset + 37, 4);
    529 
    530     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
    531                  _bcmFieldSliceSelFpf1, 13,
    532                  fp_global_mask_tcam_ofs + f1_offset + 41, 2);
    533     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    534                                bcmFieldQualifyFabricQueueTag,
    535                                _bcmFieldSliceSelFpf1, 13,
    536                                _bcmFieldSliceAuxTag1Select,
    537                                _bcmFieldAuxTagFabricQueue,
    538                                fp_global_mask_tcam_ofs + f1_offset,
    539                                33);
    540     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper,
    541                                _bcmFieldSliceSelFpf1, 13,
    542                                _bcmFieldSliceAuxTag1Select,
    543                                _bcmFieldAuxTagRtag7A,
    544                                fp_global_mask_tcam_ofs + f1_offset + 16, 17);
    545 
    546     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper,
    547                                _bcmFieldSliceSelFpf1, 13,
    548                                _bcmFieldSliceAuxTag1Select,
    549                                _bcmFieldAuxTagRtag7B,
    550                                fp_global_mask_tcam_ofs + f1_offset + 16, 17);
    551                                           
    552     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower,
    553                      _bcmFieldDevSelDisable, 0, 
    554                      _bcmFieldSliceSelFpf1, 13,
    555                      _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7A, 
    556                      0,
    557                      fp_global_mask_tcam_ofs + f1_offset, 16,  
    558                      fp_global_mask_tcam_ofs + f1_offset + 32, 1,
    559                      0, 0, 
    560                      0); 
    561 
    562     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower,
    563                      _bcmFieldDevSelDisable, 0,
    564                      _bcmFieldSliceSelFpf1, 13,
    565                      _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7B,
    566                      0,
    567                      fp_global_mask_tcam_ofs + f1_offset, 16,
    568                      fp_global_mask_tcam_ofs + f1_offset + 32, 1,
    569                      0, 0,
    570                      0); 
    571     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized,
    572                  _bcmFieldSliceSelFpf1, 14,
    573                  fp_global_mask_tcam_ofs + f1_offset + 48, 1
    574                  );
    575     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    576                  _bcmFieldSliceSelFpf1, 14, 
    577                  fp_global_mask_tcam_ofs + f1_offset, 48
    578                  );
    579 
    580 
    581     /* FPF2  single wide */
    582 
    583     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    584                  _bcmFieldSliceSelFpf2, 0, f2_offset + 64, 32);
    585     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    586                  _bcmFieldSliceSelFpf2, 0, f2_offset + 96, 32);
    587 
    588     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    589                  _bcmFieldSliceSelFpf2, 1, f2_offset + 64, 32);
    590     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    591                  _bcmFieldSliceSelFpf2, 1, f2_offset + 96, 32);
    592 
    593     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    594                  _bcmFieldSliceSelFpf2, 5, f2_offset, 16);
    595     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    596                  _bcmFieldSliceSelFpf2, 5, f2_offset, 12);
    597     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    598                  _bcmFieldSliceSelFpf2, 5, f2_offset + 12, 1);
    599     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    600                  _bcmFieldSliceSelFpf2, 5, f2_offset + 13, 3);
    601     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    602                  _bcmFieldSliceSelFpf2, 5, f2_offset + 16, 16);
    603     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    604                  _bcmFieldSliceSelFpf2, 5, f2_offset + 32, 48);
    605     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    606                  _bcmFieldSliceSelFpf2, 5, f2_offset + 80, 48);
    607 
    608     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    609                  _bcmFieldSliceSelFpf2, 6, f2_offset, 16);
    610     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    611                  _bcmFieldSliceSelFpf2, 6, f2_offset, 12);
    612     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    613                  _bcmFieldSliceSelFpf2, 6, f2_offset + 12, 1);
    614     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    615                  _bcmFieldSliceSelFpf2, 6, f2_offset + 13, 3);
    616     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    617                  _bcmFieldSliceSelFpf2, 6, f2_offset + 16, 16);
    618     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    619                  _bcmFieldSliceSelFpf2, 6, f2_offset + 32, 48);
    620 
    621     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    622                  _bcmFieldSliceSelFpf2, 7, f2_offset, 16);
    623     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    624                  _bcmFieldSliceSelFpf2, 7, f2_offset, 12);
    625     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    626                  _bcmFieldSliceSelFpf2, 7, f2_offset + 12, 1);
    627     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    628                  _bcmFieldSliceSelFpf2, 7, f2_offset + 13, 3);
    629     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    630                  _bcmFieldSliceSelFpf2, 7, f2_offset + 16, 16);
    631     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    632                  _bcmFieldSliceSelFpf2, 7, f2_offset + 32, 32);
    633     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    634                  _bcmFieldSliceSelFpf2, 7, f2_offset + 80, 48);
    635 
    636     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0,
    637                  _bcmFieldSliceSelFpf2, 8, f2_offset, 128);
    638 
    639     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1,
    640                  _bcmFieldSliceSelFpf2, 9, f2_offset, 128);
    641 
    642     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    643                  _bcmFieldSliceSelFpf2, 11, f2_offset + 32, 48);
    644     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    645                  _bcmFieldSliceSelFpf2, 11, f2_offset + 80, 48);
    646 
    647 
    648 /* FPF 3 */
    649 /* Present in Global Mask Field */
    650     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    651                                _bcmFieldSliceSelFpf3, 0,
    652                                _bcmFieldSliceDstClassSelect, 0,
    653                                fp_global_mask_tcam_ofs + f3_offset, 10);
    654     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    655                                bcmFieldQualifyDstClassField,
    656                                _bcmFieldSliceSelFpf3, 0,
    657                                _bcmFieldSliceDstClassSelect, 2,
    658                                fp_global_mask_tcam_ofs + f3_offset, 10);
    659     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    660                                bcmFieldQualifySrcClassField,
    661                                _bcmFieldSliceSelFpf3, 0,
    662                                _bcmFieldSliceDstClassSelect, 3,
    663                                fp_global_mask_tcam_ofs + f3_offset, 10);
    664     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    665                                _bcmFieldSliceSelFpf3, 0,
    666                                _bcmFieldSliceSrcClassSelect, 0,
    667                                fp_global_mask_tcam_ofs + f3_offset + 10, 10);
    668     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    669                                bcmFieldQualifyDstClassField,
    670                                _bcmFieldSliceSelFpf3, 0,
    671                                _bcmFieldSliceSrcClassSelect, 2,
    672                                fp_global_mask_tcam_ofs + f3_offset + 10, 10);
    673     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    674                                bcmFieldQualifySrcClassField,
    675                                _bcmFieldSliceSelFpf3, 0,
    676                                _bcmFieldSliceSrcClassSelect, 3,
    677                                fp_global_mask_tcam_ofs + f3_offset + 10, 10);
    678     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    679                                bcmFieldQualifyForwardingVlanId,
    680                                _bcmFieldSliceSelFpf3, 0,
    681                                _bcmFieldSliceFwdFieldSelect,
    682                                _bcmFieldFwdFieldVlan,
    683                                fp_global_mask_tcam_ofs + f3_offset + 20, 13);
    684     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    685                                _bcmFieldSliceSelFpf3, 1,
    686                                _bcmFieldSliceSrcClassSelect, 0,
    687                                fp_global_mask_tcam_ofs + f3_offset, 10);
    688     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    689                                bcmFieldQualifyDstClassField,
    690                                _bcmFieldSliceSelFpf3, 1,
    691                                _bcmFieldSliceSrcClassSelect, 2,
    692                                fp_global_mask_tcam_ofs + f3_offset, 10);
    693     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    694                                bcmFieldQualifySrcClassField,
    695                                _bcmFieldSliceSelFpf3, 1,
    696                                _bcmFieldSliceSrcClassSelect, 3,
    697                                fp_global_mask_tcam_ofs + f3_offset, 10);
    698     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    699                                bcmFieldQualifyForwardingVlanId,
    700                                _bcmFieldSliceSelFpf3, 1,
    701                                _bcmFieldSliceFwdFieldSelect,
    702                                _bcmFieldFwdFieldVlan,
    703                                fp_global_mask_tcam_ofs + f3_offset + 10, 13);
    704     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    705                  _bcmFieldSliceSelFpf3, 1,
    706                  fp_global_mask_tcam_ofs + f3_offset + 23, 12);
    707 
    708     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    709                                _bcmFieldSliceSelFpf3, 1,
    710                                _bcmFieldSliceDstClassSelect, 0,
    711                                fp_global_mask_tcam_ofs + f3_offset + 35, 10);
    712     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    713                                bcmFieldQualifyDstClassField,
    714                                _bcmFieldSliceSelFpf3, 1,
    715                                _bcmFieldSliceDstClassSelect, 2,
    716                                fp_global_mask_tcam_ofs + f3_offset + 35, 10);
    717     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    718                                bcmFieldQualifySrcClassField,
    719                                _bcmFieldSliceSelFpf3, 1,
    720                                _bcmFieldSliceDstClassSelect, 3,
    721                                fp_global_mask_tcam_ofs + f3_offset + 35, 10);
    722 
    723 
    724     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    725                                _bcmFieldSliceSelFpf3, 2,
    726                                _bcmFieldSliceDstFwdEntitySelect,
    727                                _bcmFieldFwdEntityGlp,
    728                                fp_global_mask_tcam_ofs + f3_offset, 21);
    729     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    730                                _bcmFieldSliceSelFpf3, 2,
    731                                _bcmFieldSliceDstFwdEntitySelect,
    732                                _bcmFieldFwdEntityGlp,
    733                                fp_global_mask_tcam_ofs + f3_offset, 21);
    734     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    735                                _bcmFieldSliceSelFpf3, 2,
    736                                _bcmFieldSliceDstFwdEntitySelect,
    737                                _bcmFieldFwdEntityCommonGport,
    738                                fp_global_mask_tcam_ofs + f3_offset, 21);
    739     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    740                                bcmFieldQualifyDstMulticastGroup,
    741                                _bcmFieldSliceSelFpf3, 2,
    742                                _bcmFieldSliceDstFwdEntitySelect,
    743                                _bcmFieldFwdEntityMulticastGroup,
    744                                fp_global_mask_tcam_ofs + f3_offset, 21);
    745     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    746                                _bcmFieldSliceSelFpf3, 2,
    747                                _bcmFieldSliceIngressEntitySelect,
    748                                _bcmFieldFwdEntityGlp,
    749                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
    750     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    751                                _bcmFieldSliceSelFpf3, 2,
    752                                _bcmFieldSliceIngressEntitySelect,
    753                                _bcmFieldFwdEntityGlp,
    754                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
    755     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    756                                _bcmFieldSliceSelFpf3, 2,
    757                                _bcmFieldSliceIngressEntitySelect,
    758                                _bcmFieldFwdEntityModPortGport,
    759                                fp_global_mask_tcam_ofs + f3_offset + 21, 15);
    760     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport,
    761                                _bcmFieldSliceSelFpf3, 2,
    762                                _bcmFieldSliceIngressEntitySelect,
    763                                _bcmFieldFwdEntityModPortGport,
    764                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
    765     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    766                                _bcmFieldSliceSelFpf3, 2,
    767                                _bcmFieldSliceIngressEntitySelect,
    768                                _bcmFieldFwdEntityModPortGport,
    769                                fp_global_mask_tcam_ofs + f3_offset + 28, 8);
    770     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
    771                                _bcmFieldSliceSelFpf3, 2,
    772                                _bcmFieldSliceIngressEntitySelect,
    773                                _bcmFieldFwdEntityModPortGport,
    774                                fp_global_mask_tcam_ofs + f3_offset + 28, 8);
    775     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
    776                                _bcmFieldSliceSelFpf3, 2,
    777                                 _bcmFieldSliceIngressEntitySelect,
    778                                _bcmFieldFwdEntityCommonGport,
    779                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
    780     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    781                  _bcmFieldSliceSelFpf3, 2,
    782                  fp_global_mask_tcam_ofs + f3_offset + 37, 3);
    783 
    784     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    785                  _bcmFieldSliceSelFpf3, 3,
    786                  fp_global_mask_tcam_ofs + f3_offset, 16);
    787     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    788                  _bcmFieldSliceSelFpf3, 3,
    789                  fp_global_mask_tcam_ofs + f3_offset, 12);
    790     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    791                  _bcmFieldSliceSelFpf3, 3,
    792                  fp_global_mask_tcam_ofs + f3_offset + 12, 1);
    793     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    794                  _bcmFieldSliceSelFpf3, 3,
    795                  fp_global_mask_tcam_ofs + f3_offset + 13, 3);
    796     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    797                  _bcmFieldSliceSelFpf3, 3,
    798                  fp_global_mask_tcam_ofs + f3_offset + 16, 2);
    799     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    800                  _bcmFieldSliceSelFpf3, 3,
    801                  fp_global_mask_tcam_ofs + f3_offset + 18, 2);
    802     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    803                  _bcmFieldSliceSelFpf3, 3,
    804                  fp_global_mask_tcam_ofs + f3_offset + 20, 2);
    805     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    806                  _bcmFieldSliceSelFpf3, 3,
    807                  fp_global_mask_tcam_ofs + f3_offset + 22, 3);
    808     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
    809                  _bcmFieldSliceSelFpf3, 3,
    810                  fp_global_mask_tcam_ofs + f3_offset + 25, 6);
    811     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    812                  _bcmFieldSliceSelFpf3, 3,
    813                  fp_global_mask_tcam_ofs + f3_offset + 33, 16);
    814 
    815     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    816                  _bcmFieldSliceSelFpf3, 4,
    817                  fp_global_mask_tcam_ofs + f3_offset, 16);
    818     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    819                  _bcmFieldSliceSelFpf3, 4,
    820                  fp_global_mask_tcam_ofs + f3_offset, 12);
    821     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    822                  _bcmFieldSliceSelFpf3, 4,
    823                  fp_global_mask_tcam_ofs + f3_offset + 12, 1);
    824     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    825                  _bcmFieldSliceSelFpf3, 4,
    826                  fp_global_mask_tcam_ofs + f3_offset + 13, 3);
    827     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    828                  _bcmFieldSliceSelFpf3, 4,
    829                  fp_global_mask_tcam_ofs + f3_offset + 16, 16);
    830     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    831                  _bcmFieldSliceSelFpf3, 4,
    832                  fp_global_mask_tcam_ofs + f3_offset + 16, 12);
    833     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    834                  _bcmFieldSliceSelFpf3, 4,
    835                  fp_global_mask_tcam_ofs + f3_offset + 28, 1);
    836     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    837                  _bcmFieldSliceSelFpf3, 4,
    838                  fp_global_mask_tcam_ofs + f3_offset + 29, 3);
    839     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
    840                  _bcmFieldSliceSelFpf3, 4,
    841                  fp_global_mask_tcam_ofs + f3_offset + 32, 4);
    842     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
    843                  _bcmFieldSliceSelFpf3, 4,
    844                  fp_global_mask_tcam_ofs + f3_offset + 36, 2);
    845 
    846     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    847                  _bcmFieldSliceSelFpf3, 5,
    848                  fp_global_mask_tcam_ofs + f3_offset, 16);
    849     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    850                  _bcmFieldSliceSelFpf3, 5,
    851                  fp_global_mask_tcam_ofs + f3_offset, 12);
    852     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    853                  _bcmFieldSliceSelFpf3, 5,
    854                  fp_global_mask_tcam_ofs + f3_offset + 12, 1);
    855     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    856                  _bcmFieldSliceSelFpf3, 5,
    857                  fp_global_mask_tcam_ofs + f3_offset + 13, 3);
    858     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    859                  _bcmFieldSliceSelFpf3, 5,
    860                  fp_global_mask_tcam_ofs + f3_offset + 16, 16);
    861 
    862     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
    863                  _bcmFieldSliceSelFpf3, 6,
    864                  fp_global_mask_tcam_ofs + f3_offset + 0, 3);
    865     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
    866                  _bcmFieldSliceSelFpf3, 6,
    867                  fp_global_mask_tcam_ofs + f3_offset + 3, 1);
    868     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
    869                  _bcmFieldSliceSelFpf3, 6,
    870                  fp_global_mask_tcam_ofs + f3_offset + 4, 2);
    871     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
    872                  _bcmFieldSliceSelFpf3, 6,
    873                  fp_global_mask_tcam_ofs + f3_offset + 6, 1);
    874     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
    875                  _bcmFieldSliceSelFpf3, 6,
    876                  fp_global_mask_tcam_ofs + f3_offset + 7, 1);
    877     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
    878                  _bcmFieldSliceSelFpf3, 6,
    879                  fp_global_mask_tcam_ofs + f3_offset + 8, 1);
    880     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
    881                  _bcmFieldSliceSelFpf3, 6,
    882                  fp_global_mask_tcam_ofs + f3_offset + 9, 1);
    883     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
    884                  _bcmFieldSliceSelFpf3, 6,
    885                  fp_global_mask_tcam_ofs + f3_offset + 13, 1);
    886     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
    887                  _bcmFieldSliceSelFpf3, 6,
    888                  fp_global_mask_tcam_ofs + f3_offset + 14, 1);
    889 
    890     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
    891                  _bcmFieldSliceSelFpf3, 6,
    892                  fp_global_mask_tcam_ofs + f3_offset + 20, 6);
    893     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    894                  _bcmFieldSliceSelFpf3, 6,
    895                  fp_global_mask_tcam_ofs + f3_offset + 26, 16);
    896     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    897                  _bcmFieldSliceSelFpf3, 6,
    898                  fp_global_mask_tcam_ofs + f3_offset + 26, 12);
    899     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    900                  _bcmFieldSliceSelFpf3, 6,
    901                  fp_global_mask_tcam_ofs + f3_offset + 38, 1);
    902     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    903                  _bcmFieldSliceSelFpf3, 6,
    904                  fp_global_mask_tcam_ofs + f3_offset + 39, 3);
    905 
    906     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck,
    907                  _bcmFieldSliceSelFpf3, 7,
    908                  fp_global_mask_tcam_ofs + f3_offset, 24);
    909     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31,
    910                                _bcmFieldSliceSelFpf3, 7,
    911                                _bcmFieldSliceIntfClassSelect, 3,
    912                                fp_global_mask_tcam_ofs + f3_offset + 24, 8);
    913     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
    914                                _bcmFieldSliceSelFpf3, 7,
    915                                _bcmFieldSliceIntfClassSelect, 0,
    916                                fp_global_mask_tcam_ofs + f3_offset + 24, 12);
    917     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassVPort,
    918                                _bcmFieldSliceSelFpf3, 7,
    919                                _bcmFieldSliceIntfClassSelect, 1,
    920                                fp_global_mask_tcam_ofs + f3_offset + 24, 12);
    921     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
    922                                _bcmFieldSliceSelFpf3, 7,
    923                                _bcmFieldSliceIntfClassSelect, 2,
    924                                fp_global_mask_tcam_ofs + f3_offset + 24, 12);
    925 
    926     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    927                  _bcmFieldSliceSelFpf3, 8,
    928                  fp_global_mask_tcam_ofs + f3_offset + 20, 2);
    929     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    930                  _bcmFieldSliceSelFpf3, 8,
    931                  fp_global_mask_tcam_ofs + f3_offset + 22, 2);
    932     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    933                  _bcmFieldSliceSelFpf3, 8,
    934                  fp_global_mask_tcam_ofs + f3_offset + 24, 2);
    935     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
    936                  _bcmFieldSliceSelFpf3, 8,
    937                  fp_global_mask_tcam_ofs + f3_offset + 26, 2);
    938     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
    939                  _bcmFieldSliceSelFpf3, 8,
    940                  fp_global_mask_tcam_ofs + f3_offset + 28, 2);
    941 
    942     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData3,
    943                  _bcmFieldSliceSelFpf3, 9,
    944                  fp_global_mask_tcam_ofs + f3_offset, 32);
    945 
    946     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    947                                _bcmFieldSliceSelFpf3, 10,
    948                                _bcmFieldSliceDstFwdEntitySelect,
    949                                _bcmFieldFwdEntityGlp,
    950                                fp_global_mask_tcam_ofs + f3_offset, 21);
    951     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    952                                _bcmFieldSliceSelFpf3, 10,
    953                                _bcmFieldSliceDstFwdEntitySelect,
    954                                _bcmFieldFwdEntityGlp,
    955                                fp_global_mask_tcam_ofs + f3_offset, 21);
    956     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    957                                _bcmFieldSliceSelFpf3, 10,
    958                                _bcmFieldSliceDstFwdEntitySelect,
    959                                _bcmFieldFwdEntityCommonGport,
    960                                fp_global_mask_tcam_ofs + f3_offset, 21);
    961     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    962                                _bcmFieldSliceSelFpf3, 10,
    963                                _bcmFieldSliceDstFwdEntitySelect,
    964                                _bcmFieldFwdEntityMulticastGroup,
    965                                fp_global_mask_tcam_ofs + f3_offset, 21);
    966     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    967                  _bcmFieldSliceSelFpf3, 10,
    968                  fp_global_mask_tcam_ofs + f3_offset + 21, 16);
    969     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    970                  _bcmFieldSliceSelFpf3, 10,
    971                  fp_global_mask_tcam_ofs + f3_offset + 21, 16);
    972 
    973     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    974                  _bcmFieldSliceSelFpf3, 11,
    975                  fp_global_mask_tcam_ofs + f3_offset, 16);
    976     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    977                  _bcmFieldSliceSelFpf3, 11,
    978                  fp_global_mask_tcam_ofs + f3_offset, 16);
    979     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    980                  _bcmFieldSliceSelFpf3, 11,
    981                  fp_global_mask_tcam_ofs + f3_offset, 15);
    982     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    983                  _bcmFieldSliceSelFpf3, 11,
    984                  fp_global_mask_tcam_ofs + f3_offset + 7, 8);
    985 
    986     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
    987                                  _bcmFieldSliceSelFpf3, 12,
    988                                  fp_global_mask_tcam_ofs + f3_offset + 41, 2);
    989     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
    990                                  _bcmFieldSliceSelFpf3, 12,
    991                                  fp_global_mask_tcam_ofs + f3_offset + 37, 4);
    992     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag,
    993                                _bcmFieldSliceSelFpf3, 12,
    994                                _bcmFieldSliceAuxTag2Select,
    995                                _bcmFieldAuxTagFabricQueue,
    996                                fp_global_mask_tcam_ofs + f3_offset, 33);
    997                                                                                 
    998     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper,
    999                                _bcmFieldSliceSelFpf3, 12,
   1000                                _bcmFieldSliceAuxTag2Select,
   1001                                _bcmFieldAuxTagRtag7A,
   1002                                fp_global_mask_tcam_ofs + f3_offset + 16, 17);
   1003 
   1004     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper,
   1005                                _bcmFieldSliceSelFpf3, 12,
   1006                                _bcmFieldSliceAuxTag2Select,
   1007                                _bcmFieldAuxTagRtag7B,
   1008                                fp_global_mask_tcam_ofs + f3_offset + 16, 17);
   1009 
   1010     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower,
   1011                      _bcmFieldDevSelDisable, 0,
   1012                      _bcmFieldSliceSelFpf3, 12,
   1013                      _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7A,
   1014                      0,
   1015                      fp_global_mask_tcam_ofs + f3_offset, 16,
   1016                      fp_global_mask_tcam_ofs + f3_offset + 32, 1,
   1017                      0, 0,
   1018                      0);
   1019 
   1020     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower,
   1021                      _bcmFieldDevSelDisable, 0,
   1022                      _bcmFieldSliceSelFpf3, 12,
   1023                      _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7B,
   1024                      0,
   1025                      fp_global_mask_tcam_ofs + f3_offset, 16,
   1026                      fp_global_mask_tcam_ofs + f3_offset + 32, 1,
   1027                      0, 0,
   1028                      0);
   1029     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized,
   1030                  _bcmFieldSliceSelFpf3, 13,
   1031                  fp_global_mask_tcam_ofs + f3_offset + 34, 1
   1032                  );
   1033     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized,
   1034                  _bcmFieldSliceSelFpf3, 14,
   1035                  fp_global_mask_tcam_ofs + f3_offset + 48, 1
   1036                  );
   1037     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1038                  _bcmFieldSliceSelFpf3, 14, 
   1039                  fp_global_mask_tcam_ofs + f3_offset, 48
   1040                  );
   1041 
   1042 
   1043     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   1044                                _bcmFieldSliceSelFpf3, 15,
   1045                                _bcmFieldSliceDstFwdEntitySelect,
   1046                                _bcmFieldFwdEntityGlp,
   1047                                fp_global_mask_tcam_ofs + f3_offset, 21);
   1048     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   1049                                _bcmFieldSliceSelFpf3, 15,
   1050                                _bcmFieldSliceDstFwdEntitySelect,
   1051                                _bcmFieldFwdEntityGlp,
   1052                                fp_global_mask_tcam_ofs + f3_offset, 21);
   1053     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   1054                                _bcmFieldSliceSelFpf3, 15,
   1055                                _bcmFieldSliceDstFwdEntitySelect,
   1056                                _bcmFieldFwdEntityCommonGport,
   1057                                fp_global_mask_tcam_ofs + f3_offset, 21);
   1058     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   1059                                _bcmFieldSliceSelFpf3, 15,
   1060                                _bcmFieldSliceDstFwdEntitySelect,
   1061                                _bcmFieldFwdEntityMulticastGroup,
   1062                                fp_global_mask_tcam_ofs + f3_offset, 21);
   1063     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   1064                                _bcmFieldSliceSelFpf3, 15,
   1065                                _bcmFieldSliceIngressEntitySelect,
   1066                                _bcmFieldFwdEntityGlp,
   1067                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   1068     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   1069                                _bcmFieldSliceSelFpf3, 15,
   1070                                _bcmFieldSliceIngressEntitySelect,
   1071                                _bcmFieldFwdEntityGlp,
   1072                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   1073     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   1074                                _bcmFieldSliceSelFpf3, 15,
   1075                                _bcmFieldSliceIngressEntitySelect,
   1076                                _bcmFieldFwdEntityModPortGport,
   1077                                fp_global_mask_tcam_ofs + f3_offset + 21, 15);
   1078     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
   1079                                _bcmFieldSliceSelFpf3, 15,
   1080                                _bcmFieldSliceIngressEntitySelect,
   1081                                _bcmFieldFwdEntityCommonGport,
   1082                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   1083     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1084                  _bcmFieldSliceSelFpf3, 15,
   1085                  fp_global_mask_tcam_ofs + f3_offset + 37, 12);
   1086 
   1087 
   1088 
   1089     /* FIXED single wide */
   1090     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit,
   1091                  _bcmFieldSliceSelDisable, 0, fixed_offset, 1);
   1092         _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1093                  _bcmFieldSliceSelDisable, 0, fixed_offset + 1, 1);
   1094     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   1095                  _bcmFieldSliceSelDisable, 0, fixed_offset + 2, 3);
   1096     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, _bcmFieldQualifySvpValid,
   1097                  _bcmFieldSliceSelDisable, 0, fixed_offset + 5, 1);
   1098     _FP_QUAL_PRIMARY_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopback,
   1099                                _bcmFieldSliceSelDisable, 0,
   1100                                _bcmFieldSliceLoopbackTypeSelect, 0,
   1101                                fixed_offset + 17, 1);
   1102     _FP_QUAL_PRIMARY_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopbackType,
   1103                                _bcmFieldSliceSelDisable, 0,
   1104                                _bcmFieldSliceLoopbackTypeSelect, 0,
   1105                                fixed_offset + 13, 5);
   1106     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1107                  _bcmFieldSliceSelDisable, 0, fixed_offset + 18, 1);
   1108     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1109                  _bcmFieldSliceSelDisable, 0, fixed_offset + 21, 1);
   1110 
   1111     return (BCM_E_NONE);
   1112 }
   1113 
   1114 
   1115 /*
   1116  * Function:
   1117  *     _field_sc960_lookup_qualifiers_init
   1118  * Purpose:
   1119  *     Initialize device stage lookup qaualifiers
   1120  *     select codes & offsets
   1121  * Parameters:
   1122  *     unit       - (IN) BCM device number.
   1123  *     stage_fc   - (IN) Field Processor stage control structure.
   1124 
   1125  * Returns:
   1126  *     BCM_E_NONE
   1127  */
   1128 STATIC int
   1129 _field_sc960_lookup_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1130 {
   1131     const unsigned f1_offset = 164, f2_offset = 36, f3_offset = 0;
   1132     _FP_QUAL_DECL;
   1133 
   1134     /* Input parameters check. */
   1135     if (NULL == stage_fc) {
   1136         return (BCM_E_PARAM);
   1137     }
   1138 
   1139     /* Enable the overlay of Sender Ethernet Address onto MACSA
   1140      * on ARP/RARP packets.
   1141      */
   1142     BCM_IF_ERROR_RETURN
   1143         (soc_reg_field32_modify(unit, ING_CONFIG_64r, REG_PORT_ANY,
   1144                                 ARP_VALIDATION_ENf, 1));
   1145 
   1146     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageLookup,
   1147                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1148 
   1149     /* FPF1 */
   1150     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
   1151                  _bcmFieldSliceSelFpf1, 0, f1_offset + 5, 2);
   1152     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
   1153                  _bcmFieldSliceSelFpf1, 0, f1_offset + 7, 2);
   1154     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   1155                  _bcmFieldSliceSelFpf1, 0, f1_offset + 9, 2);
   1156     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1157                  _bcmFieldSliceSelFpf1, 0, f1_offset + 11, 1);
   1158     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1159                  _bcmFieldSliceSelFpf1, 0, f1_offset + 12, 1);
   1160     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1161                  _bcmFieldSliceSelFpf1, 0, f1_offset + 13, 16);
   1162     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1163                  _bcmFieldSliceSelFpf1, 0, f1_offset + 13, 12);
   1164     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1165                  _bcmFieldSliceSelFpf1, 0, f1_offset + 25, 1);
   1166     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1167                  _bcmFieldSliceSelFpf1, 0, f1_offset + 26, 3);
   1168     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1169                  _bcmFieldSliceSelFpf1, 0, f1_offset + 29, 2);
   1170     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   1171                      _bcmFieldDevSelDisable, 0,
   1172                      _bcmFieldSliceSelFpf1, 0,
   1173                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp,
   1174                      0,
   1175                      f1_offset + 36, 7, /* Port value in SGLP */
   1176                      f1_offset + 43, 8, /* Module value in SGLP */
   1177                      f1_offset + 51, 1, /* Trunk bit in SGLP (should be 0) */
   1178                      0
   1179                      );
   1180 
   1181     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   1182                      _bcmFieldDevSelDisable, 0,
   1183                      _bcmFieldSliceSelFpf1, 0,
   1184                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp,
   1185                      0,
   1186                      f1_offset + 36, 15, /* trunk id field of SGLP */
   1187                      f1_offset + 51, 1,  /* trunk bit of SGLP */
   1188                      0, 0,
   1189                      0
   1190                      );
   1191 
   1192     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   1193                      _bcmFieldDevSelDisable, 0,
   1194                      _bcmFieldSliceSelFpf1, 0,
   1195                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   1196                      0,
   1197                      f1_offset + 36, 15, /* mod + port field of unresolved SGLP */
   1198                      0, 0,
   1199                      0, 0,
   1200                      0
   1201                      );
   1202 
   1203     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   1204                      _bcmFieldDevSelDisable, 0,
   1205                      _bcmFieldSliceSelFpf1, 0,
   1206                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   1207                      0,
   1208                      f1_offset + 36 + 7, 8, /* mod field of unresolved SGLP */
   1209                      0, 0,
   1210                      0, 0,
   1211                      0
   1212                      );
   1213 
   1214     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
   1215                      _bcmFieldDevSelDisable, 0,
   1216                      _bcmFieldSliceSelFpf1, 0,
   1217                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   1218                      0,
   1219                      f1_offset + 36 + 7, 8, /* mod field of unresolved SGLP */
   1220                      0, 0,
   1221                      0, 0,
   1222                      0
   1223                      );
   1224 
   1225     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1226                      _bcmFieldDevSelDisable, 0,
   1227                      _bcmFieldSliceSelFpf1, 0,
   1228                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityPortGroupNum,
   1229                      0,
   1230                      f1_offset + 36, 7, /* ingress port field */
   1231                      0, 0,
   1232                      0, 0,
   1233                      0
   1234                      );
   1235 
   1236     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1237                      _bcmFieldDevSelDisable, 0,
   1238                      _bcmFieldSliceSelFpf1, 0,
   1239                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityPortGroupNum,
   1240                      0,
   1241                      f1_offset + 36 + 7, 8, /* ingress port group field */
   1242                      0, 0,
   1243                      0, 0,
   1244                      0
   1245                      );
   1246 
   1247 
   1248     /* FPF2 */
   1249 
   1250     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   1251                                _bcmFieldSliceSelFpf2, 0,
   1252                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 40,
   1253                                16);
   1254     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1255                                _bcmFieldSliceSelFpf2, 0,
   1256                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 40,
   1257                                16);
   1258     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1259                  _bcmFieldSliceSelFpf2, 0, f2_offset + 64,32);
   1260     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1261                  _bcmFieldSliceSelFpf2, 0, f2_offset + 96,32);
   1262 
   1263     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1264                  _bcmFieldSliceSelFpf2, 3, f2_offset + 16, 16);
   1265     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   1266                  _bcmFieldSliceSelFpf2, 3, f2_offset + 32, 48);
   1267     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1268                  _bcmFieldSliceSelFpf2, 3, f2_offset + 80, 48);
   1269 
   1270     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1271                  _bcmFieldSliceSelFpf2, 4, f2_offset + 16, 32);
   1272     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1273                  _bcmFieldSliceSelFpf2, 4, f2_offset + 48, 32);
   1274 
   1275     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   1276                  _bcmFieldSliceSelFpf2, 4, f2_offset + 80, 48);
   1277 
   1278     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1279                  _bcmFieldSliceSelFpf2, 5, f2_offset + 16, 32);
   1280     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1281                  _bcmFieldSliceSelFpf2, 5, f2_offset + 48, 32);
   1282 
   1283     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1284                  _bcmFieldSliceSelFpf2, 5, f2_offset + 80, 48);
   1285 
   1286     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyLlc,
   1287                  _bcmFieldSliceSelFpf2, 7, f2_offset + 104, 24);
   1288 
   1289     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0,
   1290                  _bcmFieldSliceSelFpf2, 8, f2_offset, 128);
   1291 
   1292     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1,
   1293                  _bcmFieldSliceSelFpf2, 9, f2_offset, 128);
   1294 
   1295     /* FPF3 */
   1296     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1297                  _bcmFieldSliceSelFpf3, 0, f3_offset + 0, 16);
   1298     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1299                  _bcmFieldSliceSelFpf3, 0, f3_offset + 0, 12);
   1300     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1301                  _bcmFieldSliceSelFpf3, 0, f3_offset + 12, 1);
   1302     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1303                  _bcmFieldSliceSelFpf3, 0, f3_offset + 13, 3);
   1304     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1305                  _bcmFieldSliceSelFpf3, 0, f3_offset + 16, 16);
   1306 
   1307     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   1308                                _bcmFieldSliceSelFpf3, 1,
   1309                                _bcmFieldSliceIpHeaderSelect, 1, f3_offset + 16,
   1310                                16);
   1311     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1312                                _bcmFieldSliceSelFpf3, 1,
   1313                                _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 16,
   1314                                16);
   1315 
   1316     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1317                  _bcmFieldSliceSelFpf3, 3, f3_offset + 8, 16);
   1318     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1319                  _bcmFieldSliceSelFpf3, 3, f3_offset + 8, 12);
   1320     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1321                  _bcmFieldSliceSelFpf3, 3, f3_offset + 20, 1);
   1322     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1323                  _bcmFieldSliceSelFpf3, 3, f3_offset + 21, 3);
   1324     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   1325                  _bcmFieldSliceSelFpf3, 3, f3_offset + 24, 8);
   1326 
   1327     /* DWF2 */
   1328     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   1329                             _bcmFieldSliceSelFpf2, 0,
   1330                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 40,
   1331                             16);
   1332     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1333                             _bcmFieldSliceSelFpf2, 0,
   1334                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 40,
   1335                             16);
   1336     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyData1,
   1337                             _bcmFieldSliceSelFpf2, 2,
   1338                             _bcmFieldSliceSelDisable, 0,
   1339                             f2_offset, 128);
   1340 
   1341     /* DWF1 */
   1342     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1343                             _bcmFieldSliceSelFpf1, 0,
   1344                             _bcmFieldSliceIpHeaderSelect, 0, f1_offset + 24,
   1345                             16);
   1346 
   1347     return (BCM_E_NONE);
   1348 }
   1349 
   1350 
   1351 /*
   1352  * Function:
   1353  *     _field_sc960_egress_qualifiers_init
   1354  * Purpose:
   1355  *     Initialize device stage egress qaualifiers
   1356  *     select codes & offsets
   1357  * Parameters:
   1358  *     unit       - (IN) BCM device number.
   1359  *     stage_fc   - (IN) Field Processor stage control structure.
   1360  *
   1361  * Returns:
   1362  *     BCM_E_NONE
   1363  */
   1364 STATIC int
   1365 _field_sc960_egress_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1366 {
   1367     _FP_QUAL_DECL;
   1368     _key_fld_ = KEYf;
   1369 
   1370     /* Input parameters check. */
   1371     if (NULL == stage_fc) {
   1372         return (BCM_E_PARAM);
   1373     }
   1374 
   1375     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageEgress,
   1376                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1377 
   1378     /* EG_NEXT_HOP_CLASS_ID */
   1379     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   1380                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1381                                _bcmFieldSliceSelEgrDvpKey4, 0,
   1382                                1, 17);
   1383 
   1384     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   1385                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 18, 4);
   1386     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   1387                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 22, 2);
   1388     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   1389                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 24, 2);
   1390     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1391                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 26, 16);
   1392     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   1393                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 42, 48);
   1394     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1395                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 90, 48);
   1396     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
   1397                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 138, 1);
   1398     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1399                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 139, 1);
   1400     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1401                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 140, 1);
   1402     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1403                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 141, 16);
   1404     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1405                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 141, 1);
   1406     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1407                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 142, 3);
   1408     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1409                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 145, 12);
   1410     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1411                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 157, 7);
   1412     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1413                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 165, 1);
   1414     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1415                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 166, 16);
   1416     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1417                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 166, 12);
   1418     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1419                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 178, 1);
   1420     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1421                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 179, 3);
   1422     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1423                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 182, 2);
   1424     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1425                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 184, 1);
   1426     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1427                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 185, 8);
   1428     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1429                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1430                                _bcmFieldSliceSelEgrClassF4, 0,
   1431                                193, 13
   1432                                );
   1433     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1434                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1435                                _bcmFieldSliceSelEgrClassF4, 0,
   1436                                193, 13
   1437                                );
   1438     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1439                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1440                                _bcmFieldSliceSelEgrClassF4, 0,
   1441                                193, 13
   1442                                );
   1443     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   1444                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1445                                _bcmFieldSliceSelEgrClassF4, 0,
   1446                                193, 13
   1447                                );
   1448     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   1449                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1450                                _bcmFieldSliceSelEgrClassF4, 0,
   1451                                193, 13
   1452                                );
   1453     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1454                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1455                                _bcmFieldSliceSelEgrClassF4, 1,
   1456                                193, 7);
   1457     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyCpuQueue,
   1458                      _bcmFieldDevSelDisable, 0,
   1459                      _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1460                      _bcmFieldSliceSelEgrClassF4, 2,
   1461                      0,
   1462                      193, 6, /* CpuCos - 6 bits */
   1463                      16, 2,  /* Original - Data and Mask bits[5:4] */
   1464                      0, 0,
   1465                      0
   1466                      );
   1467     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   1468                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1469                                _bcmFieldSliceSelEgrClassF4, 0,
   1470                                193, 13
   1471                                );
   1472     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1473                                bcmFieldQualifyIngressInterfaceClassPort,
   1474                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1475                                _bcmFieldSliceSelEgrClassF4, 0,
   1476                                193, 13
   1477                                );
   1478     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1479                                bcmFieldQualifyIngressInterfaceClassVPort,
   1480                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1481                                _bcmFieldSliceSelEgrClassF4, 0,
   1482                                193, 13
   1483                                );
   1484     /* MDL */
   1485     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOamMdl,
   1486                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1487                                _bcmFieldSliceSelEgrMdlKey4, 1,
   1488                                206, 3);
   1489     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   1490                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 211, 12);
   1491 
   1492     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   1493                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 224, 2);
   1494 
   1495     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1496                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 226, 1);
   1497 
   1498     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   1499                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 1, 4);
   1500     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   1501                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 5, 2);
   1502     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1503                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 135, 1);
   1504     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1505                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 136, 1);
   1506     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1507                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 137, 12);
   1508     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1509                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 149, 7);
   1510     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1511                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 157, 1);
   1512     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1513                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 158, 16);
   1514     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1515                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 158, 12);
   1516     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1517                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 170, 1);
   1518     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1519                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 171, 3);
   1520     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1521                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 174, 2);
   1522     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1523                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 176, 1);
   1524     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1525                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 177, 8);
   1526     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1527                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 185, 7);
   1528     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1529                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   1530                                _bcmFieldSliceSelEgrClassF1, 0,
   1531                                197, 13
   1532                                );
   1533     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1534                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   1535                                _bcmFieldSliceSelEgrClassF1, 0,
   1536                                197, 13
   1537                                );
   1538     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1539                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   1540                                _bcmFieldSliceSelEgrClassF1, 0,
   1541                                197, 13
   1542                                );
   1543     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   1544                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   1545                                _bcmFieldSliceSelEgrClassF1, 0,
   1546                                197, 13
   1547                                );
   1548     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   1549                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   1550                                _bcmFieldSliceSelEgrClassF1, 0,
   1551                                197, 13
   1552                                );
   1553     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   1554                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   1555                                _bcmFieldSliceSelEgrClassF1, 0,
   1556                                197, 13
   1557                                );
   1558     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1559                                bcmFieldQualifyIngressInterfaceClassPort,
   1560                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   1561                                _bcmFieldSliceSelEgrClassF1, 0,
   1562                                197, 13
   1563                                );
   1564    _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1565                                bcmFieldQualifyIngressInterfaceClassVPort,
   1566                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   1567                                _bcmFieldSliceSelEgrClassF1, 0,
   1568                                197, 13
   1569                                );
   1570     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   1571                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 210, 12);
   1572 
   1573     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   1574                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 223, 2);
   1575 
   1576     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1577                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 225, 1);
   1578 
   1579     /* KEY1 without v4 specific fields. */
   1580     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   1581                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 1, 4);
   1582     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   1583                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 5, 2);
   1584     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1585                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 135, 1);
   1586     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1587                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 136, 1);
   1588     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1589                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 137, 12);
   1590     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1591                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 149, 7);
   1592     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1593                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 157, 1);
   1594     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1595                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 158, 16);
   1596     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1597                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 158, 12);
   1598     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1599                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 170, 1);
   1600     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1601                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 171, 3);
   1602     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1603                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 174, 2);
   1604     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1605                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 176, 1);
   1606     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1607                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 177, 8);
   1608     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1609                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 185, 7);
   1610     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1611                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   1612                                _bcmFieldSliceSelEgrClassF1, 0,
   1613                                197, 13
   1614                                );
   1615     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1616                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   1617                                _bcmFieldSliceSelEgrClassF1, 0,
   1618                                197, 13
   1619                                );
   1620     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1621                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   1622                                _bcmFieldSliceSelEgrClassF1, 0,
   1623                                197, 13
   1624                                );
   1625     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   1626                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   1627                                _bcmFieldSliceSelEgrClassF1, 0,
   1628                                197, 13
   1629                                );
   1630     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   1631                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   1632                                _bcmFieldSliceSelEgrClassF1, 0,
   1633                                197, 13
   1634                                );
   1635     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   1636                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   1637                                _bcmFieldSliceSelEgrClassF1, 0,
   1638                                197, 13
   1639                                );
   1640     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1641                                bcmFieldQualifyIngressInterfaceClassPort,
   1642                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   1643                                _bcmFieldSliceSelEgrClassF1, 0,
   1644                                197, 13
   1645                                );
   1646    _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1647                                bcmFieldQualifyIngressInterfaceClassVPort,
   1648                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   1649                                _bcmFieldSliceSelEgrClassF1, 0,
   1650                                197, 13
   1651                                );
   1652     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   1653                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 210, 12);
   1654 
   1655     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1656                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 145, 1);
   1657     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1658                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 146, 1);
   1659     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1660                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 147, 12);
   1661     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1662                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 159, 7);
   1663     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1664                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 167, 1);
   1665     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1666                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 168, 16);
   1667     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1668                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 168, 12);
   1669     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1670                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 180, 1);
   1671     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1672                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 181, 3);
   1673     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1674                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 184, 2);
   1675     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1676                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 186, 1);
   1677     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1678                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 187, 8);
   1679     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1680                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1681                                _bcmFieldSliceSelEgrClassF2, 0,
   1682                                195, 13
   1683                                );
   1684     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1685                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1686                                _bcmFieldSliceSelEgrClassF2, 0,
   1687                                195, 13
   1688                                );
   1689     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1690                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1691                                _bcmFieldSliceSelEgrClassF2, 0,
   1692                                195, 13
   1693                                );
   1694     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   1695                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1696                                _bcmFieldSliceSelEgrClassF2, 0,
   1697                                195, 13
   1698                                );
   1699     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   1700                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1701                                _bcmFieldSliceSelEgrClassF2, 0,
   1702                                195, 13
   1703                                );
   1704     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1705                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1706                                _bcmFieldSliceSelEgrClassF2, 3,
   1707                                195, 7
   1708                                );
   1709     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   1710                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1711                                _bcmFieldSliceSelEgrClassF2, 0,
   1712                                195, 13
   1713                                );
   1714     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1715                                bcmFieldQualifyIngressInterfaceClassPort,
   1716                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1717                                _bcmFieldSliceSelEgrClassF2, 0,
   1718                                195, 13
   1719                                );
   1720    _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1721                                bcmFieldQualifyIngressInterfaceClassVPort,
   1722                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1723                                _bcmFieldSliceSelEgrClassF2, 0,
   1724                                195, 13
   1725                                );
   1726     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   1727                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 213, 12);
   1728 
   1729     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   1730                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 226, 2);
   1731 
   1732     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1733                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 228, 1);
   1734 
   1735     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   1736                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 1, 4);
   1737     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   1738                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 5, 2);
   1739     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1740                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 216, 1);
   1741 
   1742 #if 0
   1743 /* FCOE EFP_KEY5 support is not enabled in SDK.
   1744 Uncomment this block when support is added */
   1745     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1746                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 126, 1);
   1747     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1748                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 127, 1);
   1749     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1750                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 128, 12);
   1751     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1752                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 140, 7);
   1753     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1754                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 148, 1);
   1755     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1756                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 149, 16);
   1757     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1758                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 149, 12);
   1759     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1760                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 161, 1);
   1761     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1762                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 162, 3);
   1763     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1764                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 165, 2);
   1765     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1766                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 167, 1);
   1767     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1768                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 168, 8);
   1769     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1770                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 176, 7);
   1771     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1772                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 183, 1);
   1773     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1774                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   1775                                _bcmFieldSliceSelEgrClassF1, 0,
   1776                                200, 13
   1777                                );
   1778     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1779                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   1780                                _bcmFieldSliceSelEgrClassF1, 0,
   1781                                200, 13
   1782                                );
   1783     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1784                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   1785                                _bcmFieldSliceSelEgrClassF1, 0,
   1786                                200, 13
   1787                                );
   1788     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   1789                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   1790                                _bcmFieldSliceSelEgrClassF1, 0,
   1791                                200, 13
   1792                                );
   1793     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   1794                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   1795                                _bcmFieldSliceSelEgrClassF1, 0,
   1796                                200, 13
   1797                                );
   1798     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   1799                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   1800                                _bcmFieldSliceSelEgrClassF1, 0,
   1801                                200, 13
   1802                                );
   1803     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressInterfaceClassPort,
   1804                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   1805                                _bcmFieldSliceSelEgrClassF1, 0,
   1806                                200, 13
   1807                                );
   1808    _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressInterfaceClassVPort,
   1809                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   1810                                _bcmFieldSliceSelEgrClassF1, 0,
   1811                                200, 13
   1812                                );
   1813 
   1814 
   1815     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   1816                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 198, 2);
   1817 #endif
   1818  
   1819     return (BCM_E_NONE);
   1820 }
   1821 
   1822 /*
   1823  * Function:
   1824  *     _field_sc960_qualifiers_init
   1825  * Purpose:
   1826  *     Initialize device qaualifiers select codes & offsets
   1827  * Parameters:
   1828  *     unit       - (IN) BCM device number.
   1829  *     stage_fc   - (IN) Field Processor stage control structure.
   1830  *
   1831  * Returns:
   1832  *     BCM_E_NONE
   1833  * Notes:
   1834  */
   1835 STATIC int
   1836 _field_sc960_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1837 {
   1838     /* Allocated stage qualifiers configuration array. */
   1839     _FP_XGS3_ALLOC(stage_fc->f_qual_arr,
   1840                    (_bcmFieldQualifyCount * sizeof(_bcm_field_qual_info_t *)),
   1841                    "Field qualifiers");
   1842     if (stage_fc->f_qual_arr == 0) {
   1843         return (BCM_E_MEMORY);
   1844     }
   1845 
   1846     switch (stage_fc->stage_id) {
   1847         case _BCM_FIELD_STAGE_LOOKUP:
   1848             return (_field_sc960_lookup_qualifiers_init(unit, stage_fc));
   1849         case _BCM_FIELD_STAGE_INGRESS:
   1850             return (_field_sc960_ingress_qualifiers_init(unit, stage_fc));
   1851         case _BCM_FIELD_STAGE_EGRESS:
   1852             return (_field_sc960_egress_qualifiers_init(unit, stage_fc));
   1853         default:
   1854             ;
   1855     }
   1856 
   1857     sal_free(stage_fc->f_qual_arr);
   1858     return (BCM_E_INTERNAL);
   1859 }
   1860 
   1861 /*
   1862  * Function:
   1863  *     _field_td2_ingress_qualifiers_init
   1864  * Purpose:
   1865  *     Initialize device stage ingress qualifiers
   1866  *     select codes & offsets
   1867  * Parameters:
   1868  *     unit       - (IN) BCM device number.
   1869  *     stage_fc   - (IN) Field Processor stage control structure.
   1870  *
   1871  * Returns:
   1872  *     BCM_E_NONE
   1873  */
   1874 STATIC int
   1875 _field_td2_ingress_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1876 {
   1877     const unsigned
   1878         f2_offset = 10 - 2,
   1879         fixed_offset = 138 - 2,
   1880         fixed_pairing_overlay_offset = fixed_offset,
   1881         fp_global_mask_tcam_ofs = ALIGN32(soc_mem_field_length(unit, FP_TCAMm, KEYf)),
   1882         f3_offset = 2 - 2,
   1883         f1_offset = 51 - 2,
   1884         ipbm_pairing_f0_offset = 100 - 2;
   1885 
   1886     _FP_QUAL_DECL;
   1887 
   1888     /* Handled outside normal qualifier set/get scheme */
   1889 
   1890     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStage,
   1891                  _bcmFieldSliceSelDisable, 0,
   1892                  0, 0
   1893                  );
   1894     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageIngress,
   1895                  _bcmFieldSliceSelDisable, 0,
   1896                  0, 0
   1897                  );
   1898     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
   1899                  _bcmFieldSliceSelDisable, 0,
   1900                  0, 0
   1901                  );
   1902     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   1903                  _bcmFieldSliceSelDisable, 0,
   1904                  0, 0
   1905                  );
   1906     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1907                  _bcmFieldSliceSelDisable, 0,
   1908                  0, 0
   1909                  );
   1910     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPorts,
   1911                  _bcmFieldSliceSelDisable, 0,
   1912                  0, 0
   1913                  );
   1914     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNormalizeIpAddrs,
   1915                  _bcmFieldSliceSelDisable, 0,
   1916                  0, 0
   1917                  );
   1918     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNormalizeMacAddrs,
   1919                  _bcmFieldSliceSelDisable, 0,
   1920                  0, 0
   1921                  );
   1922 
   1923 /* FPF1 single wide */
   1924 /* Present in Global Mask Field */
   1925     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   1926                                _bcmFieldSliceSelFpf1, 0,
   1927                                _bcmFieldSliceDstClassSelect, 0,
   1928                                fp_global_mask_tcam_ofs + f1_offset, 10);
   1929     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   1930                                _bcmFieldSliceSelFpf1, 0,
   1931                                _bcmFieldSliceDstClassSelect, 1,
   1932                                fp_global_mask_tcam_ofs + f1_offset, 10);
   1933     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1934                                _bcmFieldSliceSelFpf1, 0,
   1935                                _bcmFieldSliceDstClassSelect, 2,
   1936                                fp_global_mask_tcam_ofs + f1_offset, 10);
   1937     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1938                                _bcmFieldSliceSelFpf1, 0,
   1939                                _bcmFieldSliceDstClassSelect, 3,
   1940                                fp_global_mask_tcam_ofs + f1_offset, 10);
   1941     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1942                                _bcmFieldSliceSelFpf1, 0,
   1943                                _bcmFieldSliceSrcClassSelect, 0,
   1944                                fp_global_mask_tcam_ofs + f1_offset + 10, 10);
   1945     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   1946                                _bcmFieldSliceSelFpf1, 0,
   1947                                _bcmFieldSliceSrcClassSelect, 1,
   1948                                fp_global_mask_tcam_ofs + f1_offset + 10, 10);
   1949     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1950                                _bcmFieldSliceSelFpf1, 0,
   1951                                _bcmFieldSliceSrcClassSelect, 2,
   1952                                fp_global_mask_tcam_ofs + f1_offset + 10, 10);
   1953     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1954                                _bcmFieldSliceSelFpf1, 0,
   1955                                _bcmFieldSliceSrcClassSelect, 3,
   1956                                fp_global_mask_tcam_ofs + f1_offset + 10, 10);
   1957     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   1958                                _bcmFieldSliceSelFpf1, 0,
   1959                                _bcmFieldSliceFwdFieldSelect,
   1960                                _bcmFieldFwdFieldVrf,
   1961                                fp_global_mask_tcam_ofs + f1_offset + 20, 13);
   1962     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   1963                                _bcmFieldSliceSelFpf1, 0,
   1964                                _bcmFieldSliceFwdFieldSelect,
   1965                                _bcmFieldFwdFieldVpn,
   1966                                fp_global_mask_tcam_ofs + f1_offset + 20, 13);
   1967     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   1968                                _bcmFieldSliceSelFpf1, 0,
   1969                                _bcmFieldSliceFwdFieldSelect,
   1970                                _bcmFieldFwdFieldVlan,
   1971                                fp_global_mask_tcam_ofs + f1_offset + 20, 13);
   1972     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   1973                                _bcmFieldSliceSelFpf1, 0,
   1974                                _bcmFieldSliceIngressEntitySelect,
   1975                                _bcmFieldFwdEntityMplsGport,
   1976                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   1977     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGports,
   1978                                _bcmFieldSliceSelFpf1, 0,
   1979                                _bcmFieldSliceIngressEntitySelect,
   1980                                _bcmFieldFwdEntityMplsGport,
   1981                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   1982     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcNivGport,
   1983                                _bcmFieldSliceSelFpf1, 0,
   1984                                _bcmFieldSliceIngressEntitySelect,
   1985                                _bcmFieldFwdEntityNivGport,
   1986                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   1987     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcNivGports,
   1988                                _bcmFieldSliceSelFpf1, 0,
   1989                                _bcmFieldSliceIngressEntitySelect,
   1990                                _bcmFieldFwdEntityNivGport,
   1991                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   1992     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   1993                                _bcmFieldSliceSelFpf1, 0,
   1994                                _bcmFieldSliceIngressEntitySelect,
   1995                                _bcmFieldFwdEntityMimGport,
   1996                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   1997     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGports,
   1998                                _bcmFieldSliceSelFpf1, 0,
   1999                                _bcmFieldSliceIngressEntitySelect,
   2000                                _bcmFieldFwdEntityMimGport,
   2001                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   2002     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGport,
   2003                                _bcmFieldSliceSelFpf1, 0,
   2004                                _bcmFieldSliceIngressEntitySelect,
   2005                                _bcmFieldFwdEntityVxlanGport,
   2006                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   2007     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGports,
   2008                                _bcmFieldSliceSelFpf1, 0,
   2009                                _bcmFieldSliceIngressEntitySelect,
   2010                                _bcmFieldFwdEntityVxlanGport,
   2011                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   2012     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   2013                                _bcmFieldSliceSelFpf1, 0,
   2014                                _bcmFieldSliceIngressEntitySelect,
   2015                                _bcmFieldFwdEntityVlanGport,
   2016                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   2017     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGports,
   2018                                _bcmFieldSliceSelFpf1, 0,
   2019                                _bcmFieldSliceIngressEntitySelect,
   2020                                _bcmFieldFwdEntityVlanGport,
   2021                                fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   2022     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   2023                                _bcmFieldSliceSelFpf1, 1,
   2024                                _bcmFieldSliceDstFwdEntitySelect,
   2025                                _bcmFieldFwdEntityGlp,
   2026                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2027     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   2028                                _bcmFieldSliceSelFpf1, 1,
   2029                                _bcmFieldSliceDstFwdEntitySelect,
   2030                                _bcmFieldFwdEntityGlp,
   2031                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2032     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   2033                                _bcmFieldSliceSelFpf1, 1,
   2034                                _bcmFieldSliceDstFwdEntitySelect,
   2035                                _bcmFieldFwdEntityMplsGport,
   2036                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2037     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGports,
   2038                                _bcmFieldSliceSelFpf1, 1,
   2039                                _bcmFieldSliceDstFwdEntitySelect,
   2040                                _bcmFieldFwdEntityMplsGport,
   2041                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2042     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGport,
   2043                                _bcmFieldSliceSelFpf1, 1,
   2044                                _bcmFieldSliceDstFwdEntitySelect,
   2045                                _bcmFieldFwdEntityNivGport,
   2046                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2047     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGports,
   2048                                _bcmFieldSliceSelFpf1, 1,
   2049                                _bcmFieldSliceDstFwdEntitySelect,
   2050                                _bcmFieldFwdEntityNivGport,
   2051                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2052     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   2053                                _bcmFieldSliceSelFpf1, 1,
   2054                                _bcmFieldSliceDstFwdEntitySelect,
   2055                                _bcmFieldFwdEntityMimGport,
   2056                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2057     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGports,
   2058                                _bcmFieldSliceSelFpf1, 1,
   2059                                _bcmFieldSliceDstFwdEntitySelect,
   2060                                _bcmFieldFwdEntityMimGport,
   2061                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2062     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGport,
   2063                                _bcmFieldSliceSelFpf1, 1,
   2064                                _bcmFieldSliceDstFwdEntitySelect,
   2065                                _bcmFieldFwdEntityVxlanGport,
   2066                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2067     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGports,
   2068                                _bcmFieldSliceSelFpf1, 1,
   2069                                _bcmFieldSliceDstFwdEntitySelect,
   2070                                _bcmFieldFwdEntityVxlanGport,
   2071                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2072     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   2073                                _bcmFieldSliceSelFpf1, 1,
   2074                                _bcmFieldSliceDstFwdEntitySelect,
   2075                                _bcmFieldFwdEntityVlanGport,
   2076                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2077     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGports,
   2078                                _bcmFieldSliceSelFpf1, 1,
   2079                                _bcmFieldSliceDstFwdEntitySelect,
   2080                                _bcmFieldFwdEntityVlanGport,
   2081                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2082     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   2083                                _bcmFieldSliceSelFpf1, 1,
   2084                                _bcmFieldSliceDstFwdEntitySelect,
   2085                                _bcmFieldFwdEntityL3Egress,
   2086                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2087     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
   2088                                _bcmFieldSliceSelFpf1, 1,
   2089                                _bcmFieldSliceDstFwdEntitySelect,
   2090                                _bcmFieldFwdEntityL3Egress,
   2091                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2092     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   2093                                _bcmFieldSliceSelFpf1, 1,
   2094                                _bcmFieldSliceDstFwdEntitySelect,
   2095                                _bcmFieldFwdEntityMulticastGroup,
   2096                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2097     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroups,
   2098                                _bcmFieldSliceSelFpf1, 1,
   2099                                _bcmFieldSliceDstFwdEntitySelect,
   2100                                _bcmFieldFwdEntityMulticastGroup,
   2101                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2102     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
   2103                                _bcmFieldSliceSelFpf1, 1,
   2104                                _bcmFieldSliceDstFwdEntitySelect,
   2105                                _bcmFieldFwdEntityMultipath,
   2106                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2107     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   2108                                _bcmFieldSliceSelFpf1, 1,
   2109                                _bcmFieldSliceDstFwdEntitySelect,
   2110                                _bcmFieldFwdEntityCommonGport,
   2111                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2112     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGports,
   2113                                _bcmFieldSliceSelFpf1, 1,
   2114                                _bcmFieldSliceDstFwdEntitySelect,
   2115                                _bcmFieldFwdEntityCommonGport,
   2116                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2117     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   2118                                _bcmFieldSliceSelFpf1, 1,
   2119                                _bcmFieldSliceIngressEntitySelect,
   2120                                _bcmFieldFwdEntityGlp,
   2121                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2122     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   2123                                _bcmFieldSliceSelFpf1, 1,
   2124                                _bcmFieldSliceIngressEntitySelect,
   2125                                _bcmFieldFwdEntityGlp,
   2126                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2127     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   2128                                _bcmFieldSliceSelFpf1, 1,
   2129                                _bcmFieldSliceIngressEntitySelect,
   2130                                _bcmFieldFwdEntityMplsGport,
   2131                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2132     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGports,
   2133                                _bcmFieldSliceSelFpf1, 1,
   2134                                _bcmFieldSliceIngressEntitySelect,
   2135                                _bcmFieldFwdEntityMplsGport,
   2136                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2137     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcNivGport,
   2138                                _bcmFieldSliceSelFpf1, 1,
   2139                                _bcmFieldSliceIngressEntitySelect,
   2140                                _bcmFieldFwdEntityNivGport,
   2141                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2142     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcNivGports,
   2143                                _bcmFieldSliceSelFpf1, 1,
   2144                                _bcmFieldSliceIngressEntitySelect,
   2145                                _bcmFieldFwdEntityNivGport,
   2146                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2147     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   2148                                _bcmFieldSliceSelFpf1, 1,
   2149                                _bcmFieldSliceIngressEntitySelect,
   2150                                _bcmFieldFwdEntityMimGport,
   2151                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2152     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGports,
   2153                                _bcmFieldSliceSelFpf1, 1,
   2154                                _bcmFieldSliceIngressEntitySelect,
   2155                                _bcmFieldFwdEntityMimGport,
   2156                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2157     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGport,
   2158                                _bcmFieldSliceSelFpf1, 1,
   2159                                _bcmFieldSliceIngressEntitySelect,
   2160                                _bcmFieldFwdEntityVxlanGport,
   2161                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2162     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGports,
   2163                                _bcmFieldSliceSelFpf1, 1,
   2164                                _bcmFieldSliceIngressEntitySelect,
   2165                                _bcmFieldFwdEntityVxlanGport,
   2166                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2167     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   2168                                _bcmFieldSliceSelFpf1, 1,
   2169                                _bcmFieldSliceIngressEntitySelect,
   2170                                _bcmFieldFwdEntityVlanGport,
   2171                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2172     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGports,
   2173                                _bcmFieldSliceSelFpf1, 1,
   2174                                _bcmFieldSliceIngressEntitySelect,
   2175                                _bcmFieldFwdEntityVlanGport,
   2176                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2177     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   2178                                _bcmFieldSliceSelFpf1, 1,
   2179                                _bcmFieldSliceIngressEntitySelect,
   2180                                _bcmFieldFwdEntityModPortGport,
   2181                                fp_global_mask_tcam_ofs + f1_offset + 21, 15);
   2182     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGports,
   2183                                _bcmFieldSliceSelFpf1, 1,
   2184                                _bcmFieldSliceIngressEntitySelect,
   2185                                _bcmFieldFwdEntityModPortGport,
   2186                                fp_global_mask_tcam_ofs + f1_offset + 21, 15);
   2187     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport,
   2188                                _bcmFieldSliceSelFpf1, 1,
   2189                                _bcmFieldSliceIngressEntitySelect,
   2190                                _bcmFieldFwdEntityModPortGport,
   2191                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2192     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   2193                                _bcmFieldSliceSelFpf1, 1,
   2194                                _bcmFieldSliceIngressEntitySelect,
   2195                                _bcmFieldFwdEntityModPortGport,
   2196                                fp_global_mask_tcam_ofs + f1_offset + 28, 8);
   2197     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
   2198                                _bcmFieldSliceSelFpf1, 1,
   2199                                _bcmFieldSliceIngressEntitySelect,
   2200                                _bcmFieldFwdEntityCommonGport,
   2201                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2202     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGports,
   2203                                _bcmFieldSliceSelFpf1, 1,
   2204                                _bcmFieldSliceIngressEntitySelect,
   2205                                _bcmFieldFwdEntityCommonGport,
   2206                                fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2207     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
   2208                                _bcmFieldSliceSelFpf1, 1,
   2209                                _bcmFieldSliceIngressEntitySelect,
   2210                                _bcmFieldFwdEntityModPortGport,
   2211                                fp_global_mask_tcam_ofs + f1_offset + 28, 8);
   2212     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
   2213                  _bcmFieldSliceSelFpf1, 1,
   2214                  fp_global_mask_tcam_ofs + f1_offset + 37, 3);
   2215 
   2216 
   2217 
   2218     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   2219                                _bcmFieldSliceSelFpf1, 2,
   2220                                _bcmFieldSliceDstFwdEntitySelect,
   2221                                _bcmFieldFwdEntityGlp,
   2222                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2223     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   2224                                _bcmFieldSliceSelFpf1, 2,
   2225                                _bcmFieldSliceDstFwdEntitySelect,
   2226                                _bcmFieldFwdEntityGlp,
   2227                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2228     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   2229                                _bcmFieldSliceSelFpf1, 2,
   2230                                _bcmFieldSliceDstFwdEntitySelect,
   2231                                _bcmFieldFwdEntityMplsGport,
   2232                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2233     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGports,
   2234                                _bcmFieldSliceSelFpf1, 2,
   2235                                _bcmFieldSliceDstFwdEntitySelect,
   2236                                _bcmFieldFwdEntityMplsGport,
   2237                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2238     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGport,
   2239                                _bcmFieldSliceSelFpf1, 2,
   2240                                _bcmFieldSliceDstFwdEntitySelect,
   2241                                _bcmFieldFwdEntityNivGport,
   2242                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2243     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGports,
   2244                                _bcmFieldSliceSelFpf1, 2,
   2245                                _bcmFieldSliceDstFwdEntitySelect,
   2246                                _bcmFieldFwdEntityNivGport,
   2247                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2248     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   2249                                _bcmFieldSliceSelFpf1, 2,
   2250                                _bcmFieldSliceDstFwdEntitySelect,
   2251                                _bcmFieldFwdEntityMimGport,
   2252                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2253     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGports,
   2254                                _bcmFieldSliceSelFpf1, 2,
   2255                                _bcmFieldSliceDstFwdEntitySelect,
   2256                                _bcmFieldFwdEntityMimGport,
   2257                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2258     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGport,
   2259                                _bcmFieldSliceSelFpf1, 2,
   2260                                _bcmFieldSliceDstFwdEntitySelect,
   2261                                _bcmFieldFwdEntityVxlanGport,
   2262                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2263     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGports,
   2264                                _bcmFieldSliceSelFpf1, 2,
   2265                                _bcmFieldSliceDstFwdEntitySelect,
   2266                                _bcmFieldFwdEntityVxlanGport,
   2267                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2268     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   2269                                _bcmFieldSliceSelFpf1, 2,
   2270                                _bcmFieldSliceDstFwdEntitySelect,
   2271                                _bcmFieldFwdEntityVlanGport,
   2272                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2273     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGports,
   2274                                _bcmFieldSliceSelFpf1, 2,
   2275                                _bcmFieldSliceDstFwdEntitySelect,
   2276                                _bcmFieldFwdEntityVlanGport,
   2277                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2278     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   2279                                _bcmFieldSliceSelFpf1, 2,
   2280                                _bcmFieldSliceDstFwdEntitySelect,
   2281                                _bcmFieldFwdEntityCommonGport,
   2282                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2283     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGports,
   2284                                _bcmFieldSliceSelFpf1, 2,
   2285                                _bcmFieldSliceDstFwdEntitySelect,
   2286                                _bcmFieldFwdEntityCommonGport,
   2287                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2288     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   2289                                _bcmFieldSliceSelFpf1, 2,
   2290                                _bcmFieldSliceDstFwdEntitySelect,
   2291                                _bcmFieldFwdEntityL3Egress,
   2292                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2293     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2294                                bcmFieldQualifyDstL3EgressNextHops,
   2295                                _bcmFieldSliceSelFpf1, 2,
   2296                                _bcmFieldSliceDstFwdEntitySelect,
   2297                                _bcmFieldFwdEntityL3Egress,
   2298                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2299     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2300                                bcmFieldQualifyDstMulticastGroup,
   2301                                _bcmFieldSliceSelFpf1, 2,
   2302                                _bcmFieldSliceDstFwdEntitySelect,
   2303                                _bcmFieldFwdEntityMulticastGroup,
   2304                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2305     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2306                                bcmFieldQualifyDstMulticastGroups,
   2307                                _bcmFieldSliceSelFpf1, 2,
   2308                                _bcmFieldSliceDstFwdEntitySelect,
   2309                                _bcmFieldFwdEntityMulticastGroup,
   2310                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2311     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
   2312                                _bcmFieldSliceSelFpf1, 2,
   2313                                _bcmFieldSliceDstFwdEntitySelect,
   2314                                _bcmFieldFwdEntityMultipath,
   2315                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2316     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
   2317                  _bcmFieldSliceSelFpf1, 2,
   2318                  fp_global_mask_tcam_ofs + f1_offset + 21, 3);
   2319     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   2320                                _bcmFieldSliceSelFpf1, 2,
   2321                                _bcmFieldSliceDstClassSelect, 0,
   2322                                fp_global_mask_tcam_ofs + f1_offset + 24, 10);
   2323     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   2324                                _bcmFieldSliceSelFpf1, 2,
   2325                                _bcmFieldSliceDstClassSelect, 1,
   2326                                fp_global_mask_tcam_ofs + f1_offset + 24, 10);
   2327     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   2328                                _bcmFieldSliceSelFpf1, 2,
   2329                                _bcmFieldSliceDstClassSelect, 2,
   2330                                fp_global_mask_tcam_ofs + f1_offset + 24, 10);
   2331     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   2332                                _bcmFieldSliceSelFpf1, 2,
   2333                                _bcmFieldSliceDstClassSelect, 3,
   2334                                fp_global_mask_tcam_ofs + f1_offset + 24, 10);
   2335     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   2336                                _bcmFieldSliceSelFpf1, 2,
   2337                                _bcmFieldSliceSrcClassSelect, 0,
   2338                                fp_global_mask_tcam_ofs + f1_offset + 34, 10);
   2339     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   2340                                _bcmFieldSliceSelFpf1, 2,
   2341                                _bcmFieldSliceSrcClassSelect, 1,
   2342                                fp_global_mask_tcam_ofs + f1_offset + 34, 10);
   2343     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   2344                                _bcmFieldSliceSelFpf1, 2,
   2345                                _bcmFieldSliceSrcClassSelect, 2,
   2346                                fp_global_mask_tcam_ofs + f1_offset + 34, 10);
   2347     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   2348                                _bcmFieldSliceSelFpf1, 2,
   2349                                _bcmFieldSliceSrcClassSelect, 3,
   2350                                fp_global_mask_tcam_ofs + f1_offset + 34, 10);
   2351 
   2352 
   2353     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2354                  _bcmFieldSliceSelFpf1, 3,
   2355                  fp_global_mask_tcam_ofs + f1_offset, 16);
   2356     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2357                  _bcmFieldSliceSelFpf1, 3,
   2358                  fp_global_mask_tcam_ofs + f1_offset, 12);
   2359     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2360                  _bcmFieldSliceSelFpf1, 3,
   2361                  fp_global_mask_tcam_ofs + f1_offset + 12, 1);
   2362     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2363                  _bcmFieldSliceSelFpf1, 3,
   2364                  fp_global_mask_tcam_ofs + f1_offset + 13, 3);
   2365     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   2366                  _bcmFieldSliceSelFpf1, 3,
   2367                  fp_global_mask_tcam_ofs + f1_offset + 16, 16);
   2368     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   2369                  _bcmFieldSliceSelFpf1, 3,
   2370                  fp_global_mask_tcam_ofs + f1_offset + 16, 12);
   2371     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   2372                  _bcmFieldSliceSelFpf1, 3,
   2373                  fp_global_mask_tcam_ofs + f1_offset + 28, 1);
   2374     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   2375                  _bcmFieldSliceSelFpf1, 3,
   2376                  fp_global_mask_tcam_ofs + f1_offset + 29, 3);
   2377     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
   2378                  _bcmFieldSliceSelFpf1, 3,
   2379                  fp_global_mask_tcam_ofs + f1_offset + 32, 2);
   2380 
   2381 
   2382     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2383                  _bcmFieldSliceSelFpf1, 4,
   2384                  fp_global_mask_tcam_ofs + f1_offset, 16);
   2385     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2386                  _bcmFieldSliceSelFpf1, 4,
   2387                  fp_global_mask_tcam_ofs + f1_offset, 12);
   2388     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2389                  _bcmFieldSliceSelFpf1, 4,
   2390                  fp_global_mask_tcam_ofs + f1_offset + 12, 1);
   2391     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2392                  _bcmFieldSliceSelFpf1, 4,
   2393                  fp_global_mask_tcam_ofs + f1_offset + 13, 3);
   2394     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   2395                  _bcmFieldSliceSelFpf1, 4,
   2396                  fp_global_mask_tcam_ofs + f1_offset + 16, 16);
   2397     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter,
   2398                  _bcmFieldSliceSelFpf1, 4,
   2399                  fp_global_mask_tcam_ofs + f1_offset + 32, 3);
   2400     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner,
   2401                  _bcmFieldSliceSelFpf1, 4,
   2402                  fp_global_mask_tcam_ofs + f1_offset + 35, 3);
   2403 
   2404 
   2405     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
   2406                  _bcmFieldSliceSelFpf1, 5,
   2407                  fp_global_mask_tcam_ofs + f1_offset + 0, 3);
   2408     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
   2409                  _bcmFieldSliceSelFpf1, 5,
   2410                  fp_global_mask_tcam_ofs + f1_offset + 3, 1);
   2411     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
   2412                  _bcmFieldSliceSelFpf1, 5,
   2413                  fp_global_mask_tcam_ofs + f1_offset + 4, 2);
   2414     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
   2415                  _bcmFieldSliceSelFpf1, 5,
   2416                  fp_global_mask_tcam_ofs + f1_offset + 6, 1);
   2417     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
   2418                  _bcmFieldSliceSelFpf1, 5,
   2419                  fp_global_mask_tcam_ofs + f1_offset + 7, 1);
   2420     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
   2421                  _bcmFieldSliceSelFpf1, 5,
   2422                  fp_global_mask_tcam_ofs + f1_offset + 8, 1);
   2423     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
   2424                  _bcmFieldSliceSelFpf1, 5,
   2425                  fp_global_mask_tcam_ofs + f1_offset + 9, 1);
   2426     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
   2427                  _bcmFieldSliceSelFpf1, 5,
   2428                  fp_global_mask_tcam_ofs + f1_offset + 10, 1);
   2429     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
   2430                  _bcmFieldSliceSelFpf1, 5,
   2431                  fp_global_mask_tcam_ofs + f1_offset + 10, 1);
   2432     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
   2433                  _bcmFieldSliceSelFpf1, 5,
   2434                  fp_global_mask_tcam_ofs + f1_offset + 11, 1);
   2435     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
   2436                  _bcmFieldSliceSelFpf1, 5,
   2437                  fp_global_mask_tcam_ofs + f1_offset + 12, 1);
   2438     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
   2439                  _bcmFieldSliceSelFpf1, 5,
   2440                  fp_global_mask_tcam_ofs + f1_offset + 13, 1);
   2441     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
   2442                  _bcmFieldSliceSelFpf1, 5,
   2443                  fp_global_mask_tcam_ofs + f1_offset + 14, 1);
   2444     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit,
   2445                  _bcmFieldSliceSelFpf1, 5,
   2446                  fp_global_mask_tcam_ofs + f1_offset + 15, 1);
   2447     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit,
   2448                  _bcmFieldSliceSelFpf1, 5,
   2449                  fp_global_mask_tcam_ofs + f1_offset + 16, 1);
   2450     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit,
   2451                  _bcmFieldSliceSelFpf1, 5,
   2452                  fp_global_mask_tcam_ofs + f1_offset + 16, 1);
   2453     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit,
   2454                  _bcmFieldSliceSelFpf1, 5,
   2455                  fp_global_mask_tcam_ofs + f1_offset + 16, 1);
   2456     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit,
   2457                  _bcmFieldSliceSelFpf1, 5,
   2458                  fp_global_mask_tcam_ofs + f1_offset + 16, 1);
   2459     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit,
   2460                  _bcmFieldSliceSelFpf1, 5,
   2461                  fp_global_mask_tcam_ofs + f1_offset + 17, 1);
   2462     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit,
   2463                  _bcmFieldSliceSelFpf1, 5,
   2464                  fp_global_mask_tcam_ofs + f1_offset + 17, 1);
   2465     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit,
   2466                  _bcmFieldSliceSelFpf1, 5,
   2467                  fp_global_mask_tcam_ofs + f1_offset + 17, 1);
   2468     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit,
   2469                  _bcmFieldSliceSelFpf1, 5,
   2470                  fp_global_mask_tcam_ofs + f1_offset + 17, 1);
   2471     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
   2472                  _bcmFieldSliceSelFpf1, 5,
   2473                  fp_global_mask_tcam_ofs + f1_offset + 18, 1);
   2474 
   2475     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
   2476                  _bcmFieldSliceSelFpf1, 5,
   2477                  fp_global_mask_tcam_ofs + f1_offset + 20, 6);
   2478     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   2479                  _bcmFieldSliceSelFpf1, 5,
   2480                  fp_global_mask_tcam_ofs + f1_offset + 26, 16);
   2481     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   2482                  _bcmFieldSliceSelFpf1, 5,
   2483                  fp_global_mask_tcam_ofs + f1_offset + 26, 12);
   2484     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   2485                  _bcmFieldSliceSelFpf1, 5,
   2486                  fp_global_mask_tcam_ofs + f1_offset + 38, 1);
   2487     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   2488                  _bcmFieldSliceSelFpf1, 5,
   2489                  fp_global_mask_tcam_ofs + f1_offset + 39, 3);
   2490     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
   2491                  _bcmFieldSliceSelFpf1, 5,
   2492                  fp_global_mask_tcam_ofs + f1_offset + 42, 2);
   2493 
   2494 
   2495     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2496                  _bcmFieldSliceSelFpf1, 6,
   2497                  fp_global_mask_tcam_ofs + f1_offset, 16);
   2498     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2499                  _bcmFieldSliceSelFpf1, 6,
   2500                  fp_global_mask_tcam_ofs + f1_offset, 12);
   2501     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2502                  _bcmFieldSliceSelFpf1, 6,
   2503                  fp_global_mask_tcam_ofs + f1_offset + 12, 1);
   2504     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2505                  _bcmFieldSliceSelFpf1, 6,
   2506                  fp_global_mask_tcam_ofs + f1_offset + 13, 3);
   2507     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   2508                  _bcmFieldSliceSelFpf1, 6,
   2509                  fp_global_mask_tcam_ofs + f1_offset + 16, 2);
   2510     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   2511                  _bcmFieldSliceSelFpf1, 6,
   2512                  fp_global_mask_tcam_ofs + f1_offset + 18, 2);
   2513     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
   2514                  _bcmFieldSliceSelFpf1, 6,
   2515                  fp_global_mask_tcam_ofs + f1_offset + 20, 2);
   2516     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
   2517                  _bcmFieldSliceSelFpf1, 6,
   2518                  fp_global_mask_tcam_ofs + f1_offset + 22, 3);
   2519     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
   2520                  _bcmFieldSliceSelFpf1, 6,
   2521                  fp_global_mask_tcam_ofs + f1_offset + 25, 6);
   2522     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   2523                  _bcmFieldSliceSelFpf1, 6,
   2524                  fp_global_mask_tcam_ofs + f1_offset + 31, 2);
   2525     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   2526                  _bcmFieldSliceSelFpf1, 6,
   2527                  fp_global_mask_tcam_ofs + f1_offset + 33, 16);
   2528 
   2529 
   2530     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2531                  _bcmFieldSliceSelFpf1, 7,
   2532                  fp_global_mask_tcam_ofs + f1_offset, 16);
   2533     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2534                  _bcmFieldSliceSelFpf1, 7,
   2535                  fp_global_mask_tcam_ofs + f1_offset, 12);
   2536     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2537                  _bcmFieldSliceSelFpf1, 7,
   2538                  fp_global_mask_tcam_ofs + f1_offset + 12, 1);
   2539     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2540                  _bcmFieldSliceSelFpf1, 7,
   2541                  fp_global_mask_tcam_ofs + f1_offset + 13, 3);
   2542     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   2543                                _bcmFieldSliceSelFpf1, 7,
   2544                                _bcmFieldSliceSrcClassSelect, 0,
   2545                                 fp_global_mask_tcam_ofs + f1_offset + 16,
   2546                                10);
   2547     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   2548                                _bcmFieldSliceSelFpf1, 7,
   2549                                _bcmFieldSliceSrcClassSelect, 1,
   2550                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2551                                10);
   2552     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2553                                bcmFieldQualifyDstClassField,
   2554                                _bcmFieldSliceSelFpf1, 7,
   2555                                _bcmFieldSliceSrcClassSelect, 2,
   2556                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2557                                10);
   2558     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2559                                bcmFieldQualifySrcClassField,
   2560                                _bcmFieldSliceSelFpf1, 7,
   2561                                _bcmFieldSliceSrcClassSelect, 3,
   2562                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2563                                10);
   2564     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   2565                                _bcmFieldSliceSelFpf1, 7,
   2566                                _bcmFieldSliceFwdFieldSelect,
   2567                                _bcmFieldFwdFieldVrf,
   2568                                fp_global_mask_tcam_ofs + f1_offset + 26,
   2569                                13);
   2570     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   2571                                _bcmFieldSliceSelFpf1, 7,
   2572                                _bcmFieldSliceFwdFieldSelect,
   2573                                _bcmFieldFwdFieldVpn,
   2574                                fp_global_mask_tcam_ofs + f1_offset + 26,
   2575                                13);
   2576     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2577                                bcmFieldQualifyForwardingVlanId,
   2578                                _bcmFieldSliceSelFpf1, 7,
   2579                                _bcmFieldSliceFwdFieldSelect,
   2580                                _bcmFieldFwdFieldVlan,
   2581                                fp_global_mask_tcam_ofs + f1_offset + 26,
   2582                                13);
   2583     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyGenericAssociatedChannelLabelValid,
   2584                  _bcmFieldSliceSelFpf1, 7,
   2585                  fp_global_mask_tcam_ofs + f1_offset + 39, 1);
   2586     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid,
   2587                  _bcmFieldSliceSelFpf1, 7,
   2588                  fp_global_mask_tcam_ofs + f1_offset + 40, 1);
   2589 
   2590 #if 0
   2591 /* TBD.. NO MPLS HERE. But RAL,GAL */
   2592     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsOuterLabelPop,
   2593                  _bcmFieldSliceSelFpf1, 7,
   2594                  fp_global_mask_tcam_ofs + f1_offset + 39, 2);
   2595     _FP_QUAL_ADD(unit, stage_fc,
   2596                  bcmFieldQualifyMplsStationHitTunnelUnterminated,
   2597                  _bcmFieldSliceSelFpf1, 7,
   2598                  fp_global_mask_tcam_ofs + f1_offset + 39, 2);
   2599 #endif
   2600 
   2601 
   2602     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   2603                  _bcmFieldSliceSelFpf1, 8,
   2604                  fp_global_mask_tcam_ofs + f1_offset, 8);
   2605     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   2606                  _bcmFieldSliceSelFpf1, 8,
   2607                                _bcmFieldSliceTosClassSelect, 0,
   2608                                fp_global_mask_tcam_ofs + f1_offset + 8, 8);
   2609     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
   2610                                _bcmFieldSliceSelFpf1, 8,
   2611                                _bcmFieldSliceTosClassSelect, 0,
   2612                                fp_global_mask_tcam_ofs + f1_offset + 8, 8);
   2613     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
   2614                                _bcmFieldSliceSelFpf1, 8,
   2615                                _bcmFieldSliceTosClassSelect, 1,
   2616                  fp_global_mask_tcam_ofs + f1_offset + 8, 8);
   2617     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   2618                                _bcmFieldSliceSelFpf1, 8,
   2619                                _bcmFieldSliceSrcClassSelect, 0,
   2620                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2621                                10);
   2622     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   2623                                _bcmFieldSliceSelFpf1, 8,
   2624                                _bcmFieldSliceSrcClassSelect, 1,
   2625                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2626                                10);
   2627     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2628                                bcmFieldQualifyDstClassField,
   2629                                _bcmFieldSliceSelFpf1, 8,
   2630                                _bcmFieldSliceSrcClassSelect, 2,
   2631                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2632                                10);
   2633     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2634                                bcmFieldQualifySrcClassField,
   2635                                _bcmFieldSliceSelFpf1, 8,
   2636                                _bcmFieldSliceSrcClassSelect, 3,
   2637                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2638                                10);
   2639     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   2640                                _bcmFieldSliceSelFpf1, 8,
   2641                                _bcmFieldSliceFwdFieldSelect,
   2642                                _bcmFieldFwdFieldVrf,
   2643                                fp_global_mask_tcam_ofs + f1_offset + 26,
   2644                                13);
   2645     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   2646                                _bcmFieldSliceSelFpf1, 8,
   2647                                _bcmFieldSliceFwdFieldSelect,
   2648                                _bcmFieldFwdFieldVpn,
   2649                                fp_global_mask_tcam_ofs + f1_offset + 26,
   2650                                13);
   2651     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2652                                bcmFieldQualifyForwardingVlanId,
   2653                                _bcmFieldSliceSelFpf1, 8,
   2654                                _bcmFieldSliceFwdFieldSelect,
   2655                                _bcmFieldFwdFieldVlan,
   2656                                fp_global_mask_tcam_ofs + f1_offset + 26,
   2657                                13);
   2658     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpAddrsNormalized,
   2659                  _bcmFieldSliceSelFpf1, 8,
   2660                  fp_global_mask_tcam_ofs + f1_offset + 39, 1
   2661                  );
   2662     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized,
   2663                  _bcmFieldSliceSelFpf1, 8,
   2664                  fp_global_mask_tcam_ofs + f1_offset + 40, 1
   2665                  );
   2666     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNatSrcRealmId,
   2667                  _bcmFieldSliceSelFpf1, 8,
   2668                  fp_global_mask_tcam_ofs + f1_offset + 41, 2);
   2669     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNatDstRealmId,
   2670                  _bcmFieldSliceSelFpf1, 8,
   2671                  fp_global_mask_tcam_ofs + f1_offset + 43, 2);
   2672     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyNatNeeded,
   2673                  _bcmFieldSliceSelFpf1, 8,
   2674                  fp_global_mask_tcam_ofs + f1_offset + 45, 1);
   2675     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpError,
   2676                  _bcmFieldSliceSelFpf1, 8,
   2677                  fp_global_mask_tcam_ofs + f1_offset + 46, 1);
   2678     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIpLocal,
   2679                  _bcmFieldSliceSelFpf1, 8,
   2680                  fp_global_mask_tcam_ofs + f1_offset + 47, 1);
   2681 
   2682 
   2683     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData2,
   2684                  _bcmFieldSliceSelFpf1, 9,
   2685                  fp_global_mask_tcam_ofs + f1_offset, 32);
   2686     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyGenericAssociatedChannelLabelValid,
   2687                  _bcmFieldSliceSelFpf1, 9,
   2688                  fp_global_mask_tcam_ofs + f1_offset + 32, 1);
   2689     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid,
   2690                  _bcmFieldSliceSelFpf1, 9,
   2691                  fp_global_mask_tcam_ofs + f1_offset + 33, 1);
   2692     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress,
   2693                  _bcmFieldSliceSelFpf1, 9,
   2694                  fp_global_mask_tcam_ofs + f1_offset + 36 , 13);
   2695 
   2696     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   2697                                _bcmFieldSliceSelFpf1, 10,
   2698                                _bcmFieldSliceDstFwdEntitySelect,
   2699                                _bcmFieldFwdEntityGlp,
   2700                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2701     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   2702                                _bcmFieldSliceSelFpf1, 10,
   2703                                _bcmFieldSliceDstFwdEntitySelect,
   2704                                _bcmFieldFwdEntityGlp,
   2705                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2706     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2707                                bcmFieldQualifyDstMplsGport,
   2708                                _bcmFieldSliceSelFpf1, 10,
   2709                                _bcmFieldSliceDstFwdEntitySelect,
   2710                                _bcmFieldFwdEntityMplsGport,
   2711                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2712     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2713                                bcmFieldQualifyDstMplsGports,
   2714                                _bcmFieldSliceSelFpf1, 10,
   2715                                _bcmFieldSliceDstFwdEntitySelect,
   2716                                _bcmFieldFwdEntityMplsGport,
   2717                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2718     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2719                                bcmFieldQualifyDstNivGport,
   2720                                _bcmFieldSliceSelFpf1, 10,
   2721                                _bcmFieldSliceDstFwdEntitySelect,
   2722                                _bcmFieldFwdEntityNivGport,
   2723                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2724     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2725                                bcmFieldQualifyDstNivGports,
   2726                                _bcmFieldSliceSelFpf1, 10,
   2727                                _bcmFieldSliceDstFwdEntitySelect,
   2728                                _bcmFieldFwdEntityNivGport,
   2729                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2730     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2731                                bcmFieldQualifyDstMimGport,
   2732                                _bcmFieldSliceSelFpf1, 10,
   2733                                _bcmFieldSliceDstFwdEntitySelect,
   2734                                _bcmFieldFwdEntityMimGport,
   2735                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2736     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2737                                bcmFieldQualifyDstMimGports,
   2738                                _bcmFieldSliceSelFpf1, 10,
   2739                                _bcmFieldSliceDstFwdEntitySelect,
   2740                                _bcmFieldFwdEntityMimGport,
   2741                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2742     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2743                                bcmFieldQualifyDstVxlanGport,
   2744                                _bcmFieldSliceSelFpf1, 10,
   2745                                _bcmFieldSliceDstFwdEntitySelect,
   2746                                _bcmFieldFwdEntityVxlanGport,
   2747                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2748     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2749                                bcmFieldQualifyDstVxlanGports,
   2750                                _bcmFieldSliceSelFpf1, 10,
   2751                                _bcmFieldSliceDstFwdEntitySelect,
   2752                                _bcmFieldFwdEntityVxlanGport,
   2753                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2754     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2755                                bcmFieldQualifyDstVlanGport,
   2756                                _bcmFieldSliceSelFpf1, 10,
   2757                                _bcmFieldSliceDstFwdEntitySelect,
   2758                                _bcmFieldFwdEntityVlanGport,
   2759                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2760     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2761                                bcmFieldQualifyDstVlanGports,
   2762                                _bcmFieldSliceSelFpf1, 10,
   2763                                _bcmFieldSliceDstFwdEntitySelect,
   2764                                _bcmFieldFwdEntityVlanGport,
   2765                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2766     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   2767                                _bcmFieldSliceSelFpf1, 10,
   2768                                _bcmFieldSliceDstFwdEntitySelect,
   2769                                _bcmFieldFwdEntityCommonGport,
   2770                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2771     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGports,
   2772                                _bcmFieldSliceSelFpf1, 10,
   2773                                _bcmFieldSliceDstFwdEntitySelect,
   2774                                _bcmFieldFwdEntityCommonGport,
   2775                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2776 
   2777 
   2778     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   2779                                _bcmFieldSliceSelFpf1, 10,
   2780                                _bcmFieldSliceDstFwdEntitySelect,
   2781                                _bcmFieldFwdEntityL3Egress,
   2782                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2783     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2784                                bcmFieldQualifyDstL3EgressNextHops,
   2785                                _bcmFieldSliceSelFpf1, 10,
   2786                                _bcmFieldSliceDstFwdEntitySelect,
   2787                                _bcmFieldFwdEntityL3Egress,
   2788                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2789     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2790                                bcmFieldQualifyDstMulticastGroup,
   2791                                _bcmFieldSliceSelFpf1, 10,
   2792                                _bcmFieldSliceDstFwdEntitySelect,
   2793                                _bcmFieldFwdEntityMulticastGroup,
   2794                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2795     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2796                                bcmFieldQualifyDstMulticastGroups,
   2797                                _bcmFieldSliceSelFpf1, 10,
   2798                                _bcmFieldSliceDstFwdEntitySelect,
   2799                                _bcmFieldFwdEntityMulticastGroup,
   2800                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2801     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2802                                bcmFieldQualifyDstMultipath,
   2803                                _bcmFieldSliceSelFpf1, 10,
   2804                                _bcmFieldSliceDstFwdEntitySelect,
   2805                                _bcmFieldFwdEntityMultipath,
   2806                                fp_global_mask_tcam_ofs + f1_offset, 21);
   2807     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   2808                  _bcmFieldSliceSelFpf1, 10,
   2809                  fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2810     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   2811                  _bcmFieldSliceSelFpf1, 10,
   2812                  fp_global_mask_tcam_ofs + f1_offset + 21, 16);
   2813 
   2814 
   2815 
   2816     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   2817                  _bcmFieldSliceSelFpf1, 11,
   2818                  fp_global_mask_tcam_ofs + f1_offset, 16);
   2819     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   2820                  _bcmFieldSliceSelFpf1, 11,
   2821                  fp_global_mask_tcam_ofs + f1_offset, 16);
   2822     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   2823                  _bcmFieldSliceSelFpf1, 11,
   2824                  fp_global_mask_tcam_ofs + f1_offset, 15);
   2825     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGports,
   2826                  _bcmFieldSliceSelFpf1, 11,
   2827                  fp_global_mask_tcam_ofs + f1_offset, 15);
   2828     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   2829                  _bcmFieldSliceSelFpf1, 11,
   2830                  fp_global_mask_tcam_ofs + f1_offset + 7, 8);
   2831     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2832                                bcmFieldQualifySrcMplsGport,
   2833                                _bcmFieldSliceSelFpf1, 11,
   2834                                _bcmFieldSliceIngressEntitySelect,
   2835                                _bcmFieldFwdEntityMplsGport,
   2836                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2837                                16);
   2838     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2839                                bcmFieldQualifySrcMplsGports,
   2840                                _bcmFieldSliceSelFpf1, 11,
   2841                                _bcmFieldSliceIngressEntitySelect,
   2842                                _bcmFieldFwdEntityMplsGport,
   2843                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2844                                16);
   2845     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2846                                bcmFieldQualifySrcNivGport,
   2847                                _bcmFieldSliceSelFpf1, 11,
   2848                                _bcmFieldSliceIngressEntitySelect,
   2849                                _bcmFieldFwdEntityNivGport,
   2850                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2851                                16);
   2852     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2853                                bcmFieldQualifySrcNivGports,
   2854                                _bcmFieldSliceSelFpf1, 11,
   2855                                _bcmFieldSliceIngressEntitySelect,
   2856                                _bcmFieldFwdEntityNivGport,
   2857                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2858                                16);
   2859     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   2860                                _bcmFieldSliceSelFpf1, 11,
   2861                                _bcmFieldSliceIngressEntitySelect,
   2862                                _bcmFieldFwdEntityMimGport,
   2863                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2864                                16);
   2865     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGports,
   2866                                _bcmFieldSliceSelFpf1, 11,
   2867                                _bcmFieldSliceIngressEntitySelect,
   2868                                _bcmFieldFwdEntityMimGport,
   2869                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2870                                16);
   2871     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGport,
   2872                                _bcmFieldSliceSelFpf1, 11,
   2873                                _bcmFieldSliceIngressEntitySelect,
   2874                                _bcmFieldFwdEntityVxlanGport,
   2875                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2876                                16);
   2877     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGports,
   2878                                _bcmFieldSliceSelFpf1, 11,
   2879                                _bcmFieldSliceIngressEntitySelect,
   2880                                _bcmFieldFwdEntityVxlanGport,
   2881                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2882                                16);
   2883     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   2884                                _bcmFieldSliceSelFpf1, 11,
   2885                                _bcmFieldSliceIngressEntitySelect,
   2886                                _bcmFieldFwdEntityVlanGport,
   2887                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2888                                16);
   2889     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGports,
   2890                                _bcmFieldSliceSelFpf1, 11,
   2891                                _bcmFieldSliceIngressEntitySelect,
   2892                                _bcmFieldFwdEntityVlanGport,
   2893                                fp_global_mask_tcam_ofs + f1_offset + 16,
   2894                                16);
   2895     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   2896                        _bcmFieldSliceSelFpf1, 11,
   2897                        fp_global_mask_tcam_ofs + f1_offset + 32, 4);
   2898     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   2899                        _bcmFieldSliceSelFpf1, 11,
   2900                        fp_global_mask_tcam_ofs + f1_offset + 36, 2);
   2901 
   2902 
   2903     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2904                  _bcmFieldSliceSelFpf1, 12,
   2905                  fp_global_mask_tcam_ofs + f1_offset, 12);
   2906     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   2907                                _bcmFieldSliceSelFpf1, 12,
   2908                                _bcmFieldSliceSrcClassSelect, 0,
   2909                                fp_global_mask_tcam_ofs + f1_offset + 12,
   2910                                10);
   2911     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   2912                                _bcmFieldSliceSelFpf1, 12,
   2913                                _bcmFieldSliceSrcClassSelect, 1,
   2914                                fp_global_mask_tcam_ofs + f1_offset + 12,
   2915                                10);
   2916     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2917                                bcmFieldQualifyDstClassField,
   2918                                _bcmFieldSliceSelFpf1, 12,
   2919                                _bcmFieldSliceSrcClassSelect, 2,
   2920                                fp_global_mask_tcam_ofs + f1_offset + 12,
   2921                                10);
   2922     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2923                                bcmFieldQualifySrcClassField,
   2924                                _bcmFieldSliceSelFpf1, 12,
   2925                                _bcmFieldSliceSrcClassSelect, 3,
   2926                                fp_global_mask_tcam_ofs + f1_offset + 12,
   2927                                10);
   2928     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2929                                bcmFieldQualifySrcMplsGport,
   2930                                _bcmFieldSliceSelFpf1, 12,
   2931                                _bcmFieldSliceIngressEntitySelect,
   2932                                _bcmFieldFwdEntityMplsGport,
   2933                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2934                                16);
   2935     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2936                                bcmFieldQualifySrcMplsGports,
   2937                                _bcmFieldSliceSelFpf1, 12,
   2938                                _bcmFieldSliceIngressEntitySelect,
   2939                                _bcmFieldFwdEntityMplsGport,
   2940                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2941                                16);
   2942     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2943                                bcmFieldQualifySrcNivGport,
   2944                                _bcmFieldSliceSelFpf1, 12,
   2945                                _bcmFieldSliceIngressEntitySelect,
   2946                                _bcmFieldFwdEntityNivGport,
   2947                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2948                                16);
   2949     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2950                                bcmFieldQualifySrcNivGports,
   2951                                _bcmFieldSliceSelFpf1, 12,
   2952                                _bcmFieldSliceIngressEntitySelect,
   2953                                _bcmFieldFwdEntityNivGport,
   2954                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2955                                16);
   2956     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   2957                                _bcmFieldSliceSelFpf1, 12,
   2958                                _bcmFieldSliceIngressEntitySelect,
   2959                                _bcmFieldFwdEntityMimGport,
   2960                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2961                                16);
   2962     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGports,
   2963                                _bcmFieldSliceSelFpf1, 12,
   2964                                _bcmFieldSliceIngressEntitySelect,
   2965                                _bcmFieldFwdEntityMimGport,
   2966                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2967                                16);
   2968     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGport,
   2969                                _bcmFieldSliceSelFpf1, 12,
   2970                                _bcmFieldSliceIngressEntitySelect,
   2971                                _bcmFieldFwdEntityVxlanGport,
   2972                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2973                                16);
   2974     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGports,
   2975                                _bcmFieldSliceSelFpf1, 12,
   2976                                _bcmFieldSliceIngressEntitySelect,
   2977                                _bcmFieldFwdEntityVxlanGport,
   2978                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2979                                16);
   2980     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   2981                                _bcmFieldSliceSelFpf1, 12,
   2982                                _bcmFieldSliceIngressEntitySelect,
   2983                                _bcmFieldFwdEntityVlanGport,
   2984                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2985                                16);
   2986     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGports,
   2987                                _bcmFieldSliceSelFpf1, 12,
   2988                                _bcmFieldSliceIngressEntitySelect,
   2989                                _bcmFieldFwdEntityVlanGport,
   2990                                fp_global_mask_tcam_ofs + f1_offset + 22,
   2991                                16);
   2992     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   2993                                _bcmFieldSliceSelFpf1, 12,
   2994                                _bcmFieldSliceDstClassSelect, 0,
   2995                                fp_global_mask_tcam_ofs + f1_offset + 38,
   2996                                10);
   2997     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   2998                                _bcmFieldSliceSelFpf1, 12,
   2999                                _bcmFieldSliceDstClassSelect, 1,
   3000                                fp_global_mask_tcam_ofs + f1_offset + 38,
   3001                                10);
   3002     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3003                                bcmFieldQualifyDstClassField,
   3004                                _bcmFieldSliceSelFpf1, 12,
   3005                                _bcmFieldSliceDstClassSelect, 2,
   3006                                fp_global_mask_tcam_ofs + f1_offset + 38,
   3007                                10);
   3008     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3009                                bcmFieldQualifySrcClassField,
   3010                                _bcmFieldSliceSelFpf1, 12,
   3011                                _bcmFieldSliceDstClassSelect, 3,
   3012                                fp_global_mask_tcam_ofs + f1_offset + 38,
   3013                                10);
   3014 
   3015 
   3016     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid,
   3017                  _bcmFieldSliceSelFpf1, 13,
   3018                  fp_global_mask_tcam_ofs + f1_offset + 36, 1);
   3019 
   3020     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   3021                  _bcmFieldSliceSelFpf1, 13,
   3022                  fp_global_mask_tcam_ofs + f1_offset + 37, 4);
   3023 
   3024     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   3025                  _bcmFieldSliceSelFpf1, 13,
   3026                  fp_global_mask_tcam_ofs + f1_offset + 41, 2);
   3027 
   3028     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag,
   3029                                _bcmFieldSliceSelFpf1, 13,
   3030                                _bcmFieldSliceAuxTag1Select,
   3031                                _bcmFieldAuxTagVn,
   3032                                fp_global_mask_tcam_ofs + f1_offset, 33);
   3033     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag,
   3034                                _bcmFieldSliceSelFpf1, 13,
   3035                                _bcmFieldSliceAuxTag1Select,
   3036                                _bcmFieldAuxTagCn,
   3037                                fp_global_mask_tcam_ofs + f1_offset, 33);
   3038     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3039                                bcmFieldQualifyFabricQueueTag,
   3040                                _bcmFieldSliceSelFpf1, 13,
   3041                                _bcmFieldSliceAuxTag1Select,
   3042                                _bcmFieldAuxTagFabricQueue,
   3043                                fp_global_mask_tcam_ofs + f1_offset,
   3044                                33);
   3045     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabel,
   3046                                _bcmFieldSliceSelFpf1, 13,                       
   3047                                _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel,
   3048                                fp_global_mask_tcam_ofs + f1_offset, 33          
   3049                                );                                               
   3050     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelTtl,     
   3051                      _bcmFieldDevSelDisable, 0,                                 
   3052                      _bcmFieldSliceSelFpf1, 13,                                 
   3053                      _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel,
   3054                      0,                                                         
   3055                      fp_global_mask_tcam_ofs + f1_offset,      8,               
   3056                      fp_global_mask_tcam_ofs + f1_offset + 32, 1,               
   3057                      0,                         0,                              
   3058                      0                                                          
   3059                      );                                                         
   3060     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelBos,     
   3061                      _bcmFieldDevSelDisable, 0,                                 
   3062                      _bcmFieldSliceSelFpf1, 13,                                 
   3063                      _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel,
   3064                      0,                                                         
   3065                      fp_global_mask_tcam_ofs + f1_offset + 8,  1,               
   3066                      fp_global_mask_tcam_ofs + f1_offset + 32, 1,               
   3067                      0,                         0,                              
   3068                      0                                                          
   3069                      );                                                         
   3070     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelExp,     
   3071                      _bcmFieldDevSelDisable, 0,                                 
   3072                      _bcmFieldSliceSelFpf1, 13,                                 
   3073                      _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel,
   3074                      0,                                                         
   3075                      fp_global_mask_tcam_ofs + f1_offset + 9,  3,               
   3076                      fp_global_mask_tcam_ofs + f1_offset + 32, 1,               
   3077                      0,                         0,                              
   3078                      0                                                          
   3079                      );                                                         
   3080     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelId,
   3081                                _bcmFieldSliceSelFpf1, 13,                       
   3082                                _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsFwdingLabel,
   3083                                fp_global_mask_tcam_ofs + f1_offset + 12, 21     
   3084                                );                                               
   3085     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord,  
   3086                                _bcmFieldSliceSelFpf1, 13,                       
   3087                                _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagMplsCntlWord,
   3088                                fp_global_mask_tcam_ofs + f1_offset, 33          
   3089                                );                                               
   3090     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVxlanHeaderBits8_31,
   3091                                _bcmFieldSliceSelFpf1, 13,
   3092                                _bcmFieldSliceAuxTag1Select,
   3093                                _bcmFieldAuxTagVxlanReserved,
   3094                                fp_global_mask_tcam_ofs + f1_offset, 24);
   3095     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVxlanHeaderBits56_63,
   3096                                _bcmFieldSliceSelFpf1, 13,
   3097                                _bcmFieldSliceAuxTag1Select,
   3098                                _bcmFieldAuxTagVxlanReserved,
   3099                                fp_global_mask_tcam_ofs + f1_offset + 24, 8);
   3100     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVxlanNetworkId,
   3101                                _bcmFieldSliceSelFpf1, 13,
   3102                                _bcmFieldSliceAuxTag1Select,
   3103                                _bcmFieldAuxTagVxlanOrLLTag,
   3104                                fp_global_mask_tcam_ofs + f1_offset, 24);
   3105     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVxlanFlags,
   3106                                _bcmFieldSliceSelFpf1, 13,
   3107                                _bcmFieldSliceAuxTag1Select,
   3108                                _bcmFieldAuxTagVxlanOrLLTag,
   3109                                fp_global_mask_tcam_ofs + f1_offset + 24, 8);
   3110 
   3111     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper,
   3112                                _bcmFieldSliceSelFpf1, 13,
   3113                                _bcmFieldSliceAuxTag1Select,
   3114                                _bcmFieldAuxTagRtag7A,
   3115                                fp_global_mask_tcam_ofs + f1_offset + 16, 17);
   3116 
   3117     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper,
   3118                                _bcmFieldSliceSelFpf1, 13,
   3119                                _bcmFieldSliceAuxTag1Select,
   3120                                _bcmFieldAuxTagRtag7B,
   3121                                fp_global_mask_tcam_ofs + f1_offset + 16, 17);
   3122                                           
   3123     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower,
   3124                      _bcmFieldDevSelDisable, 0, 
   3125                      _bcmFieldSliceSelFpf1, 13,
   3126                      _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7A, 
   3127                      0,
   3128                      fp_global_mask_tcam_ofs + f1_offset, 16,  
   3129                      fp_global_mask_tcam_ofs + f1_offset + 32, 1,
   3130                      0, 0, 
   3131                      0); 
   3132 
   3133     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower,
   3134                      _bcmFieldDevSelDisable, 0,
   3135                      _bcmFieldSliceSelFpf1, 13,
   3136                      _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagRtag7B,
   3137                      0,
   3138                      fp_global_mask_tcam_ofs + f1_offset, 16,
   3139                      fp_global_mask_tcam_ofs + f1_offset + 32, 1,
   3140                      0, 0,
   3141                      0); 
   3142     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction,      
   3143                  _bcmFieldSliceSelFpf1, 13,                                     
   3144                  fp_global_mask_tcam_ofs + f1_offset + 33, 3                    
   3145                  );    
   3146     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized,
   3147                  _bcmFieldSliceSelFpf1, 14,
   3148                  fp_global_mask_tcam_ofs + f1_offset + 48, 1
   3149                  );
   3150     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   3151                  _bcmFieldSliceSelFpf1, 14, 
   3152                  fp_global_mask_tcam_ofs + f1_offset, 48
   3153                  );
   3154 
   3155     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   3156                  _bcmFieldSliceSelFpf1, 15,
   3157                  fp_global_mask_tcam_ofs + f1_offset, 8);
   3158     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   3159                  _bcmFieldSliceSelFpf1, 15,
   3160                  fp_global_mask_tcam_ofs + f1_offset + 8, 16);
   3161     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   3162                  _bcmFieldSliceSelFpf1, 15,
   3163                  fp_global_mask_tcam_ofs + f1_offset + 24, 16);
   3164     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   3165                  _bcmFieldSliceSelFpf1, 15,
   3166                  fp_global_mask_tcam_ofs + f1_offset + 24, 16);
   3167     /* L4_NORMALIZED */
   3168     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   3169                  _bcmFieldSliceSelFpf1, 15,
   3170                                _bcmFieldSliceTcpClassSelect, 0,
   3171                                fp_global_mask_tcam_ofs + f1_offset + 41, 6);
   3172     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
   3173                                _bcmFieldSliceSelFpf1, 15,
   3174                                _bcmFieldSliceTcpClassSelect, 0,
   3175                                fp_global_mask_tcam_ofs + f1_offset + 41, 6);
   3176     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
   3177                                _bcmFieldSliceSelFpf1, 15,
   3178                                _bcmFieldSliceTcpClassSelect, 1,
   3179                  fp_global_mask_tcam_ofs + f1_offset + 41, 6);
   3180     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   3181                  _bcmFieldSliceSelFpf1, 15,
   3182                  fp_global_mask_tcam_ofs + f1_offset + 47, 2);
   3183 
   3184 
   3185     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFcoeVersionIsZero,
   3186                  _bcmFieldSliceSelFpf1, 16,
   3187                  fp_global_mask_tcam_ofs + f1_offset, 1);
   3188     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFcoeSOF,
   3189                  _bcmFieldSliceSelFpf1, 16,
   3190                  fp_global_mask_tcam_ofs + f1_offset + 1, 8);
   3191     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanRCtl,
   3192                  _bcmFieldSliceSelFpf1, 16,
   3193                  fp_global_mask_tcam_ofs + f1_offset + 15, 8);
   3194     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTVersion,
   3195                  _bcmFieldSliceSelFpf1, 16,
   3196                  fp_global_mask_tcam_ofs + f1_offset + 23, 2);
   3197     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTHopCount,
   3198                  _bcmFieldSliceSelFpf1, 16,
   3199                  fp_global_mask_tcam_ofs + f1_offset + 25, 5);
   3200     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTVsanId,
   3201                  _bcmFieldSliceSelFpf1, 16,
   3202                  fp_global_mask_tcam_ofs + f1_offset + 30, 12);
   3203     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTVsanPri,
   3204                  _bcmFieldSliceSelFpf1, 16,
   3205                  fp_global_mask_tcam_ofs + f1_offset + 42, 3);
   3206     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanSrcFpmaCheck,
   3207                  _bcmFieldSliceSelFpf1, 16,
   3208                  fp_global_mask_tcam_ofs + f1_offset + 45, 1);
   3209     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanSrcBindCheck,
   3210                  _bcmFieldSliceSelFpf1, 16,
   3211                  fp_global_mask_tcam_ofs + f1_offset + 46, 1);
   3212     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanZoneCheck,
   3213                  _bcmFieldSliceSelFpf1, 16,
   3214                  fp_global_mask_tcam_ofs + f1_offset + 47, 2);
   3215     /* FPF2  single wide */
   3216 
   3217     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   3218                                _bcmFieldSliceSelFpf2, 0,
   3219                                _bcmFieldSliceTtlClassSelect, 0,
   3220                                 f2_offset, 8);
   3221     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
   3222                                _bcmFieldSliceSelFpf2, 0,
   3223                                _bcmFieldSliceTtlClassSelect, 0,
   3224                                 f2_offset, 8);
   3225     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
   3226                                _bcmFieldSliceSelFpf2, 0,
   3227                                _bcmFieldSliceTtlClassSelect, 1,
   3228                                 f2_offset, 8);
   3229     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   3230                                _bcmFieldSliceSelFpf2, 0,
   3231                                _bcmFieldSliceTcpClassSelect, 0,
   3232                                 f2_offset + 8, 6);
   3233     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
   3234                                _bcmFieldSliceSelFpf2, 0,
   3235                                _bcmFieldSliceTcpClassSelect, 0,
   3236                                 f2_offset + 8, 6);
   3237     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
   3238                                _bcmFieldSliceSelFpf2, 0,
   3239                                _bcmFieldSliceTcpClassSelect, 1,
   3240                                 f2_offset + 8, 6);
   3241     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFlags,
   3242                  _bcmFieldSliceSelFpf2, 0, f2_offset + 14, 2);
   3243     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   3244                                _bcmFieldSliceSelFpf2, 0,
   3245                                _bcmFieldSliceTosClassSelect, 0,
   3246                                 f2_offset + 16, 8);
   3247     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
   3248                                _bcmFieldSliceSelFpf2, 0,
   3249                                _bcmFieldSliceTosClassSelect, 0,
   3250                                 f2_offset + 16, 8);
   3251     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
   3252                                _bcmFieldSliceSelFpf2, 0,
   3253                                _bcmFieldSliceTosClassSelect, 1,
   3254                                 f2_offset + 16, 8);
   3255     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   3256                  _bcmFieldSliceSelFpf2, 0, f2_offset + 24, 16);
   3257     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   3258                  _bcmFieldSliceSelFpf2, 0, f2_offset + 40, 16);
   3259     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   3260                  _bcmFieldSliceSelFpf2, 0, f2_offset + 40, 16);
   3261     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   3262                  _bcmFieldSliceSelFpf2, 0, f2_offset + 56, 8);
   3263     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   3264                  _bcmFieldSliceSelFpf2, 0, f2_offset + 64, 32);
   3265     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   3266                  _bcmFieldSliceSelFpf2, 0, f2_offset + 96, 32);
   3267 
   3268     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   3269                                _bcmFieldSliceSelFpf2, 1,
   3270                                _bcmFieldSliceTtlClassSelect, 0,
   3271                                 f2_offset, 8);
   3272     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
   3273                                _bcmFieldSliceSelFpf2, 1,
   3274                                _bcmFieldSliceTtlClassSelect, 0,
   3275                                 f2_offset, 8);
   3276     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
   3277                                _bcmFieldSliceSelFpf2, 1,
   3278                                _bcmFieldSliceTtlClassSelect, 1,
   3279                                 f2_offset, 8);
   3280     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   3281                                _bcmFieldSliceSelFpf2, 1,
   3282                                _bcmFieldSliceTcpClassSelect, 0,
   3283                                 f2_offset + 8, 6);
   3284     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
   3285                                _bcmFieldSliceSelFpf2, 1,
   3286                                _bcmFieldSliceTcpClassSelect, 0,
   3287                                 f2_offset + 8, 6);
   3288     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
   3289                                _bcmFieldSliceSelFpf2, 1,
   3290                                _bcmFieldSliceTcpClassSelect, 1,
   3291                                 f2_offset + 8, 6);
   3292     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   3293                  _bcmFieldSliceSelFpf2, 1, f2_offset + 14, 2);
   3294     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   3295                                _bcmFieldSliceSelFpf2, 1,
   3296                                _bcmFieldSliceTosClassSelect, 0,
   3297                                 f2_offset + 16, 8);
   3298     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
   3299                                _bcmFieldSliceSelFpf2, 1,
   3300                                _bcmFieldSliceTosClassSelect, 0,
   3301                                 f2_offset + 16, 8);
   3302     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
   3303                                _bcmFieldSliceSelFpf2, 1,
   3304                                _bcmFieldSliceTosClassSelect, 1,
   3305                                 f2_offset + 16, 8);
   3306     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   3307                  _bcmFieldSliceSelFpf2, 1, f2_offset + 24, 16);
   3308     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   3309                  _bcmFieldSliceSelFpf2, 1, f2_offset + 40, 16);
   3310     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   3311                  _bcmFieldSliceSelFpf2, 1, f2_offset + 40, 16);
   3312     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   3313                  _bcmFieldSliceSelFpf2, 1, f2_offset + 56, 8);
   3314     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   3315                  _bcmFieldSliceSelFpf2, 1, f2_offset + 64, 32);
   3316     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   3317                  _bcmFieldSliceSelFpf2, 1, f2_offset + 96, 32);
   3318 
   3319     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   3320                  _bcmFieldSliceSelFpf2, 2, f2_offset, 128);
   3321     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   3322                  _bcmFieldSliceSelFpf2, 3, f2_offset, 128);
   3323     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   3324                                _bcmFieldSliceSelFpf2, 4,
   3325                                _bcmFieldSliceTtlClassSelect, 0,
   3326                                 f2_offset, 8);
   3327     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
   3328                                _bcmFieldSliceSelFpf2, 4,
   3329                                _bcmFieldSliceTtlClassSelect, 0,
   3330                                 f2_offset, 8);
   3331     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
   3332                                _bcmFieldSliceSelFpf2, 4,
   3333                                _bcmFieldSliceTtlClassSelect, 1,
   3334                                 f2_offset, 8);
   3335     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   3336                                _bcmFieldSliceSelFpf2, 4,
   3337                                _bcmFieldSliceTcpClassSelect, 0,
   3338                                 f2_offset + 8, 6);
   3339     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
   3340                                _bcmFieldSliceSelFpf2, 4,
   3341                                _bcmFieldSliceTcpClassSelect, 0,
   3342                                 f2_offset + 8, 6);
   3343     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
   3344                                _bcmFieldSliceSelFpf2, 4,
   3345                                _bcmFieldSliceTcpClassSelect, 1,
   3346                                 f2_offset + 8, 6);
   3347     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel,
   3348                  _bcmFieldSliceSelFpf2, 4, f2_offset + 14, 20);
   3349     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   3350                                _bcmFieldSliceSelFpf2, 4,
   3351                                _bcmFieldSliceTosClassSelect, 0,
   3352                                 f2_offset + 34, 8);
   3353     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
   3354                                _bcmFieldSliceSelFpf2, 4,
   3355                                _bcmFieldSliceTosClassSelect, 0,
   3356                                 f2_offset + 34, 8);
   3357     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
   3358                                _bcmFieldSliceSelFpf2, 4,
   3359                                _bcmFieldSliceTosClassSelect, 1,
   3360                                 f2_offset + 34, 8);
   3361     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   3362                  _bcmFieldSliceSelFpf2, 4, f2_offset + 42, 8);
   3363     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress,
   3364                  _bcmFieldSliceSelFpf2, 4, f2_offset + 50, 13);
   3365     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   3366                  _bcmFieldSliceSelFpf2, 4, f2_offset + 64, 64);
   3367 
   3368     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   3369                  _bcmFieldSliceSelFpf2, 5, f2_offset, 16);
   3370     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   3371                  _bcmFieldSliceSelFpf2, 5, f2_offset, 12);
   3372     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   3373                  _bcmFieldSliceSelFpf2, 5, f2_offset + 12, 1);
   3374     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   3375                  _bcmFieldSliceSelFpf2, 5, f2_offset + 13, 3);
   3376     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   3377                  _bcmFieldSliceSelFpf2, 5, f2_offset + 16, 16);
   3378     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   3379                  _bcmFieldSliceSelFpf2, 5, f2_offset + 32, 48);
   3380     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   3381                  _bcmFieldSliceSelFpf2, 5, f2_offset + 80, 48);
   3382 
   3383     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   3384                  _bcmFieldSliceSelFpf2, 6, f2_offset, 16);
   3385     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   3386                  _bcmFieldSliceSelFpf2, 6, f2_offset, 12);
   3387     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   3388                  _bcmFieldSliceSelFpf2, 6, f2_offset + 12, 1);
   3389     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   3390                  _bcmFieldSliceSelFpf2, 6, f2_offset + 13, 3);
   3391     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   3392                  _bcmFieldSliceSelFpf2, 6, f2_offset + 16, 16);
   3393     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   3394                  _bcmFieldSliceSelFpf2, 6, f2_offset + 32, 48);
   3395     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   3396                  _bcmFieldSliceSelFpf2, 6, f2_offset + 80, 32);
   3397 
   3398     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   3399                  _bcmFieldSliceSelFpf2, 7, f2_offset, 16);
   3400     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   3401                  _bcmFieldSliceSelFpf2, 7, f2_offset, 12);
   3402     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   3403                  _bcmFieldSliceSelFpf2, 7, f2_offset + 12, 1);
   3404     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   3405                  _bcmFieldSliceSelFpf2, 7, f2_offset + 13, 3);
   3406     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   3407                  _bcmFieldSliceSelFpf2, 7, f2_offset + 16, 16);
   3408     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   3409                                _bcmFieldSliceSelFpf2, 7,
   3410                                _bcmFieldSliceTtlClassSelect, 0,
   3411                                 f2_offset + 32, 8);
   3412     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
   3413                                _bcmFieldSliceSelFpf2, 7,
   3414                                _bcmFieldSliceTtlClassSelect, 0,
   3415                                 f2_offset + 32, 8);
   3416     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
   3417                                _bcmFieldSliceSelFpf2, 7,
   3418                                _bcmFieldSliceTtlClassSelect, 1,
   3419                                 f2_offset + 32, 8);
   3420     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   3421                  _bcmFieldSliceSelFpf2, 7, f2_offset + 40, 8);
   3422     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   3423                  _bcmFieldSliceSelFpf2, 7, f2_offset + 48, 32);
   3424     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   3425                  _bcmFieldSliceSelFpf2, 7, f2_offset + 80, 48);
   3426 
   3427     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0,
   3428                  _bcmFieldSliceSelFpf2, 8, f2_offset, 128);
   3429 
   3430     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1,
   3431                  _bcmFieldSliceSelFpf2, 9, f2_offset, 128);
   3432 
   3433     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
   3434                  _bcmFieldSliceSelFpf2, 10, f2_offset, 64);
   3435     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   3436                  _bcmFieldSliceSelFpf2, 10, f2_offset + 64, 64);
   3437 
   3438     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   3439                  _bcmFieldSliceSelFpf2, 11, f2_offset + 32, 48);
   3440     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   3441                  _bcmFieldSliceSelFpf2, 11, f2_offset + 80, 48);
   3442 
   3443 
   3444     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanDFCtl,
   3445                  _bcmFieldSliceSelFpf2, 12, f2_offset + 32, 8);
   3446     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanCSCtl,
   3447                  _bcmFieldSliceSelFpf2, 12, f2_offset + 40, 8);
   3448     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanFCtl,
   3449                  _bcmFieldSliceSelFpf2, 12, f2_offset + 48, 24);
   3450     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanType,
   3451                  _bcmFieldSliceSelFpf2, 12, f2_offset + 72, 8);
   3452     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanDstId,
   3453                  _bcmFieldSliceSelFpf2, 12, f2_offset + 80, 24);
   3454     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanSrcId,
   3455                  _bcmFieldSliceSelFpf2, 12, f2_offset + 104, 24);
   3456 /* FPF 3 */
   3457 /* Present in Global Mask Field */
   3458     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   3459                                _bcmFieldSliceSelFpf3, 0,
   3460                                _bcmFieldSliceDstClassSelect, 0,
   3461                                fp_global_mask_tcam_ofs + f3_offset, 10);
   3462     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   3463                                _bcmFieldSliceSelFpf3, 0,
   3464                                _bcmFieldSliceDstClassSelect, 1,
   3465                                fp_global_mask_tcam_ofs + f3_offset, 10);
   3466     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3467                                bcmFieldQualifyDstClassField,
   3468                                _bcmFieldSliceSelFpf3, 0,
   3469                                _bcmFieldSliceDstClassSelect, 2,
   3470                                fp_global_mask_tcam_ofs + f3_offset, 10);
   3471     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3472                                bcmFieldQualifySrcClassField,
   3473                                _bcmFieldSliceSelFpf3, 0,
   3474                                _bcmFieldSliceDstClassSelect, 3,
   3475                                fp_global_mask_tcam_ofs + f3_offset, 10);
   3476     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   3477                                _bcmFieldSliceSelFpf3, 0,
   3478                                _bcmFieldSliceSrcClassSelect, 0,
   3479                                fp_global_mask_tcam_ofs + f3_offset + 10, 10);
   3480     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   3481                                _bcmFieldSliceSelFpf3, 0,
   3482                                _bcmFieldSliceSrcClassSelect, 1,
   3483                                fp_global_mask_tcam_ofs + f3_offset + 10, 10);
   3484     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3485                                bcmFieldQualifyDstClassField,
   3486                                _bcmFieldSliceSelFpf3, 0,
   3487                                _bcmFieldSliceSrcClassSelect, 2,
   3488                                fp_global_mask_tcam_ofs + f3_offset + 10, 10);
   3489     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3490                                bcmFieldQualifySrcClassField,
   3491                                _bcmFieldSliceSelFpf3, 0,
   3492                                _bcmFieldSliceSrcClassSelect, 3,
   3493                                fp_global_mask_tcam_ofs + f3_offset + 10, 10);
   3494     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   3495                                _bcmFieldSliceSelFpf3, 0,
   3496                                _bcmFieldSliceFwdFieldSelect,
   3497                                _bcmFieldFwdFieldVrf,
   3498                                fp_global_mask_tcam_ofs + f3_offset + 20, 13);
   3499     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   3500                                _bcmFieldSliceSelFpf3, 0,
   3501                                _bcmFieldSliceFwdFieldSelect,
   3502                                _bcmFieldFwdFieldVpn,
   3503                                fp_global_mask_tcam_ofs + f3_offset + 20, 13);
   3504     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3505                                bcmFieldQualifyForwardingVlanId,
   3506                                _bcmFieldSliceSelFpf3, 0,
   3507                                _bcmFieldSliceFwdFieldSelect,
   3508                                _bcmFieldFwdFieldVlan,
   3509                                fp_global_mask_tcam_ofs + f3_offset + 20, 13);
   3510     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3511                                bcmFieldQualifySrcMplsGport,
   3512                                _bcmFieldSliceSelFpf3, 0,
   3513                                _bcmFieldSliceIngressEntitySelect,
   3514                                _bcmFieldFwdEntityMplsGport,
   3515                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3516     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3517                                bcmFieldQualifySrcMplsGports,
   3518                                _bcmFieldSliceSelFpf3, 0,
   3519                                _bcmFieldSliceIngressEntitySelect,
   3520                                _bcmFieldFwdEntityMplsGport,
   3521                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3522     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3523                                bcmFieldQualifySrcNivGport,
   3524                                _bcmFieldSliceSelFpf3, 0,
   3525                                _bcmFieldSliceIngressEntitySelect,
   3526                                _bcmFieldFwdEntityNivGport,
   3527                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3528     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3529                                bcmFieldQualifySrcNivGports,
   3530                                _bcmFieldSliceSelFpf3, 0,
   3531                                _bcmFieldSliceIngressEntitySelect,
   3532                                _bcmFieldFwdEntityNivGport,
   3533                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3534     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   3535                                _bcmFieldSliceSelFpf3, 0,
   3536                                _bcmFieldSliceIngressEntitySelect,
   3537                                _bcmFieldFwdEntityMimGport,
   3538                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3539     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGports,
   3540                                _bcmFieldSliceSelFpf3, 0,
   3541                                _bcmFieldSliceIngressEntitySelect,
   3542                                _bcmFieldFwdEntityMimGport,
   3543                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3544     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGport,
   3545                                _bcmFieldSliceSelFpf3, 0,
   3546                                _bcmFieldSliceIngressEntitySelect,
   3547                                _bcmFieldFwdEntityVxlanGport,
   3548                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3549     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGports,
   3550                                _bcmFieldSliceSelFpf3, 0,
   3551                                _bcmFieldSliceIngressEntitySelect,
   3552                                _bcmFieldFwdEntityVxlanGport,
   3553                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3554     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   3555                                _bcmFieldSliceSelFpf3, 0,
   3556                                _bcmFieldSliceIngressEntitySelect,
   3557                                _bcmFieldFwdEntityVlanGport,
   3558                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3559     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGports,
   3560                                _bcmFieldSliceSelFpf3, 0,
   3561                                _bcmFieldSliceIngressEntitySelect,
   3562                                _bcmFieldFwdEntityVlanGport,
   3563                                fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3564     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   3565                                _bcmFieldSliceSelFpf3, 1,
   3566                                _bcmFieldSliceSrcClassSelect, 0,
   3567                                fp_global_mask_tcam_ofs + f3_offset, 10);
   3568     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   3569                                _bcmFieldSliceSelFpf3, 1,
   3570                                _bcmFieldSliceSrcClassSelect, 1,
   3571                                fp_global_mask_tcam_ofs + f3_offset, 10);
   3572     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3573                                bcmFieldQualifyDstClassField,
   3574                                _bcmFieldSliceSelFpf3, 1,
   3575                                _bcmFieldSliceSrcClassSelect, 2,
   3576                                fp_global_mask_tcam_ofs + f3_offset, 10);
   3577     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3578                                bcmFieldQualifySrcClassField,
   3579                                _bcmFieldSliceSelFpf3, 1,
   3580                                _bcmFieldSliceSrcClassSelect, 3,
   3581                                fp_global_mask_tcam_ofs + f3_offset, 10);
   3582     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   3583                                _bcmFieldSliceSelFpf3, 1,
   3584                                _bcmFieldSliceFwdFieldSelect,
   3585                                _bcmFieldFwdFieldVrf,
   3586                                fp_global_mask_tcam_ofs + f3_offset + 10, 13);
   3587     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   3588                                _bcmFieldSliceSelFpf3, 1,
   3589                                _bcmFieldSliceFwdFieldSelect,
   3590                                _bcmFieldFwdFieldVpn,
   3591                                fp_global_mask_tcam_ofs + f3_offset + 10, 13);
   3592     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3593                                bcmFieldQualifyForwardingVlanId,
   3594                                _bcmFieldSliceSelFpf3, 1,
   3595                                _bcmFieldSliceFwdFieldSelect,
   3596                                _bcmFieldFwdFieldVlan,
   3597                                fp_global_mask_tcam_ofs + f3_offset + 10, 13);
   3598     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   3599                  _bcmFieldSliceSelFpf3, 1,
   3600                  fp_global_mask_tcam_ofs + f3_offset + 23, 12);
   3601 
   3602     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   3603                                _bcmFieldSliceSelFpf3, 1,
   3604                                _bcmFieldSliceDstClassSelect, 0,
   3605                                fp_global_mask_tcam_ofs + f3_offset + 35, 10);
   3606     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   3607                                _bcmFieldSliceSelFpf3, 1,
   3608                                _bcmFieldSliceDstClassSelect, 1,
   3609                                fp_global_mask_tcam_ofs + f3_offset + 35, 10);
   3610     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3611                                bcmFieldQualifyDstClassField,
   3612                                _bcmFieldSliceSelFpf3, 1,
   3613                                _bcmFieldSliceDstClassSelect, 2,
   3614                                fp_global_mask_tcam_ofs + f3_offset + 35, 10);
   3615     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3616                                bcmFieldQualifySrcClassField,
   3617                                _bcmFieldSliceSelFpf3, 1,
   3618                                _bcmFieldSliceDstClassSelect, 3,
   3619                                fp_global_mask_tcam_ofs + f3_offset + 35, 10);
   3620 #if 0
   3621 /* TOS_FN_LOW */
   3622 #endif
   3623 
   3624 
   3625     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   3626                                _bcmFieldSliceSelFpf3, 2,
   3627                                _bcmFieldSliceDstFwdEntitySelect,
   3628                                _bcmFieldFwdEntityGlp,
   3629                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3630     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   3631                                _bcmFieldSliceSelFpf3, 2,
   3632                                _bcmFieldSliceDstFwdEntitySelect,
   3633                                _bcmFieldFwdEntityGlp,
   3634                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3635     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3636                                bcmFieldQualifyDstMplsGport,
   3637                                _bcmFieldSliceSelFpf3, 2,
   3638                                _bcmFieldSliceDstFwdEntitySelect,
   3639                                _bcmFieldFwdEntityMplsGport,
   3640                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3641     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3642                                bcmFieldQualifyDstMplsGports,
   3643                                _bcmFieldSliceSelFpf3, 2,
   3644                                _bcmFieldSliceDstFwdEntitySelect,
   3645                                _bcmFieldFwdEntityMplsGport,
   3646                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3647     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3648                                bcmFieldQualifyDstNivGport,
   3649                                _bcmFieldSliceSelFpf3, 2,
   3650                                _bcmFieldSliceDstFwdEntitySelect,
   3651                                _bcmFieldFwdEntityNivGport,
   3652                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3653     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3654                                bcmFieldQualifyDstNivGports,
   3655                                _bcmFieldSliceSelFpf3, 2,
   3656                                _bcmFieldSliceDstFwdEntitySelect,
   3657                                _bcmFieldFwdEntityNivGport,
   3658                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3659     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3660                                bcmFieldQualifyDstMimGport,
   3661                                _bcmFieldSliceSelFpf3, 2,
   3662                                _bcmFieldSliceDstFwdEntitySelect,
   3663                                _bcmFieldFwdEntityMimGport,
   3664                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3665     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3666                                bcmFieldQualifyDstMimGports,
   3667                                _bcmFieldSliceSelFpf3, 2,
   3668                                _bcmFieldSliceDstFwdEntitySelect,
   3669                                _bcmFieldFwdEntityMimGport,
   3670                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3671     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3672                                bcmFieldQualifyDstVxlanGport,
   3673                                _bcmFieldSliceSelFpf3, 2,
   3674                                _bcmFieldSliceDstFwdEntitySelect,
   3675                                _bcmFieldFwdEntityVxlanGport,
   3676                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3677     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3678                                bcmFieldQualifyDstVxlanGports,
   3679                                _bcmFieldSliceSelFpf3, 2,
   3680                                _bcmFieldSliceDstFwdEntitySelect,
   3681                                _bcmFieldFwdEntityVxlanGport,
   3682                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3683     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3684                                bcmFieldQualifyDstVlanGport,
   3685                                _bcmFieldSliceSelFpf3, 2,
   3686                                _bcmFieldSliceDstFwdEntitySelect,
   3687                                _bcmFieldFwdEntityVlanGport,
   3688                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3689     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3690                                bcmFieldQualifyDstVlanGports,
   3691                                _bcmFieldSliceSelFpf3, 2,
   3692                                _bcmFieldSliceDstFwdEntitySelect,
   3693                                _bcmFieldFwdEntityVlanGport,
   3694                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3695     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   3696                                _bcmFieldSliceSelFpf3, 2,
   3697                                _bcmFieldSliceDstFwdEntitySelect,
   3698                                _bcmFieldFwdEntityCommonGport,
   3699                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3700     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGports,
   3701                                _bcmFieldSliceSelFpf3, 2,
   3702                                _bcmFieldSliceDstFwdEntitySelect,
   3703                                _bcmFieldFwdEntityCommonGport,
   3704                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3705     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3706                                bcmFieldQualifyDstL3Egress,
   3707                                _bcmFieldSliceSelFpf3, 2,
   3708                                _bcmFieldSliceDstFwdEntitySelect,
   3709                                _bcmFieldFwdEntityL3Egress,
   3710                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3711     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3712                                bcmFieldQualifyDstL3EgressNextHops,
   3713                                _bcmFieldSliceSelFpf3, 2,
   3714                                _bcmFieldSliceDstFwdEntitySelect,
   3715                                _bcmFieldFwdEntityL3Egress,
   3716                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3717     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3718                                bcmFieldQualifyDstMulticastGroup,
   3719                                _bcmFieldSliceSelFpf3, 2,
   3720                                _bcmFieldSliceDstFwdEntitySelect,
   3721                                _bcmFieldFwdEntityMulticastGroup,
   3722                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3723     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3724                                bcmFieldQualifyDstMulticastGroups,
   3725                                _bcmFieldSliceSelFpf3, 2,
   3726                                _bcmFieldSliceDstFwdEntitySelect,
   3727                                _bcmFieldFwdEntityMulticastGroup,
   3728                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3729     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3730                                bcmFieldQualifyDstMultipath,
   3731                                _bcmFieldSliceSelFpf3, 2,
   3732                                _bcmFieldSliceDstFwdEntitySelect,
   3733                                _bcmFieldFwdEntityMultipath,
   3734                                fp_global_mask_tcam_ofs + f3_offset, 21);
   3735     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   3736                                _bcmFieldSliceSelFpf3, 2,
   3737                                _bcmFieldSliceIngressEntitySelect,
   3738                                _bcmFieldFwdEntityGlp,
   3739                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3740     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   3741                                _bcmFieldSliceSelFpf3, 2,
   3742                                _bcmFieldSliceIngressEntitySelect,
   3743                                _bcmFieldFwdEntityGlp,
   3744                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3745     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3746                                bcmFieldQualifySrcMplsGport,
   3747                                _bcmFieldSliceSelFpf3, 2,
   3748                                _bcmFieldSliceIngressEntitySelect,
   3749                                _bcmFieldFwdEntityMplsGport,
   3750                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3751     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3752                                bcmFieldQualifySrcMplsGports,
   3753                                _bcmFieldSliceSelFpf3, 2,
   3754                                _bcmFieldSliceIngressEntitySelect,
   3755                                _bcmFieldFwdEntityMplsGport,
   3756                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3757     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3758                                bcmFieldQualifySrcNivGport,
   3759                                _bcmFieldSliceSelFpf3, 2,
   3760                                _bcmFieldSliceIngressEntitySelect,
   3761                                _bcmFieldFwdEntityNivGport,
   3762                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3763     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   3764                                bcmFieldQualifySrcNivGports,
   3765                                _bcmFieldSliceSelFpf3, 2,
   3766                                _bcmFieldSliceIngressEntitySelect,
   3767                                _bcmFieldFwdEntityNivGport,
   3768                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3769     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   3770                                _bcmFieldSliceSelFpf3, 2,
   3771                                _bcmFieldSliceIngressEntitySelect,
   3772                                _bcmFieldFwdEntityMimGport,
   3773                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3774     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGports,
   3775                                _bcmFieldSliceSelFpf3, 2,
   3776                                _bcmFieldSliceIngressEntitySelect,
   3777                                _bcmFieldFwdEntityMimGport,
   3778                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3779     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGport,
   3780                                _bcmFieldSliceSelFpf3, 2,
   3781                                _bcmFieldSliceIngressEntitySelect,
   3782                                _bcmFieldFwdEntityVxlanGport,
   3783                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3784     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGports,
   3785                                _bcmFieldSliceSelFpf3, 2,
   3786                                _bcmFieldSliceIngressEntitySelect,
   3787                                _bcmFieldFwdEntityVxlanGport,
   3788                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3789     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   3790                                _bcmFieldSliceSelFpf3, 2,
   3791                                _bcmFieldSliceIngressEntitySelect,
   3792                                _bcmFieldFwdEntityVlanGport,
   3793                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3794     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGports,
   3795                                _bcmFieldSliceSelFpf3, 2,
   3796                                _bcmFieldSliceIngressEntitySelect,
   3797                                _bcmFieldFwdEntityVlanGport,
   3798                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3799     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   3800                                _bcmFieldSliceSelFpf3, 2,
   3801                                _bcmFieldSliceIngressEntitySelect,
   3802                                _bcmFieldFwdEntityModPortGport,
   3803                                fp_global_mask_tcam_ofs + f3_offset + 21, 15);
   3804     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGports,
   3805                                _bcmFieldSliceSelFpf3, 2,
   3806                                _bcmFieldSliceIngressEntitySelect,
   3807                                _bcmFieldFwdEntityModPortGport,
   3808                                fp_global_mask_tcam_ofs + f3_offset + 21, 15);
   3809     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport,
   3810                                _bcmFieldSliceSelFpf3, 2,
   3811                                _bcmFieldSliceIngressEntitySelect,
   3812                                _bcmFieldFwdEntityModPortGport,
   3813                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3814     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   3815                                _bcmFieldSliceSelFpf3, 2,
   3816                                _bcmFieldSliceIngressEntitySelect,
   3817                                _bcmFieldFwdEntityModPortGport,
   3818                                fp_global_mask_tcam_ofs + f3_offset + 28, 8);
   3819     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
   3820                                _bcmFieldSliceSelFpf3, 2,
   3821                                 _bcmFieldSliceIngressEntitySelect,
   3822                                _bcmFieldFwdEntityCommonGport,
   3823                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3824     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGports,
   3825                                _bcmFieldSliceSelFpf3, 2,
   3826                                 _bcmFieldSliceIngressEntitySelect,
   3827                                _bcmFieldFwdEntityCommonGport,
   3828                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   3829     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
   3830                                _bcmFieldSliceSelFpf3, 2,
   3831                                _bcmFieldSliceIngressEntitySelect,
   3832                                _bcmFieldFwdEntityModPortGport,
   3833                                fp_global_mask_tcam_ofs + f3_offset + 28, 8);
   3834     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
   3835                  _bcmFieldSliceSelFpf3, 2,
   3836                  fp_global_mask_tcam_ofs + f3_offset + 37, 3);
   3837 
   3838     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   3839                  _bcmFieldSliceSelFpf3, 3,
   3840                  fp_global_mask_tcam_ofs + f3_offset, 16);
   3841     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   3842                  _bcmFieldSliceSelFpf3, 3,
   3843                  fp_global_mask_tcam_ofs + f3_offset, 12);
   3844     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   3845                  _bcmFieldSliceSelFpf3, 3,
   3846                  fp_global_mask_tcam_ofs + f3_offset + 12, 1);
   3847     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   3848                  _bcmFieldSliceSelFpf3, 3,
   3849                  fp_global_mask_tcam_ofs + f3_offset + 13, 3);
   3850     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   3851                  _bcmFieldSliceSelFpf3, 3,
   3852                  fp_global_mask_tcam_ofs + f3_offset + 16, 2);
   3853     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   3854                  _bcmFieldSliceSelFpf3, 3,
   3855                  fp_global_mask_tcam_ofs + f3_offset + 18, 2);
   3856     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
   3857                  _bcmFieldSliceSelFpf3, 3,
   3858                  fp_global_mask_tcam_ofs + f3_offset + 20, 2);
   3859     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
   3860                  _bcmFieldSliceSelFpf3, 3,
   3861                  fp_global_mask_tcam_ofs + f3_offset + 22, 3);
   3862     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
   3863                  _bcmFieldSliceSelFpf3, 3,
   3864                  fp_global_mask_tcam_ofs + f3_offset + 25, 6);
   3865     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   3866                  _bcmFieldSliceSelFpf3, 3,
   3867                  fp_global_mask_tcam_ofs + f3_offset + 31, 2);
   3868     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   3869                  _bcmFieldSliceSelFpf3, 3,
   3870                  fp_global_mask_tcam_ofs + f3_offset + 33, 16);
   3871 
   3872     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   3873                  _bcmFieldSliceSelFpf3, 4,
   3874                  fp_global_mask_tcam_ofs + f3_offset, 16);
   3875     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   3876                  _bcmFieldSliceSelFpf3, 4,
   3877                  fp_global_mask_tcam_ofs + f3_offset, 12);
   3878     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   3879                  _bcmFieldSliceSelFpf3, 4,
   3880                  fp_global_mask_tcam_ofs + f3_offset + 12, 1);
   3881     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   3882                  _bcmFieldSliceSelFpf3, 4,
   3883                  fp_global_mask_tcam_ofs + f3_offset + 13, 3);
   3884     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   3885                  _bcmFieldSliceSelFpf3, 4,
   3886                  fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   3887     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   3888                  _bcmFieldSliceSelFpf3, 4,
   3889                  fp_global_mask_tcam_ofs + f3_offset + 16, 12);
   3890     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   3891                  _bcmFieldSliceSelFpf3, 4,
   3892                  fp_global_mask_tcam_ofs + f3_offset + 28, 1);
   3893     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   3894                  _bcmFieldSliceSelFpf3, 4,
   3895                  fp_global_mask_tcam_ofs + f3_offset + 29, 3);
   3896     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   3897                  _bcmFieldSliceSelFpf3, 4,
   3898                  fp_global_mask_tcam_ofs + f3_offset + 32, 4);
   3899     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   3900                  _bcmFieldSliceSelFpf3, 4,
   3901                  fp_global_mask_tcam_ofs + f3_offset + 36, 2);
   3902     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIpLocal,
   3903                  _bcmFieldSliceSelFpf3, 4,
   3904                  fp_global_mask_tcam_ofs + f3_offset + 38, 1);
   3905 
   3906 
   3907     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   3908                  _bcmFieldSliceSelFpf3, 5,
   3909                  fp_global_mask_tcam_ofs + f3_offset, 16);
   3910     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   3911                  _bcmFieldSliceSelFpf3, 5,
   3912                  fp_global_mask_tcam_ofs + f3_offset, 12);
   3913     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   3914                  _bcmFieldSliceSelFpf3, 5,
   3915                  fp_global_mask_tcam_ofs + f3_offset + 12, 1);
   3916     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   3917                  _bcmFieldSliceSelFpf3, 5,
   3918                  fp_global_mask_tcam_ofs + f3_offset + 13, 3);
   3919     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   3920                  _bcmFieldSliceSelFpf3, 5,
   3921                  fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   3922     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter,
   3923                  _bcmFieldSliceSelFpf3, 5,
   3924                  fp_global_mask_tcam_ofs + f3_offset + 32, 3);
   3925     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner,
   3926                  _bcmFieldSliceSelFpf3, 5,
   3927                  fp_global_mask_tcam_ofs + f3_offset + 35, 3);
   3928 
   3929 
   3930     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
   3931                  _bcmFieldSliceSelFpf3, 6,
   3932                  fp_global_mask_tcam_ofs + f3_offset + 0, 3);
   3933     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
   3934                  _bcmFieldSliceSelFpf3, 6,
   3935                  fp_global_mask_tcam_ofs + f3_offset + 3, 1);
   3936     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
   3937                  _bcmFieldSliceSelFpf3, 6,
   3938                  fp_global_mask_tcam_ofs + f3_offset + 4, 2);
   3939     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
   3940                  _bcmFieldSliceSelFpf3, 6,
   3941                  fp_global_mask_tcam_ofs + f3_offset + 6, 1);
   3942     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
   3943                  _bcmFieldSliceSelFpf3, 6,
   3944                  fp_global_mask_tcam_ofs + f3_offset + 7, 1);
   3945     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
   3946                  _bcmFieldSliceSelFpf3, 6,
   3947                  fp_global_mask_tcam_ofs + f3_offset + 8, 1);
   3948     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
   3949                  _bcmFieldSliceSelFpf3, 6,
   3950                  fp_global_mask_tcam_ofs + f3_offset + 9, 1);
   3951     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
   3952                  _bcmFieldSliceSelFpf3, 6,
   3953                  fp_global_mask_tcam_ofs + f3_offset + 10, 1);
   3954     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
   3955                  _bcmFieldSliceSelFpf3, 6,
   3956                  fp_global_mask_tcam_ofs + f3_offset + 10, 1);
   3957     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
   3958                  _bcmFieldSliceSelFpf3, 6,
   3959                  fp_global_mask_tcam_ofs + f3_offset + 11, 1);
   3960     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
   3961                  _bcmFieldSliceSelFpf3, 6,
   3962                  fp_global_mask_tcam_ofs + f3_offset + 12, 1);
   3963     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
   3964                  _bcmFieldSliceSelFpf3, 6,
   3965                  fp_global_mask_tcam_ofs + f3_offset + 13, 1);
   3966     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
   3967                  _bcmFieldSliceSelFpf3, 6,
   3968                  fp_global_mask_tcam_ofs + f3_offset + 14, 1);
   3969     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit,
   3970                  _bcmFieldSliceSelFpf3, 6,
   3971                  fp_global_mask_tcam_ofs + f3_offset + 15, 1);
   3972     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit,
   3973                  _bcmFieldSliceSelFpf3, 6,
   3974                  fp_global_mask_tcam_ofs + f3_offset + 16, 1);
   3975     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit,
   3976                  _bcmFieldSliceSelFpf3, 6,
   3977                  fp_global_mask_tcam_ofs + f3_offset + 16, 1);
   3978     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit,
   3979                  _bcmFieldSliceSelFpf3, 6,
   3980                  fp_global_mask_tcam_ofs + f3_offset + 16, 1);
   3981     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit,
   3982                  _bcmFieldSliceSelFpf3, 6,
   3983                  fp_global_mask_tcam_ofs + f3_offset + 16, 1);
   3984     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit,
   3985                  _bcmFieldSliceSelFpf3, 6,
   3986                  fp_global_mask_tcam_ofs + f3_offset + 17, 1);
   3987     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit,
   3988                  _bcmFieldSliceSelFpf3, 6,
   3989                  fp_global_mask_tcam_ofs + f3_offset + 17, 1);
   3990     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit,
   3991                  _bcmFieldSliceSelFpf3, 6,
   3992                  fp_global_mask_tcam_ofs + f3_offset + 17, 1);
   3993     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit,
   3994                  _bcmFieldSliceSelFpf3, 6,
   3995                  fp_global_mask_tcam_ofs + f3_offset + 17, 1);
   3996     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
   3997                  _bcmFieldSliceSelFpf3, 6,
   3998                  fp_global_mask_tcam_ofs + f3_offset + 18, 1);
   3999 
   4000     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
   4001                  _bcmFieldSliceSelFpf3, 6,
   4002                  fp_global_mask_tcam_ofs + f3_offset + 20, 6);
   4003     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   4004                  _bcmFieldSliceSelFpf3, 6,
   4005                  fp_global_mask_tcam_ofs + f3_offset + 26, 16);
   4006     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   4007                  _bcmFieldSliceSelFpf3, 6,
   4008                  fp_global_mask_tcam_ofs + f3_offset + 26, 12);
   4009     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   4010                  _bcmFieldSliceSelFpf3, 6,
   4011                  fp_global_mask_tcam_ofs + f3_offset + 38, 1);
   4012     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   4013                  _bcmFieldSliceSelFpf3, 6,
   4014                  fp_global_mask_tcam_ofs + f3_offset + 39, 3);
   4015 
   4016     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck,
   4017                  _bcmFieldSliceSelFpf3, 7,
   4018                  fp_global_mask_tcam_ofs + f3_offset, 24);
   4019     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31,
   4020                                _bcmFieldSliceSelFpf3, 7,
   4021                                _bcmFieldSliceIntfClassSelect, 3,
   4022                                fp_global_mask_tcam_ofs + f3_offset + 24, 8);
   4023     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   4024                                _bcmFieldSliceSelFpf3, 7,
   4025                                _bcmFieldSliceIntfClassSelect, 0,
   4026                                fp_global_mask_tcam_ofs + f3_offset + 24, 12);
   4027     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassVPort,
   4028                                _bcmFieldSliceSelFpf3, 7,
   4029                                _bcmFieldSliceIntfClassSelect, 1,
   4030                                fp_global_mask_tcam_ofs + f3_offset + 24, 12);
   4031     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   4032                                _bcmFieldSliceSelFpf3, 7,
   4033                                _bcmFieldSliceIntfClassSelect, 2,
   4034                                fp_global_mask_tcam_ofs + f3_offset + 24, 12);
   4035     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   4036                                _bcmFieldSliceSelFpf3, 7,
   4037                                _bcmFieldSliceIntfClassSelect, 4,
   4038                                fp_global_mask_tcam_ofs + f3_offset + 24, 12);
   4039 
   4040     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel,
   4041                  _bcmFieldSliceSelFpf3, 8,
   4042                  fp_global_mask_tcam_ofs + f3_offset, 20);
   4043     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   4044                  _bcmFieldSliceSelFpf3, 8,
   4045                  fp_global_mask_tcam_ofs + f3_offset + 20, 2);
   4046     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   4047                  _bcmFieldSliceSelFpf3, 8,
   4048                  fp_global_mask_tcam_ofs + f3_offset + 22, 2);
   4049     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
   4050                  _bcmFieldSliceSelFpf3, 8,
   4051                  fp_global_mask_tcam_ofs + f3_offset + 24, 2);
   4052     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
   4053                  _bcmFieldSliceSelFpf3, 8,
   4054                  fp_global_mask_tcam_ofs + f3_offset + 26, 2);
   4055     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
   4056                  _bcmFieldSliceSelFpf3, 8,
   4057                  fp_global_mask_tcam_ofs + f3_offset + 28, 2);
   4058 
   4059     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData3,
   4060                  _bcmFieldSliceSelFpf3, 9,
   4061                  fp_global_mask_tcam_ofs + f3_offset, 32);
   4062     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyGenericAssociatedChannelLabelValid,
   4063                  _bcmFieldSliceSelFpf3, 9,
   4064                  fp_global_mask_tcam_ofs + f3_offset + 32, 1);
   4065     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid,
   4066                  _bcmFieldSliceSelFpf3, 9,
   4067                  fp_global_mask_tcam_ofs + f3_offset + 33, 1);
   4068 
   4069     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   4070                                _bcmFieldSliceSelFpf3, 10,
   4071                                _bcmFieldSliceDstFwdEntitySelect,
   4072                                _bcmFieldFwdEntityGlp,
   4073                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4074     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   4075                                _bcmFieldSliceSelFpf3, 10,
   4076                                _bcmFieldSliceDstFwdEntitySelect,
   4077                                _bcmFieldFwdEntityGlp,
   4078                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4079     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   4080                                _bcmFieldSliceSelFpf3, 10,
   4081                                _bcmFieldSliceDstFwdEntitySelect,
   4082                                _bcmFieldFwdEntityMplsGport,
   4083                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4084     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGports,
   4085                                _bcmFieldSliceSelFpf3, 10,
   4086                                _bcmFieldSliceDstFwdEntitySelect,
   4087                                _bcmFieldFwdEntityMplsGport,
   4088                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4089     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGport,
   4090                                _bcmFieldSliceSelFpf3, 10,
   4091                                _bcmFieldSliceDstFwdEntitySelect,
   4092                                _bcmFieldFwdEntityNivGport,
   4093                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4094     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGports,
   4095                                _bcmFieldSliceSelFpf3, 10,
   4096                                _bcmFieldSliceDstFwdEntitySelect,
   4097                                _bcmFieldFwdEntityNivGport,
   4098                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4099     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   4100                                _bcmFieldSliceSelFpf3, 10,
   4101                                _bcmFieldSliceDstFwdEntitySelect,
   4102                                _bcmFieldFwdEntityMimGport,
   4103                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4104     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGports,
   4105                                _bcmFieldSliceSelFpf3, 10,
   4106                                _bcmFieldSliceDstFwdEntitySelect,
   4107                                _bcmFieldFwdEntityMimGport,
   4108                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4109     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGport,
   4110                                _bcmFieldSliceSelFpf3, 10,
   4111                                _bcmFieldSliceDstFwdEntitySelect,
   4112                                _bcmFieldFwdEntityVxlanGport,
   4113                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4114     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGports,
   4115                                _bcmFieldSliceSelFpf3, 10,
   4116                                _bcmFieldSliceDstFwdEntitySelect,
   4117                                _bcmFieldFwdEntityVxlanGport,
   4118                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4119     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   4120                                _bcmFieldSliceSelFpf3, 10,
   4121                                _bcmFieldSliceDstFwdEntitySelect,
   4122                                _bcmFieldFwdEntityVlanGport,
   4123                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4124     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGports,
   4125                                _bcmFieldSliceSelFpf3, 10,
   4126                                _bcmFieldSliceDstFwdEntitySelect,
   4127                                _bcmFieldFwdEntityVlanGport,
   4128                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4129     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   4130                                _bcmFieldSliceSelFpf3, 10,
   4131                                _bcmFieldSliceDstFwdEntitySelect,
   4132                                _bcmFieldFwdEntityCommonGport,
   4133                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4134     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGports,
   4135                                _bcmFieldSliceSelFpf3, 10,
   4136                                _bcmFieldSliceDstFwdEntitySelect,
   4137                                _bcmFieldFwdEntityCommonGport,
   4138                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4139     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   4140                                _bcmFieldSliceSelFpf3, 10,
   4141                                _bcmFieldSliceDstFwdEntitySelect,
   4142                                _bcmFieldFwdEntityL3Egress,
   4143                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4144     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   4145                                bcmFieldQualifyDstL3EgressNextHops,
   4146                                _bcmFieldSliceSelFpf3, 10,
   4147                                _bcmFieldSliceDstFwdEntitySelect,
   4148                                _bcmFieldFwdEntityL3Egress,
   4149                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4150     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   4151                                _bcmFieldSliceSelFpf3, 10,
   4152                                _bcmFieldSliceDstFwdEntitySelect,
   4153                                _bcmFieldFwdEntityMulticastGroup,
   4154                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4155     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroups,
   4156                                _bcmFieldSliceSelFpf3, 10,
   4157                                _bcmFieldSliceDstFwdEntitySelect,
   4158                                _bcmFieldFwdEntityMulticastGroup,
   4159                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4160     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
   4161                                _bcmFieldSliceSelFpf3, 10,
   4162                                _bcmFieldSliceDstFwdEntitySelect,
   4163                                _bcmFieldFwdEntityMultipath,
   4164                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4165     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   4166                  _bcmFieldSliceSelFpf3, 10,
   4167                  fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4168     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   4169                  _bcmFieldSliceSelFpf3, 10,
   4170                  fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4171 
   4172     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   4173                  _bcmFieldSliceSelFpf3, 11,
   4174                  fp_global_mask_tcam_ofs + f3_offset, 16);
   4175     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   4176                  _bcmFieldSliceSelFpf3, 11,
   4177                  fp_global_mask_tcam_ofs + f3_offset, 16);
   4178     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   4179                  _bcmFieldSliceSelFpf3, 11,
   4180                  fp_global_mask_tcam_ofs + f3_offset, 15);
   4181     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGports,
   4182                  _bcmFieldSliceSelFpf3, 11,
   4183                  fp_global_mask_tcam_ofs + f3_offset, 15);
   4184     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   4185                  _bcmFieldSliceSelFpf3, 11,
   4186                  fp_global_mask_tcam_ofs + f3_offset + 7, 8);
   4187     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   4188                                _bcmFieldSliceSelFpf3, 11,
   4189                                _bcmFieldSliceIngressEntitySelect,
   4190                                _bcmFieldFwdEntityMplsGport,
   4191                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4192     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGports,
   4193                                _bcmFieldSliceSelFpf3, 11,
   4194                                _bcmFieldSliceIngressEntitySelect,
   4195                                _bcmFieldFwdEntityMplsGport,
   4196                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4197     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcNivGport,
   4198                                _bcmFieldSliceSelFpf3, 11,
   4199                                _bcmFieldSliceIngressEntitySelect,
   4200                                _bcmFieldFwdEntityNivGport,
   4201                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4202     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcNivGports,
   4203                                _bcmFieldSliceSelFpf3, 11,
   4204                                _bcmFieldSliceIngressEntitySelect,
   4205                                _bcmFieldFwdEntityNivGport,
   4206                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4207     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   4208                                _bcmFieldSliceSelFpf3, 11,
   4209                                _bcmFieldSliceIngressEntitySelect,
   4210                                _bcmFieldFwdEntityMimGport,
   4211                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4212     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGports,
   4213                                _bcmFieldSliceSelFpf3, 11,
   4214                                _bcmFieldSliceIngressEntitySelect,
   4215                                _bcmFieldFwdEntityMimGport,
   4216                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4217     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGport,
   4218                                _bcmFieldSliceSelFpf3, 11,
   4219                                _bcmFieldSliceIngressEntitySelect,
   4220                                _bcmFieldFwdEntityVxlanGport,
   4221                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4222     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGports,
   4223                                _bcmFieldSliceSelFpf3, 11,
   4224                                _bcmFieldSliceIngressEntitySelect,
   4225                                _bcmFieldFwdEntityVxlanGport,
   4226                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4227     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   4228                                _bcmFieldSliceSelFpf3, 11,
   4229                                _bcmFieldSliceIngressEntitySelect,
   4230                                _bcmFieldFwdEntityVlanGport,
   4231                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4232     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGports,
   4233                                _bcmFieldSliceSelFpf3, 11,
   4234                                _bcmFieldSliceIngressEntitySelect,
   4235                                _bcmFieldFwdEntityVlanGport,
   4236                                fp_global_mask_tcam_ofs + f3_offset + 16, 16);
   4237 
   4238     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid,
   4239                                  _bcmFieldSliceSelFpf3, 12,
   4240                                  fp_global_mask_tcam_ofs + f3_offset + 36, 1);
   4241     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   4242                                  _bcmFieldSliceSelFpf3, 12,
   4243                                  fp_global_mask_tcam_ofs + f3_offset + 41, 2);
   4244     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   4245                                  _bcmFieldSliceSelFpf3, 12,
   4246                                  fp_global_mask_tcam_ofs + f3_offset + 37, 4);
   4247     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag,
   4248                                _bcmFieldSliceSelFpf3, 12,
   4249                                _bcmFieldSliceAuxTag2Select,
   4250                                _bcmFieldAuxTagVn,
   4251                                fp_global_mask_tcam_ofs + f3_offset, 33);
   4252     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag,
   4253                                _bcmFieldSliceSelFpf3, 12,
   4254                                _bcmFieldSliceAuxTag2Select,
   4255                                _bcmFieldAuxTagCn,
   4256                                fp_global_mask_tcam_ofs + f3_offset, 33);
   4257     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag,
   4258                                _bcmFieldSliceSelFpf3, 12,
   4259                                _bcmFieldSliceAuxTag2Select,
   4260                                _bcmFieldAuxTagFabricQueue,
   4261                                fp_global_mask_tcam_ofs + f3_offset, 33);
   4262     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabel,
   4263                                _bcmFieldSliceSelFpf3, 12,                           
   4264                                _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel,
   4265                                fp_global_mask_tcam_ofs + f3_offset, 33               
   4266                                );                                                   
   4267     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelTtl,         
   4268                      _bcmFieldDevSelDisable, 0,                                     
   4269                      _bcmFieldSliceSelFpf3, 12,                                     
   4270                      _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel,
   4271                      0,                                                             
   4272                      fp_global_mask_tcam_ofs + f3_offset,      8,                    
   4273                      fp_global_mask_tcam_ofs + f3_offset + 32, 1,                    
   4274                      0,                         0,                                  
   4275                      0                                                              
   4276                      );                                                             
   4277     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelBos,         
   4278                      _bcmFieldDevSelDisable, 0,                                     
   4279                      _bcmFieldSliceSelFpf3, 12,                                     
   4280                      _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel,
   4281                      0,                                                             
   4282                      fp_global_mask_tcam_ofs + f3_offset + 8,  1,                    
   4283                      fp_global_mask_tcam_ofs + f3_offset + 32, 1,                    
   4284                      0,                         0,                                  
   4285                      0                                                              
   4286                      );                                                             
   4287     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelExp,         
   4288                      _bcmFieldDevSelDisable, 0,                                     
   4289                      _bcmFieldSliceSelFpf3, 12,                                     
   4290                      _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel,
   4291                      0,                                                             
   4292                      fp_global_mask_tcam_ofs + f3_offset + 9,  3,               
   4293                      fp_global_mask_tcam_ofs + f3_offset + 32, 1,               
   4294                      0,                         0,                              
   4295                      0                                                          
   4296                      );                                                         
   4297     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelId,
   4298                                _bcmFieldSliceSelFpf3, 12,                       
   4299                                _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsFwdingLabel,
   4300                                fp_global_mask_tcam_ofs + f3_offset + 12, 21     
   4301                                );                                               
   4302     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord,  
   4303                                _bcmFieldSliceSelFpf3, 12,                       
   4304                                _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagMplsCntlWord,
   4305                                fp_global_mask_tcam_ofs + f3_offset, 33          
   4306                                );                                               
   4307                                                                                 
   4308     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper,
   4309                                _bcmFieldSliceSelFpf3, 12,
   4310                                _bcmFieldSliceAuxTag2Select,
   4311                                _bcmFieldAuxTagRtag7A,
   4312                                fp_global_mask_tcam_ofs + f3_offset + 16, 17);
   4313 
   4314     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper,
   4315                                _bcmFieldSliceSelFpf3, 12,
   4316                                _bcmFieldSliceAuxTag2Select,
   4317                                _bcmFieldAuxTagRtag7B,
   4318                                fp_global_mask_tcam_ofs + f3_offset + 16, 17);
   4319 
   4320     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower,
   4321                      _bcmFieldDevSelDisable, 0,
   4322                      _bcmFieldSliceSelFpf3, 12,
   4323                      _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7A,
   4324                      0,
   4325                      fp_global_mask_tcam_ofs + f3_offset, 16,
   4326                      fp_global_mask_tcam_ofs + f3_offset + 32, 1,
   4327                      0, 0,
   4328                      0);
   4329 
   4330     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower,
   4331                      _bcmFieldDevSelDisable, 0,
   4332                      _bcmFieldSliceSelFpf3, 12,
   4333                      _bcmFieldSliceAuxTag2Select, _bcmFieldAuxTagRtag7B,
   4334                      0,
   4335                      fp_global_mask_tcam_ofs + f3_offset, 16,
   4336                      fp_global_mask_tcam_ofs + f3_offset + 32, 1,
   4337                      0, 0,
   4338                      0);
   4339 
   4340     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVxlanNetworkId,
   4341                                _bcmFieldSliceSelFpf3, 12,
   4342                                _bcmFieldSliceAuxTag2Select,
   4343                                _bcmFieldAuxTagVxlanOrLLTag,
   4344                                fp_global_mask_tcam_ofs + f3_offset, 24);
   4345 
   4346     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVxlanFlags,
   4347                                _bcmFieldSliceSelFpf3, 12,
   4348                                _bcmFieldSliceAuxTag2Select,
   4349                                _bcmFieldAuxTagVxlanOrLLTag,
   4350                                fp_global_mask_tcam_ofs + f3_offset + 24, 8);
   4351 
   4352     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVxlanHeaderBits8_31,
   4353                                _bcmFieldSliceSelFpf3, 12,
   4354                                _bcmFieldSliceAuxTag2Select,
   4355                                _bcmFieldAuxTagVxlanReserved,
   4356                                fp_global_mask_tcam_ofs + f3_offset, 24);
   4357 
   4358     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVxlanHeaderBits56_63,
   4359                                _bcmFieldSliceSelFpf3, 12,
   4360                                _bcmFieldSliceAuxTag2Select,
   4361                                _bcmFieldAuxTagVxlanReserved,
   4362                                fp_global_mask_tcam_ofs + f3_offset + 24, 8);
   4363 
   4364     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction,      
   4365                  _bcmFieldSliceSelFpf3, 12,                                     
   4366                  fp_global_mask_tcam_ofs + f3_offset + 33, 3                    
   4367                  );                                                             
   4368     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   4369                  _bcmFieldSliceSelFpf3, 13,
   4370                                _bcmFieldSliceTosClassSelect, 0,
   4371                                fp_global_mask_tcam_ofs + f3_offset, 8);
   4372     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
   4373                                _bcmFieldSliceSelFpf3, 13,
   4374                                _bcmFieldSliceTosClassSelect, 0,
   4375                                fp_global_mask_tcam_ofs + f3_offset, 8);
   4376     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
   4377                                _bcmFieldSliceSelFpf3, 13,
   4378                                _bcmFieldSliceTosClassSelect, 1,
   4379                  fp_global_mask_tcam_ofs + f3_offset, 8);
   4380     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeader2Type,
   4381                  _bcmFieldSliceSelFpf3, 13,
   4382                  fp_global_mask_tcam_ofs + f3_offset + 8, 8);
   4383     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   4384                  _bcmFieldSliceSelFpf3, 13,
   4385                  fp_global_mask_tcam_ofs + f3_offset + 16, 8);
   4386     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   4387                  _bcmFieldSliceSelFpf3, 13,
   4388                  fp_global_mask_tcam_ofs + f3_offset + 24, 8);
   4389     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIpLocal,
   4390                  _bcmFieldSliceSelFpf3, 13,
   4391                  fp_global_mask_tcam_ofs + f3_offset + 32, 1
   4392                  );
   4393     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpAddrsNormalized,
   4394                  _bcmFieldSliceSelFpf3, 13,
   4395                  fp_global_mask_tcam_ofs + f3_offset + 33, 1
   4396                  );
   4397     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized,
   4398                  _bcmFieldSliceSelFpf3, 13,
   4399                  fp_global_mask_tcam_ofs + f3_offset + 34, 1
   4400                  );
   4401     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress,
   4402                  _bcmFieldSliceSelFpf3, 13,
   4403                  fp_global_mask_tcam_ofs + f3_offset + 35, 13
   4404                  );
   4405     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMacAddrsNormalized,
   4406                  _bcmFieldSliceSelFpf3, 14,
   4407                  fp_global_mask_tcam_ofs + f3_offset + 48, 1
   4408                  );
   4409     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   4410                  _bcmFieldSliceSelFpf3, 14, 
   4411                  fp_global_mask_tcam_ofs + f3_offset, 48
   4412                  );
   4413 
   4414 
   4415     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   4416                                _bcmFieldSliceSelFpf3, 15,
   4417                                _bcmFieldSliceDstFwdEntitySelect,
   4418                                _bcmFieldFwdEntityGlp,
   4419                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4420     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   4421                                _bcmFieldSliceSelFpf3, 15,
   4422                                _bcmFieldSliceDstFwdEntitySelect,
   4423                                _bcmFieldFwdEntityGlp,
   4424                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4425     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   4426                                _bcmFieldSliceSelFpf3, 15,
   4427                                _bcmFieldSliceDstFwdEntitySelect,
   4428                                _bcmFieldFwdEntityMplsGport,
   4429                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4430     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGports,
   4431                                _bcmFieldSliceSelFpf3, 15,
   4432                                _bcmFieldSliceDstFwdEntitySelect,
   4433                                _bcmFieldFwdEntityMplsGport,
   4434                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4435     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGport,
   4436                                _bcmFieldSliceSelFpf3, 15,
   4437                                _bcmFieldSliceDstFwdEntitySelect,
   4438                                _bcmFieldFwdEntityNivGport,
   4439                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4440     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGports,
   4441                                _bcmFieldSliceSelFpf3, 15,
   4442                                _bcmFieldSliceDstFwdEntitySelect,
   4443                                _bcmFieldFwdEntityNivGport,
   4444                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4445     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   4446                                _bcmFieldSliceSelFpf3, 15,
   4447                                _bcmFieldSliceDstFwdEntitySelect,
   4448                                _bcmFieldFwdEntityMimGport,
   4449                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4450     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGports,
   4451                                _bcmFieldSliceSelFpf3, 15,
   4452                                _bcmFieldSliceDstFwdEntitySelect,
   4453                                _bcmFieldFwdEntityMimGport,
   4454                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4455     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGport,
   4456                                _bcmFieldSliceSelFpf3, 15,
   4457                                _bcmFieldSliceDstFwdEntitySelect,
   4458                                _bcmFieldFwdEntityVxlanGport,
   4459                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4460     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGports,
   4461                                _bcmFieldSliceSelFpf3, 15,
   4462                                _bcmFieldSliceDstFwdEntitySelect,
   4463                                _bcmFieldFwdEntityVxlanGport,
   4464                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4465     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   4466                                _bcmFieldSliceSelFpf3, 15,
   4467                                _bcmFieldSliceDstFwdEntitySelect,
   4468                                _bcmFieldFwdEntityVlanGport,
   4469                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4470     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGports,
   4471                                _bcmFieldSliceSelFpf3, 15,
   4472                                _bcmFieldSliceDstFwdEntitySelect,
   4473                                _bcmFieldFwdEntityVlanGport,
   4474                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4475     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   4476                                _bcmFieldSliceSelFpf3, 15,
   4477                                _bcmFieldSliceDstFwdEntitySelect,
   4478                                _bcmFieldFwdEntityCommonGport,
   4479                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4480     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGports,
   4481                                _bcmFieldSliceSelFpf3, 15,
   4482                                _bcmFieldSliceDstFwdEntitySelect,
   4483                                _bcmFieldFwdEntityCommonGport,
   4484                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4485     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   4486                                _bcmFieldSliceSelFpf3, 15,
   4487                                _bcmFieldSliceDstFwdEntitySelect,
   4488                                _bcmFieldFwdEntityL3Egress,
   4489                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4490     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
   4491                                _bcmFieldSliceSelFpf3, 15,
   4492                                _bcmFieldSliceDstFwdEntitySelect,
   4493                                _bcmFieldFwdEntityL3Egress,
   4494                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4495     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   4496                                _bcmFieldSliceSelFpf3, 15,
   4497                                _bcmFieldSliceDstFwdEntitySelect,
   4498                                _bcmFieldFwdEntityMulticastGroup,
   4499                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4500     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroups,
   4501                                _bcmFieldSliceSelFpf3, 15,
   4502                                _bcmFieldSliceDstFwdEntitySelect,
   4503                                _bcmFieldFwdEntityMulticastGroup,
   4504                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4505     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
   4506                                _bcmFieldSliceSelFpf3, 15,
   4507                                _bcmFieldSliceDstFwdEntitySelect,
   4508                                _bcmFieldFwdEntityMultipath,
   4509                                fp_global_mask_tcam_ofs + f3_offset, 21);
   4510     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   4511                                _bcmFieldSliceSelFpf3, 15,
   4512                                _bcmFieldSliceIngressEntitySelect,
   4513                                _bcmFieldFwdEntityGlp,
   4514                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4515     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   4516                                _bcmFieldSliceSelFpf3, 15,
   4517                                _bcmFieldSliceIngressEntitySelect,
   4518                                _bcmFieldFwdEntityGlp,
   4519                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4520     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   4521                                _bcmFieldSliceSelFpf3, 15,
   4522                                _bcmFieldSliceIngressEntitySelect,
   4523                                _bcmFieldFwdEntityMplsGport,
   4524                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4525     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGports,
   4526                                _bcmFieldSliceSelFpf3, 15,
   4527                                _bcmFieldSliceIngressEntitySelect,
   4528                                _bcmFieldFwdEntityMplsGport,
   4529                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4530     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcNivGport,
   4531                                _bcmFieldSliceSelFpf3, 15,
   4532                                _bcmFieldSliceIngressEntitySelect,
   4533                                _bcmFieldFwdEntityNivGport,
   4534                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4535     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcNivGports,
   4536                                _bcmFieldSliceSelFpf3, 15,
   4537                                _bcmFieldSliceIngressEntitySelect,
   4538                                _bcmFieldFwdEntityNivGport,
   4539                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4540     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   4541                                _bcmFieldSliceSelFpf3, 15,
   4542                                _bcmFieldSliceIngressEntitySelect,
   4543                                _bcmFieldFwdEntityMimGport,
   4544                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4545     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGports,
   4546                                _bcmFieldSliceSelFpf3, 15,
   4547                                _bcmFieldSliceIngressEntitySelect,
   4548                                _bcmFieldFwdEntityMimGport,
   4549                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4550     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGport,
   4551                                _bcmFieldSliceSelFpf3, 15,
   4552                                _bcmFieldSliceIngressEntitySelect,
   4553                                _bcmFieldFwdEntityVxlanGport,
   4554                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4555     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGports,
   4556                                _bcmFieldSliceSelFpf3, 15,
   4557                                _bcmFieldSliceIngressEntitySelect,
   4558                                _bcmFieldFwdEntityVxlanGport,
   4559                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4560     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   4561                                _bcmFieldSliceSelFpf3, 15,
   4562                                _bcmFieldSliceIngressEntitySelect,
   4563                                _bcmFieldFwdEntityVlanGport,
   4564                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4565     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGports,
   4566                                _bcmFieldSliceSelFpf3, 15,
   4567                                _bcmFieldSliceIngressEntitySelect,
   4568                                _bcmFieldFwdEntityVlanGport,
   4569                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4570     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   4571                                _bcmFieldSliceSelFpf3, 15,
   4572                                _bcmFieldSliceIngressEntitySelect,
   4573                                _bcmFieldFwdEntityModPortGport,
   4574                                fp_global_mask_tcam_ofs + f3_offset + 21, 15);
   4575     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGports,
   4576                                _bcmFieldSliceSelFpf3, 15,
   4577                                _bcmFieldSliceIngressEntitySelect,
   4578                                _bcmFieldFwdEntityModPortGport,
   4579                                fp_global_mask_tcam_ofs + f3_offset + 21, 15);
   4580     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
   4581                                _bcmFieldSliceSelFpf3, 15,
   4582                                _bcmFieldSliceIngressEntitySelect,
   4583                                _bcmFieldFwdEntityCommonGport,
   4584                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4585     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGports,
   4586                                _bcmFieldSliceSelFpf3, 15,
   4587                                _bcmFieldSliceIngressEntitySelect,
   4588                                _bcmFieldFwdEntityCommonGport,
   4589                                fp_global_mask_tcam_ofs + f3_offset + 21, 16);
   4590     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   4591                                _bcmFieldSliceSelFpf3, 15,
   4592                                _bcmFieldSliceIngressEntitySelect,
   4593                                _bcmFieldFwdEntityModPortGport,
   4594                                fp_global_mask_tcam_ofs + f3_offset + 28, 8);
   4595     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
   4596                                _bcmFieldSliceSelFpf3, 15,
   4597                                _bcmFieldSliceIngressEntitySelect,
   4598                                _bcmFieldFwdEntityModPortGport,
   4599                                fp_global_mask_tcam_ofs + f3_offset + 28, 8);
   4600     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   4601                  _bcmFieldSliceSelFpf3, 15,
   4602                  fp_global_mask_tcam_ofs + f3_offset + 37, 12);
   4603 
   4604 
   4605 
   4606     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFcoeVersionIsZero,
   4607                  _bcmFieldSliceSelFpf3, 16,
   4608                  fp_global_mask_tcam_ofs + f3_offset, 1);
   4609     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFcoeSOF,
   4610                  _bcmFieldSliceSelFpf3, 16,
   4611                  fp_global_mask_tcam_ofs + f3_offset + 1, 8);
   4612     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanRCtl,
   4613                  _bcmFieldSliceSelFpf3, 16,
   4614                  fp_global_mask_tcam_ofs + f3_offset + 15, 8);
   4615     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTVersion,
   4616                  _bcmFieldSliceSelFpf3, 16,
   4617                  fp_global_mask_tcam_ofs + f3_offset + 23, 2);
   4618     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTHopCount,
   4619                  _bcmFieldSliceSelFpf3, 16,
   4620                  fp_global_mask_tcam_ofs + f3_offset + 25, 5);
   4621     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTVsanId,
   4622                  _bcmFieldSliceSelFpf3, 16,
   4623                  fp_global_mask_tcam_ofs + f3_offset + 30, 12);
   4624     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTVsanPri,
   4625                  _bcmFieldSliceSelFpf3, 16,
   4626                  fp_global_mask_tcam_ofs + f3_offset + 42, 3);
   4627     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanSrcFpmaCheck,
   4628                  _bcmFieldSliceSelFpf3, 16,
   4629                  fp_global_mask_tcam_ofs + f3_offset + 45, 1);
   4630     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanSrcBindCheck,
   4631                  _bcmFieldSliceSelFpf3, 16,
   4632                  fp_global_mask_tcam_ofs + f3_offset + 46, 1);
   4633     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanZoneCheck,
   4634                  _bcmFieldSliceSelFpf3, 16,
   4635                  fp_global_mask_tcam_ofs + f3_offset + 47, 2);
   4636  
   4637 
   4638 
   4639     /* FIXED single wide */
   4640     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit,
   4641                  _bcmFieldSliceSelDisable, 0, fixed_offset, 1);
   4642         _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   4643                  _bcmFieldSliceSelDisable, 0, fixed_offset + 1, 1);
   4644     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   4645                  _bcmFieldSliceSelDisable, 0, fixed_offset + 2, 3);
   4646     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, _bcmFieldQualifySvpValid,
   4647                  _bcmFieldSliceSelDisable, 0, fixed_offset + 5, 1);
   4648     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
   4649                  _bcmFieldSliceSelDisable, 0, fixed_offset + 5, 1);
   4650     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   4651                  _bcmFieldSliceSelDisable, 0, fixed_offset + 6, 5);
   4652     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   4653                  _bcmFieldSliceSelDisable, 0, fixed_offset + 11, 1);
   4654     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   4655                  _bcmFieldSliceSelDisable, 0, fixed_offset + 12, 1);
   4656     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyLoopback,
   4657                  _bcmFieldSliceSelDisable, 0, fixed_offset + 17, 1);
   4658     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyLoopbackType,
   4659                  _bcmFieldSliceSelDisable, 0, fixed_offset + 13, 5);
   4660     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyTunnelType,
   4661                  _bcmFieldSliceSelDisable, 0, fixed_offset + 13, 5);
   4662     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   4663                  _bcmFieldSliceSelDisable, 0, fixed_offset + 18, 1);
   4664     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyRepCopy,
   4665                  _bcmFieldSliceSelDisable, 0, fixed_offset + 19, 1);
   4666     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
   4667                  _bcmFieldSliceSelDisable, 0, fixed_offset + 20, 1);
   4668     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   4669                  _bcmFieldSliceSelDisable, 0, fixed_offset + 21, 1);
   4670 
   4671     /* Overlay of FIXED key in pairing mode */
   4672     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   4673                      _bcmFieldDevSelDisable, 0,
   4674                      _bcmFieldSliceSelDisable, 0,
   4675                      _bcmFieldSliceSelDisable, 0,
   4676                      0,
   4677                      0, 0,
   4678                      fixed_pairing_overlay_offset, 2,
   4679                      0, 0,
   4680                      1);
   4681     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   4682                      _bcmFieldDevSelDisable, 0,
   4683                      _bcmFieldSliceSelDisable, 0,
   4684                      _bcmFieldSliceSelDisable, 0,
   4685                      0,
   4686                      0, 0,
   4687                      fixed_pairing_overlay_offset + 2, 8,
   4688                      0, 0,
   4689                      1);
   4690     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   4691                      _bcmFieldDevSelDisable, 0,
   4692                      _bcmFieldSliceSelDisable, 0,
   4693                      _bcmFieldSliceTtlClassSelect, 0,
   4694                      0,
   4695                      0, 0,
   4696                      fixed_pairing_overlay_offset + 10, 8,
   4697                      0, 0,
   4698                      1);
   4699     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
   4700                      _bcmFieldDevSelDisable, 0,
   4701                      _bcmFieldSliceSelDisable, 0,
   4702                      _bcmFieldSliceTtlClassSelect, 0,
   4703                      0,
   4704                      0, 0,
   4705                      fixed_pairing_overlay_offset + 10, 8,
   4706                      0, 0,
   4707                      1);
   4708     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
   4709                      _bcmFieldSliceSelDisable, 0,
   4710                      _bcmFieldSliceSelDisable, 0,
   4711                      _bcmFieldSliceTtlClassSelect, 1,
   4712                      0,
   4713                      0, 0,
   4714                      fixed_pairing_overlay_offset + 10, 8,
   4715                      0, 0,
   4716                      1);
   4717 
   4718     /* Overlay of IPBM in pairing mode */
   4719     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   4720                      _bcmFieldDevSelDisable, 0,
   4721                      _bcmFieldSliceSelDisable, 0,
   4722                      _bcmFieldSliceTcpClassSelect, 0,
   4723                      0,
   4724                      0, 0, 
   4725                      fp_global_mask_tcam_ofs + ipbm_pairing_f0_offset, 6, 
   4726                      0, 0,
   4727                      1);  
   4728     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
   4729                      _bcmFieldDevSelDisable, 0,
   4730                      _bcmFieldSliceSelDisable, 0,
   4731                      _bcmFieldSliceTcpClassSelect, 0,
   4732                      0,
   4733                      0, 0, 
   4734                      fp_global_mask_tcam_ofs + ipbm_pairing_f0_offset, 6, 
   4735                      0, 0,
   4736                      1);  
   4737     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
   4738                      _bcmFieldDevSelDisable, 0,
   4739                      _bcmFieldSliceSelDisable, 0,
   4740                      _bcmFieldSliceTcpClassSelect, 1,
   4741                      0,
   4742                      0, 0, 
   4743                      fp_global_mask_tcam_ofs + ipbm_pairing_f0_offset, 6, 
   4744                      0, 0,
   4745                      1);  
   4746     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   4747                      _bcmFieldDevSelDisable, 0,
   4748                      _bcmFieldSliceSelDisable, 0,
   4749                      _bcmFieldSliceSelDisable, 0,
   4750                      0,
   4751                      0, 0, 
   4752                      fp_global_mask_tcam_ofs + ipbm_pairing_f0_offset + 6, 16,
   4753                      0, 0, 
   4754                      1);   
   4755     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   4756                      _bcmFieldDevSelDisable, 0,
   4757                      _bcmFieldSliceSelDisable, 0,
   4758                      _bcmFieldSliceSelDisable, 0,
   4759                      0,
   4760                      0, 0,
   4761                      fp_global_mask_tcam_ofs + ipbm_pairing_f0_offset + 22, 16,
   4762                      0, 0,
   4763                      1); 
   4764     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   4765                      _bcmFieldDevSelDisable, 0,
   4766                      _bcmFieldSliceSelDisable, 0,
   4767                      _bcmFieldSliceSelDisable, 0,
   4768                      0,
   4769                      0, 0,
   4770                      fp_global_mask_tcam_ofs + ipbm_pairing_f0_offset + 22, 16,
   4771                      0, 0,
   4772                      1); 
   4773 
   4774     return (BCM_E_NONE);
   4775 }
   4776 
   4777 
   4778 /*
   4779  * Function:
   4780  *     _field_td2_lookup_qualifiers_init
   4781  * Purpose:
   4782  *     Initialize device stage lookup qaualifiers
   4783  *     select codes & offsets
   4784  * Parameters:
   4785  *     unit       - (IN) BCM device number.
   4786  *     stage_fc   - (IN) Field Processor stage control structure.
   4787 
   4788  * Returns:
   4789  *     BCM_E_NONE
   4790  */
   4791 STATIC int
   4792 _field_td2_lookup_qualifiers_init(int unit, _field_stage_t *stage_fc)
   4793 {
   4794     const unsigned f1_offset = 164, f2_offset = 36, f3_offset = 0;
   4795     _FP_QUAL_DECL;
   4796 
   4797     /* Input parameters check. */
   4798     if (NULL == stage_fc) {
   4799         return (BCM_E_PARAM);
   4800     }
   4801 
   4802     /* Enable the overlay of Sender Ethernet Address onto MACSA
   4803      * on ARP/RARP packets.
   4804      */
   4805     BCM_IF_ERROR_RETURN
   4806         (soc_reg_field32_modify(unit, ING_CONFIG_64r, REG_PORT_ANY,
   4807                                 ARP_VALIDATION_ENf, 1));
   4808 
   4809     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageLookup,
   4810                  _bcmFieldSliceSelDisable, 0, 0, 0);
   4811     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
   4812                  _bcmFieldSliceSelDisable, 0, 0, 0);
   4813     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   4814                  _bcmFieldSliceSelDisable, 0, 0, 0);
   4815 
   4816     /* FPF1 */
   4817     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   4818                                bcmFieldQualifyInnerIpProtocolCommon,
   4819                                _bcmFieldSliceSelFpf1, 0,
   4820                                _bcmFieldSliceIpHeaderSelect, 1, f1_offset, 3);
   4821     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocolCommon,
   4822                                _bcmFieldSliceSelFpf1, 0,
   4823                                _bcmFieldSliceIpHeaderSelect, 0, f1_offset, 3);
   4824     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated,
   4825                  _bcmFieldSliceSelFpf1, 0, f1_offset + 3, 1);
   4826     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
   4827                  _bcmFieldSliceSelFpf1, 0, f1_offset + 4, 1);
   4828     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
   4829                  _bcmFieldSliceSelFpf1, 0, f1_offset + 5, 2);
   4830     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
   4831                  _bcmFieldSliceSelFpf1, 0, f1_offset + 7, 2);
   4832     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   4833                  _bcmFieldSliceSelFpf1, 0, f1_offset + 9, 2);
   4834     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   4835                  _bcmFieldSliceSelFpf1, 0, f1_offset + 11, 1);
   4836     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   4837                  _bcmFieldSliceSelFpf1, 0, f1_offset + 12, 1);
   4838     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   4839                  _bcmFieldSliceSelFpf1, 0, f1_offset + 13, 16);
   4840     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   4841                  _bcmFieldSliceSelFpf1, 0, f1_offset + 13, 12);
   4842     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   4843                  _bcmFieldSliceSelFpf1, 0, f1_offset + 25, 1);
   4844     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   4845                  _bcmFieldSliceSelFpf1, 0, f1_offset + 26, 3);
   4846     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   4847                  _bcmFieldSliceSelFpf1, 0, f1_offset + 29, 2);
   4848     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpType,
   4849                                _bcmFieldSliceSelFpf1, 0,
   4850                                _bcmFieldSliceIpHeaderSelect, 1, f1_offset + 31,
   4851                                5);
   4852     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   4853                                _bcmFieldSliceSelFpf1, 0,
   4854                                _bcmFieldSliceIpHeaderSelect, 0, f1_offset + 31,
   4855                                5);
   4856     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   4857                      _bcmFieldDevSelDisable, 0,
   4858                      _bcmFieldSliceSelFpf1, 0,
   4859                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp,
   4860                      0,
   4861                      f1_offset + 36, 7, /* Port value in SGLP */
   4862                      f1_offset + 43, 8, /* Module value in SGLP */
   4863                      f1_offset + 51, 1, /* Trunk bit in SGLP (should be 0) */
   4864                      0
   4865                      );
   4866 
   4867     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   4868                      _bcmFieldDevSelDisable, 0,
   4869                      _bcmFieldSliceSelFpf1, 0,
   4870                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp,
   4871                      0,
   4872                      f1_offset + 36, 15, /* trunk id field of SGLP */
   4873                      f1_offset + 51, 1,  /* trunk bit of SGLP */
   4874                      0, 0,
   4875                      0
   4876                      );
   4877 
   4878     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   4879                      _bcmFieldDevSelDisable, 0,
   4880                      _bcmFieldSliceSelFpf1, 0,
   4881                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMplsGport,
   4882                      0,
   4883                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4884                      0, 0,
   4885                      0, 0,
   4886                      0
   4887                      );
   4888 
   4889     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGports,
   4890                      _bcmFieldDevSelDisable, 0,
   4891                      _bcmFieldSliceSelFpf1, 0,
   4892                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMplsGport,
   4893                      0,
   4894                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4895                      0, 0,
   4896                      0, 0,
   4897                      0
   4898                      );
   4899 
   4900     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcNivGport,
   4901                      _bcmFieldDevSelDisable, 0,
   4902                      _bcmFieldSliceSelFpf1, 0,
   4903                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityNivGport,
   4904                      0,
   4905                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4906                      0, 0,
   4907                      0, 0,
   4908                      0
   4909                      );
   4910 
   4911     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcNivGports,
   4912                      _bcmFieldDevSelDisable, 0,
   4913                      _bcmFieldSliceSelFpf1, 0,
   4914                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityNivGport,
   4915                      0,
   4916                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4917                      0, 0,
   4918                      0, 0,
   4919                      0
   4920                      );
   4921 
   4922     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   4923                      _bcmFieldDevSelDisable, 0,
   4924                      _bcmFieldSliceSelFpf1, 0,
   4925                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMimGport,
   4926                      0,
   4927                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4928                      0, 0,
   4929                      0, 0,
   4930                      0
   4931                      );
   4932 
   4933     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMimGports,
   4934                      _bcmFieldDevSelDisable, 0,
   4935                      _bcmFieldSliceSelFpf1, 0,
   4936                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMimGport,
   4937                      0,
   4938                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4939                      0, 0,
   4940                      0, 0,
   4941                      0
   4942                      );
   4943 
   4944     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGport,
   4945                      _bcmFieldDevSelDisable, 0,
   4946                      _bcmFieldSliceSelFpf1, 0,
   4947                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVxlanGport,
   4948                      0,
   4949                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4950                      0, 0,
   4951                      0, 0,
   4952                      0
   4953                      );
   4954 
   4955     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcVxlanGports,
   4956                      _bcmFieldDevSelDisable, 0,
   4957                      _bcmFieldSliceSelFpf1, 0,
   4958                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVxlanGport,
   4959                      0,
   4960                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4961                      0, 0,
   4962                      0, 0,
   4963                      0
   4964                      );
   4965 
   4966     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   4967                      _bcmFieldDevSelDisable, 0,
   4968                      _bcmFieldSliceSelFpf1, 0,
   4969                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVlanGport,
   4970                      0,
   4971                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4972                      0, 0,
   4973                      0, 0,
   4974                      0
   4975                      );
   4976 
   4977     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGports,
   4978                      _bcmFieldDevSelDisable, 0,
   4979                      _bcmFieldSliceSelFpf1, 0,
   4980                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVlanGport,
   4981                      0,
   4982                      f1_offset + 36, 20, /* SVP_VALID + S_TYPE_SEL + S_FIELD */
   4983                      0, 0,
   4984                      0, 0,
   4985                      0
   4986                      );
   4987 
   4988     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   4989                      _bcmFieldDevSelDisable, 0,
   4990                      _bcmFieldSliceSelFpf1, 0,
   4991                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   4992                      0,
   4993                      f1_offset + 36, 15, /* mod + port field of unresolved SGLP */
   4994                      0, 0,
   4995                      0, 0,
   4996                      0
   4997                      );
   4998 
   4999     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGports,
   5000                      _bcmFieldDevSelDisable, 0,
   5001                      _bcmFieldSliceSelFpf1, 0,
   5002                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   5003                      0,
   5004                      f1_offset + 36, 15, /* mod + port field of unresolved SGLP */
   5005                      0, 0,
   5006                      0, 0,
   5007                      0
   5008                      );
   5009 
   5010     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   5011                      _bcmFieldDevSelDisable, 0,
   5012                      _bcmFieldSliceSelFpf1, 0,
   5013                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   5014                      0,
   5015                      f1_offset + 36 + 7, 8, /* mod field of unresolved SGLP */
   5016                      0, 0,
   5017                      0, 0,
   5018                      0
   5019                      );
   5020 
   5021     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   5022                      _bcmFieldDevSelDisable, 0,
   5023                      _bcmFieldSliceSelFpf1, 0,
   5024                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityPortGroupNum,
   5025                      0,
   5026                      f1_offset + 36, 7, /* ingress port field */
   5027                      0, 0,
   5028                      0, 0,
   5029                      0
   5030                      );
   5031 
   5032     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   5033                      _bcmFieldDevSelDisable, 0,
   5034                      _bcmFieldSliceSelFpf1, 0,
   5035                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityPortGroupNum,
   5036                      0,
   5037                      f1_offset + 36 + 7, 8, /* ingress port group field */
   5038                      0, 0,
   5039                      0, 0,
   5040                      0
   5041                      );
   5042 
   5043     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
   5044                      _bcmFieldDevSelDisable, 0,
   5045                      _bcmFieldSliceSelFpf1, 0,
   5046                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   5047                      0,
   5048                      f1_offset + 36 + 7, 8, /* mod field of unresolved SGLP */
   5049                      0, 0,
   5050                      0, 0,
   5051                      0
   5052                      );
   5053     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   5054                  _bcmFieldSliceSelFpf1, 0, f1_offset + 56, 1);
   5055 
   5056 
   5057     /* FPF2 */
   5058     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl,
   5059                                _bcmFieldSliceSelFpf2, 0,
   5060                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset, 8);
   5061     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   5062                                _bcmFieldSliceSelFpf2, 0,
   5063                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset, 8);
   5064     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   5065                  _bcmFieldSliceSelFpf2, 0, f2_offset + 8, 6);
   5066     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag,
   5067                                _bcmFieldSliceSelFpf2, 0,
   5068                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 14,
   5069                                2);
   5070     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   5071                                _bcmFieldSliceSelFpf2, 0,
   5072                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 14,
   5073                                2);
   5074     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   5075                                _bcmFieldSliceSelFpf2, 0,
   5076                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 16,
   5077                                8);
   5078     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   5079                                _bcmFieldSliceSelFpf2, 0,
   5080                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 16,
   5081                                8);
   5082     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort,
   5083                                _bcmFieldSliceSelFpf2, 0,
   5084                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 24,
   5085                                16);
   5086     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   5087                                _bcmFieldSliceSelFpf2, 0,
   5088                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 24,
   5089                                16);
   5090     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   5091                                _bcmFieldSliceSelFpf2, 0,
   5092                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 40,
   5093                                16);
   5094     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   5095                                _bcmFieldSliceSelFpf2, 0,
   5096                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 40,
   5097                                16);
   5098     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   5099                                _bcmFieldSliceSelFpf2, 0,
   5100                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 40,
   5101                                16);
   5102     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   5103                                _bcmFieldSliceSelFpf2, 0,
   5104                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 56,
   5105                                8);
   5106     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   5107                                _bcmFieldSliceSelFpf2, 0,
   5108                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 56,
   5109                                8);
   5110     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp,
   5111                                _bcmFieldSliceSelFpf2, 0,
   5112                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 64,
   5113                                32);
   5114     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   5115                                _bcmFieldSliceSelFpf2, 0,
   5116                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 64,
   5117                                32);
   5118     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp,
   5119                                _bcmFieldSliceSelFpf2, 0,
   5120                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 96,
   5121                                32);
   5122     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   5123                                _bcmFieldSliceSelFpf2, 0,
   5124                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 96,
   5125                                32);
   5126 
   5127     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6,
   5128                                _bcmFieldSliceSelFpf2, 1,
   5129                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset, 128);
   5130     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   5131                                _bcmFieldSliceSelFpf2, 1,
   5132                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset, 128);
   5133 
   5134     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp6,
   5135                                _bcmFieldSliceSelFpf2, 2,
   5136                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset, 128);
   5137     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   5138                                _bcmFieldSliceSelFpf2, 2,
   5139                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset, 128);
   5140 
   5141     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   5142                  _bcmFieldSliceSelFpf2, 3, f2_offset + 16, 16);
   5143     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   5144                  _bcmFieldSliceSelFpf2, 3, f2_offset + 32, 48);
   5145     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   5146                  _bcmFieldSliceSelFpf2, 3, f2_offset + 80, 48);
   5147 
   5148     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   5149                                _bcmFieldSliceSelFpf2, 4,
   5150                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset, 8);
   5151     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   5152                                _bcmFieldSliceSelFpf2, 4,
   5153                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset, 8);
   5154     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   5155                                _bcmFieldSliceSelFpf2, 4,
   5156                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 8,
   5157                                8);
   5158     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   5159                                _bcmFieldSliceSelFpf2, 4,
   5160                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 8,
   5161                                8);
   5162     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp,
   5163                                _bcmFieldSliceSelFpf2, 4,
   5164                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 16,
   5165                                32);
   5166     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   5167                                _bcmFieldSliceSelFpf2, 4,
   5168                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 16,
   5169                                32);
   5170     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp,
   5171                                _bcmFieldSliceSelFpf2, 4,
   5172                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 48,
   5173                                32);
   5174     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   5175                                _bcmFieldSliceSelFpf2, 4,
   5176                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 48,
   5177                                32);
   5178     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   5179                  _bcmFieldSliceSelFpf2, 4, f2_offset + 80, 48);
   5180 
   5181     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   5182                                _bcmFieldSliceSelFpf2, 5,
   5183                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset, 8);
   5184     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   5185                                _bcmFieldSliceSelFpf2, 5,
   5186                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset, 8);
   5187     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   5188                                _bcmFieldSliceSelFpf2, 5,
   5189                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 8,
   5190                                8);
   5191     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   5192                                _bcmFieldSliceSelFpf2, 5,
   5193                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 8,
   5194                                8);
   5195     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp,
   5196                                _bcmFieldSliceSelFpf2, 5,
   5197                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 16,
   5198                                32);
   5199     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   5200                                _bcmFieldSliceSelFpf2, 5,
   5201                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 16,
   5202                                32);
   5203     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp,
   5204                                _bcmFieldSliceSelFpf2, 5,
   5205                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 48,
   5206                                32);
   5207     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   5208                                _bcmFieldSliceSelFpf2, 5,
   5209                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 48,
   5210                                32);
   5211     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   5212                  _bcmFieldSliceSelFpf2, 5, f2_offset + 80, 48);
   5213 
   5214     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6High,
   5215                                _bcmFieldSliceSelFpf2, 6,
   5216                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset, 64);
   5217     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
   5218                                _bcmFieldSliceSelFpf2, 6,
   5219                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset, 64);
   5220     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp6High,
   5221                                _bcmFieldSliceSelFpf2, 6,
   5222                                _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 64,
   5223                                64);
   5224     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   5225                                _bcmFieldSliceSelFpf2, 6,
   5226                                _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 64,
   5227                                64);
   5228 
   5229     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVnTag,
   5230                  _bcmFieldSliceSelFpf2, 7, f2_offset, 33);
   5231     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySnap,
   5232                  _bcmFieldSliceSelFpf2, 7, f2_offset + 64, 40);
   5233     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyLlc,
   5234                  _bcmFieldSliceSelFpf2, 7, f2_offset + 104, 24);
   5235 
   5236     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0,
   5237                  _bcmFieldSliceSelFpf2, 8, f2_offset, 128);
   5238 
   5239     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1,
   5240                  _bcmFieldSliceSelFpf2, 9, f2_offset, 128);
   5241 
   5242     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFcoeSOF,
   5243                  _bcmFieldSliceSelFpf2, 10, f2_offset + 6, 8);
   5244     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanDFCtl,
   5245                  _bcmFieldSliceSelFpf2, 10, f2_offset + 14, 8);
   5246     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanCSCtl,
   5247                  _bcmFieldSliceSelFpf2, 10, f2_offset + 22, 8);
   5248     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanFCtl,
   5249                  _bcmFieldSliceSelFpf2, 10, f2_offset + 30, 24);
   5250     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanType,
   5251                  _bcmFieldSliceSelFpf2, 10, f2_offset + 54, 8);
   5252     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanDstId,
   5253                  _bcmFieldSliceSelFpf2, 10, f2_offset + 62, 24);
   5254     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanSrcId,
   5255                  _bcmFieldSliceSelFpf2, 10, f2_offset + 86, 24);
   5256     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanRCtl,
   5257                  _bcmFieldSliceSelFpf2, 10, f2_offset + 110, 8);
   5258 
   5259     /* FPF3 */
   5260     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   5261                  _bcmFieldSliceSelFpf3, 0, f3_offset + 0, 16);
   5262     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   5263                  _bcmFieldSliceSelFpf3, 0, f3_offset + 0, 12);
   5264     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   5265                  _bcmFieldSliceSelFpf3, 0, f3_offset + 12, 1);
   5266     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   5267                  _bcmFieldSliceSelFpf3, 0, f3_offset + 13, 3);
   5268     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   5269                  _bcmFieldSliceSelFpf3, 0, f3_offset + 16, 16);
   5270 
   5271     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort,
   5272                                _bcmFieldSliceSelFpf3, 1,
   5273                                _bcmFieldSliceIpHeaderSelect, 1, f3_offset + 0,
   5274                                16);
   5275     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   5276                                _bcmFieldSliceSelFpf3, 1,
   5277                                _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 0,
   5278                                16);
   5279     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   5280                                _bcmFieldSliceSelFpf3, 1,
   5281                                _bcmFieldSliceIpHeaderSelect, 1, f3_offset + 16,
   5282                                16);
   5283     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   5284                                _bcmFieldSliceSelFpf3, 1,
   5285                                _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 16,
   5286                                16);
   5287     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   5288                                _bcmFieldSliceSelFpf3, 1,
   5289                                _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 16,
   5290                                16);
   5291     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   5292                                _bcmFieldSliceSelFpf3, 2,
   5293                                _bcmFieldSliceIpHeaderSelect, 1, f3_offset + 0,
   5294                                8);
   5295     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   5296                                _bcmFieldSliceSelFpf3, 2,
   5297                                _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 0,
   5298                                8);
   5299     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   5300                                _bcmFieldSliceSelFpf3, 2,
   5301                                _bcmFieldSliceIpHeaderSelect, 1, f3_offset + 8,
   5302                                8);
   5303     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   5304                                _bcmFieldSliceSelFpf3, 2,
   5305                                _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 8,
   5306                                8);
   5307     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   5308                  _bcmFieldSliceSelFpf3, 2, f3_offset + 16, 8);
   5309     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   5310                  _bcmFieldSliceSelFpf3, 2, f3_offset + 24, 8);
   5311 
   5312 
   5313     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   5314                  _bcmFieldSliceSelFpf3, 3, f3_offset + 0, 8);
   5315     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   5316                  _bcmFieldSliceSelFpf3, 3, f3_offset + 8, 16);
   5317     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   5318                  _bcmFieldSliceSelFpf3, 3, f3_offset + 8, 12);
   5319     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   5320                  _bcmFieldSliceSelFpf3, 3, f3_offset + 20, 1);
   5321     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   5322                  _bcmFieldSliceSelFpf3, 3, f3_offset + 21, 3);
   5323     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   5324                  _bcmFieldSliceSelFpf3, 3, f3_offset + 24, 8);
   5325 
   5326     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTHopCount,
   5327                  _bcmFieldSliceSelFpf3, 5, f3_offset, 8);
   5328     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTVsanId,
   5329                  _bcmFieldSliceSelFpf3, 5, f3_offset + 8, 12);
   5330     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTVsanPri,
   5331                  _bcmFieldSliceSelFpf3, 5, f3_offset + 20, 3);
   5332     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanVFTVersion,
   5333                  _bcmFieldSliceSelFpf3, 5, f3_offset + 23, 2);
   5334 
   5335     /* DWF3 */
   5336     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   5337                             _bcmFieldSliceSelFpf3, 0,
   5338                             _bcmFieldSliceIpHeaderSelect, 1, f3_offset + 0, 8);
   5339     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
   5340                             _bcmFieldSliceSelFpf3, 0,
   5341                             _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 0, 8);
   5342     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl,
   5343                             _bcmFieldSliceSelFpf3, 0,
   5344                             _bcmFieldSliceIpHeaderSelect, 1, f3_offset + 8, 8);
   5345     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   5346                             _bcmFieldSliceSelFpf3, 0,
   5347                             _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 8, 8);
   5348     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   5349                             _bcmFieldSliceSelFpf3, 0,
   5350                             _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 16,
   5351                             6);
   5352     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag,
   5353                             _bcmFieldSliceSelFpf3, 0,
   5354                             _bcmFieldSliceIpHeaderSelect, 1, f3_offset + 22,
   5355                             2);
   5356     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   5357                             _bcmFieldSliceSelFpf3, 0,
   5358                             _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 22,
   5359                             2);
   5360     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   5361                             _bcmFieldSliceSelFpf3, 0,
   5362                             _bcmFieldSliceIpHeaderSelect, 1, f3_offset + 24,
   5363                             8);
   5364     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   5365                             _bcmFieldSliceSelFpf3, 0,
   5366                             _bcmFieldSliceIpHeaderSelect, 0, f3_offset + 24,
   5367                             8);
   5368 
   5369     /* DWF2 */
   5370     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl,
   5371                             _bcmFieldSliceSelFpf2, 0,
   5372                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 0,
   5373                             8);
   5374     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   5375                             _bcmFieldSliceSelFpf2, 0,
   5376                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 0,
   5377                             8);
   5378     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   5379                             _bcmFieldSliceSelFpf2, 0,
   5380                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 8,
   5381                             6);
   5382     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag,
   5383                             _bcmFieldSliceSelFpf2, 0,
   5384                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 14,
   5385                             2);
   5386     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   5387                             _bcmFieldSliceSelFpf2, 0,
   5388                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 14,
   5389                             2);
   5390     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   5391                             _bcmFieldSliceSelFpf2, 0,
   5392                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 16,
   5393                             8);
   5394     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
   5395                             _bcmFieldSliceSelFpf2, 0,
   5396                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 16,
   5397                             8);
   5398     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort,
   5399                             _bcmFieldSliceSelFpf2, 0,
   5400                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 24,
   5401                             16);
   5402     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   5403                             _bcmFieldSliceSelFpf2, 0,
   5404                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 24,
   5405                             16);
   5406     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   5407                             _bcmFieldSliceSelFpf2, 0,
   5408                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 40,
   5409                             16);
   5410     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   5411                             _bcmFieldSliceSelFpf2, 0,
   5412                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 40,
   5413                             16);
   5414     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   5415                             _bcmFieldSliceSelFpf2, 0,
   5416                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 40,
   5417                             16);
   5418     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   5419                             _bcmFieldSliceSelFpf2, 0,
   5420                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 56,
   5421                             8);
   5422     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   5423                             _bcmFieldSliceSelFpf2, 0,
   5424                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 56,
   5425                             8);
   5426     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp,
   5427                             _bcmFieldSliceSelFpf2, 0,
   5428                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 64,
   5429                             32);
   5430     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   5431                             _bcmFieldSliceSelFpf2, 0,
   5432                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 64,
   5433                             32);
   5434     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp,
   5435                             _bcmFieldSliceSelFpf2, 0,
   5436                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset + 96,
   5437                             32);
   5438     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   5439                             _bcmFieldSliceSelFpf2, 0,
   5440                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset + 96,
   5441                             32);
   5442 
   5443     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6,
   5444                             _bcmFieldSliceSelFpf2, 1,
   5445                             _bcmFieldSliceIpHeaderSelect, 1, f2_offset,
   5446                             128);
   5447     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   5448                             _bcmFieldSliceSelFpf2, 1,
   5449                             _bcmFieldSliceIpHeaderSelect, 0, f2_offset,
   5450                             128);
   5451 
   5452     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyData1,
   5453                             _bcmFieldSliceSelFpf2, 2,
   5454                             _bcmFieldSliceSelDisable, 0,
   5455                             f2_offset, 128);
   5456 
   5457     /* DWF1 */
   5458     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc,
   5459                             bcmFieldQualifyExtensionHeaderSubCode,
   5460                             _bcmFieldSliceSelFpf1, 0,
   5461                             _bcmFieldSliceIpHeaderSelect, 0, f1_offset + 0,
   5462                             8);
   5463     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   5464                             _bcmFieldSliceSelFpf1, 0,
   5465                             _bcmFieldSliceIpHeaderSelect, 0, f1_offset + 8,
   5466                             8);
   5467     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   5468                             _bcmFieldSliceSelFpf1, 0,
   5469                             _bcmFieldSliceIpHeaderSelect, 0, f1_offset + 16,
   5470                             8);
   5471     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   5472                             _bcmFieldSliceSelFpf1, 0,
   5473                             _bcmFieldSliceIpHeaderSelect, 0, f1_offset + 24,
   5474                             16);
   5475 
   5476     return (BCM_E_NONE);
   5477 }
   5478 
   5479 /*
   5480  * Function:
   5481  *     _field_td2_egress_qualifiers_init
   5482  * Purpose:
   5483  *     Initialize device stage egress qaualifiers
   5484  *     select codes & offsets
   5485  * Parameters:
   5486  *     unit       - (IN) BCM device number.
   5487  *     stage_fc   - (IN) Field Processor stage control structure.
   5488  *
   5489  * Returns:
   5490  *     BCM_E_NONE
   5491  */
   5492 STATIC int
   5493 _field_td2_egress_qualifiers_init(int unit, _field_stage_t *stage_fc)
   5494 {
   5495     _FP_QUAL_DECL;
   5496     _key_fld_ = KEYf;
   5497 
   5498     /* Input parameters check. */
   5499     if (NULL == stage_fc) {
   5500         return (BCM_E_PARAM);
   5501     }
   5502 
   5503     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageEgress,
   5504                  _bcmFieldSliceSelDisable, 0, 0, 0);
   5505 
   5506     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   5507                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 0, 1);
   5508     /* EG_DVP_CLASS_ID */
   5509     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassTrill,
   5510                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5511                                _bcmFieldSliceSelEgrDvpKey4, 3,
   5512                                2, 12);
   5513     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassWlan,
   5514                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5515                                _bcmFieldSliceSelEgrDvpKey4, 3,
   5516                                2, 12);
   5517     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassVxlan,
   5518                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5519                                _bcmFieldSliceSelEgrDvpKey4, 3,
   5520                                2, 12);
   5521     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL2Gre,
   5522                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5523                                _bcmFieldSliceSelEgrDvpKey4, 3,
   5524                                2, 12);
   5525     /* DVP_VALID + DVP + SPARE_DVP */
   5526     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   5527                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5528                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5529                                1, 17);
   5530     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGports,
   5531                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5532                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5533                                1, 17);
   5534     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGport,
   5535                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5536                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5537                                1, 17);
   5538     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstNivGports,
   5539                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5540                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5541                                1, 17);
   5542     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   5543                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5544                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5545                                1, 17);
   5546     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGports,
   5547                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5548                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5549                                1, 17);
   5550     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGport,
   5551                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5552                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5553                                1, 17);
   5554     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstVxlanGports,
   5555                               _bcmFieldDevSelDisable, 0,
   5556                               _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5557                               _bcmFieldSliceSelEgrDvpKey4, 0,
   5558                               0,
   5559                               1, 17,
   5560                               227, 2, /* DVP TYPE */
   5561                               0, 0,
   5562                               0
   5563                               );
   5564     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   5565                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5566                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5567                                1, 17);
   5568     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGports,
   5569                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5570                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5571                                1, 17);
   5572     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   5573                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5574                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5575                                1, 17);
   5576     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGports,
   5577                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5578                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5579                                1, 17);
   5580     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5581                                 bcmFieldQualifyDestVirtualPortValid,
   5582                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5583                                _bcmFieldSliceSelEgrDvpKey4, 0,
   5584                                1, 1);
   5585 
   5586     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   5587                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 18, 4);
   5588     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   5589                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 22, 2);
   5590     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   5591                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 24, 2);
   5592     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   5593                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 26, 16);
   5594     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   5595                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 42, 48);
   5596     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   5597                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 90, 48);
   5598     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
   5599                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 138, 1);
   5600     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   5601                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 139, 1);
   5602     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   5603                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 140, 1);
   5604     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   5605                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 141, 16);
   5606     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   5607                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 141, 1);
   5608     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   5609                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 142, 3);
   5610     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   5611                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 145, 12);
   5612     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   5613                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 157, 7);
   5614     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   5615                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 164, 1);
   5616     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   5617                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 165, 1);
   5618     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   5619                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 166, 16);
   5620     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   5621                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 166, 12);
   5622     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   5623                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 178, 1);
   5624     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   5625                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 179, 3);
   5626     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   5627                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 182, 2);
   5628     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   5629                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 184, 1);
   5630     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   5631                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 185, 8);
   5632     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   5633                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5634                                _bcmFieldSliceSelEgrClassF4, 0,
   5635                                193, 13
   5636                                );
   5637     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   5638                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5639                                _bcmFieldSliceSelEgrClassF4, 0,
   5640                                193, 13
   5641                                );
   5642     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   5643                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5644                                _bcmFieldSliceSelEgrClassF4, 0,
   5645                                193, 13
   5646                                );
   5647     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   5648                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5649                                _bcmFieldSliceSelEgrClassF4, 0,
   5650                                193, 13
   5651                                );
   5652     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   5653                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5654                                _bcmFieldSliceSelEgrClassF4, 0,
   5655                                193, 13
   5656                                );
   5657     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   5658                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5659                                _bcmFieldSliceSelEgrClassF4, 0,
   5660                                193, 13
   5661                                );
   5662     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   5663                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5664                                _bcmFieldSliceSelEgrClassF4, 0,
   5665                                193, 13
   5666                                );
   5667     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   5668                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5669                                _bcmFieldSliceSelEgrClassF4, 0,
   5670                                193, 13
   5671                                );
   5672     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   5673                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5674                                _bcmFieldSliceSelEgrClassF4, 1,
   5675                                193, 7);
   5676     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyCpuQueue,
   5677                      _bcmFieldDevSelDisable, 0,
   5678                      _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5679                      _bcmFieldSliceSelEgrClassF4, 2,
   5680                      0,
   5681                      193, 6, /* CpuCos - 6 bits */
   5682                      16, 2,  /* Original - Data and Mask bits[5:4] */
   5683                      0, 0,
   5684                      0
   5685                      );
   5686     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   5687                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5688                                _bcmFieldSliceSelEgrClassF4, 0,
   5689                                193, 13
   5690                                );
   5691     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5692                                bcmFieldQualifyIngressInterfaceClassPort,
   5693                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5694                                _bcmFieldSliceSelEgrClassF4, 0,
   5695                                193, 13
   5696                                );
   5697     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5698                                bcmFieldQualifyIngressInterfaceClassVPort,
   5699                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5700                                _bcmFieldSliceSelEgrClassF4, 0,
   5701                                193, 13
   5702                                );
   5703     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5704                                bcmFieldQualifyInterfaceClassVPort,
   5705                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5706                                _bcmFieldSliceSelEgrClassF4, 0,
   5707                                2, 12
   5708                                );
   5709 
   5710     /* L3_PKT_TYPE */
   5711     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   5712                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5713                                _bcmFieldSliceSelEgrMdlKey4, 0,
   5714                                206, 5);
   5715     /* MDL */
   5716     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOamMdl,
   5717                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   5718                                _bcmFieldSliceSelEgrMdlKey4, 1,
   5719                                206, 3);
   5720     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   5721                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 211, 12);
   5722     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   5723                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 211, 13);
   5724     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   5725                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 211, 13);
   5726 
   5727     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   5728                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 224, 2);
   5729 
   5730     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   5731                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 226, 1);
   5732 
   5733     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   5734                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 1);
   5735     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   5736                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 1, 4);
   5737     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   5738                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 5, 2);
   5739     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   5740                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 7, 2);
   5741     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   5742                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 9, 6);
   5743     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   5744                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 15, 16);
   5745     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   5746                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 31, 16);
   5747     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   5748                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 31, 16);    
   5749     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   5750                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 47, 8);
   5751     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   5752                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 55, 8);
   5753     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   5754                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 63, 32);
   5755     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   5756                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 95, 32);
   5757     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   5758                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 127, 8);
   5759     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   5760                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 135, 1);
   5761     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   5762                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 136, 1);
   5763     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   5764                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 137, 12);
   5765     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   5766                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 149, 7);
   5767     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   5768                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 156, 1);
   5769     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   5770                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 157, 1);
   5771     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   5772                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 158, 16);
   5773     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   5774                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 158, 12);
   5775     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   5776                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 170, 1);
   5777     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   5778                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 171, 3);
   5779     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   5780                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 174, 2);
   5781     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   5782                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 176, 1);
   5783     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   5784                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 177, 8);
   5785     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   5786                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 185, 7);
   5787     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   5788                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 192, 5);
   5789     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   5790                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5791                                _bcmFieldSliceSelEgrClassF1, 0,
   5792                                197, 13
   5793                                );
   5794     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   5795                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5796                                _bcmFieldSliceSelEgrClassF1, 0,
   5797                                197, 13
   5798                                );
   5799     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   5800                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5801                                _bcmFieldSliceSelEgrClassF1, 0,
   5802                                197, 13
   5803                                );
   5804     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   5805                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5806                                _bcmFieldSliceSelEgrClassF1, 0,
   5807                                197, 13
   5808                                );
   5809     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   5810                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5811                                _bcmFieldSliceSelEgrClassF1, 0,
   5812                                197, 13
   5813                                );
   5814     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   5815                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5816                                _bcmFieldSliceSelEgrClassF1, 0,
   5817                                197, 13
   5818                                );
   5819     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   5820                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5821                                _bcmFieldSliceSelEgrClassF1, 0,
   5822                                197, 13
   5823                                );
   5824     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   5825                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5826                                _bcmFieldSliceSelEgrClassF1, 0,
   5827                                197, 13
   5828                                );
   5829     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassTrill,
   5830                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5831                                _bcmFieldSliceSelEgrClassF1, 0,
   5832                                197, 12
   5833                                );
   5834     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL2Gre,
   5835                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5836                                _bcmFieldSliceSelEgrClassF1, 0,
   5837                                197, 12
   5838                                );
   5839     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassVxlan,
   5840                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5841                                _bcmFieldSliceSelEgrClassF1, 0,
   5842                                197, 12
   5843                                );
   5844     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   5845                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5846                                _bcmFieldSliceSelEgrClassF1, 0,
   5847                                197, 13
   5848                                );
   5849     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5850                                bcmFieldQualifyIngressInterfaceClassPort,
   5851                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5852                                _bcmFieldSliceSelEgrClassF1, 0,
   5853                                197, 13
   5854                                );
   5855     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5856                                bcmFieldQualifyIngressInterfaceClassVPort,
   5857                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5858                                _bcmFieldSliceSelEgrClassF1, 0,
   5859                                197, 13
   5860                                );
   5861     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5862                                bcmFieldQualifyInterfaceClassVPort,
   5863                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   5864                                _bcmFieldSliceSelEgrClassF1, 0,
   5865                                197, 12
   5866                                );
   5867 
   5868     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   5869                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 210, 12);
   5870     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   5871                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 210, 13);
   5872     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   5873                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 210, 13);
   5874 
   5875     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   5876                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 223, 2);
   5877 
   5878     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   5879                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 225, 1);
   5880     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
   5881                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 0);
   5882 
   5883 
   5884     /* KEY1 without v4 specific fields. */
   5885     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   5886                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 0, 1);
   5887     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   5888                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 1, 4);
   5889     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   5890                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 5, 2);
   5891     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   5892                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 9, 6);
   5893     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   5894                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 15, 16);
   5895     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   5896                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 31, 16);
   5897 
   5898     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   5899                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 31, 16);
   5900 
   5901     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   5902                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 47, 8);
   5903     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   5904                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 55, 8);
   5905     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   5906                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 127, 8);
   5907     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   5908                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 135, 1);
   5909     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   5910                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 136, 1);
   5911     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   5912                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 137, 12);
   5913     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   5914                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 149, 7);
   5915     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   5916                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 156, 1);
   5917     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   5918                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 157, 1);
   5919     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   5920                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 158, 16);
   5921     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   5922                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 158, 12);
   5923     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   5924                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 170, 1);
   5925     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   5926                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 171, 3);
   5927     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   5928                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 174, 2);
   5929     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   5930                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 176, 1);
   5931     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   5932                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 177, 8);
   5933     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   5934                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 185, 7);
   5935     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   5936                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 192, 5);
   5937     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   5938                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5939                                _bcmFieldSliceSelEgrClassF1, 0,
   5940                                197, 13);
   5941     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   5942                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5943                                _bcmFieldSliceSelEgrClassF1, 0,
   5944                                197, 13);
   5945     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   5946                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5947                                _bcmFieldSliceSelEgrClassF1, 0,
   5948                                197, 13);
   5949     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   5950                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5951                                _bcmFieldSliceSelEgrClassF1, 0,
   5952                                197, 13);
   5953     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   5954                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5955                                _bcmFieldSliceSelEgrClassF1, 0,
   5956                                197, 13);
   5957     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   5958                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5959                                _bcmFieldSliceSelEgrClassF1, 0,
   5960                                197, 13);
   5961     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   5962                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5963                                _bcmFieldSliceSelEgrClassF1, 0,
   5964                                197, 13);
   5965     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   5966                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5967                                _bcmFieldSliceSelEgrClassF1, 0,
   5968                                197, 13);
   5969     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassTrill,
   5970                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5971                                _bcmFieldSliceSelEgrClassF1, 0,
   5972                                197, 12);
   5973     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL2Gre,
   5974                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5975                                _bcmFieldSliceSelEgrClassF1, 0,
   5976                                197, 12);
   5977     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassVxlan,
   5978                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5979                                _bcmFieldSliceSelEgrClassF1, 0,
   5980                                197, 12);
   5981     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   5982                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5983                                _bcmFieldSliceSelEgrClassF1, 0,
   5984                                197, 13);
   5985     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5986                                bcmFieldQualifyIngressInterfaceClassPort,
   5987                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5988                                _bcmFieldSliceSelEgrClassF1, 0,
   5989                                197, 13);
   5990     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5991                                bcmFieldQualifyIngressInterfaceClassVPort,
   5992                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5993                                _bcmFieldSliceSelEgrClassF1, 0,
   5994                                197, 13);
   5995     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   5996                                bcmFieldQualifyInterfaceClassVPort,
   5997                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   5998                                _bcmFieldSliceSelEgrClassF1, 0,
   5999                                197, 12);
   6000     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   6001                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 210, 12);
   6002     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   6003                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 210, 13);
   6004     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   6005                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 210, 13);
   6006     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   6007                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 223, 2);
   6008     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   6009                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 225, 1);
   6010 
   6011 
   6012     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   6013                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 1);
   6014     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   6015                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 1, 8);
   6016     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   6017                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6018                                _bcmFieldSliceIp6AddrSelect,
   6019                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP6,
   6020                                9, 128);
   6021     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   6022                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6023                                _bcmFieldSliceIp6AddrSelect,
   6024                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_DIP6,
   6025                                9, 128);
   6026     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
   6027                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6028                                _bcmFieldSliceIp6AddrSelect,
   6029                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64,
   6030                                9, 64);
   6031     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   6032                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6033                                _bcmFieldSliceIp6AddrSelect,
   6034                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64,
   6035                                73, 64);
   6036     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   6037                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 137, 8);
   6038     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   6039                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 145, 1);
   6040     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   6041                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 146, 1);
   6042     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   6043                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 147, 12);
   6044     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   6045                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 159, 7);
   6046     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   6047                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 166, 1);
   6048     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   6049                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 167, 1);
   6050     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   6051                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 168, 16);
   6052     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   6053                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 168, 12);
   6054     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   6055                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 180, 1);
   6056     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   6057                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 181, 3);
   6058     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   6059                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 184, 2);
   6060     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   6061                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 186, 1);
   6062     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   6063                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 187, 8);
   6064     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   6065                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6066                                _bcmFieldSliceSelEgrClassF2, 0,
   6067                                195, 13
   6068                                );
   6069     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   6070                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6071                                _bcmFieldSliceSelEgrClassF2, 0,
   6072                                195, 13
   6073                                );
   6074     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   6075                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6076                                _bcmFieldSliceSelEgrClassF2, 0,
   6077                                195, 13
   6078                                );
   6079     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   6080                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6081                                _bcmFieldSliceSelEgrClassF2, 0,
   6082                                195, 13
   6083                                );
   6084     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   6085                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6086                                _bcmFieldSliceSelEgrClassF2, 0,
   6087                                195, 13
   6088                                );
   6089     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   6090                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6091                                _bcmFieldSliceSelEgrClassF2, 0,
   6092                                195, 13
   6093                                );
   6094     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   6095                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6096                                _bcmFieldSliceSelEgrClassF2, 0,
   6097                                195, 13
   6098                                );
   6099     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   6100                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6101                                _bcmFieldSliceSelEgrClassF2, 0,
   6102                                195, 13
   6103                                );
   6104     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   6105                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6106                                _bcmFieldSliceSelEgrClassF2, 3,
   6107                                195, 7
   6108                                );
   6109     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   6110                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6111                                _bcmFieldSliceSelEgrClassF2, 0,
   6112                                195, 13
   6113                                );
   6114     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   6115                                bcmFieldQualifyIngressInterfaceClassPort,
   6116                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6117                                _bcmFieldSliceSelEgrClassF2, 0,
   6118                                195, 13
   6119                                );
   6120     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   6121                                bcmFieldQualifyIngressInterfaceClassVPort,
   6122                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6123                                _bcmFieldSliceSelEgrClassF2, 0,
   6124                                195, 13
   6125                                );
   6126     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   6127                                bcmFieldQualifyInterfaceClassVPort,
   6128                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   6129                                _bcmFieldSliceSelEgrClassF2, 0,
   6130                                195, 12
   6131                                );
   6132 
   6133     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   6134                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 208, 5);
   6135 
   6136     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   6137                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 213, 12);
   6138     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   6139                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 213, 13);
   6140     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   6141                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 213, 13);
   6142 
   6143     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   6144                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 226, 2);
   6145 
   6146     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   6147                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 228, 1);
   6148     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   6149                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 0);
   6150 
   6151     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   6152                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 1);
   6153     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   6154                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 1, 4);
   6155     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   6156                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 5, 2);
   6157     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   6158                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 7, 2);
   6159     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   6160                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 9, 6);
   6161     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   6162                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 15, 16);
   6163     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   6164                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 31, 16);
   6165     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   6166                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 31, 16);
   6167     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   6168                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 47, 8);
   6169     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   6170                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 55, 128);
   6171     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   6172                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 183, 8);
   6173     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   6174                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 191, 8);
   6175     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   6176                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 199, 5);
   6177     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassTrill,
   6178                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3,
   6179                                _bcmFieldSliceSelEgrClassF3, 2,
   6180                                204, 12);
   6181     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL2Gre,
   6182                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3,
   6183                                _bcmFieldSliceSelEgrClassF3, 2,
   6184                                204, 12);
   6185     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassVxlan,
   6186                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3,
   6187                                _bcmFieldSliceSelEgrClassF3, 2,
   6188                                204, 12);
   6189     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   6190                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 216, 1);
   6191     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   6192                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 0);
   6193 #if 0
   6194 /* FCOE EFP_KEY5 support is not enabled in SDK.
   6195 Uncomment this block when support is added */
   6196     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   6197                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 126, 1);
   6198     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   6199                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 127, 1);
   6200     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   6201                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 128, 12);
   6202     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   6203                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 140, 7);
   6204     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   6205                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 147, 1);
   6206     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   6207                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 148, 1);
   6208     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   6209                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 149, 16);
   6210     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   6211                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 149, 12);
   6212     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   6213                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 161, 1);
   6214     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   6215                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 162, 3);
   6216     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   6217                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 165, 2);
   6218     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   6219                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 167, 1);
   6220     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   6221                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 168, 8);
   6222     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   6223                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 176, 7);
   6224     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   6225                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 183, 1);
   6226     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   6227                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6228                                _bcmFieldSliceSelEgrClassF1, 0,
   6229                                200, 13
   6230                                );
   6231     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   6232                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6233                                _bcmFieldSliceSelEgrClassF1, 0,
   6234                                200, 13
   6235                                );
   6236     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   6237                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6238                                _bcmFieldSliceSelEgrClassF1, 0,
   6239                                200, 13
   6240                                );
   6241     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   6242                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6243                                _bcmFieldSliceSelEgrClassF1, 0,
   6244                                200, 13
   6245                                );
   6246     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   6247                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6248                                _bcmFieldSliceSelEgrClassF1, 0,
   6249                                200, 13
   6250                                );
   6251     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   6252                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6253                                _bcmFieldSliceSelEgrClassF1, 0,
   6254                                200, 13
   6255                                );
   6256     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   6257                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6258                                _bcmFieldSliceSelEgrClassF1, 0,
   6259                                200, 13
   6260                                );
   6261     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   6262                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6263                                _bcmFieldSliceSelEgrClassF1, 0,
   6264                                200, 13
   6265                                );
   6266     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassTrill,
   6267                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6268                                _bcmFieldSliceSelEgrClassF1, 3,
   6269                                200, 12);
   6270     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClassL2Gre,
   6271                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6272                                _bcmFieldSliceSelEgrClassF1, 3,
   6273                                200, 12);
   6274     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   6275                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6276                                _bcmFieldSliceSelEgrClassF1, 0,
   6277                                200, 13
   6278                                );
   6279     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressInterfaceClassPort,
   6280                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6281                                _bcmFieldSliceSelEgrClassF1, 0,
   6282                                200, 13
   6283                                );
   6284    _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressInterfaceClassVPort,
   6285                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5,
   6286                                _bcmFieldSliceSelEgrClassF1, 0,
   6287                                200, 13
   6288                                );
   6289     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   6290                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY5, 198, 2);
   6291 #endif
   6292  
   6293     return (BCM_E_NONE);
   6294 }
   6295 
   6296 /*
   6297  * Function:
   6298  *     _bcm_field_td2_ingress_selcodes_install
   6299  *
   6300  * Purpose:
   6301  *     Writes the field select codes (ie. FPFx).
   6302  *     for IFP (_BCM_FIELD_STAGE_INGRESS) lookup stage.
   6303  *
   6304  * Parameters:
   6305  *     unit  - BCM device number
   6306  *     fs    - slice that needs its select codes written
   6307  *
   6308  * Returns:
   6309  *     BCM_E_XXX
   6310  */
   6311 
   6312 int
   6313 _bcm_field_td2_ingress_selcodes_install(int            unit,
   6314                                        _field_group_t *fg,
   6315                                        uint8          slice_num,
   6316                                        bcm_pbmp_t     *pbmp,
   6317                                        int            selcode_idx
   6318                                        )
   6319 {
   6320 
   6321 
   6322     _field_sel_t * const          sel = &fg->sel_codes[selcode_idx];
   6323     const unsigned                pfs_idx_count = soc_mem_index_count(unit, FP_PORT_FIELD_SELm);
   6324     int                           errcode = BCM_E_NONE;
   6325     bcm_port_t                    idx;
   6326     uint32                        buf[SOC_MAX_MEM_FIELD_WORDS];
   6327     SHR_BITDCL                    *pfs_bmp = 0;
   6328 
   6329     BCM_IF_ERROR_RETURN(_bcm_field_trx_ingress_selcodes_install(unit,
   6330                 fg,
   6331                 slice_num,
   6332                 pbmp,
   6333                 selcode_idx
   6334                 )
   6335             );
   6336 
   6337     /* Get port field select table size and allocated bitmap of indexes
   6338      * applicable to the group.
   6339      */
   6340     _FP_XGS3_ALLOC(pfs_bmp,
   6341             MAX(SHR_BITALLOCSIZE(pfs_idx_count),
   6342                 sizeof(bcm_pbmp_t)
   6343                ),
   6344             "PFS bmp"
   6345             );
   6346 
   6347     if (pfs_bmp == 0) {
   6348         return (BCM_E_MEMORY);
   6349     }
   6350 
   6351     /* Populate pfs indexes applicable for the group. */
   6352     errcode = _bcm_field_trx_ingress_pfs_bmap_get(unit,
   6353             fg,
   6354             pbmp,
   6355             selcode_idx,
   6356             pfs_bmp
   6357             );
   6358     if (BCM_FAILURE(errcode)) {
   6359         goto cleanup;
   6360     }
   6361 
   6362     for (idx = 0; idx < pfs_idx_count; idx++) {
   6363         static const soc_field_t fldtbl[][2] = {
   6364             { SLICE0_NORMALIZE_IP_ADDRf,  SLICE0_NORMALIZE_MAC_ADDRf },
   6365             { SLICE1_NORMALIZE_IP_ADDRf,  SLICE1_NORMALIZE_MAC_ADDRf },
   6366             { SLICE2_NORMALIZE_IP_ADDRf,  SLICE2_NORMALIZE_MAC_ADDRf },
   6367             { SLICE3_NORMALIZE_IP_ADDRf,  SLICE3_NORMALIZE_MAC_ADDRf },
   6368             { SLICE4_NORMALIZE_IP_ADDRf,  SLICE4_NORMALIZE_MAC_ADDRf },
   6369             { SLICE5_NORMALIZE_IP_ADDRf,  SLICE5_NORMALIZE_MAC_ADDRf },
   6370             { SLICE6_NORMALIZE_IP_ADDRf,  SLICE6_NORMALIZE_MAC_ADDRf },
   6371             { SLICE7_NORMALIZE_IP_ADDRf,  SLICE7_NORMALIZE_MAC_ADDRf },
   6372             { SLICE8_NORMALIZE_IP_ADDRf,  SLICE8_NORMALIZE_MAC_ADDRf },
   6373             { SLICE9_NORMALIZE_IP_ADDRf,  SLICE9_NORMALIZE_MAC_ADDRf },
   6374             { SLICE10_NORMALIZE_IP_ADDRf, SLICE10_NORMALIZE_MAC_ADDRf },
   6375             { SLICE11_NORMALIZE_IP_ADDRf, SLICE11_NORMALIZE_MAC_ADDRf }
   6376         };
   6377 
   6378         if (0 == SHR_BITGET(pfs_bmp, idx)) {
   6379             continue;
   6380         }
   6381         sal_memset(buf, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32));
   6382         /* Read Port's current entry in FP_PORT_FIELD_SEL table */
   6383         errcode = soc_mem_read(unit,
   6384                 FP_PORT_FIELD_SELm,
   6385                 MEM_BLOCK_ANY,
   6386                 idx,
   6387                 buf
   6388                 );
   6389         if (BCM_FAILURE(errcode)) {
   6390             goto cleanup;
   6391         }
   6392 
   6393         if (sel->normalize_ip_sel != _FP_SELCODE_DONT_CARE) {
   6394             soc_mem_field32_set(unit,
   6395                     FP_PORT_FIELD_SELm,
   6396                     buf,
   6397                     fldtbl[slice_num][0],
   6398                     sel->normalize_ip_sel
   6399                     );
   6400         }
   6401         if (sel->normalize_mac_sel != _FP_SELCODE_DONT_CARE) {
   6402             soc_mem_field32_set(unit,
   6403                     FP_PORT_FIELD_SELm,
   6404                     buf,
   6405                     fldtbl[slice_num][1],
   6406                     sel->normalize_mac_sel
   6407                     );
   6408         }
   6409 
   6410         /* Write each port's new entry */
   6411         errcode = soc_mem_write(unit,
   6412                 FP_PORT_FIELD_SELm,
   6413                 MEM_BLOCK_ALL,
   6414                 idx,
   6415                 buf
   6416                 );
   6417         if (BCM_FAILURE(errcode)) {
   6418             goto cleanup;
   6419         }
   6420     }
   6421 cleanup:
   6422     if (pfs_bmp) {
   6423         sal_free(pfs_bmp);
   6424     }
   6425     return (errcode);
   6426 
   6427 
   6428 }
   6429 
   6430 /*
   6431  * Function:
   6432  *     _bcm_field_td2_lookup_selcodes_install
   6433  *
   6434  * Purpose:
   6435  *     Writes the field select codes (ie. FPFx).
   6436  *     for VFP (_BCM_FIELD_STAGE_LOOKUP) lookup stage.
   6437  *
   6438  * Parameters:
   6439  *     unit  - BCM device number
   6440  *     fs    - slice that needs its select codes written
   6441  *
   6442  * Returns:
   6443  *     BCM_E_XXX
   6444  */
   6445 
   6446 int
   6447 _bcm_field_td2_lookup_selcodes_install(int            unit,
   6448                                        _field_group_t *fg,
   6449                                        uint8          slice_num,
   6450                                        int            selcode_idx
   6451                                        )
   6452 {
   6453     static const soc_field_t s_type_fld_tbl[] = {
   6454         SLICE_0_S_TYPE_SELf,
   6455         SLICE_1_S_TYPE_SELf,
   6456         SLICE_2_S_TYPE_SELf,
   6457         SLICE_3_S_TYPE_SELf
   6458     };
   6459 
   6460     _field_sel_t * const sel = &fg->sel_codes[selcode_idx];
   6461     int           errcode = BCM_E_NONE;
   6462     uint64        regval;
   6463     uint64        val;
   6464 
   6465     BCM_IF_ERROR_RETURN(soc_reg64_get(unit,
   6466                                       VFP_KEY_CONTROL_1r,
   6467                                       REG_PORT_ANY,
   6468                                       0,
   6469                                       &regval
   6470                                       )
   6471                         );
   6472 
   6473 
   6474     if ((fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE)
   6475         && (selcode_idx & 1)
   6476         ) {
   6477         if (sel->fpf2 != _FP_SELCODE_DONT_CARE) {
   6478             COMPILER_64_SET(val, 0, sel->fpf2);
   6479             soc_reg64_field_set(unit,
   6480                                 VFP_KEY_CONTROL_1r,
   6481                                 &regval,
   6482                                 _bcm_field_trx_vfp_double_wide_sel[slice_num],
   6483                                 val
   6484                                 );
   6485         }
   6486     } else {
   6487         if (sel->fpf2 != _FP_SELCODE_DONT_CARE) {
   6488             COMPILER_64_SET(val, 0, sel->fpf2);
   6489             soc_reg64_field_set(unit,
   6490                                 VFP_KEY_CONTROL_1r,
   6491                                 &regval,
   6492                                 _bcm_field_trx_vfp_field_sel[slice_num][0],
   6493                                 val
   6494                                 );
   6495         }
   6496         if (sel->fpf3 != _FP_SELCODE_DONT_CARE) {
   6497             COMPILER_64_SET(val, 0, sel->fpf3);
   6498             soc_reg64_field_set(unit,
   6499                                 VFP_KEY_CONTROL_1r,
   6500                                 &regval,
   6501                                 _bcm_field_trx_vfp_field_sel[slice_num][1],
   6502                                 val
   6503                                 );
   6504         }
   6505     }
   6506 
   6507 
   6508     if (sel->src_entity_sel != _FP_SELCODE_DONT_CARE) {
   6509         uint32 value;
   6510 
   6511 
   6512         switch (sel->src_entity_sel) {
   6513             case _bcmFieldFwdEntityPortGroupNum:
   6514                 value = 4;
   6515                 break;
   6516             case _bcmFieldFwdEntityMplsGport:
   6517             case _bcmFieldFwdEntityNivGport:
   6518             case _bcmFieldFwdEntityMimGport:
   6519             case _bcmFieldFwdEntityWlanGport:
   6520             case _bcmFieldFwdEntityVxlanGport:
   6521             case _bcmFieldFwdEntityVlanGport:
   6522                 value = 0;
   6523                 break;
   6524             case _bcmFieldFwdEntityModPortGport:
   6525                 value = 2;
   6526                 break;
   6527             case _bcmFieldFwdEntityGlp:
   6528                 value = 1;
   6529                 break;
   6530             default:
   6531                 return (BCM_E_INTERNAL);
   6532         }
   6533         COMPILER_64_SET(val, 0, value);
   6534         soc_reg64_field_set(unit,
   6535                             VFP_KEY_CONTROL_1r,
   6536                             &regval,
   6537                             s_type_fld_tbl[slice_num],
   6538                             val
   6539                             );
   6540     }
   6541 
   6542     BCM_IF_ERROR_RETURN(soc_reg64_set(unit,
   6543                                       VFP_KEY_CONTROL_1r,
   6544                                       REG_PORT_ANY,
   6545                                       0,
   6546                                       regval
   6547                                       )
   6548                         );
   6549 
   6550     /* Set inner/outer ip header selection. */
   6551     if (sel->ip_header_sel != _FP_SELCODE_DONT_CARE) {
   6552         errcode = soc_reg_field32_modify(
   6553                       unit,
   6554                       VFP_KEY_CONTROL_2r,
   6555                       REG_PORT_ANY,
   6556                       _bcm_field_trx_vfp_ip_header_sel[slice_num],
   6557                       sel->ip_header_sel
   6558                       );
   6559     }
   6560 
   6561     return (errcode);
   6562 }
   6563 
   6564 STATIC int
   6565 _field_td2_egress_selcodes_install(int            unit,
   6566                                    _field_group_t *fg,
   6567                                    uint8          slice_num,
   6568                                    bcm_pbmp_t     *pbmp,
   6569                                    int            selcode_idx
   6570                                    )
   6571 {
   6572     static const soc_field_t fldtbl[][4] = {
   6573         { SLICE_0_F1f, SLICE_1_F1f, SLICE_2_F1f, SLICE_3_F1f },
   6574         { SLICE_0_F2f, SLICE_1_F2f, SLICE_2_F2f, SLICE_3_F2f },
   6575         { SLICE_0_F4f, SLICE_1_F4f, SLICE_2_F4f, SLICE_3_F4f }
   6576     };
   6577 
   6578     static const soc_field_t dvpfldtbl[4] = {
   6579         SLICE_0f, SLICE_1f, SLICE_2f, SLICE_3f };
   6580     
   6581     static const soc_field_t mdlfldtbl[4] = {
   6582         SLICE_0f, SLICE_1f, SLICE_2f, SLICE_3f };
   6583 
   6584 #if defined(BCM_TRIDENT2PLUS_SUPPORT)
   6585     static const soc_field_t oamoverlaytbl[4] = {
   6586         SLICE_0_OAM_OVERLAY_ENABLEf,SLICE_1_OAM_OVERLAY_ENABLEf,
   6587         SLICE_2_OAM_OVERLAY_ENABLEf, SLICE_3_OAM_OVERLAY_ENABLEf };
   6588 
   6589     static const soc_field_t efp_dest_port_selector_flds[][2] = {
   6590              {SLICE_0_F1_DEST_SELf, SLICE_0_F5_DEST_SELf},
   6591              {SLICE_1_F1_DEST_SELf, SLICE_1_F5_DEST_SELf},
   6592              {SLICE_2_F1_DEST_SELf, SLICE_2_F5_DEST_SELf},
   6593              {SLICE_3_F1_DEST_SELf, SLICE_3_F5_DEST_SELf},
   6594         };
   6595 #endif
   6596 
   6597     _field_sel_t * const sel = &fg->sel_codes[selcode_idx];
   6598 
   6599     if (sel->egr_class_f1_sel != _FP_SELCODE_DONT_CARE) {
   6600         BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit,
   6601                                                    EFP_CLASSID_SELECTORr,
   6602                                                    REG_PORT_ANY,
   6603                                                    fldtbl[0][slice_num],
   6604                                                    sel->egr_class_f1_sel
   6605                                                    )
   6606                             );
   6607     }
   6608     if (sel->egr_class_f2_sel != _FP_SELCODE_DONT_CARE) {
   6609         BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit,
   6610                                                    EFP_CLASSID_SELECTORr,
   6611                                                    REG_PORT_ANY,
   6612                                                    fldtbl[1][slice_num],
   6613                                                    sel->egr_class_f2_sel
   6614                                                    )
   6615                             );
   6616     }
   6617     if (sel->egr_class_f4_sel != _FP_SELCODE_DONT_CARE) {
   6618         BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit,
   6619                                                    EFP_CLASSID_SELECTORr,
   6620                                                    REG_PORT_ANY,
   6621                                                    fldtbl[2][slice_num],
   6622                                                    sel->egr_class_f4_sel
   6623                                                    )
   6624                             );
   6625     }
   6626     /* SELECTOR CODES for EFP_KEY4_DVP_SELECTOR register */
   6627     if (sel->egr_key4_dvp_sel != _FP_SELCODE_DONT_CARE) {
   6628         BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit,
   6629                                                    EFP_KEY4_DVP_SELECTORr,
   6630                                                    REG_PORT_ANY,
   6631                                                    dvpfldtbl[slice_num],
   6632                                                    sel->egr_key4_dvp_sel
   6633                                                   )
   6634                             );
   6635     }
   6636     /* SELECTOR CODES for EFP_KEY4_MDL_SELECTOR register */
   6637     if (sel->egr_key4_mdl_sel != _FP_SELCODE_DONT_CARE) {
   6638         BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit,
   6639                                                    EFP_KEY4_MDL_SELECTORr,
   6640                                                    REG_PORT_ANY,
   6641                                                    mdlfldtbl[slice_num],
   6642                                                    sel->egr_key4_mdl_sel
   6643                                                   )
   6644                             );
   6645     }
   6646 
   6647     /* SELECTOR CODES for EFP_KEY4_MDL_SELECTOR register
   6648      * for field  OAM_OVERLAY_ENABLE
   6649      */
   6650 #if defined BCM_TRIDENT2PLUS_SUPPORT
   6651     if (soc_feature(unit, soc_feature_fp_based_oam)) {
   6652         if (sel->egr_oam_overlay_sel != _FP_SELCODE_DONT_CARE) {
   6653             BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit,
   6654                                                    EFP_KEY4_MDL_SELECTORr,
   6655                                                    REG_PORT_ANY,
   6656                                                    oamoverlaytbl[slice_num],
   6657                                                    sel->egr_oam_overlay_sel
   6658                                                 )
   6659                             );
   6660 
   6661         }
   6662     }
   6663 
   6664     if (SOC_REG_IS_VALID(unit, EFP_DEST_PORT_SELECTORr)) {
   6665         if (sel->egr_dest_port_f1_sel != _FP_SELCODE_DONT_CARE) {
   6666             BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit,
   6667                         EFP_DEST_PORT_SELECTORr,
   6668                         REG_PORT_ANY,
   6669                         efp_dest_port_selector_flds[slice_num][0],
   6670                         sel->egr_dest_port_f1_sel
   6671                         )
   6672                     );
   6673         }
   6674         if (sel->egr_dest_port_f5_sel != _FP_SELCODE_DONT_CARE) {
   6675             BCM_IF_ERROR_RETURN(soc_reg_field32_modify(unit,
   6676                         EFP_DEST_PORT_SELECTORr,
   6677                         REG_PORT_ANY,
   6678                         efp_dest_port_selector_flds[slice_num][1],
   6679                         sel->egr_dest_port_f5_sel
   6680                         )
   6681                     );
   6682         }
   6683     }
   6684 #endif
   6685     return (BCM_E_NONE);
   6686 }
   6687 
   6688 /*
   6689  * Function:
   6690  *     _bcm_field_td2_lookup_mode_set
   6691  *
   6692  * Purpose:
   6693  *    Auxiliary routine used to set group pairing mode.
   6694  * Parameters:
   6695  *     unit       - (IN) BCM device number.
   6696  *     slice_numb - (IN) Slice number to set mode for.
   6697  *     fg         - (IN) Installed group structure.
   6698  *     flags      - (IN) New group/slice mode.
   6699  *
   6700  * Returns:
   6701  *     BCM_E_XXX
   6702  */
   6703 int
   6704 _bcm_field_td2_lookup_mode_set(int            unit,
   6705                                uint8          slice_num,
   6706                                _field_group_t *fg,
   6707                                uint8          flags
   6708                                )
   6709 {
   6710     static const soc_field_t wide_mode_flds[] = {
   6711         SLICE_0_DOUBLE_WIDE_MODEf,
   6712         SLICE_1_DOUBLE_WIDE_MODEf,
   6713         SLICE_2_DOUBLE_WIDE_MODEf,
   6714         SLICE_3_DOUBLE_WIDE_MODEf
   6715     }, pairing_flds[] = {
   6716         SLICE1_0_PAIRINGf,
   6717         SLICE3_2_PAIRINGf
   6718     };
   6719 
   6720     uint64 vfp_key_control_1_buf;
   6721 
   6722     BCM_IF_ERROR_RETURN(soc_reg64_get(unit,
   6723                                       VFP_KEY_CONTROL_1r,
   6724                                       REG_PORT_ANY,
   6725                                       0,
   6726                                       &vfp_key_control_1_buf
   6727                                       )
   6728                         );
   6729 
   6730     soc_reg64_field32_set(unit,
   6731                           VFP_KEY_CONTROL_1r,
   6732                           &vfp_key_control_1_buf,
   6733                           pairing_flds[slice_num >> 1],
   6734                           flags & _FP_GROUP_SPAN_DOUBLE_SLICE ? 1 : 0
   6735                           );
   6736     soc_reg64_field32_set(unit,
   6737                           VFP_KEY_CONTROL_1r,
   6738                           &vfp_key_control_1_buf,
   6739                           wide_mode_flds[slice_num],
   6740                           flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE ? 1 : 0
   6741                           );
   6742 
   6743 
   6744     return (soc_reg64_set(unit,
   6745                           VFP_KEY_CONTROL_1r,
   6746                           REG_PORT_ANY,
   6747                           0,
   6748                           vfp_key_control_1_buf
   6749                           )
   6750             );
   6751 }
   6752 
   6753 /*
   6754  * Function:
   6755  *     _field_td2_mode_set
   6756  *
   6757  * Purpose:
   6758  *    Auxiliary routine used to set group pairing mode.
   6759  * Parameters:
   6760  *     unit       - (IN) BCM device number.
   6761  *     slice_numb - (IN) Slice number to set mode for.
   6762  *     fg         - (IN) Installed group structure.
   6763  *     flags      - (IN) New group/slice mode.
   6764  *
   6765  * Returns:
   6766  *     BCM_E_XXX
   6767  */
   6768 
   6769 STATIC int
   6770 _field_td2_mode_set(int unit, uint8 slice_num, _field_group_t *fg, uint8 flags)
   6771 {
   6772     int (*func)(int unit, uint8 slice_num, _field_group_t *fg, uint8 flags);
   6773 
   6774     switch (fg->stage_id) {
   6775         case _BCM_FIELD_STAGE_LOOKUP:
   6776             func = _bcm_field_td2_lookup_mode_set;
   6777             break;
   6778         case _BCM_FIELD_STAGE_INGRESS:
   6779             return (BCM_E_NONE);
   6780         case _BCM_FIELD_STAGE_EGRESS:
   6781             func = _bcm_field_trx_egress_mode_set;
   6782             break;
   6783         default:
   6784             return (BCM_E_INTERNAL);
   6785     }
   6786 
   6787     return ((*func)(unit, slice_num, fg, flags));
   6788 }
   6789 
   6790 
   6791 STATIC int
   6792 _field_td2_ingress_selcode_get(int              unit,
   6793                               _field_stage_t   *stage_fc,
   6794                               bcm_field_qset_t *qset_req,
   6795                               _field_group_t   *fg)
   6796 {
   6797     if (BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifySrcMac)
   6798             || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyDstMac)
   6799        ) {
   6800         /* Qset includes MAC address qualifier
   6801            => Set selector code for MAC address normalization
   6802          */
   6803         fg->sel_codes[0].normalize_mac_sel
   6804             = BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyNormalizeMacAddrs)
   6805             ? 1 : 0;
   6806     }
   6807 
   6808     if (BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifySrcIp)
   6809             || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyDstIp)
   6810             || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifySrcIp6)
   6811             || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyDstIp6)
   6812             || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyL4SrcPort)
   6813             || BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyL4DstPort)
   6814        ) {
   6815         /* Qset includes L3 or L4 address qualifier
   6816            => Set selector code for IP (and L4) address normalization
   6817          */
   6818         fg->sel_codes[0].normalize_ip_sel
   6819             = BCM_FIELD_QSET_TEST(*qset_req, bcmFieldQualifyNormalizeIpAddrs)
   6820             ? 1 : 0;
   6821     }
   6822 
   6823     return (BCM_E_NONE);
   6824 }
   6825 
   6826 
   6827 /*
   6828  * Function:
   6829  *     _field_td2_selcodes_get
   6830  *
   6831  * Purpose:
   6832  *     Finds a 4-tuple of select encodings that will satisfy the
   6833  *     requested qualifier set (Qset).
   6834  * Parameters:
   6835  *     unit      - (IN) BCM unit number.
   6836  *     stage_fc  - (IN) Stage Field control structure.
   6837  *     qset_req  - (IN) Client qualifier set.
   6838  *     fg        - (IN/OUT)Select code information filled into the group.
   6839  *
   6840  * Returns:
   6841  *     BCM_E_XXX
   6842  */
   6843 int
   6844 _field_td2_selcode_get(int unit, _field_stage_t *stage_fc,
   6845                       bcm_field_qset_t *qset_req,
   6846                       _field_group_t *fg)
   6847 {
   6848 
   6849     BCM_IF_ERROR_RETURN(_bcm_field_tr_selcode_get(unit, stage_fc, qset_req, fg));
   6850 
   6851     switch (fg->stage_id) {
   6852         case _BCM_FIELD_STAGE_INGRESS:
   6853             return (_field_td2_ingress_selcode_get(unit, stage_fc, qset_req, fg));
   6854         default:
   6855             ;
   6856     }
   6857 
   6858     return (BCM_E_NONE);
   6859 }
   6860 
   6861 /*  
   6862  * Function:
   6863  *     _field_td2_selcodes_install
   6864  *
   6865  * Purpose:
   6866  *    Routine used to install selector codes.
   6867  * Parameters: 
   6868  *     unit        - (IN) BCM device number.
   6869  *     fg          - (IN) Installed group structure.
   6870  *     slice_numb  - (IN) Slice number to set mode for.
   6871  *     pbmp        - (IN) Group active port bit map.
   6872  *     selcode_idx - (IN) Index into select codes array.
   6873  *  
   6874  * Returns:
   6875  *     BCM_E_XXX
   6876  */
   6877 
   6878 
   6879 int
   6880 _field_td2_selcodes_install(int            unit,
   6881                             _field_group_t *fg,
   6882                             uint8          slice_num,
   6883                             bcm_pbmp_t     pbmp,
   6884                             int            selcode_idx
   6885                             )
   6886 {
   6887     int rv;
   6888 
   6889     /* Input parameters check. */
   6890     if (NULL == fg) {
   6891         return (BCM_E_PARAM);
   6892     }
   6893 
   6894     BCM_IF_ERROR_RETURN(_field_td2_mode_set(unit, slice_num, fg, fg->flags));
   6895 
   6896     switch (fg->stage_id) {
   6897         case _BCM_FIELD_STAGE_LOOKUP:
   6898             rv = _bcm_field_td2_lookup_selcodes_install(unit, fg, slice_num,
   6899                                                         selcode_idx);
   6900             break;
   6901         case _BCM_FIELD_STAGE_INGRESS:
   6902             rv =  _bcm_field_td2_ingress_selcodes_install(unit, fg, slice_num,
   6903                                                           &pbmp, selcode_idx);
   6904             break;
   6905         case _BCM_FIELD_STAGE_EGRESS:
   6906             rv = _field_td2_egress_selcodes_install(unit, fg, slice_num,
   6907                                                     &pbmp, selcode_idx);;
   6908             break;
   6909         default:
   6910             return (BCM_E_INTERNAL);
   6911     }
   6912     return (rv);
   6913 }
   6914 
   6915 /*
   6916  * Function:
   6917  *     _bcm_field_td2_selcodes_install
   6918  *
   6919  * Purpose:
   6920  *    Routine used to install selector codes.
   6921  * Parameters:
   6922  *     unit        - (IN) BCM device number.
   6923  *     fg          - (IN) Installed group structure.
   6924  *     slice_numb  - (IN) Slice number to set mode for.
   6925  *     pbmp        - (IN) Group active port bit map.
   6926  *     selcode_idx - (IN) Index into select codes array.
   6927  *
   6928  * Returns:
   6929  *     BCM_E_XXX
   6930  */
   6931 int
   6932 _bcm_field_td2_selcodes_install(int            unit,
   6933                                 _field_group_t *fg,
   6934                                 uint8          slice_num,
   6935                                 bcm_pbmp_t     pbmp,
   6936                                 int            selcode_idx
   6937                                 )
   6938 {
   6939     return _field_td2_selcodes_install(unit, fg, slice_num, pbmp, selcode_idx);
   6940 }
   6941 /*
   6942  * Function:
   6943  *    _field_td2_group_install
   6944  *
   6945  * Purpose:
   6946  *    Auxiliary routine used to install field group.
   6947  * Parameters:
   6948  *     unit       - (IN) BCM device number.
   6949  *     fg         - (IN) Installed group structure.
   6950  *
   6951  * Returns:
   6952  *     BCM_E_XXX
   6953  */
   6954 int
   6955 _field_td2_group_install(int unit, _field_group_t *fg)
   6956 {
   6957     _field_slice_t *fs;        /* Slice pointer.           */
   6958     uint8  slice_number;       /* Slices iterator.         */
   6959     int    parts_count;        /* Number of entry parts.   */
   6960     int    idx;                /* Iteration index.         */
   6961 
   6962     if (NULL == fg) {
   6963         return (BCM_E_PARAM);
   6964     }
   6965 
   6966     /* Get number of entry parts. */
   6967     BCM_IF_ERROR_RETURN(_bcm_field_entry_tcam_parts_count(unit, 
   6968                                                           fg->stage_id,
   6969                                                           fg->flags, 
   6970                                                           &parts_count));
   6971     for (idx = 0; idx < parts_count; ++idx) {
   6972         BCM_IF_ERROR_RETURN(_bcm_field_tcam_part_to_slice_number(unit, idx,
   6973                                                                  fg,
   6974                                                                  &slice_number
   6975                                                                  )
   6976                             );
   6977         fs = fg->slices + slice_number;
   6978 
   6979         BCM_IF_ERROR_RETURN(_field_td2_selcodes_install(unit,
   6980                                                         fg,
   6981                                                         fs->slice_number,
   6982                                                         fg->pbmp,
   6983                                                         idx
   6984                                                         )
   6985                             );
   6986     }
   6987 
   6988     return (BCM_E_NONE);
   6989 }
   6990 /*
   6991  * Function:
   6992  *     _bcm_field_td2_group_install
   6993  *
   6994  * Purpose:
   6995  *    Auxiliary routine used to install field group.
   6996  * Parameters:
   6997  *     unit       - (IN) BCM device number.
   6998  *     fg         - (IN) Installed group structure.
   6999  *
   7000  * Returns:
   7001  *     BCM_E_XXX
   7002  */
   7003 
   7004 int 
   7005 _bcm_field_td2_group_install(int unit, _field_group_t *fg)
   7006 {
   7007   return _field_td2_group_install(unit, fg);
   7008 }
   7009 /*
   7010  * Function:
   7011  *     _field_td2_lookup_slice_clear
   7012  *
   7013  * Purpose:
   7014  *     Reset slice configuraton on group deletion event.
   7015  *
   7016  * Parameters:
   7017  *     unit  - BCM device number
   7018  *     fs    - slice that needs its select codes written
   7019  *
   7020  * Returns:
   7021  *     BCM_E_NONE     - Success
   7022  *
   7023  * Note:
   7024  *     Unit lock should be held by calling function.
   7025  */
   7026 STATIC int
   7027 _field_td2_lookup_slice_clear(int unit, unsigned slice_num)
   7028 {
   7029     uint64 reg_val;
   7030 
   7031     BCM_IF_ERROR_RETURN(soc_reg64_get(unit,
   7032                                       VFP_KEY_CONTROL_1r,
   7033                                       REG_PORT_ANY,
   7034                                       0,
   7035                                       &reg_val
   7036                                       )
   7037                         );
   7038     soc_reg64_field32_set(unit,
   7039                           VFP_KEY_CONTROL_1r,
   7040                           &reg_val,
   7041                           _bcm_field_trx_vfp_double_wide_sel[slice_num],
   7042                           0
   7043                           );
   7044     soc_reg64_field32_set(unit,
   7045                           VFP_KEY_CONTROL_1r,
   7046                           &reg_val,
   7047                           _bcm_field_trx_vfp_field_sel[slice_num][0],
   7048                           0
   7049                           );
   7050     soc_reg64_field32_set(unit,
   7051                           VFP_KEY_CONTROL_1r,
   7052                           &reg_val,
   7053                           _bcm_field_trx_vfp_field_sel[slice_num][1],
   7054                           0
   7055                           );
   7056     soc_reg64_field32_set(unit,
   7057                           VFP_KEY_CONTROL_1r,
   7058                           &reg_val,
   7059                           _bcm_field_trx_slice_pairing_field[slice_num >> 1],
   7060                           0
   7061                           );
   7062     BCM_IF_ERROR_RETURN(soc_reg64_set(unit,
   7063                                       VFP_KEY_CONTROL_1r,
   7064                                       REG_PORT_ANY,
   7065                                       0,
   7066                                       reg_val
   7067                                       )
   7068                         );
   7069 
   7070 
   7071     return (soc_reg_field32_modify(unit,
   7072                                    VFP_KEY_CONTROL_2r,
   7073                                    REG_PORT_ANY,
   7074                                    _bcm_field_trx_vfp_ip_header_sel[slice_num],
   7075                                    0
   7076                                    )
   7077             );
   7078 }
   7079 
   7080 /*
   7081  * Function:
   7082  *     _bcm_field_td2_lookup_slice_clear
   7083  *
   7084  * Purpose:
   7085  *     Reset slice configuraton on group deletion event.
   7086  *
   7087  * Parameters:
   7088  *     unit  - BCM device number
   7089  *     fs    - slice that needs its select codes written
   7090  *
   7091  * Returns:
   7092  *     BCM_E_NONE     - Success
   7093  *
   7094  * Note:
   7095  *     Unit lock should be held by calling function.
   7096  */
   7097 int
   7098 _bcm_field_td2_lookup_slice_clear(int unit, unsigned slice_num)
   7099 {
   7100     return _field_td2_lookup_slice_clear(unit, slice_num);
   7101 }
   7102 /*
   7103  * Function:
   7104  *     _field_td2_slice_clear
   7105  *
   7106  * Purpose:
   7107  *     Clear slice configuration on group removal
   7108  *
   7109  * Parameters:
   7110  *     unit  - BCM device number
   7111  *     fg    - Field group slice belongs to
   7112  *     fs    - Field slice structure.
   7113  *
   7114  * Returns:
   7115  *     BCM_E_XXX
   7116  */
   7117 int
   7118 _field_td2_slice_clear(int unit, _field_group_t *fg, _field_slice_t *fs)
   7119 {
   7120     int rv;
   7121 
   7122     switch (fs->stage_id) {
   7123       case _BCM_FIELD_STAGE_INGRESS:
   7124           rv = _bcm_field_trx_ingress_slice_clear(unit, fs->slice_number);
   7125           break;
   7126       case _BCM_FIELD_STAGE_LOOKUP:
   7127           rv = _field_td2_lookup_slice_clear(unit, fs->slice_number);
   7128           break;
   7129       case _BCM_FIELD_STAGE_EGRESS:
   7130           rv = _bcm_field_trx_egress_slice_clear(unit, fs->slice_number);
   7131           break;
   7132       default:
   7133           rv = BCM_E_INTERNAL;
   7134     }
   7135     return (rv);
   7136 }
   7137 
   7138 /*
   7139  * Function:
   7140  *     _bcm_field_td2_slice_clear
   7141  *
   7142  * Purpose:
   7143  *     Clear slice configuration on group removal
   7144  *
   7145  * Parameters:
   7146  *     unit  - BCM device number
   7147  *     fg    - Field group slice belongs to
   7148  *     fs    - Field slice structure.
   7149  *
   7150  * Returns:
   7151  *     BCM_E_XXX
   7152  */
   7153 int
   7154 _bcm_field_td2_slice_clear(int unit, _field_group_t *fg, _field_slice_t *fs)
   7155 {
   7156     return _field_td2_slice_clear(unit, fg, fs);
   7157 }
   7158 
   7159 /*
   7160  * Function:
   7161  *     _field_td2_entry_move
   7162  * Purpose:
   7163  *     Copy an entry from one TCAM index to another. It copies the values in
   7164  *     hardware from the old index to the new index. 
   7165  *     IT IS ASSUMED THAT THE NEW INDEX IS EMPTY (VALIDf=00) IN HARDWARE.
   7166  *     The old Hardware index is cleared at the end.
   7167  * Parameters:
   7168  *     unit           - (IN) BCM device number. 
   7169  *     f_ent          - (IN) Entry to move
   7170  *     parts_count    - (IN) Field entry parts count.
   7171  *     tcam_idx_old   - (IN) Source entry tcam index.
   7172  *     tcam_idx_new   - (IN) Destination entry tcam index.
   7173  *                          
   7174  * Returns:
   7175  *     BCM_E_XXX
   7176  */
   7177 
   7178 int
   7179 _field_td2_entry_move(int unit, _field_entry_t *f_ent, int parts_count,
   7180                       int *tcam_idx_old, int *tcam_idx_new)
   7181 {
   7182     static uint32 e_buf[BCM_MAX_NUM_UNITS][25];
   7183                                         /* For TCAM .                         */
   7184     static uint32 p_buf[BCM_MAX_NUM_UNITS][_FP_MAX_ENTRY_WIDTH][25];
   7185                                         /* For policies                       */
   7186     int new_slice_numb = 0;             /* Entry new slice number.            */
   7187     int new_slice_idx = 0;              /* Entry new offset in the slice      */
   7188     soc_mem_t tcam_mem;                 /* TCAM memory id.                    */
   7189     soc_mem_t policy_mem;               /* Policy table memory id .           */
   7190     int tcam_idx_max;                   /* TCAM memory max index.             */
   7191     int tcam_idx_min;                   /* TCAM memory min index.             */
   7192     _field_stage_t *stage_fc;           /* Stage field control structure.     */
   7193     _field_stage_id_t stage_id;         /* Field pipeline stage id.           */
   7194     int idx;                            /* Iteration index.                   */
   7195     _field_policer_t *f_pl = NULL;      /* Field policer descriptor.          */
   7196     _field_stat_t    *f_st = NULL;      /* Field statistics descriptor.       */
   7197     _field_group_t   *fg;               /* Field group structure.             */
   7198     int              rv = BCM_E_NONE;   /* Operation return status.           */
   7199     int              is_backup_entry = 0;  /* Flag ,checks the entry is
   7200                                               backup entry or not*/
   7201     int meter_moved = 0;               /* meter moved as part of entry move*/
   7202     fp_global_mask_tcam_x_entry_t fp_global_mask_x[_FP_MAX_ENTRY_WIDTH];
   7203     fp_global_mask_tcam_y_entry_t fp_global_mask_y[_FP_MAX_ENTRY_WIDTH];
   7204     fp_global_mask_tcam_entry_t fp_global_mask[_FP_MAX_ENTRY_WIDTH];
   7205     fp_gm_fields_entry_t fp_gm_fields[_FP_MAX_ENTRY_WIDTH];
   7206     bcm_pbmp_t pbmp_x, pbmp_y;
   7207 #if defined (BCM_TOMAHAWK_SUPPORT)
   7208     uint8  enabled = 0;
   7209     int rv_temp;
   7210 #endif
   7211 
   7212     /* Input parameters check. */
   7213     if ((NULL == f_ent) || (NULL == tcam_idx_old) || (NULL == tcam_idx_new)) {
   7214         return (BCM_E_PARAM);
   7215     }
   7216 
   7217     fg = f_ent->group;
   7218 
   7219     /* Get field stage control . */
   7220     stage_id = f_ent->group->stage_id;
   7221     rv = _field_stage_control_get(unit, stage_id, &stage_fc);
   7222     BCM_IF_ERROR_RETURN(rv);
   7223 
   7224 #if defined (BCM_TOMAHAWK_SUPPORT)
   7225     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   7226        /* Get entry tcam and policy tables. */
   7227        rv = _bcm_field_th_tcam_policy_mem_get(unit, f_ent,
   7228                                              &tcam_mem, &policy_mem);
   7229     } else
   7230 #endif /* BCM_TOMAHAWK_SUPPORT */
   7231     {
   7232        /* Get entry tcam and actions. */
   7233        rv = _field_fb_tcam_policy_mem_get(unit, stage_id,
   7234                                           &tcam_mem, &policy_mem);
   7235     }
   7236     BCM_IF_ERROR_RETURN(rv);
   7237 
   7238     tcam_idx_max = soc_mem_index_max(unit, tcam_mem);
   7239     tcam_idx_min = soc_mem_index_min(unit, tcam_mem);
   7240 
   7241         /* Update policy entry if moving across the slices. */
   7242         if (((NULL != f_ent->ent_copy) && 
   7243                     (f_ent->ent_copy->eid ==  _FP_INTERNAL_RESERVED_ID))) {
   7244             is_backup_entry = 1;
   7245         }
   7246 
   7247     for (idx = 0; idx < parts_count; idx++) {
   7248         /* Index sanity check. */
   7249         if ((tcam_idx_old[idx] < tcam_idx_min) || (tcam_idx_old[idx] > tcam_idx_max) ||
   7250             (tcam_idx_new[idx] < tcam_idx_min) || (tcam_idx_new[idx] > tcam_idx_max)) {
   7251             LOG_DEBUG(BSL_LS_BCM_FP,
   7252                       (BSL_META_U(unit,
   7253                                   "FP(unit %d) vverb: Invalid index range for _field_td2_entry_move\n"
   7254                                   "from %d to %d"), unit, tcam_idx_old[idx], tcam_idx_new[idx]));
   7255             rv = BCM_E_PARAM;
   7256             /* coverity[dead_error_line:FALSE] */
   7257             BCM_IF_ERROR_RETURN(rv);
   7258 
   7259         }
   7260 
   7261         /* Read policy entry from current tcam index. */
   7262         rv = soc_mem_read(unit, policy_mem, MEM_BLOCK_ANY, tcam_idx_old[idx],
   7263                           p_buf[unit][idx]);
   7264         BCM_IF_ERROR_RETURN(rv);
   7265 
   7266         /*
   7267          * On Trident2, VALIDf of FP_GLOBAL_MASK_TCAMm must be set
   7268          * for all parts of an wide/paired mode entry.
   7269          * This bit would have been set during entry install.
   7270          * Read this value from all parts of an entry while moving.
   7271          * Otherwise, actions related to this entry would not work.
   7272          */
   7273         if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2X(unit))
   7274              && (stage_id == _BCM_FIELD_STAGE_INGRESS)) {
   7275             if ((fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE)
   7276                 && (0x1 & idx)) {
   7277                 rv = READ_FP_GM_FIELDSm(unit, MEM_BLOCK_ANY,
   7278                         tcam_idx_old[idx], &fp_gm_fields[idx]);
   7279                 BCM_IF_ERROR_RETURN(rv);
   7280             } else {
   7281                 rv = READ_FP_GLOBAL_MASK_TCAMm(unit, MEM_BLOCK_ANY,
   7282                         tcam_idx_old[idx], &fp_global_mask[idx]);
   7283                 BCM_IF_ERROR_RETURN(rv);
   7284             }
   7285         }
   7286     }
   7287 
   7288     /* Calculate primary entry new slice & offset in the slice. */
   7289     rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc, fg->instance,
   7290                                              tcam_idx_new[0],
   7291                                              &new_slice_numb, &new_slice_idx);
   7292     BCM_IF_ERROR_RETURN(rv);
   7293 
   7294     /* Update policy entry if moving across the slices. */
   7295     if ((1 != is_backup_entry) && (f_ent->fs->slice_number != new_slice_numb)) {
   7296         /* Get policer associated with the entry. */
   7297         if ((0 == (stage_fc->flags & _FP_STAGE_GLOBAL_METER_POOLS)) &&
   7298             (f_ent->policer[0].flags & _FP_POLICER_INSTALLED)) {
   7299             rv = (_bcm_field_policer_get(unit,
   7300                                          f_ent->policer[0].pid,
   7301                                          &f_pl));
   7302             BCM_IF_ERROR_RETURN(rv);
   7303         }
   7304         /* Get statistics entity associated with the entry. */
   7305         if ((0 == (stage_fc->flags & _FP_STAGE_GLOBAL_COUNTERS)) &&
   7306             (f_ent->statistic.flags & _FP_ENTRY_STAT_INSTALLED)) {
   7307             rv = (_bcm_field_stat_get(unit,
   7308                                       f_ent->statistic.sid,
   7309                                       &f_st));
   7310             BCM_IF_ERROR_RETURN(rv);
   7311         }
   7312         if (fg->flags & (_FP_GROUP_SPAN_SINGLE_SLICE |
   7313                          _FP_GROUP_INTRASLICE_DOUBLEWIDE)) {
   7314             /*
   7315              * For _FP_GROUP_INTRASLICE_DOUBLEWIDE, *even* if it is
   7316              *     _FP_GROUP_SPAN_DOUBLE_SLICE, we do this.
   7317              *     This is because in intraslice double-wide, the PRI
   7318              *     slice has tcam_slice_sz/2 entries, and same number
   7319              *     of counter/meter pairs.
   7320              *         Thus, counter/meter will always be allocated in the
   7321              *         PRI slice.
   7322              */
   7323             if (NULL != f_st) {
   7324                 /*
   7325                  * Set the index of the counter for entry in new slice
   7326                  * The new index has already been calculated in
   7327                  * _field_entry_move
   7328                  */
   7329                 if (stage_id == _BCM_FIELD_STAGE_EGRESS ) {
   7330                     soc_mem_field32_set(unit, policy_mem, p_buf[unit][0],
   7331                                         PID_COUNTER_INDEXf, f_st->hw_index);
   7332                     soc_mem_field32_set(unit, policy_mem, p_buf[unit][0],
   7333                                         PID_COUNTER_MODEf, f_st->hw_mode);
   7334                 } else if (stage_id == _BCM_FIELD_STAGE_LOOKUP ) {
   7335                     soc_mem_field32_set(unit, policy_mem, p_buf[unit][0],
   7336                                         VINTF_CTR_IDXf, f_st->hw_index);
   7337                     soc_mem_field32_set(unit, policy_mem, p_buf[unit][0],
   7338                                         USE_VINTF_CTR_IDXf, f_st->hw_mode);
   7339                 } else {
   7340                     soc_mem_field32_set(unit, policy_mem, p_buf[unit][0],
   7341                                         COUNTER_INDEXf, f_st->hw_index);
   7342                     soc_mem_field32_set(unit, policy_mem, p_buf[unit][0],
   7343                                         COUNTER_MODEf, f_st->hw_mode);
   7344                 }
   7345             }
   7346             if (NULL != f_pl) {
   7347                 meter_moved = 1;
   7348 
   7349                 /*
   7350                  * Set the index of the meter for entry in new slice
   7351                  * The new index has already been calculated in
   7352                  * _field_entry_move
   7353                  */
   7354                 soc_mem_field32_set(unit, policy_mem, p_buf[unit][0],
   7355                                     METER_INDEX_EVENf, f_pl->hw_index);
   7356                 soc_mem_field32_set(unit, policy_mem, p_buf[unit][0],
   7357                                     METER_INDEX_ODDf, f_pl->hw_index);
   7358                 /* in case of meter move, the even or odd meter should be
   7359                  * set based on meter index of new slice
   7360                  */
   7361                 if ((f_pl->stage_id == _BCM_FIELD_STAGE_EGRESS) &&
   7362                     (SOC_IS_TRIDENT2PLUS(unit))) {
   7363                     /*
   7364                      * Flow mode is the only one that cares about the test and
   7365                      * update bits.
   7366                      */
   7367                     if (_FP_POLICER_EXCESS_HW_METER(f_pl)) {
   7368                        /* Excess meter - even index. */
   7369                         soc_mem_field32_set(unit, policy_mem,
   7370                                      p_buf[unit][0], METER_TEST_ODDf, 0);
   7371                         if (SOC_IS_KATANA2(unit) &&
   7372                             (f_pl->cfg.flags & BCM_POLICER_AS_PACKET_COUNTER)) {
   7373                             soc_mem_field32_set(unit, policy_mem,
   7374                                          p_buf[unit][0],
   7375                                          METER_TEST_EVENf, 0);
   7376                         } else {
   7377                             soc_mem_field32_set(unit, policy_mem,
   7378                                          p_buf[unit][0],
   7379                                          METER_TEST_EVENf, 1);
   7380                         }
   7381                         soc_mem_field32_set(unit, policy_mem,
   7382                                      p_buf[unit][0],
   7383                                      METER_UPDATE_ODDf, 0);
   7384                         soc_mem_field32_set(unit, policy_mem,
   7385                                      p_buf[unit][0],
   7386                                      METER_UPDATE_EVENf, 1);
   7387                     } else if (_FP_POLICER_COMMITTED_HW_METER(f_pl)) {
   7388                     /* Committed meter - odd index. */
   7389                         if (SOC_IS_KATANA2(unit) &&
   7390                             (f_pl->cfg.flags & BCM_POLICER_AS_PACKET_COUNTER)) {
   7391                             soc_mem_field32_set(unit, policy_mem, p_buf[unit][0], METER_TEST_ODDf, 0);
   7392                         } else {
   7393                             soc_mem_field32_set(unit, policy_mem, p_buf[unit][0], METER_TEST_ODDf, 1);
   7394                         }
   7395                         soc_mem_field32_set(unit, policy_mem,
   7396                                      p_buf[unit][0],
   7397                                      METER_TEST_EVENf, 0);
   7398                         soc_mem_field32_set(unit, policy_mem,
   7399                                      p_buf[unit][0],
   7400                                      METER_UPDATE_ODDf, 1);
   7401                         soc_mem_field32_set(unit, policy_mem,
   7402                                      p_buf[unit][0],
   7403                                      METER_UPDATE_EVENf, 0);
   7404                     } else if (f_pl->cfg.mode == bcmPolicerModePassThrough) {
   7405                         soc_mem_field32_set(unit, policy_mem,
   7406                                      p_buf[unit][0],
   7407                                      METER_TEST_EVENf, 1);
   7408                     }
   7409 #if defined(BCM_TRIDENT2_SUPPORT)
   7410                     else if (f_pl->cfg.mode == bcmPolicerModeSrTcmModified
   7411                         && (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
   7412                         soc_mem_field32_set(unit, policy_mem,
   7413                                      p_buf[unit][0],
   7414                                     METER_MODE_MODIFIERf, 1);
   7415                     }
   7416 #endif
   7417                 }
   7418             }
   7419         } else {
   7420             if (NULL != f_st) {
   7421                 _bcm_field_fb_counter_adjust_wide_mode(unit, policy_mem,
   7422                                                        f_st, f_ent,
   7423                                                        f_ent + 1,
   7424                                                        new_slice_numb,
   7425                                                        p_buf[unit][0],
   7426                                                        p_buf[unit][1]);
   7427             }
   7428             if (NULL != f_pl) {
   7429                 meter_moved = 1;
   7430                 _bcm_field_fb_meter_adjust_wide_mode(unit, policy_mem,
   7431                                                      f_pl, f_ent, f_ent + 1,
   7432                                                      p_buf[unit][0],
   7433                                                      p_buf[unit][1]);
   7434             }
   7435         }
   7436     }
   7437 
   7438 #if defined (BCM_TOMAHAWK_SUPPORT)
   7439     if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   7440         _field_slice_t *fs;
   7441         for (idx = 0; idx < parts_count; idx++) {
   7442            /* Calculate entry new slice & offset in the slice. */
   7443            rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc,
   7444                                                     fg->instance,
   7445                                                     tcam_idx_new[idx],
   7446                                                     &new_slice_numb,
   7447                                                     &new_slice_idx);
   7448            if (BCM_SUCCESS(rv)) {
   7449 
   7450                fs = &stage_fc->slices[f_ent->group->instance][new_slice_numb];
   7451                /* Enable the slice if the entry moves to new slice. */
   7452                if (!(fs->slice_flags & _BCM_FIELD_SLICE_HW_ENABLE)) {
   7453                    if (BCM_FAILURE(_bcm_field_th_slice_enable_set(unit,
   7454                                                       f_ent->group, fs, 1))) {
   7455                        LOG_ERROR(BSL_LS_BCM_FP, (BSL_META(
   7456                            "Failed to Enable Field Slice[%d] for Entry[%d].\n\r"),
   7457                            fs->slice_number, f_ent->eid));
   7458                    }
   7459                    fs->slice_flags |= _BCM_FIELD_SLICE_HW_ENABLE;
   7460                    enabled = 1;
   7461                }
   7462            }
   7463         }
   7464     }
   7465 #endif /* BCM_TOMAHAWK_SUPPORT */
   7466     /*
   7467      * Write entry to the destination
   7468      * ORDER is important
   7469      */
   7470     for (idx = parts_count - 1; idx >= 0; idx--) {
   7471 
   7472         /* Write duplicate  policy entry to new tcam index. */
   7473         rv = soc_mem_write(unit, policy_mem, MEM_BLOCK_ALL, tcam_idx_new[idx],
   7474                            p_buf[unit][idx]);
   7475         if (BCM_FAILURE(rv)) {
   7476             goto cleanup;
   7477         }
   7478         if (((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2X(unit)))
   7479              && (stage_id == _BCM_FIELD_STAGE_INGRESS)) {
   7480             if ((fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE)
   7481                 && (0x1 & idx)) {
   7482                 rv = WRITE_FP_GM_FIELDSm(unit, MEM_BLOCK_ALL,
   7483                         tcam_idx_new[idx], &fp_gm_fields[idx]);
   7484                 BCM_IF_ERROR_RETURN(rv);
   7485             } else {
   7486                 if (SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Xm) &&
   7487                     SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Ym)) {
   7488 
   7489                     rv = READ_FP_GLOBAL_MASK_TCAM_Xm(unit, MEM_BLOCK_ANY,
   7490                                                      tcam_idx_old[idx],
   7491                                                      &fp_global_mask_x[idx]);
   7492                     BCM_IF_ERROR_RETURN(rv);
   7493                     rv = READ_FP_GLOBAL_MASK_TCAM_Ym(unit, MEM_BLOCK_ANY,
   7494                                                      tcam_idx_old[idx],
   7495                                                      &fp_global_mask_y[idx]);
   7496                     BCM_IF_ERROR_RETURN(rv);
   7497                     soc_mem_pbmp_field_get(unit, FP_GLOBAL_MASK_TCAM_Xm,
   7498                                            &fp_global_mask_x[idx],
   7499                                            IPBMf, &pbmp_x);
   7500                     soc_mem_pbmp_field_get(unit, FP_GLOBAL_MASK_TCAM_Ym,
   7501                                            &fp_global_mask_y[idx],
   7502                                            IPBMf, &pbmp_y);
   7503                     BCM_PBMP_OR(pbmp_x, pbmp_y);
   7504 
   7505                     soc_mem_pbmp_field_set(unit,
   7506                                            FP_GLOBAL_MASK_TCAMm,
   7507                                            &fp_global_mask[idx],
   7508                                            IPBMf,
   7509                                            &pbmp_x
   7510                                           );
   7511                     soc_mem_pbmp_field_get(unit, FP_GLOBAL_MASK_TCAM_Xm,
   7512                                            &fp_global_mask_x[idx],
   7513                                            IPBM_MASKf, &pbmp_x);
   7514                     soc_mem_pbmp_field_get(unit, FP_GLOBAL_MASK_TCAM_Ym,
   7515                                            &fp_global_mask_y[idx],
   7516                                            IPBM_MASKf, &pbmp_y);
   7517                     BCM_PBMP_OR(pbmp_x, pbmp_y);
   7518 
   7519                     soc_mem_pbmp_field_set(unit,
   7520                                            FP_GLOBAL_MASK_TCAMm,
   7521                                            &fp_global_mask[idx],
   7522                                            IPBM_MASKf,
   7523                                            &pbmp_x
   7524                                           );
   7525                 }
   7526                 rv = WRITE_FP_GLOBAL_MASK_TCAMm(unit, MEM_BLOCK_ALL,
   7527                         tcam_idx_new[idx], &fp_global_mask[idx]);
   7528                 BCM_IF_ERROR_RETURN(rv);
   7529             }
   7530         }
   7531         if (meter_moved == 0) {
   7532             /* Read tcam entry from current tcam index. */
   7533             rv = soc_mem_read(unit, tcam_mem, MEM_BLOCK_ANY, tcam_idx_old[idx],
   7534                           e_buf[unit]);
   7535             if (BCM_FAILURE(rv)) {
   7536                 goto cleanup;
   7537             }
   7538 
   7539             /* Write duplicate  tcam entry to new tcam index. */
   7540             rv = soc_mem_write(unit, tcam_mem, MEM_BLOCK_ALL, tcam_idx_new[idx],
   7541                            e_buf[unit]);
   7542             if (BCM_FAILURE(rv)) {
   7543                 goto cleanup;
   7544             }
   7545         }
   7546     }
   7547 
   7548     /*    
   7549      * fp_entry_move is invoked even for backup entry create 
   7550      * to copy TCAM and FP_POLICY_TABLE tables. In this case
   7551      * TCAM and FP_POLICY_TABLEs should not be erased for
   7552      * original entry.
   7553      */
   7554     if (1 != is_backup_entry) {
   7555         /*
   7556          * Clear old location
   7557          * ORDER is important
   7558          */
   7559         for (idx = 0; idx < parts_count; idx++) {
   7560 #if defined (BCM_TOMAHAWK_SUPPORT)
   7561             if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   7562                 rv = _bcm_field_th_tcam_policy_clear(unit, f_ent, tcam_idx_old[idx]);
   7563             } else
   7564 #endif /* BCM_TOMAHAWK_SUPPORT */
   7565             {
   7566                 rv = _field_fb_tcam_policy_clear(unit, NULL, stage_id, tcam_idx_old[idx]);
   7567             }
   7568             if (BCM_FAILURE(rv)) {
   7569                 goto cleanup;
   7570             }
   7571         }
   7572     }
   7573     return (BCM_E_NONE);
   7574 
   7575 cleanup:
   7576 #if defined (BCM_TOMAHAWK_SUPPORT)
   7577     if (enabled == 1) {
   7578         _field_slice_t *fs;
   7579         for (idx = 0; idx < parts_count; idx++) {
   7580             /* Calculate entry new slice & offset in the slice. */
   7581             rv_temp = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc,
   7582                                                      fg->instance,
   7583                                                      tcam_idx_new[idx],
   7584                                                      &new_slice_numb,
   7585                                                      &new_slice_idx);
   7586             if (BCM_SUCCESS(rv_temp)) {
   7587                 fs = &stage_fc->slices[f_ent->group->instance][new_slice_numb];
   7588                 if (fs->slice_flags & _BCM_FIELD_SLICE_HW_ENABLE) {
   7589                     if (BCM_FAILURE(_bcm_field_th_slice_enable_set(unit, f_ent->group,
   7590                                                                    fs, 0))) {
   7591                         LOG_WARN(BSL_LS_BCM_FP, (BSL_META("Failed to Disable Field"
   7592                                                   " Slice[%d] for Entry[%d].\n\r"),
   7593                                                     fs->slice_number, f_ent->eid));
   7594                     }
   7595                     fs->slice_flags &= ~_BCM_FIELD_SLICE_HW_ENABLE;
   7596                 }
   7597             }
   7598         }
   7599     }
   7600 #endif /* BCM_TOMAHAWK_SUPPORT */
   7601 
   7602     return rv;
   7603 
   7604 }
   7605 
   7606 
   7607 /*
   7608  * Function:
   7609  *     _bcm_field_td2_entry_move
   7610  * Purpose:
   7611  *     Copy an entry from one TCAM index to another. It copies the values in
   7612  *     hardware from the old index to the new index. 
   7613  *     IT IS ASSUMED THAT THE NEW INDEX IS EMPTY (VALIDf=00) IN HARDWARE.
   7614  *     The old Hardware index is cleared at the end.
   7615  * Parameters:
   7616  *     unit           - (IN) BCM device number. 
   7617  *     f_ent          - (IN) Entry to move
   7618  *     parts_count    - (IN) Field entry parts count.
   7619  *     tcam_idx_old   - (IN) Source entry tcam index.
   7620  *     tcam_idx_new   - (IN) Destination entry tcam index.
   7621  *                          
   7622  * Returns:
   7623  *     BCM_E_XXX
   7624  */
   7625 int
   7626 _bcm_field_td2_entry_move(int unit, _field_entry_t *f_ent, int parts_count,
   7627                       int *tcam_idx_old, int *tcam_idx_new)
   7628 {
   7629     return _field_td2_entry_move(unit, f_ent, parts_count, 
   7630                                  tcam_idx_old, tcam_idx_new);
   7631 }
   7632 
   7633 int
   7634 _bcm_field_td2_qualify_LoopbackType(int                      unit,
   7635                                     bcm_field_LoopbackType_t loopback_type,
   7636                                     uint32                   *tcam_data,
   7637                                     uint32                   *tcam_mask)
   7638 {
   7639     switch (loopback_type) {
   7640         case bcmFieldLoopbackTypeAny:
   7641             *tcam_data = 0x10;
   7642             *tcam_mask = 0x10;
   7643             break;
   7644         case bcmFieldLoopbackTypeMim:
   7645             *tcam_data = 0x10;
   7646             *tcam_mask = 0x1f;
   7647             break;
   7648         case bcmFieldLoopbackTypeTrillNetwork:
   7649             *tcam_data = 0x11;
   7650             *tcam_mask = 0x1f;
   7651             break;
   7652         case bcmFieldLoopbackTypeTrillAccess:
   7653             *tcam_data = 0x12;
   7654             *tcam_mask = 0x1f;
   7655             break;
   7656 #if defined(BCM_APACHE_SUPPORT)
   7657         case bcmFieldLoopbackTypeMirror:
   7658             if (SOC_IS_APACHE(unit)) {
   7659                 *tcam_data = 0x13;
   7660                 *tcam_mask = 0x1f;
   7661             } else {
   7662                 return BCM_E_UNAVAIL;
   7663             }
   7664             break;
   7665         case bcmFieldLoopbackTypeRedirect:
   7666             if (SOC_IS_APACHE(unit)) {
   7667                 *tcam_data = 0x14;
   7668                 *tcam_mask = 0x1f;
   7669             } else {
   7670                 return BCM_E_UNAVAIL;
   7671             }
   7672             break;
   7673 #endif /* BCM_APACHE_SUPPORT */
   7674         case bcmFieldLoopbackTypeQcn:
   7675 #if defined(BCM_TOMAHAWK_SUPPORT)
   7676             if (soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   7677                return BCM_E_UNAVAIL;
   7678             }
   7679 #endif /* BCM_TOMAHAWK_SUPPORT */
   7680             *tcam_data = 0x17;
   7681             *tcam_mask = 0x1f;
   7682             break;
   7683         case bcmFieldLoopbackTypeVxlan:
   7684             *tcam_data = 0x1b;
   7685             *tcam_mask = 0x1f;
   7686             break;
   7687         case bcmFieldLoopbackTypeL2Gre:
   7688             *tcam_data = 0x1e;
   7689             *tcam_mask = 0x1f;
   7690             break;
   7691         default:
   7692             return (BCM_E_PARAM);
   7693     }
   7694 
   7695     return (BCM_E_NONE);
   7696 }
   7697 
   7698 int
   7699 _bcm_field_td2_qualify_LoopbackType_get(uint8                    tcam_data,
   7700                                         uint8                    tcam_mask,
   7701                                         bcm_field_LoopbackType_t *loopback_type
   7702                                         )
   7703 {
   7704     switch (tcam_data & tcam_mask) {
   7705         case 0x10:
   7706             if (tcam_mask == 0x10) {
   7707                 *loopback_type = bcmFieldLoopbackTypeAny;
   7708             } else {
   7709                 *loopback_type = bcmFieldLoopbackTypeMim;
   7710             }
   7711             break;
   7712         case 0x11:
   7713             *loopback_type = bcmFieldLoopbackTypeTrillNetwork;
   7714             break;
   7715         case 0x12:
   7716             *loopback_type = bcmFieldLoopbackTypeTrillAccess;
   7717             break;
   7718 #if defined(BCM_APACHE_SUPPORT)
   7719         case 0x13:
   7720             *loopback_type = bcmFieldLoopbackTypeMirror;
   7721             break;
   7722         case 0x14:
   7723             *loopback_type = bcmFieldLoopbackTypeRedirect;
   7724             break;
   7725 #endif /* BCM_APACHE_SUPPORT */
   7726         case 0x17:
   7727             *loopback_type = bcmFieldLoopbackTypeQcn;
   7728             break;
   7729         case 0x1b:
   7730             *loopback_type = bcmFieldLoopbackTypeVxlan;
   7731             break;
   7732         case 0x1e:
   7733             *loopback_type = bcmFieldLoopbackTypeL2Gre;
   7734             break;
   7735         default:
   7736             return (BCM_E_PARAM);
   7737     }
   7738 
   7739     return (BCM_E_NONE);
   7740 }
   7741 
   7742 int
   7743 _bcm_field_td2_qualify_TunnelType(bcm_field_TunnelType_t tunnel_type,
   7744                                   uint32                 *tcam_data,
   7745                                   uint32                 *tcam_mask
   7746                                   )
   7747 {
   7748     switch (tunnel_type) {
   7749         case bcmFieldTunnelTypeAny:
   7750             *tcam_data = 0x0;
   7751             *tcam_mask = 0x0;
   7752             break;
   7753         case bcmFieldTunnelTypeNone:
   7754             *tcam_data = 0x0;
   7755             *tcam_mask = 0x1f;
   7756             break;
   7757         case bcmFieldTunnelTypeIp:
   7758             *tcam_data = 0x1;
   7759             *tcam_mask = 0x1f;
   7760             break;
   7761         case bcmFieldTunnelTypeMpls:
   7762             *tcam_data = 0x2;
   7763             *tcam_mask = 0x1f;
   7764             break;
   7765         case bcmFieldTunnelTypeMim:
   7766             *tcam_data = 0x3;
   7767             *tcam_mask = 0x1f;
   7768             break;
   7769         case bcmFieldTunnelTypeAutoMulticast:
   7770             *tcam_data = 0x6;
   7771             *tcam_mask = 0x1f;
   7772             break;
   7773         case bcmFieldTunnelTypeTrill:
   7774             *tcam_data = 0x7;
   7775             *tcam_mask = 0x1f;
   7776             break;
   7777         case bcmFieldTunnelTypeL2Gre:
   7778             *tcam_data = 0x8;
   7779             *tcam_mask = 0x1f;
   7780             break;
   7781         case bcmFieldTunnelTypeVxlan:
   7782             *tcam_data = 0x9;
   7783             *tcam_mask = 0x1f;
   7784             break;
   7785         default:
   7786             return (BCM_E_PARAM);
   7787     }
   7788     return (BCM_E_NONE);
   7789 }
   7790 
   7791 int
   7792 _bcm_field_td2_qualify_TunnelType_get(uint8                  tcam_data,
   7793                                       uint8                  tcam_mask,
   7794                                       bcm_field_TunnelType_t *tunnel_type
   7795                                       )
   7796 {
   7797     switch (tcam_data & tcam_mask) {
   7798         case 0x1:
   7799             *tunnel_type = bcmFieldTunnelTypeIp;
   7800             break;
   7801         case 0x2:
   7802             *tunnel_type = bcmFieldTunnelTypeMpls;
   7803             break;
   7804         case 0x3:
   7805             *tunnel_type = bcmFieldTunnelTypeMim;
   7806             break;
   7807         case 0x6:
   7808             *tunnel_type = bcmFieldTunnelTypeAutoMulticast;
   7809             break;
   7810         case 0x7:
   7811             *tunnel_type = bcmFieldTunnelTypeTrill;
   7812             break;
   7813         case 0x8:
   7814             *tunnel_type = bcmFieldTunnelTypeL2Gre;
   7815             break;
   7816         case 0x9:
   7817             *tunnel_type = bcmFieldTunnelTypeVxlan;
   7818             break;
   7819         case 0x0:
   7820             if(tcam_mask) {
   7821                 *tunnel_type = bcmFieldTunnelTypeNone;
   7822                 break;
   7823             }
   7824         default:
   7825             return (BCM_E_INTERNAL);
   7826     }
   7827 
   7828     return (BCM_E_NONE);
   7829 }
   7830 
   7831 static const struct {
   7832     uint8 api, hw_data, hw_mask;
   7833 } pkt_res_xlate_tbl[] = {
   7834     {  BCM_FIELD_PKT_RES_UNKNOWN,         0x00, 0x3f },
   7835     {  BCM_FIELD_PKT_RES_CONTROL,         0x01, 0x3f },
   7836     {  BCM_FIELD_PKT_RES_BPDU,            0x04, 0x3f },
   7837     {  BCM_FIELD_PKT_RES_L2BC,            0x0c, 0x3f },
   7838     {  BCM_FIELD_PKT_RES_L2UC,            0x08, 0x3f },
   7839     {  BCM_FIELD_PKT_RES_L2UNKNOWN,       0x09, 0x3f },
   7840     {  BCM_FIELD_PKT_RES_L3MCUNKNOWN,     0x13, 0x3f },
   7841     {  BCM_FIELD_PKT_RES_L3MCKNOWN,       0x12, 0x3f },
   7842     {  BCM_FIELD_PKT_RES_L2MCKNOWN,       0x0a, 0x3f },
   7843     {  BCM_FIELD_PKT_RES_L2MCUNKNOWN,     0x0b, 0x3f },
   7844     {  BCM_FIELD_PKT_RES_L3UCKNOWN,       0x10, 0x3f },
   7845     {  BCM_FIELD_PKT_RES_L3UCUNKNOWN,     0x11, 0x3f },
   7846     {  BCM_FIELD_PKT_RES_MPLSKNOWN,       0x1c, 0x3f },
   7847     {  BCM_FIELD_PKT_RES_MPLSMCKNOWN,     0x1d, 0x3f },
   7848     {  BCM_FIELD_PKT_RES_MPLSL3KNOWN,     0x1a, 0x3f },
   7849     {  BCM_FIELD_PKT_RES_MPLSL2KNOWN,     0x18, 0x3f },
   7850     {  BCM_FIELD_PKT_RES_MPLSUNKNOWN,     0x19, 0x3f },
   7851     {  BCM_FIELD_PKT_RES_MIMKNOWN,        0x20, 0x3f },
   7852     {  BCM_FIELD_PKT_RES_MIMUNKNOWN,      0x21, 0x3f },
   7853     {  BCM_FIELD_PKT_RES_TRILLKNOWN,      0x28, 0x3f },
   7854     {  BCM_FIELD_PKT_RES_TRILLUNKNOWN,    0x29, 0x3f },
   7855     {  BCM_FIELD_PKT_RES_NIVKNOWN,        0x30, 0x3f },
   7856     {  BCM_FIELD_PKT_RES_NIVUNKNOWN,      0x31, 0x3f },
   7857     {  BCM_FIELD_PKT_RES_OAM,             0x02, 0x3f },
   7858     {  BCM_FIELD_PKT_RES_BFD,             0x03, 0x3f },
   7859     {  BCM_FIELD_PKT_RES_ICNM,            0x05, 0x3f },
   7860     {  BCM_FIELD_PKT_RES_IEEE1588,        0x06, 0x3f },
   7861     {  BCM_FIELD_PKT_RES_L2GREKNOWN,      0x32, 0x3f },
   7862     {  BCM_FIELD_PKT_RES_VXLANKNOWN,      0x33, 0x3f },
   7863     {  BCM_FIELD_PKT_RES_FCOEKNOWN,       0x34, 0x3f },
   7864     {  BCM_FIELD_PKT_RES_FCOEUNKNOWN,     0x35, 0x3f },
   7865     {  BCM_FIELD_PKT_RES_PIMBIDIRUNKNOWN, 0x1d, 0x3f },
   7866     {  BCM_FIELD_PKT_RES_L2_ANY,          0x08, 0x38 },
   7867     {  BCM_FIELD_PKT_RES_L2MC_ANY,        0x0a, 0x3e },
   7868     {  BCM_FIELD_PKT_RES_TRILL_ANY,       0x28, 0x3e },
   7869     {  BCM_FIELD_PKT_RES_NIV_ANY,         0x30, 0x3e },
   7870     {  BCM_FIELD_PKT_RES_MPLS_ANY,        0x18, 0x38 },
   7871     {  BCM_FIELD_PKT_RES_MIM_ANY,         0x20, 0x3e },
   7872     {  BCM_FIELD_PKT_RES_FCOE_ANY,        0x34, 0x3e },
   7873     {  BCM_FIELD_PKT_RES_L3_ANY,          0x10, 0x3e }
   7874 };
   7875 
   7876 int
   7877 _bcm_field_td2_qualify_PacketRes(int               unit,
   7878                                  bcm_field_entry_t entry,
   7879                                  uint32            *data,
   7880                                  uint32            *mask
   7881                                  )
   7882 {
   7883     uint32 i;
   7884     uint8 mark = 0;
   7885 
   7886     /* Translate data #defines to hardware encodings */
   7887     for (i = 0; i < COUNTOF(pkt_res_xlate_tbl); ++i) {
   7888         if (*data == pkt_res_xlate_tbl[i].api) {
   7889             *data = pkt_res_xlate_tbl[i].hw_data;
   7890             *mask = pkt_res_xlate_tbl[i].hw_mask;
   7891             mark = 1;
   7892             break;
   7893         }
   7894     }
   7895     if (mark == 1) {
   7896         return (BCM_E_NONE);
   7897     } else {   
   7898         return (BCM_E_INTERNAL);
   7899     }
   7900 }
   7901 
   7902 int
   7903 _bcm_field_td2_qualify_PacketRes_get(int               unit,
   7904                                      bcm_field_entry_t entry,
   7905                                      uint32            *data,
   7906                                      uint32            *mask
   7907                                      )
   7908 {
   7909     uint32 i;
   7910     uint8 mark = 0;
   7911     /* Translate data #defines from hardware encodings */
   7912 
   7913     for (i = 0; i < COUNTOF(pkt_res_xlate_tbl); ++i) {
   7914         if (*data == pkt_res_xlate_tbl[i].hw_data ) {
   7915             if ( pkt_res_xlate_tbl[i].hw_mask == 0x3f) {
   7916                 if ( (*mask == pkt_res_xlate_tbl[i].hw_data) ||
   7917                      (*mask == 0x3f) ) {
   7918 #ifdef BCM_TOMAHAWK2_SUPPORT
   7919     if (soc_feature(unit,
   7920                         soc_feature_field_multi_pipe_enhanced) &&
   7921                         *data == 0x1d) {
   7922         *data = BCM_FIELD_PKT_RES_PIMBIDIRUNKNOWN;
   7923         if (*mask == 0x1d) {
   7924             *mask = BCM_FIELD_PKT_RES_PIMBIDIRUNKNOWN;
   7925                         } else {
   7926                             *mask = BCM_FIELD_EXACT_MATCH_MASK;
   7927         }
   7928             mark = 1;
   7929             break;
   7930         }
   7931 #endif
   7932                     *data = pkt_res_xlate_tbl[i].api;
   7933                     if (*mask == pkt_res_xlate_tbl[i].hw_data) {
   7934             *mask = pkt_res_xlate_tbl[i].api;
   7935                     } else {
   7936                         *mask = BCM_FIELD_EXACT_MATCH_MASK;
   7937                     }
   7938                     mark = 1;
   7939             break;
   7940         }
   7941             } else {
   7942                 if ( (*mask != pkt_res_xlate_tbl[i].hw_data) &&
   7943                      (*mask != 0x3f) ) {
   7944                     *data = pkt_res_xlate_tbl[i].api;
   7945                     *mask = BCM_FIELD_EXACT_MATCH_MASK;
   7946                     mark = 1;
   7947                     break;
   7948                 }
   7949             }
   7950         }
   7951     }
   7952     if (mark == 1) {
   7953         return (BCM_E_NONE);
   7954     } else {
   7955         return (BCM_E_INTERNAL);
   7956     }
   7957 }
   7958 
   7959 /*
   7960  * Function:
   7961  *      _bcm_field_td2_qualify_VlanTranslationHit
   7962  * Purpose:
   7963  *      Set match criteria for bcmFieildQualifyVlanTranslationHit
   7964  *                     qualifier from the field entry.
   7965  * Parameters:
   7966  *      unit  - (IN) Unit number.
   7967  *      entry - (IN) BCM field entry id.
   7968  *      data  - (OUT) Qualifier match data.
   7969  *      mask  - (OUT) Qualifier match mask.
   7970  * Returns:
   7971  *      BCM_E_XXX
   7972  * Notes:
   7973  */
   7974 int
   7975 _bcm_field_td2_qualify_VlanTranslationHit(int               unit,
   7976                                           bcm_field_entry_t entry,
   7977                                           uint8             *data,
   7978                                           uint8             *mask)
   7979 {
   7980     uint8 data1 = 0;
   7981     uint8 mask1 = 0;
   7982     uint8 valid_range;
   7983 
   7984     if (data == NULL || mask == NULL) {
   7985        return BCM_E_PARAM;
   7986     }
   7987 
   7988     valid_range = BCM_FIELD_VXLT_LOOKUP_STATUS_FIRST_HIT |
   7989                   BCM_FIELD_VXLT_LOOKUP_STATUS_SECOND_HIT |
   7990                   BCM_FIELD_VXLT_LOOKUP_STATUS_HIT;
   7991     /* exact match mask. */
   7992     if (*mask == 0xff) {
   7993       *mask = valid_range;
   7994     }
   7995 
   7996     if ((*data != BCM_FIELD_VXLT_LOOKUP_STATUS_NO_HIT ||
   7997          *mask != BCM_FIELD_VXLT_LOOKUP_STATUS_NO_HIT) &&
   7998         ((*data & ~(valid_range)) || (*mask & ~(valid_range)))) {
   7999         LOG_ERROR(BSL_LS_BCM_FP,
   8000                   (BSL_META_U(unit,
   8001                   "Error: Invalid input paramaeters *data=0x%x *mask=0x%x\n"),
   8002                    *data, *mask));
   8003         return BCM_E_PARAM;
   8004     }
   8005        
   8006     if (*data == BCM_FIELD_VXLT_LOOKUP_STATUS_NO_HIT) {
   8007         data1 = 0;
   8008     } else {
   8009         if (*data & BCM_FIELD_VXLT_LOOKUP_STATUS_FIRST_HIT) {
   8010            data1 |= 0x1;
   8011         }
   8012 
   8013         if (*data & BCM_FIELD_VXLT_LOOKUP_STATUS_SECOND_HIT) {
   8014            data1 |= 0x2;
   8015         }
   8016 
   8017         if (*data & BCM_FIELD_VXLT_LOOKUP_STATUS_HIT) {
   8018            data1 |= 0x4;
   8019         }
   8020     }
   8021 
   8022     if (*mask == BCM_FIELD_VXLT_LOOKUP_STATUS_NO_HIT) {
   8023         mask1 = 0x0;
   8024     } else {
   8025         if (*mask & BCM_FIELD_VXLT_LOOKUP_STATUS_FIRST_HIT) {
   8026            mask1 |= 0x1;
   8027         }
   8028 
   8029         if (*mask & BCM_FIELD_VXLT_LOOKUP_STATUS_SECOND_HIT) {
   8030            mask1 |= 0x2;
   8031         }
   8032 
   8033         if (*mask & BCM_FIELD_VXLT_LOOKUP_STATUS_HIT) {
   8034            mask1 |= 0x4;
   8035         }
   8036     }
   8037 
   8038     *data = data1;
   8039     *mask = mask1;
   8040     return (BCM_E_NONE);
   8041 }
   8042 
   8043 /*
   8044  * Function:
   8045  *      _bcm_field_td2_qualify_VlanTranslationHit_get
   8046  * Purpose:
   8047  *      Get match criteria for bcmFieildQualifyVlanTranslationHit
   8048  *                     qualifier from the field entry.
   8049  * Parameters:
   8050  *      unit  - (IN) Unit number.
   8051  *      entry - (IN) BCM field entry id.
   8052  *      data  - (OUT) Qualifier match data.
   8053  *      mask  - (OUT) Qualifier match mask.
   8054  * Returns:
   8055  *      BCM_E_XXX
   8056  * Notes:
   8057  */
   8058 int
   8059 _bcm_field_td2_qualify_VlanTranslationHit_get(int               unit,
   8060                                               bcm_field_entry_t entry,
   8061                                               uint8             *data,
   8062                                               uint8             *mask)
   8063 {
   8064     uint8 data1 = 0;
   8065     uint8 mask1 = 0;
   8066 
   8067     if (data == NULL || mask == NULL) {
   8068        return BCM_E_PARAM;
   8069     }
   8070 
   8071     /* Translate data #defines to hardware encodings */
   8072     if (*data == 0) {
   8073         data1 = BCM_FIELD_VXLT_LOOKUP_STATUS_NO_HIT;
   8074     } else {
   8075         if (*data & 0x1) {
   8076            data1 |= BCM_FIELD_VXLT_LOOKUP_STATUS_FIRST_HIT;
   8077         }
   8078 
   8079         if (*data & 0x2) {
   8080            data1 |= BCM_FIELD_VXLT_LOOKUP_STATUS_SECOND_HIT;
   8081         }
   8082 
   8083         if (*data & 0x4) {
   8084            data1 |= BCM_FIELD_VXLT_LOOKUP_STATUS_HIT;
   8085         }
   8086     }
   8087 
   8088     if (*mask == 0) {
   8089         mask1 = BCM_FIELD_VXLT_LOOKUP_STATUS_NO_HIT;
   8090     } else {
   8091         if (*mask & 0x1) {
   8092            mask1 |= BCM_FIELD_VXLT_LOOKUP_STATUS_FIRST_HIT;
   8093         }
   8094 
   8095         if (*mask & 0x2) {
   8096            mask1 |= BCM_FIELD_VXLT_LOOKUP_STATUS_SECOND_HIT;
   8097         }
   8098 
   8099         if (*mask & 0x4) {
   8100            mask1 |= BCM_FIELD_VXLT_LOOKUP_STATUS_HIT;
   8101         }
   8102     }
   8103 
   8104     *data = data1;
   8105     *mask = mask1;
   8106 
   8107     return (BCM_E_NONE);
   8108 }
   8109 
   8110 /*
   8111  * Function:
   8112  *     _bcm_field_td2_hash_select_profile_get
   8113  * Purpose:
   8114  *     Get the redirect profile for the unit
   8115  * Parameters:
   8116  *     unit                - (IN) BCM device number
   8117  *     profile_mem         - (IN) HASH selection table mem
   8118  *     hash_select_profile - (OUT) hash selection profile
   8119  * Returns:
   8120  *     BCM_E_XXX
   8121  * Notes:
   8122  */
   8123 int
   8124 _bcm_field_td2_hash_select_profile_get(int unit, 
   8125                                        soc_mem_t profile_mem,
   8126                                        soc_profile_mem_t **hash_select_profile)
   8127 {
   8128     _field_stage_t *stage_fc;
   8129 
   8130     
   8131     if ((profile_mem != VFP_HASH_FIELD_BMAP_TABLE_Am) &&
   8132         (profile_mem != VFP_HASH_FIELD_BMAP_TABLE_Bm)) {
   8133         return BCM_E_PARAM; 
   8134     } 
   8135          
   8136     /* Get stage control structure. */
   8137     BCM_IF_ERROR_RETURN
   8138         (_field_stage_control_get(unit, _BCM_FIELD_STAGE_LOOKUP, &stage_fc));
   8139 
   8140     if (profile_mem == VFP_HASH_FIELD_BMAP_TABLE_Am) {
   8141         *hash_select_profile = &stage_fc->hash_select[0];
   8142     } else {
   8143         *hash_select_profile = &stage_fc->hash_select[1];
   8144     }
   8145 
   8146     return (BCM_E_NONE);
   8147 }
   8148 
   8149 /*
   8150  * Function:
   8151  *     _bcm_field_td2_hash_select_profile_ref_count_get
   8152  * Purpose:
   8153  *     Get hash selection profile entry use count.
   8154  * Parameters:
   8155  *     unit        - (IN) BCM device number.
   8156  *     profile_mem - (IN) HASH selection table mem
   8157  *     index       - (IN) Profile entry index.
   8158  *     ref_count   - (OUT) redirect profile use count.
   8159  * Returns:
   8160  *     BCM_E_XXX
   8161  */
   8162 int
   8163 _bcm_field_td2_hash_select_profile_ref_count_get(int unit,
   8164                                                  soc_mem_t profile_mem, 
   8165                                                  int index, 
   8166                                                  int *ref_count)
   8167 {
   8168     soc_profile_mem_t *hash_select_profile;
   8169 
   8170     if (NULL == ref_count) {
   8171         return (BCM_E_PARAM);
   8172     }
   8173 
   8174     /* Get the redirect profile */
   8175     BCM_IF_ERROR_RETURN
   8176         (_bcm_field_td2_hash_select_profile_get(unit,  profile_mem, 
   8177                                                 &hash_select_profile));
   8178 
   8179     BCM_IF_ERROR_RETURN(soc_profile_mem_ref_count_get(unit,
   8180                                                       hash_select_profile,
   8181                                                       index, ref_count));
   8182     return (BCM_E_NONE);
   8183 }
   8184 
   8185 /*
   8186  * Function:
   8187  *     _bcm_field_td2_hash_select_profile_delete
   8188  * Purpose:
   8189  *     Delete hash select profile entry.
   8190  * Parameters:
   8191  *     unit      - (IN) BCM device number.
   8192  *     index     - (IN) Profile entry index.
   8193  * Returns:
   8194  *     BCM_E_XXX
   8195  */
   8196 int
   8197 _bcm_field_td2_hash_select_profile_delete(int unit,
   8198                                           soc_mem_t profile_mem,
   8199                                           int index) 
   8200 {
   8201     soc_profile_mem_t *hash_select_profile;
   8202 
   8203     /* Get the redirect profile */
   8204     BCM_IF_ERROR_RETURN
   8205         (_bcm_field_td2_hash_select_profile_get(unit,  profile_mem, 
   8206                                                 &hash_select_profile));
   8207 
   8208     BCM_IF_ERROR_RETURN
   8209         (soc_profile_mem_delete(unit, hash_select_profile, index));
   8210 
   8211     return (BCM_E_NONE);
   8212 }
   8213 
   8214 /*
   8215  * Function:
   8216  *     _bcm_field_td2_hash_select_profile_alloc
   8217  * Purpose:
   8218  *     Allocate hash selection profile index
   8219  * Parameters:
   8220  *     unit     - (IN) BCM device number.
   8221  *     f_ent    - (IN) Field entry structure to get policy info from.
   8222  *     fa       - (IN) Field action.
   8223  * Returns:
   8224  *     BCM_E_XXX
   8225  */
   8226 int
   8227 _bcm_field_td2_hash_select_profile_alloc(int unit, _field_entry_t *f_ent,
   8228                                              _field_action_t *fa)
   8229    
   8230 {
   8231     vfp_hash_field_bmap_table_a_entry_t entry_arr[2];
   8232     uint32            *entry_ptr[2];
   8233     soc_profile_mem_t *hash_select_profile;
   8234     int               rv;
   8235     void              *entries[1];
   8236     soc_mem_t         profile_mem;
   8237 
   8238     if ((NULL == f_ent) || (NULL == fa)) {
   8239         return (BCM_E_PARAM);
   8240     }
   8241 
   8242     profile_mem = (fa->action == bcmFieldActionHashSelect0)? 
   8243                                     VFP_HASH_FIELD_BMAP_TABLE_Am:
   8244                                     VFP_HASH_FIELD_BMAP_TABLE_Bm ;
   8245 
   8246     entry_ptr[0] = (uint32 *)entry_arr;
   8247     entry_ptr[1] =  entry_ptr[0] + soc_mem_entry_words(unit, profile_mem);
   8248     entries[0] = (void *)&entry_arr;
   8249 
   8250     /* Reset hash select profile entry. */
   8251     sal_memcpy(entry_ptr[0], soc_mem_entry_null(unit, profile_mem),
   8252                soc_mem_entry_words(unit, profile_mem) * sizeof(uint32));
   8253     sal_memcpy(entry_ptr[1], soc_mem_entry_null(unit, profile_mem),
   8254                soc_mem_entry_words(unit, profile_mem) * sizeof(uint32));
   8255  
   8256     /* Get the hash_select profile */
   8257     rv = _bcm_field_td2_hash_select_profile_get(unit,  profile_mem, 
   8258                                                 &hash_select_profile);
   8259     BCM_IF_ERROR_RETURN(rv);
   8260 
   8261     switch (fa->action) {
   8262       case bcmFieldActionHashSelect0:
   8263       case bcmFieldActionHashSelect1:
   8264           soc_mem_field_set(unit, profile_mem, entry_ptr[0], 
   8265                             BITMAPf, &fa->param[0]);
   8266           rv = soc_profile_mem_add(unit, hash_select_profile, entries,
   8267                                    1, (uint32*) &fa->hw_index);
   8268           if (BCM_SUCCESS(rv) && (fa->hw_index == 0)) {
   8269             /*
   8270              * Index 0 is invalid as the hardware will consider hash bitmap
   8271              * selection from VFP only if HASH_FIELD_BITMAP_PTR_A and
   8272              * HASH_FIELD_BITMAP_PTR_B are non-zero.
   8273              * If the index is 0, return BCM_E_INTERNAL.
   8274              */ 
   8275              return BCM_E_INTERNAL;
   8276           }
   8277           BCM_IF_ERROR_RETURN(rv);
   8278           break;
   8279       default:
   8280           return (BCM_E_PARAM);
   8281     }
   8282     return (BCM_E_NONE);
   8283 }
   8284 /*
   8285  * Function:
   8286  *     _bcm_field_td2_hash_select_profile_hw_free
   8287  *
   8288  * Purpose:
   8289  *     Free hash selection profile indexes required for entry installation.
   8290  *
   8291  * Parameters:
   8292  *     unit      - (IN) BCM device number.
   8293  *     f_ent     - (IN) Field entry descriptor.
   8294  *     flags     - (IN) Free flags (old/new/both). 
   8295  * Returns:
   8296  *     BCM_E_XXX
   8297  * Notes:
   8298  */
   8299 int
   8300 _bcm_field_td2_hash_select_profile_hw_free(int unit, 
   8301                                            _field_entry_t *f_ent, 
   8302                                            uint32 flags)
   8303 {
   8304     _field_action_t *fa;  /* Field action descriptor. */
   8305     int rv = BCM_E_NONE;  /* Operation return status. */
   8306     soc_mem_t mem; /* hash selection memory */
   8307 
   8308     /* Applicable to stage lookup on TRIDENT2 devices. */
   8309     if ((0 == (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit)||
   8310                soc_feature(unit, soc_feature_field_multi_pipe_support))) ||
   8311         (_BCM_FIELD_STAGE_LOOKUP != f_ent->group->stage_id)) {
   8312         return (BCM_E_NONE);
   8313     }
   8314 
   8315     /* Extract the policy info from the entry structure. */
   8316     for (fa = f_ent->actions; fa != NULL; fa = fa->next) {
   8317         switch (fa->action) {
   8318           case bcmFieldActionHashSelect0:
   8319           case bcmFieldActionHashSelect1:
   8320               mem = ((fa->action == bcmFieldActionHashSelect0)?   
   8321                      VFP_HASH_FIELD_BMAP_TABLE_Am: 
   8322                      VFP_HASH_FIELD_BMAP_TABLE_Bm);
   8323 
   8324               if ((flags & _FP_ACTION_RESOURCE_FREE) && 
   8325                   (_FP_INVALID_INDEX != fa->hw_index)) {
   8326                   rv = _bcm_field_td2_hash_select_profile_delete(unit, 
   8327                                                                  mem,
   8328                                                                  fa->hw_index);
   8329                   BCM_IF_ERROR_RETURN(rv);
   8330                   fa->hw_index = _FP_INVALID_INDEX;
   8331               } 
   8332 
   8333               if ((flags & _FP_ACTION_OLD_RESOURCE_FREE) && 
   8334                   (_FP_INVALID_INDEX != fa->old_index)) {
   8335                   rv = _bcm_field_td2_hash_select_profile_delete(unit,
   8336                                                                  mem,
   8337                                                                  fa->old_index);
   8338                   BCM_IF_ERROR_RETURN(rv);
   8339                   fa->old_index = _FP_INVALID_INDEX;
   8340               }
   8341               break;
   8342           default:
   8343               break;
   8344         }
   8345     }
   8346     return (rv);
   8347 }
   8348 
   8349 /*
   8350  * Function:
   8351  *     _bcm_field_td2_hash_select_profile_hw_alloc
   8352  *
   8353  * Purpose:
   8354  *     Allocate redirect profile index required for entry installation.
   8355  *
   8356  * Parameters:
   8357  *     unit      - (IN) BCM device number.
   8358  *     f_ent     - (IN) Field entry descriptor.
   8359  * Returns:
   8360  *     BCM_E_XXX
   8361  * Notes:
   8362  */
   8363 int
   8364 _bcm_field_td2_hash_select_profile_hw_alloc (int unit, _field_entry_t *f_ent)
   8365 {
   8366     int rv = BCM_E_NONE;  /* Operation return status.     */
   8367     _field_action_t *fa;  /* Field action descriptor.     */
   8368     int ref_count;        /* Profile use reference count. */
   8369     soc_mem_t mem;        /* Profile mem. */
   8370 
   8371     /* Applicable to stage lookup on TRIDENT2 devices only. */
   8372     if ((0 == (SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit) ||
   8373                soc_feature(unit, soc_feature_field_multi_pipe_support))) ||
   8374         (_BCM_FIELD_STAGE_LOOKUP != f_ent->group->stage_id)) { 
   8375         return (BCM_E_NONE);
   8376     }
   8377 
   8378     /* Extract the policy info from the entry structure. */
   8379     for (fa = f_ent->actions; 
   8380         ((fa != NULL) && (_FP_ACTION_VALID & fa->flags)); 
   8381         fa = fa->next) {
   8382         switch (fa->action) {
   8383           case bcmFieldActionHashSelect0:
   8384           case bcmFieldActionHashSelect1:
   8385               mem = ((fa->action == bcmFieldActionHashSelect0)?   
   8386                      VFP_HASH_FIELD_BMAP_TABLE_Am: 
   8387                      VFP_HASH_FIELD_BMAP_TABLE_Bm);
   8388 
   8389               /*
   8390                * Store previous hardware index value in old_index.
   8391                */ 
   8392               fa->old_index = fa->hw_index;
   8393 
   8394               rv = _bcm_field_td2_hash_select_profile_alloc(unit, f_ent, fa);
   8395               if ((BCM_E_RESOURCE == rv) && 
   8396                   (_FP_INVALID_INDEX != fa->old_index)) {
   8397                   /* Destroy old profile ONLY 
   8398                    * if it is not used by other entries.
   8399                    */
   8400                   rv = _bcm_field_td2_hash_select_profile_ref_count_get(unit,
   8401                                                                  mem,  
   8402                                                                  fa->old_index,
   8403                                                                  &ref_count);
   8404                   BCM_IF_ERROR_RETURN(rv);
   8405                   if (ref_count > 1) {
   8406                       return (BCM_E_RESOURCE);
   8407                   }
   8408                   rv = _bcm_field_td2_hash_select_profile_delete(unit,
   8409                                                                  mem, 
   8410                                                                  fa->old_index);
   8411                   BCM_IF_ERROR_RETURN(rv);
   8412 
   8413                   /* Destroy old profile is no longer required. */
   8414                   fa->old_index = _FP_INVALID_INDEX;
   8415 
   8416                   /* Reallocate profile for new action. */
   8417                   rv = _bcm_field_td2_hash_select_profile_alloc(unit, 
   8418                                                                 f_ent, 
   8419                                                                 fa);
   8420               } 
   8421               break;
   8422           default:
   8423               break;
   8424         }
   8425         if (BCM_FAILURE(rv)) {
   8426             _bcm_field_td2_hash_select_profile_hw_free(unit, f_ent, _FP_ACTION_HW_FREE);
   8427             break;
   8428         }
   8429     }
   8430 
   8431     return (rv);
   8432 }
   8433 
   8434 /*
   8435  * Function:
   8436  *     _field_td2_action_hash_select
   8437  * Purpose:
   8438  *     Install hash selection action in policy table.
   8439  * Parameters:
   8440  *     unit     - (IN) BCM device number.
   8441  *     mem      - (IN) Policy table memory.
   8442  *     f_ent    - (IN) Field entry structure to get policy info from.
   8443  *     fa       - (IN) Field action.
   8444  *     buf      - (OUT) Field Policy table entry.
   8445  * Returns:
   8446  *     BCM_E_XXX
   8447  */
   8448 STATIC int
   8449 _field_td2_action_hash_select(int unit, soc_mem_t mem, _field_entry_t *f_ent,
   8450                                   _field_action_t *fa, uint32 *buf)
   8451 {
   8452     soc_field_t   hash_select_field = INVALIDf;
   8453 
   8454     if (NULL == f_ent || NULL == fa || NULL == buf) {
   8455         return (BCM_E_PARAM);
   8456     }
   8457 
   8458     switch (fa->action) {
   8459     case bcmFieldActionHashSelect0:
   8460         hash_select_field = HASH_FIELD_BITMAP_PTR_Af; 
   8461         break; 
   8462          
   8463     case bcmFieldActionHashSelect1:
   8464         hash_select_field = HASH_FIELD_BITMAP_PTR_Bf; 
   8465         break;
   8466     default:
   8467         return (BCM_E_PARAM);
   8468     }
   8469 
   8470     PolicySet(unit, mem, buf, hash_select_field, fa->hw_index);
   8471     return (BCM_E_NONE);
   8472 }
   8473 /*
   8474  * Function:
   8475  *     _field_td2_stage_action_support_check
   8476  * Purpose:
   8477  *     Check if action is supported by device for the given stage.
   8478  * Parameters:
   8479  *     unit     - (IN) BCM device number.
   8480  *     stage    - (IN) Field processor stage.
   8481  *     action   - (IN) Action to check(bcmFieldActionXXX)
   8482  *     result   - (OUT)              
   8483  *               TRUE   - action is supported by device
   8484  *               FALSE  - action is NOT supported by device
   8485  * Returns:
   8486  *     BCM_E_XXX
   8487  */
   8488 STATIC int
   8489 _field_td2_stage_action_support_check(int                unit,
   8490                                       unsigned           stage,
   8491                                       bcm_field_action_t action,
   8492                                       int                *result
   8493                                       )
   8494 {
   8495     switch (action) {
   8496         case bcmFieldActionFibreChanSrcBindEnable:
   8497         case bcmFieldActionFibreChanFpmaPrefixCheckEnable:
   8498         case bcmFieldActionFibreChanZoneCheckEnable:
   8499             *result = (soc_feature(unit, soc_feature_fcoe) && 
   8500                 (stage == _BCM_FIELD_STAGE_LOOKUP));
   8501             return (BCM_E_NONE);
   8502             break;
   8503         case bcmFieldActionHashSelect0:
   8504         case bcmFieldActionHashSelect1:
   8505             *result = (stage == _BCM_FIELD_STAGE_LOOKUP);
   8506             return (BCM_E_NONE);
   8507             break;
   8508         case bcmFieldActionFibreChanVsanId:
   8509             *result = (soc_feature(unit, soc_feature_fcoe) && 
   8510                 (stage == _BCM_FIELD_STAGE_INGRESS || _BCM_FIELD_STAGE_LOOKUP));
   8511             return (BCM_E_NONE);
   8512             break;
   8513         case bcmFieldActionFibreChanZoneCheckActionCancel:
   8514         case bcmFieldActionFibreChanIntVsanPri:
   8515             *result = (soc_feature(unit, soc_feature_fcoe) &&
   8516                 (stage == _BCM_FIELD_STAGE_INGRESS));
   8517             return (BCM_E_NONE);
   8518             break;
   8519         case bcmFieldActionNewClassId:
   8520         case bcmFieldActionEgressClassSelect:
   8521         case bcmFieldActionHiGigClassSelect:
   8522         case bcmFieldActionIngSampleEnable: 
   8523         case bcmFieldActionEgrSampleEnable:
   8524         case bcmFieldActionTrunkLoadBalanceCancel:
   8525         case bcmFieldActionDoNotCutThrough:
   8526             *result = (stage == _BCM_FIELD_STAGE_INGRESS);
   8527             return (BCM_E_NONE);
   8528             break;
   8529         case bcmFieldActionTrunkResilientHashCancel:
   8530             *result = (soc_feature(unit, soc_feature_lag_resilient_hash) && 
   8531                 (stage == _BCM_FIELD_STAGE_INGRESS));
   8532             return (BCM_E_NONE);
   8533             break;
   8534         case bcmFieldActionHgTrunkResilientHashCancel:
   8535             *result = (soc_feature(unit, soc_feature_hg_resilient_hash) && 
   8536                 (stage == _BCM_FIELD_STAGE_INGRESS));
   8537             return (BCM_E_NONE);
   8538             break;
   8539         case bcmFieldActionEcmpResilientHashCancel:
   8540             *result = (soc_feature(unit, soc_feature_ecmp_resilient_hash) && 
   8541                 (stage == _BCM_FIELD_STAGE_INGRESS));
   8542             return (BCM_E_NONE);
   8543             break;
   8544         case bcmFieldActionVxlanHeaderBits8_31_Set:
   8545         case bcmFieldActionVxlanHeaderBits56_63_Set:
   8546         case bcmFieldActionVxlanHeaderFlags:
   8547             *result = (stage == _BCM_FIELD_STAGE_EGRESS);
   8548             return (BCM_E_NONE);
   8549         case bcmFieldActionOamOlpHeaderAdd:
   8550         case bcmFieldActionOamDmTimeFormat:
   8551             /* In trident 2 based chipsets actions are applicable
   8552              * only for OAM based on FP */
   8553             if (soc_feature(unit, soc_feature_fp_based_oam)) {
   8554                 if ((stage == _BCM_FIELD_STAGE_INGRESS)
   8555 #if defined(BCM_APACHE_SUPPORT)
   8556                         || (SOC_IS_APACHE(unit) &&
   8557                             (stage == _BCM_FIELD_STAGE_EGRESS))
   8558 #endif
   8559                    ) {
   8560                     *result = TRUE;
   8561                 } else {
   8562                     *result = FALSE;
   8563                 }
   8564             } else {
   8565                 *result = FALSE;
   8566             }
   8567             return BCM_E_NONE;
   8568             break;
   8569         case bcmFieldActionEgressPbmpNullCopyToCpu:
   8570 #if defined (BCM_TRIDENT2PLUS_SUPPORT)
   8571             if (SOC_IS_TD2P_TT2P(unit) || SOC_IS_APACHE(unit)) {
   8572                 *result = (stage == _BCM_FIELD_STAGE_INGRESS);
   8573             } else
   8574 #endif
   8575             {
   8576                 *result = FALSE;
   8577             }
   8578             return BCM_E_NONE;
   8579             break;
   8580         case bcmFieldActionPimBidirFwd:
   8581             *result = (stage == _BCM_FIELD_STAGE_LOOKUP);
   8582             return (BCM_E_NONE);
   8583             break;
   8584 
   8585         case bcmFieldActionUcastQueueNew:
   8586         case bcmFieldActionRpUcastQueueNew:
   8587         case bcmFieldActionYpUcastQueueNew:
   8588         case bcmFieldActionGpUcastQueueNew:
   8589             *result = ( stage == _BCM_FIELD_STAGE_INGRESS);
   8590             return (BCM_E_NONE);
   8591             break;
   8592         case bcmFieldActionIntCosUcastQueueNew:
   8593         case bcmFieldActionRpIntCosUcastQueueNew:
   8594         case bcmFieldActionYpIntCosUcastQueueNew:
   8595         case bcmFieldActionGpIntCosUcastQueueNew:
   8596             *result = ( stage == _BCM_FIELD_STAGE_INGRESS);
   8597             return (BCM_E_NONE);
   8598             break;
   8599 #if defined(BCM_APACHE_SUPPORT)
   8600         case bcmFieldActionStrength:
   8601             if (SOC_IS_APACHE(unit) && !SOC_IS_MONTEREY(unit)) {
   8602                 *result = (stage == _BCM_FIELD_STAGE_EGRESS);
   8603             } else {
   8604                 *result = FALSE;
   8605             }
   8606             return BCM_E_NONE;
   8607             break;
   8608         case bcmFieldActionRedirectBufferPriority:
   8609             if (SOC_IS_APACHE(unit) && !SOC_IS_MONTEREY(unit)) {
   8610                 *result = (stage == _BCM_FIELD_STAGE_EGRESS);
   8611             } else {
   8612                 *result = FALSE;
   8613             }
   8614             return BCM_E_NONE;
   8615             break;
   8616         case bcmFieldActionOamStatObjectSessionId:
   8617 #ifdef BCM_MONTEREY_SUPPORT
   8618             if (SOC_IS_MONTEREY(unit)) {
   8619                 *result = FALSE;
   8620             } else
   8621 #endif
   8622             if (SOC_IS_APACHE(unit)) {
   8623                 *result = ((stage == _BCM_FIELD_STAGE_EGRESS) || (stage == _BCM_FIELD_STAGE_INGRESS));
   8624             } else {
   8625                 *result = FALSE;
   8626             }
   8627             return BCM_E_NONE;
   8628             break;
   8629         case bcmFieldActionLoopbackOamResponse:
   8630         case bcmFieldActionLoopbackSatResponse:
   8631             if (SOC_IS_APACHE(unit)) {
   8632                 *result = ((stage == _BCM_FIELD_STAGE_EGRESS) || (stage == _BCM_FIELD_STAGE_INGRESS));
   8633             } else {
   8634                 *result = FALSE;
   8635             }
   8636             return BCM_E_NONE;
   8637             break;
   8638 #endif /* BCM_APACHE_SUPPORT */
   8639         default:
   8640         ;
   8641     }
   8642 
   8643     return (_bcm_field_trx_stage_action_support_check(unit, stage, action, result));
   8644 }
   8645 /*
   8646  * Function:
   8647  *     _bcm_field_td2_stage_action_support_check
   8648  * Purpose:
   8649  *     Check if action is supported by device for the given stage.
   8650  * Parameters:
   8651  *     unit     - (IN) BCM device number.
   8652  *     stage    - (IN) Field processor stage.
   8653  *     action   - (IN) Action to check(bcmFieldActionXXX)
   8654  *     result   - (OUT)              
   8655  *               TRUE   - action is supported by device
   8656  *               FALSE  - action is NOT supported by device
   8657  * Returns:
   8658  *     BCM_E_XXX
   8659  */
   8660 int
   8661 _bcm_field_td2_stage_action_support_check(int            unit,
   8662                                       unsigned           stage,
   8663                                       bcm_field_action_t action,
   8664                                       int                *result
   8665                                       )
   8666 {
   8667     return _field_td2_stage_action_support_check(unit, stage, action, result);
   8668 }
   8669 /*
   8670  * Function:
   8671  *     _field_td2_action_support_check
   8672  * Purpose:
   8673  *     Check if action is supported by device.
   8674  * Parameters:
   8675  *     unit     - (IN) BCM device number.
   8676  *     f_ent    - (IN) Field entry structure to get policy info from.
   8677  *     action   - (IN) Action to check(bcmFieldActionXXX)
   8678  *     result -(OUT)              
   8679  *               TRUE   - action is supported by device
   8680  *               FALSE  - action is NOT supported by device
   8681  * Returns:
   8682  *     BCM_E_XXX
   8683  */
   8684 int
   8685 _field_td2_action_support_check(int                unit,
   8686                                 _field_entry_t     *f_ent,
   8687                                 bcm_field_action_t action,
   8688                                 int                *result
   8689                                 )
   8690 {
   8691     return (_field_td2_stage_action_support_check(unit,
   8692                                                   f_ent->group->stage_id,
   8693                                                   action,
   8694                                                   result
   8695                                                   )
   8696             );
   8697 }
   8698 /*
   8699  * Function:
   8700  *     _bcm_field_td2_action_support_check
   8701  * Purpose:
   8702  *     Check if action is supported by device.
   8703  * Parameters:
   8704  *     unit     - (IN) BCM device number.
   8705  *     f_ent    - (IN) Field entry structure to get policy info from.
   8706  *     action   - (IN) Action to check(bcmFieldActionXXX)
   8707  *     result -(OUT)              
   8708  *               TRUE   - action is supported by device
   8709  *               FALSE  - action is NOT supported by device
   8710  * Returns:
   8711  *     BCM_E_XXX
   8712  */
   8713 int
   8714 _bcm_field_td2_action_support_check(int                unit,
   8715                                     _field_entry_t     *f_ent,
   8716                                     bcm_field_action_t action,
   8717                                     int                *result
   8718                                     )
   8719 {
   8720     return _field_td2_action_support_check(unit, f_ent, action, result);  
   8721 }
   8722 
   8723 
   8724 
   8725 /*
   8726  * Function:
   8727  *    _bcm_field_action_stat_conflict_check
   8728  *
   8729  * Purpose:
   8730  *     Check if actions conflict stat actions.
   8731  *
   8732  * Parameters:
   8733  *     unit    -(IN) BCM device number
   8734  *     f_ent   -(IN) Field entry structure.
   8735  *     fa      -(IN) Field Action Structure.
   8736  *
   8737  * Returns:
   8738  *     BCM_E_PARAM  - if input arguments are NULL.
   8739  *     BCM_E_CONFIG - if actions do conflict.
   8740  *     BCM_E_NONE   - if there is no conflict.
   8741  */
   8742 
   8743 int _bcm_field_action_stat_conflict_check (int unit, _field_entry_t *f_ent, _field_action_t *fa)
   8744 {
   8745     _field_entry_stat_t *f_ent_st = NULL;
   8746 
   8747     if ((fa == NULL) || (f_ent == NULL)) {
   8748         return BCM_E_PARAM;
   8749     }
   8750 
   8751     f_ent_st = &f_ent->statistic;
   8752 
   8753     switch (fa->action) {
   8754         case bcmFieldActionAddClassTag:
   8755         case bcmFieldActionL3ChangeVlan:
   8756         case bcmFieldActionL3ChangeVlanCancel:
   8757         case bcmFieldActionL3ChangeMacDa:
   8758         case bcmFieldActionL3ChangeMacDaCancel:
   8759         case bcmFieldActionL3Switch:
   8760         case bcmFieldActionL3SwitchCancel:
   8761         case bcmFieldActionSrcMacNew:
   8762         case bcmFieldActionDstMacNew:
   8763         case bcmFieldActionOuterVlanNew:
   8764         case bcmFieldActionFabricQueue:
   8765         case bcmFieldActionVnTagNew:
   8766         case bcmFieldActionVnTagDelete:
   8767         case bcmFieldActionEtagNew:
   8768         case bcmFieldActionEtagDelete:
   8769         case bcmFieldActionRedirectEgrNextHop:
   8770         case bcmFieldActionNewClassId:
   8771         case bcmFieldActionEgressClassSelect:
   8772         case bcmFieldActionHiGigClassSelect:
   8773             if (f_ent_st->flags & _FP_ENTRY_EXTENDED_STAT_VALID) {
   8774 #ifdef BROADCOM_DEBUG
   8775                 LOG_ERROR(BSL_LS_BCM_FP,
   8776                         (BSL_META_U(unit,
   8777                                     "FP(unit %d) Error: action=%s conflicts with"
   8778                                     " statistics action in entry=%d\n"), unit,
   8779                          _field_action_name(fa->action), f_ent->eid));
   8780 #endif /* BROADCOM_DEBUG */
   8781                 return (BCM_E_CONFIG);
   8782             }
   8783             break;
   8784         case bcmFieldActionVxlanHeaderBits8_31_Set:
   8785         case bcmFieldActionVxlanHeaderBits56_63_Set:
   8786         case bcmFieldActionVxlanHeaderFlags:
   8787             if (f_ent_st->flags & _FP_ENTRY_STAT_VALID) {
   8788 #ifdef BROADCOM_DEBUG
   8789                 LOG_ERROR(BSL_LS_BCM_FP,
   8790                         (BSL_META_U(unit,
   8791                                     "FP(unit %d) Error: action=%s conflicts with"
   8792                                     " statistics action in entry=%d\n"), unit,
   8793                          _field_action_name(fa->action), f_ent->eid));
   8794 #endif /* BROADCOM_DEBUG */
   8795                 return (BCM_E_CONFIG);
   8796             }
   8797             break;
   8798         case bcmFieldActionDscpNew:
   8799         case bcmFieldActionGpDscpNew:
   8800         case bcmFieldActionYpDscpNew:
   8801         case bcmFieldActionRpDscpNew:
   8802         case bcmFieldActionDscpCancel:
   8803         case bcmFieldActionGpDscpCancel:
   8804         case bcmFieldActionYpDscpCancel:
   8805         case bcmFieldActionRpDscpCancel:
   8806             if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   8807                 if (f_ent_st->flags & _FP_ENTRY_EXTENDED_STAT_VALID) {
   8808 #ifdef BROADCOM_DEBUG
   8809                     LOG_ERROR(BSL_LS_BCM_FP,
   8810                             (BSL_META_U(unit,
   8811                                         "FP(unit %d) Error: action=%s conflicts with"
   8812                                         " statistics action in entry=%d\n"), unit,
   8813                              _field_action_name(fa->action), f_ent->eid));
   8814 #endif /* BROADCOM_DEBUG */
   8815                     return (BCM_E_CONFIG);
   8816                 }
   8817             }
   8818             break;
   8819         default:
   8820             break;
   8821     }
   8822 
   8823     return BCM_E_NONE;
   8824 }
   8825 
   8826 /*
   8827  * Function:
   8828  *   _bcm_field_action_stat_flag_update
   8829  *
   8830  * Purpose:
   8831  *     Update Stat_allowed flag for Stats based on actions added.
   8832  *
   8833  * Parameters:
   8834  *     unit            - (IN) BCM device number
   8835  *     f_ent           - (IN) Field entry structure.
   8836  *     fa              - (IN) Field Action Structure.
   8837  *     is_action_added - (IN) Action added or removed.
   8838  *
   8839  * Returns:
   8840  *     BCM_E_PARAM  - if input arguments are NULL.
   8841  *     BCM_E_CONFIG - if actions do conflict.
   8842  *     BCM_E_NONE   - if there is no conflict.
   8843  */
   8844 int _bcm_field_action_stat_flag_update (int unit,
   8845         _field_entry_t *f_ent,
   8846         _field_action_t *fa,
   8847         uint8 is_action_added)
   8848 {
   8849     _field_entry_stat_t *f_ent_st = NULL;
   8850     _field_action_t     *fa_cnt = NULL;
   8851     int stat_conflict_count = 0;
   8852     int extended_stat_conflict_count = 0;
   8853 
   8854     if ((fa == NULL) || (f_ent == NULL)) {
   8855         return BCM_E_PARAM;
   8856     }
   8857 
   8858     f_ent_st = &f_ent->statistic;
   8859 
   8860     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))
   8861         || soc_feature(unit, soc_feature_field_multi_pipe_support)) {
   8862         switch (fa->action) {
   8863             case bcmFieldActionAddClassTag:
   8864             case bcmFieldActionL3ChangeVlan:
   8865             case bcmFieldActionL3ChangeVlanCancel:
   8866             case bcmFieldActionL3ChangeMacDa:
   8867             case bcmFieldActionL3ChangeMacDaCancel:
   8868             case bcmFieldActionL3Switch:
   8869             case bcmFieldActionL3SwitchCancel:
   8870             case bcmFieldActionSrcMacNew:
   8871             case bcmFieldActionDstMacNew:
   8872             case bcmFieldActionOuterVlanNew:
   8873             case bcmFieldActionFabricQueue:
   8874             case bcmFieldActionVnTagNew:
   8875             case bcmFieldActionVnTagDelete:
   8876             case bcmFieldActionEtagNew:
   8877             case bcmFieldActionEtagDelete:
   8878             case bcmFieldActionRedirectEgrNextHop:
   8879             case bcmFieldActionNewClassId:
   8880             case bcmFieldActionEgressClassSelect:
   8881             case bcmFieldActionHiGigClassSelect:
   8882                 if (is_action_added) {
   8883                     f_ent_st->flags |=  _FP_ENTRY_EXTENDED_STAT_NOT_ALLOWED;
   8884                 } else {
   8885                     fa_cnt = f_ent->actions;
   8886                     while (fa_cnt != NULL) {
   8887                         if ((fa_cnt->action == bcmFieldActionAddClassTag)
   8888                                 ||(fa_cnt->action == bcmFieldActionL3ChangeVlan)
   8889                                 ||(fa_cnt->action == bcmFieldActionL3ChangeVlanCancel)
   8890                                 ||(fa_cnt->action == bcmFieldActionL3ChangeMacDa)
   8891                                 ||(fa_cnt->action == bcmFieldActionL3ChangeMacDaCancel)
   8892                                 ||(fa_cnt->action == bcmFieldActionL3Switch)
   8893                                 ||(fa_cnt->action == bcmFieldActionL3SwitchCancel)
   8894                                 ||(fa_cnt->action == bcmFieldActionSrcMacNew)
   8895                                 ||(fa_cnt->action == bcmFieldActionDstMacNew)
   8896                                 ||(fa_cnt->action == bcmFieldActionOuterVlanNew)
   8897                                 ||(fa_cnt->action == bcmFieldActionFabricQueue)
   8898                                 ||(fa_cnt->action == bcmFieldActionVnTagNew)
   8899                                 ||(fa_cnt->action == bcmFieldActionVnTagDelete)
   8900                                 ||(fa_cnt->action == bcmFieldActionEtagNew)
   8901                                 ||(fa_cnt->action == bcmFieldActionEtagDelete)
   8902                                 ||(fa_cnt->action == bcmFieldActionRedirectEgrNextHop)
   8903                                 ||(fa_cnt->action == bcmFieldActionNewClassId)
   8904                                 ||(fa_cnt->action == bcmFieldActionEgressClassSelect)
   8905                                 ||(fa_cnt->action == bcmFieldActionHiGigClassSelect)
   8906                            ) {
   8907                             extended_stat_conflict_count++;
   8908                         }
   8909                         fa_cnt = fa_cnt->next;
   8910                     }
   8911                     if (extended_stat_conflict_count == 1) {
   8912                         f_ent_st->flags &=
   8913                             ~_FP_ENTRY_EXTENDED_STAT_NOT_ALLOWED;
   8914                     }
   8915                 }
   8916                 break;
   8917             case bcmFieldActionVxlanHeaderBits8_31_Set:
   8918             case bcmFieldActionVxlanHeaderBits56_63_Set:
   8919             case bcmFieldActionVxlanHeaderFlags:
   8920                 if (is_action_added) {
   8921                     f_ent_st->flags |=  _FP_ENTRY_STAT_NOT_ALLOWED;
   8922                 } else {
   8923                     fa_cnt = f_ent->actions;
   8924                     while (fa_cnt != NULL) {
   8925                         if ((fa_cnt->action
   8926                                 == bcmFieldActionVxlanHeaderBits8_31_Set) ||
   8927                             (fa_cnt->action ==
   8928                                     bcmFieldActionVxlanHeaderBits56_63_Set) ||
   8929                             (fa_cnt->action ==
   8930                                     bcmFieldActionVxlanHeaderFlags)) {
   8931                             if (fa_cnt->flags  & _FP_ACTION_VALID) {
   8932                                 stat_conflict_count++;
   8933                             }
   8934                         }
   8935                         fa_cnt = fa_cnt->next;
   8936                     }
   8937                     if (stat_conflict_count == 1) {
   8938                         f_ent_st->flags &=  ~_FP_ENTRY_STAT_NOT_ALLOWED;
   8939                     }
   8940                 }
   8941                 break;
   8942             case bcmFieldActionDscpNew:
   8943             case bcmFieldActionGpDscpNew:
   8944             case bcmFieldActionYpDscpNew:
   8945             case bcmFieldActionRpDscpNew:
   8946             case bcmFieldActionDscpCancel:
   8947             case bcmFieldActionGpDscpCancel:
   8948             case bcmFieldActionYpDscpCancel:
   8949             case bcmFieldActionRpDscpCancel:
   8950                 if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   8951                     if (is_action_added) {
   8952                         f_ent_st->flags |=  _FP_ENTRY_EXTENDED_STAT_NOT_ALLOWED;
   8953                     } else {
   8954                         fa_cnt = f_ent->actions;
   8955                         while (fa_cnt != NULL) {
   8956                             if ((fa_cnt->action == bcmFieldActionDscpNew)
   8957                                     ||(fa_cnt->action == bcmFieldActionGpDscpNew)
   8958                                     ||(fa_cnt->action == bcmFieldActionYpDscpNew)
   8959                                     ||(fa_cnt->action == bcmFieldActionRpDscpNew)
   8960                                     ||(fa_cnt->action == bcmFieldActionDscpCancel)
   8961                                     ||(fa_cnt->action == bcmFieldActionGpDscpCancel)
   8962                                     ||(fa_cnt->action == bcmFieldActionYpDscpCancel)
   8963                                     ||(fa_cnt->action == bcmFieldActionRpDscpCancel)
   8964                                ) {
   8965                                 extended_stat_conflict_count++;
   8966                             }
   8967                             fa_cnt = fa_cnt->next;
   8968                         }
   8969                         if (extended_stat_conflict_count == 1) {
   8970                             f_ent_st->flags &=
   8971                                 ~_FP_ENTRY_EXTENDED_STAT_NOT_ALLOWED;
   8972                         }
   8973                     }
   8974                 }
   8975                 break;
   8976             default:
   8977                 break;
   8978         }
   8979     }
   8980     return BCM_E_NONE;
   8981 }
   8982 
   8983 int
   8984 _bcm_field_td2_action_conflict_check ( int                unit,
   8985                                        _field_entry_t     *f_ent,
   8986                                        bcm_field_action_t action1,
   8987                                        bcm_field_action_t action
   8988                                      )
   8989 {
   8990     int rv = BCM_E_NONE;
   8991 
   8992     /* Input parameters check */
   8993     if (NULL == f_ent) {
   8994         return (BCM_E_PARAM);
   8995     }
   8996     if (NULL == f_ent->group) {
   8997         return (BCM_E_PARAM);
   8998     }
   8999 
   9000     if (f_ent->group->stage_id == _BCM_FIELD_STAGE_LOOKUP) {
   9001         switch (action1) {
   9002 #if defined (BCM_TRIDENT3_SUPPORT)
   9003             case bcmFieldActionAssignOpaqueObject4:
   9004             case bcmFieldActionAssignOpaqueObject3:
   9005             case bcmFieldActionAssignOpaqueObject2:
   9006             case bcmFieldActionAssignOpaqueObject1:
   9007                 _FP_ACTIONS_CONFLICT(bcmFieldActionAssignOpaqueObject4);
   9008                 _FP_ACTIONS_CONFLICT(bcmFieldActionAssignOpaqueObject3);
   9009                 _FP_ACTIONS_CONFLICT(bcmFieldActionAssignOpaqueObject2);
   9010                 _FP_ACTIONS_CONFLICT(bcmFieldActionAssignOpaqueObject1);
   9011                 rv = BCM_E_NONE;
   9012                 break;
   9013 #endif
   9014             case bcmFieldActionIncomingMplsPortSet:
   9015                 _FP_ACTIONS_CONFLICT(bcmFieldActionIngressGportSet);
   9016                 _FP_ACTIONS_CONFLICT(bcmFieldActionDoNotCheckVlan);
   9017                 _FP_ACTIONS_CONFLICT(bcmFieldActionIncomingMplsPortSet);
   9018                 rv = BCM_E_NONE;
   9019                 break;
   9020             case bcmFieldActionIngressGportSet:
   9021                 _FP_ACTIONS_CONFLICT(bcmFieldActionDoNotCheckVlan);
   9022                 _FP_ACTIONS_CONFLICT(bcmFieldActionIncomingMplsPortSet);
   9023                 _FP_ACTIONS_CONFLICT(bcmFieldActionIngressGportSet);
   9024                 rv = BCM_E_NONE;
   9025                 break;
   9026             case bcmFieldActionL3IngressSet:
   9027                 _FP_ACTIONS_CONFLICT(bcmFieldActionDoNotCheckVlan);
   9028                 _FP_ACTIONS_CONFLICT(bcmFieldActionL3IngressSet);
   9029                 rv = BCM_E_NONE;
   9030                 break;
   9031             default:
   9032                 rv = _bcm_field_trx_action_conflict_check (unit, f_ent, action1, action); 
   9033                 break;
   9034         }
   9035     } else if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   9036         switch (action1) {
   9037             case bcmFieldActionVxlanHeaderBits8_31_Set:
   9038             case bcmFieldActionVxlanHeaderBits56_63_Set:
   9039             case bcmFieldActionVxlanHeaderFlags:
   9040                 _FP_ACTIONS_CONFLICT(action1);
   9041                 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanNew);
   9042                 _FP_ACTIONS_CONFLICT(bcmFieldActionInnerVlanPrioNew);
   9043                 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterVlanNew);
   9044                 _FP_ACTIONS_CONFLICT(bcmFieldActionOuterTpidNew);
   9045                 break;
   9046             case bcmFieldActionInnerVlanNew:
   9047             case bcmFieldActionInnerVlanPrioNew:
   9048             case bcmFieldActionOuterVlanNew:
   9049             case bcmFieldActionOuterTpidNew:
   9050                 _FP_ACTIONS_CONFLICT(bcmFieldActionVxlanHeaderBits8_31_Set);
   9051                 _FP_ACTIONS_CONFLICT(bcmFieldActionVxlanHeaderBits56_63_Set);
   9052                 _FP_ACTIONS_CONFLICT(bcmFieldActionVxlanHeaderFlags);
   9053                 break;
   9054             case bcmFieldActionLoopbackOamResponse:
   9055             case bcmFieldActionLoopbackSatResponse:
   9056                 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackOamResponse);
   9057                 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSatResponse);
   9058                 break;
   9059             default:
   9060                 rv = _bcm_field_trx_action_conflict_check (unit, f_ent, action1, action);
   9061                 break;
   9062         }
   9063     } else { /* For all other stages */
   9064         switch (action1) {
   9065             case bcmFieldActionNat:
   9066             case bcmFieldActionNatCancel:
   9067                 _FP_ACTIONS_CONFLICT(bcmFieldActionNat);
   9068                 _FP_ACTIONS_CONFLICT(bcmFieldActionNatCancel);
   9069                 if (soc_feature(unit, soc_feature_fp_based_oam)) {
   9070                     _FP_ACTIONS_CONFLICT(bcmFieldActionOamDmTimeFormat);
   9071                     _FP_ACTIONS_CONFLICT(bcmFieldActionOamOlpHeaderAdd);
   9072 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
   9073                     _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecEncrypt);
   9074                     _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecDecrypt);
   9075 #endif
   9076                 }
   9077                 break;
   9078             case bcmFieldActionNatEgressOverride:
   9079                 _FP_ACTIONS_CONFLICT(bcmFieldActionNatEgressOverride);
   9080                 if (soc_feature(unit, soc_feature_fp_based_oam)) {
   9081                     _FP_ACTIONS_CONFLICT(bcmFieldActionOamDmTimeFormat);
   9082                     _FP_ACTIONS_CONFLICT(bcmFieldActionOamOlpHeaderAdd);
   9083 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
   9084                     _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecEncrypt);
   9085                     _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecDecrypt);
   9086 #endif
   9087                 }
   9088                 break;
   9089             case bcmFieldActionOamDmTimeFormat:
   9090                 _FP_ACTIONS_CONFLICT(bcmFieldActionOamDmTimeFormat);
   9091                 if (soc_feature(unit, soc_feature_fp_based_oam)) {
   9092                     _FP_ACTIONS_CONFLICT(bcmFieldActionNat);
   9093                     _FP_ACTIONS_CONFLICT(bcmFieldActionNatCancel);
   9094                     _FP_ACTIONS_CONFLICT(bcmFieldActionNatEgressOverride);
   9095                 }
   9096                 break;
   9097             case bcmFieldActionOamOlpHeaderAdd:
   9098                 _FP_ACTIONS_CONFLICT(bcmFieldActionOamOlpHeaderAdd);
   9099                 if (soc_feature(unit, soc_feature_fp_based_oam)) {
   9100                     _FP_ACTIONS_CONFLICT(bcmFieldActionNat);
   9101                     _FP_ACTIONS_CONFLICT(bcmFieldActionNatCancel);
   9102                     _FP_ACTIONS_CONFLICT(bcmFieldActionNatEgressOverride);
   9103 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
   9104                     _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecEncrypt);
   9105                     _FP_ACTIONS_CONFLICT(bcmFieldActionMacSecDecrypt);
   9106 #endif
   9107                 }
   9108                 break;
   9109             case bcmFieldActionLoopbackOamResponse:
   9110             case bcmFieldActionLoopbackSatResponse:
   9111                 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackOamResponse);
   9112                 _FP_ACTIONS_CONFLICT(bcmFieldActionLoopbackSatResponse);
   9113                 break;
   9114             default:
   9115                 rv = _bcm_field_trx_action_conflict_check (unit, f_ent, action1, action);
   9116                 break;
   9117 
   9118         }
   9119     }
   9120 
   9121     return rv;
   9122 }
   9123 
   9124 #ifdef BCM_APACHE_SUPPORT
   9125 STATIC int
   9126 _bcm_field_copytocpu_params_check(int     unit,
   9127                               soc_mem_t       mem,
   9128                               _field_entry_t  *f_ent,
   9129                               _field_action_t *fa)
   9130 {
   9131     uint32       flags;
   9132     uint32       val;
   9133     uint8        idx;
   9134     uint32       green_flags  = BCM_FIELD_COPYTOCPU_GREEN_PACKET | \
   9135                                 BCM_FIELD_COPYTOCPU_GREEN_DROPPED_PACKET | \
   9136                                 BCM_FIELD_COPYTOCPU_GREEN_NOT_DROPPED_PACKET;
   9137     uint32       red_flags    = BCM_FIELD_COPYTOCPU_RED_PACKET | \
   9138                                 BCM_FIELD_COPYTOCPU_RED_DROPPED_PACKET | \
   9139                                 BCM_FIELD_COPYTOCPU_RED_NOT_DROPPED_PACKET;
   9140     uint32       yellow_flags = BCM_FIELD_COPYTOCPU_YELLOW_PACKET | \
   9141                                 BCM_FIELD_COPYTOCPU_YELLOW_DROPPED_PACKET | \
   9142                                 BCM_FIELD_COPYTOCPU_YELLOW_NOT_DROPPED_PACKET;
   9143 
   9144     if ((NULL == f_ent) || (NULL == fa)) {
   9145         return (BCM_E_PARAM);
   9146     }
   9147 
   9148     if (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id) {
   9149         return BCM_E_PARAM;
   9150     }
   9151 
   9152     flags = fa->param[2];
   9153 
   9154     /* Only one of the Green flag can be configured */
   9155     val = flags & green_flags;
   9156     if (val & (val -1)) {
   9157         return BCM_E_PARAM;
   9158     }
   9159 
   9160     /* Only one of the Red flag can be configured */
   9161     val = flags & red_flags;
   9162     if (val & (val -1)) {
   9163         return BCM_E_PARAM;
   9164     }
   9165 
   9166     /* Only one of the Yellow flag can be configured */
   9167     val = flags & yellow_flags;
   9168     if (val & (val -1)) {
   9169         return BCM_E_PARAM;
   9170     }
   9171 
   9172     for (idx = 0 ; idx < 32 ; idx++) {
   9173         val = flags & (1 << idx);
   9174 
   9175         switch(val) {
   9176             case BCM_FIELD_COPYTOCPU_GREEN_NOT_DROPPED_PACKET:
   9177                 PolicyCheck(unit, mem, G_COPY_TO_CPUf, 0x1);
   9178                 break;
   9179             case BCM_FIELD_COPYTOCPU_GREEN_DROPPED_PACKET:
   9180                 PolicyCheck(unit, mem, G_COPY_TO_CPUf, 0x2);
   9181                 break;
   9182             case BCM_FIELD_COPYTOCPU_GREEN_PACKET:
   9183                 PolicyCheck(unit, mem, G_COPY_TO_CPUf, 0x3);
   9184                 break;
   9185             case BCM_FIELD_COPYTOCPU_YELLOW_NOT_DROPPED_PACKET:
   9186                 PolicyCheck(unit, mem, Y_COPY_TO_CPUf, 0x1);
   9187                 break;
   9188             case BCM_FIELD_COPYTOCPU_YELLOW_DROPPED_PACKET:
   9189                 PolicyCheck(unit, mem, Y_COPY_TO_CPUf, 0x2);
   9190                 break;
   9191             case BCM_FIELD_COPYTOCPU_YELLOW_PACKET:
   9192                 PolicyCheck(unit, mem, Y_COPY_TO_CPUf, 0x3);
   9193                 break;
   9194             case BCM_FIELD_COPYTOCPU_RED_NOT_DROPPED_PACKET:
   9195                 PolicyCheck(unit, mem, R_COPY_TO_CPUf, 0x1);
   9196                 break;
   9197             case BCM_FIELD_COPYTOCPU_RED_DROPPED_PACKET:
   9198                 PolicyCheck(unit, mem, R_COPY_TO_CPUf, 0x2);
   9199                 break;
   9200             case BCM_FIELD_COPYTOCPU_RED_PACKET:
   9201                 PolicyCheck(unit, mem, R_COPY_TO_CPUf, 0x3);
   9202                 break;
   9203             case BCM_FIELD_COPYTOCPU_TRUNCATE:
   9204                 PolicyCheck(unit, mem, COPY_TO_CPU_FIRST_CELL_ONLYf, 0x1);
   9205                 break;
   9206             case 0:
   9207                 break;
   9208             default:
   9209                 return BCM_E_PARAM;
   9210                 break;
   9211         }
   9212     }
   9213 
   9214     if (fa->param[3]) {
   9215         PolicyCheck(unit, mem, MATCHED_RULEf, fa->param[3]);
   9216     }
   9217 
   9218     return BCM_E_NONE;
   9219 }
   9220 
   9221 STATIC int
   9222 _bcm_field_copytocpu_action_get(int       unit,
   9223                           soc_mem_t       mem,
   9224                           _field_entry_t  *f_ent,
   9225                           _field_action_t *fa,
   9226                           uint32          *buf)
   9227 {
   9228     uint8        idx;
   9229     uint32       val;
   9230     uint32       flags;
   9231 
   9232     if (NULL == f_ent || NULL == fa || NULL == buf) {
   9233         return (BCM_E_PARAM);
   9234     }
   9235 
   9236     if (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id) {
   9237         return BCM_E_PARAM;
   9238     }
   9239 
   9240     flags = fa->param[2];
   9241 
   9242     for (idx = 0 ; idx < 32 ; idx++) {
   9243         val = flags & (1 << idx);
   9244 
   9245         switch(val) {
   9246             case BCM_FIELD_COPYTOCPU_GREEN_NOT_DROPPED_PACKET:
   9247                 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x1);
   9248                 break;
   9249             case BCM_FIELD_COPYTOCPU_GREEN_DROPPED_PACKET:
   9250                 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x2);
   9251                 break;
   9252             case BCM_FIELD_COPYTOCPU_GREEN_PACKET:
   9253                 PolicySet(unit, mem, buf, G_COPY_TO_CPUf, 0x3);
   9254                 break;
   9255             case BCM_FIELD_COPYTOCPU_YELLOW_NOT_DROPPED_PACKET:
   9256                 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x1);
   9257                 break;
   9258             case BCM_FIELD_COPYTOCPU_YELLOW_DROPPED_PACKET:
   9259                 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x2);
   9260                 break;
   9261             case BCM_FIELD_COPYTOCPU_YELLOW_PACKET:
   9262                 PolicySet(unit, mem, buf, Y_COPY_TO_CPUf, 0x3);
   9263                 break;
   9264             case BCM_FIELD_COPYTOCPU_RED_NOT_DROPPED_PACKET:
   9265                 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x1);
   9266                 break;
   9267             case BCM_FIELD_COPYTOCPU_RED_DROPPED_PACKET:
   9268                 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x2);
   9269                 break;
   9270             case BCM_FIELD_COPYTOCPU_RED_PACKET:
   9271                 PolicySet(unit, mem, buf, R_COPY_TO_CPUf, 0x3);
   9272                 break;
   9273             case BCM_FIELD_COPYTOCPU_TRUNCATE:
   9274                 PolicySet(unit, mem, buf, COPY_TO_CPU_FIRST_CELL_ONLYf, 0x1);
   9275                 break;
   9276             case 0:
   9277                 break;
   9278             default:
   9279                 return BCM_E_PARAM;
   9280                 break;
   9281         }
   9282     }
   9283 
   9284     if (fa->param[3]) {
   9285         PolicySet(unit, mem, buf, MATCHED_RULEf, fa->param[3]);
   9286     }
   9287 
   9288     return (BCM_E_NONE);
   9289 }
   9290 
   9291 STATIC int
   9292 _bcm_field_redirect_params_check(int     unit,
   9293                               soc_mem_t       mem,
   9294                               _field_entry_t  *f_ent,
   9295                               _field_action_t *fa)
   9296 {
   9297     uint32       flags;
   9298     uint32       val;
   9299     uint8        idx;
   9300     uint32       green_flags     = BCM_FIELD_REDIRECT_GREEN_PACKET | \
   9301                                    BCM_FIELD_REDIRECT_GREEN_DROPPED_PACKET | \
   9302                                    BCM_FIELD_REDIRECT_GREEN_NOT_DROPPED_PACKET;
   9303     uint32       red_flags       = BCM_FIELD_REDIRECT_RED_PACKET | \
   9304                                    BCM_FIELD_REDIRECT_RED_DROPPED_PACKET | \
   9305                                    BCM_FIELD_REDIRECT_RED_NOT_DROPPED_PACKET;
   9306     uint32       yellow_flags    = BCM_FIELD_REDIRECT_YELLOW_PACKET | \
   9307                                    BCM_FIELD_REDIRECT_YELLOW_DROPPED_PACKET | \
   9308                                    BCM_FIELD_REDIRECT_YELLOW_NOT_DROPPED_PACKET;
   9309     uint32       redir_src_flags = BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_SOURCE | \
   9310                                    BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_DESTINATION | \
   9311                                    BCM_FIELD_REDIRECT_SOURCE_USE_CONFIGURED;
   9312     uint32       redir_field     = 0;
   9313     uint32       redir_type      = 0;
   9314 
   9315     if ((NULL == f_ent) || (NULL == fa)) {
   9316         return (BCM_E_PARAM);
   9317     }
   9318 
   9319     if (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id) {
   9320         return BCM_E_PARAM;
   9321     }
   9322 
   9323     flags = fa->param[2];
   9324 
   9325     /* Only one of the Green flag can be configured */
   9326     val = flags & green_flags;
   9327     if (val & (val -1)) {
   9328         return BCM_E_PARAM;
   9329     }
   9330 
   9331     /* Only one of the Red flag can be configured */
   9332     val = flags & red_flags;
   9333     if (val & (val -1)) {
   9334         return BCM_E_PARAM;
   9335     }
   9336 
   9337     /* Only one of the Yellow flag can be configured */
   9338     val = flags & yellow_flags;
   9339     if (val & (val -1)) {
   9340         return BCM_E_PARAM;
   9341     }
   9342 
   9343     /* Only one of the Source port flag can be configured */
   9344     val = flags & redir_src_flags;
   9345     if(val & (val -1)) {
   9346         return BCM_E_PARAM;
   9347     }
   9348 
   9349     for (idx = 0 ; idx < 32 ; idx++) {
   9350         val = flags & (1 << idx);
   9351 
   9352         switch(val) {
   9353             case BCM_FIELD_REDIRECT_GREEN_NOT_DROPPED_PACKET:
   9354                 PolicyCheck(unit, mem, G_REDIRECTf, 0x1);
   9355                 break;
   9356             case BCM_FIELD_REDIRECT_GREEN_DROPPED_PACKET:
   9357                 PolicyCheck(unit, mem, G_REDIRECTf, 0x2);
   9358                 break;
   9359             case BCM_FIELD_REDIRECT_GREEN_PACKET:
   9360                 PolicyCheck(unit, mem, G_REDIRECTf, 0x3);
   9361                 break;
   9362             case BCM_FIELD_REDIRECT_YELLOW_NOT_DROPPED_PACKET:
   9363                 PolicyCheck(unit, mem, Y_REDIRECTf, 0x1);
   9364                 break;
   9365             case BCM_FIELD_REDIRECT_YELLOW_DROPPED_PACKET:
   9366                 PolicyCheck(unit, mem, Y_REDIRECTf, 0x2);
   9367                 break;
   9368             case BCM_FIELD_REDIRECT_YELLOW_PACKET:
   9369                 PolicyCheck(unit, mem, Y_REDIRECTf, 0x3);
   9370                 break;
   9371             case BCM_FIELD_REDIRECT_RED_NOT_DROPPED_PACKET:
   9372                 PolicyCheck(unit, mem, R_REDIRECTf, 0x1);
   9373                 break;
   9374             case BCM_FIELD_REDIRECT_RED_DROPPED_PACKET:
   9375                 PolicyCheck(unit, mem, R_REDIRECTf, 0x2);
   9376                 break;
   9377             case BCM_FIELD_REDIRECT_RED_PACKET:
   9378                 PolicyCheck(unit, mem, R_REDIRECTf, 0x3);
   9379                 break;
   9380             case BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_DESTINATION:
   9381                 PolicyCheck(unit, mem, REDIR_SOURCEf, 0x1);
   9382                 break;
   9383             case BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_SOURCE:
   9384                 PolicyCheck(unit, mem, REDIR_SOURCEf, 0x2);
   9385                 break;
   9386             case BCM_FIELD_REDIRECT_SOURCE_USE_CONFIGURED:
   9387                 PolicyCheck(unit, mem, REDIR_SOURCEf, 0x3);
   9388                 break;
   9389             case BCM_FIELD_REDIRECT_TRUNCATE:
   9390                 PolicyCheck(unit, mem, REDIR_FIRST_CELL_ONLYf, 0x1);
   9391                 break;
   9392             case 0:
   9393                 break;
   9394             default:
   9395                 return BCM_E_PARAM;
   9396                 break;
   9397         }
   9398     }
   9399 
   9400     /* Verify destination type and destination value */
   9401     if (fa->param[4] == BCM_GPORT_INVALID) {
   9402         return BCM_E_PARAM;
   9403     }
   9404     switch(fa->param[3]) {
   9405         case bcmFieldRedirectDestinationPort:
   9406             redir_type   = 0x5;
   9407             if (BCM_GPORT_IS_MODPORT(fa->param[4])) {
   9408                 redir_field  = BCM_GPORT_MODPORT_PORT_GET((int)fa->param[4]) & 0xff;
   9409                 redir_field |= ((BCM_GPORT_MODPORT_MODID_GET((int)fa->param[4]) & 0xff) << 8);
   9410             } else {
   9411                 return BCM_E_PARAM;
   9412             }
   9413             break;
   9414         case bcmFieldRedirectDestinationTrunk:
   9415             redir_type   = 0x6;
   9416             if (BCM_GPORT_IS_TRUNK(fa->param[4])) {
   9417                 redir_field  = BCM_GPORT_TRUNK_GET((int)fa->param[4]) & 0x1ff;
   9418             } else if (BCM_GPORT_IS_SET(fa->param[4])) {
   9419                 return BCM_E_PARAM;
   9420             } else {
   9421                 redir_field = fa->param[4];
   9422             }
   9423             break;
   9424         case bcmFieldRedirectDestinationMCast:
   9425             redir_type   = 0x7;
   9426             if (_BCM_MULTICAST_IS_SET(fa->param[4])) {
   9427                 if (0 == _BCM_MULTICAST_IS_L2(fa->param[4])) {
   9428                     return (BCM_E_PARAM);
   9429                 }
   9430                 redir_field  = _BCM_MULTICAST_ID_GET(fa->param[4]);
   9431             } else {
   9432                 return BCM_E_PARAM;
   9433             }
   9434             break;
   9435         default :
   9436             return BCM_E_PARAM;
   9437             break;
   9438     }
   9439     PolicyCheck(unit, mem, REDIRECTION_DEST_TYPEf, redir_type);
   9440     PolicyCheck(unit, mem, REDIRECTION_DESTINATIONf, redir_field);
   9441 
   9442     /* Verify source type */
   9443     if (flags & BCM_FIELD_REDIRECT_SOURCE_USE_CONFIGURED) {
   9444         redir_type   = 0x1;
   9445         if (BCM_GPORT_IS_MODPORT(fa->param[5])) {
   9446             redir_type   = 0x0;
   9447             redir_field  = BCM_GPORT_MODPORT_PORT_GET((int)fa->param[5]) & 0xff;
   9448             redir_field |= ((BCM_GPORT_MODPORT_MODID_GET((int)fa->param[5]) & 0xff) << 8);
   9449         } else if (BCM_GPORT_IS_MPLS_PORT(fa->param[5])) {
   9450             redir_field  = BCM_GPORT_MPLS_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9451         } else if (BCM_GPORT_IS_NIV_PORT(fa->param[5])) {
   9452             redir_field  = BCM_GPORT_NIV_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9453         } else if (BCM_GPORT_IS_MIM_PORT(fa->param[5])) {
   9454             redir_field  = BCM_GPORT_MIM_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9455         } else if (BCM_GPORT_IS_TRILL_PORT(fa->param[5])) {
   9456             redir_field  = BCM_GPORT_TRILL_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9457         } else if (BCM_GPORT_IS_L2GRE_PORT(fa->param[5])) {
   9458             redir_field  = BCM_GPORT_L2GRE_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9459         } else if (BCM_GPORT_IS_VXLAN_PORT(fa->param[5])) {
   9460             redir_field  = BCM_GPORT_VXLAN_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9461         } else {
   9462             return BCM_E_PARAM;
   9463         }
   9464         PolicyCheck(unit, mem, REDIR_SOURCE_TYPEf, redir_type);
   9465         PolicyCheck(unit, mem, REDIR_SOURCE_VALUEf, redir_field);
   9466     }
   9467 
   9468     /* Set DROP orignial to all EP redirection */
   9469     PolicyCheck(unit, mem, DROP_ORIGINAL_PACKETf, 0x1);
   9470 
   9471     return BCM_E_NONE;
   9472 }
   9473 
   9474 STATIC int
   9475 _bcm_field_redirect_action_get(int       unit,
   9476                           soc_mem_t       mem,
   9477                           _field_entry_t  *f_ent,
   9478                           _field_action_t *fa,
   9479                           uint32          *buf)
   9480 {
   9481     uint8        idx;
   9482     uint32       val;
   9483     uint32       flags;
   9484     uint32       redir_field     = 0;
   9485     uint32       redir_type      = 0;
   9486 
   9487     if (NULL == f_ent || NULL == fa || NULL == buf) {
   9488         return (BCM_E_PARAM);
   9489     }
   9490 
   9491     if (_BCM_FIELD_STAGE_EGRESS != f_ent->group->stage_id) {
   9492         return BCM_E_PARAM;
   9493     }
   9494 
   9495     flags = fa->param[2];
   9496 
   9497     for (idx = 0 ; idx < 32 ; idx++) {
   9498         val = flags & (1 << idx);
   9499 
   9500         switch(val) {
   9501             case BCM_FIELD_REDIRECT_GREEN_NOT_DROPPED_PACKET:
   9502                 PolicySet(unit, mem, buf, G_REDIRECTf, 0x1);
   9503                 break;
   9504             case BCM_FIELD_REDIRECT_GREEN_DROPPED_PACKET:
   9505                 PolicySet(unit, mem, buf, G_REDIRECTf, 0x2);
   9506                 break;
   9507             case BCM_FIELD_REDIRECT_GREEN_PACKET:
   9508                 PolicySet(unit, mem, buf, G_REDIRECTf, 0x3);
   9509                 break;
   9510             case BCM_FIELD_REDIRECT_YELLOW_NOT_DROPPED_PACKET:
   9511                 PolicySet(unit, mem, buf, Y_REDIRECTf, 0x1);
   9512                 break;
   9513             case BCM_FIELD_REDIRECT_YELLOW_DROPPED_PACKET:
   9514                 PolicySet(unit, mem, buf, Y_REDIRECTf, 0x2);
   9515                 break;
   9516             case BCM_FIELD_REDIRECT_YELLOW_PACKET:
   9517                 PolicySet(unit, mem, buf, Y_REDIRECTf, 0x3);
   9518                 break;
   9519             case BCM_FIELD_REDIRECT_RED_NOT_DROPPED_PACKET:
   9520                 PolicySet(unit, mem, buf, R_REDIRECTf, 0x1);
   9521                 break;
   9522             case BCM_FIELD_REDIRECT_RED_DROPPED_PACKET:
   9523                 PolicySet(unit, mem, buf, R_REDIRECTf, 0x2);
   9524                 break;
   9525             case BCM_FIELD_REDIRECT_RED_PACKET:
   9526                 PolicySet(unit, mem, buf, R_REDIRECTf, 0x3);
   9527                 break;
   9528             case BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_DESTINATION:
   9529                 PolicySet(unit, mem, buf, REDIR_SOURCEf, 0x1);
   9530                 break;
   9531             case BCM_FIELD_REDIRECT_SOURCE_USE_ORIGINAL_SOURCE:
   9532                 PolicySet(unit, mem, buf, REDIR_SOURCEf, 0x2);
   9533                 break;
   9534             case BCM_FIELD_REDIRECT_SOURCE_USE_CONFIGURED:
   9535                 PolicySet(unit, mem, buf, REDIR_SOURCEf, 0x3);
   9536                 break;
   9537             case BCM_FIELD_REDIRECT_TRUNCATE:
   9538                 PolicySet(unit, mem, buf, REDIR_FIRST_CELL_ONLYf, 0x1);
   9539                 break;
   9540             case 0:
   9541                 break;
   9542             default:
   9543                 return BCM_E_PARAM;
   9544                 break;
   9545         }
   9546     }
   9547 
   9548     /* Configure destination type and destination value */
   9549     switch(fa->param[3]) {
   9550         case bcmFieldRedirectDestinationPort:
   9551             redir_type   = 0x5;
   9552             if (BCM_GPORT_IS_MODPORT(fa->param[4])) {
   9553                 redir_field  = BCM_GPORT_MODPORT_PORT_GET((int)fa->param[4]) & 0xff;
   9554                 redir_field |= ((BCM_GPORT_MODPORT_MODID_GET((int)fa->param[4]) & 0xff) << 8);
   9555             } else {
   9556                 return BCM_E_PARAM;
   9557             }
   9558             break;
   9559         case bcmFieldRedirectDestinationTrunk:
   9560             redir_type   = 0x6;
   9561             if (BCM_GPORT_IS_TRUNK(fa->param[4])) {
   9562                 redir_field  = BCM_GPORT_TRUNK_GET((int)fa->param[4]) & 0x1ff;
   9563             } else if (BCM_GPORT_IS_SET(fa->param[4])) {
   9564                 return BCM_E_PARAM;
   9565             } else {
   9566                 redir_field = fa->param[4];
   9567             }
   9568             break;
   9569         case bcmFieldRedirectDestinationMCast:
   9570             redir_type   = 0x7;
   9571             if (_BCM_MULTICAST_IS_SET(fa->param[4])) {
   9572                 if (0 == _BCM_MULTICAST_IS_L2(fa->param[4])) {
   9573                     return (BCM_E_PARAM);
   9574                 }
   9575                 redir_field  = _BCM_MULTICAST_ID_GET(fa->param[4]);
   9576             } else {
   9577                 return BCM_E_PARAM;
   9578             }
   9579             break;
   9580         default :
   9581             return BCM_E_PARAM;
   9582             break;
   9583     }
   9584     PolicySet(unit, mem, buf, REDIRECTION_DEST_TYPEf, redir_type);
   9585     PolicySet(unit, mem, buf, REDIRECTION_DESTINATIONf, redir_field);
   9586 
   9587     /* Configure source type and source value */
   9588     if (flags & BCM_FIELD_REDIRECT_SOURCE_USE_CONFIGURED) {
   9589         redir_type   = 0x1;
   9590         if (BCM_GPORT_IS_MODPORT(fa->param[5])) {
   9591             redir_type   = 0x0;
   9592             redir_field  = BCM_GPORT_MODPORT_PORT_GET((int)fa->param[5]) & 0xff;
   9593             redir_field |= ((BCM_GPORT_MODPORT_MODID_GET((int)fa->param[5]) & 0xff) << 8);
   9594         } else if (BCM_GPORT_IS_MPLS_PORT(fa->param[5])) {
   9595             redir_field  = BCM_GPORT_MPLS_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9596         } else if (BCM_GPORT_IS_NIV_PORT(fa->param[5])) {
   9597             redir_field  = BCM_GPORT_NIV_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9598         } else if (BCM_GPORT_IS_MIM_PORT(fa->param[5])) {
   9599             redir_field  = BCM_GPORT_MIM_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9600         } else if (BCM_GPORT_IS_TRILL_PORT(fa->param[5])) {
   9601             redir_field  = BCM_GPORT_TRILL_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9602         } else if (BCM_GPORT_IS_L2GRE_PORT(fa->param[5])) {
   9603             redir_field  = BCM_GPORT_L2GRE_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9604         } else if (BCM_GPORT_IS_VXLAN_PORT(fa->param[5])) {
   9605             redir_field  = BCM_GPORT_VXLAN_PORT_ID_GET((int)fa->param[5]) & 0xffff;
   9606         } else {
   9607             return BCM_E_PARAM;
   9608         }
   9609         PolicySet(unit, mem, buf, REDIR_SOURCE_TYPEf, redir_type);
   9610         PolicySet(unit, mem, buf, REDIR_SOURCE_VALUEf, redir_field);
   9611     }
   9612 
   9613     /* Set DROP original to all EP redirection */
   9614     PolicySet(unit, mem, buf, DROP_ORIGINAL_PACKETf, 0x1);
   9615 
   9616     return (BCM_E_NONE);
   9617 }
   9618 
   9619 #endif
   9620 
   9621 int
   9622 _field_td2_action_params_check(int             unit,
   9623                                _field_entry_t  *f_ent,
   9624                                _field_action_t *fa
   9625                                )
   9626 {
   9627     soc_mem_t mem;              /* Policy table memory id. */
   9628     soc_mem_t tcam_mem;         /* Tcam memory id.         */
   9629     int hw_index = 0;
   9630     int rv = 0;
   9631     int cosq_new;
   9632 #if defined(BCM_APACHE_SUPPORT)
   9633     int8 flex_stat_pool_id = 0;
   9634 #endif
   9635 
   9636     if (_BCM_FIELD_STAGE_EXTERNAL != f_ent->group->stage_id) {
   9637 
   9638         BCM_IF_ERROR_RETURN(_field_fb_tcam_policy_mem_get(unit,
   9639             f_ent->group->stage_id, &tcam_mem, &mem));
   9640 
   9641         switch (fa->action) {
   9642             case bcmFieldActionFibreChanSrcBindEnable:
   9643                 PolicyCheck(unit, mem, FCOE_SRC_BIND_CHECK_ENABLEf, fa->param[0]);
   9644                 return (BCM_E_NONE);
   9645             case bcmFieldActionFibreChanFpmaPrefixCheckEnable:
   9646                 PolicyCheck(unit, mem, FCOE_SRC_FPMA_PREFIX_CHECK_ENABLEf,
   9647                             fa->param[0]);
   9648                 return (BCM_E_NONE);
   9649             case bcmFieldActionFibreChanZoneCheckEnable:
   9650                 PolicyCheck(unit, mem, FCOE_ZONE_CHECK_ENABLEf, fa->param[0]);
   9651                 return (BCM_E_NONE);
   9652             case bcmFieldActionFibreChanVsanId:
   9653                 PolicyCheck(unit, mem, FCOE_VSAN_IDf, fa->param[0]);
   9654                 return (BCM_E_NONE);
   9655             case bcmFieldActionFibreChanZoneCheckActionCancel:
   9656                 PolicyCheck(unit, mem, FCOE_ZONE_CHECK_ACTIONf, fa->param[0]);
   9657                 return (BCM_E_NONE);
   9658             case bcmFieldActionNewClassId:
   9659                 PolicyCheck(unit, mem, I2E_CLASSIDf, fa->param[0]);
   9660                 return (BCM_E_NONE);
   9661             case bcmFieldActionEgressClassSelect:
   9662                 return (fa->param[0] <= BCM_FIELD_EGRESS_CLASS_SELECT_NEW
   9663                     ? BCM_E_NONE : BCM_E_PARAM
   9664                     );
   9665             case bcmFieldActionHiGigClassSelect:
   9666                 return (fa->param[0] <= BCM_FIELD_HIGIG_CLASS_SELECT_PORT
   9667                     ? BCM_E_NONE : BCM_E_PARAM
   9668                     );
   9669             case bcmFieldActionFibreChanIntVsanPri:
   9670                 PolicyCheck(unit, mem, FCOE_VSAN_PRIf, fa->param[0]);
   9671                 return (BCM_E_NONE);
   9672             case bcmFieldActionHashSelect0:
   9673             /* Intentional fall through case */
   9674             /* coverity [unterminated_case] */
   9675             case bcmFieldActionHashSelect1:
   9676                 if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) {
   9677                     if (fa->param[0] == 0x0) {
   9678                        /*
   9679                         *  BITMAP 0x0 is assigned to reserved entry in the
   9680                         *  VFP_HAS_FIELD_BMAP_TABLE_A/B to skip the 0th entry.
   9681                         */
   9682                        return BCM_E_PARAM;
   9683                     }
   9684                     mem = (fa->action == bcmFieldActionHashSelect0)? 
   9685                                           VFP_HASH_FIELD_BMAP_TABLE_Am:
   9686                                           VFP_HASH_FIELD_BMAP_TABLE_Bm;
   9687 
   9688                     PolicyCheck(unit, mem, BITMAPf, fa->param[0]);
   9689                     return (BCM_E_NONE);
   9690                 }
   9691                 break;
   9692             case bcmFieldActionEtagNew:
   9693                     PolicyCheck(unit, EGR_L3_NEXT_HOPm, IFP_ACTIONS__VNTAGf,
   9694                                 fa->param[0]);              
   9695                     return (BCM_E_NONE);                                        
   9696                 break;
   9697             case bcmFieldActionVxlanHeaderBits8_31_Set:
   9698                 PolicyCheck(unit, mem, VXLAN_RESERVED_1f, fa->param[0]);
   9699                 return (BCM_E_NONE);
   9700                 break;
   9701             case bcmFieldActionVxlanHeaderBits56_63_Set:
   9702                 PolicyCheck(unit, mem, VXLAN_RESERVED_2f, fa->param[0]);
   9703                 return (BCM_E_NONE);
   9704                 break;
   9705             case bcmFieldActionVxlanHeaderFlags:
   9706                 PolicyCheck(unit, mem, VXLAN_FLAGSf, fa->param[0]);
   9707                 return (BCM_E_NONE);
   9708                 break;
   9709             case bcmFieldActionOamDmTimeFormat:
   9710                 if (soc_feature(unit, soc_feature_fp_based_oam)) {
   9711                     PolicyCheck(unit, mem, SAMPLE_TIMESTAMPf, fa->param[0]);
   9712                     return BCM_E_NONE;
   9713                 }
   9714                 break;
   9715             case bcmFieldActionOamOlpHeaderAdd:
   9716                 if (soc_feature(unit, soc_feature_fp_based_oam)) {
   9717                     if ((fa->param[0] >> 1) == 0xB) {
   9718                         return BCM_E_PARAM;
   9719                     }
   9720                     rv = _bcm_oam_olp_fp_hw_index_get (unit,fa->param[0],
   9721                             &hw_index);
   9722                     if (BCM_FAILURE(rv)) {
   9723                         return BCM_E_PARAM;
   9724                     }
   9725                     PolicyCheck(unit, mem, OLP_HDR_TYPE_COMPRESSEDf, hw_index);
   9726                     return BCM_E_NONE;
   9727                 }
   9728                 break;
   9729 
   9730             case bcmFieldActionUcastQueueNew:
   9731                 rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
   9732                         _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
   9733                         &cosq_new, NULL);
   9734                 if (BCM_FAILURE(rv)) {
   9735                     return BCM_E_PARAM;
   9736                 }
   9737 
   9738                 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new);
   9739                 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new);
   9740                 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new);
   9741                 return (BCM_E_NONE);
   9742                 break;
   9743 
   9744             case bcmFieldActionRpUcastQueueNew:
   9745                 rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
   9746                         _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
   9747                         &cosq_new, NULL);
   9748                 if (BCM_FAILURE(rv)) {
   9749                     return BCM_E_PARAM;
   9750                 }
   9751 
   9752                 PolicyCheck(unit, mem, R_COS_INT_PRIf, cosq_new);
   9753                 return (BCM_E_NONE);
   9754                 break;
   9755             case bcmFieldActionYpUcastQueueNew:
   9756                 rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
   9757                         _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
   9758                         &cosq_new, NULL);
   9759                 if (BCM_FAILURE(rv)) {
   9760                     return BCM_E_PARAM;
   9761                 }
   9762 
   9763                 PolicyCheck(unit, mem, Y_COS_INT_PRIf, cosq_new);
   9764                 return (BCM_E_NONE);
   9765                 break;
   9766             case bcmFieldActionGpUcastQueueNew:
   9767                 rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
   9768                         _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
   9769                         &cosq_new, NULL);
   9770                 if (BCM_FAILURE(rv)) {
   9771                     return BCM_E_PARAM;
   9772                 }
   9773 
   9774                 PolicyCheck(unit, mem, G_COS_INT_PRIf, cosq_new);
   9775                 return (BCM_E_NONE);
   9776                 break;
   9777             case bcmFieldActionIntCosUcastQueueNew:
   9778                 rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
   9779                         _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
   9780                         &cosq_new, NULL);
   9781                 if (BCM_FAILURE(rv)) {
   9782                     return BCM_E_PARAM;
   9783                 }
   9784 
   9785                 PolicyCheck(unit, mem, R_COS_INT_PRIf,
   9786                         (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
   9787                          cosq_new));
   9788 
   9789                 PolicyCheck(unit, mem, Y_COS_INT_PRIf,
   9790                         (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
   9791                          cosq_new));
   9792                 PolicyCheck(unit, mem, G_COS_INT_PRIf,
   9793                         (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
   9794                          cosq_new));
   9795                 return (BCM_E_NONE);
   9796                 break;
   9797 
   9798             case bcmFieldActionRpIntCosUcastQueueNew:
   9799                 rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
   9800                         _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
   9801                         &cosq_new, NULL);
   9802                 if (BCM_FAILURE(rv)) {
   9803                     return BCM_E_PARAM;
   9804                 }
   9805 
   9806                 PolicyCheck(unit, mem, R_COS_INT_PRIf,
   9807                         (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
   9808                          cosq_new));
   9809                 return (BCM_E_NONE);
   9810                 break;
   9811             case bcmFieldActionYpIntCosUcastQueueNew:
   9812                 rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
   9813                         _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
   9814                         &cosq_new, NULL);
   9815                 if (BCM_FAILURE(rv)) {
   9816                     return BCM_E_PARAM;
   9817                 }
   9818 
   9819                 PolicyCheck(unit, mem, Y_COS_INT_PRIf,
   9820                         (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
   9821                          cosq_new));
   9822                 return (BCM_E_NONE);
   9823                 break;
   9824 
   9825             case bcmFieldActionGpIntCosUcastQueueNew:
   9826                 rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
   9827                         _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
   9828                         &cosq_new, NULL);
   9829                 if (BCM_FAILURE(rv)) {
   9830                     return BCM_E_PARAM;
   9831                 }
   9832 
   9833                 PolicyCheck(unit, mem, G_COS_INT_PRIf,
   9834                         (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
   9835                          cosq_new));
   9836                 return (BCM_E_NONE);
   9837                 break;
   9838 
   9839             case bcmFieldActionDoNotCutThrough:
   9840                 return BCM_E_NONE;
   9841                 break;
   9842 
   9843 #if defined(BCM_APACHE_SUPPORT)
   9844             case bcmFieldActionStrength:
   9845                 PolicyCheck(unit, mem, REDIR_STRENGTHf, fa->param[0]);
   9846                 return BCM_E_NONE;
   9847                 break;
   9848             case bcmFieldActionRedirectBufferPriority:
   9849                 PolicyCheck(unit, mem, REDIR_RDB_PRIORITYf, fa->param[0]);
   9850                 return BCM_E_NONE;
   9851                 break;
   9852             case bcmFieldActionOamStatObjectSessionId:
   9853                 BCM_IF_ERROR_RETURN(_field_oam_lm_stat_pool_id_get(unit, fa->param[0],
   9854                             0, &flex_stat_pool_id));
   9855                 PolicyCheck(unit, mem, SESSION_ID_POOL_SELECTORf, flex_stat_pool_id);
   9856                 return BCM_E_NONE;
   9857                 break;
   9858             case bcmFieldActionCopyToCpu:
   9859                 if (SOC_IS_APACHE(unit) &&
   9860                     (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) &&
   9861                     (fa->param[2])) {
   9862                     return (_bcm_field_copytocpu_params_check(unit, mem, f_ent, fa));
   9863                 }
   9864                 break;
   9865             case bcmFieldActionRedirect:
   9866                 if (SOC_IS_APACHE(unit) &&
   9867                     (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) &&
   9868                     (fa->param[2])) {
   9869                     return (_bcm_field_redirect_params_check(unit, mem, f_ent, fa));
   9870                 }
   9871                 break;
   9872 #endif /* BCM_APACHE_SUPPORT */
   9873 
   9874             default:
   9875                 ;
   9876         }
   9877     }
   9878 
   9879     return (_bcm_field_trx_action_params_check(unit, f_ent, fa));
   9880 }
   9881 
   9882 int
   9883 _bcm_field_td2_action_params_check(int        unit,
   9884                                _field_entry_t  *f_ent,
   9885                                _field_action_t *fa
   9886                                )
   9887 {
   9888     return _field_td2_action_params_check(unit, f_ent, fa);
   9889 } 
   9890 STATIC int
   9891 _field_td2_ingress_qual_tcam_key_mask_get(int unit,
   9892                                           _field_entry_t *f_ent,
   9893                                           _field_tcam_t *tcam
   9894                                           )
   9895 {
   9896     int errcode = BCM_E_INTERNAL;
   9897     soc_mem_t mem;
   9898     const unsigned fp_tcam_words
   9899         = BITS2WORDS(soc_mem_field_length(unit,
   9900                                           FP_TCAMm,
   9901                                           KEYf
   9902                                           )
   9903                      );
   9904 
   9905     tcam->key_size
   9906         = WORDS2BYTES(fp_tcam_words
   9907                       + BITS2WORDS(soc_mem_field_length(
   9908                                        unit,
   9909                                        FP_GLOBAL_MASK_TCAMm,
   9910                                        KEYf
   9911                                                         )
   9912                                    )
   9913                       );
   9914     tcam->key  = sal_alloc(tcam->key_size, " ");
   9915     tcam->mask = sal_alloc(tcam->key_size, " ");
   9916     if (tcam->key == 0 || tcam->mask == 0) {
   9917         errcode = BCM_E_MEMORY;
   9918         goto error;
   9919     }
   9920     sal_memset(tcam->key,  0, tcam->key_size);
   9921     sal_memset(tcam->mask, 0, tcam->key_size);
   9922 
   9923     if (f_ent->flags & _FP_ENTRY_INSTALLED) {
   9924         int    tcam_idx;
   9925         uint32 tcam_entry[SOC_MAX_MEM_FIELD_WORDS];
   9926 
   9927         sal_memset(tcam_entry, 0, sizeof(tcam_entry));
   9928 
   9929         errcode = _bcm_field_entry_tcam_idx_get(unit, f_ent, &tcam_idx);
   9930         if (BCM_FAILURE(errcode)) {
   9931             goto error;
   9932         }
   9933 
   9934         errcode = soc_mem_read(unit,
   9935                                FP_TCAMm,
   9936                                MEM_BLOCK_ANY,
   9937                                tcam_idx,
   9938                                tcam_entry
   9939                                );
   9940         if (BCM_FAILURE(errcode)) {
   9941             goto error;
   9942         }
   9943         soc_mem_field_get(unit, FP_TCAMm, tcam_entry, KEYf, tcam->key);
   9944         soc_mem_field_get(unit, FP_TCAMm, tcam_entry, MASKf, tcam->mask);
   9945         
   9946         if (f_ent->flags & _FP_ENTRY_SECONDARY) {
   9947             mem = FP_GM_FIELDSm;
   9948         } else {
   9949             mem = FP_GLOBAL_MASK_TCAMm;
   9950         }
   9951 
   9952         errcode = soc_mem_read(unit,
   9953                                mem,
   9954                                MEM_BLOCK_ANY,
   9955                                tcam_idx,
   9956                                tcam_entry
   9957                                );
   9958         if (BCM_FAILURE(errcode)) {
   9959             goto error;
   9960         }
   9961 
   9962         soc_mem_field_get(unit,
   9963                           mem,
   9964                           tcam_entry,
   9965                           KEYf,
   9966                           tcam->key + fp_tcam_words
   9967                           );
   9968         soc_mem_field_get(unit,
   9969                           mem,
   9970                           tcam_entry,
   9971                           MASKf,
   9972                           tcam->mask + fp_tcam_words
   9973                           );
   9974     }
   9975 
   9976     return (BCM_E_NONE);
   9977 
   9978  error:
   9979     if (tcam->key) {
   9980         sal_free(tcam->key);
   9981         tcam->key = 0;
   9982     }
   9983     if (tcam->mask) {
   9984         sal_free(tcam->mask);
   9985         tcam->mask = 0;
   9986     }
   9987 
   9988     return (errcode);
   9989 }
   9990 
   9991 int
   9992 _bcm_field_td2_qual_tcam_key_mask_get(int unit,
   9993                                       _field_entry_t *f_ent,
   9994                                       _field_tcam_t *tcam
   9995                                       )
   9996 {
   9997     switch (f_ent->group->stage_id) {
   9998     case _BCM_FIELD_STAGE_INGRESS:
   9999         return (_field_td2_ingress_qual_tcam_key_mask_get(unit, f_ent, tcam));
  10000     default:
  10001         ;
  10002     }
  10003 
  10004     return (_field_qual_tcam_key_mask_get(unit, f_ent, tcam, 0));
  10005 }
  10006 
  10007 STATIC int
  10008 _field_td2_ingress_qual_tcam_key_mask_set(int            unit,
  10009                                           _field_entry_t *f_ent,
  10010                                           unsigned       tcam_idx,
  10011                                           unsigned       validf
  10012                                           )
  10013 {
  10014     uint32  e[SOC_MAX_MEM_FIELD_WORDS] = {0}; /* Buffer to fill Policy & TCAM entry.*/
  10015     _field_tcam_t  * const tcam = &f_ent->tcam;
  10016     _field_group_t * const fg = f_ent->group;
  10017     const unsigned fp_tcam_words
  10018         = BITS2WORDS(soc_mem_field_length(unit,
  10019                                           FP_TCAMm,
  10020                                           KEYf
  10021                                           )
  10022                      );
  10023     fp_global_mask_tcam_entry_t tcam_entry;
  10024     fp_global_mask_tcam_x_entry_t tcam_entry_x;
  10025     fp_global_mask_tcam_y_entry_t tcam_entry_y;
  10026     bcm_pbmp_t pbmp_x;
  10027     bcm_pbmp_t pbmp_y;
  10028 
  10029     sal_memset(&tcam_entry, 0, sizeof(fp_global_mask_tcam_entry_t));
  10030 
  10031     BCM_IF_ERROR_RETURN(soc_mem_read(unit,
  10032                                      FP_TCAMm,
  10033                                      MEM_BLOCK_ANY,
  10034                                      tcam_idx,
  10035                                      e
  10036                                      )
  10037                         );
  10038     soc_mem_field_set(unit, FP_TCAMm, e, KEYf, tcam->key);
  10039     soc_mem_field_set(unit, FP_TCAMm, e, MASKf, tcam->mask);
  10040     soc_mem_field32_set(unit,
  10041                         FP_TCAMm,
  10042                         e,
  10043                         VALIDf,
  10044                         validf
  10045                         ? ((fg->flags & _FP_GROUP_LOOKUP_ENABLED)
  10046                            ? 3 : 2
  10047                            )
  10048                         : 0
  10049                         );
  10050     BCM_IF_ERROR_RETURN(soc_mem_write(unit,
  10051                                       FP_TCAMm,
  10052                                       MEM_BLOCK_ALL,
  10053                                       tcam_idx,
  10054                                       e
  10055                                       )
  10056                         );
  10057 
  10058     if (f_ent->flags & _FP_ENTRY_SECONDARY) {
  10059         LOG_DEBUG(BSL_LS_BCM_FP,
  10060                   (BSL_META_U(unit,
  10061                               "Overlay in use\n")));
  10062 
  10063         sal_memset(e, 0, SOC_MAX_MEM_FIELD_WORDS * sizeof(uint32));
  10064         BCM_IF_ERROR_RETURN(soc_mem_read(unit,
  10065                                          FP_GM_FIELDSm,
  10066                                          MEM_BLOCK_ANY,
  10067                                          tcam_idx,
  10068                                          e
  10069                                          )
  10070                             );
  10071 
  10072         soc_mem_field32_set(unit, FP_GM_FIELDSm, e, VALIDf, validf ? 3 : 2);
  10073         soc_mem_field_width_fit_set(unit, FP_GM_FIELDSm, e, KEYf, tcam->key + fp_tcam_words);
  10074         soc_mem_field_width_fit_set(unit, FP_GM_FIELDSm, e, MASKf, tcam->mask + fp_tcam_words);
  10075 
  10076         BCM_IF_ERROR_RETURN(WRITE_FP_GM_FIELDSm(unit, MEM_BLOCK_ALL, tcam_idx,
  10077             e));
  10078     } else {
  10079         BCM_IF_ERROR_RETURN(soc_mem_read(unit,
  10080                                          FP_GLOBAL_MASK_TCAMm,
  10081                                          MEM_BLOCK_ANY,
  10082                                          tcam_idx,
  10083                                          &tcam_entry
  10084                                          )
  10085                             );
  10086 
  10087         soc_mem_field_set(unit,
  10088                           FP_GLOBAL_MASK_TCAMm,
  10089                           (uint32 *)&tcam_entry,
  10090                           KEYf,
  10091                           tcam->key + fp_tcam_words
  10092                           );
  10093         soc_mem_field_set(unit,
  10094                           FP_GLOBAL_MASK_TCAMm,
  10095                           (uint32 *)&tcam_entry,
  10096                           MASKf,
  10097                           tcam->mask + fp_tcam_words
  10098                           );
  10099 
  10100         if (BCM_FIELD_QSET_TEST(f_ent->group->qset, bcmFieldQualifyInPort) ||
  10101             BCM_FIELD_QSET_TEST(f_ent->group->qset, bcmFieldQualifyInPorts)) {
  10102             soc_mem_field_set(unit, FP_GLOBAL_MASK_TCAMm, (uint32 *)&tcam_entry,
  10103                               IPBMf, (uint32 *)&(f_ent->pbmp.data));
  10104             soc_mem_field_width_fit_set(unit, FP_GLOBAL_MASK_TCAMm,
  10105                                         (uint32 *)&tcam_entry, IPBM_MASKf,
  10106                                         (uint32 *)&(f_ent->pbmp.mask));
  10107 
  10108         }
  10109         else if (SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Xm) &&
  10110                 SOC_MEM_IS_VALID(unit, FP_GLOBAL_MASK_TCAM_Ym)) {
  10111             BCM_PBMP_CLEAR(pbmp_x);
  10112             BCM_PBMP_CLEAR(pbmp_y);
  10113             sal_memset(&tcam_entry_x, 0, sizeof(fp_global_mask_tcam_x_entry_t));
  10114             sal_memset(&tcam_entry_y, 0, sizeof(fp_global_mask_tcam_y_entry_t));
  10115 
  10116             BCM_IF_ERROR_RETURN(soc_mem_read(unit,
  10117                                             FP_GLOBAL_MASK_TCAM_Xm,
  10118                                             MEM_BLOCK_ANY,
  10119                                             tcam_idx,
  10120                                             &tcam_entry_x
  10121                                             )
  10122                                 );
  10123             BCM_IF_ERROR_RETURN(soc_mem_read(unit,
  10124                                             FP_GLOBAL_MASK_TCAM_Ym,
  10125                                             MEM_BLOCK_ANY,
  10126                                             tcam_idx,
  10127                                             &tcam_entry_y
  10128                                             )
  10129                                 );
  10130 
  10131             soc_mem_pbmp_field_get(unit, FP_GLOBAL_MASK_TCAM_Xm, &tcam_entry_x,
  10132                                    IPBMf, &pbmp_x);
  10133             soc_mem_pbmp_field_get(unit, FP_GLOBAL_MASK_TCAM_Ym, &tcam_entry_y,
  10134                                    IPBMf, &pbmp_y);
  10135 
  10136             BCM_PBMP_OR(pbmp_x, pbmp_y);
  10137 
  10138             soc_mem_pbmp_field_set(unit,
  10139                                    FP_GLOBAL_MASK_TCAMm,
  10140                                    &tcam_entry,
  10141                                    IPBMf,
  10142                                    &pbmp_x 
  10143                                    );
  10144         }
  10145 
  10146         if (!(f_ent->flags & _FP_ENTRY_SECOND_HALF)) {
  10147             soc_mem_field_set(unit,
  10148                               FP_GLOBAL_MASK_TCAMm,
  10149                               (uint32 *)&tcam_entry,
  10150                               IPBMf,
  10151                               f_ent->pbmp.data.pbits
  10152                               );
  10153             soc_mem_field_set(unit,
  10154                               FP_GLOBAL_MASK_TCAMm,
  10155                               (uint32 *)&tcam_entry,
  10156                               IPBM_MASKf,
  10157                               f_ent->pbmp.mask.pbits
  10158                               );
  10159         }
  10160         soc_mem_field32_set(unit,
  10161                             FP_GLOBAL_MASK_TCAMm,
  10162                             (uint32 *)&tcam_entry,
  10163                             VALIDf,
  10164                             validf ? 3 : 2
  10165                             );
  10166         BCM_IF_ERROR_RETURN(soc_mem_write(unit,
  10167                                           FP_GLOBAL_MASK_TCAMm,
  10168                                           MEM_BLOCK_ALL,
  10169                                           tcam_idx,
  10170                                           &tcam_entry
  10171                                           )
  10172                             );
  10173 
  10174     }
  10175     return (BCM_E_NONE);
  10176 }
  10177 
  10178 int
  10179 _bcm_field_td2_qual_tcam_key_mask_set(int            unit,
  10180                                       _field_entry_t *f_ent,
  10181                                       unsigned       validf
  10182                                       )
  10183 {
  10184     int       tcam_idx;
  10185     soc_mem_t tcam_mem;
  10186 
  10187     BCM_IF_ERROR_RETURN(_bcm_field_entry_tcam_idx_get(unit,
  10188                                                       f_ent,
  10189                                                       &tcam_idx
  10190                                                       )
  10191                         );
  10192 
  10193     switch (f_ent->group->stage_id) {
  10194         case _BCM_FIELD_STAGE_LOOKUP:
  10195             tcam_mem = VFP_TCAMm;
  10196             break;
  10197         case _BCM_FIELD_STAGE_INGRESS:
  10198             return (_field_td2_ingress_qual_tcam_key_mask_set(unit,
  10199                                                               f_ent,
  10200                                                               tcam_idx,
  10201                                                               validf));
  10202         case _BCM_FIELD_STAGE_EGRESS:
  10203             tcam_mem = EFP_TCAMm;
  10204            break;
  10205         default:
  10206             return (BCM_E_INTERNAL);
  10207     }
  10208     {
  10209         uint32 tcam_entry[SOC_MAX_MEM_FIELD_WORDS] = {0};
  10210 
  10211         BCM_IF_ERROR_RETURN(_bcm_field_trx_tcam_get(unit, tcam_mem,
  10212                                                     f_ent, tcam_entry));
  10213         BCM_IF_ERROR_RETURN(soc_mem_write(unit, tcam_mem, MEM_BLOCK_ALL,
  10214                                           tcam_idx, tcam_entry));
  10215     }
  10216 
  10217     return (BCM_E_NONE);
  10218 }
  10219 
  10220 /*
  10221  * Function:
  10222  *     _bcm_field_td2_action_get
  10223  * Purpose:
  10224  *     Get the actions to be written
  10225  * Parameters:
  10226  *     unit     - BCM device number
  10227  *     mem      - Policy table memory
  10228  *     f_ent    - entry structure to get policy info from
  10229  *     tcam_idx - index into TCAM
  10230  *     fa       - field action
  10231  *     buf      - (OUT) Field Policy table entry
  10232  * Returns:
  10233  *     BCM_E_NONE
  10234  *     BCM_E_PARAM - Action parameter out-of-range or unrecognized action.
  10235  * Notes:
  10236  *     This is a simple read/modify/write pattern.
  10237  *     FP unit lock should be held by calling function.
  10238  */
  10239 int
  10240 _bcm_field_td2_action_get(int             unit,
  10241                           soc_mem_t       mem,
  10242                           _field_entry_t  *f_ent,
  10243                           int             tcam_idx,
  10244                           _field_action_t *fa,
  10245                           uint32          *buf
  10246                           )
  10247 {
  10248 #ifdef INCLUDE_L3
  10249     int32     hw_idx=0, hw_half=0;
  10250 #endif /* INCLUDE_L3 */
  10251     int hw_index = 0;
  10252     int rv = 0;
  10253     int cosq_new;
  10254 
  10255     if (NULL == f_ent || NULL == fa || NULL == buf) {
  10256         return (BCM_E_PARAM);
  10257     }
  10258 
  10259     switch (fa->action) {
  10260         case bcmFieldActionFibreChanSrcBindEnable:
  10261             PolicySet(unit, mem, buf, FCOE_SRC_BIND_CHECK_ENABLEf, fa->param[0]);
  10262             break;
  10263         case bcmFieldActionFibreChanFpmaPrefixCheckEnable:
  10264             PolicySet(unit, mem, buf, FCOE_SRC_FPMA_PREFIX_CHECK_ENABLEf, fa->param[0]);
  10265             break;
  10266         case bcmFieldActionFibreChanZoneCheckEnable:
  10267             PolicySet(unit, mem, buf, FCOE_ZONE_CHECK_ENABLEf, fa->param[0]);
  10268             break;
  10269         case bcmFieldActionFibreChanVsanId:
  10270             PolicySet(unit, mem, buf, FCOE_VSAN_IDf, fa->param[0]);
  10271             break;
  10272         case bcmFieldActionFibreChanZoneCheckActionCancel:
  10273             PolicySet(unit, mem, buf, FCOE_ZONE_CHECK_ACTIONf, fa->param[0]);
  10274             break;
  10275         case bcmFieldActionFibreChanIntVsanPri:
  10276             PolicySet(unit, mem, buf, FCOE_VSAN_PRIf, fa->param[0]);
  10277             PolicySet(unit, mem, buf, FCOE_VSAN_PRI_VALIDf, 1);
  10278             break;
  10279         case bcmFieldActionNewClassId:
  10280             PolicySet(unit, mem, buf, I2E_CLASSIDf, fa->param[0]);
  10281             PolicySet(unit, mem, buf, G_L3SW_CHANGE_L2_FIELDSf, 0x8);
  10282             break;
  10283 
  10284         case bcmFieldActionEgressClassSelect:
  10285             {
  10286                 unsigned i2e_cl_sel;
  10287 
  10288                 switch (fa->param[0]) {
  10289                     case BCM_FIELD_EGRESS_CLASS_SELECT_PORT:
  10290                         i2e_cl_sel = 0x1;
  10291                         break;
  10292                     case BCM_FIELD_EGRESS_CLASS_SELECT_SVP:
  10293                         i2e_cl_sel = 0x2;
  10294                         break;
  10295                     case BCM_FIELD_EGRESS_CLASS_SELECT_L3_IIF:
  10296                         i2e_cl_sel = 0x3;
  10297                         break;
  10298                     case BCM_FIELD_EGRESS_CLASS_SELECT_FIELD_SRC:
  10299                         i2e_cl_sel = 0x4; /* VFP hi */
  10300                         break;
  10301                     case BCM_FIELD_EGRESS_CLASS_SELECT_FIELD_DST:
  10302                         i2e_cl_sel = 0x5; /* VFP lo */
  10303                         break;
  10304                     case BCM_FIELD_EGRESS_CLASS_SELECT_L2_SRC:
  10305                         i2e_cl_sel = 0x6;
  10306                         break;
  10307                     case BCM_FIELD_EGRESS_CLASS_SELECT_L2_DST:
  10308                         i2e_cl_sel = 0x7;
  10309                         break;
  10310                     case BCM_FIELD_EGRESS_CLASS_SELECT_L3_SRC:
  10311                         i2e_cl_sel = 0x8;
  10312                         break;
  10313                     case BCM_FIELD_EGRESS_CLASS_SELECT_L3_DST:
  10314                         i2e_cl_sel = 0x9;
  10315                         break;
  10316                     case BCM_FIELD_EGRESS_CLASS_SELECT_VLAN:
  10317                         i2e_cl_sel = 0xa;
  10318                         break;
  10319                     case BCM_FIELD_EGRESS_CLASS_SELECT_VRF:
  10320                         i2e_cl_sel = 0xb;
  10321                         break;
  10322                     case BCM_FIELD_EGRESS_CLASS_SELECT_NEW:
  10323                         i2e_cl_sel = 0xf;
  10324                         break;
  10325                     default:
  10326                         /* Invalid parameter should have been caught earlier */
  10327                         return (BCM_E_INTERNAL);
  10328                 }
  10329                 PolicySet(unit, mem, buf, I2E_CLASSID_SELf, i2e_cl_sel);
  10330                 PolicySet(unit, mem, buf, G_L3SW_CHANGE_L2_FIELDSf, 0x8);
  10331             }
  10332             break;
  10333 
  10334         case bcmFieldActionHiGigClassSelect:
  10335             {
  10336                 unsigned hg_cl_sel;
  10337 
  10338                 switch (fa->param[0]) {
  10339                     case BCM_FIELD_HIGIG_CLASS_SELECT_EGRESS:
  10340                         hg_cl_sel = 1;
  10341                         break;
  10342                     case BCM_FIELD_HIGIG_CLASS_SELECT_PORT:
  10343                         hg_cl_sel = 4;
  10344                         break;
  10345                     default:
  10346                         /* Invalid parameter should have been caught earlier */
  10347                         return (BCM_E_INTERNAL);
  10348                 }
  10349 
  10350                 PolicySet(unit, mem, buf, HG_CLASSID_SELf, hg_cl_sel);
  10351             }
  10352             break;
  10353 
  10354         case bcmFieldActionNatCancel:
  10355             PolicySet(unit, mem, buf, DO_NOT_NATf, 0x1);
  10356             if (soc_feature(unit, soc_feature_fp_based_oam)) {
  10357                 PolicySet(unit, mem, buf, NAT_OAM_ACTION_SELECTf, _bcmFieldNatOamValidNat);
  10358             }
  10359             break;
  10360 
  10361         case bcmFieldActionNat:
  10362             PolicySet(unit, mem, buf, NAT_ENABLEf, 0x1);
  10363             if (soc_feature(unit, soc_feature_fp_based_oam)) {
  10364                 PolicySet(unit, mem, buf, NAT_OAM_ACTION_SELECTf, _bcmFieldNatOamValidNat);
  10365             }
  10366             break;
  10367 
  10368         case bcmFieldActionNatEgressOverride:
  10369 #ifdef INCLUDE_L3
  10370             BCM_L3_NAT_EGRESS_HW_IDX_GET(fa->param[0], hw_idx, hw_half);
  10371             if ((hw_idx < 0) || (hw_idx > soc_mem_index_max(unit,
  10372                                           EGR_NAT_PACKET_EDIT_INFOm))) {
  10373                return BCM_E_PARAM;
  10374             }
  10375 
  10376             PolicySet(unit, mem, buf, NAT_PACKET_EDIT_IDXf, hw_idx);
  10377             PolicySet(unit, mem, buf, NAT_PACKET_EDIT_ENTRY_SELf, hw_half);
  10378 #else
  10379             return (BCM_E_UNAVAIL);   
  10380 #endif /* INCLUDE_L3 */ 
  10381             break;
  10382 
  10383         case bcmFieldActionIngSampleEnable: 
  10384              PolicySet(unit, mem, buf, SFLOW_ING_SAMPLEf, 0x1);
  10385              break;
  10386 
  10387         case bcmFieldActionEgrSampleEnable: 
  10388              PolicySet(unit, mem, buf, SFLOW_EGR_SAMPLEf, 0x1);
  10389              break;
  10390 
  10391         case bcmFieldActionHashSelect0:
  10392         case bcmFieldActionHashSelect1:
  10393             /* hash selection available only in lookup stage */
  10394             if (_BCM_FIELD_STAGE_LOOKUP == f_ent->group->stage_id) {
  10395                 _field_td2_action_hash_select(unit, mem, f_ent, fa, buf);
  10396             }
  10397             break;
  10398 
  10399         case bcmFieldActionTrunkLoadBalanceCancel:
  10400              PolicySet(unit, mem, buf, LAG_RH_DISABLEf, 1);
  10401              PolicySet(unit, mem, buf, HGT_RH_DISABLEf, 1);
  10402              PolicySet(unit, mem, buf, HGT_DLB_DISABLEf, 1);
  10403              break;
  10404 
  10405         case bcmFieldActionEcmpResilientHashCancel:
  10406              PolicySet(unit, mem, buf, ECMP_RH_DISABLEf, 1);
  10407              break;
  10408 
  10409         case bcmFieldActionHgTrunkResilientHashCancel:
  10410              PolicySet(unit, mem, buf, HGT_RH_DISABLEf, 1);
  10411              break;
  10412 
  10413         case bcmFieldActionTrunkResilientHashCancel:
  10414              PolicySet(unit, mem, buf, LAG_RH_DISABLEf, 1);
  10415              break;
  10416         case bcmFieldActionVxlanHeaderBits8_31_Set:
  10417             PolicySet(unit, mem, buf, VXLAN_RESERVED_1f, fa->param[0]);
  10418             PolicySet(unit, mem, buf, VXLAN_ACTIONf, 1);
  10419             break;
  10420         case bcmFieldActionVxlanHeaderBits56_63_Set:
  10421             PolicySet(unit, mem, buf, VXLAN_RESERVED_2f, fa->param[0]);
  10422             PolicySet(unit, mem, buf, VXLAN_ACTIONf, 1);
  10423             break;
  10424         case bcmFieldActionVxlanHeaderFlags:
  10425             PolicySet(unit, mem, buf, VXLAN_FLAGSf, fa->param[0]);
  10426             PolicySet(unit, mem, buf, VXLAN_ACTIONf, 1);
  10427             break;
  10428         case bcmFieldActionOamOlpHeaderAdd:
  10429             if (soc_feature(unit, soc_feature_fp_based_oam)) {
  10430                 if ((_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id)
  10431 #if defined(BCM_APACHE_SUPPORT)
  10432                     || (SOC_IS_APACHE(unit) &&
  10433                          (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id))
  10434 #endif
  10435                     ) {
  10436                     if (fa->param[0] >= bcmFieldOlpHeaderTypeCount) {
  10437                         return (BCM_E_PARAM);
  10438                     }
  10439                     hw_index = 0;
  10440                     rv = _bcm_oam_olp_fp_hw_index_get (unit,fa->param[0],
  10441                             &hw_index);
  10442                     if (BCM_FAILURE(rv)) {
  10443                         return BCM_E_PARAM;
  10444                     }
  10445 
  10446                     PolicySet(unit, mem, buf, ADD_OLP_HEADERf, 1);
  10447                     PolicySet(unit, mem, buf, OLP_HDR_TYPE_COMPRESSEDf,
  10448                               hw_index);
  10449                     /* Egress stage doesn't have NAT OAM ACTIONS.
  10450                        In IFP, if MACSEC based OLP header types
  10451                        bcmFieldOlpHeaderTypeMacSecEncrypt and bcmFieldOlpHeaderTypeMacSecDecrypt
  10452                        used then they doesn't require to program NAT_OAM_ACTION_SELECT to add OLP header.
  10453                        So avoid programming NAT_OAM_ACTION_SELECTf for MacSecEncrypt/MacSecDecrypt header types.
  10454                        bcmFieldOlpHeaderTypeMacSecEncrypt and bcmFieldOlpHeaderTypeMacSecDecrypt have
  10455                        enum values 22 and 23 respectively. Computation done to check whether the param is
  10456                        anyone of the 2 MACSEC header types.
  10457                        22 = 0001 0110 (0x16) ==> After Right shift ==> 0000 1011 (0x0B)
  10458                        23 = 0001 0111 (0x17) ==> After Right shift ==> 0000 1011 (0x0B)
  10459                        So right shift and compare with 0xB instead of multiple comparisions.
  10460                        */
  10461                     if ((_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id)
  10462 #if defined(BCM_MONTEREY_SUPPORT) && defined(INCLUDE_XFLOW_MACSEC)
  10463                          && (0xB != (fa->param[0] >> 1))
  10464 #endif /* BCM_MONTEREY_SUPPORT & INCLUDE_XFLOW_MACSEC */
  10465                         ) {
  10466                         PolicySet(unit, mem, buf, NAT_OAM_ACTION_SELECTf,
  10467                                 _bcmFieldNatOamValidOam);
  10468                     }
  10469                 }
  10470             }
  10471             break;
  10472         case bcmFieldActionOamDmTimeFormat:
  10473             if (soc_feature(unit, soc_feature_fp_based_oam)) {
  10474                 if ((_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id)
  10475 #if defined(BCM_APACHE_SUPPORT)
  10476                     || (SOC_IS_APACHE(unit) &&
  10477                          (_BCM_FIELD_STAGE_EGRESS == f_ent->group->stage_id))
  10478 #endif
  10479                     ) {
  10480                     unsigned oam_dm_type;
  10481                     switch (fa->param[0]) {
  10482                         case BCM_FIELD_OAM_DM_TIME_FORMAT_IEEE1588:
  10483                             oam_dm_type = 1;
  10484                             break;
  10485                         case BCM_FIELD_OAM_DM_TIME_FORMAT_NTP:
  10486                             oam_dm_type = 2;
  10487                             break;
  10488                         default:
  10489                             /* Invalid parameter should have been caught earlier */
  10490                             return (BCM_E_INTERNAL);
  10491                     }
  10492 
  10493                     PolicySet(unit, mem, buf, SAMPLE_TIMESTAMPf, oam_dm_type);
  10494                     /* Egress stage doesn't have NAT OAM ACTIONS */
  10495                     if (_BCM_FIELD_STAGE_INGRESS == f_ent->group->stage_id) {
  10496                         PolicySet(unit, mem, buf, NAT_OAM_ACTION_SELECTf, _bcmFieldNatOamValidOam);
  10497                     }
  10498                 }
  10499             }
  10500             break;
  10501         case bcmFieldActionEgressPbmpNullCopyToCpu:
  10502             if (SOC_MEM_FIELD_VALID(unit, mem, INSTRUMENTATION_TRIGGERS_ENABLEf)) {
  10503                 PolicySet(unit, mem, buf, INSTRUMENTATION_TRIGGERS_ENABLEf, TRUE);
  10504             }
  10505             break;
  10506         case bcmFieldActionPimBidirFwd:
  10507             PolicySet(unit, mem, buf, PIM_BIDIR_FORWARDf, 1);
  10508             break;
  10509         case bcmFieldActionDscpMapNew:
  10510             hw_index = 0;
  10511 #if defined BCM_TRIUMPH2_SUPPORT
  10512             rv = _bcm_tr2_qos_id2idx(unit, fa->param[0], &hw_index);
  10513                 if (BCM_FAILURE(rv)) {
  10514                     return BCM_E_PARAM;
  10515                 }
  10516 #endif
  10517             PolicySet(unit, mem, buf, TRUST_DSCP_PTRf, hw_index);
  10518             PolicySet(unit, mem, buf, TRUST_DSCPf, 1);
  10519             break;
  10520 
  10521         case bcmFieldActionUcastQueueNew:
  10522             PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 2);
  10523             PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 2);
  10524             PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 2);
  10525             rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
  10526                        _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
  10527                        &cosq_new, NULL);
  10528             if (BCM_FAILURE(rv)) {
  10529                 return BCM_E_PARAM;
  10530             }
  10531             PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new);
  10532             PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new);
  10533             PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new);
  10534             break;
  10535         case bcmFieldActionRpUcastQueueNew:
  10536             PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 2);
  10537             rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
  10538                        _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
  10539                        &cosq_new, NULL);
  10540             if (BCM_FAILURE(rv)) {
  10541                 return BCM_E_PARAM;
  10542             }
  10543             PolicySet(unit, mem, buf, R_COS_INT_PRIf, cosq_new);
  10544             break;
  10545         case bcmFieldActionYpUcastQueueNew:
  10546             PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 2);
  10547             rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
  10548                        _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
  10549                        &cosq_new, NULL);
  10550             if (BCM_FAILURE(rv)) {
  10551                 return BCM_E_PARAM;
  10552             }
  10553             PolicySet(unit, mem, buf, Y_COS_INT_PRIf, cosq_new);
  10554             break;
  10555         case bcmFieldActionGpUcastQueueNew:
  10556             PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 2);
  10557             rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
  10558                        _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
  10559                        &cosq_new, NULL);
  10560             if (BCM_FAILURE(rv)) {
  10561                 return BCM_E_PARAM;
  10562             }
  10563             PolicySet(unit, mem, buf, G_COS_INT_PRIf, cosq_new);
  10564             break;
  10565 
  10566         case bcmFieldActionIntCosUcastQueueNew:
  10567             PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 3);
  10568             PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 3);
  10569             PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 3);
  10570             rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
  10571                        _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
  10572                        &cosq_new, NULL);
  10573             if (BCM_FAILURE(rv)) {
  10574                 return BCM_E_PARAM;
  10575             }
  10576             PolicySet(unit, mem, buf, R_COS_INT_PRIf,
  10577                       (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
  10578                        cosq_new));
  10579             PolicySet(unit, mem, buf, Y_COS_INT_PRIf,
  10580                       (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
  10581                        cosq_new));
  10582             PolicySet(unit, mem, buf, G_COS_INT_PRIf,
  10583                       (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
  10584                        cosq_new));
  10585             break;
  10586         case bcmFieldActionRpIntCosUcastQueueNew:
  10587             PolicySet(unit, mem, buf, R_CHANGE_COS_OR_INT_PRIf, 3);
  10588             rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
  10589                        _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
  10590                        &cosq_new, NULL);
  10591             if (BCM_FAILURE(rv)) {
  10592                 return BCM_E_PARAM;
  10593             }
  10594             PolicySet(unit, mem, buf, R_COS_INT_PRIf,
  10595                       (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
  10596                        cosq_new));
  10597             break;
  10598         case bcmFieldActionYpIntCosUcastQueueNew:
  10599             PolicySet(unit, mem, buf, Y_CHANGE_COS_OR_INT_PRIf, 3);
  10600             rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
  10601                        _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
  10602                        &cosq_new, NULL);
  10603             if (BCM_FAILURE(rv)) {
  10604                 return BCM_E_PARAM;
  10605             }
  10606             PolicySet(unit, mem, buf, Y_COS_INT_PRIf,
  10607                      (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
  10608                        cosq_new));
  10609             break;
  10610         case bcmFieldActionGpIntCosUcastQueueNew:
  10611             PolicySet(unit, mem, buf, G_CHANGE_COS_OR_INT_PRIf, 3);
  10612             rv = _bcm_td2_cosq_index_resolve(unit, fa->param[0], 0,
  10613                        _BCM_TD2_COSQ_INDEX_STYLE_UCAST_QUEUE, NULL,
  10614                        &cosq_new, NULL);
  10615             if (BCM_FAILURE(rv)) {
  10616                 return BCM_E_PARAM;
  10617             }
  10618             PolicySet(unit, mem, buf, G_COS_INT_PRIf,
  10619                       (_BCM_COSQ_CLASSIFIER_FIELD_GET(fa->param[1]) << 12 |
  10620                        cosq_new));
  10621             break;
  10622         case bcmFieldActionDoNotCutThrough:
  10623             PolicySet(unit, mem, buf, DO_NOT_CUT_THROUGHf, 0x1);
  10624             break;
  10625 #if defined(BCM_APACHE_SUPPORT)
  10626         case bcmFieldActionCopyToCpu:
  10627             if (SOC_IS_APACHE(unit) &&
  10628                     (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) &&
  10629                     (fa->param[2])) {
  10630                 return (_bcm_field_copytocpu_action_get(unit, mem, f_ent, fa, buf));
  10631             } else {
  10632                 return (BCM_E_UNAVAIL);
  10633             }
  10634             break;
  10635         case bcmFieldActionRedirect:
  10636             if (SOC_IS_APACHE(unit) &&
  10637                     (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) &&
  10638                     (fa->param[2])) {
  10639                 return (_bcm_field_redirect_action_get(unit, mem, f_ent, fa, buf));
  10640             } else {
  10641                 return (BCM_E_UNAVAIL);
  10642             }
  10643             break;
  10644 #endif
  10645         case bcmFieldActionMplsLabel1ExpNew:
  10646             if ((SOC_MEM_FIELD_VALID(unit, mem, CHANGE_EXPf))
  10647                     && (SOC_MEM_FIELD_VALID(unit, mem, EXPf))) {
  10648                 PolicySet(unit, mem, buf, CHANGE_EXPf, 0x1);
  10649                 PolicySet(unit, mem, buf, EXPf, fa->param[0]);
  10650             } else {
  10651                 return (BCM_E_UNAVAIL);
  10652             }
  10653             break;
  10654         default:
  10655             return (BCM_E_UNAVAIL);
  10656     }
  10657 
  10658     return (BCM_E_NONE);
  10659 }
  10660 
  10661 
  10662 /*
  10663  * Function:
  10664  *     _field_td2_ingress_write_slice_map
  10665  * Purpose:
  10666  *     Write FP_SLICE_MAP
  10667  * Parameters:
  10668  *     unit       - (IN) BCM device number
  10669  *     stage_fc   - (IN) stage control structure
  10670  * Returns:
  10671  *     BCM_E_XXX
  10672  */
  10673 STATIC int
  10674 _field_td2_ingress_write_slice_map(int unit, _field_stage_t *stage_fc)
  10675 {
  10676     fp_slice_map_entry_t entry;
  10677     soc_field_t field;
  10678     uint32 value;
  10679     int vmap_size;
  10680     int index;
  10681     static const soc_field_t physical_slice[] = {
  10682         VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10683         VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10684         VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10685         VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10686         VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10687         VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10688         VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10689         VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10690         VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10691         VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10692         VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
  10693         VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBER_ENTRY_0f
  10694     };
  10695     static const soc_field_t slice_group[] = {
  10696         VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10697         VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10698         VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10699         VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10700         VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10701         VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10702         VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10703         VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10704         VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10705         VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10706         VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUP_ENTRY_0f,
  10707         VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUP_ENTRY_0f
  10708     };
  10709 
  10710     /* Calculate virtual map size. */
  10711     BCM_IF_ERROR_RETURN
  10712         (_bcm_field_virtual_map_size_get(unit, stage_fc, &vmap_size));
  10713 
  10714     SOC_IF_ERROR_RETURN(READ_FP_SLICE_MAPm(unit, MEM_BLOCK_ANY, 0, &entry));
  10715 
  10716     for (index = 0; index < vmap_size; index++) {
  10717         value = stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][index].vmap_key;
  10718         field = physical_slice[index];
  10719         soc_FP_SLICE_MAPm_field32_set(unit, &entry, field, value);
  10720 
  10721         value = stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][index].virtual_group;
  10722         field = slice_group[index];
  10723         soc_FP_SLICE_MAPm_field32_set(unit, &entry, field, value);
  10724     }
  10725 
  10726     return WRITE_FP_SLICE_MAPm(unit, MEM_BLOCK_ALL, 0, &entry);
  10727 }
  10728 
  10729 /*
  10730  * Function:
  10731  *     _bcm_field_td2_write_slice_map
  10732  * Purpose:
  10733  *     Write FP_SLICE_MAP, EFP_SLICE_MAP, VFP_SLICE_MAP
  10734  * Parameters:
  10735  *     unit       - (IN) BCM device number
  10736  *     stage_fc   - (IN) stage control structure
  10737  *     fg         - (IN) reference to field group structure.
  10738  * Returns:
  10739  *     BCM_E_XXX
  10740  */
  10741 
  10742 int
  10743 _bcm_field_td2_write_slice_map(int unit, _field_stage_t *stage_fc,
  10744                                _field_group_t *fg)
  10745 {
  10746     switch (stage_fc->stage_id) {
  10747         case _BCM_FIELD_STAGE_LOOKUP:
  10748             return (_bcm_field_trx_write_slice_map_vfp(unit, stage_fc));
  10749 
  10750         case _BCM_FIELD_STAGE_INGRESS:
  10751             return (_field_td2_ingress_write_slice_map(unit, stage_fc));
  10752 
  10753         case _BCM_FIELD_STAGE_EGRESS:
  10754             return (_bcm_field_trx_write_slice_map_egress(unit, stage_fc));
  10755 
  10756         default:
  10757             ;
  10758     }
  10759 
  10760     return (BCM_E_INTERNAL);
  10761 }
  10762 
  10763 /*
  10764  * Function:
  10765  *     _bcm_field_td2_qualify_ip_type
  10766  * Purpose:
  10767  *     Install ip type qualifier into TCAM
  10768  * Parameters:
  10769  *     unit  - (IN) BCM device number
  10770  *     entry - (IN) Field entry index
  10771  *     type  - (IN) Ip Type.
  10772  *     qual  - (IN) Qualifier(IpType/InnerIpType)
  10773  * Returns:
  10774  *     BCM_E_XXX
  10775  * Notes:
  10776  */
  10777 
  10778 
  10779 int
  10780 _bcm_field_td2_qualify_ip_type(int unit, bcm_field_entry_t entry,
  10781                                bcm_field_IpType_t type,
  10782                                bcm_field_qualify_t qual)
  10783 {
  10784     uint32              data = 0,
  10785                         mask = 0;
  10786 
  10787 #if defined BCM_TOMAHAWK3_SUPPORT
  10788    if (SOC_IS_TOMAHAWK3(unit)) {
  10789       return _bcm_field_th3_qualify_ip_type(unit, entry,
  10790                                             type, qual);
  10791    }
  10792 #endif
  10793 
  10794     switch (type) {
  10795       case bcmFieldIpTypeAny:
  10796           data = 0x0;
  10797           mask = 0x0;
  10798           break;
  10799       case bcmFieldIpTypeNonIp:
  10800           data = 0x1f;
  10801           mask = 0x1f;
  10802           break;
  10803       case bcmFieldIpTypeIp:
  10804           data = 0x0;
  10805           mask = 0x8;
  10806           break;
  10807           break;
  10808       case bcmFieldIpTypeIpv4NoOpts:
  10809           data = 0x0;
  10810           mask = 0x1f;
  10811           break;
  10812       case bcmFieldIpTypeIpv4WithOpts:
  10813           data = 0x1;
  10814           mask = 0x1f;
  10815           break;
  10816       case bcmFieldIpTypeIpv4Any:
  10817           data = 0x0;
  10818           mask = 0xe;
  10819           break;
  10820       case bcmFieldIpTypeIpv6NoExtHdr:
  10821           data = 0x4;
  10822           mask = 0x1f;
  10823           break;
  10824       case bcmFieldIpTypeIpv6OneExtHdr:
  10825           data = 0x5;
  10826           mask = 0x1f;
  10827           break;
  10828       case bcmFieldIpTypeIpv6TwoExtHdr:
  10829           data = 0x6;
  10830           mask = 0x1f;
  10831           break;
  10832       case bcmFieldIpTypeIpv6:
  10833           data = 0x4;
  10834           mask = 0xc;
  10835           break;
  10836       case bcmFieldIpTypeArp:
  10837           data = 0x8;
  10838           mask = 0xe;
  10839           break;
  10840       case bcmFieldIpTypeArpRequest:
  10841           data = 0x8;
  10842           mask = 0x1f;
  10843           break;
  10844       case bcmFieldIpTypeArpReply:
  10845           data = 0x9;
  10846           mask = 0x1f;
  10847           break;
  10848       case bcmFieldIpTypeTrill:
  10849           data = 0xa;
  10850           mask = 0x1f;
  10851           break;
  10852       case bcmFieldIpTypeFCoE:
  10853           data = 0xb;
  10854           mask = 0x1f;
  10855           break;
  10856       case bcmFieldIpTypeMplsUnicast:
  10857           data = 0xc;
  10858           mask = 0x1f;
  10859           break;
  10860       case bcmFieldIpTypeMplsMulticast:
  10861           data = 0xd;
  10862           mask = 0x1f;
  10863           break;
  10864       case bcmFieldIpTypeMpls:
  10865           data = 0xc;
  10866           mask = 0x1e;
  10867           break;
  10868       case bcmFieldIpTypeMim:
  10869           data = 0xe;
  10870           mask = 0x1f;
  10871           break;
  10872       default:
  10873           LOG_DEBUG(BSL_LS_BCM_FP,
  10874                     (BSL_META_U(unit,
  10875                     "FP(unit %d) vverb: entry=%d qualifying"
  10876                     " on Invalid Iptype=%#x\n))"),
  10877                     unit, entry, type));
  10878           return (BCM_E_UNAVAIL);
  10879     }
  10880     LOG_DEBUG(BSL_LS_BCM_FP,
  10881               (BSL_META_U(unit,
  10882                           "FP(unit %d) vverb: entry=%d qualifying on Iptype, "
  10883                           "data=%#x, mask=%#x\n))"),
  10884                unit, entry, data, mask));
  10885 
  10886     return _field_qualify32(unit, entry, qual,
  10887                             data, mask);
  10888 }
  10889 
  10890 /*
  10891  * Function:
  10892  *     _bcm_field_td2_qualify_ip_type_get
  10893  * Purpose:
  10894  *     Read ip type qualifier match criteria from the HW.
  10895  * Parameters:
  10896  *     unit  - (IN) BCM device number
  10897  *     entry - (IN) Field entry index
  10898  *     type  - (OUT) Ip Type.
  10899  *     qual  - (IN) Qualifier(IpType/InnerIpType)
  10900  * Returns:
  10901  *     BCM_E_XXX
  10902  * Notes:
  10903  */
  10904 
  10905 int
  10906 _bcm_field_td2_qualify_ip_type_get(int unit, bcm_field_entry_t entry,
  10907                                    bcm_field_IpType_t *type, 
  10908                                    bcm_field_qualify_t qual)
  10909 {
  10910     uint32 hw_data;          /* HW encoded qualifier data.  */
  10911     uint32 hw_mask;          /* HW encoding qualifier mask. */
  10912     int rv;                  /* Operation return status.    */
  10913 
  10914     /* Input parameters checks. */
  10915     if (NULL == type) {
  10916         return (BCM_E_PARAM);
  10917     }
  10918 
  10919 
  10920     /* Read qualifier match value and mask. */
  10921     rv = _bcm_field_entry_qualifier_uint32_get(unit, entry,
  10922                                                qual,
  10923                                                &hw_data, &hw_mask);
  10924     BCM_IF_ERROR_RETURN(rv);
  10925 	
  10926     /* Read IpType encoding for qualifier data and mask */
  10927     rv = _bcm_field_td2_qualify_ip_type_encode_get(unit, hw_data, 
  10928                                                    hw_mask, type);
  10929     return rv;
  10930 
  10931 }
  10932 
  10933 /*
  10934  * Function:
  10935  *     _bcm_field_td2_qualify_ip_type_encode_get
  10936  * Purpose:
  10937  *     Get ip type qualifier encode value for given data and mask.
  10938  * Parameters:
  10939  *     unit     - (IN) BCM device number
  10940  *     data     - (IN) qualifier data.
  10941  *     mask     - (IN) qualifier mask.
  10942  *     type     - (OUT) Ip Type.
  10943  * Returns:
  10944  *     BCM_E_XXX
  10945  * Notes:
  10946  */
  10947 int
  10948 _bcm_field_td2_qualify_ip_type_encode_get(int unit,
  10949                                           uint32 hw_data,
  10950                                           uint32 hw_mask,
  10951                                           bcm_field_IpType_t *type)
  10952 {
  10953 #if defined BCM_TOMAHAWK3_SUPPORT
  10954    if (SOC_IS_TOMAHAWK3(unit)) {
  10955       return _bcm_field_th3_qualify_ip_type_encode_get(unit, 
  10956                                             hw_data, hw_mask,
  10957                                             type);
  10958    }
  10959 #endif
  10960 
  10961 
  10962     if ((0 == hw_data) && (0 == hw_mask)) {
  10963         *type = bcmFieldIpTypeAny;
  10964     } else if ((0x1f == hw_data) && (0x1f == hw_mask)) {
  10965         *type = bcmFieldIpTypeNonIp;
  10966     } else if ((0x0 == hw_data) && (0x8 == hw_mask)) {
  10967         *type = bcmFieldIpTypeIp;
  10968     } else if ((0x0 == hw_data) && (0x1f == hw_mask)) {
  10969         *type = bcmFieldIpTypeIpv4NoOpts;
  10970     } else if ((0x1 == hw_data) && (0x1f == hw_mask)) {
  10971         *type = bcmFieldIpTypeIpv4WithOpts;
  10972     } else if ((0x0 == hw_data) && (0xe == hw_mask)) {
  10973         *type = bcmFieldIpTypeIpv4Any;
  10974     } else if ((0x4 == hw_data) && (0x1f == hw_mask)) {
  10975         *type = bcmFieldIpTypeIpv6NoExtHdr;
  10976     } else if ((0x5 == hw_data) && (0x1f == hw_mask)) {
  10977         *type = bcmFieldIpTypeIpv6OneExtHdr;
  10978     } else if ((0x6 == hw_data) && (0x1f == hw_mask)) {
  10979         *type = bcmFieldIpTypeIpv6TwoExtHdr;
  10980     } else if ((0x4 == hw_data) && (0xc == hw_mask)) {
  10981         *type = bcmFieldIpTypeIpv6;
  10982     } else if ((0x8 == hw_data) && (0xe == hw_mask)) {
  10983         *type = bcmFieldIpTypeArp;
  10984     } else if ((0x8 == hw_data) && (0x1f == hw_mask)) {
  10985         *type = bcmFieldIpTypeArpRequest;
  10986     } else if ((0x9 == hw_data) && (0x1f == hw_mask)) {
  10987         *type = bcmFieldIpTypeArpReply;
  10988     } else if ((0xa == hw_data) && (0x1f == hw_mask)) {
  10989         *type = bcmFieldIpTypeTrill;
  10990     } else if ((0xb == hw_data) && (0x1f == hw_mask)) {
  10991         *type = bcmFieldIpTypeFCoE;
  10992     } else if ((0xc == hw_data) && (0x1f == hw_mask)) {
  10993         *type = bcmFieldIpTypeMplsUnicast;
  10994     } else if ((0xd == hw_data) && (0x1f == hw_mask)) {
  10995         *type = bcmFieldIpTypeMplsMulticast;
  10996     } else if ((0xc == hw_data) && (0x1e == hw_mask)) {
  10997         *type = bcmFieldIpTypeMpls;
  10998     } else if ((0xe == hw_data) && (0x1f == hw_mask)) {
  10999         *type = bcmFieldIpTypeMim;
  11000     } else
  11001     {
  11002         return (BCM_E_INTERNAL);
  11003     }
  11004     return (BCM_E_NONE);
  11005 }
  11006 
  11007 /*
  11008  * Function:
  11009  *     _field_td2_functions_init
  11010  *
  11011  * Purpose:
  11012  *     Set up functions pointers
  11013  *
  11014  * Parameters:
  11015  *     stage_fc - (IN/OUT) pointers to stage control block whe the device
  11016  *                         and stage specific functions will be registered.
  11017  *
  11018  * Returns:
  11019  *     nothing
  11020  * Notes:
  11021  */
  11022 STATIC void
  11023 _field_td2_functions_init(_field_funct_t *functions)
  11024 {
  11025     functions->fp_detach               = _bcm_field_tr_detach;
  11026     functions->fp_group_install        = _field_td2_group_install;
  11027     functions->fp_selcodes_install     = _field_td2_selcodes_install;
  11028     functions->fp_slice_clear          = _field_td2_slice_clear;
  11029     functions->fp_entry_remove         = _bcm_field_fb_entry_remove;
  11030     functions->fp_entry_move           = _field_td2_entry_move;
  11031     functions->fp_selcode_get          = _field_td2_selcode_get;
  11032     functions->fp_selcode_to_qset      = _bcm_field_selcode_to_qset;
  11033     functions->fp_qual_list_get        = _bcm_field_qual_lists_get;
  11034     functions->fp_tcam_policy_clear    = NULL;
  11035     functions->fp_tcam_policy_install  = _bcm_field_tr_entry_install;
  11036     functions->fp_tcam_policy_reinstall = _bcm_field_tr_entry_reinstall;
  11037     functions->fp_policer_install      = _bcm_field_trx_policer_install;
  11038     functions->fp_write_slice_map      = _bcm_field_td2_write_slice_map;
  11039     functions->fp_qualify_ip_type      = _bcm_field_td2_qualify_ip_type;
  11040     functions->fp_qualify_ip_type_get  = _bcm_field_td2_qualify_ip_type_get;
  11041     functions->fp_action_support_check = _field_td2_action_support_check;
  11042     functions->fp_action_conflict_check = _bcm_field_td2_action_conflict_check;
  11043     functions->fp_counter_get          = _bcm_field_td_counter_get;
  11044     functions->fp_counter_set          = _bcm_field_td_counter_set;
  11045     functions->fp_stat_index_get       = _bcm_field_trx_stat_index_get;
  11046     functions->fp_action_params_check  = _field_td2_action_params_check;
  11047     functions->fp_action_depends_check = NULL;
  11048     functions->fp_egress_key_match_type_set
  11049         = _bcm_field_trx_egress_key_match_type_set;
  11050     functions->fp_external_entry_install  = NULL;
  11051     functions->fp_external_entry_reinstall  = NULL;
  11052     functions->fp_external_entry_remove   = NULL;
  11053     functions->fp_external_entry_prio_set = NULL;
  11054     functions->fp_data_qualifier_ethertype_add
  11055         = _bcm_field_trx2_data_qualifier_ethertype_add;
  11056     functions->fp_data_qualifier_ethertype_delete
  11057         = _bcm_field_trx2_data_qualifier_ethertype_delete;
  11058     functions->fp_data_qualifier_ip_protocol_add
  11059         = _bcm_field_trx2_data_qualifier_ip_protocol_add;
  11060     functions->fp_data_qualifier_ip_protocol_delete
  11061         = _bcm_field_trx2_data_qualifier_ip_protocol_delete;
  11062     functions->fp_data_qualifier_packet_format_add
  11063         = _bcm_field_trx2_data_qualifier_packet_format_add;
  11064     functions->fp_data_qualifier_packet_format_delete
  11065         = _bcm_field_trx2_data_qualifier_packet_format_delete;
  11066     functions->fp_stat_value_get = NULL;
  11067     functions->fp_stat_value_set = NULL;
  11068     functions->fp_control_set = _bcm_field_control_set;
  11069     functions->fp_control_get = _bcm_field_control_get;
  11070     functions->fp_stat_hw_mode_get = _bcm_field_stat_hw_mode_get;
  11071     functions->fp_stat_hw_alloc = _bcm_field_stat_hw_alloc;
  11072     functions->fp_stat_hw_free = _bcm_field_stat_hw_free;
  11073     functions->fp_group_add = NULL;
  11074     functions->fp_qualify_trunk = _bcm_field_qualify_trunk;
  11075     functions->fp_qualify_trunk_get = _bcm_field_qualify_trunk_get;
  11076     functions->fp_qualify_inports = _bcm_field_qualify_InPorts;
  11077     functions->fp_entry_stat_extended_attach = NULL;
  11078     functions->fp_entry_stat_extended_get = NULL;
  11079     functions->fp_entry_stat_detach = _bcm_field_entry_stat_detach;
  11080     functions->fp_class_size_get = NULL;
  11081     functions->fp_qualify_packet_res = _bcm_field_td2_qualify_PacketRes;
  11082     functions->fp_qualify_packet_res_get = _bcm_field_td2_qualify_PacketRes_get;
  11083 }
  11084 
  11085 /*
  11086  * Function:
  11087  *     _field_td2_qualifiers_init
  11088  * Purpose:
  11089  *     Initialize device qaualifiers select codes & offsets
  11090  * Parameters:
  11091  *     unit       - (IN) BCM device number.
  11092  *     stage_fc   - (IN) Field Processor stage control structure.
  11093  *
  11094  * Returns:
  11095  *     BCM_E_NONE
  11096  * Notes:
  11097  */
  11098 STATIC int
  11099 _field_td2_qualifiers_init(int unit, _field_stage_t *stage_fc)
  11100 {
  11101     if (!soc_feature(unit, soc_feature_l3) 
  11102         && !soc_feature(unit, soc_feature_virtual_switching)) {
  11103         return _field_sc960_qualifiers_init(unit, stage_fc);
  11104     }
  11105 
  11106     /* Allocated stage qualifiers configuration array. */
  11107     _FP_XGS3_ALLOC(stage_fc->f_qual_arr,
  11108                    (_bcmFieldQualifyCount * sizeof(_bcm_field_qual_info_t *)),
  11109                    "Field qualifiers");
  11110     if (stage_fc->f_qual_arr == 0) {
  11111         return (BCM_E_MEMORY);
  11112     }
  11113 
  11114     switch (stage_fc->stage_id) {
  11115         case _BCM_FIELD_STAGE_LOOKUP:
  11116             return (_field_td2_lookup_qualifiers_init(unit, stage_fc));
  11117         case _BCM_FIELD_STAGE_INGRESS:
  11118             return (_field_td2_ingress_qualifiers_init(unit, stage_fc));
  11119         case _BCM_FIELD_STAGE_EGRESS:
  11120             return (_field_td2_egress_qualifiers_init(unit, stage_fc));
  11121         default:
  11122             ;
  11123     }
  11124 
  11125     sal_free(stage_fc->f_qual_arr);
  11126     return (BCM_E_INTERNAL);
  11127 }
  11128 
  11129 int
  11130 _bcm_field_td2_stage_init(int unit,
  11131                           _field_stage_t *stage_fc)
  11132 {
  11133     /* Input prameters check. */
  11134     if (NULL == stage_fc) {
  11135         return (BCM_E_PARAM);
  11136     }
  11137 
  11138     switch (stage_fc->stage_id) {
  11139         case _BCM_FIELD_STAGE_LOOKUP:
  11140             /* Flags */
  11141             stage_fc->flags |= (_FP_STAGE_SLICE_ENABLE
  11142                                 | _FP_STAGE_AUTO_EXPANSION
  11143                                 | _FP_STAGE_GLOBAL_COUNTERS);
  11144             /* Slice geometry */
  11145             stage_fc->tcam_sz     = soc_mem_index_count(unit, VFP_TCAMm);
  11146             stage_fc->tcam_slices = 4;
  11147             if (soc_feature(unit, 
  11148                             soc_feature_field_stage_lookup_256_half_slice)) {
  11149                 stage_fc->flags |= _FP_STAGE_HALF_SLICE;
  11150             }
  11151             if (soc_feature(unit,
  11152                         soc_feature_field_stage_lookup_512_half_slice)) {
  11153                 stage_fc->flags |= _FP_STAGE_HALF_SLICE;
  11154             }
  11155             break;
  11156         case _BCM_FIELD_STAGE_INGRESS:
  11157             /* Flags */
  11158             stage_fc->flags
  11159                 |= _FP_STAGE_SLICE_ENABLE
  11160                 | _FP_STAGE_GLOBAL_METER_POOLS
  11161                 | _FP_STAGE_SEPARATE_PACKET_BYTE_COUNTERS
  11162                 | _FP_STAGE_AUTO_EXPANSION;
  11163             /* Slice geometry */
  11164             stage_fc->tcam_sz     = soc_mem_index_count(unit, FP_TCAMm);
  11165             if (soc_feature(unit, soc_feature_field_slices8)) {
  11166                 stage_fc->tcam_slices = 8;
  11167             } else {
  11168                 stage_fc->tcam_slices = 12;
  11169             }
  11170             if (soc_feature(unit, soc_feature_field_stage_quarter_slice)) {
  11171                 stage_fc->flags |= _FP_STAGE_QUARTER_SLICE;
  11172             } else if (soc_feature(unit, soc_feature_field_stage_half_slice)) {
  11173                 stage_fc->flags |= _FP_STAGE_HALF_SLICE;
  11174             }
  11175             break;
  11176         case _BCM_FIELD_STAGE_EGRESS:
  11177             /* Flags */
  11178             stage_fc->flags |= _FP_STAGE_SLICE_ENABLE
  11179                 | _FP_STAGE_GLOBAL_COUNTERS
  11180                 | _FP_STAGE_SEPARATE_PACKET_BYTE_COUNTERS
  11181                 | _FP_STAGE_AUTO_EXPANSION;
  11182             /* Slice geometry */
  11183             stage_fc->tcam_sz     = soc_mem_index_count(unit, EFP_TCAMm);
  11184             stage_fc->tcam_slices = 4;
  11185             if (soc_feature(unit, 
  11186                             soc_feature_field_stage_egress_256_half_slice)) {
  11187                 stage_fc->flags |= _FP_STAGE_HALF_SLICE;
  11188             }
  11189             if (soc_feature(unit,
  11190                         soc_feature_field_stage_egress_512_half_slice)) {
  11191                 stage_fc->flags |= _FP_STAGE_HALF_SLICE;
  11192             }
  11193             break;
  11194         default:
  11195             return (BCM_E_INTERNAL);
  11196     }
  11197 
  11198     return (BCM_E_NONE);
  11199 }
  11200 
  11201 /*
  11202  * Function:
  11203  *     _bcm_field_td2_init
  11204  * Purpose:
  11205  *     Perform initializations that are specific to BCM56850. This
  11206  *     includes initializing the FP field select bit offset tables for FPF[1-3]
  11207  *     for every stage.
  11208  * Parameters:
  11209  *     unit       - (IN) BCM device number.
  11210  *     fc         - (IN) Field Processor control structure.
  11211  *
  11212  * Returns:
  11213  *     BCM_E_NONE
  11214  * Notes:
  11215  */
  11216 int
  11217 _bcm_field_td2_init(int unit, _field_control_t *fc)
  11218 {
  11219     _field_stage_t *stage_fc;
  11220 
  11221     /* Input parameters check. */
  11222     if (NULL == fc) {
  11223         return (BCM_E_PARAM);
  11224     }
  11225 
  11226     stage_fc = fc->stages;
  11227     while (stage_fc) {
  11228 
  11229         if (!SAL_BOOT_BCMSIM && !SAL_BOOT_QUICKTURN && !SAL_BOOT_XGSSIM) {
  11230             /* Clear hardware table */
  11231             BCM_IF_ERROR_RETURN(_bcm_field_tr_hw_clear(unit, stage_fc));
  11232         }
  11233 
  11234 #if defined (BCM_APACHE_SUPPORT)
  11235         if (SOC_IS_APACHE(unit)) {
  11236             /* Initialize qualifiers info. */
  11237             BCM_IF_ERROR_RETURN(_field_apache_qualifiers_init(unit, stage_fc));
  11238         } else
  11239 #endif /*BCM_APACHE_SUPPORT*/
  11240     /* Initialize the function pointers */
  11241 #if defined (BCM_TRIDENT2PLUS_SUPPORT)
  11242         if (SOC_IS_TD2P_TT2P(unit)) {
  11243             BCM_IF_ERROR_RETURN(_field_td2plus_qualifiers_init(unit, stage_fc));
  11244         } else
  11245 #endif /*BCM_TRIDENT2PLUS_SUPPORT*/
  11246         {
  11247             BCM_IF_ERROR_RETURN(_field_td2_qualifiers_init(unit, stage_fc));
  11248         }
  11249 
  11250         /* Goto next stage */
  11251         stage_fc = stage_fc->next;
  11252     }
  11253 
  11254     /* Initialize the TOS_FN, TTL_FN, TCP_FN tables */
  11255     BCM_IF_ERROR_RETURN(_bcm_field_trx_tcp_ttl_tos_init(unit));
  11256 
  11257     if (0 == SOC_WARM_BOOT(unit)) {
  11258         /* Enable filter processor */
  11259         BCM_IF_ERROR_RETURN(_field_port_filter_enable_set(unit, fc, TRUE));
  11260 
  11261         /* Enable meter refresh */
  11262         BCM_IF_ERROR_RETURN(_field_meter_refresh_enable_set(unit, fc, TRUE));
  11263     }
  11264 
  11265     /* Initialize the function pointers */
  11266 #if defined (BCM_TRIDENT2PLUS_SUPPORT)
  11267     if (SOC_IS_TD2P_TT2P(unit)) {
  11268         _field_td2plus_functions_init(&fc->functions);
  11269         return BCM_E_NONE;
  11270     }
  11271 #endif /*BCM_TRIDENT2PLUS_SUPPORT*/
  11272 
  11273 #if defined (BCM_APACHE_SUPPORT)
  11274     if (SOC_IS_APACHE(unit)) {
  11275         _field_apache_functions_init(&fc->functions);
  11276         return BCM_E_NONE;
  11277     }
  11278 #endif /*BCM_APACHE_SUPPORT*/
  11279 
  11280     _field_td2_functions_init(&fc->functions);
  11281 
  11282     return (BCM_E_NONE);
  11283 }
  11284 
  11285 /*
  11286  * Function:
  11287  *     _bcm_field_td2_qualify_class
  11288  * Purpose:
  11289  *     Qualifies field entry classifier id data and mask value
  11290  * Parameters:
  11291  *     unit  - (IN) BCM device number
  11292  *     entry - (IN) Field entry identifier
  11293  *     data  - (IN) Classifier ID lookup key value
  11294  *     mask  - (IN) Classifier ID lookup mask value
  11295  * Returns:
  11296  *     BCM_E_XXXX
  11297  */
  11298 int
  11299 _bcm_field_td2_qualify_class(int unit,
  11300                              bcm_field_entry_t entry,
  11301                              bcm_field_qualify_t qual,
  11302                              uint32 *data,
  11303                              uint32 *mask
  11304                              )
  11305 {
  11306     _field_entry_t *f_ent;
  11307     uint32 cl_width, cl_max;
  11308     uint32 ifp_cl_type;
  11309 
  11310     /* Get field entry part that contains the qualifier. */
  11311     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry, qual, &f_ent));
  11312 
  11313     switch (f_ent->group->stage_id) {
  11314         case _BCM_FIELD_STAGE_INGRESS:
  11315             switch (qual) {
  11316                 case bcmFieldQualifySrcClassL2:
  11317                 case bcmFieldQualifySrcClassL3:
  11318                 case bcmFieldQualifySrcClassField:
  11319                 case bcmFieldQualifyDstClassL2:
  11320                 case bcmFieldQualifyDstClassL3:
  11321                 case bcmFieldQualifyDstClassField:
  11322                     cl_width = 10;
  11323                     break;
  11324                 case bcmFieldQualifyInterfaceClassL2:
  11325                 case bcmFieldQualifyInterfaceClassL3:
  11326                 case bcmFieldQualifyInterfaceClassPort:
  11327                 case bcmFieldQualifyInterfaceClassVPort:  
  11328                     cl_width = 12;
  11329                     break;
  11330                 default:
  11331                     return (BCM_E_INTERNAL);
  11332             }
  11333 
  11334             cl_max = 1 << cl_width;
  11335 
  11336             if (*data >= cl_max ||
  11337                (*mask != BCM_FIELD_EXACT_MATCH_MASK && *mask >= cl_max)) {
  11338                 return (BCM_E_PARAM);
  11339             }
  11340             break;
  11341 
  11342         case _BCM_FIELD_STAGE_LOOKUP:
  11343             switch (qual) {
  11344                 case bcmFieldQualifyInterfaceClassPort:
  11345                     cl_width = 8;
  11346                     break;
  11347                 case bcmFieldQualifyInterfaceClassL3:
  11348                     cl_width = 8;
  11349                     break;
  11350                 default:
  11351                     return (BCM_E_INTERNAL);
  11352             }
  11353 
  11354             cl_max   = 1 << cl_width;
  11355             if (*data >= cl_max || (*mask != BCM_FIELD_EXACT_MATCH_MASK && *mask >= cl_max)) {
  11356                 return (BCM_E_PARAM);
  11357             }
  11358             break;
  11359 
  11360         case _BCM_FIELD_STAGE_EGRESS:
  11361             cl_width = 9;
  11362             cl_max   = 1 << cl_width;
  11363 
  11364             if (*data >= cl_max || (*mask != BCM_FIELD_EXACT_MATCH_MASK && *mask >= cl_max)) {
  11365                 return (BCM_E_PARAM);
  11366             }
  11367 
  11368             /* Need to set IFP_CLASS_TYPE in TCAM (upper 4 bits) */
  11369             switch (qual) {
  11370                 case bcmFieldQualifySrcClassL2:
  11371                     ifp_cl_type = 6;
  11372                     break;
  11373                 case bcmFieldQualifySrcClassL3:
  11374                     ifp_cl_type = 8;
  11375                     break;
  11376                 case bcmFieldQualifySrcClassField:
  11377                     ifp_cl_type = 4;
  11378                     break;
  11379                 case bcmFieldQualifyDstClassL2:
  11380                     ifp_cl_type = 7;
  11381                     break;
  11382                 case bcmFieldQualifyDstClassL3:
  11383                     ifp_cl_type = 9;
  11384                     break;
  11385                 case bcmFieldQualifyDstClassField:
  11386                     ifp_cl_type = 5;
  11387                     break;
  11388                 case bcmFieldQualifyInterfaceClassL2:
  11389                     ifp_cl_type = 10;
  11390                     break;
  11391                 case bcmFieldQualifyInterfaceClassL3:
  11392                     ifp_cl_type = 3;
  11393                     break;
  11394                 case bcmFieldQualifyIngressClassField:
  11395                     ifp_cl_type = 15;
  11396                     break;
  11397                 case bcmFieldQualifyIngressInterfaceClassPort:
  11398                     ifp_cl_type = 1;
  11399                     break;
  11400                 case bcmFieldQualifyIngressInterfaceClassVPort:
  11401                     ifp_cl_type = 2;
  11402                     break;
  11403                 default:
  11404                     return (BCM_E_INTERNAL);
  11405             }
  11406 
  11407             *data |= ifp_cl_type << cl_width;
  11408             *mask |= 0xf << cl_width;
  11409             break;
  11410 
  11411         default:
  11412             return (BCM_E_INTERNAL);
  11413     }
  11414 
  11415     return (BCM_E_NONE);
  11416 }
  11417 
  11418 /*
  11419  * Function:
  11420  *     _bcm_field_td2_qualify_class_get
  11421  * Purpose:
  11422  *     Retrieve field entry classifier id data and mask values
  11423  * Parameters:
  11424  *     unit  - (IN) BCM device number
  11425  *     entry - (IN) Field entry identifier
  11426  *     qual  - (IN) Field entry qualifier enumeration
  11427  *     data  - (IN/OUT) Classifier ID lookup key value
  11428  *     mask  - (IN/OUT) Classifier ID lookup mask value
  11429  * Returns:
  11430  *     BCM_E_XXXX
  11431  */
  11432 int
  11433 _bcm_field_td2_qualify_class_get(int unit,
  11434                                  bcm_field_entry_t entry,
  11435                                  bcm_field_qualify_t qual,
  11436                                  uint32 *data,
  11437                                  uint32 *mask
  11438                                  )
  11439 {
  11440     _field_entry_t *f_ent;
  11441     const uint32 m = (1 << 9) - 1;
  11442 
  11443     /* Get field entry part that contains the qualifier. */
  11444     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry, qual, &f_ent));
  11445 
  11446     if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
  11447         /* Mask off IFP_CLASSID_TYPE */
  11448         *data &= m;
  11449         *mask &= m;
  11450     }
  11451 
  11452     return (BCM_E_NONE);
  11453 }
  11454 
  11455 /*
  11456  * Function:
  11457  *     _bcm_field_td2_hash_select_profile_alloc_reserve_entry
  11458  * Purpose:
  11459  *     Index 0 of vfp_hash_field_bmap_table_a/b is invalid as the
  11460  *     hardware will consider hash bitmap selection from VFP only
  11461  *     if HASH_FIELD_BITMAP_PTR_A and HASH_FIELD_BITMAP_PTR_B are non-zero.
  11462  *     Making the entry to NULL.
  11463  * Parameters:
  11464  *     unit       - (IN) BCM device number.
  11465  *     stage_fc   - (IN) Field Processor stage structure.
  11466  *
  11467  * Returns:
  11468  *     BCM_E_NONE
  11469  * Notes:
  11470  */
  11471 int _bcm_field_td2_hash_select_profile_alloc_reserve_entry(int unit,
  11472                                             _field_stage_t *stage_fc)
  11473 {
  11474     vfp_hash_field_bmap_table_a_entry_t entry_arr[2];
  11475     uint32            *entry_ptr[2];
  11476     int               rv, ct;
  11477     void              *entries[1];
  11478     uint32            null = 0x0;
  11479     soc_mem_t         profile_mem[2] = { VFP_HASH_FIELD_BMAP_TABLE_Am,
  11480                                          VFP_HASH_FIELD_BMAP_TABLE_Bm };
  11481     uint32            hw_index = 0;
  11482 
  11483     if ((stage_fc == NULL) ||
  11484         (stage_fc->stage_id != _BCM_FIELD_STAGE_LOOKUP)) {
  11485         return BCM_E_PARAM;
  11486     }
  11487 
  11488     for (ct = 0; ct < 2; ct++) {
  11489         entry_ptr[0] = (uint32 *)entry_arr;
  11490         entry_ptr[1] = entry_ptr[0] +
  11491                            soc_mem_entry_words(unit, profile_mem[ct]);
  11492         entries[0] = (void *)&entry_arr;
  11493 
  11494         /* Reset hash select profile entry. */
  11495         sal_memcpy(entry_ptr[0], soc_mem_entry_null(unit, profile_mem[ct]),
  11496                    soc_mem_entry_words(unit, profile_mem[ct]) * sizeof(uint32));
  11497         sal_memcpy(entry_ptr[1], soc_mem_entry_null(unit, profile_mem[ct]),
  11498                    soc_mem_entry_words(unit, profile_mem[ct]) * sizeof(uint32));
  11499  
  11500         soc_mem_field_set(unit, profile_mem[ct], entry_ptr[0], 
  11501                             BITMAPf, &null);
  11502 
  11503         rv = soc_profile_mem_add(unit, &stage_fc->hash_select[ct], entries,
  11504                                  1, &hw_index);
  11505         BCM_IF_ERROR_RETURN(rv);
  11506         if (hw_index != 0) {
  11507            return BCM_E_INTERNAL;
  11508         }
  11509     }
  11510 
  11511     return BCM_E_NONE;
  11512 }
  11513 
  11514 #ifdef BCM_WARM_BOOT_SUPPORT
  11515 STATIC soc_field_t _td2_vfp_slice_wide_mode_field[4] = {
  11516     SLICE_0_DOUBLE_WIDE_MODEf,
  11517     SLICE_1_DOUBLE_WIDE_MODEf,
  11518     SLICE_2_DOUBLE_WIDE_MODEf,
  11519     SLICE_3_DOUBLE_WIDE_MODEf};
  11520 
  11521 /*
  11522  * Function:
  11523  *     _bcm_field_td2_scache_sync
  11524  *
  11525  * Purpose:
  11526  *     Save field module software state to external cache.
  11527  *
  11528  * Parameters:
  11529  *     unit             - (IN) BCM device number
  11530  *     fc               - (IN) Pointer to device field control structure
  11531  *     stage_fc         - (IN) FP stage control info.
  11532  *
  11533  * Returns:
  11534  *     BCM_E_XXX
  11535  */
  11536 int
  11537 _bcm_field_td2_scache_sync(int              unit,
  11538                            _field_control_t *fc,
  11539                            _field_stage_t   *stage_fc
  11540                            )
  11541 {
  11542     uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0];
  11543     uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1];
  11544     uint32 start_char, end_char;
  11545     uint32 val;
  11546     uint64 rval;
  11547     int slice_idx, range_count = 0;
  11548     int rv = BCM_E_NONE;
  11549     int efp_slice_mode, paired = 0;
  11550     _field_slice_t *fs;
  11551     _field_group_t *fg;
  11552     _field_data_control_t *data_ctrl;
  11553     _field_range_t *fr;
  11554     fp_port_field_sel_entry_t pfs;
  11555     soc_field_t fld;
  11556     int ratio = 0;
  11557     int idx;
  11558     _field_entry_t *f_ent;
  11559 
  11560     soc_field_t _fb2_slice_pairing_field[8] = {
  11561         SLICE1_0_PAIRINGf,   SLICE3_2_PAIRINGf,
  11562         SLICE5_4_PAIRINGf,   SLICE7_6_PAIRINGf,
  11563         SLICE9_8_PAIRINGf,   SLICE11_10_PAIRINGf,
  11564         SLICE13_12_PAIRINGf, SLICE15_14_PAIRINGf};
  11565     soc_field_t _efp_slice_mode[] = {SLICE_0_MODEf, SLICE_1_MODEf,
  11566                                      SLICE_2_MODEf, SLICE_3_MODEf};
  11567 
  11568     switch (stage_fc->stage_id) {
  11569         case _BCM_FIELD_STAGE_INGRESS:
  11570             start_char = _FIELD_IFP_DATA_START;
  11571             end_char = _FIELD_IFP_DATA_END;
  11572             break;
  11573         case _BCM_FIELD_STAGE_EGRESS:
  11574             start_char = _FIELD_EFP_DATA_START;
  11575             end_char = _FIELD_EFP_DATA_END;
  11576             break;
  11577         case _BCM_FIELD_STAGE_LOOKUP:
  11578             start_char = _FIELD_VFP_DATA_START;
  11579             end_char = _FIELD_VFP_DATA_END;
  11580             break;
  11581         case _BCM_FIELD_STAGE_EXTERNAL:
  11582             /*
  11583             if (_field_tr2_ext_scache_sync_chk(unit, fc, stage_fc)) {
  11584                 return (_field_tr2_ext_scache_sync(unit, fc, stage_fc));
  11585             } */
  11586             start_char = _FIELD_EXTFP_DATA_START;
  11587             end_char   = _FIELD_EXTFP_DATA_END;
  11588             break;
  11589         default:
  11590             return BCM_E_PARAM;
  11591     }
  11592 
  11593     LOG_DEBUG(BSL_LS_BCM_FP,
  11594               (BSL_META_U(unit,
  11595                           "FP(unit %d) vverb: _bcm_field_td2_scache_sync() - Synching scache"
  11596                            " for FP stage %d...\n"), unit, stage_fc->stage_id));
  11597 
  11598     _field_scache_stage_hdr_save(fc, start_char);
  11599 
  11600     /* Save the range check IDs */
  11601     if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) {
  11602         fr = stage_fc->ranges;
  11603         while (fr) {
  11604             fr = fr->next;
  11605             range_count++;
  11606         }
  11607         buf[fc->scache_pos] = (uint8)range_count;
  11608         fc->scache_pos++;
  11609         if (range_count) {
  11610             fr = stage_fc->ranges;
  11611             while (fr) {
  11612                 buf[fc->scache_pos] = fr->rid & 0xFF;
  11613                 fc->scache_pos++;
  11614                 buf[fc->scache_pos] = (fr->rid >> 8) & 0xFF;
  11615                 fc->scache_pos++;
  11616                 buf[fc->scache_pos] = (fr->rid >> 16) & 0xFF;
  11617                 fc->scache_pos++;
  11618                 buf[fc->scache_pos] = (fr->rid >> 24) & 0xFF;
  11619                 fc->scache_pos++;
  11620                 fr = fr->next;
  11621             }
  11622         }
  11623 
  11624         /* Sync Hints information */
  11625         if (soc_feature(unit, soc_feature_field_ingress_two_slice_types)) {
  11626             LOG_DEBUG(BSL_LS_BCM_FP,
  11627                     (BSL_META_U(unit,"Syncing hints @pos= %d\r\n"),
  11628                                                      fc->scache_pos));
  11629             BCM_IF_ERROR_RETURN (_bcm_field_hints_scache_sync(unit,
  11630 
  11631                         fc, stage_fc, &buf[fc->scache_pos]));
  11632         }
  11633 
  11634        /* Write data qual count */
  11635         buf[fc->scache_pos] = (uint8)(bcmFieldQualifyCount >> 8);
  11636         fc->scache_pos++;
  11637         buf[fc->scache_pos] = (uint8)bcmFieldQualifyCount;
  11638         fc->scache_pos++;
  11639 
  11640     }
  11641 
  11642     /* Save data qualifiers */
  11643     if ((data_ctrl = stage_fc->data_ctrl) != 0) {
  11644         if (soc_mem_is_valid(unit, FP_UDF_TCAMm)) {
  11645             /* Device has UDF TCAM =>
  11646                Save internal information regarding TCAM entry usage
  11647             */
  11648 
  11649             _field_data_tcam_entry_t *p;
  11650             unsigned                 n;
  11651 
  11652             for (p = data_ctrl->tcam_entry_arr,
  11653                      n = soc_mem_index_count(unit, FP_UDF_TCAMm);
  11654                  n;
  11655                  --n, ++p
  11656                  ) {
  11657                 buf[fc->scache_pos] = p->ref_count;
  11658                 fc->scache_pos++;
  11659             }
  11660         }
  11661 
  11662         _field_scache_sync_data_quals_write(fc, data_ctrl);
  11663     }
  11664 
  11665     _field_slice_map_write(unit, fc, stage_fc);
  11666 
  11667     for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) {
  11668         LOG_DEBUG(BSL_LS_BCM_FP,
  11669                   (BSL_META_U(unit,
  11670                               "FP(unit %d) vverb: _bcm_field_td2_scache_sync() - "
  11671                                "Checking slice %d...\n"), unit, slice_idx));
  11672         /* Skip slices without groups */
  11673         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
  11674         fg = fc->groups;
  11675         while (fg != NULL) {
  11676             if (fg->stage_id != stage_fc->stage_id) {
  11677                 fg = fg->next;
  11678                 continue; /* Not in this stage */
  11679             }
  11680             if (fg->slices[0].slice_number == slice_idx) {
  11681                 break;
  11682             }
  11683             fg = fg->next;
  11684         }
  11685 
  11686         if (fg == NULL) {
  11687             continue; /* No group found */
  11688         }
  11689 
  11690         /* Also skip expanded slices */
  11691         if ((stage_fc->slices[_FP_DEF_INST] + slice_idx)->prev != NULL) {
  11692             continue;
  11693         }
  11694 
  11695         paired = 0;
  11696 
  11697         /* Ignore secondary slice in paired mode */
  11698         switch (stage_fc->stage_id) {
  11699             case _BCM_FIELD_STAGE_INGRESS:
  11700                 BCM_IF_ERROR_RETURN(soc_mem_read(unit,
  11701                                                  FP_PORT_FIELD_SELm,
  11702                                                  MEM_BLOCK_ANY,
  11703                                                  0,
  11704                                                  &pfs));
  11705                 fld = _fb2_slice_pairing_field[slice_idx / 2];
  11706                 paired = soc_FP_PORT_FIELD_SELm_field32_get(unit,
  11707                                                             &pfs,
  11708                                                             fld);
  11709                 break;
  11710             case _BCM_FIELD_STAGE_EGRESS:
  11711                 BCM_IF_ERROR_RETURN(READ_EFP_SLICE_CONTROLr(unit, &val));
  11712                 efp_slice_mode = soc_reg_field_get(unit,
  11713                                      EFP_SLICE_CONTROLr,
  11714                                      val,
  11715                                      _efp_slice_mode[slice_idx]);
  11716                 if ((efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE)
  11717                     || (efp_slice_mode
  11718                     == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY)
  11719                     || (efp_slice_mode
  11720                     == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6)) {
  11721                     paired = 1;
  11722                 }
  11723                 break;
  11724             case _BCM_FIELD_STAGE_LOOKUP:
  11725                 BCM_IF_ERROR_RETURN(READ_VFP_KEY_CONTROL_1r(unit, &rval));
  11726                 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2];
  11727                 paired = soc_reg64_field32_get(unit,
  11728                             VFP_KEY_CONTROL_1r,
  11729                             rval,
  11730                             fld);
  11731                 break;
  11732             case _BCM_FIELD_STAGE_EXTERNAL:
  11733                 paired = 0;
  11734                 break;
  11735             default:
  11736                 return BCM_E_PARAM;
  11737                 break;
  11738         }
  11739         if (paired && (slice_idx % 2)) {
  11740             continue;
  11741         }
  11742         BCM_IF_ERROR_RETURN
  11743             (_field_tr2_group_entry_write(unit, _FP_DEF_INST,
  11744                                slice_idx, fs, fc, stage_fc));
  11745     }
  11746 
  11747     /* Now sync the expanded slices */
  11748     for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) {
  11749         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
  11750         /* Skip empty slices */
  11751         if (fs->entry_count == fs->free_count) {
  11752             LOG_DEBUG(BSL_LS_BCM_FP,
  11753                       (BSL_META_U(unit,
  11754                                   "FP(unit %d) vverb: _bcm_field_td2_scache_sync() -"
  11755                                    " Slice is empty.\n"), unit));
  11756             continue;
  11757         }
  11758 
  11759         /* Skip master slices */
  11760         if ((stage_fc->slices[_FP_DEF_INST] + slice_idx)->prev == NULL) {
  11761             continue;
  11762         }
  11763 
  11764         /* 
  11765          * Skip expanded slices with no entries installed in Hw
  11766          * to match recovery logic.
  11767          */
  11768         if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) {
  11769             ratio = 2;
  11770         } else {
  11771             ratio = 1;
  11772         }
  11773 
  11774         for (idx = 0; idx < fs->entry_count / ratio; idx++) {
  11775             /* Find EID that matches this HW index */
  11776             f_ent = fs->entries[idx];
  11777             if (f_ent == NULL) {
  11778                 continue;
  11779             }
  11780             if (!(f_ent->flags & _FP_ENTRY_INSTALLED)) {
  11781                 continue;
  11782             }
  11783             break;
  11784         }
  11785 
  11786         if (idx == (fs->entry_count / ratio)) {
  11787             continue;
  11788         }
  11789 
  11790         paired = 0;
  11791 
  11792         /* Ignore secondary slice in paired mode */
  11793         switch (stage_fc->stage_id) {
  11794             case _BCM_FIELD_STAGE_INGRESS:
  11795                 BCM_IF_ERROR_RETURN
  11796                     (soc_mem_read(unit,
  11797                         FP_PORT_FIELD_SELm,
  11798                         MEM_BLOCK_ANY,
  11799                         0,
  11800                         &pfs));
  11801                 fld = _fb2_slice_pairing_field[slice_idx / 2];
  11802                 paired = soc_FP_PORT_FIELD_SELm_field32_get(unit,
  11803                             &pfs,
  11804                             fld);
  11805                 break;
  11806             case _BCM_FIELD_STAGE_EGRESS:
  11807                 BCM_IF_ERROR_RETURN(READ_EFP_SLICE_CONTROLr(unit, &val));
  11808                 efp_slice_mode = soc_reg_field_get(unit,
  11809                                     EFP_SLICE_CONTROLr,
  11810                                     val,
  11811                                     _efp_slice_mode[slice_idx]);
  11812                 if ((efp_slice_mode == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE)
  11813                     || (efp_slice_mode
  11814                     == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY)
  11815                     || (efp_slice_mode
  11816                     == _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6)) {
  11817                     paired = 1;
  11818                 }
  11819                 break;
  11820             case _BCM_FIELD_STAGE_LOOKUP:
  11821                 BCM_IF_ERROR_RETURN(READ_VFP_KEY_CONTROL_1r(unit, &rval));
  11822                 fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2];
  11823                 paired = soc_reg64_field32_get(unit,
  11824                             VFP_KEY_CONTROL_1r,
  11825                             rval,
  11826                             fld);
  11827                 break;
  11828             case _BCM_FIELD_STAGE_EXTERNAL:
  11829                 paired = 0;
  11830                 break;
  11831             default:
  11832                 return BCM_E_PARAM;
  11833                 break;
  11834         }
  11835         if (paired && (slice_idx % 2)) {
  11836             continue;
  11837         }
  11838         BCM_IF_ERROR_RETURN
  11839             (_field_tr2_group_entry_write(unit, _FP_DEF_INST,
  11840                                slice_idx, fs, fc, stage_fc));
  11841     }
  11842 
  11843     if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_15) {
  11844        /* Mark end of Slice Info */
  11845        buf[fc->scache_pos] = _FP_WB_END_OF_SLICES;
  11846        fc->scache_pos++;
  11847     }
  11848 
  11849     if (soc_feature(unit, soc_feature_field_ingress_two_slice_types)) {
  11850         if ( stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS ||
  11851              stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS ||
  11852              stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP
  11853            ) {
  11854             LOG_DEBUG(BSL_LS_BCM_FP,
  11855                     (BSL_META_U(unit,"FP(unit %d) vverb:"
  11856                                 "_bcm_field_td2_scache_sync() -section "
  11857                                 "Writing  HintIds information @ byte %d.\n"),
  11858                                                         unit, fc->scache_pos));
  11859             BCM_IF_ERROR_RETURN (_bcm_hints_scache_hintid_sync (unit, stage_fc,
  11860                         &buf[fc->scache_pos]));
  11861         }
  11862     }
  11863 
  11864     if ((fc->wb_current_version) >= BCM_FIELD_WB_VERSION_1_15) {
  11865         /* Group Slice Selectors */
  11866         BCM_IF_ERROR_RETURN(_field_group_slice_selectors_sync(unit,
  11867                             &buf[fc->scache_pos], stage_fc->stage_id));
  11868     }
  11869 
  11870     LOG_DEBUG(BSL_LS_BCM_FP,
  11871               (BSL_META_U(unit,
  11872                           "FP(unit %d) vverb: _bcm_field_td2_scache_sync() -"
  11873                            " Writing end of section @ byte %d.\n"), unit, fc->scache_pos));
  11874 
  11875     /* Mark the end of the IFP section */
  11876     buf[fc->scache_pos] = end_char & 0xFF;
  11877     fc->scache_pos++;
  11878     buf[fc->scache_pos] = (end_char >> 8) & 0xFF;
  11879     fc->scache_pos++;
  11880     buf[fc->scache_pos] = (end_char >> 16) & 0xFF;
  11881     fc->scache_pos++;
  11882     buf[fc->scache_pos] = (end_char >> 24) & 0xFF;
  11883     fc->scache_pos++;
  11884     fc->scache_usage = fc->scache_pos; /* Usage in bytes */
  11885 
  11886     if(NULL != buf1) {
  11887         /* Mark the end of the IFP section */
  11888         buf1[fc->scache_pos1] = end_char & 0xFF;
  11889         fc->scache_pos1++;
  11890         buf1[fc->scache_pos1] = (end_char >> 8) & 0xFF;
  11891         fc->scache_pos1++;
  11892         buf1[fc->scache_pos1] = (end_char >> 16) & 0xFF;
  11893         fc->scache_pos1++;
  11894         buf1[fc->scache_pos1] = (end_char >> 24) & 0xFF;
  11895         fc->scache_pos1++;
  11896     }
  11897 
  11898     /* Check for overflow */
  11899     if (fc->scache_pos > fc->scache_size[_FIELD_SCACHE_PART_0]) {
  11900         LOG_DEBUG(BSL_LS_BCM_FP,
  11901                 (BSL_META_U(unit,
  11902                             "FP(unit %d) Error: Current Scache Position[%u] exceeds Scache size[%u]\n"),
  11903                  unit, fc->scache_pos, fc->scache_size[_FIELD_SCACHE_PART_0]));
  11904         return BCM_E_INTERNAL;
  11905     }
  11906 
  11907     if (buf1 != NULL) {
  11908         if (fc->scache_pos1 > fc->scache_size[_FIELD_SCACHE_PART_1]) {
  11909             LOG_DEBUG(BSL_LS_BCM_FP,
  11910                     (BSL_META_U(unit,
  11911                                 "FP(unit %d) Error: Current Scache Position1[%u] exceeds Scache size[%u]\n"),
  11912                      unit, fc->scache_pos1, fc->scache_size[_FIELD_SCACHE_PART_1]));
  11913             return BCM_E_INTERNAL;
  11914         }
  11915     }
  11916 
  11917     return rv;
  11918 }
  11919 
  11920 /*
  11921  * Function:
  11922  *     _bcm_field_td2_stage_lookup_reinit
  11923  *
  11924  * Purpose:
  11925  *     Reconstruct's VFP/Lookup stage groups and entries.
  11926  *
  11927  * Parameters:
  11928  *     unit             - (IN) BCM device number.
  11929  *     fc               - (IN) Device field control structure pointer.
  11930  *     stage_fc         - (IN) FP stage control info.
  11931  *
  11932  * Returns:
  11933  *     BCM_E_XXX
  11934  */
  11935 int
  11936 _bcm_field_td2_stage_lookup_reinit(int unit,
  11937                                _field_control_t *fc,
  11938                                _field_stage_t *stage_fc)
  11939 {
  11940     int vslice_idx, max, master_slice;
  11941     int idx, idx1, slice_idx, index_min, index_max, ratio, rv = BCM_E_NONE;
  11942     int group_found, mem_sz, parts_count, slice_ent_cnt, expanded[4], slice_master_idx[4];
  11943     int i, pri_tcam_idx, part_index, slice_number, prev_prio, multigroup;
  11944     int paired, intraslice;
  11945     char *vfp_policy_buf = NULL; /* Buffer to read the VFP_POLICY table */
  11946     uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0];
  11947     uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1];
  11948     uint32 rval, dbl_wide_key, dbl_wide_key_sec;
  11949     uint32 *vfp_tcam_buf = NULL; /* Buffer to read the VFP_TCAM table */
  11950     uint32 vfp_key2, temp;
  11951     uint64 vfp_key_1;
  11952     soc_field_t fld;
  11953     vfp_tcam_entry_t *vfp_tcam_entry;
  11954     vfp_policy_table_entry_t *vfp_policy_entry;
  11955     _field_hw_qual_info_t hw_sels;
  11956     _field_slice_t *fs;
  11957     _field_group_t *fg;
  11958     _field_entry_t *f_ent = NULL;
  11959     bcm_pbmp_t entry_pbmp, temp_pbmp;
  11960     uint8 old_physical_slice, slice_num;
  11961     uint32 entry_flags;
  11962     _field_slice_t *fs_temp = NULL;
  11963 #if defined(BCM_APACHE_SUPPORT)
  11964     int offset_mode = 0, policer_index = 0;
  11965 #endif
  11966     soc_field_t vfp_en_flds[4] = {SLICE_ENABLE_SLICE_0f,
  11967                                   SLICE_ENABLE_SLICE_1f,
  11968                                   SLICE_ENABLE_SLICE_2f,
  11969                                   SLICE_ENABLE_SLICE_3f};
  11970 
  11971     soc_field_t vfp_lk_en_flds[4] = {LOOKUP_ENABLE_SLICE_0f,
  11972                                      LOOKUP_ENABLE_SLICE_1f,
  11973                                      LOOKUP_ENABLE_SLICE_2f,
  11974                                      LOOKUP_ENABLE_SLICE_3f};
  11975     static const soc_field_t s_type_fld_tbl[] = {
  11976         SLICE_0_S_TYPE_SELf,
  11977         SLICE_1_S_TYPE_SELf,
  11978         SLICE_2_S_TYPE_SELf,
  11979         SLICE_3_S_TYPE_SELf
  11980     };
  11981 
  11982     _field_action_bmp_t action_bmp;
  11983     _field_entry_wb_info_t f_ent_wb_info;
  11984 
  11985     /* Reset Action bitmap to NULL. */
  11986     action_bmp.w = NULL;
  11987 
  11988     SOC_PBMP_CLEAR(entry_pbmp);
  11989     sal_memset(expanded, 0, 4 * sizeof(int));
  11990     sal_memset(slice_master_idx, 0, 4 * sizeof(int));
  11991 
  11992     if (fc->l2warm) {
  11993         rv = _field_scache_stage_hdr_chk(fc, _FIELD_VFP_DATA_START);
  11994         if (BCM_FAILURE(rv)) {
  11995             return (rv);
  11996         }
  11997     }
  11998 
  11999     /* DMA various tables */
  12000     vfp_tcam_buf = soc_cm_salloc(unit,
  12001                     sizeof(vfp_tcam_entry_t) *
  12002                     soc_mem_index_count(unit, VFP_TCAMm),
  12003                     "VFP TCAM buffer");
  12004     if (NULL == vfp_tcam_buf) {
  12005         return BCM_E_MEMORY;
  12006     }
  12007 
  12008     sal_memset(vfp_tcam_buf,
  12009                0,
  12010                sizeof(vfp_tcam_entry_t) *
  12011                soc_mem_index_count(unit, VFP_TCAMm)
  12012                );
  12013     index_min = soc_mem_index_min(unit, VFP_TCAMm);
  12014     index_max = soc_mem_index_max(unit, VFP_TCAMm);
  12015 
  12016     fs = stage_fc->slices[_FP_DEF_INST];
  12017 
  12018     if (stage_fc->flags & _FP_STAGE_HALF_SLICE) {
  12019         slice_ent_cnt = fs->entry_count * 2;
  12020         /* DMA in chunks */
  12021         for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) {
  12022             fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
  12023             if ((rv = soc_mem_read_range
  12024                         (unit,
  12025                          VFP_TCAMm, MEM_BLOCK_ALL,
  12026                          slice_idx * slice_ent_cnt,
  12027                          slice_idx * slice_ent_cnt + fs->entry_count / 2 - 1,
  12028                          vfp_tcam_buf + slice_idx * slice_ent_cnt
  12029                          * soc_mem_entry_words(unit, VFP_TCAMm))
  12030                          ) < 0) {
  12031                 goto cleanup;
  12032             }
  12033 
  12034             if ((rv = soc_mem_read_range(unit,
  12035                         VFP_TCAMm, MEM_BLOCK_ALL,
  12036                         slice_idx * slice_ent_cnt + fs->entry_count,
  12037                         slice_idx * slice_ent_cnt
  12038                         + fs->entry_count + fs->entry_count / 2 - 1,
  12039                         vfp_tcam_buf + (slice_idx
  12040                         * slice_ent_cnt + fs->entry_count)
  12041                         * soc_mem_entry_words(unit, VFP_TCAMm))
  12042                         ) < 0 ) {
  12043                 goto cleanup;
  12044             }
  12045         }
  12046     } else {
  12047         slice_ent_cnt = fs->entry_count;
  12048         if ((rv = soc_mem_read_range(unit,
  12049                     VFP_TCAMm,
  12050                     MEM_BLOCK_ALL,
  12051                     index_min,
  12052                     index_max,
  12053                     vfp_tcam_buf)
  12054                     ) < 0 ) {
  12055             goto cleanup;
  12056         }
  12057     }
  12058 
  12059     vfp_policy_buf = soc_cm_salloc(unit,
  12060                         SOC_MEM_TABLE_BYTES(unit, VFP_POLICY_TABLEm),
  12061                         "VFP POLICY TABLE buffer"
  12062                         );
  12063     if (NULL == vfp_policy_buf) {
  12064         return BCM_E_MEMORY;
  12065     }
  12066     index_min = soc_mem_index_min(unit, VFP_POLICY_TABLEm);
  12067     index_max = soc_mem_index_max(unit, VFP_POLICY_TABLEm);
  12068     if ((rv = soc_mem_read_range(unit,
  12069                 VFP_POLICY_TABLEm,
  12070                 MEM_BLOCK_ALL,
  12071                 index_min,
  12072                 index_max,
  12073                 vfp_policy_buf)
  12074                 ) < 0 ) {
  12075         goto cleanup;
  12076     }
  12077 
  12078     /* Get slice expansion status and virtual map */
  12079     if ((rv = _field_slice_expanded_status_get
  12080                 (unit,
  12081                  fc,
  12082                  stage_fc,
  12083                  expanded,
  12084                  slice_master_idx)
  12085                 ) < 0) {
  12086         goto cleanup;
  12087     }
  12088 
  12089     /* Iterate over the slices */
  12090     if ((rv = READ_VFP_SLICE_CONTROLr(unit, &rval)) < 0) {
  12091         goto cleanup;
  12092     }
  12093 
  12094     if ((rv = READ_VFP_KEY_CONTROL_1r(unit, &vfp_key_1)) < 0) {
  12095         goto cleanup;
  12096     }
  12097 
  12098     if ((rv = READ_VFP_KEY_CONTROL_2r(unit, &vfp_key2)) < 0) {
  12099         goto cleanup;
  12100     }
  12101 
  12102     for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) {
  12103 
  12104         /* Ignore disabled slice */
  12105         if ((soc_reg_field_get
  12106                 (unit,
  12107                  VFP_SLICE_CONTROLr,
  12108                  rval,
  12109                  vfp_en_flds[slice_idx]
  12110                  ) == 0)
  12111             || (soc_reg_field_get
  12112                     (unit,
  12113                      VFP_SLICE_CONTROLr,
  12114                      rval, vfp_lk_en_flds[slice_idx]
  12115                      ) == 0)) {
  12116             continue;
  12117         }
  12118 
  12119         /* Ignore secondary slice in paired mode */
  12120         fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2];
  12121         paired = soc_reg64_field32_get
  12122                     (unit,
  12123                      VFP_KEY_CONTROL_1r,
  12124                      vfp_key_1,
  12125                      fld
  12126                      );
  12127 
  12128         fld = _td2_vfp_slice_wide_mode_field[slice_idx];
  12129         intraslice = soc_reg64_field32_get
  12130                         (unit,
  12131                          VFP_KEY_CONTROL_1r,
  12132                          vfp_key_1,
  12133                          fld
  12134                          );
  12135         if (paired && (slice_idx % 2)) {
  12136             continue;
  12137         }
  12138 
  12139         /* Don't need to read selectors for expanded slice */
  12140         if (expanded[slice_idx]) {
  12141             continue;
  12142         }
  12143 
  12144         /* Skip if slice has no valid groups and entries */
  12145         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
  12146         for (idx = 0; idx < slice_ent_cnt; idx++) {
  12147             vfp_tcam_entry = soc_mem_table_idx_to_pointer
  12148                                 (unit,
  12149                                  VFP_TCAMm,
  12150                                  vfp_tcam_entry_t *,
  12151                                  vfp_tcam_buf, idx + slice_ent_cnt
  12152                                  * slice_idx
  12153                                  );
  12154             if (soc_VFP_TCAMm_field32_get(unit,
  12155                                           vfp_tcam_entry,
  12156                                           VALIDf) != 0) {
  12157                 break;
  12158             }
  12159         }
  12160         if (idx == slice_ent_cnt && !fc->l2warm) {
  12161             continue;
  12162         }
  12163         /* If Level 2, retrieve the GIDs in this slice */
  12164         if (fc->l2warm) {
  12165             rv = _field_trx_scache_slice_group_recover(unit,
  12166                                                        fc, _FP_DEF_INST,
  12167                                                        slice_idx,
  12168                                                        &multigroup,
  12169                                                        stage_fc,
  12170                                                        0);
  12171             if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) {
  12172                 fc->l2warm = 0;
  12173                 goto cleanup;
  12174             }
  12175             if (rv == BCM_E_NOT_FOUND) {
  12176                 rv = BCM_E_NONE;
  12177                 continue;
  12178             }
  12179         }
  12180 
  12181         /* Construct the group based on HW selector values */
  12182         _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[0]);
  12183         hw_sels.pri_slice[0].intraslice = _FP_SELCODE_DONT_USE;
  12184         _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[1]);
  12185         hw_sels.pri_slice[1].intraslice = _FP_SELCODE_DONT_USE;
  12186         _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[0]);
  12187         hw_sels.sec_slice[0].intraslice = _FP_SELCODE_DONT_USE;
  12188         _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[1]);
  12189         hw_sels.sec_slice[1].intraslice = _FP_SELCODE_DONT_USE;
  12190 
  12191         /* Get primary slice's selectors */
  12192         hw_sels.pri_slice[0].fpf1 = 0;
  12193         hw_sels.pri_slice[0].fpf2
  12194             = soc_reg64_field32_get
  12195                 (unit,
  12196                  VFP_KEY_CONTROL_1r,
  12197                  vfp_key_1,
  12198                  _bcm_field_trx_vfp_field_sel[slice_idx][0]
  12199                  );
  12200         hw_sels.pri_slice[0].fpf3
  12201             = soc_reg64_field32_get
  12202                 (unit,
  12203                  VFP_KEY_CONTROL_1r,
  12204                  vfp_key_1,
  12205                  _bcm_field_trx_vfp_field_sel[slice_idx][1]
  12206                  );
  12207 
  12208         hw_sels.pri_slice[0].ip_header_sel
  12209             = soc_reg_field_get
  12210                 (unit,
  12211                  VFP_KEY_CONTROL_2r,
  12212                  vfp_key2,
  12213                  _bcm_field_trx_vfp_ip_header_sel[slice_idx]
  12214                  );
  12215 
  12216         hw_sels.pri_slice[0].src_entity_sel
  12217             = soc_reg64_field32_get(unit,
  12218                     VFP_KEY_CONTROL_1r,
  12219                     vfp_key_1,
  12220                     s_type_fld_tbl[slice_idx]
  12221                     );
  12222 
  12223         /* If intraslice, get double-wide key - only 2 options */
  12224         if (intraslice) {
  12225             dbl_wide_key = soc_reg64_field32_get
  12226                             (unit,
  12227                              VFP_KEY_CONTROL_1r,
  12228                              vfp_key_1,
  12229                              _bcm_field_trx_vfp_double_wide_sel[slice_idx]
  12230                              );
  12231             hw_sels.pri_slice[1].intraslice = TRUE;
  12232             hw_sels.pri_slice[1].fpf2 = dbl_wide_key;
  12233             hw_sels.pri_slice[1].fpf3 = 0;
  12234             hw_sels.pri_slice[1].ip_header_sel
  12235                 = soc_reg_field_get
  12236                     (unit,
  12237                      VFP_KEY_CONTROL_2r,
  12238                      vfp_key2,
  12239                     _bcm_field_trx_vfp_ip_header_sel[slice_idx]
  12240                     );
  12241 
  12242             hw_sels.pri_slice[1].src_entity_sel
  12243                 = soc_reg64_field32_get(unit,
  12244                         VFP_KEY_CONTROL_1r,
  12245                         vfp_key_1,
  12246                         s_type_fld_tbl[slice_idx]
  12247                         );
  12248         }
  12249 
  12250         /* If paired, get secondary slice's selectors */
  12251         if (paired) {
  12252             hw_sels.sec_slice[0].fpf1 = 0;
  12253             hw_sels.sec_slice[0].fpf2
  12254                 = soc_reg64_field32_get
  12255                     (unit,
  12256                      VFP_KEY_CONTROL_1r,
  12257                      vfp_key_1,
  12258                      _bcm_field_trx_vfp_field_sel[slice_idx + 1][0]
  12259                      );
  12260             hw_sels.sec_slice[0].fpf3
  12261                 = soc_reg64_field32_get
  12262                     (unit,
  12263                      VFP_KEY_CONTROL_1r,
  12264                      vfp_key_1,
  12265                      _bcm_field_trx_vfp_field_sel[slice_idx + 1][1]
  12266                      );
  12267             hw_sels.sec_slice[0].ip_header_sel
  12268                 = soc_reg_field_get
  12269                     (unit,
  12270                      VFP_KEY_CONTROL_2r, vfp_key2,
  12271                      _bcm_field_trx_vfp_ip_header_sel[slice_idx + 1]
  12272                      );
  12273 
  12274             hw_sels.sec_slice[0].src_entity_sel
  12275                 = soc_reg64_field32_get(unit,
  12276                         VFP_KEY_CONTROL_1r,
  12277                         vfp_key_1,
  12278                         s_type_fld_tbl[slice_idx+1]
  12279                         );
  12280 
  12281             /* If in intraslie double wide mode, get DW keysel value. */
  12282             if (intraslice) {
  12283                 dbl_wide_key_sec
  12284                     = soc_reg64_field32_get
  12285                         (unit,
  12286                          VFP_KEY_CONTROL_1r,
  12287                          vfp_key_1,
  12288                          _bcm_field_trx_vfp_double_wide_sel[slice_idx + 1]
  12289                          );
  12290                 hw_sels.sec_slice[1].intraslice = TRUE;
  12291                 hw_sels.sec_slice[1].fpf2 = dbl_wide_key_sec;
  12292                 hw_sels.sec_slice[1].fpf3 = 0;
  12293                 hw_sels.sec_slice[1].ip_header_sel
  12294                     = soc_reg_field_get
  12295                         (unit,
  12296                          VFP_KEY_CONTROL_2r,
  12297                          vfp_key2,
  12298                          _bcm_field_trx_vfp_ip_header_sel[slice_idx + 1]
  12299                          );
  12300 
  12301                 hw_sels.sec_slice[1].src_entity_sel
  12302                     = soc_reg64_field32_get(unit,
  12303                             VFP_KEY_CONTROL_1r,
  12304                             vfp_key_1,
  12305                             s_type_fld_tbl[slice_idx+1]
  12306                             );
  12307             }
  12308         }
  12309 
  12310         /* Create a group based on HW qualifiers (or find existing) */
  12311         rv = _field_tr2_group_construct
  12312                 (unit, _FP_DEF_INST, &hw_sels, intraslice,
  12313                  paired, fc, -1,
  12314                  _BCM_FIELD_STAGE_LOOKUP,
  12315                  slice_idx
  12316                  );
  12317         if (BCM_FAILURE(rv)) {
  12318             goto cleanup;
  12319         }
  12320         /* Now go over the entries */
  12321         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
  12322         if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) {
  12323             fs->free_count >>= 1;
  12324             ratio = 2;
  12325         } else {
  12326             ratio = 1;
  12327         }
  12328         prev_prio = -1;
  12329         for (idx = 0; idx < slice_ent_cnt / ratio; idx++) {
  12330             group_found = 0;
  12331             vfp_tcam_entry = soc_mem_table_idx_to_pointer
  12332                                  (unit,
  12333                                   VFP_TCAMm,
  12334                                   vfp_tcam_entry_t *, vfp_tcam_buf,
  12335                                   idx + slice_ent_cnt * slice_idx
  12336                                   );
  12337             if (soc_VFP_TCAMm_field32_get
  12338                     (unit,
  12339                      vfp_tcam_entry,
  12340                      VALIDf
  12341                      ) == 0) {
  12342                 continue;
  12343             }
  12344 
  12345             /* All ports are applicable to this entry */
  12346             SOC_PBMP_ASSIGN(entry_pbmp, PBMP_PORT_ALL(unit));
  12347             SOC_PBMP_OR(entry_pbmp, PBMP_CMIC(unit));
  12348 
  12349             /* Search groups to find match */
  12350             fg = fc->groups;
  12351             while (fg != NULL) {
  12352 
  12353                 /* Check if group is in this slice */
  12354                 fs = &fg->slices[0];
  12355                 if (fs->slice_number != slice_idx) {
  12356                     fg = fg->next;
  12357                     continue;
  12358                 }
  12359 
  12360                 /* Check if entry_pbmp is a subset of group pbmp */
  12361                 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp);
  12362                 SOC_PBMP_AND(temp_pbmp, entry_pbmp);
  12363                 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) {
  12364                     group_found = 1;
  12365                     break;
  12366                 }
  12367                 fg = fg->next;
  12368             }
  12369 
  12370             if (!group_found) {
  12371                 return BCM_E_INTERNAL; /* Should never happen */
  12372             }
  12373 
  12374             /* Allocate memory for the entry */
  12375             rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id,
  12376                                                    fg->flags, &parts_count);
  12377             if (BCM_FAILURE(rv)) {
  12378                 goto cleanup;
  12379             }
  12380 
  12381             mem_sz = parts_count * sizeof (_field_entry_t);
  12382             _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry");
  12383             if (f_ent == NULL) {
  12384                 rv = BCM_E_MEMORY;
  12385                 goto cleanup;
  12386             }
  12387             for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) {
  12388                  f_ent->policer[idx1].pid = _FP_INVALID_INDEX;
  12389             }
  12390 
  12391 
  12392             sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t));
  12393             f_ent_wb_info.action_bmp = &action_bmp;
  12394             f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1;
  12395             if (fc->l2warm) {
  12396                 if ((fc->wb_recovered_version) > BCM_FIELD_WB_VERSION_1_14) {
  12397                    action_bmp.w = NULL;
  12398                    _FP_XGS3_ALLOC(action_bmp.w,
  12399                             SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount),
  12400                             "Action No Param Bitmap");
  12401                    if (action_bmp.w == NULL) {
  12402                        rv = BCM_E_MEMORY;
  12403                        sal_free(f_ent);
  12404                        goto cleanup;
  12405                    }
  12406                 }
  12407 
  12408                 rv = _field_trx_entry_info_retrieve(unit,
  12409                                                     fc,
  12410                                                     stage_fc,
  12411                                                     multigroup,
  12412                                                     &prev_prio,
  12413                                                     &f_ent_wb_info
  12414                                                     );
  12415                 if (BCM_FAILURE(rv)) {
  12416                     sal_free(f_ent);
  12417                     goto cleanup;
  12418                 }
  12419             } else {
  12420                 _bcm_field_last_alloc_eid_incr(unit);
  12421             }
  12422 
  12423             pri_tcam_idx = idx + slice_ent_cnt * slice_idx;
  12424             for (i = 0; i < parts_count; i++) {
  12425                 if (fc->l2warm) {
  12426                     /* Use retrieved EID */
  12427                     f_ent[i].eid = f_ent_wb_info.eid;
  12428                     /* Set retrieved dvp_type and svp_type */
  12429                     f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i];
  12430                     f_ent[i].svp_type = f_ent_wb_info.svp_type[i];
  12431                     f_ent[i].prio = f_ent_wb_info.prio;
  12432                 } else {
  12433                     f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit);
  12434                     f_ent[i].prio = (slice_idx << 10) | (slice_ent_cnt - idx);
  12435                 }
  12436                 f_ent[i].group = fg;
  12437                 rv = _bcm_field_tcam_part_to_entry_flags
  12438                         (unit, i,
  12439                          fg,
  12440                          &f_ent[i].flags
  12441                          );
  12442                 if (BCM_FAILURE(rv)) {
  12443                     sal_free(f_ent);
  12444                     goto cleanup;
  12445                 }
  12446                 if (f_ent_wb_info.color_independent) {
  12447                     f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT;
  12448                 }
  12449                 rv = _bcm_field_entry_part_tcam_idx_get
  12450                         (unit,
  12451                          f_ent,
  12452                          pri_tcam_idx,
  12453                          i,
  12454                          &part_index
  12455                          );
  12456                 if (BCM_FAILURE(rv)) {
  12457                     sal_free(f_ent);
  12458                     goto cleanup;
  12459                 }
  12460                 rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc,
  12461                          _FP_DEF_INST, part_index,       
  12462                          &slice_number,
  12463                          (int *)&f_ent[i].slice_idx
  12464                          );
  12465                 if (BCM_FAILURE(rv)) {
  12466                     sal_free(f_ent);
  12467                     goto cleanup;
  12468                 }
  12469                 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number;
  12470                 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) {
  12471                     /* Decrement slice free entry count for primary
  12472                        entries. */
  12473                     f_ent[i].fs->free_count--;
  12474                 }
  12475                 /* Assign entry to a slice */
  12476                 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i;
  12477                 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp);
  12478                 f_ent[i].flags |= _FP_ENTRY_INSTALLED;
  12479 
  12480                 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, VALIDf) == 3) {
  12481                     f_ent[i].flags |= _FP_ENTRY_ENABLED;
  12482                 }
  12483 
  12484                 /* Get the actions associated with this part of the entry */
  12485                 vfp_policy_entry = soc_mem_table_idx_to_pointer
  12486                                     (unit,
  12487                                      VFP_POLICY_TABLEm,
  12488                                      vfp_policy_table_entry_t *,
  12489                                      vfp_policy_buf,
  12490                                      part_index
  12491                                      );
  12492                 rv = _field_tr2_actions_recover
  12493                         (unit,
  12494                          VFP_POLICY_TABLEm,
  12495                          (uint32 *) vfp_policy_entry,
  12496                          f_ent,
  12497                          i,
  12498                          &f_ent_wb_info);
  12499                 if (BCM_FAILURE(rv)) {
  12500                     sal_free(f_ent);
  12501                     goto cleanup;
  12502                 }
  12503    
  12504                 if (action_bmp.w != NULL) {
  12505                    _FP_ACTION_BMP_FREE(action_bmp);
  12506                    action_bmp.w = NULL;
  12507                 }
  12508 
  12509                 if (soc_feature(unit, soc_feature_advanced_flex_counter)) {
  12510                     _field_adv_flex_stat_info_retrieve(unit, f_ent->statistic.sid);
  12511                 }
  12512 #if defined(BCM_APACHE_SUPPORT)
  12513                 if (SOC_IS_APACHE(unit) && !SOC_IS_MONTEREY(unit)) {
  12514                     policer_index = PolicyGet(unit,
  12515                                     VFP_POLICY_TABLEm,
  12516                                     vfp_policy_entry,
  12517                                     SVC_METER_INDEXf);
  12518 
  12519                     offset_mode  = PolicyGet(unit,
  12520                                    VFP_POLICY_TABLEm,
  12521                                    vfp_policy_entry,
  12522                                    SVC_METER_OFFSET_MODEf);
  12523 
  12524                     rv = _bcm_esw_get_policer_id_from_index_offset(unit,
  12525                                    policer_index, offset_mode,
  12526                                    &(f_ent->global_meter_policer.pid));
  12527 
  12528                     if (BCM_FAILURE(rv)) {
  12529                         sal_free(f_ent);
  12530                         goto cleanup;
  12531                     }
  12532 
  12533                     f_ent->global_meter_policer.flags = PolicyGet(unit,
  12534                                                  VFP_POLICY_TABLEm,
  12535                                                  vfp_policy_entry,
  12536                                                  SVC_METER_INDEX_PRIORITYf);
  12537                 }
  12538 #endif /* BCM_APACHE_SUPPORT */
  12539             }
  12540             /* Add to the group */
  12541             rv = _field_group_entry_add(unit, fg, f_ent);
  12542             if (BCM_FAILURE(rv)) {
  12543                 sal_free(f_ent);
  12544                 goto cleanup;
  12545             }
  12546             f_ent = NULL;
  12547         }
  12548         /* Free up the temporary slice group info */
  12549         if (fc->l2warm) {
  12550             if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) {
  12551                 /* update selcode and construct group qual offset */
  12552                 rv = _field_tr2_group_construct_quals_with_sel_update(unit, fc, stage_fc);
  12553                 if (BCM_FAILURE(rv)) {
  12554                     goto cleanup;
  12555                 }
  12556             }
  12557             _field_scache_slice_group_free(unit,
  12558                                            fc,
  12559                                            slice_idx
  12560                                            );
  12561         }
  12562     }
  12563 
  12564     /* Now go over the expanded slices */
  12565     for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) {
  12566         if (!expanded[slice_idx]) {
  12567             continue;
  12568         }
  12569         /* Ignore secondary slice in paired mode */
  12570         fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2];
  12571         paired = soc_reg64_field32_get
  12572                     (unit,
  12573                      VFP_KEY_CONTROL_1r,
  12574                      vfp_key_1,
  12575                      fld
  12576                      );
  12577         if (paired && (slice_idx % 2)) {
  12578             continue;
  12579         }
  12580         /* Skip if slice has no valid groups and entries */
  12581         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
  12582         for (idx = 0; idx < slice_ent_cnt; idx++) {
  12583             vfp_tcam_entry = soc_mem_table_idx_to_pointer
  12584                                  (unit,
  12585                                   VFP_TCAMm,
  12586                                   vfp_tcam_entry_t *,
  12587                                   vfp_tcam_buf,
  12588                                   idx + slice_ent_cnt * slice_idx
  12589                                   );
  12590             if (soc_VFP_TCAMm_field32_get
  12591                     (unit,
  12592                      vfp_tcam_entry,
  12593                      VALIDf) != 0) {
  12594                 break;
  12595             }
  12596         }
  12597 
  12598         if (idx == slice_ent_cnt) {
  12599             continue;
  12600         }
  12601 
  12602         /* If Level 2, retrieve the GIDs in this slice */
  12603         if (fc->l2warm) {
  12604             rv = _field_trx_scache_slice_group_recover
  12605                     (unit,
  12606                      fc, _FP_DEF_INST,
  12607                      slice_idx,
  12608                      &multigroup,
  12609                      stage_fc,
  12610                      0);
  12611             if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) {
  12612                 fc->l2warm = 0;
  12613                 goto cleanup;
  12614             }
  12615             if (rv == BCM_E_NOT_FOUND) {
  12616                 rv = BCM_E_NONE;
  12617                 continue;
  12618             }
  12619         }
  12620 
  12621         /* Now find the master slice for this virtual group */
  12622         vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST,
  12623                                                 slice_idx, stage_fc);
  12624         if (vslice_idx < 0) {
  12625             rv = BCM_E_INTERNAL;
  12626             goto cleanup;
  12627         }
  12628 
  12629         if (fc->l2warm
  12630                 && ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_8)) {
  12631             master_slice = slice_master_idx[slice_idx];
  12632         } else {
  12633         max = -1;
  12634         for (i = 0; i < stage_fc->tcam_slices; i++) {
  12635             if ((stage_fc->vmap[_FP_DEF_INST][0][vslice_idx].virtual_group ==
  12636                 stage_fc->vmap[_FP_DEF_INST][0][i].virtual_group) && (i != vslice_idx)) {
  12637                 if (i > max) {
  12638                     max = i;
  12639                 }
  12640             }
  12641         }
  12642         if (max < 0) {
  12643             rv = BCM_E_INTERNAL;
  12644             goto cleanup;
  12645         }
  12646 
  12647         master_slice = stage_fc->vmap[_FP_DEF_INST][0][max].vmap_key;
  12648         }
  12649         /* See which group is in this slice - can be only one */
  12650         fg = fc->groups;
  12651         while (fg != NULL) {
  12652             /* Check if group is in this slice */
  12653             fs = &fg->slices[0];
  12654             if ((fg->stage_id == stage_fc->stage_id)
  12655                     && (fs->slice_number == master_slice)) {
  12656                 break;
  12657             }
  12658             fg = fg->next;
  12659         }
  12660         if (fg == NULL) {
  12661             rv = BCM_E_INTERNAL;
  12662             goto cleanup;
  12663         }
  12664 
  12665         /* Get number of entry parts for the group. */
  12666         rv = _bcm_field_entry_tcam_parts_count (unit, fg->stage_id,
  12667                                                 fg->flags, &parts_count);
  12668         BCM_IF_ERROR_RETURN(rv);
  12669 
  12670         old_physical_slice = fs->slice_number;
  12671 
  12672         /* Set up the new physical slice parameters in Software */
  12673         for(part_index = parts_count - 1; part_index >= 0; part_index--) {
  12674             /* Get entry flags. */
  12675             rv = _bcm_field_tcam_part_to_entry_flags(unit, part_index, fg, &entry_flags);
  12676             BCM_IF_ERROR_RETURN(rv);
  12677 
  12678             /* Get slice id for entry part */
  12679             rv = _bcm_field_tcam_part_to_slice_number(unit, part_index,
  12680                                                       fg, &slice_num);
  12681             BCM_IF_ERROR_RETURN(rv);
  12682 
  12683             /* Get slice pointer. */
  12684             fs = stage_fc->slices[_FP_DEF_INST] + slice_idx
  12685                     + slice_num;
  12686 
  12687             if (0 == (entry_flags & _FP_ENTRY_SECOND_HALF)) {
  12688                 /* Set per slice configuration &  number of free entries in the slice.*/
  12689                 fs->free_count = fs->entry_count;
  12690                 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) {
  12691                     fs->free_count >>= 1;
  12692                 }
  12693                 /* Set group flags in in slice.*/
  12694                 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK;
  12695 
  12696                 /* Add slice to slices linked list . */
  12697                 fs_temp = stage_fc->slices[_FP_DEF_INST] + old_physical_slice + slice_num;
  12698                 /* To handle more than one auto expanded slice in a group */
  12699                 while (fs_temp->next != NULL) {
  12700                     fs_temp = fs_temp->next;
  12701                 }
  12702                 fs_temp->next = fs;
  12703                 fs->prev = fs_temp;
  12704             }
  12705         }
  12706 
  12707         /* Now go over the entries */
  12708         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
  12709         fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK;
  12710         if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) {
  12711             ratio = 2;
  12712         } else {
  12713             ratio = 1;
  12714         }
  12715 
  12716         prev_prio = -1;
  12717         for (idx = 0; idx < slice_ent_cnt / ratio; idx++) {
  12718             vfp_tcam_entry = soc_mem_table_idx_to_pointer
  12719                                  (unit,
  12720                                   VFP_TCAMm,
  12721                                   vfp_tcam_entry_t *,
  12722                                   vfp_tcam_buf,
  12723                                   idx + slice_ent_cnt * slice_idx
  12724                                   );
  12725             if (soc_VFP_TCAMm_field32_get
  12726                     (unit,
  12727                      vfp_tcam_entry,
  12728                      VALIDf
  12729                      ) == 0) {
  12730                 continue;
  12731             }
  12732 
  12733             /* All ports are applicable to this entry */
  12734             SOC_PBMP_ASSIGN(entry_pbmp, PBMP_PORT_ALL(unit));
  12735             SOC_PBMP_OR(entry_pbmp, PBMP_CMIC(unit));
  12736 
  12737             /* Search groups to find match */
  12738             fg = fc->groups;
  12739             while (fg != NULL) {
  12740 
  12741                 /* Check if group is in this slice */
  12742                 fs = &fg->slices[0];
  12743                 if ((fg->stage_id != stage_fc->stage_id)
  12744                         || (fs->slice_number != master_slice)) {
  12745                     fg = fg->next;
  12746                     continue;
  12747                 }
  12748 
  12749                 /* Check if entry_pbmp is a subset of group pbmp */
  12750                 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp);
  12751                 SOC_PBMP_AND(temp_pbmp, entry_pbmp);
  12752                 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) {
  12753                     break;
  12754                 }
  12755                 fg = fg->next;
  12756             }
  12757 
  12758             if (fg == NULL) {
  12759                 goto cleanup;
  12760             }
  12761 
  12762             /* Allocate memory for the entry */
  12763             rv = _bcm_field_entry_tcam_parts_count(unit,fg->stage_id,
  12764                                                    fg->flags, &parts_count);
  12765             if (BCM_FAILURE(rv)) {
  12766                 goto cleanup;
  12767             }
  12768             mem_sz = parts_count * sizeof (_field_entry_t);
  12769             _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry");
  12770             if (f_ent == NULL) {
  12771                 rv = BCM_E_MEMORY;
  12772                 goto cleanup;
  12773             }
  12774 
  12775             for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) {
  12776                  f_ent->policer[idx1].pid = _FP_INVALID_INDEX;
  12777             }
  12778 
  12779             sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t));
  12780             f_ent_wb_info.action_bmp = &action_bmp;
  12781             f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1;
  12782             if (fc->l2warm) {
  12783                 if ((fc->wb_recovered_version) > BCM_FIELD_WB_VERSION_1_14) {
  12784                    action_bmp.w = NULL;
  12785                    _FP_XGS3_ALLOC(action_bmp.w,
  12786                             SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount),
  12787                             "Action No Param Bitmap");
  12788                    if (action_bmp.w == NULL) {
  12789                        rv = BCM_E_MEMORY;
  12790                        sal_free(f_ent);
  12791                        goto cleanup;
  12792                    }
  12793                 }
  12794 
  12795                 rv = _field_trx_entry_info_retrieve
  12796                         (unit,
  12797                          fc,
  12798                          stage_fc,
  12799                          multigroup,
  12800                          &prev_prio,
  12801                          &f_ent_wb_info);
  12802 
  12803                 if (BCM_FAILURE(rv)) {
  12804                     sal_free(f_ent);
  12805                     goto cleanup;
  12806                 }
  12807             } else {
  12808                 _bcm_field_last_alloc_eid_incr(unit);
  12809             }
  12810             pri_tcam_idx = idx + slice_ent_cnt * slice_idx;
  12811             for (i = 0; i < parts_count; i++) {
  12812                 if (fc->l2warm) {
  12813                     /* Use retrieved EID */
  12814                     f_ent[i].eid = f_ent_wb_info.eid;
  12815                     /* Set retrieved dvp_type and svp_type */
  12816                     f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i];
  12817                     f_ent[i].svp_type = f_ent_wb_info.svp_type[i];
  12818                     f_ent[i].prio = f_ent_wb_info.prio;
  12819                 } else {
  12820                     f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit);
  12821                     f_ent[i].prio = (slice_idx << 10) | (slice_ent_cnt - idx);
  12822                 }
  12823                 f_ent[i].group = fg;
  12824                 rv = _bcm_field_tcam_part_to_entry_flags
  12825                         (unit, i,
  12826                          fg,
  12827                          &f_ent[i].flags
  12828                          );
  12829                 if (BCM_FAILURE(rv)) {
  12830                     sal_free(f_ent);
  12831                     goto cleanup;
  12832                 }
  12833                 if (f_ent_wb_info.color_independent) {
  12834                     f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT;
  12835                 }
  12836                 rv = _bcm_field_entry_part_tcam_idx_get
  12837                         (unit,
  12838                          f_ent,
  12839                          pri_tcam_idx,
  12840                          i,
  12841                          &part_index
  12842                          );
  12843                 if (BCM_FAILURE(rv)) {
  12844                     sal_free(f_ent);
  12845                     goto cleanup;
  12846                 }
  12847                 rv = _bcm_field_tcam_idx_to_slice_offset
  12848                         (unit,
  12849                          stage_fc,
  12850                          _FP_DEF_INST,
  12851                          part_index,
  12852                         &slice_number,
  12853                         (int *)&f_ent[i].slice_idx
  12854                         );
  12855                 if (BCM_FAILURE(rv)) {
  12856                     sal_free(f_ent);
  12857                     goto cleanup;
  12858                 }
  12859                 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number;
  12860                 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) {
  12861                     /* Decrement slice free entry count for primary
  12862                        entries. */
  12863                     f_ent[i].fs->free_count--;
  12864                 }
  12865                 /* Assign entry to a slice */
  12866                 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i;
  12867                 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp);
  12868                 f_ent[i].flags |= _FP_ENTRY_INSTALLED;
  12869 
  12870                 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, VALIDf) == 3) {
  12871                     f_ent[i].flags |= _FP_ENTRY_ENABLED;
  12872                 }
  12873 
  12874                 /* Get the actions associated with this part of the entry */
  12875                 vfp_policy_entry = soc_mem_table_idx_to_pointer
  12876                                     (unit,
  12877                                      VFP_POLICY_TABLEm,
  12878                                      vfp_policy_table_entry_t *,
  12879                                      vfp_policy_buf,
  12880                                      part_index
  12881                                      );
  12882                 rv = _field_tr2_actions_recover
  12883                         (unit,
  12884                          VFP_POLICY_TABLEm,
  12885                          (uint32 *) vfp_policy_entry,
  12886                          f_ent,
  12887                          i,
  12888                          &f_ent_wb_info);
  12889                 if (BCM_FAILURE(rv)) {
  12890                     sal_free(f_ent);
  12891                     goto cleanup;
  12892                 }
  12893                 if (action_bmp.w != NULL) {
  12894                    _FP_ACTION_BMP_FREE(action_bmp);
  12895                    action_bmp.w = NULL;
  12896                 }
  12897                 if (soc_feature(unit, soc_feature_advanced_flex_counter)) {
  12898                     _field_adv_flex_stat_info_retrieve(unit, f_ent->statistic.sid);
  12899                 }
  12900 #if defined(BCM_APACHE_SUPPORT)
  12901                 if (SOC_IS_APACHE(unit) && !SOC_IS_MONTEREY(unit)) {
  12902                     policer_index = PolicyGet(unit,
  12903                                     VFP_POLICY_TABLEm,
  12904                                     vfp_policy_entry,
  12905                                     SVC_METER_INDEXf);
  12906 
  12907                     offset_mode  = PolicyGet(unit,
  12908                                    VFP_POLICY_TABLEm,
  12909                                    vfp_policy_entry,
  12910                                    SVC_METER_OFFSET_MODEf);
  12911 
  12912                     rv = _bcm_esw_get_policer_id_from_index_offset(unit,
  12913                                    policer_index, offset_mode,
  12914                                    &(f_ent->global_meter_policer.pid));
  12915 
  12916                     if (BCM_FAILURE(rv)) {
  12917                         sal_free(f_ent);
  12918                         goto cleanup;
  12919                     }
  12920 
  12921                     f_ent->global_meter_policer.flags = PolicyGet(unit,
  12922                                                  VFP_POLICY_TABLEm,
  12923                                                  vfp_policy_entry,
  12924                                                  SVC_METER_INDEX_PRIORITYf);
  12925                 }
  12926 #endif /* BCM_APACHE_SUPPORT */
  12927             }
  12928             /* Add to the group */
  12929             rv = _field_group_entry_add(unit, fg, f_ent);
  12930             if (BCM_FAILURE(rv)) {
  12931                 sal_free(f_ent);
  12932                 goto cleanup;
  12933             }
  12934             f_ent = NULL;
  12935         }
  12936         /* Free up the temporary slice group info */
  12937         if (fc->l2warm) {
  12938             _field_scache_slice_group_free(unit,
  12939                                            fc,
  12940                                            slice_idx
  12941                                            );
  12942         }
  12943     }
  12944 
  12945     if (fc->l2warm) {
  12946 
  12947         /* Mark end of Slice Info */
  12948         if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) {
  12949             fc->scache_pos++;
  12950         }
  12951 
  12952         if (soc_feature(unit, soc_feature_field_ingress_two_slice_types)) {
  12953             if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) {
  12954                 if (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP) {
  12955                     LOG_DEBUG(BSL_LS_BCM_FP,
  12956                             (BSL_META_U(unit,"Recovering hint Ids "
  12957                                         "from pos = %d\r\n"), fc->scache_pos));
  12958                     BCM_IF_ERROR_RETURN (_bcm_hints_scache_hintid_recover(
  12959                                             unit, stage_fc,
  12960                                             fc, &buf[fc->scache_pos]));
  12961                 }
  12962             }
  12963         }
  12964 
  12965         /* Group Slice Selectors */
  12966         if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) {
  12967             rv = (_field_group_slice_selectors_recover(unit,
  12968                         &buf[fc->scache_pos], stage_fc->stage_id));
  12969             if (BCM_FAILURE(rv)) {
  12970                 goto cleanup;
  12971             }
  12972         }
  12973 
  12974         temp = 0;
  12975         temp |= buf[fc->scache_pos];
  12976         fc->scache_pos++;
  12977         temp |= buf[fc->scache_pos] << 8;
  12978         fc->scache_pos++;
  12979         temp |= buf[fc->scache_pos] << 16;
  12980         fc->scache_pos++;
  12981         temp |= buf[fc->scache_pos] << 24;
  12982         fc->scache_pos++;
  12983         if (temp != _FIELD_VFP_DATA_END) {
  12984             fc->l2warm = 0;
  12985             rv = BCM_E_INTERNAL;
  12986         }
  12987 
  12988         if (NULL != buf1) {
  12989             temp = 0;
  12990             temp |= buf1[fc->scache_pos1];
  12991             fc->scache_pos1++;
  12992             temp |= buf1[fc->scache_pos1] << 8;
  12993             fc->scache_pos1++;
  12994             temp |= buf1[fc->scache_pos1] << 16;
  12995             fc->scache_pos1++;
  12996             temp |= buf1[fc->scache_pos1] << 24;
  12997             fc->scache_pos1++;
  12998             if (temp != _FIELD_VFP_DATA_END) {
  12999                 fc->l2warm = 0;
  13000                 rv = BCM_E_INTERNAL;
  13001             }
  13002         }
  13003 
  13004     }
  13005 
  13006     if (BCM_SUCCESS(rv)) {
  13007         _field_group_slice_vmap_recovery(unit, fc, stage_fc);
  13008     }
  13009 
  13010     _field_tr2_stage_reinit_all_groups_cleanup
  13011         (unit,
  13012          fc,
  13013          _BCM_FIELD_STAGE_LOOKUP,
  13014          NULL
  13015          );
  13016 
  13017 cleanup:
  13018     if (vfp_tcam_buf) {
  13019         soc_cm_sfree(unit, vfp_tcam_buf);
  13020     }
  13021     if (vfp_policy_buf) {
  13022         soc_cm_sfree(unit, vfp_policy_buf);
  13023     }
  13024     if (action_bmp.w != NULL) {
  13025        _FP_ACTION_BMP_FREE(action_bmp);
  13026        action_bmp.w = NULL;
  13027     }
  13028     return rv;
  13029 }
  13030 
  13031 /*
  13032  * Function:
  13033  *     _bcm_field_td2_egress_selcode_set
  13034  *
  13035  * Purpose:
  13036  *     Sets the select code based on the EFP slice mode and key match type
  13037  *
  13038  * Parameters:
  13039  *     unit             - (IN) BCM device number
  13040  *     fg               - (IN/OUT) Select code information filled into the group
  13041  *     efp_slice_mode   - (IN) EFP slice mode from EFP_SLICE_CONTROl register
  13042  *     efp_key_mode     - (IN) EFP key mode from EFP_SLICE_CONTROl register
  13043  *     key_match_type   - (IN) EFP key match type
  13044  *     parts_count      - (OUT) Number of parts in entry
  13045  *
  13046  * Returns:
  13047  *     BCM_E_NONE
  13048  */
  13049 int
  13050 _bcm_field_td2_egress_selcode_set(int unit, _field_group_t *fg,
  13051                                   uint32 efp_slice_mode, uint32 efp_key_mode,
  13052                                   uint32 key_match_type, int *parts_count)
  13053 {
  13054     if (!fg) {
  13055         return (BCM_E_INTERNAL);
  13056     }    
  13057 
  13058     switch (efp_slice_mode) {
  13059         case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L2:
  13060             fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE;
  13061             fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY4;
  13062             *parts_count = 1;
  13063             break;
  13064         case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3:
  13065             fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE;
  13066             if (key_match_type == ~0 /* No entries */
  13067                     || key_match_type == _BCM_FIELD_EFP_KEY1_MATCH_TYPE
  13068             ) {
  13069                 /* IPv4 single wide key */
  13070                 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1;
  13071                 *parts_count = 1;
  13072                 fg->sel_codes[0].ip6_addr_sel = _FP_SELCODE_DONT_CARE;
  13073             } else {
  13074                 /* key_match_type == _BCM_FIELD_EFP_KEY2_MATCH_TYPE */
  13075                 /* IPv6 single wide key */
  13076                 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY4;
  13077                 *parts_count = 1;
  13078                 fg->sel_codes[0].ip6_addr_sel = efp_key_mode;
  13079             }
  13080             break;
  13081         case _BCM_FIELD_EGRESS_SLICE_MODE_SINGLE_L3_ANY:
  13082             fg->flags |= _FP_GROUP_SPAN_SINGLE_SLICE;
  13083             if ((key_match_type == _BCM_FIELD_EFP_KEY1_MATCH_TYPE)) {
  13084                 /* IPv4 single wide key */
  13085                 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1;
  13086                 *parts_count = 1;
  13087                 fg->sel_codes[0].ip6_addr_sel = _FP_SELCODE_DONT_CARE;
  13088             } else {
  13089                 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY4;
  13090                 *parts_count = 1;
  13091             }
  13092             break;
  13093         case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE:
  13094             fg->flags |= _FP_GROUP_SPAN_DOUBLE_SLICE;
  13095             if (key_match_type == ~0 /* No entries */
  13096                         || key_match_type == _BCM_FIELD_EFP_KEY2_KEY3_MATCH_TYPE
  13097                         ) {
  13098                 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY3;
  13099                 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY2;
  13100             } else { /* _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE */
  13101                 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1;
  13102                 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY4;
  13103             }
  13104             *parts_count = 2;
  13105             break;
  13106         case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_ANY:
  13107             fg->flags |= _FP_GROUP_SPAN_DOUBLE_SLICE;
  13108             if ((key_match_type == _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE))  {
  13109                 /* IPv4 double wide key */
  13110                 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1;
  13111                 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY4;
  13112             } else {
  13113                 fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY1_NO_V4;
  13114                 fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY4;
  13115             }
  13116             *parts_count = 2;
  13117             break;
  13118         case _BCM_FIELD_EGRESS_SLICE_MODE_DOUBLE_L3_V6:
  13119             fg->flags |= _FP_GROUP_SPAN_DOUBLE_SLICE;
  13120             fg->sel_codes[0].fpf3 = _BCM_FIELD_EFP_KEY2;
  13121             fg->sel_codes[1].fpf3 = _BCM_FIELD_EFP_KEY4;
  13122             fg->sel_codes[0].ip6_addr_sel = efp_key_mode;
  13123             *parts_count = 2;
  13124             break;
  13125         default:
  13126             return (BCM_E_INTERNAL);
  13127         }
  13128 
  13129     return (BCM_E_NONE);
  13130 }
  13131 
  13132 /*
  13133  * Function:
  13134  *     _bcm_field_td2_group_construct_quals_add
  13135  *
  13136  * Purpose:
  13137  *     Recover all qualifiers for the given group, based on its selector codes
  13138  *
  13139  * Parameters:
  13140  *     unit             - (IN) BCM device number
  13141  *     fc               - (IN) Device field control structure pointer
  13142  *     stage_fc         - (IN) FP stage control info
  13143  *     entry_type       - (IN) EFP entry type 
  13144  *     fg               - (IN/OUT) Select code information filled into the group
  13145  *
  13146  * Returns:
  13147  *     BCM_E_NONE
  13148  */
  13149 int
  13150 _bcm_field_td2_group_construct_quals_add(int unit,
  13151                                          _field_control_t *fc,
  13152                                          _field_stage_t *stage_fc,
  13153                                          uint8 entry_type,
  13154                                          _field_group_t *fg,
  13155                                          int8 pri_key1,
  13156                                          int8 pri_key2
  13157                                         )
  13158 {
  13159     int                rv;
  13160     int                parts_cnt, part_idx;
  13161     bcm_field_qset_t   qset;
  13162     int8               fpf3 = -1;
  13163 
  13164     if ((!fc) || (!stage_fc) || (!fg)) {
  13165         return(BCM_E_INTERNAL);
  13166     }
  13167 
  13168 
  13169     BCM_FIELD_QSET_INIT(qset);
  13170 
  13171     if ((stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) &&
  13172             (_FP_ENTRY_TYPE_1 == entry_type)) {
  13173         if (fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) {
  13174             fpf3 = fg->sel_codes[1].fpf3;
  13175         }
  13176         rv = _bcm_field_trx_qset_get(unit, &(fg->qset), stage_fc,
  13177                 fg->sel_codes[0].fpf3, fpf3,
  13178                 &qset, fg);
  13179         BCM_IF_ERROR_RETURN(rv);
  13180     } else {
  13181         qset = fg->qset;
  13182     }
  13183 
  13184     if (fc->l2warm) {
  13185         rv = _field_trx_group_construct_quals_add(unit, fc, fg, entry_type, &qset,
  13186                                                   pri_key1, pri_key2);
  13187         if (BCM_SUCCESS(rv)) {
  13188             return rv;
  13189         }
  13190     }
  13191 
  13192     rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id,
  13193                                            fg->flags, &parts_cnt);
  13194     if (BCM_FAILURE(rv)) {
  13195         return (rv);
  13196     }
  13197 
  13198     for (part_idx = 0; part_idx < parts_cnt; ++part_idx) {
  13199         _bcm_field_group_qual_t *grp_qual = &fg->qual_arr[entry_type][part_idx];
  13200         unsigned qid;
  13201 
  13202         for (qid = 0; qid < _bcmFieldQualifyCount; ++qid) {
  13203             _bcm_field_qual_info_t *f_qual_arr = stage_fc->f_qual_arr[qid];
  13204             unsigned               j;
  13205             uint8                  diff_cnt;
  13206 
  13207             if (f_qual_arr == NULL) {
  13208                 continue; /* Qualifier does not exist in this stage */
  13209             }
  13210 
  13211             if (fc->l2warm && !BCM_FIELD_QSET_TEST(qset, qid)) {
  13212                 continue; /* Qualifier not present in the group */
  13213             }
  13214 
  13215             /* Add all of the stage's qualifiers that match the recovered
  13216                selector codes.  Qualifiers that appear more than once
  13217                (because more than one configuration of a qualifier matches
  13218                the recovered selector codes) will be cleaned up later.
  13219             */
  13220 
  13221             for (j = 0; j < f_qual_arr->conf_sz; j++) {
  13222                 if (_field_selector_diff(unit,
  13223                                          fg->sel_codes,
  13224                                          part_idx,
  13225                                          &f_qual_arr->conf_arr[j].selector,
  13226                                          &diff_cnt
  13227                                          )
  13228                     != BCM_E_NONE
  13229                     || diff_cnt != 0
  13230                     ) {
  13231                     continue;
  13232                 }
  13233 
  13234                 if ((!fc->l2warm) && (entry_type != _FP_ENTRY_TYPE_1)) {
  13235                     BCM_FIELD_QSET_ADD(fg->qset, qid);
  13236                 }
  13237                 _field_trx_group_qual_add(grp_qual,
  13238                                           qid,
  13239                                           &f_qual_arr->conf_arr[j].offset
  13240                                           );
  13241 
  13242                 _field_qset_udf_bmap_reinit(unit,
  13243                                             stage_fc,
  13244                                             &fg->qset,
  13245                                             qid
  13246                                             );
  13247             }
  13248         }
  13249     }
  13250 
  13251     return (BCM_E_NONE);
  13252 }
  13253 
  13254 #endif
  13255 #else /* BCM_TRIDENT2_SUPPORT && BCM_FIELD_SUPPORT */
  13256 int _td2_field_not_empty;
  13257 #endif  /* BCM_TRIDENT2_SUPPORT && BCM_FIELD_SUPPORT */
  13258