PDK API Guide for J721E
Enet UDMA module APIs.

Introduction

Sub Modules

 UDMA CPPI Protocol Specific Info
 
 UDMA Configuration
 
 UDMA Packet Definitions
 

Functions

void EnetUdma_initDataPathParams (EnetDma_initCfg *pDmaConfig)
 
EnetDma_Handle EnetUdma_initDataPath (Enet_Type enetType, uint32_t instId, const EnetDma_initCfg *pDmaInitCfg)
 
int32_t EnetUdma_deInitDataPath (EnetDma_Handle hEnetUdma)
 
int32_t EnetUdma_checkRxFlowSanity (EnetDma_RxChHandle hRxFlow, uint32_t margin)
 Check if any packet loss in RX flow FQ and CQ rings. More...
 
int32_t EnetUdma_checkTxChSanity (EnetDma_TxChHandle hTxCh, uint32_t margin)
 Check if any packet loss in TX Channel FQ and CQ rings. More...
 
Udma_RingHandle EnetUdma_getTxChFqHandle (EnetDma_TxChHandle hTxCh)
 Get TX channel FQ handle. More...
 
EnetUdma_DmaDescQHandle EnetUdma_getTxChDescPoolHandle (EnetDma_TxChHandle hTxCh)
 Get handle to DMA descriptor free pool for TX channel. More...
 
Udma_RingHandle EnetUdma_getRxFlowFqHandle (EnetDma_RxChHandle hRxFlow)
 Get RX flow FQ handle. More...
 
EnetUdma_DmaDescQHandle EnetUdma_getRxFlowDescPoolHandle (EnetDma_RxChHandle hRxFlow)
 Get handle to DMA descriptor free pool for RX flow. More...
 

Typedefs

typedef struct EnetUdma_DmaDescQ_s * EnetUdma_DmaDescQHandle
 Opaque handle to Enet UDMA descriptor queue. More...
 

Enet UDMA instance configuration

Configuration macros for Enet UDMA module.

typedef struct EnetUdma_Cfg_s EnetDma_Cfg
 Opaque handle that holds config Info for Enet DMA channel. More...
 
#define ENET_UDMA_HPD_SIZE   (128U)
 Enet UDMA HPD packet size. More...
 
#define ENET_UDMA_EXTENDED_PKT_INFO_BLOCK_SIZE   (16U)
 Extended Packet Info Block size. More...
 
#define ENET_UDMA_PROTOCOL_SPECIFIC_INFO_BLOCK_SIZE   (16U)
 Extended Packet Info Block size. More...
 
#define ENET_UDMA_PKT_DESC_RESERVED_SIZE
 Extended Packet Info Block size. More...
 
#define ENET_UDMA_RING_MEM_SIZE   (sizeof(uint64_t))
 UDMA ring single element size. More...
 
#define ENET_UDMA_RXMTU_ALIGN   (1U << 5U)
 Enet UDMA RX MTU alignment. The RxFlow MTU must be aligned to this value. More...
 
