From patchwork Sat Jul 16 18:45:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12920237 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 3AADEC433EF for ; Sat, 16 Jul 2022 18:49:22 +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=hd/PdGmjVufv7C 2V4qGjdVSU3o6cg7ig7ZhTDhQ9vgnOSxD2puzmpzo/vOkkimngauRId9fwGMFvrRabZedsgs+fTgr jKXMGuvWuTLbU0KG3tNjyz2y+vFGsGVXRfStrf6jZs1MvqyBtkJoaVDZf3YemgM7E6gvPeAv2B8+B +gHaHI5qcDWxmLBY3bAquOkpR4bn54Zda7aW3dXkhB3Yv8IGG3jCNzyOazECzVlI710i8ED6596Pu X/vAskQ7W+R7drfruKDth4b0Rr2Frh59k+/PBWHVrQsCXZRSinetN57bnej/PGU4S/xnU/e9IEg3H 4DJne30gVHnVQOYJubMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCmpx-0004n7-F9; Sat, 16 Jul 2022 18:48:21 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oCmpa-0004Z5-Ni for linux-arm-kernel@lists.infradead.org; Sat, 16 Jul 2022 18:48:00 +0000 Received: by mail-wr1-x42d.google.com with SMTP id z12so11150755wrq.7 for ; Sat, 16 Jul 2022 11:47:58 -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=qbVbSB2V7fahimrZ1Z8x+RhdfTcaVEKX5BHhKsTvlNKRUOEHV4OCPssP+OlTpg+Sea CoVGyybzYZAh0tct0k7DokF4BZ1kSE0O00QD6BYRZKEW8r20URe3htj/9nsucq9YEZBG VIsnf4QqrPFdoUhthRPrVs/kUOqNtQEpUTPamB6PWy0rswI4gkt0DHEmStjBoY5ZZCzd 5CqgVa3dU/o+mBgns7OIzIYwTgRZCAuYEwJjzYEBVWUVg3EcWGF+2sspbKZ5CHZXvE/D 64R7n1g9siKfEXImj1MF14CwmJ37bk5Ic0OXztZNU580BPBC/XSXu49UL8Tnu8SkOSnr Rklg== 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=ktwWg8UFVS6frxqeCJLKJRSZvHB3jOhreZevFrWC+kFMUuxJcXKis7wn39tKeeY7BR umQiaduQkZdUeK5QVCjnkaP69VK3mIM710mz26vIEYU2V0gRudLAdEMGmVNE0lnDLqKn mLSQeqPZ3hV3S+6li9Z7F3L/oB66A64ii98DAKBD8CkjJgIFTFlskJlBa9cu95Yvg35l eHwjQGpoOFKpiU+4GbnKzqNqApcLlvpkVhcdAGzmnurSWZLDaoDCJdS3DlI0oTdvCb+p BAXhXV3kDhjnSYPUJ5Y+HMdqJDtcedtt68XG16Gf6XFzyf+dETlzYQ81+Ru5VSh5Fqpc Ubsg== X-Gm-Message-State: AJIora/hiepmgcPSZlqI77hnmKEfJUjIA2FuQeZhjFDPIunqzSnjACyP vcnCtzVfQ+KNUHmImKUr/eQ= X-Google-Smtp-Source: AGRyM1tIw848TqIGMUpVV7CE6ipw6t3CMPmAb9mlv9DdQVSmKhlbaBnhY6KRtegb3K/BH3ykAUB50g== X-Received: by 2002:adf:f345:0:b0:21d:6927:ec8f with SMTP id e5-20020adff345000000b0021d6927ec8fmr17286090wrp.490.1657997276776; Sat, 16 Jul 2022 11:47:56 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id u18-20020a05600c19d200b003973c54bd69sm13649961wmq.1.2022.07.16.11.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 11:47:56 -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 v2 2/5] net: ethernet: stmicro: stmmac: first disable all queues in release Date: Sat, 16 Jul 2022 20:45:30 +0200 Message-Id: <20220716184533.2962-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220716184533.2962-1-ansuelsmth@gmail.com> References: <20220716184533.2962-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_114758_791340_7F353841 X-CRM114-Status: GOOD ( 14.12 ) 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);