patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] examples/vdpa: fix disabled VirtQ statistics query
@ 2022-02-24 13:24 Xueming Li
  2022-03-03  6:45 ` Xia, Chenbo
  2022-04-22  8:40 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Xueming Li @ 2022-02-24 13:24 UTC (permalink / raw)
  To: dev; +Cc: xuemingl, stable, Maxime Coquelin, Chenbo Xia, Matan Azrad

Quit VirtQ statistics query instead of reporting error.

Fixes: 6505865aa8ed ("examples/vdpa: add statistics show command")
Cc: stable@dpdk.org

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 examples/vdpa/main.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 5ab07655aed..bd66deca85c 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -391,7 +391,9 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl,
 	struct rte_vdpa_device *vdev = rte_vdpa_find_device_by_name(res->bdf);
 	struct vdpa_port *vport = NULL;
 	uint32_t first, last;
+	int vq_disabled = -1;
 	int i;
+	int ret;
 
 	if (!vdev) {
 		RTE_LOG(ERR, VDPA, "Invalid device: %s.\n",
@@ -449,8 +451,20 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl,
 	cmdline_printf(cl, "\nDevice %s:\n", res->bdf);
 	for (; first <= last; first++) {
 		memset(vport->stats, 0, sizeof(*vport->stats) * vport->stats_n);
-		if (rte_vdpa_get_stats(vport->dev, (int)first, vport->stats,
-					vport->stats_n) <= 0) {
+		ret = rte_vdpa_get_stats(vport->dev, (int)first, vport->stats,
+						vport->stats_n);
+		if (ret == 0) {
+			/* VQ disabled. */
+			if (vq_disabled == -1)
+				vq_disabled = (int)first;
+			continue;
+		}
+		if (vq_disabled != -1) {
+			cmdline_printf(cl, "\tVirtq %d - %d disabled\n",
+				       vq_disabled, (int)first - 1);
+			vq_disabled = -1;
+		}
+		if (ret < 0) {
 			RTE_LOG(ERR, VDPA, "Failed to get vdpa queue statistics"
 				" for device %s qid %d.\n", res->bdf,
 				(int)first);
@@ -464,6 +478,9 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl,
 				vport->stats[i].value);
 		}
 	}
+	if (vq_disabled != -1)
+		cmdline_printf(cl, "\tVirtq %d - %d disabled\n",
+			       vq_disabled, (int)first - 1);
 }
 
 cmdline_parse_token_string_t cmd_device_stats_ =
-- 
2.35.1


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

* RE: [PATCH] examples/vdpa: fix disabled VirtQ statistics query
  2022-02-24 13:24 [PATCH] examples/vdpa: fix disabled VirtQ statistics query Xueming Li
@ 2022-03-03  6:45 ` Xia, Chenbo
  2022-04-22  8:40 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2022-03-03  6:45 UTC (permalink / raw)
  To: Xueming Li, dev; +Cc: stable, Maxime Coquelin, Matan Azrad

Hi Xueming,

