From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CDA69A0351 for ; Mon, 21 Feb 2022 20:46:54 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9DD4410F3; Mon, 21 Feb 2022 20:46:54 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2044.outbound.protection.outlook.com [40.107.94.44]) by mails.dpdk.org (Postfix) with ESMTP id 9A80B40E5A for ; Mon, 21 Feb 2022 20:46:52 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mm1W+bWKxzUIumn7S8hCr7cBtc4XjAR0OrWToBgfwF9J4bxe0QqcbYV3yFLuRY4GEbcOwpsTTeTnijlciQP5EFkmy885ar0HTsBu2jkiPjenPgvKIhpN/tgRCedM8XG3xo5eqC/9cXJ5Afijot0hy51Rs25LT+RMZLN9/ihJb3QlcUDfdWL4E8pd8XUgPzHQVtsrdZluXsx5HvEPbrICVLok4oqtitfnzbCnJ0NB+4AJ4O7DwWwu7tP1hZ7LEI28Qvf1L8S7VZRR0MV+q/qtHirvhenjv3NB4fffMBwzrXPHa1lphYar1K/qZeiuwDAhnixFQsrnM918NNh3fPizDA== 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=9mAMz/+8/6vEoLwUxNSe2OQS13gZWF6IUQkarfoSQBA=; b=VBOI1hYEgq/c3CBBLcGY6WVT2dURievSp+WYoVadrZF/QLa9bPnNRqpJFDvcHeGSpgPCZq+jnEEq+1P4Uy6jhnYxhVKrAxyozR7FNdJqIgLIjtF7aaNZfS2JVocGm3DzVnHbxzvMvSYsDVTQh1OKjvw6gcJDnqcoPhZU5OrzWLFqSrshVM+hBGQ118Jzf/mJHJsQPSBrh6lCcwwFxd0UNaxQ3h6k48DVM8nZEYvRtdi/62tQc5HrwdTEyplEVG52aNMccUBlt0C6nD+LS897N7+WepKJPokpBQmzpFMG2nbT7/NCANSNJs9MwM4yHlTerd3Tl0YoHPqCeKtOU7/r2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=dpdk.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 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=9mAMz/+8/6vEoLwUxNSe2OQS13gZWF6IUQkarfoSQBA=; b=QIMZfYAFd8mIr+oh8ExkTzItP2Vc5tUYMkYW/abLpZOgH7teXjPs8qc444BVLU5EznsZmYKYKI7m6picVBCYB/nkBqxC5trLMoIsT2fz54ENyTjPewLf/UOcVKB1MSrSsrl3xc9x4mdsarxe3IXspOQIko2f6W2VHmDBCf2xrElu17+KaJNrzlI8GWXNzjsjrWu68d3NopdQqJR0+G4sez0bvtZWoGRTd68f6ILBc/sDdRdG/7iGJEjxMauvGwxjgyZLEKhFpg0o4PVLvDCyruWaRI8jXYAZzIUiEav7Zg+sSeTVomCILhDMrTMzuuIwDF0F6DWmzZ/AbfqhIZt3rg== Received: from DM6PR02CA0075.namprd02.prod.outlook.com (2603:10b6:5:1f4::16) by DM5PR1201MB0154.namprd12.prod.outlook.com (2603:10b6:4:58::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.17; Mon, 21 Feb 2022 19:46:51 +0000 Received: from DM6NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::9) by DM6PR02CA0075.outlook.office365.com (2603:10b6:5:1f4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14 via Frontend Transport; Mon, 21 Feb 2022 19:46:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) 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 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by DM6NAM11FT045.mail.protection.outlook.com (10.13.173.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4995.15 via Frontend Transport; Mon, 21 Feb 2022 19:46:50 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 21 Feb 2022 19:46:49 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.986.9; Mon, 21 Feb 2022 11:46:49 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9 via Frontend Transport; Mon, 21 Feb 2022 11:46:48 -0800 From: Michael Baum To: CC: Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 20.11 5/5] common/mlx5: fix error handling in multi-class probe Date: Mon, 21 Feb 2022 21:46:35 +0200 Message-ID: <20220221194635.2458173-6-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220221194635.2458173-1-michaelba@nvidia.com> References: <20220221194635.2458173-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f968a249-13d3-47c9-b756-08d9f572e77a X-MS-TrafficTypeDiagnostic: DM5PR1201MB0154:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iiT83rpOZ1t8w6ByyMhc6Apa6Watph8IJh/8g3PVFrNo4f9JQznSucUNB0j5m8OyiCNMTmoDHj6mv0GLGRk0Db+/ApPHwVCcL0HAkLmBh8GjFp/3uKrgeFLD2ybOuQH+2ZaiAITB6H/nS09pPdjEx+xDSgsc6lKutvXJiYyG17UKrSJtfgjLZKMMKh+TPDoaXShbZ0kQlVc1t1MkQRvV4Z+ScAHG5sQk9snGj7deOfyc7XHG5MapsipUoju/U4GzzHZDuGcyl6dbVjGTPKJsCTjmUTiJIX6nhLJ/cf5cYEIJC6PW+EfqzksxfeTRrY+id5QW0zgnLpB13LqSt/lvn+MYIhUzCnelsy0mA+62dTZhxDwogC2hR/+O6bjNQ5hV7O8n3947rul4zuK2Gpng6ARsM4SJhEPj56D8DSzNPiFChktv5dJPFs7FIfeKTwxGx578ItFntDz6p9zzxe13IndUKgOA/kqm8JFZ2psJzgWZmTvn4u5qcXoyMNdfUQ2rM8oeKI8mA0qlU8vUoLhus+5dwjTC9Nx7bV9H6nbQpN/uLRkrN/I1OACqnt1MVqXdzRs9lVi96h66etNyu5jmF2ECNtXJ+vh69lSkfqNrB96cI9ia1KuVe6fuiGMVzPBp2QJ5Is8TMr+RceIjYIEUe2+6FtxJ0QtisNDSmx2l6c71OJSmH2xd4iuKI8zVPG9l5PcH7ytVoePvPppur5UpAQ== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(6286002)(83380400001)(2906002)(40460700003)(356005)(26005)(186003)(1076003)(54906003)(47076005)(6916009)(8936002)(107886003)(81166007)(86362001)(6666004)(36756003)(82310400004)(316002)(36860700001)(336012)(2616005)(5660300002)(7696005)(8676002)(70586007)(426003)(70206006)(4326008)(508600001)(55016003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2022 19:46:50.7041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f968a249-13d3-47c9-b756-08d9f572e77a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0154 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit 8928997a1388ba1b045a55732acced4baf00b21d ] The common drivers_probe function calls in a loop to all probe functions for classes requested by the user. After it manages to probe them all, it updates this on the device in the "classes_loaded" field. If one of them fails, all those probed to it are remove using the drivers_remove function. However, this function only releases the classes in the "classes_loaded" field on the given device and misses the newly probed classes. This patch removes the condition from the release function, and ensures that the caller function sends a more accurate parameter. Fixes: 8a41f4deccc3 ("common/mlx5: introduce layer for multiple class drivers") Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common_pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c index 5208972bb6..fa6e89efd3 100644 --- a/drivers/common/mlx5/mlx5_common_pci.c +++ b/drivers/common/mlx5/mlx5_common_pci.c @@ -203,7 +203,6 @@ drivers_remove(struct mlx5_pci_device *dev, uint32_t enabled_classes) unsigned int i = 0; int ret = 0; - enabled_classes &= dev->classes_loaded; while (enabled_classes) { driver = driver_get(RTE_BIT64(i)); if (driver) { @@ -254,9 +253,11 @@ drivers_probe(struct mlx5_pci_device *dev, struct rte_pci_driver *pci_drv, dev->classes_loaded |= enabled_classes; return 0; probe_err: - /* Only unload drivers which are enabled which were enabled - * in this probe instance. + /* + * Need to remove only drivers which were not probed before this probe + * instance, but have already been probed before this failure. */ + enabled_classes &= ~dev->classes_loaded; drivers_remove(dev, enabled_classes); return ret; } -- 2.25.1