From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 78E495683 for ; Tue, 20 Sep 2016 09:32:11 +0200 (CEST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP; 20 Sep 2016 00:32:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,366,1470726000"; d="scan'208";a="11284939" Received: from dpdk7.bj.intel.com ([172.16.182.76]) by orsmga005.jf.intel.com with ESMTP; 20 Sep 2016 00:32:09 -0700 From: Qiming Yang To: dev@dpdk.org Cc: Qiming Yang Date: Tue, 20 Sep 2016 15:30:37 +0800 Message-Id: <1474356637-48797-1-git-send-email-qiming.yang@intel.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC] examples/ethtool: enhance ethtool app in i40e X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2016 07:32:11 -0000 Now, run the example/ethtool, the drvinfo can not show the fireware information. From customer point of view, it should be better if we can have the same as kernel version ethtool show the bus-info and firmware-version. We need to add a variable in struct rte_eth_dev_info to get the fw version. I’m interested in: a) this approach is appropriate? b) would prefer a change of the API? Signed-off-by: Qiming Yang --- drivers/net/i40e/i40e_ethdev.c | 5 +++++ examples/ethtool/ethtool-app/ethapp.c | 2 ++ examples/ethtool/lib/rte_ethtool.c | 2 ++ lib/librte_ether/rte_ethdev.h | 1 + 4 files changed, 10 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index d0aeb70..0f66ecf 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2556,6 +2556,11 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_vsi *vsi = pf->main_vsi; + snprintf(dev_info->fw_version, 20, + "%d.%d%d 0x%04x", + ((hw->nvm.version >> 12) & 0xf), + ((hw->nvm.version >> 4) & 0xff), + (hw->nvm.version & 0xf), hw->nvm.eetrack); dev_info->max_rx_queues = vsi->nb_qps; dev_info->max_tx_queues = vsi->nb_qps; dev_info->min_rx_bufsize = I40E_BUF_SIZE_MIN; diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index 38e466c..9b77385 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -184,6 +184,8 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params, printf("Port %i driver: %s (ver: %s)\n", id_port, info.driver, info.version ); + printf("bus-info: %s\n", info.bus_info); + printf("firmware-version: %s\n", info.fw_version); } } diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index a1f91d4..72c3f94 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -57,6 +57,8 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo) memset(&dev_info, 0, sizeof(dev_info)); rte_eth_dev_info_get(port_id, &dev_info); + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%s", + dev_info.fw_version); snprintf(drvinfo->driver, sizeof(drvinfo->driver), "%s", dev_info.driver_name); snprintf(drvinfo->version, sizeof(drvinfo->version), "%s", diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index b0fe033..1cb85ba 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -869,6 +869,7 @@ struct rte_eth_conf { * Ethernet device information */ struct rte_eth_dev_info { + char fw_version[20]; /**< NIC firmware version. */ struct rte_pci_device *pci_dev; /**< Device PCI information. */ const char *driver_name; /**< Device Driver name. */ unsigned int if_index; /**< Index to bound host interface, or 0 if none. -- 2.7.4