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 6664C460DB for ; Wed, 22 Jan 2025 02:48:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DEE840430; Wed, 22 Jan 2025 02:48:20 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2100.outbound.protection.outlook.com [40.107.244.100]) by mails.dpdk.org (Postfix) with ESMTP id 073FC402A9; Wed, 22 Jan 2025 02:48:18 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AIHQhUglyL9rYD4jRbSREJyIFzUmGn1uyFFDU5KtOb1VlAHv6ZbVQuf9/P6Q+q8MprHxgor7vbkG8IVYtb0OcDBlQiprFsGWAX9nPHaUuw4OMszNJOr5j3j1A/mvDs8T+Ez/dWSHp+nEj+WgNJkanAufO6yLyCeNRlsB6jYfSjyI0EiupwPvpr4hkxlBpMFCcOR/AxU90X5HlLHVcE0O8CQScEozGDQqN2XY4DVrFLcXFp5PyA/tZMa1o6+ewLcNBWD6uEddPDcUUN+59WX2rYrH6TV28eqVSHP5UU3K3jG7ggh53PsDu2C55Pg+m1ke2SimgmZJ2J5hXsw+Qpb4Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=CmK/EsIBBtAMRTTiLkDkixsSk4jAYU9HYaJxP1D2DhA=; b=x6oBRH4hMaQ11UFZFeUXhJycIcUVl3FmRPqw56xLkomIPdoBWOgz4p40JzS5S2mhw+oLzp6YTkN3pFM6glXNjOcWJs2OAjF+GfMyYuQkGzcDoTWu46LcnHQrpGRJ911I1TpRHJDE19VrGqDGRdvDtRity394LqkEAagEQbZP/aZR179OABAYVhQ3GErrcrH1U8OM+1vwjTEfbGfDz6s8oc2pxtZAjuLWWw8klCqhSP5FgzQqsgQXpM9IlvfU0b6wZTBVIi8vj20NWx1QxXsv1yNzRCk2LUTX+8Mjd8xQmJIM+gIAgAwNvjZNbPYejUFM/M60O5+7mupbge9fvXdanQ== 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=CmK/EsIBBtAMRTTiLkDkixsSk4jAYU9HYaJxP1D2DhA=; b=ltyWtJJz1KGOpj4Z/jCQPYQRYjN9NReOa6b55GxRWvc1xA3D4T7SXvI19uc4sJ5QqrHLvF7GWQyQTVWcuO8bTCRLfZ1vzuKoJFoTu6dKOGyXI/9jIDE2DCCPR88MSF5poOaloc4ZxTI0MIA5O5kVGBMOyPsCG4Ne1FUuhvVTWDQ= 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 CH3PR13MB6625.namprd13.prod.outlook.com (2603:10b6:610:1df::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.20; Wed, 22 Jan 2025 01:48:15 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%6]) with mapi id 15.20.8356.017; Wed, 22 Jan 2025 01:48:15 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , stable@dpdk.org, Long Wu , Peng Zhang Subject: [PATCH 1/2] net/nfp: fix logic of load firmware from flash Date: Wed, 22 Jan 2025 09:47:50 +0800 Message-ID: <20250122014751.1706413-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250122014751.1706413-1-chaoyong.he@corigine.com> References: <20250122014751.1706413-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SGXP274CA0023.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::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_|CH3PR13MB6625:EE_ X-MS-Office365-Filtering-Correlation-Id: a527a4cf-1c71-4053-0539-08dd3a86d642 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?kvvW0tlb0dssHOqT/Ihpkrt+yiUtxOv3Js08jM9vmfUYLrKe4TK1OWzNn2aZ?= =?us-ascii?Q?Ft7ohJiZ7NVOQM2CdtfYFL68JsLebC8i2YPc9Ob7xOIFSjOf8WZpDd01G7KY?= =?us-ascii?Q?F3Sz4Ss4XWfRBLjC+tdQ/coktHo5+1SksSVLyzjcPgvsVN/oa4USXaxwakxF?= =?us-ascii?Q?j4Ai20w8o80z8f5+cdVNg6FaaIuvBu11jKRQ30HDG20CxZ6DGGCdy3z2g9aK?= =?us-ascii?Q?GlXY129Xw+odHGgkPNrl7WqwegRaDutBv0Cgbwyfv38T5ueO0Igx3OA0Ciwa?= =?us-ascii?Q?mPXiHGXrtOQWKf+JCAB34dw4oZln76KUJxzZ1g4my67wPpRFk2NGptlUeEDm?= =?us-ascii?Q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vOvdfhUUnhvpzi/FD89rzszTAKABLsGZH3r?= =?us-ascii?Q?JAsqm4K6f8hYWCytv4kfvOM9fXgQfH2VgiDzHXkidCkYyVQLFEiF1gudsD4r?= =?us-ascii?Q?ESqfOla5rbc6fnYL/Gz98tAMx0F9esCesavX8xv3JdpW31/OLhWBQGAn4AUh?= =?us-ascii?Q?XWyf+5F+jiXKY6JfRylXUdRdiEqj57HCCzi6fJSKcfW00AVduCKgdBfglwu1?= =?us-ascii?Q?u9tGPF8b63TqFV7N13PuQKAwVOabuzAR?= 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:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?E/saJGk04ukSlnGo1K8RTOWN+5xBAy4bR0FudFDZ+g4rZ7en1nYBLOf9/u1q?= =?us-ascii?Q?k1iGZWqe4p0Tw3/KeY9ESLelwuPetvwc8tLClxbNDuCisHtnuqTjcjhxbyU9?= =?us-ascii?Q?8IsYlRhc3jEefDbUIy+wD6JVFpAuXqjKyQyWZecmhPHXmiHP3azbYHKfDLax?= =?us-ascii?Q?ZEeXxipO90Vr9JOjBrA1aJWRM5wgg3oynum9x42ZkeoRILaMwZ4K1FDTbVyH?= =?us-ascii?Q?OoUA6CahYdWf1QG0Bd5YPxf+SdJQKUO+795BMdGsnrgC7Kz2ulGfKi26pFRK?= =?us-ascii?Q?74ypYz5HxlIrWgqzzA53WD/d0kagX06HCQ4Dy3dbe8aPLyCEnSRWl3vxzWaw?= =?us-ascii?Q?3f3+wm7yZJC5le+r4WTK8UlJ/FX7NKhBWPcArypA1bFzI7yMeMpHLcI9jucK?= =?us-ascii?Q?piqfMAUqq79MJiqBlcBUoGhp1c7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=?us-ascii?Q?jkahhPCG6XLcLAqCSdvacYirfTqx+Nq7NPs+VQ/G4vPXph3rlBBAfGY8C8Rs?= =?us-ascii?Q?mU7iUpUGMP8AD3MlnCLqLWoHI30NNfNjpHXbIezYP2/DoMFupcq/NghoxHgN?= =?us-ascii?Q?lDDmLxX0RMMsaq/T8ah4+l2KZU1HLKGZjV83V60j3Fcn4sgA4NH/+weahY8A?= =?us-ascii?Q?vGgZJs3MrqzJuN/UwH1qeowdSfvWzXZmNvGkIudPHE3p9kBbMdKoIXaq3RbJ?= =?us-ascii?Q?07GTDR7SqwOKz1YXVid8DV60ZmZBOyuzDDYu4i3Ti/kLY/zCGE7bdWP4KN1x?= =?us-ascii?Q?mg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: a527a4cf-1c71-4053-0539-08dd3a86d642 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2025 01:48:15.2849 (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: C0OGWwRakZc3BVduFAaaA2U5+BaiBdG9az3fCjyr3WVzrVWZ8kNZXO35mBW54vSW02cOHADb4YdUbikCgQ3N1RkiyfXWg0YS8pQLwwNjhDQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR13MB6625 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 The firmware load policy 'NFP_NSP_APP_FW_LOAD_FLASH' means first try to load from file system, if failed then try to load from flash. The original logic will cause load firmware fail if any mistake occurs in the load from file system process. Fix this by relocated the related logic. Fixes: 08ea495d624b ("net/nfp: support loading firmware from flash") Cc: stable@dpdk.org Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/nfp_ethdev.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index f54483822f..13751469b8 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1529,16 +1529,16 @@ nfp_fw_reload_for_single_pf(struct nfp_nsp *nsp, { int ret; - if (policy == NFP_NSP_APP_FW_LOAD_FLASH && nfp_nsp_has_stored_fw_load(nsp)) { - ret = nfp_fw_reload_from_flash(nsp); + if (fw_name[0] != 0 && policy != NFP_NSP_APP_FW_LOAD_FLASH) { + ret = nfp_fw_reload_for_single_pf_from_disk(nsp, fw_name, pf_dev, reset); if (ret != 0) { - PMD_DRV_LOG(ERR, "Load single PF firmware from flash failed."); + PMD_DRV_LOG(ERR, "Load single PF firmware from disk failed."); return ret; } - } else if (fw_name[0] != 0) { - ret = nfp_fw_reload_for_single_pf_from_disk(nsp, fw_name, pf_dev, reset); + } else if (policy != NFP_NSP_APP_FW_LOAD_DISK && nfp_nsp_has_stored_fw_load(nsp)) { + ret = nfp_fw_reload_from_flash(nsp); if (ret != 0) { - PMD_DRV_LOG(ERR, "Load single PF firmware from disk failed."); + PMD_DRV_LOG(ERR, "Load single PF firmware from flash failed."); return ret; } } else { @@ -1605,19 +1605,19 @@ nfp_fw_reload_for_multi_pf(struct nfp_nsp *nsp, goto keepalive_uninit; } - if (policy == NFP_NSP_APP_FW_LOAD_FLASH && nfp_nsp_has_stored_fw_load(nsp)) { - err = nfp_fw_reload_from_flash(nsp); - if (err != 0) { - PMD_DRV_LOG(ERR, "Load multi PF firmware from flash failed."); - goto keepalive_stop; - } - } else if (fw_name[0] != 0) { + if (fw_name[0] != 0 && policy != NFP_NSP_APP_FW_LOAD_FLASH) { err = nfp_fw_reload_for_multi_pf_from_disk(nsp, fw_name, dev_info, pf_dev, reset); if (err != 0) { PMD_DRV_LOG(ERR, "Load multi PF firmware from disk failed."); goto keepalive_stop; } + } else if (policy != NFP_NSP_APP_FW_LOAD_DISK && nfp_nsp_has_stored_fw_load(nsp)) { + err = nfp_fw_reload_from_flash(nsp); + if (err != 0) { + PMD_DRV_LOG(ERR, "Load multi PF firmware from flash failed."); + goto keepalive_stop; + } } else { PMD_DRV_LOG(ERR, "Not load firmware, please update flash or recofigure card."); err = -ENODATA; @@ -1723,8 +1723,8 @@ nfp_fw_setup(struct nfp_pf_dev *pf_dev, if (policy != NFP_NSP_APP_FW_LOAD_FLASH) { err = nfp_fw_get_name(pf_dev, fw_name, sizeof(fw_name)); if (err != 0) { - PMD_DRV_LOG(ERR, "Can not find suitable firmware."); - goto close_nsp; + fw_name[0] = 0; + PMD_DRV_LOG(DEBUG, "Can not find suitable firmware."); } } -- 2.43.5