From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 4C1A7C560 for ; Wed, 29 Jul 2015 03:05:17 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 28 Jul 2015 18:05:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,567,1432623600"; d="scan'208";a="756993689" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 28 Jul 2015 18:05:12 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t6T158ql024114; Wed, 29 Jul 2015 09:05:08 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t6T156FA023256; Wed, 29 Jul 2015 09:05:08 +0800 Received: (from dayuqiu@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t6T155vL023252; Wed, 29 Jul 2015 09:05:05 +0800 From: Michael Qiu To: dev@dpdk.org Date: Wed, 29 Jul 2015 09:05:04 +0800 Message-Id: <1438131904-23221-1-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] test-pmd: show pci address in port info X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 01:05:17 -0000 pci address is one important info for port. This patch make it visible for port info. Signed-off-by: Michael Qiu --- 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