DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/7] proc-info enhancements
@ 2020-05-06 19:37 Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
                   ` (11 more replies)
  0 siblings, 12 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:37 UTC (permalink / raw)
  To: dev; +Cc: 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.

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(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH 1/7] app/proc-info: remove unused logtype #define
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
@ 2020-05-06 19:37 ` Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:37 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

This logtype is defined but never used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index abeca4aab438..69e3000616c0 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 "========================================"
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH 2/7] app/proc-info: eliminate useless borders
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
@ 2020-05-06 19:37 ` Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:37 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 69e3000616c0..049818bad51f 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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;
 }
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH 3/7] app/proc-info: hide EAL info messages
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
@ 2020-05-06 19:37 ` Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:37 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 049818bad51f..e4914191bef9 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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");
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH 4/7] app/proc-info: add more info to show_ports
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
                   ` (2 preceding siblings ...)
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
@ 2020-05-06 19:37 ` Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 5/7] app/proc-info: hide crypto-context display Stephen Hemminger
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:37 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 78 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 63 insertions(+), 15 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index e4914191bef9..2f74cbf462d5 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH 5/7] app/proc-info: hide crypto-context display
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
                   ` (3 preceding siblings ...)
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
@ 2020-05-06 19:37 ` Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 6/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:37 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 2f74cbf462d5..bb0e0cbe9e6e 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 =
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH 6/7] app/proc-info: dump rx and tx descriptor info
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
                   ` (4 preceding siblings ...)
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 5/7] app/proc-info: hide crypto-context display Stephen Hemminger
@ 2020-05-06 19:37 ` Stephen Hemminger
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 7/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:37 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index bb0e0cbe9e6e..0b7ab1e78a9d 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH 7/7] app/proc-info: provide way to request info on owned ports
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
                   ` (5 preceding siblings ...)
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 6/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
@ 2020-05-06 19:37 ` Stephen Hemminger
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:37 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/Makefile |  3 ++
 app/proc-info/main.c   | 74 ++++++++++++++++++++++++++++--------------
 2 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/app/proc-info/Makefile b/app/proc-info/Makefile
index 214f3f54a1e9..f777e037861f 100644
--- a/app/proc-info/Makefile
+++ b/app/proc-info/Makefile
@@ -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
 
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 0b7ab1e78a9d..2e864519cca3 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <unistd.h>
+#include <strings.h>
 
 #include <rte_eal.h>
 #include <rte_common.h>
@@ -676,19 +677,26 @@ eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
 static void
 show_port(void)
 {
-	uint16_t i = 0;
-	int ret = 0, j, k;
+	uint32_t port_mask = enabled_port_mask;
+	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 (port_mask = enabled_port_mask; port_mask != 0;
+	     port_mask &= ~(1u << 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;
+
+		i = ffs(port_mask) - 1;
+
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -707,6 +715,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",
@@ -1342,6 +1355,7 @@ main(int argc, char **argv)
 	char log_flag[] = "--log-level=6";
 	char *argp[argc + 4];
 	uint16_t nb_ports;
+	uint32_t port_mask;
 
 	/* preparse app arguments */
 	ret = proc_info_preparse_args(argc, argv);
@@ -1385,30 +1399,42 @@ 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;
-
-	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);
+	/* If no port mask was specified, one will be provided */
+	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)) {
+		/* ffs() first bit is 1 not 0 */
+		i = ffs(port_mask) - 1;
+
+		if (i >= RTE_MAX_ETHPORTS)
+			break;
+
+		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);
+
+	}
+
 	/* print port independent stats */
 	if (enable_metrics)
 		metrics_display(RTE_METRICS_GLOBAL);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
                   ` (6 preceding siblings ...)
  2020-05-06 19:37 ` [dpdk-dev] [PATCH 7/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
@ 2020-05-06 19:57 ` Stephen Hemminger
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
                     ` (7 more replies)
  2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
                   ` (3 subsequent siblings)
  11 siblings, 8 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:57 UTC (permalink / raw)
  To: dev; +Cc: 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(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v2 1/7] app/proc-info: remove unused logtype #define
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
@ 2020-05-06 19:57   ` Stephen Hemminger
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:57 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

This logtype is defined but never used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index abeca4aab438..69e3000616c0 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 "========================================"
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v2 2/7] app/proc-info: eliminate useless borders
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
@ 2020-05-06 19:57   ` Stephen Hemminger
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:57 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 69e3000616c0..049818bad51f 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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;
 }
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v2 3/7] app/proc-info: hide EAL info messages
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
@ 2020-05-06 19:57   ` Stephen Hemminger
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:57 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 049818bad51f..e4914191bef9 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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");
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v2 4/7] app/proc-info: add more info to show_ports
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
                     ` (2 preceding siblings ...)
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
@ 2020-05-06 19:57   ` Stephen Hemminger
  2020-07-13 12:09     ` Hemant Agrawal
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 5/7] app/proc-info: hide crypto-context display Stephen Hemminger
                     ` (3 subsequent siblings)
  7 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:57 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 78 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 63 insertions(+), 15 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index e4914191bef9..c4f1f99e7d5d 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v2 5/7] app/proc-info: hide crypto-context display
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
                     ` (3 preceding siblings ...)
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
@ 2020-05-06 19:57   ` Stephen Hemminger
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 6/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:57 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index c4f1f99e7d5d..804c0fd63b3e 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 =
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v2 6/7] app/proc-info: dump rx and tx descriptor info
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
                     ` (4 preceding siblings ...)
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 5/7] app/proc-info: hide crypto-context display Stephen Hemminger
@ 2020-05-06 19:57   ` Stephen Hemminger
  2020-07-13 12:08     ` Hemant Agrawal
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 7/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
  2020-07-13 12:10   ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Hemant Agrawal
  7 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:57 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 804c0fd63b3e..00e06c986e27 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v2 7/7] app/proc-info: provide way to request info on owned ports
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
                     ` (5 preceding siblings ...)
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 6/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
@ 2020-05-06 19:57   ` Stephen Hemminger
  2020-07-13 12:10   ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Hemant Agrawal
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-05-06 19:57 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Maryam Tahhan, Reshma Pattan

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/Makefile |  3 ++
 app/proc-info/main.c   | 74 ++++++++++++++++++++++++++++--------------
 2 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/app/proc-info/Makefile b/app/proc-info/Makefile
index 214f3f54a1e9..f777e037861f 100644
--- a/app/proc-info/Makefile
+++ b/app/proc-info/Makefile
@@ -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
 
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 00e06c986e27..e0b61b366312 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <unistd.h>
+#include <strings.h>
 
 #include <rte_eal.h>
 #include <rte_common.h>
@@ -676,19 +677,26 @@ eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
 static void
 show_port(void)
 {
-	uint16_t i = 0;
-	int ret = 0, j, k;
+	uint32_t port_mask = enabled_port_mask;
+	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 (port_mask = enabled_port_mask; port_mask != 0;
+	     port_mask &= ~(1u << 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;
+
+		i = ffs(port_mask) - 1;
+
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -707,6 +715,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",
@@ -1342,6 +1355,7 @@ main(int argc, char **argv)
 	char log_flag[] = "--log-level=6";
 	char *argp[argc + 4];
 	uint16_t nb_ports;
+	uint32_t port_mask;
 
 	/* preparse app arguments */
 	ret = proc_info_preparse_args(argc, argv);
@@ -1385,30 +1399,42 @@ 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;
-
-	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);
+	/* If no port mask was specified, one will be provided */
+	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)) {
+		/* ffs() first bit is 1 not 0 */
+		i = ffs(port_mask) - 1;
+
+		if (i >= RTE_MAX_ETHPORTS)
+			break;
+
+		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);
+
+	}
+
 	/* print port independent stats */
 	if (enable_metrics)
 		metrics_display(RTE_METRICS_GLOBAL);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v2 6/7] app/proc-info: dump rx and tx descriptor info
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 6/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
@ 2020-07-13 12:08     ` Hemant Agrawal
  0 siblings, 0 replies; 73+ messages in thread
