Modules | Typedefs | Functions
Enet Data Path (DMA)

Modules

 Packet statistics
 
 Enet UDMA
 

Typedefs

typedef EnetDma_PktInfo *(* EnetDma_AllocEthPktFxn )(uint32_t pktSize, uint32_t alignSize, void *appPriv)
 Function pointer type for Ethernet packet allocation function.
 
typedef void(* EnetDma_FreeEthPktFxn )(EnetDma_PktInfo *pPktInfo)
 Function pointer type for Ethernet packet free function.
 
typedef EnetQ EnetDma_PktInfoQ
 Packet queue. More...
 

Functions

void EnetDma_initRxChParams (const void *pRxChCfg)
 Initialize RX channel open parameters. More...
 
EnetDma_RxChHandle EnetDma_openRxCh (const void *pRxChCfg)
 Enet DMA open RX channel. More...
 
int32_t EnetDma_closeRxCh (const void *pRxChPrm, EnetDma_PktInfoQ *pFreeQ)
 Enet DMA close RX channel. More...
 
int32_t EnetDma_enableRxEvent (EnetDma_RxChHandle hRxCh)
 Enable RX channel packet reception event. More...
 
int32_t EnetDma_disableRxEvent (EnetDma_RxChHandle hRxCh)
 Disable RX channel packet reception event. More...
 
void EnetDma_initTxChParams (const void *pTxChCfg)
 Initialize TX channel open parameters. More...
 
EnetDma_TxChHandle EnetDma_openTxCh (const void *pTxChCfg)
 Enet DMA open TX channel. More...
 
int32_t EnetDma_closeTxCh (EnetDma_TxChHandle hTxCh, EnetDma_PktInfoQ *pFreeQ)
 Enet DMA close TX channel. More...
 
int32_t EnetDma_enableTxEvent (EnetDma_TxChHandle hTxCh)
 Enable TX channel packet transmit completion event. More...
 
int32_t EnetDma_disableTxEvent (EnetDma_TxChHandle hTxCh)
 Disable TX channel packet transmit completion event. More...
 
int32_t EnetDma_retrieveRxPktQ (EnetDma_RxChHandle hRxCh, EnetDma_PktInfoQ *pRetrieveQ)
 Retrieve queue of RX ready (full) packets from RX channel. More...
 
int32_t EnetDma_retrieveRxPkt (EnetDma_RxChHandle hRxCh, EnetDma_PktInfo *pPkt)
 Retrieve single RX ready (full) packet (single) from RX channel. More...
 
int32_t EnetDma_submitRxPktQ (EnetDma_RxChHandle hRxCh, EnetDma_PktInfoQ *pSubmitQ)
 Submit queue of RX free (empty) packets for reception to RX channel. More...
 
int32_t EnetDma_submitRxPkt (EnetDma_RxChHandle hRxCh, EnetDma_PktInfo *pPkt)
 Submit single RX free (empty) packet for reception to RX channel. More...
 
int32_t EnetDma_retrieveTxDonePktQ (EnetDma_TxChHandle hTxCh, EnetDma_PktInfoQ *pRetrieveQ)
 Retrieve queue of TX free (empty) packets from TX channel. More...
 
int32_t EnetDma_retrieveTxDonePkt (EnetDma_TxChHandle hTxCh, EnetDma_PktInfo *pPkt)
 Retrieve single TX free (empty) packet from TX channel. More...
 
int32_t EnetDma_submitTxReadyPktQ (EnetDma_TxChHandle hTxCh, EnetDma_PktInfoQ *pSubmitQ)
 Submit a queue of ready (full) packets to TX channel. More...
 
int32_t EnetDma_submitTxReadyPkt (EnetDma_TxChHandle hTxCh, EnetDma_PktInfo *pPkt)
 Submit a single ready (full) packet to TX channel. More...
 
void EnetDma_initPktInfo (EnetDma_PktInfo *pktInfo)
 Initialize packet information structure. More...
 
