Skip to content

RFC AF_XDP Preferred Busy Polling

Ciara Loftus dpdk-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3net/af_xdp: Increase max batch size to 512drivers/net/af_xdp/rte_eth_af_xdp.c+4 -40 replies
1/3net/af_xdp: Increase max batch size to 512drivers/net/af_xdp/rte_eth_af_xdp.c+4 -43 replies
2/3net/af_xdp: Use recvfrom() instead of poll()drivers/net/af_xdp/rte_eth_af_xdp.c+4 -30 replies
2/3net/af_xdp: Use recvfrom() instead of poll()drivers/net/af_xdp/rte_eth_af_xdp.c+4 -30 replies
3/3net/af_xdp: preferred busy pollingdoc/guides/nics/af_xdp.rst drivers/net/af_xdp/compat.h drivers/net/af_xdp/rte_eth_af_xdp.c+116 -150 replies
3/3net/af_xdp: preferred busy pollingdoc/guides/nics/af_xdp.rst drivers/net/af_xdp/compat.h drivers/net/af_xdp/rte_eth_af_xdp.c+121 -153 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchFerruh Yigit
SeriesR-b
1/3
1/3
2/3
2/3
3/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [dpdk-dev] [PATCH RFC 0/3] AF_XDP Preferred Busy Polling

Single-core performance of AF_XDP at high loads can be poor because a heavily loaded NAPI context will never enter or allow for busy-polling.

1C testpmd rxonly (both IRQs and PMD on core 0):
./dpdk-testpmd -l 0-1 --vdev=net_af_xdp0,iface=eth0 -- --forward-mode=rxonly 0.088Mpps

In order to achieve decent performance at high loads, it is currently recommended ensure the IRQs for the netdev and the core running the PMD are different.

2C testpmd rxonly (IRQs on core 0, PMD on core 1):
./dpdk-testpmd -l 0-1 --vdev=net_af_xdp0,iface=eth0 --main-lcore=0 -- \
--forward-mode=rxonly
19.26Mpps

However using an extra core is of course not ideal. The SO_PREFER_BUSY_POLL socket option was introduced in kernel v5.11 to help improve 1C performance. See [1].

This series sets this socket option on xsks created with DPDK (ie. instances of the AF_XDP PMD) unless explicitly disabled or not supported by the kernel. It was chosen to be enabled by default in order to bring the AF_XDP PMD in line with most other PMDs which execute on a single core.

The following system and netdev settings are recommended in conjunction with busy polling:
echo 2 | sudo tee /sys/class/net/eth0/napi_defer_hard_irqs
echo 200000 | sudo tee /sys/class/net/eth0/gro_flush_timeout

With the RFC these must be manually configured, but for the v1 these may be set from the PMD since the performance is tightly coupled with these settings.

Re-running the 1C test with busy polling support and the above settings:
./dpdk-testpmd -l 0-1 --vdev=net_af_xdp0,iface=eth0 -- --forward-mode=rxonly 10.45Mpps

A new vdev arg is introduced called 'busy_budget' whose default value is 64. busy_budget is the value supplied to the kernel with the SO_BUSY_POLL_BUDGET socket option and represents the busy-polling NAPI budget ie. the number of packets the kernel will attempt to process in the netdev's NAPI context. If set to 0, preferred busy polling is disabled.

To set the busy budget to 256:
./dpdk-testpmd --vdev=net_af_xdp0,iface=eth0,busy_budget=256 14.06Mpps

To set the busy budget to 512:
./dpdk-testpmd --vdev=net_af_xdp0,iface=eth0,busy_budget=512 14.32Mpps

To disable preferred busy polling:
./dpdk-testpmd --vdev=net_af_xdp0,iface=eth0,busy_budget=0

[1] https://lwn.net/Articles/837010/

Ciara Loftus (3):
net/af_xdp: Increase max batch size to 512
net/af_xdp: Use recvfrom() instead of poll()
net/af_xdp: preferred busy polling

 doc/guides/nics/af_xdp.rst          | 38 +++++++++++-
 drivers/net/af_xdp/compat.h         | 13 ++++
 drivers/net/af_xdp/rte_eth_af_xdp.c | 95 ++++++++++++++++++++++-------
 3 files changed, 124 insertions(+), 22 deletions(-)
Signature · 1 line
2.17.1