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 973F7438C7; Mon, 15 Jan 2024 03:55:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E47DA40A79; Mon, 15 Jan 2024 03:55:03 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2127.outbound.protection.outlook.com [40.107.92.127]) by mails.dpdk.org (Postfix) with ESMTP id 16F3040691 for ; Mon, 15 Jan 2024 03:55:02 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YCOBtPTIGDGMYhW13HI+8y/niU1lFl6NHhkC8iNrOFAKnUqbdOkXebYhP+jaG7oTv6J/wWCn3o8vnKn4si7zd1EtMw7byTD82/qqe7akkufd8GUMHeuPb1QhC6ateLQO5sNMev0S165fxFJ3V91KrHhT5W/Ymey/T0rc3VTTSRAOeM/Vc/h0SSuSs5KC6df+mu9g/Iu5Fen/Jir9fuWSsJ+WL+gLiW5vvAPVxJh8kOdsU2Zvkc/2tK3ZqAR/jC/l484dqQQpCryV4mCga1fNuSYfBGjasCkaM25E+4/ybh/hO0PB3YD+bJR/J3TM3MjbHNW+kyAVfd0b0ZxnNURX4g== 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=eJ5xEP1AD6R0l34L0W8Sj+X8vVdoglpPXC6FRzZIMUo=; b=Hwqc2klPKyMM+LImbd2y/oNTFzVrpGu2+c9VP8IEwKivXBtGXvZPsA8wFXyxJzf8XuavjtzJLZHduFxyf8AR1Yg2oBihpVmC8taofmkzO1Q/K0E60sarx/Gv9SGCsqjyTRWmKL3bKAXYc71NjjiQm2DghRwIzmtKtMi5s2ET3xGzLxvmFiuAWJkrX5mrIRdOWd1jLb40NkMANLz3wAZzXxkq4nCNnT0MrNZ80b39XdK177lPENizT2q3+2yAdp/0NPZfA7mm08FB/CtoMIeKWxERn+YwtsTzeHUMFt0aXNHeLkB/k0aqthDkm7qM/e4cLn0M23hOZ/nooVUGe6/zDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eJ5xEP1AD6R0l34L0W8Sj+X8vVdoglpPXC6FRzZIMUo=; b=tbDbU1ZlNb9vSPjfDcp2D/+NNKgr9YiTYq1gK1FZPZmJOnV+SZ9djk0goPX1itoN0rDT8Hs4tM8rzYnrCLLqo/54Ns5H3jI7nUkbvLRRukTQSsfmDDtc7GoXWvl2v7ZmWWSJaj1UL6HTHEBBVriatPfTHZ1nzayS8WmAZPbsCA4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by SA0PR13MB6002.namprd13.prod.outlook.com (2603:10b6:806:152::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.21; Mon, 15 Jan 2024 02:55:00 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7181.026; Mon, 15 Jan 2024 02:55:00 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , Chaoyong He , Long Wu Subject: [PATCH 8/8] net/nfp: simplify the port name for multiple PFs Date: Mon, 15 Jan 2024 10:54:19 +0800 Message-Id: <20240115025419.2447759-9-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240115025419.2447759-1-chaoyong.he@corigine.com> References: <20240115025419.2447759-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: PH0PR07CA0025.namprd07.prod.outlook.com (2603:10b6:510:5::30) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA0PR13MB6002:EE_ X-MS-Office365-Filtering-Correlation-Id: e7461a15-082b-4571-0c54-08dc15755d39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QO9ivaC+LRMg5JV7WHoNNaIU12FG75hPiIzCVB59aAY+njhIPvTWYg4aQ5kTe8EboKXvDL1qE170JDuWsGaFy4VQfyTnyNjlyeQSv4FnL/zbwlNXRCBtL1JDL3qGL4EGqV6HtR/fpJ/sCKtwiAn/vcaRwIKb4MncLYHNAitQekXs29GwFW5w38dbDX2//gNmO14W0722qDz+SQ0eOY5fHvUiWB44VvxaRmh7gGTFGdOCxb7NiNs2itWPPsARI2jsMCRYhy9tKf7ErWaiZ19TaZ7tbD8ZBBzQuX7uPZpmRtRjbHQkR+mI/kYRCUxyxtdJThSo6RrkHt22f4jPfHPvkITTUhk8M9yaLv6h7iVoJE8GINqFxgF4JcbjlXmGqP0k6zuW1y66CLb3VVIRquud95IcwePW8WhkCs+G3+1eAZTb0ILaw2Mp1EY8sfOqVFd07f6USN9xFXAzrP3rpLMPY7f5mJs0dHWNoR1+4niYc0wUAFSK6Ruequ2/EU+7aumX20KklC+DZBAj8DQMNJyOrnDAa6p2XTAgGBxZb2P+SpWAoSC6zzrDgcalDiSyfKsIAcAB5phiRz8M/4zVNmNiHHlJMfIYoJ7dEvUEYTlRUm1mw7P00EtwN4EjNDc8dXDl X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(396003)(366004)(346002)(39830400003)(136003)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(1076003)(6486002)(6506007)(6666004)(6512007)(26005)(107886003)(36756003)(2616005)(83380400001)(38350700005)(52116002)(86362001)(38100700002)(41300700001)(478600001)(44832011)(8676002)(4326008)(8936002)(5660300002)(66946007)(66476007)(66556008)(6916009)(316002)(2906002)(54906003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XNxV9Gh7+CdGq+zf+j6jQb2iRUcNnGRfokQxBisa5rqHrmDso5Rz5x7oREEa?= =?us-ascii?Q?3McXeCYKlaajLIAqBfSCc023Vi2LuTgbwj3MdriQpJc2DbEc0cM6p45u/jTz?= =?us-ascii?Q?IOfxGb3yG7rA1Yyi7ceAm50IhJS/k5k43UVEnBHAe48ckeJf5JXx9f+QII8X?= =?us-ascii?Q?uWwPsAkleZEPOVpqrbM3Fwh34rWehXiV8LpZ4UI3gpv8Vfi+mW8w7uM5Rbc2?= =?us-ascii?Q?mF//C5Ml38lVROR0bm1/4MlkQR7xdm1RUOcyw5o381ixMOvOB4bQf2KQcwpn?= =?us-ascii?Q?KQI6ztxEwiN5jEfrqm5YyU/dsm0o4ZekVvg/bhtz0gCRCdNg5wL6u7JS0AIu?= =?us-ascii?Q?WjqA4M8UX6+qLzysX45rNwlFKZE3Mn+cExkkpuAU00zMXDoDE8neppx6A1y3?= =?us-ascii?Q?cI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TnYxvHRC?= =?us-ascii?Q?5dWbcxPeSAveCMBKvypDhGRfFXuUK6B3Ly1f1JxhuWiGrC5ZsDbihSTcYmt7?= =?us-ascii?Q?pH8sjfqcEd0lkORoIu1iNLglGvHSJN2iiaMxpjmKNoFeI/7o2XVCnoWKKRGs?= =?us-ascii?Q?vCGz/DC50OICLOQI9DRO0Yp9xwdpGg3VunNNQpaujqyiP9rIpYFZGhU3Va0K?= =?us-ascii?Q?XgAGn660Vz5dm9oJIaUu/fXu7yvNHOlNqIFdn2DyXINyzy3TyZMo+BYPz9FU?= =?us-ascii?Q?M7GuZuHJcaQqr+KAfBqAJMmsd0UKV2YT30B4+EY2zzOhBcIh/sPDoQpgq9Nf?= =?us-ascii?Q?QQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7461a15-082b-4571-0c54-08dc15755d39 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 02:55:00.2951 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1h0KfcfFNljoS5ckpAgs7sW4jodJDbMvZgh0Vtx0NpLzTtXVxDzbb3IZddrLKdIBrGQ1IX79ePeVBzM6GsYwC572Q5PQF7ntotPQWMcBkfk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR13MB6002 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 From: Peng Zhang For the firmware which does not support multiple PF feature, there are multiple PFs corresponding to a single PCI BDF address, so we have to distinguish them by using a '_port*' postfix for the device name. For the firmware which supports multiple PFs feature, there is only one PF corresponding to a PCI BDF address, so actually we does not need this postfix anymore, and which is in line with the mainstream. Add the corresponding logic to simplify the port name for multiple PFs case, which will make the user happy. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/nfp_ethdev.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 22edf11253..31b2302db6 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1451,9 +1451,12 @@ nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev, /* Loop through all physical ports on PF */ numa_node = rte_socket_id(); for (i = 0; i < app_fw_nic->total_phyports; i++) { - id = nfp_function_id_get(pf_dev, i); - snprintf(port_name, sizeof(port_name), "%s_port%u", - pf_dev->pci_dev->device.name, id); + if (pf_dev->multi_pf.enabled) + snprintf(port_name, sizeof(port_name), "%s", + pf_dev->pci_dev->device.name); + else + snprintf(port_name, sizeof(port_name), "%s_port%u", + pf_dev->pci_dev->device.name, i); /* Allocate a eth_dev for this phyport */ eth_dev = rte_eth_dev_allocate(port_name); @@ -1473,6 +1476,7 @@ nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev, } hw = eth_dev->data->dev_private; + id = nfp_function_id_get(pf_dev, i); /* Add this device to the PF's array of physical ports */ app_fw_nic->ports[id] = hw; @@ -1902,14 +1906,15 @@ nfp_secondary_init_app_fw_nic(struct nfp_pf_dev *pf_dev) } for (i = 0; i < total_vnics; i++) { - uint32_t id = i; struct rte_eth_dev *eth_dev; char port_name[RTE_ETH_NAME_MAX_LEN]; if (nfp_check_multi_pf_from_fw(total_vnics)) - id = function_id; - snprintf(port_name, sizeof(port_name), "%s_port%u", - pf_dev->pci_dev->device.name, id); + snprintf(port_name, sizeof(port_name), "%s", + pf_dev->pci_dev->device.name); + else + snprintf(port_name, sizeof(port_name), "%s_port%u", + pf_dev->pci_dev->device.name, i); PMD_INIT_LOG(DEBUG, "Secondary attaching to port %s", port_name); eth_dev = rte_eth_dev_attach_secondary(port_name); -- 2.39.1