From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id D80201B53E for ; Thu, 10 Jan 2019 06:23:13 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2019 21:23:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,459,1539673200"; d="scan'208";a="310621368" Received: from dpdk-wenzhuol.sh.intel.com ([10.67.111.133]) by fmsmga005.fm.intel.com with ESMTP; 09 Jan 2019 21:23:11 -0800 From: Leyi Rong To: Qiming Yang , Wenzhuo Lu Cc: dev@dpdk.org, Leyi Rong Date: Thu, 10 Jan 2019 13:22:04 +0800 Message-Id: <1547097724-108047-1-git-send-email-leyi.rong@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] net/ice: fix firmware-version in the drvinfo result of ethtool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2019 05:23:14 -0000 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 --- drivers/net/ice/ice_ethdev.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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; -- 2.7.4