From patchwork Tue Jul 19 01:32:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12921976 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 10F6CCCA485 for ; Tue, 19 Jul 2022 01:51:06 +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=OvgIy4N5hDP+9y bnPxPjLs0mGpCahwXZz4IsmBmXH7uxSb/hH5oBOq+eIF+N55tC1T0i0UAAhVDQoIpqDaR2UUZRPkm d0F7mPwWKiMtgvJolKLRvjDNb09iOuaePQ390OaeA7HOy+AUTLZw6mwMHZZEDfRh/qBpuRfdFU4mh SxLIzhzVmwHIlytYJeC6uRm7y6hiEXFGCyrc0Vuqq+XxfxAls5rqUTYc345H79sjG6qtz04AZ1RMH zXU7yvQ9PGPyHSn1qFKE4lHmdHNA4HWHgf5hEg6ys9TM+QCh4h34ohD4nl4JYUHgy+M1H3/WTl2gt 6U45ZaNq4vYi1G6ye7TA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDcMz-003gMj-8p; Tue, 19 Jul 2022 01:49:53 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDcMg-003gGp-5O for linux-arm-kernel@lists.infradead.org; Tue, 19 Jul 2022 01:49:35 +0000 Received: by mail-wm1-x336.google.com with SMTP id v67-20020a1cac46000000b003a1888b9d36so11008059wme.0 for ; Mon, 18 Jul 2022 18:49:33 -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=NtpRkIjh4Bv37C970xdAVWthPTrnmEQdyeT0ewXV1A6lqhFkPcNO+5MKYUefXEfip/ Z4kOZTMSZth5cO6KoeWvSMI/DKggvO/X2cj6ljs8DTle6dZ6eB74+k7ucfBHtFZFQ6Nt AKTD3l/8jIrhDeHSscaJxc3kW1uBVNOzRm1eU2Y8+WnGbzbKmMjlip5ajtlVGr3Lr/Ft Yt0MGalcSuQP6bx3ZF02e2zToXzh6jfbd31tV0gk8+8skJQTq3hAT1/1sVZZ30mhrHWn /BEFoLD7lamYXtuLTkNF+BiDBgFxcGUGeNyLPlsavs8TDhonuuTvYty/kmhqLu6yh0u0 PB8w== 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=sbxBBbDxwNkS397o5jgV7hdgL6oajskWtqpfugWJ4oXtJBfeUDLU/zISriaFXhyv03 qpvXHcgP3SCGOt+jPz+/klMbdUm7KLMIVRLLCtGZsnCHzpw/LJZ9Bvs4fe79zlsiPdiO dXOkJYKAfC+YjZ8m1un7S2lyUtFTi3Tzbl7MWTS049GziggGd/LDf6K+HuCqci8iabuH ZKIeShjyAXLQ9rj1q/PLjmvS1+lPTFG5ZRJtlh9aMQ6h0Y7vMNE1CFx8h2OMsgGcwLzy HPY3B5G6RBQfIAhIKlJZUvHJhWd03TE2hWGxt7BVgjetvcFOqoxVilj+HX1r5B9g54DD 081w== X-Gm-Message-State: AJIora/nMG1CGf0Bhu2A2RzaA8mdX52F2DG7MMm0RNlIx/nZ7kWjoBY2 exiyKfnsmlDC8Yr/ij344fQ= X-Google-Smtp-Source: AGRyM1uFusY3dtICtBSOeVqJQdNbnOtjEtjon/nrmPJkBA+X+LnTpmvBYjkGQrIU6MLFLmVgr5zd+A== X-Received: by 2002:a7b:cb03:0:b0:39e:e826:ce6d with SMTP id u3-20020a7bcb03000000b0039ee826ce6dmr34636738wmj.102.1658195372239; Mon, 18 Jul 2022 18:49:32 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id v10-20020a05600c428a00b003a2fc754313sm16193600wmc.10.2022.07.18.18.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jul 2022 18:49:31 -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 v4 2/5] net: ethernet: stmicro: stmmac: first disable all queues and disconnect in release Date: Tue, 19 Jul 2022 03:32:16 +0200 Message-Id: <20220719013219.11843-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220719013219.11843-1-ansuelsmth@gmail.com> References: <20220719013219.11843-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220718_184934_217658_59864EC2 X-CRM114-Status: GOOD ( 14.38 ) 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);