Skip to contentSkip to conversation

proc-info enhancements

PATCH Superseded Stephen Hemminger 5 participants 73 messages May 6, 2020 – Oct 19, 2020

lore
Share & tools
lore
#0 lore raw

cover proc-info enhancements

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

Before:

EAL: Detected 4 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket_638764_15dfaa1a166a
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: PCI device ae9f:00:02.0 on NUMA socket 0
EAL: probe driver: 15b3:1014 net_mlx5
========== show - Port PMD 3490000000==========
===== Port (1)=====
- generic config

	  -- Socket 0
	  -- link speed 40000 duplex 1, auto neg 1 status 1
	  -- promiscuous (1)
	  -- mtu (1500)
  - queue
	  -- queue 0 rx scatter 0 descriptors 256 offloads 0x0 mempool socket 0

- cyrpto context
-- security context - (nil)
===== Port (2)=====
- generic config

	  -- Socket 0
	  -- link speed 10000 duplex 1, auto neg 1 status 1
	  -- promiscuous (1)
	  -- mtu (1500)
  - queue
	  -- queue 0 rx scatter 0 descriptors 512 offloads 0x0 mempool socket 0

- cyrpto context
-- security context - (nil)
================================================================================
======================================== ========================================

After:
========== show - Port PMD ==========
===== Port 1 =====
- generic config

	  -- driver net_netvsc device 4179c815-5d8a-4915-976e-9ea2378e382b socket 0
	  -- link speed 40Gbps (auto neg), duplex full, up
	  -- mac 00:15:5D:01:10:02
	  -- promiscuous (1)
	  -- mtu (1500)
  - rx queue
	  -- 0 descriptors 0/256 offloads 0 socket 0
  - tx queue
	  -- 0 descriptors 256/256 offloads 0
===== Port 2 =====
  - generic config
	  -- driver net_netvsc device d8e21696-8885-4567-baf6-1d1cefdf6231 socket 0
	  -- link speed 10Gbps (auto neg), duplex full, up
	  -- mac 00:15:5D:01:10:09
	  -- promiscuous (1)
	  -- mtu (1500)
  - rx queue
	  -- 0 descriptors 0/512 offloads 0 socket 0
  - tx queue
	  -- 0 descriptors 512/512 offloads 0

Stephen Hemminger (7):
app/proc-info: remove unused logtype #define app/proc-info: eliminate useless borders app/proc-info: hide EAL info messages app/proc-info: add more info to show_ports app/proc-info: hide crypto-context display app/proc-info: dump rx and tx descriptor info app/proc-info: provide way to request info on owned ports

 app/proc-info/Makefile |   3 +
 app/proc-info/main.c   | 283 ++++++++++++++++++++++++++++-------------
 2 files changed, 197 insertions(+), 89 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/7 app/proc-info: remove unused logtype #define

This logtype is defined but never used.

---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)
app/proc-info/main.c +0 -2
index abeca4aab438..69e3000616c0 100644
@@ -39,8 +39,6 @@
 
 /* Maximum long option length for option parsing. */
 #define MAX_LONG_OPT_SZ 64
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
-
 #define MAX_STRING_LEN 256
 
 #define STATS_BDR_FMT "========================================"
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/7 app/proc-info: eliminate useless borders

In reply to Stephen Hemminger

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)
app/proc-info/main.c +7 -28
index 69e3000616c0..049818bad51f 100644
@@ -660,8 +660,7 @@ show_port(void)
 	uint16_t i = 0;
 	int ret = 0, j, k;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -673,7 +672,7 @@ show_port(void)
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
-		snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
+		snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i);
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
@@ -754,8 +753,6 @@ show_port(void)
 		}
 #endif
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -841,8 +838,7 @@ show_tm(void)
 	unsigned int j, k;
 	uint16_t i = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -1038,8 +1034,6 @@ show_tm(void)
 				stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1085,8 +1079,7 @@ show_crypto(void)
 {
 	uint8_t crypto_dev_count = rte_cryptodev_count(), i;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	for (i = 0; i < crypto_dev_count; i++) {
@@ -1121,15 +1114,12 @@ show_crypto(void)
 				stats.dequeue_err_count);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
 show_ring(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " show - RING %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - RING ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1160,7 +1150,6 @@ show_ring(char *name)
 	}
 
 	rte_ring_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1168,8 +1157,7 @@ show_mempool(char *name)
 {
 	uint64_t flags = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1206,13 +1194,11 @@ show_mempool(char *name)
 				rte_mempool_avail_count(ptr),
 				rte_mempool_in_use_count(ptr));
 
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
 
 	rte_mempool_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1230,8 +1216,7 @@ mempool_itr_obj(struct rte_mempool *mp, void *opaque,
 static void
 iter_mempool(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1241,12 +1226,9 @@ iter_mempool(char *name)
 			uint32_t ret = rte_mempool_obj_iter(ptr,
 					mempool_itr_obj, NULL);
 			printf("\n  - iterated %u objects\n", ret);
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 int
@@ -1347,8 +1329,5 @@ main(int argc, char **argv)
 	if (ret)
 		printf("Error from rte_eal_cleanup(), %d\n", ret);
 
-	strlcpy(bdr_str, " ", MAX_STRING_LEN);
-	STATS_BDR_STR(50, bdr_str);
-
 	return 0;
 }
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/7 app/proc-info: hide EAL info messages

In reply to Stephen Hemminger

The DPDK EAL info messages at the start of a diagnostic application are not helpful to end user. Suppress them by setting log-level by default.

---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
app/proc-info/main.c +6 -4
index 049818bad51f..e4914191bef9 100644
@@ -1239,7 +1239,8 @@ main(int argc, char **argv)
 	char c_flag[] = "-c1";
 	char n_flag[] = "-n4";
 	char mp_flag[] = "--proc-type=secondary";
-	char *argp[argc + 3];
+	char log_flag[] = "--log-level=6";
+	char *argp[argc + 4];
 	uint16_t nb_ports;
 
 	/* preparse app arguments */
@@ -1253,18 +1254,19 @@ main(int argc, char **argv)
 	argp[1] = c_flag;
 	argp[2] = n_flag;
 	argp[3] = mp_flag;
+	argp[4] = log_flag;
 
 	for (i = 1; i < argc; i++)
-		argp[i + 3] = argv[i];
+		argp[i + 4] = argv[i];
 
-	argc += 3;
+	argc += 4;
 
 	ret = rte_eal_init(argc, argp);
 	if (ret < 0)
 		rte_panic("Cannot init EAL\n");
 
 	argc -= ret;
-	argv += (ret - 3);
+	argv += ret - 4;
 
 	if (!rte_eal_primary_proc_alive(NULL))
 		rte_exit(EXIT_FAILURE, "No primary DPDK process is running.\n");
Signature · 1 line
2.20.1
#4 lore raw

PATCH 4/7 app/proc-info: add more info to show_ports

In reply to Stephen Hemminger

Revise the display of port information to include more data and be more human friendly.

* Display units for port speed, and decode link fields.
* Show driver and device information
* Show MAC address
* Show flow control information
* Combine lines if possible

---
 app/proc-info/main.c | 78 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 63 insertions(+), 15 deletions(-)
app/proc-info/main.c +63 -15
index e4914191bef9..2f74cbf462d5 100644
@@ -669,6 +669,8 @@ 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_eth_fc_conf fc_conf;
+		struct rte_ether_addr mac;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -676,32 +678,78 @@ show_port(void)
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
-		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret != 0) {
+			printf("Error during getting device info: %s\n",
+				strerror(-ret));
+			return;
+		}
+
+		printf("\t  -- driver %s device %s socket %d\n",
+		       dev_info.driver_name, dev_info.device->name,
+		       rte_eth_dev_socket_id(i));
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			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);
+			uint32_t speed = link.link_speed;
+			char suffix = 'M';
+			const char *duplex, *autoneg, *status;
+
+			if (speed > 1000) {
+				suffix = 'G';
+				speed /= 1000;
+			}
+
+			if (link.link_duplex == ETH_LINK_FULL_DUPLEX)
+				duplex = "full";
+			else
+				duplex = "half";
+
+			if (link.link_autoneg == ETH_LINK_AUTONEG)
+				autoneg = "auto neg";
+			else
+				autoneg = "fixed";
+
+			if (link.link_status == ETH_LINK_UP)
+				status = "up";
+			else
+				status = "down";
+
+			printf("\t  -- link speed %u%cbps (%s), duplex %s, %s\n",
+			       speed, suffix, autoneg, duplex, status);
+		}
+
+		ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf);
+		if (ret == 0 && fc_conf.mode != RTE_FC_NONE)  {
+			printf("\t  -- flow control mode %s%s high %u low %u pause %u%s%s\n",
+			       fc_conf.mode == RTE_FC_RX_PAUSE ? "rx ":
+			       fc_conf.mode == RTE_FC_TX_PAUSE ? "tx ":
+			       fc_conf.mode == RTE_FC_FULL ? "full" : "???",
+			       fc_conf.autoneg ? " auto" : "",
+			       fc_conf.high_water,
+			       fc_conf.low_water,
+			       fc_conf.pause_time,
+			       fc_conf.send_xon ? " xon" : "",
+			       fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : "");
+		}
+
+		ret = rte_eth_macaddr_get(i, &mac);
+		if (ret == 0) {
+			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
+			printf("\t  -- mac %s\n", ebuf);
 		}
+
 		printf("\t  -- promiscuous (%d)\n",
-				rte_eth_promiscuous_get(i));
+		       rte_eth_promiscuous_get(i));
+
 		ret = rte_eth_dev_get_mtu(i, &mtu);
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		ret = rte_eth_dev_info_get(i, &dev_info);
-		if (ret != 0) {
-			printf("Error during getting device (port %u) info: %s\n",
-				i, strerror(-ret));
-			return;
-		}
-
 		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
Signature · 1 line
2.20.1
#5 lore raw

PATCH 5/7 app/proc-info: hide crypto-context display

In reply to Stephen Hemminger

If crypto context is not present, no point in displaying it. Also fix spelling error.

---
 app/proc-info/main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
app/proc-info/main.c +2 -3
index 2f74cbf462d5..bb0e0cbe9e6e 100644
@@ -779,12 +779,11 @@ show_port(void)
 			}
 		}
 
-		printf("  - cyrpto context\n");
 #ifdef RTE_LIBRTE_SECURITY
 		void *p_ctx = rte_eth_dev_get_sec_ctx(i);
-		printf("\t  -- security context - %p\n", p_ctx);
-
 		if (p_ctx) {
+			printf("  - crypto context\n");
+			printf("\t  -- security context - %p\n", p_ctx);
 			printf("\t  -- size %u\n",
 					rte_security_session_get_size(p_ctx));
 			const struct rte_security_capability *s_cap =
Signature · 1 line
2.20.1
#6 lore raw

PATCH 6/7 app/proc-info: dump rx and tx descriptor info

In reply to Stephen Hemminger

Many drivers will report per queue info for both rx and tx as well as how many descriptors are in use.

---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)
app/proc-info/main.c +66 -13
index bb0e0cbe9e6e..0b7ab1e78a9d 100644
@@ -654,6 +654,25 @@ metrics_display(int port_id)
 	rte_free(names);
 }
 
+/* This could be replaced by an ethdev hook in future */
+static int
+eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
+{
+	uint16_t offset;
+	int count = 0;
+
+	for (offset = 0; offset < n; offset++) {
+		int status;
+
+		status = rte_eth_tx_descriptor_status(port_id, queue_id, offset);
+		if (status < 0)
+			return status;
+		if (status == RTE_ETH_TX_DESC_DONE)
+			++count;
+	}
+	return count;
+}
+
 static void
 show_port(void)
 {
@@ -667,7 +686,6 @@ show_port(void)
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
-		struct rte_eth_rxq_info queue_info;
 		struct rte_eth_rss_conf rss_conf;
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
@@ -739,6 +757,7 @@ show_port(void)
 		ret = rte_eth_macaddr_get(i, &mac);
 		if (ret == 0) {
 			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+
 			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
 			printf("\t  -- mac %s\n", ebuf);
 		}
@@ -750,20 +769,54 @@ show_port(void)
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
+			struct rte_eth_rxq_info queue_info;
+			int count;
+
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
-			if (ret == 0) {
-				printf("\t  -- queue %d rx scatter %d"
-						" descriptors %d"
-						" offloads 0x%"PRIx64
-						" mempool socket %d\n",
-						j,
-						queue_info.scattered_rx,
-						queue_info.nb_desc,
-						queue_info.conf.offloads,
-						queue_info.mp->socket_id);
-			}
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - rx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+			count = rte_eth_rx_queue_count(i, j);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.scattered_rx)
+				printf(" scattered_rx");
+
+			printf(" offloads %#"PRIx64" socket %d\n",
+			       queue_info.conf.offloads,
+			       queue_info.mp->socket_id);
+		}
+
+		for (j = 0; j < dev_info.nb_tx_queues; j++) {
+			struct rte_eth_txq_info queue_info;
+			int count;
+
+			ret = rte_eth_tx_queue_info_get(i, j, &queue_info);
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - tx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+
+			count = eth_tx_queue_available(i, j, queue_info.nb_desc);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.conf.tx_deferred_start)
+				printf(" deferred_start");
+
+			printf(" offloads %#"PRIx64"\n",
+			       queue_info.conf.offloads);
 		}
 
 		ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
Signature · 1 line
2.20.1
#7 lore raw

PATCH 7/7 app/proc-info: provide way to request info on owned ports

In reply to Stephen Hemminger

There are cases where a port maybe owned by another (failsafe, netvsc, bond); but currently proc-info has no way to look at stats of those ports. This patch provides way for the user to explictly ask for these ports.

If no portmask is given the output is unchanged; it only shows the top level ports. If portmask requests a specific port it will be shown even if owned.

The device owner is also a useful thing to show in port info.

---
 app/proc-info/Makefile |  3 ++
 app/proc-info/main.c   | 74 ++++++++++++++++++++++++++++--------------
 2 files changed, 53 insertions(+), 24 deletions(-)
app/proc-info/Makefile +3 -0
index 214f3f54a1e9..f777e037861f 100644
@@ -5,7 +5,10 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 APP = dpdk-procinfo
 
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -Wno-deprecated-declarations
 
 # all source are stored in SRCS-y
 
app/proc-info/main.c +50 -24

117 lines not on this page · raw message

Signature · 1 line
2.20.1
#8 lore raw

v2 cover app/proc-info enhancements

In reply to Stephen Hemminger

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

v2 - fix checkpatch complaints

Stephen Hemminger (7):
app/proc-info: remove unused logtype #define app/proc-info: eliminate useless borders app/proc-info: hide EAL info messages app/proc-info: add more info to show_ports app/proc-info: hide crypto-context display app/proc-info: dump rx and tx descriptor info app/proc-info: provide way to request info on owned ports

 app/proc-info/Makefile |   3 +
 app/proc-info/main.c   | 283 ++++++++++++++++++++++++++++-------------
 2 files changed, 197 insertions(+), 89 deletions(-)
Signature · 1 line
2.20.1
#9 lore raw

PATCH v2 1/7 app/proc-info: remove unused logtype #define

This logtype is defined but never used.

---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)
app/proc-info/main.c +0 -2
index abeca4aab438..69e3000616c0 100644
@@ -39,8 +39,6 @@
 
 /* Maximum long option length for option parsing. */
 #define MAX_LONG_OPT_SZ 64
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
-
 #define MAX_STRING_LEN 256
 
 #define STATS_BDR_FMT "========================================"
Signature · 1 line
2.20.1
#10 lore raw

PATCH v2 2/7 app/proc-info: eliminate useless borders

In reply to Stephen Hemminger

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)
app/proc-info/main.c +7 -28
index 69e3000616c0..049818bad51f 100644
@@ -660,8 +660,7 @@ show_port(void)
 	uint16_t i = 0;
 	int ret = 0, j, k;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -673,7 +672,7 @@ show_port(void)
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
-		snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
+		snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i);
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
@@ -754,8 +753,6 @@ show_port(void)
 		}
 #endif
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -841,8 +838,7 @@ show_tm(void)
 	unsigned int j, k;
 	uint16_t i = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -1038,8 +1034,6 @@ show_tm(void)
 				stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1085,8 +1079,7 @@ show_crypto(void)
 {
 	uint8_t crypto_dev_count = rte_cryptodev_count(), i;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	for (i = 0; i < crypto_dev_count; i++) {
@@ -1121,15 +1114,12 @@ show_crypto(void)
 				stats.dequeue_err_count);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
 show_ring(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " show - RING %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - RING ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1160,7 +1150,6 @@ show_ring(char *name)
 	}
 
 	rte_ring_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1168,8 +1157,7 @@ show_mempool(char *name)
 {
 	uint64_t flags = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1206,13 +1194,11 @@ show_mempool(char *name)
 				rte_mempool_avail_count(ptr),
 				rte_mempool_in_use_count(ptr));
 
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
 
 	rte_mempool_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1230,8 +1216,7 @@ mempool_itr_obj(struct rte_mempool *mp, void *opaque,
 static void
 iter_mempool(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1241,12 +1226,9 @@ iter_mempool(char *name)
 			uint32_t ret = rte_mempool_obj_iter(ptr,
 					mempool_itr_obj, NULL);
 			printf("\n  - iterated %u objects\n", ret);
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 int
@@ -1347,8 +1329,5 @@ main(int argc, char **argv)
 	if (ret)
 		printf("Error from rte_eal_cleanup(), %d\n", ret);
 
-	strlcpy(bdr_str, " ", MAX_STRING_LEN);
-	STATS_BDR_STR(50, bdr_str);
-
 	return 0;
 }
Signature · 1 line
2.20.1
#11 lore raw

PATCH v2 3/7 app/proc-info: hide EAL info messages

In reply to Stephen Hemminger

The DPDK EAL info messages at the start of a diagnostic application are not helpful to end user. Suppress them by setting log-level by default.

---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
app/proc-info/main.c +6 -4
index 049818bad51f..e4914191bef9 100644
@@ -1239,7 +1239,8 @@ main(int argc, char **argv)
 	char c_flag[] = "-c1";
 	char n_flag[] = "-n4";
 	char mp_flag[] = "--proc-type=secondary";
-	char *argp[argc + 3];
+	char log_flag[] = "--log-level=6";
+	char *argp[argc + 4];
 	uint16_t nb_ports;
 
 	/* preparse app arguments */
@@ -1253,18 +1254,19 @@ main(int argc, char **argv)
 	argp[1] = c_flag;
 	argp[2] = n_flag;
 	argp[3] = mp_flag;
+	argp[4] = log_flag;
 
 	for (i = 1; i < argc; i++)
-		argp[i + 3] = argv[i];
+		argp[i + 4] = argv[i];
 
-	argc += 3;
+	argc += 4;
 
 	ret = rte_eal_init(argc, argp);
 	if (ret < 0)
 		rte_panic("Cannot init EAL\n");
 
 	argc -= ret;
-	argv += (ret - 3);
+	argv += ret - 4;
 
 	if (!rte_eal_primary_proc_alive(NULL))
 		rte_exit(EXIT_FAILURE, "No primary DPDK process is running.\n");
Signature · 1 line
2.20.1
#12 lore raw

PATCH v2 4/7 app/proc-info: add more info to show_ports

In reply to Stephen Hemminger

Revise the display of port information to include more data and be more human friendly.

* Display units for port speed, and decode link fields.
* Show driver and device information
* Show MAC address
* Show flow control information
* Combine lines if possible

---
 app/proc-info/main.c | 78 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 63 insertions(+), 15 deletions(-)
app/proc-info/main.c +63 -15
index e4914191bef9..c4f1f99e7d5d 100644
@@ -669,6 +669,8 @@ 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_eth_fc_conf fc_conf;
+		struct rte_ether_addr mac;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -676,32 +678,78 @@ show_port(void)
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
-		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret != 0) {
+			printf("Error during getting device info: %s\n",
+				strerror(-ret));
+			return;
+		}
+
+		printf("\t  -- driver %s device %s socket %d\n",
+		       dev_info.driver_name, dev_info.device->name,
+		       rte_eth_dev_socket_id(i));
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			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);
+			uint32_t speed = link.link_speed;
+			char suffix = 'M';
+			const char *duplex, *autoneg, *status;
+
+			if (speed > 1000) {
+				suffix = 'G';
+				speed /= 1000;
+			}
+
+			if (link.link_duplex == ETH_LINK_FULL_DUPLEX)
+				duplex = "full";
+			else
+				duplex = "half";
+
+			if (link.link_autoneg == ETH_LINK_AUTONEG)
+				autoneg = "auto neg";
+			else
+				autoneg = "fixed";
+
+			if (link.link_status == ETH_LINK_UP)
+				status = "up";
+			else
+				status = "down";
+
+			printf("\t  -- link speed %u%cbps (%s), duplex %s, %s\n",
+			       speed, suffix, autoneg, duplex, status);
+		}
+
+		ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf);
+		if (ret == 0 && fc_conf.mode != RTE_FC_NONE)  {
+			printf("\t  -- flow control mode %s%s high %u low %u pause %u%s%s\n",
+			       fc_conf.mode == RTE_FC_RX_PAUSE ? "rx " :
+			       fc_conf.mode == RTE_FC_TX_PAUSE ? "tx " :
+			       fc_conf.mode == RTE_FC_FULL ? "full" : "???",
+			       fc_conf.autoneg ? " auto" : "",
+			       fc_conf.high_water,
+			       fc_conf.low_water,
+			       fc_conf.pause_time,
+			       fc_conf.send_xon ? " xon" : "",
+			       fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : "");
+		}
+
+		ret = rte_eth_macaddr_get(i, &mac);
+		if (ret == 0) {
+			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
+			printf("\t  -- mac %s\n", ebuf);
 		}
