patch 'net/nfp: fix getting firmware version' has been queued to stable release 23.11.2

Xueming Li xuemingl at nvidia.com
Mon Aug 12 14:49:36 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/14/24. 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://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=174b2b5a9a3d6892847cbe2901bb77c8cac69d89

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 174b2b5a9a3d6892847cbe2901bb77c8cac69d89 Mon Sep 17 00:00:00 2001
From: Zerun Fu <zerun.fu at corigine.com>
Date: Mon, 24 Jun 2024 09:57:18 +0800
Subject: [PATCH] net/nfp: fix getting firmware version
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit b7adbb2efe98eccb60ea7a7cfc1cff6ae3c5fbc8 ]

The original logic try to get the NSP resource every time the application
call 'rte_eth_dev_fw_version_get()' interface, there are chances the NSP
resource busy and fail to get it. And because the local string variables
not initialized, there will be out of range problem when it fail to get
the NSP resource.

Fix this by initializing the local string variables and storing the
firmware version string once we get it.

Fixes: 128c8ad951bf ("net/nfp: support getting firmware version")

Signed-off-by: Zerun Fu <zerun.fu at corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
---
 drivers/net/nfp/nfp_net_common.c | 26 ++++++++++++++++++--------
 drivers/net/nfp/nfp_net_common.h |  6 ++++++
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index effb104af5..0491912bd3 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -189,9 +189,6 @@ nfp_net_notify_port_speed(struct nfp_net_hw *hw,
 			nfp_net_link_speed_rte2nfp(link->link_speed));
 }
 
-/* The length of firmware version string */
-#define FW_VER_LEN        32
-
 /**
  * Reconfigure the firmware via the mailbox
  *
@@ -2063,16 +2060,21 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
 		size_t fw_size)
 {
 	struct nfp_net_hw *hw;
-	char mip_name[FW_VER_LEN];
-	char app_name[FW_VER_LEN];
-	char nsp_version[FW_VER_LEN];
-	char vnic_version[FW_VER_LEN];
+	char app_name[FW_VER_LEN] = {0};
+	char mip_name[FW_VER_LEN] = {0};
+	char nsp_version[FW_VER_LEN] = {0};
+	char vnic_version[FW_VER_LEN] = {0};
 
 	if (fw_size < FW_VER_LEN)
 		return FW_VER_LEN;
 
 	hw = nfp_net_get_hw(dev);
 
+	if (hw->fw_version[0] != 0) {
+		snprintf(fw_version, FW_VER_LEN, "%s", hw->fw_version);
+		return 0;
+	}
+
 	if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) {
 		snprintf(vnic_version, FW_VER_LEN, "%d.%d.%d.%d",
 			hw->ver.extend, hw->ver.class,
@@ -2085,8 +2087,16 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
 	nfp_net_get_mip_name(hw, mip_name);
 	nfp_net_get_app_name(hw, app_name);
 
-	snprintf(fw_version, FW_VER_LEN, "%s %s %s %s",
+	if (nsp_version[0] == 0 || mip_name[0] == 0) {
+		snprintf(fw_version, FW_VER_LEN, "%s %s %s %s",
 			vnic_version, nsp_version, mip_name, app_name);
+		return 0;
+	}
+
+	snprintf(hw->fw_version, FW_VER_LEN, "%s %s %s %s",
+			vnic_version, nsp_version, mip_name, app_name);
+
+	snprintf(fw_version, FW_VER_LEN, "%s", hw->fw_version);
 
 	return 0;
 }
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 827aa2c0e2..41d59bfa99 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -38,6 +38,9 @@
 
 #define NFP_BEAT_LENGTH         8
 
+/* The length of firmware version string */
+#define FW_VER_LEN        32
+
 /*
  * Each PF has corresponding word to beat:
  * Offset | Usage
@@ -178,6 +181,9 @@ struct nfp_net_hw {
 	struct nfp_net_tlv_caps tlv_caps;
 
 	struct nfp_net_ipsec_data *ipsec_data;
+
+	/** Used for firmware version */
+	char fw_version[FW_VER_LEN];
 };
 
 static inline uint32_t
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-08-12 20:44:05.680993647 +0800
+++ 0099-net-nfp-fix-getting-firmware-version.patch	2024-08-12 20:44:02.385069351 +0800
@@ -1 +1 @@
-From b7adbb2efe98eccb60ea7a7cfc1cff6ae3c5fbc8 Mon Sep 17 00:00:00 2001
+From 174b2b5a9a3d6892847cbe2901bb77c8cac69d89 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit b7adbb2efe98eccb60ea7a7cfc1cff6ae3c5fbc8 ]
@@ -16 +18,0 @@
-Cc: stable at dpdk.org
@@ -28 +30 @@
-index 2260e7c66b..379335e210 100644
+index effb104af5..0491912bd3 100644
@@ -31 +33 @@
-@@ -193,9 +193,6 @@ nfp_net_notify_port_speed(struct nfp_net_hw *hw,
+@@ -189,9 +189,6 @@ nfp_net_notify_port_speed(struct nfp_net_hw *hw,
@@ -39 +41 @@
-  * Reconfigure the firmware of VF configure
+  * Reconfigure the firmware via the mailbox
@@ -41 +43 @@
-@@ -2250,11 +2247,11 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
+@@ -2063,16 +2060,21 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
@@ -49 +50,0 @@
- 	struct nfp_net_hw_priv *hw_priv;
@@ -57 +58 @@
-@@ -2262,6 +2259,11 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
+ 
@@ -59 +59,0 @@
- 	hw_priv = dev->process_private;
@@ -66 +66 @@
- 	if (!rte_eth_dev_is_repr(dev)) {
+ 	if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) {
@@ -69,3 +69,3 @@
-@@ -2274,8 +2276,16 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
- 	nfp_net_get_mip_name(hw_priv, mip_name);
- 	nfp_net_get_app_name(hw_priv, app_name);
+@@ -2085,8 +2087,16 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
+ 	nfp_net_get_mip_name(hw, mip_name);
+ 	nfp_net_get_app_name(hw, app_name);
@@ -88 +88 @@
-index 4bf7453512..bebb754ced 100644
+index 827aa2c0e2..41d59bfa99 100644
@@ -91,3 +91,3 @@
-@@ -50,6 +50,9 @@
- 				RTE_ETH_RSS_NONFRAG_IPV6_UDP  | \
- 				RTE_ETH_RSS_NONFRAG_IPV6_SCTP)
+@@ -38,6 +38,9 @@
+ 
+ #define NFP_BEAT_LENGTH         8
@@ -101 +101,2 @@
-@@ -255,6 +258,9 @@ struct nfp_net_hw {
+@@ -178,6 +181,9 @@ struct nfp_net_hw {
+ 	struct nfp_net_tlv_caps tlv_caps;
@@ -103,2 +104 @@
- 	/** Used for rte_flow of CoreNIC firmware */
- 	struct nfp_net_priv *priv;
+ 	struct nfp_net_ipsec_data *ipsec_data;


More information about the stable mailing list