int32_t EnetDma_getRxChStats (EnetDma_RxChHandle hRxCh, EnetDma_RxChStats *pStats)
 Get RX channel statistics. More...
 
int32_t EnetDma_getTxChStats (EnetDma_TxChHandle hTxCh, EnetDma_TxChStats *pStats)
 Get TX channel statistics. More...
 
int32_t EnetDma_resetRxChStats (EnetDma_RxChHandle hRxCh)
 Reset RX channel statistics. More...
 
int32_t EnetDma_resetTxChStats (EnetDma_TxChHandle hTxCh)
 Reset TX channel statistics. More...
 
void EnetDma_initDataPathParams (EnetDma_DataPathCfg *pDmaCfg)
 Set default data path parameters. More...
 

Enet DMA statistics configuration

Number of entries kept in the statistics for DMA module

#define ENET_DMA_STATS_HISTORY_CNT   ((uint32_t)32U)
 

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 DMA packet descriptors and packets and the stack/translation layer's buffers and packets.

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.
 

Detailed Description

Typedef Documentation

Packet queue.

A queue of packets, which are used for managing the packets given to the DMA driver by an application. It can also be used by the translation or application layer to manage free packets pools.

Function Documentation

int32_t EnetDma_closeRxCh ( const void *  pRxChPrm,
EnetDma_PktInfoQ pFreeQ 
)

Enet DMA close RX channel.

Closes the Enet DMA RX channel and frees all associated resources. During close operation, we flush FQ taking all DMA descriptors with packet submitted in advance for reception and return to app. Also we retrieve all packets from the CQ (packets received between last EnetDma_retrieveRxPktQ() function call) and return those to app. App doesn't need to call function EnetDma_retrieveRxPktQ() explicitly to retrieve these packets.

Parameters
hRxCh[IN] Enet DMA channel handle. This parameter can't be NULL.
pFreeQ[OUT] Pointer to EnetDma_PktInfoQ structure where packets from FQ (submitted for reception) and CQ (received packets) are retrieved and returned to application. This parameter can't be NULL.
Returns
Enet_ErrorCodes
int32_t EnetDma_closeTxCh ( EnetDma_TxChHandle  hTxCh,
EnetDma_PktInfoQ pFreeQ 
)

Enet DMA close TX channel.

Closes the Enet DMA TX channel and frees all associated resources. During close operation, we flush FQ taking all DMA descriptors with packet submitted but not yet transmitted and return to app. Also we retrieve all packets from the CQ (transmission completed packets) and return those to app. App doesn't need to call EnetDma_retrieveTxDonePktQ() explicitly to retrieve these packets.

Parameters
hTxCh[IN] Enet DMA TX Channel handle. This parameter can't be NULL.
pFreeQ[OUT] Pointer to EnetDma_PktInfoQ structure where packets from FQ (TX ready - submitted for transmission) and CQ (TX free - transmitted packets) are retrieved and returned to application. This parameter can't be NULL.
Returns
Enet_ErrorCodes
int32_t EnetDma_disableRxEvent ( EnetDma_RxChHandle  hRxCh)

Disable RX channel packet reception event.

Disable the packet arrival event for RX channel.

Parameters
hRxCh[IN] Handle to Enet DMA RX channel
Returns
Enet_ErrorCodes
int32_t EnetDma_disableTxEvent ( EnetDma_TxChHandle  hTxCh)

Disable TX channel packet transmit completion event.

Disable the packet transmit event for TX channel.

Parameters
hTxCh[IN] Handle to Enet DMA TX channel
Returns
Enet_ErrorCodes
int32_t EnetDma_enableRxEvent ( EnetDma_RxChHandle  hRxCh)

Enable RX channel packet reception event.

Enables the packet arrival event for RX channel. This allows application to control notify events runtime and retrieve packet only once to do burst packet processing.

