From mboxrd@z Thu Jan 1 00:00:00 1970 From: Qiming Yang Subject: [PATCH v8 5/5] ethtool: display firmware version Date: Thu, 12 Jan 2017 14:31:56 +0800 Message-ID: <1484202716-41669-6-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> Cc: remy.horton@intel.com, Qiming Yang To: dev@dpdk.org, ferruh.yigit@intel.com Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 9F1D3F933 for ; Thu, 12 Jan 2017 07:37:57 +0100 (CET) In-Reply-To: <1484202716-41669-1-git-send-email-qiming.yang@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch enhances the ethtool example to support to show firmware version, in the same way that the Linux kernel ethtool does. Signed-off-by: Qiming Yang Acked-by: Remy Horton --- examples/ethtool/ethtool-app/ethapp.c | 1 + examples/ethtool/lib/rte_ethtool.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index 6aeaa06..85c31ac 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -185,6 +185,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params, printf("Port %i driver: %s (ver: %s)\n", id_port, info.driver, info.version ); + 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 b1f159e..33d38a7 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -51,12 +51,18 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo) struct rte_eth_dev_info dev_info; struct rte_dev_reg_info reg_info; int n; + int ret; if (drvinfo == NULL) return -EINVAL; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + ret = rte_eth_dev_fw_version_get(port_id, drvinfo->fw_version, + sizeof(drvinfo->fw_version)); + if (ret != 0) + printf("firmware version get error: (%s)\n", strerror(-ret)); + memset(&dev_info, 0, sizeof(dev_info)); rte_eth_dev_info_get(port_id, &dev_info); -- 2.7.4