DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 21.05] app/testpmd: support show Rx queue count
@ 2021-02-11 19:44 Lance Richardson
  2021-02-12 11:51 ` Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Lance Richardson @ 2021-02-11 19:44 UTC (permalink / raw)
  To: Xiaoyun Li; +Cc: dev

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


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

* Re: [dpdk-dev] [PATCH 21.05] app/testpmd: support show Rx queue count
  2021-02-11 19:44 [dpdk-dev] [PATCH 21.05] app/testpmd: support show Rx queue count Lance Richardson
@ 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 21:24 ` [dpdk-dev] [PATCH 21.05 v3] app/testpmd: display rxq desc used count Lance Richardson
  2 siblings, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2021-02-12 11:51 UTC (permalink / raw)
  To: Lance Richardson, Xiaoyun Li; +Cc: dev

On 2/11/2021 7:44 PM, Lance Richardson wrote:
> Add support for querying receive queue count in order to allow
> the rte_eth_dev rx_queue_count() API to be exercised and tested.
> 

+1 to adding this feature, but the naming is a little misleading, "Rx queue 
count", it looks like it will print the number of Rx queues, and the API has the 
same problem indeed.

Can you please clarify it that it is to get number of used descriptor in a Rx queue?
And "used descriptor" part also needs some explanation I think.

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

There is already an existing command:
"show port <port_id> rxq|txq <queue_id> desc <desc_id> status"

What do you think adding the new one as something like:
"show port <port_id> rxq <queue_id> desc used 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
> +~~~~~~~~~~~~~~~~~~~~~~~~~

The '~' line length should be same as header length

> +
> +Display the number of ready descriptors on a given RX queue::

Can you please describe more, what is "ready descriptor"?

The 'rte_eth_rx_queue_count()' API should be returning number of descriptors 
filled by HW.

> +
> +   testpmd> show port (port_id) rxq (queue_id) count
>   
>   show config
>   ~~~~~~~~~~~
> 


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

* [dpdk-dev] [PATCH 21.05 v2] app/testpmd: support show Rx queue desc count
  2021-02-11 19:44 [dpdk-dev] [PATCH 21.05] app/testpmd: support show Rx queue count Lance Richardson
  2021-02-12 11:51 ` Ferruh Yigit
@ 2021-02-12 14:56 ` 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
  2 siblings, 1 reply; 8+ messages in thread
From: Lance Richardson @ 2021-02-12 14:56 UTC (permalink / raw)
  To: Xiaoyun Li; +Cc: dev, ferruh.yigit

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

Add support for querying the count of ready 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>
---
 app/test-pmd/cmdline.c                      | 83 +++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  7 ++
 2 files changed, 90 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 59722d268..821dd3d77 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -16699,6 +16699,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_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 +17180,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..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
 ~~~~~~~~~~~
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH 21.05] app/testpmd: support show Rx queue count
  2021-02-12 11:51 ` Ferruh Yigit
@ 2021-02-12 15:12   ` Lance Richardson
  0 siblings, 0 replies; 8+ messages in thread
From: Lance Richardson @ 2021-02-12 15:12 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Xiaoyun Li, dev

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

On Fri, Feb 12, 2021 at 6:51 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 2/11/2021 7:44 PM, Lance Richardson wrote:
> > Add support for querying receive queue count in order to allow
> > the rte_eth_dev rx_queue_count() API to be exercised and tested.
> >
>
> +1 to adding this feature, but the naming is a little misleading, "Rx queue
> count", it looks like it will print the number of Rx queues, and the API has the
> same problem indeed.
>
> Can you please clarify it that it is to get number of used descriptor in a Rx queue?
> And "used descriptor" part also needs some explanation I think.
>
That makes sense, fixed in v2.

>
> There is already an existing command:
> "show port <port_id> rxq|txq <queue_id> desc <desc_id> status"
>
> What do you think adding the new one as something like:
> "show port <port_id> rxq <queue_id> desc used count"

Sounds good, v2 is updated to use that form.

> > +show rxq count
> > +~~~~~~~~~~~~~~~~~~~~~~~~~
>
> The '~' line length should be same as header length
>

Fixed in v2.

> > +
> > +Display the number of ready descriptors on a given RX queue::
>
> Can you please describe more, what is "ready descriptor"?
>
> The 'rte_eth_rx_queue_count()' API should be returning number of descriptors
> filled by HW.
>

I took a stab at this in v2, but maybe it could be expanded more.

As I understand it, the returned descriptor count should correspond to
the number of packets that could be received in the next call to the burst
receive function... not necessarily the hardware-specific notion of a
descriptor, which might include descriptors used for chained mbufs,
LRO metadata, async status messages from firmware, etc.

Thanks,

    Lance

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

* Re: [dpdk-dev] [PATCH 21.05 v2] app/testpmd: support show Rx queue desc count
  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
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2021-02-12 16:16 UTC (permalink / raw)
  To: Lance Richardson, Xiaoyun Li; +Cc: dev

On 2/12/2021 2:56 PM, Lance Richardson wrote:
> Add support for querying the count of ready descriptors on a
> receive queue in order to allow the rte_eth_dev rx_queue_count()
> API to be exercised and tested.
> 

Overall looks good to me, but there are slightly different reference to the feature,
the commit title mentions from feature as "show Rx queue desc count",
the commit log has as "count of ready descriptors",
and the documentation has "rxq desc used count",
what do you think unifying them?

> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>

<...>

> +	.f = cmd_show_rx_queue_desc_used_count_parsed,
> +	.data = NULL,
> +	.help_str = "show port <port_id> rxq <queue_id> desc used count",

Can you please add the new command to the help, 'cmd_help_long_parsed()' too?


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

* [dpdk-dev] [PATCH 21.05 v3] app/testpmd: display rxq desc used count
  2021-02-11 19:44 [dpdk-dev] [PATCH 21.05] app/testpmd: support show Rx queue count Lance Richardson
  2021-02-12 11:51 ` Ferruh Yigit
  2021-02-12 14:56 ` [dpdk-dev] [PATCH 21.05 v2] app/testpmd: support show Rx queue desc count Lance Richardson
@ 2021-02-12 21:24 ` Lance Richardson
  2021-02-22  5:15   ` Li, Xiaoyun
  2 siblings, 1 reply; 8+ messages in thread
From: Lance Richardson @ 2021-02-12 21:24 UTC (permalink / raw)
  To: Xiaoyun Li; +Cc: dev, ferruh.yigit

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

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

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


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

* Re: [dpdk-dev] [PATCH 21.05 v3] app/testpmd: display rxq desc used count
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Li, Xiaoyun @ 2021-02-22  5:15 UTC (permalink / raw)
  To: Lance Richardson; +Cc: dev, Yigit, Ferruh

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

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

* Re: [dpdk-dev] [PATCH 21.05 v3] app/testpmd: display rxq desc used count
  2021-02-22  5:15   ` Li, Xiaoyun
@ 2021-02-22 11:17     ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2021-02-22 11:17 UTC (permalink / raw)
  To: Li, Xiaoyun, Lance Richardson; +Cc: dev

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.

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

end of thread, other threads:[~2021-02-22 11:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 19:44 [dpdk-dev] [PATCH 21.05] app/testpmd: support show Rx queue count Lance Richardson
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

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