From patchwork Sat Jul 16 23:07:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12920323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2256FC433EF for ; Sat, 16 Jul 2022 23:09:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vn6HHm2Z/AO8+OGBt9lTAClVCi878w95vyKa//sUhvM=; b=0VQfj8bE4kADVJ DAoxdvFGv5DyiSLeWtMMHv3TbEYqgtu1p51JQ/C92XSDmV8WdAKHi+pgUJtmTygi27Lo+nAWNkdni WEYcORhsL8mqtDFCDN3vkXI1X/avwDAw3806uB4XWOToaG7PFR1Ee1OB0aaKNWDi0eGCTqe1jqu2c knCHvEnd2llGhfXam2I7pxoBqBnV/leMCwbqYHjPMhfxz/Zp9Z10SQzs/gj+3gfuqgpbyXQOV/B1F Pi5fsLZNsxAZe/kfLiIyVZxlfCNHe0YXln+u3bGzkTvPCI5PQw6RB1yZsTiZTxNz+4RdburJAVveG COEnd6bveyyI3WoaZDaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCqta-001BDb-WC; Sat, 16 Jul 2022 23:08:23 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCqtQ-001B8Y-UU for linux-arm-kernel@lists.infradead.org; Sat, 16 Jul 2022 23:08:14 +0000 Received: by mail-wr1-x42f.google.com with SMTP id q9so11833029wrd.8 for ; Sat, 16 Jul 2022 16:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AcH9xqJ0k/4jByViDRihM1a2jjuLTRujm9Mqh/y4WfU=; b=Gfcogbmz3/K65c3EnnUC1lbWrysiwjn7PTvEVGPFELRoym4ssg/p1VDUPd8z1VQs/2 IPCagCFhuGEoQFsFa6usAmm+P8l4tK+MdcYMeVcxwg9GpHfNO+Hxamf4VFXlGsGLSVrZ RIQOCOS/qam6UbXgIYcHkiUFlY1c5s2MXcqnt3zEBZwESv2mJ/NX2Lw5pVfxq3KTJ2gt qpndMGJewN28lhy0vfDGjQDXpf10nJcZVs0GKQBcFjA3gXq3ad+fkPsUL0uvlPxujyA0 HV2hssNImYnmKbyshYVQnsfEfj4lnJwEb1EPQKjBQXI7A5jaxecPtqlVJ/JWifihk8uU W/9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AcH9xqJ0k/4jByViDRihM1a2jjuLTRujm9Mqh/y4WfU=; b=Dz+uo6ICLUETGg8iREEFOJ/YJOno7Ljobm8CLLjeZb9ELiysoOyCoy2AHPPgC78rWV 3mIne6vyHs8d5n/1bcXe2BDaGXdF0x2h4828y5bdOAXJubCbJGgXSmrNRw18ZL9wuTEN 86xSPGtyAqf+6LJb/Du0wVefQdOlDJKJOWM1ir1uNgmPG+Pkshj+vEfsqAP1Wj/6QCGu EPrTVsNrUAyrxOPnNmfsdCCLJHn1jhmtDyG5g9iFKCYi8YnNL9v+HiKlGKaaWJ0LdTa8 0mIIAlymEUVXvNvgWE1dzbysQ2YLhPHifB0QU9v9S01mAw6nlTEcGzx7naDwwDtd87BB LHmQ== X-Gm-Message-State: AJIora+fpAuHdeoV/eQEYZKEQGiwnFqUQeB1R5iaQnhZSwkt+vbjFgDW gMacvfDUyEjXuCebB+ce8iQ= X-Google-Smtp-Source: AGRyM1tP2PAJFpt2bHiFsNgLLbCwK7Qak01U2580Nyv+iEK/GVTVb7lSi0R1YMZOoK2qrWWj+Mnn8g== X-Received: by 2002:a05:6000:15c8:b0:21d:babe:e75c with SMTP id y8-20020a05600015c800b0021dbabee75cmr18627124wry.32.1658012891127; Sat, 16 Jul 2022 16:08:11 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id l13-20020a05600c2ccd00b003a2f2bb72d5sm15150755wmc.45.2022.07.16.16.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 16:08:10 -0700 (PDT) From: Christian Marangi To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Russell King , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [net-next PATCH v3 2/5] net: ethernet: stmicro: stmmac: first disable all queues in release Date: Sun, 17 Jul 2022 01:07:59 +0200 Message-Id: <20220716230802.20788-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220716230802.20788-1-ansuelsmth@gmail.com> References: <20220716230802.20788-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220716_160812_989725_3FCCE3AD X-CRM114-Status: GOOD ( 13.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Disable all queues before tx_disable in stmmac_release to prevent a corner case where packet may be still queued at the same time tx_disable is called resulting in kernel panic if some packet still has to be processed. Signed-off-by: Christian Marangi --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5578abb14949..1854dcdd6095 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3758,6 +3758,11 @@ static int stmmac_release(struct net_device *dev) struct stmmac_priv *priv = netdev_priv(dev); u32 chan; + stmmac_disable_all_queues(priv); + + for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) + hrtimer_cancel(&priv->tx_queue[chan].txtimer); + netif_tx_disable(dev); if (device_may_wakeup(priv->device)) @@ -3766,11 +3771,6 @@ static int stmmac_release(struct net_device *dev) phylink_stop(priv->phylink); phylink_disconnect_phy(priv->phylink); - stmmac_disable_all_queues(priv); - - for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) - hrtimer_cancel(&priv->tx_queue[chan].txtimer); - /* Free the IRQ lines */ stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0);