Skip to contentSkip to conversation

ethdev: fix non-reconfigurable pmd init

PATCH In review Thomas Monjalon 2 participants 3 messages Sep 13, 2013 – Sep 16, 2013 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: fix non-reconfigurable pmd init

Some Poll-Mode Drivers (PMD) are not reconfigurable and, thus, do not implement (rx|tx)_queue_release functions. For these drivers, the functions rte_eth_dev_(rx|tx)_queue_config must return an ENOTSUP error only when reconfiguring, but not at initial configuration.

Move the FUNC_PTR_OR_ERR_RET check into the case of reconfiguration.

---
 lib/librte_ether/rte_ethdev.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
lib/librte_ether/rte_ethdev.c +8 -8
index cb3d424..509cf11 100644
@@ -253,9 +253,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 	void **rxq;
 	unsigned i;
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP);
-
-	if (dev->data->rx_queues == NULL) {
+	if (dev->data->rx_queues == NULL) { /* first time configuration */
 		dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
 				sizeof(dev->data->rx_queues[0]) * nb_queues,
 				CACHE_LINE_SIZE);
@@ -263,7 +261,9 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 			dev->data->nb_rx_queues = 0;
 			return -(ENOMEM);
 		}
-	} else {
+	} else { /* re-configure */
+		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++)
@@ -291,9 +291,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 	void **txq;
 	unsigned i;
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP);
-
-	if (dev->data->tx_queues == NULL) {
+	if (dev->data->tx_queues == NULL) { /* first time configuration */
 		dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
 				sizeof(dev->data->tx_queues[0]) * nb_queues,
 				CACHE_LINE_SIZE);
@@ -301,7 +299,9 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 			dev->data->nb_tx_queues = 0;
 			return -(ENOMEM);
 		}
-	} else {
+	} else { /* re-configure */
+		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++)
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 1379079521-28859-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org

Acked-by
#2 lore raw
Quoted 10 lines · Thomas Monjalon

Some Poll-Mode Drivers (PMD) are not reconfigurable and, thus, do not implement (rx|tx)_queue_release functions. For these drivers, the functions rte_eth_dev_(rx|tx)_queue_config must return an ENOTSUP error only when reconfiguring, but not at initial configuration.

Move the FUNC_PTR_OR_ERR_RET check into the case of reconfiguration.

Signature · 2 lines
Ivan Boule
6WIND Development Engineer

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

16/09/2013 11:43, Ivan Boule :

Quoted 7 lines · Thomas Monjalon
Quoted 6 lines

Some Poll-Mode Drivers (PMD) are not reconfigurable and, thus, do not implement (rx|tx)_queue_release functions. For these drivers, the functions rte_eth_dev_(rx|tx)_queue_config must return an ENOTSUP error only when reconfiguring, but not at initial configuration.

Quoted 5 lines
Quoted 3 lines

Move the FUNC_PTR_OR_ERR_RET check into the case of reconfiguration.

pushed, thanks

Signature · 1 line
Thomas