Receiving Packets by the NIC Driver

The driver must implement RtndReceive and/or RtndReceiveWithCallback. The driver must implement RtndReceive to be used with the RT-TCP/IP Stack.

If the driver does not implement RtndReceiveWithCallback, the application can’t receive packets in polling mode or use RtNalReceiveWithCallback with this driver.

When a NAL client application configures the queue to receive data, it attaches to the driver queue in RtndAttachToReceiveQueue. When NAL releases the queue, it calls RtndDetachReceiveQueue.

If the NAL client application uses the queue with receive notifications, the NAL calls RtndIoctl with RTNAL_IOCTL_USE_RX_NOTIFICATIONS before calling RtndAttachToReceiveQueue.

To notify receive packets for the attached queue the driver must call RtnNotifyRecvQueue in its Interrupt Service Thread (IST). The 2nd argument recvCount is the number of the yet to be notified received packets. This number is needed only to support RtNalGetReceivePacketCount in NAL client applications, like in IntervalZero NAL samples. Instead of calling RtNalGetReceivePacketCount, NAL client applications can receive packets in a loop until RtNalReceive fails with the error code ERROR_NO_DATA. The RT-TCP/IP Stack uses this method. In this case RtnNotifyRecvQueue can be called with recvCount equal to 1.

If the receive queue is used in polling mode the NAL calls RtndIoctl with RTNAL_IOCTL_SET_RX_POLLING to enable polling and RTNAL_IOCTL_CLEAR_RX_POLLING to disable polling.

The driver should discard received packets for a detached queue or for the queue configured to the poll when polling is disabled.