Parameters
hRxCh[IN] Handle to Enet DMA RX channel
Returns
Enet_ErrorCodes
int32_t EnetDma_enableTxEvent ( EnetDma_TxChHandle  hTxCh)

Enable TX channel packet transmit completion event.

Enables the packet transmit event for TX channel. This allows application to control notify events runtime and retrieve empty packets only once to do burst packet processing.

Parameters
hTxCh[IN] Handle to Enet DMA TX channel
Returns
Enet_ErrorCodes
int32_t EnetDma_getRxChStats ( EnetDma_RxChHandle  hRxCh,
EnetDma_RxChStats pStats 
)

Get RX channel statistics.

Parameters
hRxCh[IN] RX channel handle
pStats[INOUT] Pointer to RX channel stats object where stats would be returned
Return values
ENET_SOKRetrieved stats successfully
ENET_ENOTSUPPORTEDStats is not supported (enabled) or error retrieving
int32_t EnetDma_getTxChStats ( EnetDma_TxChHandle  hTxCh,
EnetDma_TxChStats pStats 
)

Get TX channel statistics.

Parameters
hTxCh[IN] TX channel handle
pStats[INOUT] Pointer to TX Channel stats object where stats would be returned
Return values
ENET_SOKRetrieved stats successfully
ENET_ENOTSUPPORTEDStats is not supported (enabled) or error retrieving
void EnetDma_initDataPathParams ( EnetDma_DataPathCfg *  pDmaCfg)

Set default data path parameters.

Parameters
pDmaCfg[IN] Data path config structure to be initialized
void EnetDma_initPktInfo ( EnetDma_PktInfo pktInfo)

Initialize packet information structure.

Initialize packet information structure with null/zero values.

Parameters
pktInfo[IN] Pointer to EnetDma_PktInfo structure
void EnetDma_initRxChParams ( const void *  pRxChCfg)

Initialize RX channel open parameters.

Initializes RX channel parameters with default values. Refer to SOC DMA specific RX channel config structure for specific config details.

Parameters
pRxChCfgRX channel configuration parameters.
void EnetDma_initTxChParams ( const void *  pTxChCfg)

Initialize TX channel open parameters.

Initializes TX channel open parameters with default values. Refer to SOC DMA specific RX channel config structure for specific config details.

Parameters
pTxChCfgTX channel configuration parameters.
EnetDma_RxChHandle EnetDma_openRxCh ( const void *  pRxChCfg)

Enet DMA open RX channel.

Opens the Enet DMA RX channel based on the channel parameters. This function attaches channel using flowIdx provided in #EnetDma_OpenRxChPrms and configures the DMA channel. This also configures event if notifyCb is not null. Refer to SOC DMA specific RX channel config structure for specific config details.

Parameters
pRxChCfgRX channel configuration parameters. This parameter can't be NULL.
Returns
RX channel opaque handle
EnetDma_TxChHandle EnetDma_openTxCh ( const void *  pTxChCfg)

Enet DMA open TX channel.

Opens the DMA TX DMA channel based on the channel parameters. This function open TX channel using chNum provided in EnetDma_OpenTxChPrms() and configures TX channel. This also configures event if notifyCb is not null. Refer to SOC DMA specific RX channel config structure for specific config details.

Parameters
pTxChCfgTX channel configuration parameters. This parameter can't be NULL.
Returns
TX channel opaque handle
int32_t EnetDma_resetRxChStats ( EnetDma_RxChHandle  hRxCh)

Reset RX channel statistics.

Parameters
hRxCh[IN] RX channel handle
Return values
ENET_SOKResetted stats successfully
ENET_ENOTSUPPORTEDStats is not supported (enabled) or error resetting
int32_t EnetDma_resetTxChStats ( EnetDma_TxChHandle  hTxCh)

Reset TX channel statistics.

Parameters
hTxCh[IN] TX Channel handle
Return values
ENET_SOKResetted stats successfully
ENET_ENOTSUPPORTEDStats is not supported (enabled) or error resetting
int32_t EnetDma_retrieveRxPkt ( EnetDma_RxChHandle  hRxCh,
EnetDma_PktInfo pPkt 
)

