Skip to contentSkip to conversation

test-pmd: show pci address in port info

PATCH In review Michael Qiu 2 participants 2 messages Jul 29, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test-pmd: show pci address in port info

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

---
 app/test-pmd/config.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
app/test-pmd/config.c +13 -0
index 1d29146..c7db5bc 100644
@@ -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) {
Signature · 1 line
1.9.3
#1 lore raw

2015-07-29 09:05, Michael Qiu:

Quoted 4 lines

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

Maybe you missed this thread:

	http://dpdk.org/ml/archives/dev/2015-July/022107.html

app/test-pmd/config.c port_infos_display(portid_t port_id) · line 331

Quoted 4 lines
app/test-pmd/config.c +4 -0
+	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.