[PATCH RFC v3 0/9] tun: Introduce virtio-net hashing feature

2024-09-14 Thread 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 dow

[PATCH RFC v3 1/9] skbuff: Introduce SKB_EXT_TUN_VNET_HASH

2024-09-14 Thread Akihiko Odaki
This new extension will be used by tun to carry the hash values and types to report with virtio-net headers. Signed-off-by: Akihiko Odaki --- include/linux/skbuff.h | 10 ++ net/core/skbuff.c | 3 +++ 2 files changed, 13 insertions(+) diff --git a/include/linux/skbuff.h b/include/

[PATCH RFC v3 2/9] virtio_net: Add functions for hashing

2024-09-14 Thread Akihiko Odaki
They are useful to implement VIRTIO_NET_F_RSS and VIRTIO_NET_F_HASH_REPORT. Signed-off-by: Akihiko Odaki --- include/linux/virtio_net.h | 198 + 1 file changed, 198 insertions(+) diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h ind

[PATCH RFC v3 3/9] net: flow_dissector: Export flow_keys_dissector_symmetric

2024-09-14 Thread Akihiko Odaki
flow_keys_dissector_symmetric is useful to derive a symmetric hash and to know its source such as IPv4, IPv6, TCP, and UDP. Signed-off-by: Akihiko Odaki --- include/net/flow_dissector.h | 1 + net/core/flow_dissector.c| 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/inc

[PATCH RFC v3 4/9] tap: Pad virtio header with zero

2024-09-14 Thread Akihiko Odaki
tap used to simply advance iov_iter when it needs to pad virtio header. This leaves the garbage in the buffer as is and prevents telling if the header is padded or contains some real data. In theory, a user of tap can fill the buffer with zero before calling read() to avoid such a problem, but lea

[PATCH RFC v3 5/9] tun: Pad virtio header with zero

2024-09-14 Thread Akihiko Odaki
tun used to simply advance iov_iter when it needs to pad virtio header. This leaves the garbage in the buffer as is and prevents telling if the header is padded or contains some real data. In theory, a user of tun can fill the buffer with zero before calling read() to avoid such a problem, but lea

[PATCH RFC v3 6/9] tun: Introduce virtio-net hash reporting feature

2024-09-14 Thread Akihiko Odaki
Allow the guest to reuse the hash value to make receive steering consistent between the host and guest, and to save hash computation. Signed-off-by: Akihiko Odaki --- Documentation/networking/tuntap.rst | 7 ++ drivers/net/Kconfig | 1 + drivers/net/tun.c |

[PATCH RFC v3 7/9] tun: Introduce virtio-net RSS

2024-09-14 Thread Akihiko Odaki
RSS is a receive steering algorithm that can be negotiated to use with virtio_net. 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

[PATCH RFC v3 8/9] selftest: tun: Add tests for virtio-net hashing

2024-09-14 Thread Akihiko Odaki
The added tests confirm tun can perform RSS and hash reporting, and reject invalid configurations for them. Signed-off-by: Akihiko Odaki --- tools/testing/selftests/net/Makefile | 2 +- tools/testing/selftests/net/tun.c| 666 ++- 2 files changed, 660 inserti

[PATCH RFC v3 9/9] vhost/net: Support VIRTIO_NET_F_HASH_REPORT

2024-09-14 Thread Akihiko Odaki
VIRTIO_NET_F_HASH_REPORT allows to report hash values calculated on the host. When VHOST_NET_F_VIRTIO_NET_HDR is employed, it will report no hash values (i.e., the hash_report member is always set to VIRTIO_NET_HASH_REPORT_NONE). Otherwise, the values reported by the underlying socket will be repor