DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lance Richardson <lance.richardson@broadcom.com>
To: Xiaoyun Li <xiaoyun.li@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 21.05] app/testpmd: support show Rx queue count
Date: Thu, 11 Feb 2021 14:44:34 -0500	[thread overview]
Message-ID: <20210211194434.172212-1-lance.richardson@broadcom.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3846 bytes --]

Add support for querying receive queue count 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>
---
 app/test-pmd/cmdline.c                      | 65 +++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  6 ++
 2 files changed, 71 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 59722d268..6e2fe57a6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -16699,6 +16699,70 @@ cmdline_parse_inst_t cmd_show_rx_tx_desc_status = {
 	},
 };
 
+/* *** display rx queue count *** */
+struct cmd_show_rx_queue_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_count;
+	portid_t cmd_pid;
+	portid_t cmd_qid;
+};
+
+static void
+cmd_show_rx_queue_count_parsed(void *parsed_result,
+		__rte_unused struct cmdline *cl,
+		__rte_unused void *data)
+{
+	struct cmd_show_rx_queue_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_count_show =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_rx_queue_count_result,
+			cmd_show, "show");
+cmdline_parse_token_string_t cmd_show_rx_queue_count_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_rx_queue_count_result,
+			cmd_port, "port");
+cmdline_parse_token_num_t cmd_show_rx_queue_count_pid =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_rx_queue_count_result,
+			cmd_pid, RTE_UINT16);
+cmdline_parse_token_string_t cmd_show_rx_queue_count_rxq =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_rx_queue_count_result,
+			cmd_rxq, "rxq");
+cmdline_parse_token_num_t cmd_show_rx_queue_count_qid =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_rx_queue_count_result,
+			cmd_qid, RTE_UINT16);
+cmdline_parse_token_string_t cmd_show_rx_queue_count_count =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_rx_queue_count_result,
+			cmd_count, "count");
+cmdline_parse_inst_t cmd_show_rx_queue_count = {
+	.f = cmd_show_rx_queue_count_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> rxq <queue_id> count",
+	.tokens = {
+		(void *)&cmd_show_rx_queue_count_show,
+		(void *)&cmd_show_rx_queue_count_port,
+		(void *)&cmd_show_rx_queue_count_pid,
+		(void *)&cmd_show_rx_queue_count_rxq,
+		(void *)&cmd_show_rx_queue_count_qid,
+		(void *)&cmd_show_rx_queue_count_count,
+		NULL,
+	},
+};
+
 /* Common result structure for set port ptypes */
 struct cmd_set_port_ptypes_result {
 	cmdline_fixed_string_t set;
@@ -17098,6 +17162,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_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..789ee7d27 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -266,6 +266,12 @@ 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 count
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Display the number of ready descriptors on a given RX queue::
+
+   testpmd> show port (port_id) rxq (queue_id) count
 
 show config
 ~~~~~~~~~~~
-- 
2.25.1


             reply	other threads:[~2021-02-11 19:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 19:44 Lance Richardson [this message]
2021-02-12 11:51 ` Ferruh Yigit
2021-02-12 15:12   ` Lance Richardson
2021-02-12 14:56 ` [dpdk-dev] [PATCH 21.05 v2] app/testpmd: support show Rx queue desc count Lance Richardson
2021-02-12 16:16   ` Ferruh Yigit
2021-02-12 21:24 ` [dpdk-dev] [PATCH 21.05 v3] app/testpmd: display rxq desc used count Lance Richardson
2021-02-22  5:15   ` Li, Xiaoyun
2021-02-22 11:17     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210211194434.172212-1-lance.richardson@broadcom.com \
    --to=lance.richardson@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=xiaoyun.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).