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 3C89643252; Tue, 31 Oct 2023 15:28:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 282614113D; Tue, 31 Oct 2023 15:28:25 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2085.outbound.protection.outlook.com [40.107.93.85]) by mails.dpdk.org (Postfix) with ESMTP id 3559940E64; Tue, 31 Oct 2023 15:28:23 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KADOs1kKNsLWrVVb3yS45OnT8Td7eKEFyfIJuJASixC0lH1TgEI4BJ6PzhqttiM5HSPAzp5LVY7OeFMjwgkF97UN+MnKFkqI2u/4PllATLSYTSXIjjs+OZE1zsc3plz2TS9QCc/SHRPFtIpNXd2iVD6v7hJSh8/unEcdlHLVpjk5kkMjlBC3hq74Dj8A2SKyUMQXwRtkCKIn15BQE4oOeIkKUeGJNtnU10kuFwvwnSAY6QsmqFE2O7IactA+j83qBl90UGXfGr2fTd/QtWrf4M2R/bFLwahTFlMU5kDi61jivQvNPtHXJKoduu/vQ0l13S+b1Nt7pg+hvqTgUzGLWw== 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=fEcjYrsoVwRfouF9+qytFT/QvoVk/fgbGRYiLCJky0M=; b=lRUQjf/FQiSsxT8UlnozoGEXqImvX4v7O+WTPh9jr7+6YHz5hcSJiPKwCbIzXuB2FFqNmbMAxJaTA8TjZkKoUyLXMLc9MUB0AyFHYwqFpNtV+SOiccSdP83g+GZyl089q8R9Pu87NzAMBnTNHv0SHXT1gjW80ACwPPFnAlG0fzXi8cPJCsMEC+o5wZM8wnDsrQqcQNHUY4LMbTd0OdDLhqhnSalwMT6Xc1+oMHjHdZgciJvw6/zCD+202cLvxzKIByBMxKpDL/Aw+FuwT0tPbqoRMVOBvR7v3BEdfzjcl7EmzwjrTYsoecuC10txTeTHj7oN9a9xfDdc71ZsYSK93g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=fEcjYrsoVwRfouF9+qytFT/QvoVk/fgbGRYiLCJky0M=; b=QvRvfK+K4WpjofofUQJW7XGHoSgbeMkpgmhWRPukstRxOwfpNjuSI0KsIkOg7qAZCpKhE9jEPjqf0x0QahibsoJfwB/S3wfzUUTnZ4UERcX4RtMmpNsLLvciP9biZuk7SNfQG2HTdfB2z9fn8sDJKd5vT8Kaqs1R8QWLbocZtZOTT3qn7+2rx3e+TkYxmmgjtICoYk/5ttIXP9ys+QFmPguEG1xEzxkGkceIUUMjQ7TyazRqrGYUr3+frFtQ1/XncA3Eni+8qhXLqM9vJ0Yxftj52o3DbKxFK1kH0YjSDxLN95l+JP1xCoqBqKeF7BNwyobIObPSDVHvItEjOw1UBw== Received: from MW4PR04CA0076.namprd04.prod.outlook.com (2603:10b6:303:6b::21) by DM4PR12MB6039.namprd12.prod.outlook.com (2603:10b6:8:aa::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.29; Tue, 31 Oct 2023 14:28:19 +0000 Received: from MWH0EPF000971E4.namprd02.prod.outlook.com (2603:10b6:303:6b:cafe::47) by MW4PR04CA0076.outlook.office365.com (2603:10b6:303:6b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.29 via Frontend Transport; Tue, 31 Oct 2023 14:28:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by MWH0EPF000971E4.mail.protection.outlook.com (10.167.243.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Tue, 31 Oct 2023 14:28:19 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 31 Oct 2023 07:27:56 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 31 Oct 2023 07:27:54 -0700 From: Dariusz Sosnowski To: Matan Azrad , Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Xueming Li CC: , Raslan Darawsheh , Subject: [PATCH 2/8] common/mlx5: fix controller index parsing Date: Tue, 31 Oct 2023 16:27:27 +0200 Message-ID: <20231031142733.2009166-3-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231031142733.2009166-1-dsosnowski@nvidia.com> References: <20231031142733.2009166-1-dsosnowski@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E4:EE_|DM4PR12MB6039:EE_ X-MS-Office365-Filtering-Correlation-Id: d9cc685a-c331-4f9d-29b7-08dbda1da0ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fAuYG14Gf6dNo53h6EB+X9EpK0VgR96aFtCNGhte+/BlONUs7EB76h5HeCfZTO1eJx/e6wx+C4Oh2t9qhtBUgLCp2Qf4B+98tj4mOrZONoaAs3sM8bXtceJE2y1Qw+JgiiBudnzo8f9RqnmfwUn5qCfWg6mtRxB9fwLqw7dFOQWTgwpHVIhmBtze+Tm8zVOxMAuYmOGMpjfU73aNnF5rUxx6guhBVcTo4rf0nbWtivMA5pAMfzyZc2XF7TZCM1isH+3xrMKsI+nmG5k+v3WDmenkzfX7nfU1z/R1BWjU3oxD+uiE7f19z4DAc7oXftme0Ccj2k7O+dCoPZORVNS6aEHvaMpt9g3SbuvqP7TuLKgdLHRbkqMgLsEDvftSInLisbaOUoTRqg+BjiHnCAw2rfEUKc7k7abuQKFOzeHHrv6jcy23WpP4KZrxnp6MA2iU3pPSNrIV3VUyjoRhRWfMRUzxGqOuefW8EyFlv6xNqfshFdySIrdPCpin8HcTa4ig9Pi3GJ5otE00s260BaeqdSX0LSS86BHkQXfipoztICldomBAkp6ikgfOPScepuh67EDXVpuUQOn3yW0D6IuP1/qv8lF6+iGP8jWR60c8+xY93Nh5AdD9O4hd0HIBzEB1eGbaOcxcX/MK3Y0ewATEOZY66J30l/uZ93OrJY/+Ybr0J6LnmjRZlvymaHuwcjukB3cUKMXcikfnsIrqn9ifJ7OTvFzAVaNGM67jAsmO57U0tmZ7jvjGBJ/NAHNCHEVL X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(346002)(396003)(39860400002)(376002)(136003)(230922051799003)(1800799009)(186009)(64100799003)(82310400011)(451199024)(40470700004)(36840700001)(46966006)(356005)(7636003)(47076005)(36860700001)(55016003)(36756003)(2616005)(26005)(336012)(426003)(1076003)(82740400003)(6286002)(16526019)(83380400001)(86362001)(6666004)(7696005)(40480700001)(2906002)(478600001)(70206006)(54906003)(110136005)(70586007)(4326008)(8676002)(450100002)(41300700001)(5660300002)(8936002)(40460700003)(6636002)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2023 14:28:19.0389 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d9cc685a-c331-4f9d-29b7-08dbda1da0ec X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E4.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6039 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 When probing the Linux kernel network interfaces attached to E-Switch, mlx5 PMD decides the representor type and represented entity using phys_port_name exposed by the mlx5 kernel driver in sysfs. mlx5 PMD first checks this name for multihost controller index. In multihost scenarios, phys_port_name is prefixed with "c[0-9]+" string. Included integer is the controller index. Assuming that phys_port_name contains a string representing a physical port, i.e. "p[0-9]+" string, the parsing logic is incorrect. Both "p[0-9]+" and "c[0-9]+" match the formatting string used to parse phys_port_name, but controller index is still filled out. This patch fixes this behavior by storing the parsed index in a temporary variable and setting controller index if and only if phys_port_name matches multihost controller syntax. Fixes: 59df97f1a832 ("common/mlx5: support sub-function representor parsing") Cc: xuemingl@nvidia.com Cc: stable@dpdk.org Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/linux/mlx5_common_os.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index 7260c1a19f..41345e1597 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -96,10 +96,11 @@ mlx5_translate_port_name(const char *port_name_in, char ctrl = 0, pf_c1, pf_c2, vf_c1, vf_c2, eol; char *end; int sc_items; + int32_t ctrl_num = -1; - sc_items = sscanf(port_name_in, "%c%d", - &ctrl, &port_info_out->ctrl_num); + sc_items = sscanf(port_name_in, "%c%d", &ctrl, &ctrl_num); if (sc_items == 2 && ctrl == 'c') { + port_info_out->ctrl_num = ctrl_num; port_name_in++; /* 'c' */ port_name_in += snprintf(NULL, 0, "%d", port_info_out->ctrl_num); -- 2.25.1