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 66DD7A0093 for ; Fri, 22 May 2020 11:42:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5D6671D969; Fri, 22 May 2020 11:42:38 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id E232D1D974 for ; Fri, 22 May 2020 11:42:36 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id h4so8053228wmb.4 for ; Fri, 22 May 2020 02:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A1JxBWu5aeomTt8JkqfInEnsLKuXgO7E3OO8bvhIoS8=; b=C42S9xkp/TtvsSXtG0TILvtvqaq2aGzqRhe2GDDMwQkuQB1Hf55eV4vmHpnlC4MnsF Q4wjLDCCh5HaPzcx4NnNUCvSvvHPKpeW4+sZnjX9m9RSqfWP1uKDhpRrg2IRCYlUVmnp UD4mqALZMr4npn0EfRBlaB7/6UgCgKikDfraInq7iv+KDvetKky8A1f/RSMvBqIiXpL+ CpS5wnFaglpvC2hWbMmbFLToXNsHWbQyscy1zk9eHe1C6rvIV6nURxkXfL55eXeKiKxp tH53FNRNyI9c5q9s8BqvUtLYhYAmTz2ySEJEX3OQXuTuJSPaOMII75WPqoCsks0lFPhM thtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A1JxBWu5aeomTt8JkqfInEnsLKuXgO7E3OO8bvhIoS8=; b=O88jotPOd/JvPxxL2l+AE7JLZr3VyCsf0uvUlgtiINpBGv+C3qkcnLDDwOBYuNISjR efsI/4EpuLBezw1G+UrSFGuuSTFBcVjC/fcqjydce0Mx7OE2PN3jTJNRTjTuRJfIu17Z b5MOlUMJlNAVlumqgsmrwFSx284oHAb9SEyFMPsUoRi4XxihId7dhQG0eYWdA7XKDxx4 9cDuKp1IM7XizU5jJb68eINaepQMbJZQT2OwVPJuAKtfJi/Cy1BvotFLDmS6/Ax6YOIa bvgq61Iy4uxa4Z4f3FkvnkzepyFrULY6+NiZibo+3uQsqdn8vUC/rthcUV1OWKzBLOR0 heng== X-Gm-Message-State: AOAM5335DoMvoXVYV1iKnufXgIXOfkjmcyEIt0gb1fp8AfYe175NVySE 8Tn3/wzYMFtaY7htpWnNruRLuBguTmFcLg== X-Google-Smtp-Source: ABdhPJw5dcRlJta7eXxlhVlAvVfUUaifDgnPMswkAQCPvC5LoiXmKLPhBUoPU9eXeamUbHw4jvQRLg== X-Received: by 2002:a1c:f207:: with SMTP id s7mr12373497wmc.123.1590140556585; Fri, 22 May 2020 02:42:36 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id l5sm1145885wml.27.2020.05.22.02.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 02:42:36 -0700 (PDT) From: luca.boccassi@gmail.com To: Qiming Yang Cc: Xiaolong Ye , dpdk stable Date: Fri, 22 May 2020 10:40:21 +0100 Message-Id: <20200522094022.1025696-42-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200522094022.1025696-1-luca.boccassi@gmail.com> References: <20200519130549.112823-214-luca.boccassi@gmail.com> <20200522094022.1025696-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/i40e: fix queue related exception handling' has been queued to stable release 19.11.3 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 stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/24/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. Thanks. Luca Boccassi --- >From 3ddb8f1d078dcbe197aa6afba46fefad839c2653 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 430e347073..67a44e25f1 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2272,6 +2272,7 @@ i40e_dev_start(struct rte_eth_dev *dev) struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; uint32_t intr_vector = 0; struct i40e_vsi *vsi; + uint16_t nb_rxq, nb_txq; hw->adapter_stopped = 0; @@ -2303,7 +2304,7 @@ i40e_dev_start(struct rte_eth_dev *dev) ret = i40e_dev_rxtx_init(pf); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to init rx/tx queues"); - goto err_up; + return ret; } /* Map queues with MSIX interrupt */ @@ -2328,10 +2329,16 @@ 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; } /* Enable receiving broadcast packets */ @@ -2361,7 +2368,7 @@ i40e_dev_start(struct rte_eth_dev *dev) ret = i40e_aq_set_lb_modes(hw, dev->data->dev_conf.lpbk_mode, NULL); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "fail to set loopback link"); - goto err_up; + goto tx_err; } } @@ -2369,7 +2376,7 @@ i40e_dev_start(struct rte_eth_dev *dev) ret = i40e_apply_link_speed(dev); if (I40E_SUCCESS != ret) { PMD_DRV_LOG(ERR, "Fail to apply link setting"); - goto err_up; + goto tx_err; } if (!rte_intr_allow_others(intr_handle)) { @@ -2412,9 +2419,12 @@ 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; } @@ -2438,7 +2448,11 @@ 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 */ i40e_vsi_disable_queues_intr(main_vsi); @@ -6278,33 +6292,6 @@ i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) return I40E_SUCCESS; } -/* 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) { @@ -6356,59 +6343,6 @@ 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 */ static int diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 5dba0928b9..1f17649081 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -763,7 +763,6 @@ i40evf_stop_queues(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_tx_queues; i++) { if (i40evf_dev_tx_queue_stop(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to stop queue %u", i); - return -1; } } @@ -771,7 +770,6 @@ i40evf_stop_queues(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_rx_queues; i++) { 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 9a1eab4653..249d0c7976 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -1571,6 +1571,15 @@ i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) PMD_INIT_FUNC_TRACE(); 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); if (err) { @@ -1603,6 +1612,11 @@ i40e_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); 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; + } /* * rx_queue_id is queue id application refers to, while @@ -1631,6 +1645,15 @@ i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) PMD_INIT_FUNC_TRACE(); 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); /* * tx_queue_id is queue id application refers to, while @@ -1655,6 +1678,11 @@ i40e_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); 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; + } /* * tx_queue_id is queue id application refers to, while -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-22 10:37:40.859332553 +0100 +++ 0042-net-i40e-fix-queue-related-exception-handling.patch 2020-05-22 10:37:39.276415366 +0100 @@ -1,8 +1,10 @@ -From 6cc330b709b0d0b72880d872edf7d13b95649566 Mon Sep 17 00:00:00 2001 +From 3ddb8f1d078dcbe197aa6afba46fefad839c2653 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 @@ -11,7 +13,6 @@ Fixes: b6583ee40265 ("i40e: full VMDQ pools support") Fixes: 3f6a696f1054 ("i40evf: queue start and stop") -Cc: stable@dpdk.org Signed-off-by: Qiming Yang Acked-by: Xiaolong Ye @@ -22,10 +23,10 @@ 3 files changed, 53 insertions(+), 93 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c -index c68fba125e..970a31cb2e 100644 +index 430e347073..67a44e25f1 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c -@@ -2280,6 +2280,7 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2272,6 +2272,7 @@ i40e_dev_start(struct rte_eth_dev *dev) struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; uint32_t intr_vector = 0; struct i40e_vsi *vsi; @@ -33,7 +34,7 @@ hw->adapter_stopped = 0; -@@ -2311,7 +2312,7 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2303,7 +2304,7 @@ i40e_dev_start(struct rte_eth_dev *dev) ret = i40e_dev_rxtx_init(pf); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to init rx/tx queues"); @@ -42,7 +43,7 @@ } /* Map queues with MSIX interrupt */ -@@ -2336,10 +2337,16 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2328,10 +2329,16 @@ i40e_dev_start(struct rte_eth_dev *dev) } /* Enable all queues which have been configured */ @@ -63,7 +64,7 @@ } /* Enable receiving broadcast packets */ -@@ -2369,7 +2376,7 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2361,7 +2368,7 @@ i40e_dev_start(struct rte_eth_dev *dev) ret = i40e_aq_set_lb_modes(hw, dev->data->dev_conf.lpbk_mode, NULL); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "fail to set loopback link"); @@ -72,7 +73,7 @@ } } -@@ -2377,7 +2384,7 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2369,7 +2376,7 @@ i40e_dev_start(struct rte_eth_dev *dev) ret = i40e_apply_link_speed(dev); if (I40E_SUCCESS != ret) { PMD_DRV_LOG(ERR, "Fail to apply link setting"); @@ -81,7 +82,7 @@ } if (!rte_intr_allow_others(intr_handle)) { -@@ -2420,9 +2427,12 @@ i40e_dev_start(struct rte_eth_dev *dev) +@@ -2412,9 +2419,12 @@ i40e_dev_start(struct rte_eth_dev *dev) return I40E_SUCCESS; @@ -97,7 +98,7 @@ return ret; } -@@ -2446,7 +2456,11 @@ i40e_dev_stop(struct rte_eth_dev *dev) +@@ -2438,7 +2448,11 @@ i40e_dev_stop(struct rte_eth_dev *dev) } /* Disable all queues */ @@ -110,7 +111,7 @@ /* un-map queues with interrupt registers */ i40e_vsi_disable_queues_intr(main_vsi); -@@ -6286,33 +6300,6 @@ i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) +@@ -6278,33 +6292,6 @@ i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) return I40E_SUCCESS; } @@ -144,7 +145,7 @@ int i40e_switch_rx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) { -@@ -6364,59 +6351,6 @@ i40e_switch_rx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) +@@ -6356,59 +6343,6 @@ i40e_switch_rx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on) return I40E_SUCCESS; } @@ -205,10 +206,10 @@ /* Initialize VSI for TX */ static int diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c -index bb5d28a448..eca716a6a8 100644 +index 5dba0928b9..1f17649081 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c -@@ -789,7 +789,6 @@ i40evf_stop_queues(struct rte_eth_dev *dev) +@@ -763,7 +763,6 @@ i40evf_stop_queues(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_tx_queues; i++) { if (i40evf_dev_tx_queue_stop(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to stop queue %u", i); @@ -216,7 +217,7 @@ } } -@@ -797,7 +796,6 @@ i40evf_stop_queues(struct rte_eth_dev *dev) +@@ -771,7 +770,6 @@ i40evf_stop_queues(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_rx_queues; i++) { if (i40evf_dev_rx_queue_stop(dev, i) != 0) { PMD_DRV_LOG(ERR, "Fail to stop queue %u", i); @@ -225,7 +226,7 @@ } diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c -index 5e7c86ed82..840b6f387f 100644 +index 9a1eab4653..249d0c7976 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -1571,6 +1571,15 @@ i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)