OpenNSL API Guide and Reference Manual
Data Structures | Files | Macros | Typedefs | Enumerations | Functions
Packet Transmit and Receive

Data Structures

struct  opennsl_pkt_blk_s
 OPENNSL packet gather block type. More...
 
struct  opennsl_pkt_oam_counter_s
 OAM counter. More...
 
struct  opennsl_pkt_s
 Initialize a OPENNSL packet structure. More...
 
struct  opennsl_rx_cfg_s
 User-configurable, per-unit RX configuration. More...
 
struct  opennsl_rx_chan_cfg_s
 Channel-specific RX data. More...
 
struct  opennsl_rx_snoop_config_s
 User-configurable, per-unit RX configuration. More...
 
struct  opennsl_rx_trap_config_s
 User-configurable, per-unit RX configuration. More...
 
struct  opennsl_rx_trap_core_config_s
 User-configurable, per-unit-core RX destination configuration. More...
 

Files

file  pktX.h
 
file  rxX.h
 
file  tx.h
 
file  txX.h
 

Macros

#define OPENNSL_CMICX_RX_CHANNELS   8
 Max.
 
#define OPENNSL_PKT_F_NO_VTAG   0x4
 Packet does not contain VLAN tag.
 
#define OPENNSL_PKT_F_TRUNK   0x20000000
 Trunk port.
 
#define OPENNSL_PKT_NOF_DNX_HEADERS   _SHR_PKT_NOF_DNX_HEADERS
 
#define OPENNSL_PKT_OAM_COUNTER_MAX   3
 
#define OPENNSL_PKT_ONE_BUF_SETUP(pkt, buf, _len)
 
#define OPENNSL_RCO_F_ALL_COS   0x40000000
 
#define OPENNSL_RCO_F_COS_ACCEPT(cos)   (1 << (cos))
 
#define OPENNSL_RX_CHANNELS   4
 Max.
 
#define OPENNSL_RX_COSQ_PACKET_TYPE_MIRROR   0x4
 
#define OPENNSL_RX_COSQ_PACKET_TYPE_NON_UNICAST   0x2
 
#define OPENNSL_RX_COSQ_PACKET_TYPE_SWITCHED   0x1
 
#define OPENNSL_RX_REASON_CLEAR_ALL(_reasons)   _SHR_RX_REASON_CLEAR_ALL(_reasons)
 
#define OPENNSL_RX_REASON_GET(_reasons, _reason)   _SHR_RX_REASON_GET(_reasons, _reason)
 
#define OPENNSL_RX_REASON_NAMES_INITIALIZER   _SHR_RX_REASON_NAMES_INITIALIZER
 
#define OPENNSL_RX_REASON_SET(_reasons, _reason)   _SHR_RX_REASON_SET(_reasons, _reason)
 
#define OPENNSL_RX_SNOOP_DEST_MULTICAST   0x00000040
 destination is multicast.
 
#define OPENNSL_RX_SNOOP_REPLACE   0x00000100
 Replace config of existing trap/snoop.
 
#define OPENNSL_RX_SNOOP_UPDATE_COLOR   0x00000004
 update color.
 
#define OPENNSL_RX_SNOOP_UPDATE_COUNTER   0x00000020
 update counter.
 
#define OPENNSL_RX_SNOOP_UPDATE_DEST   0x00000001
 update destination.
 
#define OPENNSL_RX_SNOOP_UPDATE_ETHERNET_POLICER   0x00000010
 update Ethernet policer.
 
#define OPENNSL_RX_SNOOP_UPDATE_POLICER   0x00000008
 update policer id.
 
#define OPENNSL_RX_SNOOP_UPDATE_PRIO   0x00000002
 update priority.
 
#define OPENNSL_RX_SNOOP_WITH_ID   0x00000080
 Use the specified trap/snoop id.
 
#define OPENNSL_RX_TRAP_REPLACE   0x00000800
 Replace config of existing trap/snoop.
 
#define OPENNSL_TX_CRC_ALLOC   0x10
 Allocate buffer for CRC.
 
#define OPENNSL_TX_CRC_APPEND   (OPENNSL_TX_CRC_ALLOC + OPENNSL_TX_CRC_REGEN)
 
#define OPENNSL_TX_CRC_REGEN   0x20
 Regenerate CRC.
 
#define OPENNSL_TX_ETHER   0x100000
 Fully mapped packet TX.
 

Typedefs

typedef struct opennsl_pkt_blk_s opennsl_pkt_blk_t
 OPENNSL packet gather block type.
 
typedef void(* opennsl_pkt_cb_f )(int reserved1, opennsl_pkt_t *reserved2, void *reserved3)
 
typedef struct
opennsl_pkt_oam_counter_s 
opennsl_pkt_oam_counter_t
 OAM counter.
 
typedef struct opennsl_pkt_s opennsl_pkt_t
 The packet structure.
 
typedef int(* opennsl_rx_alloc_f )(int reserved1, int reserved2, uint32 reserved3, void **reserved4)
 
typedef opennsl_rx_t(* opennsl_rx_cb_f )(int unit, opennsl_pkt_t *pkt, void *cookie)
 
typedef struct opennsl_rx_cfg_s opennsl_rx_cfg_t
 User-configurable, per-unit RX configuration.
 
typedef struct
opennsl_rx_chan_cfg_s 
opennsl_rx_chan_cfg_t
 Channel-specific RX data.
 
typedef enum opennsl_rx_control_e opennsl_rx_control_t
 
typedef int(* opennsl_rx_free_f )(int reserved1, void *reserved2)
 
typedef enum opennsl_rx_reason_e opennsl_rx_reason_t
 PKT RX Packet Reasons; reason CPU received the packet.
 
typedef _shr_rx_reasons_t opennsl_rx_reasons_t
 Set of 'reasons' (see opennslRxReason*) why a packet came to the CPU.
 
typedef struct
opennsl_rx_snoop_config_s 
opennsl_rx_snoop_config_t
 User-configurable, per-unit RX configuration.
 
typedef enum opennsl_rx_e opennsl_rx_t
 Return values from PKT RX callout routines.
 
typedef struct
opennsl_rx_trap_config_s 
opennsl_rx_trap_config_t
 User-configurable, per-unit RX configuration.
 
typedef struct
opennsl_rx_trap_core_config_s 
opennsl_rx_trap_core_config_t
 User-configurable, per-unit-core RX destination configuration.
 
typedef enum
opennsl_rx_trap_forwarding_header_e 
opennsl_rx_trap_forwarding_header_t
 Forwarding header position overridden value.
 
typedef enum opennsl_rx_trap_e opennsl_rx_trap_t
 Return values from PKT RX callout routines.
 

Enumerations

enum  opennsl_rx_control_e { opennslRxControlCRCStrip = 0 }
 
enum  opennsl_rx_e {
  OPENNSL_RX_INVALID = 0,
  OPENNSL_RX_NOT_HANDLED = 1,
  OPENNSL_RX_HANDLED = 2,
  OPENNSL_RX_HANDLED_OWNED = 3
}
 Return values from PKT RX callout routines. More...
 
