From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 3831414EC for ; Mon, 16 Jan 2017 11:54:38 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP; 16 Jan 2017 02:54:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,238,1477983600"; d="scan'208";a="53788420" Received: from unknown (HELO dpdk7.bj.intel.com) ([172.16.182.76]) by fmsmga005.fm.intel.com with ESMTP; 16 Jan 2017 02:54:36 -0800 From: Qiming Yang To: dev@dpdk.org Cc: arybchenko@solarflare.com, thomas.monjalon@6wind.com, Qiming Yang Date: Mon, 16 Jan 2017 18:48:31 +0800 Message-Id: <1484563711-35693-6-git-send-email-qiming.yang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484563711-35693-1-git-send-email-qiming.yang@intel.com> References: <1484545498-33882-1-git-send-email-qiming.yang@intel.com> <1484563711-35693-1-git-send-email-qiming.yang@intel.com> Subject: [dpdk-dev] [PATCH v10 5/5] ethtool: display 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: Mon, 16 Jan 2017 10:54:38 -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 Acked-by: Remy Horton --- examples/ethtool/ethtool-app/ethapp.c | 1 + examples/ethtool/lib/rte_ethtool.c | 9 +++++++++ 2 files changed, 10 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..cd2f277 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -51,12 +51,21 @@ 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)); + else if (ret > 0) + printf("Insufficient fw version buffer size, the minimun size" + "should be %d\n", ret); + memset(&dev_info, 0, sizeof(dev_info)); rte_eth_dev_info_get(port_id, &dev_info); -- 2.7.4