[dpdk-dev,v3] ethtool: dispaly bus info and firmware version

Message ID 1482843968-6483-1-git-send-email-qiming.yang@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Qiming Yang Dec. 27, 2016, 1:06 p.m. UTC
  This patch enhances the ethtool example to support to show
bus information and firmware version, in the same way that
the Linux kernel ethtool does.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
v3 changes:
 * split this patch from the patch set of rte_eth_dev_fw_info_get
   use the new version function.
---
---
 examples/ethtool/ethtool-app/ethapp.c |  2 ++
 examples/ethtool/lib/rte_ethtool.c    | 11 +++++++++++
 2 files changed, 13 insertions(+)
  

Comments

Jingjing Wu Jan. 4, 2017, 7:51 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiming Yang
> Sent: Tuesday, December 27, 2016 9:06 PM
> To: dev@dpdk.org; thomas.monjalon@6wind.com
> Cc: Horton, Remy <remy.horton@intel.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> Subject: [dpdk-dev] [PATCH v3] ethtool: dispaly bus info and firmware version
> 
> This patch enhances the ethtool example to support to show bus information
> and firmware version, in the same way that the Linux kernel ethtool does.
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
> v3 changes:
>  * split this patch from the patch set of rte_eth_dev_fw_info_get
>    use the new version function.
> ---
> ---
>  examples/ethtool/ethtool-app/ethapp.c |  2 ++
>  examples/ethtool/lib/rte_ethtool.c    | 11 +++++++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/examples/ethtool/ethtool-app/ethapp.c
> b/examples/ethtool/ethtool-app/ethapp.c
> index 6aeaa06..192d941 100644
> --- a/examples/ethtool/ethtool-app/ethapp.c
> +++ b/examples/ethtool/ethtool-app/ethapp.c
> @@ -185,6 +185,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);

This patch has dependence on your get_fw_version patch set.

I think you may misunderstand Ferruh's comments,
I think what he said was ask you to remove bus-info print (above line) from that patch set,
but keep firmware version print.

Thanks
Jingjing
  

Patch

diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c
index 6aeaa06..192d941 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -185,6 +185,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 6f0ce84..f62f1d3 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -54,6 +54,11 @@  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_info_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 +66,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",