From patchwork Mon Jun 17 15:07:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700926 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2045.outbound.protection.outlook.com [40.107.237.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00C7213BAC7; Mon, 17 Jun 2024 15:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636891; cv=fail; b=VwW5VLnwwncdJKArOXrymFPuoFW1NRQ0yKTeLYtR4cqfbKp5N78TN2ClIY++niYyya5slD7/yXw7ULxQQXZsdE0smZt8iKzElSzDe/BQ+j+QC72HjEOQFDwcWbiU5ifgb0r0Io66eO+76/SG12Ld/cpaNDeMSzJfZQerLJOTfoQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636891; c=relaxed/simple; bh=YWdhJgogBZI9hePemvn1Lv93bSWJFDFmtJy2ruKz+28=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=KaL39wbf8nEvGp22JVnjHY4zzjqbvlTRnM2dHST/nRmGWK0Q1ZDHs6/GxsSjiUnAI8YKlx0mgw0TRWh3/0C2ZVMcPR1V3EUA2F4xvkqQEy42ykoHaer2Zp1a1BHp8Yc2V9oers7byjMnttl6lif4jXzcmFKL2y+/+zgeguv6j8E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=DuXnVcKS; arc=fail smtp.client-ip=40.107.237.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="DuXnVcKS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ibhFDyjnqn7DdbdbyILsc7MlD4zxD6tsQRdZGBV+ZAhl2mYa/xWGFzdXLxwQOQANdCAEaHhezDzi1Yhu0EMPzgJ2sw2Hv+U+F2bgbG2Kv0hGUr/hhvEwVwa8SIOms9ZvWCZp/y9A7o5NdhazNr1g6wk5cj92kc/LGT+qKqF+SMMFGIy4STXeS11ofgQSdxUopneETkKBH6R8J0kLVz64ZxwvQuNCAxN8IqORvMgigwOQhnD8kbLmTUM1QnyTfpFyNClaS4z6qG0PglKG8B9SK2DogUCJSeXAQykwOb1R+rqhbQ0QYsQZ0hEIXNmSmGsfMdmkz7zvM1F0RnBAF7bUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AW/zOzgsWivt9tbXI0sBGufp4GGJC4bV3kHqhuwyAY0=; b=HIefbuEvC53AnRPh57TXltE3mJbjVAqRem8egGarUvSvJsxbFrF0up2zg2XzN2JumQXe24KbriitPYPPxF1XJ3fZd0SsCzjG0po8e8q2bEDSdJWG3M9TMUbqKS8HCXxIVBq1ZdGGQ+qsRDKYIRcb+gH+ow9ocEVGE+CtpyFOLMLjUy9U/5bHwy1oabS78Ad1XavsrzHa/m3tBD9fZT74kI7saJLbS9stXmN2GSoKO0XKJzS2kur82KuDN6UrGREHKmPgM0Cr4Fsnyw7lH5qlAbxgJksE+Q2c3dtV5n3izX3LXRRBHmPtyh3RQJhBdh7qegslBBbHujdD0qi4Ar56OQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AW/zOzgsWivt9tbXI0sBGufp4GGJC4bV3kHqhuwyAY0=; b=DuXnVcKSITHKXYnPRhjuwpfg8Ech61VxaXPxV48PptJySN+2KkdWvasH3o/bvtLfG8Rw3rnNV9fl5YUIZG2ut8FHsCf/IJNDOWulmLdK/ckS9fIMP0PDb6hXczJtBKPeVkMEu+n+nWS4/xo9SnWQc7/fBfxAypf6uar1yG+WPiHHA9TTq8q+HPrczXjSHurAwfuz8c3Me6WLUSRpyUmsd88OVzCvMsUfAMKBK9gS4pH0uDLGqyP9pUVbn0hRN1aPrxSflDlEBZUp9KkXwtUGF562efUBhsbDXEEOJssz5lNrg3sQ9LX7ldpetI+Mpo/CpW4Z7rJJitNHeVm8jCEhkQ== Received: from SA9PR13CA0144.namprd13.prod.outlook.com (2603:10b6:806:27::29) by SA1PR12MB6893.namprd12.prod.outlook.com (2603:10b6:806:24c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.29; Mon, 17 Jun 2024 15:08:04 +0000 Received: from SA2PEPF00003AE6.namprd02.prod.outlook.com (2603:10b6:806:27:cafe::ba) by SA9PR13CA0144.outlook.office365.com (2603:10b6:806:27::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:08:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AE6.mail.protection.outlook.com (10.167.248.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:04 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:07:52 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:07:52 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:07:48 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:35 +0300 Subject: [PATCH vhost 01/23] vdpa/mlx5: Clarify meaning thorough function rename Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-1-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE6:EE_|SA1PR12MB6893:EE_ X-MS-Office365-Filtering-Correlation-Id: ce7de5ca-bbb6-4364-f778-08dc8edf499d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|7416011|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?PDi+bGOavbNrSwKbYP6BL/L0i88WcUS?= =?utf-8?q?OY3u6FJHJA7EkDLC/+Z03wChGsOmQVKF9EL0Rk4hWTGZQRCoNHudAl1BlTKQJ/yZU?= =?utf-8?q?vCHe4qtZdot01LhaF12Pz64yNWQjkU4e0bZupSIeNvqm/cgYPYzKp0DQOgADOCBRA?= =?utf-8?q?kPyPCx09YU9Rlr8d2LCH3xtfUqvuzZxrlUMXllBZemoCjdHRHJvUNUszIUDVXYo0Q?= =?utf-8?q?3+BjKQ4juQO5amhsWM1HyFKi4hMDPxEua1MN6aJ3yHgrwcRvvmeIdxUYglscm2LFv?= =?utf-8?q?+1r5Zr5DMeQaIiVYjACstjTgmL7IirdUL4Ond+rdqSlFLQb2vc1T3Ii73P34bjBuT?= =?utf-8?q?vKLRsAnYiRd+JDH5aGclYzrNzHeZN377SSNhrigG5H9zP5sNAo4U+pPHadezkWTY/?= =?utf-8?q?862DCCusvPKTfy9WUHkK3xfZ06tFIdGIt2AuCuc6O/XKiZ8lmLbuf0iPYWIPek9LR?= =?utf-8?q?OnqyItrYCfbLLhtXxSDrJJprYUJejkDA9fjNzCkKXgYT5qrHXs2YEvX04FODYA/5r?= =?utf-8?q?JX9W9wchd87B4c7XhW/UwoT26fbH+HX5ZIPiRvds4YuDDbdLJqEiFdvjRrodSH4e2?= =?utf-8?q?wFFbppQNyLWhc5fpKdk30SE5U5IUuIIPM3aRh6Pie9mckFzp4+y9TuyYSgs+4foNv?= =?utf-8?q?MGXCbSnpE+o6SNUZa1wDCp4wJaY840cBWW5X281A63LK5HMO9+5G1jx9H49HKfcyV?= =?utf-8?q?v+/39ZRmL02QfAFmcBp9qi2E5yYrLEvKYAJBdbaDTYPIROuW0KV2xwxon7HIoCh/E?= =?utf-8?q?PlcNOCw7iy0046XI1daPw+Psz2I7+MhJxhTnQmWmkkpBtgM+hYoFS/8e0ok3UKIAM?= =?utf-8?q?DrG98XjaJjeMVpq+YyIBHLXZfDQGOt25Pkk31c/Aszq4tVQCyMaOjswe8uEluK64a?= =?utf-8?q?PiCXaDc+G+9xxE4GGGBREUzykSv6glXee3eeVY2zFpH/4/GhXV1cGVrbEtBsexC9T?= =?utf-8?q?tF+jLC768qQ72JUNntv2Epxcy4/0ME1BfPF2L6lB4zZRAIL1Z3tu4aX2kk+hQccyo?= =?utf-8?q?koOChhMeQnYoPZr64+aCUbym6H9xmEY0Sshv7DgfujuD7d2RHiB9v3iulKJz1TCky?= =?utf-8?q?jXH6DCqWKF6AIiXRDqg5LlyAzT0mfnzLhE43ojG+0tRcgqCkg2B134jrFtSb5WyEU?= =?utf-8?q?qtya/hfHmsrAL+7rK6IfL1r67J3PsrguKDtds6hZOrqcaFfTSSHAMkzvA0pv1Aa1u?= =?utf-8?q?CkoTKiD2ClpuxzMa8jOqNzTrQxOZqeWBGQWCPnewkejWUZOLvb2s7Eo9AUYZT6ZXH?= =?utf-8?q?c9fVy5azLjLWyZeAhZjGAIAiusN8cQfXbI2L5dHQg+r2HWb04pqQ1BqaA2dujzlHB?= =?utf-8?q?8pKJ+zr44/RjdSOlmksnpNqTu/a9RThUJw=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(7416011)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:04.2302 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce7de5ca-bbb6-4364-f778-08dc8edf499d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6893 setup_driver()/teardown_driver() are a bit vague. These functions are used for virtqueue resources. Same for alloc_resources()/teardown_resources(): they represent fixed resources that are meant to exist during the device lifetime. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index ecfc16151d61..3422da0e344b 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -144,10 +144,10 @@ static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx) return idx <= mvdev->max_idx; } -static void free_resources(struct mlx5_vdpa_net *ndev); +static void free_fixed_resources(struct mlx5_vdpa_net *ndev); static void init_mvqs(struct mlx5_vdpa_net *ndev); -static int setup_driver(struct mlx5_vdpa_dev *mvdev); -static void teardown_driver(struct mlx5_vdpa_net *ndev); +static int setup_vq_resources(struct mlx5_vdpa_dev *mvdev); +static void teardown_vq_resources(struct mlx5_vdpa_net *ndev); static bool mlx5_vdpa_debug; @@ -2848,7 +2848,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, if (err) return err; - teardown_driver(ndev); + teardown_vq_resources(ndev); } mlx5_vdpa_update_mr(mvdev, new_mr, asid); @@ -2862,7 +2862,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, if (teardown) { restore_channels_info(ndev); - err = setup_driver(mvdev); + err = setup_vq_resources(mvdev); if (err) return err; } @@ -2873,7 +2873,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, } /* reslock must be held for this function */ -static int setup_driver(struct mlx5_vdpa_dev *mvdev) +static int setup_vq_resources(struct mlx5_vdpa_dev *mvdev) { struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); int err; @@ -2931,7 +2931,7 @@ static int setup_driver(struct mlx5_vdpa_dev *mvdev) } /* reslock must be held for this function */ -static void teardown_driver(struct mlx5_vdpa_net *ndev) +static void teardown_vq_resources(struct mlx5_vdpa_net *ndev) { WARN_ON(!rwsem_is_locked(&ndev->reslock)); @@ -2997,7 +2997,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); - err = setup_driver(mvdev); + err = setup_vq_resources(mvdev); if (err) { mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); goto err_driver; @@ -3040,7 +3040,7 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) down_write(&ndev->reslock); unregister_link_notifier(ndev); - teardown_driver(ndev); + teardown_vq_resources(ndev); clear_vqs_ready(ndev); if (flags & VDPA_RESET_F_CLEAN_MAP) mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); @@ -3197,7 +3197,7 @@ static void mlx5_vdpa_free(struct vdpa_device *vdev) ndev = to_mlx5_vdpa_ndev(mvdev); - free_resources(ndev); + free_fixed_resources(ndev); mlx5_vdpa_destroy_mr_resources(mvdev); if (!is_zero_ether_addr(ndev->config.mac)) { pfmdev = pci_get_drvdata(pci_physfn(mvdev->mdev->pdev)); @@ -3467,7 +3467,7 @@ static int query_mtu(struct mlx5_core_dev *mdev, u16 *mtu) return 0; } -static int alloc_resources(struct mlx5_vdpa_net *ndev) +static int alloc_fixed_resources(struct mlx5_vdpa_net *ndev) { struct mlx5_vdpa_net_resources *res = &ndev->res; int err; @@ -3494,7 +3494,7 @@ static int alloc_resources(struct mlx5_vdpa_net *ndev) return err; } -static void free_resources(struct mlx5_vdpa_net *ndev) +static void free_fixed_resources(struct mlx5_vdpa_net *ndev) { struct mlx5_vdpa_net_resources *res = &ndev->res; @@ -3735,7 +3735,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, goto err_res; } - err = alloc_resources(ndev); + err = alloc_fixed_resources(ndev); if (err) goto err_mr; @@ -3758,7 +3758,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, err_reg: destroy_workqueue(mvdev->wq); err_res2: - free_resources(ndev); + free_fixed_resources(ndev); err_mr: mlx5_vdpa_destroy_mr_resources(mvdev); err_res: From patchwork Mon Jun 17 15:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700927 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2055.outbound.protection.outlook.com [40.107.102.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBDA013C835; Mon, 17 Jun 2024 15:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636897; cv=fail; b=F1z3PG9v9Bar/6CYFf7OdSKE+JjhKexVlSeYZ3Y9pi2I55ZD7DmxecWKHbnXQxjbQSdGCGexa5S2/GkAxWdTARW8Sgeu7gjzFGXhjeLuzjCvI+PvCCZc6gxiUDP2Bljufa254sMnU0d2zIREKVDnfYRB9WBzvwwQoA++kp/ErdA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636897; c=relaxed/simple; bh=fXevU3hdj0JvO+58iWTjO4mWUEeF/0S08VrGg74MY1g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=H/8iPQpILikxfsGr9dZ/3NEn11khk1hzcQZ2N3jr0b2ehCTKXOLKBG/ZkJhcgAAyujmNz1F7P0JsQ/itsEhGK7t+xYfC8TLGT6XexyNnJSCRE6wYicsixJU3NKe83lLpN6kO+0hhdaqMVosK3AoTppGPYr+JTSNhs1M9zVTrGmg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Q1DqKb2w; arc=fail smtp.client-ip=40.107.102.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Q1DqKb2w" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MgMbU8Qm3E0WrBEXmk/1UBhg+y3flMMlbsW4Uurs4bDwkGGdJfWYUJiaI776dX2iat80JfCxTjA/MInkVOsP47U0r8oZ4Lt1QMsoY3lZohZ5262CY8/FkId2gCfq5tpI8uOo1pJUZ0fwYR5gyx/0bngzY5uatEBqkBhs/5Z84eaSjiD6MSOSwlJ3yU3SLLZexBG2TSMPqVMfI/qII7/+gIxVlL8Xi1wYIjpDSJypiecmpUa7FxzalnREg9PCST3JhkLVTb7w7ihY93ShWlYb/RpnwS5hQqyQzjXunsHPeVNJhrVXk9bA5YOpz4AkZLiY4aYj185f4pMlaUyBKi8hhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P1GgYmuetoGlnCnxjBm2rDm9Az0PPDqZMoSL4OCPk2Y=; b=WVW96CrriNpdEWvBdfv57YprsynlNGWrKOXUoK4AHfHfDdNYwrBggPM75WawhWjg5b/iUKkDvN7vJs5248UKeitfo0DsGacQHvUQKIDCUuKXFlSoXt4+IXIXPnJCsNGOKIeRDwS5v39y+954Qy7rooSXXHEY6L8IMPh8c+7vhN5KAf53nC2DT7pxMHk9Z5G/c35mCto03aZu3OIaulrf4zcMk4X82+dlzDj429ar2zNNY6XGCKt00HOBB+degjgntRNQeOhZBZcAcuiDHsvyYG5SMRzM9d3snD9EjtdggTlmdOoAoURcww6fKq0xpmfp1M5ElU2vK2I8YzyYOF0peg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P1GgYmuetoGlnCnxjBm2rDm9Az0PPDqZMoSL4OCPk2Y=; b=Q1DqKb2wDbu15JVFMeT+xzaVI+s0g7dRn5yBYN5y07zTihoFiOG7tlI+Vm7A4oGyHu+4LWlH4dqy0/KUy+WmwxBrtjO/yLQQg7oIL3LXRhhWNXb/Zi9vk7QSJFdQ/FM/mH+QIAhNbn0CR3viVTEw2RF2h1OP1pK+p+tYneNtBRNCHzKfZtdYpK7dAVLPt50mVpRxZ1fIQwi2qhsnu7J26yBBib3OtC+K8xbLDdG2nEkJmMYMb0VToKTq0L3iAlLv6cyNeuUkVN1mz+lG29GDLPVr6njXWCmhPVQ89hwmRLaZM6SjwndKXqVo8Dw+sfNsLlxWArChSZq1u482F2DdGg== Received: from SN7PR04CA0081.namprd04.prod.outlook.com (2603:10b6:806:121::26) by MW6PR12MB8833.namprd12.prod.outlook.com (2603:10b6:303:23f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:08:07 +0000 Received: from SA2PEPF00003AE9.namprd02.prod.outlook.com (2603:10b6:806:121:cafe::b4) by SN7PR04CA0081.outlook.office365.com (2603:10b6:806:121::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:08:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AE9.mail.protection.outlook.com (10.167.248.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:07 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:07:56 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:07:55 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:07:52 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:36 +0300 Subject: [PATCH vhost 02/23] vdpa/mlx5: Make setup/teardown_vq_resources() symmetrical Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-2-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE9:EE_|MW6PR12MB8833:EE_ X-MS-Office365-Filtering-Correlation-Id: f376fee9-d15c-4477-8cac-08dc8edf4b58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|7416011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: =?utf-8?q?tdrFd2ImaKJjjygCy4PGAQzXoAPdICg?= =?utf-8?q?CeE5tiOzLHeagPg6JHaxRr/UKqpZmiqbkpgG2WNJgDVAfX9QDSU/mfdfMuycmoFxp?= =?utf-8?q?rxgFFuMHsPMOLJtafR3idC0Ci+O0KncbAPuo46/g+evyaEDZe1Czm/EYaJzgDcMLi?= =?utf-8?q?PWZeuRUva1AD2ii6QI9Zb5VvMp74WBJWtMk3TN5M4268ZyXW3BZ0OsdG2SArsuUIi?= =?utf-8?q?3sxedb6O7I5ZP7MoqiUDBcATibnT+tk1CuAsPkviNgTHya2V5y9CWAoVlQmh2e/DM?= =?utf-8?q?FUDE5rSyOduwo+YfJ18Dtqt2KDidt9P0mR//8ANsbEb9qHtQtmh7BtgiRDyHBmb9u?= =?utf-8?q?3ISf3UY+IU+dzdzU4or738WRzzU0MXexvRDW+F7VVZoWpjTMkl/ue6ZLpC1w+2CH8?= =?utf-8?q?PShe6YbRN/krRTlx8XtIRRmncI2aaYeCLoyLnb7okrO69qRstXWjgAGsfKtYoZIbT?= =?utf-8?q?UWLT2bQvcXiratABPQgqLBb7Kxx7lr7wouNnR7gzoBnC6mUjL6mgtm2xYpUTOLKUG?= =?utf-8?q?/pDKynuY4LzfVPuixyW5g21Z0CNf+Rt525p7PP6Uhq7khiVJ3rDD0ZLHYQ4Exo9OQ?= =?utf-8?q?IL93oBVqsD6sbZciKtiNZnr2/3i1N/HmkTr51QlOVaT6OLzBdsreHLxaiE+XIdGZI?= =?utf-8?q?pE1jCbX1AyYB11M64BLFAOS9Z+bL1CP6Icd57X/ZSsLiXTjzSlDKz5cGP041mpkJ5?= =?utf-8?q?xoogHEsyQ2lgFia1HQg0DEmida+S4u2iV+O/b1pc9tESsMlPnQIKFxxHffDmmuK24?= =?utf-8?q?1JBKFHOWjRxn5stVh5ByBlSydMkcLaS30fkixhK1nSp4vVpOFIU3Dkwr7UDykmAgY?= =?utf-8?q?0f3CT3HEpCAAkBU1XzJRmMRa4ZmbvHxPjuFcRuEKQJYuB4WbUlqVD/xBAzqzJTR9/?= =?utf-8?q?iy0cVvX8ZXXyyy5NO+wmO2pIA+teC5SmAX8svqJeBT1UMm+IpMT81+Gr0puafiZc9?= =?utf-8?q?Iz61DEFGGZpbb/MueSHjfACKKR9LvIMv5eXFZDHZ1UQA/Hux8WGa62OvIfRJaA5ww?= =?utf-8?q?Nq6tAqcxFEAom3dpDqvEUxMLcWoJ+AceLP7UJnMOhxhUysVZMDDbLFZwoGgFLC4dJ?= =?utf-8?q?Cwv0v9ktf8dw0XvVsZ3eaTTlCXDNuelyiFpmyNvvH9KWMGlz9TCyAdgorspzR1+vB?= =?utf-8?q?Ysl/e7Pp/zYyemCFr2/ZE26yRA6jy0qcZWjv1WBGYVvTCt4+alzQToTVxgPc0fo4F?= =?utf-8?q?oJzJ60zM81AgzdQiefL70wNSoILz2/Lj2vy/Ut9SQshr0GY8B81WMKmWMuoyed3l4?= =?utf-8?q?uujohfh0B0SYDROi+tOu27VAKG2+adKgdOMrrc2jemR3JQP5DIS14ChexISQ71tyc?= =?utf-8?q?ylqMW2KbGoVIZPDzyJ6mOemY2qIw7tgIXg=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(376011)(7416011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:07.1307 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f376fee9-d15c-4477-8cac-08dc8edf4b58 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8833 ... by changing the setup_vq_resources() parameter. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 3422da0e344b..1ad281cbc541 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -146,7 +146,7 @@ static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx) static void free_fixed_resources(struct mlx5_vdpa_net *ndev); static void init_mvqs(struct mlx5_vdpa_net *ndev); -static int setup_vq_resources(struct mlx5_vdpa_dev *mvdev); +static int setup_vq_resources(struct mlx5_vdpa_net *ndev); static void teardown_vq_resources(struct mlx5_vdpa_net *ndev); static bool mlx5_vdpa_debug; @@ -2862,7 +2862,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, if (teardown) { restore_channels_info(ndev); - err = setup_vq_resources(mvdev); + err = setup_vq_resources(ndev); if (err) return err; } @@ -2873,9 +2873,9 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, } /* reslock must be held for this function */ -static int setup_vq_resources(struct mlx5_vdpa_dev *mvdev) +static int setup_vq_resources(struct mlx5_vdpa_net *ndev) { - struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + struct mlx5_vdpa_dev *mvdev = &ndev->mvdev; int err; WARN_ON(!rwsem_is_locked(&ndev->reslock)); @@ -2997,7 +2997,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); - err = setup_vq_resources(mvdev); + err = setup_vq_resources(ndev); if (err) { mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); goto err_driver; From patchwork Mon Jun 17 15:07:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700928 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2046.outbound.protection.outlook.com [40.107.96.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 539C813D255; Mon, 17 Jun 2024 15:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636902; cv=fail; b=bF9WaGGHX0/MA2AdimTU5cW2aBueZTT2d8t3OphFdQMm071qVXw3RecWeppTJUPy+1g3b6mjsYmIwETAqz3FjZ4oT/E8phCor7Xx2wHgJGmIYKqyx9sohzE1UgI7zda892jFvFNHIwiivm0sQyYkaq6W1Pwy4dqcgjA7GldSfAg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636902; c=relaxed/simple; bh=31tu6QW/csWgaBPf3pU+rLm4fxqdQnI6YJHErqHH2GU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=VO3pfNYZeFy87LF2r4kqlslvEVYli0l8xl55Q2vOODEfS7cIR1tXSaHGRfZJSO/xwhctlM5a5cRItnBOiGZmP9A7CW5bspzRd8mg0GRVHvlcIbFC5YX2cRqd+O6v4Xa3jCRdCgk9RoafMIOsnMD+GFgpsikVbaXNzb8Z5fD0ZIg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=UFMO3TjQ; arc=fail smtp.client-ip=40.107.96.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="UFMO3TjQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E92RI0X37FXBhoqB+taQFztbFa6tQe9zeJd1mci+Oy8lb9fHgge7LSKzvMRIRQ846N0EfnLe4VPbp6T5gt8HKvTzrYT1etaQhelHyizFO/ConqTFuNaFJCPQGgeYW+LfH0Kbdt33D28rGh1vIdJcqECh8b2jVQKEwtZM/2OAcUWKM/SB/2mamGH/CpPDLhxi74QXRX236xjh1p+1XcC+0WFExh/MxOj++Rw3iTJg+rTmC3JuyCIGMLHhjRby7eAiKDZP/153eKzhUggeNZ3sN6GCUjmvhDJGqB+wP6rxb/ydK5gvRlOubCLIk+TNOiA7BNLWuicUuv9Ow3OcigWpVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n2Cyrp7dTR1fq08H8JWrGW2H3ySaVka4YieTkKJ9mgA=; b=mBkrxjwdbXyyHg5M1XrSlQlQlg3jXFaUqPUj+5gyaV2RP2USnLFUW6/xZPka+b9u1zGbdpGabuvGQ/syMMUYBdcWmFZ35TG8aOF1r4LFeuuR/qfT+GLik3zNgLBMMgar5wf/XBqg0xNN/Hm4ji2hUZUKZIR9bDwW+mRPY5XN0MPy3neqn9Q449rdcvOepgzeLZS+/67tOe2FcWIn2mTEi3IMMmdmD7VE2MwMnulAsqJud2D8ilbpfoDTy5G799ADowrm+f1LiJYLy0lboxN1hupmBxzab8EyrS7YjRYfXWH71kOdGCc3MXwY/pliKwgAGhEV3rMLgchBKzj8WycBaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n2Cyrp7dTR1fq08H8JWrGW2H3ySaVka4YieTkKJ9mgA=; b=UFMO3TjQV8/tS5n7cyvQ3S54yapNn7NjGNQknaXy6ZX8dhlrkmwTJitFUgF8kgAOQQElMEufpVan18cpl0vQhS6U3XfHVW9nGBhdT8AT2aj4PIRKZ5P4Cd0f4RcsFdFOQrJgeXn+5jj5kQfDqYiAiQ2zM2GYQvnuyN/tx51QJ6dt6vBTOlB3Xrtbpt8Qg2JtftnWTWvI+p+5Cc7wX9ksvvALKyn/9dXaDgWYLvrKsIRI0PyQmWN27wKYHcQNwcS7VPLZ08Mp1YXjeN/xTATWeWQsOT+KQCY826LwIkIIVgS8BVEtEhmKRJIdnuFMgkwgsvinFWavLfc5RceJrqts8A== Received: from SN7PR04CA0075.namprd04.prod.outlook.com (2603:10b6:806:121::20) by SN7PR12MB7788.namprd12.prod.outlook.com (2603:10b6:806:345::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:08:15 +0000 Received: from SA2PEPF00003AE9.namprd02.prod.outlook.com (2603:10b6:806:121:cafe::db) by SN7PR04CA0075.outlook.office365.com (2603:10b6:806:121::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:08:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AE9.mail.protection.outlook.com (10.167.248.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:12 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:00 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:07:59 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:07:56 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:37 +0300 Subject: [PATCH vhost 03/23] vdpa/mlx5: Drop redundant code Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-3-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE9:EE_|SN7PR12MB7788:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d903e40-7f1f-4c77-7a2a-08dc8edf4eb0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|1800799021|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: =?utf-8?q?YvottKLcxwtjKbmDtYfsFSfc8ZWO/RM?= =?utf-8?q?CiubhUj8zpaTb8hD4QY6KZqmWNbhlm3jL03wHaErTgmD9zXNnJGU874RQQ0YLEPz0?= =?utf-8?q?m7Vpi831UWaqNkp+jU9BgbbnTm8KCwiTDta9OFi87cmtRkNtM1jmvGvbwkW6PvPMX?= =?utf-8?q?cdxdbCyQpK7t2HQ0RqfbP3st05pcKeyEoxWlyt2XawV5k8D930FKnXiHBI3GgDbMP?= =?utf-8?q?ywLqMt9PdxAwxPMow5df8wF8hVE2IDO6yxZNKtBKoOLr22fsuXUIVmHSHg03LYVmi?= =?utf-8?q?E2QeFFfRasoUTTI3QA+BoWmBAuhZiUfJNs4UxINQyeabmvzxKiG3Qt45m+52SMwkK?= =?utf-8?q?rkTp6oZsBHrVuQmWDfXGO7XAcQqcj2EvWRZOvpGgEIqU/l8G2OYqoPgq025HrURbw?= =?utf-8?q?lbv8VUn1T0EiV9Gd1wlO3Cwgrrj9+2HudUS8StozKoqyPp/vXgsUqjlJC0qQ+GyYE?= =?utf-8?q?Gh3A7AKcvmv+AtYZd1tMhQNA8asdoX6ShWj37XcUQw6MC8u5pcZB00kaXZozyQyp6?= =?utf-8?q?kFr5E0Zxi9PAUadrYirAHqVSHm9lEHPaQPPT90jfsFqzexR56KWlU08yHikSWQR9n?= =?utf-8?q?Yyrp36Wpdj6y6sjN5u5HgM/Mas+ahnwCI8HzX/7VC6BIJnRVSPw3+DF6Mg1GQzWbz?= =?utf-8?q?nPwaQ0PT63NKJwJA06OqHMDLtLLKAPR3HXaKSb51hl5L1tGn3TsBaOJLueFu6gcLF?= =?utf-8?q?bNqjV2kMt9fBT1UFh/qgwj912IFBzMRncT8SDYfIUeIXp+dv8U/Y6QFQ7CCxEVHU1?= =?utf-8?q?jDdTexn7mhBAcGT9aYM74HWBv9MQ66oly0NyEVta2ylgtQFBtUpJde5Y896mGWsBB?= =?utf-8?q?6oZCnhJlp9n6NXs1BdLVdfZKP8hVJRnRpCIyuZpVEZC+MnfmLoEvT+dB4o7ooK0z+?= =?utf-8?q?vKcuQ6pawHwpJjyONxc7g4Jh4U7JOaCKlLUEU/yPvURmYLPQRnjAG89B9q7ingv+2?= =?utf-8?q?+2khON7KgpSZj12UHP5M+8/78i/yN4l0rKQ16Td4jacLIsa1RoJZWX173Fdm/9AA3?= =?utf-8?q?akgRXfC9XqQJrPij/fwA6DHRix+BilWbLTZDFEHbWMeD92VmhbZ6bmiTOLShg4gmO?= =?utf-8?q?gNhsUzQqhpYewJ/ijF2lubfkyj0ymuTuj4PSEkpnt+mmB3YBa+O56uWgi3fRqxvON?= =?utf-8?q?P7qRyOavQUoxLFE4OzbVocZjubIgZcbgABv8wF3VkKFztYuUu6vFfRb8XB2NNJkA5?= =?utf-8?q?epJkDITh1hUa4+TK3qLjLQYAYH4Ot0zxP4E1p+Ycqf+9ZQSoAkMnCW2pYUDogWXdL?= =?utf-8?q?Krl5SvxxoOm/kKMHRjaocg4u5ErvKm7AGbKz7WLGEtTIn11CyCAxHFM/cTxpNfjqO?= =?utf-8?q?sFgn8fuXOuzu8OzSl+5vRzL+V4HAQ/HCkw=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(376011)(1800799021)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:12.7713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d903e40-7f1f-4c77-7a2a-08dc8edf4eb0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7788 The second iteration in init_mvqs() is never called because the first one will iterate up to max_vqs. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 1ad281cbc541..b4d9ef4f66c8 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -3519,12 +3519,6 @@ static void init_mvqs(struct mlx5_vdpa_net *ndev) mvq->fwqp.fw = true; mvq->fw_state = MLX5_VIRTIO_NET_Q_OBJECT_NONE; } - for (; i < ndev->mvdev.max_vqs; i++) { - mvq = &ndev->vqs[i]; - memset(mvq, 0, offsetof(struct mlx5_vdpa_virtqueue, ri)); - mvq->index = i; - mvq->ndev = ndev; - } } struct mlx5_vdpa_mgmtdev { From patchwork Mon Jun 17 15:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700929 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2080.outbound.protection.outlook.com [40.107.93.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFA9C13D2BB; Mon, 17 Jun 2024 15:08:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636904; cv=fail; b=End7bky1m2/Me+hgBNkISTYzlG/i9oZnyyPx+se0yBZjSCwKhr/VtoLaO8n63KvJSOOIlBaH1Tbvyb2Z3Bs4AqZidGrwxNVsSiVPwbZ1+sMYa9+xhCg4V9Q76MA1sx3+c8JcsB/gOXvG83RXAY9fHWScofmVFTG5z8Ea0dlzb4M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636904; c=relaxed/simple; bh=TRGc0/41x7iSPk6HeNlCOk/vubauiYx27vgStcTBSfg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=hfi5R0o/sZXz47LOTT7FpBKxsx4SAWKsZih7kl+tkjFw2y9uEWukYRnC2Sa0Aq+hcpjd8YGTO0akcJM6S18vDl8++LJiXLtJfv9z29LRBP0Y4Ust384q4db8B0rRU0osF944kc8MKiByFEhrDAeNIA5FvQ7WfHhVUiRKV9z5Bjg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=i3o11VyN; arc=fail smtp.client-ip=40.107.93.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="i3o11VyN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZIiWFlnS+TqDB1MRevRv2X8eC2WLpIbdfKlAtMj6HflMLgn/SCCz6TxT1nUpI87rrIIFTS8EbCGlo7fpUx1AfrWSlNNrJQo99PoB7Yl8VIOyJFIdJ/VdmJw9fuim8TC1g8RV12V90vQCdlYkpzbZRbvUXYvoPYv11Yg50A5et1Ua4Ki9mqGiT/bbW35NHd5EvV51HdgkekLib2NMbGb7GO5M7qX7+BukY3eCxCsPSQNzc4dO0yUA/WfkWhS+R87v4dprqVt4wTl0+qVzRS41JgAI3DfP2EpwCBZ1eXRo7KzzHwEAch/Xi0+pUYYAzXTmQ/0aguZzuxw9Lvw+SI03dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N/E6q/KcQcL4M6hpZbGaFa5c0cidw5SEefNg8HKLmz8=; b=HGfUwraVuvCeJmSg3lz7Gc9lBlZpyzbf8wazJOruQyVQw3TxOomopWT7FwDlAl/syisYqNNYGjgsHh0ON6DO3TQDYBW2P7jXfCAp8pjNpJ+eRqe3qpdTtFis3XJ8iRRK1YomXPhh59Abjy5vdqlHyq94Gq0OsgFRC1lesZ5cjAjw42YEz3rUSlUiGZkB0B8e+yTY7KncGMPO7Ppzij9Q/Sq+KpGYdFFu0K/6qZ3vjjQnKqjkNt9y3/OCNXxFTpF0uOiwgoyj8MWu0wyvKUizZAXgWm/b3CbdZqhozLgRlXewaTaVFR6lBpyka9ERK14rIlUSDwl0gGWafrggRWoQrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N/E6q/KcQcL4M6hpZbGaFa5c0cidw5SEefNg8HKLmz8=; b=i3o11VyN49/kaqAX4YbmcOJFzCgfSKDuOPMfDer0JSj8idCsbMkeo7qXHdUlDSd5TplLfbxyKAIXHpBF9ftPCX6LVDv6zGA8XrJnuANjws881Hx8tDCTF96bVxZevG9wdlSAqSpUHPDIy7aQ0L/48sPfJsb7t6yQaiNnCmj3Ucy38QIyrgHGkCFE6HBB8+xjs1Ng2AzkUsGFCdHg3ISB4t2aWZv/qwdxCZJeTfngo151OCWs8M6h5OJz8FfYh5Q1Zw5hnup4TsGpDZEAJfwo+OFjGa8eCv8msA9vGcDOUw6CMlEBSbr48c62h/J9HWPoWwfVnejLnwvDTKW2EEEJmQ== Received: from SN7PR04CA0079.namprd04.prod.outlook.com (2603:10b6:806:121::24) by DS7PR12MB6024.namprd12.prod.outlook.com (2603:10b6:8:84::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:08:19 +0000 Received: from SA2PEPF00003AE9.namprd02.prod.outlook.com (2603:10b6:806:121:cafe::2f) by SN7PR04CA0079.outlook.office365.com (2603:10b6:806:121::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:08:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AE9.mail.protection.outlook.com (10.167.248.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:18 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:04 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:03 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:00 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:38 +0300 Subject: [PATCH vhost 04/23] vdpa/mlx5: Drop redundant check in teardown_virtqueues() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-4-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE9:EE_|DS7PR12MB6024:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f0e43a6-c2f8-4626-a1c8-08dc8edf5222 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|1800799021|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: =?utf-8?q?gHP1LmXpv1AwvbaUHYbLloZ7PYh1bA7?= =?utf-8?q?tqPxpOwrr8qaVKCBAMOKu+dPpnaBMeNrIsJdbPxiEUqxUSdf9hgzdQAGOuLDc8Nti?= =?utf-8?q?RYoc8p7+11eEkWQjO4//ItAHo/mxqeqjFUSQUFgFeo+IW5Jni08hfrPb37+R0+dN+?= =?utf-8?q?fH66eMXTPmeenbEnN8wVFsnSoyup/gYSi7ETcl+TD0sPZJFWRt4S0BQxXN+wDEtet?= =?utf-8?q?518+zckDTnmgWIUsBmEd65IWvDn0i6N5NuPT/lmoAl2ShFksOsRNclOFJwPjZOv51?= =?utf-8?q?4yAw1EwI1K1mNw59IL/dqGHf4Ce5FLHp5VLNcaN9vbZ+9fW/5Uf72Op/FVA8Ki84m?= =?utf-8?q?MYx+MGxWlx17aKXmqhkEEgqPI2DpBTjvRn7XGKfY/v9nxczHwSyPVnWFA+/rhTWPs?= =?utf-8?q?/ntG7jnd8G6ftm0kvNjQ9D1wgaeoaKLfROu38JBBLImAbZ2z1FtS/cvFOI4s8ebZX?= =?utf-8?q?qtU9qTNJd9aYcPzDTbeGm2wmC0my3HF4nhOHb8pm1MKwCN4clZAxxCt+yA06XyLJz?= =?utf-8?q?Hs+z7wdYxGQArmJWYrMQhDd6y3FUYe4YNibulw6r1Pm58awwGYnFqNPZ27Jr5Ub3P?= =?utf-8?q?yvROGAnyluhu8SHA3Rtfoovgvpwl+63H1/qBbVJqPWD1YzFickn3nmjI3mObIt2yY?= =?utf-8?q?eOgf2vBfics9wuEyp4J9c71J1GQBmUgFBJ5AK2TyL1KiMl2s8KRD8JhaZXo/G8VJ0?= =?utf-8?q?vUv5robQYRAOM1unxkxHdnu6bkducHv346BieVbs2o4wAwddtAWsYn8Tm/djJ4UB2?= =?utf-8?q?5zP0M/WiIR+QHosjxygWbXJxdVYPDwV1MepGyaffHNKv2NTqNRXxUBIbTBIKbmXgS?= =?utf-8?q?1dwc4MfGEn/5+qcEpXAipgdKJBMyw4wHDsTd+j/3YLDhjTPeXApY1OFOxcWPn22Ik?= =?utf-8?q?Vv3UVYvIsStw4d02a8l/1bdRjyl704SE2DyWnnjvsIut+puxnjSJe6hgcf4e1WVaw?= =?utf-8?q?SknAKoOjZF4mrcCyW4epChpyThgKuYmwEpZKEl+rrQmgzWvwxSIOvT4BWigl7bkJQ?= =?utf-8?q?aX7A2XtxzpBfDWa92LTQVvxrb2d9ig8Gx6zDxLenNGl/DmJrdFHo9cTSGwht3xyqf?= =?utf-8?q?8kn9+zSKFnb6U22SXpnOcgU5kOLLmAn3rS7cjs7bjAfo34H9rgBEqdKLSsaWwoNzi?= =?utf-8?q?oCUy5JSDuqQHORb4M90gofCwfLYIQvBUJ4s8JOWitL9WWFOQWWoCBkfo9FeuT8N0M?= =?utf-8?q?WNr8BQg4iXceD9VVWB4Y3n6zZ+D9p82Z9irMBzm0wj6G0DEr5m/68wC13dznwO/8o?= =?utf-8?q?dJxvgwLh+CQU5zUVIM1Po9y9qF7Zp0ES/ZcI5oLgNaDADY6/nXN7vkdN8v4Bwew++?= =?utf-8?q?4awCssJb4FxXehjzHA3fzb3GEIJ73aNC+A=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(376011)(1800799021)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:18.5370 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f0e43a6-c2f8-4626-a1c8-08dc8edf5222 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6024 The check is done inside teardown_vq(). Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Reviewed-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index b4d9ef4f66c8..96782b34e2b2 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2559,16 +2559,10 @@ static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev) static void teardown_virtqueues(struct mlx5_vdpa_net *ndev) { - struct mlx5_vdpa_virtqueue *mvq; int i; - for (i = ndev->mvdev.max_vqs - 1; i >= 0; i--) { - mvq = &ndev->vqs[i]; - if (!mvq->initialized) - continue; - - teardown_vq(ndev, mvq); - } + for (i = ndev->mvdev.max_vqs - 1; i >= 0; i--) + teardown_vq(ndev, &ndev->vqs[i]); } static void update_cvq_info(struct mlx5_vdpa_dev *mvdev) From patchwork Mon Jun 17 15:07:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700930 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2054.outbound.protection.outlook.com [40.107.100.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49EE013E059; Mon, 17 Jun 2024 15:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636912; cv=fail; b=KLmsCqVtGYH1ik+sj6hW68UW7C2GwxB+f7uQ2+zxUV5Kc/tu9hYl7V27frfNkei8FPwB3lY8Skk5y3Nr3bCjmr+Aliw+WQR/YJc3PTOp8hrx/Ok3875y7xuFaDk6FmiECVwmCTcjhU8xFi3F4BstSsBBuGxInHp5t57d9wQyvGw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636912; c=relaxed/simple; bh=KM6HnHRhkX/NCrwt8fuvNVo2dCqADkOMKR8Yyn6AIXk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=T7cMlqyj3+BB9MCNf0fEMz9p9tfKA5OkUKyHRpfqeg6VgbUUDrVxwbQKhZuY8IT7+XJ8YhMJt+QjARP2g/y1uLRa1QFRAmgZVYG4L9gpo+6zo+KwLo1EbJGd+0RPruFdsESczFRzScwz/OZBW6S3U+dNhScrsiIbU9Jj9W4W8PY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=qxnWJFcW; arc=fail smtp.client-ip=40.107.100.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="qxnWJFcW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WAxW9lL0juDl1G+rRUxEbmkGf9cCFvHrwYts0mFI8SUheuzIBwusk55yO27jTxmD5SFHhkk40CWPOcE5kJl+LYNBkT0kJe/18liJTMVaSHvfFT1u6MyCdvFrLUrFqo4QZbDTzJNomTxM9BvhSYzec3mf43YUZiZ6iYGD/dbOGP5ebZI6dkP7mRId6MJngyEYsOcxtb+JfM0IvHqWs+idBBcxV8GkV4QptMFDPhe+KxabHFnbZn+bV9mDx16VJ+NE265dQcXoVOZfHNuFahZZd5mHw9kOIhasjpR0r89wyHIEsbXqneLfK2HuK9C3LkRq+x+k99SwA4lrh3RLFfKQfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Nk5vlO91cHkyNn6trFQSpeGQpFn7KRpGBE8TK7QnI0k=; b=GPee2/EzNWhp1GQ6aYjA8Gj9gcL2qLb330iJMY0YZErjgnqkoSWjUoUQKj+pKVxc1LMEDuH6wHFTYxCm1mn0MeF50MLRCXLw3dRfXzq4plzwCxWKktGn3PfCRts4jwtkkg/6x9uooCr08BT06KCD0yfJ+96G77ek9Oa06T4ZIKdgZ184jTmBx5Dw6dyHA7d92Kpev7j8IG78TOLzEfxPYKMT+b8nlfYb7lu1II7J0YHnTTPPdEMay7IF3+7RbDdDxcYn8zEbX2LghqPjxnpK32GTM9bsEBp8+DtekowBWN2BxCVVy0VbOTLQABUiKtAQqrACuAKLkx6KoclhCZGf1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Nk5vlO91cHkyNn6trFQSpeGQpFn7KRpGBE8TK7QnI0k=; b=qxnWJFcW/vo8ToGTsHmk92W3o8Wc25O6nWxEGOlJMBTft/lccrLZPiwV1aFBpTg+6tlNclyDSpM0Kwa0JQgrLUdbWRNjH+L4VzO7gQEQOXt0t0g9jS1eF3bMxFU8THWrzv04qEAKmc/Xa6AZI0v280KL5EHNkfcEHia3/z6ydnSKTl+2PJTIMNYYf6ljWYt6P1X1C5RPLeBWvrqY3zSzZWVvasI+rx6iHxkcQH76zOZbmBX3kmfsJfEZ5CPIGOM5qBQp+aQhHxcCch7UA12idBUhyTV8GULXlolS5kHfbk6+SXNYwbn/uyO75EdGycaEsMjypbvffhdkaOcGrMporA== Received: from BN9PR03CA0549.namprd03.prod.outlook.com (2603:10b6:408:138::14) by MW5PR12MB5622.namprd12.prod.outlook.com (2603:10b6:303:198::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Mon, 17 Jun 2024 15:08:26 +0000 Received: from BN1PEPF00004689.namprd05.prod.outlook.com (2603:10b6:408:138:cafe::9) by BN9PR03CA0549.outlook.office365.com (2603:10b6:408:138::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:08:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BN1PEPF00004689.mail.protection.outlook.com (10.167.243.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:26 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:07 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:07 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:04 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:39 +0300 Subject: [PATCH vhost 05/23] vdpa/mlx5: Iterate over active VQs during suspend/resume Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-5-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004689:EE_|MW5PR12MB5622:EE_ X-MS-Office365-Filtering-Correlation-Id: 19b4d955-72b4-465d-951e-08dc8edf56e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|1800799021|376011|7416011|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?QfKHW1Z/Ol8Gpw0uoW03Uk9QbiVM6z3?= =?utf-8?q?nZCYadXoTLFanQBb8xdfP+6D+0nw3IL/I644yoL7NMhF65E49uFY64o5nJxIONexw?= =?utf-8?q?PCAMUGbTd1JERYWQc5kVSBtgv9lcTlwpeyqkCRu6wQc3lpnl9HbsjEE8tkT8IHfiL?= =?utf-8?q?Jc9yFRciSC+Bj4fn3nLpUg3lxlSGQ0Xsh0RH62riGg5yUtQ39IZxP5m6I0sL+89Dz?= =?utf-8?q?OA+sDkARZohgRmeRUEXcMf2jZuoQo3v6vjI3PLYUEj++/Mbt3jBM+qIAXPZtBwA5g?= =?utf-8?q?F1LipDCqrPC+Y2BJ9XZ0wfz1UcUc4TtUjhMbbF4VEgAOwyWTFsZ+V9NRu1HyDxbyQ?= =?utf-8?q?jWRKpMIRPNyKJeDWnXypeT9nHyxPw2h3oM6oF6uD9Klc4Yr5Zyt7oI8POOT3nkqCL?= =?utf-8?q?RIVAvLDlk4WaqOD/4uYxv6cwA89PDLnm0gXl7IFxiUhm58/cFxPsftnMKJpmz4VUq?= =?utf-8?q?DdUhqwNud6dN+xgXvdoXYvdMAn2qPy6qm/lLU3C6NUimonSn0+lOzP8dZm+51weNX?= =?utf-8?q?gE0zHPpnGGh04BqcrjiKgLarhsh2rcFxog6efI2hVjDQAE8yZIJIIegTCKZdCZBtv?= =?utf-8?q?AgxrUsC+hLQVZjg9yd8jZdxkNOq5w49T3E1804WVaKCcWiHokQiRPl0aqSU+7/h0c?= =?utf-8?q?YSE517ZGZe4FFC95DyPpWBE2RVsisGhQrzrWYizbdN/8C69ED0QA818G/epAppc7A?= =?utf-8?q?Luu2an+xfxPRdXseLrx/Sh2nwGraQtefk2yAUvf46tWXltdF1RdxJW3RQscLBf4xU?= =?utf-8?q?q4aUrSjKoAm3yWGzqSdSZN405z1Ibh9LZLeuNZbnAY1Pl9pbFMnCUx+MxPc0NgDpS?= =?utf-8?q?4Wm2Qs/1HxrASF8wT+/ckfqzSIzKxMoR5WP10T+iRENq3/7uoC6GJxtl4q7Tz5IMg?= =?utf-8?q?5MjEnB/6T1vnP8RbvvhWQPzhFwlqsxqIK1qCLb4Ghgmdx5wgr6LAbzKbMARnIbAp+?= =?utf-8?q?Z9xW+lUVuV4Zzn+fECj46rN1iEgj3ZpH15ZFF3XSNJOGger/k7WMpHFk5QLKxfUoN?= =?utf-8?q?aiiImmswz/ZlGxKDILLXlSdr4AHXI9jvSa8q/AcTEAPEOV0n/UCc3lo7bUlkUTGv+?= =?utf-8?q?jjFzyIh2l2Zkvw6g4DNS2b820IR6Ie/U3o8SbtC97ewozIaj3AF1l7ANGUCiKS+NK?= =?utf-8?q?uoZCLbGq19iwBJjtsdXvHuoA0MvbT4Q/N9Xzp4BMoULAor3eA8vTIyv73NrxAsjuB?= =?utf-8?q?la2GIF3dp8NRFcM3K0IOIt8GLLFfhL/+xlruUDZZyCG4dpCm+5PgmijvEZ7Td49DE?= =?utf-8?q?vdJDo/3GUCcuW6vE95n+hxga/O3+HjIE+gAeVMV38uWe6fAQXmD+M+er/JvoB3lf4?= =?utf-8?q?zpIbDwjpQ8DN5OpWi+Ks9F4cUfNVuoXNfA=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(1800799021)(376011)(7416011)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:26.4630 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19b4d955-72b4-465d-951e-08dc8edf56e5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004689.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5622 No need to iterate over max number of VQs. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 96782b34e2b2..51630b1935f4 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1504,7 +1504,7 @@ static void suspend_vqs(struct mlx5_vdpa_net *ndev) { int i; - for (i = 0; i < ndev->mvdev.max_vqs; i++) + for (i = 0; i < ndev->cur_num_vqs; i++) suspend_vq(ndev, &ndev->vqs[i]); } @@ -1522,7 +1522,7 @@ static void resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mv static void resume_vqs(struct mlx5_vdpa_net *ndev) { - for (int i = 0; i < ndev->mvdev.max_vqs; i++) + for (int i = 0; i < ndev->cur_num_vqs; i++) resume_vq(ndev, &ndev->vqs[i]); } From patchwork Mon Jun 17 15:07:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700931 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2081.outbound.protection.outlook.com [40.107.236.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 089D413F014; Mon, 17 Jun 2024 15:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636917; cv=fail; b=HvEvX/BwEj9CtYqrGGKECoayF0Bm7F6tDn+spMLa3a/DNALh6NfAURe3doDpO1DczWqXAYq/VZl9Xapkt1IN2sPh6ZyJwrSvGEMJhYVlrXpFJ53kdMUQ7/cuiE98zakHjArMyO+3AXMVESc8pVyWXPVVsC8Rhkb/0YkP6os9lxk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636917; c=relaxed/simple; bh=gUj4p7KRVaXiC1XSZK6/WBZD8QkTJgmXRDR1iE3/gDs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Y8nuosoUqwQg8EPP6tisJeqkIVcvuWVmlUOtuePbc9D7hHvXuUcfLahtbrV8AJsXjaZ+qCcSbytP/6w02fuHTLntKZksewgpiRJyGYGRI3o3OSAunczOQM4psmDGrREBoH7VFh5gtBhHpCcWeO1rtU3oLhAMNAmmE6sLZoGxATw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=K99Sf28c; arc=fail smtp.client-ip=40.107.236.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="K99Sf28c" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dx1Wkum+JL3CWW0BagfoMymE0x3z88Ob0PeFyS5lLKZfwRNPDMNXAi1MUpY+ARbWmi44Y2GsKebfTVAeEa4ktgph4xYQA6p7CKFXNdRtdDxZCv46nh5kiJbDPknh01vVHhExnavC8MeAexagFYPvBT6baW5ii7cMD3AMBQZspd0dgIugrKafNI7VNFYlm0brV4NPE0Tk0wZ/jjqgvrHiNPVv3Pt1Il8Z43VScR2WQIEc4DYhgNKOPU02AzmByuaFPGlEFo9RONzsGxg7Gnxuua3P/y3iMwuv91PmdcpGZJqlc/3uyhz+2V7ylbgj91CHM4Iyw/MphrVvJ8s7d7LRMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S7h22NAKXJ6fgKMXsv/azK4HQQJSsrYAQ2O1aso+36s=; b=SmgaKykUt9LYEg2U+/fVi0FjIxJLSuZikXpbCEJUUP7IYjHR5HEFdQ1K137kbqdVtUTYRha/VRqxaEHmglXGIkwRa1xd/9z5qAv6XFmK4iKt00cvPandZ4bBozvNgfbC666+Z0SnzjwLRgZbcQF/tPzmfBWWHtIimj9Uiw2o7d4eMBY+cWDzm6FB+D6nENopuRvTKZbUbTjPxWe28M41/bByfO9cF2CE3RdwZgITa7ur/OlTQ27V8DAIqf6WJDm2hDzjfuVUdsVZl8opWo+PxC0mGxv+mvIpH0qy0EKpoa7htF0Po1z6G0LGoO/2iGG4JcSIumqFcQB0BTY3q3ShNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S7h22NAKXJ6fgKMXsv/azK4HQQJSsrYAQ2O1aso+36s=; b=K99Sf28cjH9JiOq4IVTXpFQSSFvztUCS1Z1Pw+63dfZ7x6KBzb4UANzNnMFpZzNOEXYvTKaVBFtpt2hVEK/uoctAn38xqtoBvkbP2FZKqhFYVYjAz6lhbudx9jx47GXgU5pt8DRoDpXlXaiyrcZ+WfB086GZg6dYrEnLDXyG5EofH0lR1O+yLYC4d7AUPEkdzzFMztYJ5IOo7M+1Blspgs541hvgB7zNb32oXhN5P5sQ7cmsq+FDqU2QK0nihWi4SxrhxRMrTlhuP5E0Si5y0DkRjUsQljDThz7K9O1Fi/B8Xn/p1R4wcxAg2bzxDx++UUscWmovgXTePh1PZGP2jg== Received: from BN9PR03CA0560.namprd03.prod.outlook.com (2603:10b6:408:138::25) by PH8PR12MB8431.namprd12.prod.outlook.com (2603:10b6:510:25a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Mon, 17 Jun 2024 15:08:32 +0000 Received: from BN1PEPF00004689.namprd05.prod.outlook.com (2603:10b6:408:138:cafe::1a) by BN9PR03CA0560.outlook.office365.com (2603:10b6:408:138::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:08:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BN1PEPF00004689.mail.protection.outlook.com (10.167.243.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:31 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:12 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:11 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:08 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:40 +0300 Subject: [PATCH vhost 06/23] vdpa/mlx5: Remove duplicate suspend code Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-6-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004689:EE_|PH8PR12MB8431:EE_ X-MS-Office365-Filtering-Correlation-Id: cdb2f379-086d-4b7d-af47-08dc8edf59e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|7416011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?1VwDbaYx2e9+x+EfX+Qi0MPwarbc/2D?= =?utf-8?q?/Pv9LQynQFPi69UNcwFe01kqqMst/FsMtrvSB3KrMtq1u+HEp2F7DMTnrFfYU96Qf?= =?utf-8?q?c8+mL9D0xrgdCjlEXF0F2+U9s0XL1rcJytpq9BZqRAJuXtvQqAeEpbNwzInhV+9V0?= =?utf-8?q?vjoJzCb0jQbRk352P+idImlRcvCrRquxkxOocGlCYS7RFX8J3Slz6z5eNj/UWXrQs?= =?utf-8?q?s50EoAr8xxwm+iKZ2LAjULlKfYmTr4FI4A7fGnyYNnSWHEXGRG19U9k2H4h69m4Av?= =?utf-8?q?fiidaTw5k8uCPdWmorGZYvSrILPPeQWw14NzY50FeU/KHFh4LjpfAhPRzJUQupNiS?= =?utf-8?q?t/PNBoVL31XfkT0pvxCDxvHgUPxcZXIdodiyElavF6JGLiSkuBqJH9A+5hTzv+uh3?= =?utf-8?q?gIH0849PFUu5o70BC/APCbX+7ts/MAWL5kjtSunrsGSpEQ7d6Z8HL7EjpfhSuyLzS?= =?utf-8?q?47b+/BmHpVrYAPeV7OCju6rwUHEecuuzgEn/c443no6nvd//blOtT+DCwPXKXs/sV?= =?utf-8?q?rhtSdQBmDTCe3AYh2VPO5QeUyLwY+i1x6Eydd0Cl8EpdnWfZkLpmSXw8rvtf+mxsz?= =?utf-8?q?9wv+JeIJklRA5/m07bpg0FMXdMbJ24iZDQJ4AJzxfQnJPfutXl7ltIZr52NSu7DWm?= =?utf-8?q?LkmZ5LBunPKZIpu4nQys4mclAVU5fT6sGrT8DDzUWetuXG6mI6ZuKfAyapNQRK6Cf?= =?utf-8?q?QuPOeaNtxAZDZ2g1/uotd8JBaeGU3J+iIiIuykLMpqLAAeGOSdq8xTF3gwVvwKEZR?= =?utf-8?q?eXrefZJ5pjrAGAXOiXpAPxxeAb8uTgnWNvzMumuFPuDhDR3qA5iOPhXU0hF9BmbZG?= =?utf-8?q?4Ws+onkHoMegqFWx9ZiRUKfJ6RxGEpWqjT7Ynu7psWvsPryhlWWEzKkn/D2VvOwJL?= =?utf-8?q?Cw+RX/Ce0rKKQJp9NHkB+P199WaJBRs6CBO8fIIHuhhM62W+ZOpWkt7Jth2AilmlL?= =?utf-8?q?c0rPaMKUOx+pAQfIXv4NupZo5n9ZpCls4M1fUf5plUqttDHKTYnmFw0mMYRxbKOnf?= =?utf-8?q?8wt1aFhFLcBqhxl5d+2HfJ+R5MJzsis5B6l0bIf+FCR6hdGyAcIEwy+E6zWdQO2ZP?= =?utf-8?q?IVJk5C9m1tiKJUab9pYbQei9fR7LD3bjnzdsbFwn7ynIzWsTBrzKKh2xpstiZzTCp?= =?utf-8?q?IaEJN8rMb5aDPX1RBEKN5JztHHLXftPt4q5HIGtRs2U30efd1Txeb+SSJqF80Znc8?= =?utf-8?q?+BeQd3mWrkPaQI8+E2ibe7jEP562UNX97prBeKb94FU+aK+Ql77XE43FVvrqpMiny?= =?utf-8?q?JNH2OE5F0II9U7FyMRM8RYKFWWtGPTYaev7pRzU6vEfTru37CkgbAIMpMwp7nzVAE?= =?utf-8?q?3gTbQroJmvGqym2lKVA47ELsLZ5zQTMJFg=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(376011)(7416011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:31.4943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cdb2f379-086d-4b7d-af47-08dc8edf59e7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004689.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB8431 Use the dedicated suspend_vqs() function instead. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Reviewed-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 51630b1935f4..eca6f68c2eda 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -3355,17 +3355,12 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); - struct mlx5_vdpa_virtqueue *mvq; - int i; mlx5_vdpa_info(mvdev, "suspending device\n"); down_write(&ndev->reslock); unregister_link_notifier(ndev); - for (i = 0; i < ndev->cur_num_vqs; i++) { - mvq = &ndev->vqs[i]; - suspend_vq(ndev, mvq); - } + suspend_vqs(ndev); mlx5_vdpa_cvq_suspend(mvdev); mvdev->suspended = true; up_write(&ndev->reslock); From patchwork Mon Jun 17 15:07:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700932 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2059.outbound.protection.outlook.com [40.107.92.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AB0E140380; Mon, 17 Jun 2024 15:08:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636922; cv=fail; b=m2B+7boKRRWEI05+BVTmfTvQIUwX7N+VBTuzEps5kKx3oxJBBTX2GepKXnOgqn/NkVqawfiB21WGW7HbHYIJ7RSK0nKsWe+vWRnww/oozkXNor/O8jIHhGbdj+AzUpRSorcsAojJrh0fwM2ewWO658rOwjRtgeXyTtFjIKm3pIE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636922; c=relaxed/simple; bh=Cp7tAXzhQE+P7/IbjPuQwl+ySnyhMpGENFRwUNhHmmU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=g2d6R48ceATNiSyhI4jHZE68jPgwZkc/vP/EUiYnHBcy8K6dHxwRH+BDiyl8/fJ+zIERUUOgfsvCcY5O287+iHczLLC9tKyrTWmw//83kfCJ9ePkh1MqIq4Vma9BNNoiQ/eptxVDkpA3O+4xnXb7mKCeVYEMMnCc8YLIBNqDMJU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=e5q4Gh6w; arc=fail smtp.client-ip=40.107.92.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="e5q4Gh6w" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jS1CZoIOngjufaoPzUHALUUdiQevdTHI3ubNGqacwah3tdktbUcbwAd78rq6AZxtSFXejzbV7yY1z/MITYPMXzQ6bH9inaGApRR0IETtzmyWmaWE0nOXkB4sfho7AgZTt1bxFBtciUvfmEqtnMigraa8KI5aTkhUHbIkoN4pdQ08UcnDlVeENjHOBd5otSTiqH37LjlzA/jWi7L3VZsVLleXDvd95oiBJQa0OtHJFpRBPQVvsxOXEJnC19cEBHISQMOR5itVRHC1MHoYwM3Ury+f4eibEIHuYKU08z3xeLP1y0skGjykC50miwkI1uTKcdig5NDwQcYfdaNeiY9s9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VQzmTX8odjQONLAa4OIO7L0KzlVkpAYTEX02Mc0whkQ=; b=h9fmkFh8JD90UM+9i5mAZRt7Saj0R8Pyd9h/0XiyHqAgissd5SwxyIW01j7k8Q5Aj9/jQ6NT8pufrTm/iz4IQ45KniVtXL3s5IxX09nWcjTC4OgHL44H1grnACb8b252xdGVo705PZfqSDSV2NuuvOaiy7woyQ698uhz3ABe2ejy54r2yhghSkjnqzW8yMimcPuVTFtOkQNdKn5W/UaU6euWIacZiA73/vaWrEWk5geG5UdxzSQ71ZW8q7J9s/J+ZO00FcoZFV2CmF60NfcFSB2rje9MkdO+JnCAyoUG3/rrc6Vc3JymQDcgkKg3tXo+NzXXwNf+nv6uHSHWdVqb6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VQzmTX8odjQONLAa4OIO7L0KzlVkpAYTEX02Mc0whkQ=; b=e5q4Gh6wWFxyXQVBExTVB9lR30h0XeLMRFXiv62dBJFyo8dOJoAwHUF0upUz0QiFVYjf6IZz/6SE76romUnsovKwuNeyIyto9sUKnWJV5Qe02nXCneYyj2iZmECzpGjy0rkfOyqfugGl4AbZ7inSIxf3R+UYaGWiB8qLzZitSKqL1d3J5YZkXHLNT2wJT/DgbSSocmRklFjgy9vm7bq0GGVf1JoRAFb1/uAd3N+uQAN9gW0tm0t7tEXbZiPzdVoStC2ZYggdyWFZ/2I2J1/4DiDCRiMP4xqI0ESSk6ssrHMpaAL8uzV/GLF536pBhTRkF60dEkJQLiDN1214temhhg== Received: from BN9PR03CA0370.namprd03.prod.outlook.com (2603:10b6:408:f7::15) by SJ0PR12MB6989.namprd12.prod.outlook.com (2603:10b6:a03:448::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Mon, 17 Jun 2024 15:08:36 +0000 Received: from BN1PEPF00004687.namprd05.prod.outlook.com (2603:10b6:408:f7:cafe::26) by BN9PR03CA0370.outlook.office365.com (2603:10b6:408:f7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:08:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BN1PEPF00004687.mail.protection.outlook.com (10.167.243.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:35 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:15 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:15 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:12 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:41 +0300 Subject: [PATCH vhost 07/23] vdpa/mlx5: Initialize and reset device with one queue pair Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-7-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004687:EE_|SJ0PR12MB6989:EE_ X-MS-Office365-Filtering-Correlation-Id: faa67e76-75a3-40be-124c-08dc8edf5c7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|7416011|376011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yxsU2z+G4zrE33a9vha/8Pov5NUkIwD?= =?utf-8?q?v4Pb6OfjQ3LJJIUzarRDvRfipkPAucnpEnXDj23/I+cKYwIOlZLyrFpRiT9Oq0g99?= =?utf-8?q?46TN4WZqIJZYGuYUZbIbvDAz92U6FwRz/c2HPNeS706TecoPdhUrR+A8cs/TZMy7H?= =?utf-8?q?oOsZGdORKT3cOpvOK3bQVUvQrL5FmTwosYAMB3iB+mb9QW9CFEXCoWOEB3O48Yhka?= =?utf-8?q?nPJvOyNQzpenJg4ysHMq+rdhcE35jJIT4xCTFLTgzqbSkzP6DrQMqR5o4Km9OIGNP?= =?utf-8?q?qYusqZiZANnTQQB+gdqFXJWIl0IA88NA7xw8RrUGlWkVTL9QSskENASJI6gfFcfBU?= =?utf-8?q?P87myTg5eK5bZML7vUrk0PSyvNM+MRCd8X8VpBYWY3aTn1wHb/QbyG5e0VWp3nl3A?= =?utf-8?q?zqkl5+htmN2LnwyEFZ/IfUjDHAmM0yQTbQjCilnT22r5HKOaH2pFJFyqT/c3KovU3?= =?utf-8?q?q5cilwAjSJDrCqr9iPNuIEJXeF00GSzFjr+s2kZbzh3pVVkAW1I0zQtDGtMdlt+cS?= =?utf-8?q?6Vn2JB1BGdtjFb/cz2O8YKPNx5de/rzpf6y9lBhbi8FenijOV3L43zLhoM3qUFR6V?= =?utf-8?q?a2B534tcfF4iPPkBB69xkWXUMlSsbosrgF9EoiyHm7e8roH50E/13v7XS0zyI9Rld?= =?utf-8?q?BpszpqmLAnJ+8yQAlljbh2bXi2NELvP/FWtg2Bh8eB1pX4CraRiAZPHF2xz8tSqkS?= =?utf-8?q?sy2G+VFYViGGeTKvB02kfLOHOaxq4tyWx3zyGh3NAmbUqAfch/6AGyQAcfH4GvmID?= =?utf-8?q?PY/P9231G+T8fRDlUczebD68+pJIHaED3qr41Ir0VcQ48U7Ih5fOrARzP7JBoysJX?= =?utf-8?q?kwLr8UXAalVZpDy74eP4VSSw5dnTzCsCdhiDSe1GEmypsDMPNfbQSErtfo8+cpX96?= =?utf-8?q?0OiRdAWtfKHoaUFahKjtgkZ3PEHSB08nwldxY6dENFEC3m8W8Lc+sGr7LoZ1QNrKT?= =?utf-8?q?SI8NIqmGAVs3+U/5/7oNU79gMPjgnMSgdE4Sy/PFl/hgiXXbT+72Ccv+kfVeBYukl?= =?utf-8?q?uL6150IitV3ZEnqW2G3q4hk0RTPty6PIYVK95iPl6CIrY+NlfSTewfDfm4TYE39ny?= =?utf-8?q?vCmqrNPbFgePsmt3pSx3si6jNTiYD6Af59W12FsJCA1Ius+N+Wk0idD1F76W42eg5?= =?utf-8?q?VbJz70B9kQfrUY/D8Miw3j+SeZ/ddQX4XuCsY+12P3RGzIIeQtZx7uoAY8J0+30/g?= =?utf-8?q?XN88+2fyYoPa4ILz6ypaSp/j456bn4dNnYonm/DyDL0bkwPWXjACc/F6HhMWsCwf8?= =?utf-8?q?suQwfVnKPB+R+wWbEGYw6FIap6No5rEXfrGcTc3htcC7YwOzAPK5JRQYdAMvqvZdl?= =?utf-8?q?SHneTJocu/hHyx55PhKbvooSMHDES75EJw=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(7416011)(376011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:35.8510 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: faa67e76-75a3-40be-124c-08dc8edf5c7e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004687.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6989 The virtio spec says that a vdpa device should start off with one queue pair. The driver is already compliant. This patch moves the initialization to device add and reset times. This is done in preparation for the pre-creation of hardware virtqueues at device add time. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index eca6f68c2eda..c8b5c87f001d 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -48,6 +48,16 @@ MODULE_LICENSE("Dual BSD/GPL"); #define MLX5V_UNTAGGED 0x1000 +/* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section + * 5.1.6.5.5 "Device operation in multiqueue mode": + * + * Multiqueue is disabled by default. + * The driver enables multiqueue by sending a command using class + * VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue + * operation, as follows: ... + */ +#define MLX5V_DEFAULT_VQ_COUNT 2 + struct mlx5_vdpa_cq_buf { struct mlx5_frag_buf_ctrl fbc; struct mlx5_frag_buf frag_buf; @@ -2713,16 +2723,6 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) else ndev->rqt_size = 1; - /* Device must start with 1 queue pair, as per VIRTIO v1.2 spec, section - * 5.1.6.5.5 "Device operation in multiqueue mode": - * - * Multiqueue is disabled by default. - * The driver enables multiqueue by sending a command using class - * VIRTIO_NET_CTRL_MQ. The command selects the mode of multiqueue - * operation, as follows: ... - */ - ndev->cur_num_vqs = 2; - update_cvq_info(mvdev); return err; } @@ -3040,7 +3040,7 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); ndev->mvdev.status = 0; ndev->mvdev.suspended = false; - ndev->cur_num_vqs = 0; + ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; ndev->mvdev.cvq.received_desc = 0; ndev->mvdev.cvq.completed_desc = 0; memset(ndev->event_cbs, 0, sizeof(*ndev->event_cbs) * (mvdev->max_vqs + 1)); @@ -3643,6 +3643,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, err = -ENOMEM; goto err_alloc; } + ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; init_mvqs(ndev); allocate_irqs(ndev); From patchwork Mon Jun 17 15:07:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700933 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2073.outbound.protection.outlook.com [40.107.94.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B64FF145A1F; Mon, 17 Jun 2024 15:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636925; cv=fail; b=oUkRQT34fg4erCPJa+wPDJOvktI/y2JRxooAU2wKkXHBoLIsIxdkRbR59ISCTYZ4nCGefXztvLwdUXfKIr4CjTGXHRghULGJJahbPLIKOPeFDpZGJaX4wn42Hp7g9QwVJQWoFgdVenT+uGDDS6xGFulGHC3JnOmaa4yp2FMvLHY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636925; c=relaxed/simple; bh=/GcAG51JzSd41406OQJOJV5R2SAJ/EXb73/Zmue+8zQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ojP3ekWb5aXEoQ7emQrLcPJdGbYmAz2PqOIwMydigYSna4K5irwpJqc7bFOwgCiYDxSGNJy7l7t0l5l0R+Ndy4ItEwkAN82tkmKvv30n6dCtVrBOhIdo3co7ZrmaO6Osy0d6+QFNkqR8/89DBCb4CzHtfZhOKoTgoS7dFi4KCy4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=CIDkWPyF; arc=fail smtp.client-ip=40.107.94.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="CIDkWPyF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OgO59ytYSFv3ydMta/ZBX54XsE+n8pU1PviBy7F3Cal3PxaiwZlbXqFmgy+2PIjXeEmIHgQjeaaFbNpETGs0gL7Cxq59VbalytVJsPHXPbr0m9235ZoFRNNgoSLm5VygE/XTZEK4aV7yk9KqJ6bhVNIiR5LQviVSGkY6iZ7ZI8HzOLqqA4BR8GzrdsqwB39hgUEUSRrRryPiY7Xk1YgwduUVaxd8Lib+lea0g/ZUepoCSfMHDnKI73RWZ0daZyDcxkhQlog3mbeMDvVwjqwcCyVMPQk+l6+0rwmNGa/W+lm0eb+M0c03LF3k5uA+HV0x5NXjoz60tQnche9iNmkJQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Br7FTYfEmEm/j676tWsLBfs55UWg5gCW5oR/lgiGrFk=; b=f9zMygx5HArPlEWTSNA9LTAo3xtW44xAfgl8hHO27uTgpWTuA0PlxlN+R9TCA8WxlhR05YOzwR5puXXZymkEYM93nPvxNLiej9LM/bvgqGL6rL42abNY9SpiNTB1syw7F3BzlF3Gv3h6aXPjGhqr+DNvOe+UqsFEXbUkvRWxwchRV6qDj042vuoY/uOhQ+XiRxX+WxQYJMaAJwmjTRrei5e6yU9DVuaPr1/BATHCvg+enoDGlw/iYnBKcwjv7jPkl8Sqxl7vE4rzydtKuRbhgBO6Wn8rBTZ6EL4dyu+8FDvpZcOnapHFPNbXhRKeIjvogU/sa8rEb5MJ8rybS+8Yzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Br7FTYfEmEm/j676tWsLBfs55UWg5gCW5oR/lgiGrFk=; b=CIDkWPyFTu7whgtyY5lJnS9sSNAKjHk1YViKxXv9ziOtjHmD/mS5nVZ1AV9j0tlCrE8BP3xqX3PVhErSz+zr67Wu3kPGV1+enSdyB2LS+gq9e82ztcSZz3GeAxrZ7GLMxkwGQX0ht31IVjiwDR+xiI1Bn6EN6ytBq68nb9NSvkmdkJgNBVYkFnSB1E/J93sNZZQGhnl1e/70iede4IarAyh6zP9JBDrE96d8NdBovcGuxuKeJ7GAH2KnEkZ8HGn9J72ihldoP1gzc8jXx9BIwQYi7SHfSeRSrIUKJ7Yz12BNQXR0gn1XSJDwM1NZhdLQzSHw6sy/RHYO4pFVbhD0Pg== Received: from BN0PR02CA0021.namprd02.prod.outlook.com (2603:10b6:408:e4::26) by DS0PR12MB7654.namprd12.prod.outlook.com (2603:10b6:8:11d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Mon, 17 Jun 2024 15:08:39 +0000 Received: from BN1PEPF0000468B.namprd05.prod.outlook.com (2603:10b6:408:e4:cafe::f9) by BN0PR02CA0021.outlook.office365.com (2603:10b6:408:e4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 15:08:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BN1PEPF0000468B.mail.protection.outlook.com (10.167.243.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:39 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:19 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:19 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:16 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:42 +0300 Subject: [PATCH vhost 08/23] vdpa/mlx5: Clear and reinitialize software VQ data on reset Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-8-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000468B:EE_|DS0PR12MB7654:EE_ X-MS-Office365-Filtering-Correlation-Id: 9892c8fe-e06d-488d-5461-08dc8edf5e86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|36860700010|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?T+fLPE1PKH7hno6JCPaoRCxJRHJ2Dtq?= =?utf-8?q?EGNB6es3zW++EePZmiFvmJ6E+kJu+FZgiAqZ8F44t+7tvJoV7ZX429FKHYa1CaJ7X?= =?utf-8?q?7N21+5RO6Mg8LS6IxuKwDwlZw1ooQbk1b+xNNTowNHae/AUEk9ee8WXX1jcfD9rOO?= =?utf-8?q?eClKDJm3Ov4CIrBk2ZFbDRgFZ5lhxMI7AfzCqOA8TRcH6fVJZj04im8tufeIClM5j?= =?utf-8?q?IwWhmgFpfWwB7s9wTu/JZrzPG3jhwY3h4dwe+xdy5Z3BsKMbDgCT2yk1KsC65TTdX?= =?utf-8?q?b+RVN/VCRet0RfxoQlG9GPt6LnSNrnmQs6lb2B3JKLSiu4Gd41p+8P15Qr178855K?= =?utf-8?q?vs5xgW0N1vYngTkTQaMfLNqZBfc3dDWZEJMMu161mqKcVQm7eyvHTheVV7wFpWC8c?= =?utf-8?q?+/qtcfhstmJ/vUHRBvCbFzsGvqNXJQROJI0krtusl306z2C5q797Jp7iEI2iOWGOa?= =?utf-8?q?l7d63mJITfWxyHGbbPV5aYkuod7QH8Va2BKihAIHcYNUYsE4/BNg4LiGtzCMylafe?= =?utf-8?q?IulH9fx5OSFxUF0+mXVODENOk7zIzvo2YhPyN5VP3bqrO+JnCl8qwSz81AxvVqRWG?= =?utf-8?q?MvSmiIqj2RItkB15lMF6w0iBJu+co444Xe2FCXP+yisFRcXtwa20avHmyH2RO+Ts2?= =?utf-8?q?Yse8ZJhcMLCURT8pwTrTo95rx//KOA5EMRGDj/Oqd5yDpLfCh87846eTPfFNBFsIW?= =?utf-8?q?NZAgHbDWisFj4iFZ/Uyetlyzl37Ucdoy1E8ECKEL28z8G+BZ1ezHzSH3Fjt/U+bKe?= =?utf-8?q?m7cVAmLNRggDDGp/QeZUjRo+SdNyOTrsuWpe0m46F9A4FCYhaHFeTmxl2tDNrSPE0?= =?utf-8?q?FsCAL2HrGdDuAHlS8bB4BhP4Tn3iR7itJamDrVQfgFzM1S5TqWC+WxANbwhrfxL66?= =?utf-8?q?I7jCdTGJEegwfV1X+aIO5pT+xuJStMhtm7kXyNy5qH/ic12Ng7fbHbyJHhajAUoQ+?= =?utf-8?q?OHfk3DUhVaex9SZ5rC1GNNp278DsXVp7A00myiw4B4HJQYc13vMQaKP5ScT0RVfRn?= =?utf-8?q?GjupQbQEZpznN2cXLIeIhaaK2l34RuMIt83L6WoVfuHu2WQIKKhUAi79eTbzGblXL?= =?utf-8?q?swgDuEnZht9O+BDdcmNl+JRsDt/hxhXdJiqH4usGiLniyLfoNdd8F/wqD1kdnobcq?= =?utf-8?q?8JRu8kSEjNQCRrP4S+R+IY2k9mPWQlGhUJEPaapqjzEQ8MrkR1MITSuzENggMJNNp?= =?utf-8?q?ylbOnTloWBPIKwoJBR9wUNI8YLcpN5ylwsPP1T08B9QX/snvjJqYCrK2tKB0uiIgq?= =?utf-8?q?MouyyHWsblAe7b11vXRrcOz57yAn3ZeGVGruyUSl0wSoqoM24/ScfYnZrcshcpCbA?= =?utf-8?q?oLd6UcmBpAP+q9UIP7j1oYL20cxhKfn8HA=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(376011)(36860700010)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:39.2605 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9892c8fe-e06d-488d-5461-08dc8edf5e86 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF0000468B.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7654 The hardware VQ configuration is mirrored by data in struct mlx5_vdpa_virtqueue . Instead of clearing just a few fields at reset, fully clear the struct and initialize with the appropriate default values. As clear_vqs_ready() is used only during reset, get rid of it. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index c8b5c87f001d..de013b5a2815 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2941,18 +2941,6 @@ static void teardown_vq_resources(struct mlx5_vdpa_net *ndev) ndev->setup = false; } -static void clear_vqs_ready(struct mlx5_vdpa_net *ndev) -{ - int i; - - for (i = 0; i < ndev->mvdev.max_vqs; i++) { - ndev->vqs[i].ready = false; - ndev->vqs[i].modified_fields = 0; - } - - ndev->mvdev.cvq.ready = false; -} - static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev) { struct mlx5_control_vq *cvq = &mvdev->cvq; @@ -3035,12 +3023,14 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) down_write(&ndev->reslock); unregister_link_notifier(ndev); teardown_vq_resources(ndev); - clear_vqs_ready(ndev); + init_mvqs(ndev); + if (flags & VDPA_RESET_F_CLEAN_MAP) mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); ndev->mvdev.status = 0; ndev->mvdev.suspended = false; ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; + ndev->mvdev.cvq.ready = false; ndev->mvdev.cvq.received_desc = 0; ndev->mvdev.cvq.completed_desc = 0; memset(ndev->event_cbs, 0, sizeof(*ndev->event_cbs) * (mvdev->max_vqs + 1)); From patchwork Mon Jun 17 15:07:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700935 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2083.outbound.protection.outlook.com [40.107.95.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E3C7147C87; Mon, 17 Jun 2024 15:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636927; cv=fail; b=JfRafMk0wB59Nb4Ez3DghOlG/pU/LuxjoBQ5oGsdRw/05o4hv96w/pakhFGUbIvOJO3iZepDnuQzmHDCAsc/ohNBbACMZHYrNJmIQblbxOUPSFe1II1hTg9gmFwWR9euRQc/R+fbI9NFjYBK9aCdIzE1rWuBISundg3FsmBORDA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636927; c=relaxed/simple; bh=sMgRsMZT1raUxCxekdYWtJ3SoPrRT93p2TOwNQT7H14=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=PC/nsugoj3HrZxIwtcV5GxL6oqg/xeCuQlFU8Azezobb6VpXO7F3zyHCVIULwe0A+bFCoVrE5LlCgftcxuVnlf/SIUbd9CUBn6FbKK/wsrAv7c03wkDtEFfYgHymQoiYUlyWbwVH9U2v41BU0yDJfhWHkiTJgUlzb2e+5MDebPs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=mCWIL5Kc; arc=fail smtp.client-ip=40.107.95.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="mCWIL5Kc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LrOj93xubLgkdGFx1HChIf7VFgyJDYNM1eagFDVXEwSWGhOEukTD2lu4di7PBkpzHDqK92sZUDKaxhUSIAVZ8jiNo0RSi0NMWvsX43MITkPnnwtvt9cPNKEKOSCIcwOMrKE26iaC053eRb7gZr579fgDFM/o6fbS9FnvZFxszKZ4WOj5juNg2D6ug7RrEX1DEZPz3DPdAx9G6lwlGerIKlPTU+YC3ywB2c+fm8hKdU8okOL3P2t9kySAv5E3kOVclu2mkmbT7gQll7zY/oYvDNavL234+kQwghq58fDY4EqAincyWzngZyNev3QmqrsIMBQziN/JrxWXpuCsVCWQWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pfxcLzBTqAEXjl8/FvT3hDq3MdpZXjVqdr9JwKz0FkQ=; b=gCqsag+vcNSGFt+Qo/kH4+B93JMvl/LMQNjgnQZeCZ/gtJI6ymLAQBBJLuPQ5KuPEqSLKFkFmegilbYKLdIkhFEl7bzNk+egY3yMBa8xNZsZ7YE7Dl1kwuqL4NIKIjw+dAzKCzyN8zLrnkvOMAD38b+8MCW5l0kPx4r3QJjxYQHOgEzGjA9MorTrHTx726LYhgLMwHabMmNVLE2riExVqo5LtqcGPXWQTuwy3XRExTxEyMnnILC9XqOJzFzo/c/WhX/4McJ7g7pKTyQ2C5hoPl4YGDdsoS0rxNN3P3/YSNd1pp1nOP13kIPv3DW5n2lJ5jOsQf6MTI4fDoux3cga0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pfxcLzBTqAEXjl8/FvT3hDq3MdpZXjVqdr9JwKz0FkQ=; b=mCWIL5KcSxjTxzdBLC/keIyD71n7XQucxOmCXLS/8yY8EHijLtseCnBNQj4ujXGCdzwIp+eek5wnd0h8/maaWok4PAzXMz+DicQmTL2PewS+e1YmC5uaE/494DCSbzsFwQB2Cb1xkZYbiy2p+iLNbMYAWW3lGTHv8iCdAzGK+LdrRj6NQ+DEhp9G8OEVUyDwNq7uzuHcfuf/Ely27png5TesHMxc30iMEd2VZ75+R+cRKvqt1/0CaCPInkGyd3l73CDRY5uxs+vmMOfI3SyxeFdq293xZWXNbWHtDBBwEVMHAUYnpMyxN2lNee/3xdRcofpp8PNZJIfUoB8Qvl90IQ== Received: from BN9PR03CA0382.namprd03.prod.outlook.com (2603:10b6:408:f7::27) by SA3PR12MB7832.namprd12.prod.outlook.com (2603:10b6:806:31f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:08:42 +0000 Received: from BN1PEPF00004687.namprd05.prod.outlook.com (2603:10b6:408:f7:cafe::e1) by BN9PR03CA0382.outlook.office365.com (2603:10b6:408:f7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 15:08:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BN1PEPF00004687.mail.protection.outlook.com (10.167.243.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:42 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:23 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:23 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:19 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:43 +0300 Subject: [PATCH vhost 09/23] vdpa/mlx5: Add support for modifying the virtio_version VQ field Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-9-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004687:EE_|SA3PR12MB7832:EE_ X-MS-Office365-Filtering-Correlation-Id: b3c40a19-32c1-4e9a-32f7-08dc8edf604d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|7416011|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?pL5AIUkUL5Zb089P8Q6zoeKwNEycrlp?= =?utf-8?q?piTeCPg74JH66ONUwrr1TEYM19hzCHEb3zMiC/qtnYLWUs8pomfi3RN2Ifvm5381q?= =?utf-8?q?NtQ2jfQ15fZKRWJemaUTEvgFQd8pEJxqGC7WqOwgjD44gHpE4s8queTvsNJt9YngV?= =?utf-8?q?jvUEnTl5dPF4/qV8kfLmjyPGEylQdO4cpQp8dspGT9nKJJnlGL4ns0dD4rdj9rGa3?= =?utf-8?q?7VjKkRcuijrRtXZbyN51jNCjEF6/wNZhpROVMqU9BYKDdIK8QzQhtLACCHaDHuv8R?= =?utf-8?q?B5NOdRfOcO4du0SKrOo9oqQMqlOUcZsXmOG8TTdyu/oCqC3idGDR2zC8/D2QPuLH4?= =?utf-8?q?eEu209q0tsuFKKiGUAu2o8J3hx/Y70s1UgOeZ+tzWGbh0+kAQJ0Y4+DQMxGdUAV71?= =?utf-8?q?vBJCOfloZ/YK27si2YNv8RXdOzzRt0TbWMAXzgj2xBjaazZK6KNPwTZWs2n6g7EMw?= =?utf-8?q?6lXY4gc97s3UqBUASJRDUhmcy1Z0RVI0VURKjvrpfIJmG+DLEl9gQ/Uoyl5T6QOiK?= =?utf-8?q?aPolO9OBImtFfkq3B3bYWdfzQZpsPYzUiZs5aUM8NE5UoqYgULJrxOD7NzrEXS+bg?= =?utf-8?q?sn3DWZzRr+7z8HcvcTkK//9OfRrR7ybL78Hw4x4ZD9m728H5//c1LKcI4GHAZbToH?= =?utf-8?q?UbLVeuQqHFNmvfqinOoRiKpd/4g18mJBHAFGy1S3WXBnaxmwddvZ1XHgBaqbrtCLQ?= =?utf-8?q?T1oZXZ5xFa/FrMPc81UjbCN4GhOzVOdPMIewSGhSyXwRI1Qvdh7haDCwESnIXNUOC?= =?utf-8?q?UprWmhAoExQMXI9f/F3jOdwG3lqTYk+zqortFXMgsDfFobMU7x03PNTXoLq61DF7F?= =?utf-8?q?mOlQ+dMBAj3zS7BNba8OVa0rv0PngRkEXGOSKUW++tX20lAph23s1Fkx1x6oDV3Uk?= =?utf-8?q?rHSWUITtaomruN0TrbfEXyi1ZkUKSYF/qTu12sdmR3zrwhKJeA/7KxHx+fIyOed4W?= =?utf-8?q?YFIb7d/gRZcV4zigJ4sZOrEF6241cDAcraABxcFWbSWIcikLHY7LdJV7Ei8uMYDjd?= =?utf-8?q?uvGA7KpX2At7FqEKgFBJn9C2ijmoaMk9vPY07jsAaJkJcsrNH8+RBnnN5PBnVik3O?= =?utf-8?q?MDuA8Ud+X3GR3wF8jYobociK15paOuWStV5OwrlcKA/bwYWomxPEf2Ti5/eESqzuK?= =?utf-8?q?4VxiPI+cg3wol+SeZtcJOfrZb7F55xMWy7oNkwLC5G9yKCJsvySt2Bces1w2SgTHG?= =?utf-8?q?CMvGc5K0zm56RmhGvmjZSCJKry5VbgtyhCtJLot+PCJcZ4U03JdJqrYYHe/XYOlwk?= =?utf-8?q?uts1wjLdUyZuJ6l4mfhh4rnTzlFvMrqzdQtOgGOzzUh2W7JvRHDBQ7mOnu0Z4005U?= =?utf-8?q?kriaf/kSd3rbM8hjLRbGbvPtrLuAxTCqvA=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(7416011)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:42.2416 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3c40a19-32c1-4e9a-32f7-08dc8edf604d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004687.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7832 This is done in preparation for the pre-creation of hardware virtqueues at device add time. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 16 ++++++++++++++++ include/linux/mlx5/mlx5_ifc_vdpa.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index de013b5a2815..b60e8897717b 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1283,6 +1283,10 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX) MLX5_SET(virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx); + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION) + MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, + !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY) { vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; @@ -2709,6 +2713,7 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + u64 old_features = mvdev->actual_features; int err; print_features(mvdev, features, true); @@ -2723,6 +2728,17 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) else ndev->rqt_size = 1; + /* Interested in changes of vq features only. */ + if (get_features(old_features) != get_features(mvdev->actual_features)) { + for (int i = 0; i < mvdev->max_vqs; ++i) { + struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i]; + + mvq->modified_fields |= ( + MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION + ); + } + } + update_cvq_info(mvdev); return err; } diff --git a/include/linux/mlx5/mlx5_ifc_vdpa.h b/include/linux/mlx5/mlx5_ifc_vdpa.h index 40371c916cf9..34f27c01cec9 100644 --- a/include/linux/mlx5/mlx5_ifc_vdpa.h +++ b/include/linux/mlx5/mlx5_ifc_vdpa.h @@ -148,6 +148,7 @@ enum { MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS = (u64)1 << 6, MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX = (u64)1 << 7, MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX = (u64)1 << 8, + MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION = (u64)1 << 10, MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY = (u64)1 << 11, MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14, }; From patchwork Mon Jun 17 15:07:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700934 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2073.outbound.protection.outlook.com [40.107.223.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7DED146D5E; Mon, 17 Jun 2024 15:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636927; cv=fail; b=Wxy5ds3/kGASjfwmJhk6trUfjC2vJ9QcNnjRgKAt/OrJg8yx0HDH2vr4zW1Uno7wOzCBzhBYMn6Rjpab0Iyy2QSdpK5W8R4OZWdfPAV7CUNO5IdXPKOXJE2287umpJngRxFhucQz1NbPhh8mOSmKrT6DnGWN8pftQWb6FqrjxC4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636927; c=relaxed/simple; bh=iwGhZMh1OHw5bVe1fl0nsyatgiZFrD7PLgB6yeoDAug=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=c3DijDdRvuYh+MM0tW6RC+0yjy4125tg31HpPwBWcRqePEPR1KtiCSZn0kb+yRMUWTkG9C0x9yDVXrcywLH7mzIUyv8g6x+i3A6Vya+Q7pfqIPA82uUeX1wx+UqRWG4Xxl8+Ty1wtlFpKLwWf+huJcqfa10rIcKVQ5VCOaDVkhc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=m8Zc68mo; arc=fail smtp.client-ip=40.107.223.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="m8Zc68mo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gPJiaixbmbKPKtulQCics6MeVSf+M9FW87VuSD2YfxldEtb90nm+CLtPUuHM5+Ej5mtd76ckFw7SE36x6etQQWTWNnFmnuAFHuVTEnN/5Me6Kn2tD1cqlpzxm6zWfqY+bfk/puhH3f+WHJQ0IGKAKwwjJaSll2DA7phG3/9x9IYwhHgeJq+An0vGNSr6M33oAHHqi4Rme05AClOewfd9ctmkEUqpNpramYz1j1cF+fMZxlbd/gDOwRWSrEb9dkgOtCH9Bbbdwq/sQP/hT3R8BW3Z0VamNFjW82wFBu3nh12z/nLaGmatgi/nJc5BQlT2OPkxQDLzznDEC6b6UCqU5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vDs3rH07IlW17NOLbrgcs9vPd0t32D7YqSbTvJWyRnA=; b=e/zFmHbr8COaNB6CySOB1ZCY8/x1n9HNzovscbNNoid8CoXW87YhpRXXuB3BUwqT6ES+TrqilB1aYmkilf6goDEB2RXuHxw8gvTIvJEKrI2tvopS9mkcxXVC3Caf0BvKFy6Gmlf4dNqIBA4nCiR74+KyGH+U16ePNLmW4UjTrjRPy3LaCKA/tXWH1zMtJWwidC2FFmX+iGsul3TmmJyPWt2nkNtulPfdb6pYUcJsYzlg0nhejpDcwe6nat9Uvu27/wLFI4HXXDcBTByPo86WDCCFBBQJuR2C6fnHAvhKQO3X8XFKKzkazmt0rBywgXV+6NOhtGt/rNRSEaUTCDssFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vDs3rH07IlW17NOLbrgcs9vPd0t32D7YqSbTvJWyRnA=; b=m8Zc68mo3AIqdWtns8tm6LWMP7DeKZ64xCBR8EBlpb3Egk1fh0KqZYpYP/nFK+FTWa0CPf17KNHjghlDxhuJkrrin+pgP+w3gEu9QQwQ5ArTpgFAmuLt0HS9ctd9+X3ICYhGZw4cy1ld6ikJjn6lK9ghbRuyOZ4Fwq8FUN/tNcDDr8MIfb79qOQ5TPe4nCcMJbJMYRBryenbpkQDF5sZVb0h3fuyo49NNNlHqp3wqzZfktGgbOuZTV+a5AYhJWNDO0muasLC0JgqXnoNWNTA43Hb6uvXheEl7E1ve74ab/IPZfQDD/a2cM0apQIa8t3SD4MfVuUrIy04M0v41bMLcw== Received: from SA1PR02CA0001.namprd02.prod.outlook.com (2603:10b6:806:2cf::7) by PH7PR12MB5712.namprd12.prod.outlook.com (2603:10b6:510:1e3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.28; Mon, 17 Jun 2024 15:08:41 +0000 Received: from SA2PEPF00003AE5.namprd02.prod.outlook.com (2603:10b6:806:2cf:cafe::a3) by SA1PR02CA0001.outlook.office365.com (2603:10b6:806:2cf::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:08:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AE5.mail.protection.outlook.com (10.167.248.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:40 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:27 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:27 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:24 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:44 +0300 Subject: [PATCH vhost 10/23] vdpa/mlx5: Add support for modifying the VQ features field Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-10-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE5:EE_|PH7PR12MB5712:EE_ X-MS-Office365-Filtering-Correlation-Id: 344cd847-2a62-4020-0bb1-08dc8edf5f7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|36860700010|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?xtG9H3rV+Wx7KVvZuzqNepGZLfRJI3n?= =?utf-8?q?2oakSzZvPTqMN3W2g2E1JlUmtyjYyFMgPZ618IilTMpQlFTvjkcOFjc42cSOkCkm4?= =?utf-8?q?ZDJntEJ8tDogArHPvkqnm46QjVdgdAyJ8v6b0n79kt9o+dbfzyV11O5O9KWyLcvWR?= =?utf-8?q?LSNaSgnxyxg43SLjJSh+M2fDdSUae6kQ5XXzNvhk2YRKNu8ES3iYcNEL7I09psIUR?= =?utf-8?q?njZ6N8E/tBnAeHmIItD5GBgbY3KDoT7D7ePfeQcDGv61/AGSLFCza/jCWxi56MD8m?= =?utf-8?q?SIYcGU3MTaz8QrJWzRYiKJ9FNZW1XIgQCE0wrhKaqxWn5o9ZfcPNHsFz7Q+YfpJec?= =?utf-8?q?1HVSXyWruYAH6ycoCCzuRhSmBnIWeZ428EdluYipZenxU/g8Av93hRyY+i9H5JSgM?= =?utf-8?q?cgPau3oTtemNB8rpgc0NLmrJKcVIJSRZsGFcUia2oFwWdVLBeAaV1neSUx26yOnxM?= =?utf-8?q?mHwh+bbSUs6tLWmn6P9HcszGxJdRNNrpLuUnbADRaXTd0C+YZ9BHgUYLMwz9HCp/o?= =?utf-8?q?EC9Dq0kmtPQneL/+pP4UKbEO3u8RCtOIWZ51nahvgPd0uC6MRGqZfrH+CoGxO7/mj?= =?utf-8?q?Eak9zOVTvw8FgwDdSRC/5SHos0opDFACFph6iuEDBEokqGchaNeWS2F1L2coGB5CC?= =?utf-8?q?5QKpajYvWk4J8TuVvIVa6F42sQ9kfep4SWf0wG8red8HoWLDWO1EytQM5A4OBzskU?= =?utf-8?q?tK+s/pgp6Hoy9DoowbaavWNuoZbFlGIRH+v0FDbaz3vZwiCXgY4B7pyFIeh4sNrdu?= =?utf-8?q?X2h6rs7jIbS1MgCfJFE+zYOrUyOPNZ/Bka+YWPiQOThoyjqA///4IOZjxjVz+Unsa?= =?utf-8?q?HSM1jXQo44DT35tTHJvzG0DHSA9mO10IqPJDLS3ETtMOHhycMTcHhT92b1fRynwev?= =?utf-8?q?vg3pWCEoLh6SBu68V62c2BPqVeokYGRM6XyZEkv//4ryVtxP9E4fzfA2jbQ4Hq9/e?= =?utf-8?q?ygXMD3cuBOcxiOaP6FJ6awkDruniQg/HwCiRsxocJAXRSiX+lnTtrK0v3+8wc1vdI?= =?utf-8?q?j2mZ4Q6VQ9Yeg3aUPVCnM91Z/TxUzEOI43OSjAceXUNsbAwzIXHiyKjuD4RB9TAqe?= =?utf-8?q?KvBhyZ5qKGkE3/qPeUnhFMx9lkZd3y42/K4k0joLfxvohaJ/troiqkh/bOAoFzMF7?= =?utf-8?q?/TnA3LIwHUfoP3KQLpfAdJFzxzAwXJj0CJ59v/x1XkYF2XfpfdZNbFggn6yYBKNHA?= =?utf-8?q?V6fm15MVB6DuRM8BWSYf03A9jDrlmcCQQXxb8YFWhgdFsW4gkjoYYgWCanHCskx0x?= =?utf-8?q?bQ7LKxs7XSy3/a3LVJHengA8fbEY4Tl7odUp8VIWRRWhQMcT8iLyEf6YxubmGr3uU?= =?utf-8?q?JaFVt7sUlzzKNTRHwLSZqaTvVylTOEKLFA=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(376011)(36860700010)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:40.9465 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 344cd847-2a62-4020-0bb1-08dc8edf5f7e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5712 This is done in preparation for the pre-creation of hardware virtqueues at device add time. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 +++++++++++- include/linux/mlx5/mlx5_ifc_vdpa.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index b60e8897717b..245b5dac98d3 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1287,6 +1287,15 @@ static int modify_virtqueue(struct mlx5_vdpa_net *ndev, MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES) { + u16 mlx_features = get_features(ndev->mvdev.actual_features); + + MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_12_3, + mlx_features >> 3); + MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_2_0, + mlx_features & 7); + } + if (mvq->modified_fields & MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY) { vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; @@ -2734,7 +2743,8 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i]; mvq->modified_fields |= ( - MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION + MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION | + MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES ); } } diff --git a/include/linux/mlx5/mlx5_ifc_vdpa.h b/include/linux/mlx5/mlx5_ifc_vdpa.h index 34f27c01cec9..58dfa2ee7c83 100644 --- a/include/linux/mlx5/mlx5_ifc_vdpa.h +++ b/include/linux/mlx5/mlx5_ifc_vdpa.h @@ -150,6 +150,7 @@ enum { MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX = (u64)1 << 8, MLX5_VIRTQ_MODIFY_MASK_QUEUE_VIRTIO_VERSION = (u64)1 << 10, MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY = (u64)1 << 11, + MLX5_VIRTQ_MODIFY_MASK_QUEUE_FEATURES = (u64)1 << 12, MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY = (u64)1 << 14, }; From patchwork Mon Jun 17 15:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700936 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2082.outbound.protection.outlook.com [40.107.243.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2A4D14BFB1; Mon, 17 Jun 2024 15:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636936; cv=fail; b=pxFGRAblvFntByg6Wvuag8s/3DfAtYSfaB4mGN7tg5R8wyLJY7NuQpk/m+HaFRH1tADng8u27j30D24nkQSFaDg45qkDtbqoe+msmEBaD52pZDGbS4GxeUXMlWSfcIOic8E/hzEm8I6sbHg6/jQDjuv60xc6s7uE36OC7kgZL0I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636936; c=relaxed/simple; bh=31Vz6oC2A6FECayBVpRNi7NwNchdYB4T0wlJotGXwNk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=XlnXLrbXuzlJAB0zjpy1DyQvRsHALSzIRxrKFbLng9vPIUeIdsdKyUxp9Yp45c3T1x9UGOuLUT2ecxaq3bp+Y1yuibpUeJ1thCO85wYPm24+mLLtdqFU9Kcu3T23LZXfo3aisjpExJQaBUswyBgcFR3f5yZZJ6FQR7v9qCzyOvM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=jRaluKd2; arc=fail smtp.client-ip=40.107.243.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="jRaluKd2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LauUfucc2xfaT/zOPlTsQvjnnJsOSwdBqSD+ujn5UTBDsVNjrYM7ZU/eMas5auZfCTKSvVWjGvMMqJA7fH5lsAfRNzFgW+Mbp0oG9CK8HiS2d4ZjPKlQsFcWj74SM2+Seawx5pP5ko+wZUAfY3cPzukWBkV1ix8sqGPZobQEhYnbOWOJ6A2eywUUxKCZUvlK43W+xh39rgADhXSTEFA5LfZvaW6E8U3loZgzaUQ+VtD+kUEB6K0Qx6E0tsKoL+/6HgzxpMwHL4+5/WbIxBGUyNM/Jkitx0ExtQB5cvT4GhgKcSVytkmYW5GavfEzSX7k5lM2ypD1Yha2q5/OJITtCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2SXAbxEM0h4DShNV1azULSXFak2wE9vDIBnEma8DUYc=; b=LNMRqVTp828I91Uc9lSmu4JYALRA1sejNErFkTZPkG+of7RZP246v3OpRmzI7FPaJm7iG1p1lgKj1qaft87jzXvgo+J3f4eC62/SjuwbKsAldKcNrrpCrJLnlPsfZoMHCgexHqlY5zFp/9NifLMTxlXzVoTMhno2U54JeO376uEOkHXtCYKpzex4oO6Ucy+H24z4sKkSYCW7xf4NyLCttfi6l1HkToUGcfF6lylkqlKw3db6XqAtPXo5liE+KcZc6XPldB8e6B4DOv4loqgNkacjx0YprAWX1WYqlI+zwubGZ6dX9ny6+PVwzuQqVE3WWqvx2YfY9QRGcfoJCTwk5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2SXAbxEM0h4DShNV1azULSXFak2wE9vDIBnEma8DUYc=; b=jRaluKd25FVMmFprNR+M5n4JpENylNbhQkIQzLKoTpeBaMIgS9zLWYelvmPsZbZie3CBxgsAlyva4kRFklHUvkIWIen8WEOnpYr31V9h8+eMPOa2QOG6qsnpiwPD8mVLgNUzzR6MVu+qR2PqUTpQ3s9w/B2kAeLiSF0SVq3ppGLhFJG5U7iKzghsvbzD4LZbTdVMOw/GxrHIS0Cw9+Jr7OUoLfos9CF+gHb/Dr0HrPMoVjdwsAdjymWrXszD06IvULuCc0dc4FEGXuIuIDbSdnIt8vKZD/+NJL/rSsoX+upZ3qnAGWCzOmI84pvKNtJmc3t5+5Ar93Zir92r35nPZQ== Received: from SA9P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:806:25::21) by PH0PR12MB8175.namprd12.prod.outlook.com (2603:10b6:510:291::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:08:45 +0000 Received: from SA2PEPF00003AEB.namprd02.prod.outlook.com (2603:10b6:806:25:cafe::a5) by SA9P221CA0016.outlook.office365.com (2603:10b6:806:25::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 15:08:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AEB.mail.protection.outlook.com (10.167.248.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:45 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:31 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:31 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:27 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:45 +0300 Subject: [PATCH vhost 11/23] vdpa/mlx5: Set an initial size on the VQ Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-11-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AEB:EE_|PH0PR12MB8175:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ac28832-ce0c-4239-1b88-08dc8edf6202 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|1800799021|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Klt5dMiCnGrFXfi/njZwDVBmnVSrLEu?= =?utf-8?q?S7yVOpwcIMOUyt715/Z6Z8F8V0K0Iu8LMOW7rtC75uMGcCtoWJ0v57uP8pQ6sKdXi?= =?utf-8?q?o9646mKzUq/fNboyqyckcGi5AdWPgqBbdQW6q9Akq/KPPsQEF0syud36LImtVzZwu?= =?utf-8?q?KcpjsIrrEaMZFPhXLZFzZNPAKR8UPoEOujgqUcuQTwWG5NAj4vhj9mYaZfm2TEg0r?= =?utf-8?q?4WU+RrH7KC9r1kFWUN8lFV4U194z5a1P1suxcnXh06OV1qFY/fMJSFfNRNp4ylOUx?= =?utf-8?q?dy6Q+U36LmBMoHca8vGMi49LwtDai6cU+wOzxj3shxVEh6esfSIpQ2qRHQ5MWOyYf?= =?utf-8?q?ChkFncua37kOAqNVsGXCRA67f/z+ckrA18rsA9hulszl9lXSToHI7KgSFrspNCNfD?= =?utf-8?q?8FAGcx8wMzUyz48gGttS9t+s3Z5a1/j+RFJR0Jhi68w7gRmyZw6fEaTs7p3Ya25DF?= =?utf-8?q?z1Yad9yXr7WqxRqbh+DFTu4hqlLRPH6DltOjqBH/JmFcTwhW15R4cyeXcROgxjPvb?= =?utf-8?q?INztC5pCEnFuNyeyKdT7h4spZvVIfYavmcUyWjROqnedEko7S/76E9PtLnkluq6aw?= =?utf-8?q?/ApI7E67AFFEyU0/RuqUBrdphOE4VEVUgxV1iW7Oq7+reECyaYYP9wpdXX1ZhtvH6?= =?utf-8?q?SvsQS6+okz1HDwYDhZV1AzE0ckYlLBG1BJU+JT2/7W+wHXA2ERmB2SvbvLNZiQfx4?= =?utf-8?q?X/DbX7qm11EPwb5y+qj5x2Bs33/vMZ4kGV6EHxNdCNnFNo8RFLzfcvq5ncIe2RbeP?= =?utf-8?q?W95Qznbz5/pUW60YF5/fM9pTw/OZN3axu+lfrsFITbXpoWTiMV4jh5xQr6RXC697b?= =?utf-8?q?jPXsiR/z5lj5vr69OTA6+ByDyg2KDiznutgsWOQn7FiZC/aozPHHPyZuYiSApLIIy?= =?utf-8?q?Ucq79tnIk0E3sEriFniSIWJG0H6UtFVgsfOIM0L9ox50+kqjdPoVInHoG639xEXs/?= =?utf-8?q?w6HUrwsWppPdyBE4H6GsNFzTi34FwmN8HH5XZppw3KCqEoTBTyB7j5G7aI/6QhYVF?= =?utf-8?q?kpG9mtbdgC0iJwZrlxQSCFd6zT6HHrY1eOM30QBf7tzKiPPdzEsZVEWeqaTuj2J2N?= =?utf-8?q?72xR0lNr0kgVdV4ll2WQsbBRNtQXczGszUm9kAAT66VQ7XgERuEsjMiszLJUPhjGY?= =?utf-8?q?9b0dN4csyWttF/FQTkpecw75Wr9QMF3uDBtiUjVDvGiLFzxe+87r1s8mc5vm9WGuX?= =?utf-8?q?JzjGmDbFihxJx8XXddecHocYbmfQDCQ1PM8obo2NjpOZsePrj+pHrpgzxAdM7ndFm?= =?utf-8?q?MVQb5S+sa46S5TpxfIvo8SMOzBu49L3UMgkpu+Z/TaBv0gMXOW6Nh3tbpjdyQ3sj6?= =?utf-8?q?Phb3gqYU/MHT1/WpUf9fEeoMNGBU05yS8g=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(376011)(1800799021)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:45.1674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5ac28832-ce0c-4239-1b88-08dc8edf6202 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AEB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8175 The virtqueue size is a pre-requisite for setting up any virtqueue resources. For the upcoming optimization of creating virtqueues at device add, the virtqueue size has to be configured. Store the default queue size in struct mlx5_vdpa_net to make it easy in the future to pre-configure this default value via vdpa tool. The queue size check in setup_vq() will always be false. So remove it. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 7 ++++--- drivers/vdpa/mlx5/net/mlx5_vnet.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 245b5dac98d3..1181e0ac3671 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -58,6 +58,8 @@ MODULE_LICENSE("Dual BSD/GPL"); */ #define MLX5V_DEFAULT_VQ_COUNT 2 +#define MLX5V_DEFAULT_VQ_SIZE 256 + struct mlx5_vdpa_cq_buf { struct mlx5_frag_buf_ctrl fbc; struct mlx5_frag_buf frag_buf; @@ -1445,9 +1447,6 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) u16 idx = mvq->index; int err; - if (!mvq->num_ent) - return 0; - if (mvq->initialized) return 0; @@ -3523,6 +3522,7 @@ static void init_mvqs(struct mlx5_vdpa_net *ndev) mvq->ndev = ndev; mvq->fwqp.fw = true; mvq->fw_state = MLX5_VIRTIO_NET_Q_OBJECT_NONE; + mvq->num_ent = ndev->default_queue_size; } } @@ -3660,6 +3660,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, goto err_alloc; } ndev->cur_num_vqs = MLX5V_DEFAULT_VQ_COUNT; + ndev->default_queue_size = MLX5V_DEFAULT_VQ_SIZE; init_mvqs(ndev); allocate_irqs(ndev); diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.h b/drivers/vdpa/mlx5/net/mlx5_vnet.h index 90b556a57971..2ada29767cc5 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.h +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.h @@ -58,6 +58,7 @@ struct mlx5_vdpa_net { bool setup; u32 cur_num_vqs; u32 rqt_size; + u16 default_queue_size; bool nb_registered; struct notifier_block nb; struct vdpa_callback config_cb; From patchwork Mon Jun 17 15:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700937 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2076.outbound.protection.outlook.com [40.107.244.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89C3F14D2B4; Mon, 17 Jun 2024 15:08:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636940; cv=fail; b=em1M7i6jImpNg/c1q8T+ZAKdvqaZAnPoAhQHReKjgz13lLb1zfKMPhUIlF5wvnUJ7lBwNEHCcx3rgzWIu1vmBXa623oPWcPBzfXzunrg4cz2pL4TjEhcTPGSK9P2tk++C1BZJMhtg/ildlbZynSiBfVqprAwdXkYKlcBk3gvh4U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636940; c=relaxed/simple; bh=hVNa4vF72yG1FUVJhPDUH7dFuDGsiMSwmjO5E9JhiYQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=M1aDNEUY0NivF1p101wCIsKJnyUDtQ5YerHf3uVkkmBxsNsOIbA9/wBsUVK5WtvCJMzLRI8vhCfRqBzSRfTF2EA18l+iL+qOhNFJbwRPq2qwLwzYr1spMLWhKmiM7Kv03z1JG5mCYtMZ/hufLozce0ukHcf6d64/xmidk0znVjc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=rl5drVs5; arc=fail smtp.client-ip=40.107.244.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="rl5drVs5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SkpENA/OEXPuyTGkdWhzN+qnW8Qy0QfaCOtplBjDuAbNRd/72VOltCDzCo+oGyOFXspgKCeow5BSbYaTdk1/wk6DOxRpwbrTuJiXaciQKyKap5qSfnC7VTKHx/eUGItjTH5DiEVbZNyYiZioJ/oLbk3dGZiTsySa1bI3stDsVEZqtjUVRBcBPBBdgvihXJihzANpu8BYV5Xaoje27RYziMLHCs3qR/BNDuh70LaXncM7hdEr8971xgY09MbsMSbcFMOJ1bR/oYpUgapwjDpEzzLtbhqv5y8w4TTYKzzWMHjrzMBTwbDKwHRzyx1zDByVzAAbcwkAMGEhkuRcI+lITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m+OGx9Y2GyoolpiEWe0mzcO1wPTtb2SlllQnKC1WFr0=; b=C7MEqk3QmST82DRf2Ghp2rQ9yZ2RWFV8p3EJ/F8N6zOFzkoaHdJ9HZQ5El0IF7O9coXXdvuzw6kou/gFJPUhxs/wklcc+U1rNvX9mFUhBy0vdakLEpi+y2LWEDKbw2oKow3/Zw+0lqn+gGaCEMT2Pf2Cmn57iNQuqNOSAR6L7/QOKdVEgjrvGU19/aIblFVFxpwXchPNM9LGZjxDRemz4HYfVk4tY81xri+Mggr8sRTvJHc4tNy3ELpkhMfTm0T9cAneE+1EDirH5sVtWRssrKo4uoA921YWbFblKJzZWT5F1T54cC4hHWvpINjKGsvsG8qiGXGOXSplXFc3UGLNhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m+OGx9Y2GyoolpiEWe0mzcO1wPTtb2SlllQnKC1WFr0=; b=rl5drVs50bjTEp7D6z/gvOJ7Kst0W/qqbJPSlCar/MmJ3wd8dz+U2IM0weqd/KusTqjVrfnM6XRVsA/Yq9WSftfbBduCDAP+ntt/wC2JxO2BqlU1O4LleXSkusmQtbEPQYJaaXNF4hZiZ3cDCI/zZPhDc8VqRXGM1yuVt9+8H+rS2tpbT0P/vIdBskTcGaFjDwAZ3MTgWAkkEWm59+QdC/Ip19wuOBvtFFSEWAXPrIdRy1ME9MkvhHWubzFlkkh4WnAlOtCz7GKWZ1JB8pFOtyHGgFoVpYz4vv2fhDwIUrDyg6lDOZkOsevAOWfpls8jPVRweGz+DWrQRQfLjwc6Ew== Received: from SJ0PR13CA0055.namprd13.prod.outlook.com (2603:10b6:a03:2c2::30) by CH2PR12MB4117.namprd12.prod.outlook.com (2603:10b6:610:ae::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:08:55 +0000 Received: from SJ1PEPF00002315.namprd03.prod.outlook.com (2603:10b6:a03:2c2:cafe::b) by SJ0PR13CA0055.outlook.office365.com (2603:10b6:a03:2c2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.26 via Frontend Transport; Mon, 17 Jun 2024 15:08:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ1PEPF00002315.mail.protection.outlook.com (10.167.242.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:08:55 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:35 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:35 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:31 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:46 +0300 Subject: [PATCH vhost 12/23] vdpa/mlx5: Start off rqt_size with max VQPs Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-12-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002315:EE_|CH2PR12MB4117:EE_ X-MS-Office365-Filtering-Correlation-Id: be6c5cf6-a924-42b3-e7d1-08dc8edf67ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|7416011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: =?utf-8?q?BeGG6aSThMmaraF5P11jB1t02piTTVn?= =?utf-8?q?aObiWTakYkumhgelqkAthF27mKdyuQS8TQ/r12EotgU1IGM+WI+zMsaZ8+ecmj3i2?= =?utf-8?q?ScIdS13hHZQVTfUSVDkoYTtfUMJLrhIfWO/KBNgn528puNxSV07/1sihYm5zyoHUE?= =?utf-8?q?Z+y2CL8epYo8c7n5JqbBKJe6gSi0Wg8/savRwGwKXw7V1WQCgsa61jAS8wRk8imMb?= =?utf-8?q?5KxkTQwjWq9e4gAyiIG2fi3nM5xD5QJEPDZGKUav5RSo7TVIzZqYm+kOqtCAAukA5?= =?utf-8?q?CyZn2RPSbwyg+cfl58AjjjFgOkmkRJVFdxtDlgLdsd+Gl+tlwg7SaMVWyZ/moMebC?= =?utf-8?q?qkO89LETLKKKyNVtyRuMsaWz3U8dvbc860Lf3PteEkI1E/3JFIOUmMmKg5P/J9KYB?= =?utf-8?q?hP0ttT7OjsuQXccfMzL9iQ5Fae5k8w8ZGN1HYiHPTbPSW3oYrNeloqV5Ys001JzxW?= =?utf-8?q?+3crdWsiAa857kdKtQpeGA3oomhYcLyU9AL6JtfEWeLp3sRnRLozv8uo5d1Xca4lg?= =?utf-8?q?CRMsrqQeHpgk07Ba8FkKMKo8NhXrsFe0G+I1HFI8lnK+O+ZP22MpYHI5jvdJJ+Aqs?= =?utf-8?q?464WQWnP6OW1iIGB7O0584BpTKLE16Uzw3SZFsauuD4OFfvWyBC7qpR18wWqOErUV?= =?utf-8?q?hym+/wPVR5wLmkg1t5gOq5PJtt5IDNrsJQ05WF3Y6HILrySoO8Om6N1IdCpx5IyyT?= =?utf-8?q?iS04PyFfLZ0hzVvagyXhRayyS2Vt+/TLnWSr6MpCCjP0ASlcAdP0lg5N3gqa+D/1Z?= =?utf-8?q?tWkMibVxBcpcWdLd9dBaYQBGmsygc6wGKa8e5IX2Zd21KW6VvT8TIsXdaNWlQ7OaE?= =?utf-8?q?e4AYOfG7Y5cA9+6QVKkYnUJcangYa5odbNFCyGxTEHOpisrzGSarotrzDiR+8Ymg7?= =?utf-8?q?S3W8pEiXOWKcq3ggBHhAeW2491CAXkOtI6D7cZC6YOJ1mmob0nNPvPIrtS+TmaGol?= =?utf-8?q?gRjplLsqMMmr2qAkn9vaAGNqJbKMjvSmJ0vv0AbCwDvNRnIxss92UAg749YlVT8J0?= =?utf-8?q?UhP2SdEeCtDVj/+dBx38L7A2d4kNta+rJe0eZ1iTR9qSRQB23dnjJX4iP9YE1ZYim?= =?utf-8?q?i0ftjcPaiK/Yth2LA41tzPZW1uHUrzHcgeXs5uaBDOfpzMLVUU0Qmkq7z3JqWY9LA?= =?utf-8?q?0ezUk3mBR82yOi2RC0qovFSlzF/kbGrp4qws/yteyzGVlSss9I1j+sZKSsl8kYxEb?= =?utf-8?q?qg3US1NM3eUAgvSmaYBRrpspNn1xIx0C8h7tCJtpZ6iWhSsIxLIxvsEwt1dGzZ+fb?= =?utf-8?q?c7RLwe/ktOuLC5YuHVuL85xAmIyDtTvcZYSmwXnVWYwBsOtA81TwncddplJVPozSZ?= =?utf-8?q?EwbPDqg0MA9vyl63TxkbHMvHMLumqfaarA=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(376011)(7416011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:08:55.1613 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be6c5cf6-a924-42b3-e7d1-08dc8edf67ef X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002315.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4117 Currently rqt_size is initialized during device flag configuration. That's because it is the earliest moment when device knows if MQ (multi queue) is on or off. Shift this configuration earlier to device creation time. This implies that non-MQ devices will have a larger RQT size. But the configuration will still be correct. This is done in preparation for the pre-creation of hardware virtqueues at device add time. When that change will be added, RQT will be created at device creation time so it needs to be initialized to its max size. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 1181e0ac3671..0201c6fe61e1 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2731,10 +2731,6 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) return err; ndev->mvdev.actual_features = features & ndev->mvdev.mlx_features; - if (ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_MQ)) - ndev->rqt_size = mlx5vdpa16_to_cpu(mvdev, ndev->config.max_virtqueue_pairs); - else - ndev->rqt_size = 1; /* Interested in changes of vq features only. */ if (get_features(old_features) != get_features(mvdev->actual_features)) { @@ -3719,8 +3715,12 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, goto err_alloc; } - if (device_features & BIT_ULL(VIRTIO_NET_F_MQ)) + if (device_features & BIT_ULL(VIRTIO_NET_F_MQ)) { config->max_virtqueue_pairs = cpu_to_mlx5vdpa16(mvdev, max_vqs / 2); + ndev->rqt_size = max_vqs / 2; + } else { + ndev->rqt_size = 1; + } ndev->mvdev.mlx_features = device_features; mvdev->vdev.dma_dev = &mdev->pdev->dev; From patchwork Mon Jun 17 15:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700938 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2048.outbound.protection.outlook.com [40.107.237.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14C0814E2F3; Mon, 17 Jun 2024 15:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636946; cv=fail; b=fTQiFmkl92/FjnseJYHtp+i0eEaY6wW37N2dOhKdb3b/drCSYuPU26QqPWWmJSUWEM4YK8fhf7YTo6deVITqkjtRTQydgENgF/EzemDCJDItLvndlLoCcfgBRn2qHqu+hz4bpbpgRqxhIabnh8AhB4w03k93fWB+WY3syYu/XLA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636946; c=relaxed/simple; bh=bRuejokTcGklha1Ogv5K7dMZm/jWTvvqWiQnO3jrNq8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=aMNTf8wt7dLv8xaAnkh7IX+x45Pl4+BN5Rx98xJztyXvkSgY+ma0EARbctJX6rGzSP3DgF/13TPlD9oH/JCP+OLKrFWNoq2yr1VFEPcDDav7bCC0w7+/PonOWcbSlQzhVGgMjEwWO72Em7ysIv0HGZpsiRcwNxI+E6ZvzpFqK9U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=XcD1UXLN; arc=fail smtp.client-ip=40.107.237.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="XcD1UXLN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nf/jtcaOHAWE77t2nS6Fz6DYA1dtCMdkz1P43AdRKZSY95cO2gBoiTskiTjL1/XwpI5BLdymu6aKVtCgZovKn+uGt6zgvgQmYr4B29RzW+FRGhxbISw+a0c/YblcTyS9v1dqvDTzKdMfSnapQXWAKS/Ii9X7cpCbypBrUJfForneREdk2IyzTueMz1bmT9GbC9+2FXH+rRJwjP/I/uC/LS3OdogzWtWOblLtg0KVrtYvt/uXDnPO38wqWe5piw6aAAQTlwJzPVbHxwjHeY+sZxmQAPgr8A0XDQ0KS/tg0ia48MLb7WujfBqDV00/55FsWuqLZuGdZTn4/lOlix2FCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kW3zhmW9RmiOPlX6gtQVeGNE6qk3CE502+x8haxAKFw=; b=Y0Rn7v4CjSCSBQvT70Ha4c5zcreTu/TGwyeYMvqRIoPbivkOSWg43ONGnnzOnGUH6L1jWwRnaRG9Wiv2zvJMJ/naO5udg4BtnoVDsIE0K1kTZygty5mqOGQB7i5Cr5zeY1KAnDotlp+3T2A5n3mPlkCJk5iTtD4ynfMFhQJPoS6u9a+OnHU36grH7RuYYv6CYi+twGO8MWt0BtrhPUJsaoWIqpOSz20aLGK2ZIQlLmfreEjsEqFJJSRTCj5vLs3Ip7pfrag/WV2u3TsQaSxZGT5Z/ZquJ/qv8yX7FFFRoJJs66D3wCykKMQlgqbKzOhs4kPDYhDkuusjWWwRvKefww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kW3zhmW9RmiOPlX6gtQVeGNE6qk3CE502+x8haxAKFw=; b=XcD1UXLNz7E87sBJ/FIrwX9R0tblIuUZdQm0xh/rJb9AGBqLORTNcUXP0pFGBUuqzBgF/xxF/VOqQIr5TgRQpaiSLR8ZciPc9M4i45rOWYUdBv73SFJwG68yi/sPPcMclJp7Me0LoMWPdljGJ77H4SZ+cM7jUecLK1qnLL56FQp6lglZb/hoXjNz+z/i+S4Vz2Zt6p6RyFfBtYIK7nVx10IilnE6tGtcksQd1co/iHg64Er8ClFjOXsDiZwxVckf0GFDuMuIJSjUiKSYIW80NWFmQHB7XRQRrUrGi+icUAt5NMr1Hx4fG7CBVJCh6RJIpH+zv7ZIqOA+hgMHTHf7EQ== Received: from SJ0PR13CA0059.namprd13.prod.outlook.com (2603:10b6:a03:2c2::34) by CH3PR12MB8281.namprd12.prod.outlook.com (2603:10b6:610:128::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:09:00 +0000 Received: from SJ1PEPF00002315.namprd03.prod.outlook.com (2603:10b6:a03:2c2:cafe::6b) by SJ0PR13CA0059.outlook.office365.com (2603:10b6:a03:2c2::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:09:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ1PEPF00002315.mail.protection.outlook.com (10.167.242.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:00 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:39 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:39 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:35 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:47 +0300 Subject: [PATCH vhost 13/23] vdpa/mlx5: Set mkey modified flags on all VQs Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-13-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002315:EE_|CH3PR12MB8281:EE_ X-MS-Office365-Filtering-Correlation-Id: f6ba5ef0-98e4-4fd7-8ac7-08dc8edf6afb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|1800799021|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: =?utf-8?q?YrrxbFzO2Aezw4oA6lA2l1qZPZQBs0D?= =?utf-8?q?H49pGMH0ELo3uYCURssCDKDGE/94b9vGVLR14zaorJc4iHJ4aG2XzHFmbUY/Oc7El?= =?utf-8?q?jad3BpHabKmutT7GjY1f6eghymbGQ7uibC2c6xU6LlPMHduGkV+zWeNQNM+VZARAk?= =?utf-8?q?/VLnv5bdpTYco904JxbuYS5WAjGR3ElOGtjDAXvfNyODJ0K/WdanSzrw499EHj4VJ?= =?utf-8?q?ZHWnLnlI3dpui3CW/7n3ym12UszRwhKv0w+Fb9L4k40gJZ5jmTXV/gigkLCaVRVwA?= =?utf-8?q?nPgwISMoeThRPquLse/DNASo+B2g1veV+c0K9AyO3jisXQ34bepbbg3x5d2wBNHOQ?= =?utf-8?q?OpOOieM1gBUVg1opge4Qk5AIo84TfOML5qR3H0frqNsNYmYWy4C+PH2ibjMw2x6zt?= =?utf-8?q?ylaR8O7hlgTlqi0j6P+hk6KMVJEWa/QLw/dSOSMLWj7AbjLgiRtM4vUGWxhHwnLnd?= =?utf-8?q?VUzqELNuSsvnn2gYpYrye1AqgmzllWZ3RqqbKuuZ0hABNca50s6q6YRiTuDkfDqB3?= =?utf-8?q?UzkHhWcuCDYLDa98cNJnjEruWse+PVWiSR4bUQQT/rXSYCrGwwyqYMvM/JppqUkCa?= =?utf-8?q?6LoLi3+2D8N/ASvo8Yxe/0qfhZTQa5IxtoHQeH0M96x6Hj2wNO92O4IKUjzXu/CnN?= =?utf-8?q?IfOAAqYUT2pnZfPfnrw/Z5ekFWyF/KeliR2+WExuaZwukm5GHO00V3I0lyMnQt+V4?= =?utf-8?q?CGn2cZAiOPjU+SrEzhX6f83n0uesncRB729GNiru3AdLrS9h7mum+dwhjNdR4cEZW?= =?utf-8?q?L0bhfrGBjWpA0ySfVx89yYFRp0x89dFJWU7v4SGKFNMgJkkte9JXB09lq0l19pYIC?= =?utf-8?q?ygJAfT4MNFqeICFMHkBZIs9Namy1OQZMG29/XQOAHe0adXvVQGx2Vg4k/vzEX88y1?= =?utf-8?q?TvcKxdrKccpgnsqoznIeDlSTsusIyvaonJBIGbrcb0msXOlaO78eQBJOF4qwENtKr?= =?utf-8?q?koLNM/NReKDRfPN0Mr9rW8synJvYG37V2Ex76UbneesUUJg22ify4HpWnMhRzKSmx?= =?utf-8?q?9YwWT4kuYquoPxfhIE9nMZ0zloDmUcP43Va+u282kd8CltRofWnd8qGw65ze3necD?= =?utf-8?q?F3c0pO45Ud2YVrwp7+3o9HoYEHAhAqtxM97jXJfHlsiYEOS7qvFGERa2NvtVjloiE?= =?utf-8?q?Ec/FuZluzojZbDq2zUMHEMA8oASA+uogvxjAhNhkn5hF6co2A++pIOh6WJiQdXP/W?= =?utf-8?q?pQReG6DlpHOtBJAyCspPxOjUS/A/Ch+gA16NSZTTkkVEBv6Q6ynYeJ1WmozK4owUl?= =?utf-8?q?ZnvUOFub2dwTT0+tLeNEaQzf80Pw6A1JHXs94eRjqgQpXlQc9LRDukgkKWn751RUD?= =?utf-8?q?Ejw44O0Buk6ySmWodffRj0FG0GrQTA6Ung=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(376011)(1800799021)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:00.3332 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6ba5ef0-98e4-4fd7-8ac7-08dc8edf6afb X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002315.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8281 Otherwise, when virtqueues are moved from INIT to READY the latest mkey will not be set appropriately. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 0201c6fe61e1..0abe01fd20e9 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2868,7 +2868,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, mlx5_vdpa_update_mr(mvdev, new_mr, asid); - for (int i = 0; i < ndev->cur_num_vqs; i++) + for (int i = 0; i < mvdev->max_vqs; i++) ndev->vqs[i].modified_fields |= MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY | MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY; From patchwork Mon Jun 17 15:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700941 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2058.outbound.protection.outlook.com [40.107.236.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5FDB14F134; Mon, 17 Jun 2024 15:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636954; cv=fail; b=ZS6t2g/cgNm3ez9y+6clDc21Px/Iqqp3quu77wtMbhpJJrLToOeURD+QfMtfEhC5B7NY8LlwDBnAIqgbDhPFFzvqvBmltvFsdgLEOa6g7NkerfeGcWl1YMGe6GU/IQKzjO8bXJioxug/dg5LA6JWlB3995qvfKSI/7jArcVfsEw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636954; c=relaxed/simple; bh=pc5HJS8voJPQzeDkzRBut/sCmy/3n4KyuJhmZ/HWW0o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=fXrMN8ZdY7N91BgCdKudZxK9wH3LnrYBWX2IWu5tFFxHhgFfYz4zopz064Hh3zGiH39hO68pTASL81Tn1lPRaZG0R++3Y3BlxFm/bOUkT7r9/TyZIbv1qqX0fs1RpITMQlLCyAAFz1Wh7wMu/qjZDJPhPfiQw2ulYMC4B+tqKmQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=jFiuSiHP; arc=fail smtp.client-ip=40.107.236.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="jFiuSiHP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GktqS/fqjQfXh9MoTSAiilQsy9ZjLjDEOyIy3Rk8ezoAtpJs0Z6n8AqR74pcXOlm6yUpIVVp/3qQkqZlF6+SNYSjFlgEJv4obnN8Sjoz4T8ZTcFj1p/Ou4C2haAwn34jFfXs7qKlEibHKW/82LTKz7JHFZzT3t6GuVAy8hu3qml2WTbKJpxpy0nZzjO1SMo6TxxqACm2ko1sn6NRFTEjnWEFKHpQMKP+qgL1h0pcLpEscqhhY0CGXLJLb6iuar/irZECeymHvUbUIv0167p02dqXu3fHbp9jkxjbCDddymX34ABNOdG/6nnXXPtv0eY4aEy2IyExmQzLzHy8usM7aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6567hXPJ3mj1qTBtnRoBRmvWg11JveSZG3/2M1shtOE=; b=Bjgy6+VitKWPSHURFxNPBLFTYH4trkTs6nX0CHm2KZLNvK2VpqrPvx1JjHYh5zsqnlGzrcorUjOeDNykG5xAgaiDLLP95aGWfCrXjP1oKmHn+AApkhvm5AwGhgp9UEsgBecSjRp/gE/6o6reF6MD+4Gej/WX4r9AuJNYud2EuwzCvLUIO7qz3j/G24nj32QzRdRfDgZ30O237DMSjlFxFd9wJ2XY99ll8xMojrmeuUtafbiMSf02rP9012nAaVa6ekVkJB1QeCj4MHjziho3ZAzoVmrQiiUlf2WnFvPAqBW+7sYZ+FlPnwHxe7ThNYaanTZ6F/J0phnHkrVHDbX8oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6567hXPJ3mj1qTBtnRoBRmvWg11JveSZG3/2M1shtOE=; b=jFiuSiHPFtMnFaSD48qjIk+WMQFYsJme0rRH1ia2e1RWgrEte/sZUAAQPwj3onYGVDA3k3sR0TVDaosggcv8ClM8LvgGlOZyruOtmil740Ekmgjq/M0nvtBgOFZjjl/a3/uqcfKj0mTWacpwBOCyjkRkKWCeGt1Rjtf76hp6HhsVJ3AIjAQdWZMP5/KNzBHYfmgi3HkkJpIwPetghyEBx0xoDGil34wEdO2MfsI1YiiSd03n2ER3Yfl74dH3GvOHNzQbhU2+M5IySyt4x8OAi46cIRNnlUFQtPIy6jcnDkcfX63O4Ltn6HHwfTWv2LtAj+P1hVxNUszOYNiZNRLguA== Received: from SJ0PR03CA0133.namprd03.prod.outlook.com (2603:10b6:a03:33c::18) by IA1PR12MB8078.namprd12.prod.outlook.com (2603:10b6:208:3f1::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:09:04 +0000 Received: from SJ1PEPF00002314.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::30) by SJ0PR03CA0133.outlook.office365.com (2603:10b6:a03:33c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:09:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ1PEPF00002314.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:04 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:43 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:42 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:39 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:48 +0300 Subject: [PATCH vhost 14/23] vdpa/mlx5: Allow creation of blank VQs Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-14-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002314:EE_|IA1PR12MB8078:EE_ X-MS-Office365-Filtering-Correlation-Id: 04809ec4-2705-4e63-663f-08dc8edf6d70 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|36860700010|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?wBmPgIgrH+JS2UI8UdR18XSViZlYNrG?= =?utf-8?q?Sfg8E7xIEhx871t3sgidgT+Ol+x0mZ7TXJiDL5+Wz0rFvYqYEuFfkwjV2lxHRZiu6?= =?utf-8?q?BiTbeQBBe9GKRdG4V3UNP09/NBt51nQgLkyIiuvi5tVjmmnXeduMaMPPk1WwX2k0E?= =?utf-8?q?j0EK8WLKU+F1euCSxELZZNnqVbPrlPLWW4r0GxO2y/UBx4FkwS00I0rpxNOg8rcRk?= =?utf-8?q?QwsjErQ4OEUUUps7PY5fc07kWI860hgmhaL9tSEoRNPPwRzu02k5Q90huCZyjEWwI?= =?utf-8?q?NKgdzBEprAVZPo22ZB2mUyznJazSs6lT8jcSbBpB1f4cpfjr/9TVlsrM3Icc0hx7E?= =?utf-8?q?ussjiytGqxN/xGLnzQICq+mpvr1/wgQ0HPdmd0xNeapIiF6ZOgq0vXiU/9K1CO4Pj?= =?utf-8?q?Fmjzcu9HBij7gqOe76lb1cIEwOPC4MfdxMy2xuHraXVhMRzEOEVmZoguLGB25sVFv?= =?utf-8?q?p9LqnZ9cbS/jI0BZKg2D89CWlpzhT1NIbDJZDipliaiUD02S5AIOU+TfVzLV2y0Kl?= =?utf-8?q?6xjBFS4XQeQ2UCMZ/8l2LZs4tw8idBrsGf7Hou0wB9fg4hDMxlwepflkTGlwhh95c?= =?utf-8?q?GTgGAlH4QK1lJ3zQEJ0gyNRr3eqE6fS2vBXlHBAZRbBcqj7SKKFgNxzBWpFkMvDHx?= =?utf-8?q?AoySHyMshF1orWrQelGfCXYmRtMENPVik0losuMgq5DU+YmrvChylFiRNjnG43wHy?= =?utf-8?q?IMYmZQlVxmax6Owi/Em7iE5Y5MqxeezDSeGNJLnFbcyzxE62hSlB/MI9N8Vk0INGd?= =?utf-8?q?tlPL9LxkXrdiM7L1o7v4/S58RRiEy2nAKkvq1W90V2GG74pZdsGG0GkbEH4QLRfBc?= =?utf-8?q?jgJGOYW0EIKCHPjILV7wb3nSB9MRfRemlmFTA3bl1iLN4MDEKHB0PAXU5W6qH8teD?= =?utf-8?q?5nBpIekhBLtdsAGbRu8sJpbBHnM2wYKyKzFCnL+Kki4o/X28TAwKpAp8fmqWoK5Tc?= =?utf-8?q?bVXciFieFty50FllVvgmp3fV3YN55yfETgCga83c3ICXsJlHDT+mUsTvxQ+4IZnHC?= =?utf-8?q?gUhOm8Ea6IhtVY/u45WsTBx9mos/4YJVDqpG70Jlxd9vfP20zXbcENAo39LvTsIem?= =?utf-8?q?WzHpAmo9bH2senyU7Vty8OxqxI5X/fj+yUSH6nSF7Mhv1HQmB5+D93nn1c32qsbLY?= =?utf-8?q?H53y9JP0nIQRmCjF/41EfGbwLP4IIRnlVvRwKAMPKsot9Co9xdfkPadXEW4u/bokQ?= =?utf-8?q?jSD7pG/6cepKfXnGQX01aTv93DuFDwEIua3KXackGIGSCNvcbJx7uHSvm3Cjgx1E2?= =?utf-8?q?fNaVk8rxwwrUqtH3lTZEUk3+pN+sv9ethDOdPXW2iSQk3EfctDqY3gDQoRL/N3Kfj?= =?utf-8?q?IfzzOGcG1mp3HStSAiPJUBpTnTS5ipfzEQ=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(36860700010)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:04.4545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 04809ec4-2705-4e63-663f-08dc8edf6d70 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002314.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8078 Based on the filled flag, create VQs that are filled or blank. Blank VQs will be filled in later through VQ modify. Downstream patches will make use of this to pre-create blank VQs at vdpa device creation. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 85 +++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 0abe01fd20e9..a2dd8fd58afa 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -158,7 +158,7 @@ static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx) static void free_fixed_resources(struct mlx5_vdpa_net *ndev); static void init_mvqs(struct mlx5_vdpa_net *ndev); -static int setup_vq_resources(struct mlx5_vdpa_net *ndev); +static int setup_vq_resources(struct mlx5_vdpa_net *ndev, bool filled); static void teardown_vq_resources(struct mlx5_vdpa_net *ndev); static bool mlx5_vdpa_debug; @@ -874,13 +874,16 @@ static bool msix_mode_supported(struct mlx5_vdpa_dev *mvdev) pci_msix_can_alloc_dyn(mvdev->mdev->pdev); } -static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) +static int create_virtqueue(struct mlx5_vdpa_net *ndev, + struct mlx5_vdpa_virtqueue *mvq, + bool filled) { int inlen = MLX5_ST_SZ_BYTES(create_virtio_net_q_in); u32 out[MLX5_ST_SZ_DW(create_virtio_net_q_out)] = {}; struct mlx5_vdpa_dev *mvdev = &ndev->mvdev; struct mlx5_vdpa_mr *vq_mr; struct mlx5_vdpa_mr *vq_desc_mr; + u64 features = filled ? mvdev->actual_features : mvdev->mlx_features; void *obj_context; u16 mlx_features; void *cmd_hdr; @@ -898,7 +901,7 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque goto err_alloc; } - mlx_features = get_features(ndev->mvdev.actual_features); + mlx_features = get_features(features); cmd_hdr = MLX5_ADDR_OF(create_virtio_net_q_in, in, general_obj_in_cmd_hdr); MLX5_SET(general_obj_in_cmd_hdr, cmd_hdr, opcode, MLX5_CMD_OP_CREATE_GENERAL_OBJECT); @@ -906,8 +909,6 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque MLX5_SET(general_obj_in_cmd_hdr, cmd_hdr, uid, ndev->mvdev.res.uid); obj_context = MLX5_ADDR_OF(create_virtio_net_q_in, in, obj_context); - MLX5_SET(virtio_net_q_object, obj_context, hw_available_index, mvq->avail_idx); - MLX5_SET(virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx); MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_12_3, mlx_features >> 3); MLX5_SET(virtio_net_q_object, obj_context, queue_feature_bit_mask_2_0, @@ -929,17 +930,36 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque MLX5_SET(virtio_q, vq_ctx, queue_index, mvq->index); MLX5_SET(virtio_q, vq_ctx, queue_size, mvq->num_ent); MLX5_SET(virtio_q, vq_ctx, virtio_version_1_0, - !!(ndev->mvdev.actual_features & BIT_ULL(VIRTIO_F_VERSION_1))); - MLX5_SET64(virtio_q, vq_ctx, desc_addr, mvq->desc_addr); - MLX5_SET64(virtio_q, vq_ctx, used_addr, mvq->device_addr); - MLX5_SET64(virtio_q, vq_ctx, available_addr, mvq->driver_addr); - vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; - if (vq_mr) - MLX5_SET(virtio_q, vq_ctx, virtio_q_mkey, vq_mr->mkey); - - vq_desc_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_DESC_GROUP]]; - if (vq_desc_mr && MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, desc_group_mkey_supported)) - MLX5_SET(virtio_q, vq_ctx, desc_group_mkey, vq_desc_mr->mkey); + !!(features & BIT_ULL(VIRTIO_F_VERSION_1))); + + if (filled) { + MLX5_SET(virtio_net_q_object, obj_context, hw_available_index, mvq->avail_idx); + MLX5_SET(virtio_net_q_object, obj_context, hw_used_index, mvq->used_idx); + + MLX5_SET64(virtio_q, vq_ctx, desc_addr, mvq->desc_addr); + MLX5_SET64(virtio_q, vq_ctx, used_addr, mvq->device_addr); + MLX5_SET64(virtio_q, vq_ctx, available_addr, mvq->driver_addr); + + vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; + if (vq_mr) + MLX5_SET(virtio_q, vq_ctx, virtio_q_mkey, vq_mr->mkey); + + vq_desc_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_DESC_GROUP]]; + if (vq_desc_mr && + MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, desc_group_mkey_supported)) + MLX5_SET(virtio_q, vq_ctx, desc_group_mkey, vq_desc_mr->mkey); + } else { + /* If there is no mr update, make sure that the existing ones are set + * modify to ready. + */ + vq_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]]; + if (vq_mr) + mvq->modified_fields |= MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_MKEY; + + vq_desc_mr = mvdev->mr[mvdev->group2asid[MLX5_VDPA_DATAVQ_DESC_GROUP]]; + if (vq_desc_mr) + mvq->modified_fields |= MLX5_VIRTQ_MODIFY_MASK_DESC_GROUP_MKEY; + } MLX5_SET(virtio_q, vq_ctx, umem_1_id, mvq->umem1.id); MLX5_SET(virtio_q, vq_ctx, umem_1_size, mvq->umem1.size); @@ -959,12 +979,15 @@ static int create_virtqueue(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtque kfree(in); mvq->virtq_id = MLX5_GET(general_obj_out_cmd_hdr, out, obj_id); - mlx5_vdpa_get_mr(mvdev, vq_mr); - mvq->vq_mr = vq_mr; + if (filled) { + mlx5_vdpa_get_mr(mvdev, vq_mr); + mvq->vq_mr = vq_mr; - if (vq_desc_mr && MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, desc_group_mkey_supported)) { - mlx5_vdpa_get_mr(mvdev, vq_desc_mr); - mvq->desc_mr = vq_desc_mr; + if (vq_desc_mr && + MLX5_CAP_DEV_VDPA_EMULATION(mvdev->mdev, desc_group_mkey_supported)) { + mlx5_vdpa_get_mr(mvdev, vq_desc_mr); + mvq->desc_mr = vq_desc_mr; + } } return 0; @@ -1442,7 +1465,9 @@ static void dealloc_vector(struct mlx5_vdpa_net *ndev, } } -static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) +static int setup_vq(struct mlx5_vdpa_net *ndev, + struct mlx5_vdpa_virtqueue *mvq, + bool filled) { u16 idx = mvq->index; int err; @@ -1471,7 +1496,7 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) goto err_connect; alloc_vector(ndev, mvq); - err = create_virtqueue(ndev, mvq); + err = create_virtqueue(ndev, mvq, filled); if (err) goto err_vq; @@ -2062,7 +2087,7 @@ static int change_num_qps(struct mlx5_vdpa_dev *mvdev, int newqps) } else { ndev->cur_num_vqs = 2 * newqps; for (i = cur_qps * 2; i < 2 * newqps; i++) { - err = setup_vq(ndev, &ndev->vqs[i]); + err = setup_vq(ndev, &ndev->vqs[i], true); if (err) goto clean_added; } @@ -2558,14 +2583,14 @@ static int verify_driver_features(struct mlx5_vdpa_dev *mvdev, u64 features) return 0; } -static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev) +static int setup_virtqueues(struct mlx5_vdpa_dev *mvdev, bool filled) { struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); int err; int i; for (i = 0; i < mvdev->max_vqs; i++) { - err = setup_vq(ndev, &ndev->vqs[i]); + err = setup_vq(ndev, &ndev->vqs[i], filled); if (err) goto err_vq; } @@ -2877,7 +2902,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, if (teardown) { restore_channels_info(ndev); - err = setup_vq_resources(ndev); + err = setup_vq_resources(ndev, true); if (err) return err; } @@ -2888,7 +2913,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, } /* reslock must be held for this function */ -static int setup_vq_resources(struct mlx5_vdpa_net *ndev) +static int setup_vq_resources(struct mlx5_vdpa_net *ndev, bool filled) { struct mlx5_vdpa_dev *mvdev = &ndev->mvdev; int err; @@ -2906,7 +2931,7 @@ static int setup_vq_resources(struct mlx5_vdpa_net *ndev) if (err) goto err_setup; - err = setup_virtqueues(mvdev); + err = setup_virtqueues(mvdev, filled); if (err) { mlx5_vdpa_warn(mvdev, "setup_virtqueues\n"); goto err_setup; @@ -3000,7 +3025,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); - err = setup_vq_resources(ndev); + err = setup_vq_resources(ndev, true); if (err) { mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); goto err_driver; From patchwork Mon Jun 17 15:07:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700939 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2049.outbound.protection.outlook.com [40.107.237.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDB2014D2B4; Mon, 17 Jun 2024 15:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636947; cv=fail; b=MGils4JwUiy7j+l7quUUJJqhqe9nZf9In3MYjGHSETh01b/bhnQp3s25ldTQq5eTXo/sbG4DKehGa/uwpLjG1rkpjEA84eic3zjMQL0sEbg4xatLdqzq1YfoPUiIbezKEuSFxA0C7LtT1XX3w07xnq9U8pNbjDmorK3L2HS/vJg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636947; c=relaxed/simple; bh=FtsotHAA5lLceyZuQEQ3YvMUsF62ghgO/lGhjb+y9SY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=nCzq9EwBDpZLyBFOBiCGXyQC+4YO/ibsurP1MRZ38mP21GiBsAGTF6FJtHAUVYI9y8ArvF12m+RfA6Wc+ifAab/QFhvrUGiGeKr5kG68NPv2Bw19/czANt1tGYyQ9A7Qs8KXMrnFVQMynN0blX0uPH8/wj+XTd2V+Se3surd+Uw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=UGvoSd9A; arc=fail smtp.client-ip=40.107.237.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="UGvoSd9A" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fPEkiIsQhr7nEwX9aMvHSVOR5s6NWjnf7tCve+AKPKuIu1qP6M6qe2xqOCfqXlUZXPearTkPeXNVFAnWfOW7bDmK7ULrQbXKU6nxMhcYeURhEcvHaIlHdAaC7rJvG0wEHkK4r/iLwnVI9zZ56cY2ia4yoLZIaXuBGq+OuddtQUKqvlIOmBedPu5HtxARj2ipIw36x5qwxHT8YHdtkIBgfPEwZCBw40l8bEh6nSQFrF/n2x+a8rdPGx778/iGhsEsb7hTxgfi5EjCQksz6sw5H8n7q/K4atusUb1zrdxGENZKJylM8V93hhPqoCwUbBi+gQvztXldwa9+5ycezryOrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vMCMg/Kh9NkfVaGIWd1l1ejw1IymRROnaMM+828dieE=; b=bcMbY5MHsV1T+8mQms6urN99cGM/KfjEuwY5YmcoH3dO6Q6GOfqR1bcJvjnQAB5yl+SrOaT8QF+aN1wYEUQfSg1W7x2PB1AC5P1HJDyS2qn8+uThzSfmasLusq6wmfR0XjKkd0AmDTJ5/nNqLtY4UsXmrmSnzYL+54qcZYVHVGG1HPfSHBFBKSU+i2ca264WE7CFm9015KscbaVKUYkUipnpe71I5zl1haUPLMFmMjns3Y+lyArQxg/DrFZYI736s/eT+A8VF2pGZxnLGZZytMtLuGN7WaUeZTms/MuPF5BaN7PPbET2b4Ttq06T3CK2LZZStvVxaBJ5nzZ1+XXy8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vMCMg/Kh9NkfVaGIWd1l1ejw1IymRROnaMM+828dieE=; b=UGvoSd9AtfAQ8zM2b1CcrAYKkb8rVmfhwTZQOUIZulL0ARQ9AL4XjNirpk2MKpWnYUIg5qcAsTJbDNbvvmN5w3xxkVyMfBPjti9WSZLo/RGUqqyumYWEl6gM4X1QA/xjKuF+FmI9cKZHGQ9qt2GQhVmwP41VGxTr5OxN9pnYnCqChlxEPZWG/3FH0mgtg9RfE8nQT1SelKCy5dtmrfzNuT+W3cYmieCYA1gPRmtB/ZRwxC7AmWutBl1CwsHgtn5Whnl/PdFbBmHcUKbx37F+fUDEUrxAWU3bEh5i27VzNBbwB2N8vfrLf21bP22FWSWzbPyL7GsdQrYWdmtJEXAYPA== Received: from SN7PR04CA0089.namprd04.prod.outlook.com (2603:10b6:806:121::34) by PH7PR12MB8016.namprd12.prod.outlook.com (2603:10b6:510:26b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.28; Mon, 17 Jun 2024 15:09:01 +0000 Received: from SA2PEPF00003AE9.namprd02.prod.outlook.com (2603:10b6:806:121:cafe::62) by SN7PR04CA0089.outlook.office365.com (2603:10b6:806:121::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 15:09:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AE9.mail.protection.outlook.com (10.167.248.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:00 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:47 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:46 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:43 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:49 +0300 Subject: [PATCH vhost 15/23] vdpa/mlx5: Accept Init -> Ready VQ transition in resume_vq() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-15-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE9:EE_|PH7PR12MB8016:EE_ X-MS-Office365-Filtering-Correlation-Id: 0de57bcc-8219-4fd4-7fac-08dc8edf6b70 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|7416011|376011|36860700010|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Iq0a39TmB+7anuNNFJKyefTWc+efeCo?= =?utf-8?q?3YS1vGA7mcwr0GlsY2jBq5aDkq7ZDzKm1zxlzk3f1lUIMVX2aO4mAoZ818kNBOGkW?= =?utf-8?q?4uYul1tAX71xhn+Dkon5kIyd1Xqv2DYpDSVykR9x3OwvqncBawVP1T0317qGmO1Vm?= =?utf-8?q?sdur/FFRhxPUBr0eqdP/4kE4X4dQ2bKeXlo5lIGHUwjS8rF+I3tj2MeGi93OgLwT6?= =?utf-8?q?Uh6ROH/4lIzlkM8at1+L837wq/Ta4Gc4lYo1585xRWSv4OwPoAIPBVeFlsPzMKFJg?= =?utf-8?q?WDK9JYLoO+F1DheSL4Wj2nAOMP0epaRzA36ksMoem0U/J4qsXlD1Y1CUSIgXWPe20?= =?utf-8?q?WeN2IkW6DOVrKmtUhpSdtycLhoK9HeIHAkxhytHG8nuza9O8oX+rRAm/kZ09oQ9YZ?= =?utf-8?q?yo71nNAE1JTO94NJsqKgrJM3kLhomZJptE6aYravOn+yP6dKp5/vBjiMXQQD3Ze9q?= =?utf-8?q?WCGnJ8iHImDYYgAlkSlW3trV3+HfuBrmBTD4JVRx9lYPrT/khoLY4jmAbacFqo68x?= =?utf-8?q?cHnKs3/hHfR3pS2ilR6arPtL5E9VUD4LIGHV3jPiFhrmbkJpL9jD8SwruGHDJfoH2?= =?utf-8?q?UkBWDR+OP+dw4t9kg7UAmtX4baI47GPYS34gQHmu0y9exCVTuGLPC2y4jLuTEXrkl?= =?utf-8?q?LqjK0dHcChjAumrpY76Ku2NiTNBLFv4yg9v3uVAllHsE/iPOqqL/nhIWkeUEvSHGj?= =?utf-8?q?/DDLF2f2UDtDCgodE+xYNdyKaFVCDVeC9nu6WH39Pk7so//zOBeEWydnE2JDLN+wP?= =?utf-8?q?zSLlWftcr9NHTXyUmxMThE/RyUdxa7diRXHm4CdyBu/sdTZeZJeOmLGA+BYvddaoE?= =?utf-8?q?xGM7V4tomAQK9UCtdfxEBCkxcWTy6v5SYv5U6Np6tq7+7/SMZSkP8hyJijzWptv0R?= =?utf-8?q?eafftHk1TANHsG8rtteUUeUfdxfE9FXk8BSwfKDjkioXzyRTWj8foXDt546dgM2fy?= =?utf-8?q?z02KlSvzBoWvCbEGTcVXqCyld+JT3ZOajea2TB3wWHNEQD+b6tair3F9EKIeRJKdG?= =?utf-8?q?UPaYMkbLW5RsPFuD5UXvwSALiTFG4N5dmlLDXLOzaTV6QtfSVroxZ1EPzwb+auZY5?= =?utf-8?q?9hNXf72kl6ugb7cn8WyuauuXcTzgI8I1RQIgccspHIiCk4nSxCDyLg4HYbAitXMSn?= =?utf-8?q?qAKoBtrclrven84lgbmIIVYMe7JS+pBLFkGrQamTaH2qLRR4mVG07A27q925RNLBi?= =?utf-8?q?nmd82yAbn5pTofyMxDhz1LdCuRBEevYkuWgKGkNEXFNMDhKrs3IUK8aK6+EbHIjw+?= =?utf-8?q?4s8QVVy/CDD0rgUDS7IpDlFQ9rl+puNSfU6p4ovDpUq5anq0w+ct9jVU6s/PEhdp2?= =?utf-8?q?Yd0sHgHmBIZmQaP8ZvWBs05Z52tt0hPRCg=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(1800799021)(7416011)(376011)(36860700010)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:00.9747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0de57bcc-8219-4fd4-7fac-08dc8edf6b70 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8016 Until now resume_vq() was used only for the suspend/resume scenario. This change also allows calling resume_vq() to bring it from Init to Ready state (VQ initialization). Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index a2dd8fd58afa..e4d68d2d0bb4 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1557,11 +1557,31 @@ static void suspend_vqs(struct mlx5_vdpa_net *ndev) static void resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) { - if (!mvq->initialized || !is_resumable(ndev)) + if (!mvq->initialized) return; - if (mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND) + switch (mvq->fw_state) { + case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT: + /* Due to a FW quirk we need to modify the VQ fields first then change state. + * This should be fixed soon. After that, a single command can be used. + */ + if (modify_virtqueue(ndev, mvq, 0)) + mlx5_vdpa_warn(&ndev->mvdev, + "modify vq properties failed for vq %u\n", mvq->index); + break; + case MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND: + if (!is_resumable(ndev)) { + mlx5_vdpa_warn(&ndev->mvdev, "vq %d is not resumable\n", mvq->index); + return; + } + break; + case MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY: return; + default: + mlx5_vdpa_warn(&ndev->mvdev, "resume vq %u called from bad state %d\n", + mvq->index, mvq->fw_state); + return; + } if (modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY)) mlx5_vdpa_warn(&ndev->mvdev, "modify to resume failed for vq %u\n", mvq->index); From patchwork Mon Jun 17 15:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700940 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50FFB15098D; Mon, 17 Jun 2024 15:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636954; cv=fail; b=Y6MWTxYEXiFM6m6pRLpVJU/Hk3UJo7BORNhLOrcz6IoKdQJ9ySq0GbFWcqC+EEW3WLecUHyWNeprHxhjJSFGPA4ankOH8k0nYoq5n1oYLPog84lBwApk79C3u83rsOkaqURtLBuhTA2NPxlCtWZXf3oINaAJjWjx4rEeTfOUeOo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636954; c=relaxed/simple; bh=1qJwzEUXHIoryHN7/mvuG6DqMOWyvAYPivd2gUhB+aI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=qsgZXtC5glZOg8aP4qerP675tVRSE2wd9qX60outJbrBcy3pyp8ImdGgBTj4QAIdX9U122ilQWlJJBmM6hZzy1IJZ41tLxR/q5/7QK5J3WLFJJbyegrDTiHeJ2Zyjrqwt6RH4s02JjkzGTFgOOyhu4J48ZTgcb8dsDhBApel8l4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=hwL3qOiu; arc=fail smtp.client-ip=40.107.237.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="hwL3qOiu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AwsQAXn6R/VRvlOiRSjhPNCM+9fQKD1gd6MJG9SwdX9JGqA7HlsrivIPkf+FRJWbvpcZCE6HUKXSrdDv+aiP4cb2ps6re84Zp7mIrkCwRRgtgZQOB9ue538ujvUXjCBaHiVTiQHZ61yZyO67rB2dk5gTgBLrStRLbE72RNyebkJdxCpwPVAOOMh1KUP2nKqePP8rpbrPcCo1oy1SD3I0mgtYFHKRNy5Vyqg3jyd+6MzunmemcQOXpZZA5H5Pilvw/duqtvZoc1Ctl8ku/67qcFqD2cFCpzQL8x9VCaKAGeuAGG9N7hUfsruT2v2NrbV92ViieqCwSOoB71BJoQbwEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=d9eX+AU8BIKmObJbl+Njjy+09bOEZMhAzA5zX2SkWnQ=; b=cKLkKmLvpWj+7ZjVLvPcSbSe2luxHU/CSximB34A7DAxYWcrwSaB2dqZjfeRzixmk+7MeZlQzc6geNu1hgZDKrj8FMwdRN0A0kZ7n3cyXZotQeq/an5RqAGUvgeqtFKCTEfwSbvOif3L3e2xNaLoiqWKXu7QENjjk38SU+qW/6tiHbL4hbLIIpuwbraVKgc94wQFXzzuEZIpbmzJoKtZrDsqV5oDv4U8gDROKMfCTsZJ/SPmmPPTIuK+iGtOdUrMy10A1sSa+JBCJejyhDgidBwpwTx6r3gmw0fiWq9HVxAFr0eAE/SqmBzCqAr3/gcDY9JFUiOt8RZRMePmSMS+9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d9eX+AU8BIKmObJbl+Njjy+09bOEZMhAzA5zX2SkWnQ=; b=hwL3qOiuTPdVdf746aTZ6AQqSZpig4/EICzTZu/+tRoCDGl9E6ob6XhmmOWln8ntzOuo4k8Z1yJ0yUG3zU9r1YOrRtBm9bk9q3zGvnLtAf/eMLV0laD3Jq71vxjj9P3JlxMyb3rCYnpZQ/dlTMBBY9ZmwJjU0txjesE6OeUPo4t+MPlDtYWN3+YjWvA2gUExVwmQH3PzpBVD4V7muhs/fIV9Gnt91P9qhDJG4Rm1kH6sagpERu7ngwpJMP/X0c+1Zld8858c+ndsK13JHWUHiAaNLpkKPV7/2FQPSI7tuKvjfpDKLSHaQp6Mq77ZWbXO21JxpNS6o2bCWiVpfajCtQ== Received: from SA1PR04CA0012.namprd04.prod.outlook.com (2603:10b6:806:2ce::15) by DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:09:08 +0000 Received: from SA2PEPF00003AEA.namprd02.prod.outlook.com (2603:10b6:806:2ce:cafe::2b) by SA1PR04CA0012.outlook.office365.com (2603:10b6:806:2ce::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:09:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AEA.mail.protection.outlook.com (10.167.248.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:08 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:51 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:50 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:47 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:50 +0300 Subject: [PATCH vhost 16/23] vdpa/mlx5: Add error code for suspend/resume VQ Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-16-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AEA:EE_|DS0PR12MB7726:EE_ X-MS-Office365-Filtering-Correlation-Id: 412c4610-2081-421e-9f89-08dc8edf6fad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|36860700010|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?F+bOEzuzcsdy4hyHwLc6UIeDXsV01sc?= =?utf-8?q?GKzRCO5GYFvrx4//i4++04KJU0mQzjtHl68oLIfNcAk4Jee+OeL0vM52k/V/2giX6?= =?utf-8?q?Ukas4Nq3zcaYJ/IgbiTFMcNyZaHOYp/1U31nOgfWBr2uDGOzF8pT5r3RzL5vQWslI?= =?utf-8?q?hCRIowv7sQi91nhlZdwdc5NkCwvWuHbge7shcGgv9PbZNLZVQUEFdWEfG88xWMPGO?= =?utf-8?q?dVaGMf14UcYL8HlslDyCGXN/mjpmTHi4WNIP8gcWIEQdXlqsUBD0Ll+LhQrnj55oU?= =?utf-8?q?I15Ockia6Ih8F799Kkgfgml9nXy7sc9zPLmy8qyQD1G/qh4C+HdInLLeTvE4hxtJN?= =?utf-8?q?lAdprryG7yS5WJDCxoC4FECOmQabv11arStqlgjinUTZuac+4PFmKSyCtI7R+Jmko?= =?utf-8?q?REiF1G1G/uAeClB4LKd5Pr+C1xuUaPJxYJra/9JgQx8S95qkGihYVge7uHM9mLKOH?= =?utf-8?q?gyHa3X+obNFtvwWMZCTqTT2QHgPWzElRgHpEzKoM+hd4lvQiDGrsPM1WlOm4QKQ6C?= =?utf-8?q?UAK7ZgMDekXdw+7rIdXEpIlfm+KFz9Kb93uqS+r+clhypX2UygO6braKd8Ncq4xu1?= =?utf-8?q?dkGVaNkGytAGrDrExFHqcdD/VLnZF+LPfxfxmaZNaOK5E3fuzcH485Q/KAz1/s0hw?= =?utf-8?q?whUoW6VxVW8Ma5TOtYIKPuwtAQM5UlwvYlVKd0vg64qcIkx4fcRP0GMvV/LpExFeL?= =?utf-8?q?h9mrZeRyy1QLef5X5e/efIcU9ZZrQxZ0U5vlVvxdXoZ+Sw1Li/tPbOSS+/xlrQjLR?= =?utf-8?q?R44ojmAo3IhqfX2+i8bsbmnXQ8IXSGCssT0ZTyUPMgOn5NUUaUooaqeqDWGBpEITO?= =?utf-8?q?H2emdBA5QcYfmqswvy2eqzwKDFWk0WW5Y15v45diDcJWZKOiTvxCkxHzKscB+mREE?= =?utf-8?q?Shn1CGq4L/2OgiYqYH/QiECjFx4QstEWaRYCKiu/7H6x/sCemZ91XntdG8yM/VH/q?= =?utf-8?q?JVzbdIqLuJAAbFhvdD4ziON7NExE/5cslOb/QjKWK67nmtnXQxvl3sICI9y+AzlK7?= =?utf-8?q?BjbJx1nUniGz0Kclpvz4LseI8ECEAm4LyWnRQzVM6BdqREzw88A3cDwA67iUWLHWK?= =?utf-8?q?vO+6erIhTvrO59P5MQS/SNg4rQXnHInq1eZ5kratz518+LRjgvw+qU8BAqrt9idzz?= =?utf-8?q?HQDFnoQ8VRWuzHmQI+IPXHg2scuz5a31Hx3KkRSonkL3DYL4SOIbW3D5XbOMznVjv?= =?utf-8?q?/V9jsUYfROsUMa8gevme4ZmOT3tzxpRC3t/Rf9ehIFK9i1nTbYNJ3k7Z0+7Pv8CXh?= =?utf-8?q?fjFQ0GseM7/sQFMrhltCrsggYZlc6KJilFISivbuZQpaHrY+NrLSD4eUD/wyISBgH?= =?utf-8?q?pulGwT45mbJsV5itOrqNUI/U3OGiNSlxwg=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(376011)(36860700010)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:08.1018 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 412c4610-2081-421e-9f89-08dc8edf6fad X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AEA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7726 Instead of blindly calling suspend/resume_vqs(), make then return error codes. To keep compatibility, keep suspending or resuming VQs on error and return the last error code. The assumption here is that the error code would be the same. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 77 +++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 23 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index e4d68d2d0bb4..e3a82c43b44e 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1526,71 +1526,102 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, return err; } -static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) +static int suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) { struct mlx5_virtq_attr attr; + int err; if (!mvq->initialized) - return; + return 0; if (mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY) - return; + return 0; - if (modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND)) - mlx5_vdpa_warn(&ndev->mvdev, "modify to suspend failed\n"); + err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND); + if (err) { + mlx5_vdpa_warn(&ndev->mvdev, "modify to suspend failed, err: %d\n", err); + return err; + } - if (query_virtqueue(ndev, mvq, &attr)) { - mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue\n"); - return; + err = query_virtqueue(ndev, mvq, &attr); + if (err) { + mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue, err: %d\n", err); + return err; } + mvq->avail_idx = attr.available_index; mvq->used_idx = attr.used_index; + + return 0; } -static void suspend_vqs(struct mlx5_vdpa_net *ndev) +static int suspend_vqs(struct mlx5_vdpa_net *ndev) { + int err = 0; int i; - for (i = 0; i < ndev->cur_num_vqs; i++) - suspend_vq(ndev, &ndev->vqs[i]); + for (i = 0; i < ndev->cur_num_vqs; i++) { + int local_err = suspend_vq(ndev, &ndev->vqs[i]); + + err = local_err ? local_err : err; + } + + return err; } -static void resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) +static int resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) { + int err; + if (!mvq->initialized) - return; + return 0; switch (mvq->fw_state) { case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT: /* Due to a FW quirk we need to modify the VQ fields first then change state. * This should be fixed soon. After that, a single command can be used. */ - if (modify_virtqueue(ndev, mvq, 0)) + err = modify_virtqueue(ndev, mvq, 0); + if (err) { mlx5_vdpa_warn(&ndev->mvdev, - "modify vq properties failed for vq %u\n", mvq->index); + "modify vq properties failed for vq %u, err: %d\n", + mvq->index, err); + return err; + } break; case MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND: if (!is_resumable(ndev)) { mlx5_vdpa_warn(&ndev->mvdev, "vq %d is not resumable\n", mvq->index); - return; + return -EINVAL; } break; case MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY: - return; + return 0; default: mlx5_vdpa_warn(&ndev->mvdev, "resume vq %u called from bad state %d\n", mvq->index, mvq->fw_state); - return; + return -EINVAL; } - if (modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY)) - mlx5_vdpa_warn(&ndev->mvdev, "modify to resume failed for vq %u\n", mvq->index); + err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY); + if (err) + mlx5_vdpa_warn(&ndev->mvdev, "modify to resume failed for vq %u, err: %d\n", + mvq->index, err); + + return err; } -static void resume_vqs(struct mlx5_vdpa_net *ndev) +static int resume_vqs(struct mlx5_vdpa_net *ndev) { - for (int i = 0; i < ndev->cur_num_vqs; i++) - resume_vq(ndev, &ndev->vqs[i]); + int err = 0; + + for (int i = 0; i < ndev->cur_num_vqs; i++) { + int local_err = resume_vq(ndev, &ndev->vqs[i]); + + err = local_err ? local_err : err; + } + + return err; } static void teardown_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) From patchwork Mon Jun 17 15:07:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700942 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2069.outbound.protection.outlook.com [40.107.236.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E2711514D9; Mon, 17 Jun 2024 15:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636954; cv=fail; b=jTcY3Q7sn4jVrapvJmcmxh5/wpts97uVnHUzfAWh/8ePlOuVfQwjrcT7YkoiTcvJyCtNcolRG1E21uu9COp3A+08EWzTXYZ2sedKwogkwqk9h+JoyyQzeAiD3OHDQ6YFyj5Ge5DV0zHOrwZQOEuimS39QRxPVuFtWjG015iBoKE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636954; c=relaxed/simple; bh=z9TCsTdrf2VFvSxFHjghukPWXU3S1DWzNpUAVVqiwzI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=TPpQfYtHHGRYT6VOPvmqClEovIUcucjq6NN5zrNwAw272Z31drYlIStqg1A/iK8MMhpWtYivtow6ufTjvetF2yf19eQo8MWZwA/78tqYTEg3MmfYTgP13t3PiJHwdpBmts2gtrRpmBmDuJA4fay947iWy8bIJSZfhvQRqdsvwMs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=lfXWKI6N; arc=fail smtp.client-ip=40.107.236.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="lfXWKI6N" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YLq6Z+0C8XrREXVJ3SeW80oe+GXC8C5sUgq2ZIdgxWgyzS8UYNBrjALfJzGJJAaIvZVLxhO9ZO2phzdQcwWIYzAVUyz1j9vUW3Wv/LTGYCj/u5i8MbGw7K3qp1f8E8IEkKsDZnhewbmAbTEthChXV+8Evsn6el7KXg0XwyksnLEuyxQsmwwYcpRPhBqF4nkH+Jo5J8McFIepxEPDpjZ0LyIgp5SJagMleoOMp7G2qvUo4UOT1owiRNPSxl0xXvehfR4dqvc9RFD0QD6vXkvXnLJ7hqkTHphQfHxNJ5yaj3Vgtnk1tQfF+yEImx9By50aweJwgprDUm3Si5njMfulvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vFIk8nZcVeK5tEVFyzj174gG68kaG0VSXmODuw3FFWM=; b=giP4+EtMgYwK9vBNwhcD+C8w92Dgm3G0vy11Hm9LbALIlUmk/uG/GFHXPqBxOQ/itFNfvXhc+DQzvxDPSBtQ+G+dzWkVyVNMYfGEhjdadRczDUILmy5rsp7OZiS1Sv657JR8hVkfbjdM5f3f8N13abED+c6xWMBMZZZvdBhgM8ZZu/NuFfjML+To4ifhzsINdpwp44fR/G1ayX2xkfhinofHn2k8eo+Q0XAlaoXSNrPEoN5aFG6GY4+t0wfIYA18EbRDPMpWQrQ6GzyJCoikTW2idL0c5CRPv/cPWC5cPzRYNAcx2lnj3jtIzYj8SRKaqnC5Bm29tvTiqJwc2VDhZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vFIk8nZcVeK5tEVFyzj174gG68kaG0VSXmODuw3FFWM=; b=lfXWKI6N02kYun7GQbHCtgYjz2mfHKQ8/9efTOCk4rjnZuyUUmnUk8KuAUCFYC5cMSfBolEVfGIYp+cF1aSf/hr12L2RWXnZDrFhH3YZ4GB02aoffLOoxqaihGG5X9fqHYHU3TLndKnEpsq+khqX4d7BMOUF5kHTWtcZbYCBcRTPtHwzp7RMZ4uw7NHO/RVcE6+iVfAtQXEkJ0ubQ9VYDJd8DptY+OxznxqrFcBlL9S6lxld0YgWlq01rC/ak8ZqdTYlXg/mG0fYB6yFMFyFQz4kXc4c8fAGulL88vyNcYrVyGfY6+/8+E4Z7xqYk/ALh8HIduBuUiYYGwB+QAvnvg== Received: from SA9PR10CA0014.namprd10.prod.outlook.com (2603:10b6:806:a7::19) by SN7PR12MB7021.namprd12.prod.outlook.com (2603:10b6:806:262::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:09:09 +0000 Received: from SA2PEPF00003AE7.namprd02.prod.outlook.com (2603:10b6:806:a7:cafe::c2) by SA9PR10CA0014.outlook.office365.com (2603:10b6:806:a7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:09:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AE7.mail.protection.outlook.com (10.167.248.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:09 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:55 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:54 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:51 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:51 +0300 Subject: [PATCH vhost 17/23] vdpa/mlx5: Consolidate all VQ modify to Ready to use resume_vq() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-17-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE7:EE_|SN7PR12MB7021:EE_ X-MS-Office365-Filtering-Correlation-Id: 625df858-0de4-4796-d7ad-08dc8edf7039 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|376011|1800799021|82310400023|36860700010; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/kXk/ar1uKGUm8ADBK31Y/wRmHwLAAH?= =?utf-8?q?xbiEf34qKMq5BFd4IfnZE+4cfRuQd3jeYxXbdgTJ31r2fQqqICnGHVtbvlaJjqixW?= =?utf-8?q?qYaVn9E9Om+t4526Flacz2/qAQxh9e/isuNLclXKUfVHFhzYSS5qLRqEGXeg7UXDA?= =?utf-8?q?PEMb+CQVZvcqAKAZpGVckHYllP+lj1xgEY4MpgTYJDqhr7IAZvr3Z60TgYR0o43p3?= =?utf-8?q?RbLkSjXPaNpG2LIww9inNyaWbm+RGQoBGHV6aquLSgzuqURiPEtoLJ+lW6U8x1cbK?= =?utf-8?q?9jeq9xi5E1khl3hRmMAgKGRHo9sIX8r4jumZYl7F7cazUCadaKGxGEi8g1S2meluR?= =?utf-8?q?1DG0NVGXE97yWc+c45SY1GH+hcZ8EqvhpkolqHJFnCe3it5smAXdj8m2yvHXEh58r?= =?utf-8?q?8glQXgXbgTec4iyfp69DH5CD7kJTsdWVCqdGm1A65/mOzCIkX7XHFNav80zIOCyE8?= =?utf-8?q?FwTsDJd5f58gv+oIVYdQPRmRZS58MgEFJ6utoCzAFxXuw4cem0dzwWUUGpvwgjTb7?= =?utf-8?q?VN0/gilwbcgHTr13i6vcKx5vhdwV3z15djQD+vn1S1llgJQ0FHY8FqCDh+yOhBZ2y?= =?utf-8?q?u0jtumg6o41+LPfbXaDeW1qjyfaKB2U1h5ulOJudlli3DzXySgqF3jFEqtirMeWg9?= =?utf-8?q?dmKIj32/yB0rMfsbu8/uTOoSHaG0uzQERmOWHUcMAzY99GkuO5OU+JBRNZIl/Nuza?= =?utf-8?q?ayisnRVCPeDfObSKJ406vPQMCwlO8dqET3RKIqr53nJg1JCHqNmPORq2g5W1Vwhws?= =?utf-8?q?cPn+mZyhAiyJ5VArxR3CjqiwVSbedFb3S4yVFLenifQMdSo9286J/+Ux9W0jcOMMG?= =?utf-8?q?i2Jw+g1am6bf87G4h9IhrddD4NIyW3PSImRX0iz5eCwWtwJLj8OH7cezZ6R4AKyAC?= =?utf-8?q?I1y/n5Rt0Sjj87dpyni+BzvJ1L0PIIkfiCdHO3h50yyKBtQToXncyuB9lfcREbsim?= =?utf-8?q?bnRzeo6ZxH3+0cYPbypjALD3IxvYabVZnWT+cuS28nSZrbxz13l4Z3ipygXjCU+WD?= =?utf-8?q?vcQq++TbczOWeQ7LBKBgzCj48yGmwSJXPtWN9+k0BP2SfMVX06xpK1POO53FM9V4b?= =?utf-8?q?rqZzuoDq/hRbbTtzcIPvfZGsVcG75MDllrI4VZ1CTGGRE57KLX5VTHl5XFor12Lyf?= =?utf-8?q?Aiclev4/SLwP/3jvRaACy24BXwTcdbNlCF+RKo1UQardMHEIIUw4d3aBRlQJbWtbN?= =?utf-8?q?giDgQ8V75/SrAQ/Gt5YgY2aebwmmQr2hZa+1tMFvbEtdZhaxhK22C7FpWQY7xq85M?= =?utf-8?q?3N5oYVsoJQxTGDu3vaOw17mgfsVFq90lZx6HAUWsjpe07H30Jk6MSWm92TRNn22Iu?= =?utf-8?q?9+/HZpkigXZHGARrE1MpI7IpoQQd86un4Q=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(376011)(1800799021)(82310400023)(36860700010);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:09.0051 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 625df858-0de4-4796-d7ad-08dc8edf7039 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7021 There are a few more places modifying the VQ to Ready directly. Let's consolidate them into resume_vq(). The redundant warnings for resume_vq() errors can also be dropped. There is one special case that needs to be handled for virtio-vdpa: the initialized flag must be set to true earlier in setup_vq() so that resume_vq() doesn't return early. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index e3a82c43b44e..f5d5b25cdb01 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -160,6 +160,7 @@ static void free_fixed_resources(struct mlx5_vdpa_net *ndev); static void init_mvqs(struct mlx5_vdpa_net *ndev); static int setup_vq_resources(struct mlx5_vdpa_net *ndev, bool filled); static void teardown_vq_resources(struct mlx5_vdpa_net *ndev); +static int resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq); static bool mlx5_vdpa_debug; @@ -1500,16 +1501,14 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, if (err) goto err_vq; + mvq->initialized = true; + if (mvq->ready) { - err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY); - if (err) { - mlx5_vdpa_warn(&ndev->mvdev, "failed to modify to ready vq idx %d(%d)\n", - idx, err); + err = resume_vq(ndev, mvq); + if (err) goto err_modify; - } } - mvq->initialized = true; return 0; err_modify: @@ -2422,7 +2421,6 @@ static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool ready struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); struct mlx5_vdpa_virtqueue *mvq; - int err; if (!mvdev->actual_features) return; @@ -2439,14 +2437,10 @@ static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool ready if (!ready) { suspend_vq(ndev, mvq); } else { - err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY); - if (err) { - mlx5_vdpa_warn(mvdev, "modify VQ %d to ready failed (%d)\n", idx, err); + if (resume_vq(ndev, mvq)) ready = false; - } } - mvq->ready = ready; } From patchwork Mon Jun 17 15:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700944 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2064.outbound.protection.outlook.com [40.107.223.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1067152E00; Mon, 17 Jun 2024 15:09:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636968; cv=fail; b=IZi+aCmgEZzarwEvb0RVukYrRBng2uBLe+IvGZdEtZ5Mpt5y1t0fHqNEeAk2cFCcZimrjq+vvslnVoaQXwNo0kDcpw3laLq/m73umUMtJEda5J0BPmzChz04JYAVhBGQIiBFI1FQBVu7eubQUy63wHMd+LXD+vPsMWfGG0o1buI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636968; c=relaxed/simple; bh=Uah6IifL6+bJ1VeGiVxQJbD2U72Vm0QHgCqVIfQRhAg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=tDu/y46BvfUm46TDt3p0f5yM9CdFHVcz95gYseYc7PmlARd7PsaLs1sxDEVJEuPkDu4kFBvLLKs8Z18amLS/r/t/Hx+OLUsWmtgC+2SCW56mcRhQbKdlsP1+/2c89C4Eay4AtOM9DIM3B8vPhs1c7v9Kn5+OfKNaNvG0FZQuG24= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Farr3E8G; arc=fail smtp.client-ip=40.107.223.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Farr3E8G" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MBCq4mi+RvxoAd2mT+ClWA6UrpWT0Fi4sYQ1Ieai6OdPU6Up3bWKLvcjbhaDxZ3CQ9ofCDTOzqtBGRrkr1y/QTULXilMz3R5C8k+x+aEJyCw9dRrmrSWhxfnFDfvu97O5R7JfP8EiG9Wksgu7NzBfxYaACE7RiytbvPP6RC6eG20zmXp/72gSfVSIPm1eHHEF7nW2x2gtjvK1iTg/gWPM4nZbDx2mTsnMfIeCqF3mHs1aO/DLMqjd/5lSkvGk+8qESinpLZYLEbtIicmj0uNHVAJSe++5RZdOLQDnXRO4c/ZbL8fhUbXhT/zVcxMAX+vv+1yY++Fdkm6d/qlCqPXsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vtkwxyFexeLxcbZGAkTqqIHAJkPy4smtcBPdpWb/zD0=; b=RLFCMe4V6sFHi4oLpyyDd0s8p6DdlnXqGXJrR/Ho9a30FSJQjuJRrSnIKcidLz+k6piC56CklxEx78mcfgRYKm3Y2XGQS6pWlvL11TB08QhNH8Ad5Al/K96NbuZAXlrZWnkkHomhIa9hIgrnskvwSpzdfa1C0ACrf6W95wYf320T9tu66+TMvpbNjE24VPii3KA0xHWlQS9DzL5T7g1lWhW8lEy+6zRMjIBlFfq9+iwlnicyJYEWj72pzvHVQGcHs9X0BZ6BPwdnj2Cgxhk0AvNscBi9lkJFzMlV7QJiJkFZ2VebQAS0PJsHplAgoBdf1tuKQziBqqJGRwDWNc/N2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vtkwxyFexeLxcbZGAkTqqIHAJkPy4smtcBPdpWb/zD0=; b=Farr3E8G14/PF9bqVmbZDRN29OATB2nociVCskwByQlT4BFNWvUwUfyXJEgYPTtUW7/bSTmHobmsJTaZpl5u+MkoFDENgbJOqRtc/lAei/uUBebFmhaxjOxek5NQbbLTuvbng1B5D2w4KZQYWvrUuUm4v6JAw90LEH135aWA8rvm82x26DdtqGlFfvQCeZPKhFXLZjC0h0dyBBIrBKm/Vl6SLXubku5EDfEdabeyrNBXWv+/ZUDDPODf2grQZOeyh3ZTBbeKOZAQGATKyJmf/ny0pfo83HsOckMoAIKMarHaIuK8VhsRTiuKCZLNJPeehPDA+3orJS4cqnV/wRO0Pw== Received: from SJ0PR13CA0057.namprd13.prod.outlook.com (2603:10b6:a03:2c2::32) by IA0PR12MB8303.namprd12.prod.outlook.com (2603:10b6:208:3de::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:09:21 +0000 Received: from SJ1PEPF00002315.namprd03.prod.outlook.com (2603:10b6:a03:2c2:cafe::c) by SJ0PR13CA0057.outlook.office365.com (2603:10b6:a03:2c2::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.27 via Frontend Transport; Mon, 17 Jun 2024 15:09:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ1PEPF00002315.mail.protection.outlook.com (10.167.242.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:16 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:59 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:08:58 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:55 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:52 +0300 Subject: [PATCH vhost 18/23] vdpa/mlx5: Forward error in suspend/resume device Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-18-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002315:EE_|IA0PR12MB8303:EE_ X-MS-Office365-Filtering-Correlation-Id: f81206d9-9180-46ad-5831-08dc8edf74c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|376011|7416011|82310400023|1800799021; X-Microsoft-Antispam-Message-Info: =?utf-8?q?TCrTauFTUBgB1OM7vF5hracDpiS9B8y?= =?utf-8?q?Ca8423ytWBP9vTpMFQkD/7ZzAj1asueE+9bRYCNiaE6n7HojwxMQGK2QeMhBQLgST?= =?utf-8?q?Z4w2JFNfiTGILDVGaj2Vr7k3jynRnxizhJ6VUIIblA4EL5asHJYiDQnTz6mpHyuaS?= =?utf-8?q?1TiTawEI49PyOyIyKoAvMFZtqdP0I58gHHotxEKurlWmzKgQA4vRf1orxDyogilrb?= =?utf-8?q?um1dYdB/v5Tr1KSlvgZFYdxuLwQLnjc0yjgB/FmPPGB7eRHDsuUk7MJDgJd2uJcOM?= =?utf-8?q?aGwMkoD1l0S+nrKWxwNqeoYJLXVXqx/GEZhgrhXDHhCB7oo/xbUarSituHPL3SMZe?= =?utf-8?q?wdRLg4T91v3zTOFsiAAbIYGi6DFHsPjO9Kd4nT2sxep91J6MedwMeSrxhqajccSK4?= =?utf-8?q?pI3E+kTiCmH79s/E0OpTN01VcnSFyn7IKWZ/iR1zzB6eWWIAYaeRwSwfqOfxe4m2k?= =?utf-8?q?ijCnVdsUGzPSygy2xpVJyXk2Jg7mqunCT+VYw6aeoEsZmHYlG1AybbrksURGacHe4?= =?utf-8?q?pfam2ojd9HbMz/pXISyLVxmomDBf6mlFAsNfvEGMvWux62RWiew2d/7QwQz+j4Srg?= =?utf-8?q?T+S+EawEU7Nk09Hv1KndyMxJo9x/f627xdm+1Rd8ALuhz9BKGnRRV2OvJ8chC0lri?= =?utf-8?q?5F5zhmCNz1nMwHaADxtkaLEucAyQv0ukS/cFX5LkJX39Yi0/HQPtZYY+b9ae2zVlY?= =?utf-8?q?7asTkGY/lPqWoWYEq8ioWTG4hUxzx1YBK3wFknnU9a/ZxZqOYxQt2zReIOtAyICci?= =?utf-8?q?Y8uXftsjyj//RQD+kOrLZVbHsPxrTvCWVRCG+45ftrOrC1wDP0eEuQgNEvR7vw2+7?= =?utf-8?q?LQZvnpnAS42hXtbsT5J/FvhCtKY/9gWNvj2RkH5iC4RVOnUD9GarGtGVyJ4/egD1G?= =?utf-8?q?TUwM+tt9cEW5ATCbuG5AM589rFQGzWVxF7ewMOvw6kO7Phlpob8+nErARgY+EAK6J?= =?utf-8?q?SxfrPt1Yq5TgakIEdVIsiURAE9WIPrQ62H4EqmJeFt4pIZxymwyYhhMgCxy9/qo3X?= =?utf-8?q?4craA9Vr7I0pJ0lqCw7Wyl8aET/RcR58VedSljHIokaCp3xaKRw5+Hfm/cuCSd1T0?= =?utf-8?q?5iwoM7SuzmXhIgZbxtkaQh5nMO1kiL7rDpTH9HDnaLRjL9AoUQZJwkGxTujevAIYY?= =?utf-8?q?qGYoXYVEGOR3Fi9fU14WhZ/omiOB3hzanJaUQdQXa0GUVS8oWn9nBXh08ceT//b2W?= =?utf-8?q?Ynub0PfoiJHizNiuVxn8KZvzS8rZq2S5gahGLJyEPeoIduHa+0s/MBZXojlYSIVCO?= =?utf-8?q?jGPRq7be+dQ7lhKf4Uyj+9ytIEBTU0FQy6mC3BCGM6Z4ZC85CyhVsmAVQGrMGqdlL?= =?utf-8?q?3xuHqcB2JxOVMhlsPZm1cdoKaeVqno3duA=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(376011)(7416011)(82310400023)(1800799021);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:16.7552 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f81206d9-9180-46ad-5831-08dc8edf74c5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002315.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8303 Start using the suspend/resume_vq() error return codes previously added. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Reviewed-by: Zhu Yanjun --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index f5d5b25cdb01..0e1c1b7ff297 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -3436,22 +3436,25 @@ static int mlx5_vdpa_suspend(struct vdpa_device *vdev) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + int err; mlx5_vdpa_info(mvdev, "suspending device\n"); down_write(&ndev->reslock); unregister_link_notifier(ndev); - suspend_vqs(ndev); + err = suspend_vqs(ndev); mlx5_vdpa_cvq_suspend(mvdev); mvdev->suspended = true; up_write(&ndev->reslock); - return 0; + + return err; } static int mlx5_vdpa_resume(struct vdpa_device *vdev) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev; + int err; ndev = to_mlx5_vdpa_ndev(mvdev); @@ -3459,10 +3462,11 @@ static int mlx5_vdpa_resume(struct vdpa_device *vdev) down_write(&ndev->reslock); mvdev->suspended = false; - resume_vqs(ndev); + err = resume_vqs(ndev); register_link_notifier(ndev); up_write(&ndev->reslock); - return 0; + + return err; } static int mlx5_set_group_asid(struct vdpa_device *vdev, u32 group, From patchwork Mon Jun 17 15:07:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700943 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2050.outbound.protection.outlook.com [40.107.237.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9F8116CD32; Mon, 17 Jun 2024 15:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636961; cv=fail; b=fLWFhoj4NOTL96nbb/INcIt9og0ZYy6MQYZrYENm5w9Bu3tdwt72xtmmFnSba0jDlxy5/9b8B8XpPpAdOYY1s0VfQ9QQ+iVyEo2Xgk8SFhhddhJF442iK/DQTG2t3loZSquKWQXLPYogbg0mk4CYVeZxIEoSpIe+fc/kG6m0dbg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636961; c=relaxed/simple; bh=cO9B2CFnexmejsPEZHTRU8ShI2mV3nLiEICpLKNndk8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=JTn6CZwkVq/S1u2ZN/4rIs7s1tGuezKLYTXFgItbWOu7zTJi0nulQyS+DYdjs+Dnt5LV9A05A9Yhs01UE4U4wW7Dsr0AmYngokv6sxguk15cNsW4u7WH/rVgtaTBJMjV3xVUObD6Iql8dA4Ewwx8FcWNw1l+VSQUBXegmLeSExc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=F1x9Wobo; arc=fail smtp.client-ip=40.107.237.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="F1x9Wobo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JG9E3xkX1aF6g3oYzkh7L6BZeElT/6GEDMAWK8pMuXpwcFkznS0M7KKOgYv/jaGo37kbOWnico9VDZf1c/57try0LlxILSKkRQgl6JQJBC/OwShvjwLsKRyBR0XoQxZ0LyuqYo3e7a0CKb5VTXzYDyb0gmdEdUNQXO0AR2BTs5TL9BSm25M69z29NckizvdwJTMttTtceMqX36tx4pZia4iaigktgWaYd2zC8HABkXiS0P/VUOBGpPiHt6o3Zgaavy3WdL6vAPa9FGBNTE3l81au+Xqif5njU7vI3i/QDrXlxXFINjxtTGZm0LjZiO1GP4/Yp2xbOAAzaObXqzNRYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MNyGSAOjuLKEuGmFqtGAZKOWKdkcBTc2njKCUShGqjc=; b=Ef3tLxLZVqzRHY7UZOx5d4pRubxtXjzspTUnTY6pQ02e8uZWHi1okDpDx6UH2EB14N7m+SG3tcl3EyIxC44h/YClXqt6x1zN+EQsg2egEx8g3NohquYp3cs7+dPap5MrG/+49b+l+ueSgzJG/i/hoAUgofR8VZH9g/Tw43cakpyLKS1QZHES0Chi+Y7mDVTIsGSd0b5WVw3pABqwTODHWlrgGGCdw6CiDBoJCaMe8OGsJdDnWHZ+N6SGup4Z1fwzcXshEXkhLvqg6/UyuqeU/C9xHmkvMRDCw3ca1AqO/Dd+chHB2UTrz9qkNI7DOi+MESg1AdX5YNJsoXQSWy9aiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MNyGSAOjuLKEuGmFqtGAZKOWKdkcBTc2njKCUShGqjc=; b=F1x9WoboTXNCIJ1epBzrXAzt4WInRZU15+6BgqYpoJvZZQqxaZq0nLpaL79XBr4AWzivHyjbt/yxh6qTYfpHBqlKabUM3nalVsAYqQZOieoKNTKnIq5kobckPGTHbHpNEfTcFfcvlA/sF6fKBE7gVCM6nUOC7NIwFdzOFXc0mcvGJDnn9E/k5YOOPwQspunhw3f6PzKWRr+hlMAj6/PNJJeV99pzmoOKmGihDfRalhQqYMmKuCmYF1faUCGFE/MH7GOgt8TJB5K1m9EU9hmopzcEFMCJtbsw1Y/ZIkMK/HNgkJiFXYuMINohZu3DwX254IDFr4X3uBpQAdzOwtSe3Q== Received: from SA9PR10CA0015.namprd10.prod.outlook.com (2603:10b6:806:a7::20) by DS0PR12MB7771.namprd12.prod.outlook.com (2603:10b6:8:138::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:09:15 +0000 Received: from SA2PEPF00003AE7.namprd02.prod.outlook.com (2603:10b6:806:a7:cafe::57) by SA9PR10CA0015.outlook.office365.com (2603:10b6:806:a7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:09:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AE7.mail.protection.outlook.com (10.167.248.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:14 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:03 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:02 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:08:59 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:53 +0300 Subject: [PATCH vhost 19/23] vdpa/mlx5: Use suspend/resume during VQP change Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-19-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE7:EE_|DS0PR12MB7771:EE_ X-MS-Office365-Filtering-Correlation-Id: ff145d02-25c3-4663-b00b-08dc8edf73bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|36860700010|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8mvyK2T0Abe7AbkmFdZ4rbv2k0mT5Yx?= =?utf-8?q?Pu4PaADUbQt7KBACel6U9iTmWgIA9uONzC0itT34/Oe8+0DHnH0xW/OOYRjmwWJSR?= =?utf-8?q?EgmZLsT7zT0wywct9je6ht1t0yJffK8dU1Fhaie3S/oE72C7vOAIQzQ6/zQTrDmu6?= =?utf-8?q?LyXcFwp2bcZb2KiDWEhnZH3S6GoVoD+KaN9KMy2M174OZYbFQShRdvAdPrH5QZf5K?= =?utf-8?q?f7uH5nn4tCeaAxhfxhh3VZp9d62jYCV5NmKb0O2DeQKbAU8xdTIoQoqlNEKagNz1v?= =?utf-8?q?Q5bhsjv57PVP9mg7+HxO7nkIxYirFCUnuTTuXAxdAiqYqp5uHxA1GhhpwlZZaARlV?= =?utf-8?q?MM3cCwlv409jO8OflRhYv+csQxJA6VtAA6VbUQcsCQjnjXNO2x/Qi3rENJWFwJGFL?= =?utf-8?q?AJVcHL6SaVKbv2dW6mS7KClWmni95aIBmfApOBJ2StSVnmI4a/x5Luasj4Go1hEj5?= =?utf-8?q?HXJGlCKRgYbPfB/CO1ZagH8RpQW3ccErdT50KxNdZp+79+S9DdfOQi+GB++Y0mlh8?= =?utf-8?q?ILT10rd8D1G0bRVr43Pa0N0aJcAI08+TLACd3jYmg73m1r9n5lKf31U0uy/ZMcENv?= =?utf-8?q?I4EG5yzuqXqEDIL9T1DXpakZ553RImdt+dX8nRydFxFZ8mVLzWQRZm7biVOdE4IgF?= =?utf-8?q?4aR6FqaZ38i7SpuqGpfjkOt4u4JyURqO0i0RC+BYzCUTE/q5oiYncR5XeeIjQj23w?= =?utf-8?q?VDS8ML1p8A7wtNIPPrBXRScJoqtSs1azrxy56a84PwrBCECFiw5+1i3rZ51lr79dM?= =?utf-8?q?sKUCR4yT0PfUzZ9TWLZp5WwsuWM5e+yFSQWGeYcARFnFl9KogNoj9OiL7bnFIdLLs?= =?utf-8?q?yM+UFneCr/68bwjE9cmHV8TCPlf9ls/mxdLZ14wgzz/4dYJP3TVk+VIkrS1cXYxsN?= =?utf-8?q?PKxmMnD+zUcVkgasWjItHl4qCLao6QXF+hOJrm0PkXQImkYdotp9NcVn/+Ivx5oY6?= =?utf-8?q?5Eb02umnHxQQgIExw8JArO0huoxl9xmAH2DJnleeseapsvmEkIfVOd1o1WJUXzN7J?= =?utf-8?q?t8RfRVWvSVPv9Evb499jZzOso8KKkPt8gJcCmxdEWPJbttSYPWa0JcTdIVOf0vzdG?= =?utf-8?q?zmm4oOYTSQJGy+Kglgo4UUUVQ1DcUhZBNPoGRxv/N8K9Tp2fjHClz/VztqOik/Z4U?= =?utf-8?q?6HE82nTg3NCw+C19K+gYAtfTsCmZjLp1LZhU7qLlnt07ZJcawFp/VZrRK1Ak3fxJ0?= =?utf-8?q?U60GsWLccwY7creiYiTD7kxSvu6voDL+MB/dkjgHpgdmyQiRPJ/CbQMPskeM0JZTC?= =?utf-8?q?e6/O5cUOCMRdg8OvESzRPv6PxwDSLsziO9p2GMhZFOVHpxUGDgfnMnR6e1GmhbKOu?= =?utf-8?q?ZAzNT1/HikFsOToRP/31GOjcMKzjUllh8w=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(36860700010)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:14.8958 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff145d02-25c3-4663-b00b-08dc8edf73bc X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7771 Resume a VQ if it is already created when the number of VQ pairs increases. This is done in preparation for VQ pre-creation which is coming in a later patch. It is necessary because calling setup_vq() on an already created VQ will return early and will not enable the queue. For symmetry, suspend a VQ instead of tearing it down when the number of VQ pairs decreases. But only if the resume operation is supported. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 0e1c1b7ff297..249b5afbe34a 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2130,14 +2130,22 @@ static int change_num_qps(struct mlx5_vdpa_dev *mvdev, int newqps) if (err) return err; - for (i = ndev->cur_num_vqs - 1; i >= 2 * newqps; i--) - teardown_vq(ndev, &ndev->vqs[i]); + for (i = ndev->cur_num_vqs - 1; i >= 2 * newqps; i--) { + struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i]; + + if (is_resumable(ndev)) + suspend_vq(ndev, mvq); + else + teardown_vq(ndev, mvq); + } ndev->cur_num_vqs = 2 * newqps; } else { ndev->cur_num_vqs = 2 * newqps; for (i = cur_qps * 2; i < 2 * newqps; i++) { - err = setup_vq(ndev, &ndev->vqs[i], true); + struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[i]; + + err = mvq->initialized ? resume_vq(ndev, mvq) : setup_vq(ndev, mvq, true); if (err) goto clean_added; } From patchwork Mon Jun 17 15:07:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700946 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2075.outbound.protection.outlook.com [40.107.101.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B45A152DF2; Mon, 17 Jun 2024 15:09:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636970; cv=fail; b=MdThaeoXAFG5nJq1UyLZ7JmMOOD6rC8dCnl1fnofsAG7V4VzoihDK9riGtGmurtm8tzCVPSTWvzDxP84bgCvsm7dtf5x7Jnxh9tJ9540seR+pO6OjdwoIpXiEbOsZkiKrXO/DMIwC/E4/GKpgtg1R4SmyAQMHGO2deCURwEWvd0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636970; c=relaxed/simple; bh=nTfUA3+eeP+LjaQ2b4SdWdE3/SHoPs4LUPwULAsEpKc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=hFNgCYW7p2AaEB1yM3YPu2a2GBgArYcGZg6EkG7tDn9x0ep3mebC3GUziivA1rDVI1dc9RzUqZG7sb/mtvSXMPtSsK0dI7iSmelbIklLOizG84GIRCyQJnXXK0P7XFw15chFRKZxKyKypYQtI0hKwfUCGW2ZaAmAakPqvRiY6QA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=YUJz+LgR; arc=fail smtp.client-ip=40.107.101.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="YUJz+LgR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YUCOie/OYXHpvBOZeDLZN7CFcD8BMyAmtnoipWS3mb10msO3Y4L6+DJbjMLKLY0j0sD1x48HxNsR1Op8w6upeGTSmkmPDDQO/B2esRndZRoaTL6LrMpjmOVX6UBBQ+xoqJGAd9FL9JdWGxqv44gaR04lnunnnZL/OPSqOgkAhfI50VSOqImwyPAT6MiOWyAww6IwRDJrXuKkFp+tmBpDiDmCPpMu3QGE0y4NUdurwuhSBa6ppnEnMiJeKf5DZMoScqpuozJBaHMsQQt6Dj/3cewtVuDEa/wi7hWm9H6DoG0+pAV4VkZa15ikiw1kooH10chBLBi0ShM10XTVPAML2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B2P/m400lrNpunlyWcf3KblMIoK4PdhXSvMi48p9v58=; b=KBHNDk+wnFgKvk9imjpBfv44+kTdWD3CoWS+zIQDPtsHg+R+StM4fAnpE28yzPPHKiiyrMBq+UoqfwF/82QHCGk7UyDW5VVNuuVGWGdA0wPRxp3t3NBRzjBrkTqQSMMwuYliYwvutqMBupUayV5VyuQG4t8WnfVAn6ZXWJQviEDL9CECw06sm1Txcd0l+2r3sRHF17+f01fFh0Bkr3bAsYIo8m/OybkQ6F3mhngFwQ8nC+7PEhbTQ4v43dNy8tk500GIitsRypZChutzSMZdqbf5RzrfV39zTWFD7RSbNjpqmzTnAhw9FyQfQuLIDTbJC5UE57BQn2Sg2T9i8Qgdpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B2P/m400lrNpunlyWcf3KblMIoK4PdhXSvMi48p9v58=; b=YUJz+LgRSGrzEQOjxMmHInObbEr9BU+zq24bbbXufdGOUIAWrycj6yQlYzba8kBAotLLZ+2aST/8oZuuAyJExISCYcvSm5BYsB+sSxls9YStzvl3ucdaG4DDmzXh/OZCNRLEUvgAF4JISRbeV8NAHV1W4vMnCwFgIAiDGA74fJYDTV80KzXuUNEpeZpVy10o4DJQgN3OE/+XsljeDfa/IG/sto3dh3K/3EMbSTCv4aW0NyATSXOY4m5xh9GzebDTFR1PnqM7497MkYyABpkvtvOGewZjI2kw5C3fGypZvM/xRyEe8lRzpT41jBwEgsf5hFsTN+ylZqS6hYie6cqMQg== Received: from SJ0PR03CA0122.namprd03.prod.outlook.com (2603:10b6:a03:33c::7) by SJ2PR12MB9239.namprd12.prod.outlook.com (2603:10b6:a03:55e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:09:25 +0000 Received: from SJ1PEPF00002314.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::41) by SJ0PR03CA0122.outlook.office365.com (2603:10b6:a03:33c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 15:09:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ1PEPF00002314.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:25 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:06 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:06 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:09:03 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:54 +0300 Subject: [PATCH vhost 20/23] vdpa/mlx5: Pre-create hardware VQs at vdpa .dev_add time Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-20-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002314:EE_|SJ2PR12MB9239:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f09d0db-13e3-46d6-6d88-08dc8edf79d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|36860700010|82310400023|1800799021|7416011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/33UDwa/2nJQnWMfYVXBkUJRWAgQ/m6?= =?utf-8?q?zE4L+u5dzOF+w03wuGvlQyOjb7oTjYxKwYR6MZhwzYcPXcYtMvCR2NG7B9Pk3jgDC?= =?utf-8?q?l1QLUvmchMQDYcrsKwPT5WrehFwd4tyGYmvsRrNtuEXL/fo6xXVitiWOTcLauMnOf?= =?utf-8?q?LbbA1iRgvlA6kBNF0ttsmsg27IorCkiIfXU64tF+G088Mm1hajyE2wrClKvozPoJW?= =?utf-8?q?0NR27fHyfq1KLVX939TwQYeqvn2p3XkJY1IH5OGgqjRXpqmhrDll34ctFtlp+qUUV?= =?utf-8?q?u9wxPQ73Z7uLo1icaJTrrK9TSmkB034zUd42YwK5u3HSBg2quTN3GFPrLhmaT8vp5?= =?utf-8?q?yZSQJ70EfmRTPR7kcDEMgfu+u3QQKPwHFrjfNGggVdd3AYMKNK6+5fz9E/b8/JDHN?= =?utf-8?q?9n977DLwNib83/iPEUT1gfbrldgxe9d4YSO/Oam4v71zjQufthEfrMUn2O+y6TfdD?= =?utf-8?q?JnGzPVuabLttWc22K40TOPZNqjLg/NegD0RO3s8WaLR/ncFjuuuB3hjbRKxYLylJg?= =?utf-8?q?zwcQUrzuLIffNJiMEV8skf3Wr8pah9O8bh3vmwFyhza7xcuevC0g3/Qao3eFh0XjF?= =?utf-8?q?xt8BidKuA4ZHYhmnbjdnb/ox+sqC1oWFPnOxBJYsDyhreuDidRnS+7i/YYFkMw6Eg?= =?utf-8?q?aRTZjSdzbYBAw7//scM2VA+SDLF35ccQH9y7UHTunihsJ1F6qFfrObAwo7jRy1181?= =?utf-8?q?J11VQ9iIvk3jKM8O8W4ijY3QpwIb6BnFpgTKa+1ggHEku2WjBSwEclK34/nhp8rrp?= =?utf-8?q?wrJshakJhM+tGAGksSlVHdrH1P6f0ulsyHTHbqtmqKACvQEkVHiX65ouqHiX6aKPJ?= =?utf-8?q?h+bQXZ3Pnm7uvBK3MUppr0nyK5j3UGJQDdjs326HjCbo9ictApWECQ8TpYPMBXGsN?= =?utf-8?q?5ITYc00M2FWkHr5cz/lJm/HbbAjfkhsbE46wY5QCxNaUsMCuN+Kxd+qmVkTp1wVc+?= =?utf-8?q?FDvSKdajWilNy9gHhbh1Z7UtXT63+s6auJnq+s1/hcBlQ5CS5nO7HbS4E+Dze0YDz?= =?utf-8?q?mRGgn7rVpgc10qG6RTiVosW/FLaRyZpEjK8EVH4fUbaE7aShY84qHfXB76lcDZHEr?= =?utf-8?q?JYoHMmbjFKu9wgX8tKIrnAOE8SOKQoC0YISZxXg/AO6XhpWX5XXSowsgCTD9ObMiT?= =?utf-8?q?vuhNflUsywcoycwqRp9ZdNIW97VUs4Npx79NfMkLzMGGNHYDDEs6edSiJqj9PQPd7?= =?utf-8?q?l3RWRYQ2D2d6qtiEXSseyGFne0P14l+C6yYEP9gHyE7Fgmw8paeLbAlyiB+NZ4OmS?= =?utf-8?q?BnE0GXFfDUFU5gXVV1YXS7/B0tV5kYKcpE78sai1WLoPFO6E/9OafCWRNINwcpnYb?= =?utf-8?q?lNdUvaZTJDrm7HLCIsMxE+70OdCJJuvi0Q=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(376011)(36860700010)(82310400023)(1800799021)(7416011);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:25.2205 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f09d0db-13e3-46d6-6d88-08dc8edf79d3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002314.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9239 Currently, hardware VQs are created right when the vdpa device gets into DRIVER_OK state. That is easier because most of the VQ state is known by then. This patch switches to creating all VQs and their associated resources at device creation time. The motivation is to reduce the vdpa device live migration downtime by moving the expensive operation of creating all the hardware VQs and their associated resources out of downtime on the destination VM. The VQs are now created in a blank state. The VQ configuration will happen later, on DRIVER_OK. Then the configuration will be applied when the VQs are moved to the Ready state. When .set_vq_ready() is called on a VQ before DRIVER_OK, special care is needed: now that the VQ is already created a resume_vq() will be triggered too early when no mr has been configured yet. Skip calling resume_vq() in this case, let it be handled during DRIVER_OK. For virtio-vdpa, the device configuration is done earlier during .vdpa_dev_add() by vdpa_register_device(). Avoid calling setup_vq_resources() a second time in that case. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 249b5afbe34a..b2836fd3d1dd 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2444,7 +2444,7 @@ static void mlx5_vdpa_set_vq_ready(struct vdpa_device *vdev, u16 idx, bool ready mvq = &ndev->vqs[idx]; if (!ready) { suspend_vq(ndev, mvq); - } else { + } else if (mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK) { if (resume_vq(ndev, mvq)) ready = false; } @@ -3078,10 +3078,18 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); - err = setup_vq_resources(ndev, true); - if (err) { - mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); - goto err_driver; + if (ndev->setup) { + err = resume_vqs(ndev); + if (err) { + mlx5_vdpa_warn(mvdev, "failed to resume VQs\n"); + goto err_driver; + } + } else { + err = setup_vq_resources(ndev, true); + if (err) { + mlx5_vdpa_warn(mvdev, "failed to setup driver\n"); + goto err_driver; + } } } else { mlx5_vdpa_warn(mvdev, "did not expect DRIVER_OK to be cleared\n"); @@ -3142,6 +3150,7 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) if (mlx5_vdpa_create_dma_mr(mvdev)) mlx5_vdpa_warn(mvdev, "create MR failed\n"); } + setup_vq_resources(ndev, false); up_write(&ndev->reslock); return 0; @@ -3836,8 +3845,21 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, goto err_reg; mgtdev->ndev = ndev; + + /* For virtio-vdpa, the device was set up during device register. */ + if (ndev->setup) + return 0; + + down_write(&ndev->reslock); + err = setup_vq_resources(ndev, false); + up_write(&ndev->reslock); + if (err) + goto err_setup_vq_res; + return 0; +err_setup_vq_res: + _vdpa_unregister_device(&mvdev->vdev); err_reg: destroy_workqueue(mvdev->wq); err_res2: @@ -3863,6 +3885,11 @@ static void mlx5_vdpa_dev_del(struct vdpa_mgmt_dev *v_mdev, struct vdpa_device * unregister_link_notifier(ndev); _vdpa_unregister_device(dev); + + down_write(&ndev->reslock); + teardown_vq_resources(ndev); + up_write(&ndev->reslock); + wq = mvdev->wq; mvdev->wq = NULL; destroy_workqueue(wq); From patchwork Mon Jun 17 15:07:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700945 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2089.outbound.protection.outlook.com [40.107.95.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD62B153511; Mon, 17 Jun 2024 15:09:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636969; cv=fail; b=MBg1XD8Y44o/aK39YvU5PpfSQMeu/DKO+St+iXboeKdGtNIpwp6+KIVnzWMV2Tvj3qBvssIbNq2xM9s4H0h8X5n2jDRY9MM4H8Z77mqa+QMRRjvwvCz/+3XUnkphmsSsqUWsSF2liI4+jPLeV/EpkzBsdfTXHmi4JWWrhklxJEI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636969; c=relaxed/simple; bh=nGrkEuM6V+w5uB7BA28bNQiRi0JlbeBt8uw3GSdO/i4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=GJ7h1p5g/3zm/bCwzkCDoKxSRlvZbHehyUz07Fnzc47qg6/Q2NW+XxG4iHWRk8sHClTJvqr2NkeTRyNidmCwyOV8l2XU0MS1Mqc4IG3pnGzHivp82H2otXfjM5Mv9CvZqyf+LD4QR4eD5Dtb/yN2Uypo/bGmv6WSi9dML5kXxZQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=ZhIk7L8C; arc=fail smtp.client-ip=40.107.95.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="ZhIk7L8C" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P7aV66aVW8/WiLJv2IC3pBuUg6oM8f/LV7Ui6nZ2PvSujXdBhPQ/j4x+bcCzq//LEQTY/u0Gw3qh39NteOMN0io0mf7IQoLv34DRY9fGqPjZOLlNzYZaLTj2y6KZ3mzC/EfSI53pP8xJX7PGusLmiMB6plvn7uS03A3bz4dzgF+aEhiYTRwxP0ZA9nD+N++TeK7xAGngNWZngsQ+gPN+qfKfLlB4zH6WHWJTA/okQdmbSHgH3JxiR6Bu5i5MUsDnGT4hRi4OjWdB1cjMAkOZwIG6BunUDwNNC9FtqskNtqONTQgS+ihkOUUBiZlHK6mRo8jD27y72Yeh8CGJtGq6MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bBnCTbq4ZFBVLXlkrqTHPkFV/4UN4TiMr0Pk3hG0w2c=; b=PchHgmbvUi9WURRkamqO76XbqUo5NBVMn7WLBYQBShRvYGHUG1V0eZ+vMivkdz2zX3/vs5nhe7OQFRkZksaLDkS3tNtQEQcjoC9RliQghu610kLewPK1GMit/4jjWIbSbM2bcnzL/pD28PhKPMQe3rkPaziK93VATdfw13o+4zZngjlfJeZPXwXe6hP9F/Se+pZcLheNAKCK9z7LgzDI/GF2Lr8Y6JNuDEJiMgNuUUa6wl2lh2ZyB/bNguC36BE5DHRqKK3CwwJGCannVdiUDK+1yOO+G19AQqbWBZaZBOT+8CRlVETTfXeneHysf1+zJEh5A4CGwIW8KeCFw7K58w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bBnCTbq4ZFBVLXlkrqTHPkFV/4UN4TiMr0Pk3hG0w2c=; b=ZhIk7L8CfkS3NK3FsqzafukzYEqBU+tSJI5460DhY5+4LxhllEGfoki/SsaUdA9XocEb6e7gCNL76xiJQZ1GW3/NiaBY4a0270VqHOYa/+XnOSrofrDb4bWqq/0dM+/HKeQbpqSyEto+dTl0SYthiMtWehwaBh34vqpwzOniTfnsp8TggWzwsh6TZuLjGrIdsBviZjfELKeyNJm91IqbqVbJ6ZGbdaddiLhedD9lNC/YwcmoAaYq1QvojT4ndIbLRL1TMLya+UYtj2eAsoiBMzZ8V/dSLfpZSQ+B0WmS9JMTpuY7XOYv5fex4apGBK0HkhmZPYNl8E9A9Fj+2z31sQ== Received: from SA1PR04CA0003.namprd04.prod.outlook.com (2603:10b6:806:2ce::7) by PH0PR12MB7930.namprd12.prod.outlook.com (2603:10b6:510:283::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:09:23 +0000 Received: from SA2PEPF00003AEA.namprd02.prod.outlook.com (2603:10b6:806:2ce:cafe::6b) by SA1PR04CA0003.outlook.office365.com (2603:10b6:806:2ce::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 15:09:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00003AEA.mail.protection.outlook.com (10.167.248.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:23 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:10 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:10 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:09:07 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:55 +0300 Subject: [PATCH vhost 21/23] vdpa/mlx5: Re-create HW VQs under certain conditions Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-21-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AEA:EE_|PH0PR12MB7930:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f249845-61e2-4aa7-da77-08dc8edf78a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|7416011|36860700010|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?BCmAkK4AN/vOMg2jVJHR5Ox4KHHBjRY?= =?utf-8?q?vmN8ohaMoN3GaK/FtxFXZiQUorQvcsOFzsMbFU2jUeYA1hofvRThmbPHdCoxmMgy7?= =?utf-8?q?B2KFqldktnm5KSBbLuGedctY9kLkJIh5DBe7PC9uRAP0W4OodTHJB5lhdNPW9ReDu?= =?utf-8?q?RXZpE++0VfDTC+z3lV6uYA7NivUGCB1oLxZNmlvLzB163Bs6EiKFQZAwyPHlCoI8M?= =?utf-8?q?0/3mcJmo0cimW+VNLByA4RuR8VyqtSH1g+4GXBb56lXK7QwkMuA4UQz39PoHMOYnx?= =?utf-8?q?p6BHaYPuW2HYfkT4PGg8MSnj2/o2UEtxyHBBqO3Uwo0+cZMQJXT+ooS3kVIUYZzg0?= =?utf-8?q?hHbhr61FcBUnkPIRO5hxTu6W/kqfrsOEmNQRkp4KnHUgQ6ONMuVjvjg2OL9N9+AeG?= =?utf-8?q?msnYYMBJvKYBoKtf/ajsDxfStPT8OrA6/ViJY6tLjAO9MKYvX2EIY4PVvl2oBS+yf?= =?utf-8?q?CVhpXeWjYu3rhlWtPn74yDu6vESW2WBSOpvbGq9NUk69A7UOmJE7PJfl4AmozQljB?= =?utf-8?q?xPLPHyrmoi4T06O+OWaa5VT9blqfa5Cda982K/kl1XCZ2KyZSvN1nHbVyW57w4c2P?= =?utf-8?q?/WKBtGjIz7h3dzDTebfiqIASfh4QyR1ySG+VC/+ARdzEDArg3DZFj9ofLtUm2p+bv?= =?utf-8?q?5bZ6eeWPmLU+HGRlL/Q2pdl3thMEAI/coAIYNdHu6p/qhZRYKx3bVPcxgfkMcTq+F?= =?utf-8?q?/bTiKufVAn/NF/Cw0neRTRV0GU93I81CDTvGMa4lqbGSV/fBpvkva1+PflcHYvSla?= =?utf-8?q?e6GGGH+cTOsXObSmOdsS8RFir2NwOfX6NCWgL15IeoXi0dGSzi0OFAmKyE/KNx4z/?= =?utf-8?q?Nr+47KuyCUPL3Lb0YqHDZzLFR1Dey6f4lXN2P/pKK2FcHcWSoVO3Rp+s3c+ioYo05?= =?utf-8?q?B9sEJp/lk82xrLBj1S+QvXtrXUSnRdgrYbwe7OWYx3t0JNK22/oXT6dwH0C6cEJIQ?= =?utf-8?q?qDqVJocPnCYMTUCg4wcvMD4ho4QvLab/V7JrBEPRlmgThZT9ktqkNW1iICbQPfER8?= =?utf-8?q?OOXaYhYQn62TZ0+XpHfMqk1drPSDbEsX4NCAlXtXh3k8WJ9mnz1IdRJWNmUTIeVq6?= =?utf-8?q?8IxZmfMSFd5j/LIvA0ejbv+vgyN/VwBOto+RHCpYcibQF3PTnCIpKYjkSo6B1WGpr?= =?utf-8?q?oI6UAF6o8nq9GiWclLiW0zI+k6/TLB5Swg8xp7OkWl/RGrT87I9hr/4MT1uMEhTBZ?= =?utf-8?q?MpXR6IX43X97cyQCO5mUXokZEgB7G2465TzB9vxvWfG2k24ia+h160397K5JyKPFF?= =?utf-8?q?ubDweqOL625RYRoNb30vtzGyPUJyhY8V7uPF3VYtLx2RXGhkt3fAymsDbNrLpEJrD?= =?utf-8?q?tp/rBDzrmEjKNJEYAgBnvQ3rhn6/Rjnq9Q=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230037)(7416011)(36860700010)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:23.0551 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f249845-61e2-4aa7-da77-08dc8edf78a0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AEA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7930 There are a few conditions under which the hardware VQs need a full teardown and setup: - VQ size changed to something else than default value. Hardware VQ size modification is not supported. - User turns off certain device features: mergeable buffers, checksum virtio 1.0 compliance. In these cases, the TIR and RQT need to be re-created. Add a needs_teardown configuration variable and set it when detecting the above scenarios. On next DRIVER_OK, the resources will be torn down first. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 15 +++++++++++++++ drivers/vdpa/mlx5/net/mlx5_vnet.h | 1 + 2 files changed, 16 insertions(+) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index b2836fd3d1dd..d80d6b47da61 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -2390,6 +2390,7 @@ static void mlx5_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num) } mvq = &ndev->vqs[idx]; + ndev->needs_teardown = num != mvq->num_ent; mvq->num_ent = num; } @@ -2800,6 +2801,7 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); u64 old_features = mvdev->actual_features; + u64 diff_features; int err; print_features(mvdev, features, true); @@ -2822,6 +2824,14 @@ static int mlx5_vdpa_set_driver_features(struct vdpa_device *vdev, u64 features) } } + /* When below features diverge from initial device features, VQs need a full teardown. */ +#define NEEDS_TEARDOWN_MASK (BIT_ULL(VIRTIO_NET_F_MRG_RXBUF) | \ + BIT_ULL(VIRTIO_NET_F_CSUM) | \ + BIT_ULL(VIRTIO_F_VERSION_1)) + + diff_features = mvdev->mlx_features ^ mvdev->actual_features; + ndev->needs_teardown = !!(diff_features & NEEDS_TEARDOWN_MASK); + update_cvq_info(mvdev); return err; } @@ -3038,6 +3048,7 @@ static void teardown_vq_resources(struct mlx5_vdpa_net *ndev) destroy_rqt(ndev); teardown_virtqueues(ndev); ndev->setup = false; + ndev->needs_teardown = false; } static int setup_cvq_vring(struct mlx5_vdpa_dev *mvdev) @@ -3078,6 +3089,10 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) goto err_setup; } register_link_notifier(ndev); + + if (ndev->needs_teardown) + teardown_vq_resources(ndev); + if (ndev->setup) { err = resume_vqs(ndev); if (err) { diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.h b/drivers/vdpa/mlx5/net/mlx5_vnet.h index 2ada29767cc5..da7318f82d2a 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.h +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.h @@ -56,6 +56,7 @@ struct mlx5_vdpa_net { struct dentry *rx_dent; struct dentry *rx_table_dent; bool setup; + bool needs_teardown; u32 cur_num_vqs; u32 rqt_size; u16 default_queue_size; From patchwork Mon Jun 17 15:07:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700947 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2043.outbound.protection.outlook.com [40.107.236.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 645671741D2; Mon, 17 Jun 2024 15:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636975; cv=fail; b=FkyGP9GlcYLLLVc5yjR7WJKglvEG5ZafgXCPHHRwWFqBVYd9702bJFsrB5LIx+CmzwABGpnhpadvWUPVucRcA5PT1OUnQCC8NMmDvdWN+kaqYyZOamTrHYD/eRnAtvrFhdHj9HAe0U8MhrGftijqU1uV2JteRa7R9zWgN8sAE7Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636975; c=relaxed/simple; bh=+VBdGMxn/rBdO2GAbI92QfqGAXTZEbLJD3LmtxOBV04=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=puUjoCel63BUlCsdedObajZsxZeH42k9v2KNZZj244CzPRrJRndfOo/DX00szDc2uZ7n9v8PJCbuZxAYI662pFlhzWeyN0/JL+sqT6Xm+lAieWrUURi73MFGXwucsWuRwogmn1Rf7iz62Gjjx1Cgz241uJkXxxrY+mQzgZp3mzk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=s2O88Rms; arc=fail smtp.client-ip=40.107.236.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="s2O88Rms" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hs+0iCsaArkZSPQiPcLCF6bagQU/mn0yzbdQcekHjS2jArtm5pH0uOD5sYW2P78Z+mg7/laQ8pktfkc4h7962nPufI0MlZDnId74qfpknidsGT2f2KlUBOn+crUHdR/YjMz5J00io4ByalPVFVfRlKI2dtfpiZCsd3Jw2Tdvrsoq4xLDvjRqGWZD4eOhjtTVoEExIbYbhx+LMnqim1XnR8OjryG2Ou7Q6YvHLmnOFKXWlFKg/3aW3WctHDto2b9mZI7/eZHPerbfFOET1BMtsot9xflOXrxz9Mw4onGvW0MdvCEPfc7oXfxZXwYhcMKmIQLJCpEb0It9VZzk7uShfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ARe1GYtbXbk/p6QVycKLEeBPZAEGn+VV6msIbmlUYAo=; b=O9gxYzlXwBni/CrDFGwnoeczUyvdcA/lXUf9/F2iRvgLny9j1whRH8rnBtoPgKekf7Un5jkKwiIVVvuEVr6A3Fbdqz0Ws8vYOO5psjMPby0HTpiXsC2Uua6YT7e7BnOoP7N9xBvj7XZNZ1wN3enZ5QlAFjwkCfM7iKp7VX68UQsgTLzO1GispoP36Ill+HDSR7n3LFGeHIh7cKTB1/Nii3n3MSb2aJ9k5xl4Ods0DmGI7yy985inJs1TPlnU5nFPc3sXYo+wwQMvjWw6cLslXdzjTmztX1CuqccuH8rF/GTJ3npQL1PxOzkKTY3RAp3lV4bc+4IZZDNWy6sgRwvL9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ARe1GYtbXbk/p6QVycKLEeBPZAEGn+VV6msIbmlUYAo=; b=s2O88Rmsctj1iqLweTye7XvYbXjKKM1eC/Dnd2b1JQ6A4BTh5Hn6L+Qos6POXY5ZH5DYx3l7PqN40HtThOOOebN7Tni37SY2CyE7ZFTBdJesXnyMImBGXUHwVOYxIjXzd2mW5x0GGzaLCpYjuOnm7KS0PmU2L4cnzG5+Hg9tv4R7ed9AcDieG7GrESq8q5DrM5KZqD/M7il3j3vSG41INUVUoFvR70x5YGbUxw2uvmJ6+42LC58Fu0Nn121DsOgseMMwmU17VNH6Fkc2KH/zGRULLdReF+PJaDqdSoYZ0JJhPSYPwncV6KOkkHJYQjY41IhwkMWkNk4GFY67AqTSMg== Received: from SJ0PR05CA0065.namprd05.prod.outlook.com (2603:10b6:a03:332::10) by SA0PR12MB4464.namprd12.prod.outlook.com (2603:10b6:806:9f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 15:09:30 +0000 Received: from SJ1PEPF00002310.namprd03.prod.outlook.com (2603:10b6:a03:332:cafe::f3) by SJ0PR05CA0065.outlook.office365.com (2603:10b6:a03:332::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30 via Frontend Transport; Mon, 17 Jun 2024 15:09:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ1PEPF00002310.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:29 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:14 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:14 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:09:10 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:56 +0300 Subject: [PATCH vhost 22/23] vdpa/mlx5: Don't reset VQs more than necessary Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-22-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002310:EE_|SA0PR12MB4464:EE_ X-MS-Office365-Filtering-Correlation-Id: bbeef19e-ced2-490c-0601-08dc8edf7c84 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|376011|7416011|36860700010|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?5CV6Itl7oCuvEjAXGhRL5j6jspCJbOO?= =?utf-8?q?Viz5iaDxeGj54+CZ+ZqOa/IagQe8I45PoEiA2Kwmgm1Wld52B851yTV+FuuvQ5lEk?= =?utf-8?q?4sLyEEpVwWW9RYw2DHmD+gVvAjkVIThgL5E7v/6YkdfXZWLgLbJYStCP3JfGIZk45?= =?utf-8?q?cTxv9Dly3USjbC8xvWorKTuLOpGH9OXhlN3ywMaVmeQ5kSfLqmCxU3zgB1M/+4w8k?= =?utf-8?q?zU+1FkDbgu4MNvSEVG5bWD2A5RWVhbK0kzO9i9I9RV0uPvs1BD0MgNddHYHL6HxwU?= =?utf-8?q?2PPjMpPxTUd4xct2TGdoTwOkxRxPBsiQbvbS18eSv/FHxRtCdW3XVjXrvfTZLtfe6?= =?utf-8?q?3JpMWT4sNozTSnhmueAJ3vbY+zjiFIohcafbPUGfkPEeWBD+w72MRvUfnMO0L7ltM?= =?utf-8?q?IS0yOdgdcr29ZFA7BFW+J34vR/iXbjGBkv20DsjFRxpGeKaj9Jl2W080R1Ah6QhU8?= =?utf-8?q?WMAJpOcFJF1PbRpYnv3FSg46MPR8l4jBBKsswkOga+Wi2b/8COdkcuTS1cZZ4VNLd?= =?utf-8?q?FdqNA9J4wstB6+So5LW3rhY5knwe0OoQfgLjOeZe7HpT1GcF/q9XUJxZJP69VqwV4?= =?utf-8?q?RGQEVFQSp7o876Da3mdoEDEwPKRyKOPXjk6S69HJphilXg3YiGXGF3cZeVGDAa4A4?= =?utf-8?q?7xXNe2R80SIPBOI2ChsxxSuPMWrfX4l0+3Bt9BG1XuZYESuui1lQxSDKcEer5ahDz?= =?utf-8?q?CwDKUvuY1FKRYhKccod2qoNHxCfN9GM+nqCqmse/ngiHKsrH64b6xJ1KXZgBATj8K?= =?utf-8?q?f40biw5JfDKYiLANBWmNi6i2tFJUY+KxdAcEsJDRXzIya6e/anoMuHHv3jy5biakb?= =?utf-8?q?ewJ8MHYf2tOyZdnA0sHGdbTGUMX5jDiZRgP1FbgeZL1wdImV8qOjuc+02+SlDWkuS?= =?utf-8?q?PeFOT7qegyOfgsJ2xjDBkCuO79Wd/Fyyz44fliHSPXxFCoWoiiqcOOjjp5YDqE84k?= =?utf-8?q?wZHuwKgQCjSQB/PTZ8CCxILgzwrjt70kKNwCUwqgOFyRMV6hf96qdyVlxTLro0K2X?= =?utf-8?q?bohe3jYfVn6naHby/gsu4t6X5FlNJ2ajLmnryXXQKYg7tfsBl92GfMBTQnUcpLgYK?= =?utf-8?q?nULKHbfNbUIF+jTUZEH/LXgeAwebffKTgE74JLFBtZnPXTB3NhAy+gRPkVBYZnx8x?= =?utf-8?q?NMrbt2bP66I3DuYJ3qOSAZp3odvDlheJJ7xkZKSs9vLji1GevDiKoqt4Jkc0mnX0Q?= =?utf-8?q?Y0vNsBq8VYxhr23VdqABYicRRPOKspF+NvzbvXsDOhT6lNvEegotPnmNYFnxZufhb?= =?utf-8?q?rwCb4MbGQy2d23adjU6MYjQGUIaaEQ5zbt0HBmXts8wAz3pnR4k06HEfpnHTTYXfn?= =?utf-8?q?E7bSbtJquHtdGlU12/hIpX3AoDeKULmvAg=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(1800799021)(376011)(7416011)(36860700010)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:29.7489 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bbeef19e-ced2-490c-0601-08dc8edf7c84 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002310.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4464 The vdpa device can be reset many times in sequence without any significant state changes in between. Previously this was not a problem: VQs were torn down only on first reset. But after VQ pre-creation was introduced, each reset will delete and re-create the hardware VQs and their associated resources. To solve this problem, avoid resetting hardware VQs if the VQs are still in a blank state. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index d80d6b47da61..1a5ee0d2b47f 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -3134,18 +3134,41 @@ static void init_group_to_asid_map(struct mlx5_vdpa_dev *mvdev) mvdev->group2asid[i] = 0; } +static bool needs_vqs_reset(const struct mlx5_vdpa_dev *mvdev) +{ + struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + struct mlx5_vdpa_virtqueue *mvq = &ndev->vqs[0]; + + if (mvdev->status & VIRTIO_CONFIG_S_DRIVER_OK) + return true; + + if (mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT) + return true; + + return mvq->modified_fields & ( + MLX5_VIRTQ_MODIFY_MASK_STATE | + MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_ADDRS | + MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_AVAIL_IDX | + MLX5_VIRTQ_MODIFY_MASK_VIRTIO_Q_USED_IDX + ); +} + static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) { struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev); struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev); + bool vq_reset; print_status(mvdev, 0, true); mlx5_vdpa_info(mvdev, "performing device reset\n"); down_write(&ndev->reslock); unregister_link_notifier(ndev); - teardown_vq_resources(ndev); - init_mvqs(ndev); + vq_reset = needs_vqs_reset(mvdev); + if (vq_reset) { + teardown_vq_resources(ndev); + init_mvqs(ndev); + } if (flags & VDPA_RESET_F_CLEAN_MAP) mlx5_vdpa_destroy_mr_resources(&ndev->mvdev); @@ -3165,7 +3188,8 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags) if (mlx5_vdpa_create_dma_mr(mvdev)) mlx5_vdpa_warn(mvdev, "create MR failed\n"); } - setup_vq_resources(ndev, false); + if (vq_reset) + setup_vq_resources(ndev, false); up_write(&ndev->reslock); return 0; From patchwork Mon Jun 17 15:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dragos Tatulea X-Patchwork-Id: 13700948 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2044.outbound.protection.outlook.com [40.107.243.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F1D31741FE; Mon, 17 Jun 2024 15:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636978; cv=fail; b=idhnCF+FON4bdK2vJCTuHggU/eW/Mj9af1bAzsuKSI7EiiQzl6hpC5T/AxddpAnm7ergkaDwUdKmEchrmpLnPO2+XKO0fusNhRMTSszcsBrXmhClzbHbTyHC3MPwmix6OkUgo2WbPKjAEXjGpB4rVo9KUdsChPkIQ6Qo7R2ZG1I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718636978; c=relaxed/simple; bh=AFKqxZPICXDBRRM3Jnaz0zJRsTPE9v92jV4IJ15lGpI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ocZx1YEDrgMwNt/bPtrv7AaFYxPzgjMbVJnqEFJC2gOUUK8e3p2qRnExlLQ2iEVHMlHAF2o7j+s1iHKTPL+unXGfJoYdzr0evSn8VlCUxWEXGZZD36rfcRk4KQao7Gikd0edSO2OBxUxCbBAK6WFVBX3rgW2xSS4oEIyVmGx3dg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=JnZU86bk; arc=fail smtp.client-ip=40.107.243.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="JnZU86bk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cA1tKSCHsZ44Gl6PeVmtKVMZa8kgiPpR1fX9sYCmBMayujzXbPjOkyOufhJQXM2Jj6iLE9nPebFiNPBMd3QBMPq8N64l0PL+VqMYVOqPD4jG+7jNl6PgxgSNn1lwcHYKRLfC+LUWIVExTyNPN7SzbKbVl7PAuB6AuJFypOmWXPBWznM9LzqtFnjimNmgBLiqNAcIJ7/g36Txju2Vb0cf6bGyRBw6Op1FkmuEdyzU2uJqESaMcLYNixH3/wW6uAVuK0yevq3rA5iFnaPZuwcKZ+AKf+f/L0Cy4nHfwV172cyQuXiq9sPW+kUuoFepI77XeZb6VtGYkUu7OseSg9PoKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f2qeVJE78M3ALmMWqAx3P0GQv/ossQz7wdatKeTQmhE=; b=VfOHo2JFoiHwBGGucw8dpNRWZuFS3QOdSFjGOY0F69tNoqy/IPIuWaeinH4PZCiZMRXtiv1d1nq6735M6JWbG0fRzsSnvIrq1DfXL+a9nenPZ0aFnPlD02kqD1mGo41IW6J81vT+a8DsElO9VNUftpvZrVs6DZas152mu/WLS5CD7VGKbqYaxmh6VGGgkpMlDC7Op3ZPjXfD6Ch66d7308BJEl4uae9KS29j6kiLuupr+2oZAF2etX/jT9/Kyp4Nb++YKccVHE7RQIH4eOOFC51vtkHTRxhWLLj49wEpAJBTH8w48pLFT9BhnraYSFdHThFIIdpI/Wf91QBwIw7KUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f2qeVJE78M3ALmMWqAx3P0GQv/ossQz7wdatKeTQmhE=; b=JnZU86bkLUJ/HXQr5Jfi0HdvpLPnx6ph70+untYPC86ixtGCoajK1tjIKLwDdstjkakNmyebqcJ50mJ0XaMnMSOLPk2dRCdsCVfmCHQziZrp+MS8KNV6LPdCfnVvhRJ5fykZv+UGNuUKSc7yxgUDHVJK+gohnaQD97DmugZO47he66RbkR5Tb+PLIvbhLO0GboHDJ4loOAouK0szuUVFr31KYCVNM8c68MWarcRWsiCL4mWeDlHJf7VtWfkYf12J9LfbCbQz5GZFdJHe+r3qXddCmlmI8ge8wOOyBhaJ4JrV8epIHGPDEZDuh4lkU7q7/dd8YS7oniQLJV6I56synQ== Received: from SJ0PR03CA0124.namprd03.prod.outlook.com (2603:10b6:a03:33c::9) by PH0PR12MB7486.namprd12.prod.outlook.com (2603:10b6:510:1e9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31; Mon, 17 Jun 2024 15:09:33 +0000 Received: from SJ1PEPF00002314.namprd03.prod.outlook.com (2603:10b6:a03:33c:cafe::68) by SJ0PR03CA0124.outlook.office365.com (2603:10b6:a03:33c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.31 via Frontend Transport; Mon, 17 Jun 2024 15:09:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ1PEPF00002314.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Mon, 17 Jun 2024 15:09:32 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:18 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 17 Jun 2024 08:09:17 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 17 Jun 2024 08:09:14 -0700 From: Dragos Tatulea Date: Mon, 17 Jun 2024 18:07:57 +0300 Subject: [PATCH vhost 23/23] vdpa/mlx5: Don't enable non-active VQs in .set_vq_ready() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240617-stage-vdpa-vq-precreate-v1-23-8c0483f0ca2a@nvidia.com> References: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> In-Reply-To: <20240617-stage-vdpa-vq-precreate-v1-0-8c0483f0ca2a@nvidia.com> To: "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?utf-8?q?Eugenio_P=C3=A9rez?= , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Si-Wei Liu CC: , , , , Dragos Tatulea , Cosmin Ratiu X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002314:EE_|PH0PR12MB7486:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fd2aaea-9aa8-469a-ded9-08dc8edf7e0d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|36860700010|7416011|376011|1800799021|82310400023; X-Microsoft-Antispam-Message-Info: =?utf-8?q?9TkzxFjNQ8ols7pHN97Hx36rQ3wAxlU?= =?utf-8?q?WGoy1yibreQKmdtODoOKElqMFuxxthfgrp0aG1Pw6UZ9Vs/90y0rgeWn3hqEvXQHu?= =?utf-8?q?3r9eCFHKdu2Z72Jfo+K4wuOQn/NA36hj4MaliYRaW7s1sEWYNug5e33IkLKtWlMCB?= =?utf-8?q?7gE4DiUZTFOXB09WzlSUY94NwAisaQDbAfY34BkdpkoJ1iZKgtBrNMzc8+MF3tJQU?= =?utf-8?q?cssShB+JKNd0MUCfi/7tfKK0UMzs/O6VvoBRnqSRvTAQ9GzgPOMQ5gbUH+cxu/B2j?= =?utf-8?q?harQRYt3asucrIr5p9JnyOkkwI8GmovsFf26XMdGZLRbkgEZctM1KWHKkffLLC1U/?= =?utf-8?q?69G+0XbmGLWJ/kTTJNao4dkAPjQ1TUR0BtVXl6HW7BmYggV9jZ0Heg+PkRTEh7TrD?= =?utf-8?q?trjtosqatFaZQjChS5DCtDufUL9dGU7tsk61WmEYP57l55g6i4xRIVw7WTJfPk9Bd?= =?utf-8?q?4eskFDKw17HLoPC6JBHUAfAJiE4K3UVNz7ITvmWp6heTHGjooKA1o9r6HJPrHSZix?= =?utf-8?q?g0KvLeL0KehqLjs+0wwMvSEz5g9B1hRj6qMThHAeDNvmC3qf5+2iqB96Dml9FOk7n?= =?utf-8?q?CeWgElNkBElpDoVC2mv5oB5Z7KLfH/S+kpvkXwbT+X1h/Elvg7Ay1oYytKBPvMtCC?= =?utf-8?q?Ixqx0buEwsgnbCFVf6/SW5sI2CiWPylqIDs77OaW4cs37NNqfWsKsMtyEHs/PW4Q7?= =?utf-8?q?cZTKGMq0a2z8z8Rmwotk303+fc1piXLJdfdyz47TFNy0KEaRFb5PSPsA++1cEGXBL?= =?utf-8?q?iYH14USYhv9ByxbfSwXzS9WrtJB4AVFjQ7nD+VO+3nm0ZJgmrZ9KKMsbqtS38dEwW?= =?utf-8?q?g23YJr309WUdbLfM+DfXwkcSbkFafUq3qaNON0mjBRNnQ2SLCH96A9jaBCPB5h9e0?= =?utf-8?q?6WcodMzG+2ywtZ0Bmi5zYG7TlSFlwo9h4HyRE3T3A1Cw9aBp/EZdHg/I95bRtrxmd?= =?utf-8?q?GzUc29reQsu8NKPKSr5l2uNGQOz5tWtvEsFQ0f/W5Hla5IsHSglOo55MaFUCyWT0G?= =?utf-8?q?WbqqQRwxq9m7I+8WNRcG6aH1QJoBpyObyldorymBZri8rTwnQ4hoVBfb/Uoi5Vj2R?= =?utf-8?q?cKZgxDx8KIz3y4K4DtiZZCa1bvC9dJw9TEYn1WDXpkG7/oM7TIm7N8YndpOpzuM2h?= =?utf-8?q?RnnfgkvSMK2GV53tn3ZTMdIKdcohmDPjQ9+QLTmeXrXaAGVRuCAlmwLmhih6VNV6T?= =?utf-8?q?ec4HEm7nbJ50zDQ0oIpEHVALKZLOkbI36WQfunlTvplrx9TqCOPi3dDbiH6bzIN0H?= =?utf-8?q?oiURFVLVTPSfQ04xdravzqdAhqtc6DnW/4YfXw7bDqGibqqPXQLklue8dPdWb2Cx0?= =?utf-8?q?i22uC+IUjwWvRLifcBKCdsAf+qXOSht4EQ=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230037)(36860700010)(7416011)(376011)(1800799021)(82310400023);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 15:09:32.3144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2fd2aaea-9aa8-469a-ded9-08dc8edf7e0d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00002314.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7486 VQ indices in the range [cur_num_qps, max_vqs) represent queues that have not yet been activated. .set_vq_ready should not activate these VQs. Signed-off-by: Dragos Tatulea Reviewed-by: Cosmin Ratiu Acked-by: Eugenio Pérez --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c index 1a5ee0d2b47f..a969a7f105a6 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -1575,6 +1575,9 @@ static int resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq if (!mvq->initialized) return 0; + if (mvq->index >= ndev->cur_num_vqs) + return 0; + switch (mvq->fw_state) { case MLX5_VIRTIO_NET_Q_OBJECT_STATE_INIT: /* Due to a FW quirk we need to modify the VQ fields first then change state.