DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michael Qiu <michael.qiu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] test-pmd: show pci address in port info
Date: Wed, 29 Jul 2015 09:05:04 +0800	[thread overview]
Message-ID: <1438131904-23221-1-git-send-email-michael.qiu@intel.com> (raw)

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

             reply	other threads:[~2015-07-29  1:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29  1:05 Michael Qiu [this message]
2015-07-29  8:42 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438131904-23221-1-git-send-email-michael.qiu@intel.com \
    --to=michael.qiu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).