From nobody Wed May 15 06:05:28 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1698196144; cv=none; d=zohomail.com; s=zohoarc; b=hutsRopV1Xq/9XUP1gWVkZ6WLxwkwrqExoJaXxmBeGV0mpXwollfrNJkhTo2a9ymUIzI20mOyck0Pbxer5ZoxOdghbGKF+A0EKLVQu2dknQYzBeda9VsAIlctiv7pIN+NeUbEzgg2CH69s93O3xKivaZITjfsfdeWan+aGJmZU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698196144; 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=XjAWBBVREFLGQjbMzAVjjp6ReJtDF1V6LPBKien9+Ys=; b=Rzvxejb/aG8hgq/qmgX6vftVNNpEOn6M8SImFHFgi4W+lYGIV52nRcYdxrpkHaKcqONNSXHfXrytx7zAxz51ci8laZO35F+PRFO6NGT5ms4YTVkSvkelYHbC5+O4BCEErF9oSFQzsCNmvH+cNYTAyKDbKIVyOcl7YT9jlXSRcIc= 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 1698196144799703.1819360031817; Tue, 24 Oct 2023 18:09:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvSNl-0000Un-Vl; Tue, 24 Oct 2023 21:08:26 -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 1qvSNk-0000Uc-Ib for qemu-devel@nongnu.org; Tue, 24 Oct 2023 21:08:24 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvSNi-0008HE-Lj for qemu-devel@nongnu.org; Tue, 24 Oct 2023 21:08:24 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-27d45f5658fso4052462a91.3 for ; Tue, 24 Oct 2023 18:08:22 -0700 (PDT) Received: from localhost ([183.242.254.166]) by smtp.gmail.com with ESMTPSA id cx3-20020a17090afd8300b0027d1366d113sm9071899pjb.43.2023.10.24.18.08.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 18:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698196101; x=1698800901; 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=XjAWBBVREFLGQjbMzAVjjp6ReJtDF1V6LPBKien9+Ys=; b=JOw0qGxUqAbpm2Aank4omBB1rcUkgMnFtc1iqjjJEqr406d1+P0l4L8t+bNccVctof rPEEqt0pNI7LjDlMo5Vw3byuBqyNjZaaQyA2YlBrgzGpNTuzbYOZwxrdYm3UzAe2gxbd GalTQQ1LRmvMsN+A3CEqLgQy5/riYcv+QvTIqvqKEjdy/lkdQycgQkQI0k5AArnq/hA3 Rzkz/boFUIyNDGNElEYtozfo4Sygousml5mvt5STIFr34WJj9ZXNgTuHI5wqqmsxSxvC LaETvL2BkPqgkmv9B3GOM3BeWwiy1XARxs3X7OdsfZbiYDGJGz1sGEDw1sMoaynw5UR/ 2VWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698196101; x=1698800901; 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=XjAWBBVREFLGQjbMzAVjjp6ReJtDF1V6LPBKien9+Ys=; b=LPITvGIMoP0u6unxiySXFXh/3mlYIjh4hIz98kb0ZRLPYxHMpezLX5AOgKFFzC9Kql bwmFtzK7iC7TMn//dYE81B9tWsQ0hLQLouHMhYUrnNcFv1TEP3p3is3L8O5BibuIoMXn WM73NdTw7idYoQGNQkCt2u1Abor3SNDZckOIEc1qz//89mVAnmIzg2QZoKQKcs6tTsBR MM8U1CSJFqIOo4/aQQhBfjBVIvJz+BEXHjYPfoclIaJ1Qe0+pEZ+HoSdFjPn9B6nxcbw XT8KL3yDOhbR3rDiZEllgwn1WQUduKXdFb6lDWkIoOQfvzwPqXI8VuKcHEs4JWd9Ekdf Piyg== X-Gm-Message-State: AOJu0YxTMzTmUbUHH5Es1XhK0JE+N8t2xey9MEyUQIO+oVldon3PJaqw jHfL2YZOVnZuj7zytjTjn7M= X-Google-Smtp-Source: AGHT+IFykQg0tQjXj5dEnPo9bPZiA1Qyp7NbFQe4sbkEHYjjkdNbM1Q+i3WaBatvUWps1B6xNYN05w== X-Received: by 2002:a17:90a:c202:b0:27d:af3:f15d with SMTP id e2-20020a17090ac20200b0027d0af3f15dmr12926771pjt.4.1698196100908; Tue, 24 Oct 2023 18:08:20 -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 v5 1/3] vdpa: Add SetSteeringEBPF method for NetClientState Date: Wed, 25 Oct 2023 09:08:04 +0800 Message-Id: <280e20ddce55b6de60f1552ba0865bffffe909b2.1698195059.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::102b; envelope-from=yin31149@gmail.com; helo=mail-pj1-x102b.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: 1698196145289100001 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 --- v5: - no changes v4: https://lore.kernel.org/all/1c6faf4c5c3304c0bf14929143ccedb2e90dbcb2.16= 97904740.git.yin31149@gmail.com/ - 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 54f748d49d..3466936b87 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); @@ -423,6 +429,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, @@ -1258,6 +1265,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 Wed May 15 06:05:28 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1698196144; cv=none; d=zohomail.com; s=zohoarc; b=VPoGh0NhdExQ4Es8qQX9uiqSACFsP4JpVadSKgqXhsUm2l5X1i45gXz/ZSmAZshubgpBjPl3OopB65qbFPz6lY18Yyev4/Db27oiNnk1h4Xx7BzQO7lMbLfhL9klniDERzB4LKVg6oIYAyggOuGRcQWZHdcJm2joYOQZLhQdqt4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698196144; 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=iqTJYJbb9nM6t9/9E/6lz2EsNdBEGzHkSWKAMwQOUXo=; b=Dq0+c6SAtHqFuPjt5CRiviohynf2C8uDgAMzy/nXkZAGwArMUHUTaKB5b1xfFCnblv00vzbDj178TBk8PnAv+f12iXVqp2lboaqu6phWeGBks2fRHV+WAW1cUG0G5uVoe7vEa8inavZxstyRhnIfh3yPX2gSpVQ2sDPpCLEYlAU= 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 1698196144827479.41461001846835; Tue, 24 Oct 2023 18:09:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvSNv-0000VV-Jh; Tue, 24 Oct 2023 21:08:35 -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 1qvSNo-0000VC-SC for qemu-devel@nongnu.org; Tue, 24 Oct 2023 21:08:29 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvSNn-0008Hx-0p for qemu-devel@nongnu.org; Tue, 24 Oct 2023 21:08:28 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c0ecb9a075so35945535ad.2 for ; Tue, 24 Oct 2023 18:08:26 -0700 (PDT) Received: from localhost ([183.242.254.166]) by smtp.gmail.com with ESMTPSA id jk15-20020a170903330f00b001b9d7c8f44dsm8040830plb.182.2023.10.24.18.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 18:08:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698196105; x=1698800905; 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=iqTJYJbb9nM6t9/9E/6lz2EsNdBEGzHkSWKAMwQOUXo=; b=fiXHyVfxLcp5rl29bx+RDSjU6zNBJ+xTCO3Sll1rB93P32e9U/C6IV/yhocp3Q05zz NtzFFL8XRnFkrohFn6NgP3276FwX3slDcg9JVchATtVxF16wjhtDeI3d97sj8Fup5AL6 S2Ld62+KS1Iz+9jEC5Cg7kqDoqcTV6WQRK6U31jooe5OYeGV1PSRVPN/Uazi6YWCEsmc djWL6/IzIHCKa4n/QH7/bIuIBXuVgvvK5qFzikifAb6KL0haIUANRpud0uaq7C/gRjkL UPlb9CcQFGsPMokdkT2pvY0znZwokIIOF1rgPwiQCWfdK82152O9yvNTqEWuJ41zNbl9 pXwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698196105; x=1698800905; 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=iqTJYJbb9nM6t9/9E/6lz2EsNdBEGzHkSWKAMwQOUXo=; b=u0o1jcIbdjBV49ZiQ+2PxRGI2T/ptETvZYVjdct5kiJQmgIzpoudSRwhfOZVzjvJ0l YUkzEFt+qu1ku+GWKQ+QevF1nsNEIcG4oD5yT9BaO1qGiXZx+2eZX/1CazAUG5Y/zI6N WgtsNWAhcMmjEcmR75bI6DJp6Pn4nRiv0KQAlN5tY87IDwlYCLuXp5GhFBGgsAKIPXOu d2dEMkvlERnVQ6wfdrLgI4Gw859onKQo312uJ4WCzWfm9W8Clb02tfTfd6IGf7OiMFsk ug/cDPSNIiIJOYd7R2DNcVPNIXVSWKEVoHvZ98gC0eWDAL5q63G2+JpF0scuQQUZJPrH 5ibQ== X-Gm-Message-State: AOJu0YzBs909j63Cimm6bSvqgHF1N5TEzYm+TzX5GcdIBovGfUo08KHD PE7iGosrGLcMweCjWXktmPc= X-Google-Smtp-Source: AGHT+IF+P2p+t8Gxoc3erVof1lUkiVuW0sqTgn0t9KGJWHxDhPfqdJvz+fZZ+0OlSE1JFeA5ssnZcA== X-Received: by 2002:a17:902:f988:b0:1c3:2df4:8791 with SMTP id ky8-20020a170902f98800b001c32df48791mr10601471plb.27.1698196105266; Tue, 24 Oct 2023 18:08:25 -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 v5 2/3] vdpa: Restore receive-side scaling state Date: Wed, 25 Oct 2023 09:08:05 +0800 Message-Id: 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::632; envelope-from=yin31149@gmail.com; helo=mail-pl1-x632.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: 1698196145295100002 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 Acked-by: Eugenio P=C3=A9rez --- v5: - resolve conflict with the updated patch=20 "Vhost-vdpa Shadow Virtqueue Hash calculation Support" v4: https://lore.kernel.org/all/79caf9bf05778ed5279e11bdd1f26b49baf373ce.16= 97904740.git.yin31149@gmail.com/ - 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 | 67 +++++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3466936b87..a4cc1381fc 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -828,7 +828,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 =3D {}; ssize_t r; @@ -854,21 +854,35 @@ 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_config, which corresponds to the - * `reserved` field in struct virtio_net_hash_config. - * - * Note that all other fields are zeroed at their definitions, - * except for the `indirection_table` field, where the actual data - * is stored in the `table` variable to ensure compatibility - * with RSS case. Therefore, we need to zero the `table` variable here. - */ - table[0] =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 to the + * `reserved` field in struct virtio_net_hash_config. + * + * Note that all other fields are zeroed at their definitions, + * except for the `indirection_table` field, where the actual data + * is stored in the `table` variable to ensure compatibility + * with RSS case. Therefore, we need to zero the `table` variable = here. + */ + table[0] =3D 0; + } =20 /* * Considering that virtio_net_handle_rss() currently does not restore @@ -899,6 +913,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)) { @@ -933,13 +948,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 Wed May 15 06:05:28 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1698196162; cv=none; d=zohomail.com; s=zohoarc; b=luGfJlZvbqxnQTI2wep2ALncULsjcxsAWK3vcHnhgsZKtSMuIlQpDz7wtPnm9PPOFJirOtjwyn+f+MScnDC6xoVt+QOOO59+e2lBGDWtw0qBv9sYJoT20WJAaZATnKhzo9Qngoextnw87FSVEPiE6W5ishC2oTvyJY3RTbwcKdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698196162; 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=aBAfQJoNOLA2k1XG7ov4Fhdok3Ts6/T1ZYrkGPufFZc=; b=DaLepUx37F6njHSMUvzpFiYnDbZIcQHf+dnm0DoflfaVaIyvTuxPzm4URJelhcfPpCCyrRS+vZkEDTHJvvucxNsWVDHQZI3qHsIFcckyI69duqJXCNC8nw/z5xhHvCzh9o/IGoiorarQxrSmprjklrUoJgaAKA0Kfe3MaWEUF/o= 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 1698196162774457.8183621289071; Tue, 24 Oct 2023 18:09:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvSNz-0000WH-Gv; Tue, 24 Oct 2023 21:08:41 -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 1qvSNt-0000VR-Et for qemu-devel@nongnu.org; Tue, 24 Oct 2023 21:08:33 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvSNr-0008JM-Q3 for qemu-devel@nongnu.org; Tue, 24 Oct 2023 21:08:33 -0400 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-27d087c4276so3548420a91.0 for ; Tue, 24 Oct 2023 18:08:31 -0700 (PDT) Received: from localhost ([183.242.254.166]) by smtp.gmail.com with ESMTPSA id gj6-20020a17090b108600b0027ce34334f5sm7509481pjb.37.2023.10.24.18.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 18:08:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698196110; x=1698800910; 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=aBAfQJoNOLA2k1XG7ov4Fhdok3Ts6/T1ZYrkGPufFZc=; b=Geux26xtUMlTv0nIZIPWJrL9HEJIb14H8KI2Of5HKzXXverqSpdoeh0PmaEGYYDS+B uUiv56EBK0nADwuovCa13bBnj7yHsPSnsIpULwjtpdixua2kEsvU9kCK5XUnueHLX2p7 eFbQkIacXyYZhDKxK2AalyULaoX9sukvkNZuYA+mFL9i7uOTkvi7yYhUNMux/K36n8ZU EC0cnUzeDS01e86/OAJQcgV9gK3wfpQpt8OUOky3YLpWYayHIQpNB42M31lafrZg4LLL e7rCKPc9F9R0Ic+xnzM5y67vDK4wfx05Mk22j+H3+AjraYYs0qM+CQLOW45fRxh7XHoJ EMlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698196110; x=1698800910; 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=aBAfQJoNOLA2k1XG7ov4Fhdok3Ts6/T1ZYrkGPufFZc=; b=RBxDcZp81c9bfctckJISZXwyzQis5Pk98VxW0CCbf2jmywciD5kLZs1IOGCs22Q4jW vQfs5p02UGNKGdyCX4VPtV9OYXPXNS1UZGInPHiVh5GJM1ZDn1I3jyRm8pt9TEw0IRIX f/hJaBwQ7UvSPu7JryYdUJ2w2UqshDDAROeZcb3yJTDBMuhyjafyFaMRknqBgANxRK6s G1i1Kzsfphft+aGHqAPG04ryojVc+nTsQwvrPDdX9M6+LXXLPyP2vcmj7XDhRXR5GgWi pqtFSL4+hFO1QyeYktAUvaOz7vIQ1F883ebL6wvHCwd30ns+M/CKv4MTKPrnZ/MbCgR8 YS6g== X-Gm-Message-State: AOJu0YxGbdu60JP2pfETBPfI/maJ2NVXtv13bvPI2J6BZn91gMUPqq9J rPn/OO5OTudfYFvNSPfYcfw= X-Google-Smtp-Source: AGHT+IE6eFvdN4xBWhQIrqYUozO+T75UF6cJtg7IYXDUiQT9rrp2fz8kHF5idhwb3O5RN9Lkiq6XUw== X-Received: by 2002:a17:90b:2b46:b0:27d:882f:e6c5 with SMTP id rr6-20020a17090b2b4600b0027d882fe6c5mr11647889pjb.9.1698196110185; Tue, 24 Oct 2023 18:08: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 v5 3/3] vdpa: Allow VIRTIO_NET_F_RSS in SVQ Date: Wed, 25 Oct 2023 09:08:06 +0800 Message-Id: <626449eb303207de408126b3dc7c155cd72b028b.1698195059.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::102a; envelope-from=yin31149@gmail.com; helo=mail-pj1-x102a.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: 1698196163293100001 Content-Type: text/plain; charset="utf-8" Enable SVQ with VIRTIO_NET_F_RSS feature. Signed-off-by: Hawkins Jiawei Acked-by: Eugenio P=C3=A9rez --- v5: - no changes v4: https://lore.kernel.org/all/4ee7f3f339469f41626ca2c3ac7b1c574ebce901.16= 97904740.git.yin31149@gmail.com/ - 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 a4cc1381fc..d0614d7954 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