[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 03/20] net: Move virtio-net header length assertion
From: |
Akihiko Odaki |
Subject: |
[PATCH v9 03/20] net: Move virtio-net header length assertion |
Date: |
Wed, 03 Apr 2024 20:10:51 +0900 |
The virtio-net header length assertion should happen for any clients.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
net/net.c | 5 +++++
net/tap.c | 3 ---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/net.c b/net/net.c
index bd51037ebfb0..db096765f4b2 100644
--- a/net/net.c
+++ b/net/net.c
@@ -56,6 +56,7 @@
#include "net/filter.h"
#include "qapi/string-output-visitor.h"
#include "qapi/qobject-input-visitor.h"
+#include "standard-headers/linux/virtio_net.h"
/* Net bridge is currently not supported for W32. */
#if !defined(_WIN32)
@@ -550,6 +551,10 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len)
return;
}
+ assert(len == sizeof(struct virtio_net_hdr_mrg_rxbuf) ||
+ len == sizeof(struct virtio_net_hdr) ||
+ len == sizeof(struct virtio_net_hdr_v1_hash));
+
nc->vnet_hdr_len = len;
nc->info->set_vnet_hdr_len(nc, len);
}
diff --git a/net/tap.c b/net/tap.c
index c848844955df..49edf6c2b6e1 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -267,9 +267,6 @@ static void tap_set_vnet_hdr_len(NetClientState *nc, int
len)
TAPState *s = DO_UPCAST(TAPState, nc, nc);
assert(nc->info->type == NET_CLIENT_DRIVER_TAP);
- assert(len == sizeof(struct virtio_net_hdr_mrg_rxbuf) ||
- len == sizeof(struct virtio_net_hdr) ||
- len == sizeof(struct virtio_net_hdr_v1_hash));
tap_fd_set_vnet_hdr_len(s->fd, len);
s->host_vnet_hdr_len = len;
--
2.44.0
- [PATCH v9 00/20] virtio-net RSS/hash report fixes and improvements, Akihiko Odaki, 2024/04/03
- [PATCH v9 01/20] tap: Remove tap_probe_vnet_hdr_len(), Akihiko Odaki, 2024/04/03
- [PATCH v9 02/20] tap: Remove qemu_using_vnet_hdr(), Akihiko Odaki, 2024/04/03
- [PATCH v9 03/20] net: Move virtio-net header length assertion,
Akihiko Odaki <=
- [PATCH v9 04/20] net: Remove receive_raw(), Akihiko Odaki, 2024/04/03
- [PATCH v9 05/20] tap: Call tap_receive_iov() from tap_receive(), Akihiko Odaki, 2024/04/03
- [PATCH v9 06/20] tap: Shrink zeroed virtio-net header, Akihiko Odaki, 2024/04/03
- [PATCH v9 07/20] virtio-net: Do not propagate ebpf-rss-fds errors, Akihiko Odaki, 2024/04/03
- [PATCH v9 09/20] virtio-net: Copy header only when necessary, Akihiko Odaki, 2024/04/03
- [PATCH v9 08/20] virtio-net: Add only one queue pair when realizing, Akihiko Odaki, 2024/04/03
- [PATCH v9 10/20] virtio-net: Shrink header byte swapping buffer, Akihiko Odaki, 2024/04/03
- [PATCH v9 11/20] virtio-net: Disable RSS on reset, Akihiko Odaki, 2024/04/03
- [PATCH v9 12/20] virtio-net: Unify the logic to update NIC state for RSS, Akihiko Odaki, 2024/04/03
- [PATCH v9 13/20] virtio-net: Return an error when vhost cannot enable RSS, Akihiko Odaki, 2024/04/03