+
 		printf("\t  -- promiscuous (%d)\n",
-				rte_eth_promiscuous_get(i));
+		       rte_eth_promiscuous_get(i));
+
 		ret = rte_eth_dev_get_mtu(i, &mtu);
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		ret = rte_eth_dev_info_get(i, &dev_info);
-		if (ret != 0) {
-			printf("Error during getting device (port %u) info: %s\n",
-				i, strerror(-ret));
-			return;
-		}
-
 		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
Signature · 1 line
2.20.1
Acked-by on v2 4/7
#13 lore raw

Re: [dpdk-dev] [PATCH v2 4/7] app/proc-info: add more info to show_ports

Hi

-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Thursday, May 7, 2020 1:28 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Maryam Tahhan <[email protected]>; Reshma Pattan <[email protected]>
Subject: [dpdk-dev] [PATCH v2 4/7] app/proc-info: add more info to show_ports

Revise the display of port information to include more data and be more human friendly.

* Display units for port speed, and decode link fields.
* Show driver and device information
* Show MAC address
* Show flow control information
* Combine lines if possible

---
 app/proc-info/main.c | 78 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 63 insertions(+), 15 deletions(-)
app/proc-info/main.c +63 -8
@@ -669,6 +669,8 @@ 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_eth_fc_conf fc_conf;
+		struct rte_ether_addr mac;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -676,32 +678,78 @@ show_port(void)
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
-		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret != 0) {
+			printf("Error during getting device info: %s\n",
+				strerror(-ret));
+			return;
+		}
+
+		printf("\t  -- driver %s device %s socket %d\n",
+		       dev_info.driver_name, dev_info.device->name,
+		       rte_eth_dev_socket_id(i));
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			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);
+			uint32_t speed = link.link_speed;
+			char suffix = 'M';
+			const char *duplex, *autoneg, *status;
+
+			if (speed > 1000) {
+				suffix = 'G';
+				speed /= 1000;
+			}
+
+			if (link.link_duplex == ETH_LINK_FULL_DUPLEX)
+				duplex = "full";
+			else
+				duplex = "half";
+
+			if (link.link_autoneg == ETH_LINK_AUTONEG)
+				autoneg = "auto neg";
+			else
+				autoneg = "fixed";
+
+			if (link.link_status == ETH_LINK_UP)
+				status = "up";
+			else
+				status = "down";
+
+			printf("\t  -- link speed %u%cbps (%s), duplex %s, %s\n",
+			       speed, suffix, autoneg, duplex, status);
+		}
+
+		ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf);
+		if (ret == 0 && fc_conf.mode != RTE_FC_NONE)  {
+			printf("\t  -- flow control mode %s%s high %u low %u pause %u%s%s\n",
+			       fc_conf.mode == RTE_FC_RX_PAUSE ? "rx " :
+			       fc_conf.mode == RTE_FC_TX_PAUSE ? "tx " :
+			       fc_conf.mode == RTE_FC_FULL ? "full" : "???",
+			       fc_conf.autoneg ? " auto" : "",
+			       fc_conf.high_water,
+			       fc_conf.low_water,
+			       fc_conf.pause_time,
+			       fc_conf.send_xon ? " xon" : "",
+			       fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : "");
+		}
+
+		ret = rte_eth_macaddr_get(i, &mac);
+		if (ret == 0) {
+			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
+			printf("\t  -- mac %s\n", ebuf);
 		}
+
 		printf("\t  -- promiscuous (%d)\n",
-				rte_eth_promiscuous_get(i));
+		       rte_eth_promiscuous_get(i));
+
 		ret = rte_eth_dev_get_mtu(i, &mtu);
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 

[Hemant] will you please also add
printf("\t -- multicast mode: %s\n", rte_eth_allmulticast_get(i) ? "enabled" : "disabled");

with that you can add

- ret = rte_eth_dev_info_get(i, &dev_info);
- if (ret != 0) {
- printf("Error during getting device (port %u) info: %s\n",
- i, strerror(-ret));
- return;
- }
-
printf(" - queue\n");
for (j = 0; j < dev_info.nb_rx_queues; j++) {
ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
--
2.20.1

#14 lore raw

PATCH v2 5/7 app/proc-info: hide crypto-context display

In reply to Stephen Hemminger

If crypto context is not present, no point in displaying it. Also fix spelling error.

---
 app/proc-info/main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
app/proc-info/main.c +2 -3
index c4f1f99e7d5d..804c0fd63b3e 100644
@@ -779,12 +779,11 @@ show_port(void)
 			}
 		}
 
-		printf("  - cyrpto context\n");
 #ifdef RTE_LIBRTE_SECURITY
 		void *p_ctx = rte_eth_dev_get_sec_ctx(i);
-		printf("\t  -- security context - %p\n", p_ctx);
-
 		if (p_ctx) {
+			printf("  - crypto context\n");
+			printf("\t  -- security context - %p\n", p_ctx);
 			printf("\t  -- size %u\n",
 					rte_security_session_get_size(p_ctx));
 			const struct rte_security_capability *s_cap =
Signature · 1 line
2.20.1
#15 lore raw

PATCH v2 6/7 app/proc-info: dump rx and tx descriptor info

In reply to Stephen Hemminger

Many drivers will report per queue info for both rx and tx as well as how many descriptors are in use.

---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)
app/proc-info/main.c +66 -13
index 804c0fd63b3e..00e06c986e27 100644
@@ -654,6 +654,25 @@ metrics_display(int port_id)
 	rte_free(names);
 }
 
+/* This could be replaced by an ethdev hook in future */
+static int
+eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
+{
+	uint16_t offset;
+	int count = 0;
+
+	for (offset = 0; offset < n; offset++) {
+		int status;
+
+		status = rte_eth_tx_descriptor_status(port_id, queue_id, offset);
+		if (status < 0)
+			return status;
+		if (status == RTE_ETH_TX_DESC_DONE)
+			++count;
+	}
+	return count;
+}
+
 static void
 show_port(void)
 {
@@ -667,7 +686,6 @@ show_port(void)
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
-		struct rte_eth_rxq_info queue_info;
 		struct rte_eth_rss_conf rss_conf;
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
@@ -739,6 +757,7 @@ show_port(void)
 		ret = rte_eth_macaddr_get(i, &mac);
 		if (ret == 0) {
 			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+
 			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
 			printf("\t  -- mac %s\n", ebuf);
 		}
@@ -750,20 +769,54 @@ show_port(void)
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
+			struct rte_eth_rxq_info queue_info;
+			int count;
+
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
-			if (ret == 0) {
-				printf("\t  -- queue %d rx scatter %d"
-						" descriptors %d"
-						" offloads 0x%"PRIx64
-						" mempool socket %d\n",
-						j,
-						queue_info.scattered_rx,
-						queue_info.nb_desc,
-						queue_info.conf.offloads,
-						queue_info.mp->socket_id);
-			}
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - rx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+			count = rte_eth_rx_queue_count(i, j);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.scattered_rx)
+				printf(" scattered_rx");
+
+			printf(" offloads %#"PRIx64" socket %d\n",
+			       queue_info.conf.offloads,
+			       queue_info.mp->socket_id);
+		}
+
+		for (j = 0; j < dev_info.nb_tx_queues; j++) {
+			struct rte_eth_txq_info queue_info;
+			int count;
+
+			ret = rte_eth_tx_queue_info_get(i, j, &queue_info);
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - tx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+
+			count = eth_tx_queue_available(i, j, queue_info.nb_desc);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.conf.tx_deferred_start)
+				printf(" deferred_start");
+
+			printf(" offloads %#"PRIx64"\n",
+			       queue_info.conf.offloads);
 		}
 
 		ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
Signature · 1 line
2.20.1
#16 lore raw

Re: [dpdk-dev] [PATCH v2 6/7] app/proc-info: dump rx and tx descriptor info

-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Thursday, May 7, 2020 1:28 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Maryam Tahhan <[email protected]>; Reshma Pattan <[email protected]>
Subject: [dpdk-dev] [PATCH v2 6/7] app/proc-info: dump rx and tx descriptor info

Many drivers will report per queue info for both rx and tx as well as how many descriptors are in use.

---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)
app/proc-info/main.c +40 -13
@@ -654,6 +654,25 @@ metrics_display(int port_id)
 	rte_free(names);
 }
 
+/* This could be replaced by an ethdev hook in future */ static int 
+eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n) 
+{
+	uint16_t offset;
+	int count = 0;
+
+	for (offset = 0; offset < n; offset++) {
+		int status;
+
+		status = rte_eth_tx_descriptor_status(port_id, queue_id, offset);
+		if (status < 0)
+			return status;
+		if (status == RTE_ETH_TX_DESC_DONE)
+			++count;
+	}
+	return count;
+}
+
 static void
 show_port(void)
 {
@@ -667,7 +686,6 @@ show_port(void)
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
-		struct rte_eth_rxq_info queue_info;
 		struct rte_eth_rss_conf rss_conf;
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
@@ -739,6 +757,7 @@ show_port(void)
 		ret = rte_eth_macaddr_get(i, &mac);
 		if (ret == 0) {
 			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+
 			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
 			printf("\t  -- mac %s\n", ebuf);
 		}
@@ -750,20 +769,54 @@ show_port(void)
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
+			struct rte_eth_rxq_info queue_info;
+			int count;
+
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
-			if (ret == 0) {
-				printf("\t  -- queue %d rx scatter %d"
-						" descriptors %d"
-						" offloads 0x%"PRIx64
-						" mempool socket %d\n",
-						j,
-						queue_info.scattered_rx,
-						queue_info.nb_desc,
-						queue_info.conf.offloads,
-						queue_info.mp->socket_id);
-			}
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - rx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+			count = rte_eth_rx_queue_count(i, j);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.scattered_rx)
+				printf(" scattered_rx");
+
+			printf(" offloads %#"PRIx64" socket %d\n",
+			       queue_info.conf.offloads,
+			       queue_info.mp->socket_id);

[Hemant] will you please also add printf("\t -- mempool name: %s\n", (queue_info.mp == NULL) ? "NULL" : queue_info.mp->name);

+ }
+
+ for (j = 0; j < dev_info.nb_tx_queues; j++) {
+ struct rte_eth_txq_info queue_info;
+ int count;
+
+ ret = rte_eth_tx_queue_info_get(i, j, &queue_info);
+ if (ret != 0)
+ break;
+
+ if (j == 0)
+ printf(" - tx queue\n");
+
+ printf("\t -- %d descriptors ", j);
+
+ count = eth_tx_queue_available(i, j, queue_info.nb_desc);
+ if (count >= 0)
+ printf("%d/", count);
+ printf("%d", queue_info.nb_desc);
+
+ if (queue_info.conf.tx_deferred_start)
+ printf(" deferred_start");
+
+ printf(" offloads %#"PRIx64"\n",
+ queue_info.conf.offloads);
}

ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
--
2.20.1

#17 lore raw

PATCH v2 7/7 app/proc-info: provide way to request info on owned ports

In reply to Stephen Hemminger

There are cases where a port maybe owned by another (failsafe, netvsc, bond); but currently proc-info has no way to look at stats of those ports. This patch provides way for the user to explicitly ask for these ports.

If no portmask is given the output is unchanged; it only shows the top level ports. If portmask requests a specific port it will be shown even if owned.

The device owner is also a useful thing to show in port info.

---
 app/proc-info/Makefile |  3 ++
 app/proc-info/main.c   | 74 ++++++++++++++++++++++++++++--------------
 2 files changed, 53 insertions(+), 24 deletions(-)
app/proc-info/Makefile +3 -0
index 214f3f54a1e9..f777e037861f 100644
@@ -5,7 +5,10 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 APP = dpdk-procinfo
 
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -Wno-deprecated-declarations
 
 # all source are stored in SRCS-y
 
app/proc-info/main.c +50 -24

117 lines not on this page · raw message

Signature · 1 line
2.20.1
Acked-by on the v2 series
#18 lore raw

Re: [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements

In reply to Stephen Hemminger

Series-

-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Thursday, May 7, 2020 1:28 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>
Subject: [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

v2 - fix checkpatch complaints

Stephen Hemminger (7):
app/proc-info: remove unused logtype #define app/proc-info: eliminate useless borders app/proc-info: hide EAL info messages app/proc-info: add more info to show_ports app/proc-info: hide crypto-context display app/proc-info: dump rx and tx descriptor info app/proc-info: provide way to request info on owned ports

 app/proc-info/Makefile |   3 +
 app/proc-info/main.c   | 283 ++++++++++++++++++++++++++++-------------
 2 files changed, 197 insertions(+), 89 deletions(-)

--
2.20.1

#19 lore raw

v3 cover app/proc-info enhancments

In reply to Stephen Hemminger

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

v3 - consolidate chages for displaying crypto info v2 - fix checkpatch complaints

Hemant Agrawal (1):
app/proc-info: add crypto security context info

Stephen Hemminger (6):
app/proc-info: remove unused logtype #define app/proc-info: eliminate useless borders app/proc-info: hide EAL info messages app/proc-info: add more info to show_ports app/proc-info: dump rx and tx descriptor info app/proc-info: provide way to request info on owned ports

 app/proc-info/Makefile |   3 +
 app/proc-info/main.c   | 368 +++++++++++++++++++++++++++--------------
 2 files changed, 250 insertions(+), 121 deletions(-)
Signature · 1 line
2.27.0
#20 lore raw

PATCH v3 1/7 app/proc-info: remove unused logtype #define

This logtype is defined but never used.

---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)
app/proc-info/main.c +0 -2
index abeca4aab438..69e3000616c0 100644
@@ -39,8 +39,6 @@
 
 /* Maximum long option length for option parsing. */
 #define MAX_LONG_OPT_SZ 64
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
-
 #define MAX_STRING_LEN 256
 
 #define STATS_BDR_FMT "========================================"
Signature · 1 line
2.27.0
#21 lore raw

PATCH v3 2/7 app/proc-info: eliminate useless borders

In reply to Stephen Hemminger

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)
app/proc-info/main.c +7 -28
index 69e3000616c0..049818bad51f 100644
@@ -660,8 +660,7 @@ show_port(void)
 	uint16_t i = 0;
 	int ret = 0, j, k;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -673,7 +672,7 @@ show_port(void)
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
-		snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
+		snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i);
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
@@ -754,8 +753,6 @@ show_port(void)
 		}
 #endif
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -841,8 +838,7 @@ show_tm(void)
 	unsigned int j, k;
 	uint16_t i = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -1038,8 +1034,6 @@ show_tm(void)
 				stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1085,8 +1079,7 @@ show_crypto(void)
 {
 	uint8_t crypto_dev_count = rte_cryptodev_count(), i;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	for (i = 0; i < crypto_dev_count; i++) {
@@ -1121,15 +1114,12 @@ show_crypto(void)
 				stats.dequeue_err_count);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
 show_ring(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " show - RING %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - RING ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1160,7 +1150,6 @@ show_ring(char *name)
 	}
 
 	rte_ring_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1168,8 +1157,7 @@ show_mempool(char *name)
 {
 	uint64_t flags = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1206,13 +1194,11 @@ show_mempool(char *name)
 				rte_mempool_avail_count(ptr),
 				rte_mempool_in_use_count(ptr));
 
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
 
 	rte_mempool_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1230,8 +1216,7 @@ mempool_itr_obj(struct rte_mempool *mp, void *opaque,
 static void
 iter_mempool(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1241,12 +1226,9 @@ iter_mempool(char *name)
 			uint32_t ret = rte_mempool_obj_iter(ptr,
 					mempool_itr_obj, NULL);
 			printf("\n  - iterated %u objects\n", ret);
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 int
@@ -1347,8 +1329,5 @@ main(int argc, char **argv)
 	if (ret)
 		printf("Error from rte_eal_cleanup(), %d\n", ret);
 
-	strlcpy(bdr_str, " ", MAX_STRING_LEN);
-	STATS_BDR_STR(50, bdr_str);
-
 	return 0;
 }
Signature · 1 line
2.27.0
#22 lore raw

Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders

15/07/2020 23:22, Stephen Hemminger:

Quoted 2 lines

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

The CPU frequency on headers!
OK to remove :)

#23 lore raw

Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders

Hi Stephen,

snipped

Quoted 8 lines

15/07/2020 23:22, Stephen Hemminger:

Quoted 2 lines

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

The CPU frequency on headers!
OK to remove :)

