diff options
author | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2017-03-02 16:15:51 +0100 |
---|---|---|
committer | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2017-03-03 14:43:36 +0100 |
commit | 0c3ed7dcda2b9a08702cd5e30d8e48f412ad62fd (patch) | |
tree | dc06f6a9d25a767536c9c5e281ccd11aa3143f1c /examples/ethtool | |
parent | d4326699b9ff4788aed0c889a5c26a840e75a352 (diff) |
Imported Upstream version 16.11.1
Change-Id: Ib15a339c8050bb0594ce8333133e923771d2fc57
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Diffstat (limited to 'examples/ethtool')
-rw-r--r-- | examples/ethtool/ethtool-app/ethapp.c | 1 | ||||
-rw-r--r-- | examples/ethtool/lib/rte_ethtool.c | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index 38e466c0..6aeaa061 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -177,6 +177,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params, int id_port; for (id_port = 0; id_port < rte_eth_dev_count(); id_port++) { + memset(&info, 0, sizeof(info)); if (rte_ethtool_get_drvinfo(id_port, &info)) { printf("Error getting info for port %i\n", id_port); return; diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index a1f91d45..6f0ce848 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -61,10 +61,15 @@ 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()); - 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); + if (dev_info.pci_dev) + 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 + snprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info), "N/A"); memset(®_info, 0, sizeof(reg_info)); rte_eth_dev_get_reg_info(port_id, ®_info); |