DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@nvidia.com>
Cc: <dev@dpdk.org>, Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	<xuemingl@nvidia.com>, Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: [dpdk-dev] [RFC] ethdev: change queue release callback
Date: Tue, 27 Jul 2021 11:41:34 +0800	[thread overview]
Message-ID: <20210727034134.20556-1-xuemingl@nvidia.com> (raw)

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 <xuemingl@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


             reply	other threads:[~2021-07-27  3:42 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27  3:41 Xueming Li [this message]
2021-07-28  7:40 ` Andrew Rybchenko
2021-08-09 14:39   ` Singh, Aman Deep
2021-08-09 15:31     ` Ferruh Yigit
2021-08-10  8:03       ` Xueming(Steven) Li
2021-08-10  8:54         ` Ferruh Yigit
2021-08-10  9:07           ` Xueming(Steven) Li
2021-08-11 11:57             ` Ferruh Yigit
2021-08-11 12:13               ` Xueming(Steven) Li
2021-08-12 14:29                 ` Xueming(Steven) Li
2021-09-26 11:25               ` Xueming(Steven) Li
2021-08-11 13:45 ` [dpdk-dev] [PATCH v1] " Xueming Li
2021-09-15 13:02 ` [dpdk-dev] [PATCH v2] " Xueming Li
2021-09-15 13:36   ` Xueming(Steven) Li
2021-09-16  8:09   ` Thomas Monjalon
2021-09-16 15:43     ` Xueming(Steven) Li
2021-09-16 15:50       ` Thomas Monjalon
2021-09-17  9:40         ` Xueming(Steven) Li
2021-09-17  9:39 ` [dpdk-dev] [PATCH v3 0/2] " Xueming Li
2021-09-17  9:39   ` [dpdk-dev] [PATCH v3 1/2] ethdev: queue release callback optional Xueming Li
2021-09-17 11:29     ` Andrew Rybchenko
2021-09-17 11:53       ` Andrew Rybchenko
2021-09-17 14:33         ` Xueming(Steven) Li
2021-09-17  9:39   ` [dpdk-dev] [PATCH v3 2/2] ethdev: change queue release callback Xueming Li
2021-09-17 11:49     ` Andrew Rybchenko
2021-09-17 14:31       ` Xueming(Steven) Li
2021-09-17 14:28 ` [dpdk-dev] [PATCH v4 0/2] " Xueming Li
2021-09-17 14:28   ` [dpdk-dev] [PATCH v4 1/2] ethdev: make queue release callback optional Xueming Li
2021-09-18  6:44     ` Andrew Rybchenko
2021-10-05 22:00       ` Thomas Monjalon
2021-09-17 14:28   ` [dpdk-dev] [PATCH v4 2/2] ethdev: change queue release callback Xueming Li
2021-09-18  6:50     ` Andrew Rybchenko
2021-09-18 12:39       ` Xueming(Steven) Li
2021-09-18 12:35 ` [dpdk-dev] [PATCH v5 0/2] " Xueming Li
2021-09-18 12:35   ` [dpdk-dev] [PATCH v5 1/2] ethdev: make queue release callback optional Xueming Li
2021-09-21 16:23     ` Ferruh Yigit
2021-09-18 12:35   ` [dpdk-dev] [PATCH v5 2/2] ethdev: change queue release callback Xueming Li
2021-09-21 18:13     ` Ferruh Yigit
2021-09-22  9:35       ` Xueming(Steven) Li
2021-09-22 10:57         ` Ferruh Yigit
2021-09-22 12:54           ` Xueming(Steven) Li
2021-09-29 13:57             ` Xueming(Steven) Li
2021-10-05 16:38               ` Ferruh Yigit
2021-10-06  7:55                 ` Xueming(Steven) Li
2021-10-06  8:04                   ` Ferruh Yigit
2021-10-06 11:19                     ` Xueming(Steven) Li
     [not found]           ` <2d2e9329b076c022418efd7b38ff280cf3ed1af4.camel@nvidia.com>
     [not found]             ` <56f7537a-bfc0-e4b8-72e8-c382ef0e2dbd@huawei.com>
     [not found]               ` <8e2c2f96265dc17af0564befb3918f1a8ea5154a.camel@nvidia.com>
2021-09-29 14:04                 ` [dpdk-dev] Fwd: " Xueming(Steven) Li
2021-09-30 15:17 ` [dpdk-dev] [PATCH v6 0/2] " Xueming Li
2021-09-30 15:17   ` [dpdk-dev] [PATCH v6 1/2] ethdev: make queue release callback optional Xueming Li
2021-10-05 22:04     ` Thomas Monjalon
2021-09-30 15:17   ` [dpdk-dev] [PATCH v6 2/2] ethdev: change queue release callback Xueming Li
2021-10-03  7:38     ` Matan Azrad
2021-10-03 21:00       ` Ajit Khaparde
2021-10-06 10:21     ` Somnath Kotur
2021-10-06 11:18 ` [dpdk-dev] [PATCH v7 0/2] " Xueming Li
2021-10-06 11:18   ` [dpdk-dev] [PATCH v7 1/2] ethdev: make queue release callback optional Xueming Li
2021-10-06 15:38     ` Hemant Agrawal
2021-10-08  8:16     ` Xu, Rosen
2021-10-06 11:18   ` [dpdk-dev] [PATCH v7 2/2] ethdev: change queue release callback Xueming Li
2021-10-06 17:20     ` Ferruh Yigit
2021-10-11  8:28     ` Thomas Monjalon
2021-10-11 13:11       ` Ferruh Yigit
2021-10-06 17:25   ` [dpdk-dev] [PATCH v7 0/2] " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210727034134.20556-1-xuemingl@nvidia.com \
    --to=xuemingl@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).