From patchwork Tue Jun 28 01:33:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12897512 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 5EFD2C433EF for ; Tue, 28 Jun 2022 01:35:44 +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=PFl3KHP82Ybgx7Gibt7Hc/QYzMYnVC8d2Utt3BM6Mg4=; b=fiERRzyWjks+WM Z77m+JO4/ob0XjhEqeSEaAhB6Zwz1GnC4XtMikqbWFy87cQHSiYiz1zXvQh6AsuEPNu5P9Hf7clwT A6iB4g6vpQGxpnmpkqlnXutqrTo5kJveZlPmbjSWpod106WwZYyIAF+KL8itKS3C5jA6E++4ZBEpG AJhh9DCq2+yPLhtJKjguDT/z9QEWjwdRu4+gT8Fl8rfHJgSOifuFO2c6/ukXcl0za1yXHWWh1INtE g5tP3rRSoWAM0PDvlU1p9XuqOsUH95wZc2mjOZiKIUSbz9bgVavGzUhKMUvwgJdImOGXtkL/vlNmO 6+WPORFZZVMj/IfUu7Dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o607b-003WPA-O3; Tue, 28 Jun 2022 01:34:31 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o607H-003WGu-Aj for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 01:34:12 +0000 Received: by mail-ed1-x530.google.com with SMTP id ej4so15454920edb.7 for ; Mon, 27 Jun 2022 18:34:08 -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=iXMh8QpPv/1aXKHGIBmnrm9Vg4DXhE4ZP8Hc+hLQFGQ=; b=iSLPEcMimUmFNWA7S9EVs9feLPDJLUCwZ1xnX5Dcv0912ADR3eLqtn2mTAJQRCUhph +46PzVI+CD25zqDIk+OFmZ+PKs91pgaN0eh6W5ATIJARMUnCBhfXq7+l+SftyJG0hyj5 iTVsnb7boNeWXirGktLqd/702oIVnobEs+rei18XCwz8nzWh8py8kKGavZOVIsUhiehV eKT3X/p0F6XWJypvR1kqw5DOMdk13/EBnLmwE68eB86+7yW5obwVeRFj0JIFvAf5ElJR z5+AKA4watCMXSjQRHNfj9w41uQhaFqdfvRq4+YMjsPtwcus3EmHM2W/KLVYyHf0zzuP zBTA== 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=iXMh8QpPv/1aXKHGIBmnrm9Vg4DXhE4ZP8Hc+hLQFGQ=; b=ZstC5pHTSKYWmz8TBOs7Wd3bDD7tqvG5MUeZUkPnbMZRzeAB+2xiLmNTRwKMu0LJa0 QC+yxJumtu6k3t8ACUH2FGTSJ00/Snoux5vz4sfUMtBMYDHnzwHXzlVituzyZJx5I/z1 +HXloiF7DcN6/AZKBgQrY2U/lLKjNGGDzo5dPGDnpDzcUp0xMvYw9GgL5v1n+74GMkiS 5GWsXcws/oqPWmi9wvVwiJct+GWGuoTZFaid2iFKAisSOOGwTMiWhXaQP8kes+sLnIZz 91NGUkLlbHZAw7UItwydBFBqaMXCH0jWDjAVN8/SgbVjM73w997/2Yd2ff6QF/sTx5UF R6iA== X-Gm-Message-State: AJIora/qfURdfBixdSW4edsOfhT+IqpBkJzMIBLVaPZv61So9JGM1ddn rCy07Beh9PXgcNqoCQ+/F4Y= X-Google-Smtp-Source: AGRyM1vrS+YccdrvNawuCtViR0sTpIxGP/KIv7SC+cYNjQupzDKy6zZAQKeNq1r36/eUZZ2HEe+pqw== X-Received: by 2002:a05:6402:2047:b0:435:67e0:44fe with SMTP id bc7-20020a056402204700b0043567e044femr19876442edb.360.1656380047685; Mon, 27 Jun 2022 18:34:07 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id x13-20020a170906b08d00b00724261b592esm5693492ejy.186.2022.06.27.18.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 18:34:07 -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 RFC 2/5] net: ethernet: stmicro: stmmac: first disable all queues in release Date: Tue, 28 Jun 2022 03:33:39 +0200 Message-Id: <20220628013342.13581-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628013342.13581-1-ansuelsmth@gmail.com> References: <20220628013342.13581-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220627_183411_414079_FEE713DD X-CRM114-Status: GOOD ( 14.90 ) 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 f861246de2e5..f4ba27c1c7e0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3756,6 +3756,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)) @@ -3764,11 +3769,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);