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 4D5D1A0C43; Sun, 12 Sep 2021 12:37:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4000E41102; Sun, 12 Sep 2021 12:37:01 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2050.outbound.protection.outlook.com [40.107.94.50]) by mails.dpdk.org (Postfix) with ESMTP id 3D05D410FE; Sun, 12 Sep 2021 12:36:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nDsyWPDEOsPX+NJjqgLNfeecpvARRfzwxYwKk+vVdREEa/oeoP4DsSKjumtU/F2Nalx5ZLfu+Z1CRJfskcGLU1UFmLO69d1qnKsOB6OdYEyKMaINIRJ2DdeXBK6pKVp4+NGUTo9+QjC8axltjRBWVfw296Z1YcDuRag3FCME09sNxmSzGE6/mjzUHtFvSrWJK6NKQxpP9oHh2YTz5QFaaX08IIDRrhlTqDd9IVjhaVxnlflnWx+RpDZOL7QawjxlQ0oIuPIxrQedW5tqcsKrys1ljxezujtMe9G+row++5h9bTrFeVCJIkC/FMSq5DTHMIvnyMihz6Dw/eAlNEU/ig== 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; bh=s7MHVY8KWYE6swVVQ86s4SraidtczYb8maEp6On+diI=; b=e0sf4HeT0Lg7zwE8FS+x/OydLiVeH0OyM47R1ZNs/E5BC1Krx7eIuYLFtbOjV6cA629snKY2A8cmtcdgW85Sc1jfr7q89b/9F1pNgdLmcPgoq+FLxBoTRYa3SFfrtbORRvxfHmaWhEM+yh3MTRyMn3rOdBu+4gLS76cI34MLNaZx5XnD9i6Vqdtkvet/egRffDouoFS3wVCJjmbzlHvvOpm/c2zd+iSxANalwxffCmtgvTBthbHsfhSvSKeQsmRPnZR7HJzTqlX6jPIg8pmrr7R2UUv1zUM1VFt8GEfyuPXhxJdbBOq7ndAMHxQMRuJj0zioCcbbPwfkukIykbnqFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none 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=s7MHVY8KWYE6swVVQ86s4SraidtczYb8maEp6On+diI=; b=lrEG7rcSQyKSTidDpupVEKPj3mX9OB8l9QVyw6DLTnBAspGkFpBNdEyzCDrXAA4l8HxQZzJUlmueLJOznWREv/QvpMAqDAUzTDLCkVZiOxknrrkFo1f7xGTtBRud8edM09d+PWEvmqa/Lxa8O3mBC6kM8jPdSwkGMjf8Bh+rZzn4H1d0eF4olYSG/vLUd4W6lTuDYkaEANIhQRbLPp2Hz2cLNBqAMC0OFrchlLelie1Zp8bb7++nPTQ0M+t+tlbIzp9BcHZFf54zNV1gwmnZE+tEx9r+xmmWUVsMqkPcDVfM8mJBm2gmzMYe9Rf6yxVpcjt/jnHBpbO1iIILWNwBpQ== Received: from DM5PR05CA0003.namprd05.prod.outlook.com (2603:10b6:3:d4::13) by CY4PR12MB1703.namprd12.prod.outlook.com (2603:10b6:903:122::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.22; Sun, 12 Sep 2021 10:36:56 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:3:d4:cafe::15) by DM5PR05CA0003.outlook.office365.com (2603:10b6:3:d4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Sun, 12 Sep 2021 10:36:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4500.14 via Frontend Transport; Sun, 12 Sep 2021 10:36:56 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 12 Sep 2021 10:36:55 +0000 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 12 Sep 2021 10:36:53 +0000 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Date: Sun, 12 Sep 2021 13:36:26 +0300 Message-ID: <20210912103628.257499-5-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210912103628.257499-1-michaelba@nvidia.com> References: <20210831203732.3411134-1-michaelba@nvidia.com> <20210912103628.257499-1-michaelba@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0cfdc782-7a59-4f99-b868-08d975d93e6d X-MS-TrafficTypeDiagnostic: CY4PR12MB1703: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IM5Joh2o6jZdWsFhQRy3ekEEMHRrAhqLqqP72AQb9vWecnhSlevd5P/Wfm0FvoeQ9gh81Mk2IOp24I6/yvwlBKYA9lrYEV+eCkTnFdzYOMwcqEauBV32f5PTDY3ISzOEBb2hCtTXu4k+ezz+4fnLtJH6DeiG0tU5cvKGwDgHe6QBcBvOVz/GOyezjlGPbRhmqfwAUOughKhBm684caem8uSAwZxiZMr4U4EHaANt4oxSOzCfcob8R217ccG1PKKbXNprbBnH9w7OlqcQd7ZudFfzwFp5iVTj5zEo7fkhxatUti6lw5ur172hgR1JtEOb7vjbY0l5DelLOuET4UTb+dH5bOum8/ZM4PUJL424D6GDa1iAiU1hDQ7U8QqLOCHm3IQ4tYpwDZJuV2CQrDbJefE6I3Trh65lRimARxp9cG81rI2Xwp6fqpu5jjjZDO4T0dAEl0fvL96keZA/kFKx9w29C7ftiri7oh9Xhx70DZB5jTH0jMsIwn4/ufsDN2f2Gj7QA8Dl3F0ITwKh/zg8ME/FNg9+NzDUMuxQDs5IGiwvvOV8pMWnMYuf+nd0kqvF9ZPl2QWy5oZYJaYOsRqZNhuFQE009e8s4hRVaAJOYrgX1JxBLtkb/BHt+DwL2tJKx+LBC9lIHE+J+NEiM+9+96Wg661+B1bzSDfSxLHewgjkBUyXuLFXpD37KStaPjR3/vvjMGQae6XQY12nRCe0HQ== X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(396003)(136003)(346002)(39860400002)(36840700001)(46966006)(83380400001)(7696005)(6916009)(426003)(2616005)(82310400003)(36756003)(47076005)(2906002)(86362001)(55016002)(36906005)(8676002)(316002)(5660300002)(6666004)(186003)(54906003)(1076003)(36860700001)(7636003)(356005)(16526019)(26005)(70586007)(8936002)(4326008)(478600001)(70206006)(82740400003)(450100002)(336012)(6286002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2021 10:36:56.4257 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0cfdc782-7a59-4f99-b868-08d975d93e6d 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.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1703 Subject: [dpdk-dev] [PATCH v2 4/6] common/mlx5: fix class combination validation 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 Sender: "dev" The common probe function gets as a user argument the classes it should create, and checks whether the combination is valid. In case the device already exists, it checks the integration of the above with the classes that the device has. However, the function does not check the combination when the device does not exist and it has to create it. Check if the combination is valid for all cases. Fixes: ad435d320473 ("common/mlx5: add bus-agnostic layer") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 459cf4bcc4..f6e440dca1 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -317,14 +317,16 @@ mlx5_common_dev_probe(struct rte_device *eal_dev) dev->dev = eal_dev; TAILQ_INSERT_HEAD(&devices_list, dev, next); new_device = true; - } else { - /* Validate combination here. */ - ret = is_valid_class_combination(classes | - dev->classes_loaded); - if (ret != 0) { - DRV_LOG(ERR, "Unsupported mlx5 classes combination."); - return ret; - } + } + /* + * Validate combination here. + * For new device, the classes_loaded field is 0 and it check only + * the classes given as user device arguments. + */ + ret = is_valid_class_combination(classes | dev->classes_loaded); + if (ret != 0) { + DRV_LOG(ERR, "Unsupported mlx5 classes combination."); + goto class_err; } ret = drivers_probe(dev, classes); if (ret) -- 2.25.1