From nobody Sat Nov 23 17:57:06 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=1730290486; cv=none; d=zohomail.com; s=zohoarc; b=OQwlenqQOoNvgp/7Xzi58z2MNW44ILLZ075mX+tyj8b80u1b3J5fDp23IP0l8YUwO8YBfY1tOxatLVc/gua4vGYeSuAJu7TnLMZ7yC1v5GlK7ulehLyvh3GFAq/GCN2ej4KbLQAjbdTT+3UMXtAGd+xOIjQ8iaNyXlTtl6MrXBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730290486; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NEtNNRhk3oARf+NZZV/gSBCAAapOZPq/h8+CAdpnQDU=; b=ZZvNQI0TsZKAEcc3eaPycAtNAnvhIO1Xip50Cqlbbg89J+I8r3NzWJOCdH5pRGwPO1bhPdHsgs4zv3dbz8ff4cILdACkS7liDzzX0+a2BtgjJwcug1kdsB7JIpCnGyIpX5dysAyTcEJkgRsZGa6GF8Uvu72NlvCceuTUD/PG+70= 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 1730290486479922.9116675151297; Wed, 30 Oct 2024 05:14:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t67aI-0006FT-Uh; Wed, 30 Oct 2024 08:13:58 -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 1t67aH-0006Es-98 for qemu-devel@nongnu.org; Wed, 30 Oct 2024 08:13:57 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t67a6-0001yP-3p for qemu-devel@nongnu.org; Wed, 30 Oct 2024 08:13:49 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4315eac969aso5359385e9.1 for ; Wed, 30 Oct 2024 05:13:43 -0700 (PDT) Received: from rhel9.redhat.com ([2a06:c701:46c8:3f00:ea9a:3189:41ff:b349]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd8e8471sm20144845e9.4.2024.10.30.05.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 05:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1730290422; x=1730895222; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NEtNNRhk3oARf+NZZV/gSBCAAapOZPq/h8+CAdpnQDU=; b=zKTt1p7M1aZ4sjn5PMKS+4nBOoNMsMeVckzHRbR4fR7CxHfJIZnQgZEathJgIAAnCE 6Xdk0Rr/xE39t+aMFsGUIK1JaEujup8Kpn7E7C/vzOAOQkCjnAdZDBQ+bVulnwK/70Ol LR8JX3DsK5Z3niBDbtIYFO1QOO/cVDnDg8+HBqcBuwEO2KPrAlSYUWRCpYX0vu93zKWs g2a3p1OOGate0QMTMiYa/nQlctaNbXQbAC2l47oC2Hks10AU9cEqoIS3FCmIEL8g6/dF 4enESA2LRVc2H5eirJKB3Owxy+cubf8AA9ggwXCKSPMzcPyGmkc1k16Sa0yA0U78S4j3 4Q+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730290422; x=1730895222; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NEtNNRhk3oARf+NZZV/gSBCAAapOZPq/h8+CAdpnQDU=; b=PIQLo8YQSm4cgU1VIJh4e0S5+SB+QeLFKPfJziyMN1zFBKQ5VB2AeyX/X9G5nGEMSM rdmlsKMfdt3DcYzaQeqMogSPtS5xFjO40JDsGHWVQOAW54/JKGZOSHwnGL6ufPfzQhUw Tde1Wqy+gOyvAV8a/JIalB1NMRIJhG/kUM+jZ2K5DdrLjc3x9ObbmXo4Q+/QNjpb5L5V 4rG1OCrSEcB1yDl6M9D2w5whroIW3h0tPKJvGbbiLKlgAT+j/1loU9JWPuS71HosAnzh 3kDwxCu35Y1CleV99Wc6g+X6bN139E5B7C4NE2a+VcYrE3v+7y6LdJfQgynBOsjANMhM 1WhQ== X-Forwarded-Encrypted: i=1; AJvYcCXa/4AVzdGU69tCzrmdc7fzEdv2B9PTcrmT4M/iwr/vKmUL7+nP3FRsGHknwM14PgfK3RpqZwMt5XUV@nongnu.org X-Gm-Message-State: AOJu0YxyRwYn0mDyH2jNMjKbn+ll66E4MQbEin+wf17uq8GK3uEjUuKi 434sjv+0s3JRNIjcGkY59jW6kp1qTI7lrWu67eg/RE+dJv8/hOEd+UeCp7yuaRE= X-Google-Smtp-Source: AGHT+IEy8MNqgKoK4/7QbROaR5vuBLPIbPjbJxS6pIUDPd3HLEc4qj+7FHKFhx1yuN4q8BDbQc4wwQ== X-Received: by 2002:a05:600c:3110:b0:431:5475:3cd1 with SMTP id 5b1f17b1804b1-431b583b3e1mr44934315e9.17.1730290422090; Wed, 30 Oct 2024 05:13:42 -0700 (PDT) From: Yuri Benditovich To: "Michael S . Tsirkin" , Jason Wang , qemu-devel@nongnu.org, akihiko.odaki@daynix.com Cc: yan@daynix.com Subject: [PATCH] virtio-net: Fix missing hash type and hash value Date: Wed, 30 Oct 2024 14:13:34 +0200 Message-ID: <20241030121334.134794-1-yuri.benditovich@daynix.com> X-Mailer: git-send-email 2.43.5 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=2a00:1450:4864:20::333; envelope-from=yuri.benditovich@daynix.com; helo=mail-wm1-x333.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: 1730290487411116600 Content-Type: text/plain; charset="utf-8" virtio_net_receive_rcu does not populate hash value and hash type in case it needs to change queue number from the initially defined by tap/tun to one calculated according to the packet hash. Earlier commit a4c960e places the hash value/type into local extra_hdr structure but the extra_hdr is not filled in recursive call to virtio_net_receive_rcu. Current commit discards the recursive call and just continues execution with changed net client state and uses correct virtio-net queue for the packet. Fixes: a4c960e ("virtio-net: Do not write hashes to peer buffer") Jira link: https://issues.redhat.com/browse/RHEL-59572 Signed-off-by: Yuri Benditovich --- hw/net/virtio-net.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index f2104ed364..ed4e33b48c 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1898,7 +1898,7 @@ static ssize_t virtio_net_receive_rcu(NetClientState = *nc, const uint8_t *buf, size_t size, bool no_rss) { VirtIONet *n =3D qemu_get_nic_opaque(nc); - VirtIONetQueue *q =3D virtio_net_get_subqueue(nc); + VirtIONetQueue *q; VirtIODevice *vdev =3D VIRTIO_DEVICE(n); VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE]; size_t lens[VIRTQUEUE_MAX_SIZE]; @@ -1915,12 +1915,13 @@ static ssize_t virtio_net_receive_rcu(NetClientStat= e *nc, const uint8_t *buf, 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) { - NetClientState *nc2 =3D - qemu_get_subqueue(n->nic, index % n->curr_queue_pairs); - return virtio_net_receive_rcu(nc2, buf, size, true); + /* change nc to proper one */ + nc =3D qemu_get_subqueue(n->nic, index % n->curr_queue_pairs); } } =20 + q =3D virtio_net_get_subqueue(nc); + /* 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.43.0