From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A552EA04A3 for ; Fri, 5 Jun 2020 20:27:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9AE0C1D515; Fri, 5 Jun 2020 20:27:51 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id DFF9E1D547 for ; Fri, 5 Jun 2020 20:27:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591381668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BUlkWRjlTxfe1KqAzgaDoGYuLbtdHP+iDkxY1oL0Kyk=; b=XVDJckBOhqm201omkYdNWIcoU5RqAq1NoPt46wtxcpfcl9DJqkQkz9/RmOrEQTQCMZkisj NZ3Rr8UslfbE6sUZ+IF0dVrSqOzabnWKAsys2oUJoUXr+O/N6/XlJqqiDpfA0Jy+UM4zKv jozxCSI01a4Nxj/PSQJGWal+uIwOJ8w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-48-z9axJepzPUqqsCd-4rcE_w-1; Fri, 05 Jun 2020 14:27:45 -0400 X-MC-Unique: z9axJepzPUqqsCd-4rcE_w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E57C18A822B; Fri, 5 Jun 2020 18:27:44 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B98B60C47; Fri, 5 Jun 2020 18:27:43 +0000 (UTC) From: Kevin Traynor To: Qiming Yang Cc: Xiaolong Ye , dpdk stable Date: Fri, 5 Jun 2020 19:25:10 +0100 Message-Id: <20200605182525.22483-73-ktraynor@redhat.com> In-Reply-To: <20200605182525.22483-1-ktraynor@redhat.com> References: <20200605182525.22483-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/i40e: fix queue related exception handling' has been queued to LTS release 18.11.9 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/10/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/8ef22403db44d3b93527a1988c736e5f38d8c617 Thanks. Kevin. --- >From 8ef22403db44d3b93527a1988c736e5f38d8c617 Mon Sep 17 00:00:00 2001 From: Qiming Yang Date: Mon, 18 May 2020 13:45:53 +0800 Subject: [PATCH] net/i40e: fix queue related exception handling [ upstream commit 6cc330b709b0d0b72880d872edf7d13b95649566 ] There should have different behavior in queue start fail and stop fail case. When queue start fail, all the next actions should be terminated and then started queues should be cleared. But for queue stop stage, one queue stop fail should not end other queues stop. This patch fixed that issue in PF and VF. Fixes: b6583ee40265 ("i40e: full VMDQ pools support") Fixes: 3f6a696f1054 ("i40evf: queue start and stop") Signed-off-by: Qiming Yang Acked-by: Xiaolong Ye --- drivers/net/i40e/i40e_ethdev.c | 116 +++++++----------------------- drivers/net/i40e/i40e_ethdev_vf.c | 2 - drivers/net/i40e/i40e_rxtx.c | 28 ++++++++ 3 files changed, 53 insertions(+), 93 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index fb7b489296..3f1787728f 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2242,4 +2242,5 @@ i40e_dev_start(struct rte_eth_dev *dev) uint32_t intr_vector = 0; struct i40e_vsi *vsi; + uint16_t nb_rxq, nb_txq; hw->adapter_stopped = 0; @@ -2280,5 +2281,5 @@ i40e_dev_start(struct rte_eth_dev *dev) if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to init rx/tx queues"); - goto err_up; + return ret; } @@ -2305,8 +2306,14 @@ i40e_dev_start(struct rte_eth_dev *dev) /* Enable all queues which have been configured */ - ret = i40e_dev_switch_queues(pf, TRUE); - if (ret != I40E_SUCCESS) { - PMD_DRV_LOG(ERR, "Failed to enable VSI"); - goto err_up; + for (nb_rxq = 0; nb_rxq < dev->data->nb_rx_queues; nb_rxq++) { + ret = i40e_dev_rx_queue_start(dev, nb_rxq); + if (ret) + goto rx_err; + } + + for (nb_txq = 0; nb_txq < dev->data->nb_tx_queues; nb_txq++) { + ret = i40e_dev_tx_queue_start(dev, nb_txq); + if (ret) + goto tx_err; } @@ -2338,5 +2345,5 @@ i40e_dev_start(struct rte_eth_dev *dev) if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "fail to set loopback link"); - goto err_up; + goto tx_err; } } @@ -2346,5 +2353,5 @@ i40e_dev_start(struct rte_eth_dev *dev) if (I40E_SUCCESS != ret) { PMD_DRV_LOG(ERR, "Fail to apply link setting"); - goto err_up; + goto tx_err; } @@ -2389,7 +2396,10 @@ i40e_dev_start(struct rte_eth_dev *dev) return I40E_SUCCESS; -err_up: - i40e_dev_switch_queues(pf, FALSE); - i40e_dev_clear_queues(dev); +tx_err: + for (i = 0; i < nb_txq; i++) + i40e_dev_tx_queue_stop(dev, i); +rx_err: + for (i = 0; i < nb_rxq; i++) + i40e_dev_rx_queue_stop(dev, i); return ret; @@ -2415,5 +2425,9 @@ i40e_dev_stop(struct rte_eth_dev *dev) /* Disable all queues */ - i40e_dev_switch_queues(pf, FALSE); + for (i = 0; i < dev->data->nb_tx_queues; i++) + i40e_dev_tx_queue_stop(dev, i); + + for (i = 0; i < dev->data->nb_rx_queues; i++) + i40e_dev_rx_queue_stop(dev, i); /* un-map queues with interrupt registers */ @@ -6158,31 +6172,4 @@ i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) } -/* Swith on or off the tx queues */ -static int -i40e_dev_switch_tx_queues(struct i40e_pf *pf, bool on) -{ - struct rte_eth_dev_data *dev_data = pf->dev_data; - struct i40e_tx_queue *txq; - struct rte_eth_dev *dev = pf->adapter->eth_dev; - uint16_t i; - int ret; - - for (i = 0; i < dev_data->nb_tx_queues; i++) { - txq = dev_data->tx_queues[i]; - /* Don't operate the queue if not configured or - * if starting only per queue */ - if (!txq || !txq->q_set || (on && txq->tx_deferred_start)) - continue; - if (on) - ret = i40e_dev_tx_queue_start(dev, i); - else - ret = i40e_dev_tx_queue_stop(dev, i); - if ( ret != I40E_SUCCESS) - return ret; - } - - return I40E_SUCCESS; -} - int i40e_switch_rx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) @@ -6236,57 +6223,4 @@ i40e_switch_rx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) return I40E_SUCCESS; } -/* Switch on or off the rx queues */ -static int -i40e_dev_switch_rx_queues(struct i40e_pf *pf, bool on) -{ - struct rte_eth_dev_data *dev_data = pf->dev_data; - struct i40e_rx_queue *rxq; - struct rte_eth_dev *dev = pf->adapter->eth_dev; - uint16_t i; - int ret; - - for (i = 0; i < dev_data->nb_rx_queues; i++) { - rxq = dev_data->rx_queues[i]; - /* Don't operate the queue if not configured or - * if starting only per queue */ - if (!rxq || !rxq->q_set || (on && rxq->rx_deferred_start)) - continue; - if (on) - ret = i40e_dev_rx_queue_start(dev, i); - else - ret = i40e_dev_rx_queue_stop(dev, i); - if (ret != I40E_SUCCESS) - return ret; - } - - return I40E_SUCCESS; -} - -/* Switch on or off all the rx/tx queues */ -int -i40e_dev_switch_queues(struct i40e_pf *pf, bool on) -{ - int ret; - - if (on) { - /* enable rx queues before enabling tx queues */ - ret = i40e_dev_switch_rx_queues(pf, on); - if (ret) { - PMD_DRV_LOG(ERR, "Failed to switch rx queues"); - return ret; - } - ret = i40e_dev_switch_tx_queues(pf, on); - } else { - /* Stop tx queues before stopping rx queues */ - ret = i40e_dev_switch_tx_queues(pf, on); - if (ret) { - PMD_DRV_LOG(ERR, "Failed to switch tx queues"); - return ret; - } - ret = i40e_dev_switch_rx_queues(pf, on); - } - - return ret; -} /* Initialize VSI for TX */ diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 16d67b5938..e1ebaa55de 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -739,5 +739,4 @@ i40evf_stop_queues(struct rte_eth_dev *dev) if (i40evf_dev_tx_queue_stop(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to stop queue %u", i); - return -1; } } @@ -747,5 +746,4 @@ i40evf_stop_queues(struct rte_eth_dev *dev) if (i40evf_dev_rx_queue_stop(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to stop queue %u", i); - return -1; } } diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index e4a314f4ab..7c620a76b0 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -1587,4 +1587,13 @@ i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) rxq = dev->data->rx_queues[rx_queue_id]; + if (!rxq || !rxq->q_set) { + PMD_DRV_LOG(ERR, "RX queue %u not available or setup", + rx_queue_id); + return -EINVAL; + } + + if (rxq->rx_deferred_start) + PMD_DRV_LOG(WARNING, "RX queue %u is deferrd start", + rx_queue_id); err = i40e_alloc_rx_queue_mbufs(rxq); @@ -1621,4 +1630,9 @@ i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) rxq = dev->data->rx_queues[rx_queue_id]; + if (!rxq || !rxq->q_set) { + PMD_DRV_LOG(ERR, "RX queue %u not available or setup", + rx_queue_id); + return -EINVAL; + } /* @@ -1649,4 +1663,13 @@ i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) txq = dev->data->tx_queues[tx_queue_id]; + if (!txq || !txq->q_set) { + PMD_DRV_LOG(ERR, "TX queue %u is not available or setup", + tx_queue_id); + return -EINVAL; + } + + if (txq->tx_deferred_start) + PMD_DRV_LOG(WARNING, "TX queue %u is deferrd start", + tx_queue_id); /* @@ -1673,4 +1696,9 @@ i40e_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) txq = dev->data->tx_queues[tx_queue_id]; + if (!txq || !txq->q_set) { + PMD_DRV_LOG(ERR, "TX queue %u is not available or setup", + tx_queue_id); + return -EINVAL; + } /* -- 2.21.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-06-05 19:20:54.827827596 +0100 +++ 0073-net-i40e-fix-queue-related-exception-handling.patch 2020-06-05 19:20:50.975037064 +0100 @@ -1 +1 @@ -From 6cc330b709b0d0b72880d872edf7d13b95649566 Mon Sep 17 00:00:00 2001 +From 8ef22403db44d3b93527a1988c736e5f38d8c617 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 6cc330b709b0d0b72880d872edf7d13b95649566 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index c68fba125e..970a31cb2e 100644 +index fb7b489296..3f1787728f 100644 @@ -28 +29 @@ -@@ -2281,4 +2281,5 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2242,4 +2242,5 @@ i40e_dev_start(struct rte_eth_dev *dev) @@ -34 +35 @@ -@@ -2312,5 +2313,5 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2280,5 +2281,5 @@ i40e_dev_start(struct rte_eth_dev *dev) @@ -41 +42 @@ -@@ -2337,8 +2338,14 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2305,8 +2306,14 @@ i40e_dev_start(struct rte_eth_dev *dev) @@ -60 +61 @@ -@@ -2370,5 +2377,5 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2338,5 +2345,5 @@ i40e_dev_start(struct rte_eth_dev *dev) @@ -67 +68 @@ -@@ -2378,5 +2385,5 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2346,5 +2353,5 @@ i40e_dev_start(struct rte_eth_dev *dev) @@ -74 +75 @@ -@@ -2421,7 +2428,10 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2389,7 +2396,10 @@ i40e_dev_start(struct rte_eth_dev *dev) @@ -88 +89 @@ -@@ -2447,5 +2457,9 @@ i40e_dev_stop(struct rte_eth_dev *dev) +@@ -2415,5 +2425,9 @@ i40e_dev_stop(struct rte_eth_dev *dev) @@ -99 +100 @@ -@@ -6287,31 +6301,4 @@ i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) +@@ -6158,31 +6172,4 @@ i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) @@ -131 +132 @@ -@@ -6365,57 +6352,4 @@ i40e_switch_rx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) +@@ -6236,57 +6223,4 @@ i40e_switch_rx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) @@ -190 +191 @@ -index bb5d28a448..eca716a6a8 100644 +index 16d67b5938..e1ebaa55de 100644 @@ -193 +194 @@ -@@ -790,5 +790,4 @@ i40evf_stop_queues(struct rte_eth_dev *dev) +@@ -739,5 +739,4 @@ i40evf_stop_queues(struct rte_eth_dev *dev) @@ -199 +200 @@ -@@ -798,5 +797,4 @@ i40evf_stop_queues(struct rte_eth_dev *dev) +@@ -747,5 +746,4 @@ i40evf_stop_queues(struct rte_eth_dev *dev) @@ -206 +207 @@ -index 5e7c86ed82..840b6f387f 100644 +index e4a314f4ab..7c620a76b0 100644 @@ -209 +210 @@ -@@ -1572,4 +1572,13 @@ i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) +@@ -1587,4 +1587,13 @@ i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) @@ -223 +224 @@ -@@ -1604,4 +1613,9 @@ i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) +@@ -1621,4 +1630,9 @@ i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) @@ -233 +234 @@ -@@ -1632,4 +1646,13 @@ i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) +@@ -1649,4 +1663,13 @@ i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) @@ -247 +248 @@ -@@ -1656,4 +1679,9 @@ i40e_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) +@@ -1673,4 +1696,9 @@ i40e_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)