To align with other eth device queue configuration callbacks, change RX and TX queue release callback API parameter from queue object to device and queue index.
Signed-off-by: Xueming Li <xuemi...@nvidia.com> ========================= In formal patch, there should be a lot of changes to update all PMDs. --- lib/ethdev/ethdev_driver.h | 3 ++- lib/ethdev/rte_ethdev.c | 49 +++++++++++++++----------------------- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index 40e474aa7e..838e8468e6 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -282,7 +282,8 @@ typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev, uint16_t rx_queue_id); /**< @internal Disable interrupt of a receive queue of an Ethernet device. */ -typedef void (*eth_queue_release_t)(void *queue); +typedef void (*eth_queue_release_t)(struct rte_eth_dev *dev, + uint16_t rx_queue_id); /**< @internal Release memory resources allocated by given RX/TX queue. */ typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 9d95cd11e1..a1106f5896 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -906,12 +906,10 @@ eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) return -(ENOMEM); } } else if (dev->data->rx_queues != NULL && nb_queues != 0) { /* re-configure */ - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP); - + if (dev->dev_ops->rx_queue_release != NULL) + for (i = nb_queues; i < old_nb_queues; i++) + (*dev->dev_ops->rx_queue_release)(dev, i); rxq = dev->data->rx_queues; - - for (i = nb_queues; i < old_nb_queues; i++) - (*dev->dev_ops->rx_queue_release)(rxq[i]); rxq = rte_realloc(rxq, sizeof(rxq[0]) * nb_queues, RTE_CACHE_LINE_SIZE); if (rxq == NULL) @@ -926,12 +924,10 @@ eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) dev->data->rx_queues = rxq; } else if (dev->data->rx_queues != NULL && nb_queues == 0) { - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP); - - rxq = dev->data->rx_queues; - for (i = nb_queues; i < old_nb_queues; i++) - (*dev->dev_ops->rx_queue_release)(rxq[i]); + if (dev->dev_ops->rx_queue_release != NULL) + for (i = nb_queues; i < old_nb_queues; i++) + (*dev->dev_ops->rx_queue_release)(dev, i); rte_free(dev->data->rx_queues); dev->data->rx_queues = NULL; @@ -1146,12 +1142,11 @@ eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) return -(ENOMEM); } } else if (dev->data->tx_queues != NULL && nb_queues != 0) { /* re-configure */ - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP); - txq = dev->data->tx_queues; - for (i = nb_queues; i < old_nb_queues; i++) - (*dev->dev_ops->tx_queue_release)(txq[i]); + if (dev->dev_ops->tx_queue_release != NULL) + for (i = nb_queues; i < old_nb_queues; i++) + (*dev->dev_ops->tx_queue_release)(dev, i); txq = rte_realloc(txq, sizeof(txq[0]) * nb_queues, RTE_CACHE_LINE_SIZE); if (txq == NULL) @@ -1166,12 +1161,11 @@ eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues) dev->data->tx_queues = txq; } else if (dev->data->tx_queues != NULL && nb_queues == 0) { - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP); - txq = dev->data->tx_queues; - for (i = nb_queues; i < old_nb_queues; i++) - (*dev->dev_ops->tx_queue_release)(txq[i]); + if (dev->dev_ops->tx_queue_release != NULL) + for (i = nb_queues; i < old_nb_queues; i++) + (*dev->dev_ops->tx_queue_release)(dev, i); rte_free(dev->data->tx_queues); dev->data->tx_queues = NULL; @@ -2113,9 +2107,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, rxq = dev->data->rx_queues; if (rxq[rx_queue_id]) { - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, - -ENOTSUP); - (*dev->dev_ops->rx_queue_release)(rxq[rx_queue_id]); + (*dev->dev_ops->rx_queue_release)(dev, rx_queue_id); rxq[rx_queue_id] = NULL; } @@ -2249,9 +2241,8 @@ rte_eth_rx_hairpin_queue_setup(uint16_t port_id, uint16_t rx_queue_id, return -EBUSY; rxq = dev->data->rx_queues; if (rxq[rx_queue_id] != NULL) { - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, - -ENOTSUP); - (*dev->dev_ops->rx_queue_release)(rxq[rx_queue_id]); + if (dev->dev_ops->rx_queue_release != NULL) + (*dev->dev_ops->rx_queue_release)(dev, rx_queue_id); rxq[rx_queue_id] = NULL; } ret = (*dev->dev_ops->rx_hairpin_queue_setup)(dev, rx_queue_id, @@ -2317,9 +2308,8 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, txq = dev->data->tx_queues; if (txq[tx_queue_id]) { - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, - -ENOTSUP); - (*dev->dev_ops->tx_queue_release)(txq[tx_queue_id]); + if (dev->dev_ops->tx_queue_release != NULL) + (*dev->dev_ops->tx_queue_release)(dev, tx_queue_id); txq[tx_queue_id] = NULL; } @@ -2429,9 +2419,8 @@ rte_eth_tx_hairpin_queue_setup(uint16_t port_id, uint16_t tx_queue_id, return -EBUSY; txq = dev->data->tx_queues; if (txq[tx_queue_id] != NULL) { - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, - -ENOTSUP); - (*dev->dev_ops->tx_queue_release)(txq[tx_queue_id]); + if (dev->dev_ops->tx_queue_release != NULL) + (*dev->dev_ops->tx_queue_release)(dev, tx_queue_id); txq[tx_queue_id] = NULL; } ret = (*dev->dev_ops->tx_hairpin_queue_setup) -- 2.25.1