enum  opennsl_rx_reason_e {
  opennslRxReasonInvalid = _SHR_RX_INVALID,
  opennslRxReasonArp = _SHR_RX_ARP,
  opennslRxReasonBpdu = _SHR_RX_BPDU,
  opennslRxReasonBroadcast = _SHR_RX_BROADCAST,
  opennslRxReasonClassBasedMove = _SHR_RX_CLASS_BASED_MOVE,
  opennslRxReasonClassTagPackets = _SHR_RX_CLASS_TAG_PACKETS,
  opennslRxReasonControl = _SHR_RX_CONTROL,
  opennslRxReasonCpuLearn = _SHR_RX_CPU_LEARN,
  opennslRxReasonDestLookupFail = _SHR_RX_DEST_LOOKUP_FAIL,
  opennslRxReasonDhcp = _SHR_RX_DHCP,
  opennslRxReasonDosAttack = _SHR_RX_DOS_ATTACK,
  opennslRxReasonE2eHolIbp = _SHR_RX_E2E_HOL_IBP,
  opennslRxReasonEncapHigigError = _SHR_RX_ENCAP_HIGIG_ERROR,
  opennslRxReasonFilterMatch = _SHR_RX_FILTER_MATCH,
  opennslRxReasonGreChecksum = _SHR_RX_GRE_CHECKSUM,
  opennslRxReasonGreSourceRoute = _SHR_RX_GRE_SOURCE_ROUTE,
  opennslRxReasonHigigControl = _SHR_RX_HIGIG_CONTROL,
  opennslRxReasonHigigHdrError = _SHR_RX_HIGIG_HDR_ERROR,
  opennslRxReasonIcmpRedirect = _SHR_RX_ICMP_REDIRECT,
  opennslRxReasonIgmp = _SHR_RX_IGMP,
  opennslRxReasonIngressFilter = _SHR_RX_INGRESS_FILTER,
  opennslRxReasonIp = _SHR_RX_IP,
  opennslRxReasonIpfixRateViolation = _SHR_RX_IPFIX_RATE_VIOLATION,
  opennslRxReasonIpMcastMiss = _SHR_RX_IP_MCAST_MISS,
  opennslRxReasonIpmcReserved = _SHR_RX_IPMC_RSVD,
  opennslRxReasonIpOptionVersion = _SHR_RX_IP_OPTION_VERSION,
  opennslRxReasonIpmc = _SHR_RX_IPMC,
  opennslRxReasonL2Cpu = _SHR_RX_L2_CPU,
  opennslRxReasonL2DestMiss = _SHR_RX_L2_DEST_MISS,
  opennslRxReasonL2LearnLimit = _SHR_RX_L2_LEARN_LIMIT,
  opennslRxReasonL2Move = _SHR_RX_L2_MOVE,
  opennslRxReasonL2MtuFail = _SHR_RX_L2_MTU_FAIL,
  opennslRxReasonL2NonUnicastMiss = _SHR_RX_L2_NON_UNICAST_MISS,
  opennslRxReasonL2SourceMiss = _SHR_RX_L2_SOURCE_MISS,
  opennslRxReasonL3AddrBindFail = _SHR_RX_L3_ADDR_BIND_FAIL,
  opennslRxReasonL3DestMiss = _SHR_RX_L3_DEST_MISS,
  opennslRxReasonL3HeaderError = _SHR_RX_L3_HEADER_ERROR,
  opennslRxReasonL3MtuFail = _SHR_RX_L3_MTU_FAIL,
  opennslRxReasonL3Slowpath = _SHR_RX_L3_SLOW_PATH,
  opennslRxReasonL3SourceMiss = _SHR_RX_L3_SOURCE_MISS,
  opennslRxReasonL3SourceMove = _SHR_RX_L3_SOUCE_MOVE,
  opennslRxReasonMartianAddr = _SHR_RX_MARTIAN_ADDR,
  opennslRxReasonMcastIdxError = _SHR_RX_MCAST_IDX_ERROR,
  opennslRxReasonMcastMiss = _SHR_RX_MCAST_MISS,
  opennslRxReasonMimServiceError = _SHR_RX_MIM_SERVICE_ERROR,
  opennslRxReasonMplsCtrlWordError = _SHR_RX_MPLS_CTRL_WORD_ERROR,
  opennslRxReasonMplsError = _SHR_RX_MPLS_ERROR,
  opennslRxReasonMplsInvalidAction = _SHR_RX_MPLS_INVALID_ACTION,
  opennslRxReasonMplsInvalidPayload = _SHR_RX_MPLS_INVALID_PAYLOAD,
  opennslRxReasonMplsLabelMiss = _SHR_RX_MPLS_LABEL_MISS,
  opennslRxReasonMplsSequenceNumber = _SHR_RX_MPLS_SEQUENCE_NUMBER,
  opennslRxReasonMplsTtl = _SHR_RX_MPLS_TTL,
  opennslRxReasonMulticast = _SHR_RX_MULTICAST,
  opennslRxReasonNhop = _SHR_RX_NHOP,
  opennslRxReasonOAMError = _SHR_RX_OAM_ERROR,
  opennslRxReasonOAMSlowpath = _SHR_RX_OAM_SLOW_PATH,
  opennslRxReasonOAMLMDM = _SHR_RX_OAM_LMDM,
  opennslRxReasonParityError = _SHR_RX_PARITY_ERROR,
  opennslRxReasonProtocol = _SHR_RX_PROTOCOL,
  opennslRxReasonSampleDest = _SHR_RX_SAMPLE_DEST,
  opennslRxReasonSampleSource = _SHR_RX_SAMPLE_SOURCE,
  opennslRxReasonSharedVlanMismatch = _SHR_RX_SHARED_VLAN_MISMATCH,
  opennslRxReasonSourceRoute = _SHR_RX_SOURCE_ROUTE,
  opennslRxReasonTimeStamp = _SHR_RX_TIME_STAMP,
  opennslRxReasonTtl = _SHR_RX_TTL,
  opennslRxReasonTtl1 = _SHR_RX_TTL1,
  opennslRxReasonTunnelError = _SHR_RX_TUNNEL_ERROR,
  opennslRxReasonUdpChecksum = _SHR_RX_UDP_CHECKSUM,
  opennslRxReasonUnknownVlan = _SHR_RX_UNKNOWN_VLAN,
  opennslRxReasonUrpfFail = _SHR_RX_URPF_FAIL,
  opennslRxReasonVcLabelMiss = _SHR_RX_VC_LABEL_MISS,
  opennslRxReasonVlanFilterMatch = _SHR_RX_VLAN_FILTER_MATCH,
  opennslRxReasonWlanClientError = _SHR_RX_WLAN_CLIENT_ERROR,
  opennslRxReasonWlanSlowpath = _SHR_RX_WLAN_SLOW_PATH,
  opennslRxReasonWlanDot1xDrop = _SHR_RX_WLAN_DOT1X_DROP,
  opennslRxReasonExceptionFlood = _SHR_RX_EXCEPTION_FLOOD,
  opennslRxReasonTimeSync = _SHR_RX_TIMESYNC,
  opennslRxReasonEAVData = _SHR_RX_EAV_DATA,
  opennslRxReasonSamePortBridge = _SHR_RX_SAME_PORT_BRIDGE,
  opennslRxReasonSplitHorizon = _SHR_RX_SPLIT_HORIZON,
  opennslRxReasonL4Error = _SHR_RX_L4_ERROR,
  opennslRxReasonStp = _SHR_RX_STP,
  opennslRxReasonEgressFilterRedirect = _SHR_RX_EGRESS_FILTER_REDIRECT,
  opennslRxReasonFilterRedirect = _SHR_RX_FILTER_REDIRECT,
  opennslRxReasonLoopback = _SHR_RX_LOOPBACK,
  opennslRxReasonVlanTranslate = _SHR_RX_VLAN_TRANSLATE,
  opennslRxReasonMmrp = _SHR_RX_MMRP,
  opennslRxReasonSrp = _SHR_RX_SRP,
  opennslRxReasonTunnelControl = _SHR_RX_TUNNEL_CONTROL,
  opennslRxReasonL2Marked = _SHR_RX_L2_MARKED,
  opennslRxReasonWlanSlowpathKeepalive = _SHR_RX_WLAN_SLOWPATH_KEEPALIVE,
  opennslRxReasonStation = _SHR_RX_STATION,
  opennslRxReasonNiv = _SHR_RX_NIV,
  opennslRxReasonNivPrioDrop = _SHR_RX_NIV_PRIO_DROP,
  opennslRxReasonNivInterfaceMiss = _SHR_RX_NIV_INTERFACE_MISS,
  opennslRxReasonNivRpfFail = _SHR_RX_NIV_RPF_FAIL,
  opennslRxReasonNivTagInvalid = _SHR_RX_NIV_TAG_INVALID,
  opennslRxReasonNivTagDrop = _SHR_RX_NIV_TAG_DROP,
  opennslRxReasonNivUntagDrop = _SHR_RX_NIV_UNTAG_DROP,
  opennslRxReasonTrill = _SHR_RX_TRILL,
  opennslRxReasonTrillInvalid = _SHR_RX_TRILL_INVALID,
  opennslRxReasonTrillMiss = _SHR_RX_TRILL_MISS,
  opennslRxReasonTrillRpfFail = _SHR_RX_TRILL_RPF_FAIL,
  opennslRxReasonTrillSlowpath = _SHR_RX_TRILL_SLOWPATH,
  opennslRxReasonTrillCoreIsIs = _SHR_RX_TRILL_CORE_IS_IS,
  opennslRxReasonTrillTtl = _SHR_RX_TRILL_TTL,
  opennslRxReasonTrillName = _SHR_RX_TRILL_NAME,
  opennslRxReasonBfdSlowpath = _SHR_RX_BFD_SLOWPATH,
  opennslRxReasonBfd = _SHR_RX_BFD_ERROR,
  opennslRxReasonMirror = _SHR_RX_MIRROR,
  opennslRxReasonRegexAction = _SHR_RX_REGEX_ACTION,
  opennslRxReasonRegexMatch = _SHR_RX_REGEX_MATCH,
  opennslRxReasonFailoverDrop = _SHR_RX_FAILOVER_DROP,
  opennslRxReasonWlanTunnelError = _SHR_RX_WLAN_TUNNEL_ERROR,
  opennslRxReasonCongestionCnmProxy = _SHR_RX_CONGESTION_CNM_PROXY,
  opennslRxReasonCongestionCnmProxyError = _SHR_RX_CONGESTION_CNM_PROXY_ERROR,
  opennslRxReasonCongestionCnm = _SHR_RX_CONGESTION_CNM,
  opennslRxReasonMplsUnknownAch = _SHR_RX_MPLS_UNKNOWN_ACH,
  opennslRxReasonMplsLookupsExceeded = _SHR_RX_MPLS_LOOKUPS_EXCEEDED,
  opennslRxReasonMplsReservedEntropyLabel = _SHR_RX_MPLS_RESERVED_ENTROPY_LABEL,
  opennslRxReasonMplsIllegalReservedLabel = _SHR_RX_MPLS_ILLEGAL_RESERVED_LABEL,
  opennslRxReasonMplsRouterAlertLabel = _SHR_RX_MPLS_ROUTER_ALERT_LABEL,
  opennslRxReasonNivPrune = _SHR_RX_NIV_PRUNE,
  opennslRxReasonVirtualPortPrune = _SHR_RX_VIRTUAL_PORT_PRUNE,
  opennslRxReasonNonUnicastDrop = _SHR_RX_NON_UNICAST_DROP,
  opennslRxReasonTrillPacketPortMismatch = _SHR_RX_TRILL_PACKET_PORT_MISMATCH,
  opennslRxReasonWlanClientMove = _SHR_RX_WLAN_CLIENT_MOVE,
  opennslRxReasonWlanSourcePortMiss = _SHR_RX_WLAN_SOURCE_PORT_MISS,
  opennslRxReasonWlanClientSourceMiss = _SHR_RX_WLAN_CLIENT_SOURCE_MISS,
  opennslRxReasonWlanClientDestMiss = _SHR_RX_WLAN_CLIENT_DEST_MISS,
  opennslRxReasonWlanMtu = _SHR_RX_WLAN_MTU,
  opennslRxReasonL2GreSipMiss = _SHR_RX_L2GRE_SIP_MISS,
  opennslRxReasonL2GreVpnIdMiss = _SHR_RX_L2GRE_VPN_ID_MISS,
  opennslRxReasonTimesyncUnknownVersion = _SHR_RX_TIMESYNC_UNKNOWN_VERSION,
  opennslRxReasonBfdUnknownVersion = _SHR_RX_BFD_UNKNOWN_VERSION,
  opennslRxReasonBfdInvalidVersion = _SHR_RX_BFD_INVALID_VERSION,
  opennslRxReasonBfdLookupFailure = _SHR_RX_BFD_LOOKUP_FAILURE,
  opennslRxReasonBfdInvalidPacket = _SHR_RX_BFD_INVALID_PACKET,
  opennslRxReasonVxlanSipMiss = _SHR_RX_VXLAN_SIP_MISS,
  opennslRxReasonVxlanVpnIdMiss = _SHR_RX_VXLAN_VPN_ID_MISS,
  opennslRxReasonFcoeZoneCheckFail = _SHR_RX_FCOE_ZONE_CHECK_FAIL,
  opennslRxReasonIpmcInterfaceMismatch = _SHR_RX_IPMC_INTERFACE_MISMATCH,
  opennslRxReasonNat = _SHR_RX_NAT,
  opennslRxReasonTcpUdpNatMiss = _SHR_RX_TCP_UDP_NAT_MISS,
  opennslRxReasonIcmpNatMiss = _SHR_RX_ICMP_NAT_MISS,
  opennslRxReasonNatFragment = _SHR_RX_NAT_FRAGMENT,
  opennslRxReasonNatMiss = _SHR_RX_NAT_MISS,
  opennslRxReasonOAMCCMSlowpath = _SHR_RX_OAM_CCM_SLOWPATH,
  opennslRxReasonBHHOAM = _SHR_RX_BHH_OAM_PACKET,
  opennslRxReasonUnknownSubtendingPort = _SHR_RX_UNKNOWN_SUBTENTING_PORT,
  opennslRxReasonReserved0 = _SHR_RX_RESERVED_0,
  opennslRxReasonOAMMplsLmDm = _SHR_RX_OAM_MPLS_LMDM,
  opennslRxReasonSat = _SHR_RX_SAT,
  opennslRxReasonSampleSourceFlex = _SHR_RX_SAMPLE_SOURCE_FLEX,
  opennslRxReasonFlexSflow = _SHR_RX_FLEX_SFLOW,
  opennslRxReasonVxltMiss = _SHR_RX_VXLT_MISS,
  opennslRxReasonTunnelDecapEcnError = _SHR_RX_TUNNEL_DECAP_ECN_ERROR,
  opennslRxReasonTunnelObjectValidationFail = _SHR_RX_TUNNEL_OBJECT_VALIDATION_FAIL,
  opennslRxReasonL3Cpu = _SHR_RX_L3_CPU,
  opennslRxReasonTunnelAdaptLookupMiss = _SHR_RX_TUNNEL_ADAPT_LOOKUP_MISS,
  opennslRxReasonPacketFlowSelectMiss = _SHR_RX_PACKET_FLOW_SELECT_MISS,
  opennslRxReasonProtectionDataDrop = _SHR_RX_PROTECTION_DATA_DROP,
  opennslRxReasonPacketFlowSelect = _SHR_RX_PACKET_FLOW_SELECT,
  opennslRxReasonOtherLookupMiss = _SHR_RX_OTHER_LOOKUP_MISS,
  opennslRxReasonInvalidTpid = _SHR_RX_INVALID_TPID,
  opennslRxReasonMplsControlPacket = _SHR_RX_MPLS_CONTROL_PACKET,
  opennslRxReasonTunnelTtlError = _SHR_RX_TUNNEL_TTL_ERROR,
  opennslRxReasonL2HeaderError = _SHR_RX_L2_HEADER_ERROR,
  opennslRxReasonOtherLookupHit = _SHR_RX_OTHER_LOOKUP_HIT,
  opennslRxReasonL2SrcLookupMiss = _SHR_RX_L2_SRC_LOOKUP_MISS,
  opennslRxReasonL2SrcLookupHit = _SHR_RX_L2_SRC_LOOKUP_HIT,
  opennslRxReasonL2DstLookupMiss = _SHR_RX_L2_DST_LOOKUP_MISS,
  opennslRxReasonL2DstLookupHit = _SHR_RX_L2_DST_LOOKUP_HIT,
  opennslRxReasonL3SrcRouteLookupMiss = _SHR_RX_L3_SRC_ROUTE_LOOKUP_MISS,
  opennslRxReasonL3SrcHostLookupMiss = _SHR_RX_L3_SRC_HOST_LOOKUP_MISS,
  opennslRxReasonL3SrcRouteLookupHit = _SHR_RX_L3_SRC_ROUTE_LOOKUP_HIT,
  opennslRxReasonL3SrcHostLookupHit = _SHR_RX_L3_SRC_HOST_LOOKUP_HIT,
  opennslRxReasonL3DstRouteLookupMiss = _SHR_RX_L3_DST_ROUTE_LOOKUP_MISS,
  opennslRxReasonL3DstHostLookupMiss = _SHR_RX_L3_DST_HOST_LOOKUP_MISS,
  opennslRxReasonL3DstRouteLookupHit = _SHR_RX_L3_DST_ROUTE_LOOKUP_HIT,
  opennslRxReasonL3DstHostLookupHit = _SHR_RX_L3_DST_HOST_LOOKUP_HIT,
  opennslRxReasonVlanTranslate1Lookup1Miss = _SHR_RX_VLAN_TRANSLATE1_LOOKUP1_MISS,
  opennslRxReasonVlanTranslate1Lookup2Miss = _SHR_RX_VLAN_TRANSLATE1_LOOKUP2_MISS,
  opennslRxReasonMplsLookup1Miss = _SHR_RX_MPLS_LOOKUP1_MISS,
  opennslRxReasonMplsLookup2Miss = _SHR_RX_MPLS_LOOKUP2_MISS,
  opennslRxReasonL3TunnelLookupMiss = _SHR_RX_L3_TUNNEL_LOOKUP_MISS,
  opennslRxReasonVlanTranslate2Lookup1Miss = _SHR_RX_VLAN_TRANSLATE2_LOOKUP1_MISS,
  opennslRxReasonVlanTranslate2Lookup2Miss = _SHR_RX_VLAN_TRANSLATE2_LOOKUP2_MISS,
  opennslRxReasonL2StuFail = _SHR_RX_L2_STU_FAIL,
  opennslRxReasonSrCounterExceeded = _SHR_RX_SR_COUNTER_EXCEEDED,
  opennslRxReasonSrCopyToCpuBit0 = _SHR_RX_SR_COPY_TO_CPU_BIT0,
  opennslRxReasonSrCopyToCpuBit1 = _SHR_RX_SR_COPY_TO_CPU_BIT1,
  opennslRxReasonSrCopyToCpuBit2 = _SHR_RX_SR_COPY_TO_CPU_BIT2,
  opennslRxReasonSrCopyToCpuBit3 = _SHR_RX_SR_COPY_TO_CPU_BIT3,
  opennslRxReasonSrCopyToCpuBit4 = _SHR_RX_SR_COPY_TO_CPU_BIT4,
  opennslRxReasonSrCopyToCpuBit5 = _SHR_RX_SR_COPY_TO_CPU_BIT5,
  opennslRxReasonL3HeaderMismatch = _SHR_RX_L3_HEADER_MISMATCH,
  opennslRxReasonCount = _SHR_RX_REASON_COUNT
}
 PKT RX Packet Reasons; reason CPU received the packet. More...
 
