From: Shiyang He <shiyangx.he@intel.com>
To: dev@dpdk.org
Cc: yidingx.zhou@intel.com, Shiyang He <shiyangx.he@intel.com>,
stable@dpdk.org, Qiming Yang <qiming.yang@intel.com>,
Wenjun Wu <wenjun1.wu@intel.com>,
Remy Horton <remy.horton@intel.com>
Subject: [PATCH v2] net/ixgbe: fix ixgbe firmware version inconsistency
Date: Mon, 9 Jan 2023 06:53:09 +0000 [thread overview]
Message-ID: <20230109065310.44968-1-shiyangx.he@intel.com> (raw)
In-Reply-To: <20230104095142.86796-1-shiyangx.he@intel.com>
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(-)
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
--
2.34.1
next prev parent reply other threads:[~2023-01-09 7:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 9:51 [PATCH] net/ixgbe: fix ixgbe firmware version get Shiyang He
2023-01-04 10:18 ` Morten Brørup
2023-01-05 2:52 ` He, ShiyangX
2023-01-05 6:57 ` Morten Brørup
2023-01-05 7:33 ` He, ShiyangX
2023-01-09 6:53 ` Shiyang He [this message]
2023-01-09 7:47 ` [PATCH v2] net/ixgbe: fix ixgbe firmware version inconsistency Morten Brørup
2023-01-16 8:04 ` Zhang, Qi Z
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230109065310.44968-1-shiyangx.he@intel.com \
--to=shiyangx.he@intel.com \
--cc=dev@dpdk.org \
--cc=qiming.yang@intel.com \
--cc=remy.horton@intel.com \
--cc=stable@dpdk.org \
--cc=wenjun1.wu@intel.com \
--cc=yidingx.zhou@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).