net/ixgbe: fix memzone leak on queue re-configure
Normally when closing the device the queue memzone should be freed. But the memzone will be not freed, when device setup ops like: rte_eth_bond_slave_remove -->__eth_bond_slave_remove_lock_free ---->slave_remove ------>rte_eth_dev_internal_reset -------->rte_eth_dev_rx_queue_config ---------->eth_dev_rx_queue_config ------------>ixgbe_dev_rx_queue_release rte_eth_dev_close -->ixgbe_dev_close ---->ixgbe_dev_free_queues ------>ixgbe_dev_rx_queue_release (not been called due to nb_rx_queues and nb_tx_queues are 0) And when queue number is changed to small size, the BIG memzone queue index will be lost. This will lead to a memory leak. So we should release the memzone when releasing queues. Fixes: 460d1679586e ("drivers/net: delete HW rings while freeing queues") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> Acked-by: Haiyue Wang <haiyue.wang@intel.com>
This commit is contained in:
parent
e3188d5f99
commit
a4ae7f51d2
@ -2482,6 +2482,7 @@ ixgbe_tx_queue_release(struct ixgbe_tx_queue *txq)
|
||||
if (txq != NULL && txq->ops != NULL) {
|
||||
txq->ops->release_mbufs(txq);
|
||||
txq->ops->free_swring(txq);
|
||||
rte_memzone_free(txq->mz);
|
||||
rte_free(txq);
|
||||
}
|
||||
}
|
||||
@ -2763,6 +2764,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
txq->mz = tz;
|
||||
txq->nb_tx_desc = nb_desc;
|
||||
txq->tx_rs_thresh = tx_rs_thresh;
|
||||
txq->tx_free_thresh = tx_free_thresh;
|
||||
@ -2887,6 +2889,7 @@ ixgbe_rx_queue_release(struct ixgbe_rx_queue *rxq)
|
||||
ixgbe_rx_queue_release_mbufs(rxq);
|
||||
rte_free(rxq->sw_ring);
|
||||
rte_free(rxq->sw_sc_ring);
|
||||
rte_memzone_free(rxq->mz);
|
||||
rte_free(rxq);
|
||||
}
|
||||
}
|
||||
@ -3162,6 +3165,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
rxq->mz = rz;
|
||||
/*
|
||||
* Zero init all the descriptors in the ring.
|
||||
*/
|
||||
@ -3433,14 +3437,12 @@ ixgbe_dev_free_queues(struct rte_eth_dev *dev)
|
||||
for (i = 0; i < dev->data->nb_rx_queues; i++) {
|
||||
ixgbe_dev_rx_queue_release(dev, i);
|
||||
dev->data->rx_queues[i] = NULL;
|
||||
rte_eth_dma_zone_free(dev, "rx_ring", i);
|
||||
}
|
||||
dev->data->nb_rx_queues = 0;
|
||||
|
||||
for (i = 0; i < dev->data->nb_tx_queues; i++) {
|
||||
ixgbe_dev_tx_queue_release(dev, i);
|
||||
dev->data->tx_queues[i] = NULL;
|
||||
rte_eth_dma_zone_free(dev, "tx_ring", i);
|
||||
}
|
||||
dev->data->nb_tx_queues = 0;
|
||||
}
|
||||
|
@ -138,6 +138,7 @@ struct ixgbe_rx_queue {
|
||||
struct rte_mbuf fake_mbuf;
|
||||
/** hold packets to return to application */
|
||||
struct rte_mbuf *rx_stage[RTE_PMD_IXGBE_RX_MAX_BURST*2];
|
||||
const struct rte_memzone *mz;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -236,6 +237,7 @@ struct ixgbe_tx_queue {
|
||||
uint8_t using_ipsec;
|
||||
/**< indicates that IPsec TX feature is in use */
|
||||
#endif
|
||||
const struct rte_memzone *mz;
|
||||
};
|
||||
|
||||
struct ixgbe_txq_ops {
|
||||
|
Loading…
x
Reference in New Issue
Block a user