]> git.droids-corp.org - dpdk.git/commitdiff
net/mlx5: fix Tx queue stop state
authorMatan Azrad <matan@nvidia.com>
Tue, 3 Nov 2020 06:48:32 +0000 (06:48 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 13 Nov 2020 15:26:54 +0000 (16:26 +0100)
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 as started when the port
start callback was done which kept 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>
drivers/net/mlx5/linux/mlx5_verbs.c
drivers/net/mlx5/mlx5_devx.c
drivers/net/mlx5/mlx5_rxq.c
drivers/net/mlx5/mlx5_trigger.c
drivers/net/mlx5/mlx5_txq.c

index 494ddba93ac04210080d9b99c9492451cf1323d9..540ce329900a29b4bf87537fcaace77a43648291 100644 (file)
@@ -1038,6 +1038,7 @@ mlx5_txq_ibv_obj_new(struct rte_eth_dev *dev, uint16_t idx)
                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:
index 924ee510492a1832bc58422cf00b33a198f7d1cb..e9ceda5caf952ee1bd57a71a5af1b31f3c797195 100644 (file)
@@ -1435,6 +1435,7 @@ mlx5_txq_devx_obj_new(struct rte_eth_dev *dev, uint16_t idx)
        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. */
index a61a2dac95535a85f4cefe7fdd55ce17fe91052b..d95a573095112e765ff949536312bda8efb084be 100644 (file)
@@ -1784,8 +1784,10 @@ mlx5_rxq_release(struct rte_eth_dev *dev, uint16_t idx)
                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);
index f5fab0f19d915223e05c0861c9de3f2bcbe487d1..46e4191bfa151f8abbac53d859b70ce037839f68 100644 (file)
@@ -77,6 +77,7 @@ mlx5_txq_start(struct rte_eth_dev *dev)
                }
                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);
index fcbc84b299a45c5778632a1ac4ad5d04d9007f9d..faf4e4549b2bc758d863edc593b9fe7349487ad9 100644 (file)
@@ -388,7 +388,6 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
        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 @@ mlx5_txq_release(struct rte_eth_dev *dev, uint16_t idx)
                        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);