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 EDA79428F8 for ; Sun, 9 Apr 2023 17:37:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E863A40A80; Sun, 9 Apr 2023 17:37:09 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2047.outbound.protection.outlook.com [40.107.244.47]) by mails.dpdk.org (Postfix) with ESMTP id 4A6DE40141 for ; Sun, 9 Apr 2023 17:37:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PCSuix3nZDGtpdIbMYf1t/Su1pHDnxuUi6ZYh57xjIvCITfv1MU2KztieBYmKa+Y+F0WOGTzDFVL+gQ4O18/IF+RbnxFbkPktWMgybhiJjXTEIG5Fg+y4Ya6txlZkdT/8gIC4s+MjOaKxMFYHFfVkn6QlGndRlg24GG5q14+rIYSNCoiXN0MBxhV39LMI6rZTJLKCWskY42hZreprbCIMo16qP8BexYItuKkfEz8D3ka+StDllJ8YSqNZTeGsLLr1eF7BHPz1HNAWZrWkP1ulTL5F72XNwxhigkoENjQwK2YuSTonxYW7Q0EOXc/DV8zjNRj/Z3WuA45dwLVq3fMRQ== 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=y5X19qI5ywoljhL5Gq1uYrdDgXuP8DhMFfifzRuqctA=; b=mJquZGvhcTiQ3l3p8M8V4mybJl3Nl87UpB1+dQaF6L4Iv/XI4XfIXS9xVITsLktGQNx+qodOPTRKV6nL6ehhjh/VzsMzSNyxv8zQG1VVlym7GwQScJEmMCg7WBfJpxoh1EanyCLykb/gQ4DaDFZG8iuBPenXoM48vaROAbqelavn9lRoHRUM6tyvdx+dkcJYDBvcNwye59VrzLdcjQscxgX9L+v3CVV7mnS79Ed2mPtFi0jpG9GspYsxfxV7j5N+x+TIsHluD819WertYBE3goG+6U5iU7F6e6z4gVm/66QsNnh0Y+zJ6JoPW0U85ag/V99UnAVM4Tn7T7PEbLxLJg== 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 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=y5X19qI5ywoljhL5Gq1uYrdDgXuP8DhMFfifzRuqctA=; b=hs/i8HmCP2YYmHinzb0xmdfTITnlldrv+zn9mCg0AUY4o9mKkjQx91EYatZb1smKI+zHz7ldT4c9PX6+SGl+pLEtno9purRcu1R08ScX2fzQZURG7jbZ4ysbiKPNyen9u9cyWRL4njhJwos5NNhQltdJoODRIS4LRFT8nakOkcUjoAOcS4nlHnpOhpdKMfNLVQeIAjCPpYGqU5KRe3X9zceD4TAaaEJgJ+FRs2Ru7Ra4CQvtUINEypVY06/mJ6M+mvUqzgYoV/d7ZdRQHH/LHWhroDv3sRvPG/FomF4K50YN0ybhfo8gvknDmU8uxQTFJTUCawMPXFCF1wk3wGo/wA== Received: from MW4P220CA0026.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::31) by CY8PR12MB8196.namprd12.prod.outlook.com (2603:10b6:930:78::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.31; Sun, 9 Apr 2023 15:37:05 +0000 Received: from CO1NAM11FT096.eop-nam11.prod.protection.outlook.com (2603:10b6:303:115:cafe::14) by MW4P220CA0026.outlook.office365.com (2603:10b6:303:115::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36 via Frontend Transport; Sun, 9 Apr 2023 15:37:05 +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 CO1NAM11FT096.mail.protection.outlook.com (10.13.175.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.20 via Frontend Transport; Sun, 9 Apr 2023 15:37:05 +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.5; Sun, 9 Apr 2023 08:36:59 -0700 Received: from nvidia.com (10.126.230.37) 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.37; Sun, 9 Apr 2023 08:36:57 -0700 From: Xueming Li To: Bing Zhao CC: Matan Azrad , dpdk stable Subject: patch 'net/mlx5: fix sysfs port name translation' has been queued to stable release 22.11.2 Date: Sun, 9 Apr 2023 23:25:21 +0800 Message-ID: <20230409152529.5308-134-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230409152529.5308-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230409152529.5308-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT096:EE_|CY8PR12MB8196:EE_ X-MS-Office365-Filtering-Correlation-Id: 46ab62d1-c340-41ff-34e3-08db391045d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZTDZ5Z7zTRNNFuFQp+FJF4HsL3LwUsqWNcLhrqwafOmvNBs/ksaMP4309qN/IxPO/xzTvT3LYi6gfuA93zPjwb3lfo89+w/01yMW3d1IAwIrGaJIsD5Z4GH2xdLTTE4UgA7qlesO2hOPPfRH1Z7mUpvJYnqYQoxvN0agjqekxUBwSLWR7H3VuzjDqRtSgk8N4pNs4I7yZ1X2i7Sq8klpHwkMSUWCnLXKVmDAKxVerVZF9k98H0u+5uYAuCluC877hAqHdjZYC00bUoPx+G6iiWMTGasv3v56/4bd2nPp2IEGz20+2n4DBmEpN6Q+RH3b1b5jpC0U/CQGcDpPLzaTz2mvzicf10e6P3H5Mv1+ndJp3YY6UM+IWMGkN263zOpxPll9UTlJr1tknvZL0zZaKQoLTNaLaS5qtkmNbxDZrO289d5e6uL8ZUnC8hKhjhf2txm+PF096DIXvOVrlS0L13vKDGLDw78GjWIgEZuDfmQrWpP0YnZtJfdghqidwvzb7N3i4tTIg4ROGEfQ0Zhhsh4emheigoQSzYzjNLQsSsmafHisYsZhNqSfiim0VFtF324M1wMBIHyzpzYuHIcrGiQuWMAT32GX+pmxWww+NJzXqKOfsCHhRyikMsndLPw60VER3Xybe7ZxpE1V7fr1KzL036cHyRFySjxtqGjhfKqa0bJqCQhzrSrmnFcsaAtFlPKm69kP/UCWkj0dXm4UYMPptDMi6ZuWtmKoNIsPchWLsIZLf8PTpD/6/vLuwTC0mS+aVHRhzEzdr/Vbh0X5SNXxyCUO6G4XFL6Ki5/LobtvG5zX6e8srJtyrBK21bYroYsnrUv55l3mYNQxurmcww== 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:(13230028)(4636009)(396003)(346002)(136003)(376002)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(40460700003)(478600001)(6636002)(4326008)(54906003)(7696005)(70206006)(8676002)(41300700001)(316002)(37006003)(70586007)(966005)(36756003)(86362001)(2616005)(426003)(83380400001)(336012)(1076003)(6666004)(26005)(53546011)(47076005)(82310400005)(8936002)(6862004)(55016003)(40480700001)(5660300002)(2906002)(6286002)(7636003)(356005)(82740400003)(186003)(16526019)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2023 15:37:05.5783 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46ab62d1-c340-41ff-34e3-08db391045d2 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: CO1NAM11FT096.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8196 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/11/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/2fe7fcc1a35b392a1e1903a2d047829621744c8d Thanks. Xueming Li --- >From 2fe7fcc1a35b392a1e1903a2d047829621744c8d Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Thu, 23 Mar 2023 12:54:14 +0200 Subject: [PATCH] net/mlx5: fix sysfs port name translation Cc: Xueming Li [ upstream commit f8a226ed65fa1c6e085fb0d5a91bab7fb5034aec ] With some OFED or upstream kernel of mlx5, the port name fetched from "/sys/class/net/[DEV]/phys_port_name" may have a tailing "\n" as the EOL. The sscanf() will return the scanned items number with this EOL. In such case, the "equal to" condition is considered as false and the function mlx5_translate_port_name() will recognize the port type wrongly with UNKNOWN result. The tailing carriage return character should be removed before calling the mlx5_translate_port_name(), this was already done in the NL message handling. In the meanwhile, the possible incorrect line feed character is also taken into consideration. Fixes: 654810b56828 ("common/mlx5: share Netlink commands") Fixes: 420bbdae89f2 ("net/mlx5: fix host physical function representor naming") Signed-off-by: Bing Zhao Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c index f1ff6f49f9..55801534d1 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -1035,7 +1035,8 @@ int mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info) { char ifname[IF_NAMESIZE]; - char port_name[IF_NAMESIZE]; + char *port_name = NULL; + size_t port_name_size = 0; FILE *file; struct mlx5_switch_info data = { .master = 0, @@ -1048,6 +1049,7 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info) bool port_switch_id_set = false; bool device_dir = false; char c; + ssize_t line_size; if (!if_indextoname(ifindex, ifname)) { rte_errno = errno; @@ -1063,8 +1065,21 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info) file = fopen(phys_port_name, "rb"); if (file != NULL) { - if (fgets(port_name, IF_NAMESIZE, file) != NULL) + char *tail_nl; + + line_size = getline(&port_name, &port_name_size, file); + if (line_size < 0) { + fclose(file); + rte_errno = errno; + return -rte_errno; + } else if (line_size > 0) { + /* Remove tailing newline character. */ + tail_nl = strchr(port_name, '\n'); + if (tail_nl) + *tail_nl = '\0'; mlx5_translate_port_name(port_name, &data); + } + free(port_name); fclose(file); } file = fopen(phys_switch_id, "rb"); -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-04-09 21:45:42.165751400 +0800 +++ 0133-net-mlx5-fix-sysfs-port-name-translation.patch 2023-04-09 21:45:38.809042200 +0800 @@ -1 +1 @@ -From f8a226ed65fa1c6e085fb0d5a91bab7fb5034aec Mon Sep 17 00:00:00 2001 +From 2fe7fcc1a35b392a1e1903a2d047829621744c8d Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit f8a226ed65fa1c6e085fb0d5a91bab7fb5034aec ] @@ -21 +23,0 @@ -Cc: stable@dpdk.org