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 DA4B3A0C51; Wed, 21 Jul 2021 16:39:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4BD4241109; Wed, 21 Jul 2021 16:39:12 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2045.outbound.protection.outlook.com [40.107.244.45]) by mails.dpdk.org (Postfix) with ESMTP id 051B341124 for ; Wed, 21 Jul 2021 16:39:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PRl+1VIDz87dXCLCMZUOAIpa5K2Eps5k5N59AqduNgyYeWxnWoeTLLNOOV5/8VpmIX2Gwt5y4b6+uz99IffEY848WYPV38uL7c7aoX+Efuxy54N7+YM6iUCI65iU6EYnc+6CEqtvIxplgdUziLlTE9RBxduIc3SteGdTIijH0H7PnO+55cvEa2fRLneD3QrQhvxFwORUw45eFsPCabM9geeD5Fj/0ntvqQFwoDLYqL/uZLjGc8pFumf5dVms7xEBoK5js9sKQwC4rltCGnYRSCMXmAE4oJbectyjkrwExw8FmINCrx706MuR4UgDB++zb2BUup4lZhUNVhutKrp6Jw== 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=xLWFttL1YYSCjPgy2gRDI/qscTd03+dU2tU5A33ZAXw=; b=j3zIPYPtl5KjZvebdMEDh13ayVaXfkp13zMIWL5a46ezl7D08cw+4DWG/9stl+EhWP1NO/hEabYovtBwRSm/gOOwTxlx6KWbI/SW80wNS3h8NXCqGYcGKXlV+tEOggmBMuwVPZ4RN+XaBdHW1JOnd30Lhv4rSH07ABi6DTG4f7qOpsAUMLjRo3huNBDtXMzfLVv7/MHR288nYiuD9+FDYjCw5WX94bAsanK7J9p3z/G0TXOHpw8wqQMwzLowl6dGWg66TUo4c/fphJwYg/78F/cvjXqkhA0xQZhO4V3vLk9KeBfsQHr3059RPOKeNF5vHRZdQUczXz3tge4aXfsf1w== 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=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=xLWFttL1YYSCjPgy2gRDI/qscTd03+dU2tU5A33ZAXw=; b=sFglfmXMHJQXc7IX6h/bnFCc52HoKvy+EYHmnceXFNN2cAx/gDzLHle9O4apStDM9JqQJPpUMEzR8bv6DE12Tr9tkPgWRMJE4pAPuM+fQcxt8XQ/2ArxXewrlcVlCP4r3D6Hf8Pn+o8TE4HSYmZYJaf1TbLZ45p1372BWcuPpMYrINUsrHAE4lvyuZdqiudoNFSoiJESkGNph9SyoXhS5KnYSVxB6xt1B42SeoDTwH5A+kHrrCB0Ed2Fbmo1oCXl4mexccG01EL1PFpw6SRVnqDhLAqi1ZL+Tu60E5ColaK/9zhUIT2AsJ+SmecVmbDjlKVECW7w9Tck/fr+G39sOg== Received: from BN6PR1101CA0014.namprd11.prod.outlook.com (2603:10b6:405:4a::24) by BN8PR12MB3474.namprd12.prod.outlook.com (2603:10b6:408:46::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Wed, 21 Jul 2021 14:39:09 +0000 Received: from BN8NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:405:4a:cafe::6) by BN6PR1101CA0014.outlook.office365.com (2603:10b6:405:4a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 14:39:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.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 BN8NAM11FT035.mail.protection.outlook.com (10.13.177.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 14:39:09 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 21 Jul 2021 14:39:06 +0000 From: Xueming Li To: Viacheslav Ovsiienko CC: , , Matan Azrad , Shahaf Shuler Date: Wed, 21 Jul 2021 22:37:36 +0800 Message-ID: <20210721143743.24626-10-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210721143743.24626-1-xuemingl@nvidia.com> References: <20210616040935.311733-1-xuemingl@nvidia.com> <20210721143743.24626-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2bd001fc-c88c-4b16-53bd-08d94c554cfa X-MS-TrafficTypeDiagnostic: BN8PR12MB3474: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ag1+iEGXq5csNij6RsZp9YICpgkap7SZ0vsy86wm10snqaMgJ6ZHnzEbh2KlNZoLMMzSo89nWU6oLavW/fTGpvxlInpE7YtjiGDZGj/Z52wO3VM3dA8yAdfsYUWkBX9aTuSiN+hApck8H8mWikzu+on6u75e5BDOFczLh05hj8s7CAxxdccvhlIfpQC/zJibzcJwU0k9c7CANA1yRJKJa04/UrAlod2KEaWY9zLqFOCpcSY4N3ZbjgBmXUnA+lPoUZ0r8orc+cacljIucMBGPQSUWJTlrnO+T/TopEhzXaPLbCuUmmAwSDAXJSlIDvcKa6b3pfNsJTvr4+41psyn/g2mMyPqNApQ2ZzfyOlAfPE0ET63F4h1yRlbryx3iB8nhNHG4UI3WwA2nIjZTo5tqUKrZhiH3YcVfiwc16ZOV9Rg4vYHSAOh6LOpw0iJrs5lp89IPQenckBTg9d9ONv1X2WAexBA4ZkTvxKTq8P91HtLONNMkij3YZ5esbGoAM1LDfQiy9S/RU7RgFYYZqMNxk+Kg3QXj8LCCJKx3p6wSHvmgmdyFqoYTOL9obUAcqmQrCY5WCGSwTRGOvuGM6CO/Ky847UMTu6QFmy4sb3xCkeC+qFESB+PAmRfCsjd0/mX4YKTuXXYcnsaB+dF5sYO5F0zRHcJOyBroLrVo4q/GSrRNvRp0GjAwPQeCMjzajQ0b4fbiIMibngeyukgf2E5uQ== 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)(376002)(346002)(396003)(136003)(39860400002)(46966006)(36840700001)(426003)(336012)(55016002)(2906002)(4744005)(6286002)(2616005)(70586007)(6636002)(6862004)(16526019)(36756003)(5660300002)(47076005)(70206006)(1076003)(36906005)(4326008)(316002)(356005)(478600001)(82740400003)(36860700001)(6666004)(54906003)(37006003)(8936002)(7696005)(82310400003)(107886003)(86362001)(26005)(186003)(8676002)(7636003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 14:39:09.5571 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2bd001fc-c88c-4b16-53bd-08d94c554cfa 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: BN8NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3474 Subject: [dpdk-dev] [PATCH v4 09/16] net/mlx5: check max Verbs port number 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" Verbs API doesn't support Device port number larger than 255 by design. Adds check and fails probing with proper error log. Signed-off-by: Xueming Li Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/linux/mlx5_os.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index f041f9054f..db44169b84 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1294,6 +1294,12 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, config->dv_flow_en = 0; } #endif + if (spawn->max_port > UINT8_MAX) { + /* Verbs can't support ports larger than 255 by design. */ + DRV_LOG(ERR, "can't support IB ports > UINT8_MAX"); + err = EINVAL; + goto error; + } config->ind_table_max_size = sh->device_attr.max_rwq_indirection_table_size; /* -- 2.25.1