The rational of having Time Stamp Counter as the header for port info and stats, is to account for each iteration for an average packets per second. That is using watch -d -n 1 ./dpdk-procinfo -- --xstats | grep -v ": 0".

But if there better way to do this or add as new feature, +1 to remove.

#24 lore raw

Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders

Quoted 8 lines · Vipin

Hi Stephen,

snipped

Quoted 5 lines

15/07/2020 23:22, Stephen Hemminger:

Quoted 2 lines

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

Quoted 7 lines
Quoted 3 lines

The CPU frequency on headers!
OK to remove :)

The rational of having Time Stamp Counter as the header for port info and stats, is to account for each iteration for an average packets per second. That is using watch -d -n 1 ./dpdk-procinfo -- --xstats | grep -v ": 0".

But if there better way to do this or add as new feature, +1 to remove.

Proc info should just use standard clock for its updates, not TSC?

#25 lore raw

Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders

snipped

Quoted 11 lines
Quoted 11 lines

snipped

Quoted 8 lines

15/07/2020 23:22, Stephen Hemminger:

Quoted 2 lines

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

The CPU frequency on headers!
OK to remove :)

Quoted 7 lines
Quoted 1 line

The rational of having Time Stamp Counter as the header for port info and

stats, is to account for each iteration for an average packets per second. That is using watch -d -n 1 ./dpdk-procinfo -- --xstats | grep -v ": 0".

Quoted 2 lines

But if there better way to do this or add as new feature, +1 to remove.

Proc info should just use standard clock for its updates, not TSC?

Can you please explain the rationale behind the (syscall for time) and not TSC?

#26 lore raw

Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders

snipped

Quoted 15 lines

snipped

Quoted 13 lines
Quoted 13 lines

snipped

Quoted 8 lines

15/07/2020 23:22, Stephen Hemminger:

Quoted 2 lines

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

The CPU frequency on headers!
OK to remove :)

The rational of having Time Stamp Counter as the header for port info and

Quoted 8 lines
Quoted 6 lines

stats, is to account for each iteration for an average packets per second. That is using watch -d -n 1 ./dpdk-procinfo -- --xstats | grep -v ": 0".

Quoted 2 lines

But if there better way to do this or add as new feature, +1 to remove.

Proc info should just use standard clock for its updates, not TSC?

Can you please explain the rationale behind the (syscall for time) and not TSC?

Looking forward for the patch with clock change too.

#27 lore raw

Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders

Quoted 19 lines · Vipin

snipped

Quoted 18 lines

snipped

Quoted 16 lines
Quoted 7 lines

snipped

Quoted 5 lines

15/07/2020 23:22, Stephen Hemminger:

Quoted 2 lines

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

Quoted 6 lines
Quoted 3 lines

The CPU frequency on headers!
OK to remove :)

The rational of having Time Stamp Counter as the header for port info and

stats, is to account for each iteration for an average packets per second. That is using watch -d -n 1 ./dpdk-procinfo -- --xstats | grep -v ": 0".

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

But if there better way to do this or add as new feature, +1 to remove.

Proc info should just use standard clock for its updates, not TSC?

Can you please explain the rationale behind the (syscall for time) and not TSC?

Looking forward for the patch with clock change too.

There is no part of what proc-info is show with xstats that displays or uses tsc directly. Do you have a driver that is putting TSC information in xstats?

#28 lore raw

Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders

Hi Stephen,

Quoted 26 lines
Quoted 10 lines

snipped

Quoted 8 lines

snipped

Quoted 6 lines
Quoted 6 lines

snipped

Quoted 4 lines

15/07/2020 23:22, Stephen Hemminger:

Quoted 2 lines

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense

here.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

The CPU frequency on headers!
OK to remove :)

The rational of having Time Stamp Counter as the header for port info and

stats, is to account for each iteration for an average packets per second. That is using `watch -d -n 1 ./dpdk-procinfo -- --xstats | grep -

v ": 0"`.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

But if there better way to do this or add as new feature, +1 to remove.

Proc info should just use standard clock for its updates, not TSC?

Quoted 8 lines
Quoted 1 line
Quoted 1 line

Can you please explain the rationale behind the (syscall for time) and not

TSC?

Quoted 2 lines

Looking forward for the patch with clock change too.

There is no part of what proc-info is show with xstats that displays or uses tsc directly.
Do you have a driver that is putting TSC information in xstats?

I am sorry I did not follow you on this, In the earlier implementation with proc-info header we had TSC so coupling --show --xstats. But with the header removed out with TSC, how can we get this?

#29 lore raw

Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders

Quoted 31 lines · Vipin

Hi Stephen,

Quoted 29 lines
Quoted 10 lines

snipped

Quoted 8 lines

snipped

Quoted 6 lines
Quoted 6 lines

snipped

Quoted 4 lines

15/07/2020 23:22, Stephen Hemminger:

Quoted 2 lines

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense

here.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

The CPU frequency on headers!
OK to remove :)

The rational of having Time Stamp Counter as the header for port info and

stats, is to account for each iteration for an average packets per second. That is using `watch -d -n 1 ./dpdk-procinfo -- --xstats | grep -

v ": 0"`.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

But if there better way to do this or add as new feature, +1 to remove.

Proc info should just use standard clock for its updates, not TSC?

Can you please explain the rationale behind the (syscall for time) and not

TSC?

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Looking forward for the patch with clock change too.

There is no part of what proc-info is show with xstats that displays or uses tsc directly.
Do you have a driver that is putting TSC information in xstats?

I am sorry I did not follow you on this, In the earlier implementation with proc-info header we had TSC so coupling --show --xstats. But with the header removed out with TSC, how can we get this?

I am asking why is the TSC hz a useful piece of information here? Sure, proc-info could print lots of things but unless it serves a useful purpose for examining the interfaces, it is just noise.

Developers love to clutter output, but it just raises the signal to noise ratio.

#30 lore raw

Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders

Quoted 43 lines
Quoted 28 lines

Hi Stephen,

Quoted 25 lines
Quoted 11 lines

snipped

Quoted 9 lines

snipped

Quoted 7 lines
Quoted 7 lines

snipped

Quoted 5 lines

15/07/2020 23:22, Stephen Hemminger:

Quoted 3 lines

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense

here.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

The CPU frequency on headers!
OK to remove :)

The rational of having Time Stamp Counter as the header for port info and

stats, is to account for each iteration for an average packets per second. That is using `watch -d -n 1 ./dpdk-procinfo -- --xstats | grep -

v ": 0"`.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

But if there better way to do this or add as new feature, +1 to

remove.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Proc info should just use standard clock for its updates, not TSC?

Can you please explain the rationale behind the (syscall for time) and not

TSC?

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Looking forward for the patch with clock change too.

There is no part of what proc-info is show with xstats that displays or uses tsc directly.
Do you have a driver that is putting TSC information in xstats?

I am sorry I did not follow you on this, In the earlier implementation with

Quoted 8 lines

proc-info header we had TSC so coupling --show --xstats. But with the header removed out with TSC, how can we get this?

I am asking why is the TSC hz a useful piece of information here? Sure, proc-info could print lots of things but unless it serves a useful purpose for examining the interfaces, it is just noise.

Developers love to clutter output, but it just raises the signal to noise ratio.

Thanks for the update, as mentioned earlier from my end +1 for cleaning up the console output interface. Also +1 for adding option to get timestamp too.

But I am still not able to understand the suggestions like
`1. Why Proc info should just use standard clock for its updates, not TSC?
2. CPU frequency in header?`

As I understand standard clock is syscall and TSC is register fetch for clock ticks after reset and not CPU frequency.

#31 lore raw

PATCH v3 3/7 app/proc-info: hide EAL info messages

In reply to Stephen Hemminger

The DPDK EAL info messages at the start of a diagnostic application are not helpful to end user. Suppress them by setting log-level by default.

---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
app/proc-info/main.c +6 -4
index 049818bad51f..e4914191bef9 100644
@@ -1239,7 +1239,8 @@ main(int argc, char **argv)
 	char c_flag[] = "-c1";
 	char n_flag[] = "-n4";
 	char mp_flag[] = "--proc-type=secondary";
-	char *argp[argc + 3];
+	char log_flag[] = "--log-level=6";
+	char *argp[argc + 4];
 	uint16_t nb_ports;
 
 	/* preparse app arguments */
@@ -1253,18 +1254,19 @@ main(int argc, char **argv)
 	argp[1] = c_flag;
 	argp[2] = n_flag;
 	argp[3] = mp_flag;
+	argp[4] = log_flag;
 
 	for (i = 1; i < argc; i++)
-		argp[i + 3] = argv[i];
+		argp[i + 4] = argv[i];
 
-	argc += 3;
+	argc += 4;
 
 	ret = rte_eal_init(argc, argp);
 	if (ret < 0)
 		rte_panic("Cannot init EAL\n");
 
 	argc -= ret;
-	argv += (ret - 3);
+	argv += ret - 4;
 
 	if (!rte_eal_primary_proc_alive(NULL))
 		rte_exit(EXIT_FAILURE, "No primary DPDK process is running.\n");
Signature · 1 line
2.27.0
#32 lore raw

Re: [dpdk-dev] [PATCH v3 3/7] app/proc-info: hide EAL info messages

15/07/2020 23:22, Stephen Hemminger:

Quoted 3 lines

The DPDK EAL info messages at the start of a diagnostic application are not helpful to end user. Suppress them by setting log-level by default.

[...]

app/proc-info/main.c main(int argc, char **argv) · line 1242

Quoted 1 line
app/proc-info/main.c +1 -0
+	char log_flag[] = "--log-level=6";

Instead of disabling all logs, we could just raise the level of EAL logs:
--log-level=lib.eal:notice

#33 lore raw

PATCH v3 4/7 app/proc-info: add more info to show_ports

In reply to Stephen Hemminger

Revise the display of port information to include more data and be more human friendly.

* Display units for port speed, and decode link fields.
* Show driver and device information
* Show MAC address
* Show flow control information
* Combine lines if possible
* Show all multicast mode

---
 app/proc-info/main.c | 88 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 72 insertions(+), 16 deletions(-)
app/proc-info/main.c +72 -16
index e4914191bef9..7c1276b7fbc1 100644
@@ -669,6 +669,8 @@ 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_eth_fc_conf fc_conf;
+		struct rte_ether_addr mac;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -676,32 +678,86 @@ show_port(void)
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
-		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret != 0) {
+			printf("Error during getting device info: %s\n",
+				strerror(-ret));
+			return;
+		}
+
+		printf("\t  -- driver %s device %s socket %d\n",
+		       dev_info.driver_name, dev_info.device->name,
+		       rte_eth_dev_socket_id(i));
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			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);
+			uint32_t speed = link.link_speed;
+			char suffix = 'M';
+			const char *duplex, *autoneg, *status;
+
+			if (speed > 1000) {
+				suffix = 'G';
+				speed /= 1000;
+			}
+
+			if (link.link_duplex == ETH_LINK_FULL_DUPLEX)
+				duplex = "full";
+			else
+				duplex = "half";
+
+			if (link.link_autoneg == ETH_LINK_AUTONEG)
+				autoneg = "auto neg";
+			else
+				autoneg = "fixed";
+
+			if (link.link_status == ETH_LINK_UP)
+				status = "up";
+			else
+				status = "down";
+
+			printf("\t  -- link speed %u%cbps (%s), duplex %s, %s\n",
+			       speed, suffix, autoneg, duplex, status);
+		}
+
+		ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf);
+		if (ret == 0 && fc_conf.mode != RTE_FC_NONE)  {
+			printf("\t  -- flow control mode %s%s high %u low %u pause %u%s%s\n",
+			       fc_conf.mode == RTE_FC_RX_PAUSE ? "rx " :
+			       fc_conf.mode == RTE_FC_TX_PAUSE ? "tx " :
+			       fc_conf.mode == RTE_FC_FULL ? "full" : "???",
+			       fc_conf.autoneg ? " auto" : "",
+			       fc_conf.high_water,
+			       fc_conf.low_water,
+			       fc_conf.pause_time,
+			       fc_conf.send_xon ? " xon" : "",
+			       fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : "");
 		}
-		printf("\t  -- promiscuous (%d)\n",
-				rte_eth_promiscuous_get(i));
+
+		ret = rte_eth_macaddr_get(i, &mac);
+		if (ret == 0) {
+			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
+			printf("\t  -- mac %s\n", ebuf);
+		}
+
+
+		ret = rte_eth_promiscuous_get(i);
+		if (ret >= 0)
+			printf("\t  -- promiscuous mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
+		ret = rte_eth_allmulticast_get(i);
+		if (ret >= 0)
+			printf("\t  -- all multicast mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
 		ret = rte_eth_dev_get_mtu(i, &mtu);
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		ret = rte_eth_dev_info_get(i, &dev_info);
-		if (ret != 0) {
-			printf("Error during getting device (port %u) info: %s\n",
-				i, strerror(-ret));
-			return;
-		}
-
 		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
Signature · 1 line
2.27.0
#34 lore raw

PATCH v3 5/7 app/proc-info: dump rx and tx descriptor info

In reply to Stephen Hemminger

Many drivers will report per queue info for both rx and tx as well as how many descriptors are in use.

---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)
app/proc-info/main.c +66 -13
index 7c1276b7fbc1..5000724fcdd1 100644
@@ -654,6 +654,25 @@ metrics_display(int port_id)
 	rte_free(names);
 }
 
+/* This could be replaced by an ethdev hook in future */
+static int
+eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
+{
+	uint16_t offset;
+	int count = 0;
+
+	for (offset = 0; offset < n; offset++) {
+		int status;
+
+		status = rte_eth_tx_descriptor_status(port_id, queue_id, offset);
+		if (status < 0)
+			return status;
+		if (status == RTE_ETH_TX_DESC_DONE)
+			++count;
+	}
+	return count;
+}
+
 static void
 show_port(void)
 {
@@ -667,7 +686,6 @@ show_port(void)
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
-		struct rte_eth_rxq_info queue_info;
 		struct rte_eth_rss_conf rss_conf;
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
@@ -739,6 +757,7 @@ show_port(void)
 		ret = rte_eth_macaddr_get(i, &mac);
 		if (ret == 0) {
 			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+
 			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
 			printf("\t  -- mac %s\n", ebuf);
 		}
@@ -758,20 +777,54 @@ show_port(void)
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
+			struct rte_eth_rxq_info queue_info;
+			int count;
+
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
-			if (ret == 0) {
-				printf("\t  -- queue %d rx scatter %d"
-						" descriptors %d"
-						" offloads 0x%"PRIx64
-						" mempool socket %d\n",
-						j,
-						queue_info.scattered_rx,
-						queue_info.nb_desc,
-						queue_info.conf.offloads,
-						queue_info.mp->socket_id);
-			}
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - rx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+			count = rte_eth_rx_queue_count(i, j);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.scattered_rx)
+				printf(" scattered_rx");
+
+			printf(" offloads %#"PRIx64" socket %d\n",
+			       queue_info.conf.offloads,
+			       queue_info.mp->socket_id);
+		}
+
+		for (j = 0; j < dev_info.nb_tx_queues; j++) {
+			struct rte_eth_txq_info queue_info;
+			int count;
+
+			ret = rte_eth_tx_queue_info_get(i, j, &queue_info);
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - tx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+
+			count = eth_tx_queue_available(i, j, queue_info.nb_desc);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.conf.tx_deferred_start)
+				printf(" deferred_start");
+
+			printf(" offloads %#"PRIx64"\n",
+			       queue_info.conf.offloads);
 		}
 
 		ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
Signature · 1 line
2.27.0
#35 lore raw

PATCH v3 6/7 app/proc-info: provide way to request info on owned ports

In reply to Stephen Hemminger

There are cases where a port maybe owned by another (failsafe, netvsc, bond); but currently proc-info has no way to look at stats of those ports. This patch provides way for the user to explicitly ask for these ports.

If no portmask is given the output is unchanged; it only shows the top level ports. If portmask requests a specific port it will be shown even if owned.

The device owner is also a useful thing to show in port info.

---
 app/proc-info/Makefile |  3 ++
 app/proc-info/main.c   | 74 ++++++++++++++++++++++++++++--------------
 2 files changed, 53 insertions(+), 24 deletions(-)
app/proc-info/Makefile +3 -0
index 214f3f54a1e9..f777e037861f 100644
@@ -5,7 +5,10 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 APP = dpdk-procinfo
 
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -Wno-deprecated-declarations
 
 # all source are stored in SRCS-y
 
app/proc-info/main.c +50 -24

117 lines not on this page · raw message

Signature · 1 line
2.27.0
#36 lore raw

