bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH net-next v2 0/2] virtio-net: support zerocopy multi buffer XDP in mergeable
@ 2025-05-27 16:19 Bui Quang Minh
  2025-05-27 16:19 ` [RFC PATCH net-next v2 1/2] " Bui Quang Minh
  2025-05-27 16:19 ` [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net Bui Quang Minh
  0 siblings, 2 replies; 18+ messages in thread
From: Bui Quang Minh @ 2025-05-27 16:19 UTC (permalink / raw)
  To: netdev
  Cc: Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
	Jesper Dangaard Brouer, John Fastabend, virtualization,
	linux-kernel, bpf, Bui Quang Minh

Currently, in zerocopy mode with mergeable receive buffer, virtio-net
does not support multi buffer but a single buffer only. This commit adds
support for multi mergeable receive buffer in the zerocopy XDP path by
utilizing XDP buffer with frags. This happens when the MTU of tap device
is set to 9000 so that a packet can exceed a single XDP buffer. As a
result, that packet will be split into multi buffer XDP.

This series also adds the test for virtio-net rx when an XDP socket is
bound to the interface. The test exercises both copy and zerocopy mode. We
can adjust the tap device's MTU to test both single buffer and multi
buffer XDP.

Changes in RFC v2:
- Return XDP_DROP when receiving multi-buffer XDP but BPF program does not
support it
- Add selftest
- Link to RFC v1: https://lore.kernel.org/netdev/20250426082752.43222-1-minhquangbui99@gmail.com/

Thanks,
Quang Minh.

Bui Quang Minh (2):
  virtio-net: support zerocopy multi buffer XDP in mergeable
  selftests: net: add XDP socket tests for virtio-net

 drivers/net/virtio_net.c                      | 123 +++---
 .../selftests/drivers/net/hw/.gitignore       |   3 +
 .../testing/selftests/drivers/net/hw/Makefile |  12 +-
 .../drivers/net/hw/xsk_receive.bpf.c          |  43 ++
 .../selftests/drivers/net/hw/xsk_receive.c    | 398 ++++++++++++++++++
 .../selftests/drivers/net/hw/xsk_receive.py   |  75 ++++
 6 files changed, 596 insertions(+), 58 deletions(-)
 create mode 100644 tools/testing/selftests/drivers/net/hw/xsk_receive.bpf.c
 create mode 100644 tools/testing/selftests/drivers/net/hw/xsk_receive.c
 create mode 100755 tools/testing/selftests/drivers/net/hw/xsk_receive.py

-- 
2.43.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-06-03 14:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27 16:19 [RFC PATCH net-next v2 0/2] virtio-net: support zerocopy multi buffer XDP in mergeable Bui Quang Minh
2025-05-27 16:19 ` [RFC PATCH net-next v2 1/2] " Bui Quang Minh
2025-05-28 16:44   ` ALOK TIWARI
2025-05-29  3:42     ` Bui Quang Minh
2025-05-29  5:59   ` Jason Wang
2025-05-29 12:28     ` Bui Quang Minh
2025-06-03  2:56       ` Jason Wang
2025-06-03  6:04         ` Lei Yang
2025-06-03 14:22         ` Bui Quang Minh
2025-05-27 16:19 ` [RFC PATCH net-next v2 2/2] selftests: net: add XDP socket tests for virtio-net Bui Quang Minh
2025-05-28 17:04   ` ALOK TIWARI
2025-05-29  3:44     ` Bui Quang Minh
2025-05-29 11:18   ` Maciej Fijalkowski
2025-05-29 14:29     ` Bui Quang Minh
2025-05-30 11:45       ` Maciej Fijalkowski
2025-05-31  8:51         ` Bui Quang Minh
2025-06-02 15:55           ` Maciej Fijalkowski
2025-06-03 14:18             ` Bui Quang Minh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).