Multi-Packet RQ uses mbuf indirection and direct mbufs come from the
private Mempool (rxq->mprq_mp) of PMD. To properly release the Mempool, it
is better to empty the Tx completeion array (txq->elts) before releasing
it.

Signed-off-by: Yongseok Koh <ys...@mellanox.com>
---
 drivers/net/mlx5/mlx5.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 25c0b5b1f..b2487186a 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -187,14 +187,6 @@ mlx5_dev_close(struct rte_eth_dev *dev)
        /* Prevent crashes when queues are still in use. */
        dev->rx_pkt_burst = removed_rx_burst;
        dev->tx_pkt_burst = removed_tx_burst;
-       if (priv->rxqs != NULL) {
-               /* XXX race condition if mlx5_rx_burst() is still running. */
-               usleep(1000);
-               for (i = 0; (i != priv->rxqs_n); ++i)
-                       mlx5_priv_rxq_release(priv, i);
-               priv->rxqs_n = 0;
-               priv->rxqs = NULL;
-       }
        if (priv->txqs != NULL) {
                /* XXX race condition if mlx5_tx_burst() is still running. */
                usleep(1000);
@@ -203,6 +195,14 @@ mlx5_dev_close(struct rte_eth_dev *dev)
                priv->txqs_n = 0;
                priv->txqs = NULL;
        }
+       if (priv->rxqs != NULL) {
+               /* XXX race condition if mlx5_rx_burst() is still running. */
+               usleep(1000);
+               for (i = 0; (i != priv->rxqs_n); ++i)
+                       mlx5_priv_rxq_release(priv, i);
+               priv->rxqs_n = 0;
+               priv->rxqs = NULL;
+       }
        if (priv->pd != NULL) {
                assert(priv->ctx != NULL);
                claim_zero(mlx5_glue->dealloc_pd(priv->pd));
-- 
2.11.0

Reply via email to