The OpenOnload 201805 distribution includes an example application using CTPIO with ef_vi:
onload/src/tests/rtt/rtt_efvi.c.
When OpenOnload is installed the test application is found at the following location:
/onload-201805/build/gnu_x86_64/tests/rtt
The following sequence is required to send via CTPIO:
- When allocating a VI,
ef_vi_alloc_from_pd()
, set theEF_VI_TX_CTPIO
flag. Also set the TX timestamping flag if required. - To initiate a send, form a complete Ethernet frame (excluding FCS) in host memory. Initiate the send with
ef_vi_transmit_ctpio()
oref_vi_transmitv_ctpio()
. - Post a fall-back descriptor using
ef_vi_transmit_ctpio_fallback()
oref_vi_transmitv_ctpio_fallback()
. These calls are used just like the standard DMA send calls (ef_vi_transmit()
etc.), and so must be provided with a copy of the frame in registered memory. - A TX completion event is returned to the host application regardless of whether the frame is sent via CTPIO or the legacy DMA send method.
The posting of a fall-back descriptor is not on the latency critical path, provided the CTPIO operation succeeds, however it should be posted before posting any further sends on the same VI.
For further details, refer to the ef_vi User Guide (SF-114063-CD).