From nobody Thu Nov 20 03:24:13 2025 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697941061; cv=none; d=zohomail.com; s=zohoarc; b=kFg6Uk6aTMx5b4C0HdQXnJIbkPn3nu7lVZDs/x9S3HFedbRjJsANbugBhW9jzmg/kRJGjc2dM/MR+Kja9LTWhlvRBX9mINA6HBor1WNtGXeHcztLYzVkgIv/d/tzOqCAjCgyjqANcm9sO4hnzVoGrhAsj3FjX1AkpeFGaHEY4KI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697941061; 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=lNMeJcS2Kg4+RYFG13jdQCpQGp48YyyVDQuK8zzi30o=; b=hF7+6TTuTM0xi3E6UzGmz4Kuh70agDj1+x2vRVuv8gIgd75GMRTxg6KJqxu3Gby4yTorqypIdeygvhvlEZI6tS8KJ+U0mSGjwl80nyRJVkHs7L7InOClIlFEh7ANrqJXxApGfJz6y3BG+jJynH+BJvREu/whkpYiOYxxMdy/OcQ= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697941061135262.3744724765196; Sat, 21 Oct 2023 19:17:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quO11-0005pt-Or; Sat, 21 Oct 2023 22:16:31 -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 1quO0z-0005pW-O4 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 22:16:29 -0400 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quO0y-0003LN-4A for qemu-devel@nongnu.org; Sat, 21 Oct 2023 22:16:29 -0400 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-5842c251d7cso953776eaf.1 for ; Sat, 21 Oct 2023 19:16:27 -0700 (PDT) Received: from localhost ([124.64.17.222]) by smtp.gmail.com with ESMTPSA id f23-20020aa79697000000b0068fb783d0c6sm3968457pfk.141.2023.10.21.19.16.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 19:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697940987; x=1698545787; 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=lNMeJcS2Kg4+RYFG13jdQCpQGp48YyyVDQuK8zzi30o=; b=i1LOWPEwnpruTW2G09sDMVf/3rmjZTyiiPvP6I/aRHovpW5t07OMKZzprzmZh39x3I 86b8C69FBXpQLTBSAJ6WNMQz+K5YNVnqM+OqYYUuq9fjQS/o+MuiZbcz4nDdsK2pt9bt V3/RIKZJbtpPD/bHykDwByTKKgJRMyLKLL7vez/oF5Lv7VUlNeYy2z0iVtYgj9h6+2Nh biC8kXSLzIvEy4FgzvapLf+71eYlO0HeXLenc/CawA0if5fVyZ1UHvuUAR2qvYv45gkS TGlkq+9gXRg5adLi2SO78ZHf6FrtlIoeBSkvCHEkJ4AqDYsz5otDarlPYlaJ+RPpN4Zb yV+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697940987; x=1698545787; 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=lNMeJcS2Kg4+RYFG13jdQCpQGp48YyyVDQuK8zzi30o=; b=EUbT51Wl0iTgE5Z4YOo5Gmk+waeOFtolkmySEEeu9e9Q15qazgNOahoa9ADbm1zn5v 0MXs8xGOaIL4NLfHbKUJeAg7D10dKqW1EHbKuxFTAA+c5cHl9Zoab27QVX3KQsM6O8uG fWmHmGMSBnDYy1MmhMid6yE8vUuTYwfw7pWZEFK+IDdgEzM0vz6vVGZqkQcrECI4fvur witClmofWbbM9yZtwLLENf+d/PWBmd7EfaIVyMijWn4wF7DNUF3ApdcS6NpzFFHOt1C0 eZZJWZSDSi0gHOGQSMe8CgTPsK+zcvtvieqZaWlUM4ao6oBff5/6NmYe+uOTlESnm7w2 nL4w== X-Gm-Message-State: AOJu0Yyv9IRS/1upZ2iqOm02RJkzIYrOycPeJZYk1VLZVLDAL9XGgIln OdZBq+/ysaMUYlF6WQO6KdA= X-Google-Smtp-Source: AGHT+IF8i1FaNMKZpijF5YwCZRLaBI6yCJfsNUL1e3KAmBM7Yv9H5cNvODw0QsLyRaCKidJLcCT1fA== X-Received: by 2002:a05:6358:9146:b0:140:f6ab:b11e with SMTP id r6-20020a056358914600b00140f6abb11emr6962920rwr.28.1697940986596; Sat, 21 Oct 2023 19:16:26 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH v4 1/3] vdpa: Add SetSteeringEBPF method for NetClientState Date: Sun, 22 Oct 2023 10:16:15 +0800 Message-Id: <1c6faf4c5c3304c0bf14929143ccedb2e90dbcb2.1697904740.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: pass client-ip=2607:f8b0:4864:20::c2d; envelope-from=yin31149@gmail.com; helo=mail-oo1-xc2d.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @gmail.com) X-ZM-MESSAGEID: 1697941063314100003 At present, to enable the VIRTIO_NET_F_RSS feature, eBPF must be loaded for the vhost backend. Given that vhost-vdpa is one of the vhost backend, we need to implement the SetSteeringEBPF method to support RSS for vhost-vdpa, even if vhost-vdpa calculates the rss hash in the hardware device instead of in the kernel by eBPF. Although this requires QEMU to be compiled with `--enable-bpf` configuration even if the vdpa device does not use eBPF to calculate the rss hash, this can avoid adding the specific conditional statements for vDPA case to enable the VIRTIO_NET_F_RSS feature, which reduces code maintainbility. Suggested-by: Eugenio P=C3=A9rez Signed-off-by: Hawkins Jiawei --- v4: no code changes v3: https://lore.kernel.org/all/30509e3c3b07bcadd95d5932aeb16820cb022902.16= 93299194.git.yin31149@gmail.com/ net/vhost-vdpa.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 4c65c53fd2..c4b89f5119 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -241,6 +241,12 @@ static void vhost_vdpa_cleanup(NetClientState *nc) } } =20 +/** Dummy SetSteeringEBPF to support RSS for vhost-vdpa backend */ +static bool vhost_vdpa_set_steering_ebpf(NetClientState *nc, int prog_fd) +{ + return true; +} + static bool vhost_vdpa_has_vnet_hdr(NetClientState *nc) { assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_VDPA); @@ -422,6 +428,7 @@ static NetClientInfo net_vhost_vdpa_info =3D { .has_vnet_hdr =3D vhost_vdpa_has_vnet_hdr, .has_ufo =3D vhost_vdpa_has_ufo, .check_peer_type =3D vhost_vdpa_check_peer_type, + .set_steering_ebpf =3D vhost_vdpa_set_steering_ebpf, }; =20 static int64_t vhost_vdpa_get_vring_group(int device_fd, unsigned vq_index, @@ -1255,6 +1262,7 @@ static NetClientInfo net_vhost_vdpa_cvq_info =3D { .has_vnet_hdr =3D vhost_vdpa_has_vnet_hdr, .has_ufo =3D vhost_vdpa_has_ufo, .check_peer_type =3D vhost_vdpa_check_peer_type, + .set_steering_ebpf =3D vhost_vdpa_set_steering_ebpf, }; =20 /* --=20 2.25.1 From nobody Thu Nov 20 03:24:13 2025 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697941054; cv=none; d=zohomail.com; s=zohoarc; b=JzSILLhgZbhmQUZ0k9yyyZ3pUuNgWps2io8vKJw7P8uTpeiqBPUR1bjpDtcu8p7FdJ5sOpjjrNPwX+eOj1YIwX2Lmo8t6YBHm+UfHwuECCmVcgkRXgaBq83OAhaBYU46VSOwRcdRUxE1cM3JQMX1xe3LfMX7s+Z3bkgZNXn70V0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697941054; 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:To:To:Message-Id:Reply-To; bh=GVTxssubxxqzAxFBncG+u/wKTx/KEO8I9Wt1E1WY2sk=; b=Jy7dl4rqVVWld0EfbWQOxrLtWWqX73gI4UlavRNfNf13sZzyPpxqITN9O76LTiqa2Elu5+qtY0OEha6IqVv0qHVjQ7dpi3We8G2HD8PpvyCs6TG1hF6ydIpYAVkO7i8irJPyCx9NXB1mioEvx4+7Q6F5wxQIZGK6knIbrNFwtsw= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697941054699129.13350645722028; Sat, 21 Oct 2023 19:17:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quO16-0005qH-FM; Sat, 21 Oct 2023 22:16:36 -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 1quO14-0005q2-E1 for qemu-devel@nongnu.org; Sat, 21 Oct 2023 22:16:34 -0400 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quO12-0003Le-JH for qemu-devel@nongnu.org; Sat, 21 Oct 2023 22:16:34 -0400 Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-7a683bd610dso78730539f.1 for ; Sat, 21 Oct 2023 19:16:32 -0700 (PDT) Received: from localhost ([124.64.17.222]) by smtp.gmail.com with ESMTPSA id y68-20020a636447000000b0058953648c27sm3694559pgb.88.2023.10.21.19.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 19:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697940991; x=1698545791; 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=GVTxssubxxqzAxFBncG+u/wKTx/KEO8I9Wt1E1WY2sk=; b=fiadiqwualyv2DbPjk78d/o0H6NDJG+D873QSdWKXxywNHP8mkjmds8TfPi0VL+HUS ZVW79Vm3H2czWw+WwU8HFX6BUC8LXvtsRXX2JV2Td8ijmdIoyDTWqBM2QD7lsuYmbRIW Cc2KrL8RfSqdD5Usd9azi134vbJkPthKc33bBvg3AWMHcSM/Af5ssgjJ36OsoaVvmEpT GyJJXCcerFzVqanS9Mnur7L3bEocbQYJtMtL6TvSmAFTg1JWEj9/mqWWNzklHe1d1U+z 4c/g+aCF4gUKTD16C2i+oaZQqiEvAszz40WYLA2nHSB7YkHdFcaOOSvE87U2Ad4HMUGu wPjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697940991; x=1698545791; 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=GVTxssubxxqzAxFBncG+u/wKTx/KEO8I9Wt1E1WY2sk=; b=gXngKZLgc+UQUOmybaFoz2dlLosXcMdaad7RSufmbhBj9/bEogD+UD47Cibrjobj5e WHma/IDuYmmEwdOA7pwIjs6FkbTtNlOWz939oX+4Kivj+T5Qu5z3VlWlgo0A44hwJmjn GD1VYXpl+sDRRlSI68vAhVu0+z4/WjIQrzwyGN9RPLdl6cLPFjEFC7RaknmY+fVXhU1e FnyMTTMhQG3LNcM9nfSCsxVF8TfWaxuHJKGb5BZaD4Slwd/ZLZstft5x2bLhcDatTcUi 91ugKZnRvfAQaCUJ1V5REBSIOstNu4qUxIQccAbr6ir2MYgy7PXEEYhuNUE74hB3OxGE PNlA== X-Gm-Message-State: AOJu0YwrTnftypKnsPn/K2kY9DA0eup1CYFjeWzBgIHncGq3tAANKvS6 ZkWHOr7tzXWPSpRzaFx3YL4= X-Google-Smtp-Source: AGHT+IFzjBc9eAA853Cet93vF30xwWKPnC1cQ0Jh+tfQq55Wn8KTwpKu2oLPIyAk2UeOd2F2oJPjzg== X-Received: by 2002:a05:6e02:1d96:b0:351:526a:4bc with SMTP id h22-20020a056e021d9600b00351526a04bcmr8576010ila.15.1697940990789; Sat, 21 Oct 2023 19:16:30 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH v4 2/3] vdpa: Restore receive-side scaling state Date: Sun, 22 Oct 2023 10:16:16 +0800 Message-Id: <79caf9bf05778ed5279e11bdd1f26b49baf373ce.1697904740.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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: pass client-ip=2607:f8b0:4864:20::d33; envelope-from=yin31149@gmail.com; helo=mail-io1-xd33.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @gmail.com) X-ZM-MESSAGEID: 1697941055339100003 Content-Type: text/plain; charset="utf-8" This patch reuses vhost_vdpa_net_load_rss() with some refactorings to restore the receive-side scaling state at device's startup. Signed-off-by: Hawkins Jiawei --- v4: - add do_rss argument and relative code in vhost_vdpa_net_load_rss() v3: https://lore.kernel.org/all/47b17e160ba4e55b24790b7d73b22d2b437ebe3c.16= 93299194.git.yin31149@gmail.com/ - resolve conflict with updated patch "Vhost-vdpa Shadow Virtqueue Hash calculation Support" RFC v2: https://lore.kernel.org/all/af33aa80bc4ef0b2cec6c21b9448866c517fde8= 0.1691926415.git.yin31149@gmail.com/ - Correct the feature usage to VIRTIO_NET_F_HASH_REPORT when loading the hash calculation state RFC v1: https://lore.kernel.org/all/93d5d82f0a5df71df326830033e50358c8b6be7= a.1691766252.git.yin31149@gmail.com/ net/vhost-vdpa.c | 63 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index c4b89f5119..5de01aa851 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -827,7 +827,7 @@ static int vhost_vdpa_net_load_mac(VhostVDPAState *s, c= onst VirtIONet *n, =20 static int vhost_vdpa_net_load_rss(VhostVDPAState *s, const VirtIONet *n, struct iovec *out_cursor, - struct iovec *in_cursor) + struct iovec *in_cursor, bool do_rss) { struct virtio_net_rss_config cfg; ssize_t r; @@ -853,19 +853,33 @@ static int vhost_vdpa_net_load_rss(VhostVDPAState *s,= const VirtIONet *n, sizeof(n->rss_data.indirections_table[0])); cfg.hash_types =3D cpu_to_le32(n->rss_data.hash_types); =20 - /* - * According to VirtIO standard, "Field reserved MUST contain zeroes. - * It is defined to make the structure to match the layout of - * virtio_net_rss_config structure, defined in 5.1.6.5.7.". - * - * Therefore, we need to zero the fields in struct virtio_net_rss_conf= ig, - * which corresponds the `reserved` field in - * struct virtio_net_hash_config. - */ - cfg.indirection_table_mask =3D 0; - cfg.unclassified_queue =3D 0; - table[0] =3D 0; /* the actual indirection table for cfg */ - cfg.max_tx_vq =3D 0; + if (do_rss) { + /* + * According to VirtIO standard, "Number of entries in indirection= _table + * is (indirection_table_mask + 1)". + */ + cfg.indirection_table_mask =3D cpu_to_le16(n->rss_data.indirection= s_len - + 1); + cfg.unclassified_queue =3D cpu_to_le16(n->rss_data.default_queue); + for (int i =3D 0; i < n->rss_data.indirections_len; ++i) { + table[i] =3D cpu_to_le16(n->rss_data.indirections_table[i]); + } + cfg.max_tx_vq =3D cpu_to_le16(n->curr_queue_pairs); + } else { + /* + * According to VirtIO standard, "Field reserved MUST contain zero= es. + * It is defined to make the structure to match the layout of + * virtio_net_rss_config structure, defined in 5.1.6.5.7.". + * + * Therefore, we need to zero the fields in + * struct virtio_net_rss_config, which corresponds the `reserved` = field + * in struct virtio_net_hash_config. + */ + cfg.indirection_table_mask =3D 0; + cfg.unclassified_queue =3D 0; + table[0] =3D 0; /* the actual indirection table for cfg */ + cfg.max_tx_vq =3D 0; + } =20 /* * Consider that virtio_net_handle_rss() currently does not restore the @@ -896,6 +910,7 @@ static int vhost_vdpa_net_load_rss(VhostVDPAState *s, c= onst VirtIONet *n, =20 r =3D vhost_vdpa_net_load_cmd(s, out_cursor, in_cursor, VIRTIO_NET_CTRL_MQ, + do_rss ? VIRTIO_NET_CTRL_MQ_RSS_CONFIG : VIRTIO_NET_CTRL_MQ_HASH_CONFIG, data, ARRAY_SIZE(data)); if (unlikely(r < 0)) { @@ -930,13 +945,19 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s, return r; } =20 - if (!virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_HASH_REPORT)= ) { - return 0; - } - - r =3D vhost_vdpa_net_load_rss(s, n, out_cursor, in_cursor); - if (unlikely(r < 0)) { - return r; + if (virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_RSS)) { + /* load the receive-side scaling state */ + r =3D vhost_vdpa_net_load_rss(s, n, out_cursor, in_cursor, true); + if (unlikely(r < 0)) { + return r; + } + } else if (virtio_vdev_has_feature(&n->parent_obj, + VIRTIO_NET_F_HASH_REPORT)) { + /* load the hash calculation state */ + r =3D vhost_vdpa_net_load_rss(s, n, out_cursor, in_cursor, false); + if (unlikely(r < 0)) { + return r; + } } =20 return 0; --=20 2.25.1 From nobody Thu Nov 20 03:24:13 2025 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1697941054; cv=none; d=zohomail.com; s=zohoarc; b=Ti6LJe3TI7VOH6cGianf1pk1ruykaP/9InfwES/K28cFekRvKkxuJZf7IWhhED7FFZNod2eyOpYtNIUcFTUGg0dpHnAN626xueHKCKmeMYfBL77E4IAJRN1Z0ELa/BtrPCKcrYB/l0wq2IfBaDKF35GKV2ne6QlgwZuBPJc18IM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697941054; 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:To:To:Message-Id:Reply-To; bh=UVUu4fV2FeT020iiPRfyLwwvjP1I3THSzWwFIxv3oK8=; b=GpS9xk/u6mVO0+VOq+WlhS1bePSRhWK9z5k98GKywFr2wj2KQWp2YLrYtIfRlNpHJku8MIH8GviElZGvl5fOScsBh2XK34Zwbyv0j774kU26XvDOBDPb94ESju16U7gsZw1vgaOIhvix6Zdx17F42+AEv7XGAESsAOtsJLw5p8E= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1697941054051991.8489250613986; Sat, 21 Oct 2023 19:17:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1quO19-0005qg-5l; Sat, 21 Oct 2023 22:16:39 -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 1quO17-0005qT-RJ for qemu-devel@nongnu.org; Sat, 21 Oct 2023 22:16:37 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1quO16-0003Lq-8d for qemu-devel@nongnu.org; Sat, 21 Oct 2023 22:16:37 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6bd73395bceso1571815b3a.0 for ; Sat, 21 Oct 2023 19:16:35 -0700 (PDT) Received: from localhost ([124.64.17.222]) by smtp.gmail.com with ESMTPSA id bs1-20020a632801000000b005b0b7ede830sm3672410pgb.50.2023.10.21.19.16.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 19:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697940995; x=1698545795; 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=UVUu4fV2FeT020iiPRfyLwwvjP1I3THSzWwFIxv3oK8=; b=epZf+ITiFShLY0lLcDfEVFRT+koquq3fELlxohqTDx99Mhm81NpKRr10b1pgkwHxjI hNDLhHsn/ufQvQxWotkNAO/Zf5St4T/1Yb0Ck1jA5egAN354OG8ikggI580fWcWT3ceK iq7i980EIR0jAYWOjNQkwqPF8o8pTRanpAZKyMsVeMXlmv1SAqELw9nd6DMLO+sNEJmQ mmueAKwzoXbgXDv6Dw1tjg/HukQ1mEDa++9oOsK007JnTv0KZ2EDTkoifWajFez+7bGz AhsX8ewHuxQd01yVZ4yTc8y4OcoveqcGYoeIgJ2/alquB1VXah6r+S1Tp49/HFKQFU3d +XyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697940995; x=1698545795; 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=UVUu4fV2FeT020iiPRfyLwwvjP1I3THSzWwFIxv3oK8=; b=sM7n37cM7C/KOZAW21HppOukwBZg2Nk1tUnGXejfXiptUtpjWzpTlxlUNFsxc6nME1 p+43eEJ3m3fqri49TIqfPQAoE1A+DYgimf1puJtGGdGePzahdu9BCXb54V2eM34Jd95Q p454RMQowpI6sbrwu2dWb2F9maOsv8+p085un03nnxzXbXGjX12Q7w1HvcAg3omnqQMd RNOQyqv5U88jEO9u9h9+sQMVmaE+aaDdzfpk6ArwIG2uE/rlDNFfLvmZ4kfGkxysb9SV 6PHMzFYRf5IfruZIl8+8I4R3BN80N99gBAiBYBCaZk4EHF1grISy3+rR7V5ipF72GxZl ipSA== X-Gm-Message-State: AOJu0Yws93r9ZcGGMpxVvEgun93bscu67J9uUggqWXVyMv9D/svOQJL+ ac/CH3+JfdbhSBl2xsL2tDI= X-Google-Smtp-Source: AGHT+IGlr1j1KZQvQrWDOSbJPPe5vneodmqun8AvBiVrYzigK0tpX9p1Wsi2Pqk7o1llMtAcB1a2Tg== X-Received: by 2002:aa7:900b:0:b0:692:6417:728a with SMTP id m11-20020aa7900b000000b006926417728amr11184198pfo.14.1697940994479; Sat, 21 Oct 2023 19:16:34 -0700 (PDT) From: Hawkins Jiawei To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com Cc: qemu-devel@nongnu.org, yin31149@gmail.com, 18801353760@163.com Subject: [PATCH v4 3/3] vdpa: Allow VIRTIO_NET_F_RSS in SVQ Date: Sun, 22 Oct 2023 10:16:17 +0800 Message-Id: <4ee7f3f339469f41626ca2c3ac7b1c574ebce901.1697904740.git.yin31149@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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: pass client-ip=2607:f8b0:4864:20::436; envelope-from=yin31149@gmail.com; helo=mail-pf1-x436.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 @gmail.com) X-ZM-MESSAGEID: 1697941055322100001 Content-Type: text/plain; charset="utf-8" Enable SVQ with VIRTIO_NET_F_RSS feature. Signed-off-by: Hawkins Jiawei --- v4: no code changes v3: https://lore.kernel.org/all/2d2a378291bfac4144a0c0c473cf80415bb580b3.16= 93299194.git.yin31149@gmail.com/ net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 5de01aa851..66133408d5 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -122,6 +122,7 @@ static const uint64_t vdpa_svq_device_features =3D /* VHOST_F_LOG_ALL is exposed by SVQ */ BIT_ULL(VHOST_F_LOG_ALL) | BIT_ULL(VIRTIO_NET_F_HASH_REPORT) | + BIT_ULL(VIRTIO_NET_F_RSS) | BIT_ULL(VIRTIO_NET_F_RSC_EXT) | BIT_ULL(VIRTIO_NET_F_STANDBY) | BIT_ULL(VIRTIO_NET_F_SPEED_DUPLEX); --=20 2.25.1