Retrieve single RX ready (full) packet (single) from RX channel.

Parameters
hRxCh[IN] Enet DMA RX channel handle for the RX channel we wish to retrieve packet from
pPkt[OUT] Pointer to EnetDma_PktInfo structure where packet from hardware is retrieved and returned to application
Returns
Enet_ErrorCodes
int32_t EnetDma_retrieveRxPktQ ( EnetDma_RxChHandle  hRxCh,
EnetDma_PktInfoQ pRetrieveQ 
)

Retrieve queue of RX ready (full) packets from RX channel.

Parameters
hRxCh[IN] Enet DMA RX channel handle for the RX channel we wish to retrieve packets from
pRetrieveQ[OUT] Pointer to EnetDma_PktInfoQ structure where packets from hardware are retrieved and returned to application
Returns
Enet_ErrorCodes
int32_t EnetDma_retrieveTxDonePkt ( EnetDma_TxChHandle  hTxCh,
EnetDma_PktInfo pPkt 
)

Retrieve single TX free (empty) packet from TX channel.

Parameters
hTxCh[IN] Enet DMA TX channel handle for the TX channel we wish to retrieve packet from
pPkt[OUT] Pointer to EnetDma_PktInfo structure where packet from hardware is retrieved and returned to application
Returns
Enet_ErrorCodes
int32_t EnetDma_retrieveTxDonePktQ ( EnetDma_TxChHandle  hTxCh,
EnetDma_PktInfoQ pRetrieveQ 
)

Retrieve queue of TX free (empty) packets from TX channel.

Parameters
hTxCh[IN] Enet DMA TX channel handle for the TX channel we wish to retrieve packet from
pRetrieveQ[OUT] Pointer to EnetDma_PktInfoQ structure where packets from hardware are retrieved and returned to application
Returns
Enet_ErrorCodes
int32_t EnetDma_submitRxPkt ( EnetDma_RxChHandle  hRxCh,
EnetDma_PktInfo pPkt 
)

Submit single RX free (empty) packet for reception to RX channel.

Parameters
hRxCh[IN] Enet DMA RX channel handle for the RX channel we wish to submit packet to
pPkt[IN] Pointer to EnetDma_PktInfo structure containing packet to be submitted to channel
Returns
Enet_ErrorCodes
int32_t EnetDma_submitRxPktQ ( EnetDma_RxChHandle  hRxCh,
EnetDma_PktInfoQ pSubmitQ 
)

Submit queue of RX free (empty) packets for reception to RX channel.

Parameters
hRxCh[IN] Enet DMA RX channel handle for the RX channel we wish to submit packets to
pSubmitQ[IN] Pointer to EnetDma_PktInfoQ structure containing packets to be submitted to channel [OUT] Returned packets for which driver couldn't allocate the DMA descriptors.
Returns
Enet_ErrorCodes
int32_t EnetDma_submitTxReadyPkt ( EnetDma_TxChHandle  hTxCh,
EnetDma_PktInfo pPkt 
)

Submit a single ready (full) packet to TX channel.

Parameters
hTxCh[IN] TX Channel handle for the TX channel we wish to submit packets to
pPkt[IN] Pointer to EnetDma_PktInfo structure containing packet to be submitted.
Returns
Enet_ErrorCodes
int32_t EnetDma_submitTxReadyPktQ ( EnetDma_TxChHandle  hTxCh,
EnetDma_PktInfoQ pSubmitQ 
)

Submit a queue of ready (full) packets to TX channel.

Parameters
hTxCh[IN] TX Channel handle for the TX channel we wish to submit packets to
pSubmitQ[IN] Pointer to EnetDma_PktInfo structure containing packets to be submitted.
Returns
Enet_ErrorCodes

Copyright 2020, Texas Instruments Incorporated