defined routines for rx and tx queue cleanup functions. Signed-off-by: Aman Kumar <aman.ku...@vvdntech.in> --- drivers/net/qdma/qdma_devops.c | 83 ++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 4 deletions(-)
diff --git a/drivers/net/qdma/qdma_devops.c b/drivers/net/qdma/qdma_devops.c index e411c0f1be..5329bd3cd4 100644 --- a/drivers/net/qdma/qdma_devops.c +++ b/drivers/net/qdma/qdma_devops.c @@ -765,16 +765,91 @@ int qdma_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, return err; } +#if (MIN_TX_PIDX_UPDATE_THRESHOLD > 1) +void qdma_txq_pidx_update(void *arg) +{ + struct rte_eth_dev *dev = (struct rte_eth_dev *)arg; + struct qdma_pci_dev *qdma_dev = dev->data->dev_private; + struct qdma_tx_queue *txq; + uint32_t qid; + + for (qid = 0; qid < dev->data->nb_tx_queues; qid++) { + txq = (struct qdma_tx_queue *)dev->data->tx_queues[qid]; + if (txq->tx_desc_pend) { + rte_spinlock_lock(&txq->pidx_update_lock); + if (txq->tx_desc_pend) { + qdma_dev->hw_access->qdma_queue_pidx_update(dev, + qdma_dev->is_vf, + qid, 0, &txq->q_pidx_info); + + txq->tx_desc_pend = 0; + } + rte_spinlock_unlock(&txq->pidx_update_lock); + } + } + rte_eal_alarm_set(QDMA_TXQ_PIDX_UPDATE_INTERVAL, + qdma_txq_pidx_update, (void *)arg); +} +#endif + void qdma_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t q_id) { - (void)dev; - (void)q_id; + struct qdma_tx_queue *txq; + struct qdma_pci_dev *qdma_dev; + + txq = (struct qdma_tx_queue *)dev->data->tx_queues[q_id]; + if (txq != NULL) { + PMD_DRV_LOG(INFO, "Remove H2C queue: %d", txq->queue_id); + qdma_dev = txq->dev->data->dev_private; + + if (!qdma_dev->is_vf) + qdma_dev_decrement_active_queue + (qdma_dev->dma_device_index, + qdma_dev->func_id, + QDMA_DEV_Q_TYPE_H2C); + if (txq->sw_ring) + rte_free(txq->sw_ring); + if (txq->tx_mz) + rte_memzone_free(txq->tx_mz); + rte_free(txq); + PMD_DRV_LOG(INFO, "H2C queue %d removed", txq->queue_id); + } } void qdma_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t q_id) { - (void)dev; - (void)q_id; + struct qdma_rx_queue *rxq; + struct qdma_pci_dev *qdma_dev = NULL; + + rxq = (struct qdma_rx_queue *)dev->data->rx_queues[q_id]; + if (rxq != NULL) { + PMD_DRV_LOG(INFO, "Remove C2H queue: %d", rxq->queue_id); + qdma_dev = rxq->dev->data->dev_private; + + if (!qdma_dev->is_vf) { + qdma_dev_decrement_active_queue + (qdma_dev->dma_device_index, + qdma_dev->func_id, + QDMA_DEV_Q_TYPE_C2H); + + if (rxq->st_mode) + qdma_dev_decrement_active_queue + (qdma_dev->dma_device_index, + qdma_dev->func_id, + QDMA_DEV_Q_TYPE_CMPT); + } + + if (rxq->sw_ring) + rte_free(rxq->sw_ring); + if (rxq->st_mode) { /* if ST-mode */ + if (rxq->rx_cmpt_mz) + rte_memzone_free(rxq->rx_cmpt_mz); + } + if (rxq->rx_mz) + rte_memzone_free(rxq->rx_mz); + rte_free(rxq); + PMD_DRV_LOG(INFO, "C2H queue %d removed", rxq->queue_id); + } } /** -- 2.36.1