From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B085DA0505 for ; Thu, 19 May 2022 07:05:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A3DBC4114A; Thu, 19 May 2022 07:05:13 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 349DC40140; Thu, 19 May 2022 07:05:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652936711; x=1684472711; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=hi6Jrsj+e1yDNclDL69KPoXRkfICyYe/LdlMdB4Dg1Y=; b=b6+jJSY7qSzig7+hKOuhHsOcbpSl9LxTW5BtaawY0Gis2Fj5rLqHtIsD a+FHGdCvfyEFXw0DoBWazegR+LkA/oYCDQtHCj8e/XBwqfz+TWNuQPORO 2aPo9fgvOeF4JiUFcLB19aX/1NYw0YLegqNz3sUxMJ6AguGEDTk702sAj bLVwG4gxK2/vm7lOBaomWjvtTs9FAOfGvkd4lW6hZ+EiN7+rzhCJykcMm 7ivQPQmv+1S6yAO5krXDsjBU4j1K8hJ87LrXEAXzlpP1ETJ+kx7CuZV6L RH4EnbCCIOQUh7A8vG0k4Jw9NTWryIZKG2aM/+nur96S8Q/YMVA0XQa6x g==; X-IronPort-AV: E=McAfee;i="6400,9594,10351"; a="259592565" X-IronPort-AV: E=Sophos;i="5.91,236,1647327600"; d="scan'208";a="259592565" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2022 22:05:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,236,1647327600"; d="scan'208";a="606295178" Received: from dpdk-qiming3.sh.intel.com ([10.67.110.236]) by orsmga001.jf.intel.com with ESMTP; 18 May 2022 22:05:07 -0700 From: Qiming Yang To: dev@dpdk.org, beilei.xing@intel.com Cc: Qiming Yang , stable@dpdk.org Subject: [PATCH] net/iavf: fix queue start exception handle Date: Thu, 19 May 2022 05:01:56 +0000 Message-Id: <20220519050156.2582996-1-qiming.yang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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 --- 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