Skip to contentSkip to conversation

app/testpmd: add command to get Tx queue used count

PATCH Superseded [email protected] 3 participants 9 messages Jan 24, 2024 – Feb 7, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: add command to get Tx queue used count

From: Satha Rao <[email protected]>

Fastpath API to get txq used count.

testpmd> show port 0 txq 0 desc count

---
 app/test-pmd/cmdline.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
app/test-pmd/cmdline.c +78 -0
index f704319..1d09633 100644
@@ -12638,6 +12638,83 @@ struct cmd_show_port_supported_ptypes_result {
 	},
 };
 
+/* *** display tx queue desc used count *** */
+struct cmd_show_tx_queue_desc_count_result {
+	cmdline_fixed_string_t cmd_show;
+	cmdline_fixed_string_t cmd_port;
+	cmdline_fixed_string_t cmd_txq;
+	cmdline_fixed_string_t cmd_desc;
+	cmdline_fixed_string_t cmd_count;
+	portid_t cmd_pid;
+	portid_t cmd_qid;
+};
+
+static void
+cmd_show_tx_queue_desc_count_parsed(void *parsed_result,
+		__rte_unused struct cmdline *cl,
+		__rte_unused void *data)
+{
+	struct cmd_show_tx_queue_desc_count_result *res = parsed_result;
+	int rc;
+
+	if (rte_eth_tx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
+		fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n",	res->cmd_pid,
+			res->cmd_qid);
+		return;
+	}
+
+	rc = rte_eth_tx_queue_count(res->cmd_pid, res->cmd_qid);
+	if (rc < 0) {
+		fprintf(stderr, "Tx queue count get failed rc=%d queue_id=%d\n", rc, res->cmd_qid);
+		return;
+	}
+	printf("TxQ %d used desc count = %d\n", res->cmd_qid, rc);
+}
+
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_show =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_show, "show");
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_port =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_port, "port");
+static cmdline_parse_token_num_t cmd_show_tx_queue_desc_count_pid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_pid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_txq =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_txq, "txq");
+static cmdline_parse_token_num_t cmd_show_tx_queue_desc_count_qid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_qid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_desc =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_desc, "desc");
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_count =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_count, "count");
+static cmdline_parse_inst_t cmd_show_tx_queue_desc_count = {
+	.f = cmd_show_tx_queue_desc_count_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> txq <queue_id> desc count",
+	.tokens = {
+		(void *)&cmd_show_tx_queue_desc_count_show,
+		(void *)&cmd_show_tx_queue_desc_count_port,
+		(void *)&cmd_show_tx_queue_desc_count_pid,
+		(void *)&cmd_show_tx_queue_desc_count_txq,
+		(void *)&cmd_show_tx_queue_desc_count_qid,
+		(void *)&cmd_show_tx_queue_desc_count_desc,
+		(void *)&cmd_show_tx_queue_desc_count_count,
+		NULL,
+	},
+};
+
 /* *** display rx/tx descriptor status *** */
 struct cmd_show_rx_tx_desc_status_result {
 	cmdline_fixed_string_t cmd_show;
@@ -13346,6 +13423,7 @@ struct cmd_config_tx_affinity_map {
 	(cmdline_parse_inst_t *)&cmd_show_tx_metadata,
 	(cmdline_parse_inst_t *)&cmd_show_rx_tx_desc_status,
 	(cmdline_parse_inst_t *)&cmd_show_rx_queue_desc_used_count,
+	(cmdline_parse_inst_t *)&cmd_show_tx_queue_desc_count,
 	(cmdline_parse_inst_t *)&cmd_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw_all,
Signature · 1 line
1.8.3.1
#1 lore raw

Please doc this command in doc/guides/testpmd_app_ug/testpmd_funcs.rst Also why not extend "show port rxq xxx" command to support txq ?

Quoted 108 lines · On 2024/1/24 20:18, [email protected] wrote:

From: Satha Rao <[email protected]>

Fastpath API to get txq used count.

testpmd> show port 0 txq 0 desc count

---
 app/test-pmd/cmdline.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
app/test-pmd/cmdline.c +78 -0
index f704319..1d09633 100644
@@ -12638,6 +12638,83 @@ struct cmd_show_port_supported_ptypes_result {
 	},
 };
 
+/* *** display tx queue desc used count *** */
+struct cmd_show_tx_queue_desc_count_result {
+	cmdline_fixed_string_t cmd_show;
+	cmdline_fixed_string_t cmd_port;
+	cmdline_fixed_string_t cmd_txq;
+	cmdline_fixed_string_t cmd_desc;
+	cmdline_fixed_string_t cmd_count;
+	portid_t cmd_pid;
+	portid_t cmd_qid;
+};
+
+static void
+cmd_show_tx_queue_desc_count_parsed(void *parsed_result,
+		__rte_unused struct cmdline *cl,
+		__rte_unused void *data)
+{
+	struct cmd_show_tx_queue_desc_count_result *res = parsed_result;
+	int rc;
+
+	if (rte_eth_tx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
+		fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n",	res->cmd_pid,
+			res->cmd_qid);
+		return;
+	}
+
+	rc = rte_eth_tx_queue_count(res->cmd_pid, res->cmd_qid);
+	if (rc < 0) {
+		fprintf(stderr, "Tx queue count get failed rc=%d queue_id=%d\n", rc, res->cmd_qid);
+		return;
+	}
+	printf("TxQ %d used desc count = %d\n", res->cmd_qid, rc);
+}
+
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_show =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_show, "show");
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_port =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_port, "port");
+static cmdline_parse_token_num_t cmd_show_tx_queue_desc_count_pid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_pid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_txq =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_txq, "txq");
+static cmdline_parse_token_num_t cmd_show_tx_queue_desc_count_qid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_qid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_desc =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_desc, "desc");
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_count =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_count, "count");
+static cmdline_parse_inst_t cmd_show_tx_queue_desc_count = {
+	.f = cmd_show_tx_queue_desc_count_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> txq <queue_id> desc count",
+	.tokens = {
+		(void *)&cmd_show_tx_queue_desc_count_show,
+		(void *)&cmd_show_tx_queue_desc_count_port,
+		(void *)&cmd_show_tx_queue_desc_count_pid,
+		(void *)&cmd_show_tx_queue_desc_count_txq,
+		(void *)&cmd_show_tx_queue_desc_count_qid,
+		(void *)&cmd_show_tx_queue_desc_count_desc,
+		(void *)&cmd_show_tx_queue_desc_count_count,
+		NULL,
+	},
+};
+
 /* *** display rx/tx descriptor status *** */
 struct cmd_show_rx_tx_desc_status_result {
 	cmdline_fixed_string_t cmd_show;
@@ -13346,6 +13423,7 @@ struct cmd_config_tx_affinity_map {
 	(cmdline_parse_inst_t *)&cmd_show_tx_metadata,
 	(cmdline_parse_inst_t *)&cmd_show_rx_tx_desc_status,
 	(cmdline_parse_inst_t *)&cmd_show_rx_queue_desc_used_count,
+	(cmdline_parse_inst_t *)&cmd_show_tx_queue_desc_count,
 	(cmdline_parse_inst_t *)&cmd_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw_all,
#2 lore raw

----------------------------------------------------------------------
Please doc this command in doc/guides/testpmd_app_ug/testpmd_funcs.rst

Quoted 1 line
Quoted 1 line

Thanks, will update in next version

Also why not extend "show port rxq xxx" command to support txq ?

Quoted 1 line
Quoted 1 line

txq and rxq are different directions, so extended "show port " command to support txq similar to rxq command. Could you please give more details if I missed something here.

Thanks,
Satha

Quoted 108 lines · On 2024/1/24 20:18, [email protected] wrote:

From: Satha Rao <[email protected]>

Fastpath API to get txq used count.

testpmd> show port 0 txq 0 desc count

---
 app/test-pmd/cmdline.c | 78 
++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0 -0

f704319..1d09633 100644

app/test-pmd/cmdline.c +77 -0
@@ -12638,6 +12638,83 @@ struct cmd_show_port_supported_ptypes_result {
 	},
 };
 
+/* *** display tx queue desc used count *** */ struct 
+cmd_show_tx_queue_desc_count_result {
+	cmdline_fixed_string_t cmd_show;
+	cmdline_fixed_string_t cmd_port;
+	cmdline_fixed_string_t cmd_txq;
+	cmdline_fixed_string_t cmd_desc;
+	cmdline_fixed_string_t cmd_count;
+	portid_t cmd_pid;
+	portid_t cmd_qid;
+};
+
+static void
+cmd_show_tx_queue_desc_count_parsed(void *parsed_result,
+		__rte_unused struct cmdline *cl,
+		__rte_unused void *data)
+{
+	struct cmd_show_tx_queue_desc_count_result *res = parsed_result;
+	int rc;
+
+	if (rte_eth_tx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
+		fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n",	res->cmd_pid,
+			res->cmd_qid);
+		return;
+	}
+
+	rc = rte_eth_tx_queue_count(res->cmd_pid, res->cmd_qid);
+	if (rc < 0) {
+		fprintf(stderr, "Tx queue count get failed rc=%d queue_id=%d\n", rc, res->cmd_qid);
+		return;
+	}
+	printf("TxQ %d used desc count = %d\n", res->cmd_qid, rc); }
+
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_show =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_show, "show");
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_port =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_port, "port");
+static cmdline_parse_token_num_t cmd_show_tx_queue_desc_count_pid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_pid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_txq =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_txq, "txq");
+static cmdline_parse_token_num_t cmd_show_tx_queue_desc_count_qid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_qid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_desc =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_desc, "desc");
+static cmdline_parse_token_string_t cmd_show_tx_queue_desc_count_count =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_tx_queue_desc_count_result,
+		 cmd_count, "count");
+static cmdline_parse_inst_t cmd_show_tx_queue_desc_count = {
+	.f = cmd_show_tx_queue_desc_count_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> txq <queue_id> desc count",
+	.tokens = {
+		(void *)&cmd_show_tx_queue_desc_count_show,
+		(void *)&cmd_show_tx_queue_desc_count_port,
+		(void *)&cmd_show_tx_queue_desc_count_pid,
+		(void *)&cmd_show_tx_queue_desc_count_txq,
+		(void *)&cmd_show_tx_queue_desc_count_qid,
+		(void *)&cmd_show_tx_queue_desc_count_desc,
+		(void *)&cmd_show_tx_queue_desc_count_count,
+		NULL,
+	},
+};
+
 /* *** display rx/tx descriptor status *** */  struct 
 cmd_show_rx_tx_desc_status_result {
 	cmdline_fixed_string_t cmd_show;
@@ -13346,6 +13423,7 @@ struct cmd_config_tx_affinity_map {
 	(cmdline_parse_inst_t *)&cmd_show_tx_metadata,
 	(cmdline_parse_inst_t *)&cmd_show_rx_tx_desc_status,
 	(cmdline_parse_inst_t *)&cmd_show_rx_queue_desc_used_count,
+	(cmdline_parse_inst_t *)&cmd_show_tx_queue_desc_count,
 	(cmdline_parse_inst_t *)&cmd_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw_all,
#3 lore raw
Quoted 5 lines · Satha Koteswara Rao Kottidi
Quoted 4 lines

----------------------------------------------------------------------
Please doc this command in doc/guides/testpmd_app_ug/testpmd_funcs.rst

Quoted 7 lines

Thanks, will update in next version

Quoted 2 lines

Also why not extend "show port rxq xxx" command to support txq ?

txq and rxq are different directions, so extended "show port " command to support txq similar to rxq command. Could you please give more details if I missed something here.

There is an existing "show port <port_id> rxq <queue_id> desc used count" command, which is for Rx.

As you are adding support for Tx, instead of adding it as a new command, existing 'cmd_show_rx_queue_desc_used_count_parsed()' can be extended to support both Rx and Tx.
You can check 'cmd_show_rx_tx_desc_status_parsed()' as sample.

This also helps to have a unified syntax for Rx and Tx, as your version is slightly diverging from the Rx one.

And please update 'cmd_help_long_parsed()' help string with relevant change.

#4 lore raw
Quoted 8 lines
Quoted 7 lines

---------------------------------------------------------------------
- Please doc this command in
doc/guides/testpmd_app_ug/testpmd_funcs.rst

Quoted 7 lines

Thanks, will update in next version

Quoted 2 lines

Also why not extend "show port rxq xxx" command to support txq ?

txq and rxq are different directions, so extended "show port " command to support txq similar to rxq command. Could you please give more details if I missed something here.

There is an existing "show port <port_id> rxq <queue_id> desc used count" command, which is for Rx.

As you are adding support for Tx, instead of adding it as a new command, existing 'cmd_show_rx_queue_desc_used_count_parsed()' can be extended to support both Rx and Tx. You can check 'cmd_show_rx_tx_desc_status_parsed()' as sample.

This also helps to have a unified syntax for Rx and Tx, as your version is slightly diverging from the Rx one.

And please update 'cmd_help_long_parsed()' help string with relevant change.

Quoted 1 line
Quoted 1 line
Quoted 1 line

Thanks Ferruh, will update unified command for Rx/Tx in next version.

#5 lore raw

PATCH v2 1/1 app/testpmd: command to get descriptor used count

In reply to [email protected]

From: Satha Rao <[email protected]>

Existing Rx desc used count command extended to get Tx queue used count.
testpmd> show port 0 rxq 0 desc used count testpmd> show port 0 txq 0 desc used count

---
Depends-on: series-30833 ("ethdev: support Tx queue used count")

v2:
extended rx_queue_desc_used_count command to support Tx updated testpmd_app_ug with new command

 app/test-pmd/cmdline.c                      | 184 +++++++++++---------
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  10 +-
 2 files changed, 104 insertions(+), 90 deletions(-)
app/test-pmd/cmdline.c +99 -85
index f704319771..c8c88f3236 100644
@@ -12638,6 +12638,104 @@ static cmdline_parse_inst_t cmd_show_port_supported_ptypes = {
 	},
 };
 
+/* *** display rx/tx queue descriptor used count *** */
+struct cmd_show_rx_tx_queue_desc_used_count_result {
+	cmdline_fixed_string_t cmd_show;
+	cmdline_fixed_string_t cmd_port;
+	cmdline_fixed_string_t cmd_dir;
+	cmdline_fixed_string_t cmd_desc;
+	cmdline_fixed_string_t cmd_used;
+	cmdline_fixed_string_t cmd_count;
+	portid_t cmd_pid;
+	portid_t cmd_qid;
+};
+
+static void
+cmd_show_rx_tx_queue_desc_used_count_parsed(void *parsed_result, __rte_unused struct cmdline *cl,
+					    __rte_unused void *data)
+{
+	struct cmd_show_rx_tx_queue_desc_used_count_result *res = parsed_result;
+	int rc;
+
+	if (!strcmp(res->cmd_dir, "rxq")) {
+		if (rte_eth_rx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
+			fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n",
+				res->cmd_pid, res->cmd_qid);
+			return;
+		}
+
+		rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid);
+		if (rc < 0) {
+			fprintf(stderr, "Invalid queueid = %d\n", res->cmd_qid);
+			return;
+		}
+		printf("RxQ %d used desc count = %d\n", res->cmd_qid, rc);
+	} else if (!strcmp(res->cmd_dir, "txq")) {
+		if (rte_eth_tx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
+			fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n",
+				res->cmd_pid, res->cmd_qid);
+			return;
+		}
+
+		rc = rte_eth_tx_queue_count(res->cmd_pid, res->cmd_qid);
+		if (rc < 0) {
+			fprintf(stderr, "Tx queue count get failed rc=%d queue_id=%d\n", rc,
+				res->cmd_qid);
+			return;
+		}
+		printf("TxQ %d used desc count = %d\n", res->cmd_qid, rc);
+	}
+}
+
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_show =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_show, "show");
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_port =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_port, "port");
+static cmdline_parse_token_num_t cmd_show_rx_tx_queue_desc_used_count_pid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_pid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_dir =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_dir, "rxq#txq");
+static cmdline_parse_token_num_t cmd_show_rx_tx_queue_desc_used_count_qid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_qid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_desc =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_desc, "desc");
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_used =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_count, "used");
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_count =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_count, "count");
+static cmdline_parse_inst_t cmd_show_rx_tx_queue_desc_used_count = {
+	.f = cmd_show_rx_tx_queue_desc_used_count_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> rxq|txq <queue_id> desc used count",
+	.tokens = {
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_show,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_port,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_pid,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_dir,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_qid,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_desc,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_used,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_count,
+		NULL,
+	},
+};
+
 /* *** display rx/tx descriptor status *** */
 struct cmd_show_rx_tx_desc_status_result {
 	cmdline_fixed_string_t cmd_show;
@@ -12745,90 +12843,6 @@ static cmdline_parse_inst_t cmd_show_rx_tx_desc_status = {
 	},
 };
 