From: Hemant Agrawal @ 2020-07-13 12:08 UTC (permalink / raw)
  To: Stephen Hemminger, dev; +Cc: Maryam Tahhan, Reshma Pattan



-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Stephen Hemminger
Sent: Thursday, May 7, 2020 1:28 AM
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>; Maryam Tahhan <maryam.tahhan@intel.com>; Reshma Pattan <reshma.pattan@intel.com>
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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 804c0fd63b3e..00e06c986e27 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v2 4/7] app/proc-info: add more info to show_ports
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
@ 2020-07-13 12:09     ` Hemant Agrawal
  0 siblings, 0 replies; 73+ messages in thread
From: Hemant Agrawal @ 2020-07-13 12:09 UTC (permalink / raw)
  To: Stephen Hemminger, dev; +Cc: Maryam Tahhan, Reshma Pattan

Hi

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Stephen Hemminger
Sent: Thursday, May 7, 2020 1:28 AM
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>; Maryam Tahhan <maryam.tahhan@intel.com>; Reshma Pattan <reshma.pattan@intel.com>
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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 78 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 63 insertions(+), 15 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c index e4914191bef9..c4f1f99e7d5d 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

-		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


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
                     ` (6 preceding siblings ...)
  2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 7/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
@ 2020-07-13 12:10   ` Hemant Agrawal
  7 siblings, 0 replies; 73+ messages in thread
From: Hemant Agrawal @ 2020-07-13 12:10 UTC (permalink / raw)
  To: Stephen Hemminger, dev

Series-
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of Stephen Hemminger
Sent: Thursday, May 7, 2020 1:28 AM
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
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


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
                   ` (7 preceding siblings ...)
  2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
@ 2020-07-15 21:22 ` Stephen Hemminger
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
                     ` (6 more replies)
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
                   ` (2 subsequent siblings)
  11 siblings, 7 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-15 21:22 UTC (permalink / raw)
  To: maryam.tahhan, reshma.pattan, hemant.agrawal; +Cc: dev, 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(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v3 1/7] app/proc-info: remove unused logtype #define
  2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
@ 2020-07-15 21:22   ` Stephen Hemminger
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-15 21:22 UTC (permalink / raw)
  To: maryam.tahhan, reshma.pattan, hemant.agrawal; +Cc: dev, Stephen Hemminger

This logtype is defined but never used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index abeca4aab438..69e3000616c0 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 "========================================"
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
@ 2020-07-15 21:22   ` Stephen Hemminger
  2020-07-17 14:06     ` Thomas Monjalon
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-15 21:22 UTC (permalink / raw)
  To: maryam.tahhan, reshma.pattan, hemant.agrawal; +Cc: dev, Stephen Hemminger

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 69e3000616c0..049818bad51f 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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;
 }
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v3 3/7] app/proc-info: hide EAL info messages
  2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
