Skip to contentSkip to conversation

net/ixgbe: fix ixgbe firmware version get

PATCH Superseded Shiyang He 3 participants 8 messages Jan 4, 2023 – Jan 16, 2023 Network drivers

lore
Share & tools
lore

Shiyang He

author
#0 lore raw

PATCH 1/1 net/ixgbe: fix ixgbe firmware version get

The firmware version obtained by dpdk-ethtool is inconsistent with that obtained by linux-ethtool.

This commit fixes the issue.

Fixes 8b0b56574269 ("net/ixgbe: add firmware version get")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
index ae9f65b334..012096021e 100644
@@ -3859,7 +3859,7 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
 	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
 
-	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	etrack_id = (eeprom_verl << 16) | eeprom_verh;
 	ret = snprintf(fw_version, fw_size, "0x%08x", etrack_id);
 	if (ret < 0)
 		return -EINVAL;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 22 lines

From: Shiyang He [mailto:[email protected]]
Sent: Wednesday, 4 January 2023 10.52

The firmware version obtained by dpdk-ethtool is inconsistent with that obtained by linux-ethtool.

This commit fixes the issue.

Fixes 8b0b56574269 ("net/ixgbe: add firmware version get")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index ae9f65b334..012096021e 100644

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_fw_version_get(struct rte_eth_dev *dev, · line 3864

Quoted 7 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
@@ -3859,7 +3859,7 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev,
 char *fw_version, size_t fw_size)
 	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
 	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
 
-	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	etrack_id = (eeprom_verl << 16) | eeprom_verh;
 	ret = snprintf(fw_version, fw_size, "0x%08x", etrack_id);

This looks wrong, assuming the high-word in 0x2e and the low-word in 0x2d.

Perhaps the linux ethtool needs to be fixed instead?

I don't think DPDK should aim for "bug compatibility" with Linux. :-(

Quoted 5 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
 	if (ret < 0)

return -EINVAL;
--
2.34.1

#2 lore raw
Quoted 43 lines

-----Original Message-----
From: Morten Brørup <[email protected]>
Sent: Wednesday, January 4, 2023 6:19 PM
To: He, ShiyangX <[email protected]>; [email protected]
Cc: Zhou, YidingX <[email protected]>; [email protected]; Yang, Qiming <[email protected]>; Wu, Wenjun1 <[email protected]>; Remy Horton <[email protected]>
Subject: RE: [PATCH] net/ixgbe: fix ixgbe firmware version get

Quoted 22 lines

From: Shiyang He [mailto:[email protected]]
Sent: Wednesday, 4 January 2023 10.52

The firmware version obtained by dpdk-ethtool is inconsistent with that obtained by linux-ethtool.

This commit fixes the issue.

Fixes 8b0b56574269 ("net/ixgbe: add firmware version get")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index ae9f65b334..012096021e 100644

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_fw_version_get(struct rte_eth_dev *dev, · line 3864

Quoted 7 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
@@ -3859,7 +3859,7 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev,
 char *fw_version, size_t fw_size)
 	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
 	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
 
-	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	etrack_id = (eeprom_verl << 16) | eeprom_verh;
 	ret = snprintf(fw_version, fw_size, "0x%08x", etrack_id);

This looks wrong, assuming the high-word in 0x2e and the low-word in 0x2d.

Quoted 3 lines

Perhaps the linux ethtool needs to be fixed instead?

I don't think DPDK should aim for "bug compatibility" with Linux. :-(

After following your suggestions, I read the driver source code again, which is implemented as the solution. I will send out V2 patch soon.

#3 lore raw
Quoted 37 lines

From: He, ShiyangX [mailto:[email protected]]
Sent: Thursday, 5 January 2023 03.52

Quoted 29 lines

From: Morten Brørup <[email protected]>
Sent: Wednesday, January 4, 2023 6:19 PM

Quoted 26 lines

From: Shiyang He [mailto:[email protected]]
Sent: Wednesday, 4 January 2023 10.52

The firmware version obtained by dpdk-ethtool is inconsistent with that obtained by linux-ethtool.

This commit fixes the issue.

Fixes 8b0b56574269 ("net/ixgbe: add firmware version get")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index ae9f65b334..012096021e 100644
@@ -3859,7 +3859,7 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev,
 char *fw_version, size_t fw_size)
 	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
 	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
 
Quoted 5 lines

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) · line 3863

Quoted 3 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
-	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	etrack_id = (eeprom_verl << 16) | eeprom_verh;
 	ret = snprintf(fw_version, fw_size, "0x%08x", etrack_id);

