From patchwork Mon Feb 8 14:03:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F22BC433E6 for ; Mon, 8 Feb 2021 14:05:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A30464E24 for ; Mon, 8 Feb 2021 14:05:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A30464E24 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EyAAQQeAbRY0cYIwpWpiSGQtbAxfrDDfTtyNIfQ1kMo=; b=cj/PjepbBjFOfzzCc143R9VT6 XWycevsVL9zymnO/+L//jn7nsekF1Ue33CW9mmOtkoy/Cc258p+4OHZOyrAmJBdstdCRCUyEMkrJd 7Q4ry3Hj6UqAOJVrlXinwab8h3xSYRwxJ6DvCEX+q0SIOh8TOqBlEqIOduTMZHnoVRUbS8dxmSEy9 cROP3a8NmvZHjSC461AzSsYSNMKq5B0Uu5jhtJQdN2Qt+H8bli0FE0Nj2T4zYnniBnMyQgJ4d+D6k yCOHk7LDhYhygSyJSO3mZI6Vtw+8c0nmLTT71tApxySKTp4tc6Q977H/hnDTvEYdcb3uo6Cv+GbmI UZMLa+vSA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978n-00034S-1U; Mon, 08 Feb 2021 14:03:49 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978k-00032y-Bo for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:47 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King Subject: [PATCH 01/20] net: phy: realtek: Fix events detection failure in LPI mode Date: Mon, 8 Feb 2021 17:03:22 +0300 Message-ID: <20210208140341.9271-2-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090346_755449_E8F8ECA9 X-CRM114-Status: GOOD ( 17.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It has been noticed that RTL8211E PHY stops detecting and reporting events when EEE is successfully advertised and RXC stopping in LPI is enabled. The freeze happens right after 3.0.10 bit (PC1R "Clock Stop Enable" register) is set. At the same time LED2 stops blinking as if EEE mode has been disabled. Notably the network traffic still flows through the PHY with no obvious problem. Anyway if any MDIO read procedure is performed after the "RXC stop in LPI" mode is enabled PHY gets to be unfrozen, LED2 starts blinking and PHY interrupts happens again. The problem has been noticed on RTL8211E PHY working together with DW GMAC 3.73a MAC and reporting its event via a dedicated IRQ signal. (Obviously the problem has been unnoticed in the polling mode, since it gets naturally fixed by the periodic MDIO read procedure from the PHY status register - BMSR.) In order to fix that problem we suggest to locally re-implement the MMD write method for RTL8211E PHY and perform a dummy read right after the PC1R register is accessed to enable the RXC stopping in LPI mode. Signed-off-by: Serge Semin Reviewed-by: Andrew Lunn --- drivers/net/phy/realtek.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 99ecd6c4c15a..cbb86c257aae 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -559,6 +559,42 @@ static int rtl822x_write_mmd(struct phy_device *phydev, int devnum, u16 regnum, return ret; } +static int rtl8211e_write_mmd(struct phy_device *phydev, int devnum, u16 regnum, + u16 val) +{ + int ret; + + /* Write to the MMD registers by using the standard control/data pair. + * The only difference is that we need to perform a dummy read after + * the PC1R.CLKSTOP_EN bit is set. It's required to workaround an issue + * of a partial core freeze so LED2 stops blinking in EEE mode, PHY + * stops detecting the link change and raising IRQs until any read from + * its registers performed. That happens only if and right after the PHY + * is enabled to stop RXC in LPI mode. + */ + ret = __phy_write(phydev, MII_MMD_CTRL, devnum); + if (ret) + return ret; + + ret = __phy_write(phydev, MII_MMD_DATA, regnum); + if (ret) + return ret; + + ret = __phy_write(phydev, MII_MMD_CTRL, devnum | MII_MMD_CTRL_NOINCR); + if (ret) + return ret; + + ret = __phy_write(phydev, MII_MMD_DATA, val); + if (ret) + return ret; + + if (devnum == MDIO_MMD_PCS && regnum == MDIO_CTRL1 && + val & MDIO_PCS_CTRL1_CLKSTOP_EN) + ret = __phy_read(phydev, MII_MMD_DATA); + + return ret < 0 ? ret : 0; +} + static int rtl822x_get_features(struct phy_device *phydev) { int val; @@ -725,6 +761,7 @@ static struct phy_driver realtek_drvs[] = { .resume = genphy_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, + .write_mmd = rtl8211e_write_mmd, }, { PHY_ID_MATCH_EXACT(0x001cc916), .name = "RTL8211F Gigabit Ethernet", From patchwork Mon Feb 8 14:03:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075525 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AB26C433E0 for ; Mon, 8 Feb 2021 14:05:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E013064E7C for ; Mon, 8 Feb 2021 14:05:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E013064E7C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lufq0msa4yAYQHZDc7RIvx9TnZhQNsqthGxUVyeuN3w=; b=xJ/Pkz7WdiMIka9TGKYgQ/snJ mpWhVs+LYO5yKzIY+jq0QI4WWB6yBuKMdECHYaATGrHEncLNx3Oobi/LgA9EnHeH+zTmidyETpC6l VzPISqiyzIyglOU1nbRmLkJmDr59FPzvHe0PqNsAYf5sTd/5CfO0jcbwAick4f2jwxVHx6lRmZpjv M2cuABsg7XSfLVye6eizPul1iMZ0rvcLjeDhLbS360xp65lHLpo6kGXAKr92fmh9pMSDNf50qCHIH p4cEjgB/GajnReFGO6hBUCPR98+JAZ3Bq14c3I7YF9JBtpV0DOs9wR6a48AUwwzA5NeAl/nm1yNmN Q2+vJembg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978s-00036b-TK; Mon, 08 Feb 2021 14:03:54 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978k-000332-TU for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:50 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 02/20] net: stmmac: Free Rx descs on Tx allocation failure Date: Mon, 8 Feb 2021 17:03:23 +0300 Message-ID: <20210208140341.9271-3-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090347_472926_4D304115 X-CRM114-Status: GOOD ( 10.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Indeed in accordance with the alloc_dma_desc_resources() method logic the Rx descriptors will be left allocated if Tx descriptors allocation fails. Fix it by calling the free_dma_rx_desc_resources() in case if the alloc_dma_tx_desc_resources() method returns non-zero value. While at it refactor the method a bit. Just move the Rx descriptors allocation method invocation out of the local variables declaration block and discard a pointless comment from there. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 03acf14d76de..5ee840525824 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1791,13 +1791,15 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv) */ static int alloc_dma_desc_resources(struct stmmac_priv *priv) { - /* RX Allocation */ - int ret = alloc_dma_rx_desc_resources(priv); + int ret; + ret = alloc_dma_rx_desc_resources(priv); if (ret) return ret; ret = alloc_dma_tx_desc_resources(priv); + if (ret) + free_dma_rx_desc_resources(priv); return ret; } From patchwork Mon Feb 8 14:03:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075529 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0E56C433E0 for ; Mon, 8 Feb 2021 14:05:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4CA4A64E85 for ; Mon, 8 Feb 2021 14:05:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CA4A64E85 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/vjVFip5cBCDTVMXys9lGVMjQJJVNHC5xKMsJgcvceQ=; b=gou9k15Jd+h0ssqywYQmdIHJq /mUjR/ZSVDIbK2XHNgtgynlE1owZBByZkzidsYDJMQNib6d3fnN2UF0vi0iv8AT5QkbYJ1aTPlSna 1YxuxEoC2oBkcuyL/sAl76N8g0QTA2ae1rtYOOLGWhTu75u6J6BgfAdIysUxfwc7LhJ55Im4oS+y9 /fPpJeTu56p2o0Iv+e6Ij2f34ACpOAzH1Ll5t/0H3uKCWQ1HYOWTQXFLIjj2uTEfZ5Sx3OTvAwqj4 53Lx9G96h9q5wpmygxgGF9KIeQQlAUZKVpY7gQ/oeul7tecNBwruphQxgR8CESPkiMUrD6FgS2i6g XINT82lUA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978z-0003AQ-ML; Mon, 08 Feb 2021 14:04:01 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978l-00033W-J9 for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:51 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 03/20] net: stmmac: Fix false MTL RX overflow handling for higher queues Date: Mon, 8 Feb 2021 17:03:24 +0300 Message-ID: <20210208140341.9271-4-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090347_813555_492E525A X-CRM114-Status: GOOD ( 14.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Judging by the MAC/MTL-related part of the ISR implementation if MTL IRQs status handler returns MTL Rx overflow bit set, the stmmac_set_rx_tail_ptr() method will be called for all subsequent queues. That most likely isn't what we want. Fix it by just overriding the status variable on each loop iteration. Note we can freely break the loop at the very beginning if the stmmac_host_mtl_irq_status() method returns -EINVAL, because that error means the MTL IRQ status handler isn't available for the detected hardware. Fixes: 7bac4e1ec3ca ("net: stmmac: stmmac interrupt treatment prepared for multiple queues") Signed-off-by: Serge Semin --- Folks, I haven't seen an effect of that bug. The patch has been created purely based on the code visual perception. If you think the handler is supposed to work like that and I am missing something (though I have much doubt about that), just drop this patch. --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 5ee840525824..d45af1ea2565 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4149,7 +4149,6 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) /* To handle GMAC own interrupts */ if ((priv->plat->has_gmac) || xmac) { int status = stmmac_host_irq_status(priv, priv->hw, &priv->xstats); - int mtl_status; if (unlikely(status)) { /* For LPI we need to save the tx status */ @@ -4162,10 +4161,10 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) for (queue = 0; queue < queues_count; queue++) { struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; - mtl_status = stmmac_host_mtl_irq_status(priv, priv->hw, - queue); - if (mtl_status != -EINVAL) - status |= mtl_status; + status = stmmac_host_mtl_irq_status(priv, priv->hw, + queue); + if (status == -EINVAL) + break; if (status & CORE_IRQ_MTL_RX_OVERFLOW) stmmac_set_rx_tail_ptr(priv, priv->ioaddr, From patchwork Mon Feb 8 14:03:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BFB2C433E6 for ; Mon, 8 Feb 2021 14:05:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C00264E24 for ; Mon, 8 Feb 2021 14:05:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C00264E24 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hTmLit9o4KIo+f1yTVYcYLSBkhE2DhD90d2TqYR7WZc=; b=J7wNMrHW03WD5za/5QQ/QOZ3n ixqazYlBLiPb3bKD3RVY9+2hlRY7fsG3B2/1eZ+TupAwpA69O3D7z4PD9cuWY4o/c/rM3sUMOD/U0 o/HivbFCxIzRMVYYvn4lq0n6O7QvUJ/LkIZ2bpBclbkLHx3KYIWxmUuEXUptWvDaCuy8c3jssG5Y2 1i739Sl+5sp2uTj/KCwf3XaLpakuwTzcEmmwfIBFFS7Vwun7Bv7ecwEFmnsRrrK3k2G6KTzlbhHYf DWBBAGIrK5IcE1HWEJhcV1bAskSKkwGih/0uMtHH4Usdfp9rHofiwGiU+26rR/58kLH1viAPkDzvN KQ6954QIA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l979A-0003D2-Bf; Mon, 08 Feb 2021 14:04:12 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978m-00034B-95 for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:51 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 04/20] net: stmmac: Assert reset control after MDIO de-registration Date: Mon, 8 Feb 2021 17:03:25 +0300 Message-ID: <20210208140341.9271-5-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090348_481662_14AC56BE X-CRM114-Status: GOOD ( 11.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Indeed it's unlikely but MDIO de-registration may still require an access to the core registers, which obviously won't be possible in case if the interface has been put into the reset state. So move the reset control assertion to be executed after the MDIO bus is de-registered. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index d45af1ea2565..1c40dc26fbf7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5159,10 +5159,10 @@ int stmmac_dvr_remove(struct device *dev) stmmac_exit_fs(ndev); #endif phylink_destroy(priv->phylink); - reset_control_assert(priv->plat->stmmac_rst); if (priv->hw->pcs != STMMAC_PCS_TBI && priv->hw->pcs != STMMAC_PCS_RTBI) stmmac_mdio_unregister(ndev); + reset_control_assert(priv->plat->stmmac_rst); destroy_workqueue(priv->wq); mutex_destroy(&priv->lock); From patchwork Mon Feb 8 14:03:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8425AC433E0 for ; Mon, 8 Feb 2021 14:05:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4058064E84 for ; Mon, 8 Feb 2021 14:05:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4058064E84 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gvKEfbrRfI7rXeWN+tGtlA7TT7tf8QldomyXM6Mbm+4=; b=syCajnH4pvVuNBNhA2eKW/2ZX Dc0yALgoH+PcjpyMuGBZSYdR2RXNR0ENHdOfSrMFFy3L2xwlyichboV8SIK14JMU//sNGcOOwhGnL R7K6vtek3keHi7fWkiJWA/K6Ey48BCwVueBvX4N3AlKlKOfVSFL3Gok1GYkTbtXYeTtbi3YezrxrK lc2AViCaMUke7H0ilYxXVBjL+fu1v8UsQdRODWzqd+n7vS7iz4+K6Uxp0NgCSM8wx6MXXSG6Thwux ZjWfXF3iMHYuqjSHUGTML4i/5f3tvSPiOgACxO2FHcftMmwnlCk7oVJNfnoux7WlzxpEO/8k+fTnH gSdmQjNUg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l979L-0003GV-BA; Mon, 08 Feb 2021 14:04:23 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978m-00034T-Vl for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:53 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 05/20] net: stmmac: Use dwmac410_disable_dma_irq for DW MAC v4.10 DMA Date: Mon, 8 Feb 2021 17:03:26 +0300 Message-ID: <20210208140341.9271-6-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090349_213816_0FA11CD5 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From the very beginning of the DW GMAC v4.10 IP support the driver has used an invalid DMA IRQ disable method to switch the DMA IRQs off. Since commit 021bd5e36970 ("net: stmmac: Let TX and RX interrupts be independently enabled/disabled") a valid method has been added to the dwmac4_lib.c module, but the commit author forgot to initialize the corresponding field of the DW MAC DMA operations descriptor with it. That mistake hasn't caused any problem so far just because the RIE/TIE fields match in both 4.x and 4.10 IPs. Anyway fix the inconsistency in order to at least have a coherent driver code. Fixes: 021bd5e36970 ("net: stmmac: Let TX and RX interrupts be independently enabled/disabled") Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c index bb29bfcd62c3..59da9ff36a43 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c @@ -531,7 +531,7 @@ const struct stmmac_dma_ops dwmac410_dma_ops = { .dma_rx_mode = dwmac4_dma_rx_chan_op_mode, .dma_tx_mode = dwmac4_dma_tx_chan_op_mode, .enable_dma_irq = dwmac410_enable_dma_irq, - .disable_dma_irq = dwmac4_disable_dma_irq, + .disable_dma_irq = dwmac410_disable_dma_irq, .start_tx = dwmac4_dma_start_tx, .stop_tx = dwmac4_dma_stop_tx, .start_rx = dwmac4_dma_start_rx, From patchwork Mon Feb 8 14:03:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A06DAC433E0 for ; Mon, 8 Feb 2021 14:06:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5293064E24 for ; Mon, 8 Feb 2021 14:06:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5293064E24 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ewudhoxi0p80coc8W0vMRB9eqPAOI0Qa1mvzUGYA3F4=; b=lQGna47NplsCi4uzYr00YZYXF sZ4FRUQ9ck5w9ctBtAikKQpex4P5Lo6gDC58XLfDoWLlynAk6YafJKmxk3JFRtYmvGZxjbDi3LfkJ CVkTwdcvtUDhCOcGRgSG1qfV8g21ggtw0fqGbwj8+VO8PeHZBAW7OVCKcBRaglM5SoeHTLMuPeYTa piBMTlPsJq1HUzQhZrnoww9BItKh6I4O5O1ZuIfm0GLa12x0IpKPt71EVVavNggV3tS3nXcHKPPwZ ucBL3MHbknh1wholEnWUh5Hr2UkobLdz1La1E/7LwfveNVzGFBX74pp9++Rdu319No+YeC45S1TcL KWMLluPDQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l979O-0003Hs-Lq; Mon, 08 Feb 2021 14:04:26 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978n-00034r-JR for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:53 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 06/20] net: stmmac: Use LPI IRQ status-related macro in DW MAC1000 isr Date: Mon, 8 Feb 2021 17:03:27 +0300 Message-ID: <20210208140341.9271-7-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090349_832465_35828E86 X-CRM114-Status: GOOD ( 12.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For some reason the DW MAC1000-specific IRQ status handler has been using the GMAC_INT_DISABLE_PMT macro to test whether the PMT IRQ is pending in the MAC status register while there is a dedicated macro GMAC_INT_STATUS_PMT exists for the corresponding field to test. It didn't cause any error because the bits position match in both DW MAC IRQ mask and status registers, but semantically the code still doesn't look correct. Let's fix that by using the correct macro there. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c index fc8759f146c7..6b9a4f54b93c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c @@ -321,7 +321,7 @@ static int dwmac1000_irq_status(struct mac_device_info *hw, x->mmc_rx_irq_n++; if (unlikely(intr_status & GMAC_INT_STATUS_MMCCSUM)) x->mmc_rx_csum_offload_irq_n++; - if (unlikely(intr_status & GMAC_INT_DISABLE_PMT)) { + if (unlikely(intr_status & GMAC_INT_STATUS_PMT)) { /* clear the PMT bits 5 and 6 by reading the PMT status reg */ readl(ioaddr + GMAC_PMT); x->irq_receive_pmt_irq_n++; From patchwork Mon Feb 8 14:03:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82DDBC433DB for ; Mon, 8 Feb 2021 14:07:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EEEB664D9F for ; Mon, 8 Feb 2021 14:07:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEEB664D9F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=52MwyBGsDb+1gIYVLnX6LpdaXDHoP1dT0TekMKPMT1w=; b=eVf5+eOsD/1v1ApCGzloCyPqk a5Cq4l5P5r8Wf4WWcbM02l+ELKbnVyeDWu1WLAKCZ2vjBIaHRm+kwyeaB0eSWvdXT+MO2OUdXZ4/a e4cF74ccc7vJ01kyCeq2Xu/avQNgzVjo3xQ+eb21cfcPVZrKxB8xtGJ9UmbSMTYbJO8DwPWPQkITn pY08EB80o4HtKDIx7S69DFC/KTR1odKnyvDFaosQT1Pii9ysx169jWv7Ufe7g5RdQt7xnyDCHtt0P zng9eYb/o/xs3WNl2NX5XwjXg3qziw8o/pzKQN4A3vSv7XCeqSzrw/C9BzTzCkkXCXuZ8RFp5JtJU CBbMPc/FA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l979q-0003Ti-CS; Mon, 08 Feb 2021 14:04:54 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978p-00035S-7s for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:56 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 07/20] net: stmmac: Clear descriptors before initializing them Date: Mon, 8 Feb 2021 17:03:28 +0300 Message-ID: <20210208140341.9271-8-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090351_616352_9C269805 X-CRM114-Status: UNSURE ( 9.43 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org According to the methods naming and partly based on their semantics the descriptors need to be cleared first, then they can be properly initialized. That specifically concerns the Tx descriptors and the chain mode. Moreover doing the Rx-descriptors clearance twice is redundant. Fix all of that by discarding the Rx descriptor clearance from the init_dma_rx_desc_rings() method and move the generic method of all descriptors clearance to the head of the init_dma_desc_rings() function. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 1c40dc26fbf7..3bc07f5b64e1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1399,8 +1399,6 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags) "(%s) dma_rx_phy=0x%08x\n", __func__, (u32)rx_q->dma_rx_phy); - stmmac_clear_rx_descriptors(priv, queue); - for (i = 0; i < priv->dma_rx_size; i++) { struct dma_desc *p; @@ -1522,14 +1520,14 @@ static int init_dma_desc_rings(struct net_device *dev, gfp_t flags) struct stmmac_priv *priv = netdev_priv(dev); int ret; + stmmac_clear_descriptors(priv); + ret = init_dma_rx_desc_rings(dev, flags); if (ret) return ret; ret = init_dma_tx_desc_rings(dev); - stmmac_clear_descriptors(priv); - if (netif_msg_hw(priv)) stmmac_display_rings(priv); From patchwork Mon Feb 8 14:03:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0D54C433DB for ; Mon, 8 Feb 2021 14:06:57 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2212A64E24 for ; Mon, 8 Feb 2021 14:06:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2212A64E24 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=33FZ5Ndhv0bPOOeYZhcGfZ7XEuGfeTmFyNmm5xzG0zM=; b=igeMoJgaHlKIW58Kxj76MCRAc gS4h2ZPYpqnpIk12OcPL005BJeoMFcsnsG5KXlgOxKCHfXXsvUWRVynNuSLpdnel1f3+1bNGVUB8R DiwlLajT+UOAdfZ8GLW57vEa3LQH//X1C9HoEsF9KqchMG0b9OU4GTWi5BGNO6slatrUw59bZYfxD gTwRztXgrTsKYIfb/KqXQgnqgv4rYOph1ykbsbKV+2eSfe1o96y9zlcpweXmZf62L6ENc434OTLag NGasZ6jQ43XmYlaDoUnMmvgetqLxWiAJU8WrLn9Yrl8aaFFSjtxDaWbhuIbmc10GzNFumMDtcaPtz U69bAERmw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l979U-0003K6-Vg; Mon, 08 Feb 2021 14:04:34 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978p-00035T-8G for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:55 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 08/20] net: stmmac: Fix typo in the XGMAC_L3_ADDR3 macro name Date: Mon, 8 Feb 2021 17:03:29 +0300 Message-ID: <20210208140341.9271-9-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090351_598526_0F20237C X-CRM114-Status: UNSURE ( 9.09 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The macro has been declared as XMGAC_L3_ADDR3 with obvious second and third chars confused. Revert them then. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index 6c3b8a950f58..2e6f60633128 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -191,7 +191,7 @@ #define XGMAC_L3_ADDR0 0x4 #define XGMAC_L3_ADDR1 0x5 #define XGMAC_L3_ADDR2 0x6 -#define XMGAC_L3_ADDR3 0x7 +#define XGMAC_L3_ADDR3 0x7 #define XGMAC_ARP_ADDR 0x00000c10 #define XGMAC_RSS_CTRL 0x00000c80 #define XGMAC_UDP4TE BIT(3) From patchwork Mon Feb 8 14:03:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2938CC433DB for ; Mon, 8 Feb 2021 14:07:20 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97C8564E2E for ; Mon, 8 Feb 2021 14:07:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97C8564E2E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ufLIg2XEyHAlCKshcl6gG1WTqNSJdQf8gta50wLS7Gc=; b=dejbFxO6t0j1PPnKo0AuY0Obf SzQiaga6c2gIFsNsXVhK/lpeOVeLDOqOB2Yd/FCoInXsoo8exopoXhIHcTNknCaFCRXNXa0E/jxdN hVfUQusENIXLM7rS1ttuoQwi/ElePaaIFihCA1fIEUvMzYnu4oCXal9fmCBw/vuDCVoaZP1ebC+6r HLkOu+fUv+WQ5aZLNG8hnNFLuwTTRCRYZRpLCuPoxWql7TxpmEZkC3wU8vGbc65gG2YZQt/xqoJHC hR4AOdcaaZsR4aAiRKjQtXJ+WWMamjxbwlfl8+ezKbOvy4e3bXVSZn6jWMzS94e9bVVNQc+m13ooE RmKZOuUHQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l979i-0003Qb-26; Mon, 08 Feb 2021 14:04:46 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978p-00035X-M4 for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:56 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 09/20] net: stmmac: Discard mii_irq array from private data Date: Mon, 8 Feb 2021 17:03:30 +0300 Message-ID: <20210208140341.9271-10-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090351_897517_50C751A7 X-CRM114-Status: UNSURE ( 8.37 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There has been no user of the denoted array of the device private data since commit e7f4dc3536a4 ("mdio: Move allocation of interrupts into core"). Discard it then. Signed-off-by: Serge Semin Reviewed-by: Andrew Lunn --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index e553b9a1f785..af02d369e641 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -185,7 +185,6 @@ struct stmmac_priv { unsigned int flow_ctrl; unsigned int pause; struct mii_bus *mii; - int mii_irq[PHY_MAX_ADDR]; struct phylink_config phylink_config; struct phylink *phylink; From patchwork Mon Feb 8 14:03:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45A5AC433E0 for ; Mon, 8 Feb 2021 14:07:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CFE5864D9F for ; Mon, 8 Feb 2021 14:07:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFE5864D9F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pSlrF0PVn6Uao5J+CtbK3PdJ6ooXcFoTShFiDfb7G9s=; b=QzRGzSEYvgphojlEo3AqpZpiC LtPIK9ci7cUE9yxQoEsS3Gubui/sfxRSACGhZiUeKHN90AB20nIWK8utbNs+TcgEvK+PNv4Cn+8np 4QAmn0Ys0ZRHsA7D9bG6+7HEyvyrefaWd9fUy6XJFKtK8crjr9dEYwmL3konIfcmvYvsnuUjxAunR cI0NEsFr+mZmmUN65GWGDaCa1K9NpcRnlapcOr5/TbMLbBXD+FOX51Vy7PDzBvuWC6pqx1IlhJg3S BFyclM/JUs4is0GlSCHEupeRjK1Dg5lrmHSS4k5tPYUn9SwvxYGpCqdC3nEedZo0+w8DNRVPl/vcd IT/PcOouQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97A2-0003XT-HX; Mon, 08 Feb 2021 14:05:06 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978q-00036M-Ia for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:57 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 10/20] net: stmmac: Discard Rx copybreak ethtool setting Date: Mon, 8 Feb 2021 17:03:31 +0300 Message-ID: <20210208140341.9271-11-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090352_980207_D9E63325 X-CRM114-Status: GOOD ( 12.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since commit 2af6106ae949 ("net: stmmac: Introducing support for Page Pool") the mapping and unmapping has been replaced with Pages Pool usage. The ethtool-tunable config like Rx copy-break is no longer used for SK-buffers setup. So the ethtool tunable callback since setting/getting the ETHTOOL_RX_COPYBREAK id doesn't really change anything. Just discard the ethtool tunable callback then together with the rx_copybreak private data field. The same concerns the "rx_zeroc_thresh" member of the device private data, but the main user has already been removed in commit 2af6106ae949 ("net: stmmac: Introducing support for Page Pool") and in commit d66e67bd4cc7 ("net: stmmac: Remove unused inline function stmmac_rx_threshold_count"). Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 - .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 39 ------------------- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 4 -- 3 files changed, 45 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index af02d369e641..e444b1b237c0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -79,7 +79,6 @@ struct stmmac_rx_queue { struct dma_desc *dma_rx ____cacheline_aligned_in_smp; unsigned int cur_rx; unsigned int dirty_rx; - u32 rx_zeroc_thresh; dma_addr_t dma_rx_phy; u32 rx_tail_addr; unsigned int state_saved; @@ -159,7 +158,6 @@ struct stmmac_priv { u32 sarc_type; unsigned int dma_buf_sz; - unsigned int rx_copybreak; u32 rx_riwt; int hwts_rx_en; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 9e54f953634b..0ed287edbc2d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -929,43 +929,6 @@ static int stmmac_get_ts_info(struct net_device *dev, return ethtool_op_get_ts_info(dev, info); } -static int stmmac_get_tunable(struct net_device *dev, - const struct ethtool_tunable *tuna, void *data) -{ - struct stmmac_priv *priv = netdev_priv(dev); - int ret = 0; - - switch (tuna->id) { - case ETHTOOL_RX_COPYBREAK: - *(u32 *)data = priv->rx_copybreak; - break; - default: - ret = -EINVAL; - break; - } - - return ret; -} - -static int stmmac_set_tunable(struct net_device *dev, - const struct ethtool_tunable *tuna, - const void *data) -{ - struct stmmac_priv *priv = netdev_priv(dev); - int ret = 0; - - switch (tuna->id) { - case ETHTOOL_RX_COPYBREAK: - priv->rx_copybreak = *(u32 *)data; - break; - default: - ret = -EINVAL; - break; - } - - return ret; -} - static const struct ethtool_ops stmmac_ethtool_ops = { .supported_coalesce_params = ETHTOOL_COALESCE_USECS | ETHTOOL_COALESCE_MAX_FRAMES, @@ -999,8 +962,6 @@ static const struct ethtool_ops stmmac_ethtool_ops = { .set_coalesce = stmmac_set_coalesce, .get_channels = stmmac_get_channels, .set_channels = stmmac_set_channels, - .get_tunable = stmmac_get_tunable, - .set_tunable = stmmac_set_tunable, .get_link_ksettings = stmmac_ethtool_get_link_ksettings, .set_link_ksettings = stmmac_ethtool_set_link_ksettings, }; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3bc07f5b64e1..8599ef6df52f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -84,8 +84,6 @@ static int buf_sz = DEFAULT_BUFSIZE; module_param(buf_sz, int, 0644); MODULE_PARM_DESC(buf_sz, "DMA buffer size"); -#define STMMAC_RX_COPYBREAK 256 - static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN | NETIF_MSG_TIMER); @@ -2831,8 +2829,6 @@ static int stmmac_open(struct net_device *dev) priv->dma_buf_sz = bfsize; buf_sz = bfsize; - priv->rx_copybreak = STMMAC_RX_COPYBREAK; - if (!priv->dma_tx_size) priv->dma_tx_size = DMA_DEFAULT_TX_SIZE; if (!priv->dma_rx_size) From patchwork Mon Feb 8 14:03:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3360FC433E6 for ; Mon, 8 Feb 2021 14:07:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C46D364E2E for ; Mon, 8 Feb 2021 14:07:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C46D364E2E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UAyKpaMw1dChkchiB0j4pC6pFOO3AXeWoTcCORiq6vc=; b=XsZrONkMcJesIMTanLIEyRqh6 rn4RTinLDqXFABV4CajcqF5QHsm/oNGn8QpNB6GMRVdskgjtlKYwqTOSO7m2C6yNTmHMvbCLsv2+H OENS2pGS4Y7irJOL4koADeiKgCwA/Idno61dyjMGyn/kgjluVeHyOP7WFBcKxcIIPk7Fa5fjEStS7 Otoq+jGeFlGmpL6Fd8XZeVZVX0llqQbbj1ifAFLxx9VNpxl7Fmr6/a288nm90GDOGmaJgKHBz+VbJ sIJA/NIgUA12wSoEaMDG4Qx9Gnj4lkSdP1wuKjTrBoiGOt1bD3UztOpS3IxfMBRgQ0IhZGYWaeieg T5GnS8YTA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97A8-0003dt-2e; Mon, 08 Feb 2021 14:05:12 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978r-00036X-Dn for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:58 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 11/20] net: stmmac: Discard index usage in the dirty_rx init Date: Mon, 8 Feb 2021 17:03:32 +0300 Message-ID: <20210208140341.9271-12-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090353_707189_E22178FF X-CRM114-Status: GOOD ( 10.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Indeed in accordance with the initialization loop logics the statement "(i - priv->dma_rx_size)" will always equal to zero. Just initialize the dirty_rx pointer with zero then. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8599ef6df52f..abe8db9965f4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1412,7 +1412,7 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags) } rx_q->cur_rx = 0; - rx_q->dirty_rx = (unsigned int)(i - priv->dma_rx_size); + rx_q->dirty_rx = 0; /* Setup the chained descriptor addresses */ if (priv->mode == STMMAC_CHAIN_MODE) { From patchwork Mon Feb 8 14:03:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85E62C433E0 for ; Mon, 8 Feb 2021 14:07:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 248BB64E2E for ; Mon, 8 Feb 2021 14:07:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 248BB64E2E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iuA7E9ra0zHyDR/0hqT/8hakOJ9yAYBG5WfyTzzMcD8=; b=oNE/QNk+VeV423SBxtHTJDvRZ OTr38kLs14YAvxS3uwWQkdp9ZucxSjYMw/e5MAbSbEXuobqLF0DE3EkHV8PK4a35hxLtzRIxbqUO9 kzgdVgWki6FFOVMil321cvw3ES6/XVuXIURv6JH8TJsr12ArX192Z6eOR+0cgkVS+LFtQEx+n5E/T O4PkEbzgAQijlEsAak963aNP+zpnuGW7Xpw9FfHqd6c+jcqya0ylj6q61bcVxUiYYvW19WczfOFdo n+Who9CH9dDu44efnSOqmocL3EDGWhRjvDYiN/vosDKTaL6oZ/PVVW3s6VehLzOQQlW6fuvG1QhUT 4WVHaaCGg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97AG-0003hj-5K; Mon, 08 Feb 2021 14:05:20 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978r-00034T-Oh for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:03:58 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 12/20] net: stmmac: Discard dwmac1000_dma_ops declaration from dwmac100.h Date: Mon, 8 Feb 2021 17:03:33 +0300 Message-ID: <20210208140341.9271-13-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090354_005334_BF63FE75 X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Indeed it's redundant to have that variable declaration in the dwmac1000.h header file since it's used in the hwif.c module only and declared in its header together with the rest of the ops descriptors. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h index b70d44ac0990..494e1d2f2971 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h @@ -329,5 +329,4 @@ enum rtc_control { #define GMAC_MMC_RX_CSUM_OFFLOAD 0x208 #define GMAC_EXTHASH_BASE 0x500 -extern const struct stmmac_dma_ops dwmac1000_dma_ops; #endif /* __DWMAC1000_H__ */ From patchwork Mon Feb 8 14:03:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E876CC433DB for ; Mon, 8 Feb 2021 14:09:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70B9364D9F for ; Mon, 8 Feb 2021 14:09:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70B9364D9F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lqZAo0D/7LqyW+dzwdY0CdoDI27s6kKW/rPGqrwHN0s=; b=O2FaoYkSjYMKyRoYVJ7PZ2teJ zP0LDsxHg9G24XuVoVF0xqZsIdNHQtl9bMG21uixRMOecmaHcUpZtEw4VuHc4zdjPB3elNPYGSvRN p2rhUKKr4yqdlfpiutlFcnCPZEFpoH5ydEUoPAUFUo9VoMd8W2vTAo7Vq1H4j09K1c5aIFWlzsdcb MYQnRAHr6FuxWjOdzE2mh1V/c7mTWqdEGA6A02pmv91btonOJIsS6vgWKzjw0ge8puzNDSA6PvVoY 7OTb/W5qOh4CKX3hNp9Xi7Qdp7x6xdTLz+X6SoVcZN3mN1PSIYQodo37M8+gKqFKVkF+yyP7TAxjw KIBTxx4eg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97BE-00049v-DO; Mon, 08 Feb 2021 14:06:24 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978s-00034r-NS for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:04:03 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 13/20] net: stmmac: Move DMA Tx/Rx init methods to DW MAC lib Date: Mon, 8 Feb 2021 17:03:34 +0300 Message-ID: <20210208140341.9271-14-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090355_541100_39E52994 X-CRM114-Status: GOOD ( 11.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These methods are identical for both DW MAC100 and DW MAC1000 cores, so their implementation can be moved to the common for the core library. Signed-off-by: Serge Semin --- .../ethernet/stmicro/stmmac/dwmac1000_dma.c | 20 ++----------------- .../ethernet/stmicro/stmmac/dwmac100_dma.c | 20 ++----------------- .../net/ethernet/stmicro/stmmac/dwmac_dma.h | 4 ++++ .../net/ethernet/stmicro/stmmac/dwmac_lib.c | 14 +++++++++++++ 4 files changed, 22 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c index 2bac49b49f73..2a04d9d45160 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c @@ -110,22 +110,6 @@ static void dwmac1000_dma_init(void __iomem *ioaddr, writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA); } -static void dwmac1000_dma_init_rx(void __iomem *ioaddr, - struct stmmac_dma_cfg *dma_cfg, - dma_addr_t dma_rx_phy, u32 chan) -{ - /* RX descriptor base address list must be written into DMA CSR3 */ - writel(lower_32_bits(dma_rx_phy), ioaddr + DMA_RCV_BASE_ADDR); -} - -static void dwmac1000_dma_init_tx(void __iomem *ioaddr, - struct stmmac_dma_cfg *dma_cfg, - dma_addr_t dma_tx_phy, u32 chan) -{ - /* TX descriptor base address list must be written into DMA CSR4 */ - writel(lower_32_bits(dma_tx_phy), ioaddr + DMA_TX_BASE_ADDR); -} - static u32 dwmac1000_configure_fc(u32 csr6, int rxfifosz) { csr6 &= ~DMA_CONTROL_RFA_MASK; @@ -263,8 +247,8 @@ static void dwmac1000_rx_watchdog(void __iomem *ioaddr, u32 riwt, const struct stmmac_dma_ops dwmac1000_dma_ops = { .reset = dwmac_dma_reset, .init = dwmac1000_dma_init, - .init_rx_chan = dwmac1000_dma_init_rx, - .init_tx_chan = dwmac1000_dma_init_tx, + .init_rx_chan = dwmac_dma_init_rx, + .init_tx_chan = dwmac_dma_init_tx, .axi = dwmac1000_dma_axi, .dump_regs = dwmac1000_dump_dma_regs, .dma_rx_mode = dwmac1000_dma_operation_mode_rx, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c index 8f0d9bc7cab5..ad51a7949a42 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c @@ -29,22 +29,6 @@ static void dwmac100_dma_init(void __iomem *ioaddr, writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA); } -static void dwmac100_dma_init_rx(void __iomem *ioaddr, - struct stmmac_dma_cfg *dma_cfg, - dma_addr_t dma_rx_phy, u32 chan) -{ - /* RX descriptor base addr lists must be written into DMA CSR3 */ - writel(lower_32_bits(dma_rx_phy), ioaddr + DMA_RCV_BASE_ADDR); -} - -static void dwmac100_dma_init_tx(void __iomem *ioaddr, - struct stmmac_dma_cfg *dma_cfg, - dma_addr_t dma_tx_phy, u32 chan) -{ - /* TX descriptor base addr lists must be written into DMA CSR4 */ - writel(lower_32_bits(dma_tx_phy), ioaddr + DMA_TX_BASE_ADDR); -} - /* Store and Forward capability is not used at all. * * The transmit threshold can be programmed by setting the TTC bits in the DMA @@ -111,8 +95,8 @@ static void dwmac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x, const struct stmmac_dma_ops dwmac100_dma_ops = { .reset = dwmac_dma_reset, .init = dwmac100_dma_init, - .init_rx_chan = dwmac100_dma_init_rx, - .init_tx_chan = dwmac100_dma_init_tx, + .init_rx_chan = dwmac_dma_init_rx, + .init_tx_chan = dwmac_dma_init_tx, .dump_regs = dwmac100_dump_dma_regs, .dma_tx_mode = dwmac100_dma_operation_mode_tx, .dma_diagnostic_fr = dwmac100_dma_diagnostic_fr, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h index e5dbd0bc257e..fa919bf75e19 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h @@ -134,8 +134,12 @@ void dwmac_enable_dma_transmission(void __iomem *ioaddr); void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx); void dwmac_disable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx); +void dwmac_dma_init_tx(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg, + dma_addr_t dma_tx_phy, u32 chan); void dwmac_dma_start_tx(void __iomem *ioaddr, u32 chan); void dwmac_dma_stop_tx(void __iomem *ioaddr, u32 chan); +void dwmac_dma_init_rx(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg, + dma_addr_t dma_rx_phy, u32 chan); void dwmac_dma_start_rx(void __iomem *ioaddr, u32 chan); void dwmac_dma_stop_rx(void __iomem *ioaddr, u32 chan); int dwmac_dma_interrupt(void __iomem *ioaddr, struct stmmac_extra_stats *x, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c index 57a53a600aa5..6ddfc689e77b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c @@ -56,6 +56,13 @@ void dwmac_disable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx) writel(value, ioaddr + DMA_INTR_ENA); } +void dwmac_dma_init_tx(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg, + dma_addr_t dma_tx_phy, u32 chan) +{ + /* TX descriptor base address list must be written into DMA CSR4 */ + writel(lower_32_bits(dma_tx_phy), ioaddr + DMA_TX_BASE_ADDR); +} + void dwmac_dma_start_tx(void __iomem *ioaddr, u32 chan) { u32 value = readl(ioaddr + DMA_CONTROL); @@ -70,6 +77,13 @@ void dwmac_dma_stop_tx(void __iomem *ioaddr, u32 chan) writel(value, ioaddr + DMA_CONTROL); } +void dwmac_dma_init_rx(void __iomem *ioaddr, struct stmmac_dma_cfg *dma_cfg, + dma_addr_t dma_rx_phy, u32 chan) +{ + /* RX descriptor base address list must be written into DMA CSR3 */ + writel(lower_32_bits(dma_rx_phy), ioaddr + DMA_RCV_BASE_ADDR); +} + void dwmac_dma_start_rx(void __iomem *ioaddr, u32 chan) { u32 value = readl(ioaddr + DMA_CONTROL); From patchwork Mon Feb 8 14:03:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6DBFC433DB for ; Mon, 8 Feb 2021 14:08:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 66D9664E2E for ; Mon, 8 Feb 2021 14:08:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66D9664E2E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jOPt6XUWEpGBsoHVcJTE9JZPRHXcypuG/8elyvg00TE=; b=tjuaxTg6JqZ9qcyetOquRM/+p 51KWpKNDECaN7CbXhTQMyMaj7Fl9/bTbtSSxpqPgol6qOzUb4hm9dXUB1EgLsHbu2tusdPPseVPgP HU7nf+1GDkYUvViUMzKHi+I52E4PJ09tTSLZo4T1SMHARy3CrZnwDkzVzR+ya26w+A8m9zcP+BBIM O6ZJ9W5yqx7CzQVZxCsKHI4xCRKWXkQW9KpabzFmGlpYagycxQn0ep8uEMKhyi8vFDF3jTHQNBi0w PgoEpb1xZ/vnqsZ06+sPx7kt14MUvB8QAtS0hMA3D9xiYluRVHmDoGY7CmgAD1BJnz3lr45nCdXB2 I//VsrCQw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97Aa-0003sg-MK; Mon, 08 Feb 2021 14:05:40 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978t-00037w-Kz for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:04:01 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 14/20] net: stmmac: Add DW GMAC disable LPI IRQ mask macro Date: Mon, 8 Feb 2021 17:03:35 +0300 Message-ID: <20210208140341.9271-15-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090356_031360_BC2CE1EB X-CRM114-Status: UNSURE ( 9.22 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Indeed the DW GMAC Interrupts mask register has got an ability to disable the LPI interrupts. Add the macro to close up the MAC IRQs mask macros set. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h index 494e1d2f2971..919f5b55bc7d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h @@ -38,6 +38,7 @@ #define GMAC_INT_DISABLE_PCSAN BIT(2) #define GMAC_INT_DISABLE_PMT BIT(3) #define GMAC_INT_DISABLE_TIMESTAMP BIT(9) +#define GMAC_INT_DISABLE_LPI BIT(10) #define GMAC_INT_DISABLE_PCS (GMAC_INT_DISABLE_RGMII | \ GMAC_INT_DISABLE_PCSLINK | \ GMAC_INT_DISABLE_PCSAN) From patchwork Mon Feb 8 14:03:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075579 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37FFDC433E0 for ; Mon, 8 Feb 2021 14:09:32 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D60ED64E60 for ; Mon, 8 Feb 2021 14:09:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D60ED64E60 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yAkDxAMHhyT+QiRYKVoKql4pPpRl+Jo6WZdcPgaNsZs=; b=iQQxX7yxlQyHn8qB9M3fY3ZMD IhwTka/eKIrdTQsK9onHd3mdDdUrn1Dj8NKQNc312R7eDi58hW7JvCAEqrMH+7inL6QhoTRmywNwd DdVCwl+iVa3atHjKwE+RkRGvobzclqOaEs+zLok+dIeBXYcaRainQUUiGndg2N2JRSJLlMuY+bzoS Y9HyTi258+Ucgmgg2xvcVXSEokDbwxOokvmxVMsdaCVFuyc55CpyCIltszaekmx5E0kg6s9pbTNAq aDaaqWPaXWm0t24JhyoxpwicgrhAseXVW5alNczjE/sQPWS/YzrcWZAOcryo/GU6kfbS9PHHDP1KP P2uNILxAw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97CS-0004ks-CZ; Mon, 08 Feb 2021 14:07:36 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978u-00035T-6R for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:04:04 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 15/20] net: stmmac: Discard STMMAC_RESETING flag Date: Mon, 8 Feb 2021 17:03:36 +0300 Message-ID: <20210208140341.9271-16-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090356_420393_3EABE0C0 X-CRM114-Status: UNSURE ( 7.97 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org That flag is totally useless. It's set inside a non-reentrant mutex-protected section. For the same reason the test-and-set loop is also pointless. The flag is also unused anywhere else in the driver. So just drop it. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 --- 2 files changed, 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index e444b1b237c0..3e2bf7e2dafb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -248,7 +248,6 @@ struct stmmac_priv { enum stmmac_state { STMMAC_DOWN, STMMAC_RESET_REQUESTED, - STMMAC_RESETING, STMMAC_SERVICE_SCHED, }; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index abe8db9965f4..16e08cfaadf0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -4669,14 +4669,11 @@ static void stmmac_reset_subtask(struct stmmac_priv *priv) rtnl_lock(); netif_trans_update(priv->dev); - while (test_and_set_bit(STMMAC_RESETING, &priv->state)) - usleep_range(1000, 2000); set_bit(STMMAC_DOWN, &priv->state); dev_close(priv->dev); dev_open(priv->dev, NULL); clear_bit(STMMAC_DOWN, &priv->state); - clear_bit(STMMAC_RESETING, &priv->state); rtnl_unlock(); } From patchwork Mon Feb 8 14:03:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075581 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99D7DC433E0 for ; Mon, 8 Feb 2021 14:09:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 408E664E5A for ; Mon, 8 Feb 2021 14:09:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 408E664E5A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tiZdphb+WzrbBIkOVP+f8gxWytA+x+wyGyiUDVmCUXc=; b=aRnM8zm3dmW5RdDrT/AxnoqXk MwzfLi2qjzSt+1ISb5nyTCGHZRpaUPOkFb5kLu+7BldMIuAv/VM1rVwmb53Sy69QrmlsmFbmtZPOh 1airelfzMlLtR69X1cL/Xnk2pxtiBBuoG9U1AoF3IPmHFOYU5caqtTSDwz59fnr9Z3l1dUzON9+dG +/k5Ez3mK8PgfCjYqq6fss7+05MpK1bcS9akCfL8nxT3YSVAMbLbhk8YVhWDtPrX13qckLeJv4Say tlxu+xPTpZN49jx8px88MYLxw+v0LUoWC7HwKwhANCBSFFrcZf8OufCQU807a0XW1osCOV5Ji+7r7 mHC7sqHPw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97CX-0004oC-RG; Mon, 08 Feb 2021 14:07:41 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978u-00035X-Vm for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:04:05 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 16/20] net: stmmac: Discard conditional service task execution Date: Mon, 8 Feb 2021 17:03:37 +0300 Message-ID: <20210208140341.9271-17-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090357_199115_DAD5AAE5 X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Indeed CMWQ guaranties that each particular work item is non-reenatrant, while using the atomic bitmask operation statement may cause a requested event being missed if for instance some event happens while the service task is being executed (see the STMMAC_SERVICE_SCHED flag semantic). Similarly the service task can be requested for being executed while the STMMAC core is in the down state. (Though for now there is no such sub-task defined in the driver). So to speak just drop the conditional service task execution and queue the corresponding work anytime it's requested, while the service sub-tasks shall determine whether they really need to be performed in particular situations. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 3e2bf7e2dafb..d88bc8af8eaa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -248,7 +248,6 @@ struct stmmac_priv { enum stmmac_state { STMMAC_DOWN, STMMAC_RESET_REQUESTED, - STMMAC_SERVICE_SCHED, }; int stmmac_mdio_unregister(struct net_device *ndev); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 16e08cfaadf0..08112b6e7afd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -176,9 +176,7 @@ static void stmmac_enable_all_queues(struct stmmac_priv *priv) static void stmmac_service_event_schedule(struct stmmac_priv *priv) { - if (!test_bit(STMMAC_DOWN, &priv->state) && - !test_and_set_bit(STMMAC_SERVICE_SCHED, &priv->state)) - queue_work(priv->wq, &priv->service_task); + queue_work(priv->wq, &priv->service_task); } static void stmmac_global_err(struct stmmac_priv *priv) @@ -4683,7 +4681,6 @@ static void stmmac_service_task(struct work_struct *work) service_task); stmmac_reset_subtask(priv); - clear_bit(STMMAC_SERVICE_SCHED, &priv->state); } /** From patchwork Mon Feb 8 14:03:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97947C433DB for ; Mon, 8 Feb 2021 14:09:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3D32A64E5A for ; Mon, 8 Feb 2021 14:09:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D32A64E5A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pi1Vc9QOwhJZ3pcIyTNcNsT4c5TQDp/UAjYIhdyoSAE=; b=29hbj4uz6/J6/Lu3I6qc0h2qO ildMU7/v+XLJFkrFKwPcERxHCPyfHt8Ks1qMUBJws4QeGtDu52F2/Lk2dUXrgFVGtu/oEthJQaCUe noCszahtt6djphAqWft49xMahxxb1qvpaDYPaueNvQa5PtK0fu475AaLj/0qE2mKmobe5tripmPkB sgfOH68Nlaq5oo4HIXTHcvbDwEO8vHtjP8noqhGSq38LB3g2OTwYNMAyXLQw5UbcbYZ5OypwRi48a Z6IVcAJokzT1+VzlQmBLVHS/Jzw4ut7MG2Vy2odLAcwY01Q1XgTg3ZCDCrecrrY+6vVlBrvUIBORi WBHSQuzTA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97Cf-0004rf-QO; Mon, 08 Feb 2021 14:07:49 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978v-00035S-LN for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:04:07 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 17/20] net: stmmac: Add 'cause' arg to the service task executioner Date: Mon, 8 Feb 2021 17:03:38 +0300 Message-ID: <20210208140341.9271-18-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090357_903667_86D7C450 X-CRM114-Status: GOOD ( 10.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to have a more descriptive and coherent service task interface let's add the cause argument to the stmmac_service_event_schedule() method. It will be used to test-and-set the corresponding flag in the private device state variable, and execute the service handler if the flag hasn't been set. By doing so we'll be able to activate the service sub-task just by calling the stmmac_service_event_schedule() method. Note currently there is only a single user of the service tasks interface. It's used to handle a case of the critical device errors to cause the interface reset. The changes provided here will also prevent the global error handler from being called twice if the service task has already being executed while reset sub-task still isn't started. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 08112b6e7afd..f3ced94b3f4e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -174,16 +174,18 @@ static void stmmac_enable_all_queues(struct stmmac_priv *priv) } } -static void stmmac_service_event_schedule(struct stmmac_priv *priv) +static void stmmac_service_event_schedule(struct stmmac_priv *priv, + unsigned long cause) { - queue_work(priv->wq, &priv->service_task); + if (!test_and_set_bit(cause, &priv->state)) + queue_work(priv->wq, &priv->service_task); } static void stmmac_global_err(struct stmmac_priv *priv) { netif_carrier_off(priv->dev); - set_bit(STMMAC_RESET_REQUESTED, &priv->state); - stmmac_service_event_schedule(priv); + + stmmac_service_event_schedule(priv, STMMAC_RESET_REQUESTED); } /** @@ -4658,8 +4660,6 @@ static const struct net_device_ops stmmac_netdev_ops = { static void stmmac_reset_subtask(struct stmmac_priv *priv) { - if (!test_and_clear_bit(STMMAC_RESET_REQUESTED, &priv->state)) - return; if (test_bit(STMMAC_DOWN, &priv->state)) return; @@ -4680,7 +4680,8 @@ static void stmmac_service_task(struct work_struct *work) struct stmmac_priv *priv = container_of(work, struct stmmac_priv, service_task); - stmmac_reset_subtask(priv); + if (test_and_clear_bit(STMMAC_RESET_REQUESTED, &priv->state)) + stmmac_reset_subtask(priv); } /** From patchwork Mon Feb 8 14:03:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBE3FC433DB for ; Mon, 8 Feb 2021 14:09:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67BDF64D9F for ; Mon, 8 Feb 2021 14:09:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67BDF64D9F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EO4/laA9PoL7y/qgPMIcvewk0GWHCPRBJBGuFQ8DOmU=; b=ynWgYCmmupjbem+kwM/yuv6ET un31hPzfMkNlJAii5yUP8aMLdo5pQRqR4icPdAHb1yxK3oJY0w8DUgzCTXxcX+hkj+6ritalK10U6 69jq/jFXfHir9YDOXkraOGhHrGHMToghCGcgxs+zReLCrBPG+/7o9oK07v09KLR2g0ORh4BMSfext 3QTRVrgSbnIvDhuAMG3l6Nr2dllPLslpslqvY0I2x2nUgQc+qDAlOC1gbspOm/Q2vtLfJ1h13Fd85 fwemoY2GtobG3kbsxHpE1RY9xzgwdhAN9QaINdgAP6mDAxKNjbhBVxm2ZRG85VKuZvBeBGuIj/IoN yC94d7HAA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97Cj-0004wD-Uf; Mon, 08 Feb 2021 14:07:53 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978w-00036M-BO for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:04:08 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 18/20] net: stmmac: Move PTP clock enabling to PTP-init method Date: Mon, 8 Feb 2021 17:03:39 +0300 Message-ID: <20210208140341.9271-19-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090358_735286_60CFA8D9 X-CRM114-Status: GOOD ( 16.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org That clock is purely dedicated for the PTP feature of DW *MAC. From the driver readability and maintainability point of the view it's better to have it enabled/disable in the PTP interface init/release methods. Let's do that by moving the clock prepare/enable procedure invocation to the stmmac_init_ptp() method and adding the clock disable/unprepare function call to stmmac_release_ptp(). Since the clock is now handled in the framework of the PTP-interface related initializers/de-initializers we need to call the stmmac_release_ptp() method in the HW-setup antagonist - stmmac_hw_teardown(). Thus call the later one when the network device is closed to clean the PTP-interface too. Signed-off-by: Serge Semin --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f3ced94b3f4e..d6446aa712e1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -761,10 +761,18 @@ static int stmmac_hwtstamp_get(struct net_device *dev, struct ifreq *ifr) static int stmmac_init_ptp(struct stmmac_priv *priv) { bool xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac; + int ret; if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) return -EOPNOTSUPP; + ret = clk_prepare_enable(priv->plat->clk_ptp_ref); + if (ret) { + netdev_warn(priv->dev, "failed to enable PTP ref-clock: %d\n", + ret); + return ret; + } + priv->adv_ts = 0; /* Check if adv_ts can be enabled for dwmac 4.x / xgmac core */ if (xmac && priv->dma_cap.atime_stamp) @@ -790,8 +798,12 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) static void stmmac_release_ptp(struct stmmac_priv *priv) { - clk_disable_unprepare(priv->plat->clk_ptp_ref); + if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) + return; + stmmac_ptp_unregister(priv); + + clk_disable_unprepare(priv->plat->clk_ptp_ref); } /** @@ -2716,10 +2728,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) stmmac_mmc_setup(priv); if (init_ptp) { - ret = clk_prepare_enable(priv->plat->clk_ptp_ref); - if (ret < 0) - netdev_warn(priv->dev, "failed to enable PTP reference clock: %d\n", ret); - ret = stmmac_init_ptp(priv); if (ret == -EOPNOTSUPP) netdev_warn(priv->dev, "PTP not supported by HW\n"); @@ -2784,7 +2792,7 @@ static void stmmac_hw_teardown(struct net_device *dev) { struct stmmac_priv *priv = netdev_priv(dev); - clk_disable_unprepare(priv->plat->clk_ptp_ref); + stmmac_release_ptp(priv); } /** @@ -2965,6 +2973,9 @@ static int stmmac_release(struct net_device *dev) /* Stop TX/RX DMA and clear the descriptors */ stmmac_stop_all_dma(priv); + /* Cleanup HW setup */ + stmmac_hw_teardown(dev); + /* Release and free the Rx/Tx resources */ free_dma_desc_resources(priv); @@ -2973,8 +2984,6 @@ static int stmmac_release(struct net_device *dev) netif_carrier_off(dev); - stmmac_release_ptp(priv); - return 0; } From patchwork Mon Feb 8 14:03:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B939C433E0 for ; Mon, 8 Feb 2021 14:09:57 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D26A364E5A for ; Mon, 8 Feb 2021 14:09:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D26A364E5A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Afl/B0ro/nrnYsa1ejI6xNmqbxgN7G4KSisFQWg6ffI=; b=aB5F3OmOW55UfCzppdXaFoFWC XVhsIQc3AW97i7QzhGKhXNHdMdtAk4g0j4k+lASbWXHKDZn1ekA94irBtKmwPQdBSKFwY4bsIZ8S7 0W8PzWkIxsE1mu+SafJIjZsEg0Ypbxu1rfOGy3EzKEEGA0hODgMzlmukEsmn3EXlbdTsfTB3X7g2A SchxO6Ss8SqBnyvZVR0WuDKN2WLXZr/kBX9YR+jtQwszPEbzSJSX3d3yh8YWYncXjmfEhMId/utTT d5z0DlryshrL35fhzdoEEKr4FTvdMR8szx/4Zhy/7/Ui83Ts+dPPvdKsLZsPjDLLfOptYGgDTC2/c tX8GaKhaA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97Cq-0004zQ-FP; Mon, 08 Feb 2021 14:08:00 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978w-00036X-VW for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:04:09 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 19/20] net: stmmac: Move DMA stop procedure to HW-setup antagonist Date: Mon, 8 Feb 2021 17:03:40 +0300 Message-ID: <20210208140341.9271-20-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090359_251560_01911F0C X-CRM114-Status: GOOD ( 10.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The DMA-channels enabling procedure is performed in the framework of the the DW *MAC hardware setup method. For the sake of the driver code coherency let's move the DMA-channels stop function invocation to the HW-setup antagonist method - stmmac_hw_teardown(). The latter is called in the stmmac_hw_setup() error path and in the network device release callback. So by introducing this alteration we not only improve the code readability, but also make the stmmac_hw_teardown() doing better the HW cleanup work. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index d6446aa712e1..3c03b773295a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2792,6 +2792,8 @@ static void stmmac_hw_teardown(struct net_device *dev) { struct stmmac_priv *priv = netdev_priv(dev); + stmmac_stop_all_dma(priv); + stmmac_release_ptp(priv); } @@ -2970,9 +2972,6 @@ static int stmmac_release(struct net_device *dev) del_timer_sync(&priv->eee_ctrl_timer); } - /* Stop TX/RX DMA and clear the descriptors */ - stmmac_stop_all_dma(priv); - /* Cleanup HW setup */ stmmac_hw_teardown(dev); From patchwork Mon Feb 8 14:03:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 12075589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFCCEC433DB for ; Mon, 8 Feb 2021 14:09:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4CE9F64D9F for ; Mon, 8 Feb 2021 14:09:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CE9F64D9F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baikalelectronics.ru Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1E6DGyWtHatwZmLC3k3HKZwAMk/gOkCcdimT9znZlZk=; b=YB2MgvUDebppnLKF6vnIXztnV keSlN3nLittcsShpXPUxpCcNzB3LjSsxJsH6rOc2Rg6sRCHWXu49JqyXwuadAr1arTwiVaKIuIW0I iZKD/AmKjxtxOn7eDWtrBiOSph2ngD/StRNfcx/GqU2YzSlqkENkxssvm5ttqNIr7c2Ys9YpT50qn t8HvlpoSPTRx7Tf8hAQe5AxgEk1Y7EV54VYHAbopjd+GSjtZTdoxEuXLKBbELUmwcJzv6+3sYXJ/K sb5b+OWdnS5dX7IJseYBRSZyPaFI4kKf4Ey9Cl6wdJgzp31Hf7DGbsX0i5pMgE1v53v1ldTx6SpJT zvuImNRPg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l97Cx-00054k-M0; Mon, 08 Feb 2021 14:08:07 +0000 Received: from mail.baikalelectronics.com ([87.245.175.226] helo=mail.baikalelectronics.ru) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l978x-00034T-LU for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 14:04:09 +0000 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Joao Pinto , Jose Abreu , Maxime Coquelin Subject: [PATCH 20/20] net: stmmac: Move MAC Tx/Rx disabling to HW-setup antagonist Date: Mon, 8 Feb 2021 17:03:41 +0300 Message-ID: <20210208140341.9271-21-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> References: <20210208140341.9271-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_090359_883480_33D0FCFC X-CRM114-Status: UNSURE ( 9.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , Serge Semin , Alexey Malahov , Serge Semin , Vyacheslav Mitrofanov , Pavel Parkhomenko , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since MAC Tx/Rx activity is enabled in the core hardware setup procedure it would be logically correct to it disabled in the HW-setup antagonist - stmmac_hw_teardown(). Let's do that to improve the driver code coherency and thus readability. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 3c03b773295a..f70cab9f46d9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2795,6 +2795,8 @@ static void stmmac_hw_teardown(struct net_device *dev) stmmac_stop_all_dma(priv); stmmac_release_ptp(priv); + + stmmac_mac_set(priv, priv->ioaddr, false); } /** @@ -2978,9 +2980,6 @@ static int stmmac_release(struct net_device *dev) /* Release and free the Rx/Tx resources */ free_dma_desc_resources(priv); - /* Disable the MAC Rx/Tx */ - stmmac_mac_set(priv, priv->ioaddr, false); - netif_carrier_off(dev); return 0;