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 7132E41B15 for ; Fri, 8 Mar 2024 04:11:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D11C40291; Fri, 8 Mar 2024 04:11:35 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2105.outbound.protection.outlook.com [40.107.94.105]) by mails.dpdk.org (Postfix) with ESMTP id CBDD040284; Fri, 8 Mar 2024 04:11:33 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NWFhHEotHm0cVcpxwN9xS2/ks31kIVCRByv4OKhbNi8aH1V/pqwaN7pLtB5k5KMAs5z3RCAE8MJaLzPzbHNOGgxaDgTnSL4WJbjSLFsMFVoTzE8kCH+8tHmOrFb76kMFHK+IYl5XSjlbjmsy+/NesV0PxJK09NHfoRGhWLVV11dd5eZ4oC7NRCZfe6OGH/0JuKEkW8eQQAKdRIVZO4a7Smr3m1j7JyS2UrJw/6Nas/ORnaoDhtBAHCGwKkr2oGHsw9JDd6q43zu33d6l0dK4Nd/SeIklLAchpGxToXssvy6kOig4FN/uA6bqUHFLNHRCN1SXcyS7Im0UzmxjueDzKw== 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=4RpqJXjwJQST5RD2CBOOucPwP32fLN7asf+3499bI6g=; b=BRvZSL1yCipdw17ybkTcF8Si6scNvmsLEUAF3J8nF7G9qzTydHzTsc+n+J6Y7xd/ElXjl4l3OXOJHXcyeUl4RyJmAxFiohYyc/YOG4kMliA/dxxD4HtpIDLSSpnSxHYayGtsTxBsYKPEj0yBqTTpkkOtPm5L3woDPZu4oQvTYyonNnoreHpXlZer29LGaQtls7QGH69UtgUoXX878d0P0Wg1oipSJBXVCjJfIiQfYKeGZA0nI3JJoWuU0WJj0AkdjP4JfMfhkjTgfrU3b8QO2WE3H05YYl4jRJ9x2x74GglhpabCD3hwCEWERKzdBXtTws7+3klhM8X9dL+SRgecsQ== 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=4RpqJXjwJQST5RD2CBOOucPwP32fLN7asf+3499bI6g=; b=Gn8ILBrMRdBbPiLlZrHslGK1Z9tC3VWXWxxSPS3uVTnuK6BQxDKgZrZqAa8IGQwXLC3CASyroTtdMpYpaAlrZHXhG68ZHLpIqWUe4Z9wCU5FlOQucVwnt4gKRe+X3pg5R+vLYSgebg+Q7z4fXMbIXB1MphlPA0sw4gwdtg6IZOg= 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 PH0PR13MB5874.namprd13.prod.outlook.com (2603:10b6:510:165::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24; Fri, 8 Mar 2024 03:11:30 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7339.035; Fri, 8 Mar 2024 03:11:29 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Zerun Fu , stable@dpdk.org, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH] net/nfp: fix failure of PF initiation on flower firmware Date: Fri, 8 Mar 2024 11:11:10 +0800 Message-Id: <20240308031110.2041280-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR06CA0022.namprd06.prod.outlook.com (2603:10b6:a03:d4::35) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB5874:EE_ X-MS-Office365-Filtering-Correlation-Id: 881a491a-c90f-4d14-a474-08dc3f1d72fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RHKlFoeXZ69XlQFVUmUIlZOMERq/QtE/2DIsL4gzIu44nUPrsqxpz/X1gTvqUQ76Ne9NF3XqXgBKRYTjj1oGNmJzRLRjJo/ZRNyatVzcWj88rzhYi25n6RxJk6rpy8jLN9PzX5nkpQs7/Pc47JXvnC1CQ8/s1Abg9i5RKP8axp/ni7wdk53XI53mHUVGwYWA+nvS0FcHXWPVJTfS2+E7XshwPyUyncMCOsvqwO2mTj+MKraE8MfNHiXMjmoi2+yi5HJridqLJhIz5yHIFoq9yjlRBjHEP2C7LZSGfSzKnyXyr0V3+pitseiYBUrC6ydENgCV+1VBj3k5IiFFsePsyO5WhNXAI3bzWUpWCtIblrfS+p7P2S3+YpRyrEVAf4umgDjWvUs+I0cmysmcaJkGJ/uwFzPSIUjZNUZBZWiJMWmotA5Ntw3Y/UhIw6wOC/IURSnyO7l1chTz/tz1pD6rFirmq4kDWnGZSmn0yC+pT35AijwpG6ab1XOTHzu/hHP6TCWNkmg79rTgfx6H2tOjX8BPqjSdVmqKTVJdLjYjaCm6+DLpmonuQyC+iu2lCXorYv8kBGfAYNY+Kz9RFU9nnugG03kZwjcdoi1JprzY6wBAQ7SvQYYkZKuCQuYVzvOECD3mXn/NQZdZwwHxFDxz55InJu0pmyZTbykSIPDavixoVhwsQPt/JpkxvGkeWKITR4IOOWjIvaPfyPT2Rr/x/wJywl3iTWXJSZMtLAUElUM= 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)(376005)(52116005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?gesrcDACFNC4rxF6KdZ/UJIBO2MdOjpWSYKi4y+KI4UpuM6j1OKNcesXuSy8?= =?us-ascii?Q?lgzKk5CHH6hHjJy7Iflhlr/p5LUSFnes7pjxJYT0+R/qlxFNOBoXO65iTDE/?= =?us-ascii?Q?bVn1iUgsueOf+kfbUKEC+uJc7KUEVf26ao2oMQujYxV2YcWjU1MAKX8apZUu?= =?us-ascii?Q?e5EpLYmazKhPQeLlDmUd8SkXE4FFSPX3ufusBnxcqET9etOWIkiQs7H5SV3K?= =?us-ascii?Q?gEcgCwVzMkWMIOmx9vmPu+6kZ4QHzhV4KJwU8VkKNqHVsRF3If2mI4rRxLhL?= =?us-ascii?Q?q6+JVnktZ8asvnFBu1Xpsib7aMJQQFvstBMWAyXsZ2czaASUQ9XKEW17YSz/?= =?us-ascii?Q?AQeHILqHZTLn+RDeiEvlsGyWcNxY47CCl5ObtjosAJ2CA6etziX+UWaZcMDZ?= =?us-ascii?Q?t7Ghi8nHdGQFmy7AKf6JSXAZYi1cA4sIE1uRJbk0Ho4J1odeBJalaLVP8i6u?= =?us-ascii?Q?30xD/ogGI+81nRlthquFqEU1mG6vHXGicUPttnm51wGZs5/ZjFAvJVQtZ2ma?= =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xUqjcQZXFofRidA+iGubi1BMR5pgaz+vPCizmXa6NH?= =?us-ascii?Q?gzZ2kghixX8hu+1ygaKLZVkKIMQSeUeMZM1zbwpqQTlz0v/XAcwsJ7Cjztk9?= =?us-ascii?Q?HEQt+O2s/BOMeFg1lAs/FlPmEyDB9ycs3qK0f4TJzGXRPZfFdJsaFG3tngCt?= =?us-ascii?Q?IFpB41Qt63sIRQSZ1wzWaFVU8oJIwBLuyvzyATm3VrYPlysnSTVBCJnQy6Uh?= =?us-ascii?Q?yA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 881a491a-c90f-4d14-a474-08dc3f1d72fc X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2024 03:11:29.8710 (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: WyK3igGlDUh1hgsoP9uNnefuxEq1jpJUKqxWI2ESP/2Aud9yh/cSj+qz1T8QZtxQ3eZDEG3OfknhDq45qm9BImt3Ud81cSIOQyRH6KeT9cI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5874 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 From: Zerun Fu The previous logic did not distinguish the firmware type when reading the value of "app_cap" during the initialization of the PF. This operation is not supported by the flower firmware, and this will lead to a startup failure. Fix this by adding the logic to check the firmware type. Fixes: c7a6970fc637 ("net/nfp: notify BSP if FW speed needs to be switched") Cc: stable@dpdk.org Signed-off-by: Zerun Fu Reviewed-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 8c38b4e134..1e713ee111 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1605,30 +1605,34 @@ nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev, static int nfp_net_hwinfo_set(uint8_t function_id, struct nfp_rtsym_table *sym_tbl, - struct nfp_cpp *cpp) + struct nfp_cpp *cpp, + enum nfp_app_fw_id app_fw_id) { int ret = 0; uint64_t app_cap; - uint8_t sp_indiff; struct nfp_nsp *nsp; + uint8_t sp_indiff = 1; char hw_info[RTE_ETH_NAME_MAX_LEN]; char app_cap_name[RTE_ETH_NAME_MAX_LEN]; - /* Read the app capabilities of the firmware loaded */ - snprintf(app_cap_name, sizeof(app_cap_name), "_pf%u_net_app_cap", function_id); - app_cap = nfp_rtsym_read_le(sym_tbl, app_cap_name, &ret); - if (ret != 0) { - PMD_INIT_LOG(ERR, "Couldn't read app_fw_cap from firmware."); - return ret; + if (app_fw_id != NFP_APP_FW_FLOWER_NIC) { + /* Read the app capabilities of the firmware loaded */ + snprintf(app_cap_name, sizeof(app_cap_name), "_pf%u_net_app_cap", function_id); + app_cap = nfp_rtsym_read_le(sym_tbl, app_cap_name, &ret); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not read app_fw_cap from firmware."); + return ret; + } + + /* Calculate the value of sp_indiff and write to hw_info */ + sp_indiff = app_cap & NFP_NET_APP_CAP_SP_INDIFF; } - /* Calculate the value of sp_indiff and write to hw_info */ - sp_indiff = app_cap & NFP_NET_APP_CAP_SP_INDIFF; snprintf(hw_info, sizeof(hw_info), "sp_indiff=%u", sp_indiff); nsp = nfp_nsp_open(cpp); if (nsp == NULL) { - PMD_INIT_LOG(ERR, "Couldn't get NSP."); + PMD_INIT_LOG(ERR, "Could not get NSP."); return -EIO; } @@ -1873,7 +1877,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) } /* Write sp_indiff to hw_info */ - ret = nfp_net_hwinfo_set(function_id, sym_tbl, cpp); + ret = nfp_net_hwinfo_set(function_id, sym_tbl, cpp, app_fw_id); if (ret != 0) { PMD_INIT_LOG(ERR, "Failed to set hwinfo."); ret = -EIO; -- 2.39.1