@ 2020-07-15 21:22   ` Stephen Hemminger
  2020-07-17 14:04     ` Thomas Monjalon
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
                     ` (3 subsequent siblings)
  6 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-15 21:22 UTC (permalink / raw)
  To: maryam.tahhan, reshma.pattan, hemant.agrawal; +Cc: dev, 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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 049818bad51f..e4914191bef9 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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");
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v3 4/7] app/proc-info: add more info to show_ports
  2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
                     ` (2 preceding siblings ...)
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
@ 2020-07-15 21:22   ` Stephen Hemminger
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 5/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-15 21:22 UTC (permalink / raw)
  To: maryam.tahhan, reshma.pattan, hemant.agrawal; +Cc: dev, 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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 88 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 72 insertions(+), 16 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index e4914191bef9..7c1276b7fbc1 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v3 5/7] app/proc-info: dump rx and tx descriptor info
  2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
                     ` (3 preceding siblings ...)
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
@ 2020-07-15 21:22   ` Stephen Hemminger
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 7/7] app/proc-info: add crypto security context info Stephen Hemminger
  6 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-15 21:22 UTC (permalink / raw)
  To: maryam.tahhan, reshma.pattan, hemant.agrawal; +Cc: dev, Stephen Hemminger

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 7c1276b7fbc1..5000724fcdd1 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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);
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports
  2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
                     ` (4 preceding siblings ...)
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 5/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
@ 2020-07-15 21:22   ` Stephen Hemminger
  2020-07-17 15:01     ` Thomas Monjalon
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 7/7] app/proc-info: add crypto security context info Stephen Hemminger
  6 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-15 21:22 UTC (permalink / raw)
  To: maryam.tahhan, reshma.pattan, hemant.agrawal; +Cc: dev, 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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/Makefile |  3 ++
 app/proc-info/main.c   | 74 ++++++++++++++++++++++++++++--------------
 2 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/app/proc-info/Makefile b/app/proc-info/Makefile
index 214f3f54a1e9..f777e037861f 100644
--- a/app/proc-info/Makefile
+++ b/app/proc-info/Makefile
@@ -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
 
diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 5000724fcdd1..14c04f8367f1 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <unistd.h>
+#include <strings.h>
 
 #include <rte_eal.h>
 #include <rte_common.h>
@@ -676,19 +677,26 @@ eth_tx_queue_available(uint16_t port_id, uint16_t queue_id, uint16_t n)
 static void
 show_port(void)
 {
-	uint16_t i = 0;
-	int ret = 0, j, k;
+	uint32_t port_mask = enabled_port_mask;
+	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 (port_mask = enabled_port_mask; port_mask != 0;
+	     port_mask &= ~(1u << 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;
+
+		i = ffs(port_mask) - 1;
+
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
 
 		memset(&rss_conf, 0, sizeof(rss_conf));
 
@@ -707,6 +715,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",
@@ -1351,6 +1364,7 @@ main(int argc, char **argv)
 	char log_flag[] = "--log-level=6";
 	char *argp[argc + 4];
 	uint16_t nb_ports;
+	uint32_t port_mask;
 
 	/* preparse app arguments */
 	ret = proc_info_preparse_args(argc, argv);
@@ -1394,30 +1408,42 @@ 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;
-
-	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);
+	/* If no port mask was specified, one will be provided */
+	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)) {
+		/* ffs() first bit is 1 not 0 */
+		i = ffs(port_mask) - 1;
+
+		if (i >= RTE_MAX_ETHPORTS)
+			break;
+
+		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);
+
+	}
+
 	/* print port independent stats */
 	if (enable_metrics)
 		metrics_display(RTE_METRICS_GLOBAL);
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v3 7/7] app/proc-info: add crypto security context info
  2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
                     ` (5 preceding siblings ...)
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
@ 2020-07-15 21:22   ` Stephen Hemminger
  6 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-15 21:22 UTC (permalink / raw)
  To: maryam.tahhan, reshma.pattan, hemant.agrawal; +Cc: dev, Stephen Hemminger

From: Hemant Agrawal <hemant.agrawal@nxp.com>

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.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 14c04f8367f1..91205a51ad6b 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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
 	}
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/7] app/proc-info: hide EAL info messages
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
@ 2020-07-17 14:04     ` Thomas Monjalon
  0 siblings, 0 replies; 73+ messages in thread
From: Thomas Monjalon @ 2020-07-17 14:04 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: maryam.tahhan, reshma.pattan, hemant.agrawal, dev

15/07/2020 23:22, 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.
[...]
> +	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




^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
@ 2020-07-17 14:06     ` Thomas Monjalon
  2020-08-13  4:10       ` Varghese, Vipin
  0 siblings, 1 reply; 73+ messages in thread
From: Thomas Monjalon @ 2020-07-17 14:06 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: maryam.tahhan, reshma.pattan, hemant.agrawal, dev

15/07/2020 23:22, Stephen Hemminger:
> 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 :)



^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports
  2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
@ 2020-07-17 15:01     ` Thomas Monjalon
  2020-07-21 17:05       ` Stephen Hemminger
  0 siblings, 1 reply; 73+ messages in thread
From: Thomas Monjalon @ 2020-07-17 15:01 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: maryam.tahhan, reshma.pattan, hemant.agrawal, dev

15/07/2020 23:22, Stephen Hemminger:
> --- a/app/proc-info/Makefile
> +++ b/app/proc-info/Makefile
> +CFLAGS += -DALLOW_EXPERIMENTAL_API

not needed in app/

> +CFLAGS += -O3
>  CFLAGS += $(WERROR_FLAGS)
> +CFLAGS += -Wno-deprecated-declarations

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

> +	/* 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.

> +	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.

> +		/* 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().

> +
> +		if (!rte_eth_dev_is_valid_port(i))
> +			continue;




^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports
  2020-07-17 15:01     ` Thomas Monjalon
