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


      1 /*
      2  * 
      3  *
      4  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5  * 
      6  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      7  */
      8 
      9 #include <soc/defs.h>
     10 #if defined(BCM_HURRICANE2_SUPPORT) && defined(BCM_FIELD_SUPPORT)
     11 
     12 #include <soc/mem.h>
     13 #include <soc/drv.h>
     14 
     15 #include <bcm/error.h>
     16 #include <bcm/l3.h>
     17 #include <bcm/field.h>
     18 #include <bcm/tunnel.h>
     19 
     20 #include <bcm_int/esw_dispatch.h>
     21 
     22 #include <bcm_int/esw/field.h>
     23 #include <bcm_int/esw/l3.h>
     24 #include <bcm_int/esw/firebolt.h>
     25 #include <bcm_int/esw/trx.h>
     26 #include <bcm_int/esw/enduro.h>
     27 #include <bcm_int/esw/triumph.h>
     28 #include <bcm_int/esw/triumph2.h>
     29 #include <bcm_int/esw/hurricane2.h>
     30 
     31 
     32 static soc_field_t _vfp_hu2_slice_pairing_field[2] = {
     33     SLICE1_0_PAIRINGf,   SLICE3_2_PAIRINGf};
     34 
     35 const soc_field_t _bcm_field_hu2_vfp_field_sel[][2] = {
     36     { SLICE_0_F2f, SLICE_0_F3f },
     37     { SLICE_1_F2f, SLICE_1_F3f },
     38     { SLICE_2_F2f, SLICE_2_F3f },
     39     { SLICE_3_F2f, SLICE_3_F3f }
     40 };
     41 
     42 
     43 const soc_field_t _bcm_field_hu2_slice_pairing_field[] = {
     44     SLICE1_0_PAIRINGf,
     45     SLICE3_2_PAIRINGf,
     46 };
     47 
     48 
     49 #define VFP_SLICE_COUNT    4
     50 /* local/static function prototypes */
     51 STATIC void _field_hu2_functions_init(_field_funct_t *functions) ;
     52 
     53 /*
     54  * Function:
     55  *     _field_hu2_ingress_qualifiers_init
     56  * Purpose:
     57  *     Initialize device stage ingress qaualifiers 
     58  *     select codes & offsets
     59  * Parameters:
     60  *     unit       - (IN) BCM device number.
     61  *     stage_fc   - (IN) Field Processor stage control structure. 
     62  *
     63  * Returns:
     64  *     BCM_E_NONE
     65  */
     66 STATIC int
     67 _field_hu2_ingress_qualifiers_init(int unit, _field_stage_t *stage_fc)
     68 {
     69     _FP_QUAL_DECL;
     70 
     71     /* Input parameters check. */
     72     if (NULL == stage_fc) {
     73         return (BCM_E_PARAM);
     74     }
     75 
     76     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStage,
     77                  _bcmFieldSliceSelDisable, 0, 0, 0);
     78     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageIngress,
     79                  _bcmFieldSliceSelDisable, 0, 0, 0);
     80     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
     81                  _bcmFieldSliceSelDisable, 0, 0, 0);
     82     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
     83                  _bcmFieldSliceSelDisable, 0, 0, 0);
     84     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
     85                  _bcmFieldSliceSelDisable, 0, 0, 0);
     86     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPorts,
     87                  _bcmFieldSliceSelDisable, 0, 0, 0);
     88 
     89     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
     90                  _bcmFieldSliceSelDisable, 0, 7, 1);
     91     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
     92                  _bcmFieldSliceSelDisable, 0, 8, 3);
     93     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifySvpValid,
     94                  _bcmFieldSliceSelDisable, 0, 11, 1);
     95     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
     96                  _bcmFieldSliceSelDisable, 0, 12, 4);
     97     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
     98                  _bcmFieldSliceSelDisable, 0, 16, 1);
     99     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
    100                  _bcmFieldSliceSelDisable, 0, 17, 1);
    101     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopback,
    102                                _bcmFieldSliceSelDisable, 0,
    103                                _bcmFieldSliceLoopbackTypeSelect, 0, 21, 1);
    104     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopbackType,
    105                                _bcmFieldSliceSelDisable, 0,
    106                                _bcmFieldSliceLoopbackTypeSelect, 0, 18, 4);
    107     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTunnelType,
    108                                _bcmFieldSliceSelDisable, 0,
    109                                _bcmFieldSliceLoopbackTypeSelect, 1, 18, 4);
    110     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
    111                  _bcmFieldSliceSelDisable, 0, 22, 1);
    112     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
    113                  _bcmFieldSliceSelDisable, 0, 23, 1);
    114 
    115     /* FPF3 primary slice single wide. */
    116     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    117                                _bcmFieldSliceSelFpf3, 0,
    118                                _bcmFieldSliceDstClassSelect, 0, 24, 6);
    119     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    120                                _bcmFieldSliceSelFpf3, 0,
    121                                _bcmFieldSliceDstClassSelect, 1, 24, 6);
    122     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    123                                _bcmFieldSliceSelFpf3, 0,
    124                                _bcmFieldSliceDstClassSelect, 2, 24, 6);
    125     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    126                                _bcmFieldSliceSelFpf3, 0,
    127                                _bcmFieldSliceSrcClassSelect, 2, 30, 6);
    128     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    129                                _bcmFieldSliceSelFpf3, 0,
    130                                _bcmFieldSliceSrcClassSelect, 0, 30, 6);
    131     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    132                                _bcmFieldSliceSelFpf3, 0,
    133                                _bcmFieldSliceSrcClassSelect, 1, 30, 6);
    134     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    135                                _bcmFieldSliceSelFpf3, 0,
    136                                _bcmFieldSliceSrcClassSelect, 3, 30, 6);
    137     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    138                                _bcmFieldSliceSelFpf3, 0,
    139                                _bcmFieldSliceDstClassSelect, 3, 24, 6);
    140     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    141                                _bcmFieldSliceSelFpf3, 0,
    142                                _bcmFieldSliceFwdFieldSelect, 
    143                                _bcmFieldFwdFieldVrf, 36, 12);
    144     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    145                                _bcmFieldSliceSelFpf3, 0,
    146                                _bcmFieldSliceFwdFieldSelect,
    147                                _bcmFieldFwdFieldVpn, 36, 12);
    148     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
    149                                bcmFieldQualifyForwardingVlanId,
    150                                _bcmFieldSliceSelFpf3, 0,
    151                                _bcmFieldSliceFwdFieldSelect, 
    152                                _bcmFieldFwdFieldVlan, 36, 12);
    153     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    154                                _bcmFieldSliceSelFpf3, 0,
    155                                _bcmFieldSliceIngressEntitySelect,
    156                                _bcmFieldFwdEntityMplsGport, 48, 13);
    157     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    158                                _bcmFieldSliceSelFpf3, 0,
    159                                _bcmFieldSliceIngressEntitySelect,
    160                                _bcmFieldFwdEntityVlanGport, 48, 13);
    161     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    162                                _bcmFieldSliceSelFpf3, 0,
    163                                _bcmFieldSliceIngressEntitySelect,
    164                                _bcmFieldFwdEntityMimGport, 48, 13);
    165     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress,
    166                                _bcmFieldSliceSelFpf3, 0,
    167                                _bcmFieldSliceIngressEntitySelect,
    168                                _bcmFieldFwdEntityL3Egress, 48, 13);
    169 
    170     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    171                                _bcmFieldSliceSelFpf3, 1,
    172                                _bcmFieldSliceDstClassSelect, 0, 24, 6);
    173     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    174                                _bcmFieldSliceSelFpf3, 1,
    175                                _bcmFieldSliceDstClassSelect, 1, 24, 6);
    176     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    177                                _bcmFieldSliceSelFpf3, 1,
    178                                _bcmFieldSliceDstClassSelect, 2, 24, 6);
    179     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    180                                _bcmFieldSliceSelFpf3, 1,
    181                                _bcmFieldSliceSrcClassSelect, 2, 30, 6);
    182     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    183                                _bcmFieldSliceSelFpf3, 1,
    184                                _bcmFieldSliceSrcClassSelect, 0, 30, 6);
    185     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    186                                _bcmFieldSliceSelFpf3, 1,
    187                                _bcmFieldSliceSrcClassSelect, 1, 30, 6);
    188     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    189                                _bcmFieldSliceSelFpf3, 1,
    190                                _bcmFieldSliceSrcClassSelect, 3, 30, 6);
    191     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    192                                _bcmFieldSliceSelFpf3, 1,
    193                                _bcmFieldSliceDstClassSelect, 3, 24, 6);
    194     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    195                                _bcmFieldSliceSelFpf3, 1,
    196                                _bcmFieldSliceFwdFieldSelect, 
    197                                _bcmFieldFwdFieldVrf, 36, 12);
    198     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    199                                _bcmFieldSliceSelFpf3, 1,
    200                                _bcmFieldSliceFwdFieldSelect, 
    201                                _bcmFieldFwdFieldVpn, 36, 12);
    202     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
    203                                bcmFieldQualifyForwardingVlanId,
    204                                _bcmFieldSliceSelFpf3, 1,
    205                                _bcmFieldSliceFwdFieldSelect, 
    206                                _bcmFieldFwdFieldVlan, 36, 12);
    207     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    208                  _bcmFieldSliceSelFpf3, 1, 48, 12);
    209 
    210 
    211     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    212                                _bcmFieldSliceSelFpf3, 2,
    213                                _bcmFieldSliceDstFwdEntitySelect,
    214                                _bcmFieldFwdEntityGlp, 24, 17);
    215     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    216                                _bcmFieldSliceSelFpf3, 2,
    217                                _bcmFieldSliceDstFwdEntitySelect,
    218                                _bcmFieldFwdEntityGlp, 24, 17);
    219     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    220                                _bcmFieldSliceSelFpf3, 2,
    221                                _bcmFieldSliceDstFwdEntitySelect,
    222                                _bcmFieldFwdEntityMplsGport, 24, 17);
    223     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    224                                _bcmFieldSliceSelFpf3, 2,
    225                                _bcmFieldSliceDstFwdEntitySelect,
    226                                _bcmFieldFwdEntityVlanGport, 24, 17);
    227     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    228                                _bcmFieldSliceSelFpf3, 2,
    229                                _bcmFieldSliceDstFwdEntitySelect,
    230                                _bcmFieldFwdEntityMimGport, 24, 17);
    231     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
    232                                _bcmFieldSliceSelFpf3, 2,
    233                                _bcmFieldSliceDstFwdEntitySelect,
    234                                _bcmFieldFwdEntityL3Egress, 24, 17);
    235     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
    236                                _bcmFieldSliceSelFpf3, 2,
    237                                _bcmFieldSliceDstFwdEntitySelect,
    238                                _bcmFieldFwdEntityL3Egress, 24, 17);
    239     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    240                                _bcmFieldSliceSelFpf3, 2,
    241                                _bcmFieldSliceDstFwdEntitySelect,
    242                                _bcmFieldFwdEntityMulticastGroup, 24, 17);
    243     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    244                                _bcmFieldSliceSelFpf3, 2,
    245                                _bcmFieldSliceSrcEntitySelect,
    246                                _bcmFieldFwdEntityGlp, 41, 15);
    247     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    248                                _bcmFieldSliceSelFpf3, 2,
    249                                _bcmFieldSliceSrcEntitySelect,
    250                                _bcmFieldFwdEntityGlp, 41, 15);
    251     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    252                                _bcmFieldSliceSelFpf3, 2,
    253                                _bcmFieldSliceSrcEntitySelect,
    254                                _bcmFieldFwdEntityMplsGport, 41, 15);
    255     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    256                                _bcmFieldSliceSelFpf3, 2,
    257                                _bcmFieldSliceSrcEntitySelect,
    258                                _bcmFieldFwdEntityVlanGport, 41, 15);
    259     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    260                                _bcmFieldSliceSelFpf3, 2,
    261                                _bcmFieldSliceSrcEntitySelect,
    262                                _bcmFieldFwdEntityMimGport, 41, 15);
    263     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    264                                _bcmFieldSliceSelFpf3, 2,
    265                                _bcmFieldSliceSrcEntitySelect,
    266                                _bcmFieldFwdEntityModPortGport, 41, 15);
    267     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    268                                _bcmFieldSliceSelFpf3, 2,
    269                                _bcmFieldSliceSrcEntitySelect,
    270                                _bcmFieldFwdEntityModPortGport, 47, 8);
    271     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
    272                                _bcmFieldSliceSelFpf3, 2,
    273                                _bcmFieldSliceSrcEntitySelect,
    274                                _bcmFieldFwdEntityModPortGport, 47, 8);
    275     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    276                  _bcmFieldSliceSelFpf3, 2, 56, 3);
    277 
    278     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    279                  _bcmFieldSliceSelFpf3, 3, 24, 16);
    280     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    281                  _bcmFieldSliceSelFpf3, 3, 24, 12);
    282     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    283                  _bcmFieldSliceSelFpf3, 3, 36, 1);
    284     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    285                  _bcmFieldSliceSelFpf3, 3, 37, 3);
    286     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    287                  _bcmFieldSliceSelFpf3, 3, 40, 2);
    288     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    289                  _bcmFieldSliceSelFpf3, 3, 42, 2);
    290     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    291                  _bcmFieldSliceSelFpf3, 3, 44, 2);
    292     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    293                  _bcmFieldSliceSelFpf3, 3, 46, 3);
    294     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
    295                  _bcmFieldSliceSelFpf3, 3, 49, 5);
    296     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
    297                  _bcmFieldSliceSelFpf3, 3, 54, 3);
    298 
    299     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    300                  _bcmFieldSliceSelFpf3, 4, 24, 16);
    301     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    302                  _bcmFieldSliceSelFpf3, 4, 24, 12);
    303     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    304                  _bcmFieldSliceSelFpf3, 4, 36, 1);
    305     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    306                  _bcmFieldSliceSelFpf3, 4, 37, 3);
    307     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    308                  _bcmFieldSliceSelFpf3, 4, 40, 16);
    309     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    310                  _bcmFieldSliceSelFpf3, 4, 40, 12);
    311     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    312                  _bcmFieldSliceSelFpf3, 4, 52, 1);
    313     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    314                  _bcmFieldSliceSelFpf3, 4, 53, 3);
    315 
    316     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    317                  _bcmFieldSliceSelFpf3, 5, 24, 16);
    318     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    319                  _bcmFieldSliceSelFpf3, 5, 24, 12);
    320     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    321                  _bcmFieldSliceSelFpf3, 5, 36, 1);
    322     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    323                  _bcmFieldSliceSelFpf3, 5, 37, 3);
    324     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    325                  _bcmFieldSliceSelFpf3, 5, 40, 16);
    326 
    327     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
    328                  _bcmFieldSliceSelFpf3, 6, 24, 1);
    329     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
    330                  _bcmFieldSliceSelFpf3, 6, 25, 1);
    331     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
    332                  _bcmFieldSliceSelFpf3, 6, 26, 1);
    333     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
    334                  _bcmFieldSliceSelFpf3, 6, 27, 2);
    335     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
    336                  _bcmFieldSliceSelFpf3, 6, 29, 1);
    337     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
    338                  _bcmFieldSliceSelFpf3, 6, 30, 1);
    339     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
    340                  _bcmFieldSliceSelFpf3, 6, 31, 1);
    341     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
    342                  _bcmFieldSliceSelFpf3, 6, 33, 1);
    343     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
    344                  _bcmFieldSliceSelFpf3, 6, 34, 1);
    345     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
    346                  _bcmFieldSliceSelFpf3, 6, 35, 1);
    347     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
    348                  _bcmFieldSliceSelFpf3, 6, 36, 1);
    349     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
    350                  _bcmFieldSliceSelFpf3, 6, 37, 1);
    351     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
    352                  _bcmFieldSliceSelFpf3, 6, 38, 1);
    353     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
    354                  _bcmFieldSliceSelFpf3, 6, 39, 1);
    355     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    356                  _bcmFieldSliceSelFpf3, 6, 40, 16);
    357     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    358                  _bcmFieldSliceSelFpf3, 6, 40, 12);
    359     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    360                  _bcmFieldSliceSelFpf3, 6, 52, 1);
    361     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    362                  _bcmFieldSliceSelFpf3, 6, 53, 3);
    363     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck,
    364                  _bcmFieldSliceSelFpf3, 7, 24, 24);
    365     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31,
    366                                _bcmFieldSliceSelFpf3, 7,
    367                                _bcmFieldSliceIntfClassSelect, 3, 48, 8);
    368     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
    369                                _bcmFieldSliceSelFpf3, 7,
    370                                _bcmFieldSliceIntfClassSelect, 0, 48, 8);
    371     /* bcmFieldQualifyInterfaceClassL3 is not supported */
    372     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
    373                                _bcmFieldSliceSelFpf3, 7,
    374                                _bcmFieldSliceIntfClassSelect, 2, 48, 8);
    375     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel,
    376                  _bcmFieldSliceSelFpf3, 8, 24, 20);
    377     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    378                  _bcmFieldSliceSelFpf3, 8, 44, 2);
    379     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    380                  _bcmFieldSliceSelFpf3, 8, 46, 2);
    381     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    382                  _bcmFieldSliceSelFpf3, 8, 48, 2);
    383     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
    384                  _bcmFieldSliceSelFpf3, 8, 50, 2);
    385     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
    386                  _bcmFieldSliceSelFpf3, 8, 52, 2);
    387     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData3,
    388                  _bcmFieldSliceSelFpf3, 9, 24, 32);
    389 
    390     /* FPF2 */
    391     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    392                  _bcmFieldSliceSelFpf2, 0,
    393                  _bcmFieldSliceTtlClassSelect, 0,
    394                  61, 8);
    395     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    396                  _bcmFieldSliceSelFpf2, 0,
    397                  _bcmFieldSliceTtlClassSelect, 0,
    398                  61, 8);
    399     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    400                  _bcmFieldSliceSelFpf2, 0,
    401                  _bcmFieldSliceTtlClassSelect, 1,
    402                  61, 8);
    403     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    404                  _bcmFieldSliceSelFpf2, 0,
    405                  _bcmFieldSliceTcpClassSelect, 0,
    406                  69, 6);
    407     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    408                  _bcmFieldSliceSelFpf2, 0,
    409                  _bcmFieldSliceTcpClassSelect, 0,
    410                  69, 6);
    411     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    412                  _bcmFieldSliceSelFpf2, 0,
    413                  _bcmFieldSliceTcpClassSelect, 1,
    414                  69, 6);
    415     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFlags,
    416                  _bcmFieldSliceSelFpf2, 0, 75, 2);
    417     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    418                  _bcmFieldSliceSelFpf2, 0,
    419                  _bcmFieldSliceTosClassSelect, 0,
    420                  77, 8);
    421     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    422                  _bcmFieldSliceSelFpf2, 0,
    423                  _bcmFieldSliceTosClassSelect, 0,
    424                  77, 8);
    425     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    426                  _bcmFieldSliceSelFpf2, 0,
    427                  _bcmFieldSliceTosClassSelect, 1,
    428                  77, 8);
    429     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
    430                  _bcmFieldSliceSelFpf2, 0, 85, 16);
    431     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
    432                  _bcmFieldSliceSelFpf2, 0, 101, 16);
    433     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    434                  _bcmFieldSliceSelFpf2, 0, 117, 8);
    435     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    436                  _bcmFieldSliceSelFpf2, 0, 125, 32);
    437     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    438                  _bcmFieldSliceSelFpf2, 0, 157, 32);
    439 
    440     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    441                  _bcmFieldSliceSelFpf2, 1,
    442                  _bcmFieldSliceTtlClassSelect, 0,
    443                  61, 8);
    444     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    445                  _bcmFieldSliceSelFpf2, 1,
    446                  _bcmFieldSliceTtlClassSelect, 0,
    447                  61, 8);
    448     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    449                  _bcmFieldSliceSelFpf2, 1,
    450                  _bcmFieldSliceTtlClassSelect, 1,
    451                  61, 8);
    452     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    453                  _bcmFieldSliceSelFpf2, 1,
    454                  _bcmFieldSliceTcpClassSelect, 0,
    455                  69, 6);
    456     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    457                  _bcmFieldSliceSelFpf2, 1,
    458                  _bcmFieldSliceTcpClassSelect, 0,
    459                  69, 6);
    460     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    461                  _bcmFieldSliceSelFpf2, 1,
    462                  _bcmFieldSliceTcpClassSelect, 1,
    463                  69, 6);
    464     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
    465                  _bcmFieldSliceSelFpf2, 1, 75, 2);
    466     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    467                  _bcmFieldSliceSelFpf2, 1,
    468                  _bcmFieldSliceTosClassSelect, 0,
    469                  77, 8);
    470     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    471                  _bcmFieldSliceSelFpf2, 1,
    472                  _bcmFieldSliceTosClassSelect, 0,
    473                  77, 8);
    474     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    475                  _bcmFieldSliceSelFpf2, 1,
    476                  _bcmFieldSliceTosClassSelect, 1,
    477                  77, 8);
    478     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
    479                  _bcmFieldSliceSelFpf2, 1, 85, 16);
    480     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
    481                  _bcmFieldSliceSelFpf2, 1, 101, 16);
    482     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    483                  _bcmFieldSliceSelFpf2, 1, 117, 8);
    484     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    485                  _bcmFieldSliceSelFpf2, 1, 125, 32);
    486     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    487                  _bcmFieldSliceSelFpf2, 1, 157, 32);
    488 
    489     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
    490                  _bcmFieldSliceSelFpf2, 2, 61, 128);
    491 
    492     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
    493                  _bcmFieldSliceSelFpf2, 3, 61, 128);
    494 
    495     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    496                  _bcmFieldSliceSelFpf2, 4,
    497                  _bcmFieldSliceTtlClassSelect, 0,
    498                  61, 8);
    499     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    500                  _bcmFieldSliceSelFpf2, 4,
    501                  _bcmFieldSliceTtlClassSelect, 0,
    502                  61, 8);
    503     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    504                  _bcmFieldSliceSelFpf2, 4,
    505                  _bcmFieldSliceTtlClassSelect, 1,
    506                  61, 8);
    507     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    508                  _bcmFieldSliceSelFpf2, 4,
    509                  _bcmFieldSliceTcpClassSelect, 0,
    510                  69, 6);
    511     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    512                  _bcmFieldSliceSelFpf2, 4,
    513                  _bcmFieldSliceTcpClassSelect, 0,
    514                  69, 6);
    515     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    516                  _bcmFieldSliceSelFpf2, 4,
    517                  _bcmFieldSliceTcpClassSelect, 1,
    518                  69, 6);
    519     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel,
    520                  _bcmFieldSliceSelFpf2, 4, 75, 20);
    521     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    522                  _bcmFieldSliceSelFpf2, 4,
    523                  _bcmFieldSliceTosClassSelect, 0,
    524                  95, 8);
    525     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    526                  _bcmFieldSliceSelFpf2, 4,
    527                  _bcmFieldSliceTosClassSelect, 0,
    528                  95, 8);
    529     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    530                  _bcmFieldSliceSelFpf2, 4,
    531                  _bcmFieldSliceTosClassSelect, 1,
    532                  95, 8);
    533     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    534                  _bcmFieldSliceSelFpf2, 4, 103, 8);
    535     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
    536                  _bcmFieldSliceSelFpf2, 4, 125, 64);
    537 
    538     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    539                  _bcmFieldSliceSelFpf2, 5, 61, 16);
    540     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    541                  _bcmFieldSliceSelFpf2, 5, 61, 12);
    542     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    543                  _bcmFieldSliceSelFpf2, 5, 73, 1);
    544     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    545                  _bcmFieldSliceSelFpf2, 5, 74, 3);
    546     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    547                  _bcmFieldSliceSelFpf2, 5, 77, 16);
    548     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    549                  _bcmFieldSliceSelFpf2, 5, 93, 48);
    550     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    551                  _bcmFieldSliceSelFpf2, 5, 141, 48);
    552 
    553     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    554                  _bcmFieldSliceSelFpf2, 6, 61, 16);
    555     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    556                  _bcmFieldSliceSelFpf2, 6, 61, 12);
    557     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    558                  _bcmFieldSliceSelFpf2, 6, 73, 1);
    559     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    560                  _bcmFieldSliceSelFpf2, 6, 74, 3);
    561     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    562                  _bcmFieldSliceSelFpf2, 6, 77, 16);
    563     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    564                  _bcmFieldSliceSelFpf2, 6, 93, 48);
    565     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    566                  _bcmFieldSliceSelFpf2, 6, 141, 32);
    567 
    568     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    569                  _bcmFieldSliceSelFpf2, 7, 61, 16);
    570     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    571                  _bcmFieldSliceSelFpf2, 7, 61, 12);
    572     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    573                  _bcmFieldSliceSelFpf2, 7, 73, 1);
    574     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    575                  _bcmFieldSliceSelFpf2, 7, 74, 3);
    576     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    577                  _bcmFieldSliceSelFpf2, 7, 77, 16);
    578     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    579                  _bcmFieldSliceSelFpf2, 7,
    580                  _bcmFieldSliceTtlClassSelect, 0,
    581                  93, 8);
    582     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    583                  _bcmFieldSliceSelFpf2, 7,
    584                  _bcmFieldSliceTtlClassSelect, 0,
    585                  93, 8);
    586     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    587                  _bcmFieldSliceSelFpf2, 7,
    588                  _bcmFieldSliceTtlClassSelect, 1,
    589                  93, 8);
    590     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    591                  _bcmFieldSliceSelFpf2, 7, 101, 8);
    592     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    593                  _bcmFieldSliceSelFpf2, 7, 109, 32);
    594     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    595                  _bcmFieldSliceSelFpf2, 7, 141, 48);
    596 
    597     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0,
    598                  _bcmFieldSliceSelFpf2, 8, 61, 128);
    599 
    600     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1,
    601                  _bcmFieldSliceSelFpf2, 9, 61, 128);
    602 
    603     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
    604                  _bcmFieldSliceSelFpf2, 10, 61, 64);
    605     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
    606                  _bcmFieldSliceSelFpf2, 10, 125, 64);
    607 
    608 
    609     /* FPF1 */ 
    610     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    611                                _bcmFieldSliceSelFpf1, 0,
    612                                _bcmFieldSliceDstClassSelect, 0, 189, 6);
    613     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    614                                _bcmFieldSliceSelFpf1, 0,
    615                                _bcmFieldSliceDstClassSelect, 1, 189, 6);
    616     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    617                                _bcmFieldSliceSelFpf1, 0,
    618                                _bcmFieldSliceDstClassSelect, 2, 189, 6);
    619     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    620                                _bcmFieldSliceSelFpf1, 0,
    621                                _bcmFieldSliceSrcClassSelect, 2, 195, 6);
    622     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    623                                _bcmFieldSliceSelFpf1, 0,
    624                                _bcmFieldSliceSrcClassSelect, 0, 195, 6);
    625     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    626                                _bcmFieldSliceSelFpf1, 0,
    627                                _bcmFieldSliceSrcClassSelect, 1, 195, 6);
    628     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    629                                _bcmFieldSliceSelFpf1, 0,
    630                                _bcmFieldSliceSrcClassSelect, 3, 195, 6);
    631     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    632                                _bcmFieldSliceSelFpf1, 0,
    633                                _bcmFieldSliceDstClassSelect, 3, 189, 6);
    634     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    635                                _bcmFieldSliceSelFpf1, 0,
    636                                _bcmFieldSliceFwdFieldSelect, 
    637                                _bcmFieldFwdFieldVrf, 201, 12);
    638     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    639                                _bcmFieldSliceSelFpf1, 0,
    640                                _bcmFieldSliceFwdFieldSelect, 
    641                                _bcmFieldFwdFieldVpn, 201, 12);
    642     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
    643                                bcmFieldQualifyForwardingVlanId,
    644                                _bcmFieldSliceSelFpf1, 0,
    645                                _bcmFieldSliceFwdFieldSelect, 
    646                                _bcmFieldFwdFieldVlan, 201, 12);
    647     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    648                                _bcmFieldSliceSelFpf1, 0,
    649                                _bcmFieldSliceIngressEntitySelect,
    650                                _bcmFieldFwdEntityMplsGport, 213, 13);
    651     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    652                                _bcmFieldSliceSelFpf1, 0,
    653                                _bcmFieldSliceIngressEntitySelect,
    654                                _bcmFieldFwdEntityVlanGport, 213, 13);
    655     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    656                                _bcmFieldSliceSelFpf1, 0,
    657                                _bcmFieldSliceIngressEntitySelect,
    658                                _bcmFieldFwdEntityMimGport, 213, 13);
    659     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress,
    660                                _bcmFieldSliceSelFpf1, 0,
    661                                _bcmFieldSliceIngressEntitySelect,
    662                                _bcmFieldFwdEntityL3Egress, 213, 13);
    663 
    664     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    665                                _bcmFieldSliceSelFpf1, 1,
    666                                _bcmFieldSliceDstFwdEntitySelect,
    667                                _bcmFieldFwdEntityGlp, 189, 17);
    668     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    669                                _bcmFieldSliceSelFpf1, 1,
    670                                _bcmFieldSliceDstFwdEntitySelect,
    671                                _bcmFieldFwdEntityGlp, 189, 17);
    672     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    673                                _bcmFieldSliceSelFpf1, 1,
    674                                _bcmFieldSliceDstFwdEntitySelect,
    675                                _bcmFieldFwdEntityMplsGport, 189, 17);
    676     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    677                                _bcmFieldSliceSelFpf1, 1,
    678                                _bcmFieldSliceDstFwdEntitySelect,
    679                                _bcmFieldFwdEntityVlanGport, 189, 17);
    680     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    681                                _bcmFieldSliceSelFpf1, 1,
    682                                _bcmFieldSliceDstFwdEntitySelect,
    683                                _bcmFieldFwdEntityMimGport, 189, 17);
    684     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
    685                                _bcmFieldSliceSelFpf1, 1,
    686                                _bcmFieldSliceDstFwdEntitySelect,
    687                                _bcmFieldFwdEntityL3Egress, 189, 17);
    688     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
    689                                _bcmFieldSliceSelFpf1, 1,
    690                                _bcmFieldSliceDstFwdEntitySelect,
    691                                _bcmFieldFwdEntityL3Egress, 189, 17);
    692     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    693                                _bcmFieldSliceSelFpf1, 1,
    694                                _bcmFieldSliceDstFwdEntitySelect,
    695                                _bcmFieldFwdEntityMulticastGroup, 189, 17);
    696     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    697                                _bcmFieldSliceSelFpf1, 1,
    698                                _bcmFieldSliceSrcEntitySelect,
    699                                _bcmFieldFwdEntityGlp, 206, 15);
    700     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    701                                _bcmFieldSliceSelFpf1, 1,
    702                                _bcmFieldSliceSrcEntitySelect,
    703                                _bcmFieldFwdEntityGlp, 206, 15);
    704     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    705                                _bcmFieldSliceSelFpf1, 1,
    706                                _bcmFieldSliceSrcEntitySelect,
    707                                _bcmFieldFwdEntityMplsGport, 206, 15);
    708     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    709                                _bcmFieldSliceSelFpf1, 1,
    710                                _bcmFieldSliceSrcEntitySelect,
    711                                _bcmFieldFwdEntityVlanGport, 206, 15);
    712     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    713                                _bcmFieldSliceSelFpf1, 1,
    714                                _bcmFieldSliceSrcEntitySelect,
    715                                _bcmFieldFwdEntityMimGport, 206, 15);
    716     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    717                                _bcmFieldSliceSelFpf1, 1,
    718                                _bcmFieldSliceSrcEntitySelect,
    719                                _bcmFieldFwdEntityModPortGport, 206, 15);
    720     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    721                                _bcmFieldSliceSelFpf1, 1,
    722                                _bcmFieldSliceSrcEntitySelect,
    723                                _bcmFieldFwdEntityModPortGport, 212, 8);
    724     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
    725                                _bcmFieldSliceSelFpf1, 1,
    726                                _bcmFieldSliceSrcEntitySelect,
    727                                _bcmFieldFwdEntityModPortGport, 212, 8);
    728     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    729                  _bcmFieldSliceSelFpf1, 1, 221, 3);
    730 
    731 
    732     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    733                                _bcmFieldSliceSelFpf1, 2,
    734                                _bcmFieldSliceDstFwdEntitySelect,
    735                                _bcmFieldFwdEntityGlp, 189, 17);
    736     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    737                                _bcmFieldSliceSelFpf1, 2,
    738                                _bcmFieldSliceDstFwdEntitySelect,
    739                                _bcmFieldFwdEntityGlp, 189, 17);
    740     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    741                                _bcmFieldSliceSelFpf1, 2,
    742                                _bcmFieldSliceDstFwdEntitySelect,
    743                                _bcmFieldFwdEntityMplsGport, 189, 17);
    744     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    745                                _bcmFieldSliceSelFpf1, 2,
    746                                _bcmFieldSliceDstFwdEntitySelect,
    747                                _bcmFieldFwdEntityVlanGport, 189, 17);
    748     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    749                                _bcmFieldSliceSelFpf1, 2,
    750                                _bcmFieldSliceDstFwdEntitySelect,
    751                                _bcmFieldFwdEntityMimGport, 189, 17);
    752     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
    753                                _bcmFieldSliceSelFpf1, 2,
    754                                _bcmFieldSliceDstFwdEntitySelect,
    755                                _bcmFieldFwdEntityL3Egress, 189, 17);
    756     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
    757                                _bcmFieldSliceSelFpf1, 2,
    758                                _bcmFieldSliceDstFwdEntitySelect,
    759                                _bcmFieldFwdEntityL3Egress, 189, 17);
    760     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    761                                _bcmFieldSliceSelFpf1, 2,
    762                                _bcmFieldSliceDstFwdEntitySelect,
    763                                _bcmFieldFwdEntityMulticastGroup, 189, 17);
    764     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    765                  _bcmFieldSliceSelFpf1, 2, 206, 3);
    766     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    767                                _bcmFieldSliceSelFpf1, 2,
    768                                _bcmFieldSliceDstClassSelect, 0, 209, 6);
    769     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    770                                _bcmFieldSliceSelFpf1, 2,
    771                                _bcmFieldSliceDstClassSelect, 1, 209, 6);
    772     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    773                                _bcmFieldSliceSelFpf1, 2,
    774                                _bcmFieldSliceDstClassSelect, 2, 209, 6);
    775     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    776                                _bcmFieldSliceSelFpf1, 2,
    777                                _bcmFieldSliceSrcClassSelect, 2, 215, 6);
    778     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    779                                _bcmFieldSliceSelFpf1, 2,
    780                                _bcmFieldSliceSrcClassSelect, 0, 215, 6);
    781     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    782                                _bcmFieldSliceSelFpf1, 2,
    783                                _bcmFieldSliceSrcClassSelect, 1, 215, 6);
    784     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    785                                _bcmFieldSliceSelFpf1, 2,
    786                                _bcmFieldSliceSrcClassSelect, 3, 215, 6);
    787     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    788                                _bcmFieldSliceSelFpf1, 2,
    789                                _bcmFieldSliceDstClassSelect, 3, 209, 6);
    790 
    791     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    792                  _bcmFieldSliceSelFpf1, 3, 189, 16);
    793     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    794                  _bcmFieldSliceSelFpf1, 3, 189, 12);
    795     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    796                  _bcmFieldSliceSelFpf1, 3, 201, 1);
    797     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    798                  _bcmFieldSliceSelFpf1, 3, 202, 3);
    799     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    800                  _bcmFieldSliceSelFpf1, 3, 205, 16);
    801     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    802                  _bcmFieldSliceSelFpf1, 3, 205, 12);
    803     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    804                  _bcmFieldSliceSelFpf1, 3, 217, 1);
    805     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    806                  _bcmFieldSliceSelFpf1, 3, 218, 3);
    807     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
    808                  _bcmFieldSliceSelFpf1, 3, 221, 2);
    809 
    810     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    811                  _bcmFieldSliceSelFpf1, 4, 189, 16);
    812     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    813                  _bcmFieldSliceSelFpf1, 4, 189, 12);
    814     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    815                  _bcmFieldSliceSelFpf1, 4, 201, 1);
    816     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    817                  _bcmFieldSliceSelFpf1, 4, 202, 3);
    818     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    819                  _bcmFieldSliceSelFpf1, 4, 205, 16);
    820 
    821     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
    822                  _bcmFieldSliceSelFpf1, 5, 189, 1);
    823     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
    824                  _bcmFieldSliceSelFpf1, 5, 190, 1);
    825     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
    826                  _bcmFieldSliceSelFpf1, 5, 191, 1);
    827     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
    828                  _bcmFieldSliceSelFpf1, 5, 192, 2);
    829     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
    830                  _bcmFieldSliceSelFpf1, 5, 194, 1);
    831     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
    832                  _bcmFieldSliceSelFpf1, 5, 195, 1);
    833     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
    834                  _bcmFieldSliceSelFpf1, 5, 196, 1);
    835     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
    836                  _bcmFieldSliceSelFpf1, 5, 198, 1);
    837     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
    838                  _bcmFieldSliceSelFpf1, 5, 199, 1);
    839     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
    840                  _bcmFieldSliceSelFpf1, 5, 200, 1);
    841     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
    842                  _bcmFieldSliceSelFpf1, 5, 201, 1);
    843     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
    844                  _bcmFieldSliceSelFpf1, 5, 202, 1);
    845     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
    846                  _bcmFieldSliceSelFpf1, 5, 203, 1);
    847     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
    848                  _bcmFieldSliceSelFpf1, 5, 204, 1);
    849     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    850                  _bcmFieldSliceSelFpf1, 5, 205, 16);
    851     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    852                  _bcmFieldSliceSelFpf1, 5, 205, 12);
    853     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    854                  _bcmFieldSliceSelFpf1, 5, 217, 1);
    855     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    856                  _bcmFieldSliceSelFpf1, 5, 218, 3);
    857     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
    858                  _bcmFieldSliceSelFpf1, 5, 221, 2);
    859 
    860     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    861                  _bcmFieldSliceSelFpf1, 6, 189, 16);
    862     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    863                  _bcmFieldSliceSelFpf1, 6, 189, 12);
    864     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    865                  _bcmFieldSliceSelFpf1, 6, 201, 1);
    866     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    867                  _bcmFieldSliceSelFpf1, 6, 202, 3);
    868     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    869                  _bcmFieldSliceSelFpf1, 6, 205, 2);
    870     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    871                  _bcmFieldSliceSelFpf1, 6, 207, 2);
    872     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    873                  _bcmFieldSliceSelFpf1, 6, 209, 2);
    874     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    875                  _bcmFieldSliceSelFpf1, 6, 211, 3);
    876     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
    877                  _bcmFieldSliceSelFpf1, 6, 214, 5);
    878     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
    879                  _bcmFieldSliceSelFpf1, 6, 219, 3);
    880 
    881 
    882     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    883                  _bcmFieldSliceSelFpf1, 7, 189, 16);
    884     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    885                  _bcmFieldSliceSelFpf1, 7, 189, 12);
    886     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    887                  _bcmFieldSliceSelFpf1, 7, 201, 1);
    888     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    889                  _bcmFieldSliceSelFpf1, 7, 202, 3);
    890     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    891                                _bcmFieldSliceSelFpf1, 7,
    892                                _bcmFieldSliceDstClassSelect, 0, 205, 6);
    893     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    894                                _bcmFieldSliceSelFpf1, 7,
    895                                _bcmFieldSliceDstClassSelect, 1, 205, 6);
    896     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    897                                _bcmFieldSliceSelFpf1, 7,
    898                                _bcmFieldSliceSrcClassSelect, 3, 205, 6);
    899     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    900                                _bcmFieldSliceSelFpf1, 7,
    901                                _bcmFieldSliceSrcClassSelect, 2, 205, 6);
    902     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    903                                _bcmFieldSliceSelFpf1, 7,
    904                                _bcmFieldSliceFwdFieldSelect, 
    905                                _bcmFieldFwdFieldVrf, 211, 12);
    906     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    907                                _bcmFieldSliceSelFpf1, 7,
    908                                _bcmFieldSliceFwdFieldSelect, 
    909                                _bcmFieldFwdFieldVpn, 211, 12);
    910     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
    911                                bcmFieldQualifyForwardingVlanId,
    912                                _bcmFieldSliceSelFpf1, 7,
    913                                _bcmFieldSliceFwdFieldSelect, 
    914                                _bcmFieldFwdFieldVlan, 211, 12);
    915 
    916 
    917     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    918                  _bcmFieldSliceSelFpf1, 8, 189, 8);
    919     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    920                  _bcmFieldSliceSelFpf1, 8,
    921                  _bcmFieldSliceTosClassSelect, 0,
    922                  197, 8);
    923     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    924                  _bcmFieldSliceSelFpf1, 8,
    925                  _bcmFieldSliceTosClassSelect, 0,
    926                  197, 8);
    927     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    928                  _bcmFieldSliceSelFpf1, 8,
    929                  _bcmFieldSliceTosClassSelect, 1,
    930                  197, 8);
    931     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    932                                _bcmFieldSliceSelFpf1, 8,
    933                                _bcmFieldSliceDstClassSelect, 0, 205, 6);
    934     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    935                                _bcmFieldSliceSelFpf1, 8,
    936                                _bcmFieldSliceDstClassSelect, 1, 205, 6);
    937     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    938                                _bcmFieldSliceSelFpf1, 8,
    939                                _bcmFieldSliceSrcClassSelect, 3, 205, 6);
    940     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    941                                _bcmFieldSliceSelFpf1, 8,
    942                                _bcmFieldSliceSrcClassSelect, 2, 205, 6);
    943     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    944                                _bcmFieldSliceSelFpf1, 8,
    945                                _bcmFieldSliceFwdFieldSelect, 
    946                                _bcmFieldFwdFieldVrf, 211, 12);
    947     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    948                                _bcmFieldSliceSelFpf1, 8,
    949                                _bcmFieldSliceFwdFieldSelect, 
    950                                _bcmFieldFwdFieldVpn, 211, 12);
    951     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
    952                                bcmFieldQualifyForwardingVlanId,
    953                                _bcmFieldSliceSelFpf1, 8,
    954                                _bcmFieldSliceFwdFieldSelect, 
    955                                _bcmFieldFwdFieldVlan, 211, 12);
    956     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData2,
    957                                _bcmFieldSliceSelFpf1, 9, 189, 32);
    958 
    959     /* DWF4 */
    960     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    961                             _bcmFieldSliceSelFpf4, 1,
    962                             _bcmFieldSliceTcpClassSelect, 0, 0, 6);
    963     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    964                             _bcmFieldSliceSelFpf4, 1,
    965                             _bcmFieldSliceTcpClassSelect, 0, 0, 6);
    966     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    967                             _bcmFieldSliceSelFpf4, 1,
    968                             _bcmFieldSliceTcpClassSelect, 1, 0, 6);
    969 
    970     /* DWF3 */
    971     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
    972                             _bcmFieldSliceSelDisable, 0,
    973                             _bcmFieldSliceTosClassSelect, 0, 7, 8);
    974     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    975                             _bcmFieldSliceSelDisable, 0,
    976                             _bcmFieldSliceTosClassSelect, 0, 7, 8);
    977     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    978                             _bcmFieldSliceSelDisable, 0,
    979                             _bcmFieldSliceTosClassSelect, 1, 7, 8);
    980     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    981                             _bcmFieldSliceSelDisable, 0,
    982                             _bcmFieldSliceSelDisable, 0, 15, 8);
    983     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc,
    984                             bcmFieldQualifyExtensionHeaderSubCode,
    985                             _bcmFieldSliceSelDisable, 0,
    986                             _bcmFieldSliceSelDisable, 0, 23, 8);
    987     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
    988                             _bcmFieldSliceSelDisable, 0,
    989                             _bcmFieldSliceSelDisable, 0, 31, 8);
    990 
    991     /* DWF2 */
    992     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
    993                             _bcmFieldSliceSelFpf2, 0,
    994                             _bcmFieldSliceSelDisable, 0, 55, 1);
    995     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
    996                             _bcmFieldSliceSelFpf2, 0,
    997                             _bcmFieldSliceSelDisable, 0, 56, 1);
    998     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
    999                             _bcmFieldSliceSelFpf2, 0,
   1000                             _bcmFieldSliceSelDisable, 0, 57, 1);
   1001     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
   1002                             _bcmFieldSliceSelFpf2, 0,
   1003                             _bcmFieldSliceSelDisable, 0, 58, 2);
   1004     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
   1005                             _bcmFieldSliceSelFpf2, 0,
   1006                             _bcmFieldSliceSelDisable, 0, 60, 1);
   1007     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
   1008                             _bcmFieldSliceSelFpf2, 0,
   1009                             _bcmFieldSliceSelDisable, 0, 61, 1);
   1010     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
   1011                             _bcmFieldSliceSelFpf2, 0,
   1012                             _bcmFieldSliceSelDisable, 0, 62, 1);
   1013     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
   1014                             _bcmFieldSliceSelFpf2, 0,
   1015                             _bcmFieldSliceSelDisable, 0, 64, 1);
   1016     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
   1017                             _bcmFieldSliceSelFpf2, 0,
   1018                             _bcmFieldSliceSelDisable, 0, 65, 1);
   1019     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
   1020                             _bcmFieldSliceSelFpf2, 0,
   1021                             _bcmFieldSliceSelDisable, 0, 66, 1);
   1022     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
   1023                             _bcmFieldSliceSelFpf2, 0,
   1024                             _bcmFieldSliceSelDisable, 0, 67, 1);
   1025     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
   1026                             _bcmFieldSliceSelFpf2, 0,
   1027                             _bcmFieldSliceSelDisable, 0, 68, 1);
   1028     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
   1029                             _bcmFieldSliceSelFpf2, 0,
   1030                             _bcmFieldSliceSelDisable, 0, 69, 1);
   1031     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
   1032                             _bcmFieldSliceSelFpf2, 0,
   1033                             _bcmFieldSliceSelDisable, 0, 70, 1);
   1034     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck,
   1035                             _bcmFieldSliceSelFpf2, 0,
   1036                             _bcmFieldSliceSelDisable, 0, 71, 24);
   1037     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31,
   1038                             _bcmFieldSliceSelFpf2, 0,
   1039                             _bcmFieldSliceIntfClassSelect, 3, 95, 8);
   1040     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1041                             _bcmFieldSliceSelFpf2, 0,
   1042                             _bcmFieldSliceIntfClassSelect, 0, 95, 8);
   1043     /* bcmFieldQualifyInterfaceClassL3 is not supported */
   1044     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
   1045                             _bcmFieldSliceSelFpf2, 0,
   1046                             _bcmFieldSliceIntfClassSelect, 2, 95, 8);
   1047     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1048                             _bcmFieldSliceSelFpf2, 0,
   1049                             _bcmFieldSliceSelDisable, 0, 103, 32);
   1050     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1051                             _bcmFieldSliceSelFpf2, 0,
   1052                             _bcmFieldSliceSelDisable, 0, 135, 32);
   1053     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   1054                             _bcmFieldSliceSelFpf2, 1,
   1055                             _bcmFieldSliceSelDisable, 0, 39, 128);
   1056     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   1057                             _bcmFieldSliceSelFpf2, 2,
   1058                             _bcmFieldSliceSelDisable, 0, 39, 128);
   1059     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, _bcmFieldQualifyData1,
   1060                             _bcmFieldSliceSelFpf2, 3,
   1061                             _bcmFieldSliceSelDisable, 0, 39, 128);
   1062     /* DWF1 */
   1063     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1064                             _bcmFieldSliceSelDisable, 0,
   1065                             _bcmFieldSliceTtlClassSelect, 0, 167, 8);
   1066     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
   1067                             _bcmFieldSliceSelDisable, 0,
   1068                             _bcmFieldSliceTtlClassSelect, 0, 167, 8);
   1069     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
   1070                             _bcmFieldSliceSelDisable, 0,
   1071                             _bcmFieldSliceTtlClassSelect, 1, 167, 8);
   1072     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1073                             _bcmFieldSliceSelDisable, 0,
   1074                             _bcmFieldSliceSelDisable, 0, 175, 2);
   1075     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1076                             _bcmFieldSliceSelDisable, 0,
   1077                             _bcmFieldSliceSelDisable, 0, 177, 16);
   1078     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1079                             _bcmFieldSliceSelDisable, 0,
   1080                             _bcmFieldSliceSelDisable, 0, 193, 16);
   1081 
   1082     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   1083                      _bcmFieldDevSelDisable, 0,
   1084                      _bcmFieldSliceSelDisable, 0, 
   1085                      _bcmFieldSliceDstFwdEntitySelect, 
   1086                      _bcmFieldFwdEntityGlp, 0x1,
   1087                      209, 17, 0, 0, 0, 0, 0);
   1088     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   1089                      _bcmFieldDevSelDisable, 0,
   1090                                _bcmFieldSliceSelDisable, 0,
   1091                                _bcmFieldSliceDstFwdEntitySelect,
   1092                      _bcmFieldFwdEntityGlp, 0x1,
   1093                      209, 17, 0, 0, 0, 0, 0);
   1094     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   1095                      _bcmFieldDevSelDisable, 0,
   1096                                _bcmFieldSliceSelDisable, 0,
   1097                                _bcmFieldSliceDstFwdEntitySelect,
   1098                      _bcmFieldFwdEntityMplsGport, 0x1,
   1099                      209, 17, 0, 0, 0, 0, 0);
   1100     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   1101                      _bcmFieldDevSelDisable, 0,
   1102                                _bcmFieldSliceSelDisable, 0,
   1103                                _bcmFieldSliceDstFwdEntitySelect,
   1104                      _bcmFieldFwdEntityVlanGport, 0x1,
   1105                      209, 17, 0, 0, 0, 0, 0);
   1106     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   1107                      _bcmFieldDevSelDisable, 0,
   1108                                _bcmFieldSliceSelDisable, 0,
   1109                                _bcmFieldSliceDstFwdEntitySelect,
   1110                      _bcmFieldFwdEntityMimGport, 0x1,
   1111                      209, 17, 0, 0, 0, 0, 0);
   1112     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   1113                      _bcmFieldDevSelDisable, 0,
   1114                                _bcmFieldSliceSelDisable, 0,
   1115                                _bcmFieldSliceDstFwdEntitySelect,
   1116                      _bcmFieldFwdEntityL3Egress, 0x1,
   1117                      209, 17, 0, 0, 0, 0, 0);
   1118     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
   1119                      _bcmFieldDevSelDisable, 0,
   1120                                _bcmFieldSliceSelDisable, 0,
   1121                                _bcmFieldSliceDstFwdEntitySelect,
   1122                      _bcmFieldFwdEntityL3Egress, 0x1,
   1123                      209, 17, 0, 0, 0, 0, 0);
   1124     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   1125                      _bcmFieldDevSelDisable, 0,
   1126                                _bcmFieldSliceSelDisable, 0,
   1127                                _bcmFieldSliceDstFwdEntitySelect,
   1128                      _bcmFieldFwdEntityMulticastGroup, 0x1,
   1129                      209, 17, 0, 0, 0, 0, 0);
   1130     /* DONE DWF */
   1131     return (BCM_E_NONE);
   1132 }
   1133 
   1134 /*
   1135  * Function:
   1136  *     _field_hu2_lookup_qualifiers_init
   1137  * Purpose:
   1138  *     Initialize device stage lookup qaualifiers
   1139  *     select codes & offsets
   1140  * Parameters:
   1141  *     unit       - (IN) BCM device number.
   1142  *     stage_fc   - (IN) Field Processor stage control structure.
   1143  *
   1144  * Returns:
   1145  *     BCM_E_NONE
   1146  */
   1147 STATIC int
   1148 _field_hu2_lookup_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1149 {
   1150     _FP_QUAL_DECL;
   1151 
   1152     /* Input parameters check. */
   1153     if (NULL == stage_fc) {
   1154         return (BCM_E_PARAM);
   1155     }
   1156 
   1157     /* Enable the overlay of Sender Ethernet Address onto MACSA
   1158      * on ARP/RARP packets.
   1159      */
   1160     BCM_IF_ERROR_RETURN
   1161         (soc_reg_field32_modify(unit, ING_CONFIG_64r, REG_PORT_ANY,
   1162                                 ARP_VALIDATION_ENf, 1));
   1163 
   1164     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageLookup,
   1165                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1166     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
   1167                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1168     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   1169                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1170 
   1171     /* FPF3 */
   1172     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1173                  _bcmFieldSliceSelFpf3, 0, 0, 16);
   1174     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1175                  _bcmFieldSliceSelFpf3, 0, 0, 12);
   1176     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1177                  _bcmFieldSliceSelFpf3, 0, 12, 1);
   1178     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1179                  _bcmFieldSliceSelFpf3, 0, 13, 3);
   1180     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1181                  _bcmFieldSliceSelFpf3, 0, 16, 16);
   1182 
   1183     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1184                                _bcmFieldSliceSelFpf3, 1, 0, 16);
   1185     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1186                                _bcmFieldSliceSelFpf3, 1, 16, 16);
   1187     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1188                                _bcmFieldSliceSelFpf3, 2, 0, 8);
   1189     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1190                                _bcmFieldSliceSelFpf3, 2, 8, 8);
   1191     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   1192                  _bcmFieldSliceSelFpf3, 2, 16, 8);
   1193     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   1194                  _bcmFieldSliceSelFpf3, 2, 24, 8);
   1195     /* bcmFieldQualifyInterfaceClassL3 is not supported */
   1196     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1197                  _bcmFieldSliceSelFpf3, 3, 8, 16);
   1198     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1199                  _bcmFieldSliceSelFpf3, 3, 8, 12);
   1200     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1201                  _bcmFieldSliceSelFpf3, 3, 20, 1);
   1202     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1203                  _bcmFieldSliceSelFpf3, 3, 21, 3);
   1204     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   1205                  _bcmFieldSliceSelFpf3, 3, 24, 7);
   1206 
   1207     /* FPF2 */
   1208     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1209                                _bcmFieldSliceSelFpf2, 0, 32, 8);
   1210     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1211                  _bcmFieldSliceSelFpf2, 0, 40, 6);
   1212     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1213                                _bcmFieldSliceSelFpf2, 0, 46, 2);
   1214     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1215                                _bcmFieldSliceSelFpf2, 0, 48, 8);
   1216     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1217                                _bcmFieldSliceSelFpf2, 0, 56, 16);
   1218     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1219                                _bcmFieldSliceSelFpf2, 0, 72, 16);
   1220     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1221                                _bcmFieldSliceSelFpf2, 0, 88, 8);
   1222     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1223                                _bcmFieldSliceSelFpf2, 0, 96, 32);
   1224     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1225                                _bcmFieldSliceSelFpf2, 0, 128, 32);
   1226     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   1227                                _bcmFieldSliceSelFpf2, 1, 32, 128);
   1228     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   1229                                _bcmFieldSliceSelFpf2, 2, 32, 128);
   1230     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1231                  _bcmFieldSliceSelFpf2, 3, 48, 16);
   1232     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   1233                  _bcmFieldSliceSelFpf2, 3, 64, 48);
   1234     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1235                  _bcmFieldSliceSelFpf2, 3, 112, 48);
   1236     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1237                                _bcmFieldSliceSelFpf2, 4,  32, 8);
   1238     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1239                                _bcmFieldSliceSelFpf2, 4, 40, 8);
   1240     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1241                                _bcmFieldSliceSelFpf2, 4, 48, 32);
   1242 
   1243     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1244                                _bcmFieldSliceSelFpf2, 4, 80, 32);
   1245     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   1246                  _bcmFieldSliceSelFpf2, 4, 112, 48);
   1247 
   1248     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1249                                _bcmFieldSliceSelFpf2, 5, 32, 8);
   1250     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1251                                _bcmFieldSliceSelFpf2, 5, 40, 8);
   1252     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1253                                _bcmFieldSliceSelFpf2, 5, 48, 32);
   1254     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1255                                _bcmFieldSliceSelFpf2, 5, 80, 32);
   1256     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1257                  _bcmFieldSliceSelFpf2, 5, 112, 48);
   1258     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
   1259                                _bcmFieldSliceSelFpf2, 6, 32, 64);
   1260     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   1261                                _bcmFieldSliceSelFpf2, 6, 96, 64);
   1262     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySnap,
   1263                  _bcmFieldSliceSelFpf2, 7, 96, 40);
   1264     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyLlc,
   1265                  _bcmFieldSliceSelFpf2, 7, 136, 24);
   1266 
   1267     /* FPF1 */
   1268     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocolCommon,
   1269                                _bcmFieldSliceSelFpf1, 0, 160, 3);
   1270     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated,
   1271                  _bcmFieldSliceSelFpf1, 0, 163, 1);
   1272     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
   1273                  _bcmFieldSliceSelFpf1, 0, 164, 1);
   1274     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
   1275                  _bcmFieldSliceSelFpf1, 0, 165, 2);
   1276     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
   1277                  _bcmFieldSliceSelFpf1, 0, 167, 2);
   1278     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   1279                  _bcmFieldSliceSelFpf1, 0, 169, 2);
   1280     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1281                  _bcmFieldSliceSelFpf1, 0, 171, 1);
   1282     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1283                  _bcmFieldSliceSelFpf1, 0, 172, 1);
   1284     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1285                  _bcmFieldSliceSelFpf1, 0, 173, 16);
   1286     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1287                  _bcmFieldSliceSelFpf1, 0, 173, 12);
   1288     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1289                  _bcmFieldSliceSelFpf1, 0, 185, 1);
   1290     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1291                  _bcmFieldSliceSelFpf1, 0, 186, 3);
   1292     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1293                  _bcmFieldSliceSelFpf1, 0, 189, 2);
   1294     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1295                  _bcmFieldSliceSelFpf1, 0, 191, 6);
   1296     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1297                  _bcmFieldSliceSelFpf1, 0, 197, 8);
   1298     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1299                                _bcmFieldSliceSelFpf1, 0, 205, 4);
   1300     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1301                  _bcmFieldSliceSelFpf1, 0, 209, 1);
   1302     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
   1303                  _bcmFieldSliceSelFpf1, 0, 4, 1);
   1304 
   1305     /* DWF3 */
   1306     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1307                             _bcmFieldSliceSelFpf3, 0,
   1308                             _bcmFieldSliceSelDisable, 0, 0, 8);
   1309     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1310                             _bcmFieldSliceSelFpf3, 0,
   1311                             _bcmFieldSliceSelDisable, 0, 8, 8);
   1312     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1313                             _bcmFieldSliceSelFpf3, 0,
   1314                             _bcmFieldSliceSelDisable, 0, 16, 6);
   1315     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1316                             _bcmFieldSliceSelFpf3, 0,
   1317                             _bcmFieldSliceSelDisable, 0, 22, 2);
   1318     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1319                             _bcmFieldSliceSelFpf3, 0,
   1320                             _bcmFieldSliceSelDisable, 0, 24, 8);
   1321     /* DWF2 */
   1322     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1323                             _bcmFieldSliceSelFpf2, 0,
   1324                             _bcmFieldSliceSelDisable, 0, 32, 8);
   1325     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1326                             _bcmFieldSliceSelFpf2, 0,
   1327                             _bcmFieldSliceSelDisable, 0, 40, 6);
   1328     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1329                             _bcmFieldSliceSelFpf2, 0,
   1330                             _bcmFieldSliceSelDisable, 0, 46, 2);
   1331     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1332                             _bcmFieldSliceSelFpf2, 0,
   1333                             _bcmFieldSliceSelDisable, 0, 48, 8);
   1334     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1335                             _bcmFieldSliceSelFpf2, 0,
   1336                             _bcmFieldSliceSelDisable, 0, 56, 16);
   1337     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1338                             _bcmFieldSliceSelFpf2, 0,
   1339                             _bcmFieldSliceSelDisable, 0, 72, 16);
   1340     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1341                             _bcmFieldSliceSelFpf2, 0,
   1342                             _bcmFieldSliceSelDisable, 0, 88, 8);
   1343     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1344                             _bcmFieldSliceSelFpf2, 0,
   1345                             _bcmFieldSliceSelDisable, 0, 96, 32);
   1346     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1347                             _bcmFieldSliceSelFpf2, 0,
   1348                             _bcmFieldSliceSelDisable, 0, 128, 32);
   1349     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   1350                             _bcmFieldSliceSelFpf2, 1,
   1351                             _bcmFieldSliceSelDisable, 0, 32, 128);
   1352     /* FPF1 */
   1353     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   1354                             _bcmFieldSliceSelFpf1, 0,
   1355                             _bcmFieldSliceSelDisable, 0, 160, 8);
   1356     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   1357                             _bcmFieldSliceSelFpf1, 0,
   1358                             _bcmFieldSliceSelDisable, 0, 168, 8);
   1359     /* bcmFieldQualifyInterfaceClassL3 is not supported */
   1360     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1361                             _bcmFieldSliceSelFpf1, 0,
   1362                             _bcmFieldSliceSelDisable, 0, 184, 16);
   1363 
   1364     return (BCM_E_NONE);
   1365 }
   1366 
   1367 
   1368 /*
   1369  * Function:
   1370  *     _field_hu2_egress_qualifiers_init
   1371  * Purpose:
   1372  *     Initialize device stage egress qaualifiers
   1373  *     select codes & offsets
   1374  * Parameters:
   1375  *     unit       - (IN) BCM device number.
   1376  *     stage_fc   - (IN) Field Processor stage control structure.
   1377  * 
   1378  * Returns:
   1379  *     BCM_E_NONE
   1380  */
   1381 STATIC int
   1382 _field_hu2_egress_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1383 {
   1384     _FP_QUAL_DECL;
   1385     _key_fld_ = KEYf;
   1386 
   1387     /* Input parameters check. */
   1388     if (NULL == stage_fc) {
   1389         return (BCM_E_PARAM);
   1390     }
   1391 
   1392     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageEgress,
   1393                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1394 
   1395     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1396                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 0, 1);
   1397     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   1398                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 25, 2);
   1399     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1400                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 27, 16);
   1401     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   1402                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 43, 48);
   1403     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1404                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 91, 48);
   1405     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyCpuQueue,
   1406                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 139, 6);
   1407     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
   1408                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 145, 1);
   1409     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1410                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 146, 1);
   1411     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1412                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 147, 1);
   1413     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1414                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 148, 1);
   1415     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1416                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 149, 3);
   1417     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1418                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 152, 12);
   1419     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1420                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 165, 6);
   1421     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   1422                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 171, 1);
   1423     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1424                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 172, 1);
   1425     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1426                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 173, 16);
   1427     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1428                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 173, 12);
   1429     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1430                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 185, 1);
   1431     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1432                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 186, 3);
   1433     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1434                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 189, 2);
   1435     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1436                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 191, 1);
   1437     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1438                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 192, 8);
   1439     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1440                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 200, 6);
   1441     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1442                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 206, 4);
   1443     /* L3_PKT_TYPE */
   1444     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1445                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1446                                _bcmFieldSliceSelEgrMdlKey4, 0, 206, 4);
   1447     /* MDL */
   1448     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyOamMdl,
   1449                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4,
   1450                                _bcmFieldSliceSelEgrMdlKey4, 1, 206, 3);
   1451 
   1452     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1453                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 210, 1);
   1454 
   1455 
   1456     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1457                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 1);
   1458     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1459                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 14, 2);
   1460     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1461                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 16, 6);
   1462     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1463                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 22, 16);
   1464     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1465                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 38, 16);
   1466     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1467                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 54, 8);
   1468     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1469                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 62, 8);
   1470     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1471                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 70, 32);
   1472     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1473                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 102, 32);
   1474     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1475                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 134, 8);
   1476     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1477                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 142, 1);
   1478     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1479                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 143, 1);
   1480     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1481                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 152, 12);
   1482     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1483                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 165, 6);
   1484     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   1485                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 171, 1);
   1486     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1487                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 172, 1);
   1488     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1489                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 173, 16);
   1490     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1491                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 173, 12);
   1492     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1493                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 185, 1);
   1494     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1495                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 186, 3);
   1496     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1497                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 189, 2);
   1498     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1499                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 191, 1);
   1500     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1501                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 192, 8);
   1502     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1503                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 200, 6);
   1504     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1505                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 206, 4);
   1506     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1507                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 210, 1);
   1508     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
   1509                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 0);
   1510 
   1511    /* KEY1 without v4 specific fields. */
   1512     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1513                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 0, 1);
   1514     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1515                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 16, 6);
   1516     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1517                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 22, 16);
   1518     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1519                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 38, 16);
   1520     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1521                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 54, 8);
   1522     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1523                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 62, 8);
   1524     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1525                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 134, 8);
   1526     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1527                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 142, 1);
   1528     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1529                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 143, 1);
   1530     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1531                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 152, 12);
   1532     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1533                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 165, 6);
   1534     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   1535                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 171, 1);
   1536     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1537                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 172, 1);
   1538     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1539                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 173, 16);
   1540     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1541                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 173, 12);
   1542     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1543                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 185, 1);
   1544     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1545                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 186, 3);
   1546     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1547                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 189, 2);
   1548     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1549                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 191, 1);
   1550     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1551                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 192, 8);
   1552     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1553                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 200, 6);
   1554     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1555                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 206, 4);
   1556     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1557                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 210, 1);
   1558  
   1559     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1560                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 1);
   1561     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1562                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 6, 8);
   1563     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   1564                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1565                                _bcmFieldSliceIp6AddrSelect,
   1566                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP6,
   1567                                14, 128);
   1568     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   1569                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1570                                _bcmFieldSliceIp6AddrSelect,
   1571                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_DIP6,
   1572                                14, 128);
   1573     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
   1574                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1575                                _bcmFieldSliceIp6AddrSelect,
   1576                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64,
   1577                                14, 64);
   1578     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   1579                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1580                                _bcmFieldSliceIp6AddrSelect,
   1581                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64,
   1582                                78, 64);
   1583     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1584                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 142, 8);
   1585     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1586                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 150, 1);
   1587     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1588                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 151, 1);
   1589     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1590                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 152, 12);
   1591     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1592                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 165, 6);
   1593     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   1594                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 171, 1);
   1595     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1596                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 172, 1);
   1597     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1598                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 173, 16);
   1599     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1600                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 173, 12);
   1601     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1602                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 185, 1);
   1603     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1604                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 186, 3);
   1605     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1606                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 189, 2);
   1607     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1608                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 191, 1);
   1609     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1610                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 192, 8);
   1611     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1612                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 200, 6);
   1613     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1614                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 206, 4);
   1615     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1616                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 210, 1);
   1617     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   1618                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 0);
   1619 
   1620     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1621                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 1);
   1622     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1623                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 14, 2);
   1624     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1625                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 16, 6);
   1626     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1627                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 22, 16);
   1628     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1629                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 38, 16);
   1630     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1631                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 54, 8);
   1632     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   1633                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 62, 128);
   1634     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   1635                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 190, 8);
   1636     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   1637                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 198, 8);
   1638     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1639                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 206, 4);
   1640     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1641                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 210, 1);
   1642     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   1643                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 0);
   1644 
   1645     return (BCM_E_NONE);
   1646 }
   1647 
   1648 
   1649 
   1650 /*
   1651  * Function:
   1652  *     _field_hu2_qualifiers_init
   1653  * Purpose:
   1654  *     Initialize device qaualifiers select codes & offsets
   1655  * Parameters:
   1656  *     unit       - (IN) BCM device number.
   1657  *     stage_fc   - (IN) Field Processor stage control structure. 
   1658  *
   1659  * Returns:
   1660  *     BCM_E_NONE
   1661  * Notes:
   1662  */
   1663 STATIC int
   1664 _field_hu2_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1665 {
   1666     int rv;           /* Operation return status. */
   1667 
   1668     /* Input parameters check. */
   1669     if (NULL == stage_fc) {
   1670         return (BCM_E_PARAM);
   1671     }
   1672 
   1673     /* Allocated stage qualifiers configuration array. */
   1674     _FP_XGS3_ALLOC(stage_fc->f_qual_arr, 
   1675                    (_bcmFieldQualifyCount * sizeof(_bcm_field_qual_info_t *)), 
   1676                    "Field qualifiers");
   1677     if (NULL == stage_fc->f_qual_arr) {
   1678         return (BCM_E_MEMORY);
   1679     }
   1680     
   1681     switch (stage_fc->stage_id) {
   1682       case _BCM_FIELD_STAGE_INGRESS:
   1683           rv = _field_hu2_ingress_qualifiers_init(unit, stage_fc);
   1684           break;
   1685       case _BCM_FIELD_STAGE_LOOKUP:
   1686           rv = _field_hu2_lookup_qualifiers_init(unit, stage_fc);
   1687           break;
   1688       case _BCM_FIELD_STAGE_EGRESS:
   1689           rv = _field_hu2_egress_qualifiers_init(unit, stage_fc);
   1690           break;
   1691       case _BCM_FIELD_STAGE_EXTERNAL:  
   1692       default: 
   1693           sal_free(stage_fc->f_qual_arr);
   1694           return (BCM_E_PARAM);
   1695     }
   1696     return (rv);
   1697 }
   1698 
   1699 
   1700 
   1701 /*
   1702  * Function:
   1703  *     _field_hu2_write_slice_map_ingress
   1704  *
   1705  * Purpose:
   1706  *     Write the FP_SLICE_MAP (INGRESS)
   1707  *
   1708  * Parameters:
   1709  *     unit
   1710  *     stage_fc - pointer to stage control block
   1711  *     new_fp_virtual_map - virtual map to be written
   1712  *
   1713  * Returns:
   1714  *     nothing
   1715  *     
   1716  * Notes:
   1717  */
   1718 STATIC int
   1719 _field_hu2_write_slice_map_ingress(int unit, _field_stage_t *stage_fc)
   1720 {
   1721     fp_slice_map_entry_t map_entry;  /* HW entry buffer.         */
   1722     soc_field_t field;               /* HW entry fields.         */
   1723     int vmap_size;                   /* Virtual map index count. */
   1724     uint32 value;                    /* Field entry value.       */
   1725     int idx;                         /* Map fields iterator.     */     
   1726     int rv;                          /* Operation return status. */
   1727     uint32 virtual_to_physical_map_hu2[8] = {
   1728             VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   1729             VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   1730             VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   1731             VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   1732             VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   1733             VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   1734             VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   1735             VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_0f  
   1736     };
   1737 
   1738     uint32 virtual_to_group_map_hu2[8] = {
   1739             VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   1740             VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   1741             VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   1742             VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   1743             VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   1744             VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   1745             VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   1746             VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_0f
   1747     };
   1748 
   1749     /* Calculate virtual map size. */
   1750     rv = _bcm_field_virtual_map_size_get(unit, stage_fc, &vmap_size); 
   1751     BCM_IF_ERROR_RETURN(rv);
   1752 
   1753     rv = READ_FP_SLICE_MAPm(unit, MEM_BLOCK_ANY, 0, &map_entry);
   1754     BCM_IF_ERROR_RETURN(rv);
   1755 
   1756     for (idx = 0; idx < vmap_size; idx++) {
   1757         value = (stage_fc->vmap[_FP_DEF_INST][0][idx]).vmap_key;
   1758         field = virtual_to_physical_map_hu2[idx];
   1759         soc_FP_SLICE_MAPm_field32_set(unit, &map_entry, field, value);
   1760 
   1761         value = (stage_fc->vmap[_FP_DEF_INST][0][idx]).virtual_group;
   1762         field = virtual_to_group_map_hu2[idx];
   1763         soc_FP_SLICE_MAPm_field32_set(unit, &map_entry, field, value);
   1764     }
   1765 
   1766     rv = WRITE_FP_SLICE_MAPm(unit, MEM_BLOCK_ALL, 0, &map_entry);
   1767     return (rv);
   1768 }
   1769 
   1770 
   1771 /*
   1772  * Function:
   1773  *     _bcm_field_hu2_write_slice_map
   1774  *
   1775  * Purpose:
   1776  *     Write the FP_SLICE_MAP
   1777  *
   1778  * Parameters:
   1779  *     unit
   1780  *     stage_fc - pointer to stage control block
   1781  *     fg - Reference to Field group structure.
   1782  *
   1783  * Returns:
   1784  *     nothing
   1785  *     
   1786  * Notes:
   1787  */
   1788 int
   1789 _bcm_field_hu2_write_slice_map(int unit, _field_stage_t *stage_fc,
   1790                                _field_group_t *fg)
   1791 {
   1792     int rv = BCM_E_PARAM;   /* Operation return status. */
   1793 
   1794     if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) {
   1795         rv = _field_hu2_write_slice_map_ingress(unit, stage_fc);
   1796     } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   1797         rv =  _bcm_field_trx_write_slice_map_egress(unit, stage_fc);
   1798     } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP) {
   1799         rv =  _bcm_field_trx_write_slice_map_vfp(unit, stage_fc);
   1800     }
   1801 
   1802     return (rv);
   1803 }
   1804 
   1805 /*
   1806  * Function:
   1807  *     _bcm_field_hu2_init
   1808  * Purpose:
   1809  *     Perform initializations that are specific to BCM56142. This
   1810  *     includes initializing the FP field select bit offset tables for FPF[1-3]
   1811  *     for every stage. 
   1812  * Parameters:
   1813  *     unit       - (IN) BCM device number.
   1814  *     fc         - (IN) Field Processor control structure. 
   1815  *
   1816  * Returns:
   1817  *     BCM_E_NONE
   1818  * Notes:
   1819  */
   1820 int
   1821 _bcm_field_hu2_init(int unit, _field_control_t *fc) 
   1822 {
   1823     _field_stage_t *stage_fc; /* Stages iteration pointer */
   1824 
   1825     /* Input parameters check. */
   1826     if (NULL == fc) {
   1827         return (BCM_E_PARAM);
   1828     }
   1829 
   1830     stage_fc = fc->stages;
   1831     while (stage_fc) {
   1832         /* Clear hardware table */
   1833         BCM_IF_ERROR_RETURN(_bcm_field_tr_hw_clear(unit, stage_fc));
   1834 
   1835         /* Initialize qualifiers info. */
   1836         BCM_IF_ERROR_RETURN(_field_hu2_qualifiers_init(unit, stage_fc));
   1837 
   1838         if (_BCM_FIELD_STAGE_EXTERNAL == stage_fc->stage_id) {
   1839             _bcm_field_tr_external_init(unit, stage_fc);
   1840             stage_fc = stage_fc->next;
   1841             continue;
   1842         }
   1843 
   1844         /* Goto next stage */
   1845         stage_fc = stage_fc->next;
   1846     }
   1847 
   1848     /* Initialize the TOS_FN, TTL_FN, TCP_FN tables */
   1849     BCM_IF_ERROR_RETURN(_bcm_field_trx_tcp_ttl_tos_init(unit));
   1850     
   1851     if (0 == SOC_WARM_BOOT(unit)) {
   1852         /* Enable filter processor */
   1853         BCM_IF_ERROR_RETURN(_field_port_filter_enable_set(unit, fc, TRUE));
   1854 
   1855         /* Enable meter refresh */
   1856         BCM_IF_ERROR_RETURN(_field_meter_refresh_enable_set(unit, fc, TRUE));
   1857     }
   1858 
   1859     /* Initialize the function pointers */
   1860     _field_hu2_functions_init(&fc->functions);;
   1861 
   1862     return (BCM_E_NONE);
   1863 }
   1864 
   1865 /*
   1866  * Function:
   1867  *     _bcm_field_hu2_lookup_mode_set
   1868  *
   1869  * Purpose:
   1870  *     Helper function to _bcm_field_fb_mode_install that sets the mode of a
   1871  *     slice in a register value that is to be used for VFP_KEY_CONTROLr.
   1872  *
   1873  * Parameters:
   1874  *     unit       - (IN) BCM device number.
   1875  *     slice_numb - (IN) Slice number to set mode for.
   1876  *     fg         - (IN) Filed group structure.
   1877  *     flags      - (IN) New group/slice mode.
   1878  *
   1879  * Returns:
   1880  *     BCM_E_XXX
   1881  */
   1882 int
   1883 _bcm_field_hu2_lookup_mode_set(int unit, uint8 slice_numb,
   1884                               _field_group_t *fg, uint8 flags)
   1885 
   1886 {
   1887     int paired;
   1888     uint32  reg_val;
   1889     if (slice_numb >= VFP_SLICE_COUNT) {
   1890         return (BCM_E_PARAM);
   1891     }
   1892     SOC_IF_ERROR_RETURN(READ_VFP_KEY_CONTROLr(unit, &reg_val));
   1893 
   1894     paired = (flags & _FP_GROUP_SPAN_DOUBLE_SLICE) ? 1 : 0;
   1895     soc_reg_field_set(unit, VFP_KEY_CONTROLr, &reg_val,
   1896                       _vfp_hu2_slice_pairing_field[slice_numb / 2], paired);
   1897 
   1898     SOC_IF_ERROR_RETURN(WRITE_VFP_KEY_CONTROLr(unit, reg_val));
   1899     return (BCM_E_NONE);
   1900 }
   1901 
   1902 /*
   1903  * Function:
   1904  *     _field_hu2_mode_set
   1905  *
   1906  * Purpose:
   1907  *    Auxiliary routine used to set group pairing mode.
   1908  * Parameters:
   1909  *     unit       - (IN) BCM device number.
   1910  *     slice_numb - (IN) Slice number to set mode for.
   1911  *     fg         - (IN) Installed group structure.
   1912  *     flags      - (IN) New group/slice mode.
   1913  *
   1914  * Returns:
   1915  *     BCM_E_XXX
   1916  */
   1917 int
   1918 _bcm_field_hu2_mode_set(int unit, uint8 slice_numb, _field_group_t *fg, uint8 flags)
   1919 {
   1920     int rv;     /* Operation return status. */
   1921 
   1922     /* Input parameter check. */
   1923     if (NULL == fg) {
   1924         return (BCM_E_PARAM);
   1925     }
   1926 
   1927     switch (fg->stage_id) {
   1928       case _BCM_FIELD_STAGE_INGRESS:
   1929           rv = BCM_E_NONE; /* Mode and select codes programmed together. */
   1930           break;
   1931       case _BCM_FIELD_STAGE_LOOKUP:
   1932           rv  = _bcm_field_hu2_lookup_mode_set(unit, slice_numb, fg, flags);
   1933           break;
   1934       case _BCM_FIELD_STAGE_EGRESS:
   1935           rv = _bcm_field_trx_egress_mode_set(unit, slice_numb, fg, flags);
   1936           break;
   1937       default:
   1938           rv = BCM_E_PARAM;
   1939     }
   1940     return (rv);
   1941 }
   1942 
   1943 /*
   1944  * Function:
   1945  *     _field_hu2_lookup_selcodes_install
   1946  *
   1947  * Purpose:
   1948  *     Writes the field select codes (ie. FPFx).
   1949  *     for VFP (_BCM_FIELD_STAGE_LOOKUP) lookup stage.
   1950  *
   1951  * Parameters:
   1952  *     unit  - BCM device number
   1953  *     fs    - slice that needs its select codes written
   1954  *
   1955  * Returns:
   1956  *     BCM_E_XXX
   1957  */
   1958 STATIC int
   1959 _field_hu2_lookup_selcodes_install(int unit, _field_group_t *fg,
   1960                                    uint8 slice_numb, int selcode_index)
   1961 {
   1962     uint32        reg_val;
   1963     uint32        old_reg_val;
   1964     _field_sel_t  *sel;
   1965     int           rv;
   1966     sel = &fg->sel_codes[selcode_index];
   1967 
   1968     rv = READ_VFP_KEY_CONTROLr(unit, &reg_val);
   1969     BCM_IF_ERROR_RETURN(rv);
   1970     old_reg_val = reg_val;
   1971 
   1972     if (((selcode_index % 2)  == 0) ||
   1973         ((fg->flags & _FP_GROUP_SPAN_DOUBLE_SLICE) &&
   1974             (selcode_index & 1))){
   1975         if (sel->fpf2 != _FP_SELCODE_DONT_CARE) {
   1976             soc_reg_field_set(unit,
   1977                               VFP_KEY_CONTROLr,
   1978                               &reg_val,
   1979                               _bcm_field_hu2_vfp_field_sel[slice_numb][0],
   1980                               sel->fpf2
   1981                              );
   1982         }
   1983         if (sel->fpf3 != _FP_SELCODE_DONT_CARE) {
   1984             soc_reg_field_set(unit,
   1985                               VFP_KEY_CONTROLr,
   1986                               &reg_val,
   1987                               _bcm_field_hu2_vfp_field_sel[slice_numb][1],
   1988                               sel->fpf3
   1989                              );
   1990         }
   1991     }
   1992     
   1993     if (old_reg_val != reg_val) {
   1994         rv = WRITE_VFP_KEY_CONTROLr(unit, reg_val);
   1995         BCM_IF_ERROR_RETURN(rv);
   1996     }
   1997 
   1998     return (rv);
   1999 }
   2000 
   2001 STATIC int
   2002 _field_hu2_egress_selcodes_install(int            unit,
   2003                                    _field_group_t *fg,
   2004                                    uint8          slice_num,
   2005                                    int            selcode_idx)
   2006 {
   2007     static const soc_field_t fldtbl[][4] = {
   2008         { SLICE_0_F1f, SLICE_1_F1f, SLICE_2_F1f, SLICE_3_F1f },
   2009         { SLICE_0_F2f, SLICE_1_F2f, SLICE_2_F2f, SLICE_3_F2f },
   2010         { SLICE_0_F3f, SLICE_1_F3f, SLICE_2_F3f, SLICE_3_F3f },
   2011         { SLICE_0_F4f, SLICE_1_F4f, SLICE_2_F4f, SLICE_3_F4f }
   2012     };
   2013 
   2014     static const soc_field_t mdlfldtbl[4] = {
   2015         SLICE_0f, SLICE_1f, SLICE_2f, SLICE_3f };
   2016 
   2017     _field_sel_t * const sel = &fg->sel_codes[selcode_idx];
   2018 
   2019     if (sel->egr_class_f1_sel != _FP_SELCODE_DONT_CARE) {
   2020         BCM_IF_ERROR_RETURN(
   2021             soc_reg_field32_modify(unit, EFP_CLASSID_SELECTORr, REG_PORT_ANY,
   2022                                fldtbl[0][slice_num], sel->egr_class_f1_sel));
   2023     }
   2024     if (sel->egr_class_f2_sel != _FP_SELCODE_DONT_CARE) {
   2025         BCM_IF_ERROR_RETURN(
   2026            soc_reg_field32_modify(unit, EFP_CLASSID_SELECTORr, REG_PORT_ANY,
   2027                                fldtbl[1][slice_num], sel->egr_class_f2_sel));
   2028     }
   2029     if (sel->egr_class_f3_sel != _FP_SELCODE_DONT_CARE) {
   2030         BCM_IF_ERROR_RETURN(
   2031             soc_reg_field32_modify(unit, EFP_CLASSID_SELECTORr, REG_PORT_ANY,
   2032                                 fldtbl[2][slice_num], sel->egr_class_f3_sel));
   2033     }
   2034     if (sel->egr_class_f4_sel != _FP_SELCODE_DONT_CARE) {
   2035         BCM_IF_ERROR_RETURN(
   2036             soc_reg_field32_modify(unit, EFP_CLASSID_SELECTORr, REG_PORT_ANY,
   2037                                 fldtbl[3][slice_num], sel->egr_class_f4_sel));
   2038     }
   2039 
   2040     /* SELECTOR CODES for EFP_KEY4_MDL_SELECTOR register */
   2041     if (sel->egr_key4_mdl_sel != _FP_SELCODE_DONT_CARE) {
   2042         BCM_IF_ERROR_RETURN(
   2043             soc_reg_field32_modify(unit, EFP_KEY4_MDL_SELECTORr, REG_PORT_ANY,
   2044                                 mdlfldtbl[slice_num], sel->egr_key4_mdl_sel));
   2045     }
   2046 
   2047     return (BCM_E_NONE);
   2048 }
   2049 
   2050 /*
   2051  * Function:
   2052  *     _bcm_field_hu2_selcodes_install
   2053  *
   2054  * Purpose:
   2055  *     Writes the field select codes (ie. FPFx).
   2056  *
   2057  * Parameters:
   2058  *     unit  - BCM device number
   2059  *     fs    - slice that needs its select codes written
   2060  *
   2061  * Returns:
   2062  *     BCM_E_INTERNAL - On read/write errors
   2063  *     BCM_E_NONE     - Success
   2064  *
   2065  * Note:
   2066  *     Unit lock should be held by calling function.
   2067  */
   2068 int
   2069 _bcm_field_hu2_selcodes_install(int unit, _field_group_t *fg,
   2070                                 uint8 slice_numb, bcm_pbmp_t pbmp,
   2071                                 int selcode_index)
   2072 {
   2073     int rv;    /* Operation return status. */
   2074 
   2075     /* Input parameters check. */
   2076     if (NULL == fg) {
   2077         return (BCM_E_PARAM);
   2078     }
   2079 
   2080     /* Set slice mode. Single/Double/Triple, Intraslice */
   2081     rv = _bcm_field_hu2_mode_set(unit, slice_numb, fg, fg->flags);
   2082     BCM_IF_ERROR_RETURN(rv);
   2083 
   2084     switch (fg->stage_id) {
   2085       case _BCM_FIELD_STAGE_INGRESS:
   2086           rv = _bcm_field_trx_ingress_selcodes_install(unit, fg, slice_numb,
   2087                                                        &pbmp, selcode_index);
   2088           break;
   2089       case _BCM_FIELD_STAGE_LOOKUP:
   2090           rv = _field_hu2_lookup_selcodes_install(unit, fg, slice_numb,
   2091                                                   selcode_index);
   2092           break;
   2093       case _BCM_FIELD_STAGE_EGRESS:
   2094           rv = _field_hu2_egress_selcodes_install(unit, fg, slice_numb,
   2095                                                   selcode_index);
   2096           break;
   2097       default:
   2098           return BCM_E_INTERNAL;
   2099     }
   2100     return (rv);
   2101 }
   2102 
   2103 /*
   2104  * Function:
   2105  *     _field_hu2_lookup_slice_clear
   2106  *
   2107  * Purpose:
   2108  *     Reset slice configuraton on group deletion event.
   2109  *
   2110  * Parameters:
   2111  *     unit  - BCM device number
   2112  *     fs    - slice that needs its select codes written
   2113  *
   2114  * Returns:
   2115  *     BCM_E_NONE     - Success
   2116  *
   2117  * Note:
   2118  *     Unit lock should be held by calling function.
   2119  */
   2120 STATIC int
   2121 _field_hu2_lookup_slice_clear(int unit, uint8 slice_numb)
   2122 {
   2123     uint32 reg_val;
   2124     SOC_IF_ERROR_RETURN(READ_VFP_KEY_CONTROLr(unit, &reg_val));
   2125     soc_reg_field_set(unit,
   2126                       VFP_KEY_CONTROLr,
   2127                       &reg_val,
   2128                       _bcm_field_hu2_vfp_field_sel[slice_numb][0],
   2129                       0
   2130                       );
   2131     soc_reg_field_set(unit,
   2132                       VFP_KEY_CONTROLr,
   2133                       &reg_val,
   2134                       _bcm_field_hu2_vfp_field_sel[slice_numb][1],
   2135                       0
   2136                       );
   2137     soc_reg_field_set(unit,
   2138                       VFP_KEY_CONTROLr,
   2139                       &reg_val,
   2140                       _bcm_field_hu2_slice_pairing_field[slice_numb / 2],
   2141                       0
   2142                       );
   2143     SOC_IF_ERROR_RETURN(WRITE_VFP_KEY_CONTROLr(unit, reg_val));
   2144 
   2145 
   2146     return (BCM_E_NONE);
   2147 }
   2148 
   2149 /*
   2150  * Function:
   2151  *     _bcm_field_hu2_slice_clear
   2152  *
   2153  * Purpose:
   2154  *     Clear slice configuration on group removal
   2155  *
   2156  * Parameters:
   2157  *     unit  - BCM device number
   2158  *     fg    - Field group slice belongs to
   2159  *     fs    - Field slice structure.
   2160  *
   2161  * Returns:
   2162  *     BCM_E_XXX
   2163  */
   2164 int
   2165 _bcm_field_hu2_slice_clear(int unit, _field_group_t *fg, _field_slice_t *fs)
   2166 {
   2167     int rv;
   2168 
   2169     switch (fs->stage_id) {
   2170       case _BCM_FIELD_STAGE_INGRESS:
   2171           rv = _bcm_field_trx_ingress_slice_clear(unit, fs->slice_number);
   2172           break;
   2173       case _BCM_FIELD_STAGE_LOOKUP:
   2174           rv = _field_hu2_lookup_slice_clear(unit, fs->slice_number);
   2175           break;
   2176       case _BCM_FIELD_STAGE_EGRESS:
   2177           rv = _bcm_field_trx_egress_slice_clear(unit, fs->slice_number);
   2178           break;
   2179       default:
   2180           rv = BCM_E_INTERNAL;
   2181     }
   2182     return (rv);
   2183 }
   2184 
   2185 
   2186 
   2187 /*
   2188  * Function:
   2189  *     _field_hu2_functions_init
   2190  *
   2191  * Purpose:
   2192  *     Set up functions pointers 
   2193  *
   2194  * Parameters:
   2195  *     stage_fc - (IN/OUT) pointers to stage control block whe the device 
   2196  *                         and stage specific functions will be registered.
   2197  *
   2198  * Returns:
   2199  *     nothing
   2200  * Notes:
   2201  */
   2202 STATIC void
   2203 _field_hu2_functions_init(_field_funct_t *functions)
   2204 {
   2205     functions->fp_detach               = _bcm_field_tr_detach;
   2206     functions->fp_group_install        = _bcm_field_fb_group_install;
   2207     functions->fp_selcodes_install     = _bcm_field_hu2_selcodes_install;
   2208     functions->fp_slice_clear          = _bcm_field_hu2_slice_clear;
   2209     functions->fp_entry_remove         = _bcm_field_fb_entry_remove;
   2210     functions->fp_entry_move           = _bcm_field_fb_entry_move;
   2211     functions->fp_selcode_get          = _bcm_field_tr_selcode_get;
   2212     functions->fp_selcode_to_qset      = _bcm_field_selcode_to_qset;
   2213     functions->fp_qual_list_get        = _bcm_field_qual_lists_get;
   2214     functions->fp_tcam_policy_clear    = NULL;
   2215     functions->fp_tcam_policy_install  = _bcm_field_tr_entry_install;
   2216     functions->fp_tcam_policy_reinstall  = _bcm_field_tr_entry_reinstall;
   2217     functions->fp_policer_install      = _bcm_field_trx_policer_install;
   2218     functions->fp_write_slice_map      = _bcm_field_hu2_write_slice_map;
   2219     functions->fp_qualify_ip_type      = _bcm_field_trx_qualify_ip_type;
   2220     functions->fp_qualify_ip_type_get  = _bcm_field_trx_qualify_ip_type_get;
   2221     functions->fp_action_support_check = _bcm_field_trx_action_support_check;
   2222     functions->fp_action_conflict_check = _bcm_field_trx_action_conflict_check;
   2223     functions->fp_counter_get          = _bcm_field_tr_counter_get;
   2224     functions->fp_counter_set          = _bcm_field_tr_counter_set;
   2225     functions->fp_stat_index_get       = _bcm_field_trx_stat_index_get;
   2226     functions->fp_action_params_check  = _bcm_field_trx_action_params_check;
   2227     functions->fp_egress_key_match_type_set = 
   2228         _bcm_field_trx_egress_key_match_type_set;
   2229     functions->fp_external_entry_install  = _bcm_field_tr_external_entry_install;
   2230     functions->fp_external_entry_reinstall  = _bcm_field_tr_external_entry_reinstall;
   2231     functions->fp_external_entry_remove   = _bcm_field_tr_external_entry_remove;
   2232     functions->fp_external_entry_prio_set = _bcm_field_tr_external_entry_prio_set;
   2233     functions->fp_data_qualifier_ethertype_add = 
   2234                        _bcm_field_fb_data_qualifier_ethertype_add;
   2235     functions->fp_data_qualifier_ethertype_delete= 
   2236                        _bcm_field_fb_data_qualifier_ethertype_delete;
   2237     functions->fp_data_qualifier_ip_protocol_add = 
   2238                        _bcm_field_fb_data_qualifier_ip_protocol_add;
   2239     functions->fp_data_qualifier_ip_protocol_delete= 
   2240                        _bcm_field_fb_data_qualifier_ip_protocol_delete;
   2241     functions->fp_data_qualifier_packet_format_add= 
   2242                        _bcm_field_fb_data_qualifier_packet_format_add;
   2243     functions->fp_data_qualifier_packet_format_delete=
   2244                        _bcm_field_fb_data_qualifier_packet_format_delete;
   2245     functions->fp_stat_value_get = NULL;
   2246     functions->fp_stat_value_set = NULL;
   2247     functions->fp_control_set = _bcm_field_control_set;
   2248     functions->fp_control_get = _bcm_field_control_get;
   2249     functions->fp_stat_hw_mode_get = _bcm_field_stat_hw_mode_get;
   2250     functions->fp_stat_hw_alloc = _bcm_field_stat_hw_alloc;
   2251     functions->fp_stat_hw_free = _bcm_field_stat_hw_free;
   2252     functions->fp_group_add = NULL;
   2253     functions->fp_qualify_trunk = _bcm_field_qualify_trunk;
   2254     functions->fp_qualify_trunk_get = _bcm_field_qualify_trunk_get;
   2255     functions->fp_qualify_inports = _bcm_field_qualify_InPorts;
   2256     functions->fp_entry_stat_extended_attach = NULL;
   2257     functions->fp_entry_stat_extended_get = NULL;
   2258     functions->fp_entry_stat_detach = _bcm_field_entry_stat_detach;
   2259     functions->fp_class_size_get = NULL;
   2260     functions->fp_qualify_packet_res = _field_qualify_PacketRes;
   2261     functions->fp_qualify_packet_res_get = _field_qualify_PacketRes_get;
   2262 }
   2263 #else /* BCM_HURRICANE2_SUPPORT && BCM_FIELD_SUPPORT */
   2264 int _hurricane2_field_not_empty;
   2265 #endif  /* BCM_HURRICANE2_SUPPORT && BCM_FIELD_SUPPORT */