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 D5BFDA034F for ; Wed, 10 Nov 2021 07:54:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7FDA40142; Wed, 10 Nov 2021 07:54:27 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2089.outbound.protection.outlook.com [40.107.92.89]) by mails.dpdk.org (Postfix) with ESMTP id D1BF640142 for ; Wed, 10 Nov 2021 07:54:25 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HW5dYHCJN9IlnCU0qL+I0eH+sYqAOqBLFac3msE0oxeEfI3fRF4RIQd4Q+uD2JwvYGjLreUyKO2JqdWWF8hBVs91kixLqcaz+M09uCSM3Tisowqvm9mWN9xXoJKafT8mmNkUNoJ6wSVP9v0eV7plACXBjOBLB1yDfjbK1zb5I69kNPzSUP2V8HFtexwLm/4gIx/Euq79MbWFITKglGCPEZg0xfJWhV+6iFRQxmS4+QWagYxjfGuOVeap6ZkIgSL+acAtArZa++jK9185Npf/mCUPzkOjFM0twb2dsKnft7wZmT4R/8oUWT4/ochl84NvAtYzmpQw/3TzSFAei/JB+w== 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=BoOZQpNlmkgF0EP7JrXXlF32PjPrLSJQkZj+lK7KeEA=; b=YtsPf1UQiy4H4oN+NjqCNIDfT3DYc8xfGq2CFrv9q1nWgyvv3TDlJ4jOzo9Z3UEdg4MY7QKqAxTf4U2gwx+PG0501yu5X4EGQVI4IOQ2dHgBFTxRuayZO9MQlCm/5v/HB2CDYeA6YyIvLQjS2uYRAkpm2pX0GnsUn3Gf2QKpRFLtyLPb7dGOecnZIg5tphaplAGaDmg3PckqeTVk6NE8TPGGHIuEUwML2gxsGQzh9SwnebegeW8Gj7W4FxojDA6EVrKbFJEU+xI3nQSps+ECwGQoEaqJngqSU7drKBD6YpjRa4oqM8VPCjK9tTbIUK2izdqdjtZA76EHyKO4YpuVlg== 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=quarantine 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=BoOZQpNlmkgF0EP7JrXXlF32PjPrLSJQkZj+lK7KeEA=; b=Xfa7lWYlh9mvm+5pb4U7dYm0Io7tMnvtCcpFtwd+RxWcL0gAQ8MiSfDXrHdeJ4EVzdarfmro73TQEoLSUjXdzoLs0u0vY9pGJbXnSKEfWC9KDC17Gc0Pr5jUI33Sw5UC5+aeiBQr07xur39/miX3FusstL5gZai2xHb1eZwLb5Fax/HFDRHsfzfuuI8DFwCv1EZKwjTtfcjacj5VYSeIdKc9Nc0oKiI47P1v3AN2atejmAXmh6LsK3eemTjpLOER7qNVt0g8uZohw1OYYJJIBMzxoMpZj+7lIwiBC/Syh+dfdq7Sj+V1Oi4wgPMrGWh+iwBncQUaIL+DJmBl3rkGtw== Received: from BN9PR03CA0275.namprd03.prod.outlook.com (2603:10b6:408:f5::10) by SN6PR12MB2671.namprd12.prod.outlook.com (2603:10b6:805:75::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.14; Wed, 10 Nov 2021 06:54:23 +0000 Received: from BN8NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f5:cafe::1f) by BN9PR03CA0275.outlook.office365.com (2603:10b6:408:f5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13 via Frontend Transport; Wed, 10 Nov 2021 06:54:23 +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 BN8NAM11FT058.mail.protection.outlook.com (10.13.177.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 06:54:23 +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.18; Wed, 10 Nov 2021 06:54:20 +0000 From: Xueming Li To: Xueming Li CC: Luca Boccassi , Viacheslav Ovsiienko , dpdk stable Date: Wed, 10 Nov 2021 14:31:21 +0800 Message-ID: <20211110063216.2744012-198-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-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: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 323d4e13-053f-4786-32ee-08d9a416ed97 X-MS-TrafficTypeDiagnostic: SN6PR12MB2671: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: L+W6B2UJKqBDrYBZdMsALTzbswsiI7Pgd9DQ9VQf1ug+ficHxjFv3Q53FoKvpX+fNCuRhSVqK+GydDflX44AX8mo4aLR2gvqn9WnaV+ZF7d7JiSayxb5WA6wvPjqsjWV9ugDu2O+IF8x9MXUWNuECxvl93tmv/t6L1U4ioZNvr5sbwgaQtB98jFH+5LJw5kR0oWeRsOvtVkxy00IXni+qN7oMGPexZ1rryR/DhLb1MVtYXNvLtGf5Y21QFMDuXHCstkmWzVONo2XwTEOR5cyYDNboKhiWPhwnIsaMM+32JkZkFCHu9w5pUCRcypbVWIrIaKkqX9CcI7BAQR/sB6H8yGg/KhvEykiccZZdpnv89gMI74BkiOFVhmnxnuREQNNj0xlSw/3GTJqrXF7jdZznpRR8Z+8Vi+zXU1yJ/m261VyWI2ufA93VPEtHudfgTzm/VRUeeZQIBF74gYD2qtB89LG/WAsuhy5XGrkEzVj80zfsDxFtXmXtroggx63pttg1LK3iDhiD1tw7NuPh9Y6lmha1aP9KTxWomzy+Wt5qCwiqOkmrkXu2gxAS8Ns7pwJdORUYIoQysYfBXV3S0jE5tjycWcAL6vdIYScENGFJbrkB/7BMuPEvMtvVFP/jERNfaEt8mMjDE0wINtTPxExcFhPuz3sy0V/Om7EnP1RyXv8YuA9gGh9ahrzPhOZhKocHh8YBV3v4/XpTqqQZ/97VyD83J7P9rF/8LeExZBKIALZeYFFE3TD343aenLBjSsVfaoEkFMfYIsOrNsynmXUxHq3VLOmvm7evdxij8/rnEJ4uOrVlDzFfIyHhGDk9ENk+kQ0aviafcHh/k7JOsCcPQ== 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)(36840700001)(46966006)(336012)(7636003)(8676002)(16526019)(186003)(86362001)(37006003)(966005)(53546011)(508600001)(2906002)(36860700001)(6862004)(54906003)(426003)(26005)(55016002)(6200100001)(7696005)(36756003)(8936002)(7049001)(1076003)(6286002)(83380400001)(4326008)(5660300002)(70586007)(82310400003)(70206006)(47076005)(2616005)(356005)(4001150100001)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:54:23.0061 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 323d4e13-053f-4786-32ee-08d9a416ed97 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: BN8NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2671 Subject: [dpdk-stable] patch 'common/mlx5: fix physical port name recognition' has been queued to stable release 20.11.4 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/12/21. 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://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/c4e68962efd30f3b4722bf4ad055d592141db69d Thanks. Xueming Li --- >From c4e68962efd30f3b4722bf4ad055d592141db69d Mon Sep 17 00:00:00 2001 From: Xueming Li Date: Wed, 3 Nov 2021 11:18:36 +0200 Subject: [PATCH] common/mlx5: fix physical port name recognition Cc: Xueming Li [ upstream commit 59df97f1a832a0edfd7f77ffbe5149e553e860b5 ] While device probing mlx5 PMD get the physical port name and checks against the set of patterns. If there is no any pattern match, the driver assumes the port belongs to PF device, this behaviour provides compatibility with legacy kernel drivers (before and early SR-IOV support). The newer kernels added the PCI subfunction support and representor names with pattern like pf0sf1. This pattern was not recognized by PMD and the first found subfunction representor was considered as master device. This patch supports representor name parsing for SF, and SF representors are just ignored by PMD (as there is no support for SF in 20.11-LTS release). Signed-off-by: Xueming Li Acked-by: Viacheslav Ovsiienko --- drivers/common/mlx5/linux/mlx5_common_os.c | 32 +++++++++++++++------- drivers/common/mlx5/linux/mlx5_nl.c | 3 ++ drivers/common/mlx5/mlx5_common.h | 2 ++ drivers/net/mlx5/linux/mlx5_ethdev_os.c | 3 ++ 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index 0edd78ea6d..5cf9576921 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -97,22 +97,34 @@ void mlx5_translate_port_name(const char *port_name_in, struct mlx5_switch_info *port_info_out) { - char pf_c1, pf_c2, vf_c1, vf_c2, eol; + char ctrl = 0, pf_c1, pf_c2, vf_c1, vf_c2, eol; char *end; int sc_items; - /* - * Check for port-name as a string of the form pf0vf0 - * (support kernel ver >= 5.0 or OFED ver >= 4.6). - */ + sc_items = sscanf(port_name_in, "%c%d", + &ctrl, &port_info_out->ctrl_num); + if (sc_items == 2 && ctrl == 'c') { + port_name_in++; /* 'c' */ + port_name_in += snprintf(NULL, 0, "%d", + port_info_out->ctrl_num); + } + /* Check for port-name as a string of the form pf0vf0 or pf0sf0 */ sc_items = sscanf(port_name_in, "%c%c%d%c%c%d%c", &pf_c1, &pf_c2, &port_info_out->pf_num, &vf_c1, &vf_c2, &port_info_out->port_name, &eol); - if (sc_items == 6 && - pf_c1 == 'p' && pf_c2 == 'f' && - vf_c1 == 'v' && vf_c2 == 'f') { - port_info_out->name_type = MLX5_PHYS_PORT_NAME_TYPE_PFVF; - return; + if (sc_items == 6 && pf_c1 == 'p' && pf_c2 == 'f') { + if (vf_c1 == 'v' && vf_c2 == 'f') { + /* Kernel ver >= 5.0 or OFED ver >= 4.6 */ + port_info_out->name_type = + MLX5_PHYS_PORT_NAME_TYPE_PFVF; + return; + } + if (vf_c1 == 's' && vf_c2 == 'f') { + /* Kernel ver >= 5.11 or OFED ver >= 5.1 */ + port_info_out->name_type = + MLX5_PHYS_PORT_NAME_TYPE_PFSF; + return; + } } /* * Check for port-name as a string of the form p0 diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c index 1f765dca07..145e354b2c 100644 --- a/drivers/common/mlx5/linux/mlx5_nl.c +++ b/drivers/common/mlx5/linux/mlx5_nl.c @@ -789,6 +789,7 @@ mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int iface_idx, int i; int ret; + memset(macs, 0, n * sizeof(macs[0])); ret = mlx5_nl_mac_addr_list(nlsk_fd, iface_idx, &macs, &macs_n); if (ret) return; @@ -1201,6 +1202,8 @@ mlx5_nl_check_switch_info(bool num_vf_set, case MLX5_PHYS_PORT_NAME_TYPE_PFHPF: /* Fallthrough */ case MLX5_PHYS_PORT_NAME_TYPE_PFVF: + /* Fallthrough */ + case MLX5_PHYS_PORT_NAME_TYPE_PFSF: /* New representors naming schema. */ switch_info->representor = 1; break; diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index a484b74b9c..4c75addd08 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -153,6 +153,7 @@ enum mlx5_nl_phys_port_name_type { MLX5_PHYS_PORT_NAME_TYPE_UPLINK, /* p0, kernel ver >= 5.0 */ MLX5_PHYS_PORT_NAME_TYPE_PFVF, /* pf0vf0, kernel ver >= 5.0 */ MLX5_PHYS_PORT_NAME_TYPE_PFHPF, /* pf0, kernel ver >= 5.7, HPF rep */ + MLX5_PHYS_PORT_NAME_TYPE_PFSF, /* pf0sf0, kernel ver >= 5.0 */ MLX5_PHYS_PORT_NAME_TYPE_UNKNOWN, /* Unrecognized. */ }; @@ -161,6 +162,7 @@ struct mlx5_switch_info { uint32_t master:1; /**< Master device. */ uint32_t representor:1; /**< Representor device. */ enum mlx5_nl_phys_port_name_type name_type; /** < Port name type. */ + int32_t ctrl_num; /**< Controller number (valid for c#pf#vf# format). */ int32_t pf_num; /**< PF number (valid for pfxvfx format only). */ int32_t port_name; /**< Representor port name. */ uint64_t switch_id; /**< Switch identifier. */ diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c index f641cb936e..08b51b7dc8 100644 --- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -1013,6 +1013,9 @@ mlx5_sysfs_check_switch_info(bool device_dir, /* New representors naming schema. */ switch_info->representor = 1; break; + default: + switch_info->master = device_dir; + break; } } -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:10.644954958 +0800 +++ 0197-common-mlx5-fix-physical-port-name-recognition.patch 2021-11-10 14:17:02.007411639 +0800 @@ -1 +1 @@ -From 59df97f1a832a0edfd7f77ffbe5149e553e860b5 Mon Sep 17 00:00:00 2001 +From c4e68962efd30f3b4722bf4ad055d592141db69d Mon Sep 17 00:00:00 2001 @@ -3,14 +3,20 @@ -Date: Sun, 28 Mar 2021 13:48:07 +0000 -Subject: [PATCH] common/mlx5: support sub-function representor parsing - -This patch supports representor name parsing for SF. -In sysfs, representor name stored under "phys_port_name" sysfs key, -similar to VF representor, switch port name of SF representor is -"pfsf". - -For netlink message, net SF type is supported. - -Examples: - -pf0sf1 -pf0sf[0-3] +Date: Wed, 3 Nov 2021 11:18:36 +0200 +Subject: [PATCH] common/mlx5: fix physical port name recognition +Cc: Xueming Li + +[ upstream commit 59df97f1a832a0edfd7f77ffbe5149e553e860b5 ] + +While device probing mlx5 PMD get the physical port name +and checks against the set of patterns. If there is no +any pattern match, the driver assumes the port belongs +to PF device, this behaviour provides compatibility with +legacy kernel drivers (before and early SR-IOV support). + +The newer kernels added the PCI subfunction support and +representor names with pattern like pf0sf1. This pattern +was not recognized by PMD and the first found subfunction +representor was considered as master device. + +This patch supports representor name parsing for SF, +and SF representors are just ignored by PMD (as there is +no support for SF in 20.11-LTS release). @@ -77 +83 @@ -index ef7a521379..752c57b33d 100644 +index 1f765dca07..145e354b2c 100644 @@ -80 +86 @@ -@@ -746,6 +746,7 @@ mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int iface_idx, +@@ -789,6 +789,7 @@ mlx5_nl_mac_addr_sync(int nlsk_fd, unsigned int iface_idx, @@ -88 +94 @@ -@@ -1158,6 +1159,8 @@ mlx5_nl_check_switch_info(bool num_vf_set, +@@ -1201,6 +1202,8 @@ mlx5_nl_check_switch_info(bool num_vf_set, @@ -98 +104 @@ -index 5028a05b49..8eda6749b4 100644 +index a484b74b9c..4c75addd08 100644 @@ -101 +107 @@ -@@ -151,6 +151,7 @@ enum mlx5_nl_phys_port_name_type { +@@ -153,6 +153,7 @@ enum mlx5_nl_phys_port_name_type { @@ -109 +115 @@ -@@ -159,6 +160,7 @@ struct mlx5_switch_info { +@@ -161,6 +162,7 @@ struct mlx5_switch_info { @@ -118 +124 @@ -index 0e8de9439e..cb692b22f2 100644 +index f641cb936e..08b51b7dc8 100644