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 26C4FA00C3 for ; Wed, 23 Feb 2022 17:07:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2024B41145; Wed, 23 Feb 2022 17:07:41 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2052.outbound.protection.outlook.com [40.107.96.52]) by mails.dpdk.org (Postfix) with ESMTP id 6E6FD426E4 for ; Wed, 23 Feb 2022 17:07:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NeBRBFuPCv2HeUO5E9MKJwFsIG++YVoFskKzT3UAYZikqDWtKZCTKIMyadnwEt/kKXWDNnaKo23AUw6FqG+r67EkrLFfRwOEjv7bej5OCrMXR2G3cUUfrwdnGkL0tjWIC8EZrGnFUkaOjqz3yftyr56Ho9ATngX/8j19PQFyWHNjcp+vTi+6Es3JGV5t0lZPfq0ugaKqQk9P9Xfx8tSJqSNlZ1izVQ0KeOjs5Aie9YJP3RflussovL8TAULjgzhZdf3l6PX6G7qdgLPIrNJDl2ax9IV83hZtZbvaxMeHkcBoyqj9CFRLubKIl1ecnr/cNVLzUsycNbgIND+2PXRZDA== 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=IqVwCb4zbs/chyDgIlqBBo5jKtoJU2j02fzh5tFm6xMH9QtLDL8lrtfjK2wj60ooYgmoRJ0GWn3pYsotkjTPWg9nYHtKU/G/f5GHwbiEL2BLt+g+piFMox+3Lf1dLEoSUuG40UvZvC0UoOg2jZZtECm/omLlQbfswxrxRtBQvUrLSiDQY13k89Z3Qp0o/G/BYuEKdYveUUy7xJ8V4v6Vnp4Hm+8dULWhdEF0z2PiGVytXuXkUu8g8c23pGEzHYhqPMs03WfF8F6QqfU8rLAOy9Yd0EqwvXPAYDRoRA9Nen5hvy0q9H+dBrfjYAw4WmPg2qhWIXEfIGnaWMxb9VekDA== 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=dzSciFai+OQUCJd3MnaqLQCI6WuGRxcSTYcsD0nPSIJKeV8o8MHvSRxltGNkCObjaCo4vBe6bBDNrYje8Kmc/+H4fDOQtCQUT7lmsZx/hD9pqpBCL7zV4NgkotWT1ZoHscHW8AkIoYFR6SQ43SqoGSelqqdLV/B3lM5fxnXAsMOi1n9K7VKi8XbdJg3w5N3FNJeX1mxyuAkztQYT3qwCgP6xAb8CkoWCvp0dRzH6yEtSGYgdpXBxNg2Tpme9oV7YBrAUxxnqrsOYRrrBJiTdqE/gl06hCTJQO+plM0ou8eeR44vWc9Lo7vzK1zNmYulAjZyV07tYQ3rDV4dKOxyHYA== Received: from MWHPR07CA0016.namprd07.prod.outlook.com (2603:10b6:300:116::26) by DM6PR12MB3866.namprd12.prod.outlook.com (2603:10b6:5:1c6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16; Wed, 23 Feb 2022 16:07:37 +0000 Received: from CO1NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:300:116:cafe::5c) by MWHPR07CA0016.outlook.office365.com (2603:10b6:300:116::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.23 via Frontend Transport; Wed, 23 Feb 2022 16:07:36 +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 CO1NAM11FT067.mail.protection.outlook.com (10.13.174.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5017.22 via Frontend Transport; Wed, 23 Feb 2022 16:07:36 +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; Wed, 23 Feb 2022 16:07:29 +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; Wed, 23 Feb 2022 08:07:27 -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; Wed, 23 Feb 2022 08:07:26 -0800 From: Michael Baum To: CC: Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 20.11 v2 5/5] common/mlx5: fix error handling in multi-class probe Date: Wed, 23 Feb 2022 18:07:13 +0200 Message-ID: <20220223160713.2992784-6-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223160713.2992784-1-michaelba@nvidia.com> References: <20220223160713.2992784-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: 5b71eb3e-073b-4493-ba8b-08d9f6e69bdd X-MS-TrafficTypeDiagnostic: DM6PR12MB3866: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: YeDdYveQuRTc7PMgD95k4FksCPda5CEJVzXLRTKMktgMEcO/wDs2MvDxihwyyMv1DA/QD+ufqsskpWO3ca01DhIxtc5xAg677NiGsjD+sEvI4T1qR5gRy2VdEB2R3x710xHbmN4BK6cEMDSr3lWKBlDJdJx+U7B+zd4pv7AGGwDMT8rd4NY0M5zH9aNeCNkcQd74KD078jESLzwC9T/1u8YEGsvIcB0AtFaz90rmsI0gVRXLWaKGEW7zMAxMZNk5UOV36Y6u/MFisV1ldJ9VjMAvbwIrRTukLcPe9bixUdjKpsHhGsK7zKus2YKk5RjuaQEjImMAQ9vp+mwHmH9+TIN+bvExjJYTBDYrd8QkXJLSNvj/HM96TVDpPmz8A8nunCmV0zwof7Bg+AqNGVs4CtKutmHYnt3lIyJNWcUY+prfAigH6Uv287tliHXdFiaTVpyRGIkRj8Eu7YcOQymwDkypt6lMqnPvfthy8f6LmHYmfnGl6/EAyGeolE60yAPigcuA1UvvtP4oSusXbDno5fYZu+dwinBfwsM0ySpChFMdIrOLHy/dHSsNtkmJBYiWsYTqnaiRfZbjCuZwKRyyzuLaPveM2W5Pn2K3eBg3lDBgc+ee9UMjCU91bQY+UfZCKwEfg29qHv6cHbxwXpLoCRvAPidxakrcR9VgVM9ZrmUCOT+ffDfpX9rCVpbiK55lRSu95milA4J/aucFaSEeZQ== 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)(36840700001)(46966006)(40470700004)(47076005)(82310400004)(2906002)(81166007)(356005)(5660300002)(36860700001)(508600001)(7696005)(55016003)(6666004)(70586007)(70206006)(40460700003)(316002)(83380400001)(8936002)(54906003)(6916009)(426003)(336012)(2616005)(26005)(186003)(6286002)(4326008)(1076003)(8676002)(86362001)(36756003)(107886003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2022 16:07:36.6452 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b71eb3e-073b-4493-ba8b-08d9f6e69bdd 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: CO1NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3866 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