@ 2020-07-21 17:05       ` Stephen Hemminger
  2020-07-21 17:08         ` Thomas Monjalon
  0 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 17:05 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: maryam.tahhan, reshma.pattan, hemant.agrawal, dev

On Fri, 17 Jul 2020 17:01:00 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:

> 15/07/2020 23:22, Stephen Hemminger:
> > --- a/app/proc-info/Makefile
> > +++ b/app/proc-info/Makefile
> > +CFLAGS += -DALLOW_EXPERIMENTAL_API  
> 
> not needed in app/
> 
> > +CFLAGS += -O3
> >  CFLAGS += $(WERROR_FLAGS)
> > +CFLAGS += -Wno-deprecated-declarations  
> 
> Which deprecated function is used?
> We must not use deprecated functions.

Fixing.

> 
> > +	/* 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 #

> 
> > +	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?

> 
> > +		/* 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.


> 
> > +
> > +		if (!rte_eth_dev_is_valid_port(i))
> > +			continue;  
> 
> 
> 


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports
  2020-07-21 17:05       ` Stephen Hemminger
@ 2020-07-21 17:08         ` Thomas Monjalon
  2020-07-21 17:37           ` Stephen Hemminger
  0 siblings, 1 reply; 73+ messages in thread
From: Thomas Monjalon @ 2020-07-21 17:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: maryam.tahhan, reshma.pattan, hemant.agrawal, dev

21/07/2020 19:05, Stephen Hemminger:
> On Fri, 17 Jul 2020 17:01:00 +0200
> Thomas Monjalon <thomas@monjalon.net> wrote:
> > 15/07/2020 23:22, Stephen Hemminger:
> > > +	/* 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?

> > > +	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.

> > > +		/* 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

> > > +
> > > +		if (!rte_eth_dev_is_valid_port(i))
> > > +			continue;  




^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports
  2020-07-21 17:08         ` Thomas Monjalon
@ 2020-07-21 17:37           ` Stephen Hemminger
  0 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 17:37 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: maryam.tahhan, reshma.pattan, hemant.agrawal, dev

On Tue, 21 Jul 2020 19:08:57 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:

> 21/07/2020 19:05, Stephen Hemminger:
> > On Fri, 17 Jul 2020 17:01:00 +0200
> > Thomas Monjalon <thomas@monjalon.net> wrote:  
> > > 15/07/2020 23:22, Stephen Hemminger:  
> > > > +	/* 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?

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.

^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
                   ` (8 preceding siblings ...)
  2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
@ 2020-07-21 18:22 ` Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 1/8] app/proc-info: remove unused logtype #define Stephen Hemminger
                     ` (7 more replies)
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
  2020-08-12  0:52 ` [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
  11 siblings, 8 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 18:22 UTC (permalink / raw)
  To: dev; +Cc: 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(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v4 1/8] app/proc-info: remove unused logtype #define
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
@ 2020-07-21 18:22   ` Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 2/8] app/proc-info: eliminate useless borders Stephen Hemminger
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 18:22 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

This logtype is defined but never used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index abeca4aab438..69e3000616c0 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 "========================================"
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v4 2/8] app/proc-info: eliminate useless borders
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 1/8] app/proc-info: remove unused logtype #define Stephen Hemminger
@ 2020-07-21 18:22   ` Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 3/8] app/proc-info: hide EAL info messages Stephen Hemminger
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 18:22 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 69e3000616c0..049818bad51f 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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;
 }
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v4 3/8] app/proc-info: hide EAL info messages
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 1/8] app/proc-info: remove unused logtype #define Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 2/8] app/proc-info: eliminate useless borders Stephen Hemminger
@ 2020-07-21 18:22   ` Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 4/8] app/proc-info: add more info to show_ports Stephen Hemminger
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 18:22 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 049818bad51f..e4914191bef9 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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");
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v4 4/8] app/proc-info: add more info to show_ports
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (2 preceding siblings ...)
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 3/8] app/proc-info: hide EAL info messages Stephen Hemminger
@ 2020-07-21 18:22   ` Stephen Hemminger
  2020-07-28  7:22     ` Hemant Agrawal (OSS)
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 5/8] app/proc-info: enhance mempool to print ops name Stephen Hemminger
                     ` (3 subsequent siblings)
  7 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 18:22 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 88 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 72 insertions(+), 16 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index e4914191bef9..7c1276b7fbc1 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v4 5/8] app/proc-info: enhance mempool to print ops name
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (3 preceding siblings ...)
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 4/8] app/proc-info: add more info to show_ports Stephen Hemminger
@ 2020-07-21 18:22   ` Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 6/8] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 18:22 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal, Stephen Hemminger

From: Hemant Agrawal <hemant.agrawal@nxp.com>

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

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 7c1276b7fbc1..f3f83c0cea37 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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;
 		}
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v4 6/8] app/proc-info: dump rx and tx descriptor info
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (4 preceding siblings ...)
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 5/8] app/proc-info: enhance mempool to print ops name Stephen Hemminger
@ 2020-07-21 18:22   ` Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 7/8] app/proc-info: add crypto security context info Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports Stephen Hemminger
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 18:22 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 79 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 66 insertions(+), 13 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index f3f83c0cea37..2ea554ab01f0 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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);
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v4 7/8] app/proc-info: add crypto security context info
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (5 preceding siblings ...)
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 6/8] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
@ 2020-07-21 18:22   ` Stephen Hemminger
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports Stephen Hemminger
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 18:22 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal, Stephen Hemminger

From: Hemant Agrawal <hemant.agrawal@nxp.com>

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.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 2ea554ab01f0..aa074dc7c429 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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
 	}
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (6 preceding siblings ...)
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 7/8] app/proc-info: add crypto security context info Stephen Hemminger
@ 2020-07-21 18:22   ` Stephen Hemminger
  2020-07-28  5:39     ` Hemant Agrawal (OSS)
  7 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-21 18:22 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 94 ++++++++++++++++++++++++++------------------
 1 file changed, 55 insertions(+), 39 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index aa074dc7c429..77a59bcefb9b 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports Stephen Hemminger
@ 2020-07-28  5:39     ` Hemant Agrawal (OSS)
  2020-07-28  5:45       ` Stephen Hemminger
  0 siblings, 1 reply; 73+ messages in thread
From: Hemant Agrawal (OSS) @ 2020-07-28  5:39 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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 <stephen@networkplumber.org> 
Sent: Tuesday, July 21, 2020 11:53 PM
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>; Hemant Agrawal <hemant.agrawal@nxp.com>
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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 94 ++++++++++++++++++++++++++------------------
 1 file changed, 55 insertions(+), 39 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c index aa074dc7c429..77a59bcefb9b 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports
  2020-07-28  5:39     ` Hemant Agrawal (OSS)
@ 2020-07-28  5:45       ` Stephen Hemminger
  0 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28  5:45 UTC (permalink / raw)
  To: Hemant Agrawal (OSS); +Cc: dev

On Tue, 28 Jul 2020 05:39:46 +0000
"Hemant Agrawal (OSS)" <hemant.agrawal@oss.nxp.com> wrote:

> 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
> 

Will resubmit, are there any other suggestions?


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v4 4/8] app/proc-info: add more info to show_ports
  2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 4/8] app/proc-info: add more info to show_ports Stephen Hemminger
@ 2020-07-28  7:22     ` Hemant Agrawal (OSS)
  0 siblings, 0 replies; 73+ messages in thread
From: Hemant Agrawal (OSS) @ 2020-07-28  7:22 UTC (permalink / raw)
  To: Stephen Hemminger, dev

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 <stephen@networkplumber.org> 
Sent: Tuesday, July 21, 2020 11:53 PM
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>; Hemant Agrawal <hemant.agrawal@nxp.com>
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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 88 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 72 insertions(+), 16 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c index e4914191bef9..7c1276b7fbc1 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
                   ` (9 preceding siblings ...)
  2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
@ 2020-07-28 19:13 ` Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 1/8] app/proc-info: remove unused logtype #define Stephen Hemminger
                     ` (9 more replies)
  2020-08-12  0:52 ` [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
  11 siblings, 10 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28 19:13 UTC (permalink / raw)
  To: dev; +Cc: 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(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v5 1/8] app/proc-info: remove unused logtype #define
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
@ 2020-07-28 19:13   ` Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 2/8] app/proc-info: eliminate useless borders Stephen Hemminger
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28 19:13 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

This logtype is defined but never used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index abeca4aab438..69e3000616c0 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 "========================================"
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v5 2/8] app/proc-info: eliminate useless borders
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 1/8] app/proc-info: remove unused logtype #define Stephen Hemminger
@ 2020-07-28 19:13   ` Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 3/8] app/proc-info: hide EAL info messages Stephen Hemminger
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28 19:13 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 69e3000616c0..049818bad51f 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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;
 }
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v5 3/8] app/proc-info: hide EAL info messages
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 1/8] app/proc-info: remove unused logtype #define Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 2/8] app/proc-info: eliminate useless borders Stephen Hemminger
@ 2020-07-28 19:13   ` Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 4/8] app/proc-info: add more info to show_ports Stephen Hemminger
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28 19:13 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 049818bad51f..e4914191bef9 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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");
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v5 4/8] app/proc-info: add more info to show_ports
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (2 preceding siblings ...)
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 3/8] app/proc-info: hide EAL info messages Stephen Hemminger
@ 2020-07-28 19:13   ` Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 5/8] app/proc-info: enhance mempool to print ops name Stephen Hemminger
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28 19:13 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 100 +++++++++++++++++++++++++++++++++----------
 1 file changed, 78 insertions(+), 22 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index e4914191bef9..28838be882b9 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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);
 			}
 		}
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v5 5/8] app/proc-info: enhance mempool to print ops name
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (3 preceding siblings ...)
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 4/8] app/proc-info: add more info to show_ports Stephen Hemminger
@ 2020-07-28 19:13   ` Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 6/8] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28 19:13 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal, Stephen Hemminger

From: Hemant Agrawal <hemant.agrawal@nxp.com>

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

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 28838be882b9..b2011c448577 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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;
 		}
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v5 6/8] app/proc-info: dump rx and tx descriptor info
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (4 preceding siblings ...)
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 5/8] app/proc-info: enhance mempool to print ops name Stephen Hemminger
@ 2020-07-28 19:13   ` Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 7/8] app/proc-info: add crypto security context info Stephen Hemminger
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28 19:13 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++++++++++++++-------
 1 file changed, 67 insertions(+), 13 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index b2011c448577..4e2e647498ff 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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);
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v5 7/8] app/proc-info: add crypto security context info
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (5 preceding siblings ...)
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 6/8] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
@ 2020-07-28 19:13   ` Stephen Hemminger
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 8/8] app/proc-info: provide way to request info on owned ports Stephen Hemminger
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28 19:13 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal, Stephen Hemminger

From: Hemant Agrawal <hemant.agrawal@nxp.com>

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.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 4e2e647498ff..282af670d20a 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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
 	}
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v5 8/8] app/proc-info: provide way to request info on owned ports
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (6 preceding siblings ...)
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 7/8] app/proc-info: add crypto security context info Stephen Hemminger
@ 2020-07-28 19:13   ` Stephen Hemminger
  2020-09-18 22:12   ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
  9 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-07-28 19:13 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 92 ++++++++++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 38 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 282af670d20a..f78cc0f59c74 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 */
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH 0/7] proc-info enhancements
  2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
                   ` (10 preceding siblings ...)
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
@ 2020-08-12  0:52 ` Stephen Hemminger
  11 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-08-12  0:52 UTC (permalink / raw)
  To: dev