-/* *** display rx queue desc used count *** */
-struct cmd_show_rx_queue_desc_used_count_result {
-	cmdline_fixed_string_t cmd_show;
-	cmdline_fixed_string_t cmd_port;
-	cmdline_fixed_string_t cmd_rxq;
-	cmdline_fixed_string_t cmd_desc;
-	cmdline_fixed_string_t cmd_used;
-	cmdline_fixed_string_t cmd_count;
-	portid_t cmd_pid;
-	portid_t cmd_qid;
-};
-
-static void
-cmd_show_rx_queue_desc_used_count_parsed(void *parsed_result,
-		__rte_unused struct cmdline *cl,
-		__rte_unused void *data)
-{
-	struct cmd_show_rx_queue_desc_used_count_result *res = parsed_result;
-	int rc;
-
-	if (rte_eth_rx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
-		fprintf(stderr,
-			"Invalid input: port id = %d, queue id = %d\n",
-			res->cmd_pid, res->cmd_qid);
-		return;
-	}
-
-	rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid);
-	if (rc < 0) {
-		fprintf(stderr, "Invalid queueid = %d\n", res->cmd_qid);
-		return;
-	}
-	printf("Used desc count = %d\n", rc);
-}
-
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_show =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_show, "show");
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_port =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_port, "port");
-static cmdline_parse_token_num_t cmd_show_rx_queue_desc_used_count_pid =
-	TOKEN_NUM_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_pid, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_rxq =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_rxq, "rxq");
-static cmdline_parse_token_num_t cmd_show_rx_queue_desc_used_count_qid =
-	TOKEN_NUM_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_qid, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_desc =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_count, "desc");
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_used =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_count, "used");
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_count =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_count, "count");
-static cmdline_parse_inst_t cmd_show_rx_queue_desc_used_count = {
-	.f = cmd_show_rx_queue_desc_used_count_parsed,
-	.data = NULL,
-	.help_str = "show port <port_id> rxq <queue_id> desc used count",
-	.tokens = {
-		(void *)&cmd_show_rx_queue_desc_used_count_show,
-		(void *)&cmd_show_rx_queue_desc_used_count_port,
-		(void *)&cmd_show_rx_queue_desc_used_count_pid,
-		(void *)&cmd_show_rx_queue_desc_used_count_rxq,
-		(void *)&cmd_show_rx_queue_desc_used_count_qid,
-		(void *)&cmd_show_rx_queue_desc_used_count_desc,
-		(void *)&cmd_show_rx_queue_desc_used_count_used,
-		(void *)&cmd_show_rx_queue_desc_used_count_count,
-		NULL,
-	},
-};
-
 /* Common result structure for set port ptypes */
 struct cmd_set_port_ptypes_result {
 	cmdline_fixed_string_t set;
@@ -13345,7 +13359,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_config_tx_metadata_specific,
 	(cmdline_parse_inst_t *)&cmd_show_tx_metadata,
 	(cmdline_parse_inst_t *)&cmd_show_rx_tx_desc_status,
-	(cmdline_parse_inst_t *)&cmd_show_rx_queue_desc_used_count,
+	(cmdline_parse_inst_t *)&cmd_show_rx_tx_queue_desc_used_count,
 	(cmdline_parse_inst_t *)&cmd_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw_all,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +5 -5
index ab18a80b30..6369ee337e 100644
@@ -264,13 +264,13 @@ Display information for a given port's RX/TX descriptor status::
 
    testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status
 
-show rxq desc used count
-~~~~~~~~~~~~~~~~~~~~~~~~
+show desc used count(rxq|txq)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Display the number of receive packet descriptors currently filled by hardware
-and ready to be processed by the driver on a given RX queue::
+Display the number of packet descriptors currently used by hardware for a given
+port's RX/TX queue::
 
-   testpmd> show port (port_id) rxq (queue_id) desc used count
+   testpmd> show port (port_id) (rxq|txq) (queue_id) desc used count
 
 show config
 ~~~~~~~~~~~
Signature · 1 line
2.25.1
#6 lore raw

Re: [PATCH v2] app/testpmd: command to get descriptor used count

Quoted 47 lines · On 2/1/2024 1:52 PM, [email protected] wrote:

From: Satha Rao <[email protected]>

Existing Rx desc used count command extended to get Tx queue used count.
testpmd> show port 0 rxq 0 desc used count testpmd> show port 0 txq 0 desc used count

---
Depends-on: series-30833 ("ethdev: support Tx queue used count")

v2:
extended rx_queue_desc_used_count command to support Tx updated testpmd_app_ug with new command

 app/test-pmd/cmdline.c                      | 184 +++++++++++---------
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  10 +-
 2 files changed, 104 insertions(+), 90 deletions(-)
app/test-pmd/cmdline.c +20 -0
index f704319771..c8c88f3236 100644
@@ -12638,6 +12638,104 @@ static cmdline_parse_inst_t cmd_show_port_supported_ptypes = {
 	},
 };
 