#define ENET_UDMA_HPD_SRC_TAG_LOW_MASK   (0xFF)
 Source tag low mask of descriptor (used to get packet's received port number) More...
 

Enet DMA driver callback function types

Callback function typedefs so that the EnetDma layer can call into the app layer and let it translate between the hardware packet descriptors and packets and the stack/translation layer's buffers and packets.

typedef uint8_t *(* EnetUdma_AllocRingMemFxn) (void *appPriv, uint32_t numRingEle, uint32_t alignSize)
 Function pointer type for packet allocation function. More...
 
typedef void(* EnetUdma_FreeRingMemFxn) (void *appPriv, void *pRingMem, uint32_t numRingEle)
 Function pointer type for packet free function. More...
 
typedef struct EnetUdma_DmaDesc_s *(* EnetUdma_AllocDmaDescFxn) (void *appPriv, uint32_t alignSize)
 Function pointer type for DMA descriptor allocation function. More...
 
typedef void(* EnetUdma_FreeDmaDescFxn) (void *appPriv, struct EnetUdma_DmaDesc_s *dmaDescPtr)
 Function pointer type for DMA descriptor free function. More...
 
typedef void(* EnetDma_PktNotifyCb) (void *cbArg)
 Function pointer type for packet notify call back. More...
 

Macro Definition Documentation

◆ ENET_UDMA_HPD_SIZE

#define ENET_UDMA_HPD_SIZE   (128U)

Enet UDMA HPD packet size.

◆ ENET_UDMA_EXTENDED_PKT_INFO_BLOCK_SIZE

#define ENET_UDMA_EXTENDED_PKT_INFO_BLOCK_SIZE   (16U)

Extended Packet Info Block size.

◆ ENET_UDMA_PROTOCOL_SPECIFIC_INFO_BLOCK_SIZE

#define ENET_UDMA_PROTOCOL_SPECIFIC_INFO_BLOCK_SIZE   (16U)

Extended Packet Info Block size.

◆ ENET_UDMA_PKT_DESC_RESERVED_SIZE

#define ENET_UDMA_PKT_DESC_RESERVED_SIZE
Value:
sizeof(CSL_UdmapCppi5HMPD) - \
ENET_UDMA_PROTOCOL_SPECIFIC_INFO_BLOCK_SIZE))
#define ENET_UDMA_HPD_SIZE
Enet UDMA HPD packet size.
Definition: enet_udma.h:78
#define ENET_UDMA_EXTENDED_PKT_INFO_BLOCK_SIZE
Extended Packet Info Block size.
Definition: enet_udma.h:81
Host-mode packet and buffer descriptor.
Definition: csl_udmap_cppi5.h:100

Extended Packet Info Block size.

◆ ENET_UDMA_RING_MEM_SIZE

#define ENET_UDMA_RING_MEM_SIZE   (sizeof(uint64_t))

UDMA ring single element size.

◆ ENET_UDMA_RXMTU_ALIGN

#define ENET_UDMA_RXMTU_ALIGN   (1U << 5U)

Enet UDMA RX MTU alignment. The RxFlow MTU must be aligned to this value.

As per UDMAP spec: "RX Packet Size Threshold 0: This value is left shifted by 5 bits and compared against the packet size to determine which free descriptor queue should be used for the SOP buffer in the packet" The value programmed is hence supposed to be 32 bit aligned. Programming non aligned values will result in truncation and expected MTU size will not be programmed. For example setting MTU size of 1518 (required MTU size) results in actual value of 1504 getting programmed resulting in packet drop for frames of size 1504 - 1518 which the app expects to less than the programmed MTU based on the param passed. Refer ksdma_udmap spec section 4.4.2.6 for more details

◆ ENET_UDMA_HPD_SRC_TAG_LOW_MASK

#define ENET_UDMA_HPD_SRC_TAG_LOW_MASK   (0xFF)

