From 5db6b738c5472264f092c1a3b26d5707a4afd145 Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Thu, 24 Mar 2016 15:22:03 +0000 Subject: [PATCH] ethdev: fix possibly incorrect maximum queues In rte_eth_dev_configure(), device configuration was copied to the dev struct after get_dev_info() was called to get the max queue information. In some drivers, though, the max queues can vary depending on the device configuration - but that information is not available to the driver until the copy is made. This patch moves the memcpy of the device configuration into the dev->data structure before the call to get_dev_info(), thereby making it accessible to drivers to use when reporting their max queues. Fixes: af75078fece3 ("first public release") Signed-off-by: Pablo de Lara Acked-by: John McNamara --- 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 c0d85d66f0..76a30fda4c 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.20.1