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


      1 /* 
      2  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      3  * 
      4  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      5  *
      6  * File:        field.c
      7  * Purpose:     BCM56840 Field Processor installation functions.
      8  */
      9    
     10 #include <soc/defs.h>
     11 #if defined(BCM_TRIDENT_SUPPORT) && defined(BCM_FIELD_SUPPORT)
     12 
     13 #include <soc/mem.h>
     14 #include <soc/drv.h>
     15 #include <soc/counter.h>
     16 #include <bcm/error.h>
     17 #include <bcm/l3.h>
     18 #include <bcm/field.h>
     19 #include <bcm/tunnel.h>
     20 
     21 #include <bcm_int/esw_dispatch.h>
     22 
     23 #include <bcm_int/esw/field.h>
     24 #include <bcm_int/esw/l3.h>
     25 #include <bcm_int/esw/firebolt.h>
     26 #include <bcm_int/esw/trx.h>
     27 #include <bcm_int/esw/triumph.h>
     28 #include <bcm_int/esw/trident.h>
     29 
     30 /* local/static function prototypes */
     31 STATIC void _field_trident_functions_init(_field_funct_t *functions) ;
     32 
     33 static uint32        flush_ser_event_count[SOC_MAX_NUM_DEVICES][2];
     34 
     35 /*
     36  * Function:
     37  *     _field_trident_ingress_qualifiers_init
     38  * Purpose:
     39  *     Initialize device stage ingress qualifiers 
     40  *     select codes & offsets
     41  * Parameters:
     42  *     unit       - (IN) BCM device number.
     43  *     stage_fc   - (IN) Field Processor stage control structure. 
     44  *
     45  * Returns:
     46  *     BCM_E_NONE
     47  */
     48 STATIC int
     49 _field_trident_ingress_qualifiers_init(int unit, _field_stage_t *stage_fc)
     50 {
     51     int f1_offset;
     52     int f2_offset;
     53     int f3_offset;
     54     int fixed_offset;
     55     int fixed_pairing_overlay_offset;
     56     int ipbm_pairing_overlay_offset;
     57 
     58     _FP_QUAL_DECL;
     59 
     60     /* Input parameters check. */
     61     if (NULL == stage_fc) {
     62         return (BCM_E_PARAM);
     63     }
     64 
     65     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStage,
     66                  _bcmFieldSliceSelDisable, 0, 0, 0);
     67     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageIngress,
     68                  _bcmFieldSliceSelDisable, 0, 0, 0);
     69     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
     70                  _bcmFieldSliceSelDisable, 0, 0, 0);
     71     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
     72                  _bcmFieldSliceSelDisable, 0, 0, 0);
     73     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
     74                  _bcmFieldSliceSelDisable, 0, 0, 0);
     75     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPorts,
     76                  _bcmFieldSliceSelDisable, 0, 0, 0);
     77 
     78     /* FPF3 single wide. */
     79     f3_offset = 7;
     80     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
     81                                _bcmFieldSliceSelFpf3, 0,
     82                                _bcmFieldSliceDstClassSelect, 0, f3_offset, 6);
     83     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
     84                                _bcmFieldSliceSelFpf3, 0,
     85                                _bcmFieldSliceDstClassSelect, 1, f3_offset, 6);
     86     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
     87                                _bcmFieldSliceSelFpf3, 0,
     88                                _bcmFieldSliceDstClassSelect, 2, f3_offset, 6);
     89     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
     90                                _bcmFieldSliceSelFpf3, 0,
     91                                _bcmFieldSliceDstClassSelect, 3, f3_offset, 6);
     92     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
     93                                _bcmFieldSliceSelFpf3, 0,
     94                                _bcmFieldSliceSrcClassSelect, 0, f3_offset + 6, 6);
     95     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
     96                                _bcmFieldSliceSelFpf3, 0,
     97                                _bcmFieldSliceSrcClassSelect, 1, f3_offset + 6, 6);
     98     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
     99                                _bcmFieldSliceSelFpf3, 0,
    100                                _bcmFieldSliceSrcClassSelect, 2, f3_offset + 6, 6);
    101     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    102                                _bcmFieldSliceSelFpf3, 0,
    103                                _bcmFieldSliceSrcClassSelect, 3, f3_offset + 6, 6);
    104     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    105                                _bcmFieldSliceSelFpf3, 0,
    106                                _bcmFieldSliceFwdFieldSelect, 
    107                                _bcmFieldFwdFieldVrf, f3_offset + 12, 12);
    108     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    109                                _bcmFieldSliceSelFpf3, 0,
    110                                _bcmFieldSliceFwdFieldSelect,
    111                                _bcmFieldFwdFieldVpn, f3_offset + 12, 12);
    112     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
    113                                _bcmFieldSliceSelFpf3, 0,
    114                                _bcmFieldSliceFwdFieldSelect, 
    115                                _bcmFieldFwdFieldVlan, f3_offset + 12, 12);
    116     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    117                                _bcmFieldSliceSelFpf3, 0,
    118                                _bcmFieldSliceIngressEntitySelect,
    119                                _bcmFieldFwdEntityMplsGport, f3_offset + 24, 13);
    120     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    121                                _bcmFieldSliceSelFpf3, 0,
    122                                _bcmFieldSliceIngressEntitySelect,
    123                                _bcmFieldFwdEntityVlanGport, f3_offset + 24, 13);
    124     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    125                                _bcmFieldSliceSelFpf3, 0,
    126                                _bcmFieldSliceIngressEntitySelect,
    127                                _bcmFieldFwdEntityMimGport, f3_offset + 24, 13);
    128     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress,
    129                                _bcmFieldSliceSelFpf3, 0,
    130                                _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress,
    131                                f3_offset + 24, 13);
    132     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    133                                _bcmFieldSliceSelFpf3, 1,
    134                                _bcmFieldSliceDstClassSelect, 0, f3_offset, 6);
    135     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    136                                _bcmFieldSliceSelFpf3, 1,
    137                                _bcmFieldSliceDstClassSelect, 1, f3_offset, 6);
    138     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    139                                _bcmFieldSliceSelFpf3, 1,
    140                                _bcmFieldSliceDstClassSelect, 2, f3_offset, 6);
    141     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    142                                _bcmFieldSliceSelFpf3, 1,
    143                                _bcmFieldSliceDstClassSelect, 3, f3_offset, 6);
    144     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    145                                _bcmFieldSliceSelFpf3, 1,
    146                                _bcmFieldSliceSrcClassSelect, 0, f3_offset + 6, 6);
    147     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    148                                _bcmFieldSliceSelFpf3, 1,
    149                                _bcmFieldSliceSrcClassSelect, 1, f3_offset + 6, 6);
    150     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    151                                _bcmFieldSliceSelFpf3, 1,
    152                                _bcmFieldSliceSrcClassSelect, 2, f3_offset + 6, 6);
    153     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    154                                _bcmFieldSliceSelFpf3, 1,
    155                                _bcmFieldSliceSrcClassSelect, 3, f3_offset + 6, 6);
    156     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    157                                _bcmFieldSliceSelFpf3, 1,
    158                                _bcmFieldSliceFwdFieldSelect, 
    159                                _bcmFieldFwdFieldVrf, f3_offset + 12, 12);
    160     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    161                                _bcmFieldSliceSelFpf3, 1,
    162                                _bcmFieldSliceFwdFieldSelect,
    163                                _bcmFieldFwdFieldVpn, f3_offset + 12, 12);
    164     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
    165                                _bcmFieldSliceSelFpf3, 1,
    166                                _bcmFieldSliceFwdFieldSelect, 
    167                                _bcmFieldFwdFieldVlan, f3_offset + 12, 12);
    168     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    169                  _bcmFieldSliceSelFpf3, 1, f3_offset + 24, 12);
    170 
    171     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    172                                _bcmFieldSliceSelFpf3, 2,
    173                                _bcmFieldSliceDstFwdEntitySelect,
    174                                _bcmFieldFwdEntityGlp, f3_offset, 19);
    175     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    176                                _bcmFieldSliceSelFpf3, 2,
    177                                _bcmFieldSliceDstFwdEntitySelect,
    178                                _bcmFieldFwdEntityCommonGport, f3_offset, 19);
    179     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    180                                _bcmFieldSliceSelFpf3, 2,
    181                                _bcmFieldSliceDstFwdEntitySelect,
    182                                _bcmFieldFwdEntityGlp, f3_offset, 19);
    183     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    184                                _bcmFieldSliceSelFpf3, 2,
    185                                _bcmFieldSliceDstFwdEntitySelect,
    186                                _bcmFieldFwdEntityMplsGport, f3_offset, 19);
    187     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    188                                _bcmFieldSliceSelFpf3, 2,
    189                                _bcmFieldSliceDstFwdEntitySelect,
    190                                _bcmFieldFwdEntityVlanGport, f3_offset, 19);
    191     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    192                                _bcmFieldSliceSelFpf3, 2,
    193                                _bcmFieldSliceDstFwdEntitySelect,
    194                                _bcmFieldFwdEntityMimGport, f3_offset, 19);
    195     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
    196                                _bcmFieldSliceSelFpf3, 2,
    197                                _bcmFieldSliceDstFwdEntitySelect,
    198                                _bcmFieldFwdEntityL3Egress, f3_offset, 19);
    199     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
    200                                _bcmFieldSliceSelFpf3, 2,
    201                                _bcmFieldSliceDstFwdEntitySelect,
    202                                _bcmFieldFwdEntityL3Egress, f3_offset, 19);
    203     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    204                                _bcmFieldSliceSelFpf3, 2,
    205                                _bcmFieldSliceDstFwdEntitySelect,
    206                                _bcmFieldFwdEntityMulticastGroup, f3_offset, 19);
    207     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
    208                                _bcmFieldSliceSelFpf3, 2,
    209                                _bcmFieldSliceDstFwdEntitySelect,
    210                                _bcmFieldFwdEntityMultipath, f3_offset, 19);
    211     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    212                                _bcmFieldSliceSelFpf3, 2,
    213                                _bcmFieldSliceSrcEntitySelect,
    214                                _bcmFieldFwdEntityGlp, f3_offset + 19, 17);
    215     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    216                                _bcmFieldSliceSelFpf3, 2,
    217                                _bcmFieldSliceSrcEntitySelect,
    218                                _bcmFieldFwdEntityGlp, f3_offset + 19, 17);
    219     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    220                                _bcmFieldSliceSelFpf3, 2,
    221                                 _bcmFieldSliceSrcEntitySelect,
    222                                _bcmFieldFwdEntityMplsGport, f3_offset + 19, 17);
    223     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    224                                _bcmFieldSliceSelFpf3, 2,
    225                                 _bcmFieldSliceSrcEntitySelect,
    226                                _bcmFieldFwdEntityVlanGport, f3_offset + 19, 17);
    227     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    228                                _bcmFieldSliceSelFpf3, 2,
    229                                _bcmFieldSliceSrcEntitySelect,
    230                                _bcmFieldFwdEntityMimGport, f3_offset + 19, 17);
    231     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    232                                _bcmFieldSliceSelFpf3, 2,
    233                                _bcmFieldSliceSrcEntitySelect,
    234                                _bcmFieldFwdEntityModPortGport, f3_offset + 19, 17);
    235     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport,
    236                                _bcmFieldSliceSelFpf3, 2,
    237                                _bcmFieldSliceSrcEntitySelect,
    238                                _bcmFieldFwdEntityModPortGport, f3_offset + 19, 17);
    239     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    240                                _bcmFieldSliceSelFpf3, 2,
    241                                _bcmFieldSliceSrcEntitySelect,
    242                                _bcmFieldFwdEntityModPortGport, f3_offset + 26, 10);
    243     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
    244                                _bcmFieldSliceSelFpf3, 2,
    245                                _bcmFieldSliceSrcEntitySelect,
    246                                _bcmFieldFwdEntityModPortGport, f3_offset + 26, 8);
    247     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
    248                                _bcmFieldSliceSelFpf3, 2,
    249                                 _bcmFieldSliceSrcEntitySelect,
    250                                _bcmFieldFwdEntityCommonGport, f3_offset + 19, 17);
    251     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
    252                  _bcmFieldSliceSelFpf3, 2, f3_offset + 35, 1);
    253     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    254                  _bcmFieldSliceSelFpf3, 2, f3_offset + 36, 3);
    255 
    256     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    257                  _bcmFieldSliceSelFpf3, 3, f3_offset, 16);
    258     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    259                  _bcmFieldSliceSelFpf3, 3, f3_offset, 12);
    260     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    261                  _bcmFieldSliceSelFpf3, 3, f3_offset + 12, 1);
    262     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    263                  _bcmFieldSliceSelFpf3, 3, f3_offset + 13, 3);
    264     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    265                  _bcmFieldSliceSelFpf3, 3, f3_offset + 16, 2);
    266     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    267                  _bcmFieldSliceSelFpf3, 3, f3_offset + 18, 2);
    268     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    269                  _bcmFieldSliceSelFpf3, 3, f3_offset + 20, 2);
    270     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    271                  _bcmFieldSliceSelFpf3, 3, f3_offset + 22, 3);
    272     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
    273                  _bcmFieldSliceSelFpf3, 3, f3_offset + 25, 5);
    274     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
    275                  _bcmFieldSliceSelFpf3, 3, f3_offset + 30, 3);
    276     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter,
    277                  _bcmFieldSliceSelFpf3, 3, f3_offset + 33, 3);
    278     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner,
    279                  _bcmFieldSliceSelFpf3, 3, f3_offset + 36, 3);
    280 
    281     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    282                  _bcmFieldSliceSelFpf3, 4, f3_offset, 16);
    283     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    284                  _bcmFieldSliceSelFpf3, 4, f3_offset, 12);
    285     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    286                  _bcmFieldSliceSelFpf3, 4, f3_offset + 12, 1);
    287     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    288                  _bcmFieldSliceSelFpf3, 4, f3_offset + 13, 3);
    289     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    290                  _bcmFieldSliceSelFpf3, 4, f3_offset + 16, 16);
    291     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    292                  _bcmFieldSliceSelFpf3, 4, f3_offset + 16, 12);
    293     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    294                  _bcmFieldSliceSelFpf3, 4, f3_offset + 28, 1);
    295     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    296                  _bcmFieldSliceSelFpf3, 4, f3_offset + 29, 3);
    297 
    298     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    299                  _bcmFieldSliceSelFpf3, 5, f3_offset, 16);
    300     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    301                  _bcmFieldSliceSelFpf3, 5, f3_offset, 12);
    302     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    303                  _bcmFieldSliceSelFpf3, 5, f3_offset + 12, 1);
    304     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    305                  _bcmFieldSliceSelFpf3, 5, f3_offset + 13, 3);
    306     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    307                  _bcmFieldSliceSelFpf3, 5, f3_offset + 16, 16);
    308     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter,
    309                  _bcmFieldSliceSelFpf3, 5, f3_offset + 32, 3);
    310     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner,
    311                  _bcmFieldSliceSelFpf3, 5, f3_offset + 35, 3);
    312 
    313     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
    314                  _bcmFieldSliceSelFpf3, 6, f3_offset, 1);
    315     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
    316                  _bcmFieldSliceSelFpf3, 6, f3_offset + 1, 1);
    317     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
    318                  _bcmFieldSliceSelFpf3, 6, f3_offset + 2, 1);
    319     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
    320                  _bcmFieldSliceSelFpf3, 6, f3_offset + 3, 2);
    321     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
    322                  _bcmFieldSliceSelFpf3, 6, f3_offset + 5, 1);
    323     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
    324                  _bcmFieldSliceSelFpf3, 6, f3_offset + 6, 1);
    325     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
    326                  _bcmFieldSliceSelFpf3, 6, f3_offset + 7, 1);
    327     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
    328                  _bcmFieldSliceSelFpf3, 6, f3_offset + 9, 1);
    329     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
    330                  _bcmFieldSliceSelFpf3, 6, f3_offset + 10, 1);
    331     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
    332                  _bcmFieldSliceSelFpf3, 6, f3_offset + 11, 1);
    333     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
    334                  _bcmFieldSliceSelFpf3, 6, f3_offset + 12, 1);
    335     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
    336                  _bcmFieldSliceSelFpf3, 6, f3_offset + 13, 1);
    337     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
    338                  _bcmFieldSliceSelFpf3, 6, f3_offset + 14, 1);
    339     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
    340                  _bcmFieldSliceSelFpf3, 6, f3_offset + 15, 1);
    341     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    342                  _bcmFieldSliceSelFpf3, 6, f3_offset + 16, 16);
    343     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    344                  _bcmFieldSliceSelFpf3, 6, f3_offset + 16, 12);
    345     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    346                  _bcmFieldSliceSelFpf3, 6, f3_offset + 28, 1);
    347     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    348                  _bcmFieldSliceSelFpf3, 6, f3_offset + 29, 3);
    349 
    350     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyRangeCheck,
    351                  _bcmFieldSliceSelFpf3, 7, f3_offset, 24);
    352     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, _bcmFieldQualifyRangeCheckBits24_31,
    353                                _bcmFieldSliceSelFpf3, 7,
    354                                _bcmFieldSliceIntfClassSelect, 3, f3_offset + 24, 8);
    355     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
    356                                _bcmFieldSliceSelFpf3, 7,
    357                                _bcmFieldSliceIntfClassSelect, 0, f3_offset + 24, 8);
    358     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassVPort,
    359                                _bcmFieldSliceSelFpf3, 7,
    360                                _bcmFieldSliceIntfClassSelect, 1, f3_offset + 24, 8);
    361     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
    362                                _bcmFieldSliceSelFpf3, 7,
    363                                _bcmFieldSliceIntfClassSelect, 1, f3_offset + 24, 8);
    364     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL2,
    365                                _bcmFieldSliceSelFpf3, 7,
    366                                _bcmFieldSliceIntfClassSelect, 2, f3_offset + 24, 8);
    367 
    368     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel,
    369                  _bcmFieldSliceSelFpf3, 8, f3_offset, 20);
    370     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    371                  _bcmFieldSliceSelFpf3, 8, f3_offset + 20, 2);
    372     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    373                  _bcmFieldSliceSelFpf3, 8, f3_offset + 22, 2);
    374     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
    375                  _bcmFieldSliceSelFpf3, 8, f3_offset + 24, 2);
    376     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
    377                  _bcmFieldSliceSelFpf3, 8, f3_offset + 26, 2);
    378     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
    379                  _bcmFieldSliceSelFpf3, 8, f3_offset + 28, 2);
    380 
    381     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData3,
    382                  _bcmFieldSliceSelFpf3, 9, f3_offset, 32);
    383 
    384     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    385                                _bcmFieldSliceSelFpf3, 10,
    386                                _bcmFieldSliceDstFwdEntitySelect,
    387                                _bcmFieldFwdEntityGlp, f3_offset, 19);
    388     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    389                                _bcmFieldSliceSelFpf3, 10,
    390                                _bcmFieldSliceDstFwdEntitySelect,
    391                                _bcmFieldFwdEntityCommonGport, f3_offset, 19);
    392     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    393                                _bcmFieldSliceSelFpf3, 10,
    394                                _bcmFieldSliceDstFwdEntitySelect,
    395                                _bcmFieldFwdEntityGlp, f3_offset, 19);
    396     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    397                                _bcmFieldSliceSelFpf3, 10,
    398                                _bcmFieldSliceDstFwdEntitySelect,
    399                                _bcmFieldFwdEntityMplsGport, f3_offset, 19);
    400     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    401                                _bcmFieldSliceSelFpf3, 10,
    402                                _bcmFieldSliceDstFwdEntitySelect,
    403                                _bcmFieldFwdEntityVlanGport, f3_offset, 19);
    404     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    405                                _bcmFieldSliceSelFpf3, 10,
    406                                _bcmFieldSliceDstFwdEntitySelect,
    407                                _bcmFieldFwdEntityMimGport, f3_offset, 19);
    408     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
    409                                _bcmFieldSliceSelFpf3, 10,
    410                                _bcmFieldSliceDstFwdEntitySelect,
    411                                _bcmFieldFwdEntityL3Egress, f3_offset, 19);
    412     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
    413                                _bcmFieldSliceSelFpf3, 10,
    414                                _bcmFieldSliceDstFwdEntitySelect,
    415                                _bcmFieldFwdEntityL3Egress, f3_offset, 19);
    416     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    417                                _bcmFieldSliceSelFpf3, 10,
    418                                _bcmFieldSliceDstFwdEntitySelect,
    419                                _bcmFieldFwdEntityMulticastGroup, f3_offset, 19);
    420     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
    421                                _bcmFieldSliceSelFpf3, 10,
    422                                _bcmFieldSliceDstFwdEntitySelect,
    423                                _bcmFieldFwdEntityMultipath, f3_offset, 19);
    424     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    425                  _bcmFieldSliceSelFpf3, 10, f3_offset + 19, 16);
    426     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    427                  _bcmFieldSliceSelFpf3, 10, f3_offset + 19, 16);
    428 
    429     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    430                  _bcmFieldSliceSelFpf3, 11, f3_offset, 16);
    431     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    432                  _bcmFieldSliceSelFpf3, 11, f3_offset, 16);
    433     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    434                  _bcmFieldSliceSelFpf3, 11, f3_offset, 16);
    435     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    436                  _bcmFieldSliceSelFpf3, 11, f3_offset + 7, 9);
    437     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    438                  _bcmFieldSliceSelFpf3, 11, f3_offset + 16, 14);
    439     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    440                  _bcmFieldSliceSelFpf3, 11, f3_offset + 16, 14);
    441     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    442                  _bcmFieldSliceSelFpf3, 11, f3_offset + 16, 14);
    443     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
    444                  _bcmFieldSliceSelFpf3, 11, f3_offset + 29, 1);
    445 
    446     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag,
    447                                _bcmFieldSliceSelFpf3, 12,
    448                                _bcmFieldSliceAuxTag2Select,
    449                                _bcmFieldAuxTagVn, f3_offset, 33);
    450     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag,
    451                                _bcmFieldSliceSelFpf3, 12,
    452                                _bcmFieldSliceAuxTag2Select,
    453                                _bcmFieldAuxTagCn, f3_offset, 33);
    454     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag,
    455                                _bcmFieldSliceSelFpf3, 12,
    456                                _bcmFieldSliceAuxTag2Select,
    457                                _bcmFieldAuxTagFabricQueue, f3_offset, 33);
    458 
    459     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    460                  _bcmFieldSliceSelFpf3, 13,
    461                  _bcmFieldSliceTosClassSelect, 0,
    462                  f3_offset, 8);
    463     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    464                  _bcmFieldSliceSelFpf3, 13,
    465                  _bcmFieldSliceTosClassSelect, 0,
    466                  f3_offset, 8);
    467     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    468                  _bcmFieldSliceSelFpf3, 13,
    469                  _bcmFieldSliceTosClassSelect, 1,
    470                  f3_offset, 8);
    471     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeader2Type,
    472                  _bcmFieldSliceSelFpf3, 13, f3_offset + 8, 8);
    473     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
    474                  _bcmFieldSliceSelFpf3, 13, f3_offset + 16, 8);
    475     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
    476                  _bcmFieldSliceSelFpf3, 13, f3_offset + 24, 8);
    477 
    478     /* FPF2  single wide */
    479     f2_offset = 46;
    480     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    481                  _bcmFieldSliceSelFpf2, 0,
    482                  _bcmFieldSliceTtlClassSelect, 0,
    483                  f2_offset, 8);
    484     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    485                  _bcmFieldSliceSelFpf2, 0,
    486                  _bcmFieldSliceTtlClassSelect, 0,
    487                  f2_offset, 8);
    488     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    489                  _bcmFieldSliceSelFpf2, 0,
    490                  _bcmFieldSliceTtlClassSelect, 1,
    491                  f2_offset, 8);
    492     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    493                  _bcmFieldSliceSelFpf2, 0,
    494                  _bcmFieldSliceTcpClassSelect, 0,
    495                  f2_offset + 8, 6);
    496     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    497                  _bcmFieldSliceSelFpf2, 0,
    498                  _bcmFieldSliceTcpClassSelect, 0,
    499                  f2_offset + 8, 6);
    500     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    501                  _bcmFieldSliceSelFpf2, 0,
    502                  _bcmFieldSliceTcpClassSelect, 1,
    503                  f2_offset + 8, 6);
    504     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFlags,
    505                  _bcmFieldSliceSelFpf2, 0, f2_offset + 14, 2);
    506     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    507                  _bcmFieldSliceSelFpf2, 0,
    508                  _bcmFieldSliceTosClassSelect, 0,
    509                  f2_offset + 16, 8);
    510     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    511                  _bcmFieldSliceSelFpf2, 0,
    512                  _bcmFieldSliceTosClassSelect, 0,
    513                  f2_offset + 16, 8);
    514     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    515                  _bcmFieldSliceSelFpf2, 0,
    516                  _bcmFieldSliceTosClassSelect, 1,
    517                  f2_offset + 16, 8);
    518     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
    519                  _bcmFieldSliceSelFpf2, 0, f2_offset + 24, 16);
    520     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
    521                  _bcmFieldSliceSelFpf2, 0, f2_offset + 40, 16);
    522     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
    523                  _bcmFieldSliceSelFpf2, 0, f2_offset + 40, 16);
    524     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    525                  _bcmFieldSliceSelFpf2, 0, f2_offset + 56, 8);
    526     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    527                  _bcmFieldSliceSelFpf2, 0, f2_offset + 64, 32);
    528     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    529                  _bcmFieldSliceSelFpf2, 0, f2_offset + 96, 32);
    530 
    531     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    532                  _bcmFieldSliceSelFpf2, 1,
    533                  _bcmFieldSliceTtlClassSelect, 0,
    534                  f2_offset, 8);
    535     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    536                  _bcmFieldSliceSelFpf2, 1,
    537                  _bcmFieldSliceTtlClassSelect, 0,
    538                  f2_offset, 8);
    539     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    540                  _bcmFieldSliceSelFpf2, 1,
    541                  _bcmFieldSliceTtlClassSelect, 1,
    542                  f2_offset, 8);
    543     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    544                  _bcmFieldSliceSelFpf2, 1,
    545                  _bcmFieldSliceTcpClassSelect, 0,
    546                  f2_offset + 8, 6);
    547     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    548                  _bcmFieldSliceSelFpf2, 1,
    549                  _bcmFieldSliceTcpClassSelect, 0,
    550                  f2_offset + 8, 6);
    551     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    552                  _bcmFieldSliceSelFpf2, 1,
    553                  _bcmFieldSliceTcpClassSelect, 1,
    554                  f2_offset + 8, 6);
    555     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
    556                  _bcmFieldSliceSelFpf2, 1, f2_offset + 14, 2);
    557     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    558                  _bcmFieldSliceSelFpf2, 1,
    559                  _bcmFieldSliceTosClassSelect, 0,
    560                  f2_offset + 16, 8);
    561     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    562                  _bcmFieldSliceSelFpf2, 1,
    563                  _bcmFieldSliceTosClassSelect, 0,
    564                  f2_offset + 16, 8);
    565     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    566                  _bcmFieldSliceSelFpf2, 1,
    567                  _bcmFieldSliceTosClassSelect, 1,
    568                  f2_offset + 16, 8);
    569     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
    570                  _bcmFieldSliceSelFpf2, 1, f2_offset + 24, 16);
    571     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
    572                  _bcmFieldSliceSelFpf2, 1, f2_offset + 40, 16);
    573     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
    574                  _bcmFieldSliceSelFpf2, 1, f2_offset + 40, 16);
    575     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    576                  _bcmFieldSliceSelFpf2, 1, f2_offset + 56, 8);
    577     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    578                  _bcmFieldSliceSelFpf2, 1, f2_offset + 64, 32);
    579     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    580                  _bcmFieldSliceSelFpf2, 1, f2_offset + 96, 32);
    581 
    582     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
    583                  _bcmFieldSliceSelFpf2, 2, f2_offset, 128);
    584 
    585     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
    586                  _bcmFieldSliceSelFpf2, 3, f2_offset, 128);
    587 
    588     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    589                  _bcmFieldSliceSelFpf2, 4,
    590                  _bcmFieldSliceTtlClassSelect, 0,
    591                  f2_offset, 8);
    592     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    593                  _bcmFieldSliceSelFpf2, 4,
    594                  _bcmFieldSliceTtlClassSelect, 0,
    595                  f2_offset, 8);
    596     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    597                  _bcmFieldSliceSelFpf2, 4,
    598                  _bcmFieldSliceTtlClassSelect, 1,
    599                  f2_offset, 8);
    600     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
    601                  _bcmFieldSliceSelFpf2, 4,
    602                  _bcmFieldSliceTcpClassSelect, 0,
    603                  f2_offset + 8, 6);
    604     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
    605                  _bcmFieldSliceSelFpf2, 4,
    606                  _bcmFieldSliceTcpClassSelect, 0,
    607                  f2_offset + 8, 6);
    608     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
    609                  _bcmFieldSliceSelFpf2, 4,
    610                  _bcmFieldSliceTcpClassSelect, 1,
    611                  f2_offset + 8, 6);
    612     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6FlowLabel,
    613                  _bcmFieldSliceSelFpf2, 4, f2_offset + 14, 20);
    614     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
    615                  _bcmFieldSliceSelFpf2, 4,
    616                  _bcmFieldSliceTosClassSelect, 0,
    617                  f2_offset + 34, 8);
    618     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
    619                  _bcmFieldSliceSelFpf2, 4,
    620                  _bcmFieldSliceTosClassSelect, 0,
    621                  f2_offset + 34, 8);
    622     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
    623                  _bcmFieldSliceSelFpf2, 4,
    624                  _bcmFieldSliceTosClassSelect, 1,
    625                  f2_offset + 34, 8);
    626     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    627                  _bcmFieldSliceSelFpf2, 4, f2_offset + 42, 8);
    628     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
    629                  _bcmFieldSliceSelFpf2, 4, f2_offset + 64, 64);
    630 
    631     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    632                  _bcmFieldSliceSelFpf2, 5, f2_offset, 16);
    633     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    634                  _bcmFieldSliceSelFpf2, 5, f2_offset, 12);
    635     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    636                  _bcmFieldSliceSelFpf2, 5, f2_offset + 12, 1);
    637     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    638                  _bcmFieldSliceSelFpf2, 5, f2_offset + 13, 3);
    639     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    640                  _bcmFieldSliceSelFpf2, 5, f2_offset + 16, 16);
    641     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    642                  _bcmFieldSliceSelFpf2, 5, f2_offset + 32, 48);
    643     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    644                  _bcmFieldSliceSelFpf2, 5, f2_offset + 80, 48);
    645 
    646     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    647                  _bcmFieldSliceSelFpf2, 6, f2_offset, 16);
    648     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    649                  _bcmFieldSliceSelFpf2, 6, f2_offset, 12);
    650     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    651                  _bcmFieldSliceSelFpf2, 6, f2_offset + 12, 1);
    652     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    653                  _bcmFieldSliceSelFpf2, 6, f2_offset + 13, 3);
    654     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    655                  _bcmFieldSliceSelFpf2, 6, f2_offset + 16, 16);
    656     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    657                  _bcmFieldSliceSelFpf2, 6, f2_offset + 32, 48);
    658     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
    659                  _bcmFieldSliceSelFpf2, 6, f2_offset + 80, 32);
    660 
    661     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    662                  _bcmFieldSliceSelFpf2, 7, f2_offset, 16);
    663     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    664                  _bcmFieldSliceSelFpf2, 7, f2_offset, 12);
    665     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    666                  _bcmFieldSliceSelFpf2, 7, f2_offset + 12, 1);
    667     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    668                  _bcmFieldSliceSelFpf2, 7, f2_offset + 13, 3);
    669     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    670                  _bcmFieldSliceSelFpf2, 7, f2_offset + 16, 16);
    671     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
    672                  _bcmFieldSliceSelFpf2, 7,
    673                  _bcmFieldSliceTtlClassSelect, 0,
    674                  f2_offset + 32, 8);
    675     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
    676                  _bcmFieldSliceSelFpf2, 7,
    677                  _bcmFieldSliceTtlClassSelect, 0,
    678                  f2_offset + 32, 8);
    679     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
    680                  _bcmFieldSliceSelFpf2, 7,
    681                  _bcmFieldSliceTtlClassSelect, 1,
    682                  f2_offset + 32, 8);
    683     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
    684                  _bcmFieldSliceSelFpf2, 7, f2_offset + 40, 8);
    685     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
    686                  _bcmFieldSliceSelFpf2, 7, f2_offset + 48, 32);
    687     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    688                  _bcmFieldSliceSelFpf2, 7, f2_offset + 80, 48);
    689 
    690     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData0,
    691                  _bcmFieldSliceSelFpf2, 8, f2_offset, 128);
    692 
    693     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData1,
    694                  _bcmFieldSliceSelFpf2, 9, f2_offset, 128);
    695 
    696     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
    697                  _bcmFieldSliceSelFpf2, 10, f2_offset, 64);
    698     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
    699                  _bcmFieldSliceSelFpf2, 10, f2_offset + 64, 64);
    700 
    701     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
    702                  _bcmFieldSliceSelFpf2, 11, f2_offset + 32, 48);
    703     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
    704                  _bcmFieldSliceSelFpf2, 11, f2_offset + 80, 48);
    705 
    706     /* FPF1 single wide */ 
    707     f1_offset = 174;
    708     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    709                                _bcmFieldSliceSelFpf1, 0,
    710                                _bcmFieldSliceDstClassSelect, 0, f1_offset, 6);
    711     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    712                                _bcmFieldSliceSelFpf1, 0,
    713                                _bcmFieldSliceDstClassSelect, 1, f1_offset, 6);
    714     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    715                                _bcmFieldSliceSelFpf1, 0,
    716                                _bcmFieldSliceDstClassSelect, 2, f1_offset, 6);
    717     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    718                                _bcmFieldSliceSelFpf1, 0,
    719                                _bcmFieldSliceDstClassSelect, 3, f1_offset, 6);
    720     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    721                                _bcmFieldSliceSelFpf1, 0,
    722                                _bcmFieldSliceSrcClassSelect, 0, f1_offset + 6, 6);
    723     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    724                                _bcmFieldSliceSelFpf1, 0,
    725                                _bcmFieldSliceSrcClassSelect, 1, f1_offset + 6, 6);
    726     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    727                                _bcmFieldSliceSelFpf1, 0,
    728                                _bcmFieldSliceSrcClassSelect, 2, f1_offset + 6, 6);
    729     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    730                                _bcmFieldSliceSelFpf1, 0,
    731                                _bcmFieldSliceSrcClassSelect, 3, f1_offset + 6, 6);
    732     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
    733                                _bcmFieldSliceSelFpf1, 0,
    734                                _bcmFieldSliceFwdFieldSelect, 
    735                                _bcmFieldFwdFieldVrf, f1_offset + 12, 12);
    736     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
    737                                _bcmFieldSliceSelFpf1, 0,
    738                                _bcmFieldSliceFwdFieldSelect, 
    739                                _bcmFieldFwdFieldVpn, f1_offset + 12, 12);
    740     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanId,
    741                                _bcmFieldSliceSelFpf1, 0,
    742                                _bcmFieldSliceFwdFieldSelect, 
    743                                _bcmFieldFwdFieldVlan, f1_offset + 12, 12);
    744     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    745                                _bcmFieldSliceSelFpf1, 0,
    746                                _bcmFieldSliceIngressEntitySelect,
    747                                _bcmFieldFwdEntityMplsGport, f1_offset + 24, 13);
    748     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    749                                _bcmFieldSliceSelFpf1, 0,
    750                                _bcmFieldSliceIngressEntitySelect,
    751                                _bcmFieldFwdEntityMimGport, f1_offset + 24, 13);
    752     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    753                                _bcmFieldSliceSelFpf1, 0,
    754                                _bcmFieldSliceIngressEntitySelect,
    755                                _bcmFieldFwdEntityVlanGport, f1_offset + 24, 13);
    756     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL3Ingress,
    757                                _bcmFieldSliceSelFpf1, 0,
    758                                _bcmFieldSliceIngressEntitySelect, _bcmFieldFwdEntityL3Egress,
    759                                f1_offset + 24, 13);
    760 
    761     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    762                                _bcmFieldSliceSelFpf1, 1,
    763                                _bcmFieldSliceDstFwdEntitySelect,
    764                                _bcmFieldFwdEntityGlp, f1_offset, 19);
    765     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    766                                _bcmFieldSliceSelFpf1, 1,
    767                                _bcmFieldSliceDstFwdEntitySelect,
    768                                _bcmFieldFwdEntityCommonGport, f1_offset, 19);
    769     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    770                                _bcmFieldSliceSelFpf1, 1,
    771                                _bcmFieldSliceDstFwdEntitySelect,
    772                                _bcmFieldFwdEntityGlp, f1_offset, 19);
    773     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    774                                _bcmFieldSliceSelFpf1, 1,
    775                                _bcmFieldSliceDstFwdEntitySelect,
    776                                _bcmFieldFwdEntityMplsGport, f1_offset, 19);
    777     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    778                                _bcmFieldSliceSelFpf1, 1,
    779                                _bcmFieldSliceDstFwdEntitySelect,
    780                                _bcmFieldFwdEntityVlanGport, f1_offset, 19);
    781     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    782                                _bcmFieldSliceSelFpf1, 1,
    783                                _bcmFieldSliceDstFwdEntitySelect,
    784                                _bcmFieldFwdEntityMimGport, f1_offset, 19);
    785     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
    786                                _bcmFieldSliceSelFpf1, 1,
    787                                _bcmFieldSliceDstFwdEntitySelect,
    788                                _bcmFieldFwdEntityL3Egress, f1_offset, 19);
    789     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
    790                                _bcmFieldSliceSelFpf1, 1,
    791                                _bcmFieldSliceDstFwdEntitySelect,
    792                                _bcmFieldFwdEntityL3Egress, f1_offset, 19);
    793     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    794                                _bcmFieldSliceSelFpf1, 1,
    795                                _bcmFieldSliceDstFwdEntitySelect,
    796                                _bcmFieldFwdEntityMulticastGroup, f1_offset, 19);
    797     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
    798                                _bcmFieldSliceSelFpf1, 1,
    799                                _bcmFieldSliceDstFwdEntitySelect,
    800                                _bcmFieldFwdEntityMultipath, f1_offset, 19);
    801     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
    802                                _bcmFieldSliceSelFpf1, 1,
    803                                _bcmFieldSliceSrcEntitySelect,
    804                                _bcmFieldFwdEntityGlp, f1_offset + 19, 17);
    805     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
    806                                _bcmFieldSliceSelFpf1, 1,
    807                                _bcmFieldSliceSrcEntitySelect,
    808                                _bcmFieldFwdEntityGlp, f1_offset + 19, 17);
    809     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
    810                                _bcmFieldSliceSelFpf1, 1,
    811                                _bcmFieldSliceSrcEntitySelect,
    812                                _bcmFieldFwdEntityMplsGport, f1_offset + 19, 17);
    813     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
    814                                _bcmFieldSliceSelFpf1, 1,
    815                                _bcmFieldSliceSrcEntitySelect,
    816                                _bcmFieldFwdEntityVlanGport, f1_offset + 19, 17);
    817     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
    818                                _bcmFieldSliceSelFpf1, 1,
    819                                _bcmFieldSliceSrcEntitySelect,
    820                                _bcmFieldFwdEntityMimGport, f1_offset + 19, 17);
    821     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
    822                                _bcmFieldSliceSelFpf1, 1,
    823                                _bcmFieldSliceSrcEntitySelect,
    824                                _bcmFieldFwdEntityModPortGport, f1_offset + 19, 17);
    825     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunkMemberGport,
    826                                _bcmFieldSliceSelFpf1, 1,
    827                                _bcmFieldSliceSrcEntitySelect,
    828                                _bcmFieldFwdEntityModPortGport, f1_offset + 19, 17);
    829     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
    830                                _bcmFieldSliceSelFpf1, 1,
    831                                _bcmFieldSliceSrcEntitySelect,
    832                                _bcmFieldFwdEntityModPortGport, f1_offset + 26, 10);
    833     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTrunkMemberSourceModuleId,
    834                                _bcmFieldSliceSelFpf1, 1,
    835                                _bcmFieldSliceSrcEntitySelect,
    836                                _bcmFieldFwdEntityModPortGport, f1_offset + 26, 8);
    837     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcGport,
    838                                _bcmFieldSliceSelFpf1, 1,
    839                                _bcmFieldSliceSrcEntitySelect,
    840                                _bcmFieldFwdEntityCommonGport, f1_offset + 19, 17);
    841     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
    842                  _bcmFieldSliceSelFpf1, 1, f1_offset + 35, 1);
    843     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    844                  _bcmFieldSliceSelFpf1, 1, f1_offset + 36, 3);
    845 
    846 
    847     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
    848                                _bcmFieldSliceSelFpf1, 2,
    849                                _bcmFieldSliceDstFwdEntitySelect,
    850                                _bcmFieldFwdEntityGlp, f1_offset, 19);
    851     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
    852                                _bcmFieldSliceSelFpf1, 2,
    853                                _bcmFieldSliceDstFwdEntitySelect,
    854                                _bcmFieldFwdEntityCommonGport, f1_offset, 19);
    855     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
    856                                _bcmFieldSliceSelFpf1, 2,
    857                                _bcmFieldSliceDstFwdEntitySelect,
    858                                _bcmFieldFwdEntityGlp, f1_offset, 19);
    859     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
    860                                _bcmFieldSliceSelFpf1, 2,
    861                                _bcmFieldSliceDstFwdEntitySelect,
    862                                _bcmFieldFwdEntityMplsGport, f1_offset, 19);
    863     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
    864                                _bcmFieldSliceSelFpf1, 2,
    865                                _bcmFieldSliceDstFwdEntitySelect,
    866                                _bcmFieldFwdEntityVlanGport, f1_offset, 19);
    867     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
    868                                _bcmFieldSliceSelFpf1, 2,
    869                                _bcmFieldSliceDstFwdEntitySelect,
    870                                _bcmFieldFwdEntityMimGport, f1_offset, 19);
    871     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
    872                                _bcmFieldSliceSelFpf1, 2,
    873                                _bcmFieldSliceDstFwdEntitySelect,
    874                                _bcmFieldFwdEntityL3Egress, f1_offset, 19);
    875     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
    876                                _bcmFieldSliceSelFpf1, 2,
    877                                _bcmFieldSliceDstFwdEntitySelect,
    878                                _bcmFieldFwdEntityL3Egress, f1_offset, 19);
    879     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
    880                                _bcmFieldSliceSelFpf1, 2,
    881                                _bcmFieldSliceDstFwdEntitySelect,
    882                                _bcmFieldFwdEntityMulticastGroup, f1_offset, 19);
    883     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
    884                                _bcmFieldSliceSelFpf1, 2,
    885                                _bcmFieldSliceDstFwdEntitySelect,
    886                                _bcmFieldFwdEntityMultipath, f1_offset, 19);
    887     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
    888                  _bcmFieldSliceSelFpf1, 2, f1_offset + 19, 3);
    889     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
    890                                _bcmFieldSliceSelFpf1, 2,
    891                                _bcmFieldSliceDstClassSelect, 0, f1_offset + 22, 6);
    892     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
    893                                _bcmFieldSliceSelFpf1, 2,
    894                                _bcmFieldSliceDstClassSelect, 1, f1_offset + 22, 6);
    895     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    896                                _bcmFieldSliceSelFpf1, 2,
    897                                _bcmFieldSliceDstClassSelect, 2, f1_offset + 22, 6);
    898     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    899                                _bcmFieldSliceSelFpf1, 2,
    900                                _bcmFieldSliceDstClassSelect, 3, f1_offset + 22, 6);
    901     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
    902                                _bcmFieldSliceSelFpf1, 2,
    903                                _bcmFieldSliceSrcClassSelect, 0, f1_offset + 28, 6);
    904     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
    905                                _bcmFieldSliceSelFpf1, 2,
    906                                _bcmFieldSliceSrcClassSelect, 1, f1_offset + 28, 6);
    907     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
    908                                _bcmFieldSliceSelFpf1, 2,
    909                                _bcmFieldSliceSrcClassSelect, 2, f1_offset + 28, 6);
    910     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
    911                                _bcmFieldSliceSelFpf1, 2,
    912                                _bcmFieldSliceSrcClassSelect, 3, f1_offset + 28, 6);
    913 
    914     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    915                  _bcmFieldSliceSelFpf1, 3, f1_offset, 16);
    916     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    917                  _bcmFieldSliceSelFpf1, 3, f1_offset, 12);
    918     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    919                  _bcmFieldSliceSelFpf1, 3, f1_offset + 12, 1);
    920     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    921                  _bcmFieldSliceSelFpf1, 3, f1_offset + 13, 3);
    922     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    923                  _bcmFieldSliceSelFpf1, 3, f1_offset + 16, 16);
    924     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    925                  _bcmFieldSliceSelFpf1, 3, f1_offset + 16, 12);
    926     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    927                  _bcmFieldSliceSelFpf1, 3, f1_offset + 28, 1);
    928     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    929                  _bcmFieldSliceSelFpf1, 3, f1_offset + 29, 3);
    930     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
    931                  _bcmFieldSliceSelFpf1, 3, f1_offset + 32, 2);
    932 
    933     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    934                  _bcmFieldSliceSelFpf1, 4, f1_offset, 16);
    935     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    936                  _bcmFieldSliceSelFpf1, 4, f1_offset, 12);
    937     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    938                  _bcmFieldSliceSelFpf1, 4, f1_offset + 12, 1);
    939     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    940                  _bcmFieldSliceSelFpf1, 4, f1_offset + 13, 3);
    941     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
    942                  _bcmFieldSliceSelFpf1, 4, f1_offset + 16, 16);
    943     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter,
    944                  _bcmFieldSliceSelFpf1, 4, f1_offset + 32, 3);
    945     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner,
    946                  _bcmFieldSliceSelFpf1, 4, f1_offset + 35, 3);
    947 
    948     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsTerminated,
    949                  _bcmFieldSliceSelFpf1, 5, f1_offset, 1);
    950     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
    951                  _bcmFieldSliceSelFpf1, 5, f1_offset + 1, 1);
    952     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyForwardingVlanValid,
    953                  _bcmFieldSliceSelFpf1, 5, f1_offset + 2, 1);
    954     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIngressStpState,
    955                  _bcmFieldSliceSelFpf1, 5, f1_offset + 3, 2);
    956     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcHit,
    957                  _bcmFieldSliceSelFpf1, 5, f1_offset + 5, 1);
    958     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2SrcStatic,
    959                  _bcmFieldSliceSelFpf1, 5, f1_offset + 6, 1);
    960     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2DestHit,
    961                  _bcmFieldSliceSelFpf1, 5, f1_offset + 7, 1);
    962     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2CacheHit,
    963                  _bcmFieldSliceSelFpf1, 5, f1_offset + 9, 1);
    964     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3SrcHostHit,
    965                  _bcmFieldSliceSelFpf1, 5, f1_offset + 10, 1);
    966     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestHostHit,
    967                  _bcmFieldSliceSelFpf1, 5, f1_offset + 11, 1);
    968     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpmcStarGroupHit,
    969                  _bcmFieldSliceSelFpf1, 5, f1_offset + 12, 1);
    970     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3DestRouteHit,
    971                  _bcmFieldSliceSelFpf1, 5, f1_offset + 13, 1);
    972     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2StationMove,
    973                  _bcmFieldSliceSelFpf1, 5, f1_offset + 14, 1);
    974     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDosAttack,
    975                  _bcmFieldSliceSelFpf1, 5, f1_offset + 15, 1);
    976     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
    977                  _bcmFieldSliceSelFpf1, 5, f1_offset + 16, 16);
    978     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
    979                  _bcmFieldSliceSelFpf1, 5, f1_offset + 16, 12);
    980     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
    981                  _bcmFieldSliceSelFpf1, 5, f1_offset + 28, 1);
    982     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
    983                  _bcmFieldSliceSelFpf1, 5, f1_offset + 29, 3);
    984     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
    985                  _bcmFieldSliceSelFpf1, 5, f1_offset + 32, 2);
    986 
    987     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
    988                  _bcmFieldSliceSelFpf1, 6, f1_offset, 16);
    989     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
    990                  _bcmFieldSliceSelFpf1, 6, f1_offset, 12);
    991     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
    992                  _bcmFieldSliceSelFpf1, 6, f1_offset + 12, 1);
    993     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
    994                  _bcmFieldSliceSelFpf1, 6, f1_offset + 13, 3);
    995     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
    996                  _bcmFieldSliceSelFpf1, 6, f1_offset + 16, 2);
    997     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
    998                  _bcmFieldSliceSelFpf1, 6, f1_offset + 18, 2);
    999     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTranslatedVlanFormat,
   1000                  _bcmFieldSliceSelFpf1, 6, f1_offset + 20, 2);
   1001     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMHOpcode,
   1002                  _bcmFieldSliceSelFpf1, 6, f1_offset + 22, 3);
   1003     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyPacketRes,
   1004                  _bcmFieldSliceSelFpf1, 6, f1_offset + 25, 5);
   1005     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
   1006                  _bcmFieldSliceSelFpf1, 6, f1_offset + 30, 3);
   1007     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanOuter,
   1008                  _bcmFieldSliceSelFpf1, 6, f1_offset + 33, 3);
   1009     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyFibreChanInner,
   1010                  _bcmFieldSliceSelFpf1, 6, f1_offset + 36, 3);
   1011 
   1012     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1013                  _bcmFieldSliceSelFpf1, 7, f1_offset, 16);
   1014     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1015                  _bcmFieldSliceSelFpf1, 7, f1_offset, 12);
   1016     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1017                  _bcmFieldSliceSelFpf1, 7, f1_offset + 12, 1);
   1018     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1019                  _bcmFieldSliceSelFpf1, 7, f1_offset + 13, 3);
   1020     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1021                                _bcmFieldSliceSelFpf1, 7,
   1022                                _bcmFieldSliceSrcClassSelect, 0, f1_offset + 16, 6);
   1023     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   1024                                _bcmFieldSliceSelFpf1, 7,
   1025                                _bcmFieldSliceSrcClassSelect, 1, f1_offset + 16, 6);
   1026     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1027                                _bcmFieldSliceSelFpf1, 7,
   1028                                _bcmFieldSliceSrcClassSelect, 2, f1_offset + 16, 6);
   1029     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1030                                _bcmFieldSliceSelFpf1, 7,
   1031                                _bcmFieldSliceSrcClassSelect, 3, f1_offset + 16, 6);
   1032     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   1033                                _bcmFieldSliceSelFpf1, 7,
   1034                                _bcmFieldSliceFwdFieldSelect, 
   1035                                _bcmFieldFwdFieldVrf, f1_offset + 22, 12);
   1036     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   1037                                _bcmFieldSliceSelFpf1, 7,
   1038                                _bcmFieldSliceFwdFieldSelect, 
   1039                                _bcmFieldFwdFieldVpn, f1_offset + 22, 12);
   1040     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
   1041                                bcmFieldQualifyForwardingVlanId,
   1042                                _bcmFieldSliceSelFpf1, 7,
   1043                                _bcmFieldSliceFwdFieldSelect, 
   1044                                _bcmFieldFwdFieldVlan, f1_offset + 22, 12);
   1045     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMplsOuterLabelPop,
   1046                  _bcmFieldSliceSelFpf1, 7, f1_offset + 34 , 1);
   1047     _FP_QUAL_ADD(unit, stage_fc, 
   1048                  bcmFieldQualifyMplsStationHitTunnelUnterminated,
   1049                  _bcmFieldSliceSelFpf1, 7, f1_offset + 35, 1);
   1050 
   1051     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1052                  _bcmFieldSliceSelFpf1, 8, f1_offset, 8);
   1053     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1054                  _bcmFieldSliceSelFpf1, 8,
   1055                  _bcmFieldSliceTosClassSelect, 0,
   1056                  f1_offset + 8, 8);
   1057     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassZero,
   1058                  _bcmFieldSliceSelFpf1, 8,
   1059                  _bcmFieldSliceTosClassSelect, 0,
   1060                  f1_offset + 8, 8);
   1061     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTosClassOne,
   1062                  _bcmFieldSliceSelFpf1, 8,
   1063                  _bcmFieldSliceTosClassSelect, 1,
   1064                  f1_offset + 8, 8);
   1065     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1066                                _bcmFieldSliceSelFpf1, 8,
   1067                                _bcmFieldSliceSrcClassSelect, 0, f1_offset + 16, 6);
   1068     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   1069                                _bcmFieldSliceSelFpf1, 8,
   1070                                _bcmFieldSliceSrcClassSelect, 1, f1_offset + 16, 6);
   1071     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1072                                _bcmFieldSliceSelFpf1, 8,
   1073                                _bcmFieldSliceSrcClassSelect, 2, f1_offset + 16, 6);
   1074     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1075                                _bcmFieldSliceSelFpf1, 8,
   1076                                _bcmFieldSliceSrcClassSelect, 3, f1_offset + 16, 6);
   1077     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVrf,
   1078                                _bcmFieldSliceSelFpf1, 8,
   1079                                _bcmFieldSliceFwdFieldSelect, 
   1080                                _bcmFieldFwdFieldVrf, f1_offset + 22, 12);
   1081     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVpn,
   1082                                _bcmFieldSliceSelFpf1, 8,
   1083                                _bcmFieldSliceFwdFieldSelect, 
   1084                                _bcmFieldFwdFieldVpn, f1_offset + 22, 12);
   1085     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, 
   1086                                bcmFieldQualifyForwardingVlanId,
   1087                                _bcmFieldSliceSelFpf1, 8,
   1088                                _bcmFieldSliceFwdFieldSelect, 
   1089                                _bcmFieldFwdFieldVlan, f1_offset + 22, 12);
   1090 
   1091     _FP_QUAL_ADD(unit, stage_fc, _bcmFieldQualifyData2,
   1092                  _bcmFieldSliceSelFpf1, 9, f1_offset, 32);
   1093 
   1094     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   1095                                _bcmFieldSliceSelFpf1, 10,
   1096                                _bcmFieldSliceDstFwdEntitySelect,
   1097                                _bcmFieldFwdEntityGlp, f1_offset, 19);
   1098     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstGport,
   1099                                _bcmFieldSliceSelFpf1, 10,
   1100                                _bcmFieldSliceDstFwdEntitySelect,
   1101                                _bcmFieldFwdEntityCommonGport, f1_offset, 19);
   1102     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   1103                                _bcmFieldSliceSelFpf1, 10,
   1104                                _bcmFieldSliceDstFwdEntitySelect,
   1105                                _bcmFieldFwdEntityGlp, f1_offset, 19);
   1106     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   1107                                _bcmFieldSliceSelFpf1, 10,
   1108                                _bcmFieldSliceDstFwdEntitySelect,
   1109                                _bcmFieldFwdEntityMplsGport, f1_offset, 19);
   1110     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   1111                                _bcmFieldSliceSelFpf1, 10,
   1112                                _bcmFieldSliceDstFwdEntitySelect,
   1113                                _bcmFieldFwdEntityVlanGport, f1_offset, 19);
   1114     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   1115                                _bcmFieldSliceSelFpf1, 10,
   1116                                _bcmFieldSliceDstFwdEntitySelect,
   1117                                _bcmFieldFwdEntityMimGport, f1_offset, 19);
   1118     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3Egress,
   1119                                _bcmFieldSliceSelFpf1, 10,
   1120                                _bcmFieldSliceDstFwdEntitySelect,
   1121                                _bcmFieldFwdEntityL3Egress, f1_offset, 19);
   1122     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstL3EgressNextHops,
   1123                                _bcmFieldSliceSelFpf1, 10,
   1124                                _bcmFieldSliceDstFwdEntitySelect,
   1125                                _bcmFieldFwdEntityL3Egress, f1_offset, 19);
   1126     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMulticastGroup,
   1127                                _bcmFieldSliceSelFpf1, 10,
   1128                                _bcmFieldSliceDstFwdEntitySelect,
   1129                                _bcmFieldFwdEntityMulticastGroup, f1_offset, 19);
   1130     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstMultipath,
   1131                                _bcmFieldSliceSelFpf1, 10,
   1132                                _bcmFieldSliceDstFwdEntitySelect,
   1133                                _bcmFieldFwdEntityMultipath, f1_offset, 19);
   1134     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstPort,
   1135                  _bcmFieldSliceSelFpf1, 10, f1_offset + 19, 16);
   1136     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstTrunk,
   1137                  _bcmFieldSliceSelFpf1, 10, f1_offset + 19, 16);
   1138 
   1139     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcPort,
   1140                  _bcmFieldSliceSelFpf1, 11, f1_offset, 16);
   1141     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcTrunk,
   1142                  _bcmFieldSliceSelFpf1, 11, f1_offset, 16);
   1143     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModPortGport,
   1144                  _bcmFieldSliceSelFpf1, 11, f1_offset, 16);
   1145     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   1146                  _bcmFieldSliceSelFpf1, 11, f1_offset + 7, 9);
   1147     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   1148                  _bcmFieldSliceSelFpf1, 11, f1_offset + 16, 14);
   1149     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   1150                  _bcmFieldSliceSelFpf1, 11, f1_offset + 16, 14);
   1151     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   1152                  _bcmFieldSliceSelFpf1, 11, f1_offset + 16, 14);
   1153     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
   1154                  _bcmFieldSliceSelFpf1, 11, f1_offset + 29, 1);
   1155 
   1156     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1157                  _bcmFieldSliceSelFpf1, 12, f1_offset, 12);
   1158     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL2,
   1159                                _bcmFieldSliceSelFpf1, 12,
   1160                                _bcmFieldSliceDstClassSelect, 0, f1_offset + 12, 6);
   1161     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassL3,
   1162                                _bcmFieldSliceSelFpf1, 12,
   1163                                _bcmFieldSliceDstClassSelect, 1, f1_offset + 12, 6);
   1164     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1165                                _bcmFieldSliceSelFpf1, 12,
   1166                                _bcmFieldSliceDstClassSelect, 2, f1_offset + 12, 6);
   1167     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1168                                _bcmFieldSliceSelFpf1, 12,
   1169                                _bcmFieldSliceDstClassSelect, 3, f1_offset + 12, 6);
   1170     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL2,
   1171                                _bcmFieldSliceSelFpf1, 12,
   1172                                _bcmFieldSliceSrcClassSelect, 0, f1_offset + 18, 6);
   1173     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassL3,
   1174                                _bcmFieldSliceSelFpf1, 12,
   1175                                _bcmFieldSliceSrcClassSelect, 1, f1_offset + 18, 6);
   1176     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstClassField,
   1177                                _bcmFieldSliceSelFpf1, 12,
   1178                                _bcmFieldSliceSrcClassSelect, 2, f1_offset + 18, 6);
   1179     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcClassField,
   1180                                _bcmFieldSliceSelFpf1, 12,
   1181                                _bcmFieldSliceSrcClassSelect, 3, f1_offset + 18, 6);
   1182     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMplsGport,
   1183                                _bcmFieldSliceSelFpf1, 12,
   1184                                _bcmFieldSliceIngressEntitySelect,
   1185                                _bcmFieldFwdEntityMplsGport, f1_offset + 24, 13);
   1186     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcMimGport,
   1187                                _bcmFieldSliceSelFpf1, 12,
   1188                                _bcmFieldSliceIngressEntitySelect,
   1189                                _bcmFieldFwdEntityMimGport, f1_offset + 24, 13);
   1190     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcVlanGport,
   1191                                _bcmFieldSliceSelFpf1, 12,
   1192                                _bcmFieldSliceIngressEntitySelect,
   1193                                _bcmFieldFwdEntityVlanGport, f1_offset + 24, 13);
   1194 
   1195     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyVnTag,
   1196                                _bcmFieldSliceSelFpf1, 13,
   1197                                _bcmFieldSliceAuxTag1Select,
   1198                                _bcmFieldAuxTagVn, f1_offset, 33);
   1199     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyCnTag,
   1200                                _bcmFieldSliceSelFpf1, 13,
   1201                                _bcmFieldSliceAuxTag1Select,
   1202                                _bcmFieldAuxTagCn, f1_offset, 33);
   1203     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyFabricQueueTag,
   1204                                _bcmFieldSliceSelFpf1, 13,
   1205                                _bcmFieldSliceAuxTag1Select,
   1206                                _bcmFieldAuxTagFabricQueue, f1_offset, 33);
   1207 
   1208     /* FIXED single wide */
   1209     if (soc_feature(unit, soc_feature_field_qual_my_station_hit)) {
   1210         fixed_offset = 216;
   1211         _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyMyStationHit,
   1212 		             _bcmFieldSliceSelDisable, 0, fixed_offset, 1);
   1213         fixed_offset = 217;
   1214     } else {
   1215         fixed_offset = 217;
   1216     }
   1217     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1218                  _bcmFieldSliceSelDisable, 0, fixed_offset, 1);
   1219     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyForwardingType,
   1220                  _bcmFieldSliceSelDisable, 0, fixed_offset + 1, 3);
   1221     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, _bcmFieldQualifySvpValid,
   1222                  _bcmFieldSliceSelDisable, 0, fixed_offset + 4, 1);
   1223     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifySrcVirtualPortValid,
   1224                  _bcmFieldSliceSelDisable, 0, fixed_offset + 4, 1);
   1225     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1226                  _bcmFieldSliceSelDisable, 0, fixed_offset + 5, 4);
   1227     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1228                  _bcmFieldSliceSelDisable, 0, fixed_offset + 9, 1);
   1229     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   1230                  _bcmFieldSliceSelDisable, 0, fixed_offset + 10, 1);
   1231     _FP_QUAL_PRIMARY_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyLoopback,
   1232                                _bcmFieldSliceSelDisable, 0,
   1233                                _bcmFieldSliceLoopbackTypeSelect, 0, fixed_offset + 14, 1);
   1234     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyLoopbackType,
   1235                                _bcmFieldSliceSelDisable, 0,
   1236                                fixed_offset + 11, 4);
   1237     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyTunnelType,
   1238                                _bcmFieldSliceSelDisable, 0,
   1239                                fixed_offset + 11, 4);
   1240     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1241                  _bcmFieldSliceSelDisable, 0, fixed_offset + 15, 1);
   1242     _FP_QUAL_PRIMARY_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1243                  _bcmFieldSliceSelDisable, 0, fixed_offset + 16, 1);
   1244 
   1245     /* Overlay of FIXED key in pairing mode */
   1246     fixed_pairing_overlay_offset = 215;
   1247     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1248                      _bcmFieldDevSelDisable, 0,
   1249                      _bcmFieldSliceSelDisable, 0, 
   1250                      _bcmFieldSliceSelDisable, 0,
   1251                      0,
   1252                      0, 0, 
   1253                      fixed_pairing_overlay_offset, 2,
   1254                      0, 0,
   1255                      1);   
   1256     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1257                      _bcmFieldDevSelDisable, 0,
   1258                      _bcmFieldSliceSelDisable, 0, 
   1259                      _bcmFieldSliceSelDisable, 0,
   1260                      0,
   1261                      0, 0, 
   1262                      fixed_pairing_overlay_offset + 2, 8,
   1263                      0, 0,
   1264                      1);   
   1265     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1266                      _bcmFieldDevSelDisable, 0,
   1267                      _bcmFieldSliceSelDisable, 0,
   1268                      _bcmFieldSliceTtlClassSelect, 0,
   1269                      0,
   1270                      0, 0,
   1271                      fixed_pairing_overlay_offset + 10, 8,
   1272                      0, 0,
   1273                      1);
   1274     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTtlClassZero,
   1275                      _bcmFieldDevSelDisable, 0,
   1276                      _bcmFieldSliceSelDisable, 0,
   1277                      _bcmFieldSliceTtlClassSelect, 0,
   1278                      0,
   1279                      0, 0,
   1280                      fixed_pairing_overlay_offset + 10, 8,
   1281                      0, 0,
   1282                      1);
   1283     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTtlClassOne,
   1284                      _bcmFieldDevSelDisable, 0,
   1285                      _bcmFieldSliceSelDisable, 0,
   1286                      _bcmFieldSliceTtlClassSelect, 1,
   1287                      0,
   1288                      0, 0,
   1289                      fixed_pairing_overlay_offset + 10, 8,
   1290                      0, 0,
   1291                      1);
   1292 
   1293     /* Overlay of IPBM in pairing mode */
   1294     ipbm_pairing_overlay_offset = 0;
   1295     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1296                      _bcmFieldDevSelDisable, 0,
   1297                      _bcmFieldSliceSelDisable, 0,
   1298                      _bcmFieldSliceTcpClassSelect, 0,
   1299                      0,
   1300                      fixed_pairing_overlay_offset + 18, 1,
   1301                      ipbm_pairing_overlay_offset, 5,
   1302                      0, 0,
   1303                      1);   
   1304     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTcpClassZero,
   1305                      _bcmFieldDevSelDisable, 0,
   1306                      _bcmFieldSliceSelDisable, 0,
   1307                      _bcmFieldSliceTcpClassSelect, 0,
   1308                      0,
   1309                      fixed_pairing_overlay_offset + 18, 1,
   1310                      ipbm_pairing_overlay_offset, 5, 
   1311                      0, 0,
   1312                      1);
   1313     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyTcpClassOne,
   1314                      _bcmFieldDevSelDisable, 0,
   1315                      _bcmFieldSliceSelDisable, 0,
   1316                      _bcmFieldSliceTcpClassSelect, 1,
   1317                      0,
   1318                      fixed_pairing_overlay_offset + 18, 1,
   1319                      ipbm_pairing_overlay_offset, 5, 
   1320                      0, 0,
   1321                      1);   
   1322     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1323                      _bcmFieldDevSelDisable, 0,
   1324                      _bcmFieldSliceSelDisable, 0, 
   1325                      _bcmFieldSliceSelDisable, 0,
   1326                      0,
   1327                      ipbm_pairing_overlay_offset + 5, 16,
   1328                      0, 0, 
   1329                      0, 0,
   1330                      1);   
   1331     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1332                      _bcmFieldDevSelDisable, 0,
   1333                      _bcmFieldSliceSelDisable, 0, 
   1334                      _bcmFieldSliceSelDisable, 0,
   1335                      0,
   1336                      ipbm_pairing_overlay_offset + 21, 16,
   1337                      0, 0,
   1338                      0, 0,
   1339                      1); 
   1340     _FP_QUAL_EXT_ADD(unit, stage_fc, bcmFieldQualifyIcmpTypeCode,
   1341                      _bcmFieldDevSelDisable, 0,
   1342                      _bcmFieldSliceSelDisable, 0, 
   1343                      _bcmFieldSliceSelDisable, 0,
   1344                      0,
   1345                      ipbm_pairing_overlay_offset + 21, 16,
   1346                      0, 0,
   1347                      0, 0,
   1348                      1);
   1349     return (BCM_E_NONE);
   1350 }
   1351 
   1352 /*
   1353  * Function:
   1354  *     _field_trident_lookup_qualifiers_init
   1355  * Purpose:
   1356  *     Initialize device stage lookup qaualifiers 
   1357  *     select codes & offsets
   1358  * Parameters:
   1359  *     unit       - (IN) BCM device number.
   1360  *     stage_fc   - (IN) Field Processor stage control structure. 
   1361  *
   1362  * Returns:
   1363  *     BCM_E_NONE
   1364  */
   1365 STATIC int
   1366 _field_trident_lookup_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1367 {
   1368     _FP_QUAL_DECL;
   1369 
   1370     /* Input parameters check. */
   1371     if (NULL == stage_fc) {
   1372         return (BCM_E_PARAM);
   1373     }
   1374 
   1375     /* Enable the overlay of Sender Ethernet Address onto MACSA
   1376      * on ARP/RARP packets.
   1377      */
   1378     BCM_IF_ERROR_RETURN
   1379         (soc_reg_field32_modify(unit, ING_CONFIG_64r, REG_PORT_ANY,
   1380                                 ARP_VALIDATION_ENf, 1));
   1381 
   1382     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageLookup,
   1383                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1384     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
   1385                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1386     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   1387                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1388 
   1389     /* FPF3 */
   1390     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1391                  _bcmFieldSliceSelFpf3, 0, 0, 16);
   1392     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1393                  _bcmFieldSliceSelFpf3, 0, 0, 12);
   1394     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1395                  _bcmFieldSliceSelFpf3, 0, 12, 1);
   1396     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1397                  _bcmFieldSliceSelFpf3, 0, 13, 3);
   1398     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1399                  _bcmFieldSliceSelFpf3, 0, 16, 16);
   1400 
   1401     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort,
   1402                                _bcmFieldSliceSelFpf3, 1,
   1403                                _bcmFieldSliceIpHeaderSelect, 1, 0, 16);
   1404     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1405                                _bcmFieldSliceSelFpf3, 1,
   1406                                _bcmFieldSliceIpHeaderSelect, 0, 0, 16);
   1407     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   1408                                _bcmFieldSliceSelFpf3, 1,
   1409                                _bcmFieldSliceIpHeaderSelect, 1, 16, 16);
   1410     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1411                                _bcmFieldSliceSelFpf3, 1,
   1412                                _bcmFieldSliceIpHeaderSelect, 0, 16, 16);
   1413 
   1414     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   1415                                _bcmFieldSliceSelFpf3, 2,
   1416                                _bcmFieldSliceIpHeaderSelect, 1, 0, 8);
   1417     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1418                                _bcmFieldSliceSelFpf3, 2,
   1419                                _bcmFieldSliceIpHeaderSelect, 0, 0, 8);
   1420     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   1421                                _bcmFieldSliceSelFpf3, 2,
   1422                                _bcmFieldSliceIpHeaderSelect, 1, 8, 8);
   1423     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1424                                _bcmFieldSliceSelFpf3, 2,
   1425                                _bcmFieldSliceIpHeaderSelect, 0, 8, 8);
   1426     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   1427                  _bcmFieldSliceSelFpf3, 2, 16, 8);
   1428     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   1429                  _bcmFieldSliceSelFpf3, 2, 24, 8);
   1430 
   1431     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   1432                  _bcmFieldSliceSelFpf3, 3, 0, 8);
   1433     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1434                  _bcmFieldSliceSelFpf3, 3, 8, 16);
   1435     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1436                  _bcmFieldSliceSelFpf3, 3, 8, 12);
   1437     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1438                  _bcmFieldSliceSelFpf3, 3, 20, 1);
   1439     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1440                  _bcmFieldSliceSelFpf3, 3, 21, 3);
   1441     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcModuleGport,
   1442                  _bcmFieldSliceSelFpf3, 3, 24, 8);
   1443 
   1444     /* FPF2 */
   1445     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl,
   1446                                _bcmFieldSliceSelFpf2, 0,
   1447                                _bcmFieldSliceIpHeaderSelect, 1, 32, 8);
   1448     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1449                                _bcmFieldSliceSelFpf2, 0,
   1450                                _bcmFieldSliceIpHeaderSelect, 0, 32, 8);
   1451     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1452                  _bcmFieldSliceSelFpf2, 0, 40, 6);
   1453     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag,
   1454                                _bcmFieldSliceSelFpf2, 0,
   1455                                _bcmFieldSliceIpHeaderSelect, 1, 46, 2);
   1456     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1457                                _bcmFieldSliceSelFpf2, 0,
   1458                                _bcmFieldSliceIpHeaderSelect, 0, 46, 2);
   1459     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   1460                                _bcmFieldSliceSelFpf2, 0,
   1461                                _bcmFieldSliceIpHeaderSelect, 1, 48, 8);
   1462     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1463                                _bcmFieldSliceSelFpf2, 0,
   1464                                _bcmFieldSliceIpHeaderSelect, 0, 48, 8);
   1465     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort,
   1466                                _bcmFieldSliceSelFpf2, 0,
   1467                                _bcmFieldSliceIpHeaderSelect, 1, 56, 16);
   1468     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1469                                _bcmFieldSliceSelFpf2, 0,
   1470                                _bcmFieldSliceIpHeaderSelect, 0, 56, 16);
   1471     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   1472                                _bcmFieldSliceSelFpf2, 0,
   1473                                _bcmFieldSliceIpHeaderSelect, 1, 72, 16);
   1474     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1475                                _bcmFieldSliceSelFpf2, 0,
   1476                                _bcmFieldSliceIpHeaderSelect, 0, 72, 16);
   1477     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   1478                                _bcmFieldSliceSelFpf2, 0,
   1479                                _bcmFieldSliceIpHeaderSelect, 1, 88, 8);
   1480     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1481                                _bcmFieldSliceSelFpf2, 0,
   1482                                _bcmFieldSliceIpHeaderSelect, 0, 88, 8);
   1483     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp,
   1484                                _bcmFieldSliceSelFpf2, 0,
   1485                                _bcmFieldSliceIpHeaderSelect, 1, 96, 32);
   1486     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1487                                _bcmFieldSliceSelFpf2, 0,
   1488                                _bcmFieldSliceIpHeaderSelect, 0, 96, 32);
   1489     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp,
   1490                                _bcmFieldSliceSelFpf2, 0,
   1491                                _bcmFieldSliceIpHeaderSelect, 1, 128, 32);
   1492     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1493                                _bcmFieldSliceSelFpf2, 0,
   1494                                _bcmFieldSliceIpHeaderSelect, 0, 128, 32);
   1495 
   1496     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6,
   1497                                _bcmFieldSliceSelFpf2, 1,
   1498                                _bcmFieldSliceIpHeaderSelect, 1, 32, 128);
   1499     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   1500                                _bcmFieldSliceSelFpf2, 1,
   1501                                _bcmFieldSliceIpHeaderSelect, 0, 32, 128);
   1502 
   1503     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp6,
   1504                                _bcmFieldSliceSelFpf2, 2,
   1505                                _bcmFieldSliceIpHeaderSelect, 1, 32, 128);
   1506     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   1507                                _bcmFieldSliceSelFpf2, 2,
   1508                                _bcmFieldSliceIpHeaderSelect, 0, 32, 128);
   1509 
   1510     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1511                  _bcmFieldSliceSelFpf2, 3, 48, 16);
   1512     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   1513                  _bcmFieldSliceSelFpf2, 3, 64, 48);
   1514     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1515                  _bcmFieldSliceSelFpf2, 3, 112, 48);
   1516 
   1517     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   1518                                _bcmFieldSliceSelFpf2, 4,
   1519                                _bcmFieldSliceIpHeaderSelect, 1, 32, 8);
   1520     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1521                                _bcmFieldSliceSelFpf2, 4,
   1522                                _bcmFieldSliceIpHeaderSelect, 0, 32, 8);
   1523     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   1524                                _bcmFieldSliceSelFpf2, 4,
   1525                                _bcmFieldSliceIpHeaderSelect, 1, 40, 8);
   1526     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1527                                _bcmFieldSliceSelFpf2, 4,
   1528                                _bcmFieldSliceIpHeaderSelect, 0, 40, 8);
   1529     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp,
   1530                                _bcmFieldSliceSelFpf2, 4,
   1531                                _bcmFieldSliceIpHeaderSelect, 1, 48, 32);
   1532     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1533                                _bcmFieldSliceSelFpf2, 4,
   1534                                _bcmFieldSliceIpHeaderSelect, 0, 48, 32);
   1535     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp,
   1536                                _bcmFieldSliceSelFpf2, 4,
   1537                                _bcmFieldSliceIpHeaderSelect, 1, 80, 32);
   1538     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1539                                _bcmFieldSliceSelFpf2, 4,
   1540                                _bcmFieldSliceIpHeaderSelect, 0, 80, 32);
   1541     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   1542                  _bcmFieldSliceSelFpf2, 4, 112, 48);
   1543 
   1544     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   1545                                _bcmFieldSliceSelFpf2, 5,
   1546                                _bcmFieldSliceIpHeaderSelect, 1, 32, 8);
   1547     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1548                                _bcmFieldSliceSelFpf2, 5,
   1549                                _bcmFieldSliceIpHeaderSelect, 0, 32, 8);
   1550     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   1551                                _bcmFieldSliceSelFpf2, 5,
   1552                                _bcmFieldSliceIpHeaderSelect, 1, 40, 8);
   1553     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1554                                _bcmFieldSliceSelFpf2, 5,
   1555                                _bcmFieldSliceIpHeaderSelect, 0, 40, 8);
   1556     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp,
   1557                                _bcmFieldSliceSelFpf2, 5,
   1558                                _bcmFieldSliceIpHeaderSelect, 1, 48, 32);
   1559     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1560                                _bcmFieldSliceSelFpf2, 5,
   1561                                _bcmFieldSliceIpHeaderSelect, 0, 48, 32);
   1562     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp,
   1563                                _bcmFieldSliceSelFpf2, 5,
   1564                                _bcmFieldSliceIpHeaderSelect, 1, 80, 32);
   1565     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1566                                _bcmFieldSliceSelFpf2, 5,
   1567                                _bcmFieldSliceIpHeaderSelect, 0, 80, 32);
   1568     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1569                  _bcmFieldSliceSelFpf2, 5, 112, 48);
   1570 
   1571     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6High,
   1572                                _bcmFieldSliceSelFpf2, 6,
   1573                                _bcmFieldSliceIpHeaderSelect, 1, 32, 64);
   1574     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
   1575                                _bcmFieldSliceSelFpf2, 6,
   1576                                _bcmFieldSliceIpHeaderSelect, 0, 32, 64);
   1577     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp6High,
   1578                                _bcmFieldSliceSelFpf2, 6,
   1579                                _bcmFieldSliceIpHeaderSelect, 1, 96, 64);
   1580     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   1581                                _bcmFieldSliceSelFpf2, 6,
   1582                                _bcmFieldSliceIpHeaderSelect, 0, 96, 64);
   1583 
   1584     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVnTag,
   1585                  _bcmFieldSliceSelFpf2, 7, 32, 33);
   1586     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySnap,
   1587                  _bcmFieldSliceSelFpf2, 7, 96, 40);
   1588     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyLlc,
   1589                  _bcmFieldSliceSelFpf2, 7, 136, 24);
   1590 
   1591     /* FPF1 */
   1592     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc,
   1593                                bcmFieldQualifyInnerIpProtocolCommon,
   1594                                _bcmFieldSliceSelFpf1, 0,
   1595                                _bcmFieldSliceIpHeaderSelect, 1, 160, 3);
   1596     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocolCommon,
   1597                                _bcmFieldSliceSelFpf1, 0,
   1598                                _bcmFieldSliceIpHeaderSelect, 0, 160, 3);
   1599     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTunnelTerminated,
   1600                  _bcmFieldSliceSelFpf1, 0, 163, 1);
   1601     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerTpid,
   1602                  _bcmFieldSliceSelFpf1, 0, 165, 2);
   1603     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterTpid,
   1604                  _bcmFieldSliceSelFpf1, 0, 167, 2);
   1605     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   1606                  _bcmFieldSliceSelFpf1, 0, 169, 2);
   1607     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1608                  _bcmFieldSliceSelFpf1, 0, 171, 1);
   1609     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1610                  _bcmFieldSliceSelFpf1, 0, 172, 1);
   1611     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1612                  _bcmFieldSliceSelFpf1, 0, 173, 16);
   1613     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1614                  _bcmFieldSliceSelFpf1, 0, 173, 12);
   1615     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1616                  _bcmFieldSliceSelFpf1, 0, 185, 1);
   1617     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1618                  _bcmFieldSliceSelFpf1, 0, 186, 3);
   1619     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1620                  _bcmFieldSliceSelFpf1, 0, 189, 2);
   1621     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1622                  _bcmFieldSliceSelFpf1, 0, 191, 7);
   1623     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1624                  _bcmFieldSliceSelFpf1, 0, 198, 8);
   1625     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyInnerIpType,
   1626                                _bcmFieldSliceSelFpf1, 0,
   1627                                _bcmFieldSliceIpHeaderSelect, 1, 206, 4);
   1628     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1629                                _bcmFieldSliceSelFpf1, 0,
   1630                                _bcmFieldSliceIpHeaderSelect, 0, 206, 4);
   1631     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1632                  _bcmFieldSliceSelFpf1, 0, 210, 1);
   1633     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpInfo,
   1634                  _bcmFieldSliceSelFpf1, 0, 4, 1);
   1635 
   1636     /* DWF3 */
   1637     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   1638                             _bcmFieldSliceSelFpf3, 0,
   1639                             _bcmFieldSliceIpHeaderSelect, 1, 0, 8);
   1640     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1641                             _bcmFieldSliceSelFpf3, 0,
   1642                             _bcmFieldSliceIpHeaderSelect, 0, 0, 8);
   1643     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl,
   1644                             _bcmFieldSliceSelFpf3, 0,
   1645                             _bcmFieldSliceIpHeaderSelect, 1, 8, 8);
   1646     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1647                             _bcmFieldSliceSelFpf3, 0,
   1648                             _bcmFieldSliceIpHeaderSelect, 0, 8, 8);
   1649     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1650                             _bcmFieldSliceSelFpf3, 0,
   1651                             _bcmFieldSliceIpHeaderSelect, 0, 16, 6);
   1652     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag,
   1653                             _bcmFieldSliceSelFpf3, 0,
   1654                             _bcmFieldSliceIpHeaderSelect, 1, 22, 2);
   1655     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1656                             _bcmFieldSliceSelFpf3, 0,
   1657                             _bcmFieldSliceIpHeaderSelect, 0, 22, 2);
   1658     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   1659                             _bcmFieldSliceSelFpf3, 0,
   1660                             _bcmFieldSliceIpHeaderSelect, 1, 24, 8);
   1661     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1662                             _bcmFieldSliceSelFpf3, 0,
   1663                             _bcmFieldSliceIpHeaderSelect, 0, 24, 8);
   1664 
   1665     /* DWF2 */
   1666     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTtl,
   1667                             _bcmFieldSliceSelFpf2, 0,
   1668                             _bcmFieldSliceIpHeaderSelect, 1, 32, 8);
   1669     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1670                             _bcmFieldSliceSelFpf2, 0,
   1671                             _bcmFieldSliceIpHeaderSelect, 0, 32, 8);
   1672     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1673                             _bcmFieldSliceSelFpf2, 0,
   1674                             _bcmFieldSliceIpHeaderSelect, 0, 40, 6);
   1675     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpFrag,
   1676                             _bcmFieldSliceSelFpf2, 0,
   1677                             _bcmFieldSliceIpHeaderSelect, 1, 46, 2);
   1678     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1679                             _bcmFieldSliceSelFpf2, 0,
   1680                             _bcmFieldSliceIpHeaderSelect, 0, 46, 2);
   1681     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerTos,
   1682                             _bcmFieldSliceSelFpf2, 0,
   1683                             _bcmFieldSliceIpHeaderSelect, 1, 48, 8);
   1684     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1685                             _bcmFieldSliceSelFpf2, 0,
   1686                             _bcmFieldSliceIpHeaderSelect, 0, 48, 8);
   1687     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4DstPort,
   1688                             _bcmFieldSliceSelFpf2, 0,
   1689                             _bcmFieldSliceIpHeaderSelect, 1, 56, 16);
   1690     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1691                             _bcmFieldSliceSelFpf2, 0,
   1692                             _bcmFieldSliceIpHeaderSelect, 0, 56, 16);
   1693     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerL4SrcPort,
   1694                             _bcmFieldSliceSelFpf2, 0,
   1695                             _bcmFieldSliceIpHeaderSelect, 1, 72, 16);
   1696     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1697                             _bcmFieldSliceSelFpf2, 0,
   1698                             _bcmFieldSliceIpHeaderSelect, 0, 72, 16);
   1699     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerIpProtocol,
   1700                             _bcmFieldSliceSelFpf2, 0,
   1701                             _bcmFieldSliceIpHeaderSelect, 1, 88, 8);
   1702     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1703                             _bcmFieldSliceSelFpf2, 0,
   1704                             _bcmFieldSliceIpHeaderSelect, 0, 88, 8);
   1705     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerDstIp,
   1706                             _bcmFieldSliceSelFpf2, 0,
   1707                             _bcmFieldSliceIpHeaderSelect, 1, 96, 32);
   1708     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1709                             _bcmFieldSliceSelFpf2, 0,
   1710                             _bcmFieldSliceIpHeaderSelect, 0, 96, 32);
   1711     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp,
   1712                             _bcmFieldSliceSelFpf2, 0,
   1713                             _bcmFieldSliceIpHeaderSelect, 1, 128, 32);
   1714     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1715                             _bcmFieldSliceSelFpf2, 0,
   1716                             _bcmFieldSliceIpHeaderSelect, 0, 128, 32);
   1717 
   1718     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInnerSrcIp6,
   1719                             _bcmFieldSliceSelFpf2, 1,
   1720                             _bcmFieldSliceIpHeaderSelect, 1, 32, 128);
   1721     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   1722                             _bcmFieldSliceSelFpf2, 1,
   1723                             _bcmFieldSliceIpHeaderSelect, 0, 32, 128);
   1724 
   1725     /* DWF1 */
   1726     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc,
   1727                             bcmFieldQualifyExtensionHeaderSubCode,
   1728                             _bcmFieldSliceSelFpf1, 0,
   1729                             _bcmFieldSliceIpHeaderSelect, 0, 160, 8);
   1730     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   1731                             _bcmFieldSliceSelFpf1, 0,
   1732                             _bcmFieldSliceIpHeaderSelect, 0, 168, 8);
   1733     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassL3,
   1734                             _bcmFieldSliceSelFpf1, 0,
   1735                             _bcmFieldSliceIpHeaderSelect, 0, 176, 8);
   1736     _FP_QUAL_INTRASLICE_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1737                             _bcmFieldSliceSelFpf1, 0,
   1738                             _bcmFieldSliceIpHeaderSelect, 0, 184, 16);
   1739 
   1740     return (BCM_E_NONE);
   1741 }
   1742 
   1743 
   1744 /*
   1745  * Function:
   1746  *     _field_trident_egress_qualifiers_init
   1747  * Purpose:
   1748  *     Initialize device stage egress qaualifiers 
   1749  *     select codes & offsets
   1750  * Parameters:
   1751  *     unit       - (IN) BCM device number.
   1752  *     stage_fc   - (IN) Field Processor stage control structure. 
   1753  *
   1754  * Returns:
   1755  *     BCM_E_NONE
   1756  */
   1757 STATIC int
   1758 _field_trident_egress_qualifiers_init(int unit, _field_stage_t *stage_fc)
   1759 {
   1760     _FP_QUAL_DECL;
   1761     _key_fld_ = KEYf;
   1762 
   1763     /* Input parameters check. */
   1764     if (NULL == stage_fc) {
   1765         return (BCM_E_PARAM);
   1766     }
   1767 
   1768     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyStageEgress,
   1769                  _bcmFieldSliceSelDisable, 0, 0, 0);
   1770 
   1771     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1772                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 1);
   1773     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   1774                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 8, 4);
   1775     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   1776                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 12, 2);
   1777     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1778                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 14, 2);
   1779     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1780                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 16, 6);
   1781     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1782                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 22, 16);
   1783     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1784                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 38, 16);
   1785     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1786                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 54, 8);
   1787     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1788                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 62, 8);
   1789     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp,
   1790                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 70, 32);
   1791     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcIp,
   1792                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 102, 32);
   1793     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1794                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 134, 8);
   1795     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1796                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 142, 1);
   1797     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1798                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 143, 1);
   1799     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1800                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 150, 12);
   1801     /* EFP_KEY1: CLASSID_VALID 1-bit @ bit 162 */
   1802     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1803                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 163, 7);
   1804     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   1805                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 170, 1);
   1806     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1807                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 171, 1);
   1808     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1809                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 172, 16);
   1810     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1811                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 172, 12);
   1812     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1813                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 184, 1);
   1814     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1815                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 185, 3);
   1816     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1817                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 188, 2);
   1818     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1819                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 190, 1);
   1820     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1821                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 191, 8);
   1822     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1823                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 199, 7);
   1824     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1825                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 206, 4);
   1826     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1827                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 210, 1);
   1828     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp4,
   1829                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1, 0, 0);
   1830 
   1831     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1832                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 1);
   1833     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   1834                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 4, 8);
   1835     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6,
   1836                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1837                                _bcmFieldSliceIp6AddrSelect, 
   1838                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP6, 
   1839                                12, 128);
   1840     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   1841                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1842                                _bcmFieldSliceIp6AddrSelect, 
   1843                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_DIP6,
   1844                                12, 128);
   1845     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifySrcIp6High,
   1846                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1847                                _bcmFieldSliceIp6AddrSelect, 
   1848                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64,
   1849                                12, 64);
   1850     _FP_QUAL_TWO_SLICE_SEL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6High,
   1851                                _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2,
   1852                                _bcmFieldSliceIp6AddrSelect,
   1853                                _BCM_FIELD_EGRESS_SLICE_V6_KEY_MODE_SIP_DIP_64,
   1854                                76, 64);
   1855     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   1856                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 140, 8);
   1857     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1858                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 148, 1);
   1859     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1860                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 149, 1);
   1861     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1862                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 150, 12);
   1863     /* EFP_KEY2: CLASSID_VALID 1-bit @ bit 162 */
   1864     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1865                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 163, 7);
   1866     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   1867                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 170, 1);
   1868     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1869                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 171, 1);
   1870     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1871                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 172, 16);
   1872     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1873                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 172, 12);
   1874     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1875                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 184, 1);
   1876     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1877                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 185, 3);
   1878     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1879                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 188, 2);
   1880     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1881                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 190, 1);
   1882     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1883                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 191, 8);
   1884     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1885                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 199, 7);
   1886     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1887                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 206, 4);
   1888     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1889                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 210, 1);
   1890     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   1891                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY2, 0, 0);
   1892 
   1893     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1894                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 1);
   1895     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   1896                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 8, 4);
   1897     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   1898                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 12, 2);
   1899     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpFrag,
   1900                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 14, 2);
   1901     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1902                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 16, 6);
   1903     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1904                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 22, 16);
   1905     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1906                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 38, 16);
   1907     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   1908                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 54, 8);
   1909     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstIp6,
   1910                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 62, 128);
   1911     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderSubCode,
   1912                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 190, 8);
   1913     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyExtensionHeaderType,
   1914                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 198, 8);
   1915     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1916                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 206, 4);
   1917     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1918                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 210, 1);
   1919     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIp6,
   1920                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY3, 0, 0);
   1921 
   1922     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1923                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 0, 1);
   1924     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMplsGport,
   1925                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 1, 14);
   1926     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMimGport,
   1927                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 1, 14);
   1928     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstVlanGport,
   1929                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 1, 14);
   1930     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   1931                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 17, 4);
   1932     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   1933                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 21, 2);
   1934     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL2Format,
   1935                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 23, 2);
   1936     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyEtherType,
   1937                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 25, 16);
   1938     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifySrcMac,
   1939                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 41, 48);
   1940     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstMac,
   1941                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 89, 48);
   1942     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyCpuQueue,
   1943                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 137, 6);
   1944     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanTranslationHit,
   1945                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 143, 1);
   1946     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   1947                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 144, 1);
   1948     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   1949                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 145, 1);
   1950     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlan,
   1951                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 146, 16);
   1952     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanCfi,
   1953                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 146, 1);
   1954     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanPri,
   1955                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 147, 3);
   1956     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   1957                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 150, 12);
   1958     /* EFP_KEY4: CLASSID_VALID 1-bit @ bit 162 */
   1959     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   1960                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 163, 7);
   1961     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   1962                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 170, 1);
   1963     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   1964                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 171, 1);
   1965     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   1966                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 172, 16);
   1967     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   1968                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 172, 12);
   1969     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   1970                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 184, 1);
   1971     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   1972                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 185, 3);
   1973     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   1974                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 188, 2);
   1975     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   1976                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 190, 1);
   1977     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   1978                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 191, 8);
   1979     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   1980                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 199, 7);
   1981     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   1982                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 206, 4);
   1983     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   1984                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY4, 210, 1);
   1985 
   1986     /* KEY1 without v4 specific fields. */
   1987     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4Ports,
   1988                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 0, 1);
   1989     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIntPriority,
   1990                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 8, 4);
   1991     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyColor,
   1992                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 12, 2);
   1993     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTcpControl,
   1994                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 16, 6);
   1995     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4DstPort,
   1996                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 22, 16);
   1997     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL4SrcPort,
   1998                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 38, 16);
   1999     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTtl,
   2000                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 54, 8);
   2001     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpProtocol,
   2002                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 62, 8);
   2003     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyTos,
   2004                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 134, 8);
   2005     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGigProxy,
   2006                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 142, 1);
   2007     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyHiGig,
   2008                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 143, 1);
   2009     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInnerVlanId,
   2010                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 150, 12);
   2011     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInPort,
   2012                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 163, 7);
   2013     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyL3Routable,
   2014                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 170, 1);
   2015     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyMirrorCopy,
   2016                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 171, 1);
   2017     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlan,
   2018                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 172, 16);
   2019     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanId,
   2020                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 172, 12);
   2021     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanCfi,
   2022                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 184, 1);
   2023     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOuterVlanPri,
   2024                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 185, 3);
   2025     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyVlanFormat,
   2026                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 188, 2);
   2027     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDstHiGig,
   2028                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 190, 1);
   2029     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyInterfaceClassPort,
   2030                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 191, 8);
   2031     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyOutPort,
   2032                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 199, 7);
   2033     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyIpType,
   2034                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 206, 4);
   2035     _FP_QUAL_ADD(unit, stage_fc, bcmFieldQualifyDrop,
   2036                  _bcmFieldSliceSelFpf3, _BCM_FIELD_EFP_KEY1_NO_V4, 210, 1);
   2037 
   2038     return (BCM_E_NONE);
   2039 }
   2040 
   2041 /*
   2042  * Function:
   2043  *     _field_trident_qualifiers_init
   2044  * Purpose:
   2045  *     Initialize device qaualifiers select codes & offsets
   2046  * Parameters:
   2047  *     unit       - (IN) BCM device number.
   2048  *     stage_fc   - (IN) Field Processor stage control structure. 
   2049  *
   2050  * Returns:
   2051  *     BCM_E_NONE
   2052  * Notes:
   2053  */
   2054 STATIC int
   2055 _field_trident_qualifiers_init(int unit, _field_stage_t *stage_fc)
   2056 {
   2057     int rv;           /* Operation return status. */
   2058 
   2059     /* Input parameters check. */
   2060     if (NULL == stage_fc) {
   2061         return (BCM_E_PARAM);
   2062     }
   2063 
   2064     /* Allocated stage qualifiers configuration array. */
   2065     _FP_XGS3_ALLOC(stage_fc->f_qual_arr, 
   2066                    (_bcmFieldQualifyCount * sizeof(_bcm_field_qual_info_t *)), 
   2067                    "Field qualifiers");
   2068     if (NULL == stage_fc->f_qual_arr) {
   2069         return (BCM_E_MEMORY);
   2070     }
   2071     
   2072     switch (stage_fc->stage_id) {
   2073       case _BCM_FIELD_STAGE_INGRESS:
   2074           rv = _field_trident_ingress_qualifiers_init(unit, stage_fc);
   2075           break;
   2076       case _BCM_FIELD_STAGE_LOOKUP:
   2077           rv = _field_trident_lookup_qualifiers_init(unit, stage_fc);
   2078           break;
   2079       case _BCM_FIELD_STAGE_EGRESS:
   2080           rv = _field_trident_egress_qualifiers_init(unit, stage_fc);
   2081           break;
   2082       default: 
   2083           sal_free(stage_fc->f_qual_arr);
   2084           return (BCM_E_PARAM);
   2085     }
   2086     return (rv);
   2087 }
   2088 
   2089 /*
   2090  * Function:
   2091  *     _bcm_field_trident_init
   2092  * Purpose:
   2093  *     Perform initializations that are specific to BCM56840. This
   2094  *     includes initializing the FP field select bit offset tables for FPF[1-3]
   2095  *     for every stage. 
   2096  * Parameters:
   2097  *     unit       - (IN) BCM device number.
   2098  *     fc         - (IN) Field Processor control structure. 
   2099  *
   2100  * Returns:
   2101  *     BCM_E_NONE
   2102  * Notes:
   2103  */
   2104 int
   2105 _bcm_field_trident_init(int unit, _field_control_t *fc) 
   2106 {
   2107     _field_stage_t *stage_fc; /* Stages iteration pointer */
   2108 
   2109     /* Input parameters check. */
   2110     if (NULL == fc) {
   2111         return (BCM_E_PARAM);
   2112     }
   2113 
   2114     stage_fc = fc->stages;
   2115     while (stage_fc) {
   2116         if (!SAL_BOOT_BCMSIM && !SAL_BOOT_QUICKTURN && !SAL_BOOT_XGSSIM) {
   2117             /* Clear hardware table */
   2118             BCM_IF_ERROR_RETURN(_bcm_field_tr_hw_clear(unit, stage_fc));
   2119         }
   2120 
   2121         /* Initialize qualifiers info. */
   2122         BCM_IF_ERROR_RETURN(_field_trident_qualifiers_init(unit, stage_fc));
   2123 
   2124         /* Goto next stage */
   2125         stage_fc = stage_fc->next;
   2126     }
   2127 
   2128     /* Initialize the TOS_FN, TTL_FN, TCP_FN tables */
   2129     BCM_IF_ERROR_RETURN(_bcm_field_trx_tcp_ttl_tos_init(unit));
   2130     
   2131     if (0 == SOC_WARM_BOOT(unit)) {
   2132         /* Enable filter processor */
   2133         BCM_IF_ERROR_RETURN(_field_port_filter_enable_set(unit, fc, TRUE));
   2134 
   2135         /* Enable meter refresh */
   2136         BCM_IF_ERROR_RETURN(_field_meter_refresh_enable_set(unit, fc, TRUE));
   2137     }
   2138 
   2139     /* Initialize the function pointers */
   2140     _field_trident_functions_init(&fc->functions);
   2141 
   2142     return (BCM_E_NONE);
   2143 }
   2144 
   2145 /*
   2146  * Function:
   2147  *     _field_td_write_slice_map_ingress
   2148  * Purpose:
   2149  *     Write FP_SLICE_MAP
   2150  * Parameters:
   2151  *     unit       - (IN) BCM device number
   2152  *     stage_fc   - (IN) stage control structure
   2153  * Returns:
   2154  *     BCM_E_XXX
   2155  */
   2156 STATIC int
   2157 _field_td_write_slice_map_ingress(int unit, _field_stage_t *stage_fc)
   2158 {
   2159     fp_slice_map_entry_t entry;
   2160     soc_field_t field;
   2161     uint32 value;
   2162     int vmap_size;
   2163     int index;
   2164     static const soc_field_t physical_slice[] = {
   2165         VIRTUAL_SLICE_0_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   2166         VIRTUAL_SLICE_1_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   2167         VIRTUAL_SLICE_2_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   2168         VIRTUAL_SLICE_3_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   2169         VIRTUAL_SLICE_4_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   2170         VIRTUAL_SLICE_5_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   2171         VIRTUAL_SLICE_6_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   2172         VIRTUAL_SLICE_7_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   2173         VIRTUAL_SLICE_8_PHYSICAL_SLICE_NUMBER_ENTRY_0f,
   2174         VIRTUAL_SLICE_9_PHYSICAL_SLICE_NUMBER_ENTRY_0f
   2175     };
   2176     static const soc_field_t slice_group[] = {
   2177         VIRTUAL_SLICE_0_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   2178         VIRTUAL_SLICE_1_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   2179         VIRTUAL_SLICE_2_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   2180         VIRTUAL_SLICE_3_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   2181         VIRTUAL_SLICE_4_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   2182         VIRTUAL_SLICE_5_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   2183         VIRTUAL_SLICE_6_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   2184         VIRTUAL_SLICE_7_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   2185         VIRTUAL_SLICE_8_VIRTUAL_SLICE_GROUP_ENTRY_0f,
   2186         VIRTUAL_SLICE_9_VIRTUAL_SLICE_GROUP_ENTRY_0f
   2187     };
   2188 
   2189     /* Calculate virtual map size. */
   2190     BCM_IF_ERROR_RETURN
   2191         (_bcm_field_virtual_map_size_get(unit, stage_fc, &vmap_size));
   2192 
   2193     SOC_IF_ERROR_RETURN(READ_FP_SLICE_MAPm(unit, MEM_BLOCK_ANY, 0, &entry));
   2194 
   2195     for (index = 0; index < vmap_size; index++) {
   2196         value = stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][index].vmap_key;
   2197         field = physical_slice[index];
   2198         soc_FP_SLICE_MAPm_field32_set(unit, &entry, field, value);
   2199 
   2200         value = stage_fc->vmap[_FP_DEF_INST][_FP_VMAP_DEFAULT][index].virtual_group;
   2201         field = slice_group[index];
   2202         soc_FP_SLICE_MAPm_field32_set(unit, &entry, field, value);
   2203     }
   2204 
   2205     return WRITE_FP_SLICE_MAPm(unit, MEM_BLOCK_ALL, 0, &entry);
   2206 }
   2207 
   2208 /*
   2209  * Function:
   2210  *     _bcm_field_td_write_slice_map
   2211  * Purpose:
   2212  *     Write FP_SLICE_MAP, EFP_SLICE_MAP, VFP_SLICE_MAP
   2213  * Parameters:
   2214  *     unit       - (IN) BCM device number
   2215  *     stage_fc   - (IN) stage control structure
   2216  *     fg         - (IN) Reference to field group structure.
   2217  * Returns:
   2218  *     BCM_E_XXX
   2219  */
   2220 int
   2221 _bcm_field_td_write_slice_map(int unit, _field_stage_t *stage_fc,
   2222                               _field_group_t *fg)
   2223 {
   2224     if (stage_fc->stage_id == _BCM_FIELD_STAGE_INGRESS) {
   2225         return _field_td_write_slice_map_ingress(unit, stage_fc);
   2226     } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_EGRESS) {
   2227         return _bcm_field_trx_write_slice_map_egress(unit, stage_fc);
   2228     } else if (stage_fc->stage_id == _BCM_FIELD_STAGE_LOOKUP) {
   2229         return _bcm_field_trx_write_slice_map_vfp(unit, stage_fc);
   2230     }
   2231 
   2232     return BCM_E_INTERNAL;
   2233 }
   2234 
   2235 /*
   2236  * Function:
   2237  *     _bcm_field_td_counter_write
   2238  * Purpose:
   2239  *     Write accumulated sw & hw counters
   2240  * Parameters:
   2241  *   unit          - (IN) BCM device number
   2242  *   stage_fc      - (IN) Stage field control
   2243  *   counter_x_mem - (IN) Memory name for X pipe FP counter
   2244  *   mem_x_buf     - (IN) Memory table entry for X pipe FP counter
   2245  *   counter_y_mem - (IN) Memory name for Y pipe FP counter
   2246  *   mem_y_buf     - (IN) Memory table entry for Y pipe FP counter
   2247  *   idx           - (IN) Counter index
   2248  *   packet_count  - (IN) Packet counter value
   2249  *   byte_count    - (IN) Byte counter value
   2250  * Returns:
   2251  *    BCM_E_XXX
   2252  */
   2253 STATIC int
   2254 _bcm_field_td_counter_write(int unit, soc_mem_t mem, int idx, uint32 *buf,
   2255                             _field_counter32_collect_t *cntrs32_buf,
   2256                             _field_counter64_collect_t *cntrs64_buf,
   2257                             uint64 *packet_count, uint64 *byte_count)
   2258 {
   2259     uint32  hw_val[2];     /* Parsed field counter value.*/
   2260     uint32  len;           /* field lenght */
   2261 
   2262     /* Set byte count in the memory */
   2263     if (NULL != byte_count) {
   2264         /* For TD field_length = 36, TD2 field_lenght = 37 */
   2265         len = soc_mem_field_length(unit, mem, BYTE_COUNTERf);
   2266         COMPILER_64_ZERO(cntrs64_buf->accumulated_counter);
   2267         COMPILER_64_OR(cntrs64_buf->accumulated_counter, (*byte_count));
   2268         /* coverity[large_shift] */
   2269         COMPILER_64_SET(cntrs64_buf->last_hw_value,
   2270                         COMPILER_64_HI(*byte_count) & ((1 << (len - 32)) - 1),
   2271                         COMPILER_64_LO(*byte_count));
   2272         hw_val[0] = COMPILER_64_LO(cntrs64_buf->last_hw_value);
   2273         hw_val[1] = COMPILER_64_HI(cntrs64_buf->last_hw_value);
   2274         soc_mem_field_set(unit, mem, buf, BYTE_COUNTERf, hw_val);
   2275     }
   2276 
   2277     /* Set packet count in the memory */
   2278     if (NULL != packet_count) {
   2279         /* For TD field_length = 29, TD2 field_lenght = 30 */
   2280         len = soc_mem_field_length(unit, mem, PACKET_COUNTERf);
   2281         COMPILER_64_ZERO(cntrs32_buf->accumulated_counter);
   2282         COMPILER_64_OR(cntrs32_buf->accumulated_counter,
   2283                        (*packet_count));
   2284         cntrs32_buf->last_hw_value =
   2285             (COMPILER_64_LO(*packet_count) & ((1 << len) - 1));
   2286         hw_val[0] = cntrs32_buf->last_hw_value;
   2287         hw_val[1] = 0;
   2288         soc_mem_field_set(unit, mem, buf, PACKET_COUNTERf, hw_val);
   2289     }
   2290 
   2291     return soc_mem_write(unit, mem, MEM_BLOCK_ALL, idx, buf);
   2292 }
   2293 
   2294 /*
   2295  * Function:
   2296  *     _bcm_field_td_counter_set
   2297  * Purpose:
   2298  *     Write accumulated sw and hw counters
   2299  * Parameters:
   2300  *   unit          - (IN) BCM device number
   2301  *   stage_fc      - (IN) Stage field control
   2302  *   counter_x_mem - (IN) Memory name for X pipe FP counter
   2303  *   mem_x_buf     - (IN) Memory table entry for X pipe FP counter
   2304  *   counter_y_mem - (IN) Memory name for Y pipe FP counter
   2305  *   mem_y_buf     - (IN) Memory table entry for Y pipe FP counter
   2306  *   idx           - (IN) Counter index
   2307  *   packet_count  - (IN) Packet counter value
   2308  *   byte_count    - (IN) Byte counter value
   2309  * Returns:
   2310  *    BCM_E_XXX
   2311  */
   2312 int
   2313 _bcm_field_td_counter_set(int unit, _field_stage_t *stage_fc,
   2314                           soc_mem_t counter_x_mem, uint32 *mem_x_buf,
   2315                           soc_mem_t counter_y_mem, uint32 *mem_y_buf,
   2316                           int idx, uint64 *packet_count, uint64 *byte_count)
   2317 {
   2318     _field_counter32_collect_t *cntrs32_buf;  /* Sw packet counter value    */
   2319     _field_counter64_collect_t *cntrs64_buf;  /* Sw byte counter value      */
   2320 
   2321     /* Input parameters check. */
   2322     if (NULL == stage_fc) {
   2323         return BCM_E_PARAM;
   2324     }
   2325 
   2326     /* Write X pipeline counter value. */
   2327     if (NULL != mem_x_buf) {
   2328         cntrs64_buf = &stage_fc->_field_x64_counters[idx];
   2329         cntrs32_buf = &stage_fc->_field_x32_counters[idx];
   2330         BCM_IF_ERROR_RETURN
   2331             (_bcm_field_td_counter_write(unit, counter_x_mem, idx, mem_x_buf,
   2332                                          cntrs32_buf, cntrs64_buf,
   2333                                          packet_count, byte_count));
   2334     }
   2335 
   2336     /* Write 0 to Y pipeline counter value. */
   2337     if (NULL != packet_count) {
   2338         COMPILER_64_ZERO(*packet_count);
   2339     }
   2340 
   2341     if (NULL != byte_count) {
   2342         COMPILER_64_ZERO(*byte_count);
   2343     }
   2344 
   2345     /* Write Y pipeline counter value. */
   2346     if (NULL != mem_y_buf) {
   2347         cntrs64_buf = &stage_fc->_field_y64_counters[idx];
   2348         cntrs32_buf = &stage_fc->_field_y32_counters[idx];
   2349         BCM_IF_ERROR_RETURN
   2350             (_bcm_field_td_counter_write(unit, counter_y_mem, idx, mem_y_buf,
   2351                                          cntrs32_buf, cntrs64_buf,
   2352                                          packet_count, byte_count));
   2353     }
   2354 
   2355     return BCM_E_NONE;
   2356 }
   2357 
   2358 /*
   2359  * Function:
   2360  *     _bcm_field_td_counter_read
   2361  * Purpose:
   2362  *     Update accumulated sw counter and return current counter value.
   2363  * Parameters:
   2364  *   unit          - (IN)  BCM device number
   2365  *   stage_fc      - (IN)  Stage field control
   2366  *   counter_x_mem - (IN)  Memory name for X pipe FP counter
   2367  *   mem_x_buf     - (IN)  Memory table entry for X pipe FP counter
   2368  *   counter_y_mem - (IN)  Memory name for Y pipe FP counter
   2369  *   mem_y_buf     - (IN)  Memory table entry for Y pipe FP counter
   2370  *   idx           - (IN)  Counter index
   2371  *   packet_count  - (OUT) Packet counter value
   2372  *   byte_count    - (OUT) Byte counter value
   2373  * Returns:
   2374  *    BCM_E_XXX
   2375  */
   2376 STATIC int
   2377 _bcm_field_td_counter_read(int unit,soc_memacc_t *memacc_byte,
   2378                            soc_memacc_t *memacc_pkt, uint32 *buf,
   2379                            _field_counter32_collect_t *cntrs32_buf,
   2380                            _field_counter64_collect_t *cntrs64_buf,
   2381                            uint64 *packet_count, uint64 *byte_count)
   2382 {
   2383     uint32  hw_val[2];     /* Parsed field counter value.*/
   2384 
   2385     /* Byte counter. */
   2386     hw_val[0] = hw_val[1] = 0;
   2387     soc_memacc_field_get(memacc_byte, buf, hw_val);
   2388     
   2389     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
   2390         _bcm_field_37bit_counter_update(unit, hw_val, cntrs64_buf);
   2391     } else {
   2392         _bcm_field_36bit_counter_update(unit, hw_val, cntrs64_buf);
   2393     }
   2394 
   2395     if (NULL != byte_count) {
   2396         COMPILER_64_ADD_64(*byte_count, cntrs64_buf->accumulated_counter);
   2397     }
   2398 
   2399     /* Packet counter. */
   2400     hw_val[0] = hw_val[1] = 0;
   2401     soc_memacc_field_get(memacc_pkt, buf, hw_val);
   2402 
   2403     if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) {
   2404         _bcm_field_30bit_counter_update(unit, hw_val, cntrs32_buf);
   2405     } else {
   2406         _bcm_field_29bit_counter_update(unit, hw_val, cntrs32_buf);
   2407     }
   2408 
   2409     if (NULL != packet_count) {
   2410         COMPILER_64_ADD_64(*packet_count, cntrs32_buf->accumulated_counter);
   2411     }
   2412 
   2413     return BCM_E_NONE;
   2414 }
   2415 
   2416 /* this routine just be used by dpc thread */
   2417 STATIC void
   2418 _bcm_field_td_flush_ser_on_dpc(void *unit_vp, void *d1, void *d2, void *d3, void *d4)
   2419 {
   2420     int   unit = PTR_TO_INT(unit_vp);
   2421 
   2422     if (++flush_ser_event_count[unit][1] > flush_ser_event_count[unit][0]) {
   2423         flush_ser_event_count[unit][0] = flush_ser_event_count[unit][1];
   2424     }
   2425 }
   2426 
   2427 /* SER may write entries of counter memory as '0',
   2428  * however the value of last_hw_value is larger than '0',
   2429  * so last_hw_value need to be updated */
   2430 STATIC int
   2431 _bcm_field_td_counter_last_hw_val_update(int unit, _field_stage_t *stage_fc,
   2432                                          soc_mem_t counter_mem,
   2433                                          uint32 *mem_buf, int idx, int is_pipe_y,
   2434                                          soc_memacc_t *memacc_pkt,
   2435                                          soc_memacc_t *memacc_byte)
   2436 {
   2437     int          rv = BCM_E_NONE;
   2438     uint32       ser_entry_data[SOC_MAX_MEM_WORDS];
   2439     uint32       new_val[2];
   2440     uint64       new_val64;
   2441     _field_counter32_collect_t *cntrs32_buf;  /* Sw packet counter value    */
   2442     _field_counter64_collect_t *cntrs64_buf;  /* Sw byte counter value      */
   2443     uint32   per_sleep = 1000;
   2444 
   2445     if (is_pipe_y) {
   2446         cntrs64_buf = &stage_fc->_field_y64_counters[idx];
   2447         cntrs32_buf = &stage_fc->_field_y32_counters[idx];
   2448     } else {
   2449         cntrs64_buf = &stage_fc->_field_x64_counters[idx];
   2450         cntrs32_buf = &stage_fc->_field_x32_counters[idx];
   2451     }
   2452     new_val[0] = new_val[1] = 0;
   2453     soc_memacc_field_get(memacc_byte, mem_buf, new_val);
   2454     COMPILER_64_SET(new_val64, new_val[1], new_val[0]);
   2455 
   2456     new_val[0] = new_val[1] = 0;
   2457     soc_memacc_field_get(memacc_pkt, mem_buf, new_val);
   2458     if (COMPILER_64_LE(cntrs64_buf->last_hw_value, new_val64) &&
   2459         cntrs32_buf->last_hw_value <= new_val[0]) {
   2460         return BCM_E_NONE;
   2461     }
   2462 
   2463     if (!(SOC_SER_SUPPORT(unit) && SOC_SER_CORRECTION_SUPPORT(unit))) {
   2464         return BCM_E_NONE;
   2465     }
   2466 
   2467     flush_ser_event_count[unit][0]++;
   2468     rv = sal_dpc(_bcm_field_td_flush_ser_on_dpc, INT_TO_PTR(unit), 0, 0, 0, 0);
   2469     if (BCM_SUCCESS(rv)) {
   2470         soc_timeout_t to;
   2471         int timeout_usec = 2000000; /* Timeout time 2s */
   2472         /* when dpc is dead, variable counter-- guanranteed thread not to wait forever  */
   2473         soc_timeout_init(&to, timeout_usec, 0);
   2474         while((flush_ser_event_count[unit][0] - flush_ser_event_count[unit][1] > 0)) {
   2475             sal_usleep(per_sleep);
   2476             /* Add timeout to avoid dead loop */
   2477             if (soc_timeout_check(&to)) {
   2478                 break;
   2479             }
   2480         }
   2481     } else {
   2482         flush_ser_event_count[unit][0] = 0;
   2483         flush_ser_event_count[unit][1] = 0;
   2484     }
   2485     /* SER had updated counter memory */
   2486     sal_memset(ser_entry_data, 0, SOC_MAX_MEM_WORDS * sizeof(uint32));
   2487     rv = soc_ser_counter_info_get(unit, counter_mem, idx, ser_entry_data);
   2488     if (BCM_SUCCESS(rv)) {
   2489         new_val[0] = new_val[1] = 0;
   2490         soc_memacc_field_get(memacc_byte, ser_entry_data, new_val);
   2491         COMPILER_64_SET(new_val64, new_val[1], new_val[0]);
   2492         COMPILER_64_ZERO(cntrs64_buf->last_hw_value);
   2493         COMPILER_64_OR(cntrs64_buf->last_hw_value, new_val64);
   2494 
   2495         new_val[0] = new_val[1] = 0;
   2496         soc_memacc_field_get(memacc_pkt, ser_entry_data, new_val);
   2497         cntrs32_buf->last_hw_value = new_val[0];
   2498     } else if (BCM_E_NOT_FOUND == rv) {
   2499         /* No error (counter overflow) */
   2500         rv = BCM_E_NONE;
   2501     }
   2502     return rv;
   2503 }
   2504 
   2505 
   2506 /*
   2507  * Function:
   2508  *     _bcm_field_td_counter_get
   2509  * Purpose:
   2510  *     Update accumulated sw counter and return current counter value.
   2511  * Parameters:
   2512  *   unit          - (IN)  BCM device number
   2513  *   stage_fc      - (IN)  Stage field control
   2514  *   counter_x_mem - (IN)  Memory name for X pipe FP counter
   2515  *   mem_x_buf     - (IN)  Memory table entry for X pipe FP counter
   2516  *   counter_y_mem - (IN)  Memory name for Y pipe FP counter
   2517  *   mem_y_buf     - (IN)  Memory table entry for Y pipe FP counter
   2518  *   idx           - (IN)  Counter index
   2519  *   packet_count  - (OUT) Packet counter value
   2520  *   byte_count    - (OUT) Byte counter value
   2521  * Returns:
   2522  *    BCM_E_XXX
   2523  */
   2524 int
   2525 _bcm_field_td_counter_get(int unit, _field_stage_t *stage_fc,
   2526                           soc_mem_t counter_x_mem, uint32 *mem_x_buf,
   2527                           soc_mem_t counter_y_mem, uint32 *mem_y_buf,
   2528                           int idx, uint64 *packet_count, uint64 *byte_count)
   2529 {
   2530     _field_counter32_collect_t *cntrs32_buf;  /* Sw packet counter value    */
   2531     _field_counter64_collect_t *cntrs64_buf;  /* Sw byte counter value      */
   2532     soc_memacc_t *memacc_pkt_x, *memacc_byte_x; /* Memory access cache.   */
   2533     soc_memacc_t *memacc_pkt_y, *memacc_byte_y; /* Memory access cache.   */
   2534 
   2535 
   2536     /* Input parameters check. */
   2537     if (NULL == stage_fc) {
   2538         return BCM_E_PARAM;
   2539     }
   2540 
   2541     /* Extract X pipeline counter value. */
   2542     if (NULL != mem_x_buf) {
   2543         cntrs64_buf = &stage_fc->_field_x64_counters[idx];
   2544         cntrs32_buf = &stage_fc->_field_x32_counters[idx];
   2545         memacc_byte_x =
   2546             &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_BYTE]);
   2547         memacc_pkt_x =
   2548             &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_PACKET]);
   2549 
   2550         if (SOC_IS_TRIDENT2X(unit) || SOC_IS_TRIDENT(unit)) {
   2551             BCM_IF_ERROR_RETURN(
   2552                 _bcm_field_td_counter_last_hw_val_update(unit, stage_fc,
   2553                                                          counter_x_mem,
   2554                                                          mem_x_buf,
   2555                                                          idx, 0,
   2556                                                          memacc_pkt_x,
   2557                                                          memacc_byte_x));
   2558         }
   2559         SOC_IF_ERROR_RETURN
   2560             (_bcm_field_td_counter_read(unit, memacc_byte_x, memacc_pkt_x,
   2561                                         mem_x_buf,
   2562                                         cntrs32_buf, cntrs64_buf,
   2563                                         packet_count, byte_count));
   2564     }
   2565 
   2566     /* Extract Y pipeline counter value. */
   2567     if (NULL != mem_y_buf) {
   2568         cntrs64_buf = &stage_fc->_field_y64_counters[idx];
   2569         cntrs32_buf = &stage_fc->_field_y32_counters[idx];
   2570         memacc_byte_y =
   2571             &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_BYTE_Y]);
   2572         memacc_pkt_y =
   2573             &(stage_fc->_field_memacc_counters[_FIELD_COUNTER_MEMACC_PACKET_Y]);
   2574 
   2575         if (SOC_IS_TRIDENT2X(unit) || SOC_IS_TRIDENT(unit)) {
   2576             BCM_IF_ERROR_RETURN(
   2577                 _bcm_field_td_counter_last_hw_val_update(unit, stage_fc,
   2578                                                          counter_y_mem,
   2579                                                          mem_y_buf,
   2580                                                          idx, 1,
   2581                                                          memacc_pkt_y,
   2582                                                          memacc_byte_y));
   2583         }
   2584         SOC_IF_ERROR_RETURN
   2585             (_bcm_field_td_counter_read(unit, memacc_byte_y, memacc_pkt_y,
   2586                                         mem_y_buf,
   2587                                         cntrs32_buf, cntrs64_buf,
   2588                                         packet_count, byte_count));
   2589     }
   2590 
   2591     return BCM_E_NONE;
   2592 }
   2593 
   2594 /*
   2595  * Function:
   2596  *     _field_trident_functions_init
   2597  *
   2598  * Purpose:
   2599  *     Set up functions pointers 
   2600  *
   2601  * Parameters:
   2602  *     stage_fc - (IN/OUT) pointers to stage control block whe the device 
   2603  *                         and stage specific functions will be registered.
   2604  *
   2605  * Returns:
   2606  *     nothing
   2607  * Notes:
   2608  */
   2609 STATIC void
   2610 _field_trident_functions_init(_field_funct_t *functions)
   2611 {
   2612     functions->fp_detach               = _bcm_field_tr_detach;
   2613     functions->fp_group_install        = _bcm_field_fb_group_install;
   2614     functions->fp_selcodes_install     = _bcm_field_trx_selcodes_install;
   2615     functions->fp_slice_clear          = _bcm_field_trx_slice_clear;
   2616     functions->fp_entry_remove         = _bcm_field_fb_entry_remove;
   2617     functions->fp_entry_move           = _bcm_field_fb_entry_move;
   2618     functions->fp_selcode_get          = _bcm_field_tr_selcode_get;
   2619     functions->fp_selcode_to_qset      = _bcm_field_selcode_to_qset;
   2620     functions->fp_qual_list_get        = _bcm_field_qual_lists_get;
   2621     functions->fp_tcam_policy_clear    = NULL;
   2622     functions->fp_tcam_policy_install  = _bcm_field_tr_entry_install;
   2623     functions->fp_tcam_policy_reinstall = _bcm_field_tr_entry_reinstall;
   2624     functions->fp_policer_install      = _bcm_field_trx_policer_install;
   2625     functions->fp_write_slice_map      = _bcm_field_td_write_slice_map;
   2626     functions->fp_qualify_ip_type      = _bcm_field_trx_qualify_ip_type;
   2627     functions->fp_qualify_ip_type_get  = _bcm_field_trx_qualify_ip_type_get;
   2628     functions->fp_action_support_check = _bcm_field_trx_action_support_check;
   2629     functions->fp_action_conflict_check = _bcm_field_trx_action_conflict_check;
   2630     functions->fp_counter_get          = _bcm_field_td_counter_get;
   2631     functions->fp_counter_set          = _bcm_field_td_counter_set;
   2632     functions->fp_stat_index_get       = _bcm_field_trx_stat_index_get;
   2633     functions->fp_action_params_check  = _bcm_field_trx_action_params_check;
   2634     functions->fp_action_depends_check = NULL;
   2635     functions->fp_egress_key_match_type_set =
   2636         _bcm_field_trx_egress_key_match_type_set;
   2637     functions->fp_external_entry_install  = NULL;
   2638     functions->fp_external_entry_reinstall  = NULL;
   2639     functions->fp_external_entry_remove   = NULL;
   2640     functions->fp_external_entry_prio_set = NULL;
   2641     functions->fp_data_qualifier_ethertype_add = 
   2642                        _bcm_field_trx2_data_qualifier_ethertype_add;
   2643     functions->fp_data_qualifier_ethertype_delete= 
   2644                        _bcm_field_trx2_data_qualifier_ethertype_delete;
   2645     functions->fp_data_qualifier_ip_protocol_add = 
   2646                        _bcm_field_trx2_data_qualifier_ip_protocol_add;
   2647     functions->fp_data_qualifier_ip_protocol_delete= 
   2648                        _bcm_field_trx2_data_qualifier_ip_protocol_delete;
   2649     functions->fp_data_qualifier_packet_format_add= 
   2650                        _bcm_field_trx2_data_qualifier_packet_format_add;
   2651     functions->fp_data_qualifier_packet_format_delete=
   2652                         _bcm_field_trx2_data_qualifier_packet_format_delete;
   2653     functions->fp_stat_value_get = NULL;
   2654     functions->fp_stat_value_set = NULL;
   2655     functions->fp_control_set = _bcm_field_control_set;
   2656     functions->fp_control_get = _bcm_field_control_get;
   2657     functions->fp_stat_hw_mode_get = _bcm_field_stat_hw_mode_get;
   2658     functions->fp_stat_hw_alloc = _bcm_field_stat_hw_alloc;
   2659     functions->fp_stat_hw_free = _bcm_field_stat_hw_free;
   2660     functions->fp_group_add = NULL;
   2661     functions->fp_qualify_trunk = _bcm_field_qualify_trunk;
   2662     functions->fp_qualify_trunk_get = _bcm_field_qualify_trunk_get;
   2663     functions->fp_qualify_inports = _bcm_field_qualify_InPorts;
   2664     functions->fp_entry_stat_extended_attach = NULL;
   2665     functions->fp_entry_stat_extended_get = NULL;
   2666     functions->fp_entry_stat_detach = _bcm_field_entry_stat_detach;
   2667     functions->fp_class_size_get = NULL;
   2668     functions->fp_qualify_packet_res = _field_qualify_PacketRes;
   2669     functions->fp_qualify_packet_res_get = _field_qualify_PacketRes_get;
   2670 }
   2671 
   2672 /*
   2673  * Function: 
   2674  *   _bcm_field_trident_stat_hw_mode_to_bmap
   2675  *
   2676  * Description:
   2677  *      HW counter mode to statistics bitmap. 
   2678  * Parameters:
   2679  *      unit           - (IN) BCM device number.
   2680  *      mode           - (IN) HW counter mode.
   2681  *      stage_id       - (IN) Stage id.
   2682  *      hw_bmap        - (OUT) Statistics bitmap. 
   2683  *      hw_entry_count - (OUT) Number of counters required.
   2684  * Returns:
   2685  *      BCM_E_XXX
   2686  */
   2687 int 
   2688 _bcm_field_trident_stat_hw_mode_to_bmap(int unit, uint16 mode, 
   2689                                     _field_stage_id_t stage_id, 
   2690                                     uint32 *hw_bmap, uint8 *hw_entry_count)
   2691 {
   2692     uint32 value = 0;
   2693 
   2694     /* Input parameters check. */
   2695     if ((NULL == hw_bmap) || (NULL == hw_entry_count)) {
   2696         return (BCM_E_PARAM);
   2697     }
   2698     /*
   2699      * Counter update mode selection
   2700      * Upper counter mode = COUNTER_MODE[5:3]
   2701      * Lower counter mode = COUNTER_MODE[2:0]
   2702      * For each counter mode, each bit enables a color setting:
   2703      * 3'b000 = Do not update counter
   2704      * 3'b001 = Update this counter for Green packets
   2705      * 3'b010 = Update this counter for Yellow packets
   2706      * 3'b100 = Update this counter for Red packets
   2707      */
   2708     *hw_entry_count = ((mode & (0x7)) ? 1 : 0) + ((mode & (0x7 << 3)) ? 1 : 0);
   2709 
   2710 #if defined BCM_TRIDENT2_SUPPORT
   2711     if (SOC_IS_TRIDENT2(unit)) {
   2712        if (*hw_entry_count == 2) {
   2713           uint8 upperMode = 0;
   2714           uint8 lowerMode = 0;
   2715 
   2716           lowerMode = (mode & 0x7);
   2717           upperMode = ((mode >> 3) & 0x7);
   2718 
   2719          /*
   2720           * Hardware Restriction:
   2721           * The counter Pair doesn't allow same color.
   2722           *   The COUNTER MODE will now be six bits. The bits are:
   2723           *   Bit[3] = UPPER_COUNTER_IF_GREEN
   2724           *   Bit[4] = UPPER_COUNTER_IF_YELLOW
   2725           *   Bit[5] = UPPER_COUNTER_IF_RED
   2726           *   Bit[0] = LOWER_COUNTER_IF_GREEN
   2727           *   Bit[1] = LOWER_COUNTER_IF_YELLOW
   2728           *   Bit[2] = LOWER_COUNTER_IF_RED
   2729           *   It is legal to set any combination of the bits with one exception.
   2730           *   The same color cannot be enabled for both the upper and lower counters. In other words,
   2731           *   it's illegal to set both the UPPER_COUNTER_IF_GREEN and LOWER_COUNTER_IF_GREEN.
   2732           *   It's also illegal to set both the UPPER_COUNTER_IF_YELLOW and LOWER_COUNTER_IF_YELLOW.
   2733           *   It's also illegal to set both the UPPER_COUNTER_IF_RED and LOWER_COUNTER_IF_RED
   2734           */  
   2735           if (lowerMode & upperMode) {
   2736              LOG_DEBUG(BSL_LS_BCM_FP, (BSL_META_U(unit, "NOT Allowed:"
   2737                   " LowerMode:[0x%x] UpperMode:[0x%x] mode:[0x%x].\n\r"),
   2738                   lowerMode, upperMode, mode));
   2739              return BCM_E_CONFIG;
   2740           }
   2741        } 
   2742     }
   2743 #endif /* BCM_TRIDENT2_SUPPORT */
   2744 
   2745     switch (mode & 0x7) {
   2746         case 1:
   2747             /* TR Mode = 4 */
   2748             /* 001 */
   2749             value |= (1 << (int)bcmFieldStatGreenBytes);
   2750             value |= (1 << (int)bcmFieldStatGreenPackets);
   2751             break;
   2752         case 2:
   2753             /* 010 */
   2754             value |= (1 << (int)bcmFieldStatYellowBytes);
   2755             value |= (1 << (int)bcmFieldStatYellowPackets);
   2756             break;
   2757         case 3:
   2758             /* TR Mode = 3 */
   2759             /* TR Mode = 6 */
   2760             /* 011 */
   2761             value |= (1 << (int)bcmFieldStatNotRedBytes);
   2762             value |= (1 << (int)bcmFieldStatNotRedPackets);
   2763             break;
   2764         case 4:
   2765             /* TR Mode = 3 */
   2766             /* 100 */
   2767             value |= (1 << (int)bcmFieldStatRedBytes);
   2768             value |= (1 << (int)bcmFieldStatRedPackets);
   2769             break;
   2770         case 5:
   2771             /* TR Mode = 5 */
   2772             /* 101 */
   2773             value |= (1 << (int)bcmFieldStatNotYellowBytes);
   2774             value |= (1 << (int)bcmFieldStatNotYellowPackets);
   2775             break;
   2776         case 6:
   2777             /* TR Mode = 4 */
   2778             /* TR Mode = 7 */
   2779             /* 110 */
   2780             value |= (1 << (int)bcmFieldStatNotGreenBytes);
   2781             value |= (1 << (int)bcmFieldStatNotGreenPackets);
   2782             break;
   2783         case 7:
   2784             /* TR Mode = 1 */
   2785             /* 111 */
   2786             value |= (1 << (int)bcmFieldStatBytes);
   2787             value |= (1 << (int)bcmFieldStatPackets);
   2788             break;
   2789       default:
   2790             break;
   2791     }
   2792 
   2793     switch ((mode >> 3) & (0x7)) {
   2794         case 1:
   2795             /* TR Mode = 4 */
   2796             /* 001 */
   2797             value |= (1 << (int)bcmFieldStatGreenBytes);
   2798             value |= (1 << (int)bcmFieldStatGreenPackets);
   2799             break;
   2800         case 2:
   2801             /* 010 */
   2802             value |= (1 << (int)bcmFieldStatYellowBytes);
   2803             value |= (1 << (int)bcmFieldStatYellowPackets);
   2804             break;
   2805         case 3:
   2806             /* TR Mode = 3 */
   2807             /* TR Mode = 6 */
   2808             /* 021 */
   2809             value |= (1 << (int)bcmFieldStatNotRedBytes);
   2810             value |= (1 << (int)bcmFieldStatNotRedPackets);
   2811             break;
   2812         case 4:
   2813             /* TR Mode = 3 */
   2814             /* 100 */
   2815             value |= (1 << (int)bcmFieldStatRedBytes);
   2816             value |= (1 << (int)bcmFieldStatRedPackets);
   2817             break;
   2818         case 5:
   2819             /* TR Mode = 5 */
   2820             /* 101 */
   2821             value |= (1 << (int)bcmFieldStatNotYellowBytes);
   2822             value |= (1 << (int)bcmFieldStatNotYellowPackets);
   2823             break;
   2824         case 6:
   2825             /* TR Mode = 4 */
   2826             /* TR Mode = 7 */
   2827             /* 110 */
   2828             value |= (1 << (int)bcmFieldStatNotGreenBytes);
   2829             value |= (1 << (int)bcmFieldStatNotGreenPackets);
   2830             break;
   2831       case 7:
   2832             /* TR Mode = 2 */
   2833             /* 111 */
   2834             value |= (1 << (int)bcmFieldStatBytes);
   2835             value |= (1 << (int)bcmFieldStatPackets);
   2836             break;
   2837       default:
   2838             break;
   2839     }
   2840 
   2841     *hw_bmap = value;
   2842     return (BCM_E_NONE);
   2843 }
   2844 #else /* BCM_TRIDENT_SUPPORT && BCM_FIELD_SUPPORT */
   2845 int _trident_field_not_empty;
   2846 #endif  /* BCM_TRIDENT_SUPPORT && BCM_FIELD_SUPPORT */