net/gve: support queue release
Add support for queue operations: - rx_queue_release - tx_queue_release Previous gve_tx_queue_release and gve_rx_queue_release functions are only used internally to release Rx/Tx queue related resources. But when the queues or ports are required to re-config, both of the dev ops tx_queue_release and ops rx_queue_release will be checked and then called. Without these two dev ops, the Rx/Tx queue struct will be set as NULL directly. Signed-off-by: Junfeng Guo <junfeng.guo@intel.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>
This commit is contained in:
parent
4f04edcda7
commit
10d9e91a76
@ -244,8 +244,6 @@ static int
|
||||
gve_dev_close(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct gve_priv *priv = dev->data->dev_private;
|
||||
struct gve_tx_queue *txq;
|
||||
struct gve_rx_queue *rxq;
|
||||
int err = 0;
|
||||
uint16_t i;
|
||||
|
||||
@ -255,15 +253,11 @@ gve_dev_close(struct rte_eth_dev *dev)
|
||||
PMD_DRV_LOG(ERR, "Failed to stop dev.");
|
||||
}
|
||||
|
||||
for (i = 0; i < dev->data->nb_tx_queues; i++) {
|
||||
txq = dev->data->tx_queues[i];
|
||||
gve_tx_queue_release(txq);
|
||||
}
|
||||
for (i = 0; i < dev->data->nb_tx_queues; i++)
|
||||
gve_tx_queue_release(dev, i);
|
||||
|
||||
for (i = 0; i < dev->data->nb_rx_queues; i++) {
|
||||
rxq = dev->data->rx_queues[i];
|
||||
gve_rx_queue_release(rxq);
|
||||
}
|
||||
for (i = 0; i < dev->data->nb_rx_queues; i++)
|
||||
gve_rx_queue_release(dev, i);
|
||||
|
||||
gve_free_qpls(priv);
|
||||
rte_free(priv->adminq);
|
||||
@ -362,6 +356,8 @@ static const struct eth_dev_ops gve_eth_dev_ops = {
|
||||
.dev_infos_get = gve_dev_info_get,
|
||||
.rx_queue_setup = gve_rx_queue_setup,
|
||||
.tx_queue_setup = gve_tx_queue_setup,
|
||||
.rx_queue_release = gve_rx_queue_release,
|
||||
.tx_queue_release = gve_tx_queue_release,
|
||||
.link_update = gve_link_update,
|
||||
.mtu_set = gve_dev_mtu_set,
|
||||
};
|
||||
|
@ -291,10 +291,10 @@ gve_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, uint16_t nb_desc,
|
||||
unsigned int socket_id, const struct rte_eth_txconf *conf);
|
||||
|
||||
void
|
||||
gve_tx_queue_release(void *txq);
|
||||
gve_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
|
||||
|
||||
void
|
||||
gve_rx_queue_release(void *rxq);
|
||||
gve_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
|
||||
|
||||
void
|
||||
gve_stop_tx_queues(struct rte_eth_dev *dev);
|
||||
|
@ -192,9 +192,9 @@ gve_release_rxq_mbufs(struct gve_rx_queue *rxq)
|
||||
}
|
||||
|
||||
void
|
||||
gve_rx_queue_release(void *rxq)
|
||||
gve_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
|
||||
{
|
||||
struct gve_rx_queue *q = rxq;
|
||||
struct gve_rx_queue *q = dev->data->rx_queues[qid];
|
||||
|
||||
if (!q)
|
||||
return;
|
||||
@ -232,7 +232,7 @@ gve_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,
|
||||
|
||||
/* Free memory if needed. */
|
||||
if (dev->data->rx_queues[queue_id]) {
|
||||
gve_rx_queue_release(dev->data->rx_queues[queue_id]);
|
||||
gve_rx_queue_release(dev, queue_id);
|
||||
dev->data->rx_queues[queue_id] = NULL;
|
||||
}
|
||||
|
||||
|
@ -514,9 +514,9 @@ gve_release_txq_mbufs(struct gve_tx_queue *txq)
|
||||
}
|
||||
|
||||
void
|
||||
gve_tx_queue_release(void *txq)
|
||||
gve_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
|
||||
{
|
||||
struct gve_tx_queue *q = txq;
|
||||
struct gve_tx_queue *q = dev->data->tx_queues[qid];
|
||||
|
||||
if (!q)
|
||||
return;
|
||||
@ -553,7 +553,7 @@ gve_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id, uint16_t nb_desc,
|
||||
|
||||
/* Free memory if needed. */
|
||||
if (dev->data->tx_queues[queue_id]) {
|
||||
gve_tx_queue_release(dev->data->tx_queues[queue_id]);
|
||||
gve_tx_queue_release(dev, queue_id);
|
||||
dev->data->tx_queues[queue_id] = NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user