Thread (62 messages) 62 messages, 10 authors, 2021-10-11

Re: [dpdk-dev] [PATCH v3 1/2] ethdev: queue release callback optional

From: Andrew Rybchenko <hidden>
Date: 2021-09-17 11:29:29

On 9/17/21 12:39 PM, Xueming Li wrote:
Some drivers don't need Rx and Tx queue release callback, make it
optional.

Signed-off-by: Xueming Li <redacted>
LGTM, but please, consider one nit below

Reviewed-by: Andrew Rybchenko <redacted>
quoted hunk ↗ jump to hunk
---
 lib/ethdev/rte_ethdev.c | 48 +++++++++++++++++------------------------
 1 file changed, 20 insertions(+), 28 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index daf5ca9242..2f316d1646 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -905,12 +905,11 @@ 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);
-
 		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)(rxq[i]);
Since 'if' body has more than one line, I'd add curly brackets
around to make it a bit easier to read and more robust against
future changes.

Similar note is applicable to many similar cases in the patch.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help