> -----Original Message-----
> From: Xueming Li <xuemingl@nvidia.com>
> Sent: Thursday, February 24, 2022 9:24 PM
> To: dev@dpdk.org
> Cc: xuemingl@nvidia.com; stable@dpdk.org; Maxime Coquelin
> <maxime.coquelin@redhat.com>; Xia, Chenbo <chenbo.xia@intel.com>; Matan Azrad
> <matan@mellanox.com>
> Subject: [PATCH] examples/vdpa: fix disabled VirtQ statistics query
> 
> Quit VirtQ statistics query instead of reporting error.
> 
> Fixes: 6505865aa8ed ("examples/vdpa: add statistics show command")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
>  examples/vdpa/main.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
> index 5ab07655aed..bd66deca85c 100644
> --- a/examples/vdpa/main.c
> +++ b/examples/vdpa/main.c
> @@ -391,7 +391,9 @@ static void cmd_device_stats_parsed(void *parsed_result,
> struct cmdline *cl,
>  	struct rte_vdpa_device *vdev = rte_vdpa_find_device_by_name(res->bdf);
>  	struct vdpa_port *vport = NULL;
>  	uint32_t first, last;
> +	int vq_disabled = -1;
>  	int i;
> +	int ret;
> 
>  	if (!vdev) {
>  		RTE_LOG(ERR, VDPA, "Invalid device: %s.\n",
> @@ -449,8 +451,20 @@ static void cmd_device_stats_parsed(void *parsed_result,
> struct cmdline *cl,
>  	cmdline_printf(cl, "\nDevice %s:\n", res->bdf);
>  	for (; first <= last; first++) {
>  		memset(vport->stats, 0, sizeof(*vport->stats) * vport->stats_n);
> -		if (rte_vdpa_get_stats(vport->dev, (int)first, vport->stats,
> -					vport->stats_n) <= 0) {
> +		ret = rte_vdpa_get_stats(vport->dev, (int)first, vport->stats,
> +						vport->stats_n);
> +		if (ret == 0) {
> +			/* VQ disabled. */
> +			if (vq_disabled == -1)
> +				vq_disabled = (int)first;
> +			continue;

I am not sure. Does ret == 0 mean VQ is disabled in this API? Because I don't see 
anything special described in API doxygen about return value equals zero.

> +		}
> +		if (vq_disabled != -1) {
> +			cmdline_printf(cl, "\tVirtq %d - %d disabled\n",
> +				       vq_disabled, (int)first - 1);

Let's check if vq_disabled == first - 1 to make different log. I will feel strange
if I see log like 'Virq 2-2 disabled'.

Thanks,
Chenbo

> +			vq_disabled = -1;
> +		}
> +		if (ret < 0) {
>  			RTE_LOG(ERR, VDPA, "Failed to get vdpa queue statistics"
>  				" for device %s qid %d.\n", res->bdf,
>  				(int)first);
> @@ -464,6 +478,9 @@ static void cmd_device_stats_parsed(void *parsed_result,
> struct cmdline *cl,
>  				vport->stats[i].value);
>  		}
>  	}
> +	if (vq_disabled != -1)
> +		cmdline_printf(cl, "\tVirtq %d - %d disabled\n",
> +			       vq_disabled, (int)first - 1);
>  }
> 
>  cmdline_parse_token_string_t cmd_device_stats_ =
> --
> 2.35.1


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

* Re: [PATCH] examples/vdpa: fix disabled VirtQ statistics query
  2022-02-24 13:24 [PATCH] examples/vdpa: fix disabled VirtQ statistics query Xueming Li
  2022-03-03  6:45 ` Xia, Chenbo
@ 2022-04-22  8:40 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2022-04-22  8:40 UTC (permalink / raw)
  To: Xueming Li, dev; +Cc: stable, Chenbo Xia, Matan Azrad

"examples/vdpa: fix disabled virtqueue statistics query"

On 2/24/22 14:24, Xueming Li wrote:
> Quit VirtQ statistics query instead of reporting error.
> 
> Fixes: 6505865aa8ed ("examples/vdpa: add statistics show command")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
>   examples/vdpa/main.c | 21 +++++++++++++++++++--
>   1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
> index 5ab07655aed..bd66deca85c 100644
> --- a/examples/vdpa/main.c
> +++ b/examples/vdpa/main.c
> @@ -391,7 +391,9 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl,
>   	struct rte_vdpa_device *vdev = rte_vdpa_find_device_by_name(res->bdf);
>   	struct vdpa_port *vport = NULL;
>   	uint32_t first, last;
> +	int vq_disabled = -1;
>   	int i;
> +	int ret;
>   
>   	if (!vdev) {
>   		RTE_LOG(ERR, VDPA, "Invalid device: %s.\n",
> @@ -449,8 +451,20 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl,
>   	cmdline_printf(cl, "\nDevice %s:\n", res->bdf);
>   	for (; first <= last; first++) {
>   		memset(vport->stats, 0, sizeof(*vport->stats) * vport->stats_n);
> -		if (rte_vdpa_get_stats(vport->dev, (int)first, vport->stats,
> -					vport->stats_n) <= 0) {
> +		ret = rte_vdpa_get_stats(vport->dev, (int)first, vport->stats,
> +						vport->stats_n);
> +		if (ret == 0) {
> +			/* VQ disabled. */
> +			if (vq_disabled == -1)
> +				vq_disabled = (int)first;
> +			continue;
> +		}
> +		if (vq_disabled != -1) {
> +			cmdline_printf(cl, "\tVirtq %d - %d disabled\n",
> +				       vq_disabled, (int)first - 1);
> +			vq_disabled = -1;
> +		}
> +		if (ret < 0) {
>   			RTE_LOG(ERR, VDPA, "Failed to get vdpa queue statistics"
>   				" for device %s qid %d.\n", res->bdf,
>   				(int)first);
> @@ -464,6 +478,9 @@ static void cmd_device_stats_parsed(void *parsed_result, struct cmdline *cl,
>   				vport->stats[i].value);
>   		}
>   	}
> +	if (vq_disabled != -1)
> +		cmdline_printf(cl, "\tVirtq %d - %d disabled\n",
> +			       vq_disabled, (int)first - 1);
>   }
>   
>   cmdline_parse_token_string_t cmd_device_stats_ =

It is not clear to me how it is going to look like, could you paste some
logs?


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

end of thread, other threads:[~2022-04-22  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 13:24 [PATCH] examples/vdpa: fix disabled VirtQ statistics query Xueming Li
2022-03-03  6:45 ` Xia, Chenbo
2022-04-22  8:40 ` Maxime Coquelin

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