+/* *** display rx/tx queue descriptor used count *** */
+struct cmd_show_rx_tx_queue_desc_used_count_result {
+	cmdline_fixed_string_t cmd_show;
+	cmdline_fixed_string_t cmd_port;
+	cmdline_fixed_string_t cmd_dir;
+	cmdline_fixed_string_t cmd_desc;
+	cmdline_fixed_string_t cmd_used;
+	cmdline_fixed_string_t cmd_count;
+	portid_t cmd_pid;
+	portid_t cmd_qid;
+};
+
+static void
+cmd_show_rx_tx_queue_desc_used_count_parsed(void *parsed_result, __rte_unused struct cmdline *cl,
+					    __rte_unused void *data)
+{
+	struct cmd_show_rx_tx_queue_desc_used_count_result *res = parsed_result;
+	int rc;
+
+	if (!strcmp(res->cmd_dir, "rxq")) {

app/test-pmd/cmdline.c static cmdline_parse_inst_t cmd_show_port_supported_ptypes = { · line 12670

Quoted 10 lines
app/test-pmd/cmdline.c +9 -0
+		if (rte_eth_rx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
+			fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n",
+				res->cmd_pid, res->cmd_qid);
+			return;
+		}
+
+		rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid);
+		if (rc < 0) {
+			fprintf(stderr, "Invalid queueid = %d\n", res->cmd_qid);
 

Can you please unify the error message for Rx and Tx?

Quoted 151 lines
app/test-pmd/cmdline.c +69 -0
+			return;
+		}
+		printf("RxQ %d used desc count = %d\n", res->cmd_qid, rc);
+	} else if (!strcmp(res->cmd_dir, "txq")) {
+		if (rte_eth_tx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
+			fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n",
+				res->cmd_pid, res->cmd_qid);
+			return;
+		}
+
+		rc = rte_eth_tx_queue_count(res->cmd_pid, res->cmd_qid);
+		if (rc < 0) {
+			fprintf(stderr, "Tx queue count get failed rc=%d queue_id=%d\n", rc,
+				res->cmd_qid);
+			return;
+		}
+		printf("TxQ %d used desc count = %d\n", res->cmd_qid, rc);
+	}
+}
+
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_show =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_show, "show");
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_port =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_port, "port");
+static cmdline_parse_token_num_t cmd_show_rx_tx_queue_desc_used_count_pid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_pid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_dir =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_dir, "rxq#txq");
+static cmdline_parse_token_num_t cmd_show_rx_tx_queue_desc_used_count_qid =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_qid, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_desc =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_desc, "desc");
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_used =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_count, "used");
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_count =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_count, "count");
+static cmdline_parse_inst_t cmd_show_rx_tx_queue_desc_used_count = {
+	.f = cmd_show_rx_tx_queue_desc_used_count_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> rxq|txq <queue_id> desc used count",
+	.tokens = {
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_show,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_port,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_pid,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_dir,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_qid,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_desc,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_used,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_count,
+		NULL,
+	},
+};
+
 /* *** display rx/tx descriptor status *** */
 struct cmd_show_rx_tx_desc_status_result {
app/test-pmd/cmdline.c +0 -75
 	cmdline_fixed_string_t cmd_show;
@@ -12745,90 +12843,6 @@ static cmdline_parse_inst_t cmd_show_rx_tx_desc_status = {
 	},
 };
 
