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 27A5BA0C45; Wed, 16 Jun 2021 06:10:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 50C6D4113D; Wed, 16 Jun 2021 06:10:11 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2062.outbound.protection.outlook.com [40.107.102.62]) by mails.dpdk.org (Postfix) with ESMTP id 6FB794113C for ; Wed, 16 Jun 2021 06:10:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YODQvKIPmuhDiuFBrKuwljw7GXwcvK5aQgJAI6TYUjy0+mFJvzN7CZ8VnkCR3NQzzivupnnnBy/eib1bVlz6EeD9anNKVzvAmwnKgIwj03BeqmoqUIUydG2StRf70Sj1HRRMGr1fhwP/BJsI0UOHovlXtsUAOY9P2+FchyAKGozXoEuiPdm52YWZbF4M/CWw4eKB9VwL5WW23PVOomZ7ru/qVx8LTjsgKEcTkS55KDzOsHKzj94/qPzdeAk4YdHbjRT7jMK/kX8g0XyAvu9I+8P/cWjsWCugugZbjsdtPZ+rw/CILeiK/QreMVFdatPRChrlHASQ1fBkPzLboqgYog== 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=qjxEzJV5H8iouqlK18TY9Vpi5bnfI7ci1DlsJ+H1d0o=; b=HQZuBz+oW6icINUrrJlwpyKfDbVsFc5kM4jRaWSPk2daho100jOSLM/lPIyvh9WRPsiYbiZdOqmuD/IKwpDQxhFHCZ8rrUCcKKA+Rv0cBDxiHH9HIpEon4nLgyMLaOVmQqMRvaEEyFOegi2rPGrOapkmR9tBzNrvzqN9dlvIl9GtMvKSBjzd18PvxeO0P/AWuraPmkDvvMLfQsVV3q2zAJnyr3IpSn0ST1sTit/MAvY04vBf8L2vA65tSD465lOs+9AIKIarDbEAFn0j3GYFIdL6QOapwe+2g/Kf56PcLr7HMAi0wAIkq3GTF/MNB+JM/18L/g7T1QGBjseBLmTFHA== 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=none 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=qjxEzJV5H8iouqlK18TY9Vpi5bnfI7ci1DlsJ+H1d0o=; b=SdBNkdaHeqPx3N+OrkVA7+bNf2QDZXCrTXFUbyprE7gB8oPfqYQuASCp9gS25IjY785U5nRimjQyQnvXsoNq20K6BjYV7+3nVaumCXQvkfvQ1Fi0fIPGyxZz/7qRs3jrqt/1cVGf51tUjeiA5NAwQWhaqRhdszZ4x4pAlWbILV3vQmFtGC8EJ16ime2nsv8h5WLyq12JJFvGnIZVt39SDP1ZexOco3nc36uG5SDQqNjGyOOo2M+UYC7VmkFDkPSHmSSttvdXI+foiUempunMT8tOth4ACpW42TlWsKx25mEFZ+vCAIeB8452/70qXKNQnwU6QQ+VDAu0XnSdGPrzpQ== Received: from BN0PR04CA0102.namprd04.prod.outlook.com (2603:10b6:408:ec::17) by MN2PR12MB4144.namprd12.prod.outlook.com (2603:10b6:208:15f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.24; Wed, 16 Jun 2021 04:10:09 +0000 Received: from BN8NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::50) by BN0PR04CA0102.outlook.office365.com (2603:10b6:408:ec::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.20 via Frontend Transport; Wed, 16 Jun 2021 04:10: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 BN8NAM11FT049.mail.protection.outlook.com (10.13.177.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4242.16 via Frontend Transport; Wed, 16 Jun 2021 04:10:08 +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.2; Wed, 16 Jun 2021 04:10:04 +0000 From: Xueming Li To: Viacheslav Ovsiienko CC: , , Matan Azrad , Shahaf Shuler Date: Wed, 16 Jun 2021 07:09:29 +0300 Message-ID: <20210616040935.311733-9-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210527133759.17401-2-xuemingl@nvidia.com> References: <20210527133759.17401-2-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb8921e8-f870-49b0-edc1-08d9307ca15f X-MS-TrafficTypeDiagnostic: MN2PR12MB4144: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CAsuYTXB7L3gIeOeUCqFUu5lP8Jr+Iy/UQVp7N0URHkXc3X4kAViabEg/y96Z5u+6AppHPbQZrnxG3IVNI6mPVFsWYv4gkbViMQ4YCNoC5UqJoonEW+JivHslEmVzRTuoS0G+XGxuz5+ALLEX//eHywEkcu/5D6xA7dNWRnR2CFcwtOXPI0k46Yh61/rphrXyfCtRrWhwgYf/RjP7QTrItWRqhXbIks4r5m+YWC1cnY4nzziCxu/oy59TlrPpxzRM5HBjcz9FZm+66rF3YXmbr+hVac6vksKi1vj0KtQv0tFXCfKCtsoAIt1+E25P+RwBPwy9BAeLw24yURh9S8pCcTvb2Lbi0lUkwYuH8+Fc7LNsQMReDH5v4IVOhywKLzdaqLfLNEH2i/L+WH8SCW27sSR8Mdsi2n7qfa6y1bN3o1vEsiR2T0Lc0HZB8JdABHXu1poRWlwukhlDBmvyH6My6aqFRdqiXzyexutji9t1N2EOOWmfB49o+tXKidTQSY7C3T9c0BfubHfS9UlG+Gq2UgbOfJ0j9NUx5PrOyKI3S+G1yaJxXKFa8QlnDa2Z4jEI4vDkejXyktXjP5jVfZMp9JYJG8vwIeDgFUsFZdInk6sc0icuLGwmXcaIEVz2aSQdMHIQsZmJ6S5mohTCwYwvA== 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)(396003)(39860400002)(136003)(346002)(376002)(36840700001)(46966006)(2616005)(86362001)(16526019)(26005)(107886003)(426003)(8676002)(82740400003)(6666004)(186003)(4744005)(70586007)(356005)(55016002)(47076005)(5660300002)(36756003)(7636003)(70206006)(8936002)(6862004)(37006003)(6286002)(1076003)(2906002)(54906003)(316002)(478600001)(4326008)(82310400003)(36860700001)(7696005)(336012)(36906005)(6636002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2021 04:10:08.9273 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb8921e8-f870-49b0-edc1-08d9307ca15f 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: BN8NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4144 Subject: [dpdk-dev] [PATCH v1 08/14] 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 --- 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 47df3b92f8..9a3616d539 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1168,6 +1168,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