On Wed,  6 May 2020 12:37:34 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:

> 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.

^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-07-17 14:06     ` Thomas Monjalon
@ 2020-08-13  4:10       ` Varghese, Vipin
  2020-08-13 16:11         ` Stephen Hemminger
  0 siblings, 1 reply; 73+ messages in thread
From: Varghese, Vipin @ 2020-08-13  4:10 UTC (permalink / raw)
  To: Thomas Monjalon, Stephen Hemminger
  Cc: Tahhan, Maryam, Pattan, Reshma, hemant.agrawal, dev

Hi Stephen,

snipped
> 
> 15/07/2020 23:22, Stephen Hemminger:
> > 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.

^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-08-13  4:10       ` Varghese, Vipin
@ 2020-08-13 16:11         ` Stephen Hemminger
  2020-08-14  0:45           ` Varghese, Vipin
  0 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-08-13 16:11 UTC (permalink / raw)
  To: Varghese, Vipin
  Cc: Thomas Monjalon, Tahhan, Maryam, Pattan, Reshma, hemant.agrawal, dev

On Thu, 13 Aug 2020 04:10:39 +0000
"Varghese, Vipin" <vipin.varghese@intel.com> wrote:

> Hi Stephen,
> 
> snipped
> > 
> > 15/07/2020 23:22, Stephen Hemminger:  
> > > 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.

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

