net/mlx5: fix non working secondary process by removing it
[dpdk.git] / drivers / net / mlx5 / mlx5_txq.c
index 6c1387e..4b0b532 100644 (file)
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
 #include <rte_mbuf.h>
 #include <rte_malloc.h>
 #include <rte_ethdev.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5_defs.h"
 #include "mlx5.h"
 #include "mlx5_rxtx.h"
 #include "mlx5_autoconf.h"
-#include "mlx5_defs.h"
 
 /**
  * Allocate TX queue elements.
@@ -103,9 +95,10 @@ txq_alloc_elts(struct txq_ctrl *txq_ctrl, unsigned int elts_n)
 static void
 txq_free_elts(struct txq_ctrl *txq_ctrl)
 {
-       unsigned int elts_n = 1 << txq_ctrl->txq.elts_n;
-       unsigned int elts_head = txq_ctrl->txq.elts_head;
-       unsigned int elts_tail = txq_ctrl->txq.elts_tail;
+       const uint16_t elts_n = 1 << txq_ctrl->txq.elts_n;
+       const uint16_t elts_m = elts_n - 1;
+       uint16_t elts_head = txq_ctrl->txq.elts_head;
+       uint16_t elts_tail = txq_ctrl->txq.elts_tail;
        struct rte_mbuf *(*elts)[elts_n] = txq_ctrl->txq.elts;
 
        DEBUG("%p: freeing WRs", (void *)txq_ctrl);
@@ -114,18 +107,17 @@ txq_free_elts(struct txq_ctrl *txq_ctrl)
        txq_ctrl->txq.elts_comp = 0;
 
        while (elts_tail != elts_head) {
-               struct rte_mbuf *elt = (*elts)[elts_tail];
+               struct rte_mbuf *elt = (*elts)[elts_tail & elts_m];
 
                assert(elt != NULL);
-               rte_pktmbuf_free(elt);
+               rte_pktmbuf_free_seg(elt);
 #ifndef NDEBUG
                /* Poisoning. */
-               memset(&(*elts)[elts_tail],
+               memset(&(*elts)[elts_tail & elts_m],
                       0x77,
-                      sizeof((*elts)[elts_tail]));
+                      sizeof((*elts)[elts_tail & elts_m]));
 #endif
-               if (++elts_tail == elts_n)
-                       elts_tail = 0;
+               ++elts_tail;
        }
 }
 
@@ -149,9 +141,8 @@ txq_cleanup(struct txq_ctrl *txq_ctrl)
        if (txq_ctrl->cq != NULL)
                claim_zero(ibv_destroy_cq(txq_ctrl->cq));
        for (i = 0; (i != RTE_DIM(txq_ctrl->txq.mp2mr)); ++i) {
-               if (txq_ctrl->txq.mp2mr[i].mp == NULL)
+               if (txq_ctrl->txq.mp2mr[i].mr == NULL)
                        break;
-               assert(txq_ctrl->txq.mp2mr[i].mr != NULL);
                claim_zero(ibv_dereg_mr(txq_ctrl->txq.mp2mr[i].mr));
        }
        memset(txq_ctrl, 0, sizeof(*txq_ctrl));
@@ -244,7 +235,7 @@ txq_ctrl_setup(struct rte_eth_dev *dev, struct txq_ctrl *txq_ctrl,
                ERROR("MLX5_ENABLE_CQE_COMPRESSION must never be set");
                goto error;
        }
-       (void)conf; /* Thresholds configuration (ignored). */
+       tmpl.txq.flags = conf->txq_flags;
        assert(desc > MLX5_TX_COMP_THRESH);
        tmpl.txq.elts_n = log2above(desc);
        if (priv->mps == MLX5_MPW_ENHANCED)
@@ -497,8 +488,6 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
                DEBUG("%p: adding TX queue %p to list",
                      (void *)dev, (void *)txq_ctrl);
                (*priv->txqs)[idx] = &txq_ctrl->txq;
-               /* Update send callback. */
-               priv_select_tx_function(priv);
        }
        priv_unlock(priv);
        return -ret;
@@ -537,44 +526,3 @@ mlx5_tx_queue_release(void *dpdk_txq)
        rte_free(txq_ctrl);
        priv_unlock(priv);
 }
-
-/**
- * DPDK callback for TX in secondary processes.
- *
- * This function configures all queues from primary process information
- * if necessary before reverting to the normal TX burst callback.
- *
- * @param dpdk_txq
- *   Generic pointer to TX queue structure.
- * @param[in] pkts
- *   Packets to transmit.
- * @param pkts_n
- *   Number of packets in array.
- *
- * @return
- *   Number of packets successfully transmitted (<= pkts_n).
- */
-uint16_t
-mlx5_tx_burst_secondary_setup(void *dpdk_txq, struct rte_mbuf **pkts,
-                             uint16_t pkts_n)
-{
-       struct txq *txq = dpdk_txq;
-       struct txq_ctrl *txq_ctrl = container_of(txq, struct txq_ctrl, txq);
-       struct priv *priv = mlx5_secondary_data_setup(txq_ctrl->priv);
-       struct priv *primary_priv;
-       unsigned int index;
-
-       if (priv == NULL)
-               return 0;
-       primary_priv =
-               mlx5_secondary_data[priv->dev->data->port_id].primary_priv;
-       /* Look for queue index in both private structures. */
-       for (index = 0; index != priv->txqs_n; ++index)
-               if (((*primary_priv->txqs)[index] == txq) ||
-                   ((*priv->txqs)[index] == txq))
-                       break;
-       if (index == priv->txqs_n)
-               return 0;
-       txq = (*priv->txqs)[index];
-       return priv->dev->tx_pkt_burst(txq, pkts, pkts_n);
-}