Re: [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports

15/07/2020 23:22, Stephen Hemminger:

app/proc-info/Makefile include $(RTE_SDK)/mk/rte.vars.mk · line 8

Quoted 3 lines
app/proc-info/Makefile +1 -0
+CFLAGS += -DALLOW_EXPERIMENTAL_API

not needed in app/

app/proc-info/Makefile include $(RTE_SDK)/mk/rte.vars.mk · line 11

Quoted 3 lines
app/proc-info/Makefile +2 -0
+CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -Wno-deprecated-declarations

Which deprecated function is used?
We must not use deprecated functions.

app/proc-info/Makefile

Quoted 1 line
app/proc-info/Makefile +1 -0
+	/* If no port mask was specified, one will be provided */

Would be nice to help the user by printing a port mask of owned and unowned ports.

app/proc-info/Makefile

Quoted 8 lines
app/proc-info/Makefile +5 -0
+	if (enabled_port_mask == 0) {
+		RTE_ETH_FOREACH_DEV(i) {
+			enabled_port_mask |= 1u << i;
 		}
 	}
 
+	for (port_mask = enabled_port_mask; port_mask != 0;
+	     port_mask &= ~(1u << i)) {

Please would be good to help drunk or sleepy readers with few comments.

app/proc-info/Makefile

Quoted 5 lines
app/proc-info/Makefile +5 -0
+		/* ffs() first bit is 1 not 0 */
+		i = ffs(port_mask) - 1;
+
+		if (i >= RTE_MAX_ETHPORTS)
+			break;

This check is already done in rte_eth_dev_is_valid_port().

Quoted 3 lines
app/proc-info/Makefile +3 -0
+
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
#37 lore raw

Re: [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports

Quoted 7 lines · On Fri, 17 Jul 2020 17:01:00 +0200 Thomas Monjalon <[email protected]> wrote:

15/07/2020 23:22, Stephen Hemminger:

app/proc-info/Makefile include $(RTE_SDK)/mk/rte.vars.mk · line 8

Quoted 3 lines
app/proc-info/Makefile +1 -0
+CFLAGS += -DALLOW_EXPERIMENTAL_API  

not needed in app/

Quoted 6 lines

app/proc-info/Makefile include $(RTE_SDK)/mk/rte.vars.mk · line 11

Quoted 3 lines
app/proc-info/Makefile +2 -0
+CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -Wno-deprecated-declarations  

Which deprecated function is used?
We must not use deprecated functions.

Fixing.

Quoted 5 lines

app/proc-info/Makefile

Quoted 2 lines
app/proc-info/Makefile +1 -0
+	/* If no port mask was specified, one will be provided */  

Would be nice to help the user by printing a port mask of owned and unowned ports.

Not needed, since each display already has the port #

Quoted 11 lines

app/proc-info/Makefile

Quoted 9 lines
app/proc-info/Makefile +5 -0
+	if (enabled_port_mask == 0) {
+		RTE_ETH_FOREACH_DEV(i) {
+			enabled_port_mask |= 1u << i;
 		}
 	}
 
+	for (port_mask = enabled_port_mask; port_mask != 0;
+	     port_mask &= ~(1u << i)) {  

Please would be good to help drunk or sleepy readers with few comments.

ok?

Quoted 8 lines

app/proc-info/Makefile

Quoted 6 lines
app/proc-info/Makefile +5 -0
+		/* ffs() first bit is 1 not 0 */
+		i = ffs(port_mask) - 1;
+
+		if (i >= RTE_MAX_ETHPORTS)
+			break;  

This check is already done in rte_eth_dev_is_valid_port().

Want to stop early if port is out of range,
but continue if hits a port that is owned.

Quoted 7 lines
Quoted 4 lines
app/proc-info/Makefile +3 -0
+
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;  
#38 lore raw

Re: [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports

21/07/2020 19:05, Stephen Hemminger:

Quoted 9 lines
Quoted 5 lines · On Fri, 17 Jul 2020 17:01:00 +0200 Thomas Monjalon <[email protected]> wrote:

15/07/2020 23:22, Stephen Hemminger:

app/proc-info/main.c main(int argc, char **argv) · line 1411

Quoted 1 line
app/proc-info/main.c +1 -0
+	/* If no port mask was specified, one will be provided */  

Would be nice to help the user by printing a port mask of owned and unowned ports.

Not needed, since each display already has the port #

By default, owned ports are not displayed at all.
How are we supposed to find them?

Quoted 11 lines
Quoted 10 lines

app/proc-info/main.c main(int argc, char **argv) · line 1419

Quoted 8 lines
app/proc-info/main.c +5 -0
+	if (enabled_port_mask == 0) {
+		RTE_ETH_FOREACH_DEV(i) {
+			enabled_port_mask |= 1u << i;
 		}
 	}
 
+	for (port_mask = enabled_port_mask; port_mask != 0;
+	     port_mask &= ~(1u << i)) {  

Please would be good to help drunk or sleepy readers with few comments.

ok?

Comments in the code I mean.

Quoted 10 lines
Quoted 7 lines

app/proc-info/main.c main(int argc, char **argv) · line 1424

Quoted 5 lines
app/proc-info/main.c +5 -0
+		/* ffs() first bit is 1 not 0 */
+		i = ffs(port_mask) - 1;
+
+		if (i >= RTE_MAX_ETHPORTS)
+			break;  

This check is already done in rte_eth_dev_is_valid_port().

Want to stop early if port is out of range,
but continue if hits a port that is owned.

OK

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
app/proc-info/main.c +3 -0
+
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;  
#39 lore raw

Re: [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports

Quoted 9 lines · On Tue, 21 Jul 2020 19:08:57 +0200 Thomas Monjalon <[email protected]> wrote:

21/07/2020 19:05, Stephen Hemminger:

Quoted 8 lines
Quoted 5 lines · On Fri, 17 Jul 2020 17:01:00 +0200 Thomas Monjalon <[email protected]> wrote:

15/07/2020 23:22, Stephen Hemminger:

app/proc-info/main.c main(int argc, char **argv) · line 1411

Quoted 1 line
app/proc-info/main.c +1 -0
+	/* If no port mask was specified, one will be provided */    

Would be nice to help the user by printing a port mask of owned and unowned ports.

Quoted 4 lines
Quoted 1 line

Not needed, since each display already has the port #

By default, owned ports are not displayed at all.
How are we supposed to find them?

You have to pass it in portmask.
The alternative would be to show all ports and mark those that are owned.

The ownership model API does not support a way to ask for either "tell me which other port owns port X" or "iterate over all the ports owned by Y". The problem is that the owner id is generic and stored inside the PMD. The root cause is that the original design of port ownership was targeting a more general use case that was never used. I would have been happier with a simpler parent port id index in ethdev instead.

#40 lore raw

PATCH v3 7/7 app/proc-info: add crypto security context info

In reply to Stephen Hemminger

From: Hemant Agrawal <[email protected]>

If crypto context is not present, no point in displaying it.

This patch adds the crypto based security context info. Also improve the flag printing to SECURITY OFFLOAD from INLINE.

Use common code for displaying crypto context information when doing show_ports and show_crypto.

---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 34 deletions(-)
app/proc-info/main.c +46 -34
index 14c04f8367f1..91205a51ad6b 100644
@@ -674,6 +674,32 @@ eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
 	return count;
 }
 
+static void
+show_security_context(uint16_t portid)
+{
+	void *p_ctx = rte_eth_dev_get_sec_ctx(portid);
+	const struct rte_security_capability *s_cap;
+
+	if (p_ctx == NULL)
+		return;
+
+	printf("  - crypto context\n");
+	printf("\t  -- security context - %p\n", p_ctx);
+	printf("\t  -- size %u\n",
+	       rte_security_session_get_size(p_ctx));
+
+	s_cap = rte_security_capabilities_get(p_ctx);
+	if (s_cap) {
+		printf("\t  -- action (0x%x), protocol (0x%x),"
+		       " offload flags (0x%x)\n",
+		       s_cap->action,
+		       s_cap->protocol,
+		       s_cap->ol_flags);
+		printf("\t  -- capabilities - oper type %x\n",
+		       s_cap->crypto_capabilities->op);
+	}
+}
+
 static void
 show_port(void)
 {
@@ -853,26 +879,8 @@ show_port(void)
 			}
 		}
 
-		printf("  - cyrpto context\n");
 #ifdef RTE_LIBRTE_SECURITY
-		void *p_ctx = rte_eth_dev_get_sec_ctx(i);
-		printf("\t  -- security context - %p\n", p_ctx);
-
-		if (p_ctx) {
-			printf("\t  -- size %u\n",
-					rte_security_session_get_size(p_ctx));
-			const struct rte_security_capability *s_cap =
-				rte_security_capabilities_get(p_ctx);
-			if (s_cap) {
-				printf("\t  -- action (0x%x), protocol (0x%x),"
-						" offload flags (0x%x)\n",
-						s_cap->action,
-						s_cap->protocol,
-						s_cap->ol_flags);
-				printf("\t  -- capabilities - oper type %x\n",
-						s_cap->crypto_capabilities->op);
-			}
-		}
+		show_security_context(i);
 #endif
 	}
 }
@@ -1178,7 +1186,7 @@ display_crypto_feature_info(uint64_t x)
 	printf("\t\t  + AESNI: CPU (%c), HW (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_AESNI) ? 'y' : 'n',
 		(x & RTE_CRYPTODEV_FF_HW_ACCELERATED) ? 'y' : 'n');
-	printf("\t\t  + INLINE (%c)\n",
+	printf("\t\t  + SECURITY OFFLOAD (%c)\n",
 		(x & RTE_CRYPTODEV_FF_SECURITY) ? 'y' : 'n');
 	printf("\t\t  + ARM: NEON (%c), CE (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_NEON) ? 'y' : 'n',
@@ -1212,14 +1220,14 @@ show_crypto(void)
 
 		printf("  - device (%u)\n", i);
 		printf("\t  -- name (%s)\n"
-			"\t  -- driver (%s)\n"
-			"\t  -- id (%u) on socket (%d)\n"
-			"\t  -- queue pairs (%d)\n",
-			rte_cryptodev_name_get(i),
-			dev_info.driver_name,
-			dev_info.driver_id,
-			dev_info.device->numa_node,
-			rte_cryptodev_queue_pair_count(i));
+		       "\t  -- driver (%s)\n"
+		       "\t  -- id (%u) on socket (%d)\n"
+		       "\t  -- queue pairs (%d)\n",
+		       rte_cryptodev_name_get(i),
+		       dev_info.driver_name,
+		       dev_info.driver_id,
+		       dev_info.device->numa_node,
+		       rte_cryptodev_queue_pair_count(i));
 
 		display_crypto_feature_info(dev_info.feature_flags);
 
@@ -1227,14 +1235,18 @@ show_crypto(void)
 		if (rte_cryptodev_stats_get(i, &stats) == 0) {
 			printf("\t  -- stats\n");
 			printf("\t\t  + enqueue count (%"PRIu64")"
-				" error (%"PRIu64")\n",
-				stats.enqueued_count,
-				stats.enqueue_err_count);
+			       " error (%"PRIu64")\n",
+			       stats.enqueued_count,
+			       stats.enqueue_err_count);
 			printf("\t\t  + dequeue count (%"PRIu64")"
-				" error (%"PRIu64")\n",
-				stats.dequeued_count,
-				stats.dequeue_err_count);
+			       " error (%"PRIu64")\n",
+			       stats.dequeued_count,
+			       stats.dequeue_err_count);
 		}
+
+#ifdef RTE_LIBRTE_SECURITY
+		show_security_context(i);
+#endif
 	}
 }
 
Signature · 1 line
2.27.0
#41 lore raw

v4 cover app/proc-info enhancements

In reply to Stephen Hemminger

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

v4 - incorporate mempool display
modify portmask for handling owned ports
v3 - consolidate chages for displaying crypto info v2 - fix checkpatch complaints

Hemant Agrawal (2):
app/proc-info: enhance mempool to print ops name app/proc-info: add crypto security context info

Stephen Hemminger (6):
app/proc-info: remove unused logtype #define app/proc-info: eliminate useless borders app/proc-info: hide EAL info messages app/proc-info: add more info to show_ports app/proc-info: dump rx and tx descriptor info app/proc-info: provide way to request info on owned ports

 app/proc-info/main.c | 393 ++++++++++++++++++++++++++++---------------
 1 file changed, 257 insertions(+), 136 deletions(-)
Signature · 1 line
2.27.0
#42 lore raw

PATCH v4 1/8 app/proc-info: remove unused logtype #define

This logtype is defined but never used.

---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)
app/proc-info/main.c +0 -2
index abeca4aab438..69e3000616c0 100644
@@ -39,8 +39,6 @@
 
 /* Maximum long option length for option parsing. */
 #define MAX_LONG_OPT_SZ 64
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
-
 #define MAX_STRING_LEN 256
 
 #define STATS_BDR_FMT "========================================"
Signature · 1 line
2.27.0
#43 lore raw

PATCH v4 2/8 app/proc-info: eliminate useless borders

In reply to Stephen Hemminger

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)
app/proc-info/main.c +7 -28
index 69e3000616c0..049818bad51f 100644
@@ -660,8 +660,7 @@ show_port(void)
 	uint16_t i = 0;
 	int ret = 0, j, k;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -673,7 +672,7 @@ show_port(void)
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
-		snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
+		snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i);
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
@@ -754,8 +753,6 @@ show_port(void)
 		}
 #endif
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -841,8 +838,7 @@ show_tm(void)
 	unsigned int j, k;
 	uint16_t i = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -1038,8 +1034,6 @@ show_tm(void)
 				stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1085,8 +1079,7 @@ show_crypto(void)
 {
 	uint8_t crypto_dev_count = rte_cryptodev_count(), i;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	for (i = 0; i < crypto_dev_count; i++) {
@@ -1121,15 +1114,12 @@ show_crypto(void)
 				stats.dequeue_err_count);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
 show_ring(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " show - RING %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - RING ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1160,7 +1150,6 @@ show_ring(char *name)
 	}
 
 	rte_ring_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1168,8 +1157,7 @@ show_mempool(char *name)
 {
 	uint64_t flags = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1206,13 +1194,11 @@ show_mempool(char *name)
 				rte_mempool_avail_count(ptr),
 				rte_mempool_in_use_count(ptr));
 
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
 
 	rte_mempool_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1230,8 +1216,7 @@ mempool_itr_obj(struct rte_mempool *mp, void *opaque,
 static void
 iter_mempool(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1241,12 +1226,9 @@ iter_mempool(char *name)
 			uint32_t ret = rte_mempool_obj_iter(ptr,
 					mempool_itr_obj, NULL);
 			printf("\n  - iterated %u objects\n", ret);
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 int
@@ -1347,8 +1329,5 @@ main(int argc, char **argv)
 	if (ret)
 		printf("Error from rte_eal_cleanup(), %d\n", ret);
 
-	strlcpy(bdr_str, " ", MAX_STRING_LEN);
-	STATS_BDR_STR(50, bdr_str);
-
 	return 0;
 }
Signature · 1 line
2.27.0
#44 lore raw

PATCH v4 3/8 app/proc-info: hide EAL info messages

In reply to Stephen Hemminger

The DPDK EAL info messages at the start of a diagnostic application are not helpful to end user. Suppress them by setting log-level by default.

---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
app/proc-info/main.c +6 -4
index 049818bad51f..e4914191bef9 100644
@@ -1239,7 +1239,8 @@ main(int argc, char **argv)
 	char c_flag[] = "-c1";
 	char n_flag[] = "-n4";
 	char mp_flag[] = "--proc-type=secondary";
-	char *argp[argc + 3];
+	char log_flag[] = "--log-level=6";
+	char *argp[argc + 4];
 	uint16_t nb_ports;
 
 	/* preparse app arguments */
@@ -1253,18 +1254,19 @@ main(int argc, char **argv)
 	argp[1] = c_flag;
 	argp[2] = n_flag;
 	argp[3] = mp_flag;
+	argp[4] = log_flag;
 
 	for (i = 1; i < argc; i++)
-		argp[i + 3] = argv[i];
+		argp[i + 4] = argv[i];
 
-	argc += 3;
+	argc += 4;
 
 	ret = rte_eal_init(argc, argp);
 	if (ret < 0)
 		rte_panic("Cannot init EAL\n");
 
 	argc -= ret;
-	argv += (ret - 3);
+	argv += ret - 4;
 
 	if (!rte_eal_primary_proc_alive(NULL))
 		rte_exit(EXIT_FAILURE, "No primary DPDK process is running.\n");
Signature · 1 line
2.27.0
#45 lore raw

PATCH v4 4/8 app/proc-info: add more info to show_ports

In reply to Stephen Hemminger

Revise the display of port information to include more data and be more human friendly.

* Display units for port speed, and decode link fields.
* Show driver and device information
* Show MAC address
* Show flow control information
* Combine lines if possible
* Show all multicast mode

---
 app/proc-info/main.c | 88 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 72 insertions(+), 16 deletions(-)
app/proc-info/main.c +72 -16
index e4914191bef9..7c1276b7fbc1 100644
@@ -669,6 +669,8 @@ 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_eth_fc_conf fc_conf;
+		struct rte_ether_addr mac;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -676,32 +678,86 @@ show_port(void)
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
-		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret != 0) {
+			printf("Error during getting device info: %s\n",
+				strerror(-ret));
+			return;
+		}
+
+		printf("\t  -- driver %s device %s socket %d\n",
+		       dev_info.driver_name, dev_info.device->name,
+		       rte_eth_dev_socket_id(i));
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			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);
+			uint32_t speed = link.link_speed;
+			char suffix = 'M';
+			const char *duplex, *autoneg, *status;
+
+			if (speed > 1000) {
+				suffix = 'G';
+				speed /= 1000;
+			}
+
+			if (link.link_duplex == ETH_LINK_FULL_DUPLEX)
+				duplex = "full";
+			else
+				duplex = "half";
+
+			if (link.link_autoneg == ETH_LINK_AUTONEG)
+				autoneg = "auto neg";
+			else
+				autoneg = "fixed";
+
+			if (link.link_status == ETH_LINK_UP)
+				status = "up";
+			else
+				status = "down";
+
+			printf("\t  -- link speed %u%cbps (%s), duplex %s, %s\n",
+			       speed, suffix, autoneg, duplex, status);
+		}
+
+		ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf);
+		if (ret == 0 && fc_conf.mode != RTE_FC_NONE)  {
+			printf("\t  -- flow control mode %s%s high %u low %u pause %u%s%s\n",
+			       fc_conf.mode == RTE_FC_RX_PAUSE ? "rx " :
+			       fc_conf.mode == RTE_FC_TX_PAUSE ? "tx " :
+			       fc_conf.mode == RTE_FC_FULL ? "full" : "???",
+			       fc_conf.autoneg ? " auto" : "",
+			       fc_conf.high_water,
+			       fc_conf.low_water,
+			       fc_conf.pause_time,
+			       fc_conf.send_xon ? " xon" : "",
+			       fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : "");
 		}
-		printf("\t  -- promiscuous (%d)\n",
-				rte_eth_promiscuous_get(i));
+
+		ret = rte_eth_macaddr_get(i, &mac);
+		if (ret == 0) {
+			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
+			printf("\t  -- mac %s\n", ebuf);
+		}
+
+
+		ret = rte_eth_promiscuous_get(i);
+		if (ret >= 0)
+			printf("\t  -- promiscuous mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
+		ret = rte_eth_allmulticast_get(i);
+		if (ret >= 0)
+			printf("\t  -- all multicast mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
 		ret = rte_eth_dev_get_mtu(i, &mtu);
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		ret = rte_eth_dev_info_get(i, &dev_info);
-		if (ret != 0) {
-			printf("Error during getting device (port %u) info: %s\n",
-				i, strerror(-ret));
-			return;
-		}
-
 		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
Signature · 1 line
2.27.0
Acked-by Hemant Agrawal on v4 4/8
#46 lore raw

Re: [dpdk-dev] [PATCH v4 4/8] app/proc-info: add more info to show_ports

Will you please also print queue mempool info
+ printf("\t -- mempool name: %s\n",
+ (queue_info.mp == NULL) ?
+ "NULL" : queue_info.mp->name);

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, July 21, 2020 11:53 PM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Hemant Agrawal <[email protected]>
Subject: [PATCH v4 4/8] app/proc-info: add more info to show_ports

Revise the display of port information to include more data and be more human friendly.

* Display units for port speed, and decode link fields.
* Show driver and device information
* Show MAC address
* Show flow control information
* Combine lines if possible
* Show all multicast mode

---
 app/proc-info/main.c | 88 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 72 insertions(+), 16 deletions(-)
app/proc-info/main.c +72 -16
@@ -669,6 +669,8 @@ 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_eth_fc_conf fc_conf;
+		struct rte_ether_addr mac;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -676,32 +678,86 @@ show_port(void)
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
-		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret != 0) {
+			printf("Error during getting device info: %s\n",
+				strerror(-ret));
+			return;
+		}
+
+		printf("\t  -- driver %s device %s socket %d\n",
+		       dev_info.driver_name, dev_info.device->name,
+		       rte_eth_dev_socket_id(i));
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			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);
+			uint32_t speed = link.link_speed;
+			char suffix = 'M';
+			const char *duplex, *autoneg, *status;
+
+			if (speed > 1000) {
+				suffix = 'G';
+				speed /= 1000;
+			}
+
+			if (link.link_duplex == ETH_LINK_FULL_DUPLEX)
+				duplex = "full";
+			else
+				duplex = "half";
+
+			if (link.link_autoneg == ETH_LINK_AUTONEG)
+				autoneg = "auto neg";
+			else
+				autoneg = "fixed";
+
+			if (link.link_status == ETH_LINK_UP)
+				status = "up";
+			else
+				status = "down";
+
+			printf("\t  -- link speed %u%cbps (%s), duplex %s, %s\n",
+			       speed, suffix, autoneg, duplex, status);
+		}
+
+		ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf);
+		if (ret == 0 && fc_conf.mode != RTE_FC_NONE)  {
+			printf("\t  -- flow control mode %s%s high %u low %u pause %u%s%s\n",
+			       fc_conf.mode == RTE_FC_RX_PAUSE ? "rx " :
+			       fc_conf.mode == RTE_FC_TX_PAUSE ? "tx " :
+			       fc_conf.mode == RTE_FC_FULL ? "full" : "???",
+			       fc_conf.autoneg ? " auto" : "",
+			       fc_conf.high_water,
+			       fc_conf.low_water,
+			       fc_conf.pause_time,
+			       fc_conf.send_xon ? " xon" : "",
+			       fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : "");
 		}