^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-08-13 16:11         ` Stephen Hemminger
@ 2020-08-14  0:45           ` Varghese, Vipin
  2020-08-14  1:14             ` Varghese, Vipin
  0 siblings, 1 reply; 73+ messages in thread
From: Varghese, Vipin @ 2020-08-14  0:45 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Thomas Monjalon, Tahhan, Maryam, Pattan, Reshma, hemant.agrawal, dev

snipped
> >
> > snipped
> > >
> > > 15/07/2020 23:22, Stephen Hemminger:
> > > > 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.
> 
> 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?

^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-08-14  0:45           ` Varghese, Vipin
@ 2020-08-14  1:14             ` Varghese, Vipin
  2020-08-14  3:18               ` Stephen Hemminger
  0 siblings, 1 reply; 73+ messages in thread
From: Varghese, Vipin @ 2020-08-14  1:14 UTC (permalink / raw)
  To: Varghese, Vipin, Stephen Hemminger
  Cc: Thomas Monjalon, Tahhan, Maryam, Pattan, Reshma, hemant.agrawal, dev

snipped
> 
> snipped
> > >
> > > snipped
> > > >
> > > > 15/07/2020 23:22, Stephen Hemminger:
> > > > > 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.
> >
> > 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.

^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-08-14  1:14             ` Varghese, Vipin
@ 2020-08-14  3:18               ` Stephen Hemminger
  2020-08-14 11:08                 ` Varghese, Vipin
  0 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-08-14  3:18 UTC (permalink / raw)
  To: Varghese, Vipin
  Cc: Thomas Monjalon, Tahhan, Maryam, Pattan, Reshma, hemant.agrawal, dev

On Fri, 14 Aug 2020 01:14:40 +0000
"Varghese, Vipin" <vipin.varghese@intel.com> wrote:

> snipped
> > 
> > snipped  
> > > >
> > > > snipped  
> > > > >
> > > > > 15/07/2020 23:22, Stephen Hemminger:  
> > > > > > 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.  
> > >
> > > 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?

^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-08-14  3:18               ` Stephen Hemminger
@ 2020-08-14 11:08                 ` Varghese, Vipin
  2020-08-14 14:56                   ` Stephen Hemminger
  0 siblings, 1 reply; 73+ messages in thread
From: Varghese, Vipin @ 2020-08-14 11:08 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Thomas Monjalon, Tahhan, Maryam, Pattan, Reshma, hemant.agrawal, dev

Hi Stephen,

