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


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        field.c
      8  * Purpose:     BCM56450 Field Processor installation functions.
      9  */
     10    
     11 #include <soc/defs.h>
     12 #if defined(BCM_KATANA2_SUPPORT) && defined(BCM_FIELD_SUPPORT)
     13 
     14 #include <soc/mem.h>
     15 #include <soc/drv.h>
     16 
     17 #include <bcm/error.h>
     18 #include <bcm/l3.h>
     19 #include <bcm/field.h>
     20 #include <bcm/tunnel.h>
     21 
     22 #include <bcm_int/esw_dispatch.h>
     23 
     24 #include <bcm_int/esw/field.h>
     25 #include <bcm_int/esw/l3.h>
     26 #include <bcm_int/esw/firebolt.h>
     27 #include <bcm_int/esw/trx.h>
     28 #include <bcm_int/esw/katana.h>
     29 #include <bcm_int/esw/katana2.h>
     30 #include <bcm_int/esw/triumph.h>
     31 #include <bcm_int/esw/triumph2.h>
     32 #include <bcm_int/esw/flex_ctr.h>
     33 
     34 #include <soc/scache.h>
     35 #if defined(BCM_WARM_BOOT_SUPPORT)
     36 #include <bcm_int/esw/policer.h>
     37 
     38 STATIC soc_field_t _kt2_vfp_slice_wide_mode_field[4] = {
     39     SLICE_0_DOUBLE_WIDE_MODEf,
     40     SLICE_1_DOUBLE_WIDE_MODEf,
     41     SLICE_2_DOUBLE_WIDE_MODEf,
     42     SLICE_3_DOUBLE_WIDE_MODEf};
     43 
     44 const soc_field_t _kt2_vfp_src_type_sel[]= {
     45     SLICE_0_SOURCE_TYPE_SELf, SLICE_1_SOURCE_TYPE_SELf,
     46     SLICE_2_SOURCE_TYPE_SELf, SLICE_3_SOURCE_TYPE_SELf};
     47 #endif /* BCM_WARM_BOOT_SUPPORT */
     48 
     49 #define ALIGN32(x)      (((x) + 31) & ~31)
     50 
     51 /* local/static function prototypes */
     52 STATIC void _field_kt2_functions_init(_field_funct_t *functions) ;
     53 
     54 /*
     55  * Function:
     56  *     _field_kt2_ingress_qualifiers_init
     57  * Purpose:
     58  *     Initialize device stage ingress qaualifiers 
     59  *     select codes & offsets
     60  * Parameters:
     61  *     unit       - (IN) BCM device number.
     62  *     stage_fc   - (IN) Field Processor stage control structure. 
     63  *
     64  * Returns:
     65  *     BCM_E_NONE
     66  */
     67 STATIC int
     68 _field_kt2_ingress_qualifiers_init(int unit, _field_stage_t *stage_fc)
     69 {
     70     const unsigned
     71         f1_ofs                  = 194 - 2,
     72         f2_ofs                  = 66 - 2,
     73         f3_ofs                  = 26 - 2,
     74         dw_f1_ofs               = 171 - 3 + 1,
     75         dw_f2_ofs               = 43 - 3 + 1,
     76         dw_f3_ofs               = 11 - 3 + 1,
     77         dw_f4_ofs               = 3 - 3 + 1,
     78         fp_global_mask_tcam_ofs =
     79                     ALIGN32(soc_mem_field_length(unit, FP_TCAMm, DATA_KEYf));
     80 
     81         unsigned int fixed_ofs = 0;
     82 
     83     _FP_QUAL_DECL;
     84 #if defined(BCM_METROLITE_SUPPORT)
     85     if (SOC_IS_METROLITE(unit)) {
     86         fixed_ofs              = 33 - 1;
     87     } else
     88 #endif
     89 #if defined(BCM_SABER2_SUPPORT)
     90     if (SOC_IS_SABER2(unit)) {
     91         fixed_ofs               = 97 - 1;
     92     } else
     93 #endif 
     94     {
     95         fixed_ofs               = 172 - 2;
     96     }
     97 
     98     /* Input parameters check. */
     99     if (NULL == stage_fc) {
    100         return (BCM_E_PARAM);
    101     }
    102 
    103     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStage,
    104                  _bcmFieldSliceSelDisable, 0, 0, 0);
    105     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageIngress,
    106                  _bcmFieldSliceSelDisable, 0, 0, 0);
    107     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
    108                  _bcmFieldSliceSelDisable, 0, 0, 0);
    109     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
    110                  _bcmFieldSliceSelDisable, 0, 0, 0);
    111     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
    112                  _bcmFieldSliceSelDisable, 0, 0, 0);
    113     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPorts,
    114                  _bcmFieldSliceSelDisable, 0, 0, 0);
    115 
    116     /* IFP single wide Fixed */
    117     /* N.B.  Fixed field is in FP_GLOBAL_MASK_TCAM */
    118     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
    119                  _bcmFieldSliceSelDisable, 0,
    120                  fp_global_mask_tcam_ofs + fixed_ofs, 1);
    121     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
    122                  _bcmFieldSliceSelDisable, 0,
    123                  fp_global_mask_tcam_ofs + fixed_ofs + 1, 3);
    124     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifySvpValid,
    125                  _bcmFieldSliceSelDisable, 0,
    126                  fp_global_mask_tcam_ofs + fixed_ofs + 4, 1);
    127     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
    128                  _bcmFieldSliceSelDisable, 0,
    129                  fp_global_mask_tcam_ofs + fixed_ofs + 5, 4);
    130     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
    131                  _bcmFieldSliceSelDisable, 0,
    132                  fp_global_mask_tcam_ofs + fixed_ofs + 9, 1);
    133     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
    134                  _bcmFieldSliceSelDisable, 0,
    135                  fp_global_mask_tcam_ofs + fixed_ofs + 10, 1);
    136     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTunnelType,
    137                                _bcmFieldSliceSelDisable, 0,
    138                                _bcmFieldSliceLoopbackTypeSelect, 1,
    139                                fp_global_mask_tcam_ofs + fixed_ofs + 11, 4);
    140     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopbackType,
    141                                _bcmFieldSliceSelDisable, 0,
    142                                _bcmFieldSliceLoopbackTypeSelect, 0,
    143                                fp_global_mask_tcam_ofs + fixed_ofs + 11, 4);
    144     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopback,
    145                                _bcmFieldSliceSelDisable, 0,
    146                                _bcmFieldSliceLoopbackTypeSelect, 0,
    147                                fp_global_mask_tcam_ofs + fixed_ofs + 14, 1);
    148     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
    149                                _bcmFieldSliceSelDisable, 0,
    150                                _bcmFieldSliceLoopbackTypeSelect, 2,
    151                                fp_global_mask_tcam_ofs + fixed_ofs + 11, 4);
    152     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
    153                  _bcmFieldSliceSelDisable, 0,
    154                  fp_global_mask_tcam_ofs + fixed_ofs + 15, 1);
    155     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRecoverableDrop,
    156                  _bcmFieldSliceSelDisable, 0,
    157                  fp_global_mask_tcam_ofs + fixed_ofs + 16, 1);
    158     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
    159                  _bcmFieldSliceSelDisable, 0,
    160                  fp_global_mask_tcam_ofs + fixed_ofs + 17, 1);
    161     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit,
    162                  _bcmFieldSliceSelDisable, 0,
    163                  fp_global_mask_tcam_ofs + fixed_ofs + 18, 1);
    164 #if defined (BCM_SABER2_SUPPORT)
    165     if (SOC_IS_SABER2(unit)) {
    166         _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDownMepSatTerminated,
    167                      _bcmFieldSliceSelDisable, 0,
    168                      fp_global_mask_tcam_ofs + fixed_ofs + 19, 1);
    169     }
    170 #endif /* BCM_SABER2_SUPPORT */
    171     /* FPF3 primary slice single wide.
    172      * IFP single wide F3_0  (f3_ofs = 26 - 2)*/
    173     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    174                                _bcmFieldSliceSelFpf3, 0,
    175                                _bcmFieldSliceDstClassSelect, 0, f3_ofs, 6);
    176     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    177                                _bcmFieldSliceSelFpf3, 0,
    178                                _bcmFieldSliceDstClassSelect, 1, f3_ofs, 6);
    179     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    180                                _bcmFieldSliceSelFpf3, 0,
    181                                _bcmFieldSliceDstClassSelect, 2, f3_ofs, 6);
    182     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    183                                _bcmFieldSliceSelFpf3, 0,
    184                                _bcmFieldSliceSrcClassSelect, 2, f3_ofs + 6, 6);
    185     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    186                                _bcmFieldSliceSelFpf3, 0,
    187                                _bcmFieldSliceSrcClassSelect, 0, f3_ofs + 6, 6);
    188     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    189                                _bcmFieldSliceSelFpf3, 0,
    190                                _bcmFieldSliceSrcClassSelect, 1, f3_ofs + 6, 6);
    191     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    192                                _bcmFieldSliceSelFpf3, 0,
    193                                _bcmFieldSliceSrcClassSelect, 3, f3_ofs+ 6 , 6);
    194     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    195                                _bcmFieldSliceSelFpf3, 0,
    196                                _bcmFieldSliceDstClassSelect, 3, f3_ofs , 6);
    197     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    198                                _bcmFieldSliceSelFpf3, 0,
    199                                _bcmFieldSliceFwdFieldSelect, 
    200                                _bcmFieldFwdFieldVrf, f3_ofs + 12, 12);
    201     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    202                                _bcmFieldSliceSelFpf3, 0,
    203                                _bcmFieldSliceFwdFieldSelect,
    204                                _bcmFieldFwdFieldVpn, f3_ofs + 12, 12);
    205     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
    206                                bcmFieldQualifyForwardingVlanId,
    207                                _bcmFieldSliceSelFpf3, 0,
    208                                _bcmFieldSliceFwdFieldSelect, 
    209                                _bcmFieldFwdFieldVlan, f3_ofs + 12, 12);
    210     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    211                                _bcmFieldSliceSelFpf3, 0,
    212                                _bcmFieldSliceIngressEntitySelect,
    213                                _bcmFieldFwdEntityMplsGport, f3_ofs + 24, 13);
    214     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    215                                _bcmFieldSliceSelFpf3, 0,
    216                                _bcmFieldSliceIngressEntitySelect,
    217                                _bcmFieldFwdEntityVlanGport, f3_ofs + 24, 13);
    218     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    219                                _bcmFieldSliceSelFpf3, 0,
    220                                _bcmFieldSliceIngressEntitySelect,
    221                                _bcmFieldFwdEntityMimGport, f3_ofs + 24, 13);
    222     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress,
    223                                _bcmFieldSliceSelFpf3, 0,
    224                                _bcmFieldSliceIngressEntitySelect,
    225                                _bcmFieldFwdEntityL3Egress, f3_ofs + 24, 13);
    226     /* IFP single wide F3_1  (f3_ofs = 26 - 2) */
    227     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    228                                _bcmFieldSliceSelFpf3, 1,
    229                                _bcmFieldSliceDstClassSelect, 0, f3_ofs, 6);
    230     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    231                                _bcmFieldSliceSelFpf3, 1,
    232                                _bcmFieldSliceDstClassSelect, 1, f3_ofs, 6);
    233     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    234                                _bcmFieldSliceSelFpf3, 1,
    235                                _bcmFieldSliceDstClassSelect, 2, f3_ofs, 6);
    236     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    237                                _bcmFieldSliceSelFpf3, 1,
    238                                _bcmFieldSliceDstClassSelect, 3, f3_ofs, 6);
    239     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    240                                _bcmFieldSliceSelFpf3, 1,
    241                                _bcmFieldSliceSrcClassSelect, 0, f3_ofs + 6, 6);
    242     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    243                                _bcmFieldSliceSelFpf3, 1,
    244                                _bcmFieldSliceSrcClassSelect, 1, f3_ofs + 6, 6);
    245     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    246                                _bcmFieldSliceSelFpf3, 1,
    247                                _bcmFieldSliceSrcClassSelect, 2, f3_ofs + 6, 6);
    248     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    249                                _bcmFieldSliceSelFpf3, 1,
    250                                _bcmFieldSliceSrcClassSelect, 3, f3_ofs + 6, 6);
    251     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    252                                _bcmFieldSliceSelFpf3, 1,
    253                                _bcmFieldSliceFwdFieldSelect, 
    254                                _bcmFieldFwdFieldVrf, f3_ofs + 12, 12);
    255     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    256                                _bcmFieldSliceSelFpf3, 1,
    257                                _bcmFieldSliceFwdFieldSelect,
    258                                _bcmFieldFwdFieldVpn, f3_ofs + 12, 12);
    259     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
    260                                _bcmFieldSliceSelFpf3, 1,
    261                                _bcmFieldSliceFwdFieldSelect, 
    262                                _bcmFieldFwdFieldVlan, f3_ofs + 12, 12);
    263     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    264                  _bcmFieldSliceSelFpf3, 1, f3_ofs + 24, 12);
    265 
    266     /* IFP single wide F3_2  (f3_ofs = 26 - 2) */
    267     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    268                                _bcmFieldSliceSelFpf3, 2,
    269                                _bcmFieldSliceDstFwdEntitySelect,
    270                                _bcmFieldFwdEntityGlp, f3_ofs, 19);
    271     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    272                                _bcmFieldSliceSelFpf3, 2,
    273                                _bcmFieldSliceDstFwdEntitySelect,
    274                                _bcmFieldFwdEntityCommonGport, f3_ofs, 19);
    275     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    276                                _bcmFieldSliceSelFpf3, 2,
    277                                _bcmFieldSliceDstFwdEntitySelect,
    278                                _bcmFieldFwdEntityGlp, f3_ofs, 19);
    279     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    280                                _bcmFieldSliceSelFpf3, 2,
    281                                _bcmFieldSliceDstFwdEntitySelect,
    282                                _bcmFieldFwdEntityMplsGport, f3_ofs, 19);
    283     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    284                                _bcmFieldSliceSelFpf3, 2,
    285                                _bcmFieldSliceDstFwdEntitySelect,
    286                                _bcmFieldFwdEntityVlanGport, f3_ofs, 19);
    287     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    288                                _bcmFieldSliceSelFpf3, 2,
    289                                _bcmFieldSliceDstFwdEntitySelect,
    290                                _bcmFieldFwdEntityMimGport, f3_ofs, 19);
    291     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
    292                                _bcmFieldSliceSelFpf3, 2,
    293                                _bcmFieldSliceDstFwdEntitySelect,
    294                                _bcmFieldFwdEntityL3Egress, f3_ofs, 19);
    295     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    296                                bcmFieldQualifyDstL3EgressNextHops,
    297                                _bcmFieldSliceSelFpf3, 2,
    298                                _bcmFieldSliceDstFwdEntitySelect,
    299                                _bcmFieldFwdEntityL3Egress, f3_ofs, 19);
    300     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    301                                _bcmFieldSliceSelFpf3, 2,
    302                                _bcmFieldSliceDstFwdEntitySelect,
    303                                _bcmFieldFwdEntityMulticastGroup, f3_ofs, 19);
    304     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
    305                                _bcmFieldSliceSelFpf3, 2,
    306                                _bcmFieldSliceDstFwdEntitySelect,
    307                                _bcmFieldFwdEntityMultipath, f3_ofs, 19);
    308     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    309                                _bcmFieldSliceSelFpf3, 2,
    310                                _bcmFieldSliceSrcEntitySelect,
    311                                _bcmFieldFwdEntityGlp, f3_ofs + 19, 16);
    312     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    313                                _bcmFieldSliceSelFpf3, 2,
    314                                _bcmFieldSliceSrcEntitySelect,
    315                                _bcmFieldFwdEntityGlp, f3_ofs + 19, 16);
    316     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    317                                _bcmFieldSliceSelFpf3, 2,
    318                                 _bcmFieldSliceSrcEntitySelect,
    319                                _bcmFieldFwdEntityMplsGport, f3_ofs + 19, 17);
    320     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    321                                _bcmFieldSliceSelFpf3, 2,
    322                                 _bcmFieldSliceSrcEntitySelect,
    323                                _bcmFieldFwdEntityVlanGport, f3_ofs + 19, 17);
    324     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    325                                _bcmFieldSliceSelFpf3, 2,
    326                                _bcmFieldSliceSrcEntitySelect,
    327                                _bcmFieldFwdEntityMimGport, f3_ofs + 19, 17);
    328     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    329                                bcmFieldQualifySrcModPortGport,
    330                                _bcmFieldSliceSelFpf3, 2,
    331                                _bcmFieldSliceSrcEntitySelect,
    332                                _bcmFieldFwdEntityModPortGport, f3_ofs + 19, 17);
    333     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    334                                bcmFieldQualifySrcTrunkMemberGport,
    335                                _bcmFieldSliceSelFpf3, 2,
    336                                _bcmFieldSliceSrcEntitySelect,
    337                                _bcmFieldFwdEntityModPortGport, f3_ofs + 19, 17);
    338     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    339                                _bcmFieldSliceSelFpf3, 2,
    340                                _bcmFieldSliceSrcEntitySelect,
    341                                _bcmFieldFwdEntityModPortGport, f3_ofs + 26, 10);
    342     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
    343                                _bcmFieldSliceSelFpf3, 2,
    344                                _bcmFieldSliceSrcEntitySelect,
    345                                _bcmFieldFwdEntityModPortGport, f3_ofs + 26, 8);
    346     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
    347                                _bcmFieldSliceSelFpf3, 2,
    348                                _bcmFieldSliceSrcEntitySelect,
    349                                _bcmFieldFwdEntityCommonGport, f3_ofs + 19, 17);
    350     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
    351                  _bcmFieldSliceSelFpf3, 2, f3_ofs + 35, 1);
    352     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    353                  _bcmFieldSliceSelFpf3, 2, f3_ofs + 36, 3);
    354 
    355     /* IFP single wide F3_3  (f3_ofs = 26 - 2) */
    356     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    357                  _bcmFieldSliceSelFpf3, 3, f3_ofs, 16);
    358     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    359                  _bcmFieldSliceSelFpf3, 3, f3_ofs, 12);
    360     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    361                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 12, 1);
    362     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    363                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 13, 3);
    364     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    365                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 16, 2);
    366     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    367                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 18, 2);
    368     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    369                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 20, 2);
    370     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    371                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 22, 3);
    372     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
    373                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 25, 6);
    374     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
    375                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 31, 3);
    376 
    377     /* IFP single wide F3_4  (f3_ofs = 26 - 2) */
    378     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    379                  _bcmFieldSliceSelFpf3, 4, f3_ofs, 16);
    380     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    381                  _bcmFieldSliceSelFpf3, 4, f3_ofs, 12);
    382     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    383                  _bcmFieldSliceSelFpf3, 4, f3_ofs + 12, 1);
    384     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    385                  _bcmFieldSliceSelFpf3, 4, f3_ofs + 13, 3);
    386     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    387                  _bcmFieldSliceSelFpf3, 4, f3_ofs + 16, 16);
    388     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    389                  _bcmFieldSliceSelFpf3, 4, f3_ofs + 16, 12);
    390     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    391                  _bcmFieldSliceSelFpf3, 4, f3_ofs + 28, 1);
    392     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    393                  _bcmFieldSliceSelFpf3, 4, f3_ofs + 29, 3);
    394     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
    395                  _bcmFieldSliceSelFpf3, 4, f3_ofs + 32, 2);
    396     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
    397                  _bcmFieldSliceSelFpf3, 4, f3_ofs + 34, 4);
    398 
    399     /* IFP single wide F3_5  (f3_ofs = 26 - 2) */
    400     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    401                  _bcmFieldSliceSelFpf3, 5, f3_ofs, 16);
    402     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    403                  _bcmFieldSliceSelFpf3, 5, f3_ofs, 12);
    404     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    405                  _bcmFieldSliceSelFpf3, 5, f3_ofs + 12, 1);
    406     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    407                  _bcmFieldSliceSelFpf3, 5, f3_ofs + 13, 3);
    408     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    409                  _bcmFieldSliceSelFpf3, 5, f3_ofs + 16, 16);
    410 
    411     /* IFP single wide F3_6  (f3_ofs = 26 - 2) */
    412     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
    413                  _bcmFieldSliceSelFpf3, 6, f3_ofs, 1);
    414     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
    415                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 1, 2);
    416     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
    417                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 3, 1);
    418     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
    419                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 4, 2);
    420     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
    421                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 6, 1);
    422     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
    423                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 7, 1);
    424     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
    425                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 8, 1);
    426     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
    427                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 9, 1);
    428     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
    429                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 10, 1);
    430     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
    431                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 10, 1);
    432     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
    433                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 11, 1);
    434     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
    435                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 12, 1);
    436     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
    437                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 13, 1);
    438     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
    439                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 14, 1);
    440     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit,
    441                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 15, 1);
    442     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit,
    443                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 16, 1);
    444     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit,
    445                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 16, 1);
    446     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit,
    447                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 16, 1);
    448     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit,
    449                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 16, 1);
    450     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit,
    451                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 17, 1);
    452     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit,
    453                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 17, 1);
    454     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit,
    455                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 17, 1);
    456     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit,
    457                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 17, 1);
    458     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    459                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 18, 16);
    460     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    461                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 18, 12);
    462     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    463                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 18 + 12, 1);
    464     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    465                  _bcmFieldSliceSelFpf3, 6, f3_ofs + 18 + 13, 3);
    466 
    467     /* IFP single wide F3_7  (f3_ofs = 26 - 2) */
    468     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck,
    469                  _bcmFieldSliceSelFpf3, 7, f3_ofs, 24);
    470     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    471                                _bcmFieldQualifyRangeCheckBits24_31,
    472                                _bcmFieldSliceSelFpf3, 7,
    473                                _bcmFieldSliceIntfClassSelect, 3,
    474                                f3_ofs + 24, 8);
    475     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    476                                bcmFieldQualifyInterfaceClassPort,
    477                                _bcmFieldSliceSelFpf3, 7,
    478                                _bcmFieldSliceIntfClassSelect, 0,
    479                                f3_ofs + 24, 8);
    480     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
    481                                _bcmFieldSliceSelFpf3, 7,
    482                                _bcmFieldSliceIntfClassSelect, 1,
    483                                f3_ofs + 24, 8);
    484     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    485                                bcmFieldQualifyInterfaceClassVPort,
    486                                _bcmFieldSliceSelFpf3, 7,
    487                                _bcmFieldSliceIntfClassSelect, 1,
    488                                f3_ofs + 24, 8);
    489     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
    490                                _bcmFieldSliceSelFpf3, 7,
    491                                _bcmFieldSliceIntfClassSelect, 2,
    492                                f3_ofs + 24, 8);
    493 
    494     /* IFP single wide F3_8  (f3_ofs = 26 - 2) */
    495     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel,
    496                  _bcmFieldSliceSelFpf3, 8, f3_ofs, 20);
    497     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    498                  _bcmFieldSliceSelFpf3, 8, f3_ofs + 20, 2);
    499     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    500                  _bcmFieldSliceSelFpf3, 8, f3_ofs + 22, 2);
    501     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    502                  _bcmFieldSliceSelFpf3, 8, f3_ofs + 24, 2);
    503     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
    504                  _bcmFieldSliceSelFpf3, 8, f3_ofs + 26, 2);
    505     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
    506                  _bcmFieldSliceSelFpf3, 8, f3_ofs + 28, 2);
    507 
    508     /* IFP single wide F3_9  (f3_ofs = 26 - 2) */
    509     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData3,
    510                  _bcmFieldSliceSelFpf3, 9, f3_ofs, 32);
    511     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsOuterLabelPop,
    512                  _bcmFieldSliceSelFpf3, 9, f3_ofs + 32, 1);
    513     _FP_QUAL_ADD(unit, stage_fc,
    514                  bcmFieldQualifyMplsStationHitTunnelUnterminated,
    515                  _bcmFieldSliceSelFpf3, 9, f3_ofs + 33, 1);
    516     _FP_QUAL_ADD(unit, stage_fc,
    517                  bcmFieldQualifyGenericAssociatedChannelLabelValid,
    518                  _bcmFieldSliceSelFpf3, 9, f3_ofs + 36, 1);
    519     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid,
    520                  _bcmFieldSliceSelFpf3, 9, f3_ofs + 37, 1);
    521     
    522     /* IFP single wide F3_10  (f3_ofs = 26 - 2) */
    523     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    524                                _bcmFieldSliceSelFpf3, 10,
    525                                _bcmFieldSliceDstFwdEntitySelect,
    526                                _bcmFieldFwdEntityGlp, f3_ofs, 19);
    527     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    528                                _bcmFieldSliceSelFpf3, 10,
    529                                _bcmFieldSliceDstFwdEntitySelect,
    530                                _bcmFieldFwdEntityCommonGport, f3_ofs, 19);
    531     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    532                                _bcmFieldSliceSelFpf3, 10,
    533                                _bcmFieldSliceDstFwdEntitySelect,
    534                                _bcmFieldFwdEntityGlp, f3_ofs, 19);
    535     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    536                                _bcmFieldSliceSelFpf3, 10,
    537                                _bcmFieldSliceDstFwdEntitySelect,
    538                                _bcmFieldFwdEntityMplsGport, f3_ofs, 19);
    539     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    540                                _bcmFieldSliceSelFpf3, 10,
    541                                _bcmFieldSliceDstFwdEntitySelect,
    542                                _bcmFieldFwdEntityVlanGport, f3_ofs, 19);
    543     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    544                                _bcmFieldSliceSelFpf3, 10,
    545                                _bcmFieldSliceDstFwdEntitySelect,
    546                                _bcmFieldFwdEntityMimGport, f3_ofs, 19);
    547     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
    548                                _bcmFieldSliceSelFpf3, 10,
    549                                _bcmFieldSliceDstFwdEntitySelect,
    550                                _bcmFieldFwdEntityL3Egress, f3_ofs, 19);
    551     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    552                                bcmFieldQualifyDstL3EgressNextHops,
    553                                _bcmFieldSliceSelFpf3, 10,
    554                                _bcmFieldSliceDstFwdEntitySelect,
    555                                _bcmFieldFwdEntityL3Egress, f3_ofs, 19);
    556     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    557                                _bcmFieldSliceSelFpf3, 10,
    558                                _bcmFieldSliceDstFwdEntitySelect,
    559                                _bcmFieldFwdEntityMulticastGroup, f3_ofs, 19);
    560     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
    561                                _bcmFieldSliceSelFpf3, 10,
    562                                _bcmFieldSliceDstFwdEntitySelect,
    563                                _bcmFieldFwdEntityMultipath, f3_ofs, 19);
    564     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    565                  _bcmFieldSliceSelFpf3, 10, f3_ofs + 19, 16);
    566     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    567                  _bcmFieldSliceSelFpf3, 10, f3_ofs + 19, 16);
    568 
    569     /* IFP single wide F3_11  (f3_ofs = 26 - 2) */
    570     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    571                  _bcmFieldSliceSelFpf3, 11, f3_ofs, 16);
    572     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    573                  _bcmFieldSliceSelFpf3, 11, f3_ofs, 16);
    574     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    575                  _bcmFieldSliceSelFpf3, 11, f3_ofs, 16);
    576     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    577                  _bcmFieldSliceSelFpf3, 11, f3_ofs + 7, 9);
    578     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    579                  _bcmFieldSliceSelFpf3, 11, f3_ofs + 16, 14);
    580     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    581                  _bcmFieldSliceSelFpf3, 11, f3_ofs + 16, 14);
    582     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    583                  _bcmFieldSliceSelFpf3, 11, f3_ofs + 16, 14);
    584     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
    585                  _bcmFieldSliceSelFpf3, 11, f3_ofs + 29, 1);
    586 
    587     /* IFP single wide F3_12  (f3_ofs = 26 - 2) */
    588     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag,
    589                                _bcmFieldSliceSelFpf3, 12,
    590                                _bcmFieldSliceAuxTag2Select,
    591                                _bcmFieldAuxTagVn, f3_ofs, 33);
    592     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySubportPktTag,
    593                                _bcmFieldSliceSelFpf3, 12,
    594                                _bcmFieldSliceAuxTag2Select,
    595                                _bcmFieldAuxTagVxlanOrLLTag, f3_ofs, 33);
    596     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag,
    597                                _bcmFieldSliceSelFpf3, 12,
    598                                _bcmFieldSliceAuxTag2Select,
    599                                _bcmFieldAuxTagCn, f3_ofs, 33);
    600     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag,
    601                                _bcmFieldSliceSelFpf3, 12,
    602                                _bcmFieldSliceAuxTag2Select,
    603                                _bcmFieldAuxTagFabricQueue, f3_ofs, 33);
    604     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    605                                bcmFieldQualifyMplsForwardingLabel,
    606                                _bcmFieldSliceSelFpf3, 12,
    607                                _bcmFieldSliceAuxTag2Select,
    608                                _bcmFieldAuxTagMplsFwdingLabel, f3_ofs, 33);
    609     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord,
    610                                _bcmFieldSliceSelFpf3, 12,
    611                                _bcmFieldSliceAuxTag2Select,
    612                                _bcmFieldAuxTagMplsCntlWord, f3_ofs, 33);
    613     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelTtl,
    614                      _bcmFieldDevSelDisable, 0,
    615                      _bcmFieldSliceSelFpf3, 12,
    616                      _bcmFieldSliceAuxTag2Select,
    617                      _bcmFieldAuxTagMplsFwdingLabel, 0,
    618                      f3_ofs, 8, f3_ofs + 32, 1, 0, 0, 0);
    619     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelBos,
    620                      _bcmFieldDevSelDisable, 0,
    621                      _bcmFieldSliceSelFpf3, 12,
    622                      _bcmFieldSliceAuxTag2Select,
    623                      _bcmFieldAuxTagMplsFwdingLabel, 0,
    624                      f3_ofs + 8, 1, f3_ofs + 32, 1, 0, 0, 0);
    625     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelExp,
    626                      _bcmFieldDevSelDisable, 0,
    627                      _bcmFieldSliceSelFpf3, 12,
    628                      _bcmFieldSliceAuxTag2Select,
    629                      _bcmFieldAuxTagMplsFwdingLabel, 0,
    630                      f3_ofs + 9, 3, f3_ofs + 32, 1, 0, 0, 0);
    631     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
    632                                bcmFieldQualifyMplsForwardingLabelId,
    633                                _bcmFieldSliceSelFpf3, 12,
    634                                _bcmFieldSliceAuxTag2Select,
    635                                _bcmFieldAuxTagMplsFwdingLabel, f3_ofs + 12, 21);
    636     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper,
    637                                _bcmFieldSliceSelFpf3, 12,
    638                                _bcmFieldSliceAuxTag2Select,
    639                                _bcmFieldAuxTagRtag7A, f3_ofs + 16, 17);
    640     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower,
    641                      _bcmFieldDevSelDisable, 0,
    642                      _bcmFieldSliceSelFpf3, 12,
    643                      _bcmFieldSliceAuxTag2Select,
    644                      _bcmFieldAuxTagRtag7A, 0,
    645                      f3_ofs, 16, f3_ofs + 32, 1, 0, 0, 0);
    646     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper,
    647                                _bcmFieldSliceSelFpf3, 12,
    648                                _bcmFieldSliceAuxTag2Select,
    649                                _bcmFieldAuxTagRtag7B, f3_ofs + 16, 17);
    650     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower,
    651                      _bcmFieldDevSelDisable, 0,
    652                      _bcmFieldSliceSelFpf3, 12,
    653                      _bcmFieldSliceAuxTag2Select,
    654                      _bcmFieldAuxTagRtag7B, 0,
    655                      f3_ofs, 16, f3_ofs + 32, 1, 0, 0, 0);
    656     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyLlidValue,
    657                      _bcmFieldDevSelDisable, 0,
    658                      _bcmFieldSliceSelFpf3, 12,
    659                      _bcmFieldSliceAuxTag2Select,
    660                      _bcmFieldAuxTagVxlanOrLLTag, 0,
    661                      f3_ofs, 16, f3_ofs + 32, 1, 0, 0, 0);
    662     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid,
    663                  _bcmFieldSliceSelFpf3, 12, f3_ofs + 33, 1);
    664 
    665     /* IFP single wide F3_13  (f3_ofs = 26 - 2) */
    666     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    667                                _bcmFieldSliceSelFpf3, 13,
    668                                _bcmFieldSliceTosClassSelect, 0,
    669                                f3_ofs, 8);
    670     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    671                                _bcmFieldSliceSelFpf3, 13,
    672                                _bcmFieldSliceTosClassSelect, 0,
    673                                f3_ofs, 8);
    674     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    675                                _bcmFieldSliceSelFpf3, 13,
    676                                _bcmFieldSliceTosClassSelect, 1,
    677                                f3_ofs, 8);
    678     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeader2Type,
    679                  _bcmFieldSliceSelFpf3, 13, f3_ofs + 8, 8);
    680     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
    681                  _bcmFieldSliceSelFpf3, 13, f3_ofs + 16, 8);
    682     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
    683                  _bcmFieldSliceSelFpf3, 13, f3_ofs + 24, 8);
    684 
    685     /* IFP single wide F2_0  (f2_ofs = 66 - 2)*/
    686     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    687                                 _bcmFieldSliceSelFpf2, 0,
    688                                 _bcmFieldSliceTtlClassSelect, 0,
    689                                 f2_ofs, 8);
    690     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    691                                 _bcmFieldSliceSelFpf2, 0,
    692                                 _bcmFieldSliceTtlClassSelect, 0,
    693                                 f2_ofs, 8);
    694     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    695                                 _bcmFieldSliceSelFpf2, 0,
    696                                 _bcmFieldSliceTtlClassSelect, 1,
    697                                 f2_ofs, 8);
    698     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    699                                 _bcmFieldSliceSelFpf2, 0,
    700                                 _bcmFieldSliceTcpClassSelect, 0,
    701                                 f2_ofs+ 8, 6);
    702     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    703                                 _bcmFieldSliceSelFpf2, 0,
    704                                 _bcmFieldSliceTcpClassSelect, 0,
    705                                 f2_ofs+ 8, 6);
    706     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    707                                 _bcmFieldSliceSelFpf2, 0,
    708                                 _bcmFieldSliceTcpClassSelect, 1,
    709                                 f2_ofs+ 8, 6);
    710     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFlags,
    711                  _bcmFieldSliceSelFpf2, 0, f2_ofs + 14, 2);
    712     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    713                                 _bcmFieldSliceSelFpf2, 0,
    714                                 _bcmFieldSliceTosClassSelect, 0,
    715                                 f2_ofs+ 16, 8);
    716     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    717                                 _bcmFieldSliceSelFpf2, 0,
    718                                 _bcmFieldSliceTosClassSelect, 0,
    719                                 f2_ofs+ 16, 8);
    720     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    721                                 _bcmFieldSliceSelFpf2, 0,
    722                                 _bcmFieldSliceTosClassSelect, 1,
    723                                 f2_ofs+ 16, 8);
    724     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
    725                  _bcmFieldSliceSelFpf2, 0, f2_ofs + 24, 16);
    726     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
    727                  _bcmFieldSliceSelFpf2, 0, f2_ofs + 40, 16);
    728     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
    729                  _bcmFieldSliceSelFpf2, 0, f2_ofs + 40, 16);
    730     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    731                  _bcmFieldSliceSelFpf2, 0, f2_ofs + 56, 8);
    732     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    733                  _bcmFieldSliceSelFpf2, 0, f2_ofs + 64, 32);
    734     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    735                  _bcmFieldSliceSelFpf2, 0, f2_ofs + 96, 32);
    736 
    737     /* IFP single wide F2_1 (f2_ofs = 66 - 2)*/
    738     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    739                                _bcmFieldSliceSelFpf2, 1,
    740                                _bcmFieldSliceTtlClassSelect, 0,
    741                                f2_ofs, 8);
    742     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    743                                _bcmFieldSliceSelFpf2, 1,
    744                                _bcmFieldSliceTtlClassSelect, 0,
    745                                f2_ofs, 8);
    746     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    747                                _bcmFieldSliceSelFpf2, 1,
    748                                _bcmFieldSliceTtlClassSelect, 1,
    749                                f2_ofs, 8);
    750     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    751                                _bcmFieldSliceSelFpf2, 1,
    752                                _bcmFieldSliceTcpClassSelect, 0,
    753                                f2_ofs + 8, 6);
    754     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    755                                _bcmFieldSliceSelFpf2, 1,
    756                                _bcmFieldSliceTcpClassSelect, 0,
    757                                f2_ofs + 8, 6);
    758     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    759                                _bcmFieldSliceSelFpf2, 1,
    760                                _bcmFieldSliceTcpClassSelect, 1,
    761                                f2_ofs + 8, 6);
    762     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
    763                  _bcmFieldSliceSelFpf2, 1, f2_ofs + 14, 2);
    764     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    765                                _bcmFieldSliceSelFpf2, 1,
    766                                _bcmFieldSliceTosClassSelect, 0,
    767                                f2_ofs + 16, 8);
    768     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    769                                _bcmFieldSliceSelFpf2, 1,
    770                                _bcmFieldSliceTosClassSelect, 0,
    771                                f2_ofs + 16, 8);
    772     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    773                                _bcmFieldSliceSelFpf2, 1,
    774                                _bcmFieldSliceTosClassSelect, 1,
    775                                f2_ofs + 16, 8);
    776     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
    777                  _bcmFieldSliceSelFpf2, 1, f2_ofs + 24, 16);
    778     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
    779                  _bcmFieldSliceSelFpf2, 1, f2_ofs + 40, 16);
    780     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
    781                  _bcmFieldSliceSelFpf2, 1, f2_ofs + 40, 16);
    782     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    783                  _bcmFieldSliceSelFpf2, 1, f2_ofs + 56, 8);
    784     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    785                  _bcmFieldSliceSelFpf2, 1, f2_ofs + 64, 32);
    786     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    787                  _bcmFieldSliceSelFpf2, 1, f2_ofs + 96, 32);
    788 
    789     /* IFP single wide F2_2 (f2_ofs = 66 - 2)*/
    790     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
    791                  _bcmFieldSliceSelFpf2, 2, f2_ofs, 128);
    792 
    793     /* IFP single wide F2_3 (f2_ofs = 66 - 2)*/
    794     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
    795                  _bcmFieldSliceSelFpf2, 3, f2_ofs, 128);
    796 
    797     /* IFP single wide F2_4 (f2_ofs = 66 - 2)*/
    798     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    799                                _bcmFieldSliceSelFpf2, 4,
    800                                _bcmFieldSliceTtlClassSelect, 0,
    801                                f2_ofs, 8);
    802     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    803                                _bcmFieldSliceSelFpf2, 4,
    804                                _bcmFieldSliceTtlClassSelect, 0,
    805                                f2_ofs, 8);
    806     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    807                                _bcmFieldSliceSelFpf2, 4,
    808                                _bcmFieldSliceTtlClassSelect, 1,
    809                                f2_ofs, 8);
    810     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    811                                _bcmFieldSliceSelFpf2, 4,
    812                                _bcmFieldSliceTcpClassSelect, 0,
    813                                f2_ofs + 8, 6);
    814     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    815                                _bcmFieldSliceSelFpf2, 4,
    816                                _bcmFieldSliceTcpClassSelect, 0,
    817                                f2_ofs + 8, 6);
    818     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    819                               _bcmFieldSliceSelFpf2, 4,
    820                               _bcmFieldSliceTcpClassSelect, 1,
    821                               f2_ofs + 8, 6);
    822     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel,
    823             _bcmFieldSliceSelFpf2, 4, f2_ofs + 14, 20);
    824     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    825                               _bcmFieldSliceSelFpf2, 4,
    826                               _bcmFieldSliceTosClassSelect, 0,
    827                               f2_ofs + 34, 8);
    828     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    829                                _bcmFieldSliceSelFpf2, 4,
    830                                _bcmFieldSliceTosClassSelect, 0,
    831                                f2_ofs + 34, 8);
    832     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    833                                _bcmFieldSliceSelFpf2, 4,
    834                                _bcmFieldSliceTosClassSelect, 1,
    835                                f2_ofs + 34, 8);
    836     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    837                  _bcmFieldSliceSelFpf2, 4, f2_ofs + 42, 8);
    838     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
    839                  _bcmFieldSliceSelFpf2, 4, f2_ofs + 64, 64);
    840 
    841     /* IFP single wide F2_5 (f2_ofs = 66 - 2)*/
    842     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    843                  _bcmFieldSliceSelFpf2, 5, f2_ofs, 16);
    844     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    845                  _bcmFieldSliceSelFpf2, 5, f2_ofs, 12);
    846     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    847                  _bcmFieldSliceSelFpf2, 5, f2_ofs + 12, 1);
    848     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    849                  _bcmFieldSliceSelFpf2, 5, f2_ofs + 13, 3);
    850     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    851                  _bcmFieldSliceSelFpf2, 5, f2_ofs + 16, 16);
    852     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    853                  _bcmFieldSliceSelFpf2, 5, f2_ofs + 32, 48);
    854     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    855                  _bcmFieldSliceSelFpf2, 5, f2_ofs + 80, 48);
    856 
    857     /* IFP single wide F2_6 (f2_ofs = 66 - 2)*/
    858     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    859                  _bcmFieldSliceSelFpf2, 6, f2_ofs, 16);
    860     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    861                  _bcmFieldSliceSelFpf2, 6, f2_ofs, 12);
    862     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    863                  _bcmFieldSliceSelFpf2, 6, f2_ofs + 12, 1);
    864     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    865                  _bcmFieldSliceSelFpf2, 6, f2_ofs + 13, 3);
    866     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    867                  _bcmFieldSliceSelFpf2, 6, f2_ofs + 16, 16);
    868     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    869                  _bcmFieldSliceSelFpf2, 6, f2_ofs + 32, 48);
    870     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    871                  _bcmFieldSliceSelFpf2, 6, f2_ofs + 80, 32);
    872 
    873     /* IFP single wide F2_7 (f2_ofs = 66 - 2)*/
    874     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    875                  _bcmFieldSliceSelFpf2, 7, f2_ofs, 16);
    876     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    877                  _bcmFieldSliceSelFpf2, 7, f2_ofs, 12);
    878     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    879                  _bcmFieldSliceSelFpf2, 7, f2_ofs + 12, 1);
    880     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    881                  _bcmFieldSliceSelFpf2, 7, f2_ofs + 13, 3);
    882     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    883                  _bcmFieldSliceSelFpf2, 7, f2_ofs + 16, 16);
    884     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    885                                _bcmFieldSliceSelFpf2, 7,
    886                                _bcmFieldSliceTtlClassSelect, 0,
    887                                f2_ofs + 32, 8);
    888     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    889                                _bcmFieldSliceSelFpf2, 7,
    890                                _bcmFieldSliceTtlClassSelect, 0,
    891                                f2_ofs + 32, 8);
    892     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    893                                _bcmFieldSliceSelFpf2, 7,
    894                                _bcmFieldSliceTtlClassSelect, 1,
    895                                f2_ofs + 32, 8);
    896     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    897                  _bcmFieldSliceSelFpf2, 7, f2_ofs + 40, 8);
    898     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    899                  _bcmFieldSliceSelFpf2, 7, f2_ofs + 48, 32);
    900     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    901                  _bcmFieldSliceSelFpf2, 7, f2_ofs + 80, 48);
    902 
    903     /* IFP single wide F2_8 (f2_ofs = 66 - 2)*/
    904     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0,
    905                  _bcmFieldSliceSelFpf2, 8, f2_ofs, 128);
    906 
    907     /* IFP single wide F2_9 (f2_ofs = 66 - 2)*/
    908     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1,
    909                      _bcmFieldSliceSelFpf2, 9, f2_ofs, 128);
    910 
    911     /* IFP single wide F2_10 (f2_ofs = 66 - 2)*/
    912     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
    913                      _bcmFieldSliceSelFpf2, 10, f2_ofs, 64);
    914     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
    915                      _bcmFieldSliceSelFpf2, 10, f2_ofs + 64, 64);
    916 
    917     /* IFP single wide F2_11 (f2_ofs = 66 - 2)*/
    918     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    919                  _bcmFieldSliceSelFpf2, 11, f2_ofs + 32, 48);
    920     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    921                  _bcmFieldSliceSelFpf2, 11, f2_ofs + 80, 48);
    922     /* DIP_127_96 omitted -- no qualifier?  Omitted in Trident, too.*/
    923 
    924     /* IFP single wide F1_0 (f1_ofs = 194 - 2)*/
    925     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    926                                _bcmFieldSliceSelFpf1, 0,
    927                                _bcmFieldSliceDstClassSelect, 0, f1_ofs, 6);
    928     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    929                                _bcmFieldSliceSelFpf1, 0,
    930                                _bcmFieldSliceDstClassSelect, 1, f1_ofs, 6);
    931     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    932                                _bcmFieldSliceSelFpf1, 0,
    933                                _bcmFieldSliceDstClassSelect, 2, f1_ofs, 6);
    934     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    935                                _bcmFieldSliceSelFpf1, 0,
    936                                _bcmFieldSliceDstClassSelect, 3, f1_ofs, 6);
    937     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    938                                _bcmFieldSliceSelFpf1, 0,
    939                                _bcmFieldSliceSrcClassSelect, 0, f1_ofs + 6, 6);
    940     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    941                                _bcmFieldSliceSelFpf1, 0,
    942                                _bcmFieldSliceSrcClassSelect, 1, f1_ofs + 6, 6);
    943     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    944                                _bcmFieldSliceSelFpf1, 0,
    945                                _bcmFieldSliceSrcClassSelect, 2, f1_ofs + 6, 6);
    946     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    947                                _bcmFieldSliceSelFpf1, 0,
    948                                _bcmFieldSliceSrcClassSelect, 3, f1_ofs + 6, 6);
    949     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    950                                _bcmFieldSliceSelFpf1, 0,
    951                                _bcmFieldSliceFwdFieldSelect, 
    952                                _bcmFieldFwdFieldVrf, f1_ofs + 12, 12);
    953     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    954                                _bcmFieldSliceSelFpf1, 0,
    955                                _bcmFieldSliceFwdFieldSelect, 
    956                                _bcmFieldFwdFieldVpn, f1_ofs + 12, 12);
    957     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
    958                                _bcmFieldSliceSelFpf1, 0,
    959                                _bcmFieldSliceFwdFieldSelect, 
    960                                _bcmFieldFwdFieldVlan, f1_ofs + 12, 12);
    961     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    962                                _bcmFieldSliceSelFpf1, 0,
    963                                _bcmFieldSliceIngressEntitySelect,
    964                                _bcmFieldFwdEntityMplsGport, f1_ofs + 24, 13);
    965     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    966                                _bcmFieldSliceSelFpf1, 0,
    967                                _bcmFieldSliceIngressEntitySelect,
    968                                _bcmFieldFwdEntityVlanGport, f1_ofs + 24, 13);
    969     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    970                                _bcmFieldSliceSelFpf1, 0,
    971                                _bcmFieldSliceIngressEntitySelect,
    972                                _bcmFieldFwdEntityMimGport, f1_ofs + 24, 13);
    973 
    974     /* IFP single wide F1_1  (f1_ofs = 194 - 2)*/
    975     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    976                                _bcmFieldSliceSelFpf1, 1,
    977                                _bcmFieldSliceDstFwdEntitySelect,
    978                                _bcmFieldFwdEntityGlp, f1_ofs, 19);
    979     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    980                                _bcmFieldSliceSelFpf1, 1,
    981                                _bcmFieldSliceDstFwdEntitySelect,
    982                                _bcmFieldFwdEntityCommonGport, f1_ofs, 19);
    983     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    984                                _bcmFieldSliceSelFpf1, 1,
    985                                _bcmFieldSliceDstFwdEntitySelect,
    986                                _bcmFieldFwdEntityGlp, f1_ofs, 19);
    987     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    988                                _bcmFieldSliceSelFpf1, 1,
    989                                _bcmFieldSliceDstFwdEntitySelect,
    990                                _bcmFieldFwdEntityMplsGport, f1_ofs, 19);
    991     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    992                                _bcmFieldSliceSelFpf1, 1,
    993                                _bcmFieldSliceDstFwdEntitySelect,
    994                                _bcmFieldFwdEntityVlanGport, f1_ofs, 19);
    995     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    996                                _bcmFieldSliceSelFpf1, 1,
    997                                _bcmFieldSliceDstFwdEntitySelect,
    998                                _bcmFieldFwdEntityMimGport, f1_ofs, 19);
    999     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   1000                                _bcmFieldSliceSelFpf1, 1,
   1001                                _bcmFieldSliceDstFwdEntitySelect,
   1002                                _bcmFieldFwdEntityL3Egress, f1_ofs, 19);
   1003     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1004                                bcmFieldQualifyDstL3EgressNextHops,
   1005                                _bcmFieldSliceSelFpf1, 1,
   1006                                _bcmFieldSliceDstFwdEntitySelect,
   1007                                _bcmFieldFwdEntityL3Egress, f1_ofs, 19);
   1008     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   1009                                _bcmFieldSliceSelFpf1, 1,
   1010                                _bcmFieldSliceDstFwdEntitySelect,
   1011                                _bcmFieldFwdEntityMulticastGroup, f1_ofs, 19);
   1012     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
   1013                                _bcmFieldSliceSelFpf1, 1,
   1014                                _bcmFieldSliceDstFwdEntitySelect,
   1015                                _bcmFieldFwdEntityMultipath, f1_ofs, 19);
   1016     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   1017                                _bcmFieldSliceSelFpf1, 1,
   1018                                _bcmFieldSliceSrcEntitySelect,
   1019                                _bcmFieldFwdEntityGlp, f1_ofs + 19, 16);
   1020     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   1021                                _bcmFieldSliceSelFpf1, 1,
   1022                                _bcmFieldSliceSrcEntitySelect,
   1023                                _bcmFieldFwdEntityGlp, f1_ofs + 19, 16);
   1024     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   1025                                _bcmFieldSliceSelFpf1, 1,
   1026                                _bcmFieldSliceSrcEntitySelect,
   1027                                _bcmFieldFwdEntityMplsGport, f1_ofs + 19, 17);
   1028     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   1029                                _bcmFieldSliceSelFpf1, 1,
   1030                                _bcmFieldSliceSrcEntitySelect,
   1031                                _bcmFieldFwdEntityVlanGport, f1_ofs + 19, 17);
   1032     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   1033                                _bcmFieldSliceSelFpf1, 1,
   1034                                _bcmFieldSliceSrcEntitySelect,
   1035                                _bcmFieldFwdEntityMimGport, f1_ofs + 19, 17);
   1036     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1037                                bcmFieldQualifySrcModPortGport,
   1038                                _bcmFieldSliceSelFpf1, 1,
   1039                                _bcmFieldSliceSrcEntitySelect,
   1040                                _bcmFieldFwdEntityModPortGport, f1_ofs + 19, 17);
   1041     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1042                                bcmFieldQualifySrcTrunkMemberGport,
   1043                                _bcmFieldSliceSelFpf1, 1,
   1044                                _bcmFieldSliceSrcEntitySelect,
   1045                                _bcmFieldFwdEntityModPortGport, f1_ofs + 19, 17);
   1046     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   1047                                _bcmFieldSliceSelFpf1, 1,
   1048                                _bcmFieldSliceSrcEntitySelect,
   1049                                _bcmFieldFwdEntityModPortGport, f1_ofs + 26, 10);
   1050     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
   1051                                _bcmFieldSliceSelFpf1, 1,
   1052                                _bcmFieldSliceSrcEntitySelect,
   1053                                _bcmFieldFwdEntityModPortGport, f1_ofs + 26, 8);
   1054     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
   1055                                _bcmFieldSliceSelFpf1, 1,
   1056                                _bcmFieldSliceSrcEntitySelect,
   1057                                _bcmFieldFwdEntityCommonGport, f1_ofs + 19, 17);
   1058     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
   1059                  _bcmFieldSliceSelFpf1, 1, f1_ofs + 35, 1);
   1060     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
   1061                  _bcmFieldSliceSelFpf1, 1, f1_ofs + 36, 3);
   1062 
   1063     /* IFP single wide F1_2  (f1_ofs = 194 - 2)*/
   1064     
   1065     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   1066                                _bcmFieldSliceSelFpf1, 2,
   1067                                _bcmFieldSliceDstFwdEntitySelect,
   1068                                _bcmFieldFwdEntityGlp, f1_ofs, 19);
   1069     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   1070                                _bcmFieldSliceSelFpf1, 2,
   1071                                _bcmFieldSliceDstFwdEntitySelect,
   1072                                _bcmFieldFwdEntityCommonGport, f1_ofs, 19);
   1073     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   1074                                _bcmFieldSliceSelFpf1, 2,
   1075                                _bcmFieldSliceDstFwdEntitySelect,
   1076                                _bcmFieldFwdEntityGlp, f1_ofs, 19);
   1077     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   1078                                _bcmFieldSliceSelFpf1, 2,
   1079                                _bcmFieldSliceDstFwdEntitySelect,
   1080                                _bcmFieldFwdEntityMplsGport, f1_ofs, 19);
   1081     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   1082                                _bcmFieldSliceSelFpf1, 2,
   1083                                _bcmFieldSliceDstFwdEntitySelect,
   1084                                _bcmFieldFwdEntityVlanGport, f1_ofs, 19);
   1085     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   1086                                _bcmFieldSliceSelFpf1, 2,
   1087                                _bcmFieldSliceDstFwdEntitySelect,
   1088                                _bcmFieldFwdEntityMimGport, f1_ofs, 19);
   1089     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   1090                                _bcmFieldSliceSelFpf1, 2,
   1091                                _bcmFieldSliceDstFwdEntitySelect,
   1092                                _bcmFieldFwdEntityL3Egress, f1_ofs, 19);
   1093     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1094                                bcmFieldQualifyDstL3EgressNextHops,
   1095                                _bcmFieldSliceSelFpf1, 2,
   1096                                _bcmFieldSliceDstFwdEntitySelect,
   1097                                _bcmFieldFwdEntityL3Egress, f1_ofs, 19);
   1098     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   1099                                _bcmFieldSliceSelFpf1, 2,
   1100                                _bcmFieldSliceDstFwdEntitySelect,
   1101                                _bcmFieldFwdEntityMulticastGroup, f1_ofs, 19);
   1102     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
   1103                                _bcmFieldSliceSelFpf1, 2,
   1104                                _bcmFieldSliceDstFwdEntitySelect,
   1105                                _bcmFieldFwdEntityMultipath, f1_ofs, 19);
   1106     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
   1107                  _bcmFieldSliceSelFpf1, 2, f1_ofs + 19, 3);
   1108     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   1109                                _bcmFieldSliceSelFpf1, 2,
   1110                                _bcmFieldSliceDstClassSelect, 0, f1_ofs + 22, 6);
   1111     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   1112                                _bcmFieldSliceSelFpf1, 2,
   1113                                _bcmFieldSliceDstClassSelect, 1, f1_ofs + 22, 6);
   1114     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1115                                _bcmFieldSliceSelFpf1, 2,
   1116                                _bcmFieldSliceDstClassSelect, 2, f1_ofs + 22, 6);
   1117     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1118                                _bcmFieldSliceSelFpf1, 2,
   1119                                _bcmFieldSliceDstClassSelect, 3, f1_ofs + 22, 6);
   1120     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1121                                _bcmFieldSliceSelFpf1, 2,
   1122                                _bcmFieldSliceSrcClassSelect, 0, f1_ofs + 28, 6);
   1123     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   1124                                _bcmFieldSliceSelFpf1, 2,
   1125                                _bcmFieldSliceSrcClassSelect, 1, f1_ofs + 28, 6);
   1126     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1127                                _bcmFieldSliceSelFpf1, 2,
   1128                                _bcmFieldSliceSrcClassSelect, 2, f1_ofs + 28, 6);
   1129     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1130                                _bcmFieldSliceSelFpf1, 2,
   1131                                _bcmFieldSliceSrcClassSelect, 3, f1_ofs + 28, 6);
   1132 
   1133     /* IFP single wide F1_3  (f1_ofs = 194 - 2)*/
   1134     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1135                  _bcmFieldSliceSelFpf1, 3, f1_ofs, 16);
   1136     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1137                  _bcmFieldSliceSelFpf1, 3, f1_ofs, 12);
   1138     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1139                  _bcmFieldSliceSelFpf1, 3, f1_ofs + 12, 1);
   1140     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1141                  _bcmFieldSliceSelFpf1, 3, f1_ofs + 13, 3);
   1142     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1143                  _bcmFieldSliceSelFpf1, 3, f1_ofs + 16, 16);
   1144     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1145                  _bcmFieldSliceSelFpf1, 3, f1_ofs + 16, 12);
   1146     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1147                  _bcmFieldSliceSelFpf1, 3, f1_ofs + 28, 1);
   1148     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1149                  _bcmFieldSliceSelFpf1, 3, f1_ofs + 29, 3);
   1150     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
   1151                  _bcmFieldSliceSelFpf1, 3, f1_ofs + 32, 2);
   1152 
   1153     /* IFP single wide F1_4  (f1_ofs = 194 - 2)*/
   1154     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1155                  _bcmFieldSliceSelFpf1, 4, f1_ofs, 16);
   1156     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1157                  _bcmFieldSliceSelFpf1, 4, f1_ofs, 12);
   1158     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1159                  _bcmFieldSliceSelFpf1, 4, f1_ofs + 12, 1);
   1160     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1161                  _bcmFieldSliceSelFpf1, 4, f1_ofs + 13, 3);
   1162     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1163                  _bcmFieldSliceSelFpf1, 4, f1_ofs + 16, 16);
   1164 
   1165     /* IFP single wide F1_5  (f1_ofs = 194 - 2)*/
   1166     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
   1167                  _bcmFieldSliceSelFpf1, 5, f1_ofs, 1);
   1168     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
   1169                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 1, 2);
   1170     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
   1171                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 3, 1);
   1172     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
   1173                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 4, 2);
   1174     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
   1175                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 6, 1);
   1176     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
   1177                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 7, 1);
   1178     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
   1179                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 8, 1);
   1180     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
   1181                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 9, 1);
   1182     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
   1183                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 10, 1);
   1184     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
   1185                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 10, 1);
   1186     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
   1187                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 11, 1);
   1188     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
   1189                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 12, 1);
   1190     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
   1191                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 13, 1);
   1192     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
   1193                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 14, 1);
   1194     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit,
   1195                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 15, 1);
   1196     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit,
   1197                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 16, 1);
   1198     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillEgressRbridgeHit,
   1199                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 16, 1);
   1200     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit,
   1201                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 16, 1);
   1202     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit,
   1203                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 16, 1);
   1204     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit,
   1205                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 17, 1);
   1206     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTrillIngressRbridgeHit,
   1207                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 17, 1);
   1208     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit,
   1209                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 17, 1);
   1210     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit,
   1211                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 17, 1);
   1212     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1213                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 18, 16);
   1214     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1215                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 18, 12);
   1216     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1217                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 30, 1);
   1218     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1219                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 31, 3);
   1220     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
   1221                  _bcmFieldSliceSelFpf1, 5, f1_ofs + 34, 2);
   1222 
   1223     /* IFP single wide F1_6  (f1_ofs = 194 - 2)*/
   1224     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1225                  _bcmFieldSliceSelFpf1, 6, f1_ofs, 16);
   1226     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1227                  _bcmFieldSliceSelFpf1, 6, f1_ofs, 12);
   1228     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1229                  _bcmFieldSliceSelFpf1, 6, f1_ofs + 12, 1);
   1230     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1231                  _bcmFieldSliceSelFpf1, 6, f1_ofs + 13, 3);
   1232     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1233                  _bcmFieldSliceSelFpf1, 6, f1_ofs + 16, 2);
   1234     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   1235                  _bcmFieldSliceSelFpf1, 6, f1_ofs + 18, 2);
   1236     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
   1237                  _bcmFieldSliceSelFpf1, 6, f1_ofs + 20, 2);
   1238     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
   1239                  _bcmFieldSliceSelFpf1, 6, f1_ofs + 22, 3);
   1240     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
   1241                  _bcmFieldSliceSelFpf1, 6, f1_ofs + 25, 6);
   1242     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
   1243                  _bcmFieldSliceSelFpf1, 6, f1_ofs + 31, 3);
   1244 
   1245     /* IFP single wide F1_7  (f1_ofs = 194 - 2)*/
   1246     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1247                  _bcmFieldSliceSelFpf1, 7, f1_ofs, 16);
   1248     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1249                  _bcmFieldSliceSelFpf1, 7, f1_ofs, 12);
   1250     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1251                  _bcmFieldSliceSelFpf1, 7, f1_ofs + 12, 1);
   1252     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1253                  _bcmFieldSliceSelFpf1, 7, f1_ofs + 13, 3);
   1254     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1255                                _bcmFieldSliceSelFpf1, 7,
   1256                                _bcmFieldSliceSrcClassSelect, 0, f1_ofs + 16, 6);
   1257     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   1258                                _bcmFieldSliceSelFpf1, 7,
   1259                                _bcmFieldSliceSrcClassSelect, 1, f1_ofs + 16, 6);
   1260     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1261                                _bcmFieldSliceSelFpf1, 7,
   1262                                _bcmFieldSliceSrcClassSelect, 2, f1_ofs + 16, 6);
   1263     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1264                                _bcmFieldSliceSelFpf1, 7,
   1265                                _bcmFieldSliceSrcClassSelect, 3, f1_ofs + 16, 6);
   1266     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   1267                                _bcmFieldSliceSelFpf1, 7,
   1268                                _bcmFieldSliceFwdFieldSelect, 
   1269                                _bcmFieldFwdFieldVrf, f1_ofs + 22, 12);
   1270     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   1271                                _bcmFieldSliceSelFpf1, 7,
   1272                                _bcmFieldSliceFwdFieldSelect, 
   1273                                _bcmFieldFwdFieldVpn, f1_ofs + 22, 12);
   1274     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
   1275                                bcmFieldQualifyForwardingVlanId,
   1276                                _bcmFieldSliceSelFpf1, 7,
   1277                                _bcmFieldSliceFwdFieldSelect, 
   1278                                _bcmFieldFwdFieldVlan, f1_ofs + 22, 12);
   1279     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsOuterLabelPop,
   1280                  _bcmFieldSliceSelFpf1, 7, f1_ofs + 34 , 1);
   1281     _FP_QUAL_ADD(unit, stage_fc, 
   1282                  bcmFieldQualifyMplsStationHitTunnelUnterminated,
   1283                  _bcmFieldSliceSelFpf1, 7, f1_ofs + 35, 1);
   1284     _FP_QUAL_ADD(unit, stage_fc,
   1285                  bcmFieldQualifyGenericAssociatedChannelLabelValid,
   1286                  _bcmFieldSliceSelFpf1, 7, f1_ofs + 36, 1);
   1287     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid,
   1288                  _bcmFieldSliceSelFpf1, 7, f1_ofs + 37, 1);
   1289 
   1290     /* IFP single wide F1_8  (f1_ofs = 194 - 2)*/
   1291     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1292                  _bcmFieldSliceSelFpf1, 8, f1_ofs, 8);
   1293     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1294                                _bcmFieldSliceSelFpf1, 8,
   1295                                _bcmFieldSliceTosClassSelect, 0,
   1296                                f1_ofs + 8, 8);
   1297     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
   1298                                _bcmFieldSliceSelFpf1, 8,
   1299                                _bcmFieldSliceTosClassSelect, 0,
   1300                                f1_ofs + 8, 8);
   1301     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
   1302                                _bcmFieldSliceSelFpf1, 8,
   1303                                _bcmFieldSliceTosClassSelect, 1,
   1304                                f1_ofs + 8, 8);
   1305     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1306                                _bcmFieldSliceSelFpf1, 8,
   1307                                _bcmFieldSliceSrcClassSelect, 0, f1_ofs + 16, 6);
   1308     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   1309                                _bcmFieldSliceSelFpf1, 8,
   1310                                _bcmFieldSliceSrcClassSelect, 1, f1_ofs + 16, 6);
   1311     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1312                                _bcmFieldSliceSelFpf1, 8,
   1313                                _bcmFieldSliceSrcClassSelect, 2, f1_ofs + 16, 6);
   1314     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1315                                _bcmFieldSliceSelFpf1, 8,
   1316                                _bcmFieldSliceSrcClassSelect, 3, f1_ofs + 16, 6);
   1317     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   1318                                _bcmFieldSliceSelFpf1, 8,
   1319                                _bcmFieldSliceFwdFieldSelect, 
   1320                                _bcmFieldFwdFieldVrf, f1_ofs + 22, 12);
   1321     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   1322                                _bcmFieldSliceSelFpf1, 8,
   1323                                _bcmFieldSliceFwdFieldSelect, 
   1324                                _bcmFieldFwdFieldVpn, f1_ofs + 22, 12);
   1325     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
   1326                                bcmFieldQualifyForwardingVlanId,
   1327                                _bcmFieldSliceSelFpf1, 8,
   1328                                _bcmFieldSliceFwdFieldSelect, 
   1329                                _bcmFieldFwdFieldVlan, f1_ofs + 22, 12);
   1330 
   1331     /* IFP single wide F1_9  (f1_ofs = 194 - 2)*/
   1332     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData2,
   1333                  _bcmFieldSliceSelFpf1, 9, f1_ofs, 32);
   1334     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsOuterLabelPop,
   1335                  _bcmFieldSliceSelFpf1, 9, f1_ofs + 32 , 1);
   1336     _FP_QUAL_ADD(unit, stage_fc, 
   1337                  bcmFieldQualifyMplsStationHitTunnelUnterminated,
   1338                  _bcmFieldSliceSelFpf1, 9, f1_ofs + 33, 1);
   1339     _FP_QUAL_ADD(unit, stage_fc,
   1340                  bcmFieldQualifyGenericAssociatedChannelLabelValid,
   1341                  _bcmFieldSliceSelFpf1, 9, f1_ofs + 36, 1);
   1342     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRouterAlertLabelValid,
   1343                  _bcmFieldSliceSelFpf1, 9, f1_ofs + 37, 1);
   1344 
   1345     /* IFP single wide F1_10  (f1_ofs = 194 - 2)*/
   1346     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   1347                                _bcmFieldSliceSelFpf1, 10,
   1348                                _bcmFieldSliceDstFwdEntitySelect,
   1349                                _bcmFieldFwdEntityGlp, f1_ofs, 19);
   1350     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   1351                                _bcmFieldSliceSelFpf1, 10,
   1352                                _bcmFieldSliceDstFwdEntitySelect,
   1353                                _bcmFieldFwdEntityCommonGport, f1_ofs, 19);
   1354     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   1355                                _bcmFieldSliceSelFpf1, 10,
   1356                                _bcmFieldSliceDstFwdEntitySelect,
   1357                                _bcmFieldFwdEntityGlp, f1_ofs, 19);
   1358     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   1359                                _bcmFieldSliceSelFpf1, 10,
   1360                                _bcmFieldSliceDstFwdEntitySelect,
   1361                                _bcmFieldFwdEntityMplsGport, f1_ofs, 19);
   1362     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   1363                                _bcmFieldSliceSelFpf1, 10,
   1364                                _bcmFieldSliceDstFwdEntitySelect,
   1365                                _bcmFieldFwdEntityVlanGport, f1_ofs, 19);
   1366     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   1367                                _bcmFieldSliceSelFpf1, 10,
   1368                                _bcmFieldSliceDstFwdEntitySelect,
   1369                                _bcmFieldFwdEntityMimGport, f1_ofs, 19);
   1370     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   1371                                _bcmFieldSliceSelFpf1, 10,
   1372                                _bcmFieldSliceDstFwdEntitySelect,
   1373                                _bcmFieldFwdEntityL3Egress, f1_ofs, 19);
   1374     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1375                                bcmFieldQualifyDstL3EgressNextHops,
   1376                                _bcmFieldSliceSelFpf1, 10,
   1377                                _bcmFieldSliceDstFwdEntitySelect,
   1378                                _bcmFieldFwdEntityL3Egress, f1_ofs, 19);
   1379     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   1380                                _bcmFieldSliceSelFpf1, 10,
   1381                                _bcmFieldSliceDstFwdEntitySelect,
   1382                                _bcmFieldFwdEntityMulticastGroup, f1_ofs, 19);
   1383     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
   1384                                _bcmFieldSliceSelFpf1, 10,
   1385                                _bcmFieldSliceDstFwdEntitySelect,
   1386                                _bcmFieldFwdEntityMultipath, f1_ofs, 19);
   1387     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   1388                  _bcmFieldSliceSelFpf1, 10, f1_ofs + 19, 16);
   1389     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   1390                  _bcmFieldSliceSelFpf1, 10, f1_ofs + 19, 16);
   1391 
   1392     /* IFP single wide F1_11  (f1_ofs = 194 - 2)*/
   1393     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   1394                  _bcmFieldSliceSelFpf1, 11, f1_ofs, 16);
   1395     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   1396                  _bcmFieldSliceSelFpf1, 11, f1_ofs, 16);
   1397     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   1398                  _bcmFieldSliceSelFpf1, 11, f1_ofs, 16);
   1399     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   1400                  _bcmFieldSliceSelFpf1, 11, f1_ofs + 7, 9);
   1401     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   1402                  _bcmFieldSliceSelFpf1, 11, f1_ofs + 16, 14);
   1403     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   1404                  _bcmFieldSliceSelFpf1, 11, f1_ofs + 16, 14);
   1405     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   1406                  _bcmFieldSliceSelFpf1, 11, f1_ofs + 16, 14);
   1407     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
   1408                  _bcmFieldSliceSelFpf1, 11, f1_ofs + 29, 1);
   1409     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   1410                  _bcmFieldSliceSelFpf1, 11, f1_ofs + 30, 2);
   1411     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   1412                  _bcmFieldSliceSelFpf1, 11, f1_ofs + 32, 4);
   1413 
   1414     /* IFP single wide F1_12  (f1_ofs = 194 - 2)*/
   1415     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1416                  _bcmFieldSliceSelFpf1, 12, f1_ofs, 12);
   1417     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   1418                                _bcmFieldSliceSelFpf1, 12,
   1419                                _bcmFieldSliceDstClassSelect, 0, f1_ofs + 12, 6);
   1420     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   1421                                _bcmFieldSliceSelFpf1, 12,
   1422                                _bcmFieldSliceDstClassSelect, 1, f1_ofs + 12, 6);
   1423     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1424                                _bcmFieldSliceSelFpf1, 12,
   1425                                _bcmFieldSliceDstClassSelect, 2, f1_ofs + 12, 6);
   1426     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1427                                _bcmFieldSliceSelFpf1, 12,
   1428                                _bcmFieldSliceDstClassSelect, 3, f1_ofs + 12, 6);
   1429     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1430                                _bcmFieldSliceSelFpf1, 12,
   1431                                _bcmFieldSliceSrcClassSelect, 0, f1_ofs + 18, 6);
   1432     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   1433                                _bcmFieldSliceSelFpf1, 12,
   1434                                _bcmFieldSliceSrcClassSelect, 1, f1_ofs + 18, 6);
   1435     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1436                                _bcmFieldSliceSelFpf1, 12,
   1437                                _bcmFieldSliceSrcClassSelect, 2, f1_ofs + 18, 6);
   1438     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1439                                _bcmFieldSliceSelFpf1, 12,
   1440                                _bcmFieldSliceSrcClassSelect, 3, f1_ofs + 18, 6);
   1441     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   1442                                _bcmFieldSliceSelFpf1, 12,
   1443                                _bcmFieldSliceIngressEntitySelect,
   1444                                _bcmFieldFwdEntityMplsGport, f1_ofs + 24, 13);
   1445     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   1446                                _bcmFieldSliceSelFpf1, 12,
   1447                                _bcmFieldSliceIngressEntitySelect,
   1448                                _bcmFieldFwdEntityVlanGport, f1_ofs + 24, 13);
   1449     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   1450                                _bcmFieldSliceSelFpf1, 12,
   1451                                _bcmFieldSliceIngressEntitySelect,
   1452                                _bcmFieldFwdEntityMimGport, f1_ofs + 24, 13);
   1453     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction,
   1454                  _bcmFieldSliceSelFpf1, 12, f1_ofs + 37, 3);
   1455 
   1456     /* IFP single wide F1_13  (f1_ofs = 194 - 2)*/
   1457     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag,
   1458                                _bcmFieldSliceSelFpf1, 13,
   1459                                _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagVn,
   1460                                f1_ofs, 33);
   1461     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySubportPktTag,
   1462                                _bcmFieldSliceSelFpf1, 13,
   1463                                _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagVxlanOrLLTag,
   1464                                f1_ofs, 33);
   1465     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag,
   1466                                _bcmFieldSliceSelFpf1, 13,
   1467                                _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagCn,
   1468                                f1_ofs, 33);
   1469     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag,
   1470                                _bcmFieldSliceSelFpf1, 13,
   1471                                _bcmFieldSliceAuxTag1Select, _bcmFieldAuxTagFabricQueue,
   1472                                f1_ofs, 33);
   1473     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1474                                bcmFieldQualifyMplsForwardingLabel,
   1475                                _bcmFieldSliceSelFpf1, 13,
   1476                                _bcmFieldSliceAuxTag1Select,
   1477                                _bcmFieldAuxTagMplsFwdingLabel, f1_ofs, 33);
   1478     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord,
   1479                                _bcmFieldSliceSelFpf1, 13,
   1480                                _bcmFieldSliceAuxTag1Select,
   1481                                _bcmFieldAuxTagMplsCntlWord, f1_ofs, 33);
   1482     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelTtl,
   1483                      _bcmFieldDevSelDisable, 0,
   1484                      _bcmFieldSliceSelFpf1, 13,
   1485                      _bcmFieldSliceAuxTag1Select,
   1486                      _bcmFieldAuxTagMplsFwdingLabel, 0,
   1487                      f1_ofs, 8, f1_ofs + 32, 1, 0, 0, 0);
   1488     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelBos,
   1489                      _bcmFieldDevSelDisable, 0,
   1490                      _bcmFieldSliceSelFpf1, 13,
   1491                      _bcmFieldSliceAuxTag1Select,
   1492                      _bcmFieldAuxTagMplsFwdingLabel, 0,
   1493                      f1_ofs + 8, 1, f1_ofs + 32, 1, 0, 0, 0);
   1494     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelExp,
   1495                      _bcmFieldDevSelDisable, 0,
   1496                      _bcmFieldSliceSelFpf1, 13,
   1497                      _bcmFieldSliceAuxTag1Select,
   1498                      _bcmFieldAuxTagMplsFwdingLabel, 0,
   1499                      f1_ofs + 9, 3, f1_ofs + 32, 1, 0, 0, 0);
   1500     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1501                                bcmFieldQualifyMplsForwardingLabelId,
   1502                                _bcmFieldSliceSelFpf1, 13,
   1503                                _bcmFieldSliceAuxTag1Select,
   1504                                _bcmFieldAuxTagMplsFwdingLabel, f1_ofs + 12, 21);
   1505     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashUpper,
   1506                                _bcmFieldSliceSelFpf1, 13,
   1507                                _bcmFieldSliceAuxTag1Select,
   1508                                _bcmFieldAuxTagRtag7A, f1_ofs + 16, 17);
   1509     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7AHashLower,
   1510                      _bcmFieldDevSelDisable, 0,
   1511                      _bcmFieldSliceSelFpf1, 13,
   1512                      _bcmFieldSliceAuxTag1Select,
   1513                      _bcmFieldAuxTagRtag7A, 0,
   1514                      f1_ofs, 16, f1_ofs + 32, 1, 0, 0, 0);
   1515     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashUpper,
   1516                                _bcmFieldSliceSelFpf1, 13,
   1517                                _bcmFieldSliceAuxTag1Select,
   1518                                _bcmFieldAuxTagRtag7B, f1_ofs + 16, 17);
   1519     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyRtag7BHashLower,
   1520                      _bcmFieldDevSelDisable, 0,
   1521                      _bcmFieldSliceSelFpf1, 13,
   1522                      _bcmFieldSliceAuxTag1Select,
   1523                      _bcmFieldAuxTagRtag7B, 0,
   1524                      f1_ofs, 16, f1_ofs + 32, 1, 0, 0, 0);
   1525     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyLlidValue,
   1526                      _bcmFieldDevSelDisable, 0,
   1527                      _bcmFieldSliceSelFpf1, 13,
   1528                      _bcmFieldSliceAuxTag1Select,
   1529                      _bcmFieldAuxTagVxlanOrLLTag, 0,
   1530                      f1_ofs, 16, f1_ofs + 32, 1, 0, 0, 0);
   1531     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid,
   1532                  _bcmFieldSliceSelFpf1, 13, f1_ofs + 33, 1);
   1533    _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsForwardingLabelAction,
   1534                  _bcmFieldSliceSelFpf1, 13, f1_ofs + 34, 3);
   1535 
   1536     /* IFP DWF4_1 (dw_f4_ofs = 3 - 3 + 1)*/
   1537     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1538                             _bcmFieldSliceSelFpf4, 1,
   1539                             _bcmFieldSliceTcpClassSelect, 0, dw_f4_ofs, 6);
   1540     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
   1541                             _bcmFieldSliceSelFpf4, 1,
   1542                             _bcmFieldSliceTcpClassSelect, 0, dw_f4_ofs, 6);
   1543     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
   1544                             _bcmFieldSliceSelFpf4, 1,
   1545                             _bcmFieldSliceTcpClassSelect, 1, dw_f4_ofs, 6);
   1546 
   1547     /* IFP DWF3 (dw_f3_ofs = 11 - 3 + 1,)*/
   1548     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1549                             _bcmFieldSliceSelDisable, 0,
   1550                             _bcmFieldSliceTosClassSelect, 0, dw_f3_ofs, 8);
   1551     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
   1552                             _bcmFieldSliceSelDisable, 0,
   1553                             _bcmFieldSliceTosClassSelect, 0, dw_f3_ofs, 8);
   1554     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
   1555                             _bcmFieldSliceSelDisable, 0,
   1556                             _bcmFieldSliceTosClassSelect, 1, dw_f3_ofs, 8);
   1557     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1558                             _bcmFieldSliceSelDisable, 0,
   1559                             _bcmFieldSliceSelDisable, 0, dw_f3_ofs + 8, 8);
   1560     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc,
   1561                             bcmFieldQualifyExtensionHeaderSubCode,
   1562                             _bcmFieldSliceSelDisable, 0,
   1563                             _bcmFieldSliceSelDisable, 0, dw_f3_ofs + 16, 8);
   1564     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   1565                             _bcmFieldSliceSelDisable, 0,
   1566                             _bcmFieldSliceSelDisable, 0, dw_f3_ofs + 24, 8);
   1567 
   1568     /* IFP DWF2_0 (dw_f2_ofs = = 43 - 3 + 1)*/
   1569     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
   1570                             _bcmFieldSliceSelFpf2, 0,
   1571                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14, 1);
   1572     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
   1573                             _bcmFieldSliceSelFpf2, 0,
   1574                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 + 1, 2);
   1575     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
   1576                             _bcmFieldSliceSelFpf2, 0,
   1577                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 + 3, 1);
   1578     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
   1579                             _bcmFieldSliceSelFpf2, 0,
   1580                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 + 4, 2);
   1581     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
   1582                             _bcmFieldSliceSelFpf2, 0,
   1583                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 + 6, 1);
   1584     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
   1585                             _bcmFieldSliceSelFpf2, 0,
   1586                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 + 7, 1);
   1587     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
   1588                             _bcmFieldSliceSelFpf2, 0,
   1589                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 + 8, 1);
   1590     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
   1591                             _bcmFieldSliceSelFpf2, 0,
   1592                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 + 9, 1);
   1593     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
   1594                             _bcmFieldSliceSelFpf2, 0,
   1595                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +10, 1);
   1596     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
   1597                             _bcmFieldSliceSelFpf2, 0,
   1598                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +10, 1);
   1599     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
   1600                             _bcmFieldSliceSelFpf2, 0,
   1601                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +11, 1);
   1602     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
   1603                             _bcmFieldSliceSelFpf2, 0,
   1604                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +12, 1);
   1605     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
   1606                             _bcmFieldSliceSelFpf2, 0,
   1607                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +13, 1);
   1608     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
   1609                             _bcmFieldSliceSelFpf2, 0,
   1610                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +14, 1);
   1611     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpTunnelHit,
   1612                             _bcmFieldSliceSelFpf2, 0,
   1613                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +15, 1);
   1614     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel1Hit,
   1615                             _bcmFieldSliceSelFpf2, 0,
   1616                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +16, 1);
   1617     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc,
   1618                             bcmFieldQualifyTrillEgressRbridgeHit,
   1619                             _bcmFieldSliceSelFpf2, 0,
   1620                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +16, 1);
   1621     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2GreSrcIpHit,
   1622                             _bcmFieldSliceSelFpf2, 0,
   1623                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +16, 1);
   1624     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMimSrcGportHit,
   1625                             _bcmFieldSliceSelFpf2, 0,
   1626                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +16, 1);
   1627     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsLabel2Hit,
   1628                             _bcmFieldSliceSelFpf2, 0,
   1629                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +17, 1);
   1630     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc,
   1631                             bcmFieldQualifyTrillIngressRbridgeHit,
   1632                             _bcmFieldSliceSelFpf2, 0,
   1633                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +17, 1);
   1634     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2GreVfiHit,
   1635                             _bcmFieldSliceSelFpf2, 0,
   1636                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +17, 1);
   1637     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMimVfiHit,
   1638                             _bcmFieldSliceSelFpf2, 0,
   1639                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 14 +17, 1);
   1640     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck,
   1641                             _bcmFieldSliceSelFpf2, 0,
   1642                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs + 32, 24);
   1643     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31,
   1644                             _bcmFieldSliceSelFpf2, 0,
   1645                             _bcmFieldSliceIntfClassSelect, 3,
   1646                             dw_f2_ofs + 56, 8);
   1647     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1648                             _bcmFieldSliceSelFpf2, 0,
   1649                             _bcmFieldSliceIntfClassSelect, 0,
   1650                             dw_f2_ofs + 56, 8);
   1651     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassVPort,
   1652                             _bcmFieldSliceSelFpf2, 0,
   1653                             _bcmFieldSliceIntfClassSelect, 1,
   1654                             dw_f2_ofs + 56, 8);
   1655     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   1656                             _bcmFieldSliceSelFpf2, 0,
   1657                             _bcmFieldSliceIntfClassSelect, 1,
   1658                             dw_f2_ofs + 56, 8);
   1659     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   1660                             _bcmFieldSliceSelFpf2, 0,
   1661                             _bcmFieldSliceIntfClassSelect, 2,
   1662                             dw_f2_ofs + 56, 8);
   1663     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1664                             _bcmFieldSliceSelFpf2, 0,
   1665                             _bcmFieldSliceSelDisable, 0,
   1666                             dw_f2_ofs + 64, 32);
   1667     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1668                             _bcmFieldSliceSelFpf2, 0,
   1669                             _bcmFieldSliceSelDisable, 0,
   1670                             dw_f2_ofs + 96, 32);
   1671 
   1672     /* IFP DWF2_1 (dw_f2_ofs = = 43 - 3 + 1)*/
   1673     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   1674                             _bcmFieldSliceSelFpf2, 1,
   1675                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs, 128);
   1676 
   1677     /* IFP DWF2_2 (dw_f2_ofs = = 43 - 3 + 1)*/
   1678     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   1679                             _bcmFieldSliceSelFpf2, 2,
   1680                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs, 128);
   1681 
   1682     /* IFP DWF2_3 (dw_f2_ofs = = 43 - 3 + 1)*/
   1683     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyData1,
   1684                             _bcmFieldSliceSelFpf2, 3,
   1685                             _bcmFieldSliceSelDisable, 0, dw_f2_ofs, 128);
   1686     /* IFP DWF1_0  (dw_f1_ofs = 171 - 3 + 1)*/
   1687     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1688                             _bcmFieldSliceSelFpf1, 0,
   1689                             _bcmFieldSliceTtlClassSelect, 0, dw_f1_ofs, 8);
   1690     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
   1691                             _bcmFieldSliceSelFpf1, 0,
   1692                             _bcmFieldSliceTtlClassSelect, 0, dw_f1_ofs, 8);
   1693     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
   1694                             _bcmFieldSliceSelFpf1, 0,
   1695                             _bcmFieldSliceTtlClassSelect, 1, dw_f1_ofs, 8);
   1696     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1697                             _bcmFieldSliceSelFpf1, 0,
   1698                             _bcmFieldSliceSelDisable, 0, dw_f1_ofs + 8, 2);
   1699     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1700                             _bcmFieldSliceSelFpf1, 0,
   1701                             _bcmFieldSliceSelDisable, 0, dw_f1_ofs + 10, 16);
   1702     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1703                             _bcmFieldSliceSelFpf1, 0,
   1704                             _bcmFieldSliceSelDisable, 0, dw_f1_ofs + 26, 16);
   1705     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   1706                             _bcmFieldSliceSelFpf1, 0,
   1707                             _bcmFieldSliceSelDisable, 0, dw_f1_ofs + 26, 16);
   1708     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   1709                             _bcmFieldSliceSelFpf1, 0,
   1710                             _bcmFieldSliceDstFwdEntitySelect,
   1711                             _bcmFieldFwdEntityGlp, dw_f1_ofs + 42, 19);
   1712     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   1713                             _bcmFieldSliceSelFpf1, 0,
   1714                             _bcmFieldSliceDstFwdEntitySelect,
   1715                             _bcmFieldFwdEntityCommonGport, dw_f1_ofs + 42, 19);
   1716     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   1717                             _bcmFieldSliceSelFpf1, 0,
   1718                             _bcmFieldSliceDstFwdEntitySelect,
   1719                             _bcmFieldFwdEntityGlp, dw_f1_ofs + 42, 19);
   1720     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   1721                             _bcmFieldSliceSelFpf1, 0,
   1722                             _bcmFieldSliceDstFwdEntitySelect,
   1723                             _bcmFieldFwdEntityMplsGport, dw_f1_ofs + 42, 19);
   1724     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   1725                             _bcmFieldSliceSelFpf1, 0,
   1726                             _bcmFieldSliceDstFwdEntitySelect,
   1727                             _bcmFieldFwdEntityVlanGport, dw_f1_ofs + 42, 19);
   1728     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   1729                             _bcmFieldSliceSelFpf1, 0,
   1730                             _bcmFieldSliceDstFwdEntitySelect,
   1731                             _bcmFieldFwdEntityMimGport, dw_f1_ofs + 42, 19);
   1732     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   1733                             _bcmFieldSliceSelFpf1, 0,
   1734                             _bcmFieldSliceDstFwdEntitySelect,
   1735                             _bcmFieldFwdEntityL3Egress, dw_f1_ofs + 42, 19);
   1736     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
   1737                             _bcmFieldSliceSelFpf1, 0,
   1738                             _bcmFieldSliceDstFwdEntitySelect,
   1739                             _bcmFieldFwdEntityL3Egress, dw_f1_ofs + 42, 19);
   1740     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   1741                             _bcmFieldSliceSelFpf1, 0,
   1742                             _bcmFieldSliceDstFwdEntitySelect,
   1743                             _bcmFieldFwdEntityMulticastGroup,
   1744                             dw_f1_ofs + 42, 19);
   1745     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
   1746                             _bcmFieldSliceSelFpf1, 0,
   1747                             _bcmFieldSliceDstFwdEntitySelect,
   1748                             _bcmFieldFwdEntityMultipath, dw_f1_ofs + 42, 19);
   1749 
   1750     /* IFP DWF1_1  (dw_f1_ofs = 171 - 3 + 1)*/
   1751     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc,
   1752                             bcmFieldQualifyMplsForwardingLabelId,
   1753                             _bcmFieldSliceSelFpf1, 1,
   1754                             _bcmFieldSliceSelDisable, 0, dw_f1_ofs, 20);
   1755     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc,
   1756                             bcmFieldQualifyMplsForwardingLabelAction,
   1757                             _bcmFieldSliceSelFpf1, 1,
   1758                             _bcmFieldSliceSelDisable, 0, dw_f1_ofs + 20, 3);
   1759     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWord,
   1760                             _bcmFieldSliceSelFpf1, 1,
   1761                             _bcmFieldSliceSelDisable, 0, dw_f1_ofs + 23, 32);
   1762     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsControlWordValid,
   1763                             _bcmFieldSliceSelFpf1, 1,
   1764                             _bcmFieldSliceSelDisable, 0, dw_f1_ofs + 55, 1);
   1765 
   1766 
   1767     /* IPBM OVERLAY qualifiers for Katana2 */
   1768     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   1769                      _bcmFieldDevSelDisable, 0,
   1770                      _bcmFieldSliceSelDisable, 0,
   1771                      _bcmFieldSliceSelDisable, 0,
   1772                      1,
   1773                      0, 16,
   1774                      0, 0,
   1775                      0, 0,
   1776                      1);
   1777     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   1778                      _bcmFieldDevSelDisable, 0,
   1779                      _bcmFieldSliceSelDisable, 0,
   1780                      _bcmFieldSliceSelDisable, 0,
   1781                      1,
   1782                      0, 16,
   1783                      0, 0,
   1784                      0, 0,
   1785                      1);
   1786     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   1787                      _bcmFieldDevSelDisable, 0,
   1788                      _bcmFieldSliceSelDisable, 0,
   1789                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp,
   1790                      1,
   1791                      16, 16,
   1792                      0, 0,
   1793                      0, 0,
   1794                      1);
   1795     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   1796                      _bcmFieldDevSelDisable, 0,
   1797                      _bcmFieldSliceSelDisable, 0,
   1798                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp,
   1799                      1,
   1800                      16, 16,
   1801                      0, 0,
   1802                      0, 0,
   1803                      1);
   1804     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   1805                      _bcmFieldDevSelDisable, 0,
   1806                      _bcmFieldSliceSelDisable, 0,
   1807                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   1808                      1,
   1809                      16, 16,
   1810                      0, 0,
   1811                      0, 0,
   1812                      1);
   1813      _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   1814                      _bcmFieldDevSelDisable, 0,
   1815                      _bcmFieldSliceSelDisable, 0,
   1816                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   1817                      1,
   1818                      23, 8,
   1819                      0, 0,
   1820                      0, 0,
   1821                      1);
   1822      _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
   1823                      _bcmFieldDevSelDisable, 0,
   1824                      _bcmFieldSliceSelDisable, 0,
   1825                      _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   1826                      1,
   1827                      23, 8,
   1828                      0, 0,
   1829                      0, 0,
   1830                      1);
   1831 
   1832 
   1833     /* DONE DWF */
   1834     return (BCM_E_NONE);
   1835 }
   1836 
   1837 /*
   1838  * Function:
   1839  *     _field_kt2_lookup_qualifiers_init
   1840  * Purpose:
   1841  *     Initialize device stage lookup qaualifiers 
   1842  *     select codes & offsets
   1843  * Parameters:
   1844  *     unit       - (IN) BCM device number.
   1845  *     stage_fc   - (IN) Field Processor stage control structure. 
   1846  *
   1847  * Returns:
   1848  *     BCM_E_NONE
   1849  */
   1850 STATIC int
   1851 _field_kt2_lookup_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1852 {
   1853     const unsigned f1_ofs = 160,
   1854                    f2_ofs = 32,
   1855                    f3_ofs = 0;
   1856     _FP_QUAL_DECL;
   1857 
   1858     /* Input parameters check. */
   1859     if (NULL == stage_fc) {
   1860         return (BCM_E_PARAM);
   1861     }
   1862 
   1863     /* Enable the overlay of Sender Ethernet Address onto MACSA
   1864      * on ARP/RARP packets.
   1865      */
   1866     BCM_IF_ERROR_RETURN
   1867         (soc_reg_field32_modify(unit, ING_CONFIG_64r, REG_PORT_ANY,
   1868                                 ARP_VALIDATION_ENf, 1));
   1869 
   1870     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageLookup,
   1871                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1872     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
   1873                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1874     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   1875                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1876 
   1877     /* VFP_F3_0 */
   1878     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1879                  _bcmFieldSliceSelFpf3, 0, f3_ofs, 16);
   1880     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1881                  _bcmFieldSliceSelFpf3, 0, f3_ofs, 12);
   1882     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1883                  _bcmFieldSliceSelFpf3, 0, f3_ofs + 12, 1);
   1884     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1885                  _bcmFieldSliceSelFpf3, 0, f3_ofs + 13, 3);
   1886     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1887                  _bcmFieldSliceSelFpf3, 0, f3_ofs + 16, 16);
   1888 
   1889     /* VFP_F3_1 */
   1890     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1891                                _bcmFieldSliceSelFpf3, 1,
   1892                                _bcmFieldSliceIpHeaderSelect, 0, f3_ofs, 16);
   1893     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort,
   1894                                _bcmFieldSliceSelFpf3, 1,
   1895                                _bcmFieldSliceIpHeaderSelect, 1, f3_ofs, 16);
   1896     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1897                                _bcmFieldSliceSelFpf3, 1,
   1898                                _bcmFieldSliceIpHeaderSelect, 0,f3_ofs + 16, 16);
   1899     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   1900                                _bcmFieldSliceSelFpf3, 1,
   1901                                _bcmFieldSliceIpHeaderSelect, 1,f3_ofs + 16, 16);
   1902 
   1903     /* VFP_F3_2 */
   1904     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1905                                bcmFieldQualifyInnerTos,
   1906                                _bcmFieldSliceSelFpf3, 2,
   1907                                _bcmFieldSliceIpHeaderSelect, 1, f3_ofs, 8);
   1908     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1909                                _bcmFieldSliceSelFpf3, 2,
   1910                                _bcmFieldSliceIpHeaderSelect, 0, f3_ofs, 8);
   1911     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1912                                bcmFieldQualifyInnerIpProtocol,
   1913                                _bcmFieldSliceSelFpf3, 2,
   1914                                _bcmFieldSliceIpHeaderSelect, 1, f3_ofs + 8, 8);
   1915     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1916                                _bcmFieldSliceSelFpf3, 2,
   1917                                _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 8, 8);
   1918     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   1919                  _bcmFieldSliceSelFpf3, 2, f3_ofs + 16, 8);
   1920     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   1921                  _bcmFieldSliceSelFpf3, 2, f3_ofs + 24, 8);
   1922 
   1923     /* VFP_F3_3 */
   1924     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   1925                  _bcmFieldSliceSelFpf3, 3, f3_ofs, 8);
   1926     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1927                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 8, 16);
   1928     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1929                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 8, 12);
   1930     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1931                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 20, 1);
   1932     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1933                  _bcmFieldSliceSelFpf3, 3, f3_ofs + 21, 3);
   1934 #if defined (BCM_METROLITE_SUPPORT)
   1935     if (SOC_IS_METROLITE(unit)) {
   1936     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1937                                bcmFieldQualifySrcModuleGport,
   1938                                _bcmFieldSliceSelFpf3, 3,
   1939                                _bcmFieldSliceSrcTypeSelect, 0, f3_ofs + 24, 6);
   1940    } else 
   1941 #endif
   1942    {
   1943     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1944                                bcmFieldQualifySrcModuleGport,
   1945                                _bcmFieldSliceSelFpf3, 3,
   1946                                _bcmFieldSliceSrcTypeSelect, 0, f3_ofs + 24, 8);
   1947    }
   1948 
   1949     /* VFP_F2_0 */
   1950     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1951                                bcmFieldQualifyInnerTtl,
   1952                                _bcmFieldSliceSelFpf2, 0,
   1953                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 8);
   1954     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1955                                _bcmFieldSliceSelFpf2, 0,
   1956                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 8);
   1957     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1958                  _bcmFieldSliceSelFpf2, 0, f2_ofs + 8, 6);
   1959     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1960                                bcmFieldQualifyInnerIpFrag,
   1961                                _bcmFieldSliceSelFpf2, 0,
   1962                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 14, 2);
   1963     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1964                                _bcmFieldSliceSelFpf2, 0,
   1965                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 14, 2);
   1966     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1967                                bcmFieldQualifyInnerTos,
   1968                                _bcmFieldSliceSelFpf2, 0,
   1969                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 16, 8);
   1970     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1971                                _bcmFieldSliceSelFpf2, 0,
   1972                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 16, 8);
   1973     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort,
   1974                                _bcmFieldSliceSelFpf2, 0,
   1975                                _bcmFieldSliceIpHeaderSelect, 1,f2_ofs + 24, 16);
   1976     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1977                                _bcmFieldSliceSelFpf2, 0,
   1978                                _bcmFieldSliceIpHeaderSelect, 0,f2_ofs + 24, 16);
   1979     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   1980                                _bcmFieldSliceSelFpf2, 0,
   1981                                _bcmFieldSliceIpHeaderSelect, 1,f2_ofs + 40, 16);
   1982     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1983                                _bcmFieldSliceSelFpf2, 0,
   1984                                _bcmFieldSliceIpHeaderSelect, 0,f2_ofs + 40, 16);
   1985     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1986                                bcmFieldQualifyInnerIpProtocol,
   1987                                _bcmFieldSliceSelFpf2, 0,
   1988                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 56, 8);
   1989     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1990                                _bcmFieldSliceSelFpf2, 0,
   1991                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 56, 8);
   1992     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1993                                bcmFieldQualifyInnerDstIp,
   1994                                _bcmFieldSliceSelFpf2, 0,
   1995                                _bcmFieldSliceIpHeaderSelect, 1,f2_ofs + 64, 32);
   1996     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1997                                _bcmFieldSliceSelFpf2, 0,
   1998                                _bcmFieldSliceIpHeaderSelect, 0,f2_ofs + 64, 32);
   1999     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2000                                bcmFieldQualifyInnerSrcIp,
   2001                                _bcmFieldSliceSelFpf2, 0,
   2002                                _bcmFieldSliceIpHeaderSelect, 1,f2_ofs + 96, 32);
   2003     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   2004                                _bcmFieldSliceSelFpf2, 0,
   2005                                _bcmFieldSliceIpHeaderSelect, 0,f2_ofs + 96, 32);
   2006     /* VFP_F2_1 */
   2007     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2008                                bcmFieldQualifyInnerSrcIp6,
   2009                                _bcmFieldSliceSelFpf2, 1,
   2010                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 128);
   2011     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   2012                                _bcmFieldSliceSelFpf2, 1,
   2013                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 128);
   2014     /* VFP_F2_2 */
   2015     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2016                                bcmFieldQualifyInnerDstIp6,
   2017                                _bcmFieldSliceSelFpf2, 2,
   2018                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 128);
   2019     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   2020                                _bcmFieldSliceSelFpf2, 2,
   2021                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 128);
   2022     /* VFP_F2_3 */
   2023     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   2024                  _bcmFieldSliceSelFpf2, 3, f2_ofs + 16, 16);
   2025     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   2026                  _bcmFieldSliceSelFpf2, 3, f2_ofs + 32, 48);
   2027     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   2028                  _bcmFieldSliceSelFpf2, 3, f2_ofs + 80, 48);
   2029     /* VFP_F2_4 */
   2030     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2031                                bcmFieldQualifyInnerTos,
   2032                                _bcmFieldSliceSelFpf2, 4,
   2033                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 8);
   2034     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   2035                                _bcmFieldSliceSelFpf2, 4,
   2036                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 8);
   2037     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2038                                bcmFieldQualifyInnerIpProtocol,
   2039                                _bcmFieldSliceSelFpf2, 4,
   2040                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 8, 8);
   2041     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   2042                                _bcmFieldSliceSelFpf2, 4,
   2043                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 8, 8);
   2044     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2045                                bcmFieldQualifyInnerDstIp,
   2046                                _bcmFieldSliceSelFpf2, 4,
   2047                                _bcmFieldSliceIpHeaderSelect, 1,f2_ofs + 16, 32);
   2048     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   2049                                _bcmFieldSliceSelFpf2, 4,
   2050                                _bcmFieldSliceIpHeaderSelect, 0,f2_ofs + 16, 32);
   2051     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2052                                bcmFieldQualifyInnerSrcIp,
   2053                                _bcmFieldSliceSelFpf2, 4,
   2054                                _bcmFieldSliceIpHeaderSelect, 1,f2_ofs + 48, 32);
   2055     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   2056                                _bcmFieldSliceSelFpf2, 4,
   2057                                _bcmFieldSliceIpHeaderSelect, 0,f2_ofs + 48, 32);
   2058     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   2059                  _bcmFieldSliceSelFpf2, 4, 112, 48);
   2060 
   2061     /* VFP_F2_5 */
   2062     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2063                                bcmFieldQualifyInnerTos,
   2064                                _bcmFieldSliceSelFpf2, 5,
   2065                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 8);
   2066     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   2067                                _bcmFieldSliceSelFpf2, 5,
   2068                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 8);
   2069     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2070                                bcmFieldQualifyInnerIpProtocol,
   2071                                _bcmFieldSliceSelFpf2, 5,
   2072                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 8, 8);
   2073     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   2074                                _bcmFieldSliceSelFpf2, 5,
   2075                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 8, 8);
   2076     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2077                                bcmFieldQualifyInnerDstIp,
   2078                                _bcmFieldSliceSelFpf2, 5,
   2079                                _bcmFieldSliceIpHeaderSelect, 1,f2_ofs + 16, 32);
   2080     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   2081                                _bcmFieldSliceSelFpf2, 5,
   2082                                _bcmFieldSliceIpHeaderSelect, 0,f2_ofs + 16, 32);
   2083     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2084                                bcmFieldQualifyInnerSrcIp,
   2085                                _bcmFieldSliceSelFpf2, 5,
   2086                                _bcmFieldSliceIpHeaderSelect, 1,f2_ofs + 48, 32);
   2087     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   2088                                _bcmFieldSliceSelFpf2, 5,
   2089                                _bcmFieldSliceIpHeaderSelect, 0,f2_ofs + 48, 32);
   2090     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   2091                  _bcmFieldSliceSelFpf2, 5, f2_ofs + 80, 48);
   2092 
   2093     /* VFP_F2_6 */
   2094     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2095                                bcmFieldQualifyInnerSrcIp6High,
   2096                                _bcmFieldSliceSelFpf2, 6,
   2097                                _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 64);
   2098     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
   2099                                _bcmFieldSliceSelFpf2, 6,
   2100                                _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 64);
   2101     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2102                                bcmFieldQualifyInnerDstIp6High,
   2103                                _bcmFieldSliceSelFpf2, 6,
   2104                                _bcmFieldSliceIpHeaderSelect, 1,f2_ofs + 64, 64);
   2105     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   2106                                _bcmFieldSliceSelFpf2, 6,
   2107                                _bcmFieldSliceIpHeaderSelect, 0,f2_ofs + 64, 64);
   2108 
   2109     /* VFP_F2_7 */
   2110     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVnTag,
   2111                  _bcmFieldSliceSelFpf2, 7, f2_ofs, 33);
   2112     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySubportPktTag,
   2113                  _bcmFieldSliceSelFpf2, 7, f2_ofs, 34);
   2114     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySnap,
   2115                  _bcmFieldSliceSelFpf2, 7, f2_ofs + 64, 40);
   2116     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyLlc,
   2117                  _bcmFieldSliceSelFpf2, 7, f2_ofs + 104, 24);
   2118 
   2119     /* VFP_F2_8 */
   2120     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0,
   2121                  _bcmFieldSliceSelFpf2, 8, f2_ofs, 128);
   2122 
   2123     /* VFP_F2_9 */
   2124     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1,
   2125                  _bcmFieldSliceSelFpf2, 9, f2_ofs, 128);
   2126 
   2127     /* VFP_F1_0 */
   2128     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2129                                bcmFieldQualifyInnerIpProtocolCommon,
   2130                                _bcmFieldSliceSelFpf1, 0,
   2131                                _bcmFieldSliceIpHeaderSelect, 1, f1_ofs, 3);
   2132     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocolCommon,
   2133                                _bcmFieldSliceSelFpf1, 0,
   2134                                _bcmFieldSliceIpHeaderSelect, 0, f1_ofs, 3);
   2135     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated,
   2136                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 3, 1);
   2137     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
   2138                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 4, 1);
   2139     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
   2140                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 5, 2);
   2141     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
   2142                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 7, 2);
   2143     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   2144                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 9, 2);
   2145     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   2146                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 11, 1);
   2147     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   2148                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 12, 1);
   2149     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2150                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 13, 16);
   2151     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2152                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 13, 12);
   2153     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2154                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 25, 1);
   2155     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2156                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 26, 3);
   2157     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   2158                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 29, 2);
   2159     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   2160                  _bcmFieldDevSelDisable, 0,
   2161                  _bcmFieldSliceSelFpf1, 0,
   2162                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp,
   2163                  0,
   2164                  f1_ofs + 31, 7, /* Port value in SGLP */
   2165                  f1_ofs + 38, 8, /* Module value in SGLP */
   2166                  f1_ofs + 46, 1, /* Trunk bit in SGLP (should be 0) */
   2167                  0
   2168                  );
   2169 
   2170     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   2171                  _bcmFieldDevSelDisable, 0,
   2172                  _bcmFieldSliceSelFpf1, 0,
   2173                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityGlp,
   2174                  0,
   2175                  f1_ofs + 31, 15, /* trunk id field of SGLP */
   2176                  f1_ofs + 46, 1,  /* trunk bit of SGLP */
   2177                  0, 0,
   2178                  0
   2179                  );
   2180 
   2181     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   2182                  _bcmFieldDevSelDisable, 0,
   2183                  _bcmFieldSliceSelFpf1, 0,
   2184                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMplsGport,
   2185                  0,
   2186                  f1_ofs + 31, 16, /* S_FIELD */
   2187                  f1_ofs + 56, 1,  /* SVP_VALID */
   2188                  0, 0,
   2189                  0
   2190                  );
   2191 
   2192     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   2193                  _bcmFieldDevSelDisable, 0,
   2194                  _bcmFieldSliceSelFpf1, 0,
   2195                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityVlanGport,
   2196                  0,
   2197                  f1_ofs + 31, 16, /* S_FIELD */
   2198                  f1_ofs + 56, 1,  /* SVP_VALID */
   2199                  0, 0,
   2200                  0
   2201                  );
   2202 
   2203     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   2204                  _bcmFieldDevSelDisable, 0,
   2205                  _bcmFieldSliceSelFpf1, 0,
   2206                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityMimGport,
   2207                  0,
   2208                  f1_ofs + 31, 16, /* S_FIELD */
   2209                  f1_ofs + 56, 1,  /* SVP_VALID */
   2210                  0, 0,
   2211                  0
   2212                  );
   2213 
   2214     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcWlanGport,
   2215                  _bcmFieldDevSelDisable, 0,
   2216                  _bcmFieldSliceSelFpf1, 0,
   2217                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityWlanGport,
   2218                  0,
   2219                  f1_ofs + 31, 16, /* S_FIELD */
   2220                  f1_ofs + 56, 1,  /* SVP_VALID */
   2221                  0, 0,
   2222                  0
   2223                  );
   2224 
   2225     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   2226                  _bcmFieldDevSelDisable, 0,
   2227                  _bcmFieldSliceSelFpf1, 0,
   2228                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   2229                  0,
   2230                  f1_ofs + 31, 15, /* mod + port field of unresolved SGLP */
   2231                  0, 0,
   2232                  0, 0,
   2233                  0
   2234                  );
   2235 
   2236     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   2237                  _bcmFieldDevSelDisable, 0,
   2238                  _bcmFieldSliceSelFpf1, 0,
   2239                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   2240                  0,
   2241                  f1_ofs + 31 + 7, 8, /* mod field of unresolved SGLP */
   2242                  0, 0,
   2243                  0, 0,
   2244                  0
   2245                  );
   2246 
   2247     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
   2248                  _bcmFieldDevSelDisable, 0,
   2249                  _bcmFieldSliceSelFpf1, 0,
   2250                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityModPortGport,
   2251                  0,
   2252                  f1_ofs + 31 + 7, 8, /* mod field of unresolved SGLP */
   2253                  0, 0,
   2254                  0, 0,
   2255                  0
   2256                  );
   2257 
   2258     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   2259                  _bcmFieldDevSelDisable, 0,
   2260                  _bcmFieldSliceSelFpf1, 0,
   2261                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityPortGroupNum,
   2262                  0,
   2263                  f1_ofs + 31, 8, /* ingress port field */
   2264                  0, 0,
   2265                  0, 0,
   2266                  0
   2267                  );
   2268 
   2269     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   2270                  _bcmFieldDevSelDisable, 0,
   2271                  _bcmFieldSliceSelFpf1, 0,
   2272                  _bcmFieldSliceSrcEntitySelect, _bcmFieldFwdEntityPortGroupNum,
   2273                  0,
   2274                  f1_ofs + 31 + 8, 8, /* ingress port group field */
   2275                  0, 0,
   2276                  0, 0,
   2277                  0
   2278                  );
   2279 
   2280     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2281                                bcmFieldQualifyInnerIpType,
   2282                                _bcmFieldSliceSelFpf1, 0,
   2283                                _bcmFieldSliceIpHeaderSelect, 1, f1_ofs + 48, 4);
   2284     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   2285                                _bcmFieldSliceSelFpf1, 0,
   2286                                _bcmFieldSliceIpHeaderSelect, 0, f1_ofs + 48, 4);
   2287     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports, 
   2288                  _bcmFieldSliceSelFpf1, 0, f1_ofs + 52, 1);
   2289 
   2290 
   2291     /* VFP_DOUBLE_WIDE_F3 */
   2292     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   2293                             _bcmFieldSliceSelFpf3, 0,
   2294                             _bcmFieldSliceIpHeaderSelect, 1, f3_ofs, 8);
   2295     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
   2296                             _bcmFieldSliceSelFpf3, 0,
   2297                             _bcmFieldSliceIpHeaderSelect, 0, f3_ofs, 8);
   2298     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl,
   2299                             _bcmFieldSliceSelFpf3, 0,
   2300                             _bcmFieldSliceIpHeaderSelect, 1, f3_ofs + 8, 8);
   2301     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   2302                             _bcmFieldSliceSelFpf3, 0,
   2303                             _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 8, 8);
   2304     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   2305                             _bcmFieldSliceSelFpf3, 0,
   2306                             _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 16, 6);
   2307     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag,
   2308                             _bcmFieldSliceSelFpf3, 0,
   2309                             _bcmFieldSliceIpHeaderSelect, 1, f3_ofs + 22, 2);
   2310     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   2311                             _bcmFieldSliceSelFpf3, 0,
   2312                             _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 22, 2);
   2313     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   2314                             _bcmFieldSliceSelFpf3, 0,
   2315                             _bcmFieldSliceIpHeaderSelect, 0, f3_ofs + 24, 8);
   2316     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   2317                             _bcmFieldSliceSelFpf3, 0,
   2318                             _bcmFieldSliceIpHeaderSelect, 1, f3_ofs + 24, 8);
   2319 
   2320     /* VFP_DOUBLE_WIDE_F2_0 */
   2321     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl,
   2322                             _bcmFieldSliceSelFpf2, 0,
   2323                             _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 8);
   2324     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   2325                             _bcmFieldSliceSelFpf2, 0,
   2326                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 8);
   2327     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   2328                             _bcmFieldSliceSelFpf2, 0,
   2329                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 8, 6);
   2330     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag,
   2331                             _bcmFieldSliceSelFpf2, 0,
   2332                             _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 14, 2);
   2333     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   2334                             _bcmFieldSliceSelFpf2, 0,
   2335                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 14, 2);
   2336     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   2337                             _bcmFieldSliceSelFpf2, 0,
   2338                             _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 16, 8);
   2339     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
   2340                             _bcmFieldSliceSelFpf2, 0,
   2341                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 16, 8);
   2342     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort,
   2343                             _bcmFieldSliceSelFpf2, 0,
   2344                             _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 24, 16);
   2345     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   2346                             _bcmFieldSliceSelFpf2, 0,
   2347                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 24, 16);
   2348     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   2349                             _bcmFieldSliceSelFpf2, 0,
   2350                             _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 40, 16);
   2351     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   2352                             _bcmFieldSliceSelFpf2, 0,
   2353                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 40, 16);
   2354     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   2355                             _bcmFieldSliceSelFpf2, 0,
   2356                             _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 56, 8);
   2357     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   2358                             _bcmFieldSliceSelFpf2, 0,
   2359                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 56, 8);
   2360     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp,
   2361                             _bcmFieldSliceSelFpf2, 0,
   2362                             _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 64, 32);
   2363     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   2364                             _bcmFieldSliceSelFpf2, 0,
   2365                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 64, 32);
   2366     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp,
   2367                             _bcmFieldSliceSelFpf2, 0,
   2368                             _bcmFieldSliceIpHeaderSelect, 1, f2_ofs + 96, 32);
   2369     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   2370                             _bcmFieldSliceSelFpf2, 0,
   2371                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs + 96, 32);
   2372 
   2373     /* VFP_DOUBLE_WIDE_F2_1 */
   2374     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6,
   2375                             _bcmFieldSliceSelFpf2, 1,
   2376                             _bcmFieldSliceIpHeaderSelect, 1, f2_ofs, 128);
   2377     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   2378                             _bcmFieldSliceSelFpf2, 1,
   2379                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 128);
   2380 
   2381     /* VFP_DOUBLE_WIDE_F2_2 */
   2382     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyData1,
   2383                             _bcmFieldSliceSelFpf2, 2,
   2384                             _bcmFieldSliceIpHeaderSelect, 0, f2_ofs, 128);
   2385 
   2386     /* VFP_DOUBLE_WIDE_F1 */
   2387     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc,
   2388                             bcmFieldQualifyExtensionHeaderSubCode,
   2389                             _bcmFieldSliceSelFpf1, 0,
   2390                             _bcmFieldSliceIpHeaderSelect, 0, f1_ofs, 8);
   2391     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   2392                             _bcmFieldSliceSelFpf1, 0,
   2393                             _bcmFieldSliceIpHeaderSelect, 0, f1_ofs + 8, 8);
   2394     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   2395                             _bcmFieldSliceSelFpf1, 0,
   2396                             _bcmFieldSliceIpHeaderSelect, 0, f1_ofs + 16, 8);
   2397     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   2398                             _bcmFieldSliceSelFpf1, 0,
   2399                             _bcmFieldSliceIpHeaderSelect, 0, f1_ofs + 24, 16);
   2400     return (BCM_E_NONE);
   2401 }
   2402 
   2403 
   2404 /*
   2405  * Function:
   2406  *     _field_kt2_egress_qualifiers_init
   2407  * Purpose:
   2408  *     Initialize device stage egress qaualifiers 
   2409  *     select codes & offsets
   2410  * Parameters:
   2411  *     unit       - (IN) BCM device number.
   2412  *     stage_fc   - (IN) Field Processor stage control structure. 
   2413  *
   2414  * Returns:
   2415  *     BCM_E_NONE
   2416  */
   2417 STATIC int
   2418 _field_kt2_egress_qualifiers_init(int unit, _field_stage_t *stage_fc)
   2419 {
   2420     _FP_QUAL_DECL;
   2421     _key_fld_ = KEYf;
   2422 
   2423     /* Input parameters check. */
   2424     if (NULL == stage_fc) {
   2425         return (BCM_E_PARAM);
   2426     }
   2427 
   2428     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageEgress,
   2429                  _bcmFieldSliceSelDisable, 0, 0, 0);
   2430 
   2431    /*EFP_KEY4 */
   2432     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   2433                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 0, 1);
   2434     /* EG_NEXT_HOP_CLASS_ID */
   2435     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass,
   2436                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2437                                _bcmFieldSliceSelEgrDvpKey4, 1,
   2438                                2, 12);
   2439     /* EG_L3_INTF_CLASS_ID */
   2440     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2441                                bcmFieldQualifyEgressClassL3Interface,
   2442                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2443                                _bcmFieldSliceSelEgrDvpKey4, 2,
   2444                                2, 12);
   2445 
   2446     /* DVP_VALID + DVP */
   2447     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   2448                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2449                                _bcmFieldSliceSelEgrDvpKey4, 0,
   2450                                1, 14);
   2451     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   2452                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2453                                _bcmFieldSliceSelEgrDvpKey4, 0,
   2454                                1, 14);
   2455     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   2456                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2457                                _bcmFieldSliceSelEgrDvpKey4, 0,
   2458                                1, 14);
   2459 
   2460     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   2461                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 18, 4);
   2462     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   2463                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 22, 2);
   2464     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   2465                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 24, 2);
   2466     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   2467                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 26, 16);
   2468     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   2469                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 42, 48);
   2470     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   2471                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 90, 48);
   2472     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
   2473                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 138, 1);
   2474     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   2475                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 139, 1);
   2476     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   2477                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 140, 1);
   2478     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   2479                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 141, 1);
   2480     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   2481                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 142, 3);
   2482     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   2483                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 145, 12);
   2484     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   2485                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 157, 8);
   2486     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   2487                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 165, 1);
   2488     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   2489                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 166, 1);
   2490     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2491                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 167, 16);
   2492     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2493                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 167, 12);
   2494     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2495                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 179, 1);
   2496     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2497                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 180, 3);
   2498     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   2499                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 183, 2);
   2500     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   2501                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 185, 1);
   2502     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   2503                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 186, 8);
   2504     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   2505                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2506                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2507     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   2508                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2509                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2510     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   2511                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2512                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2513     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   2514                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2515                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2516     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   2517                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2518                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2519     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   2520                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2521                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2522     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   2523                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2524                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2525     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   2526                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2527                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2528     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   2529                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2530                                _bcmFieldSliceSelEgrClassF4, 1, 194, 8);
   2531     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   2532                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2533                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2534     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2535                                bcmFieldQualifyIngressInterfaceClassPort,
   2536                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2537                                _bcmFieldSliceSelEgrClassF4, 0, 194, 13);
   2538     /* CPUCOS */
   2539     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCpuQueue,
   2540                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2541                                _bcmFieldSliceSelEgrClassF4, 2, 194, 6);
   2542     /* L3_PKT_TYPE */
   2543     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   2544                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2545                                _bcmFieldSliceSelEgrMdlKey4, 0, 208, 4);
   2546     /* MDL */
   2547     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOamMdl,
   2548                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   2549                                _bcmFieldSliceSelEgrMdlKey4, 1, 208, 3);
   2550 
   2551     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   2552                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 212, 1);
   2553     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   2554                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 213, 14);
   2555     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   2556                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 213, 14);
   2557     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   2558                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 213, 14);
   2559     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   2560                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 227, 2);
   2561 
   2562     /*EFP_KEY1 */
   2563     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   2564                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 1);
   2565     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   2566                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 1, 4);
   2567     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   2568                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 5, 2);
   2569     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   2570                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 7, 2);
   2571     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   2572                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 9, 6);
   2573     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   2574                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 15, 16);
   2575     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   2576                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 31, 16);
   2577     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   2578                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 47, 8);
   2579     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   2580                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 55, 8);
   2581     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   2582                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 63, 32);
   2583     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   2584                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 95, 32);
   2585     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   2586                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 127, 8);
   2587     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   2588                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 135, 1);
   2589     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   2590                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 136, 1);
   2591     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   2592                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 137, 12);
   2593     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   2594                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 149, 8);
   2595     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   2596                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 157, 1);
   2597     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   2598                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 158, 1);
   2599     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2600                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 159, 16);
   2601     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2602                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 159, 12);
   2603     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2604                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 171, 1);
   2605     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2606                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 172, 3);
   2607     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   2608                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 175, 2);
   2609     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   2610                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 177, 1);
   2611     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   2612                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 178, 8);
   2613     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   2614                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 186, 8);
   2615     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   2616                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 194, 4);
   2617     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   2618                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 198, 1);
   2619 
   2620     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   2621                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2622                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2623     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   2624                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2625                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2626     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   2627                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2628                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2629     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   2630                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2631                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2632     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   2633                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2634                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2635     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   2636                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2637                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2638     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   2639                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2640                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2641     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   2642                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2643                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2644     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass,
   2645                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2646                                _bcmFieldSliceSelEgrClassF1, 1, 199, 12);
   2647     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2648                                bcmFieldQualifyEgressClassL3Interface,
   2649                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2650                                _bcmFieldSliceSelEgrClassF1, 2, 199, 12);
   2651     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   2652                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2653                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2654     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2655                                bcmFieldQualifyIngressInterfaceClassPort,
   2656                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2657                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2658     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   2659                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 212, 14);
   2660     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   2661                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 212, 14);
   2662     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   2663                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 212, 14);
   2664     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   2665                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 226, 2);
   2666     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
   2667                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 0);
   2668 
   2669     /* KEY1 without v4 specific fields. */
   2670     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   2671                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 0, 1);
   2672     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   2673                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 1, 4);
   2674     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   2675                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 5, 2);
   2676     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   2677                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 9, 6);
   2678     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   2679                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 15, 16);
   2680     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   2681                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 31, 16);
   2682     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   2683                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 47, 8);
   2684     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   2685                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 55, 8);
   2686     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   2687                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 127, 8);
   2688     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   2689                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 135, 1);
   2690     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   2691                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 136, 1);
   2692     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   2693                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 137, 12);
   2694     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   2695                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 149, 8);
   2696     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   2697                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 157, 1);
   2698     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   2699                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 158, 1);
   2700     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2701                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 159, 16);
   2702     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2703                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 159, 12);
   2704     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2705                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 171, 1);
   2706     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2707                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 172, 3);
   2708     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   2709                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 175, 2);
   2710     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   2711                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 177, 1);
   2712     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   2713                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 178, 8);
   2714     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   2715                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 186, 8);
   2716     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   2717                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 194, 4);
   2718     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   2719                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 198, 1);
   2720     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   2721                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2722                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2723     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   2724                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2725                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2726     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   2727                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2728                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2729     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   2730                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2731                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2732     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   2733                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2734                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2735     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   2736                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2737                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2738     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   2739                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2740                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2741     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   2742                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2743                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2744     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass,
   2745                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2746                                _bcmFieldSliceSelEgrClassF1, 1, 199, 12);
   2747     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2748                                bcmFieldQualifyEgressClassL3Interface,
   2749                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2750                                _bcmFieldSliceSelEgrClassF1, 2, 199, 12);
   2751     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   2752                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2753                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2754     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2755                                bcmFieldQualifyIngressInterfaceClassPort,
   2756                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4,
   2757                                _bcmFieldSliceSelEgrClassF1, 0, 199, 13);
   2758     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   2759                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 212, 14);
   2760     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   2761                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 212, 14);
   2762     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   2763                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 212, 14);
   2764     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   2765                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 226, 2);
   2766 
   2767     /*EFP_KEY2 */
   2768     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   2769                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 1);
   2770     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   2771                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 1, 8);
   2772     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   2773                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2774                                _bcmFieldSliceIp6AddrSelect,
   2775                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP6,
   2776                                9, 128);
   2777     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   2778                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2779                                _bcmFieldSliceIp6AddrSelect,
   2780                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_DIP6,
   2781                                9, 128);
   2782     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
   2783                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2784                                _bcmFieldSliceIp6AddrSelect,
   2785                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64,
   2786                                9, 64);
   2787     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   2788                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2789                                _bcmFieldSliceIp6AddrSelect,
   2790                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64,
   2791                                73, 64);
   2792     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   2793                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 137, 8);
   2794     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   2795                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 145, 1);
   2796     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   2797                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 146, 1);
   2798     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   2799                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 147, 12);
   2800     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   2801                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 159, 8);
   2802     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   2803                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 167, 1);
   2804     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   2805                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 168, 1);
   2806     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2807                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 169, 16);
   2808     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2809                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 169, 12);
   2810     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2811                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 181, 1);
   2812     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2813                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 182, 3);
   2814     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   2815                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 185, 2);
   2816     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   2817                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 187, 1);
   2818     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   2819                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 188, 8);
   2820     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   2821                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2822                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2823     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   2824                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2825                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2826     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   2827                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2828                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2829     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   2830                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2831                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2832     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   2833                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2834                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2835     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   2836                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2837                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2838     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   2839                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2840                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2841     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   2842                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1,
   2843                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2844     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass,
   2845                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2846                                _bcmFieldSliceSelEgrClassF2, 1, 196, 12);
   2847     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2848                                bcmFieldQualifyEgressClassL3Interface,
   2849                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2850                                _bcmFieldSliceSelEgrClassF2, 2, 196, 12);
   2851     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   2852                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2853                                _bcmFieldSliceSelEgrClassF2, 3, 196, 8);
   2854     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIngressClassField,
   2855                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2856                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2857     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2858                                bcmFieldQualifyIngressInterfaceClassPort,
   2859                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   2860                                _bcmFieldSliceSelEgrClassF2, 0, 196, 13);
   2861     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   2862                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 209, 4);
   2863     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   2864                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 213, 1);
   2865     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   2866                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 214, 14);
   2867     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   2868                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 214, 14);
   2869     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
   2870                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 214, 14);
   2871     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   2872                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 228, 2);
   2873     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   2874                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 0);
   2875 
   2876     /*EFP_KEY3 */
   2877     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   2878                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 1);
   2879     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   2880                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 1, 4);
   2881     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   2882                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 5, 2);
   2883     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   2884                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 7, 2);
   2885     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   2886                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 9, 6);
   2887     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   2888                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 15, 16);
   2889     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   2890                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 31, 16);
   2891     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   2892                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 47, 8);
   2893     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   2894                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 55, 128);
   2895     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   2896                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 183, 8);
   2897     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   2898                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 191, 8);
   2899     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   2900                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 199, 4);
   2901     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   2902                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 203, 1);
   2903     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyEgressClass,
   2904                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3,
   2905                                _bcmFieldSliceSelEgrClassF3, 0, 204, 12);
   2906     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   2907                                bcmFieldQualifyEgressClassL3Interface,
   2908                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3,
   2909                                _bcmFieldSliceSelEgrClassF3, 1, 204, 12);
   2910     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   2911                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 0);
   2912 
   2913     return (BCM_E_NONE);
   2914 }
   2915 
   2916 /*
   2917  * Function:
   2918  *     _field_kt2_qualifiers_init
   2919  * Purpose:
   2920  *     Initialize device qaualifiers select codes & offsets
   2921  * Parameters:
   2922  *     unit       - (IN) BCM device number.
   2923  *     stage_fc   - (IN) Field Processor stage control structure. 
   2924  *
   2925  * Returns:
   2926  *     BCM_E_NONE
   2927  * Notes:
   2928  */
   2929 STATIC int
   2930 _field_kt2_qualifiers_init(int unit, _field_stage_t *stage_fc)
   2931 {
   2932     int rv;           /* Operation return status. */
   2933 
   2934     /* Input parameters check. */
   2935     if (NULL == stage_fc) {
   2936         return (BCM_E_PARAM);
   2937     }
   2938 
   2939     /* Allocated stage qualifiers configuration array. */
   2940     _FP_XGS3_ALLOC(stage_fc->f_qual_arr, 
   2941                    (_bcmFieldQualifyCount * sizeof(_bcm_field_qual_info_t *)),
   2942                    "Field qualifiers");
   2943     if (NULL == stage_fc->f_qual_arr) {
   2944         return (BCM_E_MEMORY);
   2945     }
   2946     
   2947     switch (stage_fc->stage_id) {
   2948       case _BCM_FIELD_STAGE_INGRESS:
   2949           rv = _field_kt2_ingress_qualifiers_init(unit, stage_fc);
   2950           break;
   2951       case _BCM_FIELD_STAGE_LOOKUP:
   2952           rv = _field_kt2_lookup_qualifiers_init(unit, stage_fc);
   2953           break;
   2954       case _BCM_FIELD_STAGE_EGRESS:
   2955           rv = _field_kt2_egress_qualifiers_init(unit, stage_fc);
   2956           break;
   2957       case _BCM_FIELD_STAGE_EXTERNAL:  
   2958       default: 
   2959           sal_free(stage_fc->f_qual_arr);
   2960           return (BCM_E_PARAM);
   2961     }
   2962     return (rv);
   2963 }
   2964 
   2965 /*
   2966  * Function:
   2967  *     _bcm_field_kt2_init
   2968 
   2969  * Purpose:
   2970  *     Perform initializations that are specific to BCM56230. This
   2971  *     includes initializing the FP field select bit offset tables for FPF[1-3]
   2972  *     for every stage. 
   2973  * Parameters:
   2974  *     unit       - (IN) BCM device number.
   2975  *     fc         - (IN) Field Processor control structure. 
   2976  *
   2977  * Returns:
   2978  *     BCM_E_NONE
   2979  * Notes:
   2980  */
   2981 int
   2982 _bcm_field_kt2_init(int unit, _field_control_t *fc)
   2983 {
   2984     _field_stage_t *stage_fc; /* Stages iteration pointer */
   2985 
   2986     /* Input parameters check. */
   2987     if (NULL == fc) {
   2988         return (BCM_E_PARAM);
   2989     }
   2990 
   2991     stage_fc = fc->stages;
   2992     while (stage_fc) {
   2993         /* Clear hardware table */
   2994         BCM_IF_ERROR_RETURN(_bcm_field_tr_hw_clear(unit, stage_fc));
   2995 
   2996         /* Initialize qualifiers info. */
   2997         BCM_IF_ERROR_RETURN(_field_kt2_qualifiers_init(unit, stage_fc));
   2998 
   2999         if (_BCM_FIELD_STAGE_EXTERNAL == stage_fc->stage_id) {
   3000             _bcm_field_tr_external_init(unit, stage_fc);
   3001             stage_fc = stage_fc->next;
   3002             continue;
   3003         }
   3004 
   3005         /* Goto next stage */
   3006         stage_fc = stage_fc->next;
   3007     }
   3008 
   3009     /* Initialize the TOS_FN, TTL_FN, TCP_FN tables */
   3010     BCM_IF_ERROR_RETURN(_bcm_field_trx_tcp_ttl_tos_init(unit));
   3011     
   3012     if (0 == SOC_WARM_BOOT(unit)) {
   3013         /* Enable filter processor */
   3014         BCM_IF_ERROR_RETURN(_field_port_filter_enable_set(unit, fc, TRUE));
   3015 
   3016         /* Enable meter refresh */
   3017         BCM_IF_ERROR_RETURN(_field_meter_refresh_enable_set(unit, fc, TRUE));
   3018     }
   3019 
   3020     /* Initialize the function pointers */
   3021     _field_kt2_functions_init(&fc->functions);;
   3022 
   3023     return (BCM_E_NONE);
   3024 }
   3025 
   3026 /*
   3027  * Function:
   3028  *     _field_kt2_lookup_selcodes_install
   3029  *
   3030  * Purpose:
   3031  *     Writes the field select codes (ie. FPFx).
   3032  *     for VFP (_BCM_FIELD_STAGE_LOOKUP) lookup stage.
   3033  *
   3034  * Parameters:
   3035  *     unit  - BCM device number
   3036  *     fs    - slice that needs its select codes written
   3037  *
   3038  * Returns:
   3039  *     BCM_E_XXX
   3040  */
   3041 
   3042 STATIC int
   3043 _field_kt2_lookup_selcodes_install(int            unit,
   3044                                    _field_group_t *fg,
   3045                                    uint8          slice_num,
   3046                                    int            selcode_idx)
   3047 {
   3048     static const soc_field_t s_type_fld_tbl[] = {
   3049         SLICE_0_SOURCE_TYPE_SELf,
   3050         SLICE_1_SOURCE_TYPE_SELf,
   3051         SLICE_2_SOURCE_TYPE_SELf,
   3052         SLICE_3_SOURCE_TYPE_SELf
   3053     };
   3054 
   3055     _field_sel_t * const sel = &fg->sel_codes[selcode_idx];
   3056     int           errcode = BCM_E_NONE;
   3057     uint64        regval;
   3058     uint64        val;
   3059 
   3060     BCM_IF_ERROR_RETURN(soc_reg64_get(unit, VFP_KEY_CONTROL_1r,
   3061                                       REG_PORT_ANY, 0, &regval));
   3062 
   3063     if ((fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE)
   3064         && (selcode_idx & 1)) {
   3065         if (sel->fpf2 != _FP_SELCODE_DONT_CARE) {
   3066             COMPILER_64_SET(val, 0, sel->fpf2);
   3067             soc_reg64_field_set(unit, VFP_KEY_CONTROL_1r, &regval,
   3068                             _bcm_field_trx_vfp_double_wide_sel[slice_num], val);
   3069         }
   3070     } else {
   3071         if (sel->fpf2 != _FP_SELCODE_DONT_CARE) {
   3072             COMPILER_64_SET(val, 0, sel->fpf2);
   3073             soc_reg64_field_set(unit, VFP_KEY_CONTROL_1r, &regval,
   3074                             _bcm_field_trx_vfp_field_sel[slice_num][0], val);
   3075         }
   3076         if (sel->fpf3 != _FP_SELCODE_DONT_CARE) {
   3077             COMPILER_64_SET(val, 0, sel->fpf3);
   3078             soc_reg64_field_set(unit, VFP_KEY_CONTROL_1r, &regval,
   3079                             _bcm_field_trx_vfp_field_sel[slice_num][1], val);
   3080         }
   3081     }
   3082 
   3083     if (sel->src_entity_sel != _FP_SELCODE_DONT_CARE) {
   3084         uint32 value;
   3085 
   3086         switch (sel->src_entity_sel) {
   3087             case _bcmFieldFwdEntityPortGroupNum:
   3088                 value = 4;
   3089                 break;
   3090             case _bcmFieldFwdEntityMplsGport:
   3091             case _bcmFieldFwdEntityMimGport:
   3092             case _bcmFieldFwdEntityWlanGport:
   3093             case _bcmFieldFwdEntityVlanGport:
   3094                 value = 0;
   3095                 break;
   3096             case _bcmFieldFwdEntityModPortGport:
   3097                 value = 2;
   3098                 break;
   3099             case _bcmFieldFwdEntityGlp:
   3100                 value = 1;
   3101                 break;
   3102             default:
   3103                 return (BCM_E_INTERNAL);
   3104         }
   3105         COMPILER_64_SET(val, 0, value);
   3106         soc_reg64_field_set(unit, VFP_KEY_CONTROL_1r, &regval,
   3107                             s_type_fld_tbl[slice_num], val);
   3108     }
   3109 
   3110     BCM_IF_ERROR_RETURN(
   3111         soc_reg64_set(unit, VFP_KEY_CONTROL_1r, REG_PORT_ANY, 0, regval));
   3112 
   3113     /* Set inner/outer ip header selection. */
   3114     if (sel->ip_header_sel != _FP_SELCODE_DONT_CARE) {
   3115         errcode = soc_reg_field32_modify(
   3116                       unit, VFP_KEY_CONTROL_2r, REG_PORT_ANY,
   3117                       _bcm_field_trx_vfp_ip_header_sel[slice_num],
   3118                       sel->ip_header_sel);
   3119     }
   3120     return (errcode);
   3121 }
   3122 
   3123 STATIC int
   3124 _field_kt2_egress_selcodes_install(int            unit,
   3125                                    _field_group_t *fg,
   3126                                    uint8          slice_num,
   3127                                    bcm_pbmp_t     *pbmp,
   3128                                    int            selcode_idx)
   3129 {
   3130     static const soc_field_t fldtbl[][4] = {
   3131         { SLICE_0_F1f, SLICE_1_F1f, SLICE_2_F1f, SLICE_3_F1f },
   3132         { SLICE_0_F2f, SLICE_1_F2f, SLICE_2_F2f, SLICE_3_F2f },
   3133         { SLICE_0_F3f, SLICE_1_F3f, SLICE_2_F3f, SLICE_3_F3f },
   3134         { SLICE_0_F4f, SLICE_1_F4f, SLICE_2_F4f, SLICE_3_F4f }
   3135     };
   3136 
   3137     static const soc_field_t dvpfldtbl[4] = {
   3138         SLICE_0f, SLICE_1f, SLICE_2f, SLICE_3f };
   3139 
   3140     static const soc_field_t mdlfldtbl[4] = {
   3141         SLICE_0f, SLICE_1f, SLICE_2f, SLICE_3f };
   3142 
   3143     _field_sel_t * const sel = &fg->sel_codes[selcode_idx];
   3144 
   3145     if (sel->egr_class_f1_sel != _FP_SELCODE_DONT_CARE) {
   3146         BCM_IF_ERROR_RETURN(
   3147             soc_reg_field32_modify(unit, EFP_CLASSID_SELECTORr, REG_PORT_ANY,
   3148                                fldtbl[0][slice_num], sel->egr_class_f1_sel));
   3149     }
   3150     if (sel->egr_class_f2_sel != _FP_SELCODE_DONT_CARE) {
   3151         BCM_IF_ERROR_RETURN(
   3152            soc_reg_field32_modify(unit, EFP_CLASSID_SELECTORr, REG_PORT_ANY,
   3153                                fldtbl[1][slice_num], sel->egr_class_f2_sel));
   3154     }
   3155     if (sel->egr_class_f3_sel != _FP_SELCODE_DONT_CARE) {
   3156         BCM_IF_ERROR_RETURN(
   3157             soc_reg_field32_modify(unit, EFP_CLASSID_SELECTORr, REG_PORT_ANY,
   3158                                 fldtbl[2][slice_num], sel->egr_class_f3_sel));
   3159     }
   3160     if (sel->egr_class_f4_sel != _FP_SELCODE_DONT_CARE) {
   3161         BCM_IF_ERROR_RETURN(
   3162             soc_reg_field32_modify(unit, EFP_CLASSID_SELECTORr, REG_PORT_ANY,
   3163                                 fldtbl[3][slice_num], sel->egr_class_f4_sel));
   3164     }
   3165     /* SELECTOR CODES for EFP_KEY4_DVP_SELECTOR register */
   3166     if (sel->egr_key4_dvp_sel != _FP_SELCODE_DONT_CARE) {
   3167         BCM_IF_ERROR_RETURN(
   3168             soc_reg_field32_modify(unit, EFP_KEY4_DVP_SELECTORr, REG_PORT_ANY,
   3169                                 dvpfldtbl[slice_num], sel->egr_key4_dvp_sel));
   3170     }
   3171     /* SELECTOR CODES for EFP_KEY4_MDL_SELECTOR register */
   3172     if (sel->egr_key4_mdl_sel != _FP_SELCODE_DONT_CARE) {
   3173         BCM_IF_ERROR_RETURN(
   3174             soc_reg_field32_modify(unit, EFP_KEY4_MDL_SELECTORr, REG_PORT_ANY,
   3175                                 mdlfldtbl[slice_num], sel->egr_key4_mdl_sel));
   3176     }
   3177 
   3178     return (BCM_E_NONE);
   3179 }
   3180 
   3181 /*
   3182  * Function:
   3183  *     _field_kt2_lookup_mode_set
   3184  *
   3185  * Purpose:
   3186  *    Auxiliary routine used to set group pairing mode.
   3187  * Parameters:
   3188  *     unit       - (IN) BCM device number.
   3189  *     slice_numb - (IN) Slice number to set mode for.
   3190  *     fg         - (IN) Installed group structure.
   3191  *     flags      - (IN) New group/slice mode.
   3192  *
   3193  * Returns:
   3194  *     BCM_E_XXX
   3195  */
   3196 STATIC int
   3197 _field_kt2_lookup_mode_set(int            unit,
   3198                            uint8          slice_num,
   3199                            _field_group_t *fg,
   3200                            uint8          flags)
   3201 {
   3202     static const soc_field_t wide_mode_flds[] = {
   3203         SLICE_0_DOUBLE_WIDE_MODEf,
   3204         SLICE_1_DOUBLE_WIDE_MODEf,
   3205         SLICE_2_DOUBLE_WIDE_MODEf,
   3206         SLICE_3_DOUBLE_WIDE_MODEf
   3207     }, pairing_flds[] = {
   3208         SLICE1_0_PAIRINGf,
   3209         SLICE3_2_PAIRINGf
   3210     };
   3211 
   3212     uint64 vfp_key_control_1_buf;
   3213 
   3214     BCM_IF_ERROR_RETURN(
   3215         soc_reg64_get(unit, VFP_KEY_CONTROL_1r, REG_PORT_ANY, 0,
   3216                       &vfp_key_control_1_buf));
   3217 
   3218     soc_reg64_field32_set(unit, VFP_KEY_CONTROL_1r,
   3219                           &vfp_key_control_1_buf, pairing_flds[slice_num >> 1],
   3220                           flags & _FP_GROUP_SPAN_DOUBLE_SLICE ? 1 : 0);
   3221     soc_reg64_field32_set(unit, VFP_KEY_CONTROL_1r,
   3222                           &vfp_key_control_1_buf, wide_mode_flds[slice_num],
   3223                           flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE ? 1 : 0);
   3224 
   3225     return (soc_reg64_set(unit, VFP_KEY_CONTROL_1r, REG_PORT_ANY, 0,
   3226                           vfp_key_control_1_buf));
   3227 }
   3228 
   3229 /*
   3230  * Function:
   3231  *     _field_kt2_mode_set
   3232  *
   3233  * Purpose:
   3234  *    Auxiliary routine used to set group pairing mode.
   3235  * Parameters:
   3236  *     unit       - (IN) BCM device number.
   3237  *     slice_numb - (IN) Slice number to set mode for.
   3238  *     fg         - (IN) Installed group structure.
   3239  *     flags      - (IN) New group/slice mode.
   3240  *
   3241  * Returns:
   3242  *     BCM_E_XXX
   3243  */
   3244 
   3245 STATIC int
   3246 _field_kt2_mode_set(int unit, uint8 slice_num,
   3247                          _field_group_t *fg, uint8 flags)
   3248 {
   3249     int (*func)(int unit, uint8 slice_num, _field_group_t *fg, uint8 flags);
   3250 
   3251     switch (fg->stage_id) {
   3252         case _BCM_FIELD_STAGE_LOOKUP:
   3253             func = _field_kt2_lookup_mode_set;
   3254             break;
   3255         case _BCM_FIELD_STAGE_INGRESS:
   3256             return (BCM_E_NONE);
   3257         case _BCM_FIELD_STAGE_EGRESS:
   3258             func = _bcm_field_trx_egress_mode_set;
   3259             break;
   3260         default:
   3261             return (BCM_E_INTERNAL);
   3262     }
   3263 
   3264     return ((*func)(unit, slice_num, fg, flags));
   3265 }
   3266 
   3267 STATIC int
   3268 _field_kt2_egress_key_match_type_set (int unit, _field_entry_t *f_ent)
   3269 {
   3270     _bcm_field_qual_offset_t q_offset;
   3271     const _field_group_t *fg = f_ent->group;
   3272     uint32 data, mask;
   3273 
   3274     sal_memset(&q_offset, 0, sizeof(q_offset));
   3275     q_offset.field = KEYf;
   3276     q_offset.num_offsets = 1;
   3277     q_offset.offset[0] = 231;
   3278     q_offset.width[0] = 3;
   3279  
   3280     if (fg->flags & _FP_GROUP_SPAN_SINGLE_SLICE) {
   3281         switch (fg->sel_codes[0].fpf3) {
   3282           case _BCM_FIELD_EFP_KEY1:
   3283               data = _BCM_FIELD_EFP_KEY1_MATCH_TYPE;
   3284               break;
   3285           case _BCM_FIELD_EFP_KEY2:
   3286               data = _BCM_FIELD_EFP_KEY2_MATCH_TYPE;
   3287               break;
   3288           case _BCM_FIELD_EFP_KEY4:
   3289               data = _BCM_FIELD_EFP_KEY4_MATCH_TYPE;
   3290               break;
   3291           case _BCM_FIELD_EFP_KEY1_NO_V4:
   3292               data = _BCM_FIELD_EFP_KEY1_MATCH_TYPE;
   3293               break;
   3294           default:
   3295               return (BCM_E_INTERNAL);
   3296         }
   3297     } else {
   3298         switch (fg->sel_codes[1].fpf3) {
   3299           case _BCM_FIELD_EFP_KEY2:
   3300               data = _BCM_FIELD_EFP_KEY2_KEY3_MATCH_TYPE;
   3301               break;
   3302           case _BCM_FIELD_EFP_KEY4:
   3303               if ((_BCM_FIELD_EFP_KEY1 == fg->sel_codes[0].fpf3) ||
   3304                   (_BCM_FIELD_EFP_KEY1_NO_V4 == fg->sel_codes[0].fpf3)) {
   3305                   data = _BCM_FIELD_EFP_KEY1_KEY4_MATCH_TYPE;
   3306               } else {
   3307                   data = _BCM_FIELD_EFP_KEY2_KEY4_MATCH_TYPE;
   3308               }
   3309               break;
   3310           default:
   3311               return (BCM_E_INTERNAL);
   3312         }
   3313     }
   3314 
   3315     mask = 0x7;
   3316 
   3317     /*
   3318      * COVERITY
   3319      * This flow takes care of the Out-of-bounds access issue for data and mask.
   3320      */
   3321     /* coverity[callee_ptr_arith : FALSE] */
   3322     return (_bcm_field_qual_value_set(unit,
   3323                                       (_bcm_field_qual_offset_t *) &q_offset,
   3324                                       f_ent,
   3325                                       &data,
   3326                                       &mask
   3327                                       )
   3328             );
   3329 }
   3330 
   3331 STATIC int
   3332 _field_kt2_selcodes_install(int            unit,
   3333                             _field_group_t *fg,
   3334                             uint8          slice_num,
   3335                             bcm_pbmp_t     pbmp,
   3336                             int            selcode_idx)
   3337 {
   3338     int rv;
   3339 
   3340     /* Input parameters check. */
   3341     if (NULL == fg) {
   3342         return (BCM_E_PARAM);
   3343     }
   3344 
   3345     BCM_IF_ERROR_RETURN(_field_kt2_mode_set(unit, slice_num, fg, fg->flags));
   3346 
   3347     switch (fg->stage_id) {
   3348         case _BCM_FIELD_STAGE_LOOKUP:
   3349             rv = _field_kt2_lookup_selcodes_install(unit, fg, slice_num,
   3350                                                     selcode_idx);
   3351             break;
   3352         case _BCM_FIELD_STAGE_INGRESS:
   3353             rv =  _bcm_field_trx_ingress_selcodes_install(unit, fg, slice_num,
   3354                                                           &pbmp, selcode_idx);
   3355             break;
   3356         case _BCM_FIELD_STAGE_EGRESS:
   3357             rv = _field_kt2_egress_selcodes_install(unit, fg, slice_num,
   3358                                                     &pbmp, selcode_idx);;
   3359             break;
   3360         default:
   3361             return (BCM_E_INTERNAL);
   3362     }
   3363     return (rv);
   3364 }
   3365 
   3366 STATIC int
   3367 _field_kt2_group_install(int unit, _field_group_t *fg)
   3368 {
   3369     _field_slice_t *fs;        /* Slice pointer.           */
   3370     uint8  slice_number;       /* Slices iterator.         */
   3371     int    parts_count;        /* Number of entry parts.   */
   3372     int    idx;                /* Iteration index.         */
   3373 
   3374     if (NULL == fg) {
   3375         return (BCM_E_PARAM);
   3376     }
   3377 
   3378     /* Get number of entry parts. */
   3379     BCM_IF_ERROR_RETURN(
   3380         _bcm_field_entry_tcam_parts_count(unit, fg->stage_id, 
   3381                                           fg->flags, &parts_count));
   3382 
   3383     for (idx = 0; idx < parts_count; ++idx) {
   3384         BCM_IF_ERROR_RETURN(
   3385            _bcm_field_tcam_part_to_slice_number(unit, idx, fg,
   3386                                                 &slice_number));
   3387         fs = fg->slices + slice_number;
   3388 
   3389         BCM_IF_ERROR_RETURN(
   3390             _field_kt2_selcodes_install(unit, fg, fs->slice_number,
   3391                                         fg->pbmp, idx));
   3392     }
   3393 
   3394     return (BCM_E_NONE);
   3395 }
   3396 
   3397 /*
   3398  * Function:
   3399  *     _field_kt2_lookup_slice_clear
   3400  *
   3401  * Purpose:
   3402  *     Reset slice configuraton on group deletion event.
   3403  *
   3404  * Parameters:
   3405  *     unit  - BCM device number
   3406  *     fs    - slice that needs its select codes written
   3407  *
   3408  * Returns:
   3409  *     BCM_E_NONE     - Success
   3410  *
   3411  * Note:
   3412  *     Unit lock should be held by calling function.
   3413  */
   3414 STATIC int
   3415 _field_kt2_lookup_slice_clear(int unit, unsigned slice_num)
   3416 {
   3417     uint64 reg_val;
   3418 
   3419     BCM_IF_ERROR_RETURN(
   3420         soc_reg64_get(unit, VFP_KEY_CONTROL_1r, REG_PORT_ANY, 0, &reg_val));
   3421     soc_reg64_field32_set(unit, VFP_KEY_CONTROL_1r, &reg_val,
   3422                           _bcm_field_trx_vfp_double_wide_sel[slice_num], 0);
   3423     soc_reg64_field32_set(unit, VFP_KEY_CONTROL_1r, &reg_val,
   3424                           _bcm_field_trx_vfp_field_sel[slice_num][0], 0);
   3425     soc_reg64_field32_set(unit, VFP_KEY_CONTROL_1r, &reg_val,
   3426                           _bcm_field_trx_vfp_field_sel[slice_num][1], 0);
   3427     soc_reg64_field32_set(unit, VFP_KEY_CONTROL_1r, &reg_val,
   3428                          _bcm_field_trx_slice_pairing_field[slice_num >> 1], 0);
   3429     BCM_IF_ERROR_RETURN(
   3430         soc_reg64_set(unit, VFP_KEY_CONTROL_1r, REG_PORT_ANY, 0, reg_val));
   3431 
   3432     return (soc_reg_field32_modify(unit, VFP_KEY_CONTROL_2r, REG_PORT_ANY,
   3433                            _bcm_field_trx_vfp_ip_header_sel[slice_num],0));
   3434 }
   3435 
   3436 /*
   3437  * Function:
   3438  *     _field_kt2_slice_clear
   3439  *
   3440  * Purpose:
   3441  *     Clear slice configuration on group removal
   3442  *
   3443  * Parameters:
   3444  *     unit  - BCM device number
   3445  *     fg    - Field group slice belongs to
   3446  *     fs    - Field slice structure.
   3447  *
   3448  * Returns:
   3449  *     BCM_E_XXX
   3450  */
   3451 STATIC int
   3452 _field_kt2_slice_clear(int unit, _field_group_t *fg, _field_slice_t *fs)
   3453 {
   3454     int rv;
   3455 
   3456     switch (fs->stage_id) {
   3457       case _BCM_FIELD_STAGE_INGRESS:
   3458           rv = _bcm_field_trx_ingress_slice_clear(unit, fs->slice_number);
   3459           break;
   3460       case _BCM_FIELD_STAGE_LOOKUP:
   3461           rv = _field_kt2_lookup_slice_clear(unit, fs->slice_number);
   3462           break;
   3463       case _BCM_FIELD_STAGE_EGRESS:
   3464           rv = _bcm_field_trx_egress_slice_clear(unit, fs->slice_number);
   3465           break;
   3466       default:
   3467           rv = BCM_E_INTERNAL;
   3468     }
   3469     return (rv);
   3470 }
   3471 
   3472 /*
   3473  * Function:
   3474  *     _field_kt2_write_slice_map_ingress
   3475  * Purpose:
   3476  *     Write FP_SLICE_MAP
   3477  * Parameters:
   3478  *     unit       - (IN) BCM device number
   3479  *     stage_fc   - (IN) stage control structure
   3480  * Returns:
   3481  *     BCM_E_XXX
   3482  */
   3483 STATIC int
   3484 _field_kt2_write_slice_map_ingress(int unit, _field_stage_t *stage_fc)
   3485 {
   3486     fp_slice_map_entry_t entry;
   3487     soc_field_t field;
   3488     uint32 value;
   3489     int vmap_size;
   3490     int index;
   3491     static const soc_field_t physical_slice[] = {
   3492         VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3493         VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3494         VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3495         VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3496         VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3497         VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3498         VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3499         VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3500         VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3501         VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3502         VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3503         VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3504         VIRTUAL_SLICE_12_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3505         VIRTUAL_SLICE_13_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3506         VIRTUAL_SLICE_14_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   3507         VIRTUAL_SLICE_15_PHYSICAL_SLICE_NUMBER_ENTRY_0f
   3508     };
   3509     static const soc_field_t slice_group[] = {
   3510         VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3511         VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3512         VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3513         VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3514         VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3515         VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3516         VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3517         VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3518         VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3519         VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3520         VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3521         VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3522         VIRTUAL_SLICE_12_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3523         VIRTUAL_SLICE_13_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3524         VIRTUAL_SLICE_14_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   3525         VIRTUAL_SLICE_15_VIRTUAL_SLICE_GROUP_ENTRY_0f
   3526     };
   3527 
   3528     /* Calculate virtual map size. */
   3529     BCM_IF_ERROR_RETURN
   3530         (_bcm_field_virtual_map_size_get(unit, stage_fc, &vmap_size));
   3531 
   3532     SOC_IF_ERROR_RETURN(READ_FP_SLICE_MAPm(unit, MEM_BLOCK_ANY, 0, &entry));
   3533 
   3534     for (index = 0; index < vmap_size; index++) {
   3535         value = stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][index].vmap_key;
   3536         field = physical_slice[index];
   3537         soc_FP_SLICE_MAPm_field32_set(unit, &entry, field, value);
   3538 
   3539         value = stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][index].virtual_group;
   3540         field = slice_group[index];
   3541         soc_FP_SLICE_MAPm_field32_set(unit, &entry, field, value);
   3542     }
   3543 
   3544 #ifdef BCM_SABER2_SUPPORT
   3545     /* Dagger_2 uses only 8 slices instead of 12
   3546      * FP_SLICE_MAP entries for the upper four virtual slices
   3547      * needs to updated with values > 7.
   3548      * If not configured, those virtual slice will map to
   3549      * physical slice 0 and slice 0 will be considered as
   3550      * highest priority irrespective of its group priority
   3551      * This fix is required for Beagle (Metrolite variant) */
   3552     if (SOC_IS_SABER2(unit) && (vmap_size < 12)) {
   3553         for (index = vmap_size; index < 12; index++) {
   3554             field = physical_slice[index];
   3555             if (!SOC_MEM_FIELD_VALID(unit,
   3556                         FP_SLICE_MAPm, field)) {
   3557                 break;
   3558             }
   3559             value = index;
   3560             soc_FP_SLICE_MAPm_field32_set(unit, &entry, field, value);
   3561 
   3562             value = index;
   3563             field = slice_group[index];
   3564             soc_FP_SLICE_MAPm_field32_set(unit, &entry, field, value);
   3565         }
   3566     }
   3567 #endif
   3568 
   3569     return WRITE_FP_SLICE_MAPm(unit, MEM_BLOCK_ALL, 0, &entry);
   3570 }
   3571 
   3572 /*
   3573  * Function:
   3574  *     _field_kt2_write_slice_map
   3575  * Purpose:
   3576  *     Write FP_SLICE_MAP, EFP_SLICE_MAP, VFP_SLICE_MAP
   3577  * Parameters:
   3578  *     unit       - (IN) BCM device number
   3579  *     stage_fc   - (IN) stage control structure
   3580  *     fg         - (IN) reference to field group structure.
   3581  * Returns:
   3582  *     BCM_E_XXX
   3583  */
   3584 int
   3585 _field_kt2_write_slice_map(int unit, _field_stage_t *stage_fc,
   3586                            _field_group_t *fg)
   3587 {
   3588     if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) {
   3589         return _field_kt2_write_slice_map_ingress(unit, stage_fc);
   3590     } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   3591         return _bcm_field_trx_write_slice_map_egress(unit, stage_fc);
   3592     } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP) {
   3593         return _bcm_field_trx_write_slice_map_vfp(unit, stage_fc);
   3594     }
   3595 
   3596     return BCM_E_INTERNAL;
   3597 }
   3598 
   3599 /*
   3600  * Function:
   3601  *     _field_kt2_counter_write
   3602  * Purpose:
   3603  *     Write accumulated sw & hw counters
   3604  * Parameters:
   3605  *   unit          - (IN) BCM device number
   3606  *   stage_fc      - (IN) Stage field control
   3607  *   counter_x_mem - (IN) Memory name for X pipe FP counter
   3608  *   mem_x_buf     - (IN) Memory table entry for X pipe FP counter
   3609  *   counter_y_mem - (IN) Memory name for Y pipe FP counter
   3610  *   mem_y_buf     - (IN) Memory table entry for Y pipe FP counter
   3611  *   idx           - (IN) Counter index
   3612  *   packet_count  - (IN) Packet counter value
   3613  *   byte_count    - (IN) Byte counter value
   3614  * Returns:
   3615  *    BCM_E_XXX
   3616  */
   3617 STATIC int
   3618 _field_kt2_counter_write(int unit, soc_mem_t mem, int idx, uint32 *buf,
   3619                             _field_counter32_collect_t *cntrs32_buf,
   3620                             _field_counter64_collect_t *cntrs64_buf,
   3621                             uint64 *packet_count, uint64 *byte_count)
   3622 {
   3623     uint32  hw_val[2];     /* Parsed field counter value.*/
   3624     int     len = 0;       /* Field length */
   3625     /* Set byte count in the memory */
   3626     if (NULL != byte_count) {
   3627         COMPILER_64_ZERO(cntrs64_buf->accumulated_counter);
   3628         COMPILER_64_OR(cntrs64_buf->accumulated_counter, (*byte_count));
   3629         len = soc_mem_field_length(unit, mem, BYTE_COUNTERf);
   3630         if (len <= 32) {
   3631            return BCM_E_INTERNAL;
   3632         }
   3633         COMPILER_64_SET(cntrs64_buf->last_hw_value,
   3634                         COMPILER_64_HI(*byte_count) & ((1 << (len - 32)) - 1),
   3635                         COMPILER_64_LO(*byte_count));
   3636         hw_val[0] = COMPILER_64_LO(cntrs64_buf->last_hw_value);
   3637         hw_val[1] = COMPILER_64_HI(cntrs64_buf->last_hw_value);
   3638         soc_mem_field_set(unit, mem, buf, BYTE_COUNTERf, hw_val);
   3639     }
   3640     /* Set packet count in the memory */
   3641     if (NULL != packet_count) {
   3642         COMPILER_64_ZERO(cntrs32_buf->accumulated_counter);
   3643         COMPILER_64_OR(cntrs32_buf->accumulated_counter,
   3644                        (*packet_count));
   3645         cntrs32_buf->last_hw_value =
   3646             (COMPILER_64_LO(*packet_count) & 0x1fffffff);
   3647         hw_val[0] = cntrs32_buf->last_hw_value;
   3648         hw_val[1] = 0;
   3649         soc_mem_field_set(unit, mem, buf, PACKET_COUNTERf, hw_val);
   3650     }
   3651 
   3652     return soc_mem_write(unit, mem, MEM_BLOCK_ALL, idx, buf);
   3653 }
   3654 
   3655 /*
   3656  * Function:
   3657  *     _field_kt2_counter_set
   3658  * Purpose:
   3659  *     Write accumulated sw and hw counters
   3660  * Parameters:
   3661  *   unit          - (IN) BCM device number
   3662  *   stage_fc      - (IN) Stage field control
   3663  *   counter_x_mem - (IN) Memory name for X pipe FP counter
   3664  *   mem_x_buf     - (IN) Memory table entry for X pipe FP counter
   3665  *   counter_y_mem - (IN) Memory name for Y pipe FP counter
   3666  *   mem_y_buf     - (IN) Memory table entry for Y pipe FP counter
   3667  *   idx           - (IN) Counter index
   3668  *   packet_count  - (IN) Packet counter value
   3669  *   byte_count    - (IN) Byte counter value
   3670  * Returns:
   3671  *    BCM_E_XXX
   3672  */
   3673 STATIC int
   3674 _field_kt2_counter_set(int unit, _field_stage_t *stage_fc,
   3675                           soc_mem_t counter_x_mem, uint32 *mem_x_buf,
   3676                           soc_mem_t counter_y_mem, uint32 *mem_y_buf,
   3677                           int idx, uint64 *packet_count, uint64 *byte_count)
   3678 {
   3679     _field_counter32_collect_t *cntrs32_buf;  /* Sw packet counter value    */
   3680     _field_counter64_collect_t *cntrs64_buf;  /* Sw byte counter value      */
   3681 
   3682     /* Input parameters check. */
   3683     if (NULL == stage_fc) {
   3684         return BCM_E_PARAM;
   3685     }
   3686 
   3687     /* Write counter value. */
   3688     if (NULL != mem_x_buf) {
   3689         cntrs64_buf = &stage_fc->_field_x64_counters[idx];
   3690         cntrs32_buf = &stage_fc->_field_x32_counters[idx];
   3691         BCM_IF_ERROR_RETURN(_field_kt2_counter_write(
   3692                                 unit, counter_x_mem, idx, mem_x_buf,
   3693                                 cntrs32_buf, cntrs64_buf,
   3694                                 packet_count, byte_count));
   3695     }
   3696 
   3697     return BCM_E_NONE;
   3698 }
   3699 
   3700 /*
   3701  * Function:
   3702  *     _field_kt2_counter_get
   3703  * Purpose:
   3704  *     Update accumulated sw counter and return current counter value.
   3705  * Parameters:
   3706  *   unit          - (IN)  BCM device number
   3707  *   stage_fc      - (IN)  Stage field control
   3708  *   counter_x_mem - (IN)  Memory name for X pipe FP counter
   3709  *   mem_x_buf     - (IN)  Memory table entry for X pipe FP counter
   3710  *   counter_y_mem - (IN)  Memory name for Y pipe FP counter
   3711  *   mem_y_buf     - (IN)  Memory table entry for Y pipe FP counter
   3712  *   idx           - (IN)  Counter index
   3713  *   packet_count  - (OUT) Packet counter value
   3714  *   byte_count    - (OUT) Byte counter value
   3715  * Returns:
   3716  *    BCM_E_XXX
   3717  */
   3718 STATIC int
   3719 _field_kt2_counter_get(int unit, _field_stage_t *stage_fc,
   3720                           soc_mem_t counter_x_mem, uint32 *mem_x_buf,
   3721                           soc_mem_t counter_y_mem, uint32 *mem_y_buf,
   3722                           int idx, uint64 *packet_count, uint64 *byte_count)
   3723 {
   3724     _field_counter32_collect_t *cntrs32_buf = NULL;  /* Sw packet counter value    */
   3725     _field_counter64_collect_t *cntrs64_buf = NULL;  /* Sw byte counter value      */
   3726     soc_memacc_t *memacc_pkt = NULL, *memacc_byte = NULL; /*Memory access cache*/
   3727     uint32  hw_val[2];     /* Parsed field counter value.*/
   3728 
   3729     /* Input parameters check. */
   3730     if ((NULL == mem_x_buf) || (INVALIDm == counter_x_mem) || \
   3731         (NULL == stage_fc)) {
   3732         return (BCM_E_PARAM);
   3733     }
   3734 
   3735     /* Byte counter. */
   3736     hw_val[0] = hw_val[1] = 0;
   3737     cntrs64_buf = &stage_fc->_field_x64_counters[idx];
   3738     memacc_byte =
   3739         &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_BYTE]);
   3740     soc_memacc_field_get(memacc_byte, mem_x_buf, hw_val);
   3741 
   3742     if (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   3743         /* EFP supports 36 bits Byte Counter. */
   3744         _bcm_field_36bit_counter_update(unit, hw_val, cntrs64_buf);
   3745     }
   3746     else {
   3747         _bcm_field_35bit_counter_update(unit, hw_val, cntrs64_buf);
   3748     }
   3749 
   3750     /* Return counter value to caller if (out) pointer was provided. */
   3751     if (NULL != byte_count) {
   3752         COMPILER_64_ADD_64(*byte_count, cntrs64_buf->accumulated_counter);
   3753     }
   3754 
   3755     /* Packet counter. */
   3756     cntrs32_buf = &stage_fc->_field_x32_counters[idx];
   3757     memacc_pkt =
   3758         &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_PACKET]);
   3759     soc_memacc_field_get(memacc_pkt, mem_x_buf, hw_val);
   3760     _bcm_field_29bit_counter_update(unit, hw_val, cntrs32_buf);
   3761     /* Return counter value to caller if (out) pointer was provided. */
   3762     if (NULL != packet_count) {
   3763         COMPILER_64_ADD_64(*packet_count, cntrs32_buf->accumulated_counter);
   3764     }
   3765     return BCM_E_NONE;
   3766 }
   3767 
   3768 /* FP_RESOLUTION packet field values for Katana2 */
   3769 static const struct {
   3770     uint8 api, hw_data, hw_mask;
   3771 } pkt_res_xlate_tbl[] = {
   3772     {  BCM_FIELD_PKT_RES_UNKNOWN,      0x00, 0x3f },
   3773     {  BCM_FIELD_PKT_RES_CONTROL,      0x01, 0x3f },
   3774     {  BCM_FIELD_PKT_RES_OAM,          0x02, 0x3f },
   3775     {  BCM_FIELD_PKT_RES_BFD,          0x03, 0x3f },
   3776     {  BCM_FIELD_PKT_RES_BPDU,         0x04, 0x3f },
   3777     {  BCM_FIELD_PKT_RES_ICNM,         0x05, 0x3f },
   3778     {  BCM_FIELD_PKT_RES_IEEE1588,     0x06, 0x3f },
   3779     {  BCM_FIELD_PKT_RES_L2UC,         0x08, 0x3f },
   3780     {  BCM_FIELD_PKT_RES_L2UNKNOWN,    0x09, 0x3f },
   3781     {  BCM_FIELD_PKT_RES_L2BC,         0x0c, 0x3f },
   3782     {  BCM_FIELD_PKT_RES_L2MCKNOWN,    0x0a, 0x3f },
   3783     {  BCM_FIELD_PKT_RES_L2MCUNKNOWN,  0x0b, 0x3f },
   3784     {  BCM_FIELD_PKT_RES_L3UCKNOWN,    0x10, 0x3f }, /* 16 */
   3785     {  BCM_FIELD_PKT_RES_L3UCUNKNOWN,  0x11, 0x3f }, /* 17 */
   3786     {  BCM_FIELD_PKT_RES_L3MCKNOWN,    0x12, 0x3f }, /* 18 */
   3787     {  BCM_FIELD_PKT_RES_L3MCUNKNOWN,  0x13, 0x3f }, /* 19 */
   3788     {  BCM_FIELD_PKT_RES_MPLSL2KNOWN,  0x18, 0x3f }, /* 24 */
   3789     {  BCM_FIELD_PKT_RES_MPLSL3KNOWN,  0x1a, 0x3f }, /* 26 */
   3790     {  BCM_FIELD_PKT_RES_MPLSKNOWN,    0x1c, 0x3f }, /* 28 */
   3791     {  BCM_FIELD_PKT_RES_MPLSUNKNOWN,  0x19, 0x3f }, /* 25 */
   3792     {  BCM_FIELD_PKT_RES_MPLSMCKNOWN,  0x1d, 0x3f }, /* 29 */
   3793     {  BCM_FIELD_PKT_RES_MIMKNOWN,     0x20, 0x3f }, /* 32 */
   3794     {  BCM_FIELD_PKT_RES_MIMUNKNOWN,   0x21, 0x3f }, /* 33 */
   3795     {  BCM_FIELD_PKT_RES_TRILLKNOWN,   0x28, 0x3f }, /* 40 */
   3796     {  BCM_FIELD_PKT_RES_TRILLUNKNOWN, 0x29, 0x3f }, /* 41 */
   3797     {  BCM_FIELD_PKT_RES_NIVKNOWN,     0x30, 0x3f }, /* 48 */
   3798     {  BCM_FIELD_PKT_RES_NIVUNKNOWN,   0x31, 0x3f }, /* 49 */
   3799     {  BCM_FIELD_PKT_RES_L2_ANY,       0x08, 0x38 },
   3800     {  BCM_FIELD_PKT_RES_L2MC_ANY,     0x0a, 0x3e },
   3801     {  BCM_FIELD_PKT_RES_TRILL_ANY,    0x28, 0x3e },
   3802     {  BCM_FIELD_PKT_RES_NIV_ANY,      0x30, 0x3e },
   3803     {  BCM_FIELD_PKT_RES_MPLS_ANY,     0x18, 0x38 },
   3804     {  BCM_FIELD_PKT_RES_MIM_ANY,      0x20, 0x3e },
   3805     {  BCM_FIELD_PKT_RES_L3_ANY,       0x10, 0x3e }
   3806 };
   3807 
   3808 int
   3809 _bcm_field_kt2_qualify_PacketRes(int               unit,
   3810                                  bcm_field_entry_t entry,
   3811                                  uint32            *data,
   3812                                  uint32            *mask
   3813                                  )
   3814 {
   3815     uint32 i;
   3816     uint8 mark = 0;
   3817 
   3818     /* Translate data #defines to hardware encodings */
   3819     for (i = 0; i < COUNTOF(pkt_res_xlate_tbl); ++i) {
   3820         if (*data == pkt_res_xlate_tbl[i].api) {
   3821             *data = pkt_res_xlate_tbl[i].hw_data;
   3822             *mask = pkt_res_xlate_tbl[i].hw_mask;
   3823             mark = 1;
   3824             break;
   3825         }
   3826     }
   3827     if (mark == 1) {
   3828         return  (BCM_E_NONE);
   3829     } else {
   3830         return (BCM_E_INTERNAL);
   3831     }
   3832 }
   3833 
   3834 int
   3835 _bcm_field_kt2_qualify_PacketRes_get(int               unit,
   3836                                      bcm_field_entry_t entry,
   3837                                      uint32            *data,
   3838                                      uint32            *mask
   3839                                      )
   3840 {
   3841     uint32 i;
   3842     uint8 mark = 0;
   3843     /* Translate data #defines from hardware encodings */
   3844 
   3845     for (i = 0; i < COUNTOF(pkt_res_xlate_tbl); ++i) {
   3846         if (*data == pkt_res_xlate_tbl[i].hw_data ) {
   3847             if ( pkt_res_xlate_tbl[i].hw_mask == 0x3f) {
   3848                 if ( (*mask == pkt_res_xlate_tbl[i].hw_data) ||
   3849                      (*mask == 0x3f) ) {
   3850                     *data = pkt_res_xlate_tbl[i].api;
   3851                     if (*mask == pkt_res_xlate_tbl[i].hw_data) {
   3852                         *mask = pkt_res_xlate_tbl[i].api;
   3853                     } else {
   3854                         *mask = BCM_FIELD_EXACT_MATCH_MASK;
   3855                     }
   3856                     mark = 1;
   3857                     break;
   3858                 }
   3859             } else {
   3860                 if ( (*mask != pkt_res_xlate_tbl[i].hw_data) &&
   3861                      (*mask != 0x3f) ) {
   3862                     *data = pkt_res_xlate_tbl[i].api;
   3863                     *mask = BCM_FIELD_EXACT_MATCH_MASK;
   3864                     mark = 1;
   3865                     break;
   3866                 }
   3867             }
   3868         }
   3869     }
   3870     if (mark == 1) {
   3871         return  (BCM_E_NONE);
   3872     } else {
   3873         return (BCM_E_INTERNAL);
   3874     }
   3875 }
   3876 
   3877 STATIC int
   3878 _field_kt2_ingress_qual_tcam_key_mask_get(int unit,
   3879                                           _field_entry_t *f_ent,
   3880                                           _field_tcam_t *tcam)
   3881 {
   3882     int errcode = BCM_E_INTERNAL;
   3883     const unsigned fp_tcam_words
   3884         = BITS2WORDS(soc_mem_field_length(unit,
   3885                     FP_TCAMm,
   3886                     DATAf
   3887                     )
   3888                 );
   3889 
   3890     tcam->key_size
   3891         = WORDS2BYTES(fp_tcam_words
   3892                 + BITS2WORDS(soc_mem_field_length(
   3893                         unit,
   3894                         FP_GLOBAL_MASK_TCAMm,
   3895                         FULL_KEYf
   3896                         )
   3897                     )
   3898                 );
   3899     tcam->key  = sal_alloc(tcam->key_size, " ");
   3900     tcam->mask = sal_alloc(tcam->key_size, " ");
   3901     if (tcam->key == 0 || tcam->mask == 0) {
   3902         errcode = BCM_E_MEMORY;
   3903         goto error;
   3904     }
   3905     sal_memset(tcam->key,  0, tcam->key_size);
   3906     sal_memset(tcam->mask, 0, tcam->key_size);
   3907 
   3908     if (f_ent->flags & _FP_ENTRY_INSTALLED) {
   3909         int    tcam_idx;
   3910         uint32 tcam_entry[SOC_MAX_MEM_FIELD_WORDS];
   3911 
   3912         errcode = _bcm_field_entry_tcam_idx_get(unit, f_ent, &tcam_idx);
   3913         if (BCM_FAILURE(errcode)) {
   3914             goto error;
   3915         }
   3916 
   3917         errcode = soc_mem_read(unit, FP_TCAMm, MEM_BLOCK_ANY,
   3918                                tcam_idx, tcam_entry);
   3919         if (BCM_FAILURE(errcode)) {
   3920             goto error;
   3921         }
   3922         soc_mem_field_get(unit, FP_TCAMm, tcam_entry, DATAf, tcam->key);
   3923         soc_mem_field_get(unit, FP_TCAMm, tcam_entry, DATA_MASKf, tcam->mask);
   3924 
   3925         errcode = soc_mem_read(unit,
   3926                 FP_GLOBAL_MASK_TCAMm,
   3927                 MEM_BLOCK_ANY,
   3928                 tcam_idx,
   3929                 tcam_entry
   3930                 );
   3931         if (BCM_FAILURE(errcode)) {
   3932             goto error;
   3933         }
   3934         soc_mem_field_get(unit,
   3935                 FP_GLOBAL_MASK_TCAMm,
   3936                 tcam_entry,
   3937                 FULL_KEYf,
   3938                 tcam->key + fp_tcam_words
   3939                 );
   3940         soc_mem_field_get(unit,
   3941                 FP_GLOBAL_MASK_TCAMm,
   3942                 tcam_entry,
   3943                 FULL_MASKf,
   3944                 tcam->mask + fp_tcam_words
   3945                 );
   3946 
   3947     }
   3948 
   3949     return (BCM_E_NONE);
   3950 
   3951  error:
   3952     if (tcam->key) {
   3953         sal_free(tcam->key);
   3954         tcam->key = 0;
   3955     }
   3956     if (tcam->mask) {
   3957         sal_free(tcam->mask);
   3958         tcam->mask = 0;
   3959     }
   3960 
   3961     return (errcode);
   3962 }
   3963 
   3964 int
   3965 _bcm_field_kt2_qual_tcam_key_mask_get(int unit,
   3966                                       _field_entry_t *f_ent,
   3967                                       _field_tcam_t *tcam
   3968                                       )
   3969 {
   3970     switch (f_ent->group->stage_id) {
   3971     case _BCM_FIELD_STAGE_INGRESS:
   3972         return (_field_kt2_ingress_qual_tcam_key_mask_get(unit, f_ent, tcam));
   3973     default:
   3974         ;
   3975     }
   3976 
   3977     return (_field_qual_tcam_key_mask_get(unit, f_ent, tcam, 0));
   3978 }
   3979 
   3980 STATIC int
   3981 _field_kt2_ingress_qual_tcam_key_mask_set(int unit,
   3982                                           _field_entry_t *f_ent,
   3983                                           unsigned       tcam_idx,
   3984                                           unsigned       validf)
   3985 {
   3986     _field_tcam_t  * const tcam = &f_ent->tcam;
   3987     _field_tcam_t  * const extra_tcam = &f_ent->extra_tcam;
   3988     _field_group_t * const fg = f_ent->group;
   3989     uint32         tcam_entry[SOC_MAX_MEM_FIELD_WORDS];
   3990     const unsigned fp_tcam_words
   3991         = BITS2WORDS(soc_mem_field_length(unit,
   3992                     FP_TCAMm,
   3993                     DATAf
   3994                     )
   3995                 );
   3996 
   3997     int valid_bits = 0;
   3998 
   3999     BCM_IF_ERROR_RETURN(soc_mem_read(unit, FP_TCAMm, MEM_BLOCK_ANY,
   4000                                      tcam_idx, tcam_entry));
   4001     soc_mem_field_set(unit, FP_TCAMm, tcam_entry, DATAf, tcam->key);
   4002     soc_mem_field_set(unit, FP_TCAMm, tcam_entry, DATA_MASKf, tcam->mask);
   4003     soc_mem_field32_set(unit, FP_TCAMm, tcam_entry, VALIDf, validf ? 
   4004                        ((fg->flags & _FP_GROUP_LOOKUP_ENABLED) ? 3 : 2) : 0);
   4005     BCM_IF_ERROR_RETURN(soc_mem_write(unit, FP_TCAMm, MEM_BLOCK_ALL,
   4006                                       tcam_idx, tcam_entry));
   4007 
   4008     BCM_IF_ERROR_RETURN(soc_mem_read(unit, FP_GLOBAL_MASK_TCAMm, MEM_BLOCK_ANY,
   4009                                      tcam_idx, tcam_entry));
   4010    if (!(f_ent->flags & _FP_ENTRY_USES_IPBM_OVERLAY)) {
   4011        /* In TCAM A fixed and IPBM are valid so setting accordingly */
   4012        soc_mem_field_set(unit,
   4013                FP_GLOBAL_MASK_TCAMm,
   4014                tcam_entry,
   4015                FULL_KEYf,
   4016                tcam->key + fp_tcam_words
   4017                );
   4018        soc_mem_field_set(unit,
   4019                FP_GLOBAL_MASK_TCAMm,
   4020                tcam_entry,
   4021                FULL_MASKf,
   4022                tcam->mask + fp_tcam_words
   4023                );
   4024        soc_mem_field_set(unit, FP_GLOBAL_MASK_TCAMm, tcam_entry, IPBMf,
   4025                f_ent->pbmp.data.pbits);
   4026        soc_mem_field_set(unit, FP_GLOBAL_MASK_TCAMm, tcam_entry, IPBM_MASKf,
   4027                f_ent->pbmp.mask.pbits);
   4028    } else {
   4029        /* In TCAM B IPBM overlay bits are valid so setting accordingly */
   4030        soc_mem_field_set(unit,
   4031                FP_GLOBAL_MASK_TCAMm,
   4032                tcam_entry,
   4033                IPBMf,
   4034                extra_tcam->key 
   4035                );
   4036        soc_mem_field_set(unit,
   4037                FP_GLOBAL_MASK_TCAMm,
   4038                tcam_entry,
   4039                IPBM_MASKf,
   4040                extra_tcam->mask 
   4041                );
   4042     }
   4043 
   4044     valid_bits = soc_mem_field_length(unit, FP_GLOBAL_MASK_TCAMm, VALIDf);
   4045     soc_mem_field32_set(unit, FP_GLOBAL_MASK_TCAMm, tcam_entry, VALIDf, 
   4046                         validf ? ((0x1 << valid_bits) -1):0);
   4047 
   4048     BCM_IF_ERROR_RETURN(
   4049         soc_mem_write(unit, FP_GLOBAL_MASK_TCAMm, MEM_BLOCK_ALL,
   4050                       tcam_idx, tcam_entry));
   4051 
   4052     return (BCM_E_NONE);
   4053 }
   4054 
   4055 
   4056 int
   4057 _bcm_field_kt2_qual_tcam_key_mask_set(int            unit,
   4058                                       _field_entry_t *f_ent,
   4059                                       unsigned       validf
   4060                                       )
   4061 {
   4062     int       tcam_idx;
   4063     soc_mem_t tcam_mem;
   4064 
   4065     BCM_IF_ERROR_RETURN(
   4066         _bcm_field_entry_tcam_idx_get(unit, f_ent, &tcam_idx));
   4067 
   4068     switch (f_ent->group->stage_id) {
   4069     case _BCM_FIELD_STAGE_INGRESS:
   4070         return (_field_kt2_ingress_qual_tcam_key_mask_set(unit,
   4071                                                      f_ent, tcam_idx, validf));
   4072     case _BCM_FIELD_STAGE_EGRESS:
   4073         tcam_mem = EFP_TCAMm;
   4074         break;
   4075     case _BCM_FIELD_STAGE_LOOKUP:
   4076         tcam_mem = VFP_TCAMm;
   4077         break;
   4078     default:
   4079         return (BCM_E_INTERNAL);
   4080     }
   4081     {
   4082         uint32 tcam_entry[SOC_MAX_MEM_FIELD_WORDS];
   4083         sal_memset(tcam_entry, 0, sizeof(tcam_entry));
   4084 
   4085         BCM_IF_ERROR_RETURN(
   4086             _bcm_field_trx_tcam_get(unit, tcam_mem, f_ent, tcam_entry));
   4087         BCM_IF_ERROR_RETURN(
   4088             soc_mem_write(unit, tcam_mem, MEM_BLOCK_ALL, tcam_idx, tcam_entry));
   4089     }
   4090 
   4091     return (BCM_E_NONE);
   4092 }
   4093 
   4094 
   4095 /*
   4096  * Function:
   4097  *     _field_kt2_functions_init
   4098  *
   4099  * Purpose:
   4100  *     Set up functions pointers 
   4101  *
   4102  * Parameters:
   4103  *     stage_fc - (IN/OUT) pointers to stage control block whe the device 
   4104  *                         and stage specific functions will be registered.
   4105  *
   4106  * Returns:
   4107  *     nothing
   4108  * Notes:
   4109  */
   4110 STATIC void
   4111 _field_kt2_functions_init(_field_funct_t *functions)
   4112 {
   4113     functions->fp_detach               = _bcm_field_tr_detach;
   4114     functions->fp_group_install        = _field_kt2_group_install;
   4115     functions->fp_selcodes_install     = _field_kt2_selcodes_install;
   4116     functions->fp_slice_clear          = _field_kt2_slice_clear;
   4117     functions->fp_entry_remove         = _bcm_field_fb_entry_remove;
   4118     functions->fp_entry_move           = _bcm_field_fb_entry_move;
   4119     functions->fp_selcode_get          = _bcm_field_tr_selcode_get;
   4120     functions->fp_selcode_to_qset      = _bcm_field_selcode_to_qset;
   4121     functions->fp_qual_list_get        = _bcm_field_qual_lists_get;
   4122     functions->fp_tcam_policy_clear    = NULL;
   4123     functions->fp_tcam_policy_install  = _bcm_field_tr_entry_install;
   4124     functions->fp_tcam_policy_reinstall = _bcm_field_tr_entry_reinstall;
   4125     functions->fp_policer_install      = _bcm_field_trx_policer_install;
   4126     functions->fp_write_slice_map      = _field_kt2_write_slice_map;
   4127     functions->fp_qualify_ip_type      = _bcm_field_trx_qualify_ip_type;
   4128     functions->fp_qualify_ip_type_get  = _bcm_field_trx_qualify_ip_type_get;
   4129     functions->fp_action_support_check = _bcm_field_trx_action_support_check;
   4130     functions->fp_action_conflict_check = _bcm_field_trx_action_conflict_check;
   4131     functions->fp_counter_get          = _field_kt2_counter_get;
   4132     functions->fp_counter_set          = _field_kt2_counter_set;
   4133     functions->fp_stat_index_get       = _bcm_field_trx_stat_index_get;
   4134     functions->fp_action_params_check  = _bcm_field_trx_action_params_check;
   4135     functions->fp_action_depends_check = NULL;
   4136     functions->fp_external_entry_install  = NULL;
   4137     functions->fp_external_entry_reinstall = NULL;
   4138     functions->fp_external_entry_remove   = NULL;
   4139     functions->fp_external_entry_prio_set = NULL;
   4140     functions->fp_egress_key_match_type_set =
   4141                       _field_kt2_egress_key_match_type_set;
   4142     functions->fp_data_qualifier_ethertype_add =
   4143                       _bcm_field_trx2_data_qualifier_ethertype_add;
   4144     functions->fp_data_qualifier_ethertype_delete=
   4145                       _bcm_field_trx2_data_qualifier_ethertype_delete;
   4146     functions->fp_data_qualifier_ip_protocol_add =
   4147                       _bcm_field_trx2_data_qualifier_ip_protocol_add;
   4148     functions->fp_data_qualifier_ip_protocol_delete=
   4149                       _bcm_field_trx2_data_qualifier_ip_protocol_delete;
   4150     functions->fp_data_qualifier_packet_format_add=
   4151                       _bcm_field_trx2_data_qualifier_packet_format_add;
   4152     functions->fp_data_qualifier_packet_format_delete=
   4153                       _bcm_field_trx2_data_qualifier_packet_format_delete;
   4154     functions->fp_stat_value_get = NULL;
   4155     functions->fp_stat_value_set = NULL;
   4156     functions->fp_control_set = _bcm_field_control_set;
   4157     functions->fp_control_get = _bcm_field_control_get;
   4158     functions->fp_stat_hw_mode_get = _bcm_field_stat_hw_mode_get;
   4159     functions->fp_stat_hw_alloc = _bcm_field_stat_hw_alloc;
   4160     functions->fp_stat_hw_free = _bcm_field_stat_hw_free;
   4161     functions->fp_group_add = NULL;
   4162     functions->fp_qualify_trunk = _bcm_field_qualify_trunk;
   4163     functions->fp_qualify_trunk_get = _bcm_field_qualify_trunk_get;
   4164     functions->fp_qualify_inports = _bcm_field_qualify_InPorts;
   4165     functions->fp_entry_stat_extended_attach =
   4166         _bcm_field_kt2_entry_stat_extended_attach;
   4167     functions->fp_entry_stat_extended_get =
   4168         _bcm_field_kt2_entry_stat_extended_get;
   4169     functions->fp_entry_stat_detach = _bcm_field_entry_stat_detach;
   4170     functions->fp_class_size_get = NULL;
   4171     functions->fp_policer_packet_counter_get32 =
   4172                       _bcm_field_trx_policer_packet_counter_get;
   4173     functions->fp_policer_packet_reset_counter_get32 =
   4174                       _bcm_field_trx_policer_packet_reset_counter_get;
   4175     functions->fp_qualify_packet_res = _bcm_field_kt2_qualify_PacketRes;
   4176     functions->fp_qualify_packet_res_get = _bcm_field_kt2_qualify_PacketRes_get;
   4177 }
   4178 
   4179 int
   4180 _bcm_field_kt2_qualify_class(int                 unit,
   4181                              bcm_field_entry_t   entry,
   4182                              bcm_field_qualify_t qual,
   4183                              uint32              *data,
   4184                              uint32              *mask
   4185                              )
   4186 {
   4187     _field_entry_t *f_ent;
   4188     unsigned       cl_width, cl_max;
   4189 
   4190     /* Get field entry part that contains the qualifier. */
   4191     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry, qual, &f_ent));
   4192 
   4193     switch (f_ent->group->stage_id) {
   4194     case _BCM_FIELD_STAGE_INGRESS:
   4195         break;
   4196 
   4197 
   4198     case _BCM_FIELD_STAGE_LOOKUP:
   4199         break;
   4200 
   4201     case _BCM_FIELD_STAGE_EGRESS:
   4202         {
   4203             uint32         ifp_cl_type;
   4204 
   4205             cl_width = 9;
   4206             cl_max   = 1 << cl_width;
   4207 
   4208             if (*data >= cl_max || (*mask != BCM_FIELD_EXACT_MATCH_MASK && *mask >= cl_max)) {
   4209                 return (BCM_E_PARAM);
   4210             }
   4211 
   4212             /* Need to set IFP_CLASS_TYPE in TCAM (upper 4 bits) */
   4213 
   4214             switch (qual) {
   4215             case bcmFieldQualifyIngressClassField:
   4216                 ifp_cl_type = 15;
   4217                 break;
   4218             case bcmFieldQualifySrcClassL2:
   4219                 ifp_cl_type = 6;
   4220                 break;
   4221             case bcmFieldQualifySrcClassL3:
   4222                 ifp_cl_type = 8;
   4223                 break;
   4224             case bcmFieldQualifySrcClassField:
   4225                 ifp_cl_type = 4;
   4226                 break;
   4227             case bcmFieldQualifyDstClassL2:
   4228                 ifp_cl_type = 7;
   4229                 break;
   4230             case bcmFieldQualifyDstClassL3:
   4231                 ifp_cl_type = 9;
   4232                 break;
   4233             case bcmFieldQualifyDstClassField:
   4234                 ifp_cl_type = 5;
   4235                 break;
   4236             case bcmFieldQualifyInterfaceClassL2:
   4237                 ifp_cl_type = 10;
   4238                 break;
   4239             case bcmFieldQualifyInterfaceClassL3:
   4240                 ifp_cl_type = 3;
   4241                 break;
   4242             case bcmFieldQualifyIngressInterfaceClassPort:
   4243                 ifp_cl_type = 1;
   4244                 break;
   4245             case bcmFieldQualifyIngressInterfaceClassVPort:
   4246                 ifp_cl_type = 2;
   4247                 break;
   4248             default:
   4249                 return (BCM_E_INTERNAL);
   4250             }
   4251 
   4252             *data |= ifp_cl_type << cl_width;
   4253             *mask |= 0xf << cl_width;
   4254         }
   4255         break;
   4256 
   4257         default:
   4258         return (BCM_E_INTERNAL);
   4259     }
   4260 
   4261     return (BCM_E_NONE);
   4262 }
   4263 
   4264 int
   4265 _bcm_field_kt2_qualify_class_get(int                 unit,
   4266                                  bcm_field_entry_t   entry,
   4267                                  bcm_field_qualify_t qual,
   4268                                  uint32              *data,
   4269                                  uint32              *mask
   4270                                  )
   4271 {
   4272     _field_entry_t *f_ent;
   4273 
   4274     /* Get field entry part that contains the qualifier. */
   4275     BCM_IF_ERROR_RETURN(_bcm_field_entry_qual_get(unit, entry, qual, &f_ent));
   4276 
   4277     if (f_ent->group->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   4278         /* Mask off IFP_CLASSID_TYPE */
   4279 
   4280         const uint32 m = (1 << 9) - 1;
   4281 
   4282         *data &= m;
   4283         *mask &= m;
   4284     }
   4285 
   4286     return (BCM_E_NONE);
   4287 }
   4288 
   4289 
   4290 /*
   4291  * Function:
   4292  *    _bcm_field_kt2_entry_stat_extended_attach
   4293  *
   4294  * Description:
   4295  *       Attach statistics with action entity to Field Processor entry.
   4296  * Parameters:
   4297  *      unit        - (IN) BCM device number.
   4298  *      entry       - (IN) Field entry id.
   4299  *      stat_id     - (IN) Statistics entity id.
   4300  *      stat_action - (IN) Stat Action.
   4301  * Returns:
   4302  *      BCM_E_XXX
   4303  */
   4304 int
   4305 _bcm_field_kt2_entry_stat_extended_attach(int unit,
   4306                                           _field_entry_t *f_ent,
   4307                                           int stat_id,
   4308                                           bcm_field_stat_action_t stat_action)
   4309 {
   4310     _field_entry_stat_t    *f_ent_st; /* Field entry statistics structure.*/
   4311     _field_stat_t          *f_st;     /* Internal statisics descriptor.   */
   4312     _field_stage_id_t      stage_id;  /* Pipeline stage id.               */
   4313     int                    rv;        /* Operation return status.         */
   4314 
   4315     /* Input parameters check. */
   4316     if (NULL == f_ent) {
   4317         return (BCM_E_PARAM);
   4318     }
   4319 
   4320     /* Get entry pipeline stage id. */
   4321     stage_id = f_ent->group->stage_id;
   4322 
   4323     /* Valid only for Ingress & Egress Stage */
   4324     if (stage_id != _BCM_FIELD_STAGE_LOOKUP) {
   4325         return BCM_E_UNAVAIL;
   4326     }
   4327 
   4328     /* Check params for stat action */
   4329     if ((stat_action < bcmFieldStatActionIncrement)
   4330             || (stat_action >= bcmFieldStatActionCount)) {
   4331         LOG_ERROR(BSL_LS_BCM_FP,
   4332                 (BSL_META("FP(unit %d) Error: Not a valid Stat Action value\r\n"),
   4333                  unit));
   4334         return BCM_E_PARAM;
   4335     }
   4336 
   4337     /* Check if another statistics entity is already attached. */
   4338     f_ent_st = &f_ent->statistic;
   4339 
   4340     if (f_ent_st->flags & _FP_ENTRY_EXTENDED_STAT_VALID) {
   4341         return (BCM_E_EXISTS);
   4342     }
   4343 
   4344     /* Check if statistics action conflicts with other actions */
   4345     if (f_ent_st->flags & _FP_ENTRY_EXTENDED_STAT_NOT_ALLOWED) {
   4346         return (BCM_E_CONFIG);
   4347     }
   4348 
   4349     /* Check if statid is not normal stat id */
   4350     if (f_ent_st->sid == stat_id) {
   4351         return BCM_E_PARAM;
   4352     }
   4353 
   4354     /* Get statistics entity  description structure. */
   4355     rv = _bcm_field_stat_get(unit, stat_id, &f_st);
   4356     BCM_IF_ERROR_RETURN(rv);
   4357 
   4358     if ((f_st->stage_id != stage_id) ||
   4359             (f_st->gid !=  f_ent->group->gid)) {
   4360         return (BCM_E_PARAM);
   4361     }
   4362 
   4363     /* Increment statistics entity reference counter. */
   4364     f_st->sw_ref_count++;
   4365 
   4366     /* Attach statistics entity to an entry. */
   4367     f_ent_st->flags |= _FP_ENTRY_EXTENDED_STAT_VALID;
   4368     f_ent_st->flags |= _FP_ENTRY_EXTENDED_STAT_RESERVED;
   4369     f_ent_st->extended_sid    = stat_id;
   4370     f_ent_st->stat_action = stat_action;
   4371 
   4372     /*
   4373      * If qualifiers have not been modified for this entry,
   4374      * set Action only dirty flag.
   4375      */
   4376     if (0 == (f_ent->flags & _FP_ENTRY_DIRTY)) {
   4377         f_ent->flags |= _FP_ENTRY_POLICY_TABLE_ONLY_DIRTY;
   4378     }
   4379 
   4380     /* Entry must be reinstalled for statistics to take effect. */
   4381     f_ent->flags  |= _FP_ENTRY_DIRTY;
   4382 
   4383     return (BCM_E_NONE);
   4384 }
   4385 
   4386 /*
   4387  * Function:
   4388  *    _bcm_field_kt2_entry_stat_extended_get
   4389  *
   4390  * Description:
   4391  *       Get extended statid and stat_action.
   4392  * Parameters:
   4393  *      unit        - (IN)  BCM device number.
   4394  *      entry       - (IN)  Field entry id.
   4395  *      stat_id     - (OUT) Statistics entity id.
   4396  *      stat_action - (OUT) Stat Action.
   4397  * Returns:
   4398  *      BCM_E_XXX
   4399  */
   4400 int _bcm_field_kt2_entry_stat_extended_get (int unit,
   4401                                          _field_entry_t *f_ent,
   4402                                          int *stat_id,
   4403                                          bcm_field_stat_action_t *stat_action)
   4404 {
   4405     _field_stage_id_t      stage_id;  /* Pipeline stage id. */
   4406 
   4407     if ((f_ent == NULL) || (stat_id == NULL) || (stat_action == NULL)) {
   4408         return BCM_E_PARAM;
   4409     }
   4410 
   4411     /* Get entry pipeline stage id. */
   4412     stage_id = f_ent->group->stage_id;
   4413 
   4414     /* Valid only for Ingress & Egress Stage */
   4415     if (stage_id != _BCM_FIELD_STAGE_LOOKUP) {
   4416         return BCM_E_UNAVAIL;
   4417     }
   4418 
   4419     if (f_ent->statistic.flags & _FP_ENTRY_EXTENDED_STAT_VALID) {
   4420         *stat_id = f_ent->statistic.extended_sid;
   4421         *stat_action = f_ent->statistic.stat_action;
   4422     } else {
   4423         return BCM_E_NOT_FOUND;
   4424     }
   4425 
   4426     return BCM_E_NONE;
   4427 }
   4428 
   4429 /*
   4430  * Function:
   4431  *     _bcm_field_kt2_extended_stat_hw_free
   4432  *
   4433  * Purpose:
   4434  *     Deallocate hw counter from an entry.
   4435  *
   4436  * Parameters:
   4437  *     unit      - (IN) BCM device number.
   4438  *     f_ent     - (IN) Entry statistics belongs to.
   4439  * Returns:
   4440  *     BCM_E_XXX
   4441  */
   4442 int _bcm_field_kt2_extended_stat_hw_free (int unit, _field_entry_t *f_ent)
   4443 {
   4444     _field_entry_stat_t *f_ent_st;     /* Field entry statistics structure.*/
   4445     _field_stat_t     *f_st;           /* Statistics entity descriptor.    */
   4446     _field_control_t  *fc;             /* Field control.                   */
   4447     uint64            value;           /* 64 bit zero to reset hw value.   */
   4448     int               idx;             /* Statistics iteration index.      */
   4449     int               rv;              /* Operation return status.         */
   4450     _field_stage_t   *stage_fc = NULL; /* pipeline stage                   */
   4451     int               entry_idx = 0;   /* Entry index at policy table      */
   4452     _field_stage_id_t stage_id;        /* Pipeline stage id.               */
   4453     soc_mem_t         tcam_mem;        /* TCAM memory id.         */
   4454     soc_mem_t         policy_mem;      /* Policy table memory id. */
   4455 
   4456     /* Input parameters check. */
   4457     if (NULL == f_ent) {
   4458         return (BCM_E_PARAM);
   4459     }
   4460 
   4461     /* Get entry pipeline stage id. */
   4462     stage_id = f_ent->group->stage_id;
   4463 
   4464     /* Valid only for vfp lookup Stage */
   4465     if (stage_id != _BCM_FIELD_STAGE_LOOKUP) {
   4466         return BCM_E_UNAVAIL;
   4467     }
   4468 
   4469     BCM_IF_ERROR_RETURN (_field_control_get(unit, &fc));
   4470 
   4471     f_ent_st = &f_ent->statistic;
   4472 
   4473     /* Skip uninstalled statistics entity. */
   4474     if (0 == (f_ent_st->flags & _FP_ENTRY_EXTENDED_STAT_INSTALLED)) {
   4475         return (BCM_E_NONE);
   4476     }
   4477 
   4478     BCM_IF_ERROR_RETURN(_field_stage_control_get(unit,
   4479                 f_ent->group->stage_id, &stage_fc));
   4480 
   4481     rv = _field_fb_tcam_policy_mem_get(unit, f_ent->group->stage_id,
   4482             &tcam_mem, &policy_mem);
   4483     BCM_IF_ERROR_RETURN(rv);
   4484 
   4485     /* Read stat entity configuration. */
   4486     BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit,
   4487                 f_ent_st->extended_sid, &f_st));
   4488 
   4489     /* Decrement hw reference count. */
   4490     if (f_st->hw_ref_count > 0) {
   4491         f_st->hw_ref_count--;
   4492         if (f_st->flex_mode != 0 && f_st->hw_ref_count > 0) {
   4493             /*
   4494              * Get entry index at which flex STAT information
   4495              * has been programmed in policy table.
   4496              */
   4497             BCM_IF_ERROR_RETURN (_bcm_field_slice_offset_to_tcam_idx(unit,
   4498                         stage_fc, f_ent->group->instance,
   4499                         f_ent->fs->slice_number,
   4500                         f_ent->slice_idx, &entry_idx));
   4501 
   4502             rv = _bcm_esw_stat_flex_detach_ingress_table_counters (unit,
   4503                     policy_mem, entry_idx);
   4504 
   4505             /*
   4506              * Flex STAT module detached before field module, ignore
   4507              * error during bcm_field_detach().
   4508              */
   4509             if (BCM_FAILURE(rv) && (TRUE == fc->init)) {
   4510                 return (rv);
   4511             }
   4512         }
   4513     }
   4514 
   4515     /* Statistics is not used by any other entry. */
   4516     if (f_st->hw_ref_count == 0) {
   4517         COMPILER_64_ZERO(value);
   4518         /* Read & Reset  individual statistics. */
   4519         for (idx = 0; idx < f_st->nstat; idx++) {
   4520             rv = _field_stat_value_get(unit, 0, f_st, f_st->stat_arr[idx],
   4521                     f_st->stat_values + idx);
   4522             if (BCM_FAILURE(rv)) {
   4523                 /* During system restart flex stat module
   4524                  * might be reinitialized before fp reinit. Hence
   4525                  * calls to the flex stat module will result in
   4526                  * BCM_E_NOT_FOUND * error code.
   4527                  */
   4528                 if (BCM_E_NOT_FOUND != rv) {
   4529                     return rv;
   4530                 }
   4531             } else {
   4532                 rv = _field_stat_value_set(unit, f_st,
   4533                         f_st->stat_arr[idx], value);
   4534                 BCM_IF_ERROR_RETURN(rv);
   4535             }
   4536         }
   4537         /* Mark hw resource as unused in sw. */
   4538         BCM_IF_ERROR_RETURN(_field_flex_counter_free(unit, f_ent, f_st));
   4539     }
   4540     /*
   4541      * If qualifiers have not been modified for this entry,
   4542      * set Action only dirty flag.
   4543      */
   4544     if (0 == (f_ent->flags & _FP_ENTRY_DIRTY)) {
   4545         f_ent->flags |= _FP_ENTRY_POLICY_TABLE_ONLY_DIRTY;
   4546     }
   4547 
   4548     f_ent_st->flags &= ~_FP_ENTRY_EXTENDED_STAT_INSTALLED;
   4549     f_ent_st->flags &= ~_FP_ENTRY_EXTENDED_STAT_RESERVED;
   4550 
   4551     /* Mark entry for reinstall. */
   4552     f_ent->flags |= _FP_ENTRY_DIRTY;
   4553 
   4554     return BCM_E_NONE;
   4555 }
   4556 
   4557 /*
   4558  * Function:
   4559  *    _bcm_field_kt2_entry_stat_detach
   4560  *
   4561  * Description:
   4562  *       Detach statistics entity from Field processor entry.
   4563  * Parameters:
   4564  *      unit      - (IN) BCM device number.
   4565  *      f_ent     - (IN) Field entry structure.
   4566  *      stat_id   - (IN) Statistics entity id.
   4567  * Returns:
   4568  *      BCM_E_XXX
   4569  */
   4570 int _bcm_field_kt2_entry_stat_detach (int unit,
   4571                                           _field_entry_t *f_ent,
   4572                                           int stat_id)
   4573 {
   4574 
   4575     _field_stat_t       *f_st;              /* Internal statistics entity. */
   4576     _field_entry_stat_t *f_ent_st;          /* Field entry stat structure. */
   4577     int                 rv;                 /* Operation return status.    */
   4578     uint8               isExtendedStat = 0; /* Check if extended stat id.  */
   4579     _field_stage_id_t      stage_id;        /* Pipeline stage id.          */
   4580 
   4581     /* Input parameters check. */
   4582     if (NULL == f_ent) {
   4583         return (BCM_E_PARAM);
   4584     }
   4585 
   4586     /* Get entry pipeline stage id. */
   4587     stage_id = f_ent->group->stage_id;
   4588 
   4589     /* Valid only for Vfp Lookup Stage */
   4590     if (stage_id != _BCM_FIELD_STAGE_LOOKUP) {
   4591         return _bcm_field_entry_stat_detach(unit, f_ent, stat_id);
   4592     }
   4593 
   4594     f_ent_st = &f_ent->statistic;
   4595 
   4596     if (stat_id  == f_ent_st->sid) {
   4597         isExtendedStat = 0;
   4598     } else if (stat_id  == f_ent_st->extended_sid) {
   4599         isExtendedStat = 1;
   4600     } else {
   4601         if ((0 == (f_ent_st->flags & _FP_ENTRY_STAT_VALID)) &&
   4602                 (0 == (f_ent_st->flags & _FP_ENTRY_EXTENDED_STAT_VALID))) {
   4603             return (BCM_E_EMPTY);
   4604         }
   4605         return BCM_E_PARAM;
   4606     }
   4607 
   4608     /* Make sure statistics entity attached to the entry. */
   4609     if ((0 == (f_ent_st->flags & _FP_ENTRY_STAT_VALID)) && !isExtendedStat) {
   4610         return (BCM_E_EMPTY);
   4611     }
   4612 
   4613     if ((0 == (f_ent_st->flags & _FP_ENTRY_EXTENDED_STAT_VALID))
   4614             && isExtendedStat) {
   4615         return (BCM_E_EMPTY);
   4616     }
   4617 
   4618     /* Get statics entity descriptor structure. */
   4619     if (isExtendedStat) {
   4620         BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit,
   4621                     f_ent_st->extended_sid, &f_st));
   4622         BCM_IF_ERROR_RETURN (
   4623                 _bcm_field_kt2_extended_stat_hw_free(unit, f_ent));
   4624     } else {
   4625         BCM_IF_ERROR_RETURN(_bcm_field_stat_get(unit, f_ent_st->sid, &f_st));
   4626         BCM_IF_ERROR_RETURN (_bcm_field_stat_hw_free(unit, f_ent));
   4627     }
   4628 
   4629     /* Decrement statistics entity reference counter. */
   4630     f_st->sw_ref_count--;
   4631 
   4632     /* If no one else is using the entity and it is internal destroy it. */
   4633     if ((1 == f_st->sw_ref_count) && (f_st->hw_flags & _FP_STAT_INTERNAL)) {
   4634         if (isExtendedStat) {
   4635             rv = _field_stat_destroy(unit, f_ent_st->extended_sid);
   4636         } else {
   4637             rv = _field_stat_destroy(unit, f_ent_st->sid);
   4638         }
   4639         BCM_IF_ERROR_RETURN(rv);
   4640     }
   4641 
   4642     /* Detach policer from an entry. */
   4643     if (isExtendedStat) {
   4644         f_ent_st->extended_sid   = _FP_INVALID_INDEX;
   4645         f_ent_st->flags &= ~(_FP_ENTRY_EXTENDED_STAT_VALID);
   4646         f_ent_st->flags &= ~(_FP_ENTRY_EXTENDED_STAT_INSTALLED);
   4647         f_ent_st->flags &= ~(_FP_ENTRY_STAT_INSTALLED);
   4648     } else {
   4649         f_ent_st->sid   = _FP_INVALID_INDEX;
   4650         f_ent_st->flags &= ~(_FP_ENTRY_STAT_VALID);
   4651         f_ent_st->flags &= ~(_FP_ENTRY_STAT_INSTALLED);
   4652         f_ent_st->flags &= ~(_FP_ENTRY_STAT_USE_EVEN);
   4653         f_ent_st->flags &= ~(_FP_ENTRY_STAT_USE_ODD);
   4654     }
   4655 
   4656     /* Mark entry for reinstall. */
   4657     f_ent->flags |= _FP_ENTRY_DIRTY;
   4658 
   4659     return BCM_E_NONE;
   4660 }
   4661 
   4662 #if defined(BCM_WARM_BOOT_SUPPORT)
   4663 int
   4664 _field_kt2_stage_lookup_reinit(int unit, _field_control_t *fc,
   4665                                _field_stage_t *stage_fc)
   4666 {
   4667     int vslice_idx, max, master_slice;
   4668     int idx, idx1, slice_idx, index_min, index_max, ratio, rv = BCM_E_NONE;
   4669     int group_found, mem_sz, parts_count, slice_ent_cnt, expanded[4], slice_master_idx[4];
   4670     int i, pri_tcam_idx, part_index, slice_number, prev_prio;
   4671     uint32 *vfp_tcam_buf = NULL; /* Buffer to read the VFP_TCAM table */
   4672     char *vfp_policy_buf = NULL; /* Buffer to read the VFP_POLICY table */
   4673     uint32 rval, paired, intraslice, dbl_wide_key, dbl_wide_key_sec;
   4674     uint32 vfp_key2, temp;
   4675     uint64 vfp_key1;
   4676     soc_field_t fld;
   4677     vfp_tcam_entry_t *vfp_tcam_entry;
   4678     vfp_policy_table_entry_t *vfp_policy_entry;
   4679     _field_hw_qual_info_t hw_sels;
   4680     _field_slice_t *fs;
   4681     _field_group_t *fg;
   4682     _field_entry_t *f_ent = NULL;
   4683     bcm_pbmp_t entry_pbmp, temp_pbmp;
   4684     uint8 *buf = fc->scache_ptr[_FIELD_SCACHE_PART_0];
   4685     uint8 *buf1 = fc->scache_ptr[_FIELD_SCACHE_PART_1];
   4686     int offset_mode = 0, policer_index = 0;
   4687     uint8 old_physical_slice, slice_num;
   4688     uint32 entry_flags;
   4689     _field_slice_t *fs_temp = NULL;
   4690     _field_action_bmp_t action_bmp;
   4691     _field_entry_wb_info_t f_ent_wb_info;
   4692     soc_field_t vfp_en_flds[4] = {SLICE_ENABLE_SLICE_0f, SLICE_ENABLE_SLICE_1f,
   4693                                   SLICE_ENABLE_SLICE_2f, SLICE_ENABLE_SLICE_3f};
   4694 
   4695     soc_field_t vfp_lk_en_flds[4] =
   4696                      {LOOKUP_ENABLE_SLICE_0f, LOOKUP_ENABLE_SLICE_1f,
   4697                       LOOKUP_ENABLE_SLICE_2f, LOOKUP_ENABLE_SLICE_3f};
   4698 
   4699 
   4700     /* Reset Action bitmap to NULL. */
   4701     action_bmp.w = NULL;
   4702 
   4703     SOC_PBMP_CLEAR(entry_pbmp);
   4704     sal_memset(expanded, 0, 4 * sizeof(int));
   4705     sal_memset(slice_master_idx, 0, 4 * sizeof(int));
   4706 
   4707     if (fc->l2warm) {
   4708         rv = _field_scache_stage_hdr_chk(fc, _FIELD_VFP_DATA_START);
   4709         if (BCM_FAILURE(rv)) {
   4710             return (rv);
   4711         }
   4712     }
   4713 
   4714     /* DMA various tables */
   4715     vfp_tcam_buf = soc_cm_salloc(unit, sizeof(vfp_tcam_entry_t) *
   4716                                 soc_mem_index_count(unit, VFP_TCAMm),
   4717                                 "VFP TCAM buffer");
   4718     if (NULL == vfp_tcam_buf) {
   4719         return BCM_E_MEMORY;
   4720     }
   4721     sal_memset(vfp_tcam_buf, 0, sizeof(vfp_tcam_entry_t) *
   4722                soc_mem_index_count(unit, VFP_TCAMm));
   4723     index_min = soc_mem_index_min(unit, VFP_TCAMm);
   4724     index_max = soc_mem_index_max(unit, VFP_TCAMm);
   4725     fs = stage_fc->slices[_FP_DEF_INST];
   4726     if (stage_fc->flags & _FP_STAGE_HALF_SLICE) {
   4727         slice_ent_cnt = fs->entry_count * 2;
   4728         /* DMA in chunks */
   4729         for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) {
   4730             fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
   4731             if ((rv = soc_mem_read_range(unit, VFP_TCAMm, MEM_BLOCK_ALL,
   4732                                          slice_idx * slice_ent_cnt,
   4733                                          slice_idx * slice_ent_cnt +
   4734                                              fs->entry_count / 2 - 1,
   4735                                          vfp_tcam_buf + slice_idx *
   4736                                              slice_ent_cnt *
   4737                                   soc_mem_entry_words(unit, VFP_TCAMm))) < 0 ) {
   4738                 goto cleanup;
   4739             }
   4740             if ((rv = soc_mem_read_range(unit, VFP_TCAMm, MEM_BLOCK_ALL,
   4741                                          slice_idx * slice_ent_cnt +
   4742                                          fs->entry_count,
   4743                                          slice_idx * slice_ent_cnt +
   4744                                          fs->entry_count +
   4745                                              fs->entry_count / 2 - 1,
   4746                                          vfp_tcam_buf + (slice_idx *
   4747                                          slice_ent_cnt + fs->entry_count) *
   4748                                    soc_mem_entry_words(unit, VFP_TCAMm))) < 0 ) {
   4749                 goto cleanup;
   4750             }
   4751         }
   4752     } else {
   4753         slice_ent_cnt = fs->entry_count;
   4754         if ((rv = soc_mem_read_range(unit, VFP_TCAMm, MEM_BLOCK_ALL,
   4755                                      index_min, index_max,
   4756                                      vfp_tcam_buf)) < 0 ) {
   4757             goto cleanup;
   4758         }
   4759     }
   4760     vfp_policy_buf = soc_cm_salloc(unit, SOC_MEM_TABLE_BYTES
   4761                                   (unit, VFP_POLICY_TABLEm),
   4762                                   "VFP POLICY TABLE buffer");
   4763     if (NULL == vfp_policy_buf) {
   4764         rv = BCM_E_MEMORY;
   4765         goto cleanup;
   4766     }
   4767     index_min = soc_mem_index_min(unit, VFP_POLICY_TABLEm);
   4768     index_max = soc_mem_index_max(unit, VFP_POLICY_TABLEm);
   4769     if ((rv = soc_mem_read_range(unit, VFP_POLICY_TABLEm, MEM_BLOCK_ALL,
   4770                                  index_min, index_max,
   4771                                  vfp_policy_buf)) < 0 ) {
   4772         goto cleanup;
   4773     }
   4774 
   4775     /* Get slice expansion status and virtual map */
   4776     if ((rv = _field_slice_expanded_status_get(unit, fc, stage_fc, expanded, slice_master_idx)) < 0) {
   4777         goto cleanup;
   4778     }
   4779 
   4780     /* Iterate over the slices */
   4781     if ((rv = READ_VFP_SLICE_CONTROLr(unit, &rval)) < 0) {
   4782         goto cleanup;
   4783     }
   4784     if ((rv = READ_VFP_KEY_CONTROL_1r(unit, &vfp_key1)) < 0) {
   4785         goto cleanup;
   4786     }
   4787     if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) {
   4788         if ((rv = READ_VFP_KEY_CONTROL_2r(unit, &vfp_key2)) < 0) {
   4789             goto cleanup;
   4790         }
   4791     }
   4792     for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) {
   4793         /* Ignore disabled slice */
   4794         if ((soc_reg_field_get(unit, VFP_SLICE_CONTROLr, rval,
   4795                                vfp_en_flds[slice_idx]) == 0) ||
   4796             (soc_reg_field_get(unit, VFP_SLICE_CONTROLr, rval,
   4797                                vfp_lk_en_flds[slice_idx]) == 0)) {
   4798             continue;
   4799         }
   4800         /* Ignore secondary slice in paired mode */
   4801         fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2];
   4802         paired = soc_reg64_field32_get(unit, VFP_KEY_CONTROL_1r, vfp_key1, fld);
   4803         fld = _kt2_vfp_slice_wide_mode_field[slice_idx];
   4804         if (soc_reg_field_valid(unit, VFP_KEY_CONTROL_1r, fld)) {
   4805             intraslice = soc_reg64_field32_get(unit, VFP_KEY_CONTROL_1r, vfp_key1, fld);
   4806         } else {
   4807             intraslice = 0;
   4808         }
   4809         if (paired && (slice_idx % 2)) {
   4810             continue;
   4811         }
   4812         /* Don't need to read selectors for expanded slice */
   4813         if (expanded[slice_idx]) {
   4814             continue;
   4815         }
   4816         /* Skip if slice has no valid groups and entries */
   4817         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
   4818         for (idx = 0; idx < slice_ent_cnt; idx++) {
   4819             vfp_tcam_entry = soc_mem_table_idx_to_pointer
   4820                                  (unit, VFP_TCAMm, vfp_tcam_entry_t *,
   4821                                   vfp_tcam_buf, idx +
   4822                                   slice_ent_cnt * slice_idx);
   4823             if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry,
   4824                                           VALIDf) != 0) {
   4825                 break;
   4826             }
   4827         }
   4828         if (idx == slice_ent_cnt && !fc->l2warm) {
   4829             continue;
   4830         }
   4831         /* If Level 2, retrieve the GIDs in this slice */
   4832         if (fc->l2warm) {
   4833             rv = _field_trx_scache_slice_group_recover(unit,
   4834                                                        fc, _FP_DEF_INST,
   4835                                                        slice_idx,
   4836                                                        NULL,
   4837                                                        stage_fc,
   4838                                                        0);
   4839             if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) {
   4840                 fc->l2warm = 0;
   4841                 goto cleanup;
   4842             }
   4843             if (rv == BCM_E_NOT_FOUND) {
   4844                 rv = BCM_E_NONE;
   4845                 continue;
   4846             }
   4847         }
   4848 
   4849         /* Construct the group based on HW selector values */
   4850         _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[0]);
   4851         hw_sels.pri_slice[0].intraslice = _FP_SELCODE_DONT_USE;
   4852         _FIELD_SELCODE_CLEAR(hw_sels.pri_slice[1]);
   4853         hw_sels.pri_slice[1].intraslice = _FP_SELCODE_DONT_USE;
   4854         _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[0]);
   4855         hw_sels.sec_slice[0].intraslice = _FP_SELCODE_DONT_USE;
   4856         _FIELD_SELCODE_CLEAR(hw_sels.sec_slice[1]);
   4857         hw_sels.sec_slice[1].intraslice = _FP_SELCODE_DONT_USE;
   4858 
   4859         /* Get primary slice's selectors */
   4860         hw_sels.pri_slice[0].fpf1 = 0;
   4861         hw_sels.pri_slice[0].fpf2
   4862             = soc_reg64_field32_get(unit,
   4863                                 VFP_KEY_CONTROL_1r,
   4864                                 vfp_key1,
   4865                                 _bcm_field_trx_vfp_field_sel[slice_idx][0]
   4866                                 );
   4867         hw_sels.pri_slice[0].fpf3
   4868             = soc_reg64_field32_get(unit,
   4869                                 VFP_KEY_CONTROL_1r,
   4870                                 vfp_key1,
   4871                                 _bcm_field_trx_vfp_field_sel[slice_idx][1]
   4872                                 );
   4873         if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) {
   4874             hw_sels.pri_slice[0].ip_header_sel
   4875                 = soc_reg_field_get(unit,
   4876                                 VFP_KEY_CONTROL_2r,
   4877                                 vfp_key2,
   4878                                 _bcm_field_trx_vfp_ip_header_sel[slice_idx]
   4879                                 );
   4880         }
   4881 
   4882         hw_sels.pri_slice[0].src_entity_sel
   4883                 = soc_reg64_field32_get(unit,
   4884                                     VFP_KEY_CONTROL_1r,
   4885                                     vfp_key1,
   4886                                     _kt2_vfp_src_type_sel[slice_idx]
   4887                                     );           
   4888 
   4889         /* If intraslice, get double-wide key - only 2 options */
   4890         if (intraslice) {
   4891             dbl_wide_key = soc_reg64_field32_get(
   4892                                unit,
   4893                                VFP_KEY_CONTROL_1r,
   4894                                vfp_key1,
   4895                                _bcm_field_trx_vfp_double_wide_sel[slice_idx]
   4896                                              );
   4897             hw_sels.pri_slice[1].intraslice = TRUE;
   4898             hw_sels.pri_slice[1].fpf2 = dbl_wide_key;
   4899             if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) {
   4900                 hw_sels.pri_slice[1].ip_header_sel
   4901                     = soc_reg_field_get(unit,
   4902                                     VFP_KEY_CONTROL_2r, vfp_key2,
   4903                                     _bcm_field_trx_vfp_ip_header_sel[slice_idx]
   4904                                     );
   4905             }
   4906             hw_sels.pri_slice[1].src_entity_sel
   4907                    = soc_reg64_field32_get(unit,
   4908                                        VFP_KEY_CONTROL_1r,
   4909                                        vfp_key1,
   4910                                        _kt2_vfp_src_type_sel[slice_idx]
   4911                                        );
   4912         }
   4913         /* If paired, get secondary slice's selectors */
   4914         if (paired) {
   4915             hw_sels.sec_slice[0].fpf1 = 0;
   4916             hw_sels.sec_slice[0].fpf2
   4917                 = soc_reg64_field32_get(
   4918                       unit,
   4919                       VFP_KEY_CONTROL_1r,
   4920                       vfp_key1,
   4921                       _bcm_field_trx_vfp_field_sel[slice_idx + 1][0]
   4922                                     );
   4923             hw_sels.sec_slice[0].fpf3
   4924                 = soc_reg64_field32_get(
   4925                       unit,
   4926                       VFP_KEY_CONTROL_1r,
   4927                       vfp_key1,
   4928                       _bcm_field_trx_vfp_field_sel[slice_idx + 1][1]
   4929                                     );
   4930             if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) {
   4931                 hw_sels.sec_slice[0].ip_header_sel
   4932                     = soc_reg_field_get(unit,
   4933                                     VFP_KEY_CONTROL_2r, vfp_key2,
   4934                                     _bcm_field_trx_vfp_ip_header_sel[slice_idx]
   4935                                     );
   4936             }
   4937             hw_sels.sec_slice[0].src_entity_sel
   4938                    = soc_reg64_field32_get(unit,
   4939                                        VFP_KEY_CONTROL_1r,
   4940                                        vfp_key1,
   4941                                        _kt2_vfp_src_type_sel[slice_idx]
   4942                                        );
   4943             if (intraslice) {
   4944                 dbl_wide_key_sec
   4945                     = soc_reg64_field32_get(
   4946                           unit,
   4947                           VFP_KEY_CONTROL_1r,
   4948                           vfp_key1,
   4949                           _bcm_field_trx_vfp_double_wide_sel[slice_idx]
   4950                                         );
   4951                 hw_sels.sec_slice[1].intraslice = TRUE;
   4952                 hw_sels.sec_slice[1].fpf2 = dbl_wide_key_sec;
   4953                 if (SOC_REG_IS_VALID(unit, VFP_KEY_CONTROL_2r)) {
   4954                     hw_sels.sec_slice[1].ip_header_sel
   4955                         = soc_reg_field_get(
   4956                           unit,
   4957                           VFP_KEY_CONTROL_2r,
   4958                           vfp_key2,
   4959                           _bcm_field_trx_vfp_ip_header_sel[slice_idx]
   4960                                         );
   4961                 }
   4962                 hw_sels.sec_slice[1].src_entity_sel
   4963                       = soc_reg_field_get(unit,
   4964                                           VFP_KEY_CONTROL_1r,
   4965                                           vfp_key1,
   4966                                           _kt2_vfp_src_type_sel[slice_idx]
   4967                                           );
   4968             }
   4969         }
   4970         /* Create a group based on HW qualifiers (or find existing) */
   4971         rv = _field_tr2_group_construct(unit, _FP_DEF_INST,
   4972                                         &hw_sels, intraslice,
   4973                                         paired, fc, -1,
   4974                                         _BCM_FIELD_STAGE_LOOKUP,
   4975                                         slice_idx
   4976                                         );
   4977         if (BCM_FAILURE(rv)) {
   4978             goto cleanup;
   4979         }
   4980         /* Now go over the entries */
   4981         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
   4982         if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) {
   4983             fs->free_count >>= 1;
   4984             ratio = 2;
   4985         } else {
   4986             ratio = 1;
   4987         }
   4988         prev_prio = -1;
   4989         for (idx = 0; idx < slice_ent_cnt / ratio; idx++) {
   4990             group_found = 0;
   4991             vfp_tcam_entry = soc_mem_table_idx_to_pointer
   4992                                  (unit, VFP_TCAMm, vfp_tcam_entry_t *,
   4993                                   vfp_tcam_buf, idx +
   4994                                   slice_ent_cnt * slice_idx);
   4995             if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry,
   4996                                           VALIDf) == 0) {
   4997                 continue;
   4998             }
   4999             /* All ports are applicable to this entry */
   5000             SOC_PBMP_ASSIGN(entry_pbmp, PBMP_PORT_ALL(unit));
   5001             SOC_PBMP_OR(entry_pbmp, PBMP_CMIC(unit));
   5002             if (soc_feature(unit, soc_feature_linkphy_coe) ||
   5003                 soc_feature(unit, soc_feature_subtag_coe)) {
   5004                 _bcm_kt2_subport_pbmp_update(unit, &entry_pbmp);
   5005             }
   5006             /* Search groups to find match */
   5007             fg = fc->groups;
   5008             while (fg != NULL) {
   5009                 /* Check if group is in this slice */
   5010                 fs = &fg->slices[0];
   5011                 if (fs->slice_number != slice_idx) {
   5012                     fg = fg->next;
   5013                     continue;
   5014                 }
   5015                 /* Check if entry_pbmp is a subset of group pbmp */
   5016                 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp);
   5017                 SOC_PBMP_AND(temp_pbmp, entry_pbmp);
   5018                 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) {
   5019                     group_found = 1;
   5020                     break;
   5021                 }
   5022                 fg = fg->next;
   5023             }
   5024             if (!group_found) {
   5025                 return BCM_E_INTERNAL; /* Should never happen */
   5026             }
   5027             /* Allocate memory for the entry */
   5028             rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id,
   5029                                                    fg->flags, &parts_count);
   5030             if (BCM_FAILURE(rv)) {
   5031                 goto cleanup;
   5032             }
   5033             mem_sz = parts_count * sizeof (_field_entry_t);
   5034             _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry");
   5035             if (f_ent == NULL) {
   5036                 rv = BCM_E_MEMORY;
   5037                 goto cleanup;
   5038             }
   5039             for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) {
   5040                  f_ent->policer[idx1].pid = _FP_INVALID_INDEX;
   5041             }
   5042 
   5043             sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t));
   5044             f_ent_wb_info.action_bmp = &action_bmp;
   5045             f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1;
   5046             if (fc->l2warm) {
   5047                 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) {
   5048                    action_bmp.w = NULL;
   5049                    _FP_XGS3_ALLOC(action_bmp.w,
   5050                              SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount),
   5051                              "Action No Param Bitmap");
   5052                    if (action_bmp.w == NULL) {
   5053                        rv = BCM_E_MEMORY;
   5054                        sal_free(f_ent);
   5055                        goto cleanup;
   5056                    }
   5057                 }
   5058                 rv = _field_trx_entry_info_retrieve(unit,
   5059                                                     fc,
   5060                                                     stage_fc,
   5061                                                     0,
   5062                                                     &prev_prio,
   5063                                                     &f_ent_wb_info
   5064                                                     );
   5065                 
   5066                 if (BCM_FAILURE(rv)) {
   5067                     sal_free(f_ent);
   5068                     goto cleanup;
   5069                 }
   5070             } else {
   5071                 _bcm_field_last_alloc_eid_incr(unit);
   5072             }
   5073             pri_tcam_idx = idx + slice_ent_cnt * slice_idx;
   5074             for (i = 0; i < parts_count; i++) {
   5075                 if (fc->l2warm) {
   5076                     /* Use retrieved EID */
   5077                     f_ent[i].eid = f_ent_wb_info.eid;
   5078                     /* Set retrieved dvp_type and svp_type */
   5079                     f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i];
   5080                     f_ent[i].svp_type = f_ent_wb_info.svp_type[i];
   5081                     f_ent[i].prio = f_ent_wb_info.prio;
   5082 
   5083                 } else {
   5084                     f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit);
   5085                     f_ent[i].prio = (slice_idx << 10) | (slice_ent_cnt - idx);
   5086                 }
   5087                 f_ent[i].group = fg;
   5088                 rv = _bcm_field_tcam_part_to_entry_flags(unit, i, fg,
   5089                                                          &f_ent[i].flags);
   5090                 if (BCM_FAILURE(rv)) {
   5091                     sal_free(f_ent);
   5092                     goto cleanup;
   5093                 }
   5094                 if (f_ent_wb_info.color_independent) {
   5095                     f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT;
   5096                 }
   5097                 rv = _bcm_field_entry_part_tcam_idx_get(unit, f_ent,
   5098                                                         pri_tcam_idx,
   5099                                                         i, &part_index);
   5100                 if (BCM_FAILURE(rv)) {
   5101                     sal_free(f_ent);
   5102                     goto cleanup;
   5103                 }
   5104                 rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc,
   5105                                                          _FP_DEF_INST,
   5106                                                          part_index,
   5107                                                          &slice_number,
   5108                                                 (int *)&f_ent[i].slice_idx);
   5109                 if (BCM_FAILURE(rv)) {
   5110                     sal_free(f_ent);
   5111                     goto cleanup;
   5112                 }
   5113                 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number;
   5114                 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) {
   5115                     /* Decrement slice free entry count for primary
   5116                        entries. */
   5117                     f_ent[i].fs->free_count--;
   5118                 }
   5119                 /* Assign entry to a slice */
   5120                 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i;
   5121                 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp);
   5122                 f_ent[i].flags |= _FP_ENTRY_INSTALLED;
   5123 
   5124                 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, VALIDf) == 3) {
   5125                     f_ent[i].flags |= _FP_ENTRY_ENABLED;
   5126                 }
   5127 
   5128                 /* Get the actions associated with this part of the entry */
   5129                 vfp_policy_entry = soc_mem_table_idx_to_pointer
   5130                                                 (unit, VFP_POLICY_TABLEm,
   5131                                                  vfp_policy_table_entry_t *,
   5132                                                  vfp_policy_buf, part_index);
   5133                 rv = _field_tr2_actions_recover(unit,
   5134                                                 VFP_POLICY_TABLEm,
   5135                                                 (uint32 *) vfp_policy_entry,
   5136                                                 f_ent,
   5137                                                 i,
   5138                                                 &f_ent_wb_info);
   5139                 if (BCM_FAILURE(rv)) {
   5140                    sal_free(f_ent);
   5141                    goto cleanup;
   5142                 }
   5143                 if (action_bmp.w != NULL) {
   5144                    _FP_ACTION_BMP_FREE(action_bmp);
   5145                    action_bmp.w = NULL;
   5146                 }
   5147                 
   5148                 if (soc_feature(unit, soc_feature_advanced_flex_counter)) {
   5149                     _field_adv_flex_stat_info_retrieve(unit, f_ent->statistic.sid);
   5150                 }
   5151                 policer_index = PolicyGet(unit, 
   5152                                           VFP_POLICY_TABLEm,
   5153                                           vfp_policy_entry,
   5154                                           SVC_METER_INDEXf); 
   5155                 offset_mode  = PolicyGet(unit, 
   5156                                    VFP_POLICY_TABLEm,
   5157                                    vfp_policy_entry,
   5158                                    SVC_METER_OFFSET_MODEf); 
   5159                 rv = _bcm_esw_get_policer_id_from_index_offset(unit, 
   5160                                             policer_index, offset_mode, 
   5161                                             &(f_ent->global_meter_policer.pid));
   5162                 if (BCM_FAILURE(rv)) {
   5163                    sal_free(f_ent);
   5164                    goto cleanup;
   5165                 }
   5166                 f_ent->global_meter_policer.flags = PolicyGet(unit, 
   5167                                                     VFP_POLICY_TABLEm,
   5168                                                     vfp_policy_entry,
   5169                                                     SVC_METER_INDEX_PRIORITYf); 
   5170             }
   5171             /* Add to the group */
   5172             rv = _field_group_entry_add(unit, fg, f_ent);
   5173             if (BCM_FAILURE(rv)) {
   5174                 sal_free(f_ent);
   5175                 goto cleanup;
   5176             }
   5177             f_ent = NULL;
   5178         }
   5179         /* Free up the temporary slice group info */
   5180         if (fc->l2warm) {
   5181             if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_18) {
   5182                 /* update selcode and construct group qual offset */
   5183                 rv = _field_tr2_group_construct_quals_with_sel_update(unit, fc, stage_fc);
   5184                 if (BCM_FAILURE(rv)) {
   5185                     goto cleanup;
   5186                 }
   5187             }
   5188             _field_scache_slice_group_free(unit,
   5189                                            fc,
   5190                                            slice_idx
   5191                                            );
   5192         }
   5193     }
   5194 
   5195     /* Now go over the expanded slices */
   5196     for (slice_idx = 0; slice_idx < stage_fc->tcam_slices; slice_idx++) {
   5197         if (!expanded[slice_idx]) {
   5198             continue;
   5199         }
   5200         /* Ignore secondary slice in paired mode */
   5201         fld = _bcm_field_trx_slice_pairing_field[slice_idx / 2];
   5202         paired = soc_reg64_field32_get(unit, VFP_KEY_CONTROL_1r, vfp_key1, fld);
   5203         if (paired && (slice_idx % 2)) {
   5204             continue;
   5205         }
   5206         /* Skip if slice has no valid groups and entries */
   5207         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
   5208         for (idx = 0; idx < slice_ent_cnt; idx++) {
   5209             vfp_tcam_entry = soc_mem_table_idx_to_pointer
   5210                                  (unit, VFP_TCAMm, vfp_tcam_entry_t *,
   5211                                   vfp_tcam_buf, idx +
   5212                                   slice_ent_cnt * slice_idx);
   5213             if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry,
   5214                                           VALIDf) != 0) {
   5215                 break;
   5216             }
   5217         }
   5218 
   5219         if (idx == slice_ent_cnt) {
   5220             continue;
   5221         }
   5222 
   5223         /* If Level 2, retrieve the GIDs in this slice */
   5224         if (fc->l2warm) {
   5225             rv = _field_trx_scache_slice_group_recover(unit,
   5226                                                        fc, _FP_DEF_INST,
   5227                                                        slice_idx,
   5228                                                        NULL,
   5229                                                        stage_fc,
   5230                                                        0);
   5231             if (BCM_FAILURE(rv) && (rv != BCM_E_NOT_FOUND)) {
   5232                 fc->l2warm = 0;
   5233                 goto cleanup;
   5234             }
   5235             if (rv == BCM_E_NOT_FOUND) {
   5236                 rv = BCM_E_NONE;
   5237                 continue;
   5238             }
   5239         }
   5240 
   5241         /* Now find the master slice for this virtual group */
   5242         vslice_idx = _field_physical_to_virtual(unit, _FP_DEF_INST,
   5243                                               slice_idx, stage_fc);
   5244         if (vslice_idx < 0) {
   5245             rv = BCM_E_INTERNAL;
   5246             goto cleanup;
   5247         }
   5248 
   5249         if (fc->l2warm
   5250                 && ((fc->wb_recovered_version) >=BCM_FIELD_WB_VERSION_1_8)) {
   5251             master_slice = slice_master_idx[slice_idx];
   5252         } else {
   5253         max = -1;
   5254         for (i = 0; i < stage_fc->tcam_slices; i++) {
   5255             if ((stage_fc->vmap[_FP_DEF_INST][0][vslice_idx].virtual_group ==
   5256                 stage_fc->vmap[_FP_DEF_INST][0][i].virtual_group) && (i != vslice_idx)) {
   5257                 if (i > max) {
   5258                     max = i;
   5259                 }
   5260             }
   5261         }
   5262         if (max < 0) {
   5263             rv = BCM_E_INTERNAL;
   5264             goto cleanup;
   5265         }
   5266 
   5267         master_slice = stage_fc->vmap[_FP_DEF_INST][0][max].vmap_key;
   5268         }
   5269         /* See which group is in this slice - can be only one */
   5270         fg = fc->groups;
   5271         while (fg != NULL) {
   5272             /* Check if group is in this slice */
   5273             fs = &fg->slices[0];
   5274             if ((fg->stage_id == stage_fc->stage_id)
   5275                     && (fs->slice_number == master_slice)) {
   5276                 break;
   5277             }
   5278             fg = fg->next;
   5279         }
   5280         if (fg == NULL) {
   5281             rv = BCM_E_INTERNAL;
   5282 
   5283             goto cleanup;
   5284         }
   5285 
   5286         /* Get number of entry parts for the group. */
   5287         rv = _bcm_field_entry_tcam_parts_count (unit, fg->stage_id,
   5288                                                 fg->flags, &parts_count);
   5289         BCM_IF_ERROR_RETURN(rv);
   5290 
   5291         old_physical_slice = fs->slice_number;
   5292 
   5293         /* Set up the new physical slice parameters in Software */
   5294         for(part_index = parts_count - 1; part_index >= 0; part_index--) {
   5295             /* Get entry flags. */
   5296             rv = _bcm_field_tcam_part_to_entry_flags(unit, part_index, fg, &entry_flags);
   5297             BCM_IF_ERROR_RETURN(rv);
   5298 
   5299             /* Get slice id for entry part */
   5300             rv = _bcm_field_tcam_part_to_slice_number(unit, part_index,
   5301                                                       fg, &slice_num);
   5302             BCM_IF_ERROR_RETURN(rv);
   5303 
   5304             /* Get slice pointer. */
   5305             fs = stage_fc->slices[_FP_DEF_INST] + slice_idx
   5306                     + slice_num;
   5307 
   5308             if (0 == (entry_flags & _FP_ENTRY_SECOND_HALF)) {
   5309                 /* Set per slice configuration &  number of free entries in the slice.*/
   5310                 fs->free_count = fs->entry_count;
   5311                 if (fg->flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) {
   5312                     fs->free_count >>= 1;
   5313                 }
   5314                 /* Set group flags in in slice.*/
   5315                 fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK;
   5316 
   5317                 /* Add slice to slices linked list . */
   5318                 fs_temp = stage_fc->slices[_FP_DEF_INST] + old_physical_slice + slice_num;
   5319                 /* To handle more than one auto expanded slice in a group */
   5320                 while (fs_temp->next != NULL) {
   5321                     fs_temp = fs_temp->next;
   5322                 }
   5323                 fs_temp->next = fs;
   5324                 fs->prev = fs_temp;
   5325             }
   5326         }
   5327 
   5328         /* Now go over the entries */
   5329         fs = stage_fc->slices[_FP_DEF_INST] + slice_idx;
   5330         fs->group_flags = fg->flags & _FP_GROUP_STATUS_MASK;
   5331         if (fs->group_flags & _FP_GROUP_INTRASLICE_DOUBLEWIDE) {
   5332             ratio = 2;
   5333         } else {
   5334             ratio = 1;
   5335         }
   5336 
   5337         prev_prio = -1;
   5338         for (idx = 0; idx < slice_ent_cnt / ratio; idx++) {
   5339             group_found = 0;
   5340             vfp_tcam_entry = soc_mem_table_idx_to_pointer
   5341                                  (unit, VFP_TCAMm, vfp_tcam_entry_t *,
   5342                                   vfp_tcam_buf, idx +
   5343                                   slice_ent_cnt * slice_idx);
   5344             if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry,
   5345                                           VALIDf) == 0) {
   5346                 continue;
   5347             }
   5348 
   5349             /* All ports are applicable to this entry */
   5350             SOC_PBMP_ASSIGN(entry_pbmp, PBMP_PORT_ALL(unit));
   5351             SOC_PBMP_OR(entry_pbmp, PBMP_CMIC(unit));
   5352             if (soc_feature(unit, soc_feature_linkphy_coe) ||
   5353                 soc_feature(unit, soc_feature_subtag_coe)) {
   5354                 _bcm_kt2_subport_pbmp_update(unit, &entry_pbmp);
   5355             }
   5356             /* Search groups to find match */
   5357             fg = fc->groups;
   5358             while (fg != NULL) {
   5359                 /* Check if group is in this slice */
   5360                 fs = &fg->slices[0];
   5361                 if ((fg->stage_id != stage_fc->stage_id)
   5362                         || (fs->slice_number != master_slice)) {
   5363                     fg = fg->next;
   5364                     continue;
   5365                 }
   5366                 /* Check if entry_pbmp is a subset of group pbmp */
   5367                 SOC_PBMP_ASSIGN(temp_pbmp, fg->pbmp);
   5368                 SOC_PBMP_AND(temp_pbmp, entry_pbmp);
   5369                 if (SOC_PBMP_EQ(temp_pbmp, entry_pbmp)) {
   5370                     group_found = 1;
   5371                     break;
   5372                 }
   5373                 fg = fg->next;
   5374             }
   5375             if (!group_found) {
   5376                 return BCM_E_INTERNAL; /* Should never happen */
   5377             }
   5378             /* Allocate memory for the entry */
   5379             rv = _bcm_field_entry_tcam_parts_count(unit, fg->stage_id,
   5380                                                    fg->flags, &parts_count);
   5381             if (BCM_FAILURE(rv)) {
   5382                 goto cleanup;
   5383             }
   5384             mem_sz = parts_count * sizeof (_field_entry_t);
   5385             _FP_XGS3_ALLOC(f_ent, mem_sz, "field entry");
   5386             if (f_ent == NULL) {
   5387                 rv = BCM_E_MEMORY;
   5388                 goto cleanup;
   5389             }
   5390             for (idx1 = 0; idx1 < _FP_POLICER_LEVEL_COUNT; idx1++) {
   5391                  f_ent->policer[idx1].pid = _FP_INVALID_INDEX;
   5392             }
   5393 
   5394             sal_memset(&f_ent_wb_info, 0, sizeof(_field_entry_wb_info_t));
   5395             f_ent_wb_info.action_bmp = &action_bmp;
   5396             f_ent_wb_info.sid = f_ent_wb_info.pid = f_ent_wb_info.pid1 = -1;
   5397             if (fc->l2warm) {
   5398                 if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) {
   5399                    action_bmp.w = NULL;
   5400                    _FP_XGS3_ALLOC(action_bmp.w,
   5401                              SHR_BITALLOCSIZE(_bcmFieldActionNoParamCount),
   5402                              "Action No Param Bitmap");
   5403                    if (action_bmp.w == NULL) {
   5404                        rv = BCM_E_MEMORY;
   5405                        sal_free(f_ent);
   5406                        goto cleanup;
   5407                    }
   5408                 }
   5409                 rv = _field_trx_entry_info_retrieve(unit,
   5410                                                     fc,
   5411                                                     stage_fc,
   5412                                                     0,
   5413                                                     &prev_prio,
   5414                                                     &f_ent_wb_info
   5415                                                     );
   5416                 
   5417                 if (BCM_FAILURE(rv)) {
   5418                     sal_free(f_ent);
   5419                     goto cleanup;
   5420                 }
   5421             } else {
   5422                 _bcm_field_last_alloc_eid_incr(unit);
   5423             }
   5424             pri_tcam_idx = idx + slice_ent_cnt * slice_idx;
   5425             for (i = 0; i < parts_count; i++) {
   5426                 if (fc->l2warm) {
   5427                     /* Use retrieved EID */
   5428                     f_ent[i].eid = f_ent_wb_info.eid;
   5429                     /* Set retrieved dvp_type and svp_type */
   5430                     f_ent[i].dvp_type = f_ent_wb_info.dvp_type[i];
   5431                     f_ent[i].svp_type = f_ent_wb_info.svp_type[i];
   5432                     f_ent[i].prio = f_ent_wb_info.prio;
   5433                 } else {
   5434                     f_ent[i].eid = _bcm_field_last_alloc_eid_get(unit);
   5435                     f_ent[i].prio = (slice_idx << 10) | (slice_ent_cnt - idx);
   5436                 }
   5437                 f_ent[i].group = fg;
   5438                 rv = _bcm_field_tcam_part_to_entry_flags(unit, i, fg,
   5439                                                          &f_ent[i].flags);
   5440                 if (BCM_FAILURE(rv)) {
   5441                     sal_free(f_ent);
   5442                     goto cleanup;
   5443                 }
   5444                 if (f_ent_wb_info.color_independent) {
   5445                     f_ent[i].flags |= _FP_ENTRY_COLOR_INDEPENDENT;
   5446                 }
   5447                 rv = _bcm_field_entry_part_tcam_idx_get(unit, f_ent,
   5448                                                         pri_tcam_idx,
   5449                                                         i, &part_index);
   5450                 if (BCM_FAILURE(rv)) {
   5451                     sal_free(f_ent);
   5452                     goto cleanup;
   5453                 }
   5454                 rv = _bcm_field_tcam_idx_to_slice_offset(unit, stage_fc,
   5455                                                          _FP_DEF_INST,
   5456                                                          part_index,
   5457                                                          &slice_number,
   5458                                                 (int *)&f_ent[i].slice_idx);
   5459                 if (BCM_FAILURE(rv)) {
   5460                     sal_free(f_ent);
   5461                     goto cleanup;
   5462                 }
   5463                 f_ent[i].fs = stage_fc->slices[_FP_DEF_INST] + slice_number;
   5464                 if (0 == (f_ent[i].flags & _FP_ENTRY_SECOND_HALF)) {
   5465                     /* Decrement slice free entry count for primary
   5466                        entries. */
   5467                     f_ent[i].fs->free_count--;
   5468                 }
   5469                 /* Assign entry to a slice */
   5470                 f_ent[i].fs->entries[f_ent[i].slice_idx] = f_ent + i;
   5471                 BCM_PBMP_OR(f_ent[i].fs->pbmp, fg->pbmp);
   5472                 f_ent[i].flags |= _FP_ENTRY_INSTALLED;
   5473 
   5474                 if (soc_VFP_TCAMm_field32_get(unit, vfp_tcam_entry, VALIDf) == 3) {
   5475                     f_ent[i].flags |= _FP_ENTRY_ENABLED;
   5476                 }
   5477 
   5478                 /* Get the actions associated with this part of the entry */
   5479                 vfp_policy_entry = soc_mem_table_idx_to_pointer
   5480                                                 (unit, VFP_POLICY_TABLEm,
   5481                                                  vfp_policy_table_entry_t *,
   5482                                                  vfp_policy_buf, part_index);
   5483                 rv = _field_tr2_actions_recover(unit,
   5484                                                 VFP_POLICY_TABLEm,
   5485                                                 (uint32 *) vfp_policy_entry,
   5486                                                 f_ent,
   5487                                                 i,
   5488                                                 &f_ent_wb_info);
   5489                 if (BCM_FAILURE(rv)) {
   5490                    sal_free(f_ent);
   5491                    goto cleanup;
   5492                 }
   5493                 if (action_bmp.w != NULL) {
   5494                    _FP_ACTION_BMP_FREE(action_bmp);
   5495                    action_bmp.w = NULL;
   5496                 }
   5497                 if (soc_feature(unit, soc_feature_advanced_flex_counter)) {
   5498                     _field_adv_flex_stat_info_retrieve(unit, f_ent->statistic.sid);
   5499                 }
   5500                 policer_index = PolicyGet(unit,
   5501                                           VFP_POLICY_TABLEm,
   5502                                           vfp_policy_entry,
   5503                                           SVC_METER_INDEXf);
   5504                 offset_mode  = PolicyGet(unit,
   5505                                    VFP_POLICY_TABLEm,
   5506                                    vfp_policy_entry,
   5507                                    SVC_METER_OFFSET_MODEf);
   5508                 rv = _bcm_esw_get_policer_id_from_index_offset(unit, 
   5509                                             policer_index, offset_mode, 
   5510                                             &(f_ent->global_meter_policer.pid));
   5511                 if (BCM_FAILURE(rv)) {
   5512                    sal_free(f_ent);
   5513                    goto cleanup;
   5514                 }
   5515                 f_ent->global_meter_policer.flags = PolicyGet(unit,
   5516                                                     VFP_POLICY_TABLEm,
   5517                                                     vfp_policy_entry,
   5518                                                     SVC_METER_INDEX_PRIORITYf);
   5519             
   5520             }
   5521             /* Add to the group */
   5522             rv = _field_group_entry_add(unit, fg, f_ent);
   5523             if (BCM_FAILURE(rv)) {
   5524                 sal_free(f_ent);
   5525                 goto cleanup;
   5526             }
   5527             f_ent = NULL;
   5528         }
   5529         /* Free up the temporary slice group info */
   5530         if (fc->l2warm) {
   5531             _field_scache_slice_group_free(unit,
   5532                                            fc,
   5533                                            slice_idx
   5534                                            );
   5535         }
   5536     }
   5537 
   5538     if (fc->l2warm) {
   5539 
   5540         /* Mark end of Slice Info */
   5541         if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) {
   5542             fc->scache_pos++;
   5543         }
   5544 
   5545         /* Group Slice Selectors */
   5546         if ((fc->wb_recovered_version) >= BCM_FIELD_WB_VERSION_1_15) {
   5547             rv = (_field_group_slice_selectors_recover(unit,
   5548                         &buf[fc->scache_pos], stage_fc->stage_id));
   5549             if (BCM_FAILURE(rv)) {
   5550                 goto cleanup;
   5551             }
   5552         }
   5553 
   5554 
   5555         temp = 0;
   5556         temp |= buf[fc->scache_pos];
   5557         fc->scache_pos++;
   5558         temp |= buf[fc->scache_pos] << 8;
   5559         fc->scache_pos++;
   5560         temp |= buf[fc->scache_pos] << 16;
   5561         fc->scache_pos++;
   5562         temp |= buf[fc->scache_pos] << 24;
   5563         fc->scache_pos++;
   5564         if (temp != _FIELD_VFP_DATA_END) {
   5565             fc->l2warm = 0;
   5566             rv = BCM_E_INTERNAL;
   5567         }
   5568         if (NULL != buf1) {
   5569             temp = 0;
   5570             temp |= buf1[fc->scache_pos1];
   5571             fc->scache_pos1++;
   5572             temp |= buf1[fc->scache_pos1] << 8;
   5573             fc->scache_pos1++;
   5574             temp |= buf1[fc->scache_pos1] << 16;
   5575             fc->scache_pos1++;
   5576             temp |= buf1[fc->scache_pos1] << 24;
   5577             fc->scache_pos1++;
   5578             if (temp != _FIELD_VFP_DATA_END) {
   5579                 fc->l2warm = 0;
   5580                 rv = BCM_E_INTERNAL;
   5581             }
   5582         }
   5583  
   5584     }
   5585 
   5586     if (BCM_SUCCESS(rv)) {
   5587         _field_group_slice_vmap_recovery(unit, fc, stage_fc);
   5588     }
   5589 
   5590     _field_tr2_stage_reinit_all_groups_cleanup(unit, fc,
   5591                                                _BCM_FIELD_STAGE_LOOKUP,
   5592                                                NULL);
   5593 
   5594 cleanup:
   5595 
   5596     if (vfp_tcam_buf) {
   5597         soc_cm_sfree(unit, vfp_tcam_buf);
   5598     }
   5599     if (vfp_policy_buf) {
   5600         soc_cm_sfree(unit, vfp_policy_buf);
   5601     }
   5602     if (action_bmp.w != NULL) {
   5603         _FP_ACTION_BMP_FREE(action_bmp);
   5604         action_bmp.w = NULL;
   5605     }
   5606     return rv;
   5607 }
   5608 
   5609 /*
   5610  * Function:
   5611  *     _bcm_field_kt2_loopback_type_sel_recover
   5612  *
   5613  * Purpose:
   5614  *     Retrieve slice TunnelType/LoopbackType settings from installed
   5615  *     field entry.
   5616  *
   5617  * Parameters:
   5618  *     unit              - (IN) BCM device number
   5619  *     slice_idx         - (IN) Slice number to enable
   5620  *     fp_tcam_buf       - (IN) TCAM entry
   5621  *     stage_fc          - (IN) FP stage control info.
   5622  *     intraslice        - (IN) Slice in Intra-Slice Double Wide mode.
   5623  *     loopback_type_sel - (OUT) Tunnel/Loopback Type selector value
   5624  *
   5625  * Returns:
   5626  *     Nothing
   5627  */
   5628 int
   5629 _bcm_field_kt2_loopback_type_sel_recover(int unit,
   5630                                      int slice_idx,
   5631                                       char *fp_global_mask_tcam_buf,
   5632                                      _field_stage_t *stage_fc,
   5633                                      int intraslice,
   5634                                      int8 *loopback_type_sel)
   5635 {
   5636     fp_global_mask_tcam_entry_t *global_tcam_entry;                /* Installed TCAM entry.     */
   5637     uint32 tunnel_loopback_type = 0;            /* Hw Tunnel/Loopback value. */
   5638     fp_slice_map_entry_t fp_slice_map_buf;      /* Slice map table entry.    */
   5639     _field_slice_t       *fs;                   /* Pointer to Slice info.    */
   5640     _field_control_t     *fc;                   /* Pointer to field control  */
   5641     int slice_ent_cnt;                          /* No. of entries in slice.  */
   5642     int idx;                                    /* Slice index.              */
   5643     int vmap_size, index;                       /* Virtual Map entry size.   */
   5644     int virtual_group = -1;                     /* Virtual Group ID.         */
   5645     int phy_slice;                              /* Physical slice value.     */
   5646     int offset;                                 /* offset of loopback_type   */
   5647 
   5648     static const soc_field_t physical_slice[] = {
   5649         VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5650         VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5651         VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5652         VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5653         VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5654         VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5655         VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5656         VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5657         VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5658         VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5659         VIRTUAL_SLICE_10_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5660         VIRTUAL_SLICE_11_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5661         VIRTUAL_SLICE_12_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5662         VIRTUAL_SLICE_13_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5663         VIRTUAL_SLICE_14_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5664         VIRTUAL_SLICE_15_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   5665         VIRTUAL_SLICE_16_PHYSICAL_SLICE_NUMBER_ENTRY_0f
   5666     }, slice_group[] = {
   5667         VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5668         VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5669         VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5670         VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5671         VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5672         VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5673         VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5674         VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5675         VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5676         VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5677         VIRTUAL_SLICE_10_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5678         VIRTUAL_SLICE_11_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5679         VIRTUAL_SLICE_12_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5680         VIRTUAL_SLICE_13_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5681         VIRTUAL_SLICE_14_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5682         VIRTUAL_SLICE_15_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   5683         VIRTUAL_SLICE_16_VIRTUAL_SLICE_GROUP_ENTRY_0f
   5684     };
   5685 
   5686     BCM_IF_ERROR_RETURN(_field_control_get(unit, &fc));
   5687 
   5688     vmap_size = stage_fc->tcam_slices;
   5689     if (fc->flags & _FP_EXTERNAL_PRESENT) {
   5690         ++vmap_size;
   5691     }
   5692 
   5693     BCM_IF_ERROR_RETURN(soc_mem_read(unit,
   5694                                      FP_SLICE_MAPm,
   5695                                      MEM_BLOCK_ANY,
   5696                                      0,
   5697                                      fp_slice_map_buf.entry_data
   5698                                      )
   5699                         );
   5700 #if defined(BCM_METROLITE_SUPPORT)
   5701     if (SOC_IS_METROLITE(unit)) {
   5702         offset = 44;
   5703     } else
   5704 #endif
   5705 #if defined(BCM_SABER2_SUPPORT)
   5706     if (SOC_IS_SABER2(unit)) {
   5707         offset = 108;
   5708     } else
   5709 #endif
   5710     {
   5711         offset = 183;
   5712     }
   5713 
   5714     /* Get the virtual group id for given slice_idx. */
   5715     for (index = 0; index < vmap_size; index++) {
   5716         phy_slice = soc_mem_field32_get(unit,
   5717                             FP_SLICE_MAPm,
   5718                             fp_slice_map_buf.entry_data,
   5719                             physical_slice[index]);
   5720         if (slice_idx != phy_slice) {
   5721             continue;
   5722         }
   5723         virtual_group = soc_mem_field32_get(unit,
   5724                             FP_SLICE_MAPm,
   5725                             fp_slice_map_buf.entry_data,
   5726                             slice_group[index]);
   5727         break;
   5728     }
   5729 
   5730     /* Must be a valid virtual_group to proceed further. */
   5731     if (-1 == virtual_group) {
   5732         return (BCM_E_INTERNAL);
   5733     }
   5734 
   5735     /*
   5736      * For expanded group slices, check if any entry in
   5737      * this slice has loopback_type_sel selector set.
   5738      */
   5739     for (index = 0; index < vmap_size; index++) {
   5740         if (virtual_group
   5741             != soc_mem_field32_get(unit,
   5742                                    FP_SLICE_MAPm,
   5743                                    fp_slice_map_buf.entry_data,
   5744                                    slice_group[index])) {
   5745             continue;
   5746         }
   5747 
   5748         phy_slice = soc_mem_field32_get(unit,
   5749                             FP_SLICE_MAPm,
   5750                             fp_slice_map_buf.entry_data,
   5751                             physical_slice[index]);
   5752         fs = stage_fc->slices[_FP_DEF_INST] + phy_slice;
   5753         slice_ent_cnt = fs->entry_count;
   5754     
   5755         if (intraslice) {
   5756             slice_ent_cnt >>= 1;
   5757         }
   5758 
   5759         for (idx = 0; idx < slice_ent_cnt; idx++) {
   5760             global_tcam_entry = soc_mem_table_idx_to_pointer
   5761                             (unit,
   5762                              FP_GLOBAL_MASK_TCAMm,
   5763                              fp_global_mask_tcam_entry_t *,
   5764                              fp_global_mask_tcam_buf,
   5765                              idx + slice_ent_cnt * phy_slice
   5766                              );
   5767             if (soc_FP_GLOBAL_MASK_TCAMm_field32_get(unit, 
   5768                                                      global_tcam_entry, 
   5769                                                      VALIDf) != 0) {
   5770                 /* Extract Tunnel Info from global_tcam_entry  */
   5771                 _field_extract((uint32 *)global_tcam_entry,
   5772                                offset,
   5773                                4,
   5774                                &tunnel_loopback_type
   5775                                );
   5776                 switch (tunnel_loopback_type) {
   5777                     case 0x1: /* IP_TUNNEL       */
   5778                     case 0x2: /* MPLS_TUNNEL     */
   5779                     case 0x3: /* MIM_TUNNEL      */
   5780                     case 0x4: /* WLAN_WTP TUNNEL */
   5781                     case 0x5: /* WLAN_AC TUNNEL  */
   5782                     case 0x6: /* AMT_TUNNEL      */
   5783                     case 0x7: /* TRILL_TUNNEL    */
   5784                         *loopback_type_sel = 1;
   5785                         break;
   5786                     case 0x8: /* NONE                                    */
   5787                     case 0x9: /* EGRESS MIRROR LOOPBACK                  */
   5788                     case 0xa: /* EP REDIRECTION LOOPBACK                 */
   5789                     case 0xb: /* MiM LOOPBACK                            */
   5790                     case 0xc: /* WLAN LOOPBACK || Trill Network Loopback */
   5791                     case 0xd: /* Trill Access Loopback                   */
   5792                         *loopback_type_sel = 0;
   5793                         break;
   5794                     default:
   5795                         ;
   5796                 }
   5797                 
   5798                 if (*loopback_type_sel != _FP_SELCODE_DONT_CARE) {
   5799                     goto done;
   5800                 }
   5801             }
   5802         }
   5803     }
   5804 
   5805 done:
   5806     return (BCM_E_NONE);
   5807 }
   5808 
   5809 #endif /* BCM_WARM_BOOT_SUPPORT */
   5810 #else /* BCM_KATANA2_SUPPORT && BCM_FIELD_SUPPORT */
   5811 int _kt2_field_not_empty;
   5812 #endif  /* BCM_KATANA2_SUPPORT && BCM_FIELD_SUPPORT */