-/* *** display rx queue desc used count *** */
-struct cmd_show_rx_queue_desc_used_count_result {
-	cmdline_fixed_string_t cmd_show;
-	cmdline_fixed_string_t cmd_port;
-	cmdline_fixed_string_t cmd_rxq;
-	cmdline_fixed_string_t cmd_desc;
-	cmdline_fixed_string_t cmd_used;
-	cmdline_fixed_string_t cmd_count;
-	portid_t cmd_pid;
-	portid_t cmd_qid;
-};
-
-static void
-cmd_show_rx_queue_desc_used_count_parsed(void *parsed_result,
-		__rte_unused struct cmdline *cl,
-		__rte_unused void *data)
-{
-	struct cmd_show_rx_queue_desc_used_count_result *res = parsed_result;
-	int rc;
-
-	if (rte_eth_rx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
-		fprintf(stderr,
-			"Invalid input: port id = %d, queue id = %d\n",
-			res->cmd_pid, res->cmd_qid);
-		return;
-	}
-
-	rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid);
-	if (rc < 0) {
-		fprintf(stderr, "Invalid queueid = %d\n", res->cmd_qid);
-		return;
-	}
-	printf("Used desc count = %d\n", rc);
-}
-
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_show =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_show, "show");
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_port =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_port, "port");
-static cmdline_parse_token_num_t cmd_show_rx_queue_desc_used_count_pid =
-	TOKEN_NUM_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_pid, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_rxq =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_rxq, "rxq");
-static cmdline_parse_token_num_t cmd_show_rx_queue_desc_used_count_qid =
-	TOKEN_NUM_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_qid, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_desc =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_count, "desc");
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_used =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_count, "used");
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_count =
-	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_count, "count");
-static cmdline_parse_inst_t cmd_show_rx_queue_desc_used_count = {
-	.f = cmd_show_rx_queue_desc_used_count_parsed,
-	.data = NULL,
-	.help_str = "show port <port_id> rxq <queue_id> desc used count",
-	.tokens = {
-		(void *)&cmd_show_rx_queue_desc_used_count_show,
-		(void *)&cmd_show_rx_queue_desc_used_count_port,
-		(void *)&cmd_show_rx_queue_desc_used_count_pid,

app/test-pmd/cmdline.c static cmdline_parse_inst_t cmd_show_rx_tx_desc_status = { · line 12846

Quoted 10 lines
app/test-pmd/cmdline.c +0 -9
-		(void *)&cmd_show_rx_queue_desc_used_count_rxq,
-		(void *)&cmd_show_rx_queue_desc_used_count_qid,
-		(void *)&cmd_show_rx_queue_desc_used_count_desc,
-		(void *)&cmd_show_rx_queue_desc_used_count_used,
-		(void *)&cmd_show_rx_queue_desc_used_count_count,
-		NULL,
-	},
-};
-
 

Why moving the function up, can you please keep it in same place.

Also can you please update help command output in 'cmd_help_long_parsed()' function at the beggining of the file?

#7 lore raw

PATCH v3 1/1 app/testpmd: command to get descriptor used count

In reply to [email protected]

From: Satha Rao <[email protected]>

Existing Rx desc used count command extended to get Tx queue used count.
testpmd> show port 0 rxq 0 desc used count testpmd> show port 0 txq 0 desc used count

---
Depends-on: series-30833 ("ethdev: support Tx queue used count")

v2:
extended rx_queue_desc_used_count command to support Tx updated testpmd_app_ug with new command

v3:
Updated help string, log message as per review comments

 app/test-pmd/cmdline.c                      | 116 ++++++++++++++++------------
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  10 +--
 2 files changed, 70 insertions(+), 56 deletions(-)
app/test-pmd/cmdline.c +65 -51
index f704319..d8ea2b7 100644
@@ -237,9 +237,8 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"show port (port_id) rxq|txq (queue_id) desc (desc_id) status"
 			"       Show status of rx|tx descriptor.\n\n"
 
-			"show port (port_id) rxq (queue_id) desc used count\n"
-			"    Show current number of filled receive"
-			" packet descriptors.\n\n"
+			"show port (port_id) rxq|txq (queue_id) desc used count\n"
+			"    Show current number of used descriptor count for rx|tx.\n\n"
 
 			"show port (port_id) macs|mcast_macs"
 			"       Display list of mac addresses added to port.\n\n"
@@ -12745,11 +12744,11 @@ struct cmd_show_rx_tx_desc_status_result {
 	},
 };
 
