Transmitting Packets by the NIC Driver
The driver must implement RtndTransmit and/or RtndTransmitEx. The driver must implement RtndTransmit to be used by the RT-TCP/IP Stack.
RtndTransmit transmits a single packet. It copies packet data to the driver’s packet buffer. In order to support this function, the driver must pre-allocate an array of packet buffers, indexed the same way as the ring buffer of DMA buffer descriptors. RtndTransmit must copy data to a driver buffer and use the driver buffer physical address in a DMA buffer descriptor.
If the driver does not implement RtndTransmitEx, it can service transmitted packets in a driver transmit complete thread (notified by the local event) or directly in the IST.
The following applies only to drivers which implement RtndTransmitEx.
- RtndTransmitEx is a zero-copy API to transmit an array of NAL frames of RTNAL_FRAME type, which must be allocated by RtNalAllocateFrame in the same process context, which calls RtNalTransmitEx.
- In order to support this function, the driver must pre-allocate an array of pointers to NAL frames. It must use the frame physical address in a DMA buffer descriptor.
- RtndAttachToTransmitQueue is called by NAL to enable transmit complete notifications if the application configured the queue to notify transmit. The packets transmitted on this queue will be serviced in RtndServiceTransmitQueue in the context of a NAL client application. NAL must notify the application of transmitted packets by calling RtnNotifyTransmitQueue in driver IST.
- The driver should service all other queues in its own transmit complete thread (notified by the local event) or directly in the IST.
- The driver must call RtnTransmitCompleteCallback for each NAL frame, transmitted by RtndTransmitEx. If the driver services the NAL frame in a driver context (driver transmit thread or driver IST), it must set fpCallBack in RTNAL_FRAME to NULL, before calling RtnTransmitCompleteCallback.
- The NAL calls RtndDetachTransmitQueue when an application (or NAL on its behalf) releases the queue.