netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC v4 0/9] tun: Introduce virtio-net hashing feature
@ 2024-09-24  9:01 Akihiko Odaki
  2024-09-24  9:01 ` [PATCH RFC v4 1/9] skbuff: Introduce SKB_EXT_TUN_VNET_HASH Akihiko Odaki
                   ` (9 more replies)
  0 siblings, 10 replies; 23+ messages in thread
From: Akihiko Odaki @ 2024-09-24  9:01 UTC (permalink / raw)
  To: Jonathan Corbet, Willem de Bruijn, Jason Wang, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Michael S. Tsirkin,
	Xuan Zhuo, Shuah Khan, linux-doc, linux-kernel, netdev, kvm,
	virtualization, linux-kselftest, Yuri Benditovich,
	Andrew Melnychenko, Stephen Hemminger, gur.stavi, Akihiko Odaki

virtio-net have two usage of hashes: one is RSS and another is hash
reporting. Conventionally the hash calculation was done by the VMM.
However, computing the hash after the queue was chosen defeats the
purpose of RSS.

Another approach is to use eBPF steering program. This approach has
another downside: it cannot report the calculated hash due to the
restrictive nature of eBPF.

Introduce the code to compute hashes to the kernel in order to overcome
thse challenges.

An alternative solution is to extend the eBPF steering program so that it
will be able to report to the userspace, but it is based on context
rewrites, which is in feature freeze. We can adopt kfuncs, but they will
not be UAPIs. We opt to ioctl to align with other relevant UAPIs (KVM
and vhost_net).

The patches for QEMU to use this new feature was submitted as RFC and
is available at:
https://patchew.org/QEMU/20240915-hash-v3-0-79cb08d28647@daynix.com/

This work was presented at LPC 2024:
https://lpc.events/event/18/contributions/1963/

V1 -> V2:
  Changed to introduce a new BPF program type.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
Changes in v4:
- Moved tun_vnet_hash_ext to if_tun.h.
- Renamed virtio_net_toeplitz() to virtio_net_toeplitz_calc().
- Replaced htons() with cpu_to_be16().
- Changed virtio_net_hash_rss() to return void.
- Reordered variable declarations in virtio_net_hash_rss().
- Removed virtio_net_hdr_v1_hash_from_skb().
- Updated messages of "tap: Pad virtio header with zero" and
  "tun: Pad virtio header with zero".
- Fixed vnet_hash allocation size.
- Ensured to free vnet_hash when destructing tun_struct.
- Link to v3: https://lore.kernel.org/r/20240915-rss-v3-0-c630015db082@daynix.com

Changes in v3:
- Reverted back to add ioctl.
- Split patch "tun: Introduce virtio-net hashing feature" into
  "tun: Introduce virtio-net hash reporting feature" and
  "tun: Introduce virtio-net RSS".
- Changed to reuse hash values computed for automq instead of performing
  RSS hashing when hash reporting is requested but RSS is not.
- Extracted relevant data from struct tun_struct to keep it minimal.
- Added kernel-doc.
- Changed to allow calling TUNGETVNETHASHCAP before TUNSETIFF.
- Initialized num_buffers with 1.
- Added a test case for unclassified packets.
- Fixed error handling in tests.
- Changed tests to verify that the queue index will not overflow.
- Rebased.
- Link to v2: https://lore.kernel.org/r/20231015141644.260646-1-akihiko.odaki@daynix.com

---
Akihiko Odaki (9):
      skbuff: Introduce SKB_EXT_TUN_VNET_HASH
      virtio_net: Add functions for hashing
      net: flow_dissector: Export flow_keys_dissector_symmetric
      tap: Pad virtio header with zero
      tun: Pad virtio header with zero
      tun: Introduce virtio-net hash reporting feature
      tun: Introduce virtio-net RSS
      selftest: tun: Add tests for virtio-net hashing
      vhost/net: Support VIRTIO_NET_F_HASH_REPORT

 Documentation/networking/tuntap.rst  |   7 +
 drivers/net/Kconfig                  |   1 +
 drivers/net/tap.c                    |   2 +-
 drivers/net/tun.c                    | 255 ++++++++++++--
 drivers/vhost/net.c                  |  16 +-
 include/linux/if_tun.h               |   5 +
 include/linux/skbuff.h               |   3 +
 include/linux/virtio_net.h           | 174 +++++++++
 include/net/flow_dissector.h         |   1 +
 include/uapi/linux/if_tun.h          |  71 ++++
 net/core/flow_dissector.c            |   3 +-
 net/core/skbuff.c                    |   4 +
 tools/testing/selftests/net/Makefile |   2 +-
 tools/testing/selftests/net/tun.c    | 666 ++++++++++++++++++++++++++++++++++-
 14 files changed, 1170 insertions(+), 40 deletions(-)
---
base-commit: 752ebcbe87aceeb6334e846a466116197711a982
change-id: 20240403-rss-e737d89efa77

Best regards,
-- 
Akihiko Odaki <akihiko.odaki@daynix.com>


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

end of thread, other threads:[~2024-10-02  5:27 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24  9:01 [PATCH RFC v4 0/9] tun: Introduce virtio-net hashing feature Akihiko Odaki
2024-09-24  9:01 ` [PATCH RFC v4 1/9] skbuff: Introduce SKB_EXT_TUN_VNET_HASH Akihiko Odaki
2024-09-24  9:01 ` [PATCH RFC v4 2/9] virtio_net: Add functions for hashing Akihiko Odaki
2024-09-24  9:01 ` [PATCH RFC v4 3/9] net: flow_dissector: Export flow_keys_dissector_symmetric Akihiko Odaki
2024-09-24  9:01 ` [PATCH RFC v4 4/9] tap: Pad virtio header with zero Akihiko Odaki
2024-09-24  9:01 ` [PATCH RFC v4 5/9] tun: " Akihiko Odaki
2024-09-24  9:01 ` [PATCH RFC v4 6/9] tun: Introduce virtio-net hash reporting feature Akihiko Odaki
2024-09-24  9:01 ` [PATCH RFC v4 7/9] tun: Introduce virtio-net RSS Akihiko Odaki
2024-09-24 13:05   ` Simon Horman
2024-09-27  2:22     ` Akihiko Odaki
2024-09-25  3:30   ` Jason Wang
2024-09-24  9:01 ` [PATCH RFC v4 8/9] selftest: tun: Add tests for virtio-net hashing Akihiko Odaki
2024-09-24  9:01 ` [PATCH RFC v4 9/9] vhost/net: Support VIRTIO_NET_F_HASH_REPORT Akihiko Odaki
2024-09-25  3:30 ` [PATCH RFC v4 0/9] tun: Introduce virtio-net hashing feature Jason Wang
2024-09-27  2:11   ` Akihiko Odaki
2024-09-27  4:31     ` Jason Wang
2024-09-27  7:50       ` Akihiko Odaki
2024-09-29  2:07         ` Jason Wang
2024-09-29  7:10           ` Akihiko Odaki
2024-09-29 15:33             ` Stephen Hemminger
2024-10-01  5:54               ` Akihiko Odaki
2024-10-01 16:31                 ` Stephen Hemminger
2024-10-02  5:26                   ` Akihiko Odaki

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).