> 
> > snipped
> > >
> > > snipped
> > > > >
> > > > > snipped
> > > > > >
> > > > > > 15/07/2020 23:22, Stephen Hemminger:
> > > > > > > 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.
> > > >
> > > > 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?

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?

^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-08-14 11:08                 ` Varghese, Vipin
@ 2020-08-14 14:56                   ` Stephen Hemminger
  2020-08-15  2:48                     ` Varghese, Vipin
  0 siblings, 1 reply; 73+ messages in thread
From: Stephen Hemminger @ 2020-08-14 14:56 UTC (permalink / raw)
  To: Varghese, Vipin
  Cc: Thomas Monjalon, Tahhan, Maryam, Pattan, Reshma, hemant.agrawal, dev

On Fri, 14 Aug 2020 11:08:31 +0000
"Varghese, Vipin" <vipin.varghese@intel.com> wrote:

> Hi Stephen,
> 
> >   
> > > snipped  
> > > >
> > > > snipped  
> > > > > >
> > > > > > snipped  
> > > > > > >
> > > > > > > 15/07/2020 23:22, Stephen Hemminger:  
> > > > > > > > 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.  
> > > > >
> > > > > 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?  
> 
> 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.

^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders
  2020-08-14 14:56                   ` Stephen Hemminger
@ 2020-08-15  2:48                     ` Varghese, Vipin
  0 siblings, 0 replies; 73+ messages in thread
From: Varghese, Vipin @ 2020-08-15  2:48 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Thomas Monjalon, Tahhan, Maryam, Pattan, Reshma, hemant.agrawal, dev

> 
> > Hi Stephen,
> >
> > >
> > > > snipped
> > > > >
> > > > > snipped
> > > > > > >
> > > > > > > snipped
> > > > > > > >
> > > > > > > > 15/07/2020 23:22, Stephen Hemminger:
> > > > > > > > > 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.
> > > > > >
> > > > > > 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?
> >
> > 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.

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.




^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (7 preceding siblings ...)
  2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 8/8] app/proc-info: provide way to request info on owned ports Stephen Hemminger
@ 2020-09-18 22:12   ` Stephen Hemminger
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
  9 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-09-18 22:12 UTC (permalink / raw)
  To: dev

On Tue, 28 Jul 2020 12:13:22 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:

> 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(-)
> 

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

^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements
  2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
                     ` (8 preceding siblings ...)
  2020-09-18 22:12   ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
@ 2020-09-24  5:34   ` Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
                       ` (7 more replies)
  9 siblings, 8 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-09-24  5:34 UTC (permalink / raw)
  To: dev; +Cc: 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(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v6 1/7] app/proc-info: remove unused logtype #define
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
@ 2020-09-24  5:34     ` Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
                       ` (6 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-09-24  5:34 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

This logtype is defined but never used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 64fb83b38dd4..1623c3723b3e 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 "========================================"
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v6 2/7] app/proc-info: eliminate useless borders
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
@ 2020-09-24  5:34     ` Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
                       ` (5 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-09-24  5:34 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 1623c3723b3e..6cf5bb4ea48a 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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;
 }
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v6 3/7] app/proc-info: hide EAL info messages
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
@ 2020-09-24  5:34     ` Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
                       ` (4 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-09-24  5:34 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 6cf5bb4ea48a..66918a834877 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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");
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v6 4/7] app/proc-info: add more info to show_ports
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
                       ` (2 preceding siblings ...)
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
@ 2020-09-24  5:34     ` Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 5/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
                       ` (3 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-09-24  5:34 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 77 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 59 insertions(+), 18 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 66918a834877..ab754daefa50 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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;
 		}
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v6 5/7] app/proc-info: dump rx and tx descriptor info
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
                       ` (3 preceding siblings ...)
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
@ 2020-09-24  5:34     ` Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 6/7] app/proc-info: add crypto security context info Stephen Hemminger
                       ` (2 subsequent siblings)
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-09-24  5:34 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 93 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 74 insertions(+), 19 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index ab754daefa50..c36f9f4d7471 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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);
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v6 6/7] app/proc-info: add crypto security context info
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
                       ` (4 preceding siblings ...)
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 5/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
@ 2020-09-24  5:34     ` Stephen Hemminger
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 7/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
  2020-10-19 22:39     ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Thomas Monjalon
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-09-24  5:34 UTC (permalink / raw)
  To: dev; +Cc: Hemant Agrawal, Stephen Hemminger

From: Hemant Agrawal <hemant.agrawal@nxp.com>

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.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/proc-info/main.c | 80 +++++++++++++++++++++++++-------------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index c36f9f4d7471..e90e9aba080e 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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
 	}
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* [dpdk-dev] [PATCH v6 7/7] app/proc-info: provide way to request info on owned ports
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
                       ` (5 preceding siblings ...)
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 6/7] app/proc-info: add crypto security context info Stephen Hemminger
@ 2020-09-24  5:34     ` Stephen Hemminger
  2020-10-19 22:39     ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Thomas Monjalon
  7 siblings, 0 replies; 73+ messages in thread
From: Stephen Hemminger @ 2020-09-24  5:34 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Hemant Agrawal

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 app/proc-info/main.c | 92 ++++++++++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 38 deletions(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index e90e9aba080e..267e16bc318b 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 */
-- 
2.27.0


^ permalink raw reply	[flat|nested] 73+ messages in thread

* Re: [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements
  2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
                       ` (6 preceding siblings ...)
  2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 7/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