-		printf("\t  -- promiscuous (%d)\n",
-				rte_eth_promiscuous_get(i));
+
+		ret = rte_eth_macaddr_get(i, &mac);
+		if (ret == 0) {
+			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
+			printf("\t  -- mac %s\n", ebuf);
+		}
+
+
+		ret = rte_eth_promiscuous_get(i);
+		if (ret >= 0)
+			printf("\t  -- promiscuous mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
+		ret = rte_eth_allmulticast_get(i);
+		if (ret >= 0)
+			printf("\t  -- all multicast mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
 		ret = rte_eth_dev_get_mtu(i, &mtu);
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		ret = rte_eth_dev_info_get(i, &dev_info);
-		if (ret != 0) {
-			printf("Error during getting device (port %u) info: %s\n",
-				i, strerror(-ret));
-			return;
-		}
-
 		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);

--
2.27.0

#47 lore raw

PATCH v4 5/8 app/proc-info: enhance mempool to print ops name

In reply to Stephen Hemminger

From: Hemant Agrawal <[email protected]>

Enhance the mempool details to also print the ops index and name

---
 app/proc-info/main.c | 5 +++++
 1 file changed, 5 insertions(+)
app/proc-info/main.c +5 -0
index 7c1276b7fbc1..f3f83c0cea37 100644
@@ -1219,7 +1219,10 @@ show_mempool(char *name)
 	if (name != NULL) {
 		struct rte_mempool *ptr = rte_mempool_lookup(name);
 		if (ptr != NULL) {
+			struct rte_mempool_ops *ops;
+
 			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"
@@ -1249,6 +1252,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");
 
 			return;
 		}
Signature · 1 line
2.27.0
#48 lore raw

PATCH v4 6/8 app/proc-info: dump rx and tx descriptor info

In reply to Stephen Hemminger

Many drivers will report per queue info for both rx and tx as well as how many descriptors are in use.

---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)
app/proc-info/main.c +66 -13
index f3f83c0cea37..2ea554ab01f0 100644
@@ -654,6 +654,25 @@ metrics_display(int port_id)
 	rte_free(names);
 }
 
+/* This could be replaced by an ethdev hook in future */
+static int
+eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
+{
+	uint16_t offset;
+	int count = 0;
+
+	for (offset = 0; offset < n; offset++) {
+		int status;
+
+		status = rte_eth_tx_descriptor_status(port_id, queue_id, offset);
+		if (status < 0)
+			return status;
+		if (status == RTE_ETH_TX_DESC_DONE)
+			++count;
+	}
+	return count;
+}
+
 static void
 show_port(void)
 {
@@ -667,7 +686,6 @@ show_port(void)
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
-		struct rte_eth_rxq_info queue_info;
 		struct rte_eth_rss_conf rss_conf;
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
@@ -739,6 +757,7 @@ show_port(void)
 		ret = rte_eth_macaddr_get(i, &mac);
 		if (ret == 0) {
 			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+
 			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
 			printf("\t  -- mac %s\n", ebuf);
 		}
@@ -758,20 +777,54 @@ show_port(void)
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
+			struct rte_eth_rxq_info queue_info;
+			int count;
+
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
-			if (ret == 0) {
-				printf("\t  -- queue %d rx scatter %d"
-						" descriptors %d"
-						" offloads 0x%"PRIx64
-						" mempool socket %d\n",
-						j,
-						queue_info.scattered_rx,
-						queue_info.nb_desc,
-						queue_info.conf.offloads,
-						queue_info.mp->socket_id);
-			}
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - rx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+			count = rte_eth_rx_queue_count(i, j);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.scattered_rx)
+				printf(" scattered_rx");
+
+			printf(" offloads %#"PRIx64" socket %d\n",
+			       queue_info.conf.offloads,
+			       queue_info.mp->socket_id);
+		}
+
+		for (j = 0; j < dev_info.nb_tx_queues; j++) {
+			struct rte_eth_txq_info queue_info;
+			int count;
+
+			ret = rte_eth_tx_queue_info_get(i, j, &queue_info);
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - tx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+
+			count = eth_tx_queue_available(i, j, queue_info.nb_desc);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.conf.tx_deferred_start)
+				printf(" deferred_start");
+
+			printf(" offloads %#"PRIx64"\n",
+			       queue_info.conf.offloads);
 		}
 
 		ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
Signature · 1 line
2.27.0
#49 lore raw

PATCH v4 7/8 app/proc-info: add crypto security context info

In reply to Stephen Hemminger

From: Hemant Agrawal <[email protected]>

If crypto context is not present, no point in displaying it.

This patch adds the crypto based security context info. Also improve the flag printing to SECURITY OFFLOAD from INLINE.

Use common code for displaying crypto context information when doing show_ports and show_crypto.

---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 34 deletions(-)
app/proc-info/main.c +46 -34
index 2ea554ab01f0..aa074dc7c429 100644
@@ -673,6 +673,32 @@ eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
 	return count;
 }
 
+static void
+show_security_context(uint16_t portid)
+{
+	void *p_ctx = rte_eth_dev_get_sec_ctx(portid);
+	const struct rte_security_capability *s_cap;
+
+	if (p_ctx == NULL)
+		return;
+
+	printf("  - crypto context\n");
+	printf("\t  -- security context - %p\n", p_ctx);
+	printf("\t  -- size %u\n",
+	       rte_security_session_get_size(p_ctx));
+
+	s_cap = rte_security_capabilities_get(p_ctx);
+	if (s_cap) {
+		printf("\t  -- action (0x%x), protocol (0x%x),"
+		       " offload flags (0x%x)\n",
+		       s_cap->action,
+		       s_cap->protocol,
+		       s_cap->ol_flags);
+		printf("\t  -- capabilities - oper type %x\n",
+		       s_cap->crypto_capabilities->op);
+	}
+}
+
 static void
 show_port(void)
 {
@@ -840,26 +866,8 @@ show_port(void)
 			}
 		}
 
-		printf("  - cyrpto context\n");
 #ifdef RTE_LIBRTE_SECURITY
-		void *p_ctx = rte_eth_dev_get_sec_ctx(i);
-		printf("\t  -- security context - %p\n", p_ctx);
-
-		if (p_ctx) {
-			printf("\t  -- size %u\n",
-					rte_security_session_get_size(p_ctx));
-			const struct rte_security_capability *s_cap =
-				rte_security_capabilities_get(p_ctx);
-			if (s_cap) {
-				printf("\t  -- action (0x%x), protocol (0x%x),"
-						" offload flags (0x%x)\n",
-						s_cap->action,
-						s_cap->protocol,
-						s_cap->ol_flags);
-				printf("\t  -- capabilities - oper type %x\n",
-						s_cap->crypto_capabilities->op);
-			}
-		}
+		show_security_context(i);
 #endif
 	}
 }
@@ -1165,7 +1173,7 @@ display_crypto_feature_info(uint64_t x)
 	printf("\t\t  + AESNI: CPU (%c), HW (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_AESNI) ? 'y' : 'n',
 		(x & RTE_CRYPTODEV_FF_HW_ACCELERATED) ? 'y' : 'n');
-	printf("\t\t  + INLINE (%c)\n",
+	printf("\t\t  + SECURITY OFFLOAD (%c)\n",
 		(x & RTE_CRYPTODEV_FF_SECURITY) ? 'y' : 'n');
 	printf("\t\t  + ARM: NEON (%c), CE (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_NEON) ? 'y' : 'n',
@@ -1199,14 +1207,14 @@ show_crypto(void)
 
 		printf("  - device (%u)\n", i);
 		printf("\t  -- name (%s)\n"
-			"\t  -- driver (%s)\n"
-			"\t  -- id (%u) on socket (%d)\n"
-			"\t  -- queue pairs (%d)\n",
-			rte_cryptodev_name_get(i),
-			dev_info.driver_name,
-			dev_info.driver_id,
-			dev_info.device->numa_node,
-			rte_cryptodev_queue_pair_count(i));
+		       "\t  -- driver (%s)\n"
+		       "\t  -- id (%u) on socket (%d)\n"
+		       "\t  -- queue pairs (%d)\n",
+		       rte_cryptodev_name_get(i),
+		       dev_info.driver_name,
+		       dev_info.driver_id,
+		       dev_info.device->numa_node,
+		       rte_cryptodev_queue_pair_count(i));
 
 		display_crypto_feature_info(dev_info.feature_flags);
 
@@ -1214,14 +1222,18 @@ show_crypto(void)
 		if (rte_cryptodev_stats_get(i, &stats) == 0) {
 			printf("\t  -- stats\n");
 			printf("\t\t  + enqueue count (%"PRIu64")"
-				" error (%"PRIu64")\n",
-				stats.enqueued_count,
-				stats.enqueue_err_count);
+			       " error (%"PRIu64")\n",
+			       stats.enqueued_count,
+			       stats.enqueue_err_count);
 			printf("\t\t  + dequeue count (%"PRIu64")"
-				" error (%"PRIu64")\n",
-				stats.dequeued_count,
-				stats.dequeue_err_count);
+			       " error (%"PRIu64")\n",
+			       stats.dequeued_count,
+			       stats.dequeue_err_count);
 		}
+
+#ifdef RTE_LIBRTE_SECURITY
+		show_security_context(i);
+#endif
 	}
 }
 
Signature · 1 line
2.27.0
#50 lore raw

PATCH v4 8/8 app/proc-info: provide way to request info on owned ports

In reply to Stephen Hemminger

There are cases where a port maybe owned by another (failsafe, netvsc, bond); but currently proc-info has no way to look at stats of those ports. This patch provides way for the user to explicitly ask for these ports.

If no portmask is given the output is unchanged; it only shows the top level ports. If portmask requests a specific port it will be shown even if owned.

Increase the size of port mask variable to unsigned long to allow up to 64 ports to be handled on 64 bit architecture.

The device owner is also a useful thing to show in port info.

---
 app/proc-info/main.c | 94 ++++++++++++++++++++++++++------------------
 1 file changed, 55 insertions(+), 39 deletions(-)
app/proc-info/main.c +55 -39
index aa074dc7c429..77a59bcefb9b 100644
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <unistd.h>
+#include <strings.h>
 
 #include <rte_eal.h>
 #include <rte_common.h>
@@ -46,7 +47,7 @@
 	STATS_BDR_FMT, s, w, STATS_BDR_FMT)
 
 /**< mask of enabled ports */
-static uint32_t enabled_port_mask;
+static unsigned long enabled_port_mask;
 /**< Enable stats. */
 static uint32_t enable_stats;
 /**< Enable xstats. */
@@ -128,23 +129,17 @@ static int
 parse_portmask(const char *portmask)
 {
 	char *end = NULL;
-	unsigned long pm;
 
 	errno = 0;
 
 	/* parse hexadecimal string */
-	pm = strtoul(portmask, &end, 16);
-	if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0') ||
-		(errno != 0)) {
-		printf("%s ERROR parsing the port mask\n", __func__);
+	enabled_port_mask = strtoul(portmask, &end, 16);
+	if (portmask[0] == '\0' || end == NULL || *end != '\0' || errno != 0) {
+		fprintf(stderr, "Invalid portmask '%s'\n", portmask);
 		return -1;
 	}
 
-	if (pm == 0)
-		return -1;
-
-	return pm;
-
+	return 0;
 }
 
 /*
@@ -242,9 +237,7 @@ proc_info_parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'p':
-			enabled_port_mask = parse_portmask(optarg);
-			if (enabled_port_mask == 0) {
-				printf("invalid portmask\n");
+			if (parse_portmask(optarg) < 0) {
 				proc_info_usage(prgname);
 				return -1;
 			}
@@ -702,20 +695,28 @@ show_security_context(uint16_t portid)
 static void
 show_port(void)
 {
-	uint16_t i = 0;
-	int ret = 0, j, k;
+	int i, ret, j, k;
 
 	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
-
-	RTE_ETH_FOREACH_DEV(i) {
+	
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
 		struct rte_eth_rss_conf rss_conf;
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
+		struct rte_eth_dev_owner owner;
 
+		/* Skip if port is not in mask */
+		if ((enabled_port_mask & (1ul << i)) == 0)
+			continue;
+		
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
+		
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
 		snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i);
@@ -733,6 +734,11 @@ show_port(void)
 		       dev_info.driver_name, dev_info.device->name,
 		       rte_eth_dev_socket_id(i));
 
+		ret = rte_eth_dev_owner_get(i, &owner);
+		if (ret == 0 && owner.id != RTE_ETH_DEV_NO_OWNER)
+			printf("\t --  owner %#"PRIx64":%s\n",
+			       owner.id, owner.name);
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			printf("Link get failed (port %u): %s\n",
@@ -1411,28 +1417,38 @@ main(int argc, char **argv)
 	if (nb_ports == 0)
 		rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
 
-	/* If no port mask was specified*/
-	if (enabled_port_mask == 0)
-		enabled_port_mask = 0xffff;
+	/* If no port mask was specified, then show non-owned ports */
+	if (enabled_port_mask == 0) {
+		RTE_ETH_FOREACH_DEV(i)
+			enabled_port_mask = 1ul << i;
+	}
+
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+
+		/* Skip if port is not in mask */
+		if ((enabled_port_mask & (1ul << i)) == 0)
+			continue;
+		
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
+
+		if (enable_stats)
+			nic_stats_display(i);
+		else if (enable_xstats)
+			nic_xstats_display(i);
+		else if (reset_stats)
+			nic_stats_clear(i);
+		else if (reset_xstats)
+			nic_xstats_clear(i);
+		else if (enable_xstats_name)
+			nic_xstats_by_name_display(i, xstats_name);
+		else if (nb_xstats_ids > 0)
+			nic_xstats_by_ids_display(i, xstats_ids,
+						  nb_xstats_ids);
+		else if (enable_metrics)
+			metrics_display(i);
 
-	RTE_ETH_FOREACH_DEV(i) {
-		if (enabled_port_mask & (1 << i)) {
-			if (enable_stats)
-				nic_stats_display(i);
-			else if (enable_xstats)
-				nic_xstats_display(i);
-			else if (reset_stats)
-				nic_stats_clear(i);
-			else if (reset_xstats)
-				nic_xstats_clear(i);
-			else if (enable_xstats_name)
-				nic_xstats_by_name_display(i, xstats_name);
-			else if (nb_xstats_ids > 0)
-				nic_xstats_by_ids_display(i, xstats_ids,
-						nb_xstats_ids);
-			else if (enable_metrics)
-				metrics_display(i);
-		}
 	}
 
 	/* print port independent stats */
Signature · 1 line
2.27.0
Acked-by Hemant Agrawal on v4 8/8
#51 lore raw

Re: [dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports

Hi Stephen,
This patch has checkpatch errors

### [PATCH] app/proc-info: provide way to request info on owned ports

ERROR:TRAILING_WHITESPACE: trailing whitespace
#98: FILE: app/proc-info/main.c:702:
+^I$

ERROR:TRAILING_WHITESPACE: trailing whitespace
#111: FILE: app/proc-info/main.c:715:
+^I^I$

ERROR:TRAILING_WHITESPACE: trailing whitespace
#115: FILE: app/proc-info/main.c:719:
+^I^I$

ERROR:TRAILING_WHITESPACE: trailing whitespace
#149: FILE: app/proc-info/main.c:1431:
+^I^I$

total: 4 errors, 0 warnings, 154 lines checked

Regards,
Hemant

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, July 21, 2020 11:53 PM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Hemant Agrawal <[email protected]>
Subject: [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports

There are cases where a port maybe owned by another (failsafe, netvsc, bond); but currently proc-info has no way to look at stats of those ports. This patch provides way for the user to explicitly ask for these ports.

If no portmask is given the output is unchanged; it only shows the top level ports. If portmask requests a specific port it will be shown even if owned.

Increase the size of port mask variable to unsigned long to allow up to 64 ports to be handled on 64 bit architecture.

The device owner is also a useful thing to show in port info.

---
 app/proc-info/main.c | 94 ++++++++++++++++++++++++++------------------
 1 file changed, 55 insertions(+), 39 deletions(-)
app/proc-info/main.c +19 -18
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <unistd.h>
+#include <strings.h>
 
 #include <rte_eal.h>
 #include <rte_common.h>
@@ -46,7 +47,7 @@
 	STATS_BDR_FMT, s, w, STATS_BDR_FMT)
 
 /**< mask of enabled ports */
-static uint32_t enabled_port_mask;
+static unsigned long enabled_port_mask;
 /**< Enable stats. */
 static uint32_t enable_stats;
 /**< Enable xstats. */
@@ -128,23 +129,17 @@ static int
 parse_portmask(const char *portmask)
 {
 	char *end = NULL;
-	unsigned long pm;
 
 	errno = 0;
 
 	/* parse hexadecimal string */
-	pm = strtoul(portmask, &end, 16);
-	if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0') ||
-		(errno != 0)) {
-		printf("%s ERROR parsing the port mask\n", __func__);
+	enabled_port_mask = strtoul(portmask, &end, 16);
+	if (portmask[0] == '\0' || end == NULL || *end != '\0' || errno != 0) {
+		fprintf(stderr, "Invalid portmask '%s'\n", portmask);
 		return -1;
 	}
 
-	if (pm == 0)
-		return -1;
-
-	return pm;
-
+	return 0;
 }
 
 /*
@@ -242,9 +237,7 @@ proc_info_parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'p':
-			enabled_port_mask = parse_portmask(optarg);
-			if (enabled_port_mask == 0) {
-				printf("invalid portmask\n");
+			if (parse_portmask(optarg) < 0) {
 				proc_info_usage(prgname);
 				return -1;
 			}
@@ -702,20 +695,28 @@ show_security_context(uint16_t portid)  static void
 show_port(void)
 {
-	uint16_t i = 0;
-	int ret = 0, j, k;
+	int i, ret, j, k;
 
 	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
-
-	RTE_ETH_FOREACH_DEV(i) {
+	
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
 		struct rte_eth_rss_conf rss_conf;
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
+		struct rte_eth_dev_owner owner;
 
+		/* Skip if port is not in mask */
+		if ((enabled_port_mask & (1ul << i)) == 0)
+			continue;
+		
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
+		
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
 		snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i); @@ -733,6 +734,11 @@ show_port(void)
 		       dev_info.driver_name, dev_info.device->name,

rte_eth_dev_socket_id(i));