This looks wrong, assuming the high-word in 0x2e and the low-word in

Quoted 8 lines

0x2d.

Quoted 4 lines

Perhaps the linux ethtool needs to be fixed instead?

I don't think DPDK should aim for "bug compatibility" with Linux. :-(

After following your suggestions, I read the driver source code again, which is implemented as the solution. I will send out V2 patch soon.

I suppose what you are looking for is here:
https://elixir.bootlin.com/linux/v6.1.3/source/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c#L4106

#4 lore raw
Quoted 53 lines

-----Original Message-----
From: Morten Brørup <[email protected]>
Sent: Thursday, January 5, 2023 2:57 PM
To: He, ShiyangX <[email protected]>; [email protected]
Cc: Zhou, YidingX <[email protected]>; [email protected]; Yang, Qiming <[email protected]>; Wu, Wenjun1 <[email protected]>; Remy Horton <[email protected]>
Subject: RE: [PATCH] net/ixgbe: fix ixgbe firmware version get

Quoted 22 lines

From: He, ShiyangX [mailto:[email protected]]
Sent: Thursday, 5 January 2023 03.52

Quoted 19 lines

From: Morten Brørup <[email protected]>
Sent: Wednesday, January 4, 2023 6:19 PM

Quoted 16 lines

From: Shiyang He [mailto:[email protected]]
Sent: Wednesday, 4 January 2023 10.52

The firmware version obtained by dpdk-ethtool is inconsistent with that obtained by linux-ethtool.

This commit fixes the issue.

Fixes 8b0b56574269 ("net/ixgbe: add firmware version get")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 6 lines
Quoted 6 lines

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_fw_version_get(struct rte_eth_dev

Quoted 6 lines
drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index ae9f65b334..012096021e 100644
@@ -3859,7 +3859,7 @@ ixgbe_fw_version_get(struct rte_eth_dev

*dev,

Quoted 13 lines
Quoted 9 lines

drivers/net/ixgbe/ixgbe_ethdev.c ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) · line 3863

Quoted 7 lines
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
 char *fw_version, size_t fw_size)
 	ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh);
 	ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl);
 
-	etrack_id = (eeprom_verh << 16) | eeprom_verl;
+	etrack_id = (eeprom_verl << 16) | eeprom_verh;
 	ret = snprintf(fw_version, fw_size, "0x%08x", etrack_id);

This looks wrong, assuming the high-word in 0x2e and the low-word in

0x2d.

Quoted 3 lines

Perhaps the linux ethtool needs to be fixed instead?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I don't think DPDK should aim for "bug compatibility" with Linux. :-(

After following your suggestions, I read the driver source code again, which is implemented as the solution. I will send out V2 patch soon.

I suppose what you are looking for is here:
https://elixir.bootlin.com/linux/v6.1.3/source/drivers/net/ethernet/intel/ixg
be/ixgbe_common.c#L4106

Thanks so much! The next patch will refer to this method!

author
#5 lore raw

PATCH v2 1/1 net/ixgbe: fix ixgbe firmware version inconsistency

In reply to Shiyang He

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")

v2: follow the code of ixgbe kernel driver

---
 drivers/net/ixgbe/ixgbe_ethdev.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +20 -11
index ae9f65b334..65655b9212 100644
@@ -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
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#6 lore raw

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

Quoted 7 lines

From: Shiyang He [mailto:[email protected]]
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.

Quoted 7 lines
Fixes 8b0b56574269 ("net/ixgbe: add firmware version get")

v2: follow the code of ixgbe kernel driver
---

Thank you for the updated patch. LGTM.

Applied
#7 lore raw

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

Quoted 21 lines

-----Original Message-----
From: Morten Brørup <[email protected]>
Sent: Monday, January 9, 2023 3:48 PM
To: He, ShiyangX <[email protected]>; [email protected]
Cc: Zhou, YidingX <[email protected]>; [email protected]; Yang, Qiming <[email protected]>; Wu, Wenjun1 <[email protected]>; Remy Horton <[email protected]>
Subject: RE: [PATCH v2] net/ixgbe: fix ixgbe firmware version inconsistency

Quoted 10 lines

From: Shiyang He [mailto:[email protected]]
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")
Quoted 8 lines
Quoted 4 lines

v2: follow the code of ixgbe kernel driver
---

Thank you for the updated patch. LGTM.

Applied to dpdk-next-net-intel.

Thanks
Qi