DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] support new firmware name scheme
@ 2024-05-28  1:29 Chaoyong He
  2024-05-28  1:29 ` [PATCH 1/2] net/nfp: refactor the firmware load logic Chaoyong He
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chaoyong He @ 2024-05-28  1:29 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He

This patch series refator the firmware load logic and add support of
the fourth firmware name scheme, and this name scheme takes the third
priority.

Chaoyong He (2):
  net/nfp: refactor the firmware load logic
  net/nfp: support new firmware name scheme

 drivers/net/nfp/nfp_ethdev.c | 73 ++++++++++++++++++------------------
 1 file changed, 36 insertions(+), 37 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] net/nfp: refactor the firmware load logic
  2024-05-28  1:29 [PATCH 0/2] support new firmware name scheme Chaoyong He
@ 2024-05-28  1:29 ` Chaoyong He
  2024-05-28  1:29 ` [PATCH 2/2] net/nfp: support new firmware name scheme Chaoyong He
  2024-07-05 11:28 ` [PATCH 0/2] " Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2024-05-28  1:29 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang

Refactor the firmware load logic, make it more specific and clear.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 66 ++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 37 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index cdc946faff..771137db92 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1081,16 +1081,18 @@ nfp_net_init(struct rte_eth_dev *eth_dev,
 
 static int
 nfp_fw_get_name(struct rte_pci_device *dev,
-		struct nfp_nsp *nsp,
-		char *card,
+		struct nfp_cpp *cpp,
+		struct nfp_eth_table *nfp_eth_table,
+		struct nfp_hwinfo *hwinfo,
 		char *fw_name,
 		size_t fw_size)
 {
 	char serial[40];
 	uint16_t interface;
+	char card_desc[100];
 	uint32_t cpp_serial_len;
+	const char *nfp_fw_model;
 	const uint8_t *cpp_serial;
-	struct nfp_cpp *cpp = nfp_nsp_cpp(nsp);
 
 	cpp_serial_len = nfp_cpp_serial(cpp, &cpp_serial);
 	if (cpp_serial_len != NFP_SERIAL_LEN)
@@ -1119,8 +1121,20 @@ nfp_fw_get_name(struct rte_pci_device *dev,
 	if (access(fw_name, F_OK) == 0)
 		return 0;
 
+	nfp_fw_model = nfp_hwinfo_lookup(hwinfo, "nffw.partno");
+	if (nfp_fw_model == NULL) {
+		nfp_fw_model = nfp_hwinfo_lookup(hwinfo, "assembly.partno");
+		if (nfp_fw_model == NULL) {
+			PMD_DRV_LOG(ERR, "firmware model NOT found");
+			return -EIO;
+		}
+	}
+
 	/* Finally try the card type and media */
-	snprintf(fw_name, fw_size, "%s/%s", DEFAULT_FW_PATH, card);
+	snprintf(card_desc, sizeof(card_desc), "nic_%s_%dx%d.nffw",
+			nfp_fw_model, nfp_eth_table->count,
+			nfp_eth_table->ports[0].speed / 1000);
+	snprintf(fw_name, fw_size, "%s/%s", DEFAULT_FW_PATH, card_desc);
 	PMD_DRV_LOG(DEBUG, "Trying with fw file: %s", fw_name);
 	if (access(fw_name, F_OK) == 0)
 		return 0;
@@ -1364,49 +1378,20 @@ nfp_fw_setup(struct rte_pci_device *dev,
 {
 	int err;
 	char fw_name[125];
-	char card_desc[100];
 	struct nfp_nsp *nsp;
-	const char *nfp_fw_model;
-
-	nfp_fw_model = nfp_hwinfo_lookup(hwinfo, "nffw.partno");
-	if (nfp_fw_model == NULL)
-		nfp_fw_model = nfp_hwinfo_lookup(hwinfo, "assembly.partno");
-
-	if (nfp_fw_model != NULL) {
-		PMD_DRV_LOG(INFO, "firmware model found: %s", nfp_fw_model);
-	} else {
-		PMD_DRV_LOG(ERR, "firmware model NOT found");
-		return -EIO;
-	}
 
-	if (nfp_eth_table->count == 0 || nfp_eth_table->count > 8) {
-		PMD_DRV_LOG(ERR, "NFP ethernet table reports wrong ports: %u",
-				nfp_eth_table->count);
-		return -EIO;
+	err = nfp_fw_get_name(dev, cpp, nfp_eth_table, hwinfo, fw_name, sizeof(fw_name));
+	if (err != 0) {
+		PMD_DRV_LOG(ERR, "Can't find suitable firmware.");
+		return err;
 	}
 
-	PMD_DRV_LOG(INFO, "NFP ethernet port table reports %u ports",
-			nfp_eth_table->count);
-
-	PMD_DRV_LOG(INFO, "Port speed: %u", nfp_eth_table->ports[0].speed);
-
-	snprintf(card_desc, sizeof(card_desc), "nic_%s_%dx%d.nffw",
-			nfp_fw_model, nfp_eth_table->count,
-			nfp_eth_table->ports[0].speed / 1000);
-
 	nsp = nfp_nsp_open(cpp);
 	if (nsp == NULL) {
 		PMD_DRV_LOG(ERR, "NFP error when obtaining NSP handle");
 		return -EIO;
 	}
 
-	err = nfp_fw_get_name(dev, nsp, card_desc, fw_name, sizeof(fw_name));
-	if (err != 0) {
-		PMD_DRV_LOG(ERR, "Can't find suitable firmware.");
-		nfp_nsp_close(nsp);
-		return err;
-	}
-
 	if (multi_pf->enabled)
 		err = nfp_fw_reload_for_multi_pf(nsp, fw_name, cpp, dev_info, multi_pf,
 				force_reload_fw);
@@ -1853,6 +1838,13 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 		goto hwinfo_cleanup;
 	}
 
+	if (nfp_eth_table->count == 0 || nfp_eth_table->count > 8) {
+		PMD_INIT_LOG(ERR, "NFP ethernet table reports wrong ports: %u",
+				nfp_eth_table->count);
+		ret = -EIO;
+		goto eth_table_cleanup;
+	}
+
 	pf_dev->multi_pf.enabled = nfp_check_multi_pf_from_nsp(pci_dev, cpp);
 	pf_dev->multi_pf.function_id = function_id;
 
-- 
2.39.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] net/nfp: support new firmware name scheme
  2024-05-28  1:29 [PATCH 0/2] support new firmware name scheme Chaoyong He
  2024-05-28  1:29 ` [PATCH 1/2] net/nfp: refactor the firmware load logic Chaoyong He
@ 2024-05-28  1:29 ` Chaoyong He
  2024-07-05 11:28 ` [PATCH 0/2] " Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2024-05-28  1:29 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, Long Wu, Peng Zhang

Now all application firmware is indifferent of port speed, so do not
bother to compose the firmware name with media info. This will reduce
a number of symlinks for firmware files.

The logic of firmware name with media info still kept for compatibility.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 771137db92..74d4a726df 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1130,6 +1130,13 @@ nfp_fw_get_name(struct rte_pci_device *dev,
 		}
 	}
 
+	/* And then try the model name */
+	snprintf(card_desc, sizeof(card_desc), "%s.nffw", nfp_fw_model);
+	snprintf(fw_name, fw_size, "%s/%s", DEFAULT_FW_PATH, card_desc);
+	PMD_DRV_LOG(DEBUG, "Trying with fw file: %s", fw_name);
+	if (access(fw_name, F_OK) == 0)
+		return 0;
+
 	/* Finally try the card type and media */
 	snprintf(card_desc, sizeof(card_desc), "nic_%s_%dx%d.nffw",
 			nfp_fw_model, nfp_eth_table->count,
-- 
2.39.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] support new firmware name scheme
  2024-05-28  1:29 [PATCH 0/2] support new firmware name scheme Chaoyong He
  2024-05-28  1:29 ` [PATCH 1/2] net/nfp: refactor the firmware load logic Chaoyong He
  2024-05-28  1:29 ` [PATCH 2/2] net/nfp: support new firmware name scheme Chaoyong He
@ 2024-07-05 11:28 ` Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2024-07-05 11:28 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers

On 5/28/2024 2:29 AM, Chaoyong He wrote:
> This patch series refator the firmware load logic and add support of
> the fourth firmware name scheme, and this name scheme takes the third
> priority.
> 
> Chaoyong He (2):
>   net/nfp: refactor the firmware load logic
>   net/nfp: support new firmware name scheme
>

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-05 11:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-28  1:29 [PATCH 0/2] support new firmware name scheme Chaoyong He
2024-05-28  1:29 ` [PATCH 1/2] net/nfp: refactor the firmware load logic Chaoyong He
2024-05-28  1:29 ` [PATCH 2/2] net/nfp: support new firmware name scheme Chaoyong He
2024-07-05 11:28 ` [PATCH 0/2] " Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).