patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: fix Tx queue stop state
@ 2020-11-03  6:48 Matan Azrad
  2020-11-03  6:56 ` Slava Ovsiienko
  2020-11-05 17:41 ` [dpdk-stable] [dpdk-dev] " Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Matan Azrad @ 2020-11-03  6:48 UTC (permalink / raw)
  To: Viacheslav Ovsiienko; +Cc: dev, stable

The Tx queue stop API doesn't call the PMD callback when the state of
the queue is stopped.
The drivers should update the state to be stopped when the queue stop
callback is done successfully or when the port is stopped.
The drivers should update the state to be started when the queue start
callback is done successfully or when the port is started.

The driver wrongly didn't update the state to be started when the port
start callback was done what remained the state as stopped.
Following call to a queue stop API was not completed by ethdev layer
because the state is already stopped.

Move the state update from the Tx queue setup to the port start
callback.

Fixes: 161d103b231c ("net/mlx5: add queue start and stop")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_verbs.c | 1 +
 drivers/net/mlx5/mlx5_devx.c        | 1 +
 drivers/net/mlx5/mlx5_rxq.c         | 4 +++-
 drivers/net/mlx5/mlx5_trigger.c     | 1 +
 drivers/net/mlx5/mlx5_txq.c         | 3 +--
 5 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c
index 494ddba..540ce32 100644
--- a/drivers/net/mlx5/linux/mlx5_verbs.c
+++ b/drivers/net/mlx5/linux/mlx5_verbs.c
@@ -1038,6 +1038,7 @@
 		goto error;
 	}
 	txq_uar_init(txq_ctrl);
+	dev->data->tx_queue_state[idx] = RTE_ETH_QUEUE_STATE_STARTED;
 	priv->verbs_alloc_ctx.type = MLX5_VERBS_ALLOC_TYPE_NONE;
 	return 0;
 error:
diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index b3acbc2..2888977 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -1427,6 +1427,7 @@
 	txq_ctrl->uar_mmap_offset =
 				mlx5_os_get_devx_uar_mmap_offset(sh->tx_uar);
 	txq_uar_init(txq_ctrl);
+	dev->data->tx_queue_state[idx] = RTE_ETH_QUEUE_STATE_STARTED;
 	return 0;
 error:
 	ret = rte_errno; /* Save rte_errno before cleanup. */
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index a733eda..88c0151 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1773,8 +1773,10 @@ struct mlx5_rxq_ctrl *
 		mlx5_free(rxq_ctrl->obj);
 		rxq_ctrl->obj = NULL;
 	}
-	if (rxq_ctrl->type == MLX5_RXQ_TYPE_STANDARD)
+	if (rxq_ctrl->type == MLX5_RXQ_TYPE_STANDARD) {
 		rxq_free_elts(rxq_ctrl);
+		dev->data->rx_queue_state[idx] = RTE_ETH_QUEUE_STATE_STOPPED;
+	}
 	if (!__atomic_load_n(&rxq_ctrl->refcnt, __ATOMIC_RELAXED)) {
 		if (rxq_ctrl->type == MLX5_RXQ_TYPE_STANDARD)
 			mlx5_mr_btree_free(&rxq_ctrl->rxq.mr_ctrl.cache_bh);
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 52691b6..4b6e17e 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -77,6 +77,7 @@
 		}
 		if (txq_ctrl->type == MLX5_TXQ_TYPE_STANDARD) {
 			size_t size = txq_data->cqe_s * sizeof(*txq_data->fcqs);
+
 			txq_data->fcqs = mlx5_malloc(flags, size,
 						     RTE_CACHE_LINE_SIZE,
 						     txq_ctrl->socket);
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index e1291f0..6390cd0 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -388,7 +388,6 @@
 	DRV_LOG(DEBUG, "port %u adding Tx queue %u to list",
 		dev->data->port_id, idx);
 	(*priv->txqs)[idx] = &txq_ctrl->txq;
-	dev->data->tx_queue_state[idx] = RTE_ETH_QUEUE_STATE_STARTED;
 	return 0;
 }
 
