From patchwork Sat Jul 23 14:29: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: 12927212 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 64617C43334 for ; Sat, 23 Jul 2022 14:31: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=bKv9FY0fCfIhk6O72TTKdHISsRE9Z8+k/iK2tOgQ/Y0=; b=WOVC3ys7z5jNHq DAkJSlu8aDWmThfFQmJKoqddcCv+KAby4TMumdUuS9k8/vhL/hrPt/ZtwVK/FbM/nqoksbs75l0JE c16sLUiBEdoV6kNEqXAA5KnjlPeMIRbc4Xpe8l5gxF1o7c5ORUCLN/KA6uFITgQ/6NKt+RCL78v+k vXWmNFMUgdCi9uhFKSapWH7GZfR1OC6gUjJ6XMk63qk1/2zEdI5oD0OVIFv/vB3CnYGNqyR23rJ7M GzoyVLBECoYTz4tMFx4m6LcJ16Ca2LCBykjpfr3jeEBj5WZpKJ+qHmgV3HtLevyeBFxktYU2HFykf yz8nA88JJDTVEGhfYHPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oFG91-0046Fr-2c; Sat, 23 Jul 2022 14:30:15 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oFG8g-0045wf-Cf for linux-arm-kernel@lists.infradead.org; Sat, 23 Jul 2022 14:29:55 +0000 Received: by mail-wm1-x334.google.com with SMTP id ay11-20020a05600c1e0b00b003a3013da120so6736103wmb.5 for ; Sat, 23 Jul 2022 07:29:52 -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=rjiJgm+ePUWk4K7ivlZ0MC/qqioPkcS003xuwMGC70A=; b=ixXDJxh8BydzdrlUp+5pUGg9ENcZKGe2KUprYBMZl2POERKwenf+RWBmrRBU+7gIcN WLWnVORyug8+zftCXTTwjU3z1OijT1bJouuZZdo5g7Fb0hODAOPGAGpTxMaDBaWsxVJ9 16SW4wUw0BASYukDBptpq07R+d/cHE1fTmUQAvANxHcpukXeTR70lz6lszlDXXtO9Iin woCuS7iso2EZKipkiL+zFeYXghQKpbDUGN7/bazdWzTs/f3xUL2eVmfC+MhZQf3B2bC5 XEU6Ofz4Rublo81gGXPxVRKSeWRMrdPO29YVc7RKI3JucyaKK3NWdj7RwR6J03iX3+ZV EKTw== 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=rjiJgm+ePUWk4K7ivlZ0MC/qqioPkcS003xuwMGC70A=; b=2M09YH9ayrHPjX721dCXIMChrFQ2D7UyAWqWqzy2UZdgAwpsbuqT1IonaCeOSH1oB+ LMDwRdWCTkkY2ysVB4APH49ZwXOkLSRNVumYNpfBABFEigOtFRnmQZlLXVKBkl5SeFts GQ1ztP/x/iPVOsfFp6HJNt33HwWtztxCx3KNBlNSmx/32XbYH5LkGjxqUnF5trbaO/8J BJiKr0MBBAn2ZAXIFGEXXKYLQKtuk/Fr2ghn1RwyGi3DAFZKifYq4Mbz+whZG2YEQsSJ Dz/UArTqqKsW+M/TE9mMXRlRQOincGBDpyOsuTzCjdKR/TjHAjBx2vhdgynW6AQS53GV YBqg== X-Gm-Message-State: AJIora+eujbiX2tPcoJmQSESqg3fi72p6YzzHNiyTm4ocK4I6hZgYnbG KE/cJLr6MKqRlAZpsVLlH58= X-Google-Smtp-Source: AGRyM1vVaFgb3GqjCNsvMbzlaBRd98PPg1L/7OqXzOm1rUViGRihb4msdECZSlhE1Jheg38qChktQg== X-Received: by 2002:a05:600c:4f49:b0:3a3:2717:27fc with SMTP id m9-20020a05600c4f4900b003a3271727fcmr15822873wmq.36.1658586590737; Sat, 23 Jul 2022 07:29:50 -0700 (PDT) Received: from localhost.localdomain (host-87-7-207-127.retail.telecomitalia.it. [87.7.207.127]) by smtp.googlemail.com with ESMTPSA id q6-20020a1cf306000000b0039c5ab7167dsm11689717wmq.48.2022.07.23.07.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jul 2022 07:29:50 -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 v5 2/5] net: ethernet: stmicro: stmmac: first disable all queues and disconnect in release Date: Sat, 23 Jul 2022 16:29:30 +0200 Message-Id: <20220723142933.16030-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220723142933.16030-1-ansuelsmth@gmail.com> References: <20220723142933.16030-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220723_072954_454168_4511FBCB X-CRM114-Status: GOOD ( 13.94 ) 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 and disconnect 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5578abb14949..96e55dadcfba 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3758,8 +3758,6 @@ static int stmmac_release(struct net_device *dev) struct stmmac_priv *priv = netdev_priv(dev); u32 chan; - netif_tx_disable(dev); - if (device_may_wakeup(priv->device)) phylink_speed_down(priv->phylink, false); /* Stop and disconnect the PHY */ @@ -3771,6 +3769,8 @@ static int stmmac_release(struct net_device *dev) for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) hrtimer_cancel(&priv->tx_queue[chan].txtimer); + netif_tx_disable(dev); + /* Free the IRQ lines */ stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0);