+ ret = rte_eth_dev_owner_get(i, &owner);
+ if (ret == 0 && owner.id != RTE_ETH_DEV_NO_OWNER)
+ printf("\t -- owner %#"PRIx64":%s\n",
+ owner.id, owner.name);
+
ret = rte_eth_link_get(i, &link);
if (ret < 0) {
printf("Link get failed (port %u): %s\n", @@ -1411,28 +1417,38 @@ main(int argc, char **argv)
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");

- /* If no port mask was specified*/
- if (enabled_port_mask == 0)
- enabled_port_mask = 0xffff;
+ /* If no port mask was specified, then show non-owned ports */
+ if (enabled_port_mask == 0) {
+ RTE_ETH_FOREACH_DEV(i)
+ enabled_port_mask = 1ul << i;
+ }
+
+ for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+
+ /* Skip if port is not in mask */
+ if ((enabled_port_mask & (1ul << i)) == 0)
+ continue;
+
+ /* Skip if port is unused */
+ if (!rte_eth_dev_is_valid_port(i))
+ continue;
+
+ if (enable_stats)
+ nic_stats_display(i);
+ else if (enable_xstats)
+ nic_xstats_display(i);
+ else if (reset_stats)
+ nic_stats_clear(i);
+ else if (reset_xstats)
+ nic_xstats_clear(i);
+ else if (enable_xstats_name)
+ nic_xstats_by_name_display(i, xstats_name);
+ else if (nb_xstats_ids > 0)
+ nic_xstats_by_ids_display(i, xstats_ids,
+ nb_xstats_ids);
+ else if (enable_metrics)
+ metrics_display(i);

- RTE_ETH_FOREACH_DEV(i) {
- if (enabled_port_mask & (1 << i)) {
- if (enable_stats)
- nic_stats_display(i);
- else if (enable_xstats)
- nic_xstats_display(i);
- else if (reset_stats)
- nic_stats_clear(i);
- else if (reset_xstats)
- nic_xstats_clear(i);
- else if (enable_xstats_name)
- nic_xstats_by_name_display(i, xstats_name);
- else if (nb_xstats_ids > 0)
- nic_xstats_by_ids_display(i, xstats_ids,
- nb_xstats_ids);
- else if (enable_metrics)
- metrics_display(i);
- }
}

/* print port independent stats */
--
2.27.0

#52 lore raw

Re: [dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports

Quoted 17 lines · On Tue, 28 Jul 2020 05:39:46 +0000 "Hemant Agrawal (OSS)"…

Hi Stephen,
This patch has checkpatch errors

### [PATCH] app/proc-info: provide way to request info on owned ports

ERROR:TRAILING_WHITESPACE: trailing whitespace
#98: FILE: app/proc-info/main.c:702:
+^I$

ERROR:TRAILING_WHITESPACE: trailing whitespace
#111: FILE: app/proc-info/main.c:715:
+^I^I$

ERROR:TRAILING_WHITESPACE: trailing whitespace
#115: FILE: app/proc-info/main.c:719:
+^I^I$

Quoted 9 lines

ERROR:TRAILING_WHITESPACE: trailing whitespace
#149: FILE: app/proc-info/main.c:1431:
+^I^I$

total: 4 errors, 0 warnings, 154 lines checked

Regards,
Hemant

Will resubmit, are there any other suggestions?

#53 lore raw

v5 cover app/proc-info enhancements

In reply to Stephen Hemminger

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

v5 - add mempool name to queue info
fix trailing whitespace
v4 - incorporate mempool display
modify portmask for handling owned ports
v3 - consolidate chages for displaying crypto info v2 - fix checkpatch complaints

Hemant Agrawal (2):
app/proc-info: enhance mempool to print ops name app/proc-info: add crypto security context info

Stephen Hemminger (6):
app/proc-info: remove unused logtype #define app/proc-info: eliminate useless borders app/proc-info: hide EAL info messages app/proc-info: add more info to show_ports app/proc-info: dump rx and tx descriptor info app/proc-info: provide way to request info on owned ports

 app/proc-info/main.c | 392 ++++++++++++++++++++++++++++---------------
 1 file changed, 257 insertions(+), 135 deletions(-)
Signature · 1 line
2.27.0
#54 lore raw

PATCH v5 1/8 app/proc-info: remove unused logtype #define

This logtype is defined but never used.

---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)
app/proc-info/main.c +0 -2
index abeca4aab438..69e3000616c0 100644
@@ -39,8 +39,6 @@
 
 /* Maximum long option length for option parsing. */
 #define MAX_LONG_OPT_SZ 64
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
-
 #define MAX_STRING_LEN 256
 
 #define STATS_BDR_FMT "========================================"
Signature · 1 line
2.27.0
#55 lore raw

PATCH v5 2/8 app/proc-info: eliminate useless borders

In reply to Stephen Hemminger

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)
app/proc-info/main.c +7 -28
index 69e3000616c0..049818bad51f 100644
@@ -660,8 +660,7 @@ show_port(void)
 	uint16_t i = 0;
 	int ret = 0, j, k;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -673,7 +672,7 @@ show_port(void)
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
-		snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
+		snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i);
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
@@ -754,8 +753,6 @@ show_port(void)
 		}
 #endif
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -841,8 +838,7 @@ show_tm(void)
 	unsigned int j, k;
 	uint16_t i = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -1038,8 +1034,6 @@ show_tm(void)
 				stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1085,8 +1079,7 @@ show_crypto(void)
 {
 	uint8_t crypto_dev_count = rte_cryptodev_count(), i;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	for (i = 0; i < crypto_dev_count; i++) {
@@ -1121,15 +1114,12 @@ show_crypto(void)
 				stats.dequeue_err_count);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
 show_ring(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " show - RING %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - RING ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1160,7 +1150,6 @@ show_ring(char *name)
 	}
 
 	rte_ring_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1168,8 +1157,7 @@ show_mempool(char *name)
 {
 	uint64_t flags = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1206,13 +1194,11 @@ show_mempool(char *name)
 				rte_mempool_avail_count(ptr),
 				rte_mempool_in_use_count(ptr));
 
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
 
 	rte_mempool_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1230,8 +1216,7 @@ mempool_itr_obj(struct rte_mempool *mp, void *opaque,
 static void
 iter_mempool(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1241,12 +1226,9 @@ iter_mempool(char *name)
 			uint32_t ret = rte_mempool_obj_iter(ptr,
 					mempool_itr_obj, NULL);
 			printf("\n  - iterated %u objects\n", ret);
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 int
@@ -1347,8 +1329,5 @@ main(int argc, char **argv)
 	if (ret)
 		printf("Error from rte_eal_cleanup(), %d\n", ret);
 
-	strlcpy(bdr_str, " ", MAX_STRING_LEN);
-	STATS_BDR_STR(50, bdr_str);
-
 	return 0;
 }
Signature · 1 line
2.27.0
#56 lore raw

PATCH v5 3/8 app/proc-info: hide EAL info messages

In reply to Stephen Hemminger

The DPDK EAL info messages at the start of a diagnostic application are not helpful to end user. Suppress them by setting log-level by default.

---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
app/proc-info/main.c +6 -4
index 049818bad51f..e4914191bef9 100644
@@ -1239,7 +1239,8 @@ main(int argc, char **argv)
 	char c_flag[] = "-c1";
 	char n_flag[] = "-n4";
 	char mp_flag[] = "--proc-type=secondary";
-	char *argp[argc + 3];
+	char log_flag[] = "--log-level=6";
+	char *argp[argc + 4];
 	uint16_t nb_ports;
 
 	/* preparse app arguments */
@@ -1253,18 +1254,19 @@ main(int argc, char **argv)
 	argp[1] = c_flag;
 	argp[2] = n_flag;
 	argp[3] = mp_flag;
+	argp[4] = log_flag;
 
 	for (i = 1; i < argc; i++)
-		argp[i + 3] = argv[i];
+		argp[i + 4] = argv[i];
 
-	argc += 3;
+	argc += 4;
 
 	ret = rte_eal_init(argc, argp);
 	if (ret < 0)
 		rte_panic("Cannot init EAL\n");
 
 	argc -= ret;
-	argv += (ret - 3);
+	argv += ret - 4;
 
 	if (!rte_eal_primary_proc_alive(NULL))
 		rte_exit(EXIT_FAILURE, "No primary DPDK process is running.\n");
Signature · 1 line
2.27.0
#57 lore raw

PATCH v5 4/8 app/proc-info: add more info to show_ports

In reply to Stephen Hemminger

Revise the display of port information to include more data and be more human friendly.

* Display units for port speed, and decode link fields.
* Show driver and device information
* Show MAC address
* Show flow control information
* Combine lines if possible
* Show all multicast mode
* Show queue mempool name

---
 app/proc-info/main.c | 100 +++++++++++++++++++++++++++++++++----------
 1 file changed, 78 insertions(+), 22 deletions(-)
app/proc-info/main.c +78 -22
index e4914191bef9..28838be882b9 100644
@@ -669,6 +669,8 @@ 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_eth_fc_conf fc_conf;
+		struct rte_ether_addr mac;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -676,32 +678,86 @@ show_port(void)
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
-		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret != 0) {
+			printf("Error during getting device info: %s\n",
+				strerror(-ret));
+			return;
+		}
+
+		printf("\t  -- driver %s device %s socket %d\n",
+		       dev_info.driver_name, dev_info.device->name,
+		       rte_eth_dev_socket_id(i));
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			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);
+			uint32_t speed = link.link_speed;
+			char suffix = 'M';
+			const char *duplex, *autoneg, *status;
+
+			if (speed > 1000) {
+				suffix = 'G';
+				speed /= 1000;
+			}
+
+			if (link.link_duplex == ETH_LINK_FULL_DUPLEX)
+				duplex = "full";
+			else
+				duplex = "half";
+
+			if (link.link_autoneg == ETH_LINK_AUTONEG)
+				autoneg = "auto neg";
+			else
+				autoneg = "fixed";
+
+			if (link.link_status == ETH_LINK_UP)
+				status = "up";
+			else
+				status = "down";
+
+			printf("\t  -- link speed %u%cbps (%s), duplex %s, %s\n",
+			       speed, suffix, autoneg, duplex, status);
+		}
+
+		ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf);
+		if (ret == 0 && fc_conf.mode != RTE_FC_NONE)  {
+			printf("\t  -- flow control mode %s%s high %u low %u pause %u%s%s\n",
+			       fc_conf.mode == RTE_FC_RX_PAUSE ? "rx " :
+			       fc_conf.mode == RTE_FC_TX_PAUSE ? "tx " :
+			       fc_conf.mode == RTE_FC_FULL ? "full" : "???",
+			       fc_conf.autoneg ? " auto" : "",
+			       fc_conf.high_water,
+			       fc_conf.low_water,
+			       fc_conf.pause_time,
+			       fc_conf.send_xon ? " xon" : "",
+			       fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : "");
 		}
-		printf("\t  -- promiscuous (%d)\n",
-				rte_eth_promiscuous_get(i));
+
+		ret = rte_eth_macaddr_get(i, &mac);
+		if (ret == 0) {
+			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
+			printf("\t  -- mac %s\n", ebuf);
+		}
+
+
+		ret = rte_eth_promiscuous_get(i);
+		if (ret >= 0)
+			printf("\t  -- promiscuous mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
+		ret = rte_eth_allmulticast_get(i);
+		if (ret >= 0)
+			printf("\t  -- all multicast mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
 		ret = rte_eth_dev_get_mtu(i, &mtu);
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		ret = rte_eth_dev_info_get(i, &dev_info);
-		if (ret != 0) {
-			printf("Error during getting device (port %u) info: %s\n",
-				i, strerror(-ret));
-			return;
-		}
-
 		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
@@ -709,12 +765,12 @@ show_port(void)
 				printf("\t  -- queue %d rx scatter %d"
 						" descriptors %d"
 						" offloads 0x%"PRIx64
-						" mempool socket %d\n",
-						j,
-						queue_info.scattered_rx,
-						queue_info.nb_desc,
-						queue_info.conf.offloads,
-						queue_info.mp->socket_id);
+						" mempool name %s socket %d\n",
+				       j, queue_info.scattered_rx,
+				       queue_info.nb_desc,
+				       queue_info.conf.offloads,
+				       queue_info.mp->name,
+				       queue_info.mp->socket_id);
 			}
 		}
 
Signature · 1 line
2.27.0
#58 lore raw

PATCH v5 5/8 app/proc-info: enhance mempool to print ops name

In reply to Stephen Hemminger

From: Hemant Agrawal <[email protected]>

Enhance the mempool details to also print the ops index and name

---
 app/proc-info/main.c | 5 +++++
 1 file changed, 5 insertions(+)
app/proc-info/main.c +5 -0
index 28838be882b9..b2011c448577 100644
@@ -1219,7 +1219,10 @@ show_mempool(char *name)
 	if (name != NULL) {
 		struct rte_mempool *ptr = rte_mempool_lookup(name);
 		if (ptr != NULL) {
+			struct rte_mempool_ops *ops;
+
 			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"
@@ -1249,6 +1252,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");
 
 			return;
 		}
Signature · 1 line
2.27.0
#59 lore raw

PATCH v5 6/8 app/proc-info: dump rx and tx descriptor info

In reply to Stephen Hemminger

Many drivers will report per queue info for both rx and tx as well as how many descriptors are in use.

---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 67 insertions(+), 13 deletions(-)
app/proc-info/main.c +67 -13
index b2011c448577..4e2e647498ff 100644
@@ -654,6 +654,25 @@ metrics_display(int port_id)
 	rte_free(names);
 }
 
+/* This could be replaced by an ethdev hook in future */
+static int
+eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
+{
+	uint16_t offset;
+	int count = 0;
+
+	for (offset = 0; offset < n; offset++) {
+		int status;
+
+		status = rte_eth_tx_descriptor_status(port_id, queue_id, offset);
+		if (status < 0)
+			return status;
+		if (status == RTE_ETH_TX_DESC_DONE)
+			++count;
+	}
+	return count;
+}
+
 static void
 show_port(void)
 {
@@ -667,7 +686,6 @@ show_port(void)
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
-		struct rte_eth_rxq_info queue_info;
 		struct rte_eth_rss_conf rss_conf;
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
@@ -739,6 +757,7 @@ show_port(void)
 		ret = rte_eth_macaddr_get(i, &mac);
 		if (ret == 0) {
 			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+
 			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
 			printf("\t  -- mac %s\n", ebuf);
 		}
@@ -758,20 +777,55 @@ show_port(void)
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
+			struct rte_eth_rxq_info queue_info;
+			int count;
+
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
-			if (ret == 0) {
-				printf("\t  -- queue %d rx scatter %d"
-						" descriptors %d"
-						" offloads 0x%"PRIx64
-						" mempool name %s socket %d\n",
-				       j, queue_info.scattered_rx,
-				       queue_info.nb_desc,
-				       queue_info.conf.offloads,
-				       queue_info.mp->name,
-				       queue_info.mp->socket_id);
-			}
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - rx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+			count = rte_eth_rx_queue_count(i, j);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.scattered_rx)
+				printf(" scattered_rx");
+
+			printf(" offloads %#"PRIx64" mempool %s socket %d\n",
+			       queue_info.conf.offloads,
+			       queue_info.mp->name,
+			       queue_info.mp->socket_id);
+		}
+
+		for (j = 0; j < dev_info.nb_tx_queues; j++) {
+			struct rte_eth_txq_info queue_info;
+			int count;
+
+			ret = rte_eth_tx_queue_info_get(i, j, &queue_info);
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - tx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+
+			count = eth_tx_queue_available(i, j, queue_info.nb_desc);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%d", queue_info.nb_desc);
+
+			if (queue_info.conf.tx_deferred_start)
+				printf(" deferred_start");
+
+			printf(" offloads %#"PRIx64"\n",
+			       queue_info.conf.offloads);
 		}
 
 		ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
Signature · 1 line
2.27.0
#60 lore raw

PATCH v5 7/8 app/proc-info: add crypto security context info

In reply to Stephen Hemminger

From: Hemant Agrawal <[email protected]>

If crypto context is not present, no point in displaying it.

This patch adds the crypto based security context info. Also improve the flag printing to SECURITY OFFLOAD from INLINE.

Use common code for displaying crypto context information when doing show_ports and show_crypto.

---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 34 deletions(-)
app/proc-info/main.c +46 -34
index 4e2e647498ff..282af670d20a 100644
@@ -673,6 +673,32 @@ eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
 	return count;
 }
 
+static void
+show_security_context(uint16_t portid)
+{
+	void *p_ctx = rte_eth_dev_get_sec_ctx(portid);
+	const struct rte_security_capability *s_cap;
+
+	if (p_ctx == NULL)
+		return;
+
+	printf("  - crypto context\n");
+	printf("\t  -- security context - %p\n", p_ctx);
+	printf("\t  -- size %u\n",
+	       rte_security_session_get_size(p_ctx));
+
+	s_cap = rte_security_capabilities_get(p_ctx);
+	if (s_cap) {
+		printf("\t  -- action (0x%x), protocol (0x%x),"
+		       " offload flags (0x%x)\n",
+		       s_cap->action,
+		       s_cap->protocol,
+		       s_cap->ol_flags);
+		printf("\t  -- capabilities - oper type %x\n",
+		       s_cap->crypto_capabilities->op);
+	}
+}
+
 static void
 show_port(void)
 {
@@ -841,26 +867,8 @@ show_port(void)
 			}
 		}
 
-		printf("  - cyrpto context\n");
 #ifdef RTE_LIBRTE_SECURITY
