From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 54CF34CC5 for ; Wed, 4 Jan 2017 13:09:41 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 04 Jan 2017 04:09:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,459,1477983600"; d="scan'208";a="209520083" Received: from dpdk7.bj.intel.com ([172.16.182.76]) by fmsmga004.fm.intel.com with ESMTP; 04 Jan 2017 04:09:39 -0800 From: Qiming Yang To: dev@dpdk.org Cc: ferruh.yigit@intel.com, helin.zhang@intel.com, remy.horton@intel.com, Qiming Yang Date: Wed, 4 Jan 2017 20:03:48 +0800 Message-Id: <1483531428-14481-6-git-send-email-qiming.yang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483531428-14481-1-git-send-email-qiming.yang@intel.com> References: <1482841816-54143-1-git-send-email-qiming.yang@intel.com> <1483531428-14481-1-git-send-email-qiming.yang@intel.com> Subject: [dpdk-dev] [PATCH v4 5/5] ethtool: dispaly firmware version 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: Wed, 04 Jan 2017 12:09:41 -0000 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 --- v4 changes: * split bus info print from this patch set --- --- examples/ethtool/ethtool-app/ethapp.c | 1 + examples/ethtool/lib/rte_ethtool.c | 12 ++++++++++++ 2 files changed, 13 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 6f0ce84..741468f 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -54,6 +54,12 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + uint32_t fw_major = 0; + uint32_t fw_minor = 0; + uint32_t etrack = 0; + + rte_eth_dev_fw_version_get(port_id, &fw_major, &fw_minor, + NULL, &etrack); memset(&dev_info, 0, sizeof(dev_info)); rte_eth_dev_info_get(port_id, &dev_info); @@ -61,6 +67,12 @@ rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo) dev_info.driver_name); snprintf(drvinfo->version, sizeof(drvinfo->version), "%s", rte_version()); + if (strcmp(drvinfo->driver, "net_ixgbe") == 0) + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), + "0x%08x", etrack); + else + snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), + "%d.%02d 0x%08x", fw_major, fw_minor, etrack); if (dev_info.pci_dev) snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "%04x:%02x:%02x.%x", -- 2.7.4