enum  opennsl_rx_trap_e { opennslRxTrapUserDefine = 204 }
 Return values from PKT RX callout routines. More...
 
enum  opennsl_rx_trap_forwarding_header_e {
  opennslRxTrapForwardingHeaderPacketStart = 0,
  opennslRxTrapForwardingHeaderL2Header = 1,
  opennslRxTrapForwardingHeaderFirstHeader = 2,
  opennslRxTrapForwardingHeaderSecondHeader = 3,
  opennslRxTrapForwardingHeaderThirdHeader = 4,
  opennslRxTrapForwardingHeaderFourthHeader = 5,
  opennslRxTrapForwardingHeaderOamBfdPdu = 6,
  opennslRxTrapForwardingHeaderCount = 7
}
 Forwarding header position overridden value. More...
 

Functions

int opennsl_pkt_alloc (int unit, int size, uint32 flags, opennsl_pkt_t **pkt_buf) LIB_DLL_EXPORTED
 Allocate or deallocate a packet structure and packet data.
 
void opennsl_pkt_blk_t_init (opennsl_pkt_blk_t *pkt_blk) LIB_DLL_EXPORTED
 Initialize a OPENNSL packet block structure.
 
int opennsl_pkt_clear (int unit, opennsl_pkt_t *pkt, opennsl_pkt_blk_t *blks, int blk_count, uint32 flags, opennsl_pkt_t **pkt_buf) LIB_DLL_EXPORTED
 Initialize and set up a opennsl_pkt_t structure.
 
int opennsl_pkt_flags_init (int unit, opennsl_pkt_t *pkt, uint32 init_flags) LIB_DLL_EXPORTED
 Initialize packet flags based on the type of device.
 
int opennsl_pkt_free (int unit, opennsl_pkt_t *pkt) LIB_DLL_EXPORTED
 Allocate or deallocate a packet structure and packet data.
 
int opennsl_pkt_memcpy (opennsl_pkt_t *pkt, int dest_byte, uint8 *src, int len) LIB_DLL_EXPORTED
 Copy data into the data blocks of a packet structure.
 
void opennsl_pkt_t_init (opennsl_pkt_t *pkt) LIB_DLL_EXPORTED
 Initialize a OPENNSL packet structure.
 
int opennsl_rx_active (int unit) LIB_DLL_EXPORTED
 Boolean indication of whether RX is running on this device.
 
int opennsl_rx_cfg_get (int unit, opennsl_rx_cfg_t *cfg) LIB_DLL_EXPORTED
 Get the current configuration for the given device.
 
int opennsl_rx_cfg_init (int unit) LIB_DLL_EXPORTED
 Re-initialize the user level configuration for the RX module.
 
void opennsl_rx_cfg_t_init (opennsl_rx_cfg_t *rx_cfg) LIB_DLL_EXPORTED
 Initialize a OPENNSL RX configuration structure.
 
int opennsl_rx_control_get (int unit, opennsl_rx_control_t type, int *arg) LIB_DLL_EXPORTED
 Set/get RX operating modes.
 
int opennsl_rx_control_set (int unit, opennsl_rx_control_t type, int arg) LIB_DLL_EXPORTED
 Set/get RX operating modes.
 
int opennsl_rx_cos_rate_set (int unit, int cos, int pps) LIB_DLL_EXPORTED
 Set/get the RX per-Cos rate limiting value.
 
int opennsl_rx_cosq_mapping_delete (int unit, int index) LIB_DLL_EXPORTED
 Map/Un-map packets to a CPU CoS queue.
 
