1.6.3.11 DRV_G3ADP_MAC_PacketRx Function
C
TCPIP_MAC_PACKET* DRV_G3ADP_MAC_PacketRx (DRV_HANDLE hMac, TCPIP_MAC_RES* pRes, TCPIP_MAC_PACKET_RX_STAT* pPktStat);
Summary
This is the G3 ADP MAC receive function.
Description
This function will return a packet if such a pending packet exists. Additional information about the packet is available by providing the pRes and pPktStat fields.
Precondition
DRV_G3ADP_MAC_Initialize must have been called to set up the driver. DRV_G3ADP_MAC_Open() should have been called to obtain a valid handle.
Parameters
Param | Description |
---|---|
hMac | Handle identifying the MAC driver client |
pRes | Optional pointer to an address that will receive an additional result associated with the operation. Can be 0 if not needed. |
pPktStat | Not implemented. Optional pointer to an address where to copy the received packet status. Can be 0 if not needed. |
Returns
A valid pointer to an available RX packet
0 if no packet pending/available
Example
TCPIP_MAC_PACKET* pRxPkt; // get all the new MAC packets while((pRxPkt = DRV_G3ADP_MAC_PacketRx(pNetIf->hIfMac, 0, 0)) != 0) { // process or queue RX packet }
Remarks
Once a pending packet is available in the MAC driver internal RX queues this function will dequeue the packet and hand it over to the G3 ADP MAC driver's client - i.e., the TCPIP stack - for further processing.
The G3 ADP MAC driver dequeues and return to the caller just one single packet. That is the packets are not chained.
The packet buffers are allocated by the G3 ADP MAC driver itself. Once the higher level layers in the stack are done with processing the RX packet, they have to call the corresponding packet knowledgment function that tells the MAC driver that it can resume control of that packet.
Once the stack modules are done processing the RX packets and the acknowledge function is calledthe MAC driver will reuse the RX packets.
The G3 ADP MAC driver may use the DRV_G3ADP_MAC_Process() for obtaining new RX packets if needed.