- uint16_t old_nb_queues = dev->data->nb_tx_queues;
- struct igb_tx_queue **txq;
- unsigned i;
-
- PMD_INIT_FUNC_TRACE();
-
- if (dev->data->tx_queues == NULL) {
- dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
- sizeof(struct igb_tx_queue *) * nb_queues,
- CACHE_LINE_SIZE);
- if (dev->data->tx_queues == NULL) {
- dev->data->nb_tx_queues = 0;
- return -1;
- }
- }
- else {
- for (i = nb_queues; i < old_nb_queues; i++)
- ixgbe_tx_queue_release(dev->data->tx_queues[i]);
- txq = rte_realloc(dev->data->tx_queues,
- sizeof(struct igb_tx_queue *) * nb_queues,
- CACHE_LINE_SIZE);
- if (txq == NULL)
- return -1;
- else
- dev->data->tx_queues = txq;
- if (nb_queues > old_nb_queues)
- memset(&dev->data->tx_queues[old_nb_queues], 0,
- sizeof(struct igb_tx_queue *) *
- (nb_queues - old_nb_queues));
- }
- dev->data->nb_tx_queues = nb_queues;
- return 0;