diff mbox series

[21.05,v3] app/testpmd: display rxq desc used count

Message ID 20210212212452.200471-1-lance.richardson@broadcom.com (mailing list archive)
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series [21.05,v3] app/testpmd: display rxq desc used count | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/travis-robot fail travis build: failed
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Lance Richardson Feb. 12, 2021, 9:24 p.m. UTC
Add support for displaying the count of used (filled by hardware
but not yet processed by the driver) descriptors on a receive
queue in order to allow the rte_eth_dev rx_queue_count() API to
be exercised and tested.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
v3:
 - Made terminology more consistent betwen commit log, title, and
   documentation text.
 - Added long help text for new command.

v2:
 - Changed command syntax from "show port <> rxq <> count" to
   "show port <> rxq <> desc used count".
 - Expanded description to clarify the meaning of the displayed
   descriptor count.
 - Fixed header line length.

 app/test-pmd/cmdline.c                      | 87 +++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 ++
 2 files changed, 94 insertions(+)

Comments

Li, Xiaoyun Feb. 22, 2021, 5:15 a.m. UTC | #1
> -----Original Message-----
> From: Lance Richardson <lance.richardson@broadcom.com>
> Sent: Saturday, February 13, 2021 05:25
> To: Li, Xiaoyun <xiaoyun.li@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: [PATCH 21.05 v3] app/testpmd: display rxq desc used count
> 
> Add support for displaying the count of used (filled by hardware
> but not yet processed by the driver) descriptors on a receive
> queue in order to allow the rte_eth_dev rx_queue_count() API to
> be exercised and tested.
> 
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
> ---
> v3:
>  - Made terminology more consistent betwen commit log, title, and
>    documentation text.
>  - Added long help text for new command.
> 
> v2:
>  - Changed command syntax from "show port <> rxq <> count" to
>    "show port <> rxq <> desc used count".
>  - Expanded description to clarify the meaning of the displayed
>    descriptor count.
>  - Fixed header line length.
> 
>  app/test-pmd/cmdline.c                      | 87 +++++++++++++++++++++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 ++
>  2 files changed, 94 insertions(+)
> 

Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
Ferruh Yigit Feb. 22, 2021, 11:17 a.m. UTC | #2
On 2/22/2021 5:15 AM, Li, Xiaoyun wrote:
>> -----Original Message-----
>> From: Lance Richardson <lance.richardson@broadcom.com>
>> Sent: Saturday, February 13, 2021 05:25
>> To: Li, Xiaoyun <xiaoyun.li@intel.com>
>> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>
>> Subject: [PATCH 21.05 v3] app/testpmd: display rxq desc used count
>>
>> Add support for displaying the count of used (filled by hardware
>> but not yet processed by the driver) descriptors on a receive
>> queue in order to allow the rte_eth_dev rx_queue_count() API to
>> be exercised and tested.
>>
>> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
>> ---
>> v3:
>>   - Made terminology more consistent betwen commit log, title, and
>>     documentation text.
>>   - Added long help text for new command.
>>
>> v2:
>>   - Changed command syntax from "show port <> rxq <> count" to
>>     "show port <> rxq <> desc used count".
>>   - Expanded description to clarify the meaning of the displayed
>>     descriptor count.
>>   - Fixed header line length.
>>
>>   app/test-pmd/cmdline.c                      | 87 +++++++++++++++++++++
>>   doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 ++
>>   2 files changed, 94 insertions(+)
>>
> 
> Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
> 

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

Added release notes update while merging.
diff mbox series

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 59722d268..8eb2a48ef 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -246,6 +246,10 @@  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) macs|mcast_macs"
 			"       Display list of mac addresses added to port.\n\n"
 
@@ -16699,6 +16703,88 @@  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_dev_is_valid_port(res->cmd_pid)) {
+		printf("invalid port id %u\n", res->cmd_pid);
+		return;
+	}
+
+	rc = rte_eth_rx_queue_count(res->cmd_pid, res->cmd_qid);
+	if (rc < 0) {
+		printf("Invalid queueid = %d\n", res->cmd_qid);
+		return;
+	}
+	printf("Used desc count = %d\n", rc);
+}
+
+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");
+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");
+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);
+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");
+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);
+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");
+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");
+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");
+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;
@@ -17098,6 +17184,7 @@  cmdline_parse_ctx_t main_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_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw_all,
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index a45910b81..703dead0c 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -266,6 +266,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
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Display the number of receive packet descriptors currently filled by hardware
+and ready to be processed by the driver on a given RX queue::
+
+   testpmd> show port (port_id) rxq (queue_id) desc used count
 
 show config
 ~~~~~~~~~~~