summaryrefslogtreecommitdiff
path: root/examples/ethtool
diff options
context:
space:
mode:
authorFerruh Yigit <ferruh.yigit@intel.com>2018-04-09 13:09:38 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2018-04-14 00:41:44 +0200
commitcd8c7c7ce241d2ea7c059a9df07caa9411ef19ed (patch)
tree93b03b50a9a77c2f86bd071573c8a94326427558 /examples/ethtool
parente4031ced5a3d6afc028ab8551d80d60351c3a180 (diff)
downloaddpdk-cd8c7c7ce241d2ea7c059a9df07caa9411ef19ed.zip
dpdk-cd8c7c7ce241d2ea7c059a9df07caa9411ef19ed.tar.gz
dpdk-cd8c7c7ce241d2ea7c059a9df07caa9411ef19ed.tar.xz
ethdev: replace bus specific struct with generic dev
Public struct rte_eth_dev_info has a "struct rte_pci_device" field in it although it is common for all ethdev in all buses. Replacing pci specific struct with generic device struct and updating places that are using pci device in a way to get this information from generic device. Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Reviewed-by: David Marchand <david.marchand@6wind.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
Diffstat (limited to 'examples/ethtool')
-rw-r--r--examples/ethtool/lib/rte_ethtool.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c
index 90dfbb7..d519a50 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -22,6 +22,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
{
struct rte_eth_dev_info dev_info;
struct rte_dev_reg_info reg_info;
+ const struct rte_pci_device *pci_dev;
+ const struct rte_bus *bus = NULL;
int n;
int ret;
@@ -46,15 +48,17 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct ethtool_drvinfo *drvinfo)
snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
rte_version());
/* TODO: replace bus_info by rte_devargs.name */
- if (dev_info.pci_dev)
+ if (dev_info.device)
+ bus = rte_bus_find_by_device(dev_info.device);
+ if (bus && !strcmp(bus->name, "pci")) {
+ pci_dev = RTE_DEV_TO_PCI(dev_info.device);
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),
"%04x:%02x:%02x.%x",
- dev_info.pci_dev->addr.domain,
- dev_info.pci_dev->addr.bus,
- dev_info.pci_dev->addr.devid,
- dev_info.pci_dev->addr.function);
- else
+ pci_dev->addr.domain, pci_dev->addr.bus,
+ pci_dev->addr.devid, pci_dev->addr.function);
+ } else {
snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A");
+ }
memset(&reg_info, 0, sizeof(reg_info));
rte_eth_dev_get_reg_info(port_id, &reg_info);