@@ -1249,8 +1248,8 @@ struct mlx5_txq_ctrl *
 			txq_ctrl->txq.fcqs = NULL;
 		}
 		txq_free_elts(txq_ctrl);
+		dev->data->tx_queue_state[idx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	}
-	dev->data->tx_queue_state[idx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	if (!__atomic_load_n(&txq_ctrl->refcnt, __ATOMIC_RELAXED)) {
 		if (txq_ctrl->type == MLX5_TXQ_TYPE_STANDARD)
 			mlx5_mr_btree_free(&txq_ctrl->txq.mr_ctrl.cache_bh);
-- 
1.8.3.1


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

* Re: [dpdk-stable] [PATCH] net/mlx5: fix Tx queue stop state
  2020-11-03  6:48 [dpdk-stable] [PATCH] net/mlx5: fix Tx queue stop state Matan Azrad
@ 2020-11-03  6:56 ` Slava Ovsiienko
  2020-11-05 17:41 ` [dpdk-stable] [dpdk-dev] " Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Slava Ovsiienko @ 2020-11-03  6:56 UTC (permalink / raw)
  To: Matan Azrad; +Cc: dev, stable

> -----Original Message-----
> From: Matan Azrad <matan@nvidia.com>
> Sent: Tuesday, November 3, 2020 8:49
> To: Slava Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix Tx queue stop state
> 
> The Tx queue stop API doesn't call the PMD callback when the state of the
> queue is stopped.
> The drivers should update the state to be stopped when the queue stop
> callback is done successfully or when the port is stopped.
> The drivers should update the state to be started when the queue start
> callback is done successfully or when the port is started.
> 
> The driver wrongly didn't update the state to be started when the port start
> callback was done what remained the state as stopped.
> Following call to a queue stop API was not completed by ethdev layer because
> the state is already stopped.
> 
> Move the state update from the Tx queue setup to the port start callback.
> 
> Fixes: 161d103b231c ("net/mlx5: add queue start and stop")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/mlx5: fix Tx queue stop state
  2020-11-03  6:48 [dpdk-stable] [PATCH] net/mlx5: fix Tx queue stop state Matan Azrad
  2020-11-03  6:56 ` Slava Ovsiienko
@ 2020-11-05 17:41 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-11-05 17:41 UTC (permalink / raw)
  To: Matan Azrad, Slava Ovsiienko; +Cc: dev, stable

Hi,
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Matan Azrad
> Sent: Tuesday, November 3, 2020 8:49 AM
> To: Slava Ovsiienko <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix Tx queue stop state
> 
> The Tx queue stop API doesn't call the PMD callback when the state of
> the queue is stopped.
> The drivers should update the state to be stopped when the queue stop
> callback is done successfully or when the port is stopped.
> The drivers should update the state to be started when the queue start
> callback is done successfully or when the port is started.
> 
> The driver wrongly didn't update the state to be started when the port
> start callback was done what remained the state as stopped.
> Following call to a queue stop API was not completed by ethdev layer
> because the state is already stopped.
> 
> Move the state update from the Tx queue setup to the port start
> callback.
> 
> Fixes: 161d103b231c ("net/mlx5: add queue start and stop")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Matan Azrad <matan@nvidia.com>
> ---
>  drivers/net/mlx5/linux/mlx5_verbs.c | 1 +
>  drivers/net/mlx5/mlx5_devx.c        | 1 +
>  drivers/net/mlx5/mlx5_rxq.c         | 4 +++-
>  drivers/net/mlx5/mlx5_trigger.c     | 1 +
>  drivers/net/mlx5/mlx5_txq.c         | 3 +--
>  5 files changed, 7 insertions(+), 3 deletions(-)

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh


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

end of thread, other threads:[~2020-11-05 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03  6:48 [dpdk-stable] [PATCH] net/mlx5: fix Tx queue stop state Matan Azrad
2020-11-03  6:56 ` Slava Ovsiienko
2020-11-05 17:41 ` [dpdk-stable] [dpdk-dev] " Raslan Darawsheh

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git