From nobody Wed Nov 27 06:45:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1700299700; cv=none; d=zohomail.com; s=zohoarc; b=FDnvCZ2eNahzIsKzcIXlFj32wlyGXo70o6+eZ2LzdWtWMPzZzZ+o9WPtyhpuzxfy6c95cdoz5BKKWw5oF0aju0NnYG7lZSTZXERur+Q205a/99SwnD6Wb0Oh6wva0JfM5PHmh/lZEb2Rg+yBWD2Iq9bA/y7r++rTPXf0O5zKDnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700299700; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:Message-Id:Reply-To:To; bh=V2WqTGsj76jZXQ8vdPVVfqT8PnTeJYClWaZDpNJ/6/w=; b=AvZoN3ZG0voW8n0i2fmlxXy9jHq7JVV3SvJ8Cs0Je8O0JOTVrqiynvUxD4bYnWbG7QSSbzWGwBkj1SHDGKO6krwTxFqvqgNC7Tsg5gLrkFn464cIVwERs94zHF40sQLu++uxVGPwUa1i2A38k3LMONDKqE5bN+n4mqnY0gHEFOk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700299700364991.6121936660668; Sat, 18 Nov 2023 01:28:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4Ham-0006Am-3A; Sat, 18 Nov 2023 04:26:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4Hak-0006AX-Bg for qemu-devel@nongnu.org; Sat, 18 Nov 2023 04:26:18 -0500 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4Hai-0003fh-On for qemu-devel@nongnu.org; Sat, 18 Nov 2023 04:26:18 -0500 Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-7a66aa8ebb7so105153439f.3 for ; Sat, 18 Nov 2023 01:26:16 -0800 (PST) Received: from localhost ([157.82.205.15]) by smtp.gmail.com with UTF8SMTPSA id 23-20020a17090a031700b002836c720713sm2836883pje.24.2023.11.18.01.26.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Nov 2023 01:26:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1700299575; x=1700904375; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V2WqTGsj76jZXQ8vdPVVfqT8PnTeJYClWaZDpNJ/6/w=; b=Pog/iFrdo80nxHsn4nH4cdFoXL8K43h4DSL5NPfr4/op9BQUJ4qgULF2rieDuH/c6W rhs+Mz8dKXF21Dep13xyK/AjOPFG+9kua6s1zD1vMDY5Yickg3D1HgkjpoWf9/U9kBS9 SDFnyCPnOWZKBupD6JR3tD+uL5zdtKQunmB2v2VrhIBxYCabWiX6LEZpusvtYKQsuNCb FthEjcOvW2ZSs91DLB/dPxYPfeIlz1Bp13RNBRp/aJz2F7W9eSn4RziNtkc+wofea0WL 4Srl6nRczb3H69jQwwIHHD9Hp9F9WkOlP2N4V8NKq1RJKMhAIbU0I893sATJzK38p6a4 8IJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700299575; x=1700904375; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V2WqTGsj76jZXQ8vdPVVfqT8PnTeJYClWaZDpNJ/6/w=; b=ViE2F2j1N4S5YghqusHdlj6khbaEXpOnthy/0Hmbcfbip6X/YawN3LiCdePE3rClM4 wn1rXsL+mPYDP2kwy58esKke102m4TScD9qpsLAZlMgDXH9k91acssrQzJyOweEvVvVO MXLcbJXod7tsOmlK5mrYD4tADx2i5+UgE2S7ttIv7gbWOBAN3ixGrMua73H64ws0NyzQ M50eLSR2Sl9Qi7P83pAZsspXO+PMuC372Gh/AjDHHNJwwL5boGG3AzpSNqKZ4s5Zm84g yhCx5T/V1CextAMeuYyGJg7JjtBAUstc9PNOrBkqzOv/YiuvC1TIIlTpstdnwNjfoRzo 6ICg== X-Gm-Message-State: AOJu0Yy/uuBPj4vVqYMkEkr/cCU0TZA9vJVUZ1/0GUNHw+MYP14Lco5w BRwYQqoPJ1y1tZ6d0TDCY84K4qIzLfeU38/JAbw= X-Google-Smtp-Source: AGHT+IELNEo6f4pZXis/a0DDz4nb3SvcgBJd0tl2vTm1gZwH3SQ/i5Eidmr9vzkplN6RM6SbuQpJxg== X-Received: by 2002:a92:d2c2:0:b0:359:d12c:756a with SMTP id w2-20020a92d2c2000000b00359d12c756amr2439099ilg.20.1700299575502; Sat, 18 Nov 2023 01:26:15 -0800 (PST) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, Yuri Benditovich , Andrew Melnychenko , "Michael S . Tsirkin" , Jason Wang , "Zhang, Chen" , Akihiko Odaki Subject: [PATCH RESEND v7 01/19] tap: Remove tap_probe_vnet_hdr_len() Date: Sat, 18 Nov 2023 18:25:41 +0900 Message-ID: <20231118092601.7132-2-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231118092601.7132-1-akihiko.odaki@daynix.com> References: <20231118092601.7132-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::d31; envelope-from=akihiko.odaki@daynix.com; helo=mail-io1-xd31.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1700299701849100007 Content-Type: text/plain; charset="utf-8" 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 Acked-by: Michael S. Tsirkin --- 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 | 8 ++------ 6 files changed, 2 insertions(+), 42 deletions(-) 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 maxl= en); =20 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, 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; } =20 -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; } =20 -/* Verify that we can assign given length */ -int tap_probe_vnet_hdr_len(int fd, int len) -{ - int orig; - if (ioctl(fd, TUNGETVNETHDRSZ, &orig) =3D=3D -1) { - return 0; - } - if (ioctl(fd, TUNSETVNETHDRSZ, &len) =3D=3D -1) { - return 0; - } - /* Restore original length: we can't handle failure. */ - if (ioctl(fd, TUNSETVNETHDRSZ, &orig) =3D=3D -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) =3D=3D -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; } =20 -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; } =20 -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 c23d0323c2..a1f4d9d49f 100644 --- a/net/tap.c +++ b/net/tap.c @@ -259,11 +259,7 @@ static bool tap_has_vnet_hdr(NetClientState *nc) =20 static bool tap_has_vnet_hdr_len(NetClientState *nc, int len) { - TAPState *s =3D DO_UPCAST(TAPState, nc, nc); - - assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP); - - return !!tap_probe_vnet_hdr_len(s->fd, len); + return tap_has_vnet_hdr(nc); } =20 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); --=20 2.42.1