[dpdk-dev,v4,5/5] ethtool: dispaly firmware version
Checks
Commit Message
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>
---
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(+)
Comments
On 1/4/2017 12:03 PM, Qiming Yang wrote:
> 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>
<...>
>
> @@ -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)
Do you need this check. I think it is not good idea to add this kind of
checks into ethtool app. Why not just print "%d.%d.%d %#X, major, minor,
patch, etrack" for all cases ?
> + 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",
>
-----Original Message-----
From: Yigit, Ferruh
Sent: Wednesday, January 4, 2017 10:01 PM
To: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org
Cc: Zhang, Helin <helin.zhang@intel.com>; Horton, Remy <remy.horton@intel.com>
Subject: Re: [PATCH v4 5/5] ethtool: dispaly firmware version
On 1/4/2017 12:03 PM, Qiming Yang wrote:
> 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>
<...>
>
> @@ -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)
Do you need this check. I think it is not good idea to add this kind of checks into ethtool app. Why not just print "%d.%d.%d %#X, major, minor, patch, etrack" for all cases ?
Qiming: because I want to keep the format same with kernel version ethtool.
> + 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",
>
On 05/01/2017 01:31, Yang, Qiming wrote:
[..]
>> + if (strcmp(drvinfo->driver, "net_ixgbe") == 0)
>
> Do you need this check. I think it is not good idea to add this kind
> of checks into ethtool app. Why not just print "%d.%d.%d %#X, major,
> minor, patch, etrack" for all cases ?
> Qiming: because I want to keep the format same with kernel version
ethtool.
My feeling is that if we're going to have driver-specific output, then
the task of constructing the string should be pushed down into the PMDs.
It would also solve the headache of trying to standardise, as Thomas has
mentioned..
..Remy
@@ -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);
}
}
@@ -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",