patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/iavf: fix queue start exception handle
@ 2022-05-19  5:01 Qiming Yang
  2022-05-19  5:40 ` Zhang, Qi Z
  0 siblings, 1 reply; 2+ messages in thread
From: Qiming Yang @ 2022-05-19  5:01 UTC (permalink / raw)
  To: dev, beilei.xing; +Cc: Qiming Yang, stable

When queue start fail, started queues should be cleared.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
Cc: stable@dpdk.org

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 79397f15e5..69472869e3 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -896,28 +896,38 @@ iavf_start_queues(struct rte_eth_dev *dev)
 	struct iavf_rx_queue *rxq;
 	struct iavf_tx_queue *txq;
 	int i;
+	uint16_t nb_txq, nb_rxq;
 
-	for (i = 0; i < dev->data->nb_tx_queues; i++) {
-		txq = dev->data->tx_queues[i];
+	for (nb_txq = 0; nb_txq < dev->data->nb_tx_queues; nb_txq++) {
+		txq = dev->data->tx_queues[nb_txq];
 		if (txq->tx_deferred_start)
 			continue;
-		if (iavf_dev_tx_queue_start(dev, i) != 0) {
-			PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
-			return -1;
+		if (iavf_dev_tx_queue_start(dev, nb_txq) != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start tx queue %u", nb_txq);
+			goto tx_err;
 		}
 	}
 
-	for (i = 0; i < dev->data->nb_rx_queues; i++) {
-		rxq = dev->data->rx_queues[i];
+	for (nb_rxq = 0; nb_rxq < dev->data->nb_rx_queues; nb_rxq++) {
+		rxq = dev->data->rx_queues[nb_rxq];
 		if (rxq->rx_deferred_start)
 			continue;
-		if (iavf_dev_rx_queue_start(dev, i) != 0) {
-			PMD_DRV_LOG(ERR, "Fail to start queue %u", i);
-			return -1;
+		if (iavf_dev_rx_queue_start(dev, nb_rxq) != 0) {
+			PMD_DRV_LOG(ERR, "Fail to start rx queue %u", nb_rxq);
+			goto rx_err;
 		}
 	}
 
 	return 0;
+
+rx_err:
+	for (i = 0; i < nb_rxq; i++)
+		iavf_dev_rx_queue_stop(dev, i);
+tx_err:
+	for (i = 0; i < nb_txq; i++)
+		iavf_dev_tx_queue_stop(dev, i);
+
+	return -1;
 }
 
 static int
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-19  5:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19  5:01 [PATCH] net/iavf: fix queue start exception handle Qiming Yang
2022-05-19  5:40 ` Zhang, Qi Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).