int opennsl_rx_cosq_mapping_get (int unit, int index, opennsl_rx_reasons_t *reasons, opennsl_rx_reasons_t *reasons_mask, uint8 *int_prio, uint8 *int_prio_mask, uint32 *packet_type, uint32 *packet_type_mask, opennsl_cos_queue_t *cosq) LIB_DLL_EXPORTED
 Map/Un-map packets to a CPU CoS queue.
 
int opennsl_rx_cosq_mapping_reasons_get (int unit, opennsl_rx_reasons_t *reasons) LIB_DLL_EXPORTED
 Get all the CPU CoS queue mapping reasons supported on the specified device.
 
int opennsl_rx_cosq_mapping_set (int unit, int index, opennsl_rx_reasons_t reasons, opennsl_rx_reasons_t reasons_mask, uint8 int_prio, uint8 int_prio_mask, uint32 packet_type, uint32 packet_type_mask, opennsl_cos_queue_t cosq) LIB_DLL_EXPORTED
 Map/Un-map packets to a CPU CoS queue.
 
int opennsl_rx_cosq_mapping_size_get (int unit, int *size) LIB_DLL_EXPORTED
 Map/Un-map packets to a CPU CoS queue.
 
int opennsl_rx_free (int unit, void *pkt_data) LIB_DLL_EXPORTED
 Allocate or deallocate a packet buffer as configured.
 
int opennsl_rx_queue_max_get (int unit, opennsl_cos_queue_t *cosq) LIB_DLL_EXPORTED
 Get highest priority queue number supported by device.
 
int opennsl_rx_reasons_get (int unit, opennsl_rx_reasons_t *reasons) LIB_DLL_EXPORTED
 Get all the CPU RX reasons supported on the specified device.
 
void opennsl_rx_reasons_t_init (opennsl_rx_reasons_t *reasons) LIB_DLL_EXPORTED
 Initialize a OPENNSL RX reasons structure.
 
int opennsl_rx_register (int unit, const char *name, opennsl_rx_cb_f callback, uint8 priority, void *cookie, uint32 flags) LIB_DLL_EXPORTED
 Register or unregister to receive callbacks for received packets.
 
void opennsl_rx_snoop_config_t_init (opennsl_rx_snoop_config_t *snoop_config) LIB_DLL_EXPORTED
 Initialize the rx_snoop_config_t structure.
 
int opennsl_rx_snoop_create (int unit, int flags, int *snoop_cmnd) LIB_DLL_EXPORTED
 Create snoop command.
 
int opennsl_rx_snoop_destroy (int unit, int flags, int snoop_cmnd) LIB_DLL_EXPORTED
 Destroy create snoop command.
 
int opennsl_rx_snoop_get (int unit, int snoop_cmnd, opennsl_rx_snoop_config_t *config) LIB_DLL_EXPORTED
 Set snoop configuration of the snoop command.
 
int opennsl_rx_snoop_set (int unit, int snoop_cmnd, opennsl_rx_snoop_config_t *config) LIB_DLL_EXPORTED
 The snoop can be set for given trap-code (e.g.
 
int opennsl_rx_start (int unit, opennsl_rx_cfg_t *cfg) LIB_DLL_EXPORTED
 Start packet reception for the given device.
 
int opennsl_rx_stop (int unit, opennsl_rx_cfg_t *cfg) LIB_DLL_EXPORTED
 Stop the RX software module.
 
void opennsl_rx_trap_config_t_init (opennsl_rx_trap_config_t *trap_config) LIB_DLL_EXPORTED
 Initialize the rx_trap_config_t structure.
 
int opennsl_rx_trap_get (int unit, int trap_id, opennsl_rx_trap_config_t *config) LIB_DLL_EXPORTED
 Get trap configuration according to trap id.
 
int opennsl_rx_trap_set (int unit, int trap_id, opennsl_rx_trap_config_t *config) LIB_DLL_EXPORTED
 Set how to handle packet according to trap type.
 
int opennsl_rx_trap_type_create (int unit, int flags, opennsl_rx_trap_t type, int *trap_id) LIB_DLL_EXPORTED
 Create trap handle for a given type.
 
int opennsl_rx_trap_type_destroy (int unit, int trap_id) LIB_DLL_EXPORTED
 Destroy trap handle for a given trap id.
 
int opennsl_rx_trap_type_from_id_get (int unit, int flags, int trap_id, opennsl_rx_trap_t *trap_type) LIB_DLL_EXPORTED
 Get trap type according to trap id.
 
int opennsl_rx_trap_type_get (int unit, int flags, opennsl_rx_trap_t type, int *trap_id) LIB_DLL_EXPORTED
 Get trap id according to type.
 
int opennsl_rx_unregister (int unit, opennsl_rx_cb_f callback, uint8 priority) LIB_DLL_EXPORTED
 Register or unregister to receive callbacks for received packets.
 
int opennsl_tx (int unit, opennsl_pkt_t *tx_pkt, void *cookie) LIB_DLL_EXPORTED
 Transmit one or more packets.
 

Detailed Description

Macro Definition Documentation

#define OPENNSL_CMICX_RX_CHANNELS   8

Max.

number of CMICx RX channels.

Definition at line 33 of file rx.h.

#define OPENNSL_PKT_F_NO_VTAG   0x4

Packet does not contain VLAN tag.

Definition at line 209 of file pkt.h.

#define OPENNSL_PKT_F_TRUNK   0x20000000

Trunk port.

Definition at line 214 of file pkt.h.

#define OPENNSL_PKT_NOF_DNX_HEADERS   _SHR_PKT_NOF_DNX_HEADERS

Definition at line 89 of file pkt.h.

#define OPENNSL_PKT_OAM_COUNTER_MAX   3

Definition at line 88 of file pkt.h.

#define OPENNSL_PKT_ONE_BUF_SETUP (   pkt,
  buf,
  _len 
)
Value:
do { \
(pkt)->_pkt_data.data = (buf); \
(pkt)->_pkt_data.len = (_len); \
(pkt)->pkt_data = &(pkt)->_pkt_data; \
(pkt)->blk_count = 1; \
} while (0)

Definition at line 215 of file pkt.h.

#define OPENNSL_RCO_F_ALL_COS   0x40000000

Definition at line 36 of file rx.h.

Referenced by example_rx_setup(), and main().

#define OPENNSL_RCO_F_COS_ACCEPT (   cos)    (1 << (cos))

Definition at line 35 of file rx.h.

#define OPENNSL_RX_CHANNELS   4

Max.

number of RX channels.

Definition at line 32 of file rx.h.

#define OPENNSL_RX_COSQ_PACKET_TYPE_MIRROR   0x4

Definition at line 28 of file rxX.h.

#define OPENNSL_RX_COSQ_PACKET_TYPE_NON_UNICAST   0x2

Definition at line 27 of file rxX.h.

#define OPENNSL_RX_COSQ_PACKET_TYPE_SWITCHED   0x1

Definition at line 26 of file rxX.h.

#define OPENNSL_RX_REASON_CLEAR_ALL (   _reasons)    _SHR_RX_REASON_CLEAR_ALL(_reasons)

Definition at line 318 of file rx.h.

#define OPENNSL_RX_REASON_GET (   _reasons,
  _reason 
)    _SHR_RX_REASON_GET(_reasons, _reason)

Definition at line 314 of file rx.h.

#define OPENNSL_RX_REASON_NAMES_INITIALIZER   _SHR_RX_REASON_NAMES_INITIALIZER

Definition at line 103 of file rx.h.

#define OPENNSL_RX_REASON_SET (   _reasons,
  _reason 
)    _SHR_RX_REASON_SET(_reasons, _reason)

Definition at line 316 of file rx.h.

#define OPENNSL_RX_SNOOP_DEST_MULTICAST   0x00000040

destination is multicast.

Definition at line 548 of file rxX.h.

#define OPENNSL_RX_SNOOP_REPLACE   0x00000100

Replace config of existing trap/snoop.

Definition at line 552 of file rxX.h.

#define OPENNSL_RX_SNOOP_UPDATE_COLOR   0x00000004

update color.

Definition at line 543 of file rxX.h.

#define OPENNSL_RX_SNOOP_UPDATE_COUNTER   0x00000020

update counter.

Definition at line 547 of file rxX.h.

#define OPENNSL_RX_SNOOP_UPDATE_DEST   0x00000001

update destination.

Definition at line 541 of file rxX.h.

#define OPENNSL_RX_SNOOP_UPDATE_ETHERNET_POLICER   0x00000010

update Ethernet policer.

Definition at line 545 of file rxX.h.

#define OPENNSL_RX_SNOOP_UPDATE_POLICER   0x00000008

update policer id.

Definition at line 544 of file rxX.h.

#define OPENNSL_RX_SNOOP_UPDATE_PRIO   0x00000002

update priority.

Definition at line 542 of file rxX.h.

#define OPENNSL_RX_SNOOP_WITH_ID   0x00000080

Use the specified trap/snoop id.

Definition at line 550 of file rxX.h.

#define OPENNSL_RX_TRAP_REPLACE   0x00000800

Replace config of existing trap/snoop.

Definition at line 539 of file rxX.h.

#define OPENNSL_TX_CRC_ALLOC   0x10

Allocate buffer for CRC.

Definition at line 210 of file pkt.h.

Referenced by example_pkt_send().

#define OPENNSL_TX_CRC_APPEND   (OPENNSL_TX_CRC_ALLOC + OPENNSL_TX_CRC_REGEN)

Definition at line 212 of file pkt.h.

#define OPENNSL_TX_CRC_REGEN   0x20

Regenerate CRC.

Definition at line 211 of file pkt.h.

#define OPENNSL_TX_ETHER   0x100000

Fully mapped packet TX.

Definition at line 213 of file pkt.h.

Typedef Documentation

OPENNSL packet gather block type.

typedef void(* opennsl_pkt_cb_f)(int reserved1, opennsl_pkt_t *reserved2, void *reserved3)

Definition at line 61 of file pkt.h.

OAM counter.

typedef struct opennsl_pkt_s opennsl_pkt_t

The packet structure.

The packet layout is as follows:

DMAC + SMAC 12 bytes VLAN tag 4 bytes (may be filled in by SW on network switch) payload N bytes CRC 4 bytes pad M bytes SL tag 4 bytes (may be unused) HiGig Header 12 bytes (may be unused)

The rule is: alloc_len = 12 + 4 + N + 4 + M + 4 + 12 (all of above). payload_len (below) is N.

