diff mbox series

app/procinfo: enhance port and mempool info

Message ID 20200710160610.22844-1-hemant.agrawal@nxp.com
State New
Headers show
Series app/procinfo: enhance port and mempool info | expand

Commit Message

Hemant Agrawal July 10, 2020, 4:06 p.m. UTC
This patch enhances the port info for more details about
the port and queues.
This patch also add support to get info about the mempool
ops.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 app/proc-info/main.c | 63 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 52 insertions(+), 11 deletions(-)

-- 
2.17.1

Comments

Stephen Hemminger July 10, 2020, 6:07 p.m. UTC | #1
On Fri, 10 Jul 2020 21:36:10 +0530
Hemant Agrawal <hemant.agrawal@nxp.com> wrote:

> +			printf("\t  MAC: %02" PRIx8 ":%02" PRIx8 ":%02" PRIx8

> +				":%02" PRIx8 ":%02" PRIx8 ":%02" PRIx8"\n",

> +				ethaddr.addr_bytes[0], ethaddr.addr_bytes[1],

> +				ethaddr.addr_bytes[2], ethaddr.addr_bytes[3],

> +				ethaddr.addr_bytes[4], ethaddr.addr_bytes[5]);



Please use rte_ether_format_addr() here.
diff mbox series

Patch

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index abeca4aab..2dda1e201 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -661,6 +661,7 @@  show_port(void)
 {
 	uint16_t i = 0;
 	int ret = 0, j, k;
+	int rxq_count;
 
 	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD %"PRIu64,
 			rte_get_tsc_hz());
@@ -672,12 +673,27 @@  show_port(void)
 		struct rte_eth_dev_info dev_info;
 		struct rte_eth_rxq_info queue_info;
 		struct rte_eth_rss_conf rss_conf;
+		struct rte_ether_addr ethaddr;
+		char name[RTE_ETH_NAME_MAX_LEN];
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
-		snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
+		rte_eth_dev_get_name_by_port(i, name);
+
+		snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)(%s)", i, name);
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
+		ret = rte_eth_macaddr_get(i, &ethaddr);
+		if (ret != 0) {
+			printf("macaddr get failed (port %u): %s\n",
+			       i, rte_strerror(-ret));
+		} else {
+			printf("\t  MAC: %02" PRIx8 ":%02" PRIx8 ":%02" PRIx8
+				":%02" PRIx8 ":%02" PRIx8 ":%02" PRIx8"\n",
+				ethaddr.addr_bytes[0], ethaddr.addr_bytes[1],
+				ethaddr.addr_bytes[2], ethaddr.addr_bytes[3],
+				ethaddr.addr_bytes[4], ethaddr.addr_bytes[5]);
+		}
 
 		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
 		ret = rte_eth_link_get(i, &link);
@@ -685,18 +701,21 @@  show_port(void)
 			printf("Link get failed (port %u): %s\n",
 			       i, rte_strerror(-ret));
 		} else {
-			printf("\t  -- link speed %d duplex %d,"
-					" auto neg %d status %d\n",
-					link.link_speed,
-					link.link_duplex,
-					link.link_autoneg,
-					link.link_status);
+			printf("\t  -- link speed: %d Mbps %s,"
+				":auto neg %d :status-%s\n",
+				link.link_speed,
+				(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
+				 ("full-duplex") : ("half-duplex"),
+				link.link_autoneg,
+				(link.link_status) ? ("up") : ("down"));
 		}
-		printf("\t  -- promiscuous (%d)\n",
-				rte_eth_promiscuous_get(i));
+		printf("\t  -- promiscuous: %s\n",
+			rte_eth_promiscuous_get(i) ? "enabled" : "disabled");
 		ret = rte_eth_dev_get_mtu(i, &mtu);
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
+		printf("\t  -- multicast mode: %s\n",
+			rte_eth_allmulticast_get(i) ? "enabled" : "disabled");
 
 		ret = rte_eth_dev_info_get(i, &dev_info);
 		if (ret != 0) {
@@ -704,7 +723,17 @@  show_port(void)
 				i, strerror(-ret));
 			return;
 		}
-
+		printf("\t  -- Driver name: %s\n", dev_info.driver_name);
+		if (dev_info.device->devargs && dev_info.device->devargs->args)
+			printf("\t  -- Devargs: %s\n",
+				dev_info.device->devargs->args);
+		printf("\t  -- min size of RX buf: %u\n",
+			dev_info.min_rx_bufsize);
+		printf("\t  -- max config length of RX pkt: %u\n",
+			dev_info.max_rx_pktlen);
+
+		printf("\t  -- num of RX queues: %u\n", dev_info.nb_rx_queues);
+		printf("\t  -- num of TX queues: %u\n", dev_info.nb_tx_queues);
 		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
@@ -718,7 +747,15 @@  show_port(void)
 						queue_info.nb_desc,
 						queue_info.conf.offloads,
 						queue_info.mp->socket_id);
+				printf("\t  -- mempool name: %s\n",
+						(queue_info.mp == NULL) ?
+						"NULL" : queue_info.mp->name);
+
 			}
+			rxq_count = rte_eth_rx_queue_count(i, j);
+			if (rxq_count >= 0)
+				printf("\t  -- used rx desc count: %d\n",
+						rxq_count);
 		}
 
 		ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
@@ -734,7 +771,7 @@  show_port(void)
 			}
 		}
 
-		printf("  - cyrpto context\n");
+		printf("  - crypto context\n");
 #ifdef RTE_LIBRTE_SECURITY
 		void *p_ctx = rte_eth_dev_get_sec_ctx(i);
 		printf("\t  -- security context - %p\n", p_ctx);
@@ -1176,8 +1213,10 @@  show_mempool(char *name)
 
 	if (name != NULL) {
 		struct rte_mempool *ptr = rte_mempool_lookup(name);
+		struct rte_mempool_ops *ops;
 		if (ptr != NULL) {
 			flags = ptr->flags;
+			ops = rte_mempool_get_ops(ptr->ops_index);
 			printf("  - Name: %s on socket %d\n"
 				"  - flags:\n"
 				"\t  -- No spread (%c)\n"
@@ -1207,6 +1246,8 @@  show_mempool(char *name)
 			printf("  - Count: avail (%u), in use (%u)\n",
 				rte_mempool_avail_count(ptr),
 				rte_mempool_in_use_count(ptr));
+			printf("  - ops_index %d ops_name %s\n",
+				ptr->ops_index, ops ? ops->name:"NA");
 
 			STATS_BDR_STR(50, "");
 			return;