From patchwork Mon Oct 12 14:19:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABtan_Rivet?= X-Patchwork-Id: 80376 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A2B80A04B6; Mon, 12 Oct 2020 16:19:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E6401D8F5; Mon, 12 Oct 2020 16:19:20 +0200 (CEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by dpdk.org (Postfix) with ESMTP id AE1261D8CA; Mon, 12 Oct 2020 16:19:17 +0200 (CEST) X-Originating-IP: 86.254.165.59 Received: from inocybe.home (lfbn-poi-1-843-59.w86-254.abo.wanadoo.fr [86.254.165.59]) (Authenticated sender: grive@u256.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 2552A60014; Mon, 12 Oct 2020 14:19:15 +0000 (UTC) From: Gaetan Rivet To: dev@dpdk.org Cc: longli@microsoft.com, stable@dpdk.org Date: Mon, 12 Oct 2020 16:19:04 +0200 Message-Id: X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/failsafe: fix state synchro cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" During a hotplug attempt, failsafe will try to bring a subdevice that just appeared to its internal state. On error, the subdevice is marked for removal and will be cleaned up. However failsafe_dev_remove() only remove active devices. Devices that failed during probe will be stuck in DEV_PARSED state repeatedly. Consider all devices when doing a removal round, but limit burst control and stats saving to active devices. Fixes: 598fb8aec6f6 ("net/failsafe: support device removal") Cc: stable@dpdk.org Signed-off-by: Gaetan Rivet --- drivers/net/failsafe/failsafe_ether.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 2b748bd8b4..30f778dbf2 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -383,14 +383,23 @@ failsafe_dev_remove(struct rte_eth_dev *dev) struct sub_device *sdev; uint8_t i; - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) - if (sdev->remove && fs_rxtx_clean(sdev)) { - if (fs_lock(dev, 1) != 0) - return; + FOREACH_SUBDEV(sdev, i, dev) { + if (!sdev->remove) + continue; + + /* Active devices must have finished their burst and + * their stats must be saved. + */ + if (sdev->state >= DEV_ACTIVE && + fs_rxtx_clean(sdev) == 0) + continue; + if (fs_lock(dev, 1) != 0) + return; + if (sdev->state >= DEV_ACTIVE) fs_dev_stats_save(sdev); - fs_dev_remove(sdev); - fs_unlock(dev, 1); - } + fs_dev_remove(sdev); + fs_unlock(dev, 1); + } } static int