Skip to contentSkip to conversation

ethdev: fix corrupted device info in configure

PATCH In review Ferruh Yigit 2 participants 3 messages May 9, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: fix corrupted device info in configure

Calling dev_infos_get() devops directly in rte_eth_dev_configure cause random values in uninitialized fields because devops doesn't reset the dev_info structure.

Call rte_eth_dev_info_get() API instead which memset the struct.

Also remove duplicated dev_infos_get existence check.

Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")
---
 lib/librte_ethdev/rte_ethdev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
lib/librte_ethdev/rte_ethdev.c +3 -4
index 4b713a184..9304b0d4b 100644
@@ -1028,7 +1028,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+
+	rte_eth_dev_info_get(port_id, &dev_info);
 
 	/* If number of queues specified by application for both Rx and Tx is
 	 * zero, use driver preferred values. This cannot be done individually
@@ -1059,9 +1061,6 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		return -EINVAL;
 	}
 
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
-
 	if (dev->data->dev_started) {
 		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
Signature · 1 line
2.14.3
Acked-by on v1 1/1
#1 lore raw

10/05/2018 00:16, Ferruh Yigit:

Quoted 4 lines

Calling dev_infos_get() devops directly in rte_eth_dev_configure cause random values in uninitialized fields because devops doesn't reset the dev_info structure.

Quoted 8 lines

Call rte_eth_dev_info_get() API instead which memset the struct.

Also remove duplicated dev_infos_get existence check.

Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")
author Applied
#2 lore raw
Quoted 7 lines · Thomas Monjalon

10/05/2018 00:16, Ferruh Yigit:

Quoted 6 lines

Calling dev_infos_get() devops directly in rte_eth_dev_configure cause random values in uninitialized fields because devops doesn't reset the dev_info structure.

Call rte_eth_dev_info_get() API instead which memset the struct.

Quoted 8 lines
Quoted 6 lines

Also remove duplicated dev_infos_get existence check.

Fixes 3be82f5cc5e3 ("ethdev: support PMD-tuned Tx/Rx parameters")

Applied to dpdk-next-net/master, thanks.