[dpdk-dev] test-pmd: show pci address in port info
Commit Message
pci address is one important info for port.
This patch make it visible for port info.
Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
app/test-pmd/config.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
Comments
2015-07-29 09:05, Michael Qiu:
> pci address is one important info for port.
> This patch make it visible for port info.
>
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
Maybe you missed this thread:
http://dpdk.org/ml/archives/dev/2015-July/022107.html
> + if (strncmp("0000:00:00.0", pci_addr, 12))
> + printf("\nPCI address: %s", pci_addr);
> + else
> + printf("\nPCI address: N/A");
Checking a null PCI address to handle non-pci devices is ugly.
EAL must be reworked to correctly handle non-PCI devices.
Patches welcome.
This patch is rejected.
@@ -297,6 +297,8 @@ port_infos_display(portid_t port_id)
{
struct rte_port *port;
struct ether_addr mac_addr;
+ struct rte_pci_addr *addr = NULL;
+ char pci_addr[13] = "0000:00:00.0";
struct rte_eth_link link;
struct rte_eth_dev_info dev_info;
int vlan_offload;
@@ -317,6 +319,17 @@ port_infos_display(portid_t port_id)
info_border, port_id, info_border);
rte_eth_macaddr_get(port_id, &mac_addr);
print_ethaddr("MAC address: ", &mac_addr);
+ if (port->dev_info.pci_dev) {
+ addr = &port->dev_info.pci_dev->addr;
+ sprintf(pci_addr, "%04x:%02x:%02x.%01x",
+ addr->domain, addr->bus, addr->devid, addr->function);
+ }
+
+ if (strncmp("0000:00:00.0", pci_addr, 12))
+ printf("\nPCI address: %s", pci_addr);
+ else
+ printf("\nPCI address: N/A");
+
printf("\nConnect to socket: %u", port->socket_id);
if (port_numa[port_id] != NUMA_NO_CONFIG) {