From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 7158D2C29 for ; Sun, 8 Jan 2017 05:17:31 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP; 07 Jan 2017 20:17:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,333,1477983600"; d="scan'208";a="50716473" Received: from unknown (HELO dpdk7.bj.intel.com) ([172.16.182.76]) by fmsmga005.fm.intel.com with ESMTP; 07 Jan 2017 20:17:29 -0800 From: Qiming Yang To: dev@dpdk.org Cc: ferruh.yigit@intel.com, helin.zhang@intel.com, remy.horton@intel.com, Qiming Yang Date: Sun, 8 Jan 2017 12:11:33 +0800 Message-Id: <1483848695-44643-4-git-send-email-qiming.yang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483848695-44643-1-git-send-email-qiming.yang@intel.com> References: <1483531428-14481-1-git-send-email-qiming.yang@intel.com> <1483848695-44643-1-git-send-email-qiming.yang@intel.com> Subject: [dpdk-dev] [PATCH v5 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: Sun, 08 Jan 2017 04:17:31 -0000 This patch adds a new function ixgbe_fw_version_get. Signed-off-by: Qiming Yang Acked-by: Remy Horton --- v3 changes: * use ixgbe_fw_version_get(struct rte_eth_dev *dev, __rte_unused u32 *fw_major, __rte_unused u32 *fw_minor, __rte_unused u32 *fw_patch, u32 *etrack_id) instead of ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length). Add statusment in /doc/guides/nics/features/ixgbe.ini. v5 changes: * use the function interface in patch v2. --- --- doc/guides/nics/features/ixgbe.ini | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 18 ++++++++++++++++++ 2 files changed, 19 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 ec2edad..407f398 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 void ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, + int fw_length); 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); @@ -538,6 +540,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, @@ -3029,6 +3032,21 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev) } static void +ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, int fw_length) +{ + struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + u16 eeprom_verh, eeprom_verl; + u32 etrack_id; + + 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_length, + "0x%08x", etrack_id); +} + +static void ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct rte_pci_device *pci_dev = IXGBE_DEV_TO_PCI(dev); -- 2.7.4