From patchwork Wed Jun 26 10:26: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: 13712566 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2071.outbound.protection.outlook.com [40.107.94.71]) (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 F408017839B; Wed, 26 Jun 2024 10:27:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719397634; cv=fail; b=RiWmjc/Sb7A1CwZK+RGDGLBGR5g3TVLcmyK8rcbgpBvBv8a/38qrCsLdUnoFmdNjqyc/hXdhLrtQZMxg35GRIkMRdwYkPhrREE3X4CWrWDg/sh3h0LNXsJ8K2G/OZfQIADLFfaxYP9nB4Qz9wPwyVZB+5TwSCzwjH8EnDaZg3Gw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719397634; c=relaxed/simple; bh=C2tPCh8FQBXNjckfu2hkFRSK8vMqBuVV3Aw2VkupURs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=RnAbG6McWIzktFToTpENIdT8NpqaV3E1qQxrB2Knk+9g1oDWvTk/GRfU4ObTw1K5SC+gRSO8I5yxGUICnqCk6bXN+rWqxFan5ute7aQ2elWPDaB/fMbulgz8BuZKeCcJkcJgtytIlkgNVfIB2sMx9X6BnUPptVtBN+s1lB2P/64= 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=RLjc3Vtz; arc=fail smtp.client-ip=40.107.94.71 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="RLjc3Vtz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E9k5nFv5m+Vl93mcE+PoEHJiooD9JZ+0rQrKuCsnwe1SKxfqTVzh7thVSAWnAG0XNIXuU+tZK3EH2IDNa484YS+kK6nMq/SZHRADT512bPctA6A60jij243ZGLkmOTJfampYa6Totw9/U4xRC/a6IlZHAflMFsRS8exIbRs0x7rXXcchGy8qjBvGJTLcISrLZlaBtDUKdS88bYTAK/MDLiJ8ave4+nMhX1jYCe1qjgkk12boVIgrklyonayYRLMIuQTXnGKOMpbJYS+8Fvy/hMrOECObV1ZDIFQC6kzhMGNfsSlsQCzRSXNPlSgCZy0TFoyV3IrQKKz2FNPFZe9Oeg== 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=AjqnAAoM/3WBJeJ1KiveeCW3YMFotXJX4AxpcMxRD7w=; b=VlCnUph+0kT0ZNuPJrjZYGwY0vXBqg1OrXDcCqoDTi3/XV3pztu4wWrLrEO0vSNikMx41rGNlccAcLfvaWb3vOdiSpdR+kGv2ByO233yuHeadsVKkRHEZ4DWvwMyHpHHeNi0K5y6rym5qc827AUdPN5NuiIFaykYRUYvdenFA7aBsvnP/Zt0UfOKGOmJJdGOPw4id38lTz9zxN9t0woDMAJKDhPLOcOeU235ceI71wYSLKXmTKRgbb8sP+rYko0ErBm/lUurUi7fOBifCWNi0KzTqK0rW7LUi4FBNeKcSj5kCajyYXLPJBWYjq2m0NNFpZS71ccuFFa1M4M3g/f1ew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org 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=AjqnAAoM/3WBJeJ1KiveeCW3YMFotXJX4AxpcMxRD7w=; b=RLjc3VtzwyK2hTzmwev3o2VRu7uiZ52/r9rxg8XAlvT0buUghWUPIp6odzI50jLpfakhp92i1advCHZLifwUxgRL7GbtMP734B/LhQkCUu9a7XaNAR5vMUl6TSOsg56sjbI84146p+oT1kerXJF4MM8shyuWUqOteGMK26mKUeiq8uS6jweKJ/Sr0bmmmsJUAeLK6NzQ9mnut1Ts/uH+aJW+Trh7U8wqzuhH2gsvLXfNBjum0V8pwK+856GJco8rjT8H6vu0/6F3KUSTBOiuvjVypOA3OdERSF0EEm576kxwMGEJv0HRd+o2aNKpT4V3tlrJ4SSxKAdpZXXagZye8g== Received: from MW3PR05CA0006.namprd05.prod.outlook.com (2603:10b6:303:2b::11) by SJ2PR12MB9190.namprd12.prod.outlook.com (2603:10b6:a03:554::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.30; Wed, 26 Jun 2024 10:27:09 +0000 Received: from SJ5PEPF000001C8.namprd05.prod.outlook.com (2603:10b6:303:2b:cafe::41) by MW3PR05CA0006.outlook.office365.com (2603:10b6:303:2b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.22 via Frontend Transport; Wed, 26 Jun 2024 10:27:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SJ5PEPF000001C8.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Wed, 26 Jun 2024 10:27:09 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 26 Jun 2024 03:26:51 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 26 Jun 2024 03:26:51 -0700 Received: from dev-l-177.mtl.labs.mlnx (10.127.8.11) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 26 Jun 2024 03:26:47 -0700 From: Dragos Tatulea Date: Wed, 26 Jun 2024 13:26:37 +0300 Subject: [PATCH vhost v2 01/24] vdpa/mlx5: Clarify meaning thorough function rename Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240626-stage-vdpa-vq-precreate-v2-1-560c491078df@nvidia.com> References: <20240626-stage-vdpa-vq-precreate-v2-0-560c491078df@nvidia.com> In-Reply-To: <20240626-stage-vdpa-vq-precreate-v2-0-560c491078df@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: , , , , Cosmin Ratiu , Dragos Tatulea X-Mailer: b4 0.13.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001C8:EE_|SJ2PR12MB9190:EE_ X-MS-Office365-Filtering-Correlation-Id: 935bdde2-4d71-4c42-1e46-08dc95ca88db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230038|36860700011|376012|7416012|1800799022|82310400024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yA0Z8VobTA5xT8uAUxWOTQyn1mqQcTP?= =?utf-8?q?T/pSrlR1uUJCisSgUctHmjfDpbs8joIxguBGQ/QxTazJMOd13MH3BiDm+H+5pMN22?= =?utf-8?q?exfLY5UMSn5gzl+vGOoDkEmaa6DiBXmoWF3IA5aDd73iLMyuy49mFER9NPO6SgVUS?= =?utf-8?q?B/ZZWFfIe6QhzyRagNM8iJimz/S8fsgCHkHK561lAl09VHX3DHft4DsJ7jsCqVes1?= =?utf-8?q?YUpcRgKeZpDZ4nFaBcgsLQVb9A2Z4vK5dRTRfFY+sjUPA3jVklSY/daPf1p3jEQIQ?= =?utf-8?q?QNj0WlVQLPF0mZjbHtNFqRv9UW8lRBakTU1FfhMLp2h669uhm/EEI3xaO7KIbXh5b?= =?utf-8?q?QuPJwB59PJmm5McQ7Fm0qak2JZEVDW2o1vVcXFmxDuy/dupd7Y8m7f4k5zfte5uP4?= =?utf-8?q?VXJdt6DQ/cfNHh4LhV4wRVnTfUDQ5herVU5ptj5jhyw/mmhaPe4eLb85y6b6fbpi5?= =?utf-8?q?VByOKI9m0uiMVa+OhrQt46ioViaakUAmcoLtF5gL4JkD7ZvCWwAkawGaVQRwCkvcV?= =?utf-8?q?A//5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L:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230038)(36860700011)(376012)(7416012)(1800799022)(82310400024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 10:27:09.0511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 935bdde2-4d71-4c42-1e46-08dc95ca88db X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001C8.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9190 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. Reviewed-by: Cosmin Ratiu Acked-by: Eugenio PĂ©rez Signed-off-by: Dragos Tatulea --- 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: