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

rx.h (108364B)


      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_RX_H__
     14 #define __BCM_RX_H__
     15 
     16 #include <bcm/types.h>
     17 #include <bcm/pkt.h>
     18 #include <bcm/tx.h>
     19 #include <bcm/mirror.h>
     20 
     21 #define BCM_RX_COS              64         /* Number of COS supported. */
     22 #define BCM_RX_COS_ALL          -1         /* Affect all COS. */
     23 #define BCM_RX_CHANNELS         4          /* Max. number of RX channels. */
     24 #define BCM_CMICX_RX_CHANNELS   8          /* Max. number of CMICx RX channels. */
     25 
     26 /* 
     27  * This is the default time between minimum token refreshes. It is also
     28  * the maximum time between RX thread wake-ups.
     29  */
     30 #define BCM_RX_TOKEN_CHECK_US_DEFAULT   100000     /* 10 times/sec. */
     31 
     32 /* 
     33  * This is the default value for match rule which SDK uses to identify
     34  * OLP packets.
     35  */
     36 #define BCM_DEFAULT_OLP_MATCH_RULE  255        /* Olp Match Rule (default) */
     37 
     38 /* bcm_rx_token_check_us */
     39 extern int bcm_rx_token_check_us;
     40 
     41 /* 
     42  * RX Callback Flags
     43  * 
     44  * The lower eight bits of the flag value are used to indicate which
     45  * COS(es) a callback should look at.
     46  * 
     47  *   BCM_RX_F_INTERRUPT_SET(flags) Add the interrupt flags
     48  *   BCM_RX_F_COS_ADD(flags, cos)  Add COS to flags
     49  * 
     50  *   BCM_RCO_F_COS_ACCEPT_MASK             Bits used for COS
     51  *   BCM_RCO_F_COS_ACCEPT(cos)             Generate bit for given COS
     52  *   BCM_RCO_F_INTR                        Interrupt level callback
     53  */
     54 #define BCM_RCO_F_COS_ACCEPT_MASK   0xc0ff     
     55 #define BCM_RCO_F_COS_ACCEPT(cos)   (1 << (cos)) 
     56 #define BCM_RCO_F_ALL_COS           0x40000000 
     57 #define BCM_RCO_F_INTR              0x80000000 
     58 
     59 #define BCM_RX_F_INTERRUPT_SET(flags)  ((flags) |= BCM_RCO_F_INTR) 
     60 #define BCM_RX_F_COS_ADD(flags, cos)  ((flags) |= BCM_RCO_F_COS_ACCEPT(cos)) 
     61 
     62 #define BCM_RX_RATE_NOLIMIT         0          
     63 #define BCM_RX_SCHED_ALL_PACKETS    -1         
     64 
     65 /* Return values from PKT RX callout routines. */
     66 typedef enum bcm_rx_e {
     67     BCM_RX_INVALID = 0,         /* Invalid return value. */
     68     BCM_RX_NOT_HANDLED = 1,     /* Packet not processed. */
     69     BCM_RX_HANDLED = 2,         /* Packet handled, not owned. */
     70     BCM_RX_HANDLED_OWNED = 3    /* Packet handled and owned. */
     71 } bcm_rx_t;
     72 
     73 /* Max. allowed packets per chain. */
     74 #define BCM_RX_PPC_MAX                     
     75 
     76 /* Callback function type for applications using bcm RX facility. */
     77 typedef bcm_rx_t (*bcm_rx_cb_f)(
     78     int unit, 
     79     bcm_pkt_t *pkt, 
     80     void *cookie);
     81 
     82 /* Callback function type for applications implementing RX scheduling. */
     83 typedef int (*bcm_rx_sched_cb)(
     84     int unit, 
     85     int *sched_unit, 
     86     bcm_cos_queue_t *sched_cosq, 
     87     int *sched_count);
     88 
     89 /* RX packet buffer allocation function. */
     90 typedef int (*bcm_rx_alloc_f)(
     91     int unit, 
     92     int size, 
     93     uint32 flags, 
     94     void **pkt_buf);
     95 
     96 /* RX packet buffer free function. */
     97 typedef int (*bcm_rx_free_f)(
     98     int unit, 
     99     void *pkt_buf);
    100 
    101 #define bcm_data_alloc_f        bcm_rx_alloc_f 
    102 #define bcm_data_free_f         bcm_rx_free_f 
    103 
    104 /* RX registration function. */
    105 typedef int (*bcm_rx_reg_f)(
    106     int unit, 
    107     const char *name, 
    108     bcm_rx_cb_f callback, 
    109     uint8 priority, 
    110     void *cookie, 
    111     uint32 flags);
    112 
    113 /* RX unregistration function. */
    114 typedef int (*bcm_rx_unreg_f)(
    115     int unit, 
    116     bcm_rx_cb_f callback, 
    117     uint8 priority);
    118 
    119 /* 
    120  * Channel-specific RX data.
    121  * 
    122  * The number of chains allowed for the channel controls the burst size
    123  * that the channel accepts.
    124  * 
    125  * The 'rate_pps' field is DEPRECATED. The rate may be set on a per-COS
    126  * basis using bcm_rx_rate_set/get.
    127  * 
    128  * IMPORTANT: If BCM_RX_F_MULTI_DCB is NOT used (single DCB per packet)
    129  * then the rx_free routine must be given the allocation pointer
    130  * (pkt->alloc_ptr) rather than the packet data pointer
    131  * (pkt->_pkt_data.data or pkt->pkt_data[0].data).
    132  */
    133 typedef struct bcm_rx_chan_cfg_s {
    134     int chains;     /* Number of chains (DVs) set up. 0 means channel not used. */
    135     int rate_pps;   /* Deprecated: Use bcm_rx_cos_rate_set/get. */
    136     int flags;      /* See BCM_RX_F_* definitions. */
    137     uint32 cos_bmp; /* COS bitmap, if supported. */
    138 } bcm_rx_chan_cfg_t;
    139 
    140 /* Flags for bcm_rx_chan_cfg_t. */
    141 #define BCM_RX_F_CRC_STRIP      0x1        /* Strip CRC from packets. */
    142 #define BCM_RX_F_VTAG_STRIP     0x2        /* Strip VLAN tag from packets. */
    143 #define BCM_RX_F_RATE_STALL     0x4        /* Use stall instead of discard. */
    144 #define BCM_RX_F_MULTI_DCB      0x8        /* Scatter data with multiple DCBs. */
    145 #define BCM_RX_F_OVERSIZED_OK   0x10       /* Accept packets larger than
    146                                               bufsize. */
    147 #define BCM_RX_F_PKT_UNPARSED   0x20       /* Do not parse received packets. */
    148 
    149 /* User-configurable, per-unit RX configuration. */
    150 typedef struct bcm_rx_cfg_s {
    151     int pkt_size;                       /* Default packet size. */
    152     int pkts_per_chain;                 /* Packets per DMA chain. */
    153     int global_pps;                     /* Global rate limiting as packets per
    154                                            second. */
    155     int max_burst;                      /* Max. packets to be received in a
    156                                            single burst. */
    157     bcm_rx_chan_cfg_t chan_cfg[BCM_CMICX_RX_CHANNELS]; /* RX channel configuration. */
    158     bcm_rx_alloc_f rx_alloc;            /* RX packet allocation function. */
    159     bcm_rx_free_f rx_free;              /* RX packet free function. */
    160     int32 flags;                        /* See BCM_RX_F_* definitions. */
    161     int num_of_cpu_addresses;           /* Explicitly set the relevant num of
    162                                            CPU addresses - ignore if not
    163                                            relevant. */
    164     int *cpu_address;                   /* Explicitly set the relevant CPU
    165                                            addresses - ignore if not relevant. */
    166 } bcm_rx_cfg_t;
    167 
    168 /* Flags for bcm_rx_cfg_t. */
    169 #define BCM_RX_F_IGNORE_HGHDR   0x1        /* Force HiGig Header into packet for
    170                                               fabric device. */
    171 #define BCM_RX_F_IGNORE_SLTAG   0x2        /* Force SL tag into packet on SL
    172                                               stacking. */
    173 
    174 /* Structure of transport related function pointers. */
    175 typedef struct bcm_trans_ptr_s {
    176     bcm_rx_alloc_f tp_data_alloc;   /* Packet data allocation function. */
    177     bcm_rx_free_f tp_data_free;     /* Packet data free function. */
    178     bcm_pkt_alloc_f tp_pkt_alloc;   /* Packet structure (bcm_pkt_t) allocation
    179                                        function. */
    180     bcm_pkt_free_f tp_pkt_free;     /* Packet structure (bcm_pkt_t) free
    181                                        function. */
    182     bcm_rx_reg_f tp_rx_reg;         /* RX registration function. */
    183     bcm_rx_unreg_f tp_rx_unreg;     /* RX unregistration function. */
    184     bcm_tx_pkt_setup_f tp_setup_tx; /* TX packet setup function. */
    185     bcm_tx_f tp_tx;                 /* TX single packet transmit function. */
    186     bcm_tx_list_f tp_tx_list;       /* TX function for sending a list of
    187                                        packets. */
    188     bcm_tx_array_f tp_tx_array;     /* TX function for sending an array of
    189                                        packets. */
    190     bcm_pkt_l2_map_f tp_l2_map;     /* Map a packet's L2 information into a port
    191                                        bitmap. */
    192     int tp_unit;                    /* Default unit to use for allocation/free
    193                                        functions. */
    194 } bcm_trans_ptr_t;
    195 
    196 /* bcm_rx_chan_t */
    197 typedef int bcm_rx_chan_t;
    198 
    199 /* Standard BCM transport pointer structure. */
    200 extern bcm_trans_ptr_t bcm_trans_ptr;
    201 
    202 #define BCM_RX_REASON_NAMES_INITIALIZER _SHR_RX_REASON_NAMES_INITIALIZER 
    203 
    204 /* 
    205  * PKT RX Packet Reasons; reason CPU received the packet.
    206  * 
    207  * It is possible no reasons are set (directed to CPU from ARL for
    208  * example), or multiple reasons may be set.
    209  */
    210 typedef enum bcm_rx_reason_e {
    211     bcmRxReasonInvalid = _SHR_RX_INVALID, 
    212     bcmRxReasonArp = _SHR_RX_ARP, 
    213     bcmRxReasonBpdu = _SHR_RX_BPDU, 
    214     bcmRxReasonBroadcast = _SHR_RX_BROADCAST, 
    215     bcmRxReasonClassBasedMove = _SHR_RX_CLASS_BASED_MOVE, 
    216     bcmRxReasonClassTagPackets = _SHR_RX_CLASS_TAG_PACKETS, 
    217     bcmRxReasonControl = _SHR_RX_CONTROL, 
    218     bcmRxReasonCpuLearn = _SHR_RX_CPU_LEARN, 
    219     bcmRxReasonDestLookupFail = _SHR_RX_DEST_LOOKUP_FAIL, 
    220     bcmRxReasonDhcp = _SHR_RX_DHCP, 
    221     bcmRxReasonDosAttack = _SHR_RX_DOS_ATTACK, 
    222     bcmRxReasonE2eHolIbp = _SHR_RX_E2E_HOL_IBP, 
    223     bcmRxReasonEncapHigigError = _SHR_RX_ENCAP_HIGIG_ERROR, 
    224     bcmRxReasonFilterMatch = _SHR_RX_FILTER_MATCH, 
    225     bcmRxReasonGreChecksum = _SHR_RX_GRE_CHECKSUM, 
    226     bcmRxReasonGreSourceRoute = _SHR_RX_GRE_SOURCE_ROUTE, 
    227     bcmRxReasonHigigControl = _SHR_RX_HIGIG_CONTROL, 
    228     bcmRxReasonHigigHdrError = _SHR_RX_HIGIG_HDR_ERROR, 
    229     bcmRxReasonIcmpRedirect = _SHR_RX_ICMP_REDIRECT, 
    230     bcmRxReasonIgmp = _SHR_RX_IGMP, 
    231     bcmRxReasonIngressFilter = _SHR_RX_INGRESS_FILTER, 
    232     bcmRxReasonIp = _SHR_RX_IP, 
    233     bcmRxReasonIpfixRateViolation = _SHR_RX_IPFIX_RATE_VIOLATION, 
    234     bcmRxReasonIpMcastMiss = _SHR_RX_IP_MCAST_MISS, 
    235     bcmRxReasonIpmcReserved = _SHR_RX_IPMC_RSVD, 
    236     bcmRxReasonIpOptionVersion = _SHR_RX_IP_OPTION_VERSION, 
    237     bcmRxReasonIpmc = _SHR_RX_IPMC, 
    238     bcmRxReasonL2Cpu = _SHR_RX_L2_CPU, 
    239     bcmRxReasonL2DestMiss = _SHR_RX_L2_DEST_MISS, 
    240     bcmRxReasonL2LearnLimit = _SHR_RX_L2_LEARN_LIMIT, 
    241     bcmRxReasonL2Move = _SHR_RX_L2_MOVE, 
    242     bcmRxReasonL2MtuFail = _SHR_RX_L2_MTU_FAIL, 
    243     bcmRxReasonL2NonUnicastMiss = _SHR_RX_L2_NON_UNICAST_MISS, 
    244     bcmRxReasonL2SourceMiss = _SHR_RX_L2_SOURCE_MISS, 
    245     bcmRxReasonL3AddrBindFail = _SHR_RX_L3_ADDR_BIND_FAIL, 
    246     bcmRxReasonL3DestMiss = _SHR_RX_L3_DEST_MISS, 
    247     bcmRxReasonL3HeaderError = _SHR_RX_L3_HEADER_ERROR, 
    248     bcmRxReasonL3MtuFail = _SHR_RX_L3_MTU_FAIL, 
    249     bcmRxReasonL3Slowpath = _SHR_RX_L3_SLOW_PATH, 
    250     bcmRxReasonL3SourceMiss = _SHR_RX_L3_SOURCE_MISS, 
    251     bcmRxReasonL3SourceMove = _SHR_RX_L3_SOUCE_MOVE, 
    252     bcmRxReasonMartianAddr = _SHR_RX_MARTIAN_ADDR, 
    253     bcmRxReasonMcastIdxError = _SHR_RX_MCAST_IDX_ERROR, 
    254     bcmRxReasonMcastMiss = _SHR_RX_MCAST_MISS, 
    255     bcmRxReasonMimServiceError = _SHR_RX_MIM_SERVICE_ERROR, 
    256     bcmRxReasonMplsCtrlWordError = _SHR_RX_MPLS_CTRL_WORD_ERROR, 
    257     bcmRxReasonMplsError = _SHR_RX_MPLS_ERROR, 
    258     bcmRxReasonMplsInvalidAction = _SHR_RX_MPLS_INVALID_ACTION, 
    259     bcmRxReasonMplsInvalidPayload = _SHR_RX_MPLS_INVALID_PAYLOAD, 
    260     bcmRxReasonMplsLabelMiss = _SHR_RX_MPLS_LABEL_MISS, 
    261     bcmRxReasonMplsSequenceNumber = _SHR_RX_MPLS_SEQUENCE_NUMBER, 
    262     bcmRxReasonMplsTtl = _SHR_RX_MPLS_TTL, 
    263     bcmRxReasonMulticast = _SHR_RX_MULTICAST, 
    264     bcmRxReasonNhop = _SHR_RX_NHOP, 
    265     bcmRxReasonOAMError = _SHR_RX_OAM_ERROR, 
    266     bcmRxReasonOAMSlowpath = _SHR_RX_OAM_SLOW_PATH, 
    267     bcmRxReasonOAMLMDM = _SHR_RX_OAM_LMDM, 
    268     bcmRxReasonParityError = _SHR_RX_PARITY_ERROR, 
    269     bcmRxReasonProtocol = _SHR_RX_PROTOCOL, 
    270     bcmRxReasonSampleDest = _SHR_RX_SAMPLE_DEST, 
    271     bcmRxReasonSampleSource = _SHR_RX_SAMPLE_SOURCE, 
    272     bcmRxReasonSharedVlanMismatch = _SHR_RX_SHARED_VLAN_MISMATCH, 
    273     bcmRxReasonSourceRoute = _SHR_RX_SOURCE_ROUTE, 
    274     bcmRxReasonTimeStamp = _SHR_RX_TIME_STAMP, 
    275     bcmRxReasonTtl = _SHR_RX_TTL, 
    276     bcmRxReasonTtl1 = _SHR_RX_TTL1, 
    277     bcmRxReasonTunnelError = _SHR_RX_TUNNEL_ERROR, 
    278     bcmRxReasonUdpChecksum = _SHR_RX_UDP_CHECKSUM, 
    279     bcmRxReasonUnknownVlan = _SHR_RX_UNKNOWN_VLAN, 
    280     bcmRxReasonUrpfFail = _SHR_RX_URPF_FAIL, 
    281     bcmRxReasonVcLabelMiss = _SHR_RX_VC_LABEL_MISS, 
    282     bcmRxReasonVlanFilterMatch = _SHR_RX_VLAN_FILTER_MATCH, 
    283     bcmRxReasonWlanClientError = _SHR_RX_WLAN_CLIENT_ERROR, 
    284     bcmRxReasonWlanSlowpath = _SHR_RX_WLAN_SLOW_PATH, 
    285     bcmRxReasonWlanDot1xDrop = _SHR_RX_WLAN_DOT1X_DROP, 
    286     bcmRxReasonTimeSync = _SHR_RX_TIMESYNC, 
    287     bcmRxReasonEAVData = _SHR_RX_EAV_DATA, 
    288     bcmRxReasonSamePortBridge = _SHR_RX_SAME_PORT_BRIDGE, 
    289     bcmRxReasonSplitHorizon = _SHR_RX_SPLIT_HORIZON, 
    290     bcmRxReasonL4Error = _SHR_RX_L4_ERROR, 
    291     bcmRxReasonStp = _SHR_RX_STP, 
    292     bcmRxReasonVlanTranslate = _SHR_RX_VLAN_TRANSLATE, 
    293     bcmRxReasonMmrp = _SHR_RX_MMRP, 
    294     bcmRxReasonSrp = _SHR_RX_SRP, 
    295     bcmRxReasonTunnelControl = _SHR_RX_TUNNEL_CONTROL, 
    296     bcmRxReasonL2Marked = _SHR_RX_L2_MARKED, 
    297     bcmRxReasonWlanSlowpathKeepalive = _SHR_RX_WLAN_SLOWPATH_KEEPALIVE, 
    298     bcmRxReasonStation = _SHR_RX_STATION, 
    299     bcmRxReasonNiv = _SHR_RX_NIV, 
    300     bcmRxReasonNivPrioDrop = _SHR_RX_NIV_PRIO_DROP, 
    301     bcmRxReasonNivInterfaceMiss = _SHR_RX_NIV_INTERFACE_MISS, 
    302     bcmRxReasonNivRpfFail = _SHR_RX_NIV_RPF_FAIL, 
    303     bcmRxReasonNivTagInvalid = _SHR_RX_NIV_TAG_INVALID, 
    304     bcmRxReasonNivTagDrop = _SHR_RX_NIV_TAG_DROP, 
    305     bcmRxReasonNivUntagDrop = _SHR_RX_NIV_UNTAG_DROP, 
    306     bcmRxReasonTrill = _SHR_RX_TRILL, 
    307     bcmRxReasonTrillInvalid = _SHR_RX_TRILL_INVALID, 
    308     bcmRxReasonTrillMiss = _SHR_RX_TRILL_MISS, 
    309     bcmRxReasonTrillRpfFail = _SHR_RX_TRILL_RPF_FAIL, 
    310     bcmRxReasonTrillSlowpath = _SHR_RX_TRILL_SLOWPATH, 
    311     bcmRxReasonTrillCoreIsIs = _SHR_RX_TRILL_CORE_IS_IS, 
    312     bcmRxReasonTrillTtl = _SHR_RX_TRILL_TTL, 
    313     bcmRxReasonTrillName = _SHR_RX_TRILL_NAME, 
    314     bcmRxReasonBfdSlowpath = _SHR_RX_BFD_SLOWPATH, 
    315     bcmRxReasonBfd = _SHR_RX_BFD_ERROR, 
    316     bcmRxReasonMirror = _SHR_RX_MIRROR, 
    317     bcmRxReasonRegexAction = _SHR_RX_REGEX_ACTION, 
    318     bcmRxReasonRegexMatch = _SHR_RX_REGEX_MATCH, 
    319     bcmRxReasonFailoverDrop = _SHR_RX_FAILOVER_DROP, 
    320     bcmRxReasonWlanTunnelError = _SHR_RX_WLAN_TUNNEL_ERROR, 
    321     bcmRxReasonCongestionCnmProxy = _SHR_RX_CONGESTION_CNM_PROXY, 
    322     bcmRxReasonCongestionCnmProxyError = _SHR_RX_CONGESTION_CNM_PROXY_ERROR, 
    323     bcmRxReasonCongestionCnm = _SHR_RX_CONGESTION_CNM, 
    324     bcmRxReasonMplsUnknownAch = _SHR_RX_MPLS_UNKNOWN_ACH, 
    325     bcmRxReasonMplsLookupsExceeded = _SHR_RX_MPLS_LOOKUPS_EXCEEDED, 
    326     bcmRxReasonMplsReservedEntropyLabel = _SHR_RX_MPLS_RESERVED_ENTROPY_LABEL, 
    327     bcmRxReasonMplsIllegalReservedLabel = _SHR_RX_MPLS_ILLEGAL_RESERVED_LABEL, 
    328     bcmRxReasonMplsRouterAlertLabel = _SHR_RX_MPLS_ROUTER_ALERT_LABEL, 
    329     bcmRxReasonNivPrune = _SHR_RX_NIV_PRUNE, 
    330     bcmRxReasonVirtualPortPrune = _SHR_RX_VIRTUAL_PORT_PRUNE, 
    331     bcmRxReasonNonUnicastDrop = _SHR_RX_NON_UNICAST_DROP, 
    332     bcmRxReasonTrillPacketPortMismatch = _SHR_RX_TRILL_PACKET_PORT_MISMATCH, 
    333     bcmRxReasonWlanClientMove = _SHR_RX_WLAN_CLIENT_MOVE, 
    334     bcmRxReasonWlanSourcePortMiss = _SHR_RX_WLAN_SOURCE_PORT_MISS, 
    335     bcmRxReasonWlanClientSourceMiss = _SHR_RX_WLAN_CLIENT_SOURCE_MISS, 
    336     bcmRxReasonWlanClientDestMiss = _SHR_RX_WLAN_CLIENT_DEST_MISS, 
    337     bcmRxReasonWlanMtu = _SHR_RX_WLAN_MTU, 
    338     bcmRxReasonL2GreSipMiss = _SHR_RX_L2GRE_SIP_MISS, 
    339     bcmRxReasonL2GreVpnIdMiss = _SHR_RX_L2GRE_VPN_ID_MISS, 
    340     bcmRxReasonTimesyncUnknownVersion = _SHR_RX_TIMESYNC_UNKNOWN_VERSION, 
    341     bcmRxReasonBfdUnknownVersion = _SHR_RX_BFD_UNKNOWN_VERSION, 
    342     bcmRxReasonBfdInvalidVersion = _SHR_RX_BFD_INVALID_VERSION, 
    343     bcmRxReasonBfdLookupFailure = _SHR_RX_BFD_LOOKUP_FAILURE, 
    344     bcmRxReasonBfdInvalidPacket = _SHR_RX_BFD_INVALID_PACKET, 
    345     bcmRxReasonVxlanSipMiss = _SHR_RX_VXLAN_SIP_MISS, 
    346     bcmRxReasonVxlanVpnIdMiss = _SHR_RX_VXLAN_VPN_ID_MISS, 
    347     bcmRxReasonFcoeZoneCheckFail = _SHR_RX_FCOE_ZONE_CHECK_FAIL, 
    348     bcmRxReasonIpmcInterfaceMismatch = _SHR_RX_IPMC_INTERFACE_MISMATCH, 
    349     bcmRxReasonNat = _SHR_RX_NAT, 
    350     bcmRxReasonTcpUdpNatMiss = _SHR_RX_TCP_UDP_NAT_MISS, 
    351     bcmRxReasonIcmpNatMiss = _SHR_RX_ICMP_NAT_MISS, 
    352     bcmRxReasonNatFragment = _SHR_RX_NAT_FRAGMENT, 
    353     bcmRxReasonNatMiss = _SHR_RX_NAT_MISS, 
    354     bcmRxReasonOAMCCMSlowpath = _SHR_RX_OAM_CCM_SLOWPATH, 
    355     bcmRxReasonBHHOAM = _SHR_RX_BHH_OAM_PACKET, 
    356     bcmRxReasonUnknownSubtendingPort = _SHR_RX_UNKNOWN_SUBTENTING_PORT, 
    357     bcmRxReasonReserved0 = _SHR_RX_RESERVED_0, 
    358     bcmRxReasonOAMMplsLmDm = _SHR_RX_OAM_MPLS_LMDM, 
    359     bcmRxReasonSat = _SHR_RX_SAT, 
    360     bcmRxReasonSampleSourceFlex = _SHR_RX_SAMPLE_SOURCE_FLEX, 
    361     bcmRxReasonFlexSflow = _SHR_RX_FLEX_SFLOW, 
    362     bcmRxReasonVxltMiss = _SHR_RX_VXLT_MISS, 
    363     bcmRxReasonTunnelDecapEcnError = _SHR_RX_TUNNEL_DECAP_ECN_ERROR, 
    364     bcmRxReasonTunnelObjectValidationFail = _SHR_RX_TUNNEL_OBJECT_VALIDATION_FAIL, 
    365     bcmRxReasonL3Cpu = _SHR_RX_L3_CPU, 
    366     bcmRxReasonTunnelAdaptLookupMiss = _SHR_RX_TUNNEL_ADAPT_LOOKUP_MISS, 
    367     bcmRxReasonPacketFlowSelectMiss = _SHR_RX_PACKET_FLOW_SELECT_MISS, 
    368     bcmRxReasonProtectionDataDrop = _SHR_RX_PROTECTION_DATA_DROP, 
    369     bcmRxReasonPacketFlowSelect = _SHR_RX_PACKET_FLOW_SELECT, 
    370     bcmRxReasonOtherLookupMiss = _SHR_RX_OTHER_LOOKUP_MISS, 
    371     bcmRxReasonInvalidTpid = _SHR_RX_INVALID_TPID, 
    372     bcmRxReasonMplsControlPacket = _SHR_RX_MPLS_CONTROL_PACKET, 
    373     bcmRxReasonTunnelTtlError = _SHR_RX_TUNNEL_TTL_ERROR, 
    374     bcmRxReasonL2HeaderError = _SHR_RX_L2_HEADER_ERROR, 
    375     bcmRxReasonOtherLookupHit = _SHR_RX_OTHER_LOOKUP_HIT, 
    376     bcmRxReasonL2SrcLookupMiss = _SHR_RX_L2_SRC_LOOKUP_MISS, 
    377     bcmRxReasonL2SrcLookupHit = _SHR_RX_L2_SRC_LOOKUP_HIT, 
    378     bcmRxReasonL2DstLookupMiss = _SHR_RX_L2_DST_LOOKUP_MISS, 
    379     bcmRxReasonL2DstLookupHit = _SHR_RX_L2_DST_LOOKUP_HIT, 
    380     bcmRxReasonL3SrcRouteLookupMiss = _SHR_RX_L3_SRC_ROUTE_LOOKUP_MISS, 
    381     bcmRxReasonL3SrcHostLookupMiss = _SHR_RX_L3_SRC_HOST_LOOKUP_MISS, 
    382     bcmRxReasonL3SrcRouteLookupHit = _SHR_RX_L3_SRC_ROUTE_LOOKUP_HIT, 
    383     bcmRxReasonL3SrcHostLookupHit = _SHR_RX_L3_SRC_HOST_LOOKUP_HIT, 
    384     bcmRxReasonL3DstRouteLookupMiss = _SHR_RX_L3_DST_ROUTE_LOOKUP_MISS, 
    385     bcmRxReasonL3DstHostLookupMiss = _SHR_RX_L3_DST_HOST_LOOKUP_MISS, 
    386     bcmRxReasonL3DstRouteLookupHit = _SHR_RX_L3_DST_ROUTE_LOOKUP_HIT, 
    387     bcmRxReasonL3DstHostLookupHit = _SHR_RX_L3_DST_HOST_LOOKUP_HIT, 
    388     bcmRxReasonVlanTranslate1Lookup1Miss = _SHR_RX_VLAN_TRANSLATE1_LOOKUP1_MISS, 
    389     bcmRxReasonVlanTranslate1Lookup2Miss = _SHR_RX_VLAN_TRANSLATE1_LOOKUP2_MISS, 
    390     bcmRxReasonMplsLookup1Miss = _SHR_RX_MPLS_LOOKUP1_MISS, 
    391     bcmRxReasonMplsLookup2Miss = _SHR_RX_MPLS_LOOKUP2_MISS, 
    392     bcmRxReasonL3TunnelLookupMiss = _SHR_RX_L3_TUNNEL_LOOKUP_MISS, 
    393     bcmRxReasonVlanTranslate2Lookup1Miss = _SHR_RX_VLAN_TRANSLATE2_LOOKUP1_MISS, 
    394     bcmRxReasonVlanTranslate2Lookup2Miss = _SHR_RX_VLAN_TRANSLATE2_LOOKUP2_MISS, 
    395     bcmRxReasonL2StuFail = _SHR_RX_L2_STU_FAIL, 
    396     bcmRxReasonSrCounterExceeded = _SHR_RX_SR_COUNTER_EXCEEDED, 
    397     bcmRxReasonSrCopyToCpuBit0 = _SHR_RX_SR_COPY_TO_CPU_BIT0, 
    398     bcmRxReasonSrCopyToCpuBit1 = _SHR_RX_SR_COPY_TO_CPU_BIT1, 
    399     bcmRxReasonSrCopyToCpuBit2 = _SHR_RX_SR_COPY_TO_CPU_BIT2, 
    400     bcmRxReasonSrCopyToCpuBit3 = _SHR_RX_SR_COPY_TO_CPU_BIT3, 
    401     bcmRxReasonSrCopyToCpuBit4 = _SHR_RX_SR_COPY_TO_CPU_BIT4, 
    402     bcmRxReasonSrCopyToCpuBit5 = _SHR_RX_SR_COPY_TO_CPU_BIT5, 
    403     bcmRxReasonL3HeaderMismatch = _SHR_RX_L3_HEADER_MISMATCH, 
    404     bcmRxReasonDLBMonitor = _SHR_RX_DLB_MONITOR, 
    405     bcmRxReasonETrapMonitor = _SHR_RX_ETRAP_MONITOR, 
    406     bcmRxReasonIntTurnAround = _SHR_RX_INT_TURNAROUND, 
    407     bcmRxReasonIntHopLimit = _SHR_RX_INT_HOP_LIMIT, 
    408     bcmRxReasonCount = _SHR_RX_REASON_COUNT 
    409 } bcm_rx_reason_t;
    410 
    411 /* 
    412  * Macro to check if a reason (bcmRxReason*) is included in a set of
    413  * reasons (bcm_rx_reasons_t).
    414  * 
    415  * Returns:
    416  *   zero     => reason is not included in the set
    417  *   non-zero => reason is included in the set
    418  */
    419 #define BCM_RX_REASON_GET(_reasons, _reason)  \
    420    _SHR_RX_REASON_GET(_reasons, _reason) 
    421 
    422 /* 
    423  * Macro to add a reason (bcmRxReason*) to a set of reasons
    424  * (bcm_rx_reasons_t).
    425  */
    426 #define BCM_RX_REASON_SET(_reasons, _reason)  \
    427    _SHR_RX_REASON_SET(_reasons, _reason) 
    428 
    429 /* 
    430  * Macro to add all reasons (bcmRxReason*) to a set of reasons
    431  * (bcm_rx_reasons_t).
    432  */
    433 #define BCM_RX_REASON_SET_ALL(_reasons)  \
    434    _SHR_RX_REASON_SET_ALL(_reasons) 
    435 
    436 /* 
    437  * Macro to clear a reason (bcmRxReason*) from a set of reasons
    438  * (bcm_rx_reasons_t).
    439  */
    440 #define BCM_RX_REASON_CLEAR(_reasons, _reason)  \
    441    _SHR_RX_REASON_CLEAR(_reasons, _reason) 
    442 
    443 /* Macro to clear a set of reasons (bcm_rx_reasons_t). */
    444 #define BCM_RX_REASON_CLEAR_ALL(_reasons)  \
    445    _SHR_RX_REASON_CLEAR_ALL(_reasons) 
    446 
    447 /* Macro to check if a set of reasons (bcm_rx_reasons_t) is empty. */
    448 #define BCM_RX_REASON_IS_NULL(_reasons)  \
    449    _SHR_RX_REASON_IS_NULL(_reasons) 
    450 
    451 /* Macro to itterate over a set of reasons (bcm_rx_reasons_t). */
    452 #define BCM_RX_REASON_ITER(_reasons, _reason)  \
    453    _SHR_RX_REASON_ITER(_reasons, _reason) 
    454 
    455 /* 
    456  * Macro to count number of active reasons in a set of reasons
    457  * (bcm_rx_reasons_t).
    458  */
    459 #define BCM_RX_REASON_COUNT(_reasons, count)  \
    460    _SHR_RX_REASON_COUNT(_reasons, count) 
    461 
    462 /* Macro to compare two sets of reasons (bcm_rx_reasons_t). */
    463 #define BCM_RX_REASON_EQ(_reasons1, _reasons2)  \
    464    _SHR_RX_REASON_EQ(_reasons1, _reasons2) 
    465 
    466 /* Macro to negative compare two sets of reasons (bcm_rx_reasons_t). */
    467 #define BCM_RX_REASON_NEQ(_reasons1, _reasons2)  \
    468    _SHR_RX_REASON_NEQ(_reasons1, _reasons2) 
    469 
    470 /* 
    471  * Macro to perform logical AND operation on two sets of reasons
    472  * (bcm_rx_reasons_t).
    473  */
    474 #define BCM_RX_REASON_AND(_reasons1, _reasons2)  \
    475    _SHR_RX_REASON_AND(_reasons1, _reasons2) 
    476 
    477 /* 
    478  * Macro to perform logical OR operation on two sets of reasons
    479  * (bcm_rx_reasons_t).
    480  */
    481 #define BCM_RX_REASON_OR(_reasons1, _reasons2)  \
    482    _SHR_RX_REASON_OR(_reasons1, _reasons2) 
    483 
    484 /* 
    485  * Macro to perform logical XOR operation on two sets of reasons
    486  * (bcm_rx_reasons_t).
    487  */
    488 #define BCM_RX_REASON_XOR(_reasons1, _reasons2)  \
    489    _SHR_RX_REASON_XOR(_reasons1, _reasons2) 
    490 
    491 /* 
    492  * Macro to remove set of reasons2 (bcm_rx_reasons_t) from set of
    493  * reasons1 (bcm_rx_reasons_t).
    494  */
    495 #define BCM_RX_REASON_REMOVE(_reasons1, _reasons2)  \
    496    _SHR_RX_REASON_REMOVE(_reasons1, _reasons2) 
    497 
    498 /* Macro to negate two sets of reasons (bcm_rx_reasons_t). */
    499 #define BCM_RX_REASON_NEGATE(_reasons1, _reasons2)  \
    500    _SHR_RX_REASON_NEGATE(_reasons1, _reasons2) 
    501 
    502 #ifndef BCM_HIDE_DISPATCHABLE
    503 
    504 /* Associate a policer to the specified set of reason codes. */
    505 extern int bcm_rx_reasons_policer_set(
    506     int unit, 
    507     bcm_rx_reasons_t rx_reasons, 
    508     bcm_policer_t polid);
    509 
    510 #endif /* BCM_HIDE_DISPATCHABLE */
    511 
    512 /* 
    513  * Macro to map virtual id of MC_RESERVED traps from range [0,7] to HW
    514  * trap_id range [24,31]
    515  */
    516 #define BCM_RX_TRAP_VIRTUAL_HW_TRAP_ID_MC_RESERVED(_id, _trap_id)  \
    517     (_id >7 ? _trap_id=-1 : (_trap_id = _id + 24) ) 
    518 
    519 /* 
    520  * Macro to map virtual id of GENERAL/PROGRAMABLE traps from range [0,3]
    521  * to HW trap_id range [38,41]
    522  */
    523 #define BCM_RX_TRAP_VIRTUAL_HW_TRAP_ID_PROG(_id, _trap_id)  \
    524     (_id >3 ? _trap_id=-1 : (_trap_id = _id + 38) ) 
    525 
    526 /* 
    527  * Defines for priorities of registered PKT RX handlers. PKT RX handlers
    528  * are always called from highest priority to lowest priority until one
    529  * of the handlers returns rx_handled or rx_handled_owned.
    530  * 
    531  * When started, a default PKT RX handler is installed at PKT_RX_PRIO_MIN
    532  * that discards the packets.
    533  */
    534 #define BCM_RX_PRIO_MIN         ((uint8)0) 
    535 #define BCM_RX_PRIO_MAX         ((uint8)255) 
    536 
    537 #define BCM_RX_INIT_DONE(unit)  (bcm_rx_cfg_get(unit, NULL) == 0) 
    538 
    539 #ifndef BCM_HIDE_DISPATCHABLE
    540 
    541 /* Initialize the RX software module for the given device. */
    542 extern int bcm_rx_init(
    543     int unit);
    544 
    545 /* Re-initialize the user level configuration for the RX module. */
    546 extern int bcm_rx_cfg_init(
    547     int unit);
    548 
    549 /* Start packet reception for the given device. */
    550 extern int bcm_rx_start(
    551     int unit, 
    552     bcm_rx_cfg_t *cfg);
    553 
    554 /* Stop the RX software module. */
    555 extern int bcm_rx_stop(
    556     int unit, 
    557     bcm_rx_cfg_t *cfg);
    558 
    559 /* Get the current configuration for the given device. */
    560 extern int bcm_rx_cfg_get(
    561     int unit, 
    562     bcm_rx_cfg_t *cfg);
    563 
    564 /* Boolean indication of whether RX is running on this device. */
    565 extern int bcm_rx_active(
    566     int unit);
    567 
    568 /* Register CPU bound packets scheduler. */
    569 extern int bcm_rx_sched_register(
    570     int unit, 
    571     bcm_rx_sched_cb sched_cb);
    572 
    573 /* Unregister CPU bound packets scheduler. */
    574 extern int bcm_rx_sched_unregister(
    575     int unit);
    576 
    577 /* Get next unit with cpu rx enabled. */
    578 extern int bcm_rx_unit_next_get(
    579     int unit, 
    580     int *next_unit);
    581 
    582 /* Get maximum cos queue number for the device. */
    583 extern int bcm_rx_queue_max_get(
    584     int unit, 
    585     bcm_cos_queue_t *cosq);
    586 
    587 /* 
    588  * Get number of packet takens available for the specific device/queue
    589  *                 BCM_RX_SCHED_ALL_PACKETS - queue doesn't limit number
    590  * of packets.
    591  */
    592 extern int bcm_rx_queue_rate_limit_status_get(
    593     int unit, 
    594     bcm_cos_queue_t cosq, 
    595     int *packet_tokens);
    596 
    597 /* 
    598  * Get number of packets awaiting processing in the specific device,
    599  * queue.
    600  */
    601 extern int bcm_rx_queue_packet_count_get(
    602     int unit, 
    603     bcm_cos_queue_t cosq, 
    604     int *packet_count);
    605 
    606 /* Register or unregister to receive callbacks for received packets. */
    607 extern int bcm_rx_register(
    608     int unit, 
    609     const char *name, 
    610     bcm_rx_cb_f callback, 
    611     uint8 priority, 
    612     void *cookie, 
    613     uint32 flags);
    614 
    615 /* Register or unregister to receive callbacks for received packets. */
    616 extern int bcm_rx_unregister(
    617     int unit, 
    618     bcm_rx_cb_f callback, 
    619     uint8 priority);
    620 
    621 /* 
    622  * Register a callback function to be called when a packet is received on
    623  * the specified CPU COS queue.
    624  */
    625 extern int bcm_rx_queue_register(
    626     int unit, 
    627     const char *name, 
    628     bcm_cos_queue_t cosq, 
    629     bcm_rx_cb_f callback, 
    630     uint8 priority, 
    631     void *cookie, 
    632     uint32 flags);
    633 
    634 /* Unregister CPU COS callback function. */
    635 extern int bcm_rx_queue_unregister(
    636     int unit, 
    637     bcm_cos_queue_t cosq, 
    638     bcm_rx_cb_f callback, 
    639     uint8 priority);
    640 
    641 #endif /* BCM_HIDE_DISPATCHABLE */
    642 
    643 #define BCM_RX_COSQ_PACKET_TYPE_SWITCHED    0x1        
    644 #define BCM_RX_COSQ_PACKET_TYPE_NON_UNICAST 0x2        
    645 #define BCM_RX_COSQ_PACKET_TYPE_MIRROR      0x4        
    646 
    647 #define BCM_RX_TRAP_EG_TRAP_ID_DEFAULT  0x800      
    648 
    649 #define BCM_RX_TRAP_EG_TX_TRAP_ID_DEFAULT   0xC00      
    650 #define BCM_RX_TRAP_EG_TX_TRAP_ID_DROP      0xC01      
    651 
    652 #ifndef BCM_HIDE_DISPATCHABLE
    653 
    654 /* Get number of packet to CPU COS queue mappings. */
    655 extern int bcm_rx_cosq_mapping_size_get(
    656     int unit, 
    657     int *size);
    658 
    659 /* Map packets to a CPU COS queue. */
    660 extern int bcm_rx_cosq_mapping_set(
    661     int unit, 
    662     int index, 
    663     bcm_rx_reasons_t reasons, 
    664     bcm_rx_reasons_t reasons_mask, 
    665     uint8 int_prio, 
    666     uint8 int_prio_mask, 
    667     uint32 packet_type, 
    668     uint32 packet_type_mask, 
    669     bcm_cos_queue_t cosq);
    670 
    671 /* Get packets to CPU COS queue mappings. */
    672 extern int bcm_rx_cosq_mapping_get(
    673     int unit, 
    674     int index, 
    675     bcm_rx_reasons_t *reasons, 
    676     bcm_rx_reasons_t *reasons_mask, 
    677     uint8 *int_prio, 
    678     uint8 *int_prio_mask, 
    679     uint32 *packet_type, 
    680     uint32 *packet_type_mask, 
    681     bcm_cos_queue_t *cosq);
    682 
    683 /* Unmap packets to a CPU COS queue. */
    684 extern int bcm_rx_cosq_mapping_delete(
    685     int unit, 
    686     int index);
    687 
    688 /* Get all supported reasons for CPU COS queue mapping. */
    689 extern int bcm_rx_cosq_mapping_reasons_get(
    690     int unit, 
    691     bcm_rx_reasons_t *reasons);
    692 
    693 /* Get all supported reasons for rx packets. */
    694 extern int bcm_rx_reasons_get(
    695     int unit, 
    696     bcm_rx_reasons_t *reasons);
    697 
    698 /* Assign a RX channel to a cosq. */
    699 extern int bcm_rx_queue_channel_set(
    700     int unit, 
    701     bcm_cos_queue_t queue_id, 
    702     bcm_rx_chan_t chan_id);
    703 
    704 /* Get the RX channel assigned to the given cosq. */
    705 extern int bcm_rx_queue_channel_get(
    706     int unit, 
    707     bcm_cos_queue_t queue_id, 
    708     bcm_rx_chan_t *chan_id);
    709 
    710 /* bcm_rx_channels_running */
    711 extern int bcm_rx_channels_running(
    712     int unit, 
    713     uint32 *channels);
    714 
    715 /* Allocate or deallocate a packet buffer as configured. */
    716 extern int bcm_rx_alloc(
    717     int unit, 
    718     int pkt_size, 
    719     uint32 flags, 
    720     void **buf);
    721 
    722 /* Allocate or deallocate a packet buffer as configured. */
    723 extern int bcm_rx_free(
    724     int unit, 
    725     void *pkt_data);
    726 
    727 /* Enqueue a data buffer to be freed later. */
    728 extern int bcm_rx_free_enqueue(
    729     int unit, 
    730     void *pkt_data);
    731 
    732 /* Set/get the overall packet rate for the given device. */
    733 extern int bcm_rx_rate_set(
    734     int unit, 
    735     int pps);
    736 
    737 /* Set/get the overall packet rate for the given device. */
    738 extern int bcm_rx_rate_get(
    739     int unit, 
    740     int *pps);
    741 
    742 /* 
    743  * Set/get the overall packet rate for the CPU that given device is
    744  * attached to.
    745  */
    746 extern int bcm_rx_cpu_rate_set(
    747     int unit, 
    748     int pps);
    749 
    750 /* 
    751  * Set/get the overall packet rate for the CPU that given device is
    752  * attached to.
    753  */
    754 extern int bcm_rx_cpu_rate_get(
    755     int unit, 
    756     int *pps);
    757 
    758 /* Set/get the burst size for the given device. */
    759 extern int bcm_rx_burst_set(
    760     int unit, 
    761     int burst);
    762 
    763 /* Set/get the burst size for the given device. */
    764 extern int bcm_rx_burst_get(
    765     int unit, 
    766     int *burst);
    767 
    768 /* Set/get the RX per-COS rate limiting value. */
    769 extern int bcm_rx_cos_rate_set(
    770     int unit, 
    771     int cos, 
    772     int pps);
    773 
    774 /* Set/get the RX per-COS rate limiting value. */
    775 extern int bcm_rx_cos_rate_get(
    776     int unit, 
    777     int cos, 
    778     int *pps);
    779 
    780 /* Set/get the per-COS burst setting. */
    781 extern int bcm_rx_cos_burst_set(
    782     int unit, 
    783     int cos, 
    784     int burst);
    785 
    786 /* Set/get the per-COS burst setting. */
    787 extern int bcm_rx_cos_burst_get(
    788     int unit, 
    789     int cos, 
    790     int *burst);
    791 
    792 /* Set/get the per-COS max queue length. */
    793 extern int bcm_rx_cos_max_len_set(
    794     int unit, 
    795     int cos, 
    796     int max_q_len);
    797 
    798 /* Set/get the per-COS max queue length. */
    799 extern int bcm_rx_cos_max_len_get(
    800     int unit, 
    801     int cos, 
    802     int *max_q_len);
    803 
    804 /* Clear all the RX configuration. */
    805 extern int bcm_rx_clear(
    806     int unit);
    807 
    808 #endif /* BCM_HIDE_DISPATCHABLE */
    809 
    810 /* Initialize a BCM RX configuration structure. */
    811 extern void bcm_rx_cfg_t_init(
    812     bcm_rx_cfg_t *rx_cfg);
    813 
    814 #if defined(BCM_RPC_SUPPORT) || defined(BCM_RCPU_SUPPORT)
    815 #define BCM_RX_PKTLIST_COUNT_DEFAULT    64         
    816 #endif
    817 
    818 #if defined(BCM_RPC_SUPPORT) || defined(BCM_RCPU_SUPPORT)
    819 /* bcm_rx_pktlist_count */
    820 extern int bcm_rx_pktlist_count;
    821 #endif
    822 
    823 #if defined(BCM_RPC_SUPPORT) || defined(BCM_RCPU_SUPPORT)
    824 /* bcm_rx_remote_pkt_alloc */
    825 extern int bcm_rx_remote_pkt_alloc(
    826     int len, 
    827     bcm_pkt_t **pkt);
    828 #endif
    829 
    830 #if defined(BCM_RPC_SUPPORT) || defined(BCM_RCPU_SUPPORT)
    831 /* bcm_rx_remote_pkt_free */
    832 extern int bcm_rx_remote_pkt_free(
    833     bcm_pkt_t *pkt);
    834 #endif
    835 
    836 #ifndef BCM_HIDE_DISPATCHABLE
    837 
    838 /* bcm_rx_remote_pkt_enqueue */
    839 extern int bcm_rx_remote_pkt_enqueue(
    840     int unit, 
    841     bcm_pkt_t *pkt);
    842 
    843 #if defined(BROADCOM_DEBUG)
    844 /* bcm_rx_show */
    845 extern int bcm_rx_show(
    846     int unit);
    847 #endif
    848 
    849 #endif /* BCM_HIDE_DISPATCHABLE */
    850 
    851 /* 
    852  * RX Pool
    853  * 
    854  * RX Pool is not really a true API, but an implementation of an
    855  * efficient buffer management scheme. RX uses the RX Pool allocation and
    856  * free routines as the default, and the application is free to change
    857  * them.
    858  */
    859 
    860 /* Set up the RX pool software module. */
    861 extern int bcm_rx_pool_setup(
    862     int pkt_count, 
    863     int bytes_per_pkt);
    864 
    865 /* Boolean indication of whether the RX pool module is currently set up. */
    866 extern int bcm_rx_pool_setup_done(
    867     void );
    868 
    869 /* Deallocate RX pool structures. */
    870 extern int bcm_rx_pool_cleanup(
    871     void );
    872 
    873 /* Allocate a buffer from RX pool. */
    874 extern int bcm_rx_pool_alloc(
    875     int unit, 
    876     int size, 
    877     uint32 flags, 
    878     void **pool);
    879 
    880 /* Deallocate a buffer allocated with =bcm_rx_pool_alloc. */
    881 extern int bcm_rx_pool_free(
    882     int unit, 
    883     void *buf);
    884 
    885 #if defined(BCM_RXP_DEBUG)
    886 /* Display information on RX pool buffer status. */
    887 extern void bcm_rx_pool_dump(
    888     int min, 
    889     int max);
    890 #endif
    891 
    892 #if defined(BCM_RXP_DEBUG)
    893 /* Verify the RX pool free buffer list. */
    894 extern void bcm_rx_pool_free_verify(void);
    895 #endif
    896 
    897 #if defined(BCM_RXP_DEBUG)
    898 /* Indicate ownership of an RX pool buffer. */
    899 extern void bcm_rx_pool_own(
    900     void *buf, 
    901     void *owner);
    902 #endif
    903 
    904 #if defined(BCM_RXP_DEBUG)
    905 /* Send RX pool debugging information to an output stream. */
    906 extern void bcm_rx_pool_report(
    907     int min, 
    908     int max);
    909 #endif
    910 
    911 typedef enum bcm_rx_control_e {
    912     bcmRxControlCRCStrip = 0,       /* Strip CRC from packets. */
    913     bcmRxControlVTagStrip = 1,      /* Strip VLAN tag from packets. */
    914     bcmRxControlRateStall = 2,      /* Use stall instead of discard. */
    915     bcmRxControlMultiDCB = 3,       /* Scatter data with multiple DCBs. */
    916     bcmRxControlOversizedOK = 4,    /* Accept packets larger than bufsize. */
    917     bcmRxControlIgnoreHGHeader = 5, /* Force HiGig Header into packet for fabric
    918                                        device. */
    919     bcmRxControlIgnoreSLHeader = 6, /* Force SL tag into packet on SL stacking. */
    920     bcmRxControlTmSnoopCount = 7    /* Indicate the number of snoop commands
    921                                        used for Traffic Management (TM)
    922                                        processing. */
    923 } bcm_rx_control_t;
    924 
    925 #ifndef BCM_HIDE_DISPATCHABLE
    926 
    927 /* Get RX operating modes. */
    928 extern int bcm_rx_control_get(
    929     int unit, 
    930     bcm_rx_control_t type, 
    931     int *arg);
    932 
    933 /* Configure RX operating modes. */
    934 extern int bcm_rx_control_set(
    935     int unit, 
    936     bcm_rx_control_t type, 
    937     int arg);
    938 
    939 #endif /* BCM_HIDE_DISPATCHABLE */
    940 
    941 typedef enum bcm_rx_redirect_e {
    942     bcmRxRedirectNormal = _SHR_RX_REDIRECT_NORMAL, /* Rx redirect reasons for normal
    943                                            packets. */
    944     bcmRxRedirectHigig = _SHR_RX_REDIRECT_HIGIG, /* Rx redirect reasons for higig
    945                                            packets. */
    946     bcmRxRedirectTruncated = _SHR_RX_REDIRECT_TRUNCATED /* Rx redirect reasons for truncated
    947                                            packets. */
    948 } bcm_rx_redirect_t;
    949 
    950 #ifndef BCM_HIDE_DISPATCHABLE
    951 
    952 /* Get mode specific configured redirection reasons for rx packets. */
    953 extern int bcm_rx_redirect_reasons_get(
    954     int unit, 
    955     bcm_rx_redirect_t mode, 
    956     bcm_rx_reasons_t *reasons);
    957 
    958 #endif /* BCM_HIDE_DISPATCHABLE */
    959 
    960 /* Return values from PKT RX callout routines. */
    961 typedef enum bcm_rx_trap_e {
    962     bcmRxTrapMimDiscardMacsaFwd = 0,    /* Triggered by port control
    963                                            bcmPortControlDiscardMacsaAction with
    964                                            BCM_PORT_CONTROL_DISCARD_MACSA_FWD. */
    965     bcmRxTrapMimDiscardMacsaDrop = 1,   /* Triggered by port control
    966                                            bcmPortControlDiscardMacsaAction with
    967                                            BCM_PORT_CONTROL_DISCARD_MACSA_DROP. */
    968     bcmRxTrapMimDiscardMacsaTrap = 2,   /*  Triggered by port control
    969                                            bcmPortControlDiscardMacsaAction with
    970                                            BCM_PORT_CONTROL_DISCARD_MACSA_TRAP. */
    971     bcmRxTrapMimDiscardMacsaSnoop = 3,  /* Triggered by port control
    972                                            bcmPortControlDiscardMacsaAction with
    973                                            BCM_PORT_CONTROL_DISCARD_MACSA_SNOOP. */
    974     bcmRxTrapMimTeSaMove = 4,           /*  Packet's BVID is in TE-BVID range,
    975                                            SA lookup succeeds, butSystem Port ID
    976                                            of SA lookup is different from source
    977                                            system Port ID. */
    978     bcmRxTrapMimTeSaUnknown = 5,        /*  Packet's BVID is in TE-BVID range,
    979                                            SA lookup fails. */
    980     bcmRxTrapMimSaMove = 6,             /* Packet's BVID is not in TE-BVID
    981                                            range, SA lookup succeeds. */
    982     bcmRxTrapMimSaUnknown = 7,          /* Packet's BVID is not in TE-BVID
    983                                            range, SA lookup fails. */
    984     bcmRxTrapAuthSaLookupFail = 8,      /* SA authentication fails: SA lookup
    985                                            fails. */
    986     bcmRxTrapAuthSaPortFail = 9,        /* SA authentication fails: SA lookup
    987                                            succeeds in an unpermitted port. */
    988     bcmRxTrapAuthSaVlanFail = 10,       /* SA authentication fails: SA lookup
    989                                            succeeds in an unpermitted VLAN. */
    990     bcmRxTrapSaMulticast = 11,          /* SA is multicast. */
    991     bcmRxTrapSaEqualsDa = 12,           /* SA equals DA. */
    992     bcmRxTrap8021xFail = 13,            /* 8021x authentication fails. */
    993     bcmRxTrapArpMyIp = 14,              /* If InPort is enabled for ARP trapping
    994                                            AND ARP request TPA is equal to My-IP
    995                                            (two configurable IP addresses). */
    996     bcmRxTrapArp = 15,                  /* ARP Request incoming on InPort which
    997                                            is enabled for ARP trapping. If DA is
    998                                            set to be ignored for ARP replies,
    999                                            ARP replies are also trapped with
   1000                                            this trap code. */
   1001     bcmRxTrapIgmpMembershipQuery = 16,  /* Packet is IGMP and first octet in the
   1002                                            IGMP payload is 0x11. */
   1003     bcmRxTrapIgmpReportLeaveMsg = 17,   /* Packet is IGMP and first octet in the
   1004                                            IGMP payload is 0x12, 0x16, 0x17, or
   1005                                            0x22. */
   1006     bcmRxTrapIgmpUndefined = 18,        /* Packet is IGMP and first octet in the
   1007                                            IGMP payload is not 0x11, 0x12, 0x16,
   1008                                            0x17, or 0x22. */
   1009     bcmRxTrapIcmpv6MldMcListenerQuery = 19, /* . */
   1010     bcmRxTrapL2Cache = 20,              /* Triggered by  bcm_l2_cache_set 
   1011                                            entry. */
   1012     bcmRxTrapDhcpv6Server = 21,         /* DHCP packet sent to server over
   1013                                            IPv6oE. */
   1014     bcmRxTrapDhcpv6Client = 22,         /* DHCP packet sent to client over
   1015                                            IPv6oE. */
   1016     bcmRxTrapPortNotVlanMember = 23,    /*  Initial VID membership error. */
   1017     bcmRxTrapHeaderSizeErr = 24,        /* Parser indicates header size error. */
   1018     bcmRxTrapMyBmacUknownTunnel = 25,   /* BSA lookup fail and (BDA = My-BDA). */
   1019     bcmRxTrapMyBmacUnknownISid = 26,    /*   Unknown I-SID. */
   1020     bcmRxTrapStpStateBlock = 27,        /* Packet ingresses on a blocked port.
   1021                                            Note - BPDU will be forwarded with
   1022                                            strength 6. */
   1023     bcmRxTrapStpStateLearn = 28,        /* Packet ingresses a port in a LEARN
   1024                                            state. */
   1025     bcmRxTrapIpCompMcInvalidIp = 29,    /*   L2 compatible MC, but IP does not
   1026                                            match. */
   1027     bcmRxTrapMyMacAndIpDisabled = 30,   /*   Terminated My-MAC over IP, but
   1028                                            routing is disabled for InRIF. */
   1029     bcmRxTrapTrillVersion = 31,         /* Invalid TRILL version. */
   1030     bcmRxTrapTrillTtl0 = 32,            /* Invalid TRILL TTL. */
   1031     bcmRxTrapTrillChbh = 33,            /* Unsupported TRILL option flags. */
   1032     bcmRxTrapTrillUnknonwnIngressNickname = 34, /* Unknown ingress nickname. */
   1033     bcmRxTrapTrillCite = 35,            /* Unsupported TRILL options flags. */
   1034     bcmRxTrapTrillIllegalInnerMc = 36,  /*  Invalid packet format. */
   1035     bcmRxTrapMyMacAndMplsDisable = 37,  /* Terminated My-MAC over MPLS, but MPLS
   1036                                            is disabled for InRIF. */
   1037     bcmRxTrapArpReply = 38,             /* ARP reply to My-MAC. */
   1038     bcmRxTrapMyMacAndUnknownL3 = 39,    /* Terminated My-MAC but L3 protocol is
   1039                                            unknown. */
   1040     bcmRxTrapMplsLabel0150 = 40,        /* Triggered by MPLS labels 0-15
   1041                                            forwarding Trap Code. */
   1042     bcmRxTrapMplsLabel0151 = 41,        /* Triggered by MPLS labels 0-15
   1043                                            forwarding Trap Code. */
   1044     bcmRxTrapMplsLabel0152 = 42,        /* Triggered by MPLS labels 0-15
   1045                                            forwarding Trap Code. */
   1046     bcmRxTrapMplsLabel0153 = 43,        /* Triggered by MPLS labels 0-15
   1047                                            forwarding Trap Code. */
   1048     bcmRxTrapMplsTerminationFail = 44,  /* MPLS already terminated twice by
   1049                                            label range match. Additional labels
   1050                                            may not be terminated by Label range
   1051                                            match. */
   1052     bcmRxTrapMplsUnexpectedBos = 45,    /* Terminated MPLS label indicates that
   1053                                            another MPLS shim is to follow,
   1054                                            however the terminated label is BOS. */
   1055     bcmRxTrapMplsUnexpectedNoBos = 46,  /* Reserved MPLS label (0.15) is mapped
   1056                                            to this action by
   1057                                            ppd_mpls_term_reserved_label_info_set(). */
   1058     bcmRxTrapCfmAcceleratedIngress = 47, /* ITU Y.1731 packet observed (CFM). */
   1059     bcmRxTrapIllegelPacketFormat = 48,  /* Parser failure. */
   1060     bcmRxTrapL2DiscardMacsaFwd = 49,    /* Triggered by control
   1061                                            bcmPortControlDiscardMacsaAction with
   1062                                             BCM_PORT_CONTROL_DISCARD_MACSA_FWD. */
   1063     bcmRxTrapL2DiscardMacsaDrop = 50,   /* Triggered by control
   1064                                            bcmPortControlDiscardMacsaAction with
   1065                                             BCM_PORT_CONTROL_DISCARD_MACSA_FWD . */
   1066     bcmRxTrapL2DiscardMacsaTrap = 51,   /* Triggered by control
   1067                                            bcmPortControlDiscardMacsaAction with
   1068                                             BCM_PORT_CONTROL_DISCARD_MACSA_DROP. */
   1069     bcmRxTrapL2DiscardMacsaSnoop = 52,  /* Triggered by control
   1070                                            bcmPortControlDiscardMacsaAction with
   1071                                             BCM_PORT_CONTROL_DISCARD_MACSA_TRAP. */
   1072     bcmRxTrapL2Learn0 = 53,             /* Triggered by bcm_port_learn_set with
   1073                                            flag =
   1074                                            BCM_PORT_LEARN_ARL|BCM_PORT_LEARN_FWD. */
   1075     bcmRxTrapL2Learn1 = 54,             /* Triggered by bcm_port_learn_set with
   1076                                            flag =
   1077                                            BCM_PORT_LEARN_CPU|BCM_PORT_LEARN_FWD. */
   1078     bcmRxTrapL2Learn2 = 55,             /* Triggered by bcm_port_learn_set with
   1079                                            flag = BCM_PORT_LEARN_ARL. */
   1080     bcmRxTrapL2Learn3 = 56,             /* Triggered by bcm_port_learn_set with
   1081                                            flag = BCM_PORT_LEARN_FWD |
   1082                                            BCM_PORT_LEARN_CPU. */
   1083     bcmRxTrapVlanUnknownDa = 57,        /* Per VLAN/VSI 8 flooding profiled can
   1084                                            be set for unknown packets. These
   1085                                            Trap code define the flooding
   1086                                            profile. The flooding multicast group
   1087                                            is the VLAN/VSI base flooding group +
   1088                                            the flooding offset. */
   1089     bcmRxTrapExternalLookupError = 58,  /* ELK is accessed and returns an error. */
   1090     bcmRxTrapL2DlfFwd = 59,             /* per port trap when DA is not found,
   1091                                            see bcmPortControlUnknownMacDaAction
   1092                                            BCM_PORT_CONTROL_UNKNOWN_MACDA_FWD. */
   1093     bcmRxTrapL2DlfDrop = 60,            /* BCM_PORT_CONTROL_UNKNOWN_MACDA_DROP. */
   1094     bcmRxTrapL2DlfTrap = 61,            /* BCM_PORT_CONTROL_UNKNOWN_MACDA_TRAP. */
   1095     bcmRxTrapL2DlfSnoop = 62,           /* BCM_PORT_CONTROL_UNKNOWN_MACDA_SNOOP. */
   1096     bcmRxTrapExtendedP2pLookupFail = 63, /* Transparent P2P Lookup key is not
   1097                                            found in the ELK/LEM. */
   1098     bcmRxTrapSameInterface = 64,        /* Source interface is equal to
   1099                                            destination interface (hair-pin). */
   1100     bcmRxTrapTrillUnknownUc = 65,       /* Forwarding Code is TRILL, lookup key
   1101                                            is not found in ELK/LEM. */
   1102     bcmRxTrapTrillUnknownMc = 66,       /* Forwarding Code is TRILL, lookup key
   1103                                            is not found in ELK/LEM. */
   1104     bcmRxTrapUcLooseRpfFail = 67,       /* Forwarding Code is IPv4 UC and RPF
   1105                                            FEC Pointer Valid is not set. */
   1106     bcmRxTrapDefaultUcv6 = 68,          /* IPv6 UC default forwarding. */
   1107     bcmRxTrapDefaultMcv6 = 69,          /* IPv6 MC default forwarding. */
   1108     bcmRxTrapMplsP2pNoBos = 70,         /* Lookup key is found in ELK/LEM,
   1109                                            P2P-Service If lookup result is set,
   1110                                            and header is not BOS.. */
   1111     bcmRxTrapMplsControlWordTrap = 71,  /* Lookup key is found in ELK/LEM,
   1112                                            P2P-Service If lookup result is set,
   1113                                            lookup result determines that there's
   1114                                            a control word, nibble after MPLS
   1115                                            stack equal '1'. */
   1116     bcmRxTrapMplsControlWordDrop = 72,  /* Lookup key is found in ELK/LEM,
   1117                                            P2P-Service If lookup result is set,
   1118                                            lookup result determines that there's
   1119                                            a control word, nibble after MPLS
   1120                                            stack does not equal '1' or '0'. */
   1121     bcmRxTrapMplsUnknownLabel = 73,     /* Lookup key is not found in ELK/LEM. */
   1122     bcmRxTrapMplsExtendP2pMplsx4 = 74,  /* Extended P2P service with 4 MPLS
   1123                                            labels. */
   1124     bcmRxTrapFrwrdIgmpMembershipQuery = 75, /* Forwarded packet is IGMP and first
   1125                                            octet in the IGMP payload is 0x11. */
   1126     bcmRxTrapFrwrdIgmpReportLeaveMsg = 76, /* Forwarded packet is IGMP and first
   1127                                            octet in the IGMP payload is 0x12,
   1128                                            0x16, 0x17, or 0x22. */
   1129     bcmRxTrapFrwrdIgmpUndefined = 77,   /* Forwarded packet is IGMP and first
   1130                                            octet in the IGMP payload is not
   1131                                            0x11, 0x12, 0x16, 0x17, or 0x22. */
   1132     bcmRxTrapFrwrdIcmpv6MldMcListenerQuery = 78, /* Forwarded packet is ICMPv6 with an
   1133                                            MLD type, IPv6 packet with IP
   1134                                            protocol 58 and the ICMPv6 type is
   1135                                            130. */
   1136     bcmRxTrapFrwrdIcmpv6MldReportDone = 79, /* Forwarded packet is ICMPv6 with an
   1137                                            MLD type, IPv6 packet with IP
   1138                                            protocol 58 and the ICMPv6 type is
   1139                                            131,132 or 143. */
   1140     bcmRxTrapFrwrdIcmpv6MldUndefined = 80, /* Forwarded packet is ICMPv6 with an
   1141                                            MLD type, IPv6 packet with IP
   1142                                            protocol 58 and the ICMPv6 type is
   1143                                            other than 130,131,132 or 143. */
   1144     bcmRxTrapIpv4VersionError = 81,     /* Version is different than 4. */
   1145     bcmRxTrapIpv4ChecksumError = 82,    /*  IHL is 5 and the checksum over the
   1146                                            first 20 bytes doesn't verify. */
   1147     bcmRxTrapIpv4HeaderLengthError = 83, /* IHL (Internet Header Length) is less
   1148                                            than 5. */
   1149     bcmRxTrapIpv4TotalLengthError = 84, /* Total length is less than 20. */
   1150     bcmRxTrapIpv4Ttl0 = 85,             /* TTL is equal to 0. */
   1151     bcmRxTrapIpv4HasOptions = 86,       /* IHL (Internet Header Length) is
   1152                                            greater than 5. */
   1153     bcmRxTrapIpv4Ttl1 = 87,             /* In-TTL is 0. */
   1154     bcmRxTrapIpv4SipEqualDip = 88,      /* Source-IP is equal to destination IP. */
   1155     bcmRxTrapIpv4DipZero = 89,          /* Destination IP is 0. */
   1156     bcmRxTrapIpv4SipIsMc = 90,          /* Source-IP is multicast. */
   1157     bcmRxTrapIpv4TunnelTerminationAndFragmented = 91, /* Fragmented  IPv4 packet over an IPv4
   1158                                            tunnel. */
   1159     bcmRxTrapIpv6VersionError = 92,     /* Version is different than 6. */
   1160     bcmRxTrapIpv6HopCount0 = 93,        /* Hop count (TTL) is 0. */
   1161     bcmRxTrapIpv6HopCount1 = 94,        /* Hop count (TTL) is 1. */
   1162     bcmRxTrapIpv6UnspecifiedDestination = 95, /* Forwarding header DIP = ::. */
   1163     bcmRxTrapIpv6LoopbackAddress = 96,  /* DIP = ::1 or SIP = ::1. */
   1164     bcmRxTrapIpv6MulticastSource = 97,  /* The MSB of the SIP = 0xFF. */
   1165     bcmRxTrapIpv6NextHeaderNull = 98,   /* Next-protocol is zero. */
   1166     bcmRxTrapIpv6UnspecifiedSource = 99, /* SIP = ::. */
   1167     bcmRxTrapIpv6LocalLinkDestination = 100, /* Bits 127:118 of the destination-IP
   1168                                            are equal to 0x3FA. */
   1169     bcmRxTrapIpv6LocalSiteDestination = 101, /* Bits 127:118 of the DIP = 0x3FB
   1170                                            (deprecated). */
   1171     bcmRxTrapIpv6LocalLinkSource = 102, /* Bits 127:118 of the SIP = 0x3FA. */
   1172     bcmRxTrapIpv6LocalSiteSource = 103, /* Bits 127:118 of the SIP = 0x3FB. */
   1173     bcmRxTrapIpv6Ipv4CompatibleDestination = 104, /* Bits 127:32 of the DIP = 0. */
   1174     bcmRxTrapIpv6Ipv4MappedDestination = 105, /* Bits 127:32 of the DIP are equal to
   1175                                            0000_FFF_0000_0000_0000_0000. */
   1176     bcmRxTrapIpv6MulticastDestination = 106, /* MSB of the DIP=0xFF. */
   1177     bcmRxTrapMplsTtl0 = 107,            /* TTL is equal to 0. */
   1178     bcmRxTrapMplsTtl1 = 108,            /* TTL is equal to 1. */
   1179     bcmRxTrapTcpSnFlagsZero = 109,      /* L4 Sequence-Number and Flags (6) are
   1180                                            both zero. */
   1181     bcmRxTrapTcpSnZeroFlagsSet = 110,   /* L4 Sequence-Number is zero and either
   1182                                            Flags. FIN, Flags. URG or FLAGS. PSH
   1183                                            are set. */
   1184     bcmRxTrapTcpSynFin = 111,           /* Both Flags. SYN and Flags. FIN are
   1185                                            set. */
   1186     bcmRxTrapTcpEqualPorts = 112,       /* Source-Port equals Destination-Port. */
   1187     bcmRxTrapTcpFragmentIncompleteHeader = 113, /* L3 is IPv4 and IP-Header. Fragmented
   1188                                            and IP-Header. Fragment-Offset zero
   1189                                            and (IPv4-Header. Total-Length - 4 *
   1190                                            IPv4-Header. IHL) is less than 20B. */
   1191     bcmRxTrapTcpFragmentOffsetLt8 = 114, /* L3 is IPv4 and IP-Header. Fragmented
   1192                                            and IP-Header. Fragment-Offset is
   1193                                            less than 8. */
   1194     bcmRxTrapUdpEqualPorts = 115,       /* Source-Port equals Destination-Port. */
   1195     bcmRxTrapIcmpDataGt576 = 116,       /* L3 is IPv4 and (IPv4-Header.
   1196                                            Total-Length - 4* IPv4-Header. IHL)
   1197                                            is greater than 576B or layer-3 is
   1198                                            IPv6 and IPv6-Header. Payload-Length
   1199                                            is greater than 576B. */
   1200     bcmRxTrapIcmpFragmented = 117,      /* IP-Header. Fragmented is set. */
   1201     bcmRxTrapFailoverFacilityInvalid = 118, /* Both Destination-0-Valid and
   1202                                            Destination-1-Valid are not set. */
   1203     bcmRxTrapUcStrictRpfFail = 119,     /* UC-RPF-Mode is 'Strict' and OutRIF is
   1204                                            not equal to packet InRIF . */
   1205     bcmRxTrapMcExplicitRpfFail = 120,   /* RPF-Entry. Expected-InRIF is not
   1206                                            equal to packet InRIF Relevant when
   1207                                            FEC-Entry. MC-RPF-Mode is 'Explicit'. */
   1208     bcmRxTrapMcUseSipRpfFail = 121,     /* Out-RIF is not equal to In-RIF when
   1209                                            MC-RPF-Mode is 'Use-SIP-WITH-ECMP'
   1210                                            Note: . */
   1211     bcmRxTrapMcUseSipMultipath = 122,   /* Found RPF-ECMP-Group-Size > '1'
   1212                                            Relevant when MC-RPF-Mode is
   1213                                            'Use-SIP'. */
   1214     bcmRxTrapIcmpRedirect = 123,        /* ICMP-Redirect is enabled,
   1215                                            Forwarding-Code is IPv4|6-UC, and
   1216                                            packet InRIF is equal to FEC-Entry.
   1217                                            OutRIF. */
   1218     bcmRxTrapOamp = 124,                /* . */
   1219     bcmRxTrapOampTrapErr = 125,         /* Packet arrived to the OAMP with
   1220                                            illegal trap code. */
   1221     bcmRxTrapOampTypeErr = 126,         /* Packet arrived to the OAMP with
   1222                                            illegal mep type. */
   1223     bcmRxTrapOampRmepErr = 127,         /* Packet arrived to the OAMP with RMEP
   1224                                            index miss. */
   1225     bcmRxTrapOampMaidErr = 128,         /* Packet arrived to the OAMP with MAID
   1226                                            miss. */
   1227     bcmRxTrapOampMdlErr = 129,          /* Packet arrived to the OAMP with MDL
   1228                                            miss. */
   1229     bcmRxTrapOampCcmIntrvErr = 130,     /* Packet arrived to the OAMP with CCM
   1230                                            interval miss. */
   1231     bcmRxTrapOampMyDiscErr = 131,       /* Packet arrived to the OAMP with My
   1232                                            Discriminator miss (BFD). */
   1233     bcmRxTrapOampSrcIpErr = 132,        /* Packet arrived to the OAMP with
   1234                                            source IP address miss (BFD). */
   1235     bcmRxTrapOampYourDiscErr = 133,     /* Packet arrived to the OAMP with Your
   1236                                            Discriminator miss (BFD). */
   1237     bcmRxTrapOampSrcPortErr = 134,      /* Packet arrived to the OAMP with UDP
   1238                                            source port miss (BFD). */
   1239     bcmRxTrapOampRmepStateChange = 135, /* BFD packet arrived that does not
   1240                                            match the current RMEP state. */
   1241     bcmRxTrapOampParityErr = 136,       /* Parity error occurred in the OAMP. */
   1242     bcmRxTrapOampTimestampErr = 137,    /* Packet arrived to the OAMP with
   1243                                            timestamp miss. */
   1244     bcmRxTrapOampProtection = 138,      /* OAMP protection packet. */
   1245     bcmRxTrapOamEthAccelerated = 139,   /* . */
   1246     bcmRxTrapOamMplsAccelerated = 140,  /* In T20E this trap code cannot be used
   1247                                            in
   1248                                            ppd_trap_frwrd_profile_info_set(),ppd_trap_snoop*_profile_info_set()
   1249                                            as trap_ndx, it's only used as
   1250                                            Trap-code in the packet header. */
   1251     bcmRxTrapOamBfdIpTunnelAccelerated = 141, /* . */
   1252     bcmRxTrapOamBfdPweAccelerated = 142, /* . */
   1253     bcmRxTrapOamEthUpAccelerated = 143, /* . */
   1254     bcmRxTrapEgPortNotVlanMember = 144, /* egress vlan membership. */
   1255     bcmRxTrapEgHairPinFilter = 145,     /* . */
   1256     bcmRxTrapEgSplitHorizonFilter = 146, /* . */
   1257     bcmRxTrapEgUnknownDa = 147,         /* uc unknown DA. */
   1258     bcmRxTrapEgMtuFilter = 148,         /* packet size > mtu. */
   1259     bcmRxTrapEgPvlanFilter = 149,       /* private vlan filter. */
   1260     bcmRxTrapEgDiscardFrameTypeFilter = 150, /* not acceptable frame type on port
   1261                                            (tagged, untagged). */
   1262     bcmRxTrapEgTrillHairPinFilter = 151, /* trill same in/out interface. */
   1263     bcmRxTrapEgTrillBounceBack = 152,   /* prevent bounce back of trill
   1264                                            terminated unicast packets by the
   1265                                            egress router bridge in case of a DA
   1266                                            not found. */
   1267     bcmRxTrapEgTrillTtl0 = 153,         /* trill invalid ttl (egress). */
   1268     bcmRxTrapEgIpmcTtlErr = 154,        /* IPv4 MC packet with invalid ttl. */
   1269     bcmRxTrapEgCfmAccelerated = 155,    /* CFM packet at egress. */
   1270     bcmRxTrapDssStacking = 156,         /* Trap according to Dss stacking denail
   1271                                            (history Bitmap). */
   1272     bcmRxTrapLagMulticast = 157,        /* Trap Lag Multicast Packets. */
   1273     bcmRxTrapExEgCnm = 158,             /* CNM packet. */
   1274     bcmRxTrapTrillDesignatedVlanNoMymac = 159, /* EoTrilloE packet is not designtated
   1275                                            vlan but with my-mac, or designated
   1276                                            vlan but without my-mac. Disable
   1277                                            bridging for such packets. */
   1278     bcmRxTrapAdjacentCheckFail = 160,   /* TRILL adjacent check fail. */
   1279     bcmRxTrapFcoeSrcIdMismatchSa = 161, /* FCoE, where FC.SrC is mismatch
   1280                                            Eth.SA. */
   1281     bcmRxTrapSipMove = 162,             /* sip transplant. */
   1282     bcmRxTrapOamY1731MplsTp = 163,      /* . */
   1283     bcmRxTrapOamY1731Pwe = 164,         /* . */
   1284     bcmRxTrapOamBfdIpv4 = 165,          /* . */
   1285     bcmRxTrapOamBfdMpls = 166,          /* . */
   1286     bcmRxTrapOamBfdPwe = 167,           /* . */
   1287     bcmRxTrapOamBfdCcMplsTp = 168,      /* . */
   1288     bcmRxTrapOamBfdCvMplsTp = 169,      /* . */
   1289     bcmRxTrapOamLevel = 170,            /* OAM packet with mdlevel below highest
   1290                                            MEP on active side. */
   1291     bcmRxTrapOamPassive = 171,          /* OAM packet equal or below highest MEP
   1292                                            level on passive side. */
   1293     bcmRxTrap1588 = 172,                /* 1588 protocol packet. */
   1294     bcmRxTrapMplsLabelIndexNoSupport = 173, /* No support to forward according to
   1295                                            MPLS forth label. */
   1296     bcmRxTrapDhcpv4Client = 174,        /* DHCP packet sent to client over
   1297                                            IPv4oE. */
   1298     bcmRxTrapDhcpv4Server = 175,        /* DHCP packet sent to server over
   1299                                            IPv4oE. */
   1300     bcmRxTrapEtherIpVersion = 176,      /* IPv4 version error, for
   1301                                            IPv4oEtheroIPv4oEth packet. */
   1302     bcmRxTrapEgressObjectAccessed = 177, /* Egress object entry was accessed due
   1303                                            to packet lookup. */
   1304     bcmRxTrapIcmpv6MldReportDone = 178, /* ICMPv6 packet with an MLD with done
   1305                                            message. */
   1306     bcmRxTrapIcmpv6MldUndefined = 179,  /* ICMPv6 packet with an MLD with other
   1307                                            message. */
   1308     bcmRxTrapFailover1Plus1Fail = 180,  /* 1 plus 1 protected LIF and failover
   1309                                            status is down. */
   1310     bcmRxTrapEgInvalidDestPort = 181,   /* Egress trap: Invalid out port number. */
   1311     bcmRxTrapEgIpv4VersionError = 182,  /* Egress trap: Version is different
   1312                                            than 4.. */
   1313     bcmRxTrapEgIpv4ChecksumError = 183, /* Egress trap: IHL is 5 and the
   1314                                            checksum over the first 20 bytes
   1315                                            doesn't verify. */
   1316     bcmRxTrapEgIpv4HeaderLengthError = 184, /* Egress trap: IHL (Internet Header
   1317                                            Length) is less than 5. */
   1318     bcmRxTrapEgIpv4TotalLengthError = 185, /* Egress trap: Total length is less
   1319                                            than 20. */
   1320     bcmRxTrapEgIpv4Ttl0 = 186,          /* Egress trap: TTL is equal to 0. */
   1321     bcmRxTrapEgIpv4HasOptions = 187,    /* Egress trap: IHL (Internet Header
   1322                                            Length) is greater than 5. */
   1323     bcmRxTrapEgIpv4Ttl1 = 188,          /* Egress trap: In-TTL is 0. */
   1324     bcmRxTrapEgIpv4SipEqualDip = 189,   /* Egress trap: Source-IP is equal to
   1325                                            destination IP. */
   1326     bcmRxTrapEgIpv4DipZero = 190,       /* Egress trap: Destination IP is 0. */
   1327     bcmRxTrapEgIpv4SipIsMc = 191,       /* Egress trap: Source-IP is multicast. */
   1328     bcmRxTrapEgIpv6UnspecifiedDestination = 192, /* Egress trap: Forwarding header DIP =
   1329                                            ::. */
   1330     bcmRxTrapEgIpv6LoopbackAddress = 193, /* Egress trap: DIP = ::1 or SIP = ::1. */
   1331     bcmRxTrapEgIpv6MulticastSource = 194, /* Egress trap: The MSB of the SIP =
   1332                                            0xFF. */
   1333     bcmRxTrapEgIpv6UnspecifiedSource = 195, /* Egress trap: SIP = ::. */
   1334     bcmRxTrapEgIpv6LocalLinkDestination = 196, /* Egress trap: Bits 127:118 of the
   1335                                            destination-IP are equal to 0x3FA. */
   1336     bcmRxTrapEgIpv6LocalSiteDestination = 197, /* Egress trap: Bits 127:118 of the DIP
   1337                                            = 0x3FB (deprecated). */
   1338     bcmRxTrapEgIpv6LocalLinkSource = 198, /* Egress trap: Bits 127:118 of the SIP
   1339                                            = 0x3FA. */
   1340     bcmRxTrapEgIpv6LocalSiteSource = 199, /* Egress trap: Bits 127:118 of the SIP
   1341                                            = 0x3FB. */
   1342     bcmRxTrapEgIpv6Ipv4CompatibleDestination = 200, /* Egress trap: Bits 127:32 of the DIP =
   1343                                            0. */
   1344     bcmRxTrapEgIpv6Ipv4MappedDestination = 201, /* Egress trap: Bits 127:32 of the DIP
   1345                                            are equal to
   1346                                            0000_FFF_0000_0000_0000_0000. */
   1347     bcmRxTrapEgIpv6MulticastDestination = 202, /* Egress trap: MSB of the DIP=0xFF. */
   1348     bcmRxTrapEgIpv6NextHeaderNull = 203, /* Egress trap: Next-protocol is zero. */
   1349     bcmRxTrapUserDefine = 204,          /* User define traps. */
   1350     bcmRxTrapReserved = 205,            /* Reserved */
   1351     bcmRxTrapFcoeZoneCheckFail = 206,   /* Fcoe zone check failed. */
   1352     bcmRxTrapArplookupFail = 207,       /* For ARP packet, lookup for VRF and
   1353                                            TPA (IP) failed. */
   1354     bcmRxTrapL2cpPeer = 208,            /* L2CP trapped to peer destination. */
   1355     bcmRxTrapL2cpDrop = 209,            /* L2CP dropped. */
   1356     bcmRxTrapMimMyBmacMulticastContinue = 210, /* Terminated BMAC header indicates
   1357                                            Multicast. Continue on both BMAC
   1358                                            header and CMAC header. */
   1359     bcmRxTrapBfdEchoOverIpv4 = 211,     /* IPv4 BFD Echo. */
   1360     bcmRxTrapDfltDroppedPacket = 212,   /* Dropped packet */
   1361     bcmRxTrapDfltRedirectToCpuPacket = 213, /* Packet redirected to CPU */
   1362     bcmRxTrapRedirectToCpuOamPacket = 214, /* OAM Packet redirected to CPU */
   1363     bcmRxTrapSnoopOamPacket = 215,      /* OAM Packet snooped */
   1364     bcmRxTrapRecycleOamPacket = 216,    /* RxTrapRecycleOamPacket */
   1365     bcmRxTrapItmhSnoop0 = 217,          /* ITMH packet with Snoop field equal to
   1366                                            0 */
   1367     bcmRxTrapItmhSnoop1 = 218,          /* ITMH packet with Snoop field equal to
   1368                                            1 */
   1369     bcmRxTrapItmhSnoop2 = 219,          /* ITMH packet with Snoop field equal to
   1370                                            2 */
   1371     bcmRxTrapItmhSnoop3 = 220,          /* ITMH packet with Snoop field equal to
   1372                                            3 */
   1373     bcmRxTrapItmhSnoop4 = 221,          /* ITMH packet with Snoop field equal to
   1374                                            4 */
   1375     bcmRxTrapItmhSnoop5 = 222,          /* ITMH packet with Snoop field equal to
   1376                                            5 */
   1377     bcmRxTrapItmhSnoop6 = 223,          /* ITMH packet with Snoop field equal to
   1378                                            6 */
   1379     bcmRxTrapItmhSnoop7 = 224,          /* ITMH packet with Snoop field equal to
   1380                                            7 */
   1381     bcmRxTrapItmhSnoop8 = 225,          /* ITMH packet with Snoop field equal to
   1382                                            8 */
   1383     bcmRxTrapItmhSnoop9 = 226,          /* ITMH packet with Snoop field equal to
   1384                                            9 */
   1385     bcmRxTrapItmhSnoop10 = 227,         /* ITMH packet with Snoop field equal to
   1386                                            10 */
   1387     bcmRxTrapItmhSnoop11 = 228,         /* ITMH packet with Snoop field equal to
   1388                                            11 */
   1389     bcmRxTrapItmhSnoop12 = 229,         /* ITMH packet with Snoop field equal to
   1390                                            12 */
   1391     bcmRxTrapItmhSnoop13 = 230,         /* ITMH packet with Snoop field equal to
   1392                                            13 */
   1393     bcmRxTrapItmhSnoop14 = 231,         /* ITMH packet with Snoop field equal to
   1394                                            14 */
   1395     bcmRxTrapItmhSnoop15 = 232,         /* ITMH packet with Snoop field equal to
   1396                                            15 */
   1397     bcmRxTrapFcoeFcfPacket = 233,       /* FCF FCoE packets with fixed
   1398                                            forwarding-header location */
   1399     bcmRxTrapVlanTagDiscard = 234,      /* Discarded packets according to their
   1400                                            VLAN Tag configuration */
   1401     bcmRxTrapVlanTagAccept = 235,       /* Accepted packets according to their
   1402                                            VLAN Tag configuration */
   1403     bcmRxTrap1588Discard = 236,         /* Discarded 1588 packets */
   1404     bcmRxTrap1588Accepted = 237,        /* Accepted 1588 packets */
   1405     bcmRxTrapInnerIpCompMcInvalidIp = 238, /* L2 compatible MC in inner Ethernet,
   1406                                            but IP does not match */
   1407     bcmRxTrapIllegalReservedLabel = 239, /* Unexpected MPLS reserved label. */
   1408     bcmRxTrapInnerMyMacAndIpDisabled = 240, /* Terminated Inner-My-MAC over IP, but
   1409                                            routing is disabled for InRIF */
   1410     bcmRxTrapEgTxFieldSnoop0 = 241,     /* Egress snoop from Egress Field
   1411                                            Processor profile 0 */
   1412     bcmRxTrapEgTxFieldSnoop1 = 242,     /* Egress snoop from Egress Field
   1413                                            Processor profile 1 */
   1414     bcmRxTrapEgTxFieldSnoop2 = 243,     /* Egress snoop from Egress Field
   1415                                            Processor profile 2 */
   1416     bcmRxTrapEgTxFieldSnoop3 = 244,     /* Egress snoop from Egress Field
   1417                                            Processor profile 3 */
   1418     bcmRxTrapEgTxFieldSnoop4 = 245,     /* Egress snoop from Egress Field
   1419                                            Processor profile 4 */
   1420     bcmRxTrapEgTxFieldSnoop5 = 246,     /* Egress snoop from Egress Field
   1421                                            Processor profile 5 */
   1422     bcmRxTrapEgTxFieldSnoop6 = 247,     /* Egress snoop from Egress Field
   1423                                            Processor profile 6 */
   1424     bcmRxTrapEgTxFieldSnoop7 = 248,     /* Egress snoop from Egress Field
   1425                                            Processor profile 7 */
   1426     bcmRxTrapEgTxFieldSnoop8 = 249,     /* Egress snoop from Egress Field
   1427                                            Processor profile 8 */
   1428     bcmRxTrapEgTxFieldSnoop9 = 250,     /* Egress snoop from Egress Field
   1429                                            Processor profile 9 */
   1430     bcmRxTrapEgTxFieldSnoop10 = 251,    /* Egress snoop from Egress Field
   1431                                            Processor profile 10 */
   1432     bcmRxTrapEgTxFieldSnoop11 = 252,    /* Egress snoop from Egress Field
   1433                                            Processor profile 11 */
   1434     bcmRxTrapEgTxFieldSnoop12 = 253,    /* Egress snoop from Egress Field
   1435                                            Processor profile 12 */
   1436     bcmRxTrapEgTxFieldSnoop13 = 254,    /* Egress snoop from Egress Field
   1437                                            Processor profile 13 */
   1438     bcmRxTrapEgTxFieldSnoop14 = 255,    /* Egress snoop from Egress Field
   1439                                            Processor profile 14 */
   1440     bcmRxTrapEgTxFieldSnoop15 = 256,    /* Egress snoop from Egress Field
   1441                                            Processor profile 15 */
   1442     bcmRxTrapOutVPortDiscard = 257,     /* Out-VPort discarding any traffic */
   1443     bcmRxTrapEgTxStpStateFail = 258,    /* ess STP state failure */
   1444     bcmRxTrapEgTxProtectionPathUnexpected = 259, /* Unexpected Traffic on a Protecting
   1445                                            Path */
   1446     bcmRxTrapOutVPortLookupFail = 260,  /* Out-VPort lookup fail */
   1447     bcmRxTrapOamBfdIpv6 = 261,          /* Bfd over Ipv6 trap code */
   1448     bcmRxTrapOamMipSnoop2ndPass = 262,  /* Snoop OAM packets with egress info
   1449                                            (out port). */
   1450     bcmRxTrapSat0 = 263,                /* Sat trap code No 0 */
   1451     bcmRxTrapSat1 = 264,                /* Sat trap code No 1 */
   1452     bcmRxTrapSat2 = 265,                /* Sat trap code No 2 */
   1453     bcmRxTrapEgTxPortNotVlanMember = 266, /* Egress STP state failure */
   1454     bcmRxTrapEgTxDiscardFrameTypeFilter = 267, 
   1455     bcmRxTrapEgTxMtuFilter = 268, 
   1456     bcmRxTrapEgTxSplitHorizonFilter = 269, 
   1457     bcmRxTrapOamUpMEP = 270,            /* Default trap code for OAM Up MEPs */
   1458     bcmRxTrapBfdOamDownMEP = 271,       /* Default trap code for OAM Down MEPs
   1459                                            and BFD */
   1460     bcmRxTrapOamUpMEP2 = 272,           /* Default destination is OAMP */
   1461     bcmRxTrapOamUpMEP3 = 273, 
   1462     bcmRxTrapOamUpMEP4 = 274,           /* To be used by
   1463                                            bcm_oam_endpoint_action_set */
   1464     bcmRxTrapSer = 275,                 /* Packet which has SER (mem-soft-error)
   1465                                            which accumulated along the pipe
   1466                                            Ingress . */
   1467     bcmRxTrapEgTxSer = 276,             /* ETPP SW Error Recovery trap. */
   1468     bcmRxTrapEgSer = 277,               /* ERPP SW Error Recovery trap. */
   1469     bcmRxTrapMplsTunnelTerminationTtl0 = 278, /* Mpls tunnel termination trap with TTL
   1470                                            equal to 0. */
   1471     bcmRxTrapMplsTunnelTerminationTtl1 = 279, /* Mpls tunnel termination trap with TTL
   1472                                            equal to 1. */
   1473     bcmRxTrapMplsForwardingTtl0 = 280,  /* Mpls forwarding trap with TTL equal
   1474                                            to 0. */
   1475     bcmRxTrapMplsForwardingTtl1 = 281,  /* Mpls forwarding trap with TTL equal
   1476                                            to 1. */
   1477     bcmRxTrapOampChanTypeMissErr = 282, /* Mpls OAM channel type mismatch error */
   1478     bcmRxTrapOampFlexCrcMissErr = 283,  /* OAM PDU flex CRC mismacth error */
   1479     bcmRxTrapNdp = 284,                 /* An ICMP-NDP Neighbor Solicitation
   1480                                            request is identified when the packet
   1481                                            is ICMPoIPv6 packet, and the ICMP
   1482                                            type is 135. */
   1483     bcmRxTrapNdpMyIp = 285,             /* A packet is considered NdpMyIp when
   1484                                            its Target-Address matches one of two
   1485                                            configurable MyNDP IPv6 addresses. */
   1486     bcmRxTrapEgTxLatency = 286,         /* Latency ETPP trap */
   1487     bcmRxTrapEgTxMetering = 287,        /* Metering ETPP trap */
   1488     bcmRxTrapEgTxGlem = 288,            /* GLEM error ETPP trap */
   1489     bcmRxTrapEgTxOamUpMEPOamp = 289,    /* ETPP trap for OAM Up MEPs with
   1490                                            destination OAMP */
   1491     bcmRxTrapEgTxOamUpMEPDest1 = 290,   /* ETPP trap for OAM Up MEPs with
   1492                                            configurable destination */
   1493     bcmRxTrapEgTxOamUpMEPDest2 = 291,   /* ETPP trap for OAM Up MEPs with
   1494                                            configurable destination */
   1495     bcmRxTrapEgTxOamPassive = 292,      /* OAM passive error ETPP trap */
   1496     bcmRxTrapEgTxOamLevel = 293,        /* OAM level error ETPP trap */
   1497     bcmRxTrapEgRqpDiscard = 294,        /* RQP discard ERPP trap */
   1498     bcmRxTrapEgTdmDiscard = 295,        /* TDM discard ERPP trap */
   1499     bcmRxTrapEgExcludeSrc = 296,        /* Exclude source ERPP trap */
   1500     bcmRxTrapEgGlemPpTrap = 297,        /* GLEM PP ERPP trap */
   1501     bcmRxTrapEgGlemNonePpTrap = 298,    /* GLEM None PP ERPP trap */
   1502     bcmRxTrapEgIpv4Error = 299,         /* IPV4 error ERPP trap */
   1503     bcmRxTrapEgIpv6Error = 300,         /* IPV6 error ERPP trap */
   1504     bcmRxTrapEgL4Error = 301,           /* Layer4 error ERPP trap */
   1505     bcmRxTrapOamReflector = 302,        /* down MEP OAM reflector Trap */
   1506     bcmRxTrapEgTxOamReflector = 303,    /* up MEP OAM reflector Trap */
   1507     bcmRxTrapEgUserDefine = 304,        /* User defined ERPP Trap */
   1508     bcmRxTrapEgTxUserDefine = 305,      /* User defined ETPP Trap */
   1509     bcmRxTrapLinkLayerVlanTagDiscard = 306, /* Discarded packets according to their
   1510                                            VLAN Tag configuration */
   1511     bcmRxTrapTerminatedVlanTagDiscard = 307, /* Discarded packets according to their
   1512                                            terminated VLAN Tag configuration */
   1513     bcmRxTrapLinkLayerVlanTagAccept = 308, /* Accepted packets according to their
   1514                                            VLAN Tag configuration */
   1515     bcmRxTrapTerminatedVlanTagAccept = 309, /* Accepted packets according to their
   1516                                            terminated VLAN Tag configuration */
   1517     bcmRxTrapLinkLayerSaEqualsDa = 310, /* SA equals DA. */
   1518     bcmRxTrapTerminatedSaEqualsDa = 311, /* SA equals DA. */
   1519     bcmRxTrapLinkLayerSaMulticast = 312, /* SA is multicast. */
   1520     bcmRxTrapTerminatedSaMulticast = 313, /* SA is multicast. */
   1521     bcmRxTrapLinkLayerHeaderSizeErr = 314, /* Parser indicates header size error. */
   1522     bcmRxTrapTerminatedHeaderSizeErr = 315, /* Parser indicates terminated header
   1523                                            size error. */
   1524     bcmRxTrapForwardingIpv4VersionError = 316, /* Version is different than 4. */
   1525     bcmRxTrapTerminatedIpv4VersionError = 317, /* Terminated IPv4 Version is different
   1526                                            than 4. */
   1527     bcmRxTrapForwardingIpv4ChecksumError = 318, /* IHL is 5 and the checksum over the
   1528                                            first 20 bytes doesn't verify. */
   1529     bcmRxTrapTerminatedIpv4ChecksumError = 319, /* Terminated IPv4 IHL is 5 and the
   1530                                            checksum over the first 20 bytes
   1531                                            doesn't verify. */
   1532     bcmRxTrapForwardingIpv4HeaderLengthError = 320, /* IHL (Internet Header Length) is less
   1533                                            than 5. */
   1534     bcmRxTrapTerminatedIpv4HeaderLengthError = 321, /* Terminated IPv4 IHL (Internet Header
   1535                                            Length) is less than 5. */
   1536     bcmRxTrapForwardingIpv4TotalLengthError = 322, /* Total length is less than 20. */
   1537     bcmRxTrapTerminatedIpv4TotalLengthError = 323, /* Terminated IPv4 Total length is less
   1538                                            than 20. */
   1539     bcmRxTrapForwardingIpv4HasOptions = 324, /* IHL (Internet Header Length) is
   1540                                            greater than 5. */
   1541     bcmRxTrapTerminatedIpv4HasOptions = 325, /* Terminated IPv4 IHL (Internet Header
   1542                                            Length) is greater than 5. */
   1543     bcmRxTrapForwardingIpv4SipEqualDip = 326, /* Source-IP is equal to destination IP. */
   1544     bcmRxTrapTerminatedIpv4SipEqualDip = 327, /* Terminated IPv4 Source-IP is equal to
   1545                                            destination IP. */
   1546     bcmRxTrapForwardingIpv4DipZero = 328, /* Destination IP is 0. */
   1547     bcmRxTrapTerminatedIpv4DipZero = 329, /* Terminated IPv4 Destination IP is 0. */
   1548     bcmRxTrapForwardingIpv4SipIsMc = 330, /* Source-IP is multicast. */
   1549     bcmRxTrapTerminatedIpv4SipIsMc = 331, /* Terminated IPv4 Source-IP is
   1550                                            multicast. */
   1551     bcmRxTrapForwardingIpv4Ttl0 = 332,  /* TTL is equal to 0. */
   1552     bcmRxTrapTerminatedIpv4Ttl0 = 333,  /* Terminated IPv4 TTL is equal to 0. */
   1553     bcmRxTrapForwardingIpv4Ttl1 = 334,  /* In-TTL is 0. */
   1554     bcmRxTrapTerminatedIpv4Ttl1 = 335,  /* Terminated IPv4 In-TTL is 0. */
   1555     bcmRxTrapForwardingIpv6VersionError = 336, /* Version is different than 6. */
   1556     bcmRxTrapTerminatedIpv6VersionError = 337, /* Terminated IPv6 Version is different
   1557                                            than 6. */
   1558     bcmRxTrapForwardingIpv6UnspecifiedDestination = 338, /* Forwarding header DIP = ::. */
   1559     bcmRxTrapTerminatedIpv6UnspecifiedDestination = 339, /* Terminated IPv6 header DIP = ::. */
   1560     bcmRxTrapForwardingIpv6LoopbackAddress = 340, /* DIP = ::1 or SIP = ::1. */
   1561     bcmRxTrapTerminatedIpv6LoopbackAddress = 341, /* Terminated IPv6 DIP = ::1 or SIP =
   1562                                            ::1. */
   1563     bcmRxTrapForwardingIpv6MulticastSource = 342, /* The MSB of the SIP = 0xFF. */
   1564     bcmRxTrapTerminatedIpv6MulticastSource = 343, /* Terminated IPv6 MSB of the SIP =
   1565                                            0xFF. */
   1566     bcmRxTrapForwardingIpv6NextHeaderNull = 344, /* Next-protocol is zero. */
   1567     bcmRxTrapTerminatedIpv6NextHeaderNull = 345, /* Terminated IPv6 Next-protocol is
   1568                                            zero. */
   1569     bcmRxTrapForwardingIpv6UnspecifiedSource = 346, /* SIP = ::. */
   1570     bcmRxTrapTerminatedIpv6UnspecifiedSource = 347, /* Terminated IPv6 SIP = ::. */
   1571     bcmRxTrapForwardingIpv6LocalLinkDestination = 348, /* Bits 127:118 of the destination-IP
   1572                                            are equal to 0x3FA. */
   1573     bcmRxTrapTerminatedIpv6LocalLinkDestination = 349, /* Terminated IPv6 Bits 127:118 of the
   1574                                            destination-IP are equal to 0x3FA. */
   1575     bcmRxTrapForwardingIpv6LocalSiteDestination = 350, /* Bits 127:118 of the DIP = 0x3FB
   1576                                            (deprecated). */
   1577     bcmRxTrapTerminatedIpv6LocalSiteDestination = 351, /* Terminated IPv6 Bits 127:118 of the
   1578                                            DIP = 0x3FB (deprecated). */
   1579     bcmRxTrapForwardingIpv6LocalLinkSource = 352, /* Bits 127:118 of the SIP = 0x3FA. */
   1580     bcmRxTrapTerminatedIpv6LocalLinkSource = 353, /* Terminated IPv6 Bits 127:118 of the
   1581                                            SIP = 0x3FA. */
   1582     bcmRxTrapForwardingIpv6LocalSiteSource = 354, /* Bits 127:118 of the SIP = 0x3FB. */
   1583     bcmRxTrapTerminatedIpv6LocalSiteSource = 355, /* Terminated IPv6 Bits 127:118 of the
   1584                                            SIP = 0x3FB. */
   1585     bcmRxTrapForwardingIpv6Ipv4CompatibleDestination = 356, /* Bits 127:32 of the DIP = 0. */
   1586     bcmRxTrapTerminatedIpv6Ipv4CompatibleDestination = 357, /* Terminated IPv6 Bits 127:32 of the
   1587                                            DIP = 0. */
   1588     bcmRxTrapForwardingIpv6Ipv4MappedDestination = 358, /* Bits 127:32 of the DIP are equal to
   1589                                            0000_FFF_0000_0000_0000_0000. */
   1590     bcmRxTrapTerminatedIpv6Ipv4MappedDestination = 359, /* Terminated IPv6 Bits 127:32 of the
   1591                                            DIP are equal to
   1592                                            0000_FFF_0000_0000_0000_0000. */
   1593     bcmRxTrapForwardingIpv6MulticastDestination = 360, /* MSB of the DIP=0xFF. */
   1594     bcmRxTrapTerminatedIpv6MulticastDestination = 361, /* Terminated IPv6 MSB of the DIP=0xFF. */
   1595     bcmRxTrapOutlifOverflow = 362,      /* outlif array overflow. */
   1596     bcmRxTrapTerminatedCoeFlowControl = 363, /* CoE Flow Control Packet. */
   1597     bcmRxTrapTerminatedGenericCoeFlowControl = 364, /* CoE Generic Flow Control Packet. */
   1598     bcmRxTrapTerminatedIpv4Fragmented = 365, /* Terminated IPv4 which is fragmented. */
   1599     bcmRxTrapTerminatedMplsControlWordTrap = 366, /* Lookup key is found in ELK/LEM,
   1600                                            P2P-Service If lookup result is set,
   1601                                            lookup result determines that there's
   1602                                            a control word, nibble after
   1603                                            terminated MPLS stack equal '1'. */
   1604     bcmRxTrapTerminatedMplsControlWordDrop = 367, /* Lookup key is found in ELK/LEM,
   1605                                            P2P-Service If lookup result is set,
   1606                                            lookup result determines that there's
   1607                                            a control word, nibble after
   1608                                            terminated MPLS stack does not equal
   1609                                            '1' or '0'. */
   1610     bcmRxTrapTerminatedVridMyMac = 368, /* VRID-My-Mac is invalid. */
   1611     bcmRxTrapMplsPreprocessingBosOrTtl = 369, /* Error of BOS or TTL was idendefined
   1612                                            in MPLS preprocessing. */
   1613     bcmRxTrapUnknownDest = 370,         /* Unkown destination trap */
   1614     bcmRxTrapDefault = 371,             /* Default trap. */
   1615     bcmRxTrapBfdEchoOverIpv6 = 372,     /* BFDoIPv6 echo Trap. */
   1616     bcmRxTrapEgressTrapped2ndPass = 373, /* Egress trapped packet on 2nd pass
   1617                                            Trap. */
   1618     bcmRxTrap1588User1 = 374,           /* 1588 protocol user trap #1. */
   1619     bcmRxTrap1588User2 = 375,           /* 1588 protocol user trap #2. */
   1620     bcmRxTrap1588User3 = 376,           /* 1588 protocol user trap #3. */
   1621     bcmRxTrap1588User4 = 377,           /* 1588 protocol user trap #4. */
   1622     bcmRxTrap1588User5 = 378,           /* 1588 protocol user trap #5. */
   1623     bcmRxTrapEgTxVisibility = 379,      /* ETPP visibility trap. */
   1624     bcmRxTrapBfdIpv6InvalidUdpChecksum = 380, /* BFD IPv6 trap for invalid UDP
   1625                                            checksum. */
   1626     bcmRxTrapCount = 381                /* Must be last: enum count size. */
   1627 } bcm_rx_trap_t;
   1628 
   1629 #define BCM_RX_TRAP_MAX_STAT_OBJ_ARR_LEN    10         
   1630 
   1631 /* Forwarding header position overridden value */
   1632 typedef enum bcm_rx_trap_forwarding_header_e {
   1633     bcmRxTrapForwardingHeaderPacketStart = 0, /* Start of packet. */
   1634     bcmRxTrapForwardingHeaderL2Header = 1, /* Ethernet header. */
   1635     bcmRxTrapForwardingHeaderFirstHeader = 2, /* First header after Ethernet. */
   1636     bcmRxTrapForwardingHeaderSecondHeader = 3, /* Second header after Ethernet. */
   1637     bcmRxTrapForwardingHeaderThirdHeader = 4, /* Third header after Ethernet. */
   1638     bcmRxTrapForwardingHeaderFourthHeader = 5, /* Fourth header after Ethernet. */
   1639     bcmRxTrapForwardingHeaderOamBfdPdu = 6, /* OAM or BFD PDU header. */
   1640     bcmRxTrapForwardingHeaderCount = 7  /* Always Last. Not a usable value. */
   1641 } bcm_rx_trap_forwarding_header_t;
   1642 
   1643 /* User-configurable, per-unit-core RX destination configuration. */
   1644 typedef struct bcm_rx_trap_core_config_s {
   1645     bcm_gport_t dest_port;  /* Destination port */
   1646     bcm_if_t encap_id;      /* Encap-ID */
   1647     bcm_if_t encap_id2;     /* Encap-ID #2 */
   1648 } bcm_rx_trap_core_config_t;
   1649 
   1650 /* User-configurable, statistical object overwrite configuration. */
   1651 typedef struct bcm_rx_trap_stat_obj_config_s {
   1652     int counter_command_id;         /* Command id (interface id), 0-9 */
   1653     uint32 stat_id;                 /* Object statistic id (the counter_pointer
   1654                                        value as sent to the crps) */
   1655     uint8 is_offset_by_qual_enable; /* StatObjValue is added a trap qualifier
   1656                                        offset */
   1657     int stat_object_type;           /* Statistic object type in range
   1658                                        0-BCM_STAT_MAX_NUMBER_OF_OBJECT_TYPES-1 */
   1659     uint8 is_meter;                 /* Allow metering */
   1660     int stat_profile;               /* Statistic object profile */
   1661 } bcm_rx_trap_stat_obj_config_t;
   1662 
   1663 /* User-configurable, per-unit RX configuration. */
   1664 typedef struct bcm_rx_trap_config_s {
   1665     uint32 flags;                       /* BCM_RX_TRAP_XXX FLAGS. */
   1666     bcm_gport_t dest_port;              /* Destination port. */
   1667     bcm_multicast_t dest_group;         /* Destination group. */
   1668     int prio;                           /* Internal priority of the packet. */
   1669     bcm_color_t color;                  /* Color of the packet. */
   1670     bcm_policer_t ether_policer_id;     /* Ethernet Policer. */
   1671     bcm_policer_t policer_id;           /* general policer id. */
   1672     int counter_num;                    /* counter. */
   1673     int trap_strength;                  /* Strength of this trap, strongest trap
   1674                                            in processing holds. */
   1675     int snoop_cmnd;                     /* snoop command. */
   1676     int snoop_strength;                 /* Strength of this trap, strongest
   1677                                            snoop in processing holds. */
   1678     bcm_forwarding_type_t forwarding_type; /* Forwarding type value */
   1679     bcm_rx_trap_forwarding_header_t forwarding_header; /* Forwarding header position overridden
   1680                                            value */
   1681     bcm_if_t encap_id;                  /* Encap-ID */
   1682     bcm_mirror_options_t *mirror_cmd;   /* Mirror options in ETPP traps */
   1683     bcm_rx_trap_core_config_t *core_config_arr; /* Destinations information per core */
   1684     int core_config_arr_len;            /* core_config_arr length */
   1685     int qos_map_id;                     /* cos profile handle */
   1686     int tunnel_termination_trap_strength; /* Strength of tunnel termination trap,
   1687                                            strongest trap in processing holds. */
   1688     int tunnel_termination_snoop_strength; /* Strength of tunnel termination trap,
   1689                                            strongest snoop in processing holds. */
   1690     int meter_cmd;                      /* meter command. */
   1691     uint8 mapped_trap_strength;         /* mapped trap strength */
   1692     uint8 is_recycle_high_priority;     /* recycle high priority indication */
   1693     uint8 is_recycle_crop_pkt;          /* crop recycle packet indication */
   1694     uint8 is_recycle_append_ftmh;       /* indication regarding appending the
   1695                                            original FTMH to the recycle packet */
   1696     bcm_gport_t cpu_trap_gport;         /* cpu trap gport */
   1697     int stamped_trap_code;              /* trap code stamped on packet headers */
   1698     bcm_if_t encap_id2;                 /* Encap-ID #2 */
   1699     uint8 ecn_value;                    /* Ethernet encapsulation */
   1700     uint16 vsq;                         /* Statistics VSQ pointer */
   1701     uint8 latency_flow_id_clear;        /* Indication if to clear
   1702                                            latency_flow_id */
   1703     uint8 visibility_value;             /* Visibility value */
   1704     uint32 stat_clear_bitmap;           /* Bitmap indicating which statistical
   1705                                            objects are to clear */
   1706     bcm_rx_trap_stat_obj_config_t stat_obj_config_arr[BCM_RX_TRAP_MAX_STAT_OBJ_ARR_LEN]; /* Overwrite configuration of
   1707                                            statistical objects */
   1708     uint32 stat_obj_config_len;         /* stat_obj_config_arr length */
   1709     uint32 stat_metadata_mask;          /* Statistical metadata mask */
   1710     int mirror_profile;                 /* mirror action profile */
   1711     uint32 egress_forwarding_index;     /* Egress forwarding(parsing) index */
   1712     int pp_drop_reason;                 /* Packet processing drop reason */
   1713 } bcm_rx_trap_config_t;
   1714 
   1715 /* Initialize the rx_trap_config_t structure. */
   1716 extern void bcm_rx_trap_config_t_init(
   1717     bcm_rx_trap_config_t *trap_config);
   1718 
   1719 /* User-configurable, per-unit RX configuration. */
   1720 typedef struct bcm_rx_snoop_config_s {
   1721     uint32 flags;               /* BCM_RX_SNOOP_XXX FLAGS. */
   1722     bcm_gport_t dest_port;      /* Destination port. */
   1723     bcm_multicast_t dest_group; /* Destination group. */
   1724     int prio;                   /* Internal priority of the packet. */
   1725     bcm_color_t color;          /* Color of the packet. */
   1726     bcm_policer_t policer_id;   /* policer_id. */
   1727     int counter_num;            /* counter. */
   1728     int size;                   /* what portion of the packet to snoop to CPU,
   1729                                    use -1 to indicate full packet snooping. */
   1730     int probability;            /* snooping probability. Value represents
   1731                                    percentage with percisionof a thousandth of a
   1732                                    percent (100000 is 100.000%),  range 0 -
   1733                                    100000. */
   1734     bcm_if_t encap_id;          /* Encap-ID */
   1735 } bcm_rx_snoop_config_t;
   1736 
   1737 /* Initialize the rx_snoop_config_t structure. */
   1738 extern void bcm_rx_snoop_config_t_init(
   1739     bcm_rx_snoop_config_t *snoop_config);
   1740 
   1741 #ifndef BCM_HIDE_DISPATCHABLE
   1742 
   1743 /* rx_trap_type_create. */
   1744 extern int bcm_rx_trap_type_create(
   1745     int unit, 
   1746     int flags, 
   1747     bcm_rx_trap_t type, 
   1748     int *trap_id);
   1749 
   1750 /* rx_trap_type_get. */
   1751 extern int bcm_rx_trap_type_get(
   1752     int unit, 
   1753     int flags, 
   1754     bcm_rx_trap_t type, 
   1755     int *trap_id);
   1756 
   1757 /* Get RX trap type from trap ID */
   1758 extern int bcm_rx_trap_type_from_id_get(
   1759     int unit, 
   1760     int flags, 
   1761     int trap_id, 
   1762     bcm_rx_trap_t *trap_type);
   1763 
   1764 /* rx_trap_type_destroy. */
   1765 extern int bcm_rx_trap_type_destroy(
   1766     int unit, 
   1767     int trap_id);
   1768 
   1769 /* rx_trap_set. */
   1770 extern int bcm_rx_trap_set(
   1771     int unit, 
   1772     int trap_id, 
   1773     bcm_rx_trap_config_t *config);
   1774 
   1775 /* rx_trap_get. */
   1776 extern int bcm_rx_trap_get(
   1777     int unit, 
   1778     int trap_id, 
   1779     bcm_rx_trap_config_t *config);
   1780 
   1781 /* rx_snoop_set. */
   1782 extern int bcm_rx_snoop_set(
   1783     int unit, 
   1784     int snoop_cmnd, 
   1785     bcm_rx_snoop_config_t *config);
   1786 
   1787 /* rx_snoop_get. */
   1788 extern int bcm_rx_snoop_get(
   1789     int unit, 
   1790     int snoop_cmnd, 
   1791     bcm_rx_snoop_config_t *config);
   1792 
   1793 /* rx_snoop_create. */
   1794 extern int bcm_rx_snoop_create(
   1795     int unit, 
   1796     int flags, 
   1797     int *snoop_cmnd);
   1798 
   1799 /* rx_trap_type_destroy. */
   1800 extern int bcm_rx_snoop_destroy(
   1801     int unit, 
   1802     int flags, 
   1803     int snoop_cmnd);
   1804 
   1805 #endif /* BCM_HIDE_DISPATCHABLE */
   1806 
   1807 /* Flags for bcm_rx_trap_t. */
   1808 #define BCM_RX_TRAP_UPDATE_DEST             0x00000001 /* update destination. */
   1809 #define BCM_RX_TRAP_UPDATE_PRIO             0x00000002 /* update priority. */
   1810 #define BCM_RX_TRAP_UPDATE_COLOR            0x00000004 /* update color. */
   1811 #define BCM_RX_TRAP_UPDATE_POLICER          0x00000008 /* update policer id No.1 */
   1812 #define BCM_RX_TRAP_UPDATE_ETHERNET_POLICER 0x00000010 /* update Ethernet
   1813                                                           policer. */
   1814 #define BCM_RX_TRAP_UPDATE_COUNTER          0x00000020 /* update counter. */
   1815 #define BCM_RX_TRAP_DEST_MULTICAST          0x00000040 /* destination is
   1816                                                           multicast. */
   1817 #define BCM_RX_TRAP_TRAP                    0x00000080 /* if present packet is
   1818                                                           trapped to CPU (with
   1819                                                           trap information)
   1820                                                           otherwise packet is
   1821                                                           forwarded to
   1822                                                           destination port/cpu. */
   1823 #define BCM_RX_TRAP_BYPASS_FILTERS          0x00000100 /* bypass filtering. */
   1824 #define BCM_RX_TRAP_LEARN_DISABLE           0x00000200 /* disable learning . */
   1825 #define BCM_RX_TRAP_WITH_ID                 0x00000400 /* Use the specified
   1826                                                           trap/snoop id. */
   1827 #define BCM_RX_TRAP_REPLACE                 0x00000800 /* Replace config of
   1828                                                           existing trap/snoop. */
   1829 #define BCM_RX_TRAP_POLICER_RESULT_INGRESS  0x00001000 /* User policer result on
   1830                                                           ingress. */
   1831 #define BCM_RX_TRAP_POLICER_RESULT_EGRESS   0x00002000 /* User policer result on
   1832                                                           egress. */
   1833 #define BCM_RX_TRAP_UPDATE_ADD_VLAN         0x00004000 /* Add VLAN to the final
   1834                                                           destination value */
   1835 #define BCM_RX_TRAP_UPDATE_FORWARDING_TYPE  0x00008000 /* Replace the forwarding
   1836                                                           type */
   1837 #define BCM_RX_TRAP_UPDATE_COUNTER_2        0x00010000 /* update counter No.2 */
   1838 #define BCM_RX_TRAP_UPDATE_FORWARDING_HEADER 0x00020000 /* Override the
   1839                                                           Forwarding header */
   1840 #define BCM_RX_TRAP_UPDATE_ENCAP_ID         0x00040000 /* Update Encap-id */
   1841 #define BCM_RX_TRAP_DROP_AND_LEARN          0x00080000 /* Enable learning for
   1842                                                           dropped packets */
   1843 #define BCM_RX_TRAP_UPDATE_POLICER_2        0x00100000 /* update policer id No.2 */
   1844 #define BCM_RX_TRAP_UPDATE_QOS_MAP_ID       0x00200000 /* update cos profile */
   1845 #define BCM_RX_TRAP_UPDATE_TUNNEL_TERMINATION_STRENGTH 0x00400000 /* update tunnel
   1846                                                           termination trap/snoop
   1847                                                           strengths */
   1848 #define BCM_RX_TRAP_UPDATE_METER_CMD        0x00800000 /* update meter command */
   1849 #define BCM_RX_TRAP_UPDATE_MAPPED_STRENGTH  0x01000000 /* update mapped strength */
   1850 #define BCM_RX_TRAP_UPDATE_ECN_VALUE        0x02000000 /* update ECN value */
   1851 #define BCM_RX_TRAP_UPDATE_VSQ              0x04000000 /* update VSQ */
   1852 #define BCM_RX_TRAP_UPDATE_VISIBILITY       0x08000000 /* update visibility */
   1853 #define BCM_RX_TRAP_UPDATE_EGRESS_FWD_INDEX 0x10000000 /* update egress
   1854                                                           forwarding index */
   1855 
   1856 /* Flags for bcm_rx_snoop_t. */
   1857 #define BCM_RX_SNOOP_UPDATE_DEST            0x00000001 /* update destination. */
   1858 #define BCM_RX_SNOOP_UPDATE_PRIO            0x00000002 /* update priority. */
   1859 #define BCM_RX_SNOOP_UPDATE_COLOR           0x00000004 /* update color. */
   1860 #define BCM_RX_SNOOP_UPDATE_POLICER         0x00000008 /* update policer id. */
   1861 #define BCM_RX_SNOOP_UPDATE_ETHERNET_POLICER 0x00000010 /* update Ethernet
   1862                                                           policer. */
   1863 #define BCM_RX_SNOOP_UPDATE_COUNTER         0x00000020 /* update counter. */
   1864 #define BCM_RX_SNOOP_DEST_MULTICAST         0x00000040 /* destination is
   1865                                                           multicast. */
   1866 #define BCM_RX_SNOOP_WITH_ID                0x00000080 /* Use the specified
   1867                                                           trap/snoop id. */
   1868 #define BCM_RX_SNOOP_REPLACE                0x00000100 /* Replace config of
   1869                                                           existing trap/snoop. */
   1870 #define BCM_RX_SNOOP_POLICER_RESULT_INGRESS 0x00000200 /* User policer result on
   1871                                                           ingress. */
   1872 #define BCM_RX_SNOOP_POLICER_RESULT_EGRESS  0x00000400 /* User policer result on
   1873                                                           egress. */
   1874 #define BCM_RX_SNOOP_UPDATE_ENCAP_ID        0x00000800 /* Update Encap-id */
   1875 #define BCM_RX_SNOOP_UPDATE_COUNTER_1       0x00001000 /* update counter No.1 */
   1876 #define BCM_RX_SNOOP_UPDATE_COUNTER_2       0x00002000 /* update counter No.2 */
   1877 
   1878 #ifndef BCM_HIDE_DISPATCHABLE
   1879 
   1880 /* Set mode specific redirection reasons for rx packets. */
   1881 extern int bcm_rx_redirect_reasons_set(
   1882     int unit, 
   1883     bcm_rx_redirect_t mode, 
   1884     bcm_rx_reasons_t reasons);
   1885 
   1886 #endif /* BCM_HIDE_DISPATCHABLE */
   1887 
   1888 /* Options to configure copy to cpu properties */
   1889 #define BCM_RX_COPYTOCPU_WITH_ID    0x00000001 /* Option to replace an existing
   1890                                                   entry */
   1891 #define BCM_RX_COPYTOCPU_REPLACE    0x00000002 /* Option to use an index that is
   1892                                                   passed in */
   1893 
   1894 /* Options for bcm_rx_mtu_set API */
   1895 #define BCM_RX_MTU_RIF          0x00000001 /* Set MTU filter for RIF, input is
   1896                                               RIF */
   1897 #define BCM_RX_MTU_LIF          0x00000002 /* Set MTU filter for LIF, input is
   1898                                               LIF */
   1899 #define BCM_RX_MTU_PORT         0x00000004 /* Set MTU filter for PORT, input is
   1900                                               port */
   1901 
   1902 /* Flags to configure copy to cpu properties */
   1903 #define BCM_RX_COPYTOCPU_TRUNCATE   0x00000001 /* If set, packets copied to cpu
   1904                                                   will be truncated */
   1905 
   1906 /* Buffer priority of copy to cpu packets */
   1907 #define BCM_RX_COPYTOCPU_BUFFER_PRIORITY_LOW 0x00000001 /* If set, a low buffer
   1908                                                           priority will be used
   1909                                                           for packets copied to
   1910                                                           cpu */
   1911 #define BCM_RX_COPYTOCPU_BUFFER_PRIORITY_MEDIUM 0x00000002 /* If set, a medium
   1912                                                           buffer priority will
   1913                                                           be used for packets
   1914                                                           copied to cpu */
   1915 #define BCM_RX_COPYTOCPU_BUFFER_PRIORITY_HIGH 0x00000004 /* If set, a high buffer
   1916                                                           priority will be used
   1917                                                           for packets copied to
   1918                                                           cpu */
   1919 
   1920 /* Copy to CPU attributes */
   1921 typedef struct bcm_rx_CopyToCpu_config_s {
   1922     int flags;                          /* Flags to pass with configuration data */
   1923     int index;                          /* Index of the entry */
   1924     bcm_pkt_drop_reasons_t drop_reason_vector; /* Array of drop reasons */
   1925     int strength;                       /* Strength of the entry */
   1926     int buffer_priority;                /* Buffering priority of the redirected
   1927                                            packet */
   1928     int cpu_cosq;                       /* CPU CoS queue to use */
   1929 } bcm_rx_CopyToCpu_config_t;
   1930 
   1931 /* Initialize a copy to cpu config structure */
   1932 extern void bcm_rx_CopyToCpu_config_t_init(
   1933     bcm_rx_CopyToCpu_config_t *copyToCpu_config);
   1934 
   1935 #ifndef BCM_HIDE_DISPATCHABLE
   1936 
   1937 /* Add a copy to cpu entry criteria */
   1938 extern int bcm_rx_CopyToCpu_config_add(
   1939     int unit, 
   1940     uint32 options, 
   1941     bcm_rx_CopyToCpu_config_t *copyToCpu_config);
   1942 
   1943 /* Delete a copy to cpu entry */
   1944 extern int bcm_rx_CopyToCpu_config_delete(
   1945     int unit, 
   1946     int index);
   1947 
   1948 /* Get a copy to cpu entry */
   1949 extern int bcm_rx_CopyToCpu_config_get(
   1950     int unit, 
   1951     int index, 
   1952     bcm_rx_CopyToCpu_config_t *copyToCpu_config);
   1953 
   1954 /* Get all copy to cpu entries */
   1955 extern int bcm_rx_CopyToCpu_config_get_all(
   1956     int unit, 
   1957     int entries_max, 
   1958     bcm_rx_CopyToCpu_config_t *copyToCpu_config, 
   1959     int *entries_count);
   1960 
   1961 /* Delete all copy to cpu entries */
   1962 extern int bcm_rx_CopyToCpu_config_delete_all(
   1963     int unit);
   1964 
   1965 #endif /* BCM_HIDE_DISPATCHABLE */
   1966 
   1967 /* User-configurable, key to configure MTU profile. */
   1968 typedef struct bcm_rx_mtu_profile_key_s {
   1969     uint8 cmp_layer_type;   /* Compressed layer type - Only relevant for LIF/RIF */
   1970     uint8 mtu_profile;      /* MTU profile to configure */
   1971 } bcm_rx_mtu_profile_key_t;
   1972 
   1973 /* User-configurable, value to configure MTU profile. */
   1974 typedef struct bcm_rx_mtu_profile_value_s {
   1975     uint32 mtu_val;         /* MTU value to configure */
   1976     bcm_gport_t trap_gport; /* Trap GPORT (Action Profile, FWD and SNP Strength) */
   1977 } bcm_rx_mtu_profile_value_t;
   1978 
   1979 #ifndef BCM_HIDE_DISPATCHABLE
   1980 
   1981 /* 
   1982  * Configure MTU profile indexed by mtu_key with values given in
   1983  * mtu_value
   1984  */
   1985 extern int bcm_rx_mtu_profile_set(
   1986     int unit, 
   1987     uint32 flags, 
   1988     bcm_rx_mtu_profile_key_t *mtu_key, 
   1989     bcm_rx_mtu_profile_value_t *mtu_value);
   1990 
   1991 /* Retrieve values of MTU profile indexed by mtu_key */
   1992 extern int bcm_rx_mtu_profile_get(
   1993     int unit, 
   1994     uint32 flags, 
   1995     bcm_rx_mtu_profile_key_t *mtu_key, 
   1996     bcm_rx_mtu_profile_value_t *mtu_value);
   1997 
   1998 #endif /* BCM_HIDE_DISPATCHABLE */
   1999 
   2000 /* User-configurable, MTU value per LIF/RIF. */
   2001 typedef struct bcm_rx_mtu_config_s {
   2002     uint32 flags;       /* BCM_RX_MTU_FLAG_XXX */
   2003     bcm_if_t intf;      /* Interface  RIF */
   2004     bcm_gport_t gport;  /* GPORT LIF */
   2005     uint32 mtu;         /* MTU value to set for LIF/RIF */
   2006     uint8 mtu_profile;  /* MTU profile to configure */
   2007 } bcm_rx_mtu_config_t;
   2008 
   2009 #ifndef BCM_HIDE_DISPATCHABLE
   2010 
   2011 /* maps the MTU value from input to LIF/RIF value from input */
   2012 extern int bcm_rx_mtu_set(
   2013     int unit, 
   2014     bcm_rx_mtu_config_t *config);
   2015 
   2016 /* return MTU value that was set for LIF/RIF */
   2017 extern int bcm_rx_mtu_get(
   2018     int unit, 
   2019     bcm_rx_mtu_config_t *config);
   2020 
   2021 /* Maps between SW trap id to HW trap id */
   2022 extern int bcm_rx_trap_sw_to_hw_id_map_get(
   2023     int unit, 
   2024     uint32 flags, 
   2025     int sw_trap_id, 
   2026     int *hw_trap_id);
   2027 
   2028 #endif /* BCM_HIDE_DISPATCHABLE */
   2029 
   2030 /* Rx cosq mapping. */
   2031 typedef struct bcm_rx_cosq_mapping_s {
   2032     uint32 flags;                   /* flags */
   2033     int index;                      /* Index into COSQ mapping table (0 is
   2034                                        highest match priority) */
   2035     bcm_rx_reasons_t reasons;       /* packet reasons bitmap */
   2036     bcm_rx_reasons_t reasons_mask;  /* mask for packet reasons bitmap */
   2037     uint8 int_prio;                 /* internal priority value */
   2038     uint8 int_prio_mask;            /* mask for internal priority value */
   2039     uint32 packet_type;             /* packet type bitmap */
   2040     uint32 packet_type_mask;        /* mask for packet type bitmap */
   2041     bcm_cos_queue_t cosq;           /* cosq value */
   2042 } bcm_rx_cosq_mapping_t;
   2043 
   2044 /* Initialize a BCM RX cosq mapping structure. */
   2045 extern void bcm_rx_cosq_mapping_t_init(
   2046     bcm_rx_cosq_mapping_t *rx_cosq_mapping);
   2047 
   2048 #ifndef BCM_HIDE_DISPATCHABLE
   2049 
   2050 /* Map packets to a CPU COS queue. */
   2051 extern int bcm_rx_cosq_mapping_extended_set(
   2052     int unit, 
   2053     uint32 options, 
   2054     bcm_rx_cosq_mapping_t *rx_cosq_mapping);
   2055 
   2056 /* Get packets to CPU COS queue mappings. */
   2057 extern int bcm_rx_cosq_mapping_extended_get(
   2058     int unit, 
   2059     bcm_rx_cosq_mapping_t *rx_cosq_mapping);
   2060 
   2061 #endif /* BCM_HIDE_DISPATCHABLE */
   2062 
   2063 /* User-configurable, protocol trap key parameters. */
   2064 typedef struct bcm_rx_trap_protocol_key_s {
   2065     bcm_rx_trap_t protocol_type;    /* one of L2CP/ICMP/IGMP/Non-Authorized
   2066                                        802.1x/DHCP/ARP/NDP. */
   2067     uint8 protocol_trap_profile;    /* protocol trap handling profile,
   2068                                        values:0-3. */
   2069     uint32 trap_args;               /* argument according to protocol_type. */
   2070 } bcm_rx_trap_protocol_key_t;
   2071 
   2072 /* User-configurable, trap profile of each protocol. */
   2073 typedef struct bcm_rx_trap_protocol_profiles_s {
   2074     uint8 icmpv6_trap_profile;          /* ICMP IPv6 trap profile, also used for
   2075                                            NDP trap profile. */
   2076     uint8 icmpv4_trap_profile;          /* ICMP IPv4 trap profile. */
   2077     uint8 l2cp_trap_profile;            /* L2CP trap profile. */
   2078     uint8 arp_trap_profile;             /* ARP trap profile. */
   2079     uint8 igmp_trap_profile;            /* IGMP trap profile. */
   2080     uint8 dhcp_trap_profile;            /* DHCP trap profile. */
   2081     uint8 non_auth_8021x_trap_profile;  /* non authorized 802.1x trap profile,
   2082                                            MSB - collision bit, LSB - profile
   2083                                            bit. */
   2084 } bcm_rx_trap_protocol_profiles_t;
   2085 
   2086 #ifndef BCM_HIDE_DISPATCHABLE
   2087 
   2088 /* rx_trap_protocol_set. */
   2089 extern int bcm_rx_trap_protocol_set(
   2090     int unit, 
   2091     bcm_rx_trap_protocol_key_t *key_p, 
   2092     bcm_gport_t trap_gport);
   2093 
   2094 /* rx_trap_protocol_get. */
   2095 extern int bcm_rx_trap_protocol_get(
   2096     int unit, 
   2097     bcm_rx_trap_protocol_key_t *key_p, 
   2098     bcm_gport_t *trap_gport_p);
   2099 
   2100 /* rx_trap_protocol_clear. */
   2101 extern int bcm_rx_trap_protocol_clear(
   2102     int unit, 
   2103     bcm_rx_trap_protocol_key_t *key_p);
   2104 
   2105 /* rx_trap_protocol_profiles_set. */
   2106 extern int bcm_rx_trap_protocol_profiles_set(
   2107     int unit, 
   2108     bcm_gport_t port, 
   2109     bcm_rx_trap_protocol_profiles_t *protocol_profiles_p);
   2110 
   2111 /* rx_trap_protocol_profiles_get. */
   2112 extern int bcm_rx_trap_protocol_profiles_get(
   2113     int unit, 
   2114     bcm_gport_t port, 
   2115     bcm_rx_trap_protocol_profiles_t *protocol_profiles_p);
   2116 
   2117 /* rx_trap_action_profile_set. */
   2118 extern int bcm_rx_trap_action_profile_set(
   2119     int unit, 
   2120     uint32 flags, 
   2121     bcm_rx_trap_t trap_type, 
   2122     bcm_gport_t gport);
   2123 
   2124 /* rx_trap_action_profile_get. */
   2125 extern int bcm_rx_trap_action_profile_get(
   2126     int unit, 
   2127     bcm_rx_trap_t trap_type, 
   2128     bcm_gport_t *gport);
   2129 
   2130 /* rx_trap_action_profile_clear. */
   2131 extern int bcm_rx_trap_action_profile_clear(
   2132     int unit, 
   2133     bcm_rx_trap_t trap_type);
   2134 
   2135 #endif /* BCM_HIDE_DISPATCHABLE */
   2136 
   2137 /* Rx Program Enable Types */
   2138 typedef enum bcm_rx_trap_prog_enable_e {
   2139     bcmRxTrapProgDisable = 0, 
   2140     bcmRxTrapProgEnableMatch = 1, 
   2141     bcmRxTrapProgEnableMismatch = 2 
   2142 } bcm_rx_trap_prog_enable_t;
   2143 
   2144 /* Programmable trap structure. */
   2145 typedef struct bcm_rx_trap_prog_config_s {
   2146     bcm_rx_trap_prog_enable_t src_mac_enable; 
   2147     bcm_mac_t src_mac; 
   2148     uint8 src_mac_nof_bits; 
   2149     bcm_rx_trap_prog_enable_t dest_mac_enable; 
   2150     bcm_mac_t dest_mac; 
   2151     uint8 dest_mac_nof_bits; 
   2152     bcm_rx_trap_prog_enable_t ether_type_enable; 
   2153     uint16 ether_type; 
   2154     bcm_rx_trap_prog_enable_t sub_type_enable; 
   2155     uint8 sub_type; 
   2156     uint8 sub_type_mask; 
   2157     bcm_rx_trap_prog_enable_t ip_protocol_enable; 
   2158     uint8 ip_protocol; 
   2159     bcm_rx_trap_prog_enable_t l4_ports_enable; 
   2160     bcm_port_t src_port; 
   2161     uint16 src_port_mask; 
   2162     bcm_port_t dest_port; 
   2163     uint16 dest_port_mask; 
   2164     bcm_rx_trap_prog_enable_t tcp_flags_enable; 
   2165     uint16 tcp_flags; 
   2166     uint16 tcp_flags_mask; 
   2167     bcm_rx_trap_prog_enable_t tcp_seq_is_zero_enable; 
   2168     bcm_gport_t trap_gport; 
   2169 } bcm_rx_trap_prog_config_t;
   2170 
   2171 /* Initialize programmable trap configuration. */
   2172 extern void bcm_rx_trap_prog_config_t_init(
   2173     bcm_rx_trap_prog_config_t *prog_config_p);
   2174 
   2175 #ifndef BCM_HIDE_DISPATCHABLE
   2176 
   2177 /* Set programmable trap configuration. */
   2178 extern int bcm_rx_trap_prog_set(
   2179     int unit, 
   2180     uint32 flags, 
   2181     uint8 prog_index, 
   2182     bcm_rx_trap_prog_config_t *prog_config_p);
   2183 
   2184 /* Get programmable trap configuration. */
   2185 extern int bcm_rx_trap_prog_get(
   2186     int unit, 
   2187     uint8 prog_index, 
   2188     bcm_rx_trap_prog_config_t *prog_config_p);
   2189 
   2190 #endif /* BCM_HIDE_DISPATCHABLE */
   2191 
   2192 /* Initialize the MTU profile key struct to init values. */
   2193 extern void bcm_rx_mtu_profile_key_t_init(
   2194     bcm_rx_mtu_profile_key_t *mtu_key);
   2195 
   2196 /* Initialize the MTU profile value struct to init values. */
   2197 extern void bcm_rx_mtu_profile_value_t_init(
   2198     bcm_rx_mtu_profile_value_t *mtu_value);
   2199 
   2200 /* Initialize the MTU struct to init values. */
   2201 extern void bcm_rx_mtu_config_t_init(
   2202     bcm_rx_mtu_config_t *mtu_config);
   2203 
   2204 /* LIF types for trap configuration */
   2205 typedef enum bcm_rx_trap_lif_type_e {
   2206     bcmRxTrapLifTypeInLif = 0, 
   2207     bcmRxTrapLifTypeInRif = 1, 
   2208     bcmRxTrapLifTypeOutLif = 2, 
   2209     bcmRxTrapLifTypeOutRif = 3, 
   2210     bcmRxTrapLifTypeCount = 4 
   2211 } bcm_rx_trap_lif_type_t;
   2212 
   2213 /* LIf traps configuration structure. */
   2214 typedef struct bcm_rx_trap_lif_config_s {
   2215     bcm_rx_trap_lif_type_t lif_type; 
   2216     bcm_if_t rif_intf;                  /* Interface  RIF */
   2217     bcm_gport_t lif_gport;              /* GPORT LIF */
   2218     bcm_gport_t action_gport;           /* hold theTrap-Action-Profile or
   2219                                            mirror_cmd(only for egress) to
   2220                                            configure */
   2221 } bcm_rx_trap_lif_config_t;
   2222 
   2223 /* Initialize LIF trap configuration. */
   2224 extern void bcm_rx_trap_lif_config_t_init(
   2225     bcm_rx_trap_lif_config_t *lif_config_p);
   2226 
   2227 #ifndef BCM_HIDE_DISPATCHABLE
   2228 
   2229 /* Set LIF trap configuration. */
   2230 extern int bcm_rx_trap_lif_set(
   2231     int unit, 
   2232     uint32 flags, 
   2233     bcm_rx_trap_lif_config_t *lif_config_p);
   2234 
   2235 /* Get LIF trap configuration. */
   2236 extern int bcm_rx_trap_lif_get(
   2237     int unit, 
   2238     bcm_rx_trap_lif_config_t *lif_config_p);
   2239 
   2240 #endif /* BCM_HIDE_DISPATCHABLE */
   2241 
   2242 /* Initialize the protocol trap key struct to init values. */
   2243 extern void bcm_rx_trap_protocol_key_t_init(
   2244     bcm_rx_trap_protocol_key_t *key_p);
   2245 
   2246 /* Initialize the protocol trap profiles struct to init values. */
   2247 extern void bcm_rx_trap_protocol_profiles_t_init(
   2248     bcm_rx_trap_protocol_profiles_t *protocol_profiles_p);
   2249 
   2250 #endif /* __BCM_RX_H__ */