Note that the payload may grow until M == 0; the CRC moves. The SL and HiGig headers will not move.

The "IEEE packet" is everything from the DMAC through the CRC (inclusive), not including SL tag or HiGig header.

Scatter/gather is used to put the data into the right positions on transmit and receive. The SL/HiGig headers are parsed on RX into data members in the packet structure. On TX, opennsl_tx will send the packet according to the unit type. It will not check or affect any fields except maybe the CRC. Other routines will be provided to ensure the HiGig and SL tags are properly set up from the data in the packet structure.

Definition at line 59 of file pkt.h.

typedef int(* opennsl_rx_alloc_f)(int reserved1, int reserved2, uint32 reserved3, void **reserved4)

Definition at line 51 of file rx.h.

typedef opennsl_rx_t(* opennsl_rx_cb_f)(int unit, opennsl_pkt_t *pkt, void *cookie)

Definition at line 46 of file rx.h.

User-configurable, per-unit RX configuration.

Channel-specific RX data.

The number of chains allowed for the channel controls the burst size that the channel accepts.

The 'rate_pps' field is DEPRECATED. The rate may be set on a per-COS basis using opennsl_rx_rate_set/get.

IMPORTANT: If OPENNSL_RX_F_MULTI_DCB is NOT used (single DCB per packet) then the rx_free routine must be given the allocation pointer (pkt->alloc_ptr) rather than the packet data pointer (pkt->_pkt_data.data or pkt->pkt_data[0].data).

typedef int(* opennsl_rx_free_f)(int reserved1, void *reserved2)

Definition at line 57 of file rx.h.

PKT RX Packet Reasons; reason CPU received the packet.

It is possible no reasons are set (directed to CPU from ARL for example), or multiple reasons may be set.

Set of 'reasons' (see opennslRxReason*) why a packet came to the CPU.

Definition at line 74 of file pkt.h.

User-configurable, per-unit RX configuration.

typedef enum opennsl_rx_e opennsl_rx_t

Return values from PKT RX callout routines.

User-configurable, per-unit RX configuration.

User-configurable, per-unit-core RX destination configuration.

Forwarding header position overridden value.

Return values from PKT RX callout routines.

Enumeration Type Documentation

Enumerator:
opennslRxControlCRCStrip 

Strip CRC from packets.

Definition at line 569 of file rx.h.

Return values from PKT RX callout routines.

Enumerator:
OPENNSL_RX_INVALID 

Invalid return value.

OPENNSL_RX_NOT_HANDLED 

Packet not processed.

OPENNSL_RX_HANDLED 

Packet handled, not owned.

OPENNSL_RX_HANDLED_OWNED 

Packet handled and owned.

Definition at line 38 of file rx.h.

PKT RX Packet Reasons; reason CPU received the packet.

It is possible no reasons are set (directed to CPU from ARL for example), or multiple reasons may be set.

Enumerator:
opennslRxReasonInvalid 
opennslRxReasonArp 
opennslRxReasonBpdu 
opennslRxReasonBroadcast 
opennslRxReasonClassBasedMove 
opennslRxReasonClassTagPackets 
opennslRxReasonControl 
opennslRxReasonCpuLearn 
opennslRxReasonDestLookupFail 
opennslRxReasonDhcp 
opennslRxReasonDosAttack 
opennslRxReasonE2eHolIbp 
opennslRxReasonEncapHigigError 
opennslRxReasonFilterMatch 
opennslRxReasonGreChecksum 
opennslRxReasonGreSourceRoute 
opennslRxReasonHigigControl 
opennslRxReasonHigigHdrError 
opennslRxReasonIcmpRedirect 
opennslRxReasonIgmp 
opennslRxReasonIngressFilter 
opennslRxReasonIp 
opennslRxReasonIpfixRateViolation 
opennslRxReasonIpMcastMiss 
opennslRxReasonIpmcReserved 
opennslRxReasonIpOptionVersion 
opennslRxReasonIpmc 
opennslRxReasonL2Cpu 
opennslRxReasonL2DestMiss 
opennslRxReasonL2LearnLimit 
opennslRxReasonL2Move 
opennslRxReasonL2MtuFail 
opennslRxReasonL2NonUnicastMiss 
opennslRxReasonL2SourceMiss 
opennslRxReasonL3AddrBindFail 
opennslRxReasonL3DestMiss 
opennslRxReasonL3HeaderError 
opennslRxReasonL3MtuFail 
opennslRxReasonL3Slowpath 
opennslRxReasonL3SourceMiss 
opennslRxReasonL3SourceMove 
opennslRxReasonMartianAddr 
opennslRxReasonMcastIdxError 
opennslRxReasonMcastMiss 
opennslRxReasonMimServiceError 
opennslRxReasonMplsCtrlWordError 
opennslRxReasonMplsError 
opennslRxReasonMplsInvalidAction 
opennslRxReasonMplsInvalidPayload 
opennslRxReasonMplsLabelMiss 
opennslRxReasonMplsSequenceNumber 
opennslRxReasonMplsTtl 
opennslRxReasonMulticast 
opennslRxReasonNhop 
opennslRxReasonOAMError 
opennslRxReasonOAMSlowpath 
opennslRxReasonOAMLMDM 
opennslRxReasonParityError 
opennslRxReasonProtocol 
opennslRxReasonSampleDest 
opennslRxReasonSampleSource 
opennslRxReasonSharedVlanMismatch 
opennslRxReasonSourceRoute 
opennslRxReasonTimeStamp 
opennslRxReasonTtl 
opennslRxReasonTtl1 
opennslRxReasonTunnelError 
opennslRxReasonUdpChecksum 
opennslRxReasonUnknownVlan 
opennslRxReasonUrpfFail 
opennslRxReasonVcLabelMiss 
opennslRxReasonVlanFilterMatch 
opennslRxReasonWlanClientError 
opennslRxReasonWlanSlowpath 
opennslRxReasonWlanDot1xDrop 
opennslRxReasonExceptionFlood 
opennslRxReasonTimeSync 
opennslRxReasonEAVData 
opennslRxReasonSamePortBridge 
opennslRxReasonSplitHorizon 
opennslRxReasonL4Error 
opennslRxReasonStp 
opennslRxReasonEgressFilterRedirect 
opennslRxReasonFilterRedirect 
opennslRxReasonLoopback 
opennslRxReasonVlanTranslate 
opennslRxReasonMmrp 
opennslRxReasonSrp 
opennslRxReasonTunnelControl 
opennslRxReasonL2Marked 
opennslRxReasonWlanSlowpathKeepalive 
opennslRxReasonStation 
opennslRxReasonNiv 
opennslRxReasonNivPrioDrop 
opennslRxReasonNivInterfaceMiss 
opennslRxReasonNivRpfFail 
opennslRxReasonNivTagInvalid 
opennslRxReasonNivTagDrop 
opennslRxReasonNivUntagDrop 
opennslRxReasonTrill 
opennslRxReasonTrillInvalid 
opennslRxReasonTrillMiss 
opennslRxReasonTrillRpfFail 
opennslRxReasonTrillSlowpath 
opennslRxReasonTrillCoreIsIs 
opennslRxReasonTrillTtl 
opennslRxReasonTrillName 
opennslRxReasonBfdSlowpath 
opennslRxReasonBfd 
opennslRxReasonMirror 
opennslRxReasonRegexAction 
opennslRxReasonRegexMatch 
opennslRxReasonFailoverDrop 
opennslRxReasonWlanTunnelError 
opennslRxReasonCongestionCnmProxy 
opennslRxReasonCongestionCnmProxyError 
opennslRxReasonCongestionCnm 
opennslRxReasonMplsUnknownAch 
opennslRxReasonMplsLookupsExceeded 
opennslRxReasonMplsReservedEntropyLabel 
opennslRxReasonMplsIllegalReservedLabel 
opennslRxReasonMplsRouterAlertLabel 
opennslRxReasonNivPrune 
opennslRxReasonVirtualPortPrune 
opennslRxReasonNonUnicastDrop 
opennslRxReasonTrillPacketPortMismatch 
opennslRxReasonWlanClientMove 
opennslRxReasonWlanSourcePortMiss 
opennslRxReasonWlanClientSourceMiss 
opennslRxReasonWlanClientDestMiss 
opennslRxReasonWlanMtu 
opennslRxReasonL2GreSipMiss 
opennslRxReasonL2GreVpnIdMiss 
opennslRxReasonTimesyncUnknownVersion 
opennslRxReasonBfdUnknownVersion 
opennslRxReasonBfdInvalidVersion 
opennslRxReasonBfdLookupFailure 
opennslRxReasonBfdInvalidPacket 
opennslRxReasonVxlanSipMiss 
opennslRxReasonVxlanVpnIdMiss 
opennslRxReasonFcoeZoneCheckFail 
opennslRxReasonIpmcInterfaceMismatch 
opennslRxReasonNat 
opennslRxReasonTcpUdpNatMiss 
opennslRxReasonIcmpNatMiss 
opennslRxReasonNatFragment 
opennslRxReasonNatMiss 
opennslRxReasonOAMCCMSlowpath 
opennslRxReasonBHHOAM 
opennslRxReasonUnknownSubtendingPort 
opennslRxReasonReserved0 
opennslRxReasonOAMMplsLmDm 
opennslRxReasonSat 
opennslRxReasonSampleSourceFlex 
opennslRxReasonFlexSflow 
opennslRxReasonVxltMiss 
opennslRxReasonTunnelDecapEcnError 
opennslRxReasonTunnelObjectValidationFail 
opennslRxReasonL3Cpu 
opennslRxReasonTunnelAdaptLookupMiss 
opennslRxReasonPacketFlowSelectMiss 
opennslRxReasonProtectionDataDrop 
opennslRxReasonPacketFlowSelect 
opennslRxReasonOtherLookupMiss 
opennslRxReasonInvalidTpid 
opennslRxReasonMplsControlPacket 
opennslRxReasonTunnelTtlError 
opennslRxReasonL2HeaderError 
opennslRxReasonOtherLookupHit 
opennslRxReasonL2SrcLookupMiss 
opennslRxReasonL2SrcLookupHit 
opennslRxReasonL2DstLookupMiss 
opennslRxReasonL2DstLookupHit 
opennslRxReasonL3SrcRouteLookupMiss 
opennslRxReasonL3SrcHostLookupMiss 
opennslRxReasonL3SrcRouteLookupHit 
opennslRxReasonL3SrcHostLookupHit 
opennslRxReasonL3DstRouteLookupMiss 
opennslRxReasonL3DstHostLookupMiss 
opennslRxReasonL3DstRouteLookupHit 
opennslRxReasonL3DstHostLookupHit 
opennslRxReasonVlanTranslate1Lookup1Miss 
opennslRxReasonVlanTranslate1Lookup2Miss 
opennslRxReasonMplsLookup1Miss 
opennslRxReasonMplsLookup2Miss 
opennslRxReasonL3TunnelLookupMiss 
opennslRxReasonVlanTranslate2Lookup1Miss 
opennslRxReasonVlanTranslate2Lookup2Miss 
opennslRxReasonL2StuFail 
opennslRxReasonSrCounterExceeded 
opennslRxReasonSrCopyToCpuBit0 
opennslRxReasonSrCopyToCpuBit1 
opennslRxReasonSrCopyToCpuBit2 
opennslRxReasonSrCopyToCpuBit3 
opennslRxReasonSrCopyToCpuBit4 
opennslRxReasonSrCopyToCpuBit5 
opennslRxReasonL3HeaderMismatch 
opennslRxReasonCount 

