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 2B06BA0C52; Wed, 24 Nov 2021 23:03:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A67E840140; Wed, 24 Nov 2021 23:03:03 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2045.outbound.protection.outlook.com [40.107.243.45]) by mails.dpdk.org (Postfix) with ESMTP id 9C8464003C; Wed, 24 Nov 2021 23:03:01 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XMoHu5iF9XvBWRAuorBKYWDMwjwXUmewS1jaE9xlBNQX9xTqlVCLNfGY/tQU2weJibj1lTx6BNxGNKyoabwrlIMRhQI80k9HTho39eFHZunMenLIM2e1rpeAsq8QTlfhqfMs92jf/FqO0jh0N2B2E+GgWnPOoHQSkFmmDpIuf4E43B8LdN/12WqZLCf43tFNQkQByQaRMrlJd5731V41KwaVok0CIIottQLpjXOQdPBVbqC6l0/2IUVQblrscNjVmuBQbVfiWskaY/eW/TjXuhuv1+w0oSJ0uEUSSw6znSWBkIl7oFy3YWM1YaSNQ5p4yrTZgbhE0wrFW5ztCACZEQ== 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=NyUA2P8tb9f8icYq+tLLlHy4Sdt2K79OA61cqt1ioVI=; b=SwZZpYZP4kTi9uqYsA2w8+JZ3wt1yyPwkSX2H7aJvZCT3S4z/pn0vCLtiogZ+IEz7zB4dli1Qf+xXxImBi2/+O5XzG42PqBBzfFeSWokmpb/DnOI9LbXcokD2UreTxJa29uFvRQxiQKERaNfc6lGwcvzBRkgpiNgaInU4iTszDQKL1UWLJqRfmdG6pi7HYbqw1211YJIXFfzsx8rM7UT480XQmdb27LzGqbiZBqO3rih0TLWBCwKO43XK/poaLUrnZnrh7AigtEWcrc81TPgbAfw9FeSH1bq/ybSwkDrSJgg8r6tsdwwPp/JX0xojxw/ib1uaqbclpWV18hsW5D/Pg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=NyUA2P8tb9f8icYq+tLLlHy4Sdt2K79OA61cqt1ioVI=; b=Bh8UnZeYJlSDCInBLY8hFGBqdWp3fhwxmAcBK49OhVQ5MfsI+078OpCNqNYOnA/edfkCrkRPqcUCjGVGV3k5y0qINhbEmtMt90rrP2e2nrkZ6e5p382WUZjP5+3t9c246LR4SSMtwKicrZUNxawNTZ/AGuZm70RFYg+feLehK6NZH7L8EvEyWsLBvSnTFomhjD6MX6yLYdj48xS2gT5M2w6D1jRlBhIhtIaKdw+I/rA8ZNmyx+MDa2BvlYEB5NhLv2/50uQHfBW+sruSx5GjXixfn1dc9zW65xmj0CX0AoRS89EFsbAoxLThtKyMt4meoKZWdK6MhZ3kvRiu+7Bn9Q== Received: from DM5PR18CA0072.namprd18.prod.outlook.com (2603:10b6:3:22::34) by MWHPR12MB1181.namprd12.prod.outlook.com (2603:10b6:300:e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Wed, 24 Nov 2021 22:02:59 +0000 Received: from DM6NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:3:22:cafe::da) by DM5PR18CA0072.outlook.office365.com (2603:10b6:3:22::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22 via Frontend Transport; Wed, 24 Nov 2021 22:02:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT055.mail.protection.outlook.com (10.13.173.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Wed, 24 Nov 2021 22:02:58 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 24 Nov 2021 22:02:56 +0000 From: To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Michael Baum , Subject: [PATCH] common/mlx5: fix error handling in multi-class probe Date: Thu, 25 Nov 2021 00:02:38 +0200 Message-ID: <20211124220238.3119860-1-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c99eaa9c-9380-484a-587e-08d9af962d4c X-MS-TrafficTypeDiagnostic: MWHPR12MB1181: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I/d9KcEtH0lH50oghbQO/3BemgvJW8HvC3C+g4XFSfsZI0n6O1TSQxZsfrsAKisNtDrF+ReDQQYwJEDEhmcSIotXHrACx9kDgF37pdMUV4B9yVWe2e71fptqyaENDsfvOYJ7xoo5yMsHrvRgCUspMura+hcrn8CPvWilqmx6gA/FT0AP4/nKK9nmIrp0QUDn+PFKtQIh7r1LcvDZH8ZdJ8KfqgSinEoF3BL0FYksa5zJ5mmW7nZmly0BiUBw0N296rCwxlNUNN/p+1tA+Tlf+GnrFVo6MJsz36FuoRN5VlI5n1CfUi0NmBTCepvCgHQSG/3nOii0AFqTttNiV0es0/DB5A1/NKVf6vAAEGohl73pShZTq2l6DJqII9wqhKWc0xrfIvHBSDkvst+D3HfqLDM2keB23ZLQNkwZUM7LdnYsiD3NT18eEkWf5BB01DB+Zv5+bw/RrQX+7dVPph08SZEgMief+NeAcRioVgZll5sxEv3yjPhH0BpENwwu6b9jHXZhD6s2WcQQ401SNJioaby7wrfsgSBzAqDhZOyd8B3ha844hH9q4Qxbd7CvXsNUkaqBtX79XddqVDlLdDTFSvXs+PhdkKM0IwOLTMa99ec3OAi/gpUviVzkLbTJn9AblGw5+g98Ths90KHjKpHUG85hna7GMnOXVr8+DT6c8/1R0Aq4A2DDAXyif0j2SmUPA5RqmyFg/FOJScow1Itcrw== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(2876002)(8676002)(55016003)(26005)(6286002)(426003)(82310400004)(36756003)(16526019)(8936002)(450100002)(47076005)(508600001)(336012)(356005)(5660300002)(4326008)(186003)(86362001)(2906002)(70586007)(1076003)(36860700001)(2616005)(7696005)(7636003)(316002)(54906003)(6666004)(70206006)(6916009)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2021 22:02:58.8509 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c99eaa9c-9380-484a-587e-08d9af962d4c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1181 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Michael Baum 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") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index f1650f94c6..faa3d65ab3 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -616,7 +616,6 @@ drivers_remove(struct mlx5_common_device *cdev, uint32_t enabled_classes) unsigned int i = 0; int ret = 0; - enabled_classes &= cdev->classes_loaded; while (enabled_classes) { driver = driver_get(RTE_BIT64(i)); if (driver != NULL) { @@ -665,9 +664,11 @@ drivers_probe(struct mlx5_common_device *cdev, uint32_t user_classes) cdev->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 &= ~cdev->classes_loaded; drivers_remove(cdev, enabled_classes); return ret; } -- 2.25.1