From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C23D6A04B1;
	Thu, 24 Sep 2020 07:35:22 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 775841DD5F;
	Thu, 24 Sep 2020 07:34:55 +0200 (CEST)
Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com
 [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id 31BB61DD4A
 for <dev@dpdk.org>; Thu, 24 Sep 2020 07:34:48 +0200 (CEST)
Received: by mail-pg1-f196.google.com with SMTP id o25so1231087pgm.0
 for <dev@dpdk.org>; Wed, 23 Sep 2020 22:34:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=pB3RwbhgCnn/O0WzPSGpSG6t/7EDd3Q1To/7rDHYhro=;
 b=EUdeOUg2abSSPuwi9RvPW7MDKPwtry8veLCzfqSgOR+/4o1KlbKeGmDwhJUhktdKUw
 6BsPe36S4eUlduBwjO1t9v7tWUynNW1eUkFLYTfMthl38xy3c/s8IzIZ8TUjhfaDF/Kc
 sDQ0qtfRsO9ReHcXZh5T+akic6n0otVepouVCgRllCaEgGLMUE2eLjzEMiXisaxJxATC
 HOq6jChiPk/R/ArbUT+IOmojqQwyo7XUTVYi1h6u0OAJTaL1xSpkN0bbyVPG2+iFYQWq
 oCnZO5GJ6ExwFfcJjOjbNOLeeqMGqbpAtWe6C8PJs1QlwNHtGLK06rZDzM4BkakZOEzj
 NttA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=pB3RwbhgCnn/O0WzPSGpSG6t/7EDd3Q1To/7rDHYhro=;
 b=gefYDxku+fgxUufKrB7YNy0OyOdKBBe+ayWcYQhVFgEuRNsoJiL/a/TF+M7GRf4AW4
 sM2ud38CQa4P9a8L5+qG3laxYrx5b061en7NEC6GCckAsCtmljFBkh53lf0aMQ3A1XYU
 oS5BKvl95Aps7Ma9wKk3YS4iYBHr12/dAGMocsxtgTPBz0m6pAKdcufR8QdTRaoqVvaO
 rZIVRa/OHq8Z+eVa5WMkDzUouImShtMLfjkFzHuRLTru39xq8/pLltnLSJSUIw2SNzjS
 +9NnknQFF7D46RvBMqafn2EzgHuepS0T/DSiuZnsvh/sWfs0dD6EkEHRN/ophPlrQiSD
 P+sw==
X-Gm-Message-State: AOAM532mz1D1siGXvlVsfuOeOnGkqXr30SS64iNvIKxLfIbwtwHorScw
 9YqVzVGHAtEX7uH8vvJVutV4UTknLbQmZA==
X-Google-Smtp-Source: ABdhPJwB+rl/9z5a3hhI9hLwDdt//wS+b+4Lz0Sb4mfvyUxbnLcj8Nz8X8PSpVfExeV262iiGhIyFw==
X-Received: by 2002:a65:4641:: with SMTP id k1mr2590754pgr.133.1600925687002; 
 Wed, 23 Sep 2020 22:34:47 -0700 (PDT)
Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id v8sm1529609pgg.58.2020.09.23.22.34.45
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 23 Sep 2020 22:34:46 -0700 (PDT)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 Hemant Agrawal <hemant.agrawal@nxp.com>
Date: Wed, 23 Sep 2020 22:34:31 -0700
Message-Id: <20200924053433.12648-6-stephen@networkplumber.org>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20200924053433.12648-1-stephen@networkplumber.org>
References: <20200728191330.20864-1-stephen@networkplumber.org>
 <20200924053433.12648-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v6 5/7] app/proc-info: dump rx and tx descriptor
	info
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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