net/ice: fix firmware-version in the drvinfo result of ethtool
diff mbox series

Message ID 1547097724-108047-1-git-send-email-leyi.rong@intel.com
State Accepted, archived
Delegated to: Qi Zhang
Headers show
Series
  • net/ice: fix firmware-version in the drvinfo result of ethtool
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Leyi Rong Jan. 10, 2019, 5:22 a.m. UTC
Fix the drvinfo dumped firmware-version when using dpdk ethtool,
change it to the same result as linux ethtool shown info.

Fixes: e31cb9a36298 ("net/ice: support FW version getting")

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Zhang, Qi Z Jan. 10, 2019, 12:08 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Leyi Rong
> Sent: Thursday, January 10, 2019 1:22 PM
> To: Yang, Qiming <qiming.yang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>
> Cc: dev@dpdk.org; Rong, Leyi <leyi.rong@intel.com>
> Subject: [dpdk-dev] [PATCH] net/ice: fix firmware-version in the drvinfo result
> of ethtool
> 
> Fix the drvinfo dumped firmware-version when using dpdk ethtool, change it to
> the same result as linux ethtool shown info.
> 
> Fixes: e31cb9a36298 ("net/ice: support FW version getting")
> 
> Signed-off-by: Leyi Rong <leyi.rong@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

Patch
diff mbox series

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 0a81e04..5545f38 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2590,11 +2590,22 @@  static int
 ice_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 {
 	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	u32 full_ver;
+	u8 ver, patch;
+	u16 build;
 	int ret;
 
-	ret = snprintf(fw_version, fw_size, "%d.%d.%05d %d.%d",
-		       hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build,
-		       hw->api_maj_ver, hw->api_min_ver);
+	full_ver = hw->nvm.oem_ver;
+	ver = (u8)(full_ver >> 24);
+	build = (u16)((full_ver >> 8) & 0xffff);
+	patch = (u8)(full_ver & 0xff);
+
+	ret = snprintf(fw_version, fw_size,
+			"%d.%d%d 0x%08x %d.%d.%d",
+			((hw->nvm.ver >> 12) & 0xf),
+			((hw->nvm.ver >> 4) & 0xff),
+			(hw->nvm.ver & 0xf), hw->nvm.eetrack,
+			ver, build, patch);
 
 	/* add the size of '\0' */
 	ret += 1;