pci address is one important info for port.
This patch make it visible for port info.

Signed-off-by: Michael Qiu <michael.qiu at intel.com>
---
 app/test-pmd/config.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 1d29146..c7db5bc 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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) {
-- 
1.9.3

Reply via email to