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 A935EC433F5 for ; Fri, 26 Nov 2021 15:53:21 +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: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:In-Reply-To:References: List-Owner; bh=MeMxbXtDsFedhsisYDv3b/vPxgdMXoWfH1+zKOns9gM=; b=Yyf9VbJi/pERzO NiheP9JAFBIwyNdAg5vj/T6kpyQWJYqfnY7RGdjdL6TRnOkCPMQSItxyFq/nwRwBXbyd2Wi0VDbEI vQ/GsiZQqPqHpuUPdnok5H9zy25qNhKcOt/ylxsTa/HpMV5AzYlb7loXrcszLiwHji8wDk7gjZt3Z vWBhJtB7JXmk/ZBFKXw1CpcN/Md6/jIlwydfhfqxb3MQVyIuA4TDvI5ScWmI82PN6dlmvjxtz+9IQ bKo0K7L52eKGShFSI13KnUUE4S1VH193KkZ6lmU7S5+w5yMtWCeBKj3DB4IvZ5CAfVfwXQ4kF2McU jk8AV1s1E8qqWIkQQYlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqdVv-00B1yq-Ph; Fri, 26 Nov 2021 15:51:51 +0000 Received: from smtp2.axis.com ([195.60.68.18]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqdVr-00B1wa-AO for linux-arm-kernel@lists.infradead.org; Fri, 26 Nov 2021 15:51:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1637941907; x=1669477907; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZKY0ZUn6hBuF4L45SUjR2Of2kdJCM0Bs6BEONxhZqMk=; b=gErZn43QMIYJc4pAlty4lgvjFCBKzuDIeVTglN+i19T4QZI56tUKBRyq SRw43wlD8TfzbhbROfs+uW/yNWOwDBnIDos7E0XkcV2DbBJd2pvM/wPA/ uMKPET1BuKV+eVa9q/Om429zFBDf3yRkFnC6knujnPDI4iCxouemcjtPY ssuK4FRQG8Uuy4CDwVd/7dpMY8liz9uUBQUH4wnQTUBxi112z2r57cUjX Cvd4QE2poO9vFswhw3E5THmvUCDrVPd6neNGrDkHZ0YydaRog/nlIm8Us HRBkfk4sMQWl4NLHoyhWNEdzKGzZaBOOOKV0G82lQTAreXLfZ3vHoyTzj w==; From: Vincent Whitchurch To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Maxime Coquelin CC: , Vincent Whitchurch , Jose Abreu , , , , Subject: [PATCH net] net: stmmac: Avoid DMA_CHAN_CONTROL write if no Split Header support Date: Fri, 26 Nov 2021 16:51:15 +0100 Message-ID: <20211126155115.12394-1-vincent.whitchurch@axis.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211126_075147_851929_6B430D74 X-CRM114-Status: GOOD ( 15.26 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver assumes that split headers can be enabled/disabled without stopping/starting the device, so it writes DMA_CHAN_CONTROL from stmmac_set_features(). However, on my system (IP v5.10a without Split Header support), simply writing DMA_CHAN_CONTROL when DMA is running (for example, with the commands below) leads to a TX watchdog timeout. host$ socat TCP-LISTEN:1024,fork,reuseaddr - & device$ ethtool -K eth0 tso off device$ ethtool -K eth0 tso on device$ dd if=/dev/zero bs=1M count=10 | socat - TCP4:host:1024 Note that since my IP is configured without Split Header support, the driver always just reads and writes the same value to the DMA_CHAN_CONTROL register. I don't have access to any platforms with Split Header support so I don't know if these writes to the DMA_CHAN_CONTROL while DMA is running actually work properly on such systems. I could not find anything in the databook that says that DMA_CHAN_CONTROL should not be written when the DMA is running. But on systems without Split Header support, there is in any case no need to call enable_sph() in stmmac_set_features() at all since SPH can never be toggled, so we can avoid the watchdog timeout there by skipping this call. Fixes: 8c6fc097a2f4acf ("net: stmmac: gmac4+: Add Split Header support") Signed-off-by: Vincent Whitchurch --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 2eb284576336..0ee513f67677 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5504,8 +5504,6 @@ static int stmmac_set_features(struct net_device *netdev, netdev_features_t features) { struct stmmac_priv *priv = netdev_priv(netdev); - bool sph_en; - u32 chan; /* Keep the COE Type in case of csum is supporting */ if (features & NETIF_F_RXCSUM) @@ -5517,10 +5515,13 @@ static int stmmac_set_features(struct net_device *netdev, */ stmmac_rx_ipc(priv, priv->hw); - sph_en = (priv->hw->rx_csum > 0) && priv->sph; + if (priv->sph_cap) { + bool sph_en = (priv->hw->rx_csum > 0) && priv->sph; + u32 chan; - for (chan = 0; chan < priv->plat->rx_queues_to_use; chan++) - stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan); + for (chan = 0; chan < priv->plat->rx_queues_to_use; chan++) + stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan); + } return 0; } -- 2.33.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel