qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: peter.maydell@linaro.org, qemu-devel@nongnu.org
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>
Subject: [PULL 01/20] tap: Remove tap_probe_vnet_hdr_len()
Date: Tue,  4 Jun 2024 15:37:36 +0800	[thread overview]
Message-ID: <20240604073755.1859-2-jasowang@redhat.com> (raw)
In-Reply-To: <20240604073755.1859-1-jasowang@redhat.com>

From: Akihiko Odaki <akihiko.odaki@daynix.com>

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>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/tap-bsd.c     |  5 -----
 net/tap-linux.c   | 20 --------------------
 net/tap-solaris.c |  5 -----
 net/tap-stub.c    |  5 -----
 net/tap.c         |  8 ++------
 net/tap_int.h     |  1 -
 6 files changed, 2 insertions(+), 42 deletions(-)

diff --git a/net/tap-bsd.c b/net/tap-bsd.c
index 274ea7bd2c..b4c84441ba 100644
--- a/net/tap-bsd.c
+++ b/net/tap-bsd.c
@@ -217,11 +217,6 @@ int tap_probe_has_uso(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 c7e514ecb0..1226d5fda2 100644
--- a/net/tap-linux.c
+++ b/net/tap-linux.c
@@ -185,26 +185,6 @@ int tap_probe_has_uso(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 08b13af512..51b7830bef 100644
--- a/net/tap-solaris.c
+++ b/net/tap-solaris.c
@@ -221,11 +221,6 @@ int tap_probe_has_uso(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 4b24f61e3a..38673434cb 100644
--- a/net/tap-stub.c
+++ b/net/tap-stub.c
@@ -52,11 +52,6 @@ int tap_probe_has_uso(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 baaa2f7a9a..72ae95894f 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -259,11 +259,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)
@@ -432,7 +428,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)) {
+    if (vnet_hdr) {
         tap_fd_set_vnet_hdr_len(s->fd, s->host_vnet_hdr_len);
     }
     tap_read_poll(s, true);
diff --git a/net/tap_int.h b/net/tap_int.h
index 9a2175655b..8857ff299d 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);
 int tap_probe_has_uso(int fd);
 void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo,
-- 
2.42.0



  reply	other threads:[~2024-06-04  7:38 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04  7:37 [PULL 00/20] Net patches Jason Wang
2024-06-04  7:37 ` Jason Wang [this message]
2024-06-04  7:37 ` [PULL 02/20] tap: Remove qemu_using_vnet_hdr() Jason Wang
2024-06-04  7:37 ` [PULL 03/20] net: Move virtio-net header length assertion Jason Wang
2024-06-04  7:37 ` [PULL 04/20] net: Remove receive_raw() Jason Wang
2024-06-04  7:37 ` [PULL 05/20] tap: Call tap_receive_iov() from tap_receive() Jason Wang
2024-06-04  7:37 ` [PULL 06/20] tap: Shrink zeroed virtio-net header Jason Wang
2024-06-04  7:37 ` [PULL 07/20] virtio-net: Do not propagate ebpf-rss-fds errors Jason Wang
2024-06-05 10:23   ` Daniel P. Berrangé
2024-06-05 20:14     ` Akihiko Odaki
2024-06-06  7:14       ` Daniel P. Berrangé
2024-06-06  7:19         ` Akihiko Odaki
2024-06-06  7:59           ` Daniel P. Berrangé
2024-06-07  6:04             ` Akihiko Odaki
2024-06-04  7:37 ` [PULL 08/20] virtio-net: Add only one queue pair when realizing Jason Wang
2024-10-14  8:30   ` Laurent Vivier
2024-10-14 15:16     ` Laurent Vivier
2024-10-17  6:59       ` Jason Wang
2024-10-17  7:32         ` Laurent Vivier
2024-10-17  9:07           ` Akihiko Odaki
2024-10-17  9:17             ` Laurent Vivier
2024-10-17  9:42               ` Akihiko Odaki
2024-10-18  4:50                 ` Jason Wang
2024-10-19 12:38                   ` Akihiko Odaki
2024-10-21  7:23                     ` Jason Wang
2024-10-21  8:40                       ` Akihiko Odaki
2024-06-04  7:37 ` [PULL 09/20] virtio-net: Copy header only when necessary Jason Wang
2024-06-04  7:37 ` [PULL 10/20] virtio-net: Shrink header byte swapping buffer Jason Wang
2024-06-04  7:37 ` [PULL 11/20] virtio-net: Disable RSS on reset Jason Wang
2024-06-04  7:37 ` [PULL 12/20] virtio-net: Unify the logic to update NIC state for RSS Jason Wang
2024-06-04  7:37 ` [PULL 13/20] virtio-net: Always set populate_hash Jason Wang
2024-06-04  7:37 ` [PULL 14/20] virtio-net: Do not write hashes to peer buffer Jason Wang
2024-06-04  7:37 ` [PULL 15/20] ebpf: Fix RSS error handling Jason Wang
2024-06-04  7:37 ` [PULL 16/20] ebpf: Return 0 when configuration fails Jason Wang
2024-06-04  7:37 ` [PULL 17/20] ebpf: Refactor tun_rss_steering_prog() Jason Wang
2024-06-04  7:37 ` [PULL 18/20] ebpf: Add a separate target for skeleton Jason Wang
2024-06-04  7:37 ` [PULL 19/20] virtio-net: drop too short packets early Jason Wang
2024-06-04  7:37 ` [PULL 20/20] ebpf: Added traces back. Changed source set for eBPF to 'system' Jason Wang
2024-06-04 19:52 ` [PULL 00/20] Net patches Richard Henderson
2024-06-05 10:14 ` Michael Tokarev
2024-06-05 20:18   ` Akihiko Odaki
2024-06-06  0:13   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240604073755.1859-2-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=akihiko.odaki@daynix.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).