[dpdk-dev] [PATCH v4 2/3] ethdev: copy device configuration earlier

Pablo de Lara pablo.de.lara.guarch at intel.com
Thu Mar 24 16:22:03 CET 2016


In rte_eth_dev_configure(), device configuration was copied
after requesting the device information, to check the
maximum number of RX/TX queues. Since this number may change
depending on the device configuration, the memcpy of it
has to be performed before requesting the device information.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
---
 lib/librte_ether/rte_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 8721a6b..b941b0d 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -901,6 +901,9 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		return -EBUSY;
 	}
 
+	/* Copy the dev_conf parameter into the dev structure */
+	memcpy(&dev->data->dev_conf, dev_conf, sizeof(dev->data->dev_conf));
+
 	/*
 	 * Check that the numbers of RX and TX queues are not greater
 	 * than the maximum number of RX and TX queues supported by the
@@ -925,9 +928,6 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		return -EINVAL;
 	}
 
-	/* Copy the dev_conf parameter into the dev structure */
-	memcpy(&dev->data->dev_conf, dev_conf, sizeof(dev->data->dev_conf));
-
 	/*
 	 * If link state interrupt is enabled, check that the
 	 * device supports it.
-- 
2.5.5



More information about the dev mailing list