Definition at line 110 of file rx.h.

Return values from PKT RX callout routines.

Enumerator:
opennslRxTrapUserDefine 

User define traps.

Definition at line 265 of file rxX.h.

Forwarding header position overridden value.

Enumerator:
opennslRxTrapForwardingHeaderPacketStart 

Start of packet.

opennslRxTrapForwardingHeaderL2Header 

Ethernet header.

opennslRxTrapForwardingHeaderFirstHeader 

First header after Ethernet.

opennslRxTrapForwardingHeaderSecondHeader 

Second header after Ethernet.

opennslRxTrapForwardingHeaderThirdHeader 

Third header after Ethernet.

opennslRxTrapForwardingHeaderFourthHeader 

Fourth header after Ethernet.

opennslRxTrapForwardingHeaderOamBfdPdu 

OAM or BFD PDU header.

opennslRxTrapForwardingHeaderCount 

Always Last.

Not a usable value.

Definition at line 271 of file rxX.h.

Function Documentation

int opennsl_pkt_alloc ( int  unit,
int  size,
uint32  flags,
opennsl_pkt_t **  pkt_buf 
)

Allocate or deallocate a packet structure and packet data.

Description
opennsl_pkt_alloc will allocate a packet structure using sal_alloc, allocate a packet data buffer of size bytes using soc_cm_salloc and then link this buffer into the packet structure. It will call =opennsl_pkt_flags_init to set up the packet. opennsl_pkt_free deallocates a packet allocated by opennsl_pkt_alloc. opennsl_pkt_free supports freeing multiple packet data blocks. opennsl_pkt_alloc does not currently work when unit is a remote device.
Parameters
unit[IN] Unit number.
size[IN] Number of bytes to allocate for buffer space
flags[IN] Initial flags for the packet structure
pkt_buf[OUT] Structure to be allocated.
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_MEMORYNot enough memory - pkt_buf will be NULL

Referenced by example_pkt_send().

void opennsl_pkt_blk_t_init ( opennsl_pkt_blk_t pkt_blk)

Initialize a OPENNSL packet block structure.

Description
Initializes a OPENNSL packet block structure to default values. This function should be used to initialize any OPENNSL packet block structure prior to filling it out and passing it to an API function. This ensures that subsequent API releases may add new structure members to the opennsl_pkt_blk_t structure, and opennsl_pkt_blk_t_init will initialize the new members to correct default values.
Parameters
pkt_blk[IN,OUT] Pointer to OPENNSL packet block structure to initialize.
Return values
None.
int opennsl_pkt_clear ( int  unit,
opennsl_pkt_t pkt,
opennsl_pkt_blk_t blks,
int  blk_count,
uint32  flags,
opennsl_pkt_t **  pkt_buf 
)

Initialize and set up a opennsl_pkt_t structure.

Description
If pkt is NULL, a new packet structure is allocated using sal_alloc . The packet structure is set up with the indicated data blocks. If the total number of bytes is less than the minimum permitted, the routine fails. If no data blocks are provided, the function still succeeds, and a single data block can be attached using the OPENNSL_PKT_ONE_BUF_SETUP macro. This routine calls =opennsl_pkt_flags_len_setup before returning.
Parameters
unit[IN] Unit number.
pkt[IN] Pointer to packet to setup; may be NULL
blks[IN] Pointer to array of gather blocks for the packet
blk_count[IN] Number of elements in blks array
flags[IN] See =pkt_flags_table for TX related flags
pkt_buf[OUT] Pointer to a cleared packet or NULL if failed to allocate packet
Return values
OPENNSL_E_NONEOn success
OPENNSL_E_MEMORYOtherwise
int opennsl_pkt_flags_init ( int  unit,
opennsl_pkt_t pkt,
uint32  init_flags 
)

Initialize packet flags based on the type of device.

Description
Based on the device type of unit, initializes the flags for opennsl_pkt_t starting with init_flags.
Parameters
unit[IN] Unit number.
pkt[IN] Packet structure to modify
init_flags[IN] Initial flags to start with
Return values
OPENNSL_E_NONEOn success
int opennsl_pkt_free ( int  unit,
opennsl_pkt_t pkt 
)

Allocate or deallocate a packet structure and packet data.

Description
opennsl_pkt_alloc will allocate a packet structure using sal_alloc, allocate a packet data buffer of size bytes using soc_cm_salloc and then link this buffer into the packet structure. It will call =opennsl_pkt_flags_init to set up the packet. opennsl_pkt_free deallocates a packet allocated by opennsl_pkt_alloc. opennsl_pkt_free supports freeing multiple packet data blocks. opennsl_pkt_alloc does not currently work when unit is a remote device.
Parameters
unit[IN] Unit number.
pkt[IN] Structure to be allocated.
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_MEMORYNot enough memory - pkt_buf will be NULL

Referenced by example_pkt_send().

int opennsl_pkt_memcpy ( opennsl_pkt_t pkt,
int  dest_byte,
uint8 src,
int  len 
)

Copy data into the data blocks of a packet structure.

Description
Copies len bytes of data from src to the packet's data starting at offset dest_byte. This takes into account the block structure of the packet. dest_byte is an absolute offset from the first data byte of the first data block of the packet. This routine does not update the packets data length, hence if number of bytes copied is different from pkt_data.len member then Macro OPENNSL_PKT_TX_LEN_SET should be used to adjust it.
Parameters
pkt[IN] Structure to be updated
dest_byte[IN] Byte offset in the packet's data buffer
src[IN] Pointer to source data to copy
len[IN] Number of bytes to copy
Return values
Thenumber of bytes copied. If there is not sufficient space in the
packet'sdata buffer, this may be less than len.

Referenced by example_pkt_send().

void opennsl_pkt_t_init ( opennsl_pkt_t pkt)

Initialize a OPENNSL packet structure.

Description
Initializes a OPENNSL packet structure to default values. This function should be used to initialize any OPENNSL packet structure prior to filling it out and passing it to an API function. This ensures that subsequent API releases may add new structure members to the opennsl_pkt_t structure, and opennsl_pkt_t_init will initialize the new members to correct default values.
Parameters
pkt[IN,OUT] Pointer to OPENNSL packet structure to initialize.
Return values
None.
int opennsl_rx_active ( int  unit)

Boolean indication of whether RX is running on this device.

Parameters
unit[IN] Unit number.
Return values
TRUEThe RX module is initialized and running on this device
FALSEThe RX module is not running on this device

Referenced by example_rx_setup(), and main().

int opennsl_rx_cfg_get ( int  unit,
opennsl_rx_cfg_t cfg 
)

Get the current configuration for the given device.

Description
If cfg is non-NULL, the current configuration for the indicated device is copied there. If the device has not had =opennsl_rx_start called on it, the routine will return OPENNSL_E_INIT. In this case, the state of cfg will be undefined.
Parameters
unit[IN] Unit number.
cfg[OUT] Where to copy the device's configuration
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_INITStart has not yet been called on the device
OPENNSL_E_PARAMInvalid device
OPENNSL_E_MEMORYUnable to allocate necessary objects for initialization
int opennsl_rx_cfg_init ( int  unit)

Re-initialize the user level configuration for the RX module.

Description
The default configuration is copied to the RX module's configuration for the given device. The device must not be active (started without being stopped).
Parameters
unit[IN] Unit number.
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_BUSYDevice has been started
OPENNSL_E_PARAMInvalid device
OPENNSL_E_MEMORYUnable to allocate necessary objects for initialization
void opennsl_rx_cfg_t_init ( opennsl_rx_cfg_t rx_cfg)

Initialize a OPENNSL RX configuration structure.

Description
Initializes a OPENNSL RX configuration structure to default values. This function should be used to initialize any OPENNSL RX configuration structure prior to filling it out and passing it to an API function. This ensures that subsequent API releases may add new structure members to the opennsl_rx_cfg_t structure, and opennsl_rx_cfg_t_init will initialize the new members to correct default values.
Parameters
rx_cfg[IN,OUT] Pointer to OPENNSL RX configuration structure to initialize.
Return values
None.

Referenced by example_rx_setup().

int opennsl_rx_control_get ( int  unit,
opennsl_rx_control_t  type,
int *  arg 
)

Set/get RX operating modes.

Description
RX controls configure general behavior such as stripping of CRC or VLAN tags. RX controls may be changed by the application at any time. Changes apply to newly received packets, but do not affect previously received and buffered packets. Applications must be prepared to continue to handle packets according to the previous control settings for some time, or else stop packet reception and drain all queues before changing RX controls.
Parameters
unit[IN] Unit number.
type[IN] RX control parameter (see =opennsl_rx_control_switches)
arg[OUT] (for _set) Argument whose meaning is dependent on type
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_UNAVAILControl unavailable
int opennsl_rx_control_set ( int  unit,
opennsl_rx_control_t  type,
int  arg 
)

