summaryrefslogtreecommitdiff
path: root/examples/ethtool
diff options
context:
space:
mode:
authorQiming Yang <qiming.yang@intel.com>2017-01-16 18:48:31 +0800
committerThomas Monjalon <thomas.monjalon@6wind.com>2017-01-17 22:34:36 +0100
commit1e07b4ecb18bc6c5dde929a1ae06a5b24b5d4f4c (patch)
tree91c05982135ca24e906d03df5edfe913f3189be3 /examples/ethtool
parented0dfdd0e97628f35e904266745f112337fa1b51 (diff)
downloaddpdk-1e07b4ecb18bc6c5dde929a1ae06a5b24b5d4f4c.zip
dpdk-1e07b4ecb18bc6c5dde929a1ae06a5b24b5d4f4c.tar.gz
dpdk-1e07b4ecb18bc6c5dde929a1ae06a5b24b5d4f4c.tar.xz
examples/ethtool: display firmware version
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 <qiming.yang@intel.com> Acked-by: Remy Horton <remy.horton@intel.com>
Diffstat (limited to 'examples/ethtool')
-rw-r--r--examples/ethtool/ethtool-app/ethapp.c1
-rw-r--r--examples/ethtool/lib/rte_ethtool.c9
2 files changed, 10 insertions, 0 deletions
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..b33ae12 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -48,12 +48,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);