ethdev: free queue array after releasing all queues
authorJan Blunck <jblunck@infradead.org>
Thu, 24 Nov 2016 11:26:46 +0000 (12:26 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 21 Dec 2016 17:40:09 +0000 (18:40 +0100)
If all queues are released lets also free up the dev->data->rx/tx_queues
to be able to properly reinitialize.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
lib/librte_ether/rte_ethdev.c

index 7003ac3..418434c 100644 (file)
@@ -529,6 +529,9 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 
                for (i = nb_queues; i < old_nb_queues; i++)
                        (*dev->dev_ops->rx_queue_release)(rxq[i]);
+
+               rte_free(dev->data->rx_queues);
+               dev->data->rx_queues = NULL;
        }
        dev->data->nb_rx_queues = nb_queues;
        return 0;
@@ -680,6 +683,9 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 
                for (i = nb_queues; i < old_nb_queues; i++)
                        (*dev->dev_ops->tx_queue_release)(txq[i]);
+
+               rte_free(dev->data->tx_queues);
+               dev->data->tx_queues = NULL;
        }
        dev->data->nb_tx_queues = nb_queues;
        return 0;