From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id EA76EF934 for ; Thu, 12 Jan 2017 07:37:54 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP; 11 Jan 2017 22:37:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,348,1477983600"; d="scan'208";a="52071473" Received: from dpdk7.bj.intel.com ([172.16.182.76]) by orsmga005.jf.intel.com with ESMTP; 11 Jan 2017 22:37:53 -0800 From: Qiming Yang To: dev@dpdk.org, ferruh.yigit@intel.com Cc: remy.horton@intel.com, Qiming Yang Date: Thu, 12 Jan 2017 14:31:54 +0800 Message-Id: <1484202716-41669-4-git-send-email-qiming.yang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484202716-41669-1-git-send-email-qiming.yang@intel.com> References: <1484116905-57438-1-git-send-email-qiming.yang@intel.com> <1484202716-41669-1-git-send-email-qiming.yang@intel.com> Subject: [dpdk-dev] [PATCH v8 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: Thu, 12 Jan 2017 06:37:55 -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 | 26 ++++++++++++++++++++++++++ 2 files changed, 27 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 b7ddd4f..2363eb4 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -163,6 +163,7 @@ enum ixgbevf_xcast_modes { #define IXGBE_EXVET_VET_EXT_SHIFT 16 #define IXGBE_DMATXCTL_VT_MASK 0xFFFF0000 +#define IXGBE_MIN_FW_VERSION_SIZE 11 static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev); static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev); static int ixgbe_dev_configure(struct rte_eth_dev *dev); @@ -193,6 +194,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); @@ -532,6 +535,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, @@ -3022,6 +3026,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 < IXGBE_MIN_FW_VERSION_SIZE) { + 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