Modules | Typedefs | Functions

Modules

 UDMA Packet Definitions
 
 UDMA Configuration
 
 UDMA CPPI Protocol Specific Info
 

Typedefs

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

Functions

int32_t EnetUdma_checkRxFlowSanity (EnetUdma_RxFlowHandle hRxFlow, uint32_t margin)
 Check if any packet loss in RX flow FQ and CQ rings. More...
 
int32_t EnetUdma_checkTxChSanity (EnetUdma_TxChHandle hTxCh, uint32_t margin)
 Check if any packet loss in TX Channel FQ and CQ rings. More...
 
Udma_RingHandle EnetUdma_getTxChFqHandle (EnetUdma_TxChHandle hTxCh)
 Get TX channel FQ handle. More...
 
EnetUdma_DmaDescQHandle EnetUdma_getTxChDescPoolHandle (EnetUdma_TxChHandle hTxCh)
 Get handle to DMA descriptor free pool for TX channel. More...
 
Udma_RingHandle EnetUdma_getRxFlowFqHandle (EnetUdma_RxFlowHandle hRxFlow)
 Get RX flow FQ handle. More...
 
EnetUdma_DmaDescQHandle EnetUdma_getRxFlowDescPoolHandle (EnetUdma_RxFlowHandle hRxFlow)
 Get handle to DMA descriptor free pool for RX flow. More...
 
EnetDma_Handle EnetDma_initDmaCfg (Cpsw_Type cpswType, const EnetUdma_DmaCfg *pDmaCfg)
 Initialize data path. More...
 
int32_t EnetDma_deinitDmaCfg (EnetDma_Handle hCpswDma)
 De-initialize data path. More...
 

Enet UDMA instance configuration

Configuration macros for Enet UDMA module.

#define ENET_UDMA_CPSW_MAX_TX_CH   (8U)
 Maximum number of CPSW TX DMA channels.
 
#define ENET_UDMA_CPSW_MAX_RX_FLOW   (64U)
 Maximum number of CPSW RX FLOWS channels.
 
#define ENET_UDMA_CPSW_MAX_RX_FREE_QUEUE   (4U)
 Max. number for RX free queues for CPSW RX DMA flow.
 
#define ENET_UDMA_HPD_SIZE   (128U)
 Enet UDMA HPD packet size.
 
#define ENET_UDMA_EXTENDED_PKT_INFO_BLOCK_SIZE   (16U)
 Extended Packet Info Block size.
 
#define ENET_UDMA_PROTOCOL_SPECIFIC_INFO_BLOCK_SIZE   (16U)
 Extended Packet Info Block size.
 
#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.
 
#define ENET_UDMA_RXFLOWIDX_INVALID   (0xABCDABCDU)
 Enet UDMA invalid RX flow id.
 
#define ENET_UDMA_RXMTU_ALIGN   (1U << 5U)
 Enet UDMA RX MTU alignment. The RxFlow MTU must be aligned to this value. More...
 

Enet DMA driver opaque handles

Opaque handle typedefs for Enet DMA driver objects.

typedef struct
EnetUdma_RxFlowObj_s * 
EnetDma_RxChHandle
 Opaque handle that holds software state for Enet RX DMA flow. More...
 
typedef struct EnetUdma_TxChObj_s * EnetDma_TxChHandle
 Opaque handle that holds software state for Enet TX DMA channel.
 
typedef struct EnetUdma_PktInfo_s EnetDma_PktInfo
 Enet DMA packet info structure typedef for Enet UDMA module.
 

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.
 
typedef void(* EnetUdma_FreeRingMemFxn )(void *appPriv, void *pRingMem, uint32_t numRingEle)
 Function pointer type for packet free function.
 
typedef struct
EnetUdma_DmaDesc_s *(* 
EnetUdma_AllocDmaDescFxn )(void *appPriv, uint32_t alignSize)
 Function pointer type for DMA descriptor allocation function.
 
typedef void(* EnetUdma_FreeDmaDescFxn )(void *appPriv, struct EnetUdma_DmaDesc_s *dmaDescPtr)
 Function pointer type for DMA descriptor free function.
 
typedef void(* EnetUdma_PktNotifyCb )(void *cbArg)
 Function pointer type for packet notify call back. More...
 

Detailed Description

Macro Definition Documentation

#define ENET_UDMA_PKT_DESC_RESERVED_SIZE
Value:
sizeof(CSL_UdmapCppi5HMPD) - \
#define ENET_UDMA_EXTENDED_PKT_INFO_BLOCK_SIZE
Extended Packet Info Block size.
Definition: enet_udma.h:86
#define ENET_UDMA_PROTOCOL_SPECIFIC_INFO_BLOCK_SIZE
Extended Packet Info Block size.
Definition: enet_udma.h:89
#define ENET_UDMA_HPD_SIZE
Enet UDMA HPD packet size.
Definition: enet_udma.h:83

Extended Packet Info Block size.

#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

Typedef Documentation

typedef struct EnetUdma_RxFlowObj_s* EnetDma_RxChHandle

Opaque handle that holds software state for Enet RX DMA flow.

Note - Even though the typedef is EnetDma_RxChHandle, it is actually flow handle. CPSW and ICSSG has single RX channel with multiple flows with apps using flow to get data from host port.

typedef void(* EnetUdma_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

int32_t EnetDma_deinitDmaCfg ( EnetDma_Handle  hCpswDma)

De-initialize data path.

De-initialize DMA data path state on remote core.

Parameters
hCpswDma[IN] Cpsw DMA Handle
Returns
Enet_ErrorCodes
EnetDma_Handle EnetDma_initDmaCfg ( Cpsw_Type  cpswType,
const EnetUdma_DmaCfg pDmaCfg 
)

Initialize data path.

Initialize DMA data path state on remote core.

Parameters
cpswType[IN] Cpsw Type
pDmaCfg[IN] Data Path Init params
Returns
Enet DMA opaque handle
int32_t EnetUdma_checkRxFlowSanity ( EnetUdma_RxFlowHandle  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
int32_t EnetUdma_checkTxChSanity ( EnetUdma_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_DmaDescQHandle EnetUdma_getRxFlowDescPoolHandle ( EnetUdma_RxFlowHandle  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
Udma_RingHandle EnetUdma_getRxFlowFqHandle ( EnetUdma_RxFlowHandle  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_DmaDescQHandle EnetUdma_getTxChDescPoolHandle ( EnetUdma_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
Udma_RingHandle EnetUdma_getTxChFqHandle ( EnetUdma_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

Copyright 2020, Texas Instruments Incorporated