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 6585AA0C58; Tue, 31 Aug 2021 22:38:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8890641151; Tue, 31 Aug 2021 22:38:09 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2068.outbound.protection.outlook.com [40.107.236.68]) by mails.dpdk.org (Postfix) with ESMTP id E380341137; Tue, 31 Aug 2021 22:38:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JJe0mFCKfjDSIF6C2Y2r7f86LbXBHSF6VWU+B8pN0xycjgF+90iKLVgN+BK078hvpwNz5KEw9HWMiioqd2VbCilkDG3YNjwx/B8oO9N85NAdHQNI84vu+3nDN2zCkSQFRmQ6U45xhGdK/Da1v6+GZSFQ4zqVb+QINHqaHyucBNXsbxn/05NOkfGqrbzuqL/Mqt8R1GwbvVy1e7RKi9b1p0Tm+N8hgm8WAD/6z0do6zQVIWoEf/oWBIJUbMZwvfhB0KRUBvNDBUW7ZHMPzwUXrx4MUwjOJTp9ho5j4viIbr/Wi2QjCb7IhdkEgMmMAi7K1rk1SIV72EhTOsMTk33UGw== 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-SenderADCheck; bh=geGQFwh1a5V+p1UZKW+WYcva3SdmlkU6NwGiwTD1nd0=; b=iVlFRVUovFYnrJJtlbOzvpPr9SG3zULcHTqhL78Tn4i7BUF+AdEfEIwWJGH6P+g4WmB5uRyQBlaeugBwSxBkT/Xn/Nav/wrYX5FRnuzC6TWZE0pZ494J9Ig/pKKas1qh5oMa7cwuIo8463bnTKLjvW+o/QGELFZAeUVmc6LzkiMReOWcKXtLN6w+TpyZkV3ns68T7Tiu5g0C4qETZ9hULhBve14PigKrfBdTATzUJ/kuTEEPV2Gmy6yZ/xWmUyVwQQbk0hMmzZJYWpDsHDnU0xfO54xL0J8gUGyAGIMx6W6hBHsfscg3R+y4EgP50Mfnuncy0UFfydq4wTT/czPPrA== 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=geGQFwh1a5V+p1UZKW+WYcva3SdmlkU6NwGiwTD1nd0=; b=TGQlDhFu9MK53Z7YddPQar2F0dsrpFbKWLLKU8JP9eUKiJ4OzaZ0vNXcPYh9jmlnG8UUPYbrfDGFSx4l0BtHx2DLIsmnnKKjuHsAHv4/B9/gJPSrP+qfJ1oMvKEE1OvPQsncb7UQEBhG8KEBZw47qtCroEQEETOUUDAfHJhSeOJtYZaK8Fp+bXIVzktoLsC8U9W+vAsRH6X1tcKiscdeLpYR8AG1776F99LkGT3m314FDhWANgeOyMyjYWQin40Davb7vl9/yiVNPuJ8NS4JG5Yj4Ld8G+sBaO/Ji9nrqJobl9CG/mftA0tQu+c5FiDWlw5MqU26swpL/QBAYDcIsQ== Received: from BN6PR1401CA0002.namprd14.prod.outlook.com (2603:10b6:405:4b::12) by CH2PR12MB4117.namprd12.prod.outlook.com (2603:10b6:610:ae::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.21; Tue, 31 Aug 2021 20:38:04 +0000 Received: from BN8NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:405:4b:cafe::13) by BN6PR1401CA0002.outlook.office365.com (2603:10b6:405:4b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17 via Frontend Transport; Tue, 31 Aug 2021 20:38:04 +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 BN8NAM11FT057.mail.protection.outlook.com (10.13.177.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4478.19 via Frontend Transport; Tue, 31 Aug 2021 20:38:04 +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.2; Tue, 31 Aug 2021 20:38:03 +0000 Received: from nvidia.com (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 31 Aug 2021 20:38:01 +0000 From: Michael Baum To: CC: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , Date: Tue, 31 Aug 2021 23:37:30 +0300 Message-ID: <20210831203732.3411134-5-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210831203732.3411134-1-michaelba@nvidia.com> References: <20210831203732.3411134-1-michaelba@nvidia.com> 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 DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b9baaffc-5271-4903-1749-08d96cbf3bb1 X-MS-TrafficTypeDiagnostic: CH2PR12MB4117: 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: 9uQfE5JuNZ3JhWIZpsnAF1ApQwa5P9PHwCyplsgYZGwPayy47TbHnhbE1wQJ0kFZl5d4JLSl4vnqcrlhFuzwDMPSUDli78MwO0l5+Mv4f9DIvaFReIu29s1iAcvkXfOiu3D2U0mgjs7ff38JRIXgbXyV9Ic8y95Wnmbal80+AQB48wEDgP2CP7+MrTZWiBn+2YETwNWw4dsatDpN/p8TJlg2oos+C52RWRpUmRFXgkeTPFkKo6ZoSvvgcj/lMQz1NuYv1Bdm9dIhNQO2WNgdmLaWtjMCtdW4s75Hm5Ete43zk5vK7bieEBLfgYFOWNlMxziLEMGjBwaGR4jbfRdfDjReW6Gi3tgZJYdRKykjQxLT+d+IptHkMxwhYypwBuIspwayqIZuEQ070FvIVcM4FBdW//emSw8DvheenSdaIJtgBb4PSScqMGuLAACQWLKDFIYnTunAhIG4WHcXY099BMnfAj9eeKdKmhFIRwIHvZYfTNUvE4BHrAYDF6ZHRRpAPjN3KQ6F5yPEUIu4T7uf4Wr6Ec8/jJc5qhYTwYPLqDd07eUt9dO2cOK45oAQTDHhUmO1RUjMA6+85W+tuLtek5kcxUPHr4VvvPEgx49XjHF6C+721wioyrf4xuiYJJOVT4L1O6LfEahBUm/5GM/Tz0SuN1nO+aJ4MoSROd3ebmoX3QjYBFXRuYVuYa50vH2/v4788qMNwLepDxp8SZx4wQ== 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)(136003)(39860400002)(396003)(346002)(36840700001)(46966006)(6916009)(478600001)(83380400001)(4326008)(6286002)(8936002)(82310400003)(7696005)(86362001)(426003)(450100002)(1076003)(2906002)(16526019)(186003)(5660300002)(316002)(82740400003)(2616005)(6666004)(36906005)(356005)(70586007)(70206006)(7636003)(8676002)(36860700001)(55016002)(36756003)(54906003)(47076005)(336012)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2021 20:38:04.3991 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9baaffc-5271-4903-1749-08d96cbf3bb1 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: BN8NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4117 Subject: [dpdk-dev] [PATCH 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 --- 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