]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: mana: Use page pool fragments for RX buffers instead of full pages to improve...
authorDipayaan Roy <dipayanroy@linux.microsoft.com>
Thu, 14 Aug 2025 14:04:10 +0000 (07:04 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 19 Aug 2025 12:42:44 +0000 (14:42 +0200)
commit730ff06d3f5cc2ce0348414b78c10528b767d4a3
treef59b7daa225f55b70d60412c612390bde6503505
parenta8bdd935d1ddb7186358fb60ffe84253e85340c8
net: mana: Use page pool fragments for RX buffers instead of full pages to improve memory efficiency.

This patch enhances RX buffer handling in the mana driver by allocating
pages from a page pool and slicing them into MTU-sized fragments, rather
than dedicating a full page per packet. This approach is especially
beneficial on systems with large base page sizes like 64KB.

Key improvements:

- Proper integration of page pool for RX buffer allocations.
- MTU-sized buffer slicing to improve memory utilization.
- Reduce overall per Rx queue memory footprint.
- Automatic fallback to full-page buffers when:
   * Jumbo frames are enabled (MTU > PAGE_SIZE / 2).
   * The XDP path is active, to avoid complexities with fragment reuse.

Testing on VMs with 64KB pages shows around 200% throughput improvement.
Memory efficiency is significantly improved due to reduced wastage in page
allocations. Example: We are now able to fit 35 rx buffers in a single 64kb
page for MTU size of 1500, instead of 1 rx buffer per page previously.

Tested:

- iperf3, iperf2, and nttcp benchmarks.
- Jumbo frames with MTU 9000.
- Native XDP programs (XDP_PASS, XDP_DROP, XDP_TX, XDP_REDIRECT) for
  testing the XDP path in driver.
- Memory leak detection (kmemleak).
- Driver load/unload, reboot, and stress scenarios.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Dipayaan Roy <dipayanroy@linux.microsoft.com>
Link: https://patch.msgid.link/20250814140410.GA22089@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/microsoft/mana/mana_bpf.c
drivers/net/ethernet/microsoft/mana/mana_en.c
include/net/mana/mana.h