-		void *p_ctx = rte_eth_dev_get_sec_ctx(i);
-		printf("\t  -- security context - %p\n", p_ctx);
-
-		if (p_ctx) {
-			printf("\t  -- size %u\n",
-					rte_security_session_get_size(p_ctx));
-			const struct rte_security_capability *s_cap =
-				rte_security_capabilities_get(p_ctx);
-			if (s_cap) {
-				printf("\t  -- action (0x%x), protocol (0x%x),"
-						" offload flags (0x%x)\n",
-						s_cap->action,
-						s_cap->protocol,
-						s_cap->ol_flags);
-				printf("\t  -- capabilities - oper type %x\n",
-						s_cap->crypto_capabilities->op);
-			}
-		}
+		show_security_context(i);
 #endif
 	}
 }
@@ -1166,7 +1174,7 @@ display_crypto_feature_info(uint64_t x)
 	printf("\t\t  + AESNI: CPU (%c), HW (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_AESNI) ? 'y' : 'n',
 		(x & RTE_CRYPTODEV_FF_HW_ACCELERATED) ? 'y' : 'n');
-	printf("\t\t  + INLINE (%c)\n",
+	printf("\t\t  + SECURITY OFFLOAD (%c)\n",
 		(x & RTE_CRYPTODEV_FF_SECURITY) ? 'y' : 'n');
 	printf("\t\t  + ARM: NEON (%c), CE (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_NEON) ? 'y' : 'n',
@@ -1200,14 +1208,14 @@ show_crypto(void)
 
 		printf("  - device (%u)\n", i);
 		printf("\t  -- name (%s)\n"
-			"\t  -- driver (%s)\n"
-			"\t  -- id (%u) on socket (%d)\n"
-			"\t  -- queue pairs (%d)\n",
-			rte_cryptodev_name_get(i),
-			dev_info.driver_name,
-			dev_info.driver_id,
-			dev_info.device->numa_node,
-			rte_cryptodev_queue_pair_count(i));
+		       "\t  -- driver (%s)\n"
+		       "\t  -- id (%u) on socket (%d)\n"
+		       "\t  -- queue pairs (%d)\n",
+		       rte_cryptodev_name_get(i),
+		       dev_info.driver_name,
+		       dev_info.driver_id,
+		       dev_info.device->numa_node,
+		       rte_cryptodev_queue_pair_count(i));
 
 		display_crypto_feature_info(dev_info.feature_flags);
 
@@ -1215,14 +1223,18 @@ show_crypto(void)
 		if (rte_cryptodev_stats_get(i, &stats) == 0) {
 			printf("\t  -- stats\n");
 			printf("\t\t  + enqueue count (%"PRIu64")"
-				" error (%"PRIu64")\n",
-				stats.enqueued_count,
-				stats.enqueue_err_count);
+			       " error (%"PRIu64")\n",
+			       stats.enqueued_count,
+			       stats.enqueue_err_count);
 			printf("\t\t  + dequeue count (%"PRIu64")"
-				" error (%"PRIu64")\n",
-				stats.dequeued_count,
-				stats.dequeue_err_count);
+			       " error (%"PRIu64")\n",
+			       stats.dequeued_count,
+			       stats.dequeue_err_count);
 		}
+
+#ifdef RTE_LIBRTE_SECURITY
+		show_security_context(i);
+#endif
 	}
 }
 
Signature · 1 line
2.27.0
#61 lore raw

PATCH v5 8/8 app/proc-info: provide way to request info on owned ports

In reply to Stephen Hemminger

There are cases where a port maybe owned by another (failsafe, netvsc, bond); but currently proc-info has no way to look at stats of those ports. This patch provides way for the user to explicitly ask for these ports.

If no portmask is given the output is unchanged; it only shows the top level ports. If portmask requests a specific port it will be shown even if owned.

Increase the size of port mask variable to unsigned long to allow up to 64 ports to be handled on 64 bit architecture.

The device owner is also a useful thing to show in port info.

---
 app/proc-info/main.c | 92 ++++++++++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 38 deletions(-)
app/proc-info/main.c +54 -38
index 282af670d20a..f78cc0f59c74 100644
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <unistd.h>
+#include <strings.h>
 
 #include <rte_eal.h>
 #include <rte_common.h>
@@ -46,7 +47,7 @@
 	STATS_BDR_FMT, s, w, STATS_BDR_FMT)
 
 /**< mask of enabled ports */
-static uint32_t enabled_port_mask;
+static unsigned long enabled_port_mask;
 /**< Enable stats. */
 static uint32_t enable_stats;
 /**< Enable xstats. */
@@ -128,23 +129,17 @@ static int
 parse_portmask(const char *portmask)
 {
 	char *end = NULL;
-	unsigned long pm;
 
 	errno = 0;
 
 	/* parse hexadecimal string */
-	pm = strtoul(portmask, &end, 16);
-	if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0') ||
-		(errno != 0)) {
-		printf("%s ERROR parsing the port mask\n", __func__);
+	enabled_port_mask = strtoul(portmask, &end, 16);
+	if (portmask[0] == '\0' || end == NULL || *end != '\0' || errno != 0) {
+		fprintf(stderr, "Invalid portmask '%s'\n", portmask);
 		return -1;
 	}
 
-	if (pm == 0)
-		return -1;
-
-	return pm;
-
+	return 0;
 }
 
 /*
@@ -242,9 +237,7 @@ proc_info_parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'p':
-			enabled_port_mask = parse_portmask(optarg);
-			if (enabled_port_mask == 0) {
-				printf("invalid portmask\n");
+			if (parse_portmask(optarg) < 0) {
 				proc_info_usage(prgname);
 				return -1;
 			}
@@ -702,19 +695,27 @@ show_security_context(uint16_t portid)
 static void
 show_port(void)
 {
-	uint16_t i = 0;
-	int ret = 0, j, k;
+	int i, ret, j, k;
 
 	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
-	RTE_ETH_FOREACH_DEV(i) {
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
 		struct rte_eth_rss_conf rss_conf;
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
+		struct rte_eth_dev_owner owner;
+
+		/* Skip if port is not in mask */
+		if ((enabled_port_mask & (1ul << i)) == 0)
+			continue;
+
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -733,6 +734,11 @@ show_port(void)
 		       dev_info.driver_name, dev_info.device->name,
 		       rte_eth_dev_socket_id(i));
 
+		ret = rte_eth_dev_owner_get(i, &owner);
+		if (ret == 0 && owner.id != RTE_ETH_DEV_NO_OWNER)
+			printf("\t --  owner %#"PRIx64":%s\n",
+			       owner.id, owner.name);
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			printf("Link get failed (port %u): %s\n",
@@ -1412,28 +1418,38 @@ main(int argc, char **argv)
 	if (nb_ports == 0)
 		rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
 
-	/* If no port mask was specified*/
-	if (enabled_port_mask == 0)
-		enabled_port_mask = 0xffff;
+	/* If no port mask was specified, then show non-owned ports */
+	if (enabled_port_mask == 0) {
+		RTE_ETH_FOREACH_DEV(i)
+			enabled_port_mask = 1ul << i;
+	}
+
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+
+		/* Skip if port is not in mask */
+		if ((enabled_port_mask & (1ul << i)) == 0)
+			continue;
+
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
+
+		if (enable_stats)
+			nic_stats_display(i);
+		else if (enable_xstats)
+			nic_xstats_display(i);
+		else if (reset_stats)
+			nic_stats_clear(i);
+		else if (reset_xstats)
+			nic_xstats_clear(i);
+		else if (enable_xstats_name)
+			nic_xstats_by_name_display(i, xstats_name);
+		else if (nb_xstats_ids > 0)
+			nic_xstats_by_ids_display(i, xstats_ids,
+						  nb_xstats_ids);
+		else if (enable_metrics)
+			metrics_display(i);
 
-	RTE_ETH_FOREACH_DEV(i) {
-		if (enabled_port_mask & (1 << i)) {
-			if (enable_stats)
-				nic_stats_display(i);
-			else if (enable_xstats)
-				nic_xstats_display(i);
-			else if (reset_stats)
-				nic_stats_clear(i);
-			else if (reset_xstats)
-				nic_xstats_clear(i);
-			else if (enable_xstats_name)
-				nic_xstats_by_name_display(i, xstats_name);
-			else if (nb_xstats_ids > 0)
-				nic_xstats_by_ids_display(i, xstats_ids,
-						nb_xstats_ids);
-			else if (enable_metrics)
-				metrics_display(i);
-		}
 	}
 
 	/* print port independent stats */
Signature · 1 line
2.27.0
#62 lore raw

Re: [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements

In reply to Stephen Hemminger
Quoted 24 lines · On Tue, 28 Jul 2020 12:13:22 -0700 Stephen Hemminger…

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

v5 - add mempool name to queue info
fix trailing whitespace
v4 - incorporate mempool display
modify portmask for handling owned ports
v3 - consolidate chages for displaying crypto info v2 - fix checkpatch complaints

Hemant Agrawal (2):
app/proc-info: enhance mempool to print ops name app/proc-info: add crypto security context info

Stephen Hemminger (6):
app/proc-info: remove unused logtype #define app/proc-info: eliminate useless borders app/proc-info: hide EAL info messages app/proc-info: add more info to show_ports app/proc-info: dump rx and tx descriptor info app/proc-info: provide way to request info on owned ports

Quoted 3 lines
 app/proc-info/main.c | 392 ++++++++++++++++++++++++++++---------------
 1 file changed, 257 insertions(+), 135 deletions(-)

Why is this still not merged, there is no outstanding feedback, and more patches to proc-info seem to keep coming?

#63 lore raw

v6 cover app/proc-info: enhancements

In reply to Stephen Hemminger

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

A before/after example:

 # dpdk-proc-info -w 03:00.0 -- --show-port
EAL: Detected 8 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket_23602_5b92232fa062
EAL: Selected IOVA mode 'VA'
EAL: Probing VFIO support...
EAL: Probe PCI driver: mlx5_pci (15b3:1013) device: 0000:03:00.0 (socket 0)
EAL: No legacy callbacks, legacy socket not created
========== show - Port PMD 3490000000==========
===== Port (0)=====
  - generic config
	  -- Socket 0
Link get failed (port 0): Operation not supported
	  -- promiscuous (1)
	  -- mtu (1500)
  - queue
	  -- queue 0 rx scatter 0 descriptors 256 offloads 0x0 mempool socket 0
  - cyrpto context
	  -- security context - (nil)
================================================================================
======================================== ========================================

After:

 # dpdk-proc-info -w 03:00.0 -- --show-port
EAL: No legacy callbacks, legacy socket not created
========== show - Port PMD ==========
===== Port 0 =====
  - generic config
	  -- driver mlx5_pci device 03:00.0 socket 0
Link get failed (port 0): Operation not supported
	  -- mac EC:0D:9A:37:D8:86
	  -- promiscuous mode enabled
	  -- all multicast mode disabled
	  -- mtu (1500)
  - rx queue
	  -- 0 descriptors 4096 drop_en mempool mbuf_pool_socket_0 socket 0 offloads : RSS_HASH
	  -- 1 descriptors 4096 drop_en mempool mbuf_pool_socket_0 socket 0 offloads : RSS_HASH
	  -- 2 descriptors 4096 drop_en mempool mbuf_pool_socket_0 socket 0 offloads : RSS_HASH
	  -- 3 descriptors 4096 drop_en mempool mbuf_pool_socket_0 socket 0 offloads : RSS_HASH
  - tx queue
	  -- 0 descriptors 4096 thresh 0/0
	  -- 1 descriptors 4096 thresh 0/0
	  -- 2 descriptors 4096 thresh 0/0
	  -- 3 descriptors 4096 thresh 0/0

History:
v6 - rebase to main and dump offload information

v5 - add mempool name to queue info
fix trailing whitespace
v4 - incorporate mempool display
modify portmask for handling owned ports
v3 - consolidate chages for displaying crypto info v2 - fix checkpatch complaints

Hemant Agrawal (1):
app/proc-info: add crypto security context info

Stephen Hemminger (6):
app/proc-info: remove unused logtype #define app/proc-info: eliminate useless borders app/proc-info: hide EAL info messages app/proc-info: add more info to show_ports app/proc-info: dump rx and tx descriptor info app/proc-info: provide way to request info on owned ports

 app/proc-info/main.c | 371 +++++++++++++++++++++++++++----------------
 1 file changed, 237 insertions(+), 134 deletions(-)
Signature · 1 line
2.27.0
#64 lore raw

PATCH v6 1/7 app/proc-info: remove unused logtype #define

This logtype is defined but never used.

---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)
app/proc-info/main.c +0 -2
index 64fb83b38dd4..1623c3723b3e 100644
@@ -39,8 +39,6 @@
 
 /* Maximum long option length for option parsing. */
 #define MAX_LONG_OPT_SZ 64
-#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
-
 #define MAX_STRING_LEN 256
 
 #define STATS_BDR_FMT "========================================"
Signature · 1 line
2.27.0
#65 lore raw

PATCH v6 2/7 app/proc-info: eliminate useless borders

In reply to Stephen Hemminger

Printing extra borders does not improve readability, and is just unnecessary. Putting TSC hz in header also makes no sense here.

---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)
app/proc-info/main.c +7 -28
index 1623c3723b3e..6cf5bb4ea48a 100644
@@ -660,8 +660,7 @@ show_port(void)
 	uint16_t i = 0;
 	int ret = 0, j, k;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -674,7 +673,7 @@ show_port(void)
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
-		snprintf(bdr_str, MAX_STRING_LEN, " Port (%u)", i);
+		snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i);
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
@@ -758,8 +757,6 @@ show_port(void)
 		}
 #endif
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -845,8 +842,7 @@ show_tm(void)
 	unsigned int j, k;
 	uint16_t i = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - TM PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	RTE_ETH_FOREACH_DEV(i) {
@@ -1042,8 +1038,6 @@ show_tm(void)
 				stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1089,8 +1083,7 @@ show_crypto(void)
 {
 	uint8_t crypto_dev_count = rte_cryptodev_count(), i;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - CRYPTO PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
 	for (i = 0; i < crypto_dev_count; i++) {
@@ -1125,15 +1118,12 @@ show_crypto(void)
 				stats.dequeue_err_count);
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 static void
 show_ring(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " show - RING %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - RING ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1164,7 +1154,6 @@ show_ring(char *name)
 	}
 
 	rte_ring_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1172,8 +1161,7 @@ show_mempool(char *name)
 {
 	uint64_t flags = 0;
 
-	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " show - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1210,13 +1198,11 @@ show_mempool(char *name)
 				rte_mempool_avail_count(ptr),
 				rte_mempool_in_use_count(ptr));
 
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
 
 	rte_mempool_list_dump(stdout);
-	STATS_BDR_STR(50, "");
 }
 
 static void
@@ -1234,8 +1220,7 @@ mempool_itr_obj(struct rte_mempool *mp, void *opaque,
 static void
 iter_mempool(char *name)
 {
-	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL %"PRIu64,
-			rte_get_tsc_hz());
+	snprintf(bdr_str, MAX_STRING_LEN, " iter - MEMPOOL ");
 	STATS_BDR_STR(10, bdr_str);
 
 	if (name != NULL) {
@@ -1245,12 +1230,9 @@ iter_mempool(char *name)
 			uint32_t ret = rte_mempool_obj_iter(ptr,
 					mempool_itr_obj, NULL);
 			printf("\n  - iterated %u objects\n", ret);
-			STATS_BDR_STR(50, "");
 			return;
 		}
 	}
-
-	STATS_BDR_STR(50, "");
 }
 
 int
@@ -1351,8 +1333,5 @@ main(int argc, char **argv)
 	if (ret)
 		printf("Error from rte_eal_cleanup(), %d\n", ret);
 
-	strlcpy(bdr_str, " ", MAX_STRING_LEN);
-	STATS_BDR_STR(50, bdr_str);
-
 	return 0;
 }
Signature · 1 line
2.27.0
#66 lore raw

PATCH v6 3/7 app/proc-info: hide EAL info messages

In reply to Stephen Hemminger

The DPDK EAL info messages at the start of a diagnostic application are not helpful to end user. Suppress them by setting log-level by default.

---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
app/proc-info/main.c +6 -4
index 6cf5bb4ea48a..66918a834877 100644
@@ -1243,7 +1243,8 @@ main(int argc, char **argv)
 	char c_flag[] = "-c1";
 	char n_flag[] = "-n4";
 	char mp_flag[] = "--proc-type=secondary";
-	char *argp[argc + 3];
+	char log_flag[] = "--log-level=6";
+	char *argp[argc + 4];
 	uint16_t nb_ports;
 
 	/* preparse app arguments */
@@ -1257,18 +1258,19 @@ main(int argc, char **argv)
 	argp[1] = c_flag;
 	argp[2] = n_flag;
 	argp[3] = mp_flag;
+	argp[4] = log_flag;
 
 	for (i = 1; i < argc; i++)
-		argp[i + 3] = argv[i];
+		argp[i + 4] = argv[i];
 
-	argc += 3;
+	argc += 4;
 
 	ret = rte_eal_init(argc, argp);
 	if (ret < 0)
 		rte_panic("Cannot init EAL\n");
 
 	argc -= ret;
-	argv += (ret - 3);
+	argv += ret - 4;
 
 	if (!rte_eal_primary_proc_alive(NULL))
 		rte_exit(EXIT_FAILURE, "No primary DPDK process is running.\n");
Signature · 1 line
2.27.0
#67 lore raw

PATCH v6 4/7 app/proc-info: add more info to show_ports

In reply to Stephen Hemminger

Revise the display of port information to include more data and be more human friendly.

* Show driver and device information
* Show MAC address
* Show flow control information
* Combine lines if possible
* Show all multicast mode
* Show queue mempool name

---
 app/proc-info/main.c | 77 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 59 insertions(+), 18 deletions(-)
app/proc-info/main.c +59 -18
index 66918a834877..ab754daefa50 100644
@@ -670,6 +670,8 @@ show_port(void)
 		struct rte_eth_rxq_info queue_info;
 		struct rte_eth_rss_conf rss_conf;
 		char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
+		struct rte_eth_fc_conf fc_conf;
+		struct rte_ether_addr mac;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -677,7 +679,17 @@ show_port(void)
 		STATS_BDR_STR(5, bdr_str);
 		printf("  - generic config\n");
 
-		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
+		ret = rte_eth_dev_info_get(i, &dev_info);
+		if (ret != 0) {
+			printf("Error during getting device info: %s\n",
+				strerror(-ret));
+			return;
+		}
+
+		printf("\t  -- driver %s device %s socket %d\n",
+		       dev_info.driver_name, dev_info.device->name,
+		       rte_eth_dev_socket_id(i));
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			printf("Link get failed (port %u): %s\n",
@@ -688,32 +700,56 @@ show_port(void)
 					&link);
 			printf("\t%s\n", link_status_text);
 		}