Source tag low mask of descriptor (used to get packet's received port number)

Typedef Documentation

◆ EnetDma_Cfg

typedef struct EnetUdma_Cfg_s EnetDma_Cfg

Opaque handle that holds config Info for Enet DMA channel.

◆ EnetUdma_DmaDescQHandle

typedef struct EnetUdma_DmaDescQ_s* EnetUdma_DmaDescQHandle

Opaque handle to Enet UDMA descriptor queue.

◆ EnetUdma_AllocRingMemFxn

typedef uint8_t*(* EnetUdma_AllocRingMemFxn) (void *appPriv, uint32_t numRingEle, uint32_t alignSize)

Function pointer type for packet allocation function.

◆ EnetUdma_FreeRingMemFxn

typedef void(* EnetUdma_FreeRingMemFxn) (void *appPriv, void *pRingMem, uint32_t numRingEle)

Function pointer type for packet free function.

◆ EnetUdma_AllocDmaDescFxn

typedef struct EnetUdma_DmaDesc_s*(* EnetUdma_AllocDmaDescFxn) (void *appPriv, uint32_t alignSize)

Function pointer type for DMA descriptor allocation function.

◆ EnetUdma_FreeDmaDescFxn

typedef void(* EnetUdma_FreeDmaDescFxn) (void *appPriv, struct EnetUdma_DmaDesc_s *dmaDescPtr)

Function pointer type for DMA descriptor free function.

◆ EnetDma_PktNotifyCb

typedef void(* EnetDma_PktNotifyCb) (void *cbArg)

Function pointer type for packet notify call back.

This is called by driver when packet is received on the RX channel or transmission completed from TX channel.

Function Documentation

◆ EnetUdma_initDataPathParams()

void EnetUdma_initDataPathParams ( EnetDma_initCfg pDmaConfig)

◆ EnetUdma_initDataPath()

EnetDma_Handle EnetUdma_initDataPath ( Enet_Type  enetType,
uint32_t  instId,
const EnetDma_initCfg pDmaInitCfg 
)

◆ EnetUdma_deInitDataPath()

int32_t EnetUdma_deInitDataPath ( EnetDma_Handle  hEnetUdma)

◆ EnetUdma_checkRxFlowSanity()

int32_t EnetUdma_checkRxFlowSanity ( EnetDma_RxChHandle  hRxFlow,
uint32_t  margin 
)

Check if any packet loss in RX flow FQ and CQ rings.

This development time error checks API checks DMA descriptor loss due to any timing issues. We check amount of descriptors with DMA and free matches the number of allocated with some "margin" for packets in flight.

Note: Margin can vary drastically based on Core (A72 vs R5), type of Udma channel (NORMAL/HC etc.) and size of packet. This makes these API dependent on application configuration.

Parameters
hRxFlow[IN] flow handle for the flow we wish to check sanity
margin[IN] Amount of packets which can be in flight in DMA
Return values
UDMA_SOKNumber of free descriptors and with DMA matches (total allocated packets - margin) = (packets in CQ + Packets in FQ)
UDMA_EFAILNumber offree descriptors and with DMA don't match

◆ EnetUdma_checkTxChSanity()

int32_t EnetUdma_checkTxChSanity ( EnetDma_TxChHandle  hTxCh,
uint32_t  margin 
)

Check if any packet loss in TX Channel FQ and CQ rings.

This development time error checks API checks dma desc loss due to any timing issues. We check amount of descriptors with DMA and free matches the number of allocated with some "margin" for packets in flight.

Note: Margin can vary drastically based on Core (A72 vs R5), type of Udma channel (NORMAL/HC etc.) and size of packet. This makes these API dependent on application configuration.

Parameters
hTxCh[IN] TX Channel handle for the TX channel we wish to check sanity
margin[IN] Amount of packets which can be in flight in DMA
Return values
UDMA_SOKNumber of free descriptors and with DMA matches (total allocated packets - margin) = (packets in CQ + Packets in FQ)
UDMA_EFAILNumber of free descriptors and with DMA don't match

◆ EnetUdma_getTxChFqHandle()

Udma_RingHandle EnetUdma_getTxChFqHandle ( EnetDma_TxChHandle  hTxCh)

Get TX channel FQ handle.

Returns FQ handle for TX Channel. This function can be used when auto-recycling of buffers is used.

Parameters
hTxCh[IN] TX Channel handle
Returns
Udma_RingHandle - Handle to FQ ring

◆ EnetUdma_getTxChDescPoolHandle()

EnetUdma_DmaDescQHandle EnetUdma_getTxChDescPoolHandle ( EnetDma_TxChHandle  hTxCh)

Get handle to DMA descriptor free pool for TX channel.

Returns DMA descriptor free pool for TX channel. This function can be used when auto-recycling of buffers is used.

Parameters
hTxCh[IN] TX channel handle
Returns
EnetUdma_DmaDescQHandle - Handle to DMA descriptor free pool

◆ EnetUdma_getRxFlowFqHandle()

Udma_RingHandle EnetUdma_getRxFlowFqHandle ( EnetDma_RxChHandle  hRxFlow)

Get RX flow FQ handle.

Returns FQ handle for RX flow. This function can be used when auto-recycling of buffers is used.

Parameters
hRxFlow[IN] RX flow handle
Returns
Udma_RingHandle - Handle to FQ ring

◆ EnetUdma_getRxFlowDescPoolHandle()

EnetUdma_DmaDescQHandle EnetUdma_getRxFlowDescPoolHandle ( EnetDma_RxChHandle  hRxFlow)

Get handle to DMA descriptor free pool for RX flow.

Returns DMA descriptor free pool for RX flow. This function can be used when auto-recycling of buffers is used.

Parameters
hRxFlow[IN] RX flow handle
Returns
EnetUdma_DmaDescQHandle - Handle to DMA descriptor free pool