@ 2020-10-19 22:39     ` Thomas Monjalon
  7 siblings, 0 replies; 73+ messages in thread
From: Thomas Monjalon @ 2020-10-19 22:39 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, hemant.agrawal

24/09/2020 07:34, 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.
> 
> 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(-)

Applied, thanks




^ permalink raw reply	[flat|nested] 73+ messages in thread

end of thread, other threads:[~2020-10-19 22:39 UTC | newest]

Thread overview: 73+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 19:37 [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger
2020-05-06 19:37 ` [dpdk-dev] [PATCH 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
2020-05-06 19:37 ` [dpdk-dev] [PATCH 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
2020-05-06 19:37 ` [dpdk-dev] [PATCH 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
2020-05-06 19:37 ` [dpdk-dev] [PATCH 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
2020-05-06 19:37 ` [dpdk-dev] [PATCH 5/7] app/proc-info: hide crypto-context display Stephen Hemminger
2020-05-06 19:37 ` [dpdk-dev] [PATCH 6/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
2020-05-06 19:37 ` [dpdk-dev] [PATCH 7/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
2020-05-06 19:57 ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Stephen Hemminger
2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
2020-07-13 12:09     ` Hemant Agrawal
2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 5/7] app/proc-info: hide crypto-context display Stephen Hemminger
2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 6/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
2020-07-13 12:08     ` Hemant Agrawal
2020-05-06 19:57   ` [dpdk-dev] [PATCH v2 7/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
2020-07-13 12:10   ` [dpdk-dev] [PATCH v2 0/7] app/proc-info enhancements Hemant Agrawal
2020-07-15 21:22 ` [dpdk-dev] [PATCH v3 0/7] app/proc-info enhancments Stephen Hemminger
2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
2020-07-17 14:06     ` Thomas Monjalon
2020-08-13  4:10       ` Varghese, Vipin
2020-08-13 16:11         ` Stephen Hemminger
2020-08-14  0:45           ` Varghese, Vipin
2020-08-14  1:14             ` Varghese, Vipin
2020-08-14  3:18               ` Stephen Hemminger
2020-08-14 11:08                 ` Varghese, Vipin
2020-08-14 14:56                   ` Stephen Hemminger
2020-08-15  2:48                     ` Varghese, Vipin
2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
2020-07-17 14:04     ` Thomas Monjalon
2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 5/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 6/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
2020-07-17 15:01     ` Thomas Monjalon
2020-07-21 17:05       ` Stephen Hemminger
2020-07-21 17:08         ` Thomas Monjalon
2020-07-21 17:37           ` Stephen Hemminger
2020-07-15 21:22   ` [dpdk-dev] [PATCH v3 7/7] app/proc-info: add crypto security context info Stephen Hemminger
2020-07-21 18:22 ` [dpdk-dev] [PATCH v4 0/8] app/proc-info enhancements Stephen Hemminger
2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 1/8] app/proc-info: remove unused logtype #define Stephen Hemminger
2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 2/8] app/proc-info: eliminate useless borders Stephen Hemminger
2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 3/8] app/proc-info: hide EAL info messages Stephen Hemminger
2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 4/8] app/proc-info: add more info to show_ports Stephen Hemminger
2020-07-28  7:22     ` Hemant Agrawal (OSS)
2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 5/8] app/proc-info: enhance mempool to print ops name Stephen Hemminger
2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 6/8] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 7/8] app/proc-info: add crypto security context info Stephen Hemminger
2020-07-21 18:22   ` [dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request info on owned ports Stephen Hemminger
2020-07-28  5:39     ` Hemant Agrawal (OSS)
2020-07-28  5:45       ` Stephen Hemminger
2020-07-28 19:13 ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 1/8] app/proc-info: remove unused logtype #define Stephen Hemminger
2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 2/8] app/proc-info: eliminate useless borders Stephen Hemminger
2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 3/8] app/proc-info: hide EAL info messages Stephen Hemminger
2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 4/8] app/proc-info: add more info to show_ports Stephen Hemminger
2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 5/8] app/proc-info: enhance mempool to print ops name Stephen Hemminger
2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 6/8] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 7/8] app/proc-info: add crypto security context info Stephen Hemminger
2020-07-28 19:13   ` [dpdk-dev] [PATCH v5 8/8] app/proc-info: provide way to request info on owned ports Stephen Hemminger
2020-09-18 22:12   ` [dpdk-dev] [PATCH v5 0/8] app/proc-info enhancements Stephen Hemminger
2020-09-24  5:34   ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Stephen Hemminger
2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 1/7] app/proc-info: remove unused logtype #define Stephen Hemminger
2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 2/7] app/proc-info: eliminate useless borders Stephen Hemminger
2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 3/7] app/proc-info: hide EAL info messages Stephen Hemminger
2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 4/7] app/proc-info: add more info to show_ports Stephen Hemminger
2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 5/7] app/proc-info: dump rx and tx descriptor info Stephen Hemminger
2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 6/7] app/proc-info: add crypto security context info Stephen Hemminger
2020-09-24  5:34     ` [dpdk-dev] [PATCH v6 7/7] app/proc-info: provide way to request info on owned ports Stephen Hemminger
2020-10-19 22:39     ` [dpdk-dev] [PATCH v6 0/7] app/proc-info: enhancements Thomas Monjalon
2020-08-12  0:52 ` [dpdk-dev] [PATCH 0/7] proc-info enhancements Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).