From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B30044237B; Mon, 9 Jan 2023 08:03:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2966740687; Mon, 9 Jan 2023 08:03:04 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 532C04067C; Mon, 9 Jan 2023 08:03:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673247782; x=1704783782; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LkmB1OphoaE2tp66NSVfmbpnJuAis9D0lrsbgYsU1Ug=; b=nvnjAoaYk6SPD7NhlW4grmVhQTsjcf0oZFFS5l4uHuQOl0SXPzjXee6w eLdNSjdAKXn7r8L8lREBj8ExNMincjj+SBwArSoUdMpwJMJ5I25li+McF mK/GAr4GDnZ7vEVhw5Uu4oy2YKZP0b9tdB1KZCGkOyiTqlHyt2TuP+wuS 4w9o0CVZkwnzNUWLR7wvIaWBKZ2sS7CMDAHdOS1aOriOWA+a7OyZLl6Wq 3Ppl/W0NibugTwDCtO1qiD3ewHpKjWWeOl+kC1ZJNnvoQl3niFUcN1oJ7 o8PAYwGusB1UzDBbszWmdL1AHEGmC7wkVmZJL5WO9iKNClIB8mYtDGv16 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10584"; a="387258403" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="387258403" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2023 23:03:01 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10584"; a="634107511" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="634107511" Received: from unknown (HELO root..) ([10.239.252.111]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2023 23:02:58 -0800 From: Shiyang He To: dev@dpdk.org Cc: yidingx.zhou@intel.com, Shiyang He , stable@dpdk.org, Qiming Yang , Wenjun Wu , Remy Horton Subject: [PATCH v2] net/ixgbe: fix ixgbe firmware version inconsistency Date: Mon, 9 Jan 2023 06:53:09 +0000 Message-Id: <20230109065310.44968-1-shiyangx.he@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104095142.86796-1-shiyangx.he@intel.com> References: <20230104095142.86796-1-shiyangx.he@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 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