The following figure illustrates the difference between the normal TCP transmit method and the zero- copy method.
When using standard POSIX socket calls, the application first creates the payload data in an application allocated buffer before calling the send()
function. Onload will copy the data to a Onload packet buffer in memory and post a descriptor to this buffer in the network adapter TX descriptor ring.
Using the zero-copy TCP transmit API the application calls the onload_zc_alloc_buffers()
function to request buffers from Onload. A pointer to a packet buffer is returned in response. The application places the data to send directly into this buffer and then calls onload_zc_send()
to indicate to Onload that data is available to send.
Onload will post a descriptor for the packet buffer in the network adapter TX descriptor ring and ring the TX doorbell. The network adapter fetches the data for transmission.
onload_zc_send
function does not currently support the ONLOAD_MSG_MORE or TCP_CORK flags.Zero-copy TCP transmit is implemented within the Onload Extensions API.