From nobody Wed Nov 27 06:53:08 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=1700299225; cv=none; d=zohomail.com; s=zohoarc; b=O5K0hjs6KO074XAEfJiyMQ6gDDDOWGcEWGuEOTVMpZF3vzPKcxsVK6lo1+ApeDr7knneyjLHtMgfyqZ1+yOK2Ta1ZWHSMymeYhTT08CRJjZKl36zZGcxCsPc+9LyeQWitb7QbYqof2HSYqSIajQYQolSlH5WrzYznYlwQKcMP3g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700299225; 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=rH3OESzwjQ69xioS7GrBiuwAFBXJAVIbXvkiJ7DPKqQ=; b=FOXEVG/n1OzOIYBlANRtjkPj3+Vk8/KClbTPb9LVj/8wWPwIvsSxVsNrqR7cKlObgJVk6C00dfavy8Ij4NxKxKkGiI+ORXOoDdgTgS3FZEArzb7QnaOZ/FQgEBuK4W2YTpLhliY3AMRtBDE8tHDUyApBg1SKbkqu+3pfD3nypZw= 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 1700299225090841.0556880091997; Sat, 18 Nov 2023 01:20:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4HTu-0002UQ-UL; Sat, 18 Nov 2023 04:19:14 -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 1r4HTt-0002UG-Oj for qemu-devel@nongnu.org; Sat, 18 Nov 2023 04:19:13 -0500 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4HTs-00056B-8o for qemu-devel@nongnu.org; Sat, 18 Nov 2023 04:19:13 -0500 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5c21e185df5so405282a12.1 for ; Sat, 18 Nov 2023 01:19:11 -0800 (PST) Received: from localhost ([157.82.205.15]) by smtp.gmail.com with UTF8SMTPSA id fn21-20020a056a002fd500b006c34a04c782sm2664146pfb.61.2023.11.18.01.19.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 Nov 2023 01:19:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1700299151; x=1700903951; 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=rH3OESzwjQ69xioS7GrBiuwAFBXJAVIbXvkiJ7DPKqQ=; b=vRl8wpM6LNC39A1qJQg3z1JAOhuPJOhY//Qg8AVEow2QfrR0P640QUdwxHotLwb7H4 IaXHryrYid8fGZMFzw5iG4W2VhsdFcQgdTZA6uiqCmn3zMRBMkoUE9Z2U4zn+GjuprW4 YArWKgFtMhU1wdsiCtTLQz+LTEYfiIfPBujRo3MtmgQ+IEqWnm/6n8AtFLwtH0KanGxh 1ZmnMQ0115ROj43HgyWoFdbvG/Prhw2eLBsjR9jsChfKeVQDu2K+Wo6OUHT5zBwcBo9U XHLGirZvIOaXjV2mUn0axQzlWXCKG9yIqSZaMqCgDO83QKdOw7Z9Yk2vUJD/JSWIyT1Y FsmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700299151; x=1700903951; 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=rH3OESzwjQ69xioS7GrBiuwAFBXJAVIbXvkiJ7DPKqQ=; b=sBOTTirwWK2m62kDLCKLAbqRDF13gWomXy49IHZuSTx5FNu+a4ZZu6kj97zt10t+0Q 21ThDO951ahKacPeWpPRT9KKGkZh+ENEZyoReZZSyoVVnr2nJCgKBB/BSfXsfAhA1et6 AxL10/e3GxXmLDR+mLLVV5d3gF0Dqdvlo1uav572FviSyZXfq4/BTPUw+jHL9CKRyK55 ITQlgUP/r9Akn7fg7nKeDqpX6saAZaMfjNERUU4vuTEOutqihonnUMNN2dOMPaYpuFQU 3/48hStQ2mX8JMqYP9EdbAKkxtkJ8yIQcqdY5M6zNiYN+mgqzOdEQoYYc66Yq/fwGJVB E7ww== X-Gm-Message-State: AOJu0YyiqXznLIsrPrnbk1ZDiqc0xil7/jcmrLMCrvz93Doc2vFncWxd 8Nr3a8NMXeoibHapgO40X+PDLU/uelHIz7GZw5U= X-Google-Smtp-Source: AGHT+IE1Nl3zgmoCdvFSwQPu8llszF9ksnX/DqNnMSCi7jM2sog+VVWMY55Mh9Pd4+lcfGXsAwc+0A== X-Received: by 2002:a05:6a20:1584:b0:188:290f:3da6 with SMTP id h4-20020a056a20158400b00188290f3da6mr2082026pzj.41.1700299150987; Sat, 18 Nov 2023 01:19:10 -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 v7 03/19] net: Move virtio-net header length assertion Date: Sat, 18 Nov 2023 18:18:17 +0900 Message-ID: <20231118091837.5758-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231118091837.5758-1-akihiko.odaki@daynix.com> References: <20231118091837.5758-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::530; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x530.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: 1700299226269100007 Content-Type: text/plain; charset="utf-8" The virtio-net header length assertion should happen for any clients. Signed-off-by: Akihiko Odaki --- 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 f603030dd6..2e7c3fcc2a 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" =20 /* Net bridge is currently not supported for W32. */ #if !defined(_WIN32) @@ -545,6 +546,10 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len) return; } =20 + assert(len =3D=3D sizeof(struct virtio_net_hdr_mrg_rxbuf) || + len =3D=3D sizeof(struct virtio_net_hdr) || + len =3D=3D sizeof(struct virtio_net_hdr_v1_hash)); + nc->vnet_hdr_len =3D len; nc->info->set_vnet_hdr_len(nc, len); } diff --git a/net/tap.c b/net/tap.c index ea2dadc943..f2021b699c 100644 --- a/net/tap.c +++ b/net/tap.c @@ -267,9 +267,6 @@ static void tap_set_vnet_hdr_len(NetClientState *nc, in= t len) TAPState *s =3D DO_UPCAST(TAPState, nc, nc); =20 assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP); - assert(len =3D=3D sizeof(struct virtio_net_hdr_mrg_rxbuf) || - len =3D=3D sizeof(struct virtio_net_hdr) || - len =3D=3D sizeof(struct virtio_net_hdr_v1_hash)); =20 tap_fd_set_vnet_hdr_len(s->fd, len); s->host_vnet_hdr_len =3D len; --=20 2.42.1