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


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