-/* *** display rx queue desc used count *** */
-struct cmd_show_rx_queue_desc_used_count_result {
+/* *** display rx/tx queue descriptor used count *** */
+struct cmd_show_rx_tx_queue_desc_used_count_result {
 	cmdline_fixed_string_t cmd_show;
 	cmdline_fixed_string_t cmd_port;
-	cmdline_fixed_string_t cmd_rxq;
+	cmdline_fixed_string_t cmd_dir;
 	cmdline_fixed_string_t cmd_desc;
 	cmdline_fixed_string_t cmd_used;
 	cmdline_fixed_string_t cmd_count;
@@ -12758,73 +12757,88 @@ struct cmd_show_rx_queue_desc_used_count_result {
 };
 
 static void
-cmd_show_rx_queue_desc_used_count_parsed(void *parsed_result,
-		__rte_unused struct cmdline *cl,
-		__rte_unused void *data)
+cmd_show_rx_tx_queue_desc_used_count_parsed(void *parsed_result, __rte_unused struct cmdline *cl,
+					    __rte_unused void *data)
 {
-	struct cmd_show_rx_queue_desc_used_count_result *res = parsed_result;
+	struct cmd_show_rx_tx_queue_desc_used_count_result *res = parsed_result;
 	int rc;
 
-	if (rte_eth_rx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
-		fprintf(stderr,
-			"Invalid input: port id = %d, queue id = %d\n",
-			res->cmd_pid, res->cmd_qid);
-		return;
-	}
+	if (!strcmp(res->cmd_dir, "rxq")) {
+		if (rte_eth_rx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
+			fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n",
+				res->cmd_pid, res->cmd_qid);
+			return;
+		}
 
-	rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid);
-	if (rc < 0) {
-		fprintf(stderr, "Invalid queueid = %d\n", res->cmd_qid);
-		return;
+		rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid);
+		if (rc < 0) {
+			fprintf(stderr, "Rx queue count get failed rc=%d queue_id=%d\n", rc,
+				res->cmd_qid);
+			return;
+		}
+		printf("RxQ %d used desc count = %d\n", res->cmd_qid, rc);
+	} else if (!strcmp(res->cmd_dir, "txq")) {
+		if (rte_eth_tx_queue_is_valid(res->cmd_pid, res->cmd_qid) != 0) {
+			fprintf(stderr, "Invalid input: port id = %d, queue id = %d\n",
+				res->cmd_pid, res->cmd_qid);
+			return;
+		}
+
+		rc = rte_eth_tx_queue_count(res->cmd_pid, res->cmd_qid);
+		if (rc < 0) {
+			fprintf(stderr, "Tx queue count get failed rc=%d queue_id=%d\n", rc,
+				res->cmd_qid);
+			return;
+		}
+		printf("TxQ %d used desc count = %d\n", res->cmd_qid, rc);
 	}
-	printf("Used desc count = %d\n", rc);
 }
 
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_show =
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_show =
 	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
 		 cmd_show, "show");
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_port =
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_port =
 	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
 		 cmd_port, "port");
