net/bnxt: fix Rx queue state on start
[dpdk.git] / drivers / net / bnxt / bnxt_txr.c
index 8eb9493..9e45ddd 100644 (file)
@@ -9,6 +9,7 @@
 #include <rte_malloc.h>
 
 #include "bnxt.h"
+#include "bnxt_hwrm.h"
 #include "bnxt_ring.h"
 #include "bnxt_txq.h"
 #include "bnxt_txr.h"
@@ -37,6 +38,9 @@ void bnxt_free_tx_rings(struct bnxt *bp)
                rte_free(txq->cp_ring->cp_ring_struct);
                rte_free(txq->cp_ring);
 
+               rte_memzone_free(txq->mz);
+               txq->mz = NULL;
+
                rte_free(txq);
                bp->tx_queues[i] = NULL;
        }
@@ -460,7 +464,7 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq)
                cons = RING_CMPL(ring_mask, raw_cons);
                txcmp = (struct tx_cmpl *)&cpr->cp_desc_ring[cons];
 
-               if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct))
+               if (!bnxt_cpr_cmp_valid(txcmp, raw_cons, ring_mask + 1))
                        break;
 
                opaque = rte_le_to_cpu_32(txcmp->opaque);
@@ -547,6 +551,11 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
        if (rc)
                return rc;
 
+       bnxt_free_hwrm_tx_ring(bp, tx_queue_id);
+       rc = bnxt_alloc_hwrm_tx_ring(bp, tx_queue_id);
+       if (rc)
+               return rc;
+
        dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
        txq->tx_started = true;
        PMD_DRV_LOG(DEBUG, "Tx queue started\n");