On 14/12/2021 09.07, Karlsson, Magnus wrote:
I'm coding on an AF_XDP program[1] that need to send (a bulk of packets) in a short time-window (related to Time-Triggered Ethernet).
[...]
How can I get AF_XDP to "flush" TX packets when calling sendto()? Should we add another flag than the current MSG_DONTWAIT?In zero-copy mode with softirq driver processing (not busy poll), a sendto will just trigger the xsk_wakeup ndo that schedules napi unless it is already executing. It is up to the driver to then get packets from the Tx ring and put them on the HW and make sure they are sent. Barring any HW quirks, sending one packets should be perfectly fine.
This actually doesn't sound so good from my customers use-case PoV. That we only trigger a ndo_xsk_wakeup that schedules napi. We want to trigger HW transmission immediately. Can we achieve this via using busy-poll mode?
Hint, I'm using tcpdump hardware timestamping on receiving hist via cmdline: tcpdump -vv -s0 -ni eth1 -j adapter_unsynced --time-stamp-precision=nano -w af_xdp_tx_cyclic.dump42Notice[1] on specific branch: [1] https://github.com/xdp-project/bpf-examples/tree/vestas03_AF_XDP_example/AF_XDP-interaction