-static cmdline_parse_token_num_t cmd_show_rx_queue_desc_used_count_pid =
+static cmdline_parse_token_num_t cmd_show_rx_tx_queue_desc_used_count_pid =
 	TOKEN_NUM_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
 		 cmd_pid, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_rxq =
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_dir =
 	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_rxq, "rxq");
-static cmdline_parse_token_num_t cmd_show_rx_queue_desc_used_count_qid =
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_dir, "rxq#txq");
+static cmdline_parse_token_num_t cmd_show_rx_tx_queue_desc_used_count_qid =
 	TOKEN_NUM_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
 		 cmd_qid, RTE_UINT16);
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_desc =
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_desc =
 	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
-		 cmd_count, "desc");
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_used =
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
+		 cmd_desc, "desc");
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_used =
 	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
 		 cmd_count, "used");
-static cmdline_parse_token_string_t cmd_show_rx_queue_desc_used_count_count =
+static cmdline_parse_token_string_t cmd_show_rx_tx_queue_desc_used_count_count =
 	TOKEN_STRING_INITIALIZER
-		(struct cmd_show_rx_queue_desc_used_count_result,
+		(struct cmd_show_rx_tx_queue_desc_used_count_result,
 		 cmd_count, "count");
-static cmdline_parse_inst_t cmd_show_rx_queue_desc_used_count = {
-	.f = cmd_show_rx_queue_desc_used_count_parsed,
+static cmdline_parse_inst_t cmd_show_rx_tx_queue_desc_used_count = {
+	.f = cmd_show_rx_tx_queue_desc_used_count_parsed,
 	.data = NULL,
-	.help_str = "show port <port_id> rxq <queue_id> desc used count",
+	.help_str = "show port <port_id> rxq|txq <queue_id> desc used count",
 	.tokens = {
-		(void *)&cmd_show_rx_queue_desc_used_count_show,
-		(void *)&cmd_show_rx_queue_desc_used_count_port,
-		(void *)&cmd_show_rx_queue_desc_used_count_pid,
-		(void *)&cmd_show_rx_queue_desc_used_count_rxq,
-		(void *)&cmd_show_rx_queue_desc_used_count_qid,
-		(void *)&cmd_show_rx_queue_desc_used_count_desc,
-		(void *)&cmd_show_rx_queue_desc_used_count_used,
-		(void *)&cmd_show_rx_queue_desc_used_count_count,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_show,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_port,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_pid,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_dir,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_qid,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_desc,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_used,
+		(void *)&cmd_show_rx_tx_queue_desc_used_count_count,
 		NULL,
 	},
 };
@@ -13345,7 +13359,7 @@ struct cmd_config_tx_affinity_map {
 	(cmdline_parse_inst_t *)&cmd_config_tx_metadata_specific,
 	(cmdline_parse_inst_t *)&cmd_show_tx_metadata,
 	(cmdline_parse_inst_t *)&cmd_show_rx_tx_desc_status,
-	(cmdline_parse_inst_t *)&cmd_show_rx_queue_desc_used_count,
+	(cmdline_parse_inst_t *)&cmd_show_rx_tx_queue_desc_used_count,
 	(cmdline_parse_inst_t *)&cmd_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw_all,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +5 -5
index 53923ad..468f70b 100644
@@ -264,13 +264,13 @@ Display information for a given port's RX/TX descriptor status::
 
    testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status
 
-show rxq desc used count
-~~~~~~~~~~~~~~~~~~~~~~~~
+show desc used count(rxq|txq)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Display the number of receive packet descriptors currently filled by hardware
-and ready to be processed by the driver on a given RX queue::
+Display the number of packet descriptors currently used by hardware for a given
+port's RX/TX queue::
 
-   testpmd> show port (port_id) rxq (queue_id) desc used count
+   testpmd> show port (port_id) (rxq|txq) (queue_id) desc used count
 
 show config
 ~~~~~~~~~~~
Signature · 1 line
1.8.3.1
Reviewed-by on v3 1/1 Applied
#8 lore raw

Re: [PATCH v3] app/testpmd: command to get descriptor used count

Quoted 9 lines · On 2/7/2024 5:04 PM, [email protected] wrote:

From: Satha Rao <[email protected]>

Existing Rx desc used count command extended to get Tx queue used count.
testpmd> show port 0 rxq 0 desc used count testpmd> show port 0 txq 0 desc used count

Applied to dpdk-next-net/main, thanks.