#include <rte_malloc.h>
#include "bnxt.h"
+#include "bnxt_hwrm.h"
#include "bnxt_ring.h"
#include "bnxt_txq.h"
#include "bnxt_txr.h"
}
}
-void bnxt_tx_queue_release_op(void *tx_queue)
+void bnxt_tx_queue_release_op(struct rte_eth_dev *dev, uint16_t queue_idx)
{
- struct bnxt_tx_queue *txq = (struct bnxt_tx_queue *)tx_queue;
+ struct bnxt_tx_queue *txq = dev->data->tx_queues[queue_idx];
if (txq) {
if (is_bnxt_in_error(txq->bp))
return;
/* Free TX ring hardware descriptors */
+ bnxt_free_hwrm_tx_ring(txq->bp, txq->queue_id);
bnxt_tx_queue_release_mbufs(txq);
if (txq->tx_ring) {
bnxt_free_ring(txq->tx_ring->tx_ring_struct);
rte_free(txq->free);
rte_free(txq);
+ dev->data->tx_queues[queue_idx] = NULL;
}
}
if (eth_dev->data->tx_queues) {
txq = eth_dev->data->tx_queues[queue_idx];
- if (txq) {
- bnxt_tx_queue_release_op(txq);
- txq = NULL;
- }
+ if (txq)
+ bnxt_tx_queue_release_op(eth_dev, queue_idx);
}
txq = rte_zmalloc_socket("bnxt_tx_queue", sizeof(struct bnxt_tx_queue),
RTE_CACHE_LINE_SIZE, socket_id);
return -ENOMEM;
}
+ txq->bp = bp;
+ eth_dev->data->tx_queues[queue_idx] = txq;
+
txq->free = rte_zmalloc_socket(NULL,
sizeof(struct rte_mbuf *) * nb_desc,
RTE_CACHE_LINE_SIZE, socket_id);
rc = -ENOMEM;
goto err;
}
- txq->bp = bp;
txq->nb_tx_desc = nb_desc;
txq->tx_free_thresh =
RTE_MIN(rte_align32pow2(nb_desc) / 4, RTE_BNXT_MAX_TX_BURST);
txq->port_id = eth_dev->data->port_id;
/* Allocate TX ring hardware descriptors */
- if (bnxt_alloc_rings(bp, queue_idx, txq, NULL, txq->cp_ring, NULL,
- "txr")) {
+ if (bnxt_alloc_rings(bp, socket_id, queue_idx, txq, NULL, txq->cp_ring,
+ NULL, "txr")) {
PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!");
rc = -ENOMEM;
goto err;
goto err;
}
- eth_dev->data->tx_queues[queue_idx] = txq;
-
- if (txq->tx_deferred_start)
- txq->tx_started = false;
- else
- txq->tx_started = true;
-
return 0;
err:
- bnxt_tx_queue_release_op(txq);
+ bnxt_tx_queue_release_op(eth_dev, queue_idx);
return rc;
}