DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test-pmd: show pci address in port info
@ 2015-07-29  1:05 Michael Qiu
  2015-07-29  8:42 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Qiu @ 2015-07-29  1:05 UTC (permalink / raw)
  To: dev

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(+)

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-29  8:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29  1:05 [dpdk-dev] [PATCH] test-pmd: show pci address in port info Michael Qiu
2015-07-29  8:42 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).