[v2] net/ixgbe: fix ixgbe firmware version inconsistency

Message ID 20230109065310.44968-1-shiyangx.he@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v2] net/ixgbe: fix ixgbe firmware version inconsistency |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build fail github build: failed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Shiyang He Jan. 9, 2023, 6:53 a.m. UTC
  This patch follows the code of ixgbe kernel driver so that it keeps the
firmware version obtained by dpdk-ethtool consistent with that obtained
by linux-ethtool.

Fixes: 8b0b56574269 ("net/ixgbe: add firmware version get")
Cc: stable@dpdk.org

Signed-off-by: Shiyang He <shiyangx.he@intel.com>

v2: follow the code of ixgbe kernel driver
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
  

Comments

Morten Brørup Jan. 9, 2023, 7:47 a.m. UTC | #1
> From: Shiyang He [mailto:shiyangx.he@intel.com]
> Sent: Monday, 9 January 2023 07.53
> 
> This patch follows the code of ixgbe kernel driver so that it keeps the
> firmware version obtained by dpdk-ethtool consistent with that obtained
> by linux-ethtool.
> 
> Fixes: 8b0b56574269 ("net/ixgbe: add firmware version get")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shiyang He <shiyangx.he@intel.com>
> 
> v2: follow the code of ixgbe kernel driver
> ---

Thank you for the updated patch. LGTM.

Acked-by: Morten Brørup <mb@smartsharesystems.com>
  
Qi Zhang Jan. 16, 2023, 8:04 a.m. UTC | #2
> -----Original Message-----
> From: Morten Brørup <mb@smartsharesystems.com>
> Sent: Monday, January 9, 2023 3:48 PM
> To: He, ShiyangX <shiyangx.he@intel.com>; dev@dpdk.org
> Cc: Zhou, YidingX <yidingx.zhou@intel.com>; stable@dpdk.org; Yang, Qiming
> <qiming.yang@intel.com>; Wu, Wenjun1 <wenjun1.wu@intel.com>; Remy
> Horton <remy.horton@intel.com>
> Subject: RE: [PATCH v2] net/ixgbe: fix ixgbe firmware version inconsistency
> 
> > From: Shiyang He [mailto:shiyangx.he@intel.com]
> > Sent: Monday, 9 January 2023 07.53
> >
> > This patch follows the code of ixgbe kernel driver so that it keeps
> > the firmware version obtained by dpdk-ethtool consistent with that
> > obtained by linux-ethtool.
> >
> > Fixes: 8b0b56574269 ("net/ixgbe: add firmware version get")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Shiyang He <shiyangx.he@intel.com>
> >
> > v2: follow the code of ixgbe kernel driver
> > ---
> 
> Thank you for the updated patch. LGTM.
> 
> Acked-by: Morten Brørup <mb@smartsharesystems.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ae9f65b334..65655b9212 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3852,23 +3852,32 @@  static int
 ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	u16 eeprom_verh, eeprom_verl;
-	u32 etrack_id;
+	struct ixgbe_nvm_version nvm_ver;
 	int ret;
 
-	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
-	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
+	ixgbe_get_oem_prod_version(hw, &nvm_ver);
+	if (nvm_ver.oem_valid) {
+		snprintf(fw_version, fw_size, "%x.%x.%x",
+			 nvm_ver.oem_major, nvm_ver.oem_minor,
+			 nvm_ver.oem_release);
+		return 0;
+	}
+
+	ixgbe_get_etk_id(hw, &nvm_ver);
+	ixgbe_get_orom_version(hw, &nvm_ver);
 
-	etrack_id = (eeprom_verh << 16) | eeprom_verl;
-	ret = snprintf(fw_version, fw_size, "0x%08x", etrack_id);
+	if (nvm_ver.or_valid) {
+		snprintf(fw_version, fw_size, "0x%08x, %d.%d.%d",
+			 nvm_ver.etk_id, nvm_ver.or_major,
+			 nvm_ver.or_build, nvm_ver.or_patch);
+		return 0;
+	}
+
+	ret = snprintf(fw_version, fw_size, "0x%08x", nvm_ver.etk_id);
 	if (ret < 0)
 		return -EINVAL;
 
-	ret += 1; /* add the size of '\0' */
-	if (fw_size < (size_t)ret)
-		return ret;
-	else
-		return 0;
+	return (fw_size < (size_t)ret++) ? ret : 0;
 }
 
 static int