-		printf("\t  -- promiscuous (%d)\n",
-				rte_eth_promiscuous_get(i));
+
+		ret = rte_eth_dev_flow_ctrl_get(i, &fc_conf);
+		if (ret == 0 && fc_conf.mode != RTE_FC_NONE)  {
+			printf("\t  -- flow control mode %s%s high %u low %u pause %u%s%s\n",
+			       fc_conf.mode == RTE_FC_RX_PAUSE ? "rx " :
+			       fc_conf.mode == RTE_FC_TX_PAUSE ? "tx " :
+			       fc_conf.mode == RTE_FC_FULL ? "full" : "???",
+			       fc_conf.autoneg ? " auto" : "",
+			       fc_conf.high_water,
+			       fc_conf.low_water,
+			       fc_conf.pause_time,
+			       fc_conf.send_xon ? " xon" : "",
+			       fc_conf.mac_ctrl_frame_fwd ? " mac_ctrl" : "");
+		}
+
+		ret = rte_eth_macaddr_get(i, &mac);
+		if (ret == 0) {
+			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
+			printf("\t  -- mac %s\n", ebuf);
+		}
+
+		ret = rte_eth_promiscuous_get(i);
+		if (ret >= 0)
+			printf("\t  -- promiscuous mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
+		ret = rte_eth_allmulticast_get(i);
+		if (ret >= 0)
+			printf("\t  -- all multicast mode %s\n",
+			       ret > 0 ? "enabled" : "disabled");
+
 		ret = rte_eth_dev_get_mtu(i, &mtu);
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		ret = rte_eth_dev_info_get(i, &dev_info);
-		if (ret != 0) {
-			printf("Error during getting device (port %u) info: %s\n",
-				i, strerror(-ret));
-			return;
-		}
-
 		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
 			if (ret == 0) {
 				printf("\t  -- queue %u rx scatter %u"
-						" descriptors %u"
-						" offloads 0x%" PRIx64
-						" mempool socket %d",
-						j,
-						queue_info.scattered_rx,
-						queue_info.nb_desc,
-						queue_info.conf.offloads,
-						queue_info.mp->socket_id);
+				       " descriptors %u"
+				       " offloads %#" PRIx64
+				       " mempool name %s socket %d",
+				       j,
+				       queue_info.scattered_rx,
+				       queue_info.nb_desc,
+				       queue_info.conf.offloads,
+				       queue_info.mp->name,
+				       queue_info.mp->socket_id);
 
 				if (queue_info.rx_buf_size != 0)
 					printf(" rx buffer size %u",
@@ -1167,7 +1203,10 @@ show_mempool(char *name)
 	if (name != NULL) {
 		struct rte_mempool *ptr = rte_mempool_lookup(name);
 		if (ptr != NULL) {
+			struct rte_mempool_ops *ops;
+
 			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"
@@ -1197,6 +1236,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");
 
 			return;
 		}
Signature · 1 line
2.27.0
#68 lore raw

PATCH v6 5/7 app/proc-info: dump rx and tx descriptor info

In reply to Stephen Hemminger

Many drivers will report per queue info
as well as how many descriptors are in use.
Also display per-queue offload flags.

---
 app/proc-info/main.c | 93 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 74 insertions(+), 19 deletions(-)
app/proc-info/main.c +74 -19
index ab754daefa50..c36f9f4d7471 100644
@@ -654,6 +654,18 @@ metrics_display(int port_id)
 	rte_free(names);
 }
 
+static void
+show_offloads(uint64_t offloads,
+	      const char *(show_offload)(uint64_t))
+{
+	printf(" offloads :");
+	while (offloads != 0) {
+		uint64_t offload_flag = 1ULL << __builtin_ctzll(offloads);
+		printf(" %s", show_offload(offload_flag));
+		offloads &= ~offload_flag;
+ 	}
+}
+
 static void
 show_port(void)
 {
@@ -667,7 +679,6 @@ show_port(void)
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
-		struct rte_eth_rxq_info queue_info;
 		struct rte_eth_rss_conf rss_conf;
 		char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
 		struct rte_eth_fc_conf fc_conf;
@@ -718,6 +729,7 @@ show_port(void)
 		ret = rte_eth_macaddr_get(i, &mac);
 		if (ret == 0) {
 			char ebuf[RTE_ETHER_ADDR_FMT_SIZE];
+
 			rte_ether_format_addr(ebuf, sizeof(ebuf), &mac);
 			printf("\t  -- mac %s\n", ebuf);
 		}
@@ -736,26 +748,69 @@ show_port(void)
 		if (ret == 0)
 			printf("\t  -- mtu (%d)\n", mtu);
 
-		printf("  - queue\n");
 		for (j = 0; j < dev_info.nb_rx_queues; j++) {
+			struct rte_eth_rxq_info queue_info;
+			int count;
+
 			ret = rte_eth_rx_queue_info_get(i, j, &queue_info);
-			if (ret == 0) {
-				printf("\t  -- queue %u rx scatter %u"
-				       " descriptors %u"
-				       " offloads %#" PRIx64
-				       " mempool name %s socket %d",
-				       j,
-				       queue_info.scattered_rx,
-				       queue_info.nb_desc,
-				       queue_info.conf.offloads,
-				       queue_info.mp->name,
-				       queue_info.mp->socket_id);
-
-				if (queue_info.rx_buf_size != 0)
-					printf(" rx buffer size %u",
-						queue_info.rx_buf_size);
-				printf("\n");
-			}
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - rx queue\n");
+
+			printf("\t  -- %d descriptors ", j);
+			count = rte_eth_rx_queue_count(i, j);
+			if (count >= 0)
+				printf("%d/", count);
+			printf("%u", queue_info.nb_desc);
+
+			if (queue_info.scattered_rx)
+				printf(" scattered");
+
+			if (queue_info.conf.rx_drop_en)
+				printf(" drop_en");
+
+			if (queue_info.conf.rx_deferred_start)
+				printf(" deferred_start");
+
+			if (queue_info.rx_buf_size != 0)
+				printf(" rx buffer size %u",
+				       queue_info.rx_buf_size);
+
+			printf(" mempool %s socket %d",
+			       queue_info.mp->name,
+			       queue_info.mp->socket_id);
+
+			if (queue_info.conf.offloads != 0)
+				show_offloads(queue_info.conf.offloads, rte_eth_dev_rx_offload_name);
+
+			printf("\n");
+		}
+
+		for (j = 0; j < dev_info.nb_tx_queues; j++) {
+			struct rte_eth_txq_info queue_info;
+
+			ret = rte_eth_tx_queue_info_get(i, j, &queue_info);
+			if (ret != 0)
+				break;
+
+			if (j == 0)
+				printf("  - tx queue\n");
+
+			printf("\t  -- %d descriptors %d",
+			       j, queue_info.nb_desc);
+
+			printf(" thresh %u/%u",
+			       queue_info.conf.tx_rs_thresh,
+			       queue_info.conf.tx_free_thresh);
+
+			if (queue_info.conf.tx_deferred_start)
+				printf(" deferred_start");
+
+			if (queue_info.conf.offloads != 0)
+				show_offloads(queue_info.conf.offloads, rte_eth_dev_tx_offload_name);
+			printf("\n");
 		}
 
 		ret = rte_eth_dev_rss_hash_conf_get(i, &rss_conf);
Signature · 1 line
2.27.0
#69 lore raw

PATCH v6 6/7 app/proc-info: add crypto security context info

In reply to Stephen Hemminger

From: Hemant Agrawal <[email protected]>

If crypto context is not present, no point in displaying it.

This patch adds the crypto based security context info. Also improve the flag printing to SECURITY OFFLOAD from INLINE.

Use common code for displaying crypto context information when doing show_ports and show_crypto.

---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 34 deletions(-)
app/proc-info/main.c +46 -34
index c36f9f4d7471..e90e9aba080e 100644
@@ -654,6 +654,32 @@ metrics_display(int port_id)
 	rte_free(names);
 }
 
+static void
+show_security_context(uint16_t portid)
+{
+	void *p_ctx = rte_eth_dev_get_sec_ctx(portid);
+	const struct rte_security_capability *s_cap;
+
+	if (p_ctx == NULL)
+		return;
+
+	printf("  - crypto context\n");
+	printf("\t  -- security context - %p\n", p_ctx);
+	printf("\t  -- size %u\n",
+	       rte_security_session_get_size(p_ctx));
+
+	s_cap = rte_security_capabilities_get(p_ctx);
+	if (s_cap) {
+		printf("\t  -- action (0x%x), protocol (0x%x),"
+		       " offload flags (0x%x)\n",
+		       s_cap->action,
+		       s_cap->protocol,
+		       s_cap->ol_flags);
+		printf("\t  -- capabilities - oper type %x\n",
+		       s_cap->crypto_capabilities->op);
+	}
+}
+
 static void
 show_offloads(uint64_t offloads,
 	      const char *(show_offload)(uint64_t))
@@ -826,26 +852,8 @@ show_port(void)
 			}
 		}
 
-		printf("  - cyrpto context\n");
 #ifdef RTE_LIBRTE_SECURITY
-		void *p_ctx = rte_eth_dev_get_sec_ctx(i);
-		printf("\t  -- security context - %p\n", p_ctx);
-
-		if (p_ctx) {
-			printf("\t  -- size %u\n",
-					rte_security_session_get_size(p_ctx));
-			const struct rte_security_capability *s_cap =
-				rte_security_capabilities_get(p_ctx);
-			if (s_cap) {
-				printf("\t  -- action (0x%x), protocol (0x%x),"
-						" offload flags (0x%x)\n",
-						s_cap->action,
-						s_cap->protocol,
-						s_cap->ol_flags);
-				printf("\t  -- capabilities - oper type %x\n",
-						s_cap->crypto_capabilities->op);
-			}
-		}
+		show_security_context(i);
 #endif
 	}
 }
@@ -1151,7 +1159,7 @@ display_crypto_feature_info(uint64_t x)
 	printf("\t\t  + AESNI: CPU (%c), HW (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_AESNI) ? 'y' : 'n',
 		(x & RTE_CRYPTODEV_FF_HW_ACCELERATED) ? 'y' : 'n');
-	printf("\t\t  + INLINE (%c)\n",
+	printf("\t\t  + SECURITY OFFLOAD (%c)\n",
 		(x & RTE_CRYPTODEV_FF_SECURITY) ? 'y' : 'n');
 	printf("\t\t  + ARM: NEON (%c), CE (%c)\n",
 		(x & RTE_CRYPTODEV_FF_CPU_NEON) ? 'y' : 'n',
@@ -1185,14 +1193,14 @@ show_crypto(void)
 
 		printf("  - device (%u)\n", i);
 		printf("\t  -- name (%s)\n"
-			"\t  -- driver (%s)\n"
-			"\t  -- id (%u) on socket (%d)\n"
-			"\t  -- queue pairs (%d)\n",
-			rte_cryptodev_name_get(i),
-			dev_info.driver_name,
-			dev_info.driver_id,
-			dev_info.device->numa_node,
-			rte_cryptodev_queue_pair_count(i));
+		       "\t  -- driver (%s)\n"
+		       "\t  -- id (%u) on socket (%d)\n"
+		       "\t  -- queue pairs (%d)\n",
+		       rte_cryptodev_name_get(i),
+		       dev_info.driver_name,
+		       dev_info.driver_id,
+		       dev_info.device->numa_node,
+		       rte_cryptodev_queue_pair_count(i));
 
 		display_crypto_feature_info(dev_info.feature_flags);
 
@@ -1200,14 +1208,18 @@ show_crypto(void)
 		if (rte_cryptodev_stats_get(i, &stats) == 0) {
 			printf("\t  -- stats\n");
 			printf("\t\t  + enqueue count (%"PRIu64")"
-				" error (%"PRIu64")\n",
-				stats.enqueued_count,
-				stats.enqueue_err_count);
+			       " error (%"PRIu64")\n",
+			       stats.enqueued_count,
+			       stats.enqueue_err_count);
 			printf("\t\t  + dequeue count (%"PRIu64")"
-				" error (%"PRIu64")\n",
-				stats.dequeued_count,
-				stats.dequeue_err_count);
+			       " error (%"PRIu64")\n",
+			       stats.dequeued_count,
+			       stats.dequeue_err_count);
 		}
+
+#ifdef RTE_LIBRTE_SECURITY
+		show_security_context(i);
+#endif
 	}
 }
 
Signature · 1 line
2.27.0
#70 lore raw

PATCH v6 7/7 app/proc-info: provide way to request info on owned ports

In reply to Stephen Hemminger

There are cases where a port maybe owned by another (failsafe, netvsc, bond); but currently proc-info has no way to look at stats of those ports. This patch provides way for the user to explicitly ask for these ports.

If no portmask is given the output is unchanged; it only shows the top level ports. If portmask requests a specific port it will be shown even if owned.

Increase the size of port mask variable to unsigned long to allow up to 64 ports to be handled on 64 bit architecture.

The device owner is also a useful thing to show in port info.

---
 app/proc-info/main.c | 92 ++++++++++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 38 deletions(-)
app/proc-info/main.c +54 -38
index e90e9aba080e..267e16bc318b 100644
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <unistd.h>
+#include <strings.h>
 
 #include <rte_eal.h>
 #include <rte_common.h>
@@ -46,7 +47,7 @@
 	STATS_BDR_FMT, s, w, STATS_BDR_FMT)
 
 /**< mask of enabled ports */
-static uint32_t enabled_port_mask;
+static unsigned long enabled_port_mask;
 /**< Enable stats. */
 static uint32_t enable_stats;
 /**< Enable xstats. */
@@ -128,23 +129,17 @@ static int
 parse_portmask(const char *portmask)
 {
 	char *end = NULL;
-	unsigned long pm;
 
 	errno = 0;
 
 	/* parse hexadecimal string */
-	pm = strtoul(portmask, &end, 16);
-	if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0') ||
-		(errno != 0)) {
-		printf("%s ERROR parsing the port mask\n", __func__);
+	enabled_port_mask = strtoul(portmask, &end, 16);
+	if (portmask[0] == '\0' || end == NULL || *end != '\0' || errno != 0) {
+		fprintf(stderr, "Invalid portmask '%s'\n", portmask);
 		return -1;
 	}
 
-	if (pm == 0)
-		return -1;
-
-	return pm;
-
+	return 0;
 }
 
 /*
@@ -242,9 +237,7 @@ proc_info_parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'p':
-			enabled_port_mask = parse_portmask(optarg);
-			if (enabled_port_mask == 0) {
-				printf("invalid portmask\n");
+			if (parse_portmask(optarg) < 0) {
 				proc_info_usage(prgname);
 				return -1;
 			}
@@ -695,13 +688,12 @@ show_offloads(uint64_t offloads,
 static void
 show_port(void)
 {
-	uint16_t i = 0;
-	int ret = 0, j, k;
+	int i, ret, j, k;
 
 	snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD ");
 	STATS_BDR_STR(10, bdr_str);
 
-	RTE_ETH_FOREACH_DEV(i) {
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
 		uint16_t mtu = 0;
 		struct rte_eth_link link;
 		struct rte_eth_dev_info dev_info;
@@ -709,6 +701,15 @@ show_port(void)
 		char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
 		struct rte_eth_fc_conf fc_conf;
 		struct rte_ether_addr mac;
+		struct rte_eth_dev_owner owner;
+
+		/* Skip if port is not in mask */
+		if ((enabled_port_mask & (1ul << i)) == 0)
+			continue;
+
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -727,6 +728,11 @@ show_port(void)
 		       dev_info.driver_name, dev_info.device->name,
 		       rte_eth_dev_socket_id(i));
 
+		ret = rte_eth_dev_owner_get(i, &owner);
+		if (ret == 0 && owner.id != RTE_ETH_DEV_NO_OWNER)
+			printf("\t --  owner %#"PRIx64":%s\n",
+			       owner.id, owner.name);
+
 		ret = rte_eth_link_get(i, &link);
 		if (ret < 0) {
 			printf("Link get failed (port %u): %s\n",
@@ -1397,28 +1403,38 @@ main(int argc, char **argv)
 	if (nb_ports == 0)
 		rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
 
-	/* If no port mask was specified*/
-	if (enabled_port_mask == 0)
-		enabled_port_mask = 0xffff;
+	/* If no port mask was specified, then show non-owned ports */
+	if (enabled_port_mask == 0) {
+		RTE_ETH_FOREACH_DEV(i)
+			enabled_port_mask = 1ul << i;
+	}
+
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+
+		/* Skip if port is not in mask */
+		if ((enabled_port_mask & (1ul << i)) == 0)
+			continue;
+
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
+
+		if (enable_stats)
+			nic_stats_display(i);
+		else if (enable_xstats)
+			nic_xstats_display(i);
+		else if (reset_stats)
+			nic_stats_clear(i);
+		else if (reset_xstats)
+			nic_xstats_clear(i);
+		else if (enable_xstats_name)
+			nic_xstats_by_name_display(i, xstats_name);
+		else if (nb_xstats_ids > 0)
+			nic_xstats_by_ids_display(i, xstats_ids,
+						  nb_xstats_ids);
+		else if (enable_metrics)
+			metrics_display(i);
 
-	RTE_ETH_FOREACH_DEV(i) {
-		if (enabled_port_mask & (1 << i)) {
-			if (enable_stats)
-				nic_stats_display(i);
-			else if (enable_xstats)
-				nic_xstats_display(i);
-			else if (reset_stats)
-				nic_stats_clear(i);
-			else if (reset_xstats)
-				nic_xstats_clear(i);
-			else if (enable_xstats_name)
-				nic_xstats_by_name_display(i, xstats_name);
-			else if (nb_xstats_ids > 0)
-				nic_xstats_by_ids_display(i, xstats_ids,
-						nb_xstats_ids);
-			else if (enable_metrics)
-				metrics_display(i);
-		}
 	}
 
 	/* print port independent stats */
Signature · 1 line
2.27.0
#71 lore raw

Re: [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements

In reply to Stephen Hemminger

24/09/2020 07:34, Stephen Hemminger:

Quoted 16 lines

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

Hemant Agrawal (1):
app/proc-info: add crypto security context info

Stephen Hemminger (6):
app/proc-info: remove unused logtype #define app/proc-info: eliminate useless borders app/proc-info: hide EAL info messages app/proc-info: add more info to show_ports app/proc-info: dump rx and tx descriptor info app/proc-info: provide way to request info on owned ports

Quoted 2 lines
 app/proc-info/main.c | 371 +++++++++++++++++++++++++++----------------
 1 file changed, 237 insertions(+), 134 deletions(-)

Applied, thanks

#72 lore raw
In reply to Stephen Hemminger
Quoted 5 lines · On Wed, 6 May 2020 12:37:34 -0700 Stephen Hemminger…

The current proc-info command is useful for diagnosing issues with external DPDK applications, but the display is limited and somewhat ugly. This patchset adds some enhancements which show more info and suppress unnecessary stuff.

I know 20.08 release was hectic but what happened, this patchset got passed over. That make me sad since it is very useful for diagnosing real issues.