[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 01/20] tap: Remove tap_probe_vnet_hdr_len()
From: |
Akihiko Odaki |
Subject: |
[PATCH v4 01/20] tap: Remove tap_probe_vnet_hdr_len() |
Date: |
Sun, 15 Oct 2023 23:02:33 +0900 |
It was necessary since an Linux older than 2.6.35 may implement the
virtio-net header but may not allow to change its length. Remove it
since such an old Linux is no longer supported.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
net/tap_int.h | 1 -
net/tap-bsd.c | 5 -----
net/tap-linux.c | 20 --------------------
net/tap-solaris.c | 5 -----
net/tap-stub.c | 5 -----
net/tap.c | 10 ++--------
6 files changed, 2 insertions(+), 44 deletions(-)
diff --git a/net/tap_int.h b/net/tap_int.h
index 547f8a5a28..ff7ab23ad7 100644
--- a/net/tap_int.h
+++ b/net/tap_int.h
@@ -35,7 +35,6 @@ ssize_t tap_read_packet(int tapfd, uint8_t *buf, int maxlen);
void tap_set_sndbuf(int fd, const NetdevTapOptions *tap, Error **errp);
int tap_probe_vnet_hdr(int fd, Error **errp);
-int tap_probe_vnet_hdr_len(int fd, int len);
int tap_probe_has_ufo(int fd);
void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int
ufo);
void tap_fd_set_vnet_hdr_len(int fd, int len);
diff --git a/net/tap-bsd.c b/net/tap-bsd.c
index 4c98fdd337..bcd9e894a8 100644
--- a/net/tap-bsd.c
+++ b/net/tap-bsd.c
@@ -212,11 +212,6 @@ int tap_probe_has_ufo(int fd)
return 0;
}
-int tap_probe_vnet_hdr_len(int fd, int len)
-{
- return 0;
-}
-
void tap_fd_set_vnet_hdr_len(int fd, int len)
{
}
diff --git a/net/tap-linux.c b/net/tap-linux.c
index f54f308d35..985287816e 100644
--- a/net/tap-linux.c
+++ b/net/tap-linux.c
@@ -173,26 +173,6 @@ int tap_probe_has_ufo(int fd)
return 1;
}
-/* Verify that we can assign given length */
-int tap_probe_vnet_hdr_len(int fd, int len)
-{
- int orig;
- if (ioctl(fd, TUNGETVNETHDRSZ, &orig) == -1) {
- return 0;
- }
- if (ioctl(fd, TUNSETVNETHDRSZ, &len) == -1) {
- return 0;
- }
- /* Restore original length: we can't handle failure. */
- if (ioctl(fd, TUNSETVNETHDRSZ, &orig) == -1) {
- fprintf(stderr, "TUNGETVNETHDRSZ ioctl() failed: %s. Exiting.\n",
- strerror(errno));
- abort();
- return -errno;
- }
- return 1;
-}
-
void tap_fd_set_vnet_hdr_len(int fd, int len)
{
if (ioctl(fd, TUNSETVNETHDRSZ, &len) == -1) {
diff --git a/net/tap-solaris.c b/net/tap-solaris.c
index 38e15028bf..6ad79fecad 100644
--- a/net/tap-solaris.c
+++ b/net/tap-solaris.c
@@ -216,11 +216,6 @@ int tap_probe_has_ufo(int fd)
return 0;
}
-int tap_probe_vnet_hdr_len(int fd, int len)
-{
- return 0;
-}
-
void tap_fd_set_vnet_hdr_len(int fd, int len)
{
}
diff --git a/net/tap-stub.c b/net/tap-stub.c
index a0fa25804b..422257668c 100644
--- a/net/tap-stub.c
+++ b/net/tap-stub.c
@@ -47,11 +47,6 @@ int tap_probe_has_ufo(int fd)
return 0;
}
-int tap_probe_vnet_hdr_len(int fd, int len)
-{
- return 0;
-}
-
void tap_fd_set_vnet_hdr_len(int fd, int len)
{
}
diff --git a/net/tap.c b/net/tap.c
index c6639d9f20..0403729739 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -248,11 +248,7 @@ static bool tap_has_vnet_hdr(NetClientState *nc)
static bool tap_has_vnet_hdr_len(NetClientState *nc, int len)
{
- TAPState *s = DO_UPCAST(TAPState, nc, nc);
-
- assert(nc->info->type == NET_CLIENT_DRIVER_TAP);
-
- return !!tap_probe_vnet_hdr_len(s->fd, len);
+ return tap_has_vnet_hdr(nc);
}
static int tap_get_vnet_hdr_len(NetClientState *nc)
@@ -419,9 +415,7 @@ static TAPState *net_tap_fd_init(NetClientState *peer,
* Make sure host header length is set correctly in tap:
* it might have been modified by another instance of qemu.
*/
- if (tap_probe_vnet_hdr_len(s->fd, s->host_vnet_hdr_len)) {
- tap_fd_set_vnet_hdr_len(s->fd, s->host_vnet_hdr_len);
- }
+ tap_fd_set_vnet_hdr_len(s->fd, s->host_vnet_hdr_len);
tap_read_poll(s, true);
s->vhost_net = NULL;
--
2.42.0
- [PATCH v4 00/20] virtio-net RSS/hash report fixes and improvements, Akihiko Odaki, 2023/10/15
- [PATCH v4 01/20] tap: Remove tap_probe_vnet_hdr_len(),
Akihiko Odaki <=
- [PATCH v4 02/20] tap: Remove qemu_using_vnet_hdr(), Akihiko Odaki, 2023/10/15
- [PATCH v4 03/20] net: Move virtio-net header length assertion, Akihiko Odaki, 2023/10/15
- [PATCH v4 04/20] net: Remove receive_raw(), Akihiko Odaki, 2023/10/15
- [PATCH v4 05/20] tap: Remove tap_receive(), Akihiko Odaki, 2023/10/15
- [PATCH v4 06/20] net: Remove flag propagation, Akihiko Odaki, 2023/10/15
- [PATCH v4 07/20] tap: Shrink zeroed virtio-net header, Akihiko Odaki, 2023/10/15
- [PATCH v4 08/20] virtio-net: Copy header only when necessary, Akihiko Odaki, 2023/10/15
- [PATCH v4 09/20] virtio-net: Disable RSS on reset, Akihiko Odaki, 2023/10/15
- [PATCH v4 10/20] virtio-net: Unify the logic to update NIC state for RSS, Akihiko Odaki, 2023/10/15
- [PATCH v4 11/20] virtio-net: Return an error when vhost cannot enable RSS, Akihiko Odaki, 2023/10/15