From nobody Sun Nov 24 06:31:15 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=1726362463; cv=none; d=zohomail.com; s=zohoarc; b=NOqFLUgDSo0DQ1ERKDiRnVMME3v6CVQhItLy0uUh1jBICP0RVASt//QdIkBx5nT7uaU831I2TezPqeOs0sjt2E2HOezaRjh1pT1INLWVUYwbQnWJ0J7GK5k5ojEjd/a9ATjGIzFNvNfoapHLSa76enQwQgFeJ5QLw5JiCqL0GXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726362463; h=Content-Type: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:To:To:Message-Id:Reply-To; bh=TJXuPeXYKPTzK6yFSg9nQc+Qxxmfh9dt2HenYTLinZ0=; b=UeWu38iRgIHNpii2vvAW8TGtWHu6eh0fgm6Y+LaRewFGSPwahxVCr0PZlKZixaF9uiZoI/4qt4je/ig9njA1ERjXolkpVFPKg8dSlYYummh0vC/np1yF/aBZL+IaDZOwbZrAG9/W8dsOry9KcvKZGVKFB+X+SzGXXlgJlN7dJjU= 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 172636246303443.58376224822371; Sat, 14 Sep 2024 18:07:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1spdjA-0001SZ-De; Sat, 14 Sep 2024 21:07:00 -0400 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 1spdj8-0001OF-O3 for qemu-devel@nongnu.org; Sat, 14 Sep 2024 21:06:58 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1spdj7-0004AY-6k for qemu-devel@nongnu.org; Sat, 14 Sep 2024 21:06:58 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2053616fa36so39680675ad.0 for ; Sat, 14 Sep 2024 18:06:56 -0700 (PDT) Received: from localhost ([210.160.217.68]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-207945da8d4sm14765615ad.59.2024.09.14.18.06.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 14 Sep 2024 18:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1726362415; x=1726967215; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TJXuPeXYKPTzK6yFSg9nQc+Qxxmfh9dt2HenYTLinZ0=; b=y7Z3cg/CIqa7R0/Mnd7YndKuES9zJUG7tWzsIEqdhG0I427G51olZd8VYQtjpY59tX sBOyN/nOrChbGn5Rx6KSR8FhWnGZyN3yGk4pSpVtOrOFPTeWDnEOeQO6cm1g5OcQMkrg tmIHU4iOS0IyRtYz/+YX4IK5IUG0ncpn1UNMREI16f+KatAPh+UcP5PqTNt9qS6PpCkE ah5+s4ZebJr78ItB9Xjuc6F4Ck8LUEvUZkxDA7HQHdunvd//eT0ChPaq8wNQYz4E7Tsn I+ETFgHjfF8hTxOsCuqvBmrMF/X+lud6LeYkC/CYFLx0Z48T+7/7z33JUC+Mq6ggVhhP BzJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726362415; x=1726967215; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TJXuPeXYKPTzK6yFSg9nQc+Qxxmfh9dt2HenYTLinZ0=; b=k7GAXjHPVETT2kfQd68/N2QhWBpKE/AGWGeNRldgtmOqwDITK2w6KOYTyr3XNgXBc5 io8YyDEVzAy2/vNms5SnPIZ9N9KgeNyzlzB84yH9NgZHjcTfuaNyuZTXSBFX5wdWGzJX WYc0JB0TpOUUvntfDoIyMPHHlgGXRjMFPNwFT2vQWipjh1k5tDJdEC3pcqOujetkDNFd BMLVR+xR2Q1eUTV/KJkgwD0UEEMSq3kOoBZY2jYjQDGA1pggMfX4PbtiwKXA/m/2zvXi ycVYZ9NrfNmo0gzm6TylzVO08hlExeGc8Tnp0yrjhsPPMxPZMnn2/GDPm6AJemGCFu2k OGVg== X-Gm-Message-State: AOJu0YwEmQbWjlG5KDMHHqJz7LA6C5usViilQyM6pk/Yaq9I0IkOBvQs X1pwlf/P9evATC6vk5r/WLMyQ7dfiIDNK+AXRht4aP/uoCGPp/rCfhZuz7aGSv0= X-Google-Smtp-Source: AGHT+IHDdM6RtsDG5q1aX0+PPggEv7aJ/0jn74p+B27R3RskGtns6eCBBZZYcR+W+yA+2Yj8ozu0LQ== X-Received: by 2002:a17:902:e5c3:b0:205:709e:1949 with SMTP id d9443c01a7336-2076e421fd0mr180808305ad.57.1726362415315; Sat, 14 Sep 2024 18:06:55 -0700 (PDT) From: Akihiko Odaki Date: Sun, 15 Sep 2024 10:06:41 +0900 Subject: [PATCH 3/7] virtio-net: Do not check for the queue before RSS MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240915-queue-v1-3-b49bd49b926d@daynix.com> References: <20240915-queue-v1-0-b49bd49b926d@daynix.com> In-Reply-To: <20240915-queue-v1-0-b49bd49b926d@daynix.com> To: Jason Wang , "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 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::62e; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62e.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 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: 1726362464497116600 virtio_net_can_receive() checks if the queue is ready, but RSS will change the queue to use so, strictly speaking, we may still be able to receive the packet even if the queue initially provided is not ready. Perform RSS before virtio_net_can_receive() to cover such a case. Fixes: 4474e37a5b3a ("virtio-net: implement RX RSS processing") Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 755530c035e4..3ee1ebd88daa 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1901,10 +1901,6 @@ static ssize_t virtio_net_receive_rcu(NetClientState= *nc, const uint8_t *buf, size_t offset, i, guest_offset, j; ssize_t err; =20 - if (!virtio_net_can_receive(nc)) { - return -1; - } - if (!no_rss && n->rss_data.enabled && n->rss_data.enabled_software_rss= ) { int index =3D virtio_net_process_rss(nc, buf, size, &extra_hdr); if (index >=3D 0) { @@ -1913,6 +1909,10 @@ static ssize_t virtio_net_receive_rcu(NetClientState= *nc, const uint8_t *buf, } } =20 + if (!virtio_net_can_receive(nc)) { + return -1; + } + /* hdr_len refers to the header we supply to the guest */ if (!virtio_net_has_buffers(q, size + n->guest_hdr_len - n->host_hdr_l= en)) { return 0; --=20 2.46.0