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

flexctr.h (68547B)


      1 /*
      2  * 
      3  * 
      4  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5  * 
      6  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      7  *
      8  */
      9 
     10 #ifndef __BCM_FLEXCTR_H__
     11 #define __BCM_FLEXCTR_H__
     12 
     13 #include <bcm/types.h>
     14 #include <bcm/port.h>
     15 
     16 /* 
     17  * Enumeration of flex counter sources.
     18  * 
     19  * Flex counter source indicates the sources to generates a flex counter
     20  * action.
     21  */
     22 typedef enum bcm_flexctr_source_e {
     23     bcmFlexctrSourceIngPort = 0,        /* Ingress system port. */
     24     bcmFlexctrSourceEgrPort = 1,        /* Egress system port. */
     25     bcmFlexctrSourceIngVlan = 2,        /* Ingress VLAN. */
     26     bcmFlexctrSourceEgrVlan = 3,        /* Egress VLAN. */
     27     bcmFlexctrSourceIngVpn = 4,         /* Ingress VPN. */
     28     bcmFlexctrSourceEgrVpn = 5,         /* Egress VPN. */
     29     bcmFlexctrSourceSvp = 6,            /* Source VP. */
     30     bcmFlexctrSourceDvp = 7,            /* Destination VP. */
     31     bcmFlexctrSourceIngL3Intf = 8,      /* Ingress L3 interface. */
     32     bcmFlexctrSourceIngVrf = 9,         /* Ingress VRF. */
     33     bcmFlexctrSourceIfp = 10,           /* Ingress filter processor. */
     34     bcmFlexctrSourceVfp = 11,           /* Ingress VLAN filter processor. */
     35     bcmFlexctrSourceEfp = 12,           /* Egress filter processor. */
     36     bcmFlexctrSourceL3EgressOverlay = 13, /* Overlay L3 egress. */
     37     bcmFlexctrSourceL3EgressUnderlay = 14, /* Underlay L3 egress. */
     38     bcmFlexctrSourceExactMatch = 15,    /* ExactMatch filter processor. */
     39     bcmFlexctrSourceIpmc = 16,          /* Ipmc. */
     40     bcmFlexctrSourceFieldDestination = 17, /* Destination field. */
     41     bcmFlexctrSourceIngSamplePool = 18, /* Packets eligible to be sampled by
     42                                            ingress sampler. */
     43     bcmFlexctrSourceIngSampleCount = 19, /* Packets sampled by ingress sampler. */
     44     bcmFlexctrSourceFlexSamplePool = 20, /* Packets eligible to be sampled by
     45                                            flex sampler. */
     46     bcmFlexctrSourceFlexSampleCount = 21, /* Packets sampled by flex sampler. */
     47     bcmFlexctrSourceL3Route = 22,       /* L3 route. */
     48     bcmFlexctrSourceMplsLabel = 23,     /* MPLS termination. */
     49     bcmFlexctrSourceIpTunnelTerminator = 24, /* IP tunnel termination. */
     50     bcmFlexctrSourceEcmp = 25,          /* ECMP group. */
     51     bcmFlexctrSourceEgrL3Intf = 26,     /* Egress L3 interface. */
     52     bcmFlexctrSourceTrunk = 27,         /* TRUNK group. */
     53     bcmFlexctrSourceLatencyMonitor = 28, /* Latency monitor. */
     54     bcmFlexctrSourceEsFilter = 29,      /* Ethernet Segment filter. */
     55     bcmFlexctrSourceL2TunnelInitiator = 30, /* L2 tunnel initiator. */
     56     bcmFlexctrSourceL2TunnelVnidAssignment = 31, /* L2 tunnel VNID assignment. */
     57     bcmFlexctrSourceL2TunnelTerminator = 32, /* L2 tunnel termination. */
     58     bcmFlexctrSourceL2TunnelVpnAssignment = 33, /* L2 tunnel VPN assignment. */
     59     bcmFlexctrSourceSvpAssignment = 34, /* Source VP assignment. */
     60     bcmFlexctrSourceIngVlanTranslate = 35, /* Ingress VLAN translation. */
     61     bcmFlexctrSourceEgrVlanTranslate = 36, /* Egress VLAN translation. */
     62     bcmFlexctrSourceCount = 37          /* Always last one. */
     63 } bcm_flexctr_source_t;
     64 
     65 #define BCM_FLEXCTR_SOURCE_NAME_INITIALIZER \
     66 { \
     67     "bcmFlexctrSourceIngPort", \
     68     "bcmFlexctrSourceEgrPort", \
     69     "bcmFlexctrSourceIngVlan", \
     70     "bcmFlexctrSourceEgrVlan", \
     71     "bcmFlexctrSourceIngVpn", \
     72     "bcmFlexctrSourceEgrVpn", \
     73     "bcmFlexctrSourceSvp", \
     74     "bcmFlexctrSourceDvp", \
     75     "bcmFlexctrSourceIngL3Intf", \
     76     "bcmFlexctrSourceIngVrf", \
     77     "bcmFlexctrSourceIfp", \
     78     "bcmFlexctrSourceVfp", \
     79     "bcmFlexctrSourceEfp", \
     80     "bcmFlexctrSourceL3EgressOverlay", \
     81     "bcmFlexctrSourceL3EgressUnderlay", \
     82     "bcmFlexctrSourceExactMatch", \
     83     "bcmFlexctrSourceIpmc", \
     84     "bcmFlexctrSourceFieldDestination", \
     85     "bcmFlexctrSourceIngSamplePool", \
     86     "bcmFlexctrSourceIngSampleCount", \
     87     "bcmFlexctrSourceFlexSamplePool", \
     88     "bcmFlexctrSourceFlexSampleCount", \
     89     "bcmFlexctrSourceL3Route", \
     90     "bcmFlexctrSourceMplsLabel", \
     91     "bcmFlexctrSourceIpTunnelTerminator", \
     92     "bcmFlexctrSourceEcmp", \
     93     "bcmFlexctrSourceEgrL3Intf", \
     94     "bcmFlexctrSourceTrunk", \
     95     "bcmFlexctrSourceLatencyMonitor", \
     96     "bcmFlexctrSourceEsFilter", \
     97     "bcmFlexctrSourceL2TunnelInitiator", \
     98     "bcmFlexctrSourceL2TunnelVnidAssignment", \
     99     "bcmFlexctrSourceL2TunnelTerminator", \
    100     "bcmFlexctrSourceL2TunnelVpnAssignment", \
    101     "bcmFlexctrSourceSvpAssignment", \
    102     "bcmFlexctrSourceIngVlanTranslate", \
    103     "bcmFlexctrSourceEgrVlanTranslate", \
    104     "bcmFlexctrSourceCount"  \
    105 }
    106 
    107 /* 
    108  * Enumeration of flex counter objects.
    109  * 
    110  * Flex counter object could be used to generate counter index and
    111  * counter value.
    112  * Some objects could also be used for conditional trigger and
    113  * quantization.
    114  */
    115 typedef enum bcm_flexctr_object_e {
    116     bcmFlexctrObjectConstZero = 0,      /* Const value 0 object. */
    117     bcmFlexctrObjectConstOne = 1,       /* Const value 1 object. */
    118     bcmFlexctrObjectTriggerInterval = 2, /* Trigger interval object. */
    119     bcmFlexctrObjectQuant = 3,          /* Quantization result object. */
    120     bcmFlexctrObjectStaticIngFieldStageLookup = 4, /* Ingress: VFP object. */
    121     bcmFlexctrObjectStaticIngFieldStageIngress = 5, /* Ingress: IFP object. */
    122     bcmFlexctrObjectStaticIngExactMatch = 6, /* Ingress: exact match FP Object. */
    123     bcmFlexctrObjectStaticIngMplsSingleTable = 7, /* Ingress: MPLS single table object. */
    124     bcmFlexctrObjectStaticIngMplsDoubleTable = 8, /* Ingress: MPLS double table object. */
    125     bcmFlexctrObjectStaticIngL3Tunnel = 9, /* Ingress: L3 tunnel object. */
    126     bcmFlexctrObjectStaticIngFlowCountPrefixLength = 10, /* Ingress: flow count prefix length
    127                                            object. */
    128     bcmFlexctrObjectStaticIngFlowCountPortContext = 11, /* Ingress: flow count port context
    129                                            object. */
    130     bcmFlexctrObjectStaticIngFlowCountFlowSizeLower = 12, /* Ingress: flow count flow size lower
    131                                            byte object. */
    132     bcmFlexctrObjectStaticIngFlowCountFlowSizeUpper = 13, /* Ingress: flow count flow size upper
    133                                            byte object. */
    134     bcmFlexctrObjectStaticIngAlpmSrcLookup = 14, /* Ingress: ALPM source lookup object. */
    135     bcmFlexctrObjectStaticIngAlpmDstLookup = 15, /* Ingress: ALPM destination lookup
    136                                            object. */
    137     bcmFlexctrObjectStaticIngLookupHitStatus = 16, /* Ingress: lookup hit status object. */
    138     bcmFlexctrObjectStaticIngIngressPort = 17, /* Ingress: ingress port object. */
    139     bcmFlexctrObjectStaticIngEgressPort = 18, /* Ingress: egress port object. */
    140     bcmFlexctrObjectStaticIngVlan = 19, /* Ingress: VLAN object. */
    141     bcmFlexctrObjectStaticIngL3Intf = 20, /* Ingress: L3 ingress interface
    142                                            (L3_IIF) object. */
    143     bcmFlexctrObjectStaticIngVrf = 21,  /* Ingress: VRF object. */
    144     bcmFlexctrObjectStaticIngPortClassId = 22, /* Ingress: port class ID object. */
    145     bcmFlexctrObjectStaticIngEcmpGroup = 23, /* Ingress: ECMP group object. */
    146     bcmFlexctrObjectStaticIngEcmpMember = 24, /* Ingress: ECMP member object. */
    147     bcmFlexctrObjectStaticIngNextHopOrMcIndex = 25, /* Ingress: next hop or multicast index
    148                                            object. */
    149     bcmFlexctrObjectStaticIngRtag7Hash0Instance0 = 26, /* Ingress: RTAG7 subselection hash 0
    150                                            and instance 0 object. */
    151     bcmFlexctrObjectStaticIngRtag7Hash0Instance1 = 27, /* Ingress: RTAG7 subselection hash 0
    152                                            and instance 1 object. */
    153     bcmFlexctrObjectStaticIngRtag7Hash1Instance0 = 28, /* Ingress: RTAG7 subselection hash 1
    154                                            and instance 0 object. */
    155     bcmFlexctrObjectStaticIngRtag7Hash1Instance1 = 29, /* Ingress: RTAG7 subselection hash 1
    156                                            and instance 1 object. */
    157     bcmFlexctrObjectStaticIngIngressTimestampBitRange0 = 30, /* Ingress: ingress timestamp object for
    158                                            bit 0 to 15. */
    159     bcmFlexctrObjectStaticIngIngressTimestampBitRange1 = 31, /* Ingress: ingress timestamp object for
    160                                            bit 16 to 31. */
    161     bcmFlexctrObjectStaticIngIngressTimestampBitRange2 = 32, /* Ingress: ingress timestamp object for
    162                                            bit 32 to 47. */
    163     bcmFlexctrObjectStaticIngIpTotalLength = 33, /* Ingress: packet length in IP header
    164                                            object. */
    165     bcmFlexctrObjectStaticIngL4Flags = 34, /* Ingress: L4 flags object. */
    166     bcmFlexctrObjectStaticIngUdf1 = 35, /* Ingress: UDF1 object. */
    167     bcmFlexctrObjectStaticIngUdf2 = 36, /* Ingress: UDF2 object. */
    168     bcmFlexctrObjectStaticIngIntPri = 37, /* Ingress: internal priority object. */
    169     bcmFlexctrObjectStaticIngIntCn = 38, /* Ingress: internal congestion
    170                                            notification object. */
    171     bcmFlexctrObjectStaticIngModEvent = 39, /* Ingress: mirror-on-drop event object. */
    172     bcmFlexctrObjectStaticIngTrunkGroup = 40, /* Ingress: trunk group object. */
    173     bcmFlexctrObjectStaticIngTrunkMember = 41, /* Ingress: trunk member object. */
    174     bcmFlexctrObjectStaticIngIpProtocol = 42, /* Ingress: protocol field in IP header
    175                                            object. */
    176     bcmFlexctrObjectStaticEgrAdapt = 43, /* Egress: egress adapt table object. */
    177     bcmFlexctrObjectStaticEgrFieldStageEgress = 44, /* Egress: EFP object. */
    178     bcmFlexctrObjectStaticEgrIngressPort = 45, /* Egress: ingress port object. */
    179     bcmFlexctrObjectStaticEgrEgressPort = 46, /* Egress: egress port object. */
    180     bcmFlexctrObjectStaticEgrVlan = 47, /* Egress: VLAN object. */
    181     bcmFlexctrObjectStaticEgrVrf = 48,  /* Egress: VRF object. */
    182     bcmFlexctrObjectStaticEgrL3Oif = 49, /* Egress: L3 outgoing interface object. */
    183     bcmFlexctrObjectStaticEgrL3TunnelIndex = 50, /* Egress: L3 tunnel index object. */
    184     bcmFlexctrObjectStaticEgrL3NextHop = 51, /* Egress: L3 next hop object. */
    185     bcmFlexctrObjectStaticEgrL3NextHopMetadata = 52, /* Egress: L3 next hop metadata object. */
    186     bcmFlexctrObjectStaticEgrI2eClassId = 53, /* Egress: I2E class ID object. */
    187     bcmFlexctrObjectStaticEgrI2eClassIdType = 54, /* Egress: I2E class ID type object. */
    188     bcmFlexctrObjectStaticEgrQueueNum = 55, /* Egress: queue number object. */
    189     bcmFlexctrObjectStaticEgrQueueOccupancy = 56, /* Egress: queue occupancy object. */
    190     bcmFlexctrObjectStaticEgrResidenceTimestampLower = 57, /* Egress: residency timestamp lower
    191                                            object. */
    192     bcmFlexctrObjectStaticEgrResidenceTimestampUpper = 58, /* Egress: residency timestamp upper
    193                                            object. */
    194     bcmFlexctrObjectStaticEgrEgressTimestampBitRange0 = 59, /* Egress: egress timestamp object for
    195                                            bit 0 to 15. */
    196     bcmFlexctrObjectStaticEgrEgressTimestampBitRange1 = 60, /* Egress: egress timestamp object for
    197                                            bit 16 to 31. */
    198     bcmFlexctrObjectStaticEgrEgressTimestampBitRange2 = 61, /* Egress: egress timestamp object for
    199                                            bit 32 to 47. */
    200     bcmFlexctrObjectStaticEgrIngressTimestampBitRange0 = 62, /* Egress: ingress timestamp object for
    201                                            bit 0 to 15. */
    202     bcmFlexctrObjectStaticEgrIngressTimestampBitRange1 = 63, /* Egress: ingress timestamp object for
    203                                            bit 16 to 31. */
    204     bcmFlexctrObjectStaticEgrIngressTimestampBitRange2 = 64, /* Egress: ingress timestamp object for
    205                                            bit 32 to 47. */
    206     bcmFlexctrObjectStaticEgrEntropyLabelBitRange0 = 65, /* Egress: entropy label object for bit
    207                                            0 to 15. */
    208     bcmFlexctrObjectStaticEgrEntropyLabelBitRange1 = 66, /* Egress: entropy label object for bit
    209                                            16 to 25. */
    210     bcmFlexctrObjectStaticEgrModEvent = 67, /* Egress: mirror-on-drop event object. */
    211     bcmFlexctrObjectStaticEgrIntPri = 68, /* Egress: internal priority object. */
    212     bcmFlexctrObjectStaticEgrIntCn = 69, /* Egress: internal congestion
    213                                            notification object. */
    214     bcmFlexctrObjectStaticEgrCng = 70,  /* Egress: congestion color object. */
    215     bcmFlexctrObjectStaticEgrPortAndQueueNum = 71, /* Egress: port and queue number object. */
    216     bcmFlexctrObjectStaticIngPktAttribute = 72, /* Ingress: packet attribute offset
    217                                            object. */
    218     bcmFlexctrObjectStaticEgrPktAttribute = 73, /* Egress: packet attribute offset
    219                                            object. */
    220     bcmFlexctrObjectStaticIngVfi = 74,  /* Ingress: VFI (virtual forwarding
    221                                            instance). */
    222     bcmFlexctrObjectStaticIngDvp = 75,  /* Ingress: destination VP (virtual
    223                                            port). */
    224     bcmFlexctrObjectStaticIngSvp = 76,  /* Ingress: source VP (virtual port). */
    225     bcmFlexctrObjectStaticIngOverlayEcmpGroup = 77, /* Ingress: overlay ECMP group object. */
    226     bcmFlexctrObjectStaticIngOverlayEcmpMember = 78, /* Ingress: overlay ECMP member object. */
    227     bcmFlexctrObjectStaticIngOverlayL3NextHop = 79, /* Ingress: overlay L3 next hop object. */
    228     bcmFlexctrObjectStaticEgrDvp = 80,  /* Egress: destination VP (virtual
    229                                            port). */
    230     bcmFlexctrObjectStaticEgrSvp = 81,  /* Egress: source VP (virtual port). */
    231     bcmFlexctrObjectStaticEgrVfi = 82,  /* Egress: VFI (virtual forwarding
    232                                            instance). */
    233     bcmFlexctrObjectStaticEgrNetworkGroupSvp = 83, /* Egress: network group for source VP
    234                                            (virtual port). */
    235     bcmFlexctrObjectStaticEgrNetworkGroupDvp = 84, /* Egress: network group for destination
    236                                            VP (virtual port). */
    237     bcmFlexctrObjectStaticEgrOverlayL3NextHop = 85, /* Egress: overlay L3 next hop object. */
    238     bcmFlexctrObjectStaticEgrOverlayL3Oif = 86, /* Egress: overlay L3 outgoing interface
    239                                            object. */
    240     bcmFlexctrObjectStaticCount = 87,   /* Always last for static objects. Not a
    241                                            usable value. */
    242     bcmFlexctrObjectIngSystemSource = 1000, /* Ingress system source object. */
    243     bcmFlexctrObjectIngIngressPpPort = 1001, /* Ingress pp port object. */
    244     bcmFlexctrObjectIngL2Iif = 1002,    /* Ingress l2 iif object. */
    245     bcmFlexctrObjectIngL3Iif = 1003,    /* Ingress l3 iif object. */
    246     bcmFlexctrObjectIngL2SrcLookupHitIndex0 = 1004, /* Ingress l2 src lookup hit index 0
    247                                            object. */
    248     bcmFlexctrObjectIngL2SrcLookupHitIndex1 = 1005, /* Ingress l2 src lookup hit index 1
    249                                            object. */
    250     bcmFlexctrObjectIngL2DstLookupHitIndex0 = 1006, /* Ingress l2 dst lookup hit index 0
    251                                            object. */
    252     bcmFlexctrObjectIngL2DstLookupHitIndex1 = 1007, /* Ingress l2 dst lookup hit index 1
    253                                            object. */
    254     bcmFlexctrObjectIngSvp = 1008,      /* Ingress svp object. */
    255     bcmFlexctrObjectIngVfi = 1009,      /* Ingress vfi object. */
    256     bcmFlexctrObjectIngDstFpFlexCtrIndex = 1010, /* Ingress dst fp flex ctr index object. */
    257     bcmFlexctrObjectIngIfpOpaqueObj1 = 1011, /* Ingress ifp opaque obj 1 object. */
    258     bcmFlexctrObjectIngIfpOpaqueObj0 = 1012, /* Ingress ifp opaque obj 0 object. */
    259     bcmFlexctrObjectEgrVfi = 1013,      /* Egress vfi object. */
    260     bcmFlexctrObjectEgrDvp = 1014,      /* Egress dvp object. */
    261     bcmFlexctrObjectEgrL2Oif = 1015,    /* Egress l2 oif object. */
    262     bcmFlexctrObjectEgrL3Oif1 = 1016,   /* Egress l3 oif 1 object. */
    263     bcmFlexctrObjectEgrTxPpPort = 1017, /* Egress tx pp port object. */
    264     bcmFlexctrObjectEgrL3Oif2 = 1018,   /* Egress l3 oif 2 object. */
    265     bcmFlexctrObjectEgrL3NextHop2FlexCtrIndex = 1019, /* Egress l3 next hop 2 flex ctr index
    266                                            object. */
    267     bcmFlexctrObjectEgrL3NextHop1FlexCtrIndex = 1020, /* Egress l3 next hop 1 flex ctr index
    268                                            object. */
    269     bcmFlexctrObjectEgrPipePortQueueNum = 1021, /* Egress pipe port queue num object. */
    270     bcmFlexctrObjectEgrEfpOpaqueObj2 = 1022, /* Egress efp opaque obj 2 object. */
    271     bcmFlexctrObjectEgrEfpOpaqueObj1 = 1023, /* Egress efp opaque obj 1 object. */
    272     bcmFlexctrObjectEgrResidenceTimeShifted0 = 1024, /* Egress residence time shifted 0
    273                                            object. */
    274     bcmFlexctrObjectEgrResidenceTimeShifted = 1025, /* Egress residence time shifted object. */
    275     bcmFlexctrObjectIngVfpOpaqueObj0 = 1026, /* Ingress vfp opaque obj 0 object. */
    276     bcmFlexctrObjectIngNhop2OrEcmpGroupIndex1 = 1027, /* Ingress nhop 2 or ecmp group index 1
    277                                            object. */
    278     bcmFlexctrObjectIngNhopIndex1 = 1028, /* Ingress nhop index 1 object. */
    279     bcmFlexctrObjectIngEmFtOpaqueObj1 = 1029, /* Ingress em ft opaque obj 1 object. */
    280     bcmFlexctrObjectIngEmFtOpaqueObj0 = 1030, /* Ingress em ft opaque obj 0 object. */
    281     bcmFlexctrObjectEgrEcnMapInputVector = 1031, /* Egress ecn map input vector object. */
    282     bcmFlexctrObjectIngEmFtHitIndex0 = 1032, /* Ingress em ft hit index 0 object. */
    283     bcmFlexctrObjectIngEmFtHitIndex1 = 1033, /* Ingress em ft hit index 1 object. */
    284     bcmFlexctrObjectIngL3DstClassId = 1034, /* Ingress l3 dst class id object. */
    285     bcmFlexctrObjectEgrResidenceTimeShifted1 = 1035, /* Egress residence time shifted 1
    286                                            object. */
    287     bcmFlexctrObjectEgrEcnMapInputVector0 = 1036, /* Egress ecn map input vector 0 object. */
    288     bcmFlexctrObjectIngIntPri = 1037,   /* Ingress int pri object. */
    289     bcmFlexctrObjectIngIfpOpaqueObj2 = 1038, /* Ingress ifp opaque obj 2 object. */
    290     bcmFlexctrObjectEgrIntcnIntpriCng0 = 1039, /* Egress intcn intpri cng 0 object. */
    291     bcmFlexctrObjectEgrIntcnIntpriCng = 1040, /* Egress intcn intpri cng object. */
    292     bcmFlexctrObjectEgrL3Oif216VfiClassid = 1041, /* Egress l3 oif 2 16 vfi classid
    293                                            object. */
    294     bcmFlexctrObjectIngIngressQoSRemapValue = 1042, /* Ingress QoS Remap value object. */
    295     bcmFlexctrObjectIngFlexDigestA0 = 1043, /* Ingress flex digest a0 object. */
    296     bcmFlexctrObjectIngFlexDigestA1 = 1044, /* Ingress flex digest a1 object. */
    297     bcmFlexctrObjectIngFlexDigestB0 = 1045, /* Ingress flex digest b0 object. */
    298     bcmFlexctrObjectIngFlexDigestB1 = 1046, /* Ingress flex digest b1 object. */
    299     bcmFlexctrObjectIngFlexDigestC0 = 1047, /* Ingress flex digest c0 object. */
    300     bcmFlexctrObjectIngFlexDigestC1 = 1048, /* Ingress flex digest c1 object. */
    301     bcmFlexctrObjectIngIpHdrTotalLength = 1049, /* Ingress ip header total length
    302                                            object. */
    303     bcmFlexctrObjectIngI2eClassId = 1050, /* Ingress i2e class id object. */
    304     bcmFlexctrObjectIngVlanXlate = 1051, /* Ingress vlan xlate object. */
    305     bcmFlexctrObjectIngIfpLagDgmActionSet = 1052, /* Ingress ifp lag dgm action set
    306                                            object. */
    307     bcmFlexctrObjectIngIfpSamplerIndex = 1053, /* Ingress ifp sampler index object. */
    308     bcmFlexctrObjectIngEmFtOpaqueObj = 1054, /* Ingress em ft opaque obj object. */
    309     bcmFlexctrObjectEgrEvxltFlexCtrIndex = 1055, /* Egress evxlt flex ctr index object. */
    310     bcmFlexctrObjectIngIfpOpaqueObj1_0 = 1056, /* Ingress ifp opaque obj 1 0 object. */
    311     bcmFlexctrObjectIngIfpOpaqueObj1_1 = 1057, /* Ingress ifp opaque obj 1 1 object. */
    312     bcmFlexctrObjectIngIfpOpaqueObj1_2 = 1058, /* Ingress ifp opaque obj 1 2 object. */
    313     bcmFlexctrObjectIngIfpOpaqueObj1_3 = 1059, /* Ingress ifp opaque obj 1 3 object. */
    314     bcmFlexctrObjectIngIfpOpaqueObj3 = 1060, /* Ingress ifp opaque obj 3 object. */
    315     bcmFlexctrObjectIngIfpOpaqueObj4 = 1061, /* Ingress ifp opaque obj 4 object. */
    316     bcmFlexctrObjectIngIfpOpaqueObj5 = 1062, /* Ingress ifp opaque obj 5 object. */
    317     bcmFlexctrObjectIngIfpOpaqueObj6 = 1063, /* Ingress ifp opaque obj 6 object. */
    318     bcmFlexctrObjectIngIfpOpaqueObj7 = 1064, /* Ingress ifp opaque obj 7 object. */
    319     bcmFlexctrObjectIngIfpOpaqueObj8 = 1065, /* Ingress ifp opaque obj 8 object. */
    320     bcmFlexctrObjectIngIfpOpaqueObj9 = 1066, /* Ingress ifp opaque obj 9 object. */
    321     bcmFlexctrObjectIngVfpOpaqueObj1 = 1067, /* Ingress vfp opaque obj 1 object. */
    322     bcmFlexctrObjectIngEpNihHdrDropCode = 1068, /* Ingress EP NIH header drop code
    323                                            object. */
    324     bcmFlexctrObjectEgrEpRecircProfile = 1069, /* Egress EP Recirculate profile object. */
    325     bcmFlexctrObjectCount = 1070        /* Always last one. */
    326 } bcm_flexctr_object_t;
    327 
    328 #define BCM_FLEXCTR_OBJECT_NAME_INITIALIZER \
    329 { \
    330     "bcmFlexctrObjectConstZero", \
    331     "bcmFlexctrObjectConstOne", \
    332     "bcmFlexctrObjectTriggerInterval", \
    333     "bcmFlexctrObjectQuant", \
    334     "bcmFlexctrObjectStaticIngFieldStageLookup", \
    335     "bcmFlexctrObjectStaticIngFieldStageIngress", \
    336     "bcmFlexctrObjectStaticIngExactMatch", \
    337     "bcmFlexctrObjectStaticIngMplsSingleTable", \
    338     "bcmFlexctrObjectStaticIngMplsDoubleTable", \
    339     "bcmFlexctrObjectStaticIngL3Tunnel", \
    340     "bcmFlexctrObjectStaticIngFlowCountPrefixLength", \
    341     "bcmFlexctrObjectStaticIngFlowCountPortContext", \
    342     "bcmFlexctrObjectStaticIngFlowCountFlowSizeLower", \
    343     "bcmFlexctrObjectStaticIngFlowCountFlowSizeUpper", \
    344     "bcmFlexctrObjectStaticIngAlpmSrcLookup", \
    345     "bcmFlexctrObjectStaticIngAlpmDstLookup", \
    346     "bcmFlexctrObjectStaticIngLookupHitStatus", \
    347     "bcmFlexctrObjectStaticIngIngressPort", \
    348     "bcmFlexctrObjectStaticIngEgressPort", \
    349     "bcmFlexctrObjectStaticIngVlan", \
    350     "bcmFlexctrObjectStaticIngL3Intf", \
    351     "bcmFlexctrObjectStaticIngVrf", \
    352     "bcmFlexctrObjectStaticIngPortClassId", \
    353     "bcmFlexctrObjectStaticIngEcmpGroup", \
    354     "bcmFlexctrObjectStaticIngEcmpMember", \
    355     "bcmFlexctrObjectStaticIngNextHopOrMcIndex", \
    356     "bcmFlexctrObjectStaticIngRtag7Hash0Instance0", \
    357     "bcmFlexctrObjectStaticIngRtag7Hash0Instance1", \
    358     "bcmFlexctrObjectStaticIngRtag7Hash1Instance0", \
    359     "bcmFlexctrObjectStaticIngRtag7Hash1Instance1", \
    360     "bcmFlexctrObjectStaticIngIngressTimestampBitRange0", \
    361     "bcmFlexctrObjectStaticIngIngressTimestampBitRange1", \
    362     "bcmFlexctrObjectStaticIngIngressTimestampBitRange2", \
    363     "bcmFlexctrObjectStaticIngIpTotalLength", \
    364     "bcmFlexctrObjectStaticIngL4Flags", \
    365     "bcmFlexctrObjectStaticIngUdf1", \
    366     "bcmFlexctrObjectStaticIngUdf2", \
    367     "bcmFlexctrObjectStaticIngIntPri", \
    368     "bcmFlexctrObjectStaticIngIntCn", \
    369     "bcmFlexctrObjectStaticIngModEvent", \
    370     "bcmFlexctrObjectStaticIngTrunkGroup", \
    371     "bcmFlexctrObjectStaticIngTrunkMember", \
    372     "bcmFlexctrObjectStaticIngIpProtocol", \
    373     "bcmFlexctrObjectStaticEgrAdapt", \
    374     "bcmFlexctrObjectStaticEgrFieldStageEgress", \
    375     "bcmFlexctrObjectStaticEgrIngressPort", \
    376     "bcmFlexctrObjectStaticEgrEgressPort", \
    377     "bcmFlexctrObjectStaticEgrVlan", \
    378     "bcmFlexctrObjectStaticEgrVrf", \
    379     "bcmFlexctrObjectStaticEgrL3Oif", \
    380     "bcmFlexctrObjectStaticEgrL3TunnelIndex", \
    381     "bcmFlexctrObjectStaticEgrL3NextHop", \
    382     "bcmFlexctrObjectStaticEgrL3NextHopMetadata", \
    383     "bcmFlexctrObjectStaticEgrI2eClassId", \
    384     "bcmFlexctrObjectStaticEgrI2eClassIdType", \
    385     "bcmFlexctrObjectStaticEgrQueueNum", \
    386     "bcmFlexctrObjectStaticEgrQueueOccupancy", \
    387     "bcmFlexctrObjectStaticEgrResidenceTimestampLower", \
    388     "bcmFlexctrObjectStaticEgrResidenceTimestampUpper", \
    389     "bcmFlexctrObjectStaticEgrEgressTimestampBitRange0", \
    390     "bcmFlexctrObjectStaticEgrEgressTimestampBitRange1", \
    391     "bcmFlexctrObjectStaticEgrEgressTimestampBitRange2", \
    392     "bcmFlexctrObjectStaticEgrIngressTimestampBitRange0", \
    393     "bcmFlexctrObjectStaticEgrIngressTimestampBitRange1", \
    394     "bcmFlexctrObjectStaticEgrIngressTimestampBitRange2", \
    395     "bcmFlexctrObjectStaticEgrEntropyLabelBitRange0", \
    396     "bcmFlexctrObjectStaticEgrEntropyLabelBitRange1", \
    397     "bcmFlexctrObjectStaticEgrModEvent", \
    398     "bcmFlexctrObjectStaticEgrIntPri", \
    399     "bcmFlexctrObjectStaticEgrIntCn", \
    400     "bcmFlexctrObjectStaticEgrCng", \
    401     "bcmFlexctrObjectStaticEgrPortAndQueueNum", \
    402     "bcmFlexctrObjectStaticIngPktAttribute", \
    403     "bcmFlexctrObjectStaticEgrPktAttribute", \
    404     "bcmFlexctrObjectStaticIngVfi", \
    405     "bcmFlexctrObjectStaticIngDvp", \
    406     "bcmFlexctrObjectStaticIngSvp", \
    407     "bcmFlexctrObjectStaticIngOverlayEcmpGroup", \
    408     "bcmFlexctrObjectStaticIngOverlayEcmpMember", \
    409     "bcmFlexctrObjectStaticIngOverlayL3NextHop", \
    410     "bcmFlexctrObjectStaticEgrDvp", \
    411     "bcmFlexctrObjectStaticEgrSvp", \
    412     "bcmFlexctrObjectStaticEgrVfi", \
    413     "bcmFlexctrObjectStaticEgrNetworkGroupSvp", \
    414     "bcmFlexctrObjectStaticEgrNetworkGroupDvp", \
    415     "bcmFlexctrObjectStaticEgrOverlayL3NextHop", \
    416     "bcmFlexctrObjectStaticEgrOverlayL3Oif", \
    417     "bcmFlexctrObjectStaticCount", \
    418     "bcmFlexctrObjectIngSystemSource", \
    419     "bcmFlexctrObjectIngIngressPpPort", \
    420     "bcmFlexctrObjectIngL2Iif", \
    421     "bcmFlexctrObjectIngL3Iif", \
    422     "bcmFlexctrObjectIngL2SrcLookupHitIndex0", \
    423     "bcmFlexctrObjectIngL2SrcLookupHitIndex1", \
    424     "bcmFlexctrObjectIngL2DstLookupHitIndex0", \
    425     "bcmFlexctrObjectIngL2DstLookupHitIndex1", \
    426     "bcmFlexctrObjectIngSvp", \
    427     "bcmFlexctrObjectIngVfi", \
    428     "bcmFlexctrObjectIngDstFpFlexCtrIndex", \
    429     "bcmFlexctrObjectIngIfpOpaqueObj1", \
    430     "bcmFlexctrObjectIngIfpOpaqueObj0", \
    431     "bcmFlexctrObjectEgrVfi", \
    432     "bcmFlexctrObjectEgrDvp", \
    433     "bcmFlexctrObjectEgrL2Oif", \
    434     "bcmFlexctrObjectEgrL3Oif1", \
    435     "bcmFlexctrObjectEgrTxPpPort", \
    436     "bcmFlexctrObjectEgrL3Oif2", \
    437     "bcmFlexctrObjectEgrL3NextHop2FlexCtrIndex", \
    438     "bcmFlexctrObjectEgrL3NextHop1FlexCtrIndex", \
    439     "bcmFlexctrObjectEgrPipePortQueueNum", \
    440     "bcmFlexctrObjectEgrEfpOpaqueObj2", \
    441     "bcmFlexctrObjectEgrEfpOpaqueObj1", \
    442     "bcmFlexctrObjectEgrResidenceTimeShifted0", \
    443     "bcmFlexctrObjectEgrResidenceTimeShifted", \
    444     "bcmFlexctrObjectIngVfpOpaqueObj0", \
    445     "bcmFlexctrObjectIngNhop2OrEcmpGroupIndex1", \
    446     "bcmFlexctrObjectIngNhopIndex1", \
    447     "bcmFlexctrObjectIngEmFtOpaqueObj1", \
    448     "bcmFlexctrObjectIngEmFtOpaqueObj0", \
    449     "bcmFlexctrObjectEgrEcnMapInputVector", \
    450     "bcmFlexctrObjectIngEmFtHitIndex0", \
    451     "bcmFlexctrObjectIngEmFtHitIndex1", \
    452     "bcmFlexctrObjectIngL3DstClassId", \
    453     "bcmFlexctrObjectEgrResidenceTimeShifted1", \
    454     "bcmFlexctrObjectEgrEcnMapInputVector0", \
    455     "bcmFlexctrObjectIngIntPri", \
    456     "bcmFlexctrObjectIngIfpOpaqueObj2", \
    457     "bcmFlexctrObjectEgrIntcnIntpriCng0", \
    458     "bcmFlexctrObjectEgrIntcnIntpriCng", \
    459     "bcmFlexctrObjectEgrL3Oif216VfiClassid", \
    460     "bcmFlexctrObjectIngIngressQoSRemapValue", \
    461     "bcmFlexctrObjectIngFlexDigestA0", \
    462     "bcmFlexctrObjectIngFlexDigestA1", \
    463     "bcmFlexctrObjectIngFlexDigestB0", \
    464     "bcmFlexctrObjectIngFlexDigestB1", \
    465     "bcmFlexctrObjectIngFlexDigestC0", \
    466     "bcmFlexctrObjectIngFlexDigestC1", \
    467     "bcmFlexctrObjectIngIpHdrTotalLength", \
    468     "bcmFlexctrObjectIngI2eClassId", \
    469     "bcmFlexctrObjectIngVlanXlate", \
    470     "bcmFlexctrObjectIngIfpLagDgmActionSet", \
    471     "bcmFlexctrObjectIngIfpSamplerIndex", \
    472     "bcmFlexctrObjectIngEmFtOpaqueObj", \
    473     "bcmFlexctrObjectEgrEvxltFlexCtrIndex", \
    474     "bcmFlexctrObjectIngIfpOpaqueObj1_0", \
    475     "bcmFlexctrObjectIngIfpOpaqueObj1_1", \
    476     "bcmFlexctrObjectIngIfpOpaqueObj1_2", \
    477     "bcmFlexctrObjectIngIfpOpaqueObj1_3", \
    478     "bcmFlexctrObjectIngIfpOpaqueObj3", \
    479     "bcmFlexctrObjectIngIfpOpaqueObj4", \
    480     "bcmFlexctrObjectIngIfpOpaqueObj5", \
    481     "bcmFlexctrObjectIngIfpOpaqueObj6", \
    482     "bcmFlexctrObjectIngIfpOpaqueObj7", \
    483     "bcmFlexctrObjectIngIfpOpaqueObj8", \
    484     "bcmFlexctrObjectIngIfpOpaqueObj9", \
    485     "bcmFlexctrObjectIngVfpOpaqueObj1", \
    486     "bcmFlexctrObjectIngEpNihHdrDropCode", \
    487     "bcmFlexctrObjectEgrEpRecircProfile", \
    488     "bcmFlexctrObjectCount"  \
    489 }
    490 
    491 #define BCM_FLEXCTR_COUNTER_VALUE_SIZE  2          /* Counter array size number. */
    492 
    493 /* 
    494  * Flex counter statistic value.
    495  * 
    496  * Normal mode:
    497  * value[0] is the data of counter value A.
    498  * value[1] is the data of counter value B.
    499  * Wide mode:
    500  * value[0] is the upper part data of counter value A.
    501  * value[1] is the lower part data of counter value A.
    502  * Slim mode:
    503  * value[0] is the data of counter value A.
    504  */
    505 typedef struct bcm_flexctr_counter_value_s {
    506     uint64 value[BCM_FLEXCTR_COUNTER_VALUE_SIZE]; /* Flex counter statistic value array. */
    507 } bcm_flexctr_counter_value_t;
    508 
    509 /* Maximum flex counter operation object size. */
    510 #define BCM_FLEXCTR_OPERATION_OBJECT_SIZE   8          /* Operation object array
    511                                                           size number. */
    512 
    513 /* 
    514  * Flex counter index operation structure.
    515  * 
    516  * This data structure lists the operation of a flex counter index.
    517  * Number of supported elements for these member arrays and how the
    518  * index is generated from these elements may vary depending on device.
    519  * Flex counter index generated from two elements (if supported):
    520  *      value0 = (SEL(object0) >> shift0) & ((1 << mask_size0) - 1)).
    521  *      value1 = (SEL(object1) & ((1 << mask_size1) - 1)) << shift1.
    522  *      index = (value1 | value0).
    523  * Flex counter index generated from three elements (if supported):
    524  *      value0 = (SEL(object0) >> shift0) & ((1 << mask_size0) - 1)).
    525  *      value1 = ((SEL(object1) >> shift2) & ((1 << mask_size1) - 1)) <<
    526  * shift1.
    527  *      value2 = ((SEL(object2) >> shift4) & ((1 << mask_size2) - 1)) <<
    528  * shift3.
    529  *      index = (value2 | value1 | value0).
    530  */
    531 typedef struct bcm_flexctr_index_operation_s {
    532     bcm_flexctr_object_t object[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Flex counter object array. */
    533     uint32 quant_id[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Quantization ID. */
    534     uint8 mask_size[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Object mask size array. */
    535     uint8 shift[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Object shift array. */
    536     uint32 object_id[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Flex counter object ID. */
    537 } bcm_flexctr_index_operation_t;
    538 
    539 /* Enumeration of flex counter value select. */
    540 typedef enum bcm_flexctr_value_select_e {
    541     bcmFlexctrValueSelectCounterValue = 0, /* Select counter value generated by
    542                                            operation to update counter. */
    543     bcmFlexctrValueSelectPacketLength = 1, /* Select packet length to update
    544                                            counter. */
    545     bcmFlexctrValueSelectPairedCounter = 2, /* Select paired counter value to update
    546                                            counter. */
    547     bcmFlexctrValueSelectCount = 3      /* Always last one. */
    548 } bcm_flexctr_value_select_t;
    549 
    550 /* Enumeration of flex counter value operation types. */
    551 typedef enum bcm_flexctr_value_operation_type_e {
    552     bcmFlexctrValueOperationTypeNoop = 0, /* COUNTER = OLD_COUNTER. */
    553     bcmFlexctrValueOperationTypeSet = 1, /* COUNTER = CVALUE. */
    554     bcmFlexctrValueOperationTypeInc = 2, /* COUNTER = OLD_COUNTER + CVALUE. */
    555     bcmFlexctrValueOperationTypeDec = 3, /* COUNTER = OLD_COUNTER - CVALUE. */
    556     bcmFlexctrValueOperationTypeMax = 4, /* COUNTER = MAX(OLD_COUNTER, CVALUE). */
    557     bcmFlexctrValueOperationTypeMin = 5, /* COUNTER = MIN(OLD_COUNTER, CVALUE). */
    558     bcmFlexctrValueOperationTypeAverage = 6, /* COUNTER = AVERAGE(OLD_COUNTER,
    559                                            CVALUE). */
    560     bcmFlexctrValueOperationTypeSetBit = 7, /* COUNTER = SETBIT(OLD_COUNTER,
    561                                            CVALUE). */
    562     bcmFlexctrValueOperationTypeRdec = 8, /* COUNTER = CVALUE - OLD_COUNTER. */
    563     bcmFlexctrValueOperationTypeXor = 9, /* COUNTER = XOR(OLD_COUNTER, CVALUE). */
    564     bcmFlexctrValueOperationTypeCount = 10 /* Always last one. */
    565 } bcm_flexctr_value_operation_type_t;
    566 
    567 /* 
    568  * Flex counter value operation structure.
    569  * 
    570  * This data structure lists the operation of a flex counter update
    571  * value.
    572  * Number of supported elements for these member arrays and how the
    573  * value is generated from these elements may vary depending on device.
    574  * Flex counter update value generated from two elements (if supported):
    575  *      value0 = (SEL(object0) >> shift0) & ((1 << mask_size0) - 1)).
    576  *      value1 = (SEL(object1) & ((1 << mask_size1) - 1)) << shift1.
    577  *      value = (value1 | value0).
    578  *      New_counter = UPDATE_TYPE(old_counter, value).
    579  * Flex counter update value generated from three elements
    580  * (if supported):
    581  *      value0 = (SEL(object0) >> shift0) & ((1 << mask_size0) - 1)).
    582  *      value1 = ((SEL(object1) >> shift2) & ((1 << mask_size1) - 1)) <<
    583  * shift1.
    584  *      value2 = ((SEL(object2) >> shift4) & ((1 << mask_size2) - 1)) <<
    585  * shift3.
    586  *      value =  (value2 | value1 | value0).
    587  *      New_counter = UPDATE_TYPE(old_counter, value).
    588  */
    589 typedef struct bcm_flexctr_value_operation_s {
    590     bcm_flexctr_value_select_t select;  /* Select counter value. */
    591     bcm_flexctr_object_t object[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Flex counter object array. */
    592     uint32 quant_id[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Quantization ID. */
    593     uint8 mask_size[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Object mask size array. */
    594     uint8 shift[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Object shift array. */
    595     bcm_flexctr_value_operation_type_t type; /* Counter value operation type. */
    596     uint32 object_id[BCM_FLEXCTR_OPERATION_OBJECT_SIZE]; /* Flex counter object ID. */
    597 } bcm_flexctr_value_operation_t;
    598 
    599 #define BCM_FLEXCTR_QUANTIZATION_RANGE_SIZE 8          /* Quantization range
    600                                                           check array size
    601                                                           number. */
    602 
    603 /* Quantization flags definition. */
    604 #define BCM_FLEXCTR_QUANTIZATION_FLAGS_GLOBAL (1 << 0)   /* Global quantization in
    605                                                           pipe unique mode. */
    606 
    607 #define BCM_FLEXCTR_QUANTIZATION_FLAGS_32BIT_MODE (1 << 1)   /* Specify 32-bit values
    608                                                           in the range check
    609                                                           arrays (if supported). */
    610 
    611 /* 
    612  * Flex counter quantization structure.
    613  * 
    614  * This data structure lists the properties of a flex counter
    615  * quantization.
    616  * Each quantization instance generates a range check result.
    617  */
    618 typedef struct bcm_flexctr_quantization_s {
    619     bcm_flexctr_object_t object;        /* Flex counter object. */
    620     bcm_flexctr_object_t object_upper;  /* Flex counter object for the upper 16
    621                                            bits when flag
    622                                            BCM_FLEXCTR_QUANTIZATION_FLAGS_32BIT_MODE
    623                                            is set. The 'object' field is for the
    624                                            lower 16 bits. */
    625     bcm_pbmp_t ports;                   /* Flex counter ports. */
    626     uint32 range_check_min[BCM_FLEXCTR_QUANTIZATION_RANGE_SIZE]; /* Range check min value array. */
    627     uint32 range_check_max[BCM_FLEXCTR_QUANTIZATION_RANGE_SIZE]; /* Range check max value array. */
    628     uint8 range_num;                    /* Total range check number */
    629     uint32 object_id;                   /* Flex counter object ID. */
    630     uint32 object_id_upper;             /* Flex counter object ID (0-based
    631                                            index) for the counter object
    632                                            specified by 'object_upper' field (if
    633                                            required). Valid when flag
    634                                            BCM_FLEXCTR_QUANTIZATION_FLAGS_32BIT_MODE
    635                                            is set. */
    636     uint32 flags;                       /* Quantization flags. */
    637 } bcm_flexctr_quantization_t;
    638 
    639 /* Enumeration of flex counter trigger type. */
    640 typedef enum bcm_flexctr_trigger_type_e {
    641     bcmFlexctrTriggerTypeTime = 0,      /* Time based trigger type. */
    642     bcmFlexctrTriggerTypeCondition = 1, /* Condition based trigger type. */
    643     bcmFlexctrTriggerTypeConditionStartTimeStop = 2, /* Condition based start and time based
    644                                            stop type. */
    645     bcmFlexctrTriggerTypeTimeStartActionCountStop = 3, /* Time based start and action count
    646                                            based stop type. */
    647     bcmFlexctrTriggerTypeConditionStartActionCountStop = 4, /* Condition based start and action
    648                                            count based stop type. */
    649     bcmFlexctrTriggerTypeCount = 5      /* Always last one. */
    650 } bcm_flexctr_trigger_type_t;
    651 
    652 /* Enumeration of flex counter trigger interval scale. */
    653 typedef enum bcm_flexctr_trigger_interval_e {
    654     bcmFlexctrTriggerIntervalUnlimited = 0, /* Unlimited collection. */
    655     bcmFlexctrTriggerInterval100ns = 1, /* 100 nanosecond interval. */
    656     bcmFlexctrTriggerInterval500ns = 2, /* 500 nanosecond interval. */
    657     bcmFlexctrTriggerInterval1us = 3,   /* 1 microsecond interval. */
    658     bcmFlexctrTriggerInterval10us = 4,  /* 10 microsecond interval. */
    659     bcmFlexctrTriggerInterval100us = 5, /* 100 microsecond interval. */
    660     bcmFlexctrTriggerInterval1ms = 6,   /* 1 millisecond interval. */
    661     bcmFlexctrTriggerInterval10ms = 7,  /* 10 millisecond interval. */
    662     bcmFlexctrTriggerInterval100ms = 8, /* 100 millisecond interval. */
    663     bcmFlexctrTriggerInterval1s = 9,    /* 1 second interval. */
    664     bcmFlexctrTriggerInterval10s = 10,  /* 10 second interval. */
    665     bcmFlexctrTriggerIntervalCount = 11 /* Always last one. */
    666 } bcm_flexctr_trigger_interval_t;
    667 
    668 /* Trigger flags definition. */
    669 #define BCM_FLEXCTR_TRIGGER_CONDITION_COMPARE_NOT_EQUAL_START (1 << 0)   /* Specify to use 'not
    670                                                           equal' as the compare
    671                                                           function to trigger
    672                                                           start counter update
    673                                                           for conditional
    674                                                           trigger. */
    675 
    676 #define BCM_FLEXCTR_TRIGGER_CONDITION_COMPARE_NOT_EQUAL_STOP (1 << 1)   /* Specify to use 'not
    677                                                           equal' as the compare
    678                                                           function to trigger
    679                                                           stop counter update
    680                                                           for conditional
    681                                                           trigger. */
    682 
    683 /* 
    684  * Flex counter trigger structure.
    685  * 
    686  * This data structure lists the properties of the flex counter trigger.
    687  */
    688 typedef struct bcm_flexctr_trigger_s {
    689     bcm_flexctr_trigger_type_t trigger_type; /* Trigger type. */
    690     uint8 period_num;                   /* Time trigger period number. */
    691     bcm_flexctr_trigger_interval_t interval; /* Time trigger interval scale. */
    692     bcm_flexctr_object_t object;        /* Flex counter object. */
    693     uint16 object_value_start;          /* Conditional trigger start value. */
    694     uint16 object_value_stop;           /* Conditional trigger stop value. */
    695     uint16 object_value_mask;           /* Conditional trigger mask. */
    696     uint16 interval_shift;              /* Time trigger interval shift. */
    697     uint16 interval_size;               /* Time trigger interval size. */
    698     uint32 object_id;                   /* Flex counter object ID. */
    699     uint8 action_count_stop;            /* Number of times a counter action is
    700                                            hit before stopping. Only valid with
    701                                            action count based stop type. */
    702     uint32 flags;                       /* Trigger flags. */
    703 } bcm_flexctr_trigger_t;
    704 
    705 /* Enumeration of flex counter counter modes. */
    706 typedef enum bcm_flexctr_counter_mode_e {
    707     bcmFlexctrCounterModeNormal = 0,    /* Each counter contains two values A
    708                                            and B.
    709                                            The update value of value A and B are
    710                                            separately controlled by
    711                                            value_a_operation and
    712                                            value_b_operation in counter action.
    713                                            All value operation modes except
    714                                            SetBit are suitable for values A and
    715                                            B. */
    716     bcmFlexctrCounterModeWide = 1,      /* Each counter only contains one value
    717                                            A.
    718                                            The update value of value A is
    719                                            controlled by value_a_operation in
    720                                            counter action.
    721                                            Only value operation modes noop, set,
    722                                            inc and setbit are suitable for value
    723                                            A. */
    724     bcmFlexctrCounterModeSlim = 2,      /* Each counter only contains one value
    725                                            A.
    726                                            The update value of value A is
    727                                            controlled by value_a_operation in
    728                                            counter action.
    729                                            Only value operation modes noop, set
    730                                            and inc are suitable for value A.
    731                                            Using slim mode could contain more
    732                                            counters within same h/w resources. */
    733     bcmFlexctrCounterModeCount = 3      /* Always last one. */
    734 } bcm_flexctr_counter_mode_t;
    735 
    736 /* Enumeration of flex counter drop count modes. */
    737 typedef enum bcm_flexctr_drop_count_mode_e {
    738     bcmFlexctrDropCountModeNoDrop = 0,  /* Count only if not being dropped. */
    739     bcmFlexctrDropCountModeDrop = 1,    /* Count only if being dropped. */
    740     bcmFlexctrDropCountModeAll = 2,     /* Ignore drop status and always count. */
    741     bcmFlexctrDropCountModeCount = 3    /* Always last one. */
    742 } bcm_flexctr_drop_count_mode_t;
    743 
    744 /* Hint type. */
    745 typedef enum bcm_flexctr_hint_type_e {
    746     bcmFlexctrHintPool = 0,         /* Assign the same pool ID on one hint value
    747                                        for the given flex counter source. */
    748     bcmFlexctrHintFieldGroupId = 1, /* Indicate a field group ID as the hint and
    749                                        assign the pool ID based on the field
    750                                        group priority. */
    751     bcmFlexctrHintCount = 2         /* Always last one. */
    752 } bcm_flexctr_hint_type_t;
    753 
    754 #define BCM_FLEXCTR_ACTION_FLAGS_TRIGGER    0x1        /* Flex counter trigger
    755                                                           is attached in the
    756                                                           action. */
    757 #define BCM_FLEXCTR_ACTION_FLAGS_GLOBAL     0x2        /* Global action in pipe
    758                                                           unique mode. */
    759 
    760 /* 
    761  * Flex counter action structure.
    762  * 
    763  * This data structure lists the properties of a flex counter action.
    764  */
    765 typedef struct bcm_flexctr_action_s {
    766     uint32 flags;                       /* Action flags. */
    767     bcm_flexctr_source_t source;        /* Flex counter source. */
    768     bcm_pbmp_t ports;                   /* Flex counter ports. */
    769     int hint;                           /* Flex counter hint. */
    770     bcm_flexctr_drop_count_mode_t drop_count_mode; /* Counter drop mode for functional
    771                                            packet drops. */
    772     int exception_drop_count_enable;    /* Enable to count on hardware exception
    773                                            drops. */
    774     int egress_mirror_count_enable;     /* Enable to count egress mirrored
    775                                            packets also. */
    776     bcm_flexctr_counter_mode_t mode;    /* Action mode. */
    777     uint32 index_num;                   /* Total counter index number. */
    778     bcm_flexctr_index_operation_t index_operation; /* Flex counter index operation
    779                                            structure. */
    780     bcm_flexctr_value_operation_t operation_a; /* Flex counter value A operation
    781                                            structure. */
    782     bcm_flexctr_value_operation_t operation_b; /* Flex counter value B operation
    783                                            structure. */
    784     bcm_flexctr_trigger_t trigger;      /* Flex counter trigger structure. */
    785     bcm_flexctr_hint_type_t hint_type;  /* Hint type. */
    786 } bcm_flexctr_action_t;
    787 
    788 #define BCM_FLEXCTR_GROUP_ACTION_SIZE   16         /* Group action array size
    789                                                       number. */
    790 
    791 /* Group action flags definition. */
    792 #define BCM_FLEXCTR_GROUP_ACTION_FLAGS_GLOBAL (1 << 0)   /* Global group action in
    793                                                           pipe unique mode. */
    794 
    795 /* 
    796  * Flex counter group action structure.
    797  * 
    798  * This data structure lists the properties of a flex counter group
    799  * action.
    800  */
    801 typedef struct bcm_flexctr_group_action_s {
    802     bcm_flexctr_source_t source;        /* Flex counter source. */
    803     bcm_pbmp_t ports;                   /* Flex counter ports. */
    804     uint32 stat_counter_id[BCM_FLEXCTR_GROUP_ACTION_SIZE]; /* Flex counter group action array. */
    805     uint8 action_num;                   /* Total group action array number */
    806     uint32 flags;                       /* Group action flags. */
    807 } bcm_flexctr_group_action_t;
    808 
    809 /* 
    810  * Enumeration of flex counter packet types: used when packet attribute
    811  * selector type is:
    812  * - bcmFlexctrPacketAttributeTypeIngPktType.
    813  */
    814 typedef enum bcm_flexctr_packet_attribute_pkt_type_e {
    815     bcmFlexctrPacketAttributePktTypeAll = 0, /* All packet types. */
    816     bcmFlexctrPacketAttributePktTypeUnknown = 1, /* Unknown packet. */
    817     bcmFlexctrPacketAttributePktTypeControl = 2, /* Control packet. */
    818     bcmFlexctrPacketAttributePktTypeBfd = 3, /* BFD (Bidirectional Forwarding
    819                                            Detection) packet. */
    820     bcmFlexctrPacketAttributePktTypeBpdu = 4, /* BPDU (Bridge Protocol Data Unit)
    821                                            packet. */
    822     bcmFlexctrPacketAttributePktType1588 = 5, /* IEEE 1588 packet. */
    823     bcmFlexctrPacketAttributePktTypeKnownL2Uc = 6, /* Known L2 unicast packet. */
    824     bcmFlexctrPacketAttributePktTypeUnknownL2Uc = 7, /* Unknown L2 unicast packet. */
    825     bcmFlexctrPacketAttributePktTypeKnownL2Mc = 8, /* Known L2 multicast packet. */
    826     bcmFlexctrPacketAttributePktTypeUnknownL2Mc = 9, /* Unknown L2 multicast packet. */
    827     bcmFlexctrPacketAttributePktTypeL2Bc = 10, /* L2 broadcast packet. */
    828     bcmFlexctrPacketAttributePktTypeKnownL3Uc = 11, /* Known L3 unicast packet. */
    829     bcmFlexctrPacketAttributePktTypeUnknownL3Uc = 12, /* Unknown L3 unicast packet. */
    830     bcmFlexctrPacketAttributePktTypeKnownIpmc = 13, /* Known IP multicast packet. */
    831     bcmFlexctrPacketAttributePktTypeUnknownIpmc = 14, /* Unknown IP multicast packet. */
    832     bcmFlexctrPacketAttributePktTypeKnownMplsL3 = 15, /* Known L3 MPLS packet. */
    833     bcmFlexctrPacketAttributePktTypeKnownMpls = 16, /* Known MPLS packet. */
    834     bcmFlexctrPacketAttributePktTypeUnknownMpls = 17, /* Unknown MPLS packet. */
    835     bcmFlexctrPacketAttributePktTypeCount = 18 /* Always last one. */
    836 } bcm_flexctr_packet_attribute_pkt_type_t;
    837 
    838 /* 
    839  * Enumeration of flex counter VLAN tag information: used when packet
    840  * attribute selector type is:
    841  * - bcmFlexctrPacketAttributeTypeIngVlanTag.
    842  * - bcmFlexctrPacketAttributeTypeEgrVlanTag.
    843  */
    844 typedef enum bcm_flexctr_packet_attribute_vlan_e {
    845     bcmFlexctrPacketAttributeVlanUnTagged = 0, /* Untagged VLAN packets. */
    846     bcmFlexctrPacketAttributeVlanOuterTag = 1, /* Single outer VLAN tagged packets. */
    847     bcmFlexctrPacketAttributeVlanCount = 2 /* Always last one. */
    848 } bcm_flexctr_packet_attribute_vlan_t;
    849 
    850 /* 
    851  * Enumeration of flex counter packet attribute selector types.
    852  * 
    853  * Flex counter packet attribute selectors could be used to generate
    854  * offset indices and each offset index becomes additional object on
    855  * object bus. The object could be used to generate counter index and
    856  * counter value.
    857  */
    858 typedef enum bcm_flexctr_packet_attribute_type_e {
    859     bcmFlexctrPacketAttributeTypeIngIp = 0, /* Ingress: IP packet. Possible values:
    860                                            0 or 1. */
    861     bcmFlexctrPacketAttributeTypeIngDrop = 1, /* Ingress: dropped packet. Possible
    862                                            values: 0 or 1. */
    863     bcmFlexctrPacketAttributeTypeIngPktType = 2, /* Ingress: packet type. Possible
    864                                            values:
    865                                            <bcmFlexctrPacketAttributePktType*>,
    866                                            mask: 6-bit (0x3F). */
    867     bcmFlexctrPacketAttributeTypeIngTosEcn = 3, /* Ingress: TOS for ECN (explicit
    868                                            congestion notification). Possible
    869                                            values: 0 to 3, mask: 2-bit (0x3). */
    870     bcmFlexctrPacketAttributeTypeIngTosDscp = 4, /* Ingress: TOS for DSCP (differentiated
    871                                            services code point). Possible
    872                                            values: 0 to 63, mask: 6-bit (0x3F). */
    873     bcmFlexctrPacketAttributeTypeIngPort = 5, /* Ingress: port number. Possible
    874                                            values: <MaxLogicalPort>, mask: 6-bit
    875                                            (0x3F). */
    876     bcmFlexctrPacketAttributeTypeIngIntCn = 6, /* Ingress: internal congestion
    877                                            notification. Possible values: 0 to
    878                                            3, mask: 2-bit (0x3). */
    879     bcmFlexctrPacketAttributeTypeIngOuterPri = 7, /* Ingress: outer VLAN priority.
    880                                            Possible values: 0 to 7, mask: 3-bit
    881                                            (0x7). */
    882     bcmFlexctrPacketAttributeTypeIngVlanTag = 8, /* Ingress: VLAN tag. Possible values:
    883                                            <bcmFlexctrPacketAttributeVlan*>,
    884                                            mask: 1-bit (0x1). */
    885     bcmFlexctrPacketAttributeTypeIngIntPri = 9, /* Ingress: internal priority. Possible
    886                                            values: 0 to 15, mask: 4-bit (0xF). */
    887     bcmFlexctrPacketAttributeTypeIngColor = 10, /* Ingress: packet color. Possible
    888                                            values: <bcmColorGreen|Yellow|Red>,
    889                                            mask: 2-bit (0x3). */
    890     bcmFlexctrPacketAttributeTypeIngFieldIngressColor = 11, /* Ingress: IFP color. Possible values:
    891                                            <bcmColorGreen|Yellow|Red>, mask:
    892                                            2-bit (0x3). */
    893     bcmFlexctrPacketAttributeTypeIngElephant = 12, /* Ingress: elephant packet. Possible
    894                                            values: 0 or 1. */
    895     bcmFlexctrPacketAttributeTypeIngTcpFlagsSyn = 13, /* Ingress: TCP SYN flag. Possible
    896                                            values: 0 or 1. */
    897     bcmFlexctrPacketAttributeTypeIngTcpFlagsFin = 14, /* Ingress: TCP FIN flag. Possible
    898                                            values: 0 or 1. */
    899     bcmFlexctrPacketAttributeTypeIngTcpFlagsRst = 15, /* Ingress: TCP RST flag. Possible
    900                                            values: 0 or 1. */
    901     bcmFlexctrPacketAttributeTypeIngTcpFlagsPsh = 16, /* Ingress: TCP PSH flag. Possible
    902                                            values: 0 or 1. */
    903     bcmFlexctrPacketAttributeTypeIngTcpFlagsAck = 17, /* Ingress: TCP ACK flag. Possible
    904                                            values: 0 or 1. */
    905     bcmFlexctrPacketAttributeTypeIngTcpFlagsUrg = 18, /* Ingress: TCP URG flag. Possible
    906                                            values: 0 or 1. */
    907     bcmFlexctrPacketAttributeTypeIngTcpFlagsEce = 19, /* Ingress: TCP ECE flag. Possible
    908                                            values: 0 or 1. */
    909     bcmFlexctrPacketAttributeTypeIngTcpFlagsCwr = 20, /* Ingress: TCP CWR flag. Possible
    910                                            values: 0 or 1. */
    911     bcmFlexctrPacketAttributeTypeIngMplsExp = 21, /* Ingress: MPLS experimental field.
    912                                            Possible values: 0 to 7, mask: 3-bit
    913                                            (0x7). */
    914     bcmFlexctrPacketAttributeTypeEgrIp = 22, /* Egress: IP packet. Possible values: 0
    915                                            or 1. */
    916     bcmFlexctrPacketAttributeTypeEgrDrop = 23, /* Egress: dropped packet. Possible
    917                                            values: 0 or 1. */
    918     bcmFlexctrPacketAttributeTypeEgrPktTypeMc = 24, /* Egress: multicast packet type.
    919                                            Possible values: 0: unicast or 1:
    920                                            multicast. */
    921     bcmFlexctrPacketAttributeTypeEgrTosEcn = 25, /* Egress: TOS for ECN (explicit
    922                                            congestion notification). Possible
    923                                            values: 0 to 3, mask: 2-bit (0x3). */
    924     bcmFlexctrPacketAttributeTypeEgrTosDscp = 26, /* Egress: TOS for DSCP (differentiated
    925                                            services code point). Possible
    926                                            values: 0 to 63, mask: 6-bit (0x3F). */
    927     bcmFlexctrPacketAttributeTypeEgrEgressPort = 27, /* Egress: port number. Possible values:
    928                                            <MaxLogicalPort>, mask: 6-bit (0x3F). */
    929     bcmFlexctrPacketAttributeTypeEgrIntCn = 28, /* Egress: internal congestion
    930                                            notification. Possible values: 0 to
    931                                            3, mask: 2-bit (0x3). */
    932     bcmFlexctrPacketAttributeTypeEgrOuterPri = 29, /* Egress: outer VLAN priority. Possible
    933                                            values: 0 to 7, mask: 3-bit (0x7). */
    934     bcmFlexctrPacketAttributeTypeEgrVlanTag = 30, /* Egress: VLAN tag. Possible values:
    935                                            <bcmFlexctrPacketAttributeVlan*>,
    936                                            mask: 1-bit (0x1). */
    937     bcmFlexctrPacketAttributeTypeEgrIntPri = 31, /* Egress: internal priority. Possible
    938                                            values: 0 to 15, mask: 4-bit (0xF). */
    939     bcmFlexctrPacketAttributeTypeEgrColor = 32, /* Egress: packet color. Possible
    940                                            values: <bcmColorGreen|Yellow|Red>,
    941                                            mask: 2-bit (0x3). */
    942     bcmFlexctrPacketAttributeTypeEgrCongestionMarked = 33, /* Egress: congestion marked status due
    943                                            to MMU congestion. Possible values: 0
    944                                            or 1. */
    945     bcmFlexctrPacketAttributeTypeEgrQueueType = 34, /* Egress: queue type. Possible values:
    946                                            0: multicast or 1: unicast. */
    947     bcmFlexctrPacketAttributeTypeEgrCos = 35, /* Egress: MMU cos. Possible values: 0
    948                                            to 15, mask: 4-bit (0xF). */
    949     bcmFlexctrPacketAttributeTypeEgrMplsExp = 36, /* Egress: MPLS experimental field.
    950                                            Possible values: 0 to 7, mask: 3-bit
    951                                            (0x7). */
    952     bcmFlexctrPacketAttributeTypeCount = 37 /* Always last one. Not a usable value. */
    953 } bcm_flexctr_packet_attribute_type_t;
    954 
    955 /* 
    956  * Enumeration of flex counter direction: used to indicates the direction
    957  * of a flex counter action.
    958  */
    959 typedef enum bcm_flexctr_direction_e {
    960     bcmFlexctrDirectionIngress = 0, /* Ingress flex counter. */
    961     bcmFlexctrDirectionEgress = 1,  /* Egress flex counter. */
    962     bcmFlexctrDirectionCount = 2    /* Always last one. */
    963 } bcm_flexctr_direction_t;
    964 
    965 /* 
    966  * Flex counter packet attribute selector structure.
    967  * 
    968  * This data structure lists the properties of the flex counter packet
    969  * attribute selector.
    970  */
    971 typedef struct bcm_flexctr_packet_attribute_selector_s {
    972     bcm_flexctr_packet_attribute_type_t attr_type; /* Packet attribute selector type. */
    973     uint32 attr_mask;                   /* Packet attribute selector mask. The
    974                                            valid mask range depends on packet
    975                                            attribute selector type. */
    976 } bcm_flexctr_packet_attribute_selector_t;
    977 
    978 /* Flex counter packet attribute selectors. */
    979 #define BCM_FLEXCTR_PACKET_ATTRIBUTE_MAX_SELECTORS 8          /* Maximum number of
    980                                                           selectors for packet
    981                                                           attribute. */
    982 
    983 /* 
    984  * Flex counter packet attribute profile structure.
    985  * 
    986  * This data structure lists the properties of the flex counter packet
    987  * attribute profile.
    988  */
    989 typedef struct bcm_flexctr_packet_attribute_profile_s {
    990     bcm_pbmp_t ports;                   /* Flex counter ports. */
    991     uint32 num_selectors;               /* Number of packet attribute selectors
    992                                            used in this profile. */
    993     bcm_flexctr_packet_attribute_selector_t attr_selectors[BCM_FLEXCTR_PACKET_ATTRIBUTE_MAX_SELECTORS]; /* Attribute selectors array for flex
    994                                            counter packet attribute. */
    995 } bcm_flexctr_packet_attribute_profile_t;
    996 
    997 /* 
    998  * Flex counter packet attribute map entry structure.
    999  * 
   1000  * This data structure lists the properties of the flex counter packet
   1001  * attribute map entry.
   1002  */
   1003 typedef struct bcm_flexctr_packet_attribute_map_entry_s {
   1004     bcm_flexctr_packet_attribute_type_t attr_type; /* Packet attribute selector type. */
   1005     uint32 attr_value;                  /* Packet attribute selector value. The
   1006                                            valid value range depends on packet
   1007                                            attribute selector type. */
   1008 } bcm_flexctr_packet_attribute_map_entry_t;
   1009 
   1010 /* 
   1011  * Flex counter packet attribute map structure.
   1012  * 
   1013  * This data structure lists the properties of the flex counter packet
   1014  * attribute map.
   1015  */
   1016 typedef struct bcm_flexctr_packet_attribute_map_s {
   1017     uint32 num_entries;                 /* Number of packet attribute map
   1018                                            entries used in this map. */
   1019     bcm_flexctr_packet_attribute_map_entry_t attr_map_entries[BCM_FLEXCTR_PACKET_ATTRIBUTE_MAX_SELECTORS]; /* Attribute  map entries array for flex
   1020                                            counter packet attribute. */
   1021 } bcm_flexctr_packet_attribute_map_t;
   1022 
   1023 #ifndef BCM_HIDE_DISPATCHABLE
   1024 
   1025 /* 
   1026  * Flexctr module initialization function.
   1027  * 
   1028  * This function is used to initialize flexctr module.
   1029  * 
   1030  * [in] unit Unit number.
   1031  * 
   1032  * BCM_E_NONE No errors.
   1033  * BCM_E_XXX API errors.
   1034  */
   1035 extern int bcm_flexctr_init(
   1036     int unit);
   1037 
   1038 /* 
   1039  * Flexctr module cleanup function.
   1040  * 
   1041  * This function is used to shut down flexctr module.
   1042  * 
   1043  * [in] unit Unit number.
   1044  * 
   1045  * BCM_E_NONE No errors.
   1046  * BCM_E_XXX API errors.
   1047  */
   1048 extern int bcm_flexctr_cleanup(
   1049     int unit);
   1050 
   1051 #endif /* BCM_HIDE_DISPATCHABLE */
   1052 
   1053 #define BCM_FLEXCTR_OPTIONS_WITH_ID 0x1        /* Instance id is presented. */
   1054 #define BCM_FLEXCTR_OPTIONS_REPLACE 0x2        /* Need to replace an existing
   1055                                                   instance. */
   1056 
   1057 /* Flex counter quantization data structure initialization function. */
   1058 extern void bcm_flexctr_quantization_t_init(
   1059     bcm_flexctr_quantization_t *quantization);
   1060 
   1061 #ifndef BCM_HIDE_DISPATCHABLE
   1062 
   1063 /* Flex counter quantization creation function. */
   1064 extern int bcm_flexctr_quantization_create(
   1065     int unit, 
   1066     int options, 
   1067     bcm_flexctr_quantization_t *quantization, 
   1068     uint32 *quant_id);
   1069 
   1070 /* Flex counter quantization destroy function. */
   1071 extern int bcm_flexctr_quantization_destroy(
   1072     int unit, 
   1073     uint32 quant_id);
   1074 
   1075 /* Flex counter quantization get function. */
   1076 extern int bcm_flexctr_quantization_get(
   1077     int unit, 
   1078     uint32 quant_id, 
   1079     bcm_flexctr_quantization_t *quantization);
   1080 
   1081 #endif /* BCM_HIDE_DISPATCHABLE */
   1082 
   1083 /* Flex counter quantization traverse callback. */
   1084 typedef int (*bcm_flexctr_quantization_traverse_cb)(
   1085     int unit, 
   1086     uint32 quant_id, 
   1087     bcm_flexctr_quantization_t *quantization, 
   1088     void *user_data);
   1089 
   1090 #ifndef BCM_HIDE_DISPATCHABLE
   1091 
   1092 /* Flex counter quantization traverse function. */
   1093 extern int bcm_flexctr_quantization_traverse(
   1094     int unit, 
   1095     bcm_flexctr_quantization_traverse_cb trav_fn, 
   1096     void *user_data);
   1097 
   1098 #endif /* BCM_HIDE_DISPATCHABLE */
   1099 
   1100 /* Flex counter action data structure initialization function. */
   1101 extern void bcm_flexctr_action_t_init(
   1102     bcm_flexctr_action_t *action);
   1103 
   1104 #ifndef BCM_HIDE_DISPATCHABLE
   1105 
   1106 /* Flex counter action creation function. */
   1107 extern int bcm_flexctr_action_create(
   1108     int unit, 
   1109     int options, 
   1110     bcm_flexctr_action_t *action, 
   1111     uint32 *stat_counter_id);
   1112 
   1113 /* Flex counter action destroy function. */
   1114 extern int bcm_flexctr_action_destroy(
   1115     int unit, 
   1116     uint32 stat_counter_id);
   1117 
   1118 /* Flex counter action get function. */
   1119 extern int bcm_flexctr_action_get(
   1120     int unit, 
   1121     uint32 stat_counter_id, 
   1122     bcm_flexctr_action_t *action);
   1123 
   1124 #endif /* BCM_HIDE_DISPATCHABLE */
   1125 
   1126 /* Flex counter action traverse callback. */
   1127 typedef int (*bcm_flexctr_action_traverse_cb)(
   1128     int unit, 
   1129     uint32 stat_counter_id, 
   1130     bcm_flexctr_action_t *action, 
   1131     void *user_data);
   1132 
   1133 #ifndef BCM_HIDE_DISPATCHABLE
   1134 
   1135 /* Flex counter action traverse function. */
   1136 extern int bcm_flexctr_action_traverse(
   1137     int unit, 
   1138     bcm_flexctr_action_traverse_cb trav_fn, 
   1139     void *user_data);
   1140 
   1141 #endif /* BCM_HIDE_DISPATCHABLE */
   1142 
   1143 /* Flex counter group action data structure initialization function. */
   1144 extern void bcm_flexctr_group_action_t_init(
   1145     bcm_flexctr_group_action_t *group_action);
   1146 
   1147 #ifndef BCM_HIDE_DISPATCHABLE
   1148 
   1149 /* Flex counter group action creation function. */
   1150 extern int bcm_flexctr_group_action_create(
   1151     int unit, 
   1152     int options, 
   1153     bcm_flexctr_group_action_t *group_action, 
   1154     uint32 *group_stat_counter_id);
   1155 
   1156 /* Flex counter group action destroy function. */
   1157 extern int bcm_flexctr_group_action_destroy(
   1158     int unit, 
   1159     uint32 group_stat_counter_id);
   1160 
   1161 /* Flex counter group action get function. */
   1162 extern int bcm_flexctr_group_action_get(
   1163     int unit, 
   1164     uint32 group_stat_counter_id, 
   1165     bcm_flexctr_group_action_t *group_action);
   1166 
   1167 #endif /* BCM_HIDE_DISPATCHABLE */
   1168 
   1169 /* Flex counter group action traverse callback. */
   1170 typedef int (*bcm_flexctr_group_action_traverse_cb)(
   1171     int unit, 
   1172     uint32 group_stat_counter_id, 
   1173     bcm_flexctr_group_action_t *group_action, 
   1174     void *user_data);
   1175 
   1176 #ifndef BCM_HIDE_DISPATCHABLE
   1177 
   1178 /* Flex counter group action traverse function. */
   1179 extern int bcm_flexctr_group_action_traverse(
   1180     int unit, 
   1181     bcm_flexctr_group_action_traverse_cb trav_fn, 
   1182     void *user_data);
   1183 
   1184 /* Flex counter trigger enable set function. */
   1185 extern int bcm_flexctr_trigger_enable_set(
   1186     int unit, 
   1187     uint32 stat_counter_id, 
   1188     int enable);
   1189 
   1190 /* Flex counter trigger enable get function. */
   1191 extern int bcm_flexctr_trigger_enable_get(
   1192     int unit, 
   1193     uint32 stat_counter_id, 
   1194     int *enable);
   1195 
   1196 /* Flex counter statistic get function. */
   1197 extern int bcm_flexctr_stat_get(
   1198     int unit, 
   1199     uint32 stat_counter_id, 
   1200     uint32 num_entries, 
   1201     uint32 *counter_indexes, 
   1202     bcm_flexctr_counter_value_t *counter_values);
   1203 
   1204 /* Flex counter statistic sync get function. */
   1205 extern int bcm_flexctr_stat_sync_get(
   1206     int unit, 
   1207     uint32 stat_counter_id, 
   1208     uint32 num_entries, 
   1209     uint32 *counter_indexes, 
   1210     bcm_flexctr_counter_value_t *counter_values);
   1211 
   1212 /* Flex counter statistic set function. */
   1213 extern int bcm_flexctr_stat_set(
   1214     int unit, 
   1215     uint32 stat_counter_id, 
   1216     uint32 num_entries, 
   1217     uint32 *counter_indexes, 
   1218     bcm_flexctr_counter_value_t *counter_values);
   1219 
   1220 #endif /* BCM_HIDE_DISPATCHABLE */
   1221 
   1222 /* Flex counter packet attribute options for creating a profile. */
   1223 #define BCM_FLEXCTR_PACKET_ATTRIBUTE_OPTIONS_WITH_ID 0x1        /* Instance id is
   1224                                                           presented. */
   1225 #define BCM_FLEXCTR_PACKET_ATTRIBUTE_OPTIONS_REPLACE 0x2        /* Need to replace an
   1226                                                           existing instance. */
   1227 
   1228 /* 
   1229  * Flex counter packet attribute selector data structure initialization
   1230  * function.
   1231  */
   1232 extern void bcm_flexctr_packet_attribute_selector_t_init(
   1233     bcm_flexctr_packet_attribute_selector_t *attr_selector);
   1234 
   1235 /* 
   1236  * Flex counter packet attribute profile data structure initialization
   1237  * function.
   1238  */
   1239 extern void bcm_flexctr_packet_attribute_profile_t_init(
   1240     bcm_flexctr_packet_attribute_profile_t *attr_profile);
   1241 
   1242 #ifndef BCM_HIDE_DISPATCHABLE
   1243 
   1244 /* Flex counter packet attribute profile creation function. */
   1245 extern int bcm_flexctr_packet_attribute_profile_create(
   1246     int unit, 
   1247     int options, 
   1248     bcm_flexctr_packet_attribute_profile_t *attr_profile, 
   1249     int *profile_id);
   1250 
   1251 /* Flex counter packet attribute profile destroy function. */
   1252 extern int bcm_flexctr_packet_attribute_profile_destroy(
   1253     int unit, 
   1254     int profile_id);
   1255 
   1256 /* Flex counter packet attribute profile get function. */
   1257 extern int bcm_flexctr_packet_attribute_profile_get(
   1258     int unit, 
   1259     int profile_id, 
   1260     bcm_flexctr_packet_attribute_profile_t *attr_profile);
   1261 
   1262 #endif /* BCM_HIDE_DISPATCHABLE */
   1263 
   1264 /* Flex counter packet attribute profile traverse callback. */
   1265 typedef int (*bcm_flexctr_packet_attribute_profile_traverse_cb)(
   1266     int unit, 
   1267     int profile_id, 
   1268     bcm_flexctr_packet_attribute_profile_t *attr_profile, 
   1269     void *user_data);
   1270 
   1271 #ifndef BCM_HIDE_DISPATCHABLE
   1272 
   1273 /* Flex counter packet attribute profile traverse function. */
   1274 extern int bcm_flexctr_packet_attribute_profile_traverse(
   1275     int unit, 
   1276     bcm_flexctr_packet_attribute_profile_traverse_cb trav_fn, 
   1277     void *user_data);
   1278 
   1279 #endif /* BCM_HIDE_DISPATCHABLE */
   1280 
   1281 /* 
   1282  * Flex counter packet attribute map entry data structure initialization
   1283  * function.
   1284  */
   1285 extern void bcm_flexctr_packet_attribute_map_entry_t_init(
   1286     bcm_flexctr_packet_attribute_map_entry_t *attr_map_entry);
   1287 
   1288 /* 
   1289  * Flex counter packet attribute map data structure initialization
   1290  * function.
   1291  */
   1292 extern void bcm_flexctr_packet_attribute_map_t_init(
   1293     bcm_flexctr_packet_attribute_map_t *attr_map);
   1294 
   1295 #ifndef BCM_HIDE_DISPATCHABLE
   1296 
   1297 /* Flex counter packet attribute map entry add function. */
   1298 extern int bcm_flexctr_packet_attribute_map_add(
   1299     int unit, 
   1300     int profile_id, 
   1301     bcm_flexctr_packet_attribute_map_t *attr_map, 
   1302     uint32 offset_value);
   1303 
   1304 /* Flex counter packet attribute map entry delete function. */
   1305 extern int bcm_flexctr_packet_attribute_map_delete(
   1306     int unit, 
   1307     int profile_id, 
   1308     bcm_flexctr_packet_attribute_map_t *attr_map);
   1309 
   1310 /* Flex counter packet attribute map entry delete all function. */
   1311 extern int bcm_flexctr_packet_attribute_map_delete_all(
   1312     int unit, 
   1313     int profile_id);
   1314 
   1315 /* Flex counter packet attribute map entry get function. */
   1316 extern int bcm_flexctr_packet_attribute_map_get(
   1317     int unit, 
   1318     int profile_id, 
   1319     bcm_flexctr_packet_attribute_map_t *attr_map, 
   1320     uint32 *offset_value);
   1321 
   1322 #endif /* BCM_HIDE_DISPATCHABLE */
   1323 
   1324 /* Flex counter packet attribute map entry traverse callback. */
   1325 typedef int (*bcm_flexctr_packet_attribute_map_traverse_cb)(
   1326     int unit, 
   1327     bcm_flexctr_packet_attribute_map_t *attr_map, 
   1328     uint32 offset_value, 
   1329     void *user_data);
   1330 
   1331 #ifndef BCM_HIDE_DISPATCHABLE
   1332 
   1333 /* Flex counter packet attribute map entry traverse function. */
   1334 extern int bcm_flexctr_packet_attribute_map_traverse(
   1335     int unit, 
   1336     int profile_id, 
   1337     bcm_flexctr_packet_attribute_map_traverse_cb trav_fn, 
   1338     void *user_data);
   1339 
   1340 /* Get overlaid objects for a specified flexctr object. */
   1341 extern int bcm_flexctr_object_overlay_multi_get(
   1342     int unit, 
   1343     bcm_flexctr_object_t object, 
   1344     int array_size, 
   1345     bcm_flexctr_object_t *overlay_object_array, 
   1346     int *count);
   1347 
   1348 #endif /* BCM_HIDE_DISPATCHABLE */
   1349 
   1350 #endif /* __BCM_FLEXCTR_H__ */