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 8CF7F2A5B for ; Tue, 10 Jan 2017 10:14:50 +0100 (CET) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 10 Jan 2017 01:14:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,343,1477983600"; d="scan'208";a="52097180" Received: from unknown (HELO dpdk7.bj.intel.com) ([172.16.182.76]) by fmsmga006.fm.intel.com with ESMTP; 10 Jan 2017 01:14:48 -0800 From: Qiming Yang To: dev@dpdk.org Cc: remy.horton@intel.com, ferruh.yigit@intel.com, helin.zhang@intel.com, Qiming Yang Date: Tue, 10 Jan 2017 17:08:51 +0800 Message-Id: <1484039333-30074-4-git-send-email-qiming.yang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484039333-30074-1-git-send-email-qiming.yang@intel.com> References: <1483848695-44643-1-git-send-email-qiming.yang@intel.com> <1484039333-30074-1-git-send-email-qiming.yang@intel.com> Subject: [dpdk-dev] [PATCH v6 3/5] net/ixgbe: add firmware version get 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: Tue, 10 Jan 2017 09:14:51 -0000 This patch adds a new function ixgbe_fw_version_get. Signed-off-by: Qiming Yang Acked-by: Remy Horton --- doc/guides/nics/features/ixgbe.ini | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/doc/guides/nics/features/ixgbe.ini b/doc/guides/nics/features/ixgbe.ini index 4a5667f..e7104c2 100644 --- a/doc/guides/nics/features/ixgbe.ini +++ b/doc/guides/nics/features/ixgbe.ini @@ -43,6 +43,7 @@ Timesync = Y Basic stats = Y Extended stats = Y Stats per queue = Y +FW version = Y EEPROM dump = Y Registers dump = Y Multiprocess aware = Y diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 060772d..a638936 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -193,6 +193,8 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev, uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx); +static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, + size_t fw_size); static void ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev); @@ -540,6 +542,7 @@ static const struct eth_dev_ops ixgbe_eth_dev_ops = { .xstats_reset = ixgbe_dev_xstats_reset, .xstats_get_names = ixgbe_dev_xstats_get_names, .queue_stats_mapping_set = ixgbe_dev_queue_stats_mapping_set, + .fw_version_get = ixgbe_fw_version_get, .dev_infos_get = ixgbe_dev_info_get, .dev_supported_ptypes_get = ixgbe_dev_supported_ptypes_get, .mtu_set = ixgbe_dev_mtu_set, @@ -3034,6 +3037,28 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev) hw_stats->vfgotc = 0; } +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; + + if (fw_size < 11) { + PMD_DRV_LOG(WARNING, "Insufficient fw version buffer size"); + return -EINVAL; + } + + ixgbe_read_eeprom(hw, 0x2e, &eeprom_verh); + ixgbe_read_eeprom(hw, 0x2d, &eeprom_verl); + + etrack_id = (eeprom_verh << 16) | eeprom_verl; + snprintf(fw_version, fw_size, + "0x%08x", etrack_id); + + return 0; +} + static void ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { -- 2.7.4