patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] vdpa/mlx5: fix virtq unset
@ 2020-08-03  8:25 Matan Azrad
  2020-08-03 14:38 ` Maxime Coquelin
  2020-08-03 15:56 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Matan Azrad @ 2020-08-03  8:25 UTC (permalink / raw)
  To: Maxime Coquelin; +Cc: dev, stable

When a virtq is destroyed, the SW should be able to continue the virtq
processing from where the HW stopped.

The current destroy behavior in the driver saves the virtq state (used
and available indexes) only when LM is requested.
So, when LM is not requested the queue state is not saved and the SW
indexes stay invalid.

Save the virtq state in the virtq destroy process.

Fixes: bff735011078 ("vdpa/mlx5: prepare virtio queues")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Xueming Li <xuemingl@mellanox.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa.h       |  1 +
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 17 ++++++++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h
index 57044d9..5963e35 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.h
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.h
@@ -86,6 +86,7 @@ struct mlx5_vdpa_virtq {
 	uint16_t index;
 	uint16_t vq_size;
 	uint8_t notifier_state;
+	bool stopped;
 	struct mlx5_vdpa_priv *priv;
 	struct mlx5_devx_obj *virtq;
 	struct mlx5_devx_obj *counters;
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index 19554f6..17e71cf 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -72,8 +72,13 @@
 		}
 		virtq->intr_handle.fd = -1;
 	}
-	if (virtq->virtq)
+	if (virtq->virtq) {
+		ret = mlx5_vdpa_virtq_stop(virtq->priv, virtq->index);
+		if (ret)
+			DRV_LOG(WARNING, "Failed to stop virtq %d.",
+				virtq->index);
 		claim_zero(mlx5_devx_cmd_destroy(virtq->virtq));
+	}
 	virtq->virtq = NULL;
 	for (i = 0; i < RTE_DIM(virtq->umems); ++i) {
 		if (virtq->umems[i].obj)
@@ -135,10 +140,14 @@
 {
 	struct mlx5_devx_virtq_attr attr = {0};
 	struct mlx5_vdpa_virtq *virtq = &priv->virtqs[index];
-	int ret = mlx5_vdpa_virtq_modify(virtq, 0);
+	int ret;
 
+	if (virtq->stopped)
+		return 0;
+	ret = mlx5_vdpa_virtq_modify(virtq, 0);
 	if (ret)
 		return -1;
+	virtq->stopped = true;
 	if (mlx5_devx_cmd_query_virtq(virtq->virtq, &attr)) {
 		DRV_LOG(ERR, "Failed to query virtq %d.", index);
 		return -1;
@@ -323,6 +332,7 @@
 				virtq->intr_handle.fd, index);
 		}
 	}
+	virtq->stopped = false;
 	DRV_LOG(DEBUG, "vid %u virtq %u was created successfully.", priv->vid,
 		index);
 	return 0;
@@ -489,9 +499,6 @@
 				DRV_LOG(WARNING, "Failed to disable steering "
 					"for virtq %d.", index);
 		}
-		ret = mlx5_vdpa_virtq_stop(priv, index);
-		if (ret)
-			DRV_LOG(WARNING, "Failed to stop virtq %d.", index);
 		mlx5_vdpa_virtq_unset(virtq);
 	}
 	if (enable) {
-- 
1.8.3.1


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

* Re: [dpdk-stable] [PATCH] vdpa/mlx5: fix virtq unset
  2020-08-03  8:25 [dpdk-stable] [PATCH] vdpa/mlx5: fix virtq unset Matan Azrad
@ 2020-08-03 14:38 ` Maxime Coquelin
  2020-08-03 15:56 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2020-08-03 14:38 UTC (permalink / raw)
  To: Matan Azrad; +Cc: dev, stable



On 8/3/20 10:25 AM, Matan Azrad wrote:
> When a virtq is destroyed, the SW should be able to continue the virtq
> processing from where the HW stopped.
> 
> The current destroy behavior in the driver saves the virtq state (used
> and available indexes) only when LM is requested.
> So, when LM is not requested the queue state is not saved and the SW
> indexes stay invalid.
> 
> Save the virtq state in the virtq destroy process.
> 
> Fixes: bff735011078 ("vdpa/mlx5: prepare virtio queues")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> Acked-by: Xueming Li <xuemingl@mellanox.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa.h       |  1 +
>  drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 17 ++++++++++++-----
>  2 files changed, 13 insertions(+), 5 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


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

* Re: [dpdk-stable] [PATCH] vdpa/mlx5: fix virtq unset
  2020-08-03  8:25 [dpdk-stable] [PATCH] vdpa/mlx5: fix virtq unset Matan Azrad
  2020-08-03 14:38 ` Maxime Coquelin
@ 2020-08-03 15:56 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2020-08-03 15:56 UTC (permalink / raw)
  To: Matan Azrad; +Cc: dev, stable



On 8/3/20 10:25 AM, Matan Azrad wrote:
> When a virtq is destroyed, the SW should be able to continue the virtq
> processing from where the HW stopped.
> 
> The current destroy behavior in the driver saves the virtq state (used
> and available indexes) only when LM is requested.
> So, when LM is not requested the queue state is not saved and the SW
> indexes stay invalid.
> 
> Save the virtq state in the virtq destroy process.
> 
> Fixes: bff735011078 ("vdpa/mlx5: prepare virtio queues")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> Acked-by: Xueming Li <xuemingl@mellanox.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa.h       |  1 +
>  drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 17 ++++++++++++-----
>  2 files changed, 13 insertions(+), 5 deletions(-)

Applied to dpdk-next-virtio/master.

Thanks,
Maxime


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

end of thread, other threads:[~2020-08-03 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03  8:25 [dpdk-stable] [PATCH] vdpa/mlx5: fix virtq unset Matan Azrad
2020-08-03 14:38 ` Maxime Coquelin
2020-08-03 15:56 ` 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).