Skip to content

igb: Add support for AF_XDP zero-copy

Kurt Kanzenbach bpf intel-wired-lan netdev 5 versions – In review

Get series with b4
b4 am [email protected] change-id 20240711-b4-igb_zero_copy-bb70a31ecb0f

Versions newest first

  1. v9 Latest6 patches 9 repliesIn review
  2. v86 patches 4 repliesSuperseded
  3. v75 patches 5 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v66 patches17 repliesSuperseded
v54 patches4 repliesSuperseded

Changes in v9 from the cover letter

- Collect tags
- Pass read once xsk_pool pointer to igb_xmit_zc() (Maciej)
- Change return type of igb_run_xdp_zc() from skb* to int (Maciej)
- Link to v8: https://lore.kernel.org/r/[email protected]

Patches in v9 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6igb: Remove static qualifiersdrivers/net/ethernet/intel/igb/igb.h drivers/net/ethernet/intel/igb/igb_main.c+35 -311 reply
2/6igb: Introduce igb_xdp_is_enabled()drivers/net/ethernet/intel/igb/igb.h drivers/net/ethernet/intel/igb/igb_main.c+10 -31 reply
3/6igb: Introduce XSK data structures and helpersdrivers/net/ethernet/intel/igb/Makefile drivers/net/ethernet/intel/igb/igb.h drivers/net/ethernet/intel/igb/igb_main.c +1 more+229 -21 reply
4/6igb: Add XDP finalize and stats update functionsdrivers/net/ethernet/intel/igb/igb.h drivers/net/ethernet/intel/igb/igb_main.c+38 -191 reply
5/6igb: Add AF_XDP zero-copy Rx supportdrivers/net/ethernet/intel/igb/igb.h drivers/net/ethernet/intel/igb/igb_main.c drivers/net/ethernet/intel/igb/igb_xsk.c+360 -191 reply
6/6igb: Add AF_XDP zero-copy Tx supportdrivers/net/ethernet/intel/igb/igb.h drivers/net/ethernet/intel/igb/igb_main.c drivers/net/ethernet/intel/igb/igb_xsk.c+116 -103 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchMaciej FijalkowskiGeorge Kuruvinakunnel
1/6A-b T-b
2/6A-b T-b
3/6R-b T-b
4/6A-b T-b
5/6A-b T-b
6/6R-b T-b

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

Read the v9 thread

Cover letter [PATCH iwl-next v9 0/6] igb: Add support for AF_XDP zero-copy

This is version v8 of the AF_XDP zero-copy support for igb. Since Sriram's duties changed I am sending this instead. Additionally, I've tested this on real hardware, Intel i210 [1].

Changes since v8:

- Collect tags
- Pass read once xsk_pool pointer to igb_xmit_zc() (Maciej)
- Change return type of igb_run_xdp_zc() from skb* to int (Maciej)
- Link to v8: https://lore.kernel.org/r/[email protected]

Changes since v7:

- Collect tags
- Split patches (Maciej)
- Use read once xsk_pool pointer in igb_alloc_rx_buffers_zc() (Maciej)
- Add FIXME about RS bit in Tx path (Maciej)
- Link to v7: https://lore.kernel.org/r/[email protected]

Changes since v6:

- Rebase to v6.12
- Collect tags
- Merged first patch via -net
- Inline small functions (Maciej)
- Read xdp_prog only once per NAPI cycle (Maciej)
- Use u32 for stack based variables (Maciej)
- Link to v6: https://lore.kernel.org/r/[email protected]

Changes since v5:

- Rebase to 6.11
- Fix set-but-unused variable warnings
- Split first patches (Maciej)
- Add READ/WRITE_ONCE() for xsk_pool and xdp_prog (Maciej)
- Add synchronize_net() (Maciej)
- Remove IGB_RING_FLAG_AF_XDP_ZC (Maciej)
- Add NETDEV_XDP_ACT_XSK_ZEROCOPY to last patch (Maciej)
- Update Rx ntc handling (Maciej)
- Move stats update and xdp finalize to common functions (Maciej)
- "Likelyfy" XDP_REDIRECT case (Maciej)
- Check Tx disabled and carrier in igb_xmit_zc() (Maciej)
- RCT (Maciej)
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes since v4:

- Rebase to v6.10
- Fix issue reported by kernel test robot
- Provide napi_id for xdp_rxq_info_reg() so that busy polling works
- Set olinfo_status in igb_xmit_zc() so that frames are transmitted

Link to v4: https://lore.kernel.org/intel-wired-lan/[email protected]/

[1] - https://github.com/Linutronix/TSN-Testbench/tree/main/tests/busypolling_i210

Original cover letter:

The first couple of patches adds helper funcctions to prepare for AF_XDP zero-copy support which comes in the last couple of patches, one each for Rx and TX paths.

As mentioned in v1 patchset [0], I don't have access to an actual IGB device to provide correct performance numbers. I have used Intel 82576EB emulator in QEMU [1] to test the changes to IGB driver.

The tests use one isolated vCPU for RX/TX and one isolated vCPU for the xdp-sock application [2]. Hope these measurements provide at the least some indication on the increase in performance when using ZC, especially in the TX path. It would be awesome if someone with a real IGB NIC can test the patch.

AF_XDP performance using 64 byte packets in Kpps.
Benchmark: XDP-SKB XDP-DRV XDP-DRV(ZC)
rxdrop 220 235 350
txpush 1.000 1.000 410
l2fwd 1.000 1.000 200

AF_XDP performance using 1500 byte packets in Kpps.
Benchmark: XDP-SKB XDP-DRV XDP-DRV(ZC)
rxdrop 200 210 310
txpush 1.000 1.000 410
l2fwd 0.900 1.000 160

[0]: https://lore.kernel.org/intel-wired-lan/[email protected]/
[1]: https://www.qemu.org/docs/master/system/devices/igb.html
[2]: https://github.com/xdp-project/bpf-examples/tree/master/AF_XDP-example

v3->v4:
- NULL check buffer_info in igb_dump before dereferencing (Simon Horman)

v2->v3:
- Avoid TX unit hang when using AF_XDP zero-copy by setting time_stamp on the tx_buffer_info
- Fix uninitialized nb_buffs (Simon Horman)

v1->v2:
- Use batch XSK APIs (Maciej Fijalkowski)
- Follow reverse xmas tree convention and remove the ternary operator use (Simon Horman)

---
Kurt Kanzenbach (1):
igb: Add XDP finalize and stats update functions

Sriram Yagnaraman (5):
igb: Remove static qualifiers
igb: Introduce igb_xdp_is_enabled()
igb: Introduce XSK data structures and helpers
igb: Add AF_XDP zero-copy Rx support
igb: Add AF_XDP zero-copy Tx support

 drivers/net/ethernet/intel/igb/Makefile   |   2 +-
 drivers/net/ethernet/intel/igb/igb.h      |  58 ++-
 drivers/net/ethernet/intel/igb/igb_main.c | 248 ++++++++-----
 drivers/net/ethernet/intel/igb/igb_xsk.c  | 562 ++++++++++++++++++++++++++++++
 4 files changed, 787 insertions(+), 83 deletions(-)

---
base-commit: 283f6fbb370dc1adf455be5d5ac41d58d215fd8b
change-id: 20240711-b4-igb_zero_copy-bb70a31ecb0f

Best regards,

Signature · 1 line
Kurt Kanzenbach <[email protected]>