Set/get RX operating modes.

Description
RX controls configure general behavior such as stripping of CRC or VLAN tags. RX controls may be changed by the application at any time. Changes apply to newly received packets, but do not affect previously received and buffered packets. Applications must be prepared to continue to handle packets according to the previous control settings for some time, or else stop packet reception and drain all queues before changing RX controls.
Parameters
unit[IN] Unit number.
type[IN] RX control parameter (see =opennsl_rx_control_switches)
arg[IN] (for _set) Argument whose meaning is dependent on type
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_UNAVAILControl unavailable
int opennsl_rx_cos_rate_set ( int  unit,
int  cos,
int  pps 
)

Set/get the RX per-Cos rate limiting value.

Description
These functions configure rate limiting on a per-software-Cos-queue basis. If packets for the given CoS are received at a rate higher than this setting, they will be discarded in the interrupt handler. Both functions support a value of OPENNSL_RX_RATE_NOLIMIT for pps to indicate rate limiting is disabled. Setting the unit number to OPENNSL_RX_SYSTEM_UNIT (only in SDK-5.3.0 or SDK-5.2.4; see =opennsl_rx_rate_set ) will result in an error returned because system wide burst settings are not supported. .
Parameters
unit[IN] Unit number.
cos[IN] CoS to configure
pps[IN] Rate in packets/second
Return values
OPENNSL_E_XXXError during required initialization
int opennsl_rx_cosq_mapping_delete ( int  unit,
int  index 
)

Map/Un-map packets to a CPU CoS queue.

Description
These APIs can be used to direct certain Host-bound packets to a specific Host CoS queue. CPU-bound packets may have zero or more reasons associated with them which can be used to map packets to CoS queues. (see =rx_reasons_code_table .) Reasons used to classify a packet must be included in both reasons and reasons_mask. A packet can also be classified by the internal packet priority by setting int_prio and int_prio_mask. Finally, a packet can be classified by the packet type (see below) using packet_type and packet_type_mask. If a specific packet type should not be used to classify a packet, the corresponding bit in packet_type_mask should be set to zero. A given packet may match multiple classification entries. This ambiguity is resolved by using the entry with the lowest index value to determine the CoS queue. The API opennsl_rx_cosq_mapping_size_get can be used to determine the number of entries in the CoS classification table for a given device. A few classication entries with the lowest priorities are reserved by the SDK to classify packets to appropriate CPU CoS queues by default. These entries may be overwritten or deleted by the application if the default behavior is undesirable. When the number of queues per port on the device is changed via =opennsl_cosq_config_set, the default entries are will be recreated as appropriate for the new queues.
Parameters
unit[IN] Unit number.
index[IN] Index into CPU CoS mapping table
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_PARAMInvalid parameter(s)
OPENNSL_E_UNAVAILNot available on the specified unit
int opennsl_rx_cosq_mapping_get ( int  unit,
int  index,
opennsl_rx_reasons_t reasons,
opennsl_rx_reasons_t reasons_mask,
uint8 int_prio,
uint8 int_prio_mask,
uint32 packet_type,
uint32 packet_type_mask,
opennsl_cos_queue_t cosq 
)

Map/Un-map packets to a CPU CoS queue.

Description
These APIs can be used to direct certain Host-bound packets to a specific Host CoS queue. CPU-bound packets may have zero or more reasons associated with them which can be used to map packets to CoS queues. (see =rx_reasons_code_table .) Reasons used to classify a packet must be included in both reasons and reasons_mask. A packet can also be classified by the internal packet priority by setting int_prio and int_prio_mask. Finally, a packet can be classified by the packet type (see below) using packet_type and packet_type_mask. If a specific packet type should not be used to classify a packet, the corresponding bit in packet_type_mask should be set to zero. A given packet may match multiple classification entries. This ambiguity is resolved by using the entry with the lowest index value to determine the CoS queue. The API opennsl_rx_cosq_mapping_size_get can be used to determine the number of entries in the CoS classification table for a given device. A few classication entries with the lowest priorities are reserved by the SDK to classify packets to appropriate CPU CoS queues by default. These entries may be overwritten or deleted by the application if the default behavior is undesirable. When the number of queues per port on the device is changed via =opennsl_cosq_config_set, the default entries are will be recreated as appropriate for the new queues.
Parameters
unit[IN] Unit number.
index[IN] Index into CPU CoS mapping table
reasons[IN,OUT] Set of packet reasons
reasons_mask[IN,OUT] Mask for the set of packet reasons
int_prio[OUT] Internal priority value of packet
int_prio_mask[OUT] Mask for internal priority value
packet_type[OUT] Packet type (see OPENNSL_RX_COSQ_PACKET_TYPE_* below)
packet_type_mask[OUT] Mask for packet type
cosq[OUT] CPU CoS queue
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_PARAMInvalid parameter(s)
OPENNSL_E_UNAVAILNot available on the specified unit
int opennsl_rx_cosq_mapping_reasons_get ( int  unit,
opennsl_rx_reasons_t reasons 
)

Get all the CPU CoS queue mapping reasons supported on the specified device.

Description
Get all the CPU CoS queue mapping reasons supported on the specified device.
Parameters
unit[IN] Unit number.
reasons[OUT] Set of packet reasons
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_PARAMInvalid parameter(s)
OPENNSL_E_UNAVAILNot available on the specified unit
int opennsl_rx_cosq_mapping_set ( int  unit,
int  index,
opennsl_rx_reasons_t  reasons,
opennsl_rx_reasons_t  reasons_mask,
uint8  int_prio,
uint8  int_prio_mask,
uint32  packet_type,
uint32  packet_type_mask,
opennsl_cos_queue_t  cosq 
)

Map/Un-map packets to a CPU CoS queue.

Description
These APIs can be used to direct certain Host-bound packets to a specific Host CoS queue. CPU-bound packets may have zero or more reasons associated with them which can be used to map packets to CoS queues. (see =rx_reasons_code_table .) Reasons used to classify a packet must be included in both reasons and reasons_mask. A packet can also be classified by the internal packet priority by setting int_prio and int_prio_mask. Finally, a packet can be classified by the packet type (see below) using packet_type and packet_type_mask. If a specific packet type should not be used to classify a packet, the corresponding bit in packet_type_mask should be set to zero. A given packet may match multiple classification entries. This ambiguity is resolved by using the entry with the lowest index value to determine the CoS queue. The API opennsl_rx_cosq_mapping_size_get can be used to determine the number of entries in the CoS classification table for a given device. A few classication entries with the lowest priorities are reserved by the SDK to classify packets to appropriate CPU CoS queues by default. These entries may be overwritten or deleted by the application if the default behavior is undesirable. When the number of queues per port on the device is changed via =opennsl_cosq_config_set, the default entries are will be recreated as appropriate for the new queues.
Parameters
unit[IN] Unit number.
index[IN] Index into CPU CoS mapping table
reasons[IN] Set of packet reasons
reasons_mask[IN] Mask for the set of packet reasons
int_prio[IN] Internal priority value of packet
int_prio_mask[IN] Mask for internal priority value
packet_type[IN] Packet type (see OPENNSL_RX_COSQ_PACKET_TYPE_* below)
packet_type_mask[IN] Mask for packet type
cosq[IN] CPU CoS queue
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_PARAMInvalid parameter(s)
OPENNSL_E_UNAVAILNot available on the specified unit
int opennsl_rx_cosq_mapping_size_get ( int  unit,
int *  size 
)

Map/Un-map packets to a CPU CoS queue.

Description
These APIs can be used to direct certain Host-bound packets to a specific Host CoS queue. CPU-bound packets may have zero or more reasons associated with them which can be used to map packets to CoS queues. (see =rx_reasons_code_table .) Reasons used to classify a packet must be included in both reasons and reasons_mask. A packet can also be classified by the internal packet priority by setting int_prio and int_prio_mask. Finally, a packet can be classified by the packet type (see below) using packet_type and packet_type_mask. If a specific packet type should not be used to classify a packet, the corresponding bit in packet_type_mask should be set to zero. A given packet may match multiple classification entries. This ambiguity is resolved by using the entry with the lowest index value to determine the CoS queue. The API opennsl_rx_cosq_mapping_size_get can be used to determine the number of entries in the CoS classification table for a given device. A few classication entries with the lowest priorities are reserved by the SDK to classify packets to appropriate CPU CoS queues by default. These entries may be overwritten or deleted by the application if the default behavior is undesirable. When the number of queues per port on the device is changed via =opennsl_cosq_config_set, the default entries are will be recreated as appropriate for the new queues.
Parameters
unit[IN] Unit number.
size[OUT]
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_PARAMInvalid parameter(s)
OPENNSL_E_UNAVAILNot available on the specified unit
int opennsl_rx_free ( int  unit,
void *  pkt_data 
)

Allocate or deallocate a packet buffer as configured.

Description
The RX module is configured with the =opennsl_rx_cfg_t structure which includes a pointer to packet buffer allocation and deallocation routines. These functions are a gateway to those configured functions which, by default, are the =opennsl_rx_pool_alloc functions.
Parameters
unit[IN] Unit number.
pkt_data[IN] For opennsl_rx_free, pointer to the data to free
Return values
OPENNSL_E_NONEOperation completed successfully
OPENNSL_E_MEMORYOtherwise
int opennsl_rx_queue_max_get ( int  unit,
opennsl_cos_queue_t cosq 
)

Get highest priority queue number supported by device.

Description
Get highest priority queue number supported by device.
Parameters
unit[IN] Unit number.
cosq[OUT] Maximum priority queue supported by device.
Return values
OPENNSL_E_XXX
int opennsl_rx_reasons_get ( int  unit,
opennsl_rx_reasons_t reasons 
)

Get all the CPU RX reasons supported on the specified device.

Description
Get all the CPU RX reasons supported on the specified device. This may be different than the set of CPU CoS queue mapping reasons (see opennsl_rx_cosq_mapping_reasons_get). For example, some devices have a many-to-one mapping of CPU COS queue mapping reasons to RX reason in the RX packet structure.
Parameters
unit[IN] Unit number.
reasons[OUT] Set of packet reasons
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_PARAMInvalid parameter(s)
OPENNSL_E_UNAVAILNot available on the specified unit
void opennsl_rx_reasons_t_init ( opennsl_rx_reasons_t reasons)

