net/mlx5: make indirection tables shareable
[dpdk.git] / drivers / net / mlx5 / mlx5.c
index ed77351..46b4067 100644 (file)
@@ -208,34 +208,16 @@ mlx5_dev_close(struct rte_eth_dev *dev)
        if (priv->rxqs != NULL) {
                /* XXX race condition if mlx5_rx_burst() is still running. */
                usleep(1000);
-               for (i = 0; (i != priv->rxqs_n); ++i) {
-                       struct mlx5_rxq_data *rxq = (*priv->rxqs)[i];
-                       struct mlx5_rxq_ctrl *rxq_ctrl;
-
-                       if (rxq == NULL)
-                               continue;
-                       rxq_ctrl = container_of(rxq, struct mlx5_rxq_ctrl, rxq);
-                       (*priv->rxqs)[i] = NULL;
-                       mlx5_rxq_cleanup(rxq_ctrl);
-                       rte_free(rxq_ctrl);
-               }
+               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);
-               for (i = 0; (i != priv->txqs_n); ++i) {
-                       struct mlx5_txq_data *txq = (*priv->txqs)[i];
-                       struct mlx5_txq_ctrl *txq_ctrl;
-
-                       if (txq == NULL)
-                               continue;
-                       txq_ctrl = container_of(txq, struct mlx5_txq_ctrl, txq);
-                       (*priv->txqs)[i] = NULL;
-                       mlx5_txq_cleanup(txq_ctrl);
-                       rte_free(txq_ctrl);
-               }
+               for (i = 0; (i != priv->txqs_n); ++i)
+                       mlx5_priv_txq_release(priv, i);
                priv->txqs_n = 0;
                priv->txqs = NULL;
        }
@@ -253,9 +235,21 @@ mlx5_dev_close(struct rte_eth_dev *dev)
        if (priv->reta_idx != NULL)
                rte_free(priv->reta_idx);
        priv_socket_uninit(priv);
+       ret = mlx5_priv_ind_table_ibv_verify(priv);
+       if (ret)
+               WARN("%p: some Indirection table still remain", (void *)priv);
        ret = mlx5_priv_rxq_ibv_verify(priv);
        if (ret)
                WARN("%p: some Verbs Rx queue still remain", (void *)priv);
+       ret = mlx5_priv_rxq_verify(priv);
+       if (ret)
+               WARN("%p: some Rx Queues still remain", (void *)priv);
+       ret = mlx5_priv_txq_ibv_verify(priv);
+       if (ret)
+               WARN("%p: some Verbs Tx queue still remain", (void *)priv);
+       ret = mlx5_priv_txq_verify(priv);
+       if (ret)
+               WARN("%p: some Tx Queues still remain", (void *)priv);
        ret = priv_flow_verify(priv);
        if (ret)
                WARN("%p: some flows still remain", (void *)priv);