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

stat.h (153785B)


      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  * DO NOT EDIT THIS FILE!
      9  * This file is auto-generated.
     10  * Edits to this file will be lost when it is regenerated.
     11  */
     12 
     13 #ifndef __BCM_STAT_H__
     14 #define __BCM_STAT_H__
     15 
     16 #include <bcm/types.h>
     17 
     18 /* 
     19  * Statistics counters.
     20  * 
     21  * Note: the following RFC 2465 MIBs are not supported:
     22  * 
     23  *   snmpIpv6IfStatsInTooBigErrors,
     24  *   snmpIpv6IfStatsInNoRoutes,
     25  *   snmpIpv6IfStatsInUnknownProtos,
     26  *   snmpIpv6IfStatsInTruncatedPkts,
     27  *   snmpIpv6IfStatsInDelivers,
     28  *   snmpIpv6IfStatsOutRequests,
     29  *   snmpIpv6IfStatsOutFragOKs,
     30  *   snmpIpv6IfStatsOutFragFails,
     31  *   snmpIpv6IfStatsOutFragCreates,
     32  *   snmpIpv6IfStatsReasmReqds,
     33  *   snmpIpv6IfStatsReasmOKs,
     34  *   snmpIpv6IfStatsReasmFails,
     35  */
     36 typedef enum bcm_stat_val_e {
     37     snmpIfInOctets = 0,                 /* RFC 1213 */
     38     snmpIfInUcastPkts = 1,              /* RFC 1213 */
     39     snmpIfInNUcastPkts = 2,             /* RFC 1213 */
     40     snmpIfInDiscards = 3,               /* RFC 1213 */
     41     snmpIfInErrors = 4,                 /* RFC 1213 */
     42     snmpIfInUnknownProtos = 5,          /* RFC 1213 */
     43     snmpIfOutOctets = 6,                /* RFC 1213 */
     44     snmpIfOutUcastPkts = 7,             /* RFC 1213 */
     45     snmpIfOutNUcastPkts = 8,            /* RFC 1213 */
     46     snmpIfOutDiscards = 9,              /* RFC 1213 */
     47     snmpIfOutErrors = 10,               /* RFC 1213 */
     48     snmpIfOutQLen = 11,                 /* RFC 1213 */
     49     snmpIpInReceives = 12,              /* RFC 1213 */
     50     snmpIpInHdrErrors = 13,             /* RFC 1213 */
     51     snmpIpForwDatagrams = 14,           /* RFC 1213 */
     52     snmpIpInDiscards = 15,              /* RFC 1213 */
     53     snmpDot1dBasePortDelayExceededDiscards = 16, /* RFC 1493 */
     54     snmpDot1dBasePortMtuExceededDiscards = 17, /* RFC 1493 */
     55     snmpDot1dTpPortInFrames = 18,       /* RFC 1493 */
     56     snmpDot1dTpPortOutFrames = 19,      /* RFC 1493 */
     57     snmpDot1dPortInDiscards = 20,       /* RFC 1493 */
     58     snmpEtherStatsDropEvents = 21,      /* RFC 1757 (EtherStat) */
     59     snmpEtherStatsMulticastPkts = 22,   /* RFC 1757 (EtherStat) */
     60     snmpEtherStatsBroadcastPkts = 23,   /* RFC 1757 (EtherStat) */
     61     snmpEtherStatsUndersizePkts = 24,   /* RFC 1757 (EtherStat) */
     62     snmpEtherStatsFragments = 25,       /* RFC 1757 (EtherStat) */
     63     snmpEtherStatsPkts64Octets = 26,    /* RFC 1757 (EtherStat) */
     64     snmpEtherStatsPkts65to127Octets = 27, /* RFC 1757 (EtherStat) */
     65     snmpEtherStatsPkts128to255Octets = 28, /* RFC 1757 (EtherStat) */
     66     snmpEtherStatsPkts256to511Octets = 29, /* RFC 1757 (EtherStat) */
     67     snmpEtherStatsPkts512to1023Octets = 30, /* RFC 1757 (EtherStat) */
     68     snmpEtherStatsPkts1024to1518Octets = 31, /* RFC 1757 (EtherStat) */
     69     snmpEtherStatsOversizePkts = 32,    /* RFC 1757 (EtherStat) */
     70     snmpEtherRxOversizePkts = 33,       /* Rx component of
     71                                            snmpEtherStatsOversizePkts */
     72     snmpEtherTxOversizePkts = 34,       /* Tx component of
     73                                            snmpEtherStatsOversizePkts */
     74     snmpEtherStatsJabbers = 35,         /* RFC 1757 (EtherStat) */
     75     snmpEtherStatsOctets = 36,          /* RFC 1757 (EtherStat) */
     76     snmpEtherStatsPkts = 37,            /* RFC 1757 (EtherStat) */
     77     snmpEtherStatsCollisions = 38,      /* RFC 1757 (EtherStat) */
     78     snmpEtherStatsCRCAlignErrors = 39,  /* RFC 1757 (EtherStat) */
     79     snmpEtherStatsTXNoErrors = 40,      /* RFC 1757 (EtherStat) */
     80     snmpEtherStatsRXNoErrors = 41,      /* RFC 1757 (EtherStat) */
     81     snmpDot3StatsAlignmentErrors = 42,  /* RFC 2665 */
     82     snmpDot3StatsFCSErrors = 43,        /* RFC 2665 */
     83     snmpDot3StatsSingleCollisionFrames = 44, /* RFC 2665 */
     84     snmpDot3StatsMultipleCollisionFrames = 45, /* RFC 2665 */
     85     snmpDot3StatsSQETTestErrors = 46,   /* RFC 2665 */
     86     snmpDot3StatsDeferredTransmissions = 47, /* RFC 2665 */
     87     snmpDot3StatsLateCollisions = 48,   /* RFC 2665 */
     88     snmpDot3StatsExcessiveCollisions = 49, /* RFC 2665 */
     89     snmpDot3StatsInternalMacTransmitErrors = 50, /* RFC 2665 */
     90     snmpDot3StatsCarrierSenseErrors = 51, /* RFC 2665 */
     91     snmpDot3StatsFrameTooLongs = 52,    /* RFC 2665 */
     92     snmpDot3StatsInternalMacReceiveErrors = 53, /* RFC 2665 */
     93     snmpDot3StatsSymbolErrors = 54,     /* RFC 2665 */
     94     snmpDot3ControlInUnknownOpcodes = 55, /* RFC 2665 */
     95     snmpDot3InPauseFrames = 56,         /* RFC 2665 */
     96     snmpDot3OutPauseFrames = 57,        /* RFC 2665 */
     97     snmpIfHCInOctets = 58,              /* RFC 2233 */
     98     snmpIfHCInUcastPkts = 59,           /* RFC 2233 */
     99     snmpIfHCInMulticastPkts = 60,       /* RFC 2233 */
    100     snmpIfHCInBroadcastPkts = 61,       /* RFC 2233 */
    101     snmpIfHCOutOctets = 62,             /* RFC 2233 */
    102     snmpIfHCOutUcastPkts = 63,          /* RFC 2233 */
    103     snmpIfHCOutMulticastPkts = 64,      /* RFC 2233 */
    104     snmpIfHCOutBroadcastPckts = 65,     /* RFC 2233 */
    105     snmpIpv6IfStatsInReceives = 66,     /* RFC 2465 */
    106     snmpIpv6IfStatsInHdrErrors = 67,    /* RFC 2465 */
    107     snmpIpv6IfStatsInAddrErrors = 68,   /* RFC 2465 */
    108     snmpIpv6IfStatsInDiscards = 69,     /* RFC 2465 */
    109     snmpIpv6IfStatsOutForwDatagrams = 70, /* RFC 2465 */
    110     snmpIpv6IfStatsOutDiscards = 71,    /* RFC 2465 */
    111     snmpIpv6IfStatsInMcastPkts = 72,    /* RFC 2465 */
    112     snmpIpv6IfStatsOutMcastPkts = 73,   /* RFC 2465 */
    113     snmpIfInBroadcastPkts = 74,         /* RFC 1573 */
    114     snmpIfInMulticastPkts = 75,         /* RFC 1573 */
    115     snmpIfOutBroadcastPkts = 76,        /* RFC 1573 */
    116     snmpIfOutMulticastPkts = 77,        /* RFC 1573 */
    117     snmpIeee8021PfcRequests = 78,       /* IEEE 802.1bb */
    118     snmpIeee8021PfcIndications = 79,    /* IEEE 802.1bb */
    119     snmpBcmReceivedUndersizePkts = 80,  /* Broadcom-specific */
    120     snmpBcmTransmittedUndersizePkts = 81, /* Broadcom-specific */
    121     snmpBcmIPMCBridgedPckts = 82,       /* Broadcom-specific */
    122     snmpBcmIPMCRoutedPckts = 83,        /* Broadcom-specific */
    123     snmpBcmIPMCInDroppedPckts = 84,     /* Broadcom-specific */
    124     snmpBcmIPMCOutDroppedPckts = 85,    /* Broadcom-specific */
    125     snmpBcmEtherStatsPkts1519to1522Octets = 86, /* Broadcom-specific */
    126     snmpBcmEtherStatsPkts1522to2047Octets = 87, /* Broadcom-specific */
    127     snmpBcmEtherStatsPkts2048to4095Octets = 88, /* Broadcom-specific */
    128     snmpBcmEtherStatsPkts4095to9216Octets = 89, /* Broadcom-specific */
    129     snmpBcmReceivedPkts64Octets = 90,   /* Broadcom-specific */
    130     snmpBcmReceivedPkts65to127Octets = 91, /* Broadcom-specific */
    131     snmpBcmReceivedPkts128to255Octets = 92, /* Broadcom-specific */
    132     snmpBcmReceivedPkts256to511Octets = 93, /* Broadcom-specific */
    133     snmpBcmReceivedPkts512to1023Octets = 94, /* Broadcom-specific */
    134     snmpBcmReceivedPkts1024to1518Octets = 95, /* Broadcom-specific */
    135     snmpBcmReceivedPkts1519to2047Octets = 96, /* Broadcom-specific */
    136     snmpBcmReceivedPkts2048to4095Octets = 97, /* Broadcom-specific */
    137     snmpBcmReceivedPkts4095to9216Octets = 98, /* Broadcom-specific */
    138     snmpBcmTransmittedPkts64Octets = 99, /* Broadcom-specific */
    139     snmpBcmTransmittedPkts65to127Octets = 100, /* Broadcom-specific */
    140     snmpBcmTransmittedPkts128to255Octets = 101, /* Broadcom-specific */
    141     snmpBcmTransmittedPkts256to511Octets = 102, /* Broadcom-specific */
    142     snmpBcmTransmittedPkts512to1023Octets = 103, /* Broadcom-specific */
    143     snmpBcmTransmittedPkts1024to1518Octets = 104, /* Broadcom-specific */
    144     snmpBcmTransmittedPkts1519to2047Octets = 105, /* Broadcom-specific */
    145     snmpBcmTransmittedPkts2048to4095Octets = 106, /* Broadcom-specific */
    146     snmpBcmTransmittedPkts4095to9216Octets = 107, /* Broadcom-specific */
    147     snmpBcmTxControlCells = 108,        /* Fabric TX Control cells counter.
    148                                            (Broadcom-specific) */
    149     snmpBcmTxDataCells = 109,           /* Fabric TX Data cell counter.
    150                                            (Broadcom-specific) */
    151     snmpBcmTxDataBytes = 110,           /* Fabric TX Data byte counter.
    152                                            (Broadcom-specific) */
    153     snmpBcmRxCrcErrors = 111,           /* Fabric RX CRC errors counter.
    154                                            (Broadcom-specific) */
    155     snmpBcmRxFecCorrectable = 112,      /* Fabric RX LFEC/FEC correctable error.
    156                                            (Broadcom-specific) */
    157     snmpBcmRxBecCrcErrors = 113,        /* Fabric RX BEC crc error.
    158                                            (Broadcom-specific) */
    159     snmpBcmRxDisparityErrors = 114,     /* Fabric RX 8b/10b disparity errors.
    160                                            (Broadcom-specific) */
    161     snmpBcmRxControlCells = 115,        /* Fabric RX Control cells counter.
    162                                            (Broadcom-specific) */
    163     snmpBcmRxDataCells = 116,           /* Fabric RX Data cell counter.
    164                                            (Broadcom-specific) */
    165     snmpBcmRxDataBytes = 117,           /* Fabric RX Data byte counter.
    166                                            (Broadcom-specific) */
    167     snmpBcmRxDroppedRetransmittedControl = 118, /* Fabric RX dropped retransmitted
    168                                            control. (Broadcom-specific) */
    169     snmpBcmTxBecRetransmit = 119,       /* Fabric TX BEC retransmit.
    170                                            (Broadcom-specific) */
    171     snmpBcmRxBecRetransmit = 120,       /* Fabric RX BEC retransmit.
    172                                            (Broadcom-specific) */
    173     snmpBcmTxAsynFifoRate = 121,        /* Fabric TX Asyn fifo rate at units of
    174                                            40 bits. (Broadcom-specific) */
    175     snmpBcmRxAsynFifoRate = 122,        /* Fabric RX Asyn fifo rate at units of
    176                                            40 bits. (Broadcom-specific) */
    177     snmpBcmRxFecUncorrectable = 123,    /* Fabric RX LFEC/FEC uncorrectable
    178                                            erros. (Broadcom-specific) */
    179     snmpBcmRxBecRxFault = 124,          /* Fabric RX BEC RX fault.
    180                                            (Broadcom-specific) */
    181     snmpBcmRxCodeErrors = 125,          /* Fabric RX 8b/10b code errors.
    182                                            (Broadcom-specific) */
    183     snmpBcmRxRsFecBitError = 126,       /* Fabric RX RS-FEC bit error counter.
    184                                            (Broadcom-specific) */
    185     snmpBcmRxRsFecSymbolError = 127,    /* RX RS-FEC symbol error counter.
    186                                            (Broadcom-specific) */
    187     snmpBcmRxLlfcPrimary = 128,         /* Fabric RX LLFC Primary.
    188                                            (Broadcom-specific) */
    189     snmpBcmRxLlfcSecondary = 129,       /* Fabric RX LLFC Secondary.
    190                                            (Broadcom-specific) */
    191     snmpBcmCustomReceive0 = 130,        /* Broadcom-specific */
    192     snmpBcmCustomReceive1 = 131,        /* Broadcom-specific */
    193     snmpBcmCustomReceive2 = 132,        /* Broadcom-specific */
    194     snmpBcmCustomReceive3 = 133,        /* Broadcom-specific */
    195     snmpBcmCustomReceive4 = 134,        /* Broadcom-specific */
    196     snmpBcmCustomReceive5 = 135,        /* Broadcom-specific */
    197     snmpBcmCustomReceive6 = 136,        /* Broadcom-specific */
    198     snmpBcmCustomReceive7 = 137,        /* Broadcom-specific */
    199     snmpBcmCustomReceive8 = 138,        /* Broadcom-specific */
    200     snmpBcmCustomTransmit0 = 139,       /* Broadcom-specific */
    201     snmpBcmCustomTransmit1 = 140,       /* Broadcom-specific */
    202     snmpBcmCustomTransmit2 = 141,       /* Broadcom-specific */
    203     snmpBcmCustomTransmit3 = 142,       /* Broadcom-specific */
    204     snmpBcmCustomTransmit4 = 143,       /* Broadcom-specific */
    205     snmpBcmCustomTransmit5 = 144,       /* Broadcom-specific */
    206     snmpBcmCustomTransmit6 = 145,       /* Broadcom-specific */
    207     snmpBcmCustomTransmit7 = 146,       /* Broadcom-specific */
    208     snmpBcmCustomTransmit8 = 147,       /* Broadcom-specific */
    209     snmpBcmCustomTransmit9 = 148,       /* Broadcom-specific */
    210     snmpBcmCustomTransmit10 = 149,      /* Broadcom-specific */
    211     snmpBcmCustomTransmit11 = 150,      /* Broadcom-specific */
    212     snmpBcmCustomTransmit12 = 151,      /* Broadcom-specific */
    213     snmpBcmCustomTransmit13 = 152,      /* Broadcom-specific */
    214     snmpBcmCustomTransmit14 = 153,      /* Broadcom-specific */
    215     snmpDot3StatsInRangeLengthError = 154, /* RFC 1284 */
    216     snmpDot3OmpEmulationCRC8Errors = 155, /* RFC 4837 */
    217     snmpDot3MpcpRxGate = 156,           /* RFC 4837 */
    218     snmpDot3MpcpRxRegister = 157,       /* RFC 4837 */
    219     snmpDot3MpcpTxRegRequest = 158,     /* RFC 4837 */
    220     snmpDot3MpcpTxRegAck = 159,         /* RFC 4837 */
    221     snmpDot3MpcpTxReport = 160,         /* RFC 4837 */
    222     snmpDot3EponFecCorrectedBlocks = 161, /* RFC 4837 */
    223     snmpDot3EponFecUncorrectableBlocks = 162, /* RFC 4837 */
    224     snmpBcmPonInDroppedOctets = 163,    /* Broadcom-specific */
    225     snmpBcmPonOutDroppedOctets = 164,   /* Broadcom-specific */
    226     snmpBcmPonInDelayedOctets = 165,    /* Broadcom-specific */
    227     snmpBcmPonOutDelayedOctets = 166,   /* Broadcom-specific */
    228     snmpBcmPonInDelayedHundredUs = 167, /* Broadcom-specific */
    229     snmpBcmPonOutDelayedHundredUs = 168, /* Broadcom-specific */
    230     snmpBcmPonInFrameErrors = 169,      /* Broadcom-specific */
    231     snmpBcmPonInOamFrames = 170,        /* Broadcom-specific */
    232     snmpBcmPonOutOamFrames = 171,       /* Broadcom-specific */
    233     snmpBcmPonOutUnusedOctets = 172,    /* Broadcom-specific */
    234     snmpBcmEtherStatsPkts9217to16383Octets = 173, /* Broadcom-specific */
    235     snmpBcmReceivedPkts9217to16383Octets = 174, /* Broadcom-specific */
    236     snmpBcmTransmittedPkts9217to16383Octets = 175, /* Broadcom-specific */
    237     snmpBcmRxVlanTagFrame = 176,        /* Broadcom-specific */
    238     snmpBcmRxDoubleVlanTagFrame = 177,  /* Broadcom-specific */
    239     snmpBcmTxVlanTagFrame = 178,        /* Broadcom-specific */
    240     snmpBcmTxDoubleVlanTagFrame = 179,  /* Broadcom-specific */
    241     snmpBcmRxPFCControlFrame = 180,     /* PFC Receive Control Frame */
    242     snmpBcmTxPFCControlFrame = 181,     /* PFC Transmit Control Frame */
    243     snmpBcmRxPFCFrameXonPriority0 = 182, /* Receive PFC Frame Priority 0 XON to
    244                                            XOFF */
    245     snmpBcmRxPFCFrameXonPriority1 = 183, /* Receive PFC Frame Priority 1 XON to
    246                                            XOFF */
    247     snmpBcmRxPFCFrameXonPriority2 = 184, /* Receive PFC Frame Priority 2 XON to
    248                                            XOFF */
    249     snmpBcmRxPFCFrameXonPriority3 = 185, /* Receive PFC Frame Priority 3 XON to
    250                                            XOFF */
    251     snmpBcmRxPFCFrameXonPriority4 = 186, /* Receive PFC Frame Priority 4 XON to
    252                                            XOFF */
    253     snmpBcmRxPFCFrameXonPriority5 = 187, /* Receive PFC Frame Priority 5 XON to
    254                                            XOFF */
    255     snmpBcmRxPFCFrameXonPriority6 = 188, /* Receive PFC Frame Priority 6 XON to
    256                                            XOFF */
    257     snmpBcmRxPFCFrameXonPriority7 = 189, /* Receive PFC Frame Priority 7 XON to
    258                                            XOFF */
    259     snmpBcmRxPFCFramePriority0 = 190,   /* Receive PFC Frame Priority 0 */
    260     snmpBcmRxPFCFramePriority1 = 191,   /* Receive PFC Frame Priority 1 */
    261     snmpBcmRxPFCFramePriority2 = 192,   /* Receive PFC Frame Priority 2 */
    262     snmpBcmRxPFCFramePriority3 = 193,   /* Receive PFC Frame Priority 3 */
    263     snmpBcmRxPFCFramePriority4 = 194,   /* Receive PFC Frame Priority 4 */
    264     snmpBcmRxPFCFramePriority5 = 195,   /* Receive PFC Frame Priority 5 */
    265     snmpBcmRxPFCFramePriority6 = 196,   /* Receive PFC Frame Priority 6 */
    266     snmpBcmRxPFCFramePriority7 = 197,   /* Receive PFC Frame Priority 7 */
    267     snmpBcmTxPFCFramePriority0 = 198,   /* Transmit PFC Frame Priority 0 */
    268     snmpBcmTxPFCFramePriority1 = 199,   /* Transmit PFC Frame Priority 1 */
    269     snmpBcmTxPFCFramePriority2 = 200,   /* Transmit PFC Frame Priority 2 */
    270     snmpBcmTxPFCFramePriority3 = 201,   /* Transmit PFC Frame Priority 3 */
    271     snmpBcmTxPFCFramePriority4 = 202,   /* Transmit PFC Frame Priority 4 */
    272     snmpBcmTxPFCFramePriority5 = 203,   /* Transmit PFC Frame Priority 5 */
    273     snmpBcmTxPFCFramePriority6 = 204,   /* Transmit PFC Frame Priority 6 */
    274     snmpBcmTxPFCFramePriority7 = 205,   /* Transmit PFC Frame Priority 7 */
    275     snmpFcmPortClass3RxFrames = 206,    /* RFC 4044 */
    276     snmpFcmPortClass3TxFrames = 207,    /* RFC 4044 */
    277     snmpFcmPortClass3Discards = 208,    /* RFC 4044 */
    278     snmpFcmPortClass2RxFrames = 209,    /* RFC 4044 */
    279     snmpFcmPortClass2TxFrames = 210,    /* RFC 4044 */
    280     snmpFcmPortClass2Discards = 211,    /* RFC 4044 */
    281     snmpFcmPortInvalidCRCs = 212,       /* RFC 4044 */
    282     snmpFcmPortDelimiterErrors = 213,   /* RFC 4044 */
    283     snmpBcmSampleIngressPkts = 214,     /* Total number of packets eligible to
    284                                            be sampled by Ingress Sampler.
    285                                            (Broadcom-specific) */
    286     snmpBcmSampleIngressSnapshotPkts = 215, /* Total number of eligible packets when
    287                                            the last packet was sampled by
    288                                            Ingress sampler. (Broadcom-specific) */
    289     snmpBcmSampleIngressSampledPkts = 216, /* Total number of packets sampled by
    290                                            Ingress sampler. (Broadcom-specific) */
    291     snmpBcmSampleFlexPkts = 217,        /* Total number of packets eligible to
    292                                            be sampled by Flex sampler enabled by
    293                                            IFP ingress sampling policy action.
    294                                            (Broadcom-specific) */
    295     snmpBcmSampleFlexSnapshotPkts = 218, /* Total number of eligible packets when
    296                                            the last packet was sampled by Flex
    297                                            sampler enabled by IFP ingress
    298                                            sampling policy action.
    299                                            (Broadcom-specific) */
    300     snmpBcmSampleFlexSampledPkts = 219, /* Total number of packets sampled by
    301                                            Flex sampler enabled by IFP ingress
    302                                            sampling policy action.
    303                                            (Broadcom-specific) */
    304     snmpBcmEgressProtectionDataDrop = 220, /* Egress Protection data drop in EPIPE.
    305                                            (Broadcom-specific) */
    306     snmpBcmTxE2ECCControlFrames = 221,  /* Total number of End to End Congestion
    307                                            Control(E2E-CC) Head of line(HOL)
    308                                            packets or DMVoQ flow control packets
    309                                            transmitted on each of the ports.
    310                                            (Broadcom-specific) */
    311     snmpBcmE2EHOLDropPkts = 222,        /* Total number of packets dropped due
    312                                            to E2EHOL (End to End Head of Line)
    313                                            drop status. (Broadcom-specific) */
    314     snmpEtherStatsTxCRCAlignErrors = 223, /* RFC 1757 (EtherStat) */
    315     snmpEtherStatsTxJabbers = 224,      /* RFC 1757 (EtherStat) */
    316     snmpBcmMacMergeTxFrag = 225,        /* Number of additional mPackets
    317                                            transmitted due to preemption. */
    318     snmpBcmMacMergeTxVerifyFrame = 226, /* Number of transmitted verify
    319                                            mPackets. */
    320     snmpBcmMacMergeTxReplyFrame = 227,  /* Number of transmitted reply mPackets. */
    321     snmpBcmMacMergeRxFrameAssErrors = 228, /* Number of packets with reassembly
    322                                            errors in MAC receive direction. */
    323     snmpBcmMacMergeRxFrameSmdErrors = 229, /* Number of received packets rejected
    324                                            due to unknown SMD value or arriving
    325                                            with an SMD-C when no packet is in
    326                                            progress. */
    327     snmpBcmMacMergeRxFrameAss = 230,    /* Number of received packets that were
    328                                            successfully reassembled. */
    329     snmpBcmMacMergeRxFrag = 231,        /* Number of additional mPackets
    330                                            received due to preemption. */
    331     snmpBcmMacMergeRxVerifyFrame = 232, /* Number of received verify mPackets. */
    332     snmpBcmMacMergeRxReplyFrame = 233,  /* Number of received reply mPackets. */
    333     snmpBcmMacMergeRxFinalFragSizeError = 234, /* Number of the received mPackets which
    334                                            are less than non-final fragments
    335                                            size. */
    336     snmpBcmMacMergeRxFragSizeError = 235, /* Number of received mPackets which are
    337                                            less than final fragments size. */
    338     snmpBcmMacMergeRxDiscard = 236,     /* Number of all discarded mPackets
    339                                            because of error conditions. */
    340     snmpBcmMacMergeHoldCount = 237,     /* Number of hold request primitive
    341                                            events. */
    342     snmpBcmRxBipErrorCount = 238,       /* RX BER and BIP counter. */
    343     snmpBcmTxEcnErrors = 239,           /* Egress ECN error counter. */
    344     snmpBcmRxDot3LengthMismatches = 240, /* Number of the received good frames in
    345                                            which the 802.3 length field is valid
    346                                            (<= 0x600) and does not match the
    347                                            number of data bytes actually
    348                                            received. */
    349     snmpValCount = 241 
    350 } bcm_stat_val_t;
    351 
    352 #define BCM_STAT_NAME_INITIALIZER \
    353 { \
    354     "snmpIfInOctets", \
    355     "snmpIfInUcastPkts", \
    356     "snmpIfInNUcastPkts", \
    357     "snmpIfInDiscards", \
    358     "snmpIfInErrors", \
    359     "snmpIfInUnknownProtos", \
    360     "snmpIfOutOctets", \
    361     "snmpIfOutUcastPkts", \
    362     "snmpIfOutNUcastPkts", \
    363     "snmpIfOutDiscards", \
    364     "snmpIfOutErrors", \
    365     "snmpIfOutQLen", \
    366     "snmpIpInReceives", \
    367     "snmpIpInHdrErrors", \
    368     "snmpIpForwDatagrams", \
    369     "snmpIpInDiscards", \
    370     "snmpDot1dBasePortDelayExceededDiscards", \
    371     "snmpDot1dBasePortMtuExceededDiscards", \
    372     "snmpDot1dTpPortInFrames", \
    373     "snmpDot1dTpPortOutFrames", \
    374     "snmpDot1dPortInDiscards", \
    375     "snmpEtherStatsDropEvents", \
    376     "snmpEtherStatsMulticastPkts", \
    377     "snmpEtherStatsBroadcastPkts", \
    378     "snmpEtherStatsUndersizePkts", \
    379     "snmpEtherStatsFragments", \
    380     "snmpEtherStatsPkts64Octets", \
    381     "snmpEtherStatsPkts65to127Octets", \
    382     "snmpEtherStatsPkts128to255Octets", \
    383     "snmpEtherStatsPkts256to511Octets", \
    384     "snmpEtherStatsPkts512to1023Octets", \
    385     "snmpEtherStatsPkts1024to1518Octets", \
    386     "snmpEtherStatsOversizePkts", \
    387     "snmpEtherRxOversizePkts", \
    388     "snmpEtherTxOversizePkts", \
    389     "snmpEtherStatsJabbers", \
    390     "snmpEtherStatsOctets", \
    391     "snmpEtherStatsPkts", \
    392     "snmpEtherStatsCollisions", \
    393     "snmpEtherStatsCRCAlignErrors", \
    394     "snmpEtherStatsTXNoErrors", \
    395     "snmpEtherStatsRXNoErrors", \
    396     "snmpDot3StatsAlignmentErrors", \
    397     "snmpDot3StatsFCSErrors", \
    398     "snmpDot3StatsSingleCollisionFrames", \
    399     "snmpDot3StatsMultipleCollisionFrames", \
    400     "snmpDot3StatsSQETTestErrors", \
    401     "snmpDot3StatsDeferredTransmissions", \
    402     "snmpDot3StatsLateCollisions", \
    403     "snmpDot3StatsExcessiveCollisions", \
    404     "snmpDot3StatsInternalMacTransmitErrors", \
    405     "snmpDot3StatsCarrierSenseErrors", \
    406     "snmpDot3StatsFrameTooLongs", \
    407     "snmpDot3StatsInternalMacReceiveErrors", \
    408     "snmpDot3StatsSymbolErrors", \
    409     "snmpDot3ControlInUnknownOpcodes", \
    410     "snmpDot3InPauseFrames", \
    411     "snmpDot3OutPauseFrames", \
    412     "snmpIfHCInOctets", \
    413     "snmpIfHCInUcastPkts", \
    414     "snmpIfHCInMulticastPkts", \
    415     "snmpIfHCInBroadcastPkts", \
    416     "snmpIfHCOutOctets", \
    417     "snmpIfHCOutUcastPkts", \
    418     "snmpIfHCOutMulticastPkts", \
    419     "snmpIfHCOutBroadcastPckts", \
    420     "snmpIpv6IfStatsInReceives", \
    421     "snmpIpv6IfStatsInHdrErrors", \
    422     "snmpIpv6IfStatsInAddrErrors", \
    423     "snmpIpv6IfStatsInDiscards", \
    424     "snmpIpv6IfStatsOutForwDatagrams", \
    425     "snmpIpv6IfStatsOutDiscards", \
    426     "snmpIpv6IfStatsInMcastPkts", \
    427     "snmpIpv6IfStatsOutMcastPkts", \
    428     "snmpIfInBroadcastPkts", \
    429     "snmpIfInMulticastPkts", \
    430     "snmpIfOutBroadcastPkts", \
    431     "snmpIfOutMulticastPkts", \
    432     "snmpIeee8021PfcRequests", \
    433     "snmpIeee8021PfcIndications", \
    434     "snmpBcmReceivedUndersizePkts", \
    435     "snmpBcmTransmittedUndersizePkts", \
    436     "snmpBcmIPMCBridgedPckts", \
    437     "snmpBcmIPMCRoutedPckts", \
    438     "snmpBcmIPMCInDroppedPckts", \
    439     "snmpBcmIPMCOutDroppedPckts", \
    440     "snmpBcmEtherStatsPkts1519to1522Octets", \
    441     "snmpBcmEtherStatsPkts1522to2047Octets", \
    442     "snmpBcmEtherStatsPkts2048to4095Octets", \
    443     "snmpBcmEtherStatsPkts4095to9216Octets", \
    444     "snmpBcmReceivedPkts64Octets", \
    445     "snmpBcmReceivedPkts65to127Octets", \
    446     "snmpBcmReceivedPkts128to255Octets", \
    447     "snmpBcmReceivedPkts256to511Octets", \
    448     "snmpBcmReceivedPkts512to1023Octets", \
    449     "snmpBcmReceivedPkts1024to1518Octets", \
    450     "snmpBcmReceivedPkts1519to2047Octets", \
    451     "snmpBcmReceivedPkts2048to4095Octets", \
    452     "snmpBcmReceivedPkts4095to9216Octets", \
    453     "snmpBcmTransmittedPkts64Octets", \
    454     "snmpBcmTransmittedPkts65to127Octets", \
    455     "snmpBcmTransmittedPkts128to255Octets", \
    456     "snmpBcmTransmittedPkts256to511Octets", \
    457     "snmpBcmTransmittedPkts512to1023Octets", \
    458     "snmpBcmTransmittedPkts1024to1518Octets", \
    459     "snmpBcmTransmittedPkts1519to2047Octets", \
    460     "snmpBcmTransmittedPkts2048to4095Octets", \
    461     "snmpBcmTransmittedPkts4095to9216Octets", \
    462     "snmpBcmTxControlCells", \
    463     "snmpBcmTxDataCells", \
    464     "snmpBcmTxDataBytes", \
    465     "snmpBcmRxCrcErrors", \
    466     "snmpBcmRxFecCorrectable", \
    467     "snmpBcmRxBecCrcErrors", \
    468     "snmpBcmRxDisparityErrors", \
    469     "snmpBcmRxControlCells", \
    470     "snmpBcmRxDataCells", \
    471     "snmpBcmRxDataBytes", \
    472     "snmpBcmRxDroppedRetransmittedControl", \
    473     "snmpBcmTxBecRetransmit", \
    474     "snmpBcmRxBecRetransmit", \
    475     "snmpBcmTxAsynFifoRate", \
    476     "snmpBcmRxAsynFifoRate", \
    477     "snmpBcmRxFecUncorrectable", \
    478     "snmpBcmRxBecRxFault", \
    479     "snmpBcmRxCodeErrors", \
    480     "snmpBcmRxRsFecBitError", \
    481     "snmpBcmRxRsFecSymbolError", \
    482     "snmpBcmRxLlfcPrimary", \
    483     "snmpBcmRxLlfcSecondary", \
    484     "snmpBcmCustomReceive0", \
    485     "snmpBcmCustomReceive1", \
    486     "snmpBcmCustomReceive2", \
    487     "snmpBcmCustomReceive3", \
    488     "snmpBcmCustomReceive4", \
    489     "snmpBcmCustomReceive5", \
    490     "snmpBcmCustomReceive6", \
    491     "snmpBcmCustomReceive7", \
    492     "snmpBcmCustomReceive8", \
    493     "snmpBcmCustomTransmit0", \
    494     "snmpBcmCustomTransmit1", \
    495     "snmpBcmCustomTransmit2", \
    496     "snmpBcmCustomTransmit3", \
    497     "snmpBcmCustomTransmit4", \
    498     "snmpBcmCustomTransmit5", \
    499     "snmpBcmCustomTransmit6", \
    500     "snmpBcmCustomTransmit7", \
    501     "snmpBcmCustomTransmit8", \
    502     "snmpBcmCustomTransmit9", \
    503     "snmpBcmCustomTransmit10", \
    504     "snmpBcmCustomTransmit11", \
    505     "snmpBcmCustomTransmit12", \
    506     "snmpBcmCustomTransmit13", \
    507     "snmpBcmCustomTransmit14", \
    508     "snmpDot3StatsInRangeLengthError", \
    509     "snmpDot3OmpEmulationCRC8Errors", \
    510     "snmpDot3MpcpRxGate", \
    511     "snmpDot3MpcpRxRegister", \
    512     "snmpDot3MpcpTxRegRequest", \
    513     "snmpDot3MpcpTxRegAck", \
    514     "snmpDot3MpcpTxReport", \
    515     "snmpDot3EponFecCorrectedBlocks", \
    516     "snmpDot3EponFecUncorrectableBlocks", \
    517     "snmpBcmPonInDroppedOctets", \
    518     "snmpBcmPonOutDroppedOctets", \
    519     "snmpBcmPonInDelayedOctets", \
    520     "snmpBcmPonOutDelayedOctets", \
    521     "snmpBcmPonInDelayedHundredUs", \
    522     "snmpBcmPonOutDelayedHundredUs", \
    523     "snmpBcmPonInFrameErrors", \
    524     "snmpBcmPonInOamFrames", \
    525     "snmpBcmPonOutOamFrames", \
    526     "snmpBcmPonOutUnusedOctets", \
    527     "snmpBcmEtherStatsPkts9217to16383Octets", \
    528     "snmpBcmReceivedPkts9217to16383Octets", \
    529     "snmpBcmTransmittedPkts9217to16383Octets", \
    530     "snmpBcmRxVlanTagFrame", \
    531     "snmpBcmRxDoubleVlanTagFrame", \
    532     "snmpBcmTxVlanTagFrame", \
    533     "snmpBcmTxDoubleVlanTagFrame", \
    534     "snmpBcmRxPFCControlFrame", \
    535     "snmpBcmTxPFCControlFrame", \
    536     "snmpBcmRxPFCFrameXonPriority0", \
    537     "snmpBcmRxPFCFrameXonPriority1", \
    538     "snmpBcmRxPFCFrameXonPriority2", \
    539     "snmpBcmRxPFCFrameXonPriority3", \
    540     "snmpBcmRxPFCFrameXonPriority4", \
    541     "snmpBcmRxPFCFrameXonPriority5", \
    542     "snmpBcmRxPFCFrameXonPriority6", \
    543     "snmpBcmRxPFCFrameXonPriority7", \
    544     "snmpBcmRxPFCFramePriority0", \
    545     "snmpBcmRxPFCFramePriority1", \
    546     "snmpBcmRxPFCFramePriority2", \
    547     "snmpBcmRxPFCFramePriority3", \
    548     "snmpBcmRxPFCFramePriority4", \
    549     "snmpBcmRxPFCFramePriority5", \
    550     "snmpBcmRxPFCFramePriority6", \
    551     "snmpBcmRxPFCFramePriority7", \
    552     "snmpBcmTxPFCFramePriority0", \
    553     "snmpBcmTxPFCFramePriority1", \
    554     "snmpBcmTxPFCFramePriority2", \
    555     "snmpBcmTxPFCFramePriority3", \
    556     "snmpBcmTxPFCFramePriority4", \
    557     "snmpBcmTxPFCFramePriority5", \
    558     "snmpBcmTxPFCFramePriority6", \
    559     "snmpBcmTxPFCFramePriority7", \
    560     "snmpFcmPortClass3RxFrames", \
    561     "snmpFcmPortClass3TxFrames", \
    562     "snmpFcmPortClass3Discards", \
    563     "snmpFcmPortClass2RxFrames", \
    564     "snmpFcmPortClass2TxFrames", \
    565     "snmpFcmPortClass2Discards", \
    566     "snmpFcmPortInvalidCRCs", \
    567     "snmpFcmPortDelimiterErrors", \
    568     "snmpBcmSampleIngressPkts", \
    569     "snmpBcmSampleIngressSnapshotPkts", \
    570     "snmpBcmSampleIngressSampledPkts", \
    571     "snmpBcmSampleFlexPkts", \
    572     "snmpBcmSampleFlexSnapshotPkts", \
    573     "snmpBcmSampleFlexSampledPkts", \
    574     "snmpBcmEgressProtectionDataDrop", \
    575     "snmpBcmTxE2ECCControlFrames", \
    576     "snmpBcmE2EHOLDropPkts", \
    577     "snmpEtherStatsTxCRCAlignErrors", \
    578     "snmpEtherStatsTxJabbers", \
    579     "snmpBcmMacMergeTxFrag", \
    580     "snmpBcmMacMergeTxVerifyFrame", \
    581     "snmpBcmMacMergeTxReplyFrame", \
    582     "snmpBcmMacMergeRxFrameAssErrors", \
    583     "snmpBcmMacMergeRxFrameSmdErrors", \
    584     "snmpBcmMacMergeRxFrameAss", \
    585     "snmpBcmMacMergeRxFrag", \
    586     "snmpBcmMacMergeRxVerifyFrame", \
    587     "snmpBcmMacMergeRxReplyFrame", \
    588     "snmpBcmMacMergeRxFinalFragSizeError", \
    589     "snmpBcmMacMergeRxFragSizeError", \
    590     "snmpBcmMacMergeRxDiscard", \
    591     "snmpBcmMacMergeHoldCount", \
    592     "snmpBcmRxBipErrorCount", \
    593     "snmpBcmTxEcnErrors", \
    594     "snmpBcmRxDot3LengthMismatches"  \
    595 }
    596 
    597 /* bcm_custom_stat_trigger_e */
    598 typedef enum bcm_custom_stat_trigger_e {
    599     bcmDbgCntRIPD4 = 0,                 /* Rx: IPv4 L3 discard packets. */
    600     bcmDbgCntRIPC4 = 1,                 /* Rx: Good L3 (V4 packets) includes
    601                                            tunneled. */
    602     bcmDbgCntRIPHE4 = 2,                /* Rx: IPv4 header error packets. */
    603     bcmDbgCntIMRP4 = 3,                 /* Rx: Routed IPv4 multicast packets. */
    604     bcmDbgCntRIPD6 = 4,                 /* Rx: IPv6 L3 discard packets. */
    605     bcmDbgCntRIPC6 = 5,                 /* Rx: Good L3 (V6 packets) includes
    606                                            tunneled. */
    607     bcmDbgCntRIPHE6 = 6,                /* Rx: IPv6 header error packets. */
    608     bcmDbgCntIMRP6 = 7,                 /* Rx: Routed IPv6 multicast packets. */
    609     bcmDbgCntRDISC = 8,                 /* Rx: IBP discard and CBP full. */
    610     bcmDbgCntRUC = 9,                   /* Rx: Good unicast (L2+L3) packets. */
    611     bcmDbgCntRPORTD = 10,               /* Rx: Packets droppped when ingress
    612                                            port is not in forwarding state. */
    613     bcmDbgCntPDISC = 11,                /* Rx: policy discard - DST_DISCARD,
    614                                            SRC_DISCARD, RATE_CONTROL... */
    615     bcmDbgCntIMBP = 12,                 /* Rx: Bridged multicast packets. */
    616     bcmDbgCntRFILDR = 13,               /* Rx: Packets dropped by FP. */
    617     bcmDbgCntRIMDR = 14,                /* Rx: Multicast (L2+L3) packets that
    618                                            are dropped. */
    619     bcmDbgCntRDROP = 15,                /* Rx: Port bitmap zero drop condition. */
    620     bcmDbgCntIRPSE = 16,                /* Rx: HiGig IPIC pause packets. */
    621     bcmDbgCntIRHOL = 17,                /* Rx: HiGig End-to-End HOL packets
    622                                            (BCM56504/56700/56800/56580). */
    623     bcmDbgCntIRIBP = 18,                /* Rx: HiGig End-to-End IBP packets
    624                                            (BCM56504/56700/56800/56580). */
    625     bcmDbgCntDSL3HE = 19,               /* Rx: DOS L3 header error packets. */
    626     bcmDbgCntIUNKHDR = 20,              /* Rx: Unknown HiGig header type packet
    627                                            (BCM56700/56800/56580). */
    628     bcmDbgCntDSL4HE = 21,               /* Rx: DOS L4 header error packets. */
    629     bcmDbgCntIMIRROR = 22,              /* Rx: HiGig mirror packet
    630                                            (BCM56700/56800/56580). */
    631     bcmDbgCntDSICMP = 23,               /* Rx: DOS ICMP error packets. */
    632     bcmDbgCntDSFRAG = 24,               /* Rx: DOS fragment error packets. */
    633     bcmDbgCntMTUERR = 25,               /* Rx: Packets trapped to CPU due to
    634                                            egress L3 MTU violation. */
    635     bcmDbgCntRTUN = 26,                 /* Rx: Tunnel packets. */
    636     bcmDbgCntRTUNE = 27,                /* Rx: tunnel error packets. */
    637     bcmDbgCntVLANDR = 28,               /* Rx: VLAN drops. */
    638     bcmDbgCntRHGUC = 29,                /* Rx: HiGig lookup UC cases (BCM56504
    639                                            B0). */
    640     bcmDbgCntRHGMC = 30,                /* Rx: HiGig lookup MC cases (BCM56504
    641                                            B0). */
    642     bcmDbgCntMPLS = 31,                 /* Rx: MPLS packets (BCM5660x only). */
    643     bcmDbgCntMACLMT = 32,               /* Rx: packets dropped due to MAC Limit
    644                                            is hit. */
    645     bcmDbgCntMPLSERR = 33,              /* Rx: MPLS packets with error (BCM5660x
    646                                            only). */
    647     bcmDbgCntURPFERR = 34,              /* Rx: L3 source URPF check Fail
    648                                            (BCM5660x only). */
    649     bcmDbgCntHGHDRE = 35,               /* Rx: Higig Header error packets
    650                                            (BCM56700/56800/56580/56514). */
    651     bcmDbgCntMCIDXE = 36,               /* Rx: Multicast Index error packets
    652                                            (BCM56700/56800/56580). */
    653     bcmDbgCntLAGLUP = 37,               /* Rx: LAG failover loopback packets
    654                                            (BCM56700/56800/56580). */
    655     bcmDbgCntLAGLUPD = 38,              /* Rx: LAG backup port down
    656                                            (BCM56700/56800/56580). */
    657     bcmDbgCntPARITYD = 39,              /* Rx: Parity error packets
    658                                            (BCM56700/56800/56580). */
    659     bcmDbgCntVFPDR = 40,                /* Rx: VLAN FP drop case (BCM56514). */
    660     bcmDbgCntURPF = 41,                 /* Rx: Unicast RPF drop case (BCM56514). */
    661     bcmDbgCntDSTDISCARDDROP = 42,       /* Rx: L2/L3 lookup DST_DISCARD drop. */
    662     bcmDbgCntCLASSBASEDMOVEDROP = 43,   /* Rx: Class based learning drop. */
    663     bcmDbgCntMACLMT_NODROP = 44,        /* Rx: Mac limit exceeded and packet not
    664                                            dropped. */
    665     bcmDbgCntMACSAEQUALMACDA = 45,      /* Rx: Dos Attack L2 Packets MACSA
    666                                            equals to MACDA. */
    667     bcmDbgCntMACLMT_DROP = 46,          /* Rx: Mac limit exceeded and packet
    668                                            dropped. */
    669     bcmDbgCntTGIP4 = 47,                /* Tx: Good IPv4 L3 UC packets. */
    670     bcmDbgCntTIPD4 = 48,                /* Tx: IPv4 L3 UC Aged and Drop packets. */
    671     bcmDbgCntTGIPMC4 = 49,              /* Tx: Good IPv4 IPMC packets. */
    672     bcmDbgCntTIPMCD4 = 50,              /* Tx: IPv4 IPMC Aged and Drop packets. */
    673     bcmDbgCntTGIP6 = 51,                /* Tx: Good IPv6 L3 UC packets. */
    674     bcmDbgCntTIPD6 = 52,                /* Tx: IPv6 L3 UC Aged and Drop Packets. */
    675     bcmDbgCntTGIPMC6 = 53,              /* Tx: Good IPv6 IPMC packets. */
    676     bcmDbgCntTIPMCD6 = 54,              /* Tx: IPv6 IPMC Aged and Drop packets. */
    677     bcmDbgCntTTNL = 55,                 /* Tx: Tunnel packets. */
    678     bcmDbgCntTTNLE = 56,                /* Tx: Tunnel error packets. */
    679     bcmDbgCntTTTLD = 57,                /* Tx: Packets dropped due to TTL
    680                                            threshold counter. */
    681     bcmDbgCntTCFID = 58,                /* Tx: Packets dropped when CFI set &
    682                                            pket is untagged or L3 switched for
    683                                            IPMC. */
    684     bcmDbgCntTVLAN = 59,                /* Tx: VLAN tagged packets. */
    685     bcmDbgCntTVLAND = 60,               /* Tx: Packets dropped due to invalid
    686                                            VLAN counter. */
    687     bcmDbgCntTVXLTMD = 61,              /* Tx: Packets dropped due to miss in
    688                                            VXLT table counter. */
    689     bcmDbgCntTSTGD = 62,                /* Tx: Packets dropped due to Spanning
    690                                            Tree State not in forwarding state. */
    691     bcmDbgCntTAGED = 63,                /* Tx: Packets dropped due to packet
    692                                            aged counter. */
    693     bcmDbgCntTL2MCD = 64,               /* Tx: L2 MC packets. */
    694     bcmDbgCntTPKTD = 65,                /* Tx: Packets dropped due to any
    695                                            condition. */
    696     bcmDbgCntTMIRR = 66,                /* Tx: Packets with mirroring flag. */
    697     bcmDbgCntTSIPL = 67,                /* Tx: Packets with SIP Link Local Drop
    698                                            flag (BCM56504/56700/56800/56580). */
    699     bcmDbgCntTHGUC = 68,                /* Tx: Higig Looked-up L3UC packets
    700                                            (BCM56504_B0/56700/56800/56580). */
    701     bcmDbgCntTHGMC = 69,                /* Tx: Higig Looked-up L3MC packets
    702                                            (BCM56504_B0/56700/56800/56580). */
    703     bcmDbgCntTHIGIG2 = 70,              /* Tx: Unknown HiGig2 Drops
    704                                            (BCM56700/56800/56580). */
    705     bcmDbgCntTHGI = 71,                 /* Tx: Unknown HiGig drops
    706                                            (BCM56700/56800/56580). */
    707     bcmDbgCntTL2_MTU = 72,              /* Tx: L2 MTU fail drops
    708                                            (BCM56700/56800/56580). */
    709     bcmDbgCntTPARITY_ERR = 73,          /* Tx: Parity error drops
    710                                            (BCM56700/56800/56580). */
    711     bcmDbgCntTIP_LEN_FAIL = 74,         /* Tx: IP Length check fail drops
    712                                            (BCM56700/56800/56580). */
    713     bcmDbgCntTMTUD = 75,                /* Tx: EBAD_MTU_drops (BCM5660x only). */
    714     bcmDbgCntTSLLD = 76,                /* Tx: ESIP_LINK_LOCAL (BCM5660x only). */
    715     bcmDbgCntTL2MPLS = 77,              /* Tx: L2_MPLS_ENCAP_TX (BCM5660x only). */
    716     bcmDbgCntTL3MPLS = 78,              /* Tx: L3_MPLS_ENCAP_TX (BCM5660x only). */
    717     bcmDbgCntTMPLS = 79,                /* Tx: MPLS_TX (BCM5660x only). */
    718     bcmDbgCntTMODIDTOOLARGEDROP = 80,   /* Tx: MODID greater than 31 drop
    719                                            counter. */
    720     bcmDbgCntPKTMODTOOLARGEDROP = 81,   /* Tx: Byte additions too large drop
    721                                            counter. */
    722     bcmDbgCntRX_SYMBOL = 82,            /* Fabric I/F => Rx Errors (e.g.8B10B) */
    723     bcmDbgCntTIME_ALIGNMENT_EVEN = 83,  /* Fabric I/F => Time Alignment (even) */
    724     bcmDbgCntTIME_ALIGNMENT_ODD = 84,   /* Fabric I/F => Time Alignment (odd) */
    725     bcmDbgCntBIT_INTERLEAVED_PARITY_EVEN = 85, /* Fabric I/F => BIP (even) */
    726     bcmDbgCntBIT_INTERLEAVED_PARITY_ODD = 86, /* Fabric I/F => BIP (odd) */
    727     bcmDbgCntFcmPortClass3RxFrames = 87, /* FCOE L3 RX frames */
    728     bcmDbgCntFcmPortClass3RxDiscards = 88, /* FCOE L3 RX discarded frames */
    729     bcmDbgCntFcmPortClass3TxFrames = 89, /* FCOE L3 TX frames */
    730     bcmDbgCntFcmPortClass2RxFrames = 90, /* FCOE L2 RX frames */
    731     bcmDbgCntFcmPortClass2RxDiscards = 91, /* FCOE L2 RX discarded frames */
    732     bcmDbgCntFcmPortClass2TxFrames = 92, /* FCOE L2 TX frames */
    733     bcmDbgCntNonHGoE = 93,              /* Non HGoE Rx frames on an HGoE port */
    734     bcmDbgCntHGoE = 94,                 /* HGoE Rx frames */
    735     bcmDbgCntEgressProtectionDataDrop = 95, /* Egress Protection data drop in EPIPE */
    736     bcmDbgCntVntagRxError = 96,         /* Rx: VNTAG error packets */
    737     bcmDbgCntNivRxForwardingError = 97, /* Rx: NIV/PE packets dropped due to
    738                                            forwarding error */
    739     bcmDbgCntIfpTriggerPfcRxDrop = 98,  /* Rx: Original ingress packets dropped
    740                                            due to IFP PfcTx action */
    741     bcmDbgCntEcnTxError = 99,           /* Tx: Egress packets dropped due to ECN
    742                                            error */
    743     bcmDbgCntNivTxPrune = 100,          /* Tx: Egress NIV/PE packets dropped due
    744                                            to pruning check */
    745     bcmDbgCntRxHigigLoopbackDrop = 101, /* Rx: HiGig loopback packets dropped. */
    746     bcmDbgCntRxHigigUnknownOpcodeDrop = 102, /* Rx: HiGig packets dropped due to
    747                                            unknown opcode. */
    748     bcmDbgCntRxIpInIpDrop = 103,        /* Rx: IPinIP tunnel process failure. */
    749     bcmDbgCntRxMimDrop = 104,           /* Rx: MiM tunnel process failure. */
    750     bcmDbgCntRxTunnelInterfaceError = 105, /* Rx: IP multicast tunnel incoming
    751                                            interface is incorrect. */
    752     bcmDbgCntRxMplsControlWordInvalid = 106, /* Rx: MPLS invalid control word. */
    753     bcmDbgCntRxMplsGalNotBosDrop = 107, /* Rx: MPLS Generic Label is not BOS. */
    754     bcmDbgCntRxMplsPayloadInvalid = 108, /* Rx: MPLS invalid payload. */
    755     bcmDbgCntRxMplsEntropyDrop = 109,   /* Rx: MPLS entropy label in unallowed
    756                                            range. */
    757     bcmDbgCntRxMplsLabelLookupMiss = 110, /* Rx: MPLS label lookup miss. */
    758     bcmDbgCntRxMplsActionInvalid = 111, /* Rx: MPLS invalid action. */
    759     bcmDbgCntRxTunnelTtlError = 112,    /* Rx: Tunnel TTL check failure. */
    760     bcmDbgCntRxTunnelShimError = 113,   /* Rx: Tunnel shim header error. */
    761     bcmDbgCntRxTunnelObjectValidationFail = 114, /* Rx: Tunnel termination failure as not
    762                                            all packet forwarding objects got
    763                                            assigned. */
    764     bcmDbgCntRxVlanMismatch = 115,      /* Rx: VLAN ID invalid. */
    765     bcmDbgCntRxVlanMemberMismatch = 116, /* Rx: Ingress port not in VLAN
    766                                            membership. */
    767     bcmDbgCntRxTpidMismatch = 117,      /* Rx: VLAN TPID mismatch. */
    768     bcmDbgCntRxPrivateVlanMismatch = 118, /* Rx: PVLAN VID mismatch. */
    769     bcmDbgCntRxMacIpBindError = 119,    /* Rx: MAC to IP bind check failure. */
    770     bcmDbgCntRxVlanTranslate2LookupMiss = 120, /* Rx: VLAN Translate2 lookup miss. */
    771     bcmDbgCntRxL3TunnelLookupMiss = 121, /* Rx: L3 Tunnel lookup miss. */
    772     bcmDbgCntRxMplsLookupMiss = 122,    /* Rx: MPLS lookup miss. */
    773     bcmDbgCntRxVlanTranslate1LookupMiss = 123, /* Rx: VLAN Translate1 lookup miss. */
    774     bcmDbgCntRxFcoeVftDrop = 124,       /* Rx: FVT header error. */
    775     bcmDbgCntRxFcoeSrcBindError = 125,  /* Rx: FCOE source bind check failure. */
    776     bcmDbgCntRxFcoeSrcFpmaError = 126,  /* Rx: Source FPMA prefix check failure. */
    777     bcmDbgCntRxVfiP2pDrop = 127,        /* Rx: PT2PT service but packets arrived
    778                                            from a VP that is not programmed in
    779                                            PT2PT connection. */
    780     bcmDbgCntRxStgDrop = 128,           /* Rx: Spanning tree state not in
    781                                            forwarding state. */
    782     bcmDbgCntRxCompositeError = 129,    /* Rx: HW related error like lookup
    783                                            table with parity error. */
    784     bcmDbgCntRxBpduDrop = 130,          /* Rx: BPUD packets dropped due to
    785                                            PORT_TABLE.DROP_BPDU. */
    786     bcmDbgCntRxProtocolDrop = 131,      /* Rx: Protocol packets dropped due to
    787                                            PROTOCOL_PKT_CONTROL config. */
    788     bcmDbgCntRxUnknownMacSaDrop = 132,  /* Rx: Unknown source MAC packets
    789                                            dropped due to CML_OFFSET.DROP. */
    790     bcmDbgCntRxSrcRouteDrop = 133,      /* Rx: Packets dropped due to MACSA is
    791                                            multicast(bit 40 == 1). */
    792     bcmDbgCntRxL2SrcDiscardDrop = 134,  /* Rx: L2 SRC_DISCARD drop. */
    793     bcmDbgCntRxL2SrcStaticMoveDrop = 135, /* Rx: Port movement of static L2 addr. */
    794     bcmDbgCntRxL2DstDiscardDrop = 136,  /* Rx: L2 DST_DISCARD drop. */
    795     bcmDbgCntRxL3DisableDrop = 137,     /* Rx: Packets dropped due to
    796                                            PORT_TABLE.V4L3_ENABLE/V6L3_ENABLE
    797                                            unset. */
    798     bcmDbgCntRxMacSaEqual0Drop = 138,   /* Rx: Packets dropped due to MACSA ==
    799                                            0. */
    800     bcmDbgCntRxVlanCrossConnectOrNonUnicastDrop = 139, /* Rx: L2 forwarding lookup miss or PBT
    801                                            non unicast packets drop. */
    802     bcmDbgCntRxTimeSyncDrop = 140,      /* Rx: Network time sync packets
    803                                            dropped. */
    804     bcmDbgCntRxIpmcDrop = 141,          /* Rx: IPMC process failure. */
    805     bcmDbgCntRxMyStationDrop = 142,     /* Rx: MY_STATION.DISCARD drop. */
    806     bcmDbgCntRxPrivateVlanVpFilterDrop = 143, /* Rx: Private vlan drop based on
    807                                            src/dst virtual port type. */
    808     bcmDbgCntRxL3DstDiscardDrop = 144,  /* Rx: L3 DST_DISCARD drop. */
    809     bcmDbgCntRxTunnelDecapEcnError = 145, /* Rx: Tunnel decap ECN error. */
    810     bcmDbgCntRxL3SrcDiscardDrop = 146,  /* Rx: L3 SRC_DISCARD drop. */
    811     bcmDbgCntRxFcoeZoneLookupMiss = 147, /* Rx: FCOE_ZONE lookup miss. */
    812     bcmDbgCntRxL3TtlError = 148,        /* Rx: L3 TTL check failure. */
    813     bcmDbgCntRxL3HeaderError = 149,     /* Rx: L3 header error. */
    814     bcmDbgCntRxL2HeaderError = 150,     /* Rx: L2 header error. */
    815     bcmDbgCntRxL3DstLookupDrop = 151,   /* Rx: IPMC processing drop, or
    816                                            L3_DESTINATION == 0 for L3UC packets. */
    817     bcmDbgCntRxL2TtlError = 152,        /* Rx: L2 ZONE TTL check failure. */
    818     bcmDbgCntRxL2RpfError = 153,        /* Rx: Incoming port/lag/svp check
    819                                            failure enforced L2 entry. */
    820     bcmDbgCntRxTagUntagDiscardDrop = 154, /* Rx: Packets dropped due to
    821                                            PORT_DIS_UNTAG/PORT_DIS_TAG. */
    822     bcmDbgCntRxStormControlDrop = 155,  /* Rx: Storm control metering drop. */
    823     bcmDbgCntRxFcoeZoneError = 156,     /* Rx: FCOE_ZONE check failure. */
    824     bcmDbgCntRxFieldChangeL2NoRedirectDrop = 157, /* Rx: FP Changes L2 Fields packets is
    825                                            not eligible for routing. Redirect
    826                                            action must be deployed to select
    827                                            packet destination. */
    828     bcmDbgCntRxNextHopDrop = 158,       /* Rx: NEXT_HOP drop. */
    829     bcmDbgCntRxNatDrop = 159,           /* Rx: NAT process failure, e.g.
    830                                            destination lookup miss or Hairpin
    831                                            drop. */
    832     bcmDbgCntIngressProtectionDataDrop = 160, /* Rx: Protection data drop. */
    833     bcmDbgCntRxSrcKnockoutDrop = 161,   /* Rx: SGPP == DGPP or SVP == DVP, etc. */
    834     bcmDbgCntRxMplsSeqNumberError = 162, /* Rx: MPLS control word sequence number
    835                                            error. */
    836     bcmDbgCntRxBlockMaskDrop = 163,     /* Rx: Packets dropped due to bitmap of
    837                                            ports to be blocked. */
    838     bcmDbgCntRxDlbRhResolutionError = 164, /* Rx: DLB or RH resolution error. */
    839     bcmDbgCntTxFwdDomainNotFoundDrop = 165, /* Tx: Forwarding domain not found. */
    840     bcmDbgCntTxNotFwdDomainMemberDrop = 166, /* Tx: Not forwarding domain member. */
    841     bcmDbgCntTxIpmcL2SrcPortPruneDrop = 167, /* Tx: IPMC L2 self port drop, VLAN ID
    842                                            in the packet is the same as the VLAN
    843                                            ID in EGR_L3_INTF. */
    844     bcmDbgCntTxNonUnicastPruneDrop = 168, /* Tx: Non unicast pruning. */
    845     bcmDbgCntTxSvpRemoveDrop = 169,     /* Tx: Virtual port pruning. */
    846     bcmDbgCntTxVplagPruneDrop = 170,    /* Tx: VPLAG pruning. */
    847     bcmDbgCntTxSplitHorizonDrop = 171,  /* Tx: Packets dropped due to split
    848                                            horizon check. This is done by
    849                                            enabling pruning for DVP network
    850                                            group. */
    851     bcmDbgCntTxMmuPurgeDrop = 172,      /* Tx: Packets dropped due to MMU purge. */
    852     bcmDbgCntTxStgDisableDrop = 173,    /* Tx: Packets dropped due to STG
    853                                            disabled. */
    854     bcmDbgCntTxEgressPortDrop = 174,    /* Tx: Packets dropped due to
    855                                            EGR_LPORT_PROFILE.DROP. */
    856     bcmDbgCntTxEgressFilterDrop = 175,  /* Tx: Packets dropped by EFP. */
    857     bcmDbgCntTxVisibilityDrop = 176,    /* Tx: Visibility packets dropped. */
    858     bcmDbgCntNum = 177                  /* Must be last one. */
    859 } bcm_custom_stat_trigger_t;
    860 
    861 /* Custom receive flags. */
    862 #define BCM_DBG_CNT_RIPD4       0x00000001 /* Rx IPv4 L3 discard packets. */
    863 #define BCM_DBG_CNT_RIPC4       0x00000002 /* Good rx L3 (V4 packets) includes
    864                                               tunneled. */
    865 #define BCM_DBG_CNT_RIPHE4      0x00000004 /* Rx IPv4 header error packets. */
    866 #define BCM_DBG_CNT_IMRP4       0x00000008 /* Routed IPv4 multicast packets. */
    867 #define BCM_DBG_CNT_RIPD6       0x00000010 /* Rx IPv6 L3 discard packet. */
    868 #define BCM_DBG_CNT_RIPC6       0x00000020 /* Good rx L3 (V6 packets) includes
    869                                               tunneled. */
    870 #define BCM_DBG_CNT_RIPHE6      0x00000040 /* Rx IPv6 header error packets. */
    871 #define BCM_DBG_CNT_IMRP6       0x00000080 /* Routed IPv6 multicast packets. */
    872 #define BCM_DBG_CNT_RDISC       0x00000100 /* IBP discard and CBP full. */
    873 #define BCM_DBG_CNT_RUC         0x00000200 /* Good rx unicast (L2+L3) packets. */
    874 #define BCM_DBG_CNT_RPORTD      0x00000400 /* Packets droppped when ingress port
    875                                               is not in forwarding state. */
    876 #define BCM_DBG_CNT_PDISC       0x00000800 /* Rx policy discard - DST_DISCARD,
    877                                               SRC_DISCARD, RATE_CONTROL... */
    878 #define BCM_DBG_CNT_IMBP        0x00001000 /* Bridged multicast packets. */
    879 #define BCM_DBG_CNT_RFILDR      0x00002000 /* Packets dropped by FP. */
    880 #define BCM_DBG_CNT_RIMDR       0x00004000 /* Multicast (L2+L3) packets that are
    881                                               dropped. */
    882 #define BCM_DBG_CNT_RDROP       0x00008000 /* Port bitmap zero drop condition. */
    883 #define BCM_DBG_CNT_IRPSE       0x00010000 /* HiGig IPIC pause rx. */
    884 #define BCM_DBG_CNT_IRHOL       0x00020000 /* HiGig End-to-End HOL rx packets
    885                                               (BCM56504/56700/56800/56580). */
    886 #define BCM_DBG_CNT_IRIBP       0x00040000 /* HiGig End-to-End IBP rx packets
    887                                               (BCM56504/56700/56800/56580). */
    888 #define BCM_DBG_CNT_DSL3HE      0x00080000 /* DOS L3 header error packets. */
    889 #define BCM_DBG_CNT_IUNKHDR     0x00080000 /* Unknown HiGig header type packet
    890                                               (BCM56700/56800/56580). */
    891 #define BCM_DBG_CNT_DSL4HE      0x00100000 /* DOS L4 header error packets. */
    892 #define BCM_DBG_CNT_IMIRROR     0x00100000 /* HiGig mirror packet
    893                                               (BCM56700/56800/56580). */
    894 #define BCM_DBG_CNT_DSICMP      0x00200000 /* DOS ICMP error packets. */
    895 #define BCM_DBG_CNT_DSFRAG      0x00400000 /* DOS fragment error packets. */
    896 #define BCM_DBG_CNT_MTUERR      0x00800000 /* Packets trapped to CPU due to
    897                                               egress L3 MTU violation. */
    898 #define BCM_DBG_CNT_RTUN        0x01000000 /* Number of tunnel packets received. */
    899 #define BCM_DBG_CNT_RTUNE       0x02000000 /* Rx tunnel error packets. */
    900 #define BCM_DBG_CNT_VLANDR      0x04000000 /* Rx VLAN drops. */
    901 #define BCM_DBG_CNT_RHGUC       0x08000000 /* Rx HiGig lookup UC cases (BCM56504
    902                                               B0 only). */
    903 #define BCM_DBG_CNT_RHGMC       0x10000000 /* Rx HiGig lookup MC cases (BCM56504
    904                                               B0 only). */
    905 #define BCM_DBG_CNT_MPLS        0x20000000 /* Received MPLS Packets (BCM5660x
    906                                               only). */
    907 #define BCM_DBG_CNT_MACLMT      0x20000000 /* packets dropped due to MAC Limit
    908                                               is hit. */
    909 #define BCM_DBG_CNT_MPLSERR     0x40000000 /* Received MPLS Packets with Error
    910                                               (BCM5660x only). */
    911 #define BCM_DBG_CNT_URPFERR     0x80000000 /* L3 src URPF check Fail (BCM5660x
    912                                               only). */
    913 #define BCM_DBG_CNT_HGHDRE      0x08000000 /* Higig Header error packets
    914                                               (BCM56700/56800/56580). */
    915 #define BCM_DBG_CNT_MCIDXE      0x10000000 /* Multicast Index error packets
    916                                               (BCM56700/56800/56580). */
    917 #define BCM_DBG_CNT_LAGLUP      0x20000000 /* LAG failover loopback packets
    918                                               (BCM56700/56800/56580). */
    919 #define BCM_DBG_CNT_LAGLUPD     0x40000000 /* LAG backup port down
    920                                               (BCM56700/56800/56580). */
    921 #define BCM_DBG_CNT_PARITYD     0x80000000 /* Parity error packets
    922                                               (BCM56700/56800/56580). */
    923 #define BCM_FB_DBG_CNT_RMASK    0x07ffffff /* Internal. */
    924 #define BCM_RP_DBG_CNT_RMASK    0x27ffffff /* Internal. */
    925 #define BCM_FB_B0_DBG_CNT_RMASK 0x1fffffff /* Internal. */
    926 #define BCM_HB_DBG_CNT_RMASK    0xffffffff /* Internal. */
    927 
    928 /* Custom transmit flags. */
    929 #define BCM_DBG_CNT_TGIP4               0x00000001 /* Tx Good IPv4 L3 UC
    930                                                       packets. */
    931 #define BCM_DBG_CNT_TIPD4               0x00000002 /* Tx IPv4 L3 UC Aged and
    932                                                       Drop packets. */
    933 #define BCM_DBG_CNT_TGIPMC4             0x00000004 /* Tx Good IPv4 IPMC packets. */
    934 #define BCM_DBG_CNT_TIPMCD4             0x00000008 /* Tx IPv4 IPMC Aged and Drop
    935                                                       packets. */
    936 #define BCM_DBG_CNT_TGIP6               0x00000010 /* Tx Good IPv6 L3 UC
    937                                                       packets. */
    938 #define BCM_DBG_CNT_TIPD6               0x00000020 /* Tx IPv6 L3 UC Aged and
    939                                                       Drop Packets. */
    940 #define BCM_DBG_CNT_TGIPMC6             0x00000040 /* Tx Good IPv6 IPMC packets. */
    941 #define BCM_DBG_CNT_TIPMCD6             0x00000080 /* Tx IPv6 IPMC Aged and Drop
    942                                                       packets. */
    943 #define BCM_DBG_CNT_TTNL                0x00000100 /* Tx Tunnel packets. */
    944 #define BCM_DBG_CNT_TTNLE               0x00000200 /* Tx Tunnel error packets. */
    945 #define BCM_DBG_CNT_TTTLD               0x00000400 /* Pkts dropped due to TTL
    946                                                       threshold counter. */
    947 #define BCM_DBG_CNT_TCFID               0x00000800 /* Pkts dropped when CFI set
    948                                                       & pket is untagged or L3
    949                                                       switched for IPMC. */
    950 #define BCM_DBG_CNT_TVLAN               0x00001000 /* Tx VLAN tagged packets. */
    951 #define BCM_DBG_CNT_TVLAND              0x00002000 /* Pkts dropped due to
    952                                                       invalid VLAN counter. */
    953 #define BCM_DBG_CNT_TVXLTMD             0x00004000 /* Pkts dropped due to miss
    954                                                       in VXLT table counter. */
    955 #define BCM_DBG_CNT_TSTGD               0x00008000 /* Pkts dropped due to
    956                                                       Spanning Tree State not in
    957                                                       forwarding state. */
    958 #define BCM_DBG_CNT_TAGED               0x00010000 /* Pkts dropped due to packet
    959                                                       aged counter. */
    960 #define BCM_DBG_CNT_TL2MCD              0x00020000 /* L2 MC packet drop counter. */
    961 #define BCM_DBG_CNT_TPKTD               0x00040000 /* Pkts dropped due to any
    962                                                       condition. */
    963 #define BCM_DBG_CNT_TMIRR               0x00080000 /* mirroring flag. */
    964 #define BCM_DBG_CNT_TSIPL               0x00100000 /* SIP Link Local Drop flag
    965                                                       (BCM56504/56700/56800/56580). */
    966 #define BCM_DBG_CNT_THGUC               0x00200000 /* Higig Lookedup L3UC Pkts
    967                                                       (BCM56504_B0/56700/56800/56580). */
    968 #define BCM_DBG_CNT_THGMC               0x00400000 /* Higig Lookedup L3MC Pkts
    969                                                       (BCM56504_B0/56700/56800/56580). */
    970 #define BCM_DBG_CNT_THIGIG2             0x00800000 /* Unknown HiGig2 Drop
    971                                                       (BCM56700/56800/56580). */
    972 #define BCM_DBG_CNT_THGI                0x01000000 /* Unknown HiGig drop
    973                                                       (BCM56700/56800/56580). */
    974 #define BCM_DBG_CNT_TL2_MTU             0x02000000 /* L2 MTU fail drop
    975                                                       (BCM56700/56800/56580). */
    976 #define BCM_DBG_CNT_TPARITY_ERR         0x04000000 /* Parity Error drop
    977                                                       (BCM56700/56800/56580). */
    978 #define BCM_DBG_CNT_TIP_LEN_FAIL        0x08000000 /* IP Length check fail drop
    979                                                       (BCM56700/56800/56580). */
    980 #define BCM_DBG_CNT_TMTUD               0x01000000 /* EBAD_MTU_DROP (BCM5660x
    981                                                       only). */
    982 #define BCM_DBG_CNT_TSLLD               0x10000000 /* ESIP_LINK_LOCAL (BCM5660x
    983                                                       only). */
    984 #define BCM_DBG_CNT_TL2MPLS             0x20000000 /* L2_MPLS_ENCAP_TX (BCM5660x
    985                                                       only). */
    986 #define BCM_DBG_CNT_TL3MPLS             0x40000000 /* L3_MPLS_ENCAP_TX (BCM5660x
    987                                                       only). */
    988 #define BCM_DBG_CNT_TMPLS               0x80000000 /* MPLS_TX (BCM5660x only). */
    989 #define BCM_DBG_CNT_MODIDTOOLARGEDROP   0x10000000 /* MODID greater than 31 drop
    990                                                       counter. */
    991 #define BCM_DBG_CNT_PKTMODTOOLARGEDROP  0x20000000 /* Byte additions too large
    992                                                       drop counter. */
    993 #define BCM_FB_DBG_CNT_TMASK            0x001fffff /* Internal. */
    994 #define BCM_RP_DBG_CNT_TMASK            0x001fffff /* Internal. */
    995 #define BCM_FB_B0_DBG_CNT_TMASK         0x007fffff /* Internal. */
    996 #define BCM_HB_DBG_CNT_TMASK            0x0fffffff /* Internal. */
    997 #define BCM_TRX_DBG_CNT_TMASK           0x3fffffff /* Internal. */
    998 
    999 #ifndef BCM_HIDE_DISPATCHABLE
   1000 
   1001 /* Initialize the BCM statistics module. */
   1002 extern int bcm_stat_init(
   1003     int unit);
   1004 
   1005 #endif /* BCM_HIDE_DISPATCHABLE */
   1006 
   1007 #define bcm_stat_enable_set(unit, port, enable)             /* Gone */
   1008 #define bcm_stat_enable_get(unit, port, enable_ptr)             /* Gone */
   1009 
   1010 #ifndef BCM_HIDE_DISPATCHABLE
   1011 
   1012 /* Clear the port-based statistics for the indicated device port. */
   1013 extern int bcm_stat_clear(
   1014     int unit, 
   1015     bcm_port_t port);
   1016 
   1017 /* Synchronize software counters with hardware. */
   1018 extern int bcm_stat_sync(
   1019     int unit);
   1020 
   1021 /* Get the specified statistics from the device. */
   1022 extern int bcm_stat_get(
   1023     int unit, 
   1024     bcm_port_t port, 
   1025     bcm_stat_val_t type, 
   1026     uint64 *value);
   1027 
   1028 /* Get the specified statistics from the device. */
   1029 extern int bcm_stat_get32(
   1030     int unit, 
   1031     bcm_port_t port, 
   1032     bcm_stat_val_t type, 
   1033     uint32 *value);
   1034 
   1035 /* Get the specified statistics from the device. */
   1036 extern int bcm_stat_multi_get(
   1037     int unit, 
   1038     bcm_port_t port, 
   1039     int nstat, 
   1040     bcm_stat_val_t *stat_arr, 
   1041     uint64 *value_arr);
   1042 
   1043 /* 
   1044  * Get the specified statistics from the device.  The 64-bit values may
   1045  * be truncated to fit.
   1046  */
   1047 extern int bcm_stat_multi_get32(
   1048     int unit, 
   1049     bcm_port_t port, 
   1050     int nstat, 
   1051     bcm_stat_val_t *stat_arr, 
   1052     uint32 *value_arr);
   1053 
   1054 /* Get the specified hardware statistics from the device. */
   1055 extern int bcm_stat_sync_get(
   1056     int unit, 
   1057     bcm_port_t port, 
   1058     bcm_stat_val_t type, 
   1059     uint64 *value);
   1060 
   1061 /* Get the specified hardware statistics from the device. */
   1062 extern int bcm_stat_sync_get32(
   1063     int unit, 
   1064     bcm_port_t port, 
   1065     bcm_stat_val_t type, 
   1066     uint32 *value);
   1067 
   1068 /* Get the specified hardware statistics from the device. */
   1069 extern int bcm_stat_sync_multi_get(
   1070     int unit, 
   1071     bcm_port_t port, 
   1072     int nstat, 
   1073     bcm_stat_val_t *stat_arr, 
   1074     uint64 *value_arr);
   1075 
   1076 /* 
   1077  * Get the specified hardware statistics from the device.  The 64-bit
   1078  * values may be truncated to fit.
   1079  */
   1080 extern int bcm_stat_sync_multi_get32(
   1081     int unit, 
   1082     bcm_port_t port, 
   1083     int nstat, 
   1084     bcm_stat_val_t *stat_arr, 
   1085     uint32 *value_arr);
   1086 
   1087 /* 
   1088  * Get the specified hardware statistics from the device, no software
   1089  * cache update.
   1090  */
   1091 extern int bcm_stat_direct_get(
   1092     int unit, 
   1093     bcm_port_t port, 
   1094     bcm_stat_val_t type, 
   1095     uint64 *value);
   1096 
   1097 /* Get the specified hardware statistics from the device. */
   1098 extern int bcm_stat_direct_multi_get(
   1099     int unit, 
   1100     bcm_port_t port, 
   1101     int nstat, 
   1102     bcm_stat_val_t *stat_arr, 
   1103     uint64 *value_arr);
   1104 
   1105 /* Set/get debug counter to count certain packet types. */
   1106 extern int bcm_stat_custom_set(
   1107     int unit, 
   1108     bcm_port_t port, 
   1109     bcm_stat_val_t type, 
   1110     uint32 flags);
   1111 
   1112 /* Set/get debug counter to count certain packet types. */
   1113 extern int bcm_stat_custom_get(
   1114     int unit, 
   1115     bcm_port_t port, 
   1116     bcm_stat_val_t type, 
   1117     uint32 *flags);
   1118 
   1119 /* Add a certain packet type to debug counter to count. */
   1120 extern int bcm_stat_custom_add(
   1121     int unit, 
   1122     bcm_port_t port, 
   1123     bcm_stat_val_t type, 
   1124     bcm_custom_stat_trigger_t trigger);
   1125 
   1126 /* Delete the specified packet type from debug counter. */
   1127 extern int bcm_stat_custom_delete(
   1128     int unit, 
   1129     bcm_port_t port, 
   1130     bcm_stat_val_t type, 
   1131     bcm_custom_stat_trigger_t trigger);
   1132 
   1133 /* Delete all packet types from debug counter. */
   1134 extern int bcm_stat_custom_delete_all(
   1135     int unit, 
   1136     bcm_port_t port, 
   1137     bcm_stat_val_t type);
   1138 
   1139 /* Check if specified packet types is part of debug counter. */
   1140 extern int bcm_stat_custom_check(
   1141     int unit, 
   1142     bcm_port_t port, 
   1143     bcm_stat_val_t type, 
   1144     bcm_custom_stat_trigger_t trigger, 
   1145     int *result);
   1146 
   1147 #endif /* BCM_HIDE_DISPATCHABLE */
   1148 
   1149 /* TCP flags related flex attributes values */
   1150 typedef enum bcm_stat_group_mode_attr_tcp_flags_e {
   1151     bcmStatGroupModeAttrTcpFlagsTypeSyn = 0, /* Synchronisation flag */
   1152     bcmStatGroupModeAttrTcpFlagsTypeFin = 1, /* Finish flag */
   1153     bcmStatGroupModeAttrTcpFlagsTypeRst = 2, /* Reset flag */
   1154     bcmStatGroupModeAttrTcpFlagsTypePsh = 3, /* Push flag */
   1155     bcmStatGroupModeAttrTcpFlagsTypeAck = 4, /* Acknowledgement flag */
   1156     bcmStatGroupModeAttrTcpFlagsTypeUrg = 5, /* Urgent flag */
   1157     bcmStatGroupModeAttrTcpFlagsTypeEce = 6, /* ECN capable flag */
   1158     bcmStatGroupModeAttrTcpFlagsTypeCwr = 7 /* Congestion Window Reduced flag */
   1159 } bcm_stat_group_mode_attr_tcp_flags_t;
   1160 
   1161 /* FC Type related flex attribute values. */
   1162 typedef enum bcm_stat_group_mode_attr_flowcontrolpkt_type_e {
   1163     bcmStatGroupModeAttrFlowControlPktTypeData = 0, /* Data */
   1164     bcmStatGroupModeAttrFlowControlPktTypePause = 1, /* Pause */
   1165     bcmStatGroupModeAttrFlowControlPktTypeePfc = 2, /* PFC */
   1166     bcmStatGroupModeAttrFlowControlPktTypeE2ecc = 3 /* E2ECC */
   1167 } bcm_stat_group_mode_attr_flowcontrolpkt_type_t;
   1168 
   1169 /* Vlan related flex attributes values */
   1170 typedef enum bcm_stat_group_mode_attr_vlan_e {
   1171     bcmStatGroupModeAttrVlanUnTagged = 1, /* UnTagged Vlan */
   1172     bcmStatGroupModeAttrVlanInnerTag = 2, /* Inner Tagged Vlan */
   1173     bcmStatGroupModeAttrVlanOuterTag = 3, /* Outer Tagged Vlan */
   1174     bcmStatGroupModeAttrVlanStackedTag = 4, /* Both Inner and Outer Tagged Vlan */
   1175     bcmStatGroupModeAttrVlanAll = 5     /* UnTagged,Inner and Outer Tagged Vlan */
   1176 } bcm_stat_group_mode_attr_vlan_t;
   1177 
   1178 #ifndef BCM_HIDE_DISPATCHABLE
   1179 
   1180 /* Clear the specified statistics from the device. */
   1181 extern int bcm_stat_clear_single(
   1182     int unit, 
   1183     bcm_port_t port, 
   1184     bcm_stat_val_t type);
   1185 
   1186 #endif /* BCM_HIDE_DISPATCHABLE */
   1187 
   1188 /* Packet type related flex attributes values */
   1189 typedef enum bcm_stat_group_mode_attr_pkt_type_e {
   1190     bcmStatGroupModeAttrPktTypeAll = 1, /* All Packet Types */
   1191     bcmStatGroupModeAttrPktTypeUnknown = 2, /* Unknown Packet */
   1192     bcmStatGroupModeAttrPktTypeControl = 3, /* Control Packet */
   1193     bcmStatGroupModeAttrPktTypeOAM = 4, /* OAM Packet */
   1194     bcmStatGroupModeAttrPktTypeBFD = 5, /* BFD Packet */
   1195     bcmStatGroupModeAttrPktTypeBPDU = 6, /* BPDU Packet */
   1196     bcmStatGroupModeAttrPktTypeICNM = 7, /* ICNM Packet */
   1197     bcmStatGroupModeAttrPktType1588 = 8, /* 1588 Packet */
   1198     bcmStatGroupModeAttrPktTypeKnownL2UC = 9, /* Known L2 Unicast Packet */
   1199     bcmStatGroupModeAttrPktTypeUnknownL2UC = 10, /* Unknown L2 Unicast Packet */
   1200     bcmStatGroupModeAttrPktTypeL2BC = 11, /* L2 Broadcast Packet */
   1201     bcmStatGroupModeAttrPktTypeKnownL2MC = 12, /* Known L2 Multicast Packet */
   1202     bcmStatGroupModeAttrPktTypeUnknownL2MC = 13, /* Unknown L2 Multicast Packet */
   1203     bcmStatGroupModeAttrPktTypeKnownL3UC = 14, /* Known L3 Unicast Packet */
   1204     bcmStatGroupModeAttrPktTypeUnknownL3UC = 15, /* Unknown L3 Unicast Packet */
   1205     bcmStatGroupModeAttrPktTypeKnownIPMC = 16, /* Known IPMC Packet */
   1206     bcmStatGroupModeAttrPktTypeUnknownIPMC = 17, /* Unknown IPMC Packet */
   1207     bcmStatGroupModeAttrPktTypeKnownMplsL2 = 18, /* Known MPLS L2 Packet */
   1208     bcmStatGroupModeAttrPktTypeKnownMplsL3 = 19, /* Known MPLS L3 Packet */
   1209     bcmStatGroupModeAttrPktTypeKnownMpls = 20, /* Known MPLS Packet */
   1210     bcmStatGroupModeAttrPktTypeUnknownMpls = 21, /* Unknown MPLS Packet */
   1211     bcmStatGroupModeAttrPktTypeKnownMplsMulticast = 22, /* Known MPLS Multicast Packet */
   1212     bcmStatGroupModeAttrPktTypeKnownMim = 23, /* Known MiM Packet */
   1213     bcmStatGroupModeAttrPktTypeUnknownMim = 24, /* Unknown MiM Packet */
   1214     bcmStatGroupModeAttrPktTypeKnownTrill = 25, /* Known TRILL Packet */
   1215     bcmStatGroupModeAttrPktTypeUnknownTrill = 26, /* Unknown TRILL Packet */
   1216     bcmStatGroupModeAttrPktTypeKnownNiv = 27, /* Known  NIV Packet */
   1217     bcmStatGroupModeAttrPktTypeUnknownNiv = 28 /* Unknown  NIV Packet */
   1218 } bcm_stat_group_mode_attr_pkt_type_t;
   1219 
   1220 /* Stat Group Mode Attribute Selectors */
   1221 typedef enum bcm_stat_group_mode_attr_e {
   1222     bcmStatGroupModeAttrColor = 1,      /* Color Selector: Possible
   1223                                            Value:bcmColorGreen|Yellow|REd or
   1224                                            oxFFFFFFFF */
   1225     bcmStatGroupModeAttrFieldIngressColor = 2, /* Field Ingress Color Selector:
   1226                                            Possible
   1227                                            Values:bcmColorGreen|Yellow|REd or
   1228                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1229                                            all */
   1230     bcmStatGroupModeAttrIntPri = 3,     /* Internal Priority Selector: Possible
   1231                                            Values: 0 to 15 or
   1232                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1233                                            all */
   1234     bcmStatGroupModeAttrVlan = 4,       /* Vlan Type Selector: Possible Values:
   1235                                            bcmStatGroupModeVlanAttr */
   1236     bcmStatGroupModeAttrOuterPri = 5,   /* Outer Vlan Priority Selector:
   1237                                            Possible Values: 0 to 7 or
   1238                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1239                                            all */
   1240     bcmStatGroupModeAttrInnerPri = 6,   /* Inner Vlan Priority Selector:
   1241                                            Possible Values: 0 to 7 or
   1242                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1243                                            all */
   1244     bcmStatGroupModeAttrPort = 7,       /* Logical Port Selector: Possible
   1245                                            Values:<MaxLogicalPort> or
   1246                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1247                                            all */
   1248     bcmStatGroupModeAttrTosDscp = 8,    /* Type Of Service Selector(DSCP :
   1249                                            Differentiated services Code Point):
   1250                                            Possible Values:<6b:TOS Val> or
   1251                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1252                                            all */
   1253     bcmStatGroupModeAttrTosEcn = 9,     /* Type Of Service Selector(ECN:
   1254                                            Explicit Congestion Notification):
   1255                                            Possible Values:<2b:TOS Val> or
   1256                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1257                                            all */
   1258     bcmStatGroupModeAttrPktType = 10,   /* Packet Type Selector: Possible
   1259                                            Values:<bcmStatGroupModeAttrPktType*> */
   1260     bcmStatGroupModeAttrIngNetworkGroup = 11, /* Ingress Network Group Selector:
   1261                                            Possible Values:<Value> or
   1262                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1263                                            all */
   1264     bcmStatGroupModeAttrEgrNetworkGroup = 12, /* Egress Network Group Selector:
   1265                                            Possible Values:<Value> or
   1266                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1267                                            all */
   1268     bcmStatGroupModeAttrDrop = 13,      /* Drop Selector: Possible Values:<0 or
   1269                                            1> */
   1270     bcmStatGroupModeAttrPacketTypeIp = 14, /* Ip Packet Selector: Possible
   1271                                            Values:<0 or 1> */
   1272     bcmStatGroupModeAttrColorMplsLabelFirst = 15, /* Color Selector derived from first
   1273                                            Mpls label: Possible
   1274                                            Value:bcmColorGreen|Yellow|REd or
   1275                                            oxFFFFFFFF */
   1276     bcmStatGroupModeAttrIntPriMplsLabelFirst = 16, /* Internal Priority Selector derived
   1277                                            from first Mpls label: Possible
   1278                                            Values: 0 to 15 or
   1279                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1280                                            all */
   1281     bcmStatGroupModeAttrColorMplsLabelSecond = 17, /* Color Selector derived from second
   1282                                            Mpls label: Possible
   1283                                            Value:bcmColorGreen|Yellow|REd or
   1284                                            oxFFFFFFFF */
   1285     bcmStatGroupModeAttrIntPriMplsLabelSecond = 18, /* Internal Priority Selector derived
   1286                                            from second Mpls label: Possible
   1287                                            Values: 0 to 15 or
   1288                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1289                                            all */
   1290     bcmStatGroupModeAttrColorMplsLabelThird = 19, /* Color Selector derived from third
   1291                                            Mpls label: Possible
   1292                                            Value:bcmColorGreen|Yellow|REd or
   1293                                            oxFFFFFFFF */
   1294     bcmStatGroupModeAttrIntPriMplsLabelThird = 20, /* Internal Priority Selector derived
   1295                                            from third Mpls label: Possible
   1296                                            Values: 0 to 15 or
   1297                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1298                                            all */
   1299     bcmStatGroupModeAttrPktCfiPri = 21, /* Vlan tag CFI, PRI Selector: Possible
   1300                                            Values: 0 to 15 or
   1301                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1302                                            all */
   1303     bcmStatGroupModeAttrUdf = 22,       /* UDF. Possible Values:< max 8b valid
   1304                                            bit in UDF Val> or <max 7b valid bit
   1305                                            in UDF Val> when AttrDrop is enabled */
   1306     bcmStatGroupModeAttrCos = 23,       /* MMU cos Selector: Possible Values: 0
   1307                                            to 15 or
   1308                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1309                                            all */
   1310     bcmStatGroupModeAttrQueueType = 24, /* Queue Type Selector: Possible Values:
   1311                                            0 for MC queue, or 1 for UC queue or
   1312                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1313                                            all */
   1314     bcmStatGroupModeAttrCongestionMarked = 25, /* Congestion marked status Selector:
   1315                                            Possible Values: 0 to 1 or
   1316                                            STAT_GROUP_MODE_ATTR_ALL_VALUES for
   1317                                            all */
   1318     bcmStatGroupModeAttrClassType = 26, /* User defined class to identify a set
   1319                                            of attributes combined together */
   1320     bcmStatGroupModeAttrTcpFlagsType = 27, /* TCP flags selector derived from TCP
   1321                                            flags field in the packet */
   1322     bcmStatGroupModeAttrIntCongestion = 28, /* Internal Congestion selector derived
   1323                                            form ECN to internal congestion
   1324                                            mapped value */
   1325     bcmStatGroupModeAttrFlowControlPktType = 29, /* Indicates type of Flow Control Packet */
   1326     bcmStatGroupModeAttrMaxValue = 30   /* This should be the maximum value
   1327                                            defined in this enum */
   1328 } bcm_stat_group_mode_attr_t;
   1329 
   1330 /* Unique constants */
   1331 #define BCM_STAT_GROUP_MODE_ATTR_ALL_VALUES 0xFFFFFFFF /* A unique constant for
   1332                                                           using all attr values */
   1333 
   1334 /* Stat Group Mode Flags */
   1335 #define BCM_STAT_GROUP_MODE_INGRESS         0x00000001 /* Stat Group Mode
   1336                                                           Ingress */
   1337 #define BCM_STAT_GROUP_MODE_EGRESS          0x00000002 /* Stat Group Mode Egress */
   1338 #define BCM_STAT_GROUP_MODE_CAPABILITY_OAM  0x00000004 /* Stat Group Mode With
   1339                                                           OAM Capability */
   1340 #define BCM_STAT_GROUP_MODE_UDF             0x00000008 /* Stat Group Mode UDF */
   1341 
   1342 /* Ingress and Egress Statistics Accounting Objects */
   1343 typedef enum bcm_stat_object_e {
   1344     bcmStatObjectIngPort = 0,           /* Ingress Port Object */
   1345     bcmStatObjectIngVlan = 1,           /* Ingress Vlan Object */
   1346     bcmStatObjectIngVlanXlate = 2,      /* Ingress Vlan Translate Object */
   1347     bcmStatObjectIngVfi = 3,            /* Ingress VFI Object */
   1348     bcmStatObjectIngL3Intf = 4,         /* Ingress L3 Interface Object */
   1349     bcmStatObjectIngVrf = 5,            /* Ingress VRF Object */
   1350     bcmStatObjectIngPolicy = 6,         /* Ingress Policy Object */
   1351     bcmStatObjectIngFieldStageLookup = 6, /* Ingress VFP Object */
   1352     bcmStatObjectIngMplsVcLabel = 7,    /* Ingress MPLS VC Label Object */
   1353     bcmStatObjectIngMplsSwitchLabel = 8, /* Ingress MPLS Switch Label Object */
   1354     bcmStatObjectEgrPort = 9,           /* Egress Port Object */
   1355     bcmStatObjectEgrVlan = 10,          /* Egress Vlan Object */
   1356     bcmStatObjectEgrVlanXlate = 11,     /* Egress Vlan Translate Object */
   1357     bcmStatObjectEgrVfi = 12,           /* Egress VFI Object */
   1358     bcmStatObjectEgrL3Intf = 13,        /* Egress L3 Interface Object */
   1359     bcmStatObjectIngMplsFrrLabel = 14,  /* Ingress MPLS Fast Reroute Label
   1360                                            Object */
   1361     bcmStatObjectIngL3Host = 15,        /* L3 Host without L3 Egress Object */
   1362     bcmStatObjectIngTrill = 16,         /* Ingress Trill Object */
   1363     bcmStatObjectIngMimLookupId = 17,   /* Ingress MiM I-SID Object */
   1364     bcmStatObjectIngL2Gre = 18,         /* Ingress L2 GRE Object */
   1365     bcmStatObjectIngEXTPolicy = 19,     /* Ingress external FP Object */
   1366     bcmStatObjectIngFieldStageExternal = 19, /* Ingress external FP Object */
   1367     bcmStatObjectEgrWlan = 20,          /* Egress WLAN Object */
   1368     bcmStatObjectEgrMim = 21,           /* Egress MiM Object */
   1369     bcmStatObjectEgrMimLookupId = 22,   /* Egress MiM I-SID Object */
   1370     bcmStatObjectEgrL2Gre = 23,         /* Egress L2 GRE Object */
   1371     bcmStatObjectIngVxlan = 24,         /* Ingress Vxlan Object */
   1372     bcmStatObjectIngVsan = 25,          /* Ingress FCOE VSAN Object */
   1373     bcmStatObjectIngFcoe = 26,          /* Ingress FCOE Object */
   1374     bcmStatObjectIngL3Route = 27,       /* Ingress L2 Route Defip Object */
   1375     bcmStatObjectEgrVxlan = 28,         /* Egress Vxlan Object */
   1376     bcmStatObjectEgrL3Nat = 29,         /* Egress L3 NAT Object */
   1377     bcmStatObjectIngNiv = 30,           /* Ingress Niv Object */
   1378     bcmStatObjectIngIpmc = 32,          /* Ingress IPMC Object */
   1379     bcmStatObjectEgrNiv = 31,           /* Egress Niv Object */
   1380     bcmStatObjectIngVxlanDip = 33,      /* Ingress Vxlan Dip Object */
   1381     bcmStatObjectIngFieldStageIngress = 34, /* Ingress FP Object */
   1382     bcmStatObjectEgrFieldStageEgress = 35, /* Egress FP Object */
   1383     bcmStatObjectEgrMplsTunnelLabel = 36, /* Egress MPLS Tunnel Label */
   1384     bcmStatObjectIngExactMatch = 37,    /* Exact Match FP Object */
   1385     bcmStatObjectIngGport = 38,         /* Ingress GPort Object */
   1386     bcmStatObjectIngVlanXlateSecondLookup = 39, /* Ingress Vlan Translate Second Lookup
   1387                                            Object */
   1388     bcmStatObjectEgrVlanXlateSecondLookup = 40, /* Egress Vlan Translate Second Lookup
   1389                                            Object */
   1390     bcmStatObjectIngMplsSwitchSecondLabel = 41, /* Mpls Entry Lookup object for the
   1391                                            Second Label */
   1392     bcmStatObjectEgrMplsTunnelSecondLabel = 42, /* Egress Mpls Tunnel Second Label
   1393                                            Object */
   1394     bcmStatObjectEgrDvpAttr = 43,       /* Egress DVP Attribute table object */
   1395     bcmStatObjectMaxValue = 44          /* This should be the maximum value
   1396                                            defined in this enum */
   1397 } bcm_stat_object_t;
   1398 
   1399 #define BCM_STAT_OBJECT \
   1400 { \
   1401     "IngPort", \
   1402     "IngVlan", \
   1403     "IngVlanXlate", \
   1404     "IngVfi", \
   1405     "IngL3Intf", \
   1406     "IngVrf", \
   1407     "IngPolicy", \
   1408     "IngMplsVcLabel", \
   1409     "IngMplsSwitchLabel", \
   1410     "EgrPort", \
   1411     "EgrVlan", \
   1412     "EgrVlanXlate", \
   1413     "EgrVfi", \
   1414     "EgrL3Intf", \
   1415     "IngMplsFrrLabel", \
   1416     "IngL3Host", \
   1417     "IngTrill", \
   1418     "IngMimLookupId", \
   1419     "IngL2Gre", \
   1420     "IngEXTPolicy", \
   1421     "EgrWlan", \
   1422     "EgrMim", \
   1423     "EgrMimLookupId", \
   1424     "EgrL2Gre", \
   1425     "IngVxlan", \
   1426     "IngVsan", \
   1427     "IngFcoe", \
   1428     "IngL3Route", \
   1429     "EgrVxlan", \
   1430     "EgrL3Nat", \
   1431     "IngNiv", \
   1432     "IngIpmc", \
   1433     "EgrNiv", \
   1434     "IngVxlanDip", \
   1435     "IngFieldStageIngress", \
   1436     "EgrFieldStageEgress", \
   1437     "EgrMplsTunnelLabel", \
   1438     "IngExactMatch", \
   1439     "IngGport", \
   1440     "IngVlanXlateSecondLookup", \
   1441     "EgrVlanXlateSecondLookup", \
   1442     "IngMplsSwitchSecondLabel", \
   1443     "EgrMplsTunnelSecondLabel", \
   1444     "EgrDvpAttr", \
   1445     "MaxValue"  \
   1446 }
   1447 
   1448 /* Flex stat pool direction */
   1449 typedef enum bcm_stat_flex_direction_e {
   1450     bcmStatFlexDirectionIngress = 0,    /* Ingress direction */
   1451     bcmStatFlexDirectionEgress = 1,     /* Egress direction */
   1452     bcmStatFlexDirectionCount = 2       /* Max value defined for this enum */
   1453 } bcm_stat_flex_direction_t;
   1454 
   1455 /* Defines the IFP specific parameters. */
   1456 typedef enum bcm_stat_group_mode_hint_type_e {
   1457     bcmStatGroupAllocHintIngressFieldGroup = 1, 
   1458     bcmStatGroupAllocHintVlanFieldGroup = 2, 
   1459     bcmStatGroupAllocHintExactMatchFieldGroup = 3, 
   1460     bcmStatGroupAllocHintEgressFieldGroup = 4, 
   1461     bcmStatGroupAllocHintCount = 5      /* Max value defined for this enum */
   1462 } bcm_stat_group_mode_hint_type_t;
   1463 
   1464 /* Flex pool statistics information */
   1465 typedef struct bcm_stat_flex_pool_stat_info_s {
   1466     uint32 pool_id;                     /* pool ID */
   1467     uint32 total_entries;               /* The size of this pool */
   1468     uint32 used_entries;                /* Entries that are allocated (but not
   1469                                            necessarily assigned) */
   1470     uint32 attached_entries;            /* he number of used_entries that are
   1471                                            actually assigned to an object */
   1472     uint32 free_entries;                /* The result of deducting used_entries
   1473                                            from total_entries */
   1474     SHR_BITDCL used_by_objects[_SHR_BITDCLSIZE(bcmStatObjectMaxValue)]; 
   1475 } bcm_stat_flex_pool_stat_info_t;
   1476 
   1477 /* Stat Flex Group Attribute Selector */
   1478 typedef struct bcm_stat_group_mode_attr_selector_s {
   1479     uint32 counter_offset;              /* Counter Offset */
   1480     bcm_stat_group_mode_attr_t attr;    /* Attribute Selector */
   1481     uint32 attr_value;                  /* Attribute Values */
   1482     uint32 udf_bitmap;                  /* valid UDF bits, should be same in one
   1483                                            mode id */
   1484 } bcm_stat_group_mode_attr_selector_t;
   1485 
   1486 /* Stat Flex Group Hint */
   1487 typedef struct bcm_stat_group_mode_hint_s {
   1488     bcm_stat_group_mode_hint_type_t type; /* Hint type */
   1489     uint32 value;                       /* Hint value */
   1490 } bcm_stat_group_mode_hint_t;
   1491 
   1492 /* Stat Flex Group Attribute Selector */
   1493 typedef struct bcm_stat_group_mode_id_config_s {
   1494     uint32 flags;                       /* Counter Mode Flags */
   1495     uint32 total_counters;              /* Total Number of Counters */
   1496     bcm_stat_group_mode_hint_t hint;    /* Stat Hint */
   1497 } bcm_stat_group_mode_id_config_t;
   1498 
   1499 /* Counter Statistics Values */
   1500 typedef struct bcm_stat_value_s {
   1501     uint32 packets;     /* packets value */
   1502     uint64 bytes;       /* bytes value */
   1503     uint64 packets64;   /* 64-bit accumulated packets value */
   1504 } bcm_stat_value_t;
   1505 
   1506 /* Statistics Group Modes */
   1507 typedef enum bcm_stat_group_mode_e {
   1508     bcmStatGroupModeSingle = 0,         /* A single counter used for all traffic
   1509                                            types */
   1510     bcmStatGroupModeTrafficType = 1,    /* A dedicated counter per traffic type
   1511                                            Unicast, multicast, broadcast */
   1512     bcmStatGroupModeDlfAll = 2,         /* A pair of counters where the base
   1513                                            counter is used for dlf and the other
   1514                                            counter is used for all traffic types */
   1515     bcmStatGroupModeDlfIntPri = 3,      /* N+1 counters where the base counter
   1516                                            is used for dlf and next N are used
   1517                                            per Cos */
   1518     bcmStatGroupModeTyped = 4,          /* A dedicated counter for unknown
   1519                                            unicast, known unicast, multicast,
   1520                                            broadcast */
   1521     bcmStatGroupModeTypedAll = 5,       /* A dedicated counter for unknown
   1522                                            unicast, known unicast, multicast,
   1523                                            broadcast and one for all traffic(not
   1524                                            already counted) */
   1525     bcmStatGroupModeTypedIntPri = 6,    /* A dedicated counter for unknown
   1526                                            unicast, known unicast,
   1527                                            multicast,broadcast and N internal
   1528                                            priority counters for traffic (not
   1529                                            already counted) */
   1530     bcmStatGroupModeSingleWithControl = 7, /* A single counter used for all traffic
   1531                                            types with an additional counter for
   1532                                            control traffic */
   1533     bcmStatGroupModeTrafficTypeWithControl = 8, /* A dedicated counter per traffic type
   1534                                            unicast, multicast, broadcast with an
   1535                                            additional counter for control
   1536                                            traffic */
   1537     bcmStatGroupModeDlfAllWithControl = 9, /* A pair of counters where the base
   1538                                            counter is used for control, the next
   1539                                            one for dlf and the other counter is
   1540                                            used for all traffic types */
   1541     bcmStatGroupModeDlfIntPriWithControl = 10, /* N+2 counters where the base counter
   1542                                            is used for control, the next one for
   1543                                            dlf and next N are used per Cos */
   1544     bcmStatGroupModeTypedWithControl = 11, /* A dedicated counter for control,
   1545                                            unknown unicast, known unicast,
   1546                                            multicast, broadcast */
   1547     bcmStatGroupModeTypedAllWithControl = 12, /* A dedicated counter for control,
   1548                                            unknown unicast, known
   1549                                            unicast,multicast, broadcast and one
   1550                                            for all traffic (not already counted) */
   1551     bcmStatGroupModeTypedIntPriWithControl = 13, /* A dedicated counter for control,
   1552                                            unknown unicast, known unicast,
   1553                                            multicast, broadcast and N internal
   1554                                            priority counters for traffic (not
   1555                                            already counted) */
   1556     bcmStatGroupModeDot1P = 14,         /* A set of 8(2^3) counters selected
   1557                                            based on Vlan priority */
   1558     bcmStatGroupModeIntPri = 15,        /* A set of 16(2^4) counters based on
   1559                                            internal priority */
   1560     bcmStatGroupModeIntPriCng = 16,     /* A set of 64 counters(2^(4+2)) based
   1561                                            on Internal priority+CNG */
   1562     bcmStatGroupModeSvpType = 17,       /* A set of 2 counters(2^1) based on SVP
   1563                                            type */
   1564     bcmStatGroupModeDscp = 18,          /* A set of 64 counters(2^6) based on
   1565                                            DSCP bits */
   1566     bcmStatGroupModeDvpType = 19,       /* A set of 2 counters(2^1) based on DVP
   1567                                            type */
   1568     bcmStatGroupModeCng = 20,           /* A set of 4 counters based on Pre IFP
   1569                                            packet color bits */
   1570     bcmStatGroupModeMplsCngLabelFirst = 21, /* A set of 4 counters based on Pre IFP
   1571                                            packet color bits based on first Mpls
   1572                                            Label */
   1573     bcmStatGroupModeMplsIntPriLabelFirst = 22, /* A set of 16(2^4) counters based on
   1574                                            internal priority based on first Mpls
   1575                                            Label */
   1576     bcmStatGroupModeMplsCngLabelSecond = 23, /* A set of 4 counters based on Pre IFP
   1577                                            packet color bits based on second
   1578                                            Mpls Label */
   1579     bcmStatGroupModeMplsIntPriLabelSecond = 24, /* A set of 16(2^4) counters based on
   1580                                            internal priority based on second
   1581                                            Mpls Label */
   1582     bcmStatGroupModeMplsCngLabelThird = 25, /* A set of 4 counters based on Pre IFP
   1583                                            packet color bits based on third Mpls
   1584                                            Label */
   1585     bcmStatGroupModeMplsIntPriLabelThird = 26, /* A set of 16(2^4) counters based on
   1586                                            internal priority based on third Mpls
   1587                                            Label */
   1588     bcmStatGroupModeCount = 27          /* This should be the maximum value
   1589                                            defined for the enum */
   1590 } bcm_stat_group_mode_t;
   1591 
   1592 /* Flex statistics type */
   1593 typedef enum bcm_stat_flex_stat_e {
   1594     bcmStatFlexStatPackets = 0, /* Packets statistics */
   1595     bcmStatFlexStatBytes = 1,   /* Bytes statistics */
   1596     bcmStatFlexStatCount = 2    /* Max value defined for this enum */
   1597 } bcm_stat_flex_stat_t;
   1598 
   1599 #ifndef BCM_HIDE_DISPATCHABLE
   1600 
   1601 /* Retrieves the flex counter details for a given objectId */
   1602 extern int bcm_stat_flex_pool_info_multi_get(
   1603     int unit, 
   1604     bcm_stat_flex_direction_t direction, 
   1605     uint32 num_pools, 
   1606     bcm_stat_flex_pool_stat_info_t *flex_pool_stat, 
   1607     uint32 *actual_num_pools);
   1608 
   1609 #endif /* BCM_HIDE_DISPATCHABLE */
   1610 
   1611 /* Initialize an attribute selector of Stat Flex Group Mode */
   1612 extern void bcm_stat_group_mode_attr_selector_t_init(
   1613     bcm_stat_group_mode_attr_selector_t *attr_selector);
   1614 
   1615 /* Initialize bcm_stat_value_t structure */
   1616 extern void bcm_stat_value_t_init(
   1617     bcm_stat_value_t *stat_value);
   1618 
   1619 #ifndef BCM_HIDE_DISPATCHABLE
   1620 
   1621 /* Create Customized Stat Group mode for given Counter Attributes */
   1622 extern int bcm_stat_group_mode_id_create(
   1623     int unit, 
   1624     uint32 flags, 
   1625     uint32 total_counters, 
   1626     uint32 num_selectors, 
   1627     bcm_stat_group_mode_attr_selector_t *attr_selectors, 
   1628     uint32 *mode_id);
   1629 
   1630 /* Create mapping between created class and the combined type Attributes */
   1631 extern int bcm_stat_group_mode_attr_class_id_create(
   1632     int unit, 
   1633     bcm_stat_group_mode_attr_t attr, 
   1634     uint32 num_of_attr_values, 
   1635     uint32 *attr_values, 
   1636     bcm_stat_group_mode_attr_class_id_t *attr_class_id);
   1637 
   1638 /* Retrieves Customized Stat Group mode Attributes for given mode_id */
   1639 extern int bcm_stat_group_mode_id_get(
   1640     int unit, 
   1641     uint32 mode_id, 
   1642     uint32 *flags, 
   1643     uint32 *total_counters, 
   1644     uint32 num_selectors, 
   1645     bcm_stat_group_mode_attr_selector_t *attr_selectors, 
   1646     uint32 *actual_num_selectors);
   1647 
   1648 /* Destroys Customized Group mode */
   1649 extern int bcm_stat_group_mode_id_destroy(
   1650     int unit, 
   1651     uint32 mode_id);
   1652 
   1653 /* Destroy mapping between created class and the combined type Attributes */
   1654 extern int bcm_stat_group_mode_attr_class_id_destroy(
   1655     int unit, 
   1656     bcm_stat_group_mode_attr_class_id_t attr_class_id);
   1657 
   1658 /* Associate an accounting object to customized group mode */
   1659 extern int bcm_stat_custom_group_create(
   1660     int unit, 
   1661     uint32 mode_id, 
   1662     bcm_stat_object_t object, 
   1663     uint32 *stat_counter_id, 
   1664     uint32 *num_entries);
   1665 
   1666 #endif /* BCM_HIDE_DISPATCHABLE */
   1667 
   1668 /* Initialize stat group config structure */
   1669 extern void bcm_stat_group_mode_id_config_t_init(
   1670     bcm_stat_group_mode_id_config_t *stat_config);
   1671 
   1672 #ifndef BCM_HIDE_DISPATCHABLE
   1673 
   1674 /* Associate an accounting object to customized group mode */
   1675 extern int bcm_stat_group_mode_id_config_create(
   1676     int unit, 
   1677     uint32 options, 
   1678     bcm_stat_group_mode_id_config_t *stat_config, 
   1679     uint32 num_selectors, 
   1680     bcm_stat_group_mode_attr_selector_t *attr_sel, 
   1681     uint32 *mode_id);
   1682 
   1683 /* Associate an accounting object to customized group mode */
   1684 extern int bcm_stat_group_mode_id_config_get(
   1685     int unit, 
   1686     uint32 mode_id, 
   1687     bcm_stat_group_mode_id_config_t *config, 
   1688     uint32 num_selectors, 
   1689     bcm_stat_group_mode_attr_selector_t *attr_sel, 
   1690     uint32 *actual_num_selectors);
   1691 
   1692 #endif /* BCM_HIDE_DISPATCHABLE */
   1693 
   1694 /* Initialize stat Hint structure */
   1695 extern void bcm_stat_group_mode_hint_t_init(
   1696     bcm_stat_group_mode_hint_t *stat_hint);
   1697 
   1698 #ifndef BCM_HIDE_DISPATCHABLE
   1699 
   1700 /* Create Fixed Counter Entries group for given accounting object */
   1701 extern int bcm_stat_group_create(
   1702     int unit, 
   1703     bcm_stat_object_t object, 
   1704     bcm_stat_group_mode_t group_mode, 
   1705     uint32 *stat_counter_id, 
   1706     uint32 *num_entries);
   1707 
   1708 /* Destroy counter Entries group */
   1709 extern int bcm_stat_group_destroy(
   1710     int unit, 
   1711     uint32 stat_counter_id);
   1712 
   1713 /* Dump contents of all configured groups */
   1714 extern int bcm_stat_group_dump(
   1715     int unit, 
   1716     bcm_stat_object_t object, 
   1717     bcm_stat_group_mode_t group_mode);
   1718 
   1719 /* Dump contents of all configured groups */
   1720 extern int bcm_stat_group_dump_all(
   1721     int unit);
   1722 
   1723 /* Get all Stat Ids attached to the specified flex stat object. */
   1724 extern int bcm_stat_id_get_all(
   1725     int unit, 
   1726     bcm_stat_object_t object, 
   1727     int stat_max, 
   1728     uint32 *stat_array, 
   1729     int *stat_count);
   1730 
   1731 #endif /* BCM_HIDE_DISPATCHABLE */
   1732 
   1733 /* A range of counter pointers. */
   1734 typedef struct bcm_stat_counter_pointer_range_s {
   1735     int start; 
   1736     int end; 
   1737 } bcm_stat_counter_pointer_range_t;
   1738 
   1739 /* 
   1740  * Define the counting source of a counter engine. That is, what block to
   1741  * count, and what to count in a block
   1742  */
   1743 typedef enum bcm_stat_counter_source_type_e {
   1744     bcmStatCounterSourceIngressOam = 0, 
   1745     bcmStatCounterSourceEgressOam = 1, 
   1746     bcmStatCounterSourceIngressVsi = 2, 
   1747     bcmStatCounterSourceIngressInlif = 3, 
   1748     bcmStatCounterSourceIngressCnm = 4, 
   1749     bcmStatCounterSourceIngressField = 5, 
   1750     bcmStatCounterSourceEgressField = 6, 
   1751     bcmStatCounterSourceIngressLatency = 7, 
   1752     bcmStatCounterSourceIngressVoq = 8, 
   1753     bcmStatCounterSourceIngressVsq = 9, 
   1754     bcmStatCounterSourceEgressTransmitVsi = 10, 
   1755     bcmStatCounterSourceEgressReceiveVsi = 11, 
   1756     bcmStatCounterSourceEgressTransmitOutlif = 12, 
   1757     bcmStatCounterSourceEgressReceiveOutlif = 13, 
   1758     bcmStatCounterSourceEgressTransmitQueue = 14, 
   1759     bcmStatCounterSourceEgressTransmitTmPort = 15, 
   1760     bcmStatCounterSourceEgressReceiveQueue = 16, 
   1761     bcmStatCounterSourceEgressReceiveTmPort = 17, 
   1762     bcmStatCounterSourceEgressReceiveTm = 18, 
   1763     bcmStatCounterSourceCount = 19      /* Must be last one. */
   1764 } bcm_stat_counter_source_type_t;
   1765 
   1766 /* Counter Engine Source Configuration */
   1767 typedef struct bcm_stat_counter_source_s {
   1768     bcm_core_t core_id;                 /* The counting source core */
   1769     bcm_stat_counter_source_type_t engine_source; /* Counting source */
   1770     bcm_stat_counter_pointer_range_t pointer_range; /* The range of counter  pointers. */
   1771     int command_id;                     /* Defines what counting command to
   1772                                            read. */
   1773     int num_voqs_per_entry;             /* Defines how many consecutive VOQs are
   1774                                            counted in one counter set. Only
   1775                                            relevant for
   1776                                            bcm_stat_counter_engine_source_ingress_voq. */
   1777     int offset;                         /* Constant offset added on top of the
   1778                                            counter pointer value, applicable for
   1779                                            ERPP sources only. */
   1780 } bcm_stat_counter_source_t;
   1781 
   1782 /* 
   1783  * An entry counter set offset mapping, consists of color X {forward,
   1784  * drop}
   1785  */
   1786 typedef struct bcm_stat_counter_set_entry_s {
   1787     bcm_color_t color;          /* Counter color (Drop Precedence) */
   1788     uint8 is_forward_not_drop;  /* If set, the counter refers to Forward packet
   1789                                    counters. Otherwise, to dropped packet
   1790                                    counters. */
   1791 } bcm_stat_counter_set_entry_t;
   1792 
   1793 /* Mapping of an entry to a counter set offset */
   1794 typedef struct bcm_stat_counter_set_entry_mapping_s {
   1795     bcm_stat_counter_set_entry_t entry; /* The entrys value, consists of color X
   1796                                            {forward, drop} */
   1797     int offset; 
   1798 } bcm_stat_counter_set_entry_mapping_t;
   1799 
   1800 #define BCM_STAT_COUNTER_MAPPING_MAX_SIZE   8          /* The maximum legal size
   1801                                                           of a counter set */
   1802 
   1803 /* Counter configuration struct */
   1804 typedef struct bcm_stat_counter_set_mapping_s {
   1805     int counter_set_size;               /* The size of the counter set, cannot
   1806                                            an entry mapped to a value above it,
   1807                                            will not be counted */
   1808     int num_of_mapping_entries;         /* The number of valid entries in
   1809                                            entry_mapping array */
   1810     bcm_stat_counter_set_entry_mapping_t entry_mapping[BCM_STAT_COUNTER_MAPPING_MAX_SIZE]; /* An array of color X {forward, drop}
   1811                                            mapped to count an offset in the
   1812                                            counter set */
   1813 } bcm_stat_counter_set_mapping_t;
   1814 
   1815 /* Defines the width of an entry, and what statistics to gather. */
   1816 typedef enum bcm_stat_counter_format_type_e {
   1817     bcmStatCounterFormatPacketsAndBytes = 0, 
   1818     bcmStatCounterFormatPackets = 1, 
   1819     bcmStatCounterFormatBytes = 2, 
   1820     bcmStatCounterFormatDoublePackets = 3, /* doubles that total number of entries
   1821                                            for a counter engine */
   1822     bcmStatCounterFormatMaxVoqSize = 4, /* Not relevant for Jer2 */
   1823     bcmStatCounterFormatMaxSize = 4,    /* Always double mode */
   1824     bcmStatCounterFormatIngressLatency = 5, 
   1825     bcmStatCounterFormatCount = 6       /* Must be last one. */
   1826 } bcm_stat_counter_format_type_t;
   1827 
   1828 /* Counter configuration struct */
   1829 typedef struct bcm_stat_counter_format_s {
   1830     bcm_stat_counter_format_type_t format_type; /* Counting format: defines the width of
   1831                                            an entry, and what statistics to
   1832                                            gather. */
   1833     bcm_stat_counter_set_mapping_t counter_set_mapping; /* counter set configuration: defines
   1834                                            the size of a counter set, and what
   1835                                            each offset inside a set counts. */
   1836 } bcm_stat_counter_format_t;
   1837 
   1838 /* Counter configuration struct */
   1839 typedef struct bcm_stat_counter_config_s {
   1840     bcm_stat_counter_format_t format; 
   1841     bcm_stat_counter_source_t source; 
   1842 } bcm_stat_counter_config_t;
   1843 
   1844 #define BCM_STAT_COUNTER_CLEAR_CONFIGURATION 0x1        /* Disables the counter
   1845                                                           engine counting clears
   1846                                                           its configuration. */
   1847 #define BCM_STAT_COUNTER_CACHE              0x2        /* Clears the counter
   1848                                                           cache. */
   1849 #define BCM_STAT_COUNTER_SYMMETRICAL_MULTICORE_ENGINE 0x4        /* If this flag is
   1850                                                           specified then
   1851                                                           consecutive counter
   1852                                                           engines are configured
   1853                                                           for each core, each
   1854                                                           statistics gathering
   1855                                                           is aggregated for
   1856                                                           symmetrical sources.
   1857                                                           config->source.core_id
   1858                                                           must be BCM_CORE_ALL. */
   1859 #define BCM_STAT_COUNTER_IGNORE_COLORS      0x8        /* Ignore colors from
   1860                                                           counter set mapping. */
   1861 #define BCM_STAT_COUNTER_IGNORE_DISPOSITION 0x10       /* Ignore disposition
   1862                                                           (forward or drop) from
   1863                                                           counter set mapping. */
   1864 #define BCM_STAT_COUNTER_MULTIPLE_SOURCES_PER_ENGINE 0x20       /* Connect 2 sources to
   1865                                                           one engine - for QAX
   1866                                                           OAM. */
   1867 #define BCM_STAT_COUNTER_OFFSET_VALID       0x40       /* Defines if to consider
   1868                                                           the offset parameter
   1869                                                           in the structure
   1870                                                           bcm_stat_counter_source_t. */
   1871 
   1872 /* Couner engine type */
   1873 typedef struct bcm_stat_counter_engine_s {
   1874     uint32 flags; 
   1875     int engine_id; 
   1876 } bcm_stat_counter_engine_t;
   1877 
   1878 #ifndef BCM_HIDE_DISPATCHABLE
   1879 
   1880 /* Configure counter engine. */
   1881 extern int bcm_stat_counter_config_set(
   1882     int unit, 
   1883     bcm_stat_counter_engine_t *engine, 
   1884     bcm_stat_counter_config_t *config);
   1885 
   1886 /* Get counter engine configuration. */
   1887 extern int bcm_stat_counter_config_get(
   1888     int unit, 
   1889     bcm_stat_counter_engine_t *engine, 
   1890     bcm_stat_counter_config_t *config);
   1891 
   1892 /* Get the specified statistic of given counter */
   1893 extern int bcm_stat_flex_counter_get(
   1894     int unit, 
   1895     uint32 stat_counter_id, 
   1896     bcm_stat_flex_stat_t stat, 
   1897     uint32 num_entries, 
   1898     uint32 *counter_indexes, 
   1899     bcm_stat_value_t *counter_values);
   1900 
   1901 /* Get the synced specified statistic of given counter */
   1902 extern int bcm_stat_flex_counter_sync_get(
   1903     int unit, 
   1904     uint32 stat_counter_id, 
   1905     bcm_stat_flex_stat_t stat, 
   1906     uint32 num_entries, 
   1907     uint32 *counter_indexes, 
   1908     bcm_stat_value_t *counter_values);
   1909 
   1910 /* Set counter value of given counter */
   1911 extern int bcm_stat_flex_counter_set(
   1912     int unit, 
   1913     uint32 stat_counter_id, 
   1914     bcm_stat_flex_stat_t stat, 
   1915     uint32 num_entries, 
   1916     uint32 *counter_indexes, 
   1917     bcm_stat_value_t *counter_values);
   1918 
   1919 #endif /* BCM_HIDE_DISPATCHABLE */
   1920 
   1921 typedef enum bcm_stat_counter_lif_stack_id_e {
   1922     bcmStatCounterLifStackIdNone = -1,  /* Do not issue a counter command. */
   1923     bcmStatCounterLifStackId0 = 0,      /* Issue a counter command with the
   1924                                            outermost LIF. */
   1925     bcmStatCounterLifStackId1 = 1,      /* Issue a counter command with LIF 1 in
   1926                                            the packet stack. */
   1927     bcmStatCounterLifStackId2 = 2,      /* Issue a counter command with LIF 2 in
   1928                                            the packet stack. */
   1929     bcmStatCounterLifStackId3 = 3       /* Issue a counter command with the
   1930                                            innermost LIF. */
   1931 } bcm_stat_counter_lif_stack_id_t;
   1932 
   1933 #define BCM_STAT_COUNT_LIF_NUMBER_OF_STACK_IDS 4          /* The maximal number of
   1934                                                           LIFs in the packet
   1935                                                           stack */
   1936 
   1937 /* 
   1938  * An entry in a mask of range IDs per stack ID level, each value defines
   1939  * a result of LIF value compared with the LIF ranges.
   1940  */
   1941 typedef enum bcm_stat_counter_lif_range_id_e {
   1942     bcmStatCounterLifRangeIdLifInvalid = -2, /* The LIF does not exist in the packet
   1943                                            stack. */
   1944     bcmStatCounterLifRangeIdNotInAny = -1, /* The LIF is not in any range. */
   1945     bcmBcmStatCounterLifRangeId0 = 0,   /* The LIF is in any range 0. */
   1946     bcmBcmStatCounterLifRangeId1 = 1    /* The LIF is in any range 1. */
   1947 } bcm_stat_counter_lif_range_id_t;
   1948 
   1949 /* 
   1950  * Defines the mask of range IDs per stack ID level, for which the packet
   1951  * will be counted.
   1952  */
   1953 typedef struct bcm_stat_counter_lif_mask_s {
   1954     bcm_stat_counter_lif_range_id_t lif_counting_mask[BCM_STAT_COUNT_LIF_NUMBER_OF_STACK_IDS]; /* An entry in a mask of range IDs per
   1955                                            stack ID level, each value defines a
   1956                                            result of LIF value compared with the
   1957                                            LIF ranges. */
   1958 } bcm_stat_counter_lif_mask_t;
   1959 
   1960 #ifndef BCM_HIDE_DISPATCHABLE
   1961 
   1962 /* 
   1963  * Creates a {counting_source, counting_mask} to lif_stack_level mapping.
   1964  * For issuing a counter command with the the LIF in
   1965  * lif_stack_id_to_count in the packet LIF stack.
   1966  */
   1967 extern int bcm_stat_counter_lif_counting_set(
   1968     int unit, 
   1969     uint32 flags, 
   1970     bcm_stat_counter_source_t *source, 
   1971     bcm_stat_counter_lif_mask_t *counting_mask, 
   1972     bcm_stat_counter_lif_stack_id_t lif_stack_id_to_count);
   1973 
   1974 /* 
   1975  * Get a {counting_source, counting_mask} to lif_stack_level mapping. For
   1976  * issuing a counter command with the the LIF in lif_stack_id_to_count in
   1977  * the packet LIF stack.
   1978  */
   1979 extern int bcm_stat_counter_lif_counting_get(
   1980     int unit, 
   1981     uint32 flags, 
   1982     bcm_stat_counter_source_t *source, 
   1983     bcm_stat_counter_lif_mask_t *counting_mask, 
   1984     bcm_stat_counter_lif_stack_id_t *lif_stack_id_to_count);
   1985 
   1986 #endif /* BCM_HIDE_DISPATCHABLE */
   1987 
   1988 /* A range of LIF IDs. */
   1989 typedef struct bcm_stat_counter_lif_counting_range_s {
   1990     int start; 
   1991     int end; 
   1992     int is_double_entry; 
   1993 } bcm_stat_counter_lif_counting_range_t;
   1994 
   1995 #ifndef BCM_HIDE_DISPATCHABLE
   1996 
   1997 /* Set A range of LIF IDs. */
   1998 extern int bcm_stat_counter_lif_counting_range_set(
   1999     int unit, 
   2000     uint32 flags, 
   2001     bcm_stat_counter_source_type_t source, 
   2002     bcm_stat_counter_lif_range_id_t range_id, 
   2003     bcm_stat_counter_lif_counting_range_t *lif_range);
   2004 
   2005 /* get A range of LIF IDs. */
   2006 extern int bcm_stat_counter_lif_counting_range_get(
   2007     int unit, 
   2008     uint32 flags, 
   2009     bcm_stat_counter_source_type_t source, 
   2010     bcm_stat_counter_lif_range_id_t range_id, 
   2011     bcm_stat_counter_lif_counting_range_t *lif_range);
   2012 
   2013 #endif /* BCM_HIDE_DISPATCHABLE */
   2014 
   2015 /* 
   2016  * Enable parameter 'engine_range_offse' in structure
   2017  * bcm_stat_lif_counting_source_t.
   2018  */
   2019 #define BCM_STAT_COUNT_LIF_ENGINE_RANGE_OFFSET_ENABLE 0x1        
   2020 
   2021 /* LIF Counting Source. */
   2022 typedef struct bcm_stat_lif_counting_source_s {
   2023     bcm_stat_counter_source_type_t type; 
   2024     int command_id; 
   2025     int stif_counter_id; 
   2026     uint32 offset; 
   2027     int engine_range_offset;            /* Positive or negative offset to align
   2028                                            the profile range to the engine
   2029                                            range. relevant only for out lif
   2030                                            counting in QAX/QUX. */
   2031 } bcm_stat_lif_counting_source_t;
   2032 
   2033 /* LIF Counting Configuration. */
   2034 typedef struct bcm_stat_lif_counting_s {
   2035     bcm_stat_lif_counting_source_t source; 
   2036     bcm_stat_counter_lif_counting_range_t range; 
   2037 } bcm_stat_lif_counting_t;
   2038 
   2039 /* stat counter value structure . */
   2040 typedef struct bcm_stat_counter_value_s {
   2041     uint64 value;   /* value of one statistic */
   2042 } bcm_stat_counter_value_t;
   2043 
   2044 /* stat counter Input data in order to know which counter to read. */
   2045 typedef struct bcm_stat_counter_input_data_s {
   2046     bcm_gport_t counter_source_gport;   /* counter source gport, (for example:
   2047                                            global lif, If the source is Lif) */
   2048     uint32 counter_source_id;           /* Object-stat-id (counter_set id) that
   2049                                            the user wants to read (the
   2050                                            counter_pointer value as sent to the
   2051                                            crps.) */
   2052     bcm_stat_counter_source_type_t counter_source_type; /* type of source to count.not in used
   2053                                            for 88690 device and above */
   2054     int command_id;                     /* command id */
   2055     bcm_core_t core_id;                 /* core id to count from */
   2056     int database_id;                    /* determine the database that user want
   2057                                            to read from. (not in use before
   2058                                            device 88690). */
   2059     int type_id;                        /* determine the source_type_id that
   2060                                            user want to read from. (not in use
   2061                                            before device 88690). */
   2062     int nstat;                          /* size of statistics array to count */
   2063     int *stat_arr;                      /* statistic array to count */
   2064 } bcm_stat_counter_input_data_t;
   2065 
   2066 /* stat counter output data. */
   2067 typedef struct bcm_stat_counter_output_data_s {
   2068     bcm_stat_counter_value_t *value_arr; /* array with the values read for each
   2069                                            statistic */
   2070 } bcm_stat_counter_output_data_t;
   2071 
   2072 #define BCM_STAT_LIF_COUNTING_PROFILE_NONE  -1         /* An indicator for a LIF
   2073                                                           to be uncounted */
   2074 
   2075 #ifndef BCM_HIDE_DISPATCHABLE
   2076 
   2077 /* 
   2078  * Mapping a LIF-couting-profile to a counting-source and
   2079  * LIF-counting-range.
   2080  */
   2081 extern int bcm_stat_lif_counting_profile_set(
   2082     int unit, 
   2083     uint32 flags, 
   2084     int lif_counting_profile, 
   2085     bcm_stat_lif_counting_t *lif_counting);
   2086 
   2087 /* 
   2088  * Get a mapping of a LIF-couting-profile to a counting-source and
   2089  * LIF-counting-range.
   2090  */
   2091 extern int bcm_stat_lif_counting_profile_get(
   2092     int unit, 
   2093     uint32 flags, 
   2094     int lif_counting_profile, 
   2095     bcm_stat_lif_counting_t *lif_counting);
   2096 
   2097 /* 
   2098  * Set a priority for a LIF-stack-level: in case two LIF from the same
   2099  * range are found on the same packet.
   2100  */
   2101 extern int bcm_stat_lif_counting_stack_level_priority_set(
   2102     int unit, 
   2103     uint32 flags, 
   2104     bcm_stat_lif_counting_source_t *source, 
   2105     bcm_stat_counter_lif_stack_id_t lif_stack_level, 
   2106     int priority);
   2107 
   2108 /* 
   2109  * Get a priority for a LIF-stack-level: in case two LIF from the same
   2110  * range are found on the same packet.
   2111  */
   2112 extern int bcm_stat_lif_counting_stack_level_priority_get(
   2113     int unit, 
   2114     uint32 flags, 
   2115     bcm_stat_lif_counting_source_t *source, 
   2116     bcm_stat_counter_lif_stack_id_t lif_stack_level, 
   2117     int *priority);
   2118 
   2119 #endif /* BCM_HIDE_DISPATCHABLE */
   2120 
   2121 /* 
   2122  * different types of filters to be filtered in or out by the counter
   2123  * proccesor
   2124  */
   2125 typedef enum bcm_stat_counter_filter_e {
   2126     bcmStatCounterTotalPDsThresholdViolated, /* Total PDs Threshold Violated - for
   2127                                            Egress Receive engine source */
   2128     bcmStatCounterTotalPDsUcPoolSizeThresholdViolated, /* Total PDs Uc Pool Size Threshold
   2129                                            Violated - for Egress Receive engine
   2130                                            source */
   2131     bcmStatCounterPerPortUcPDsThresholdViolated, /* Per Port Uc PDs Threshold Violated -
   2132                                            for Egress Receive engine source */
   2133     bcmStatCounterPerQueueUcPDsThresholdViolated, /* Per Queue Uc PDs Threshold Violated -
   2134                                            for Egress Receive engine source */
   2135     bcmStatCounterPerPortUcDBsThresholdViolated, /* Per Port Uc DBs Threshold Violated -
   2136                                            for Egress Receive engine source */
   2137     bcmStatCounterPerQueueUcDBsThresholdViolated, /* Per Queue Uc DBs Threshold Violated -
   2138                                            for Egress Receive engine source */
   2139     bcmStatCounterPerQueueDisableBit,   /* Stat Counter Per Queue Disable Bit -
   2140                                            for Egress Receive engine source */
   2141     bcmStatCounterTotalPDsMcPoolSizeThresholdViolated, /* Total PDs Mc Pool Size Threshold
   2142                                            Violated - for Egress Receive engine
   2143                                            source */
   2144     bcmStatCounterPerInterfacePDsThreholdViolated, /* Per Interface PDs Threhold Violated -
   2145                                            for Egress Receive engine source */
   2146     bcmStatCounterMcSPThresholdViolated, /* Mc SP Threshold Violated - for Egress
   2147                                            Receive engine source */
   2148     bcmStatCounterPerMcTCThresholdViolated, /* Per Mc TC Threshold Violated - for
   2149                                            Egress Receive engine source */
   2150     bcmStatCounterMcPDsPerPortThresholdViolated, /* Mc PDs Per Port Threshold Violated -
   2151                                            for Egress Receive engine source */
   2152     bcmStatCounterMcPDsPerQueueThresholdViolated, /* Mc PDs Per Queue Threshold Violated -
   2153                                            for Egress Receive engine source */
   2154     bcmStatCounterMcPerPortSizeThresholdViolated, /* Mc Per Port Size Threshold Violated -
   2155                                            for Egress Receive engine source */
   2156     bcmStatCounterMcPerQueueSizeThresholdViolated, /* Mc Per Queue Size Threshold Violated
   2157                                            - for Egress Receive engine source */
   2158     bcmStatCounterGlobalRejectDiscards, /* Global Reject Discards - for Ingress
   2159                                            engine source */
   2160     bcmStatCounterDramRejectDiscards,   /* Dram Reject Discards - for Ingress
   2161                                            engine source */
   2162     bcmStatCounterVoqTailDropDiscards,  /* Voq Tail Drop Discards - for Ingress
   2163                                            engine source */
   2164     bcmStatCounterVoqStatisticsDiscards, /* Voq Statistics Discards - for Ingress
   2165                                            engine source */
   2166     bcmStatCounterVsqTailDropDiscards,  /* Vsq Tail Drop Discards - for Ingress
   2167                                            engine source */
   2168     bcmStatCounterVsqStatisticsDiscards, /* Vsq Statistics Discards - for Ingress
   2169                                            engine source */
   2170     bcmStatCounterQueueNotValidDiscard, /* Queue Not Valid Discard - for Ingress
   2171                                            engine source */
   2172     bcmStatCounterOtherDiscards,        /* Other Discards - for Ingress engine
   2173                                            source */
   2174     bcmStatCounterDropReasonCount       /* Number of Drop Reasons - should
   2175                                            always be last entry */
   2176 } bcm_stat_counter_filter_t;
   2177 
   2178 #define BCM_STAT_COUNTER_TM_COMMAND 0xFF       /* flag for dedicated engine
   2179                                                   using TM command */
   2180 
   2181 #ifndef BCM_HIDE_DISPATCHABLE
   2182 
   2183 /* set counter source to filter in or out certain filter criteria. */
   2184 extern int bcm_stat_counter_filter_set(
   2185     int unit, 
   2186     bcm_stat_counter_source_t source, 
   2187     bcm_stat_counter_filter_t *filter_array, 
   2188     int filter_count, 
   2189     int is_active);
   2190 
   2191 /* 
   2192  * determine which filter criteria a certain counter source is filtering
   2193  * out.
   2194  */
   2195 extern int bcm_stat_counter_filter_get(
   2196     int unit, 
   2197     bcm_stat_counter_source_t source, 
   2198     int filter_max_count, 
   2199     bcm_stat_counter_filter_t *filter_array, 
   2200     int *filter_count);
   2201 
   2202 /* determine if counter is filtering out certain filter criterion. */
   2203 extern int bcm_stat_counter_filter_is_active_get(
   2204     int unit, 
   2205     bcm_stat_counter_source_t source, 
   2206     bcm_stat_counter_filter_t filter, 
   2207     int *is_active);
   2208 
   2209 /* 
   2210  * Get 64 bit counter values array for a multiple (or single if array
   2211  * size=1) statistic types belong to one source counter set.
   2212  */
   2213 extern int bcm_stat_counter_get(
   2214     int unit, 
   2215     uint32 flags, 
   2216     bcm_stat_counter_input_data_t *stat_counter_input_data, 
   2217     bcm_stat_counter_output_data_t *stat_counter_output_data);
   2218 
   2219 #endif /* BCM_HIDE_DISPATCHABLE */
   2220 
   2221 /* Init function to the structure bcm_stat_counter_input_data_t. */
   2222 extern void bcm_stat_counter_input_data_t_init(
   2223     bcm_stat_counter_input_data_t *stat_input_data);
   2224 
   2225 /* Init function to the structure bcm_stat_flex_pool_stat_info_t. */
   2226 extern void bcm_stat_flex_pool_stat_info_t_init(
   2227     bcm_stat_flex_pool_stat_info_t *stat_flex_pool_stat_info);
   2228 
   2229 /* Structure bcm_stat_egress_receive_tm_pointer_format_t */
   2230 typedef struct bcm_stat_egress_receive_tm_pointer_format_s {
   2231     uint32 queue_pair_mask;     /* Which bits to consider from the queue pair
   2232                                    field when building the counter pointer. */
   2233     uint32 traffic_class_mask;  /* Which bits to consider from the traffic class
   2234                                    field when building the counter pointer. */
   2235     uint32 cast_mask;           /* Consider (or not) the cast bit when building
   2236                                    the counter pointer. */
   2237 } bcm_stat_egress_receive_tm_pointer_format_t;
   2238 
   2239 #ifndef BCM_HIDE_DISPATCHABLE
   2240 
   2241 /* 
   2242  * Set the format of the counter pointer that is sent from egress receive
   2243  * tm.
   2244  */
   2245 extern int bcm_stat_egress_receive_tm_pointer_format_set(
   2246     int unit, 
   2247     int flags, 
   2248     bcm_stat_egress_receive_tm_pointer_format_t *pointer_format);
   2249 
   2250 /* 
   2251  * Get the format of the counter pointer that is sent from egress receive
   2252  * tm.
   2253  */
   2254 extern int bcm_stat_egress_receive_tm_pointer_format_get(
   2255     int unit, 
   2256     int flags, 
   2257     bcm_stat_egress_receive_tm_pointer_format_t *pointer_format);
   2258 
   2259 #endif /* BCM_HIDE_DISPATCHABLE */
   2260 
   2261 /* Defines the counter database id and core */
   2262 typedef struct bcm_stat_counter_database_s {
   2263     int database_id;    /* Database id. */
   2264     bcm_core_t core_id; /* Core id. */
   2265 } bcm_stat_counter_database_t;
   2266 
   2267 #define BCM_STAT_DATABASE_CREATE_WITH_ID    0x00000001 /* Create a counter
   2268                                                           database with id */
   2269 
   2270 #ifndef BCM_HIDE_DISPATCHABLE
   2271 
   2272 /* API creates a counter database */
   2273 extern int bcm_stat_counter_database_create(
   2274     int unit, 
   2275     uint32 flags, 
   2276     bcm_core_t core_id, 
   2277     int *database_id);
   2278 
   2279 /* API destroy a counter database */
   2280 extern int bcm_stat_counter_database_destroy(
   2281     int unit, 
   2282     uint32 flags, 
   2283     bcm_stat_counter_database_t *database);
   2284 
   2285 #endif /* BCM_HIDE_DISPATCHABLE */
   2286 
   2287 /* Defines the counter engine id and core */
   2288 typedef struct bcm_stat_engine_s {
   2289     int engine_id;      /* Engine id. */
   2290     bcm_core_t core_id; /* Core id. Must give explicit core. */
   2291 } bcm_stat_engine_t;
   2292 
   2293 /* 
   2294  * Enable/disable the engines belong to the database - counting and
   2295  * eviction.
   2296  */
   2297 typedef struct bcm_stat_counter_enable_s {
   2298     int enable_counting;    /* Engine input - if set, the engine may receive
   2299                                counter pointers and can count. */
   2300     int enable_eviction;    /* Engine output - if set the engine eviction
   2301                                mechanism (scanner) works and counters evicted to
   2302                                the relevant DMA FIFO. */
   2303 } bcm_stat_counter_enable_t;
   2304 
   2305 #ifndef BCM_HIDE_DISPATCHABLE
   2306 
   2307 /* 
   2308  * API enable/disable the engines belong to the database - counting and
   2309  * eviction (input and output). Enable should be made after configure all
   2310  * parameters of the database.
   2311  */
   2312 extern int bcm_stat_counter_database_enable_set(
   2313     int unit, 
   2314     uint32 flags, 
   2315     bcm_stat_counter_database_t *database, 
   2316     bcm_stat_counter_enable_t *enable);
   2317 
   2318 /* determine the enabler status of the database. */
   2319 extern int bcm_stat_counter_database_enable_get(
   2320     int unit, 
   2321     uint32 flags, 
   2322     bcm_stat_counter_database_t *database, 
   2323     bcm_stat_counter_enable_t *enable);
   2324 
   2325 /* API attach new engine to database */
   2326 extern int bcm_stat_counter_engine_attach(
   2327     int unit, 
   2328     uint32 flags, 
   2329     bcm_stat_counter_database_t *database, 
   2330     int engine_id);
   2331 
   2332 /* API detach engine from database */
   2333 extern int bcm_stat_counter_engine_detach(
   2334     int unit, 
   2335     uint32 flags, 
   2336     bcm_stat_counter_database_t *database, 
   2337     int engine_id);
   2338 
   2339 #endif /* BCM_HIDE_DISPATCHABLE */
   2340 
   2341 /* Enum which defines the engine control options */
   2342 typedef enum bcm_stat_counter_engine_control_e {
   2343     bcmStatCounterClearAll = 0,         /* Clear all counters belong to an
   2344                                            engine. clear HW/SW counters. (depend
   2345                                            on the flags. default is both, but
   2346                                            not simultaneously) */
   2347     bcmStatCounterSequentialSamplingInterval = 1, /* Setting the sequential sampling
   2348                                            interval. micro-seconds units */
   2349     bcmStatCounterEngineEvictionEnable = 2 /* Enable/Disable HW eviction for a
   2350                                            specific engine */
   2351 } bcm_stat_counter_engine_control_t;
   2352 
   2353 /* Enum which defines the counter database control options. */
   2354 typedef enum bcm_stat_counter_database_control_e {
   2355     bcmStatCounterDatabaseClearAll = 0, /* Clear all counters belong to a
   2356                                            database. clear HW/SW counters.
   2357                                            (depend on the flags. default is
   2358                                            both, but not simultaneously) */
   2359     bcmStatCounterOverflowMode = 1      /* Allow the user to choose the counter
   2360                                            overflow mode */
   2361 } bcm_stat_counter_database_control_t;
   2362 
   2363 #define BCM_STAT_COUNTER_CONTROL_CLEAR_SW_ONLY 0x1        /* Refer to control enum
   2364                                                           bcmStatCounterClearAll
   2365                                                           - clear only SW
   2366                                                           counters memory. */
   2367 #define BCM_STAT_COUNTER_CONTROL_CLEAR_HW_ONLY 0x2        /* Refer to control enum
   2368                                                           bcmStatCounterClearAll
   2369                                                           - clear only HW
   2370                                                           counters memory. */
   2371 
   2372 #ifndef BCM_HIDE_DISPATCHABLE
   2373 
   2374 /* 
   2375  * API which control some counter engine operations on genral crps
   2376  * operations.
   2377  */
   2378 extern int bcm_stat_counter_engine_control_set(
   2379     int unit, 
   2380     uint32 flags, 
   2381     bcm_stat_engine_t *engine, 
   2382     bcm_stat_counter_engine_control_t control, 
   2383     uint32 arg);
   2384 
   2385 /* 
   2386  * Get the value of one control element. Can't be used for enum
   2387  * bcmStatCounterClearAll.
   2388  */
   2389 extern int bcm_stat_counter_engine_control_get(
   2390     int unit, 
   2391     uint32 flags, 
   2392     bcm_stat_engine_t *engine, 
   2393     bcm_stat_counter_engine_control_t control, 
   2394     uint32 *arg);
   2395 
   2396 /* API which control some counter database operations. */
   2397 extern int bcm_stat_counter_database_control_set(
   2398     int unit, 
   2399     uint32 flags, 
   2400     bcm_stat_counter_database_t *database, 
   2401     bcm_stat_counter_database_control_t control, 
   2402     uint32 arg);
   2403 
   2404 /* 
   2405  * Get the value of one control counter database element. Can't be used
   2406  * for enum bcmStatCounterClearAll.
   2407  */
   2408 extern int bcm_stat_counter_database_control_get(
   2409     int unit, 
   2410     uint32 flags, 
   2411     bcm_stat_counter_database_t *database, 
   2412     bcm_stat_counter_database_control_t control, 
   2413     uint32 *arg);
   2414 
   2415 #endif /* BCM_HIDE_DISPATCHABLE */
   2416 
   2417 #define BCM_STAT_MAX_NUMBER_OF_OBJECT_TYPES 4          /* Defines the number of
   2418                                                           object types */
   2419 
   2420 /* Define the counting source of a counter engine. */
   2421 typedef enum bcm_stat_counter_interface_type_e {
   2422     bcmStatCounterInterfaceIngressReceivePp = 0, 
   2423     bcmStatCounterInterfaceIngressOam = 1, 
   2424     bcmStatCounterInterfaceIngressVoq = 2, 
   2425     bcmStatCounterInterfaceIngressTransmitPp = 3, 
   2426     bcmStatCounterInterfaceEgressReceivePp = 4, 
   2427     bcmStatCounterInterfaceEgressReceiveQueue = 5, 
   2428     bcmStatCounterInterfaceEgressTransmitPp = 6, 
   2429     bcmStatCounterInterfaceEgressOam = 7, 
   2430     bcmStatCounterInterfaceOamp = 8, 
   2431     bcmStatCounterInterfaceCount = 9 
   2432 } bcm_stat_counter_interface_type_t;
   2433 
   2434 /* Set of counter engine parameters per type. */
   2435 typedef struct bcm_stat_counter_type_config_s {
   2436     uint32 valid;               /* Defines type addmission to an engine. */
   2437     uint32 object_type_offset;  /* Counter offset for the type which is add in
   2438                                    the counter mapping process.
   2439                                    units=object-stat-id */
   2440     int start;                  /* Holds the base counter pointer that the
   2441                                    engine should refer to. units=object-stat-id.
   2442                                    If the engine is concatenate to other engines
   2443                                    (prev or next), the range (start/end) should
   2444                                    be the same for all engines in the
   2445                                    'engines-link-list' and it should refer to
   2446                                    the total range that need to count. (driver
   2447                                    will calculate the specific range for each
   2448                                    engine) */
   2449     int end;                    /* Holds the last object-stat-id pointer that
   2450                                    the engine should refer to.
   2451                                    units=object-stat-id. If the engine is
   2452                                    concatenate to other engines (prev or next),
   2453                                    the range (start/end) should be the same for
   2454                                    all engines in the 'engines-link-list' and it
   2455                                    should refer to the total range that need to
   2456                                    count. (driver will calculate the specific
   2457                                    range for each engine) */
   2458 } bcm_stat_counter_type_config_t;
   2459 
   2460 /* Defines the counter engine id and core */
   2461 typedef struct bcm_stat_counter_interface_s {
   2462     bcm_stat_counter_interface_type_t source; /* Counting source. */
   2463     int command_id;                     /* Command id (interface id). */
   2464     bcm_stat_counter_type_config_t type_config[BCM_STAT_MAX_NUMBER_OF_OBJECT_TYPES]; /* Set of parameters configured per
   2465                                            object type. */
   2466     bcm_stat_counter_format_type_t format_type; /* Format of the counter and it
   2467                                            arithmetic action. */
   2468     int counter_set_size;               /* The size of the counter set. */
   2469 } bcm_stat_counter_interface_t;
   2470 
   2471 #define BCM_STAT_COUNTER_MODIFY_RANGE_ONLY  0x00000001 /* Allow to change only
   2472                                                           the range and the
   2473                                                           parameter
   2474                                                           next_consecutive_engine_id
   2475                                                           per type on the fly,
   2476                                                           while engine is
   2477                                                           active. */
   2478 #define BCM_STAT_COUNTER_END_TO_END_LATENCY 0x00000002 /* If flag set, driver
   2479                                                           select the latency
   2480                                                           value as an input to
   2481                                                           the engine, otherwise
   2482                                                           select packet size. */
   2483 
   2484 #ifndef BCM_HIDE_DISPATCHABLE
   2485 
   2486 /* API is used to configure the database interface. */
   2487 extern int bcm_stat_counter_interface_set(
   2488     int unit, 
   2489     uint32 flags, 
   2490     bcm_stat_counter_database_t *database, 
   2491     bcm_stat_counter_interface_t *config);
   2492 
   2493 /* API is used to get the database interface configuration. */
   2494 extern int bcm_stat_counter_interface_get(
   2495     int unit, 
   2496     uint32 flags, 
   2497     bcm_stat_counter_database_t *database, 
   2498     bcm_stat_counter_interface_t *config);
   2499 
   2500 #endif /* BCM_HIDE_DISPATCHABLE */
   2501 
   2502 /* Enum of the fields(types) that can be used in the expansion format. */
   2503 typedef enum bcm_stat_expansion_types_e {
   2504     bcmStatExpansionTypeTmDropReason = 0, 
   2505     bcmStatExpansionTypeDispositionIsDrop = 1, 
   2506     bcmStatExpansionTypeDropPrecedenceMeter0Valid = 2, 
   2507     bcmStatExpansionTypeDropPrecedenceMeter0Value = 3, 
   2508     bcmStatExpansionTypeDropPrecedenceMeter1Valid = 4, 
   2509     bcmStatExpansionTypDropPrecedenceMeter1Value = 5, 
   2510     bcmStatExpansionTypeDropPrecedenceMeter2Valid = 6, 
   2511     bcmStatExpansionTypeDropPrecedenceMeter2Value = 7, 
   2512     bcmStatExpansionTypeTrafficClass = 8, 
   2513     bcmStatExpansionTypeDropPrecedenceMeterResolved = 9, /* Final dp. */
   2514     bcmStatExpansionTypeDropPrecedenceInput = 10, 
   2515     bcmStatExpansionTypeSystemMultiCast = 11, 
   2516     bcmStatExpansionTypeEcnEligibleAndCni = 12, 
   2517     bcmStatExpansionTypePortMetaData = 13, 
   2518     bcmStatExpansionTypePpDropReason = 14, 
   2519     bcmStatExpansionTypeMetaData = 15, 
   2520     bcmStatExpansionTypeDiscardPp = 16, 
   2521     bcmStatExpansionTypeDiscardTm = 17, 
   2522     bcmStatExpansionTypeEgressTmActionType = 18, 
   2523     bcmStatExpansionTypeLatencyBin = 19, 
   2524     bcmStatExpansionTypeLatencyFlowProfile = 20, 
   2525     bcmStatExpansionTypeTmLastCopy = 21, 
   2526     bcmStatExpansionTypeMax = 22 
   2527 } bcm_stat_expansion_types_t;
   2528 
   2529 /* Defines the counter interface key. */
   2530 typedef struct bcm_stat_counter_interface_key_s {
   2531     bcm_core_t core_id;                 /* Core id explicit. */
   2532     bcm_stat_counter_interface_type_t interface_source; /* Source. */
   2533     int command_id;                     /* Command id. */
   2534     int type_id;                        /* Object type id [0..3] . */
   2535 } bcm_stat_counter_interface_key_t;
   2536 
   2537 /* Define the type and bitmap (if relevant) for each expansion element. */
   2538 typedef struct bcm_stat_expansion_element_s {
   2539     bcm_stat_expansion_types_t type; 
   2540     uint32 bitmap;                      /* Select specific bits from the type
   2541                                            for the expansion. relevant only if
   2542                                            user selected metadata or
   2543                                            portMetaData types. */
   2544 } bcm_stat_expansion_element_t;
   2545 
   2546 /* Defines the expansion selection elements. */
   2547 typedef struct bcm_stat_expansion_select_s {
   2548     int nof_elements;                   /* Nof elements. */
   2549     bcm_stat_expansion_element_t expansion_elements[bcmStatExpansionTypeMax]; /* Array which selects the expansion 
   2550                                            types (and bitmaps) that will
   2551                                            generate the expansion. */
   2552 } bcm_stat_expansion_select_t;
   2553 
   2554 #ifndef BCM_HIDE_DISPATCHABLE
   2555 
   2556 /* 
   2557  * API is used to configure the expansion selection per interface.It is
   2558  * not allowed to create different expansions for different types belong
   2559  * to the same interface, if the types are access to the same engine.
   2560  */
   2561 extern int bcm_stat_counter_expansion_select_set(
   2562     int unit, 
   2563     uint32 flags, 
   2564     bcm_stat_counter_interface_key_t *interface, 
   2565     bcm_stat_expansion_select_t *expansion_select);
   2566 
   2567 /* API is used to get the expansion selection configuration. */
   2568 extern int bcm_stat_counter_expansion_select_get(
   2569     int unit, 
   2570     uint32 flags, 
   2571     bcm_stat_counter_interface_key_t *interface, 
   2572     bcm_stat_expansion_select_t *expansion_select);
   2573 
   2574 #endif /* BCM_HIDE_DISPATCHABLE */
   2575 
   2576 #define BCM_STAT_COUNTER_MAPPING_FULL_SPREAD 0x1        /* Used to configure full
   2577                                                           spread for the entire
   2578                                                           expansion. All other
   2579                                                           parameters in the
   2580                                                           strucutre
   2581                                                           bcm_stat_counter_set_map_t
   2582                                                           are ignored.This flag
   2583                                                           is allowed only if the
   2584                                                           expansion is no bigger
   2585                                                           than 5 bits */
   2586 
   2587 /* 
   2588  * Expansion data key. use it to determine the entry to the HW expansion
   2589  * data table.
   2590  */
   2591 typedef struct bcm_stat_expansion_data_key_s {
   2592     bcm_stat_expansion_types_t type;    /* Type/filed from the expansion
   2593                                            selection. */
   2594     int value;                          /* Value for the type. -1 refer to all
   2595                                            values. */
   2596 } bcm_stat_expansion_data_key_t;
   2597 
   2598 /* Defines the value of the HW expansion data mapping table. */
   2599 typedef struct bcm_stat_expansion_data_value_s {
   2600     int counter_set_offset; /* Counter set offset. */
   2601     int valid;              /* Admission for this expansion data(value). */
   2602 } bcm_stat_expansion_data_value_t;
   2603 
   2604 #define BCM_STAT_MAX_NOF_EXPANSION_KEY_ELEMENTS 0x7        /* max size of elements
   2605                                                           that create the
   2606                                                           key(entry) for the
   2607                                                           data expansion table. */
   2608 
   2609 /* 
   2610  * Defines the set of conditions that will generate the exact key for the
   2611  * HW data mapping table, and set it's value.
   2612  */
   2613 typedef struct bcm_stat_expansion_data_mapping_s {
   2614     int nof_key_conditions;             /* max bcmStatExpansionTypeMax. */
   2615     bcm_stat_expansion_data_key_t key[BCM_STAT_MAX_NOF_EXPANSION_KEY_ELEMENTS]; /* Build the key from number of type
   2616                                            values. */
   2617     bcm_stat_expansion_data_value_t value; /* Set the output value of the table
   2618                                            {admission and counter set offset}. */
   2619 } bcm_stat_expansion_data_mapping_t;
   2620 
   2621 /* 
   2622  * Defines the counter set size of the engine and the counter set
   2623  * mapping.
   2624  */
   2625 typedef struct bcm_stat_counter_set_map_s {
   2626     int nof_entries;                    /* Nof entries to the expansion data
   2627                                            mapping array. */
   2628     bcm_stat_expansion_data_mapping_t *expansion_data_mapping; /* Data mapping array. max size=1024. */
   2629 } bcm_stat_counter_set_map_t;
   2630 
   2631 #ifndef BCM_HIDE_DISPATCHABLE
   2632 
   2633 /* API determine the counter set mapping. */
   2634 extern int bcm_stat_counter_set_mapping_set(
   2635     int unit, 
   2636     uint32 flags, 
   2637     bcm_stat_counter_database_t *database, 
   2638     bcm_stat_counter_set_map_t *counter_set_map);
   2639 
   2640 /* API get the counter set mapping. */
   2641 extern int bcm_stat_counter_set_mapping_get(
   2642     int unit, 
   2643     uint32 flags, 
   2644     bcm_stat_counter_database_t *database, 
   2645     bcm_stat_counter_set_map_t *counter_set_map);
   2646 
   2647 #endif /* BCM_HIDE_DISPATCHABLE */
   2648 
   2649 /* Destination types for each dma fifo. */
   2650 typedef enum bcm_eviction_destination_type_e {
   2651     bcmStatEvictionDestinationLocalHost = 0 
   2652 } bcm_eviction_destination_type_t;
   2653 
   2654 /* Eviction record format enum. */
   2655 typedef enum bcm_eviction_record_format_e {
   2656     bcmStatEvictionRecordFormatPhysical = 0, 
   2657     bcmStatEvictionRecordFormatLogical = 1 
   2658 } bcm_eviction_record_format_t;
   2659 
   2660 /* Holds the configuration of the eviction per engine. */
   2661 typedef struct bcm_stat_eviction_s {
   2662     int dma_fifo_select;                /* dma fifo to select. */
   2663     bcm_eviction_destination_type_t type; /* Dest type. */
   2664     bcm_eviction_record_format_t record_format; /* (physical, logical). */
   2665     int eviction_event_id;              /* Relevant only for logical format. */
   2666 } bcm_stat_eviction_t;
   2667 
   2668 #ifndef BCM_HIDE_DISPATCHABLE
   2669 
   2670 /* API to set the engine eviction configuration . */
   2671 extern int bcm_stat_counter_eviction_set(
   2672     int unit, 
   2673     uint32 flags, 
   2674     bcm_stat_engine_t *engine, 
   2675     bcm_stat_eviction_t *eviction);
   2676 
   2677 /* API to get the engine eviction configuration. */
   2678 extern int bcm_stat_counter_eviction_get(
   2679     int unit, 
   2680     uint32 flags, 
   2681     bcm_stat_engine_t *engine, 
   2682     bcm_stat_eviction_t *eviction);
   2683 
   2684 #endif /* BCM_HIDE_DISPATCHABLE */
   2685 
   2686 #define BCM_STAT_COUNTER_CLEAR_ON_READ  0x1        /* Used to clear on read SW
   2687                                                       counters */
   2688 
   2689 /* 
   2690  * Configuration of statistics to get, from a counter_set and engine
   2691  * which defined explicitly.
   2692  */
   2693 typedef struct bcm_stat_counter_explicit_input_data_s {
   2694     bcm_stat_engine_t engine; 
   2695     int object_stat_id;         /* The counter pointer that is being sent to the
   2696                                    counter processor. */
   2697     int type_id; 
   2698     int nstat; 
   2699     int *stat_arr; 
   2700 } bcm_stat_counter_explicit_input_data_t;
   2701 
   2702 #ifndef BCM_HIDE_DISPATCHABLE
   2703 
   2704 /* 
   2705  * API gets array of statistics for explicit counter_set and engine,
   2706  * given by the user.
   2707  */
   2708 extern int bcm_stat_counter_explicit_get(
   2709     int unit, 
   2710     uint32 flags, 
   2711     bcm_stat_counter_explicit_input_data_t *stat_counter_input_data, 
   2712     bcm_stat_counter_output_data_t *stat_counter_output_data);
   2713 
   2714 #endif /* BCM_HIDE_DISPATCHABLE */
   2715 
   2716 /* init bcm_stat_engine_t */
   2717 extern void bcm_stat_engine_t_init(
   2718     bcm_stat_engine_t *stat_engine);
   2719 
   2720 /* init bcm_stat_counter_database_t */
   2721 extern void bcm_stat_counter_database_t_init(
   2722     bcm_stat_counter_database_t *stat_counter_database);
   2723 
   2724 /* init bcm_stat_counter_explicit_input_data_t */
   2725 extern void bcm_stat_counter_explicit_input_data_t_init(
   2726     bcm_stat_counter_explicit_input_data_t *stat_counter_explicit_input_data);
   2727 
   2728 /* init bcm_stat_eviction_t */
   2729 extern void bcm_stat_eviction_t_init(
   2730     bcm_stat_eviction_t *stat_eviction);
   2731 
   2732 /* init bcm_stat_counter_set_map_t */
   2733 extern void bcm_stat_counter_set_map_t_init(
   2734     bcm_stat_counter_set_map_t *stat_counter_set_map);
   2735 
   2736 /* init bcm_stat_expansion_data_mapping_t */
   2737 extern void bcm_stat_expansion_data_mapping_t_init(
   2738     bcm_stat_expansion_data_mapping_t *stat_expansion_data_mapping);
   2739 
   2740 /* init bcm_stat_counter_interface_key_t */
   2741 extern void bcm_stat_counter_interface_key_t_init(
   2742     bcm_stat_counter_interface_key_t *stat_counter_interface_key);
   2743 
   2744 /* init bcm_stat_expansion_select_t */
   2745 extern void bcm_stat_expansion_select_t_init(
   2746     bcm_stat_expansion_select_t *stat_expansion_select);
   2747 
   2748 /* init bcm_stat_counter_interface_t */
   2749 extern void bcm_stat_counter_interface_t_init(
   2750     bcm_stat_counter_interface_t *stat_counter_interface);
   2751 
   2752 /* init bcm_stat_counter_enable_t */
   2753 extern void bcm_stat_counter_enable_t_init(
   2754     bcm_stat_counter_enable_t *stat_counter_enable);
   2755 
   2756 /* init bcm_stat_counter_output_data_t */
   2757 extern void bcm_stat_counter_output_data_t_init(
   2758     bcm_stat_counter_output_data_t *stat_counter_output_data);
   2759 
   2760 typedef struct bcm_stat_eviction_boundaries_s {
   2761     int start; 
   2762     int end; 
   2763 } bcm_stat_eviction_boundaries_t;
   2764 
   2765 /* Return sequential eviction boundaries to the default values. */
   2766 #define BCM_STAT_EVICTION_RANGE_ALL 0x00000001 
   2767 
   2768 #ifndef BCM_HIDE_DISPATCHABLE
   2769 
   2770 /* Modify sequential boundaries. */
   2771 extern int bcm_stat_eviction_boundaries_set(
   2772     int unit, 
   2773     uint32 flags, 
   2774     bcm_stat_engine_t *engine, 
   2775     bcm_stat_eviction_boundaries_t *boundaries);
   2776 
   2777 /* Get the values of the sequential boundaries. */
   2778 extern int bcm_stat_eviction_boundaries_get(
   2779     int unit, 
   2780     uint32 flags, 
   2781     bcm_stat_engine_t *engine, 
   2782     bcm_stat_eviction_boundaries_t *boundaries);
   2783 
   2784 #endif /* BCM_HIDE_DISPATCHABLE */
   2785 
   2786 /* 
   2787  * Defines the types (that user can select) of packet size adjustment per
   2788  * stat source block.
   2789  */
   2790 typedef enum bcm_stat_pkt_size_adjust_select_type_e {
   2791     bcmStatPktSizeSelectCounterIngressHeaderTruncate = 0 
   2792 } bcm_stat_pkt_size_adjust_select_type_t;
   2793 
   2794 /* 
   2795  * Defines the key parameters to select a packet size adjustment type
   2796  * (For counter processor, per source and command_id)
   2797  */
   2798 typedef struct bcm_stat_counter_command_id_key_s {
   2799     bcm_core_t core_id;                 /* Support specific core or ALL. */
   2800     bcm_stat_counter_interface_type_t source; /* Select source. */
   2801     int command_id;                     /* Select the command id. */
   2802 } bcm_stat_counter_command_id_key_t;
   2803 
   2804 #ifndef BCM_HIDE_DISPATCHABLE
   2805 
   2806 /* 
   2807  * Enable/disable a packet size adjustment type (currently just
   2808  * header-truncate), for ingress packet size adjustment calculation
   2809  * (compensation).
   2810  */
   2811 extern int bcm_stat_pkt_size_adjust_select_set(
   2812     int unit, 
   2813     int flags, 
   2814     bcm_stat_counter_command_id_key_t *key, 
   2815     bcm_stat_pkt_size_adjust_select_type_t select_type, 
   2816     int enable);
   2817 
   2818 /* 
   2819  * Get if packet size adjustment type is enabled or disabled according to
   2820  * the given key.
   2821  */
   2822 extern int bcm_stat_pkt_size_adjust_select_get(
   2823     int unit, 
   2824     int flags, 
   2825     bcm_stat_counter_command_id_key_t *key, 
   2826     bcm_stat_pkt_size_adjust_select_type_t select_type, 
   2827     int *enable);
   2828 
   2829 #endif /* BCM_HIDE_DISPATCHABLE */
   2830 
   2831 #define BCM_STAT_COUNTER_OVERFLOW_MODE_RESET 0          /* Refer to control enum
   2832                                                           bcmStatCounterOverflowMode
   2833                                                           - reset to 0. */
   2834 #define BCM_STAT_COUNTER_OVERFLOW_MODE_WRAP_AROUND 1          /* Refer to control enum
   2835                                                           bcmStatCounterOverflowMode
   2836                                                           - handle overflow for
   2837                                                           source OAM. */
   2838 #define BCM_STAT_COUNTER_OVERFLOW_MODE_FIXED_AT_MAX 2          /* Refer to control enum
   2839                                                           bcmStatCounterOverflowMode
   2840                                                           - use mode stuck all
   2841                                                           at ones. */
   2842 
   2843 /* Filter groups */
   2844 typedef enum bcm_stat_counter_group_filter_e {
   2845     bcmStatCounterGroupFilterGlobalResourcesDrop = 0, 
   2846     bcmStatCounterGroupFilterVoqResourcesDrop = 1, 
   2847     bcmStatCounterGroupFilterWredDrop = 2, 
   2848     bcmStatCounterGroupFilterOcbResourcesDrop = 3, 
   2849     bcmStatCounterGroupFilterVsqResourcesDrop = 4, 
   2850     bcmStatCounterGroupFilterLatencyDrop = 5, 
   2851     bcmStatCounterGroupFilterMiscDrop = 6, 
   2852     bcmStatCounterGroupFilterUserDefinedGroup = 7, 
   2853     bcmStatCounterGroupFilterCount = 8 
   2854 } bcm_stat_counter_group_filter_t;
   2855 
   2856 #ifndef BCM_HIDE_DISPATCHABLE
   2857 
   2858 /* Set counter source to filter in or out certain filter criteria. */
   2859 extern int bcm_stat_counter_filter_group_set(
   2860     int unit, 
   2861     uint32 flags, 
   2862     bcm_stat_counter_command_id_key_t *key, 
   2863     bcm_stat_counter_group_filter_t filter, 
   2864     int is_active);
   2865 
   2866 /* Determine if given filter criteria is active or not. */
   2867 extern int bcm_stat_counter_filter_group_get(
   2868     int unit, 
   2869     uint32 flags, 
   2870     bcm_stat_counter_command_id_key_t *key, 
   2871     bcm_stat_counter_group_filter_t filter, 
   2872     int *is_active);
   2873 
   2874 #endif /* BCM_HIDE_DISPATCHABLE */
   2875 
   2876 /* init bcm_stat_counter_command_id_key_t */
   2877 extern void bcm_stat_counter_command_id_key_t_init(
   2878     bcm_stat_counter_command_id_key_t *stat_counter_command_id_key);
   2879 
   2880 /* init bcm_stat_eviction_boundaries_t */
   2881 extern void bcm_stat_eviction_boundaries_t_init(
   2882     bcm_stat_eviction_boundaries_t *stat_eviction_boundaries);
   2883 
   2884 #define BCM_STAT_EXTERNAL       0x00000001 
   2885 
   2886 #define BCM_STAT_FULL_MASK      0xFFFFFFFF /* mask the whole field */
   2887 
   2888 #define BCM_STAT_INGRESS        0x1        
   2889 #define BCM_STAT_EGRESS         0x2        
   2890 
   2891 /* List of elements that build the statistics interface record format */
   2892 typedef enum bcm_stat_stif_record_element_type_e {
   2893     bcmStatStifRecordElementObj0 = 0,   /* mask=BCM_STAT_FULL_MASK must be set */
   2894     bcmStatStifRecordElementObj1 = 1,   /* mask=BCM_STAT_FULL_MASK must be set */
   2895     bcmStatStifRecordElementObj2 = 2,   /* mask=BCM_STAT_FULL_MASK must be set */
   2896     bcmStatStifRecordElementObj3 = 3,   /*  mask=BCM_STAT_FULL_MASK must be set */
   2897     bcmStatStifRecordElementPacketSize = 4, /* mask=BCM_STAT_FULL_MASK must be set */
   2898     bcmStatStifRecordElementOpCode = 5, /* mask=BCM_STAT_FULL_MASK must be used.
   2899                                            8 bits represent 4 objs opCode */
   2900     bcmStatStifRecordElementIngressDispositionIsDrop = 6, 
   2901     bcmStatStifRecordElementIngressTmDropReason = 7, 
   2902     bcmStatStifRecordElementIngressTrafficClass = 8, 
   2903     bcmStatStifRecordElementIngressIncomingDropPrecedence = 9, 
   2904     bcmStatStifRecordElementIngressDropPrecedenceMeterResolved = 10, 
   2905     bcmStatStifRecordElementIngressDropPrecedenceMeter0Valid = 11, 
   2906     bcmStatStifRecordElementIngressDropPrecedenceMeter0Value = 12, 
   2907     bcmStatStifRecordElementIngressDropPrecedenceMeter1Valid = 13, 
   2908     bcmStatStifRecordElementIngressDropPrecedenceMeter1Value = 14, 
   2909     bcmStatStifRecordElementIngressDropPrecedenceMeter2Valid = 15, 
   2910     bcmStatStifRecordElementIngressDropPrecedenceMeter2Value = 16, 
   2911     bcmStatStifRecordElementIngressCore = 17, 
   2912     bcmStatStifRecordElementIngressPpMetaData = 18, 
   2913     bcmStatStifRecordElementIngressQueueNumber = 19, 
   2914     bcmStatStifRecordElementEgressMetaDataMultiCast = 20, /* mask=BCM_STAT_FULL_MASK must be set */
   2915     bcmStatStifRecordElementEgressMetaDataPpDropReason = 21, /* mask=BCM_STAT_FULL_MASK must be set */
   2916     bcmStatStifRecordElementEgressMetaDataPort = 22, /* mask=BCM_STAT_FULL_MASK must be set */
   2917     bcmStatStifRecordElementEgressMetaDataEcnEligibleAndCni = 23, /* mask=BCM_STAT_FULL_MASK must be set */
   2918     bcmStatStifRecordElementEgressMetaDataTrafficClass = 24, /* mask=BCM_STAT_FULL_MASK must be set */
   2919     bcmStatStifRecordElementEgressMetaDataDropPrecedence = 25, /* mask=BCM_STAT_FULL_MASK must be set */
   2920     bcmStatStifRecordElementEgressMetaDataObj0 = 26, /* mask=BCM_STAT_FULL_MASK must be set */
   2921     bcmStatStifRecordElementEgressMetaDataObj1 = 27, /* mask=BCM_STAT_FULL_MASK must be set */
   2922     bcmStatStifRecordElementEgressMetaDataObj2 = 28, /* mask=BCM_STAT_FULL_MASK must be set */
   2923     bcmStatStifRecordElementEgressMetaDataObj3 = 29, /* mask=BCM_STAT_FULL_MASK must be set */
   2924     bcmStatStifRecordElementEgressMetaDataCore = 30 /* mask=BCM_STAT_FULL_MASK must be set */
   2925 } bcm_stat_stif_record_element_type_t;
   2926 
   2927 /* 
   2928  * Structure holds one element and its position, in the statistics
   2929  * interface record format
   2930  */
   2931 typedef struct bcm_stat_stif_record_format_element_s {
   2932     bcm_stat_stif_record_element_type_t element_type; 
   2933     uint32 mask; 
   2934 } bcm_stat_stif_record_format_element_t;
   2935 
   2936 #ifndef BCM_HIDE_DISPATCHABLE
   2937 
   2938 /* 
   2939  * API set the statistics interface record format (for billing mode
   2940  * INGRESS or EGRESS).
   2941  */
   2942 extern int bcm_stat_stif_record_format_set(
   2943     int unit, 
   2944     int flags, 
   2945     int nof_elements, 
   2946     bcm_stat_stif_record_format_element_t *record_format_elements);
   2947 
   2948 /* 
   2949  * API get the statistics interface record format (for billing mode
   2950  * INGRESS or EGRESS).
   2951  */
   2952 extern int bcm_stat_stif_record_format_get(
   2953     int unit, 
   2954     int flags, 
   2955     int max_nof_elements, 
   2956     bcm_stat_stif_record_format_element_t *elements_array, 
   2957     int *nof_elements);
   2958 
   2959 #endif /* BCM_HIDE_DISPATCHABLE */
   2960 
   2961 /* 
   2962  * List of statistics interface sources that generate the statistics
   2963  * records.
   2964  */
   2965 typedef enum bcm_stat_stif_source_type_e {
   2966     bcmStatStifSourceIngressEnqueue = 0, 
   2967     bcmStatStifSourceIngressDequeue = 1, 
   2968     bcmStatStifSourceIngressScrubber = 2, 
   2969     bcmStatStifSourceEgressDequeue = 3 
   2970 } bcm_stat_stif_source_type_t;
   2971 
   2972 /* 
   2973  * Structure hold one statistic interface source which generate
   2974  * statistics records.
   2975  */
   2976 typedef struct bcm_stat_stif_source_s {
   2977     bcm_core_t core; 
   2978     bcm_stat_stif_source_type_t src_type; 
   2979 } bcm_stat_stif_source_t;
   2980 
   2981 #ifndef BCM_HIDE_DISPATCHABLE
   2982 
   2983 /* 
   2984  * API map statistics source (statistics interface source) to logical
   2985  * port. port=invalid means disconnect the source.
   2986  */
   2987 extern int bcm_stat_stif_source_mapping_set(
   2988     int unit, 
   2989     int flags, 
   2990     bcm_stat_stif_source_t source, 
   2991     bcm_port_t port);
   2992 
   2993 /* 
   2994  * API get the mapping of statistics source to its logical port.
   2995  * port=invalid means that the source is disconnected.
   2996  */
   2997 extern int bcm_stat_stif_source_mapping_get(
   2998     int unit, 
   2999     int flags, 
   3000     bcm_stat_stif_source_t source, 
   3001     bcm_port_t *port);
   3002 
   3003 #endif /* BCM_HIDE_DISPATCHABLE */
   3004 
   3005 /* List of stat control types. */
   3006 typedef enum bcm_stat_control_e {
   3007     bcmStatControlStifFcEnable = 0, 
   3008     bcmStatControlCounterThreadEnable = 1 /* General enabler for the SW BG thread
   3009                                            of counter collecting. Irelevant for
   3010                                            specific engine. (one thread for all
   3011                                            engines) */
   3012 } bcm_stat_control_t;
   3013 
   3014 #ifndef BCM_HIDE_DISPATCHABLE
   3015 
   3016 /* API stat control set. */
   3017 extern int bcm_stat_control_set(
   3018     int unit, 
   3019     int flags, 
   3020     bcm_stat_control_t type, 
   3021     int arg);
   3022 
   3023 /* API stat control get. */
   3024 extern int bcm_stat_control_get(
   3025     int unit, 
   3026     int flags, 
   3027     bcm_stat_control_t type, 
   3028     int *arg);
   3029 
   3030 #endif /* BCM_HIDE_DISPATCHABLE */
   3031 
   3032 /* Stat Flex Counter Information */
   3033 typedef struct bcm_stat_custom_counter_info_s {
   3034     uint32 ctr_tbl_mode_id;         /* Counter table Mode Identifier */
   3035     uint32 ctr_tbl_pool_id;         /* Counter table Pool Id */
   3036     uint32 ctr_tbl_pool_base_idx;   /* Counter table Pool Base Index */
   3037     uint32 offset_tbl_base_idx;     /* Offset table Pool Base Index */
   3038     uint32 num_counters;            /* Number of counter entries created */
   3039     uint32 stat_counter_id;         /* Stat Counter Id */
   3040     bcm_stat_object_t object;       /* Stat Accounting object */
   3041 } bcm_stat_custom_counter_info_t;
   3042 
   3043 #ifndef BCM_HIDE_DISPATCHABLE
   3044 
   3045 /* 
   3046  * Associate an accounting object to customized group mode with user
   3047  * configured pool id.
   3048  */
   3049 extern int bcm_stat_custom_group_id_create(
   3050     int unit, 
   3051     uint32 mode_id, 
   3052     bcm_stat_object_t object, 
   3053     uint32 pool_id, 
   3054     uint32 base_idx, 
   3055     bcm_stat_custom_counter_info_t *counter_info);
   3056 
   3057 #endif /* BCM_HIDE_DISPATCHABLE */
   3058 
   3059 /* bcm_stat_custom_base_index_action_e */
   3060 typedef enum bcm_stat_custom_base_index_action_e {
   3061     bcmStatCustomBaseIdxAlloc = 0,  /* Counter Base Index Alloc */
   3062     bcmStatCustomBaseIdxMove = 1    /* Counter Base Index Move */
   3063 } bcm_stat_custom_base_index_action_t;
   3064 
   3065 #ifndef BCM_HIDE_DISPATCHABLE
   3066 
   3067 /* 
   3068  * This function is used to move the old set of counters to new free
   3069  * location provided by user.
   3070  */
   3071 extern int bcm_stat_custom_counter_id_move(
   3072     int unit, 
   3073     bcm_stat_custom_base_index_action_t idx_action, 
   3074     bcm_stat_custom_counter_info_t counter_info_old, 
   3075     bcm_stat_custom_counter_info_t *counter_info_new);
   3076 
   3077 #endif /* BCM_HIDE_DISPATCHABLE */
   3078 
   3079 /* Initialize flex stat counter information */
   3080 extern void bcm_stat_custom_counter_info_t_init(
   3081     bcm_stat_custom_counter_info_t *counter_info);
   3082 
   3083 /* PP statistic profile. */
   3084 typedef struct bcm_stat_pp_profile_info_s {
   3085     int counter_command_id; /* Command id (interface id). */
   3086     int stat_object_type;   /* Statistic object type in range
   3087                                0-BCM_STAT_MAX_NUMBER_OF_OBJECT_TYPES-1 */
   3088     int meter_command_id;   /* Relevant only for egress */
   3089     int meter_qos_map_id;   /* Relevant only for egress */
   3090     uint8 is_meter_enable;  /* Allow metering */
   3091     uint8 is_fp_cs_var;     /* Enable PMF2 context selection */
   3092 } bcm_stat_pp_profile_info_t;
   3093 
   3094 #ifndef BCM_HIDE_DISPATCHABLE
   3095 
   3096 /* Map {statistic command, statistic profile} to the profile properties. */
   3097 extern int bcm_stat_pp_profile_create(
   3098     int unit, 
   3099     int flags, 
   3100     bcm_stat_counter_interface_type_t engine_source, 
   3101     int *stat_pp_profile, 
   3102     bcm_stat_pp_profile_info_t *stat_pp_profile_info);
   3103 
   3104 /* Get profile properties according to stat_pp_profile. */
   3105 extern int bcm_stat_pp_profile_get(
   3106     int unit, 
   3107     int stat_pp_profile, 
   3108     bcm_stat_pp_profile_info_t *stat_pp_profile_info);
   3109 
   3110 /* Delete profile properties according to stat_pp_profile. */
   3111 extern int bcm_stat_pp_profile_delete(
   3112     int unit, 
   3113     int stat_pp_profile);
   3114 
   3115 #endif /* BCM_HIDE_DISPATCHABLE */
   3116 
   3117 /* Stat PP profile flags */
   3118 #define BCM_STAT_PP_PROFILE_WITH_ID 0x0001     /* Add stat profile instance
   3119                                                   using a specific id. */
   3120 #define BCM_STAT_PP_PROFILE_REPLACE 0x0002     /* Replace data in an existing
   3121                                                   stat profile instance. */
   3122 
   3123 /* Initialize stat_pp_profile_info_t */
   3124 extern void bcm_stat_pp_profile_info_t_init(
   3125     bcm_stat_pp_profile_info_t *pp_profile);
   3126 
   3127 /* PP statistic profile information */
   3128 typedef struct bcm_stat_pp_info_s {
   3129     uint32 flags;           /* BCM_STAT_INFO_WITH_ID, BCM_STAT_INFO_REPLACE */
   3130     uint32 stat_id;         /* object statistic id (the counter_pointer value as
   3131                                sent to the crps) */
   3132     int stat_pp_profile;    /* profile */
   3133 } bcm_stat_pp_info_t;
   3134 
   3135 /* Initialize stat_pp_info_t structure */
   3136 extern void bcm_stat_pp_info_t_init(
   3137     bcm_stat_pp_info_t *stat_pp_info);
   3138 
   3139 #ifndef BCM_HIDE_DISPATCHABLE
   3140 
   3141 /* 
   3142  * Map physical or logical port to stat id and stat profile. In case of
   3143  * DPC LIF the api can accept core parameter to distinguish between the
   3144  * stat id on the two cores.
   3145  */
   3146 extern int bcm_gport_stat_set(
   3147     int unit, 
   3148     bcm_gport_t gport, 
   3149     bcm_core_t core_id, 
   3150     bcm_stat_counter_interface_type_t engine_source, 
   3151     bcm_stat_pp_info_t stat_info);
   3152 
   3153 /* 
   3154  * Get mapping of physical or logical port to stat id and stat profile.
   3155  * In case of DPC LIF the api can accept core parameter to distinguish
   3156  * between the stat id on the two cores.
   3157  */
   3158 extern int bcm_gport_stat_get(
   3159     int unit, 
   3160     bcm_gport_t gport, 
   3161     bcm_core_t core_id, 
   3162     bcm_stat_counter_interface_type_t engine_source, 
   3163     bcm_stat_pp_info_t *stat_info);
   3164 
   3165 #endif /* BCM_HIDE_DISPATCHABLE */
   3166 
   3167 /* 
   3168  * Structure holds the key for decoding the stat-id of end to end latency
   3169  * per destination port.
   3170  */
   3171 typedef struct bcm_stat_latency_port_stat_id_key_s {
   3172     int is_multicast;   /* Multicast. */
   3173     int traffic_class;  /* Traffic class. */
   3174     bcm_port_t port;    /* Port. */
   3175 } bcm_stat_latency_port_stat_id_key_t;
   3176 
   3177 #ifndef BCM_HIDE_DISPATCHABLE
   3178 
   3179 /* 
   3180  * For end to end latency per destination port, API give back the decoded
   3181  * latency stat-id.
   3182  */
   3183 extern int bcm_stat_latency_port_stat_id_get(
   3184     int unit, 
   3185     int flags, 
   3186     bcm_stat_latency_port_stat_id_key_t *key, 
   3187     int *stat_id);
   3188 
   3189 /* Set drop reasons to be part of certain group. */
   3190 extern int bcm_stat_group_drop_reasons_set(
   3191     int unit, 
   3192     uint32 flags, 
   3193     bcm_stat_counter_group_filter_t group, 
   3194     bcm_cosq_drop_reason_t *drop_reasons_array, 
   3195     int drop_reasons_count);
   3196 
   3197 /* Get drop reasons represented by given group. */
   3198 extern int bcm_stat_group_drop_reasons_get(
   3199     int unit, 
   3200     uint32 flags, 
   3201     bcm_stat_counter_group_filter_t group, 
   3202     int max_drop_reason_count, 
   3203     bcm_cosq_drop_reason_t *drop_reasons_array, 
   3204     int *drop_reasons_count);
   3205 
   3206 #endif /* BCM_HIDE_DISPATCHABLE */
   3207 
   3208 #endif /* __BCM_STAT_H__ */