Initialize a OPENNSL RX reasons structure.

Description
Initializes a OPENNSL RX reasons structure to default values. This function should be used to initialize any OPENNSL RX reasons structure prior to filling it out and passing it to an API function. This ensures that the structure is initialized to correct default values if subsequent API releases add new members to the structure.
Parameters
reasons[IN,OUT] - Pointer to the structure to be initialized.
Return values
None.
int opennsl_rx_register ( int  unit,
const char *  name,
opennsl_rx_cb_f  callback,
uint8  priority,
void *  cookie,
uint32  flags 
)

Register or unregister to receive callbacks for received packets.

Description
See =opennsl_rx_reg_f for more information about the registration prototype. See =opennsl_rx_cb_f for more information about the callback function prototype for callback. In particular, see =opennsl_rx_t for the legal return values of the callback. The callback is placed on an ordered list associated with the given device and will be called when packets are received on that device To set the interrupt and CoS settings for the callback, the flags parameter should be properly configured with the macros described above in =rx_callback_flags . As mentioned, callbacks may be registered to receive packets in interrupt context. This is generally not recommended. A function may be registered multiple times with different priorities. However, if the same function and priority are registered twice, the flags and cookie must match. .
Parameters
unit[IN] Unit number.
name[IN] String to identify function; for reporting only
callback[IN] Function pointer to be called
priority[IN] Relative priority of the callback; 0 is lowest
cookie[IN] Application data passed on callback
flags[IN] CoS and interrupt level flags; see =rx_callback_flags
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_MEMORYCould not allocate an entry on the callback list
OPENNSL_E_PARAMRegister was called with a NULL callback or re-registered with mismatched flags or cookie.

Referenced by example_rx_setup(), and main().

void opennsl_rx_snoop_config_t_init ( opennsl_rx_snoop_config_t snoop_config)

Initialize the rx_snoop_config_t structure.

Description
Initialize the rx_snoop_config_t structure. .
Parameters
snoop_config[IN,OUT] snoop configuration structure
Returns
Nothing
int opennsl_rx_snoop_create ( int  unit,
int  flags,
int *  snoop_cmnd 
)

Create snoop command.

Description
Create snoop command. .
Parameters
unit[IN] Unit number.
flags[IN] OPENNSL_RX_SNOOP_XXX FLAGS
snoop_cmnd[IN,OUT] Snoop command
Return values
OPENNSL_E_RESOURCENo more trap-id of given type
OPENNSL_E_EXISTSTrap-id already exists
int opennsl_rx_snoop_destroy ( int  unit,
int  flags,
int  snoop_cmnd 
)

Destroy create snoop command.

Description
Destroy create snoop command. .
Parameters
unit[IN] Unit number.
flags[IN] See OPENNSL_RX_TRAP_xxx
snoop_cmnd[IN] Snoop command
Return values
OPENNSL_E_NOT_FOUNDTrap not found
int opennsl_rx_snoop_get ( int  unit,
int  snoop_cmnd,
opennsl_rx_snoop_config_t config 
)

Set snoop configuration of the snoop command.

Description
Set snoop configuration of the snoop command .
Parameters
unit[IN] Unit number.
snoop_cmnd[IN] Snoop command
config[OUT] Pointer for opennsl_rx_snoop_config_t struct
Return values
OPENNSL_E_NOT_FOUNDTrap not found
int opennsl_rx_snoop_set ( int  unit,
int  snoop_cmnd,
opennsl_rx_snoop_config_t config 
)

The snoop can be set for given trap-code (e.g.

IGMP), or by other action, like FP, or forwarding lookup.

Description
The snoop can be set for given trap-code (e.g. IGMP), or by other action, like FP, or forwarding lookup. .
Parameters
unit[IN] Unit number.
snoop_cmnd[IN] Snoop command
config[IN] Pointer for opennsl_rx_snoop_config_t struct
Return values
OPENNSL_E_UNITIllegal unit number
OPENNSL_E_INITUnit not initialized yet
OPENNSL_E_PARAMBad parameter
OPENNSL_E_XXXOther error code
int opennsl_rx_start ( int  unit,
opennsl_rx_cfg_t cfg 
)

Start packet reception for the given device.

Description
If cfg is non-NULL, that configuration is copied to the device's local configuration. The rx_alloc and rx_free members of cfg may be NULL in which case the default values for these functions are used. These are normally the =opennsl_rx_pool_alloc functions. If the RX thread is not already running (only one thread runs for all devices) then that thread is started.
Parameters
unit[IN] Unit number.
cfg[IN] Configuration to use (may be NULL)
Return values
OPENNSL_E_NONESuccess; RX is now running on the device
OPENNSL_E_PARAMInvalid device or pkt_size/pkts_per_chain is 0
OPENNSL_E_MEMORYUnable to allocate necessary objects for initialization

Referenced by example_rx_setup(), and main().

int opennsl_rx_stop ( int  unit,
opennsl_rx_cfg_t cfg 
)

Stop the RX software module.

Description
If RX is running on the given device, it will be given an indication that it should stop. If this is the last device running, the RX thread will be signaled to terminate. This function polls for acknowledgment of that operation will sleep between polls. The current settings force will result in checking for acknowledgment 10 times at one-half second intervals. A warning may be printed if the thread does not exit.
Parameters
unit[IN] Unit number.
cfg[OUT] Saved configuration state
Return values
OPENNSL_E_NONESuccess; RX is no longer running on this device
void opennsl_rx_trap_config_t_init ( opennsl_rx_trap_config_t trap_config)

Initialize the rx_trap_config_t structure.

Description
Initialize the rx_trap_config_t structure. .
Parameters
trap_config[IN,OUT] Trap configuration structure
Returns
Nothing
int opennsl_rx_trap_get ( int  unit,
int  trap_id,
opennsl_rx_trap_config_t config 
)

Get trap configuration according to trap id.

Description
Get trap configuration according to trap id. .
Parameters
unit[IN] Unit number.
trap_id[IN] Trap id
config[OUT] Trap configuration
Return values
OPENNSL_E_NOT_FOUNDTrap not found
int opennsl_rx_trap_set ( int  unit,
int  trap_id,
opennsl_rx_trap_config_t config 
)

Set how to handle packet according to trap type.

Description
Set how to handle packet according to trap type. .
Parameters
unit[IN] Unit number.
trap_id[IN] Trap id
config[IN] Trap configuration
Return values
OPENNSL_E_UNITIllegal unit number
OPENNSL_E_INITUnit not initialized yet
OPENNSL_E_PARAMBad parameter
OPENNSL_E_XXXOther error code
int opennsl_rx_trap_type_create ( int  unit,
int  flags,
opennsl_rx_trap_t  type,
int *  trap_id 
)

Create trap handle for a given type.

Description
Create trap handle for a given type .
Parameters
unit[IN] Unit number.
flags[IN] See OPENNSL_RX_TRAP_xxx
type[IN] Type of trap see opennsl_rx_trap_t
trap_id[IN,OUT] Trap id
Return values
OPENNSL_E_RESOURCENo more trap-id of given type
OPENNSL_E_EXISTSTrap-id already exists
int opennsl_rx_trap_type_destroy ( int  unit,
int  trap_id 
)

Destroy trap handle for a given trap id.

Description
Destroy trap handle for a given trap id. .
Parameters
unit[IN] Unit number.
trap_id[IN] Trap id
Return values
OPENNSL_E_NOT_FOUNDTrap not found
int opennsl_rx_trap_type_from_id_get ( int  unit,
int  flags,
int  trap_id,
opennsl_rx_trap_t trap_type 
)

Get trap type according to trap id.

Description
Get trap type according to trap id. .
Parameters
unit[IN] Unit number.
flags[IN] reserved for future use
trap_id[IN] Trap id
trap_type[OUT] Trap type
Return values
OPENNSL_E_NOT_FOUNDif trap type not found
int opennsl_rx_trap_type_get ( int  unit,
int  flags,
opennsl_rx_trap_t  type,
int *  trap_id 
)

Get trap id according to type.

Description
Get trap id according to type. .
Parameters
unit[IN] Unit number.
flags[IN] See OPENNSL_RX_TRAP_xxx
type[IN] Type of trap see opennsl_rx_trap_t
trap_id[OUT] Trap id
Return values
OPENNSL_E_PARAMBad parameter
int opennsl_rx_unregister ( int  unit,
opennsl_rx_cb_f  callback,
uint8  priority 
)

Register or unregister to receive callbacks for received packets.

Description
See =opennsl_rx_reg_f for more information about the registration prototype. See =opennsl_rx_cb_f for more information about the callback function prototype for callback. In particular, see =opennsl_rx_t for the legal return values of the callback. The callback is placed on an ordered list associated with the given device and will be called when packets are received on that device To set the interrupt and CoS settings for the callback, the flags parameter should be properly configured with the macros described above in =rx_callback_flags . As mentioned, callbacks may be registered to receive packets in interrupt context. This is generally not recommended. A function may be registered multiple times with different priorities. However, if the same function and priority are registered twice, the flags and cookie must match. .
Parameters
unit[IN] Unit number.
callback[IN] Function pointer to be called
priority[IN] Relative priority of the callback; 0 is lowest
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_MEMORYCould not allocate an entry on the callback list
OPENNSL_E_PARAMRegister was called with a NULL callback or re-registered with mismatched flags or cookie.
int opennsl_tx ( int  unit,
opennsl_pkt_t tx_pkt,
void *  cookie 
)

Transmit one or more packets.

Description
See the =opennsl_tx_f documentation for more details about these function types. The opennsl_pkt_t structure is owned by the OPENNSL TX API until the API returns (if callback was NULL), or the callback is executed. For opennsl_tx only: if unit is a remote device, the packet will be automatically tunneled. In this case, OPENNSL_TX_BEST_EFFORT and OPENNSL_TX_RELIABLE will be checked in the packet's flags. See.
Parameters
unit[IN] Unit number.
tx_pkt[IN] A single packet structure
cookie[IN] Application data returned with callback
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_UNITInvalid device ID
OPENNSL_E_MEMORYUnable to allocate necessary structures for transmit
OPENNSL_E_PARAMSee

Referenced by example_pkt_send().