From patchwork Sat Mar 25 17:08:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vittorio Gambaletta X-Patchwork-Id: 743498 X-Patchwork-Delegate: mschiffer@universe-factory.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vr6FZ5PVBz9s7R for ; Sun, 26 Mar 2017 04:08:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eQHA17c9"; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=vittgam.net header.i=@vittgam.net header.b="KGneWTgS"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-ID:To:From: Date:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=krKXf7wZr8EK5v3bygX+wJf4CR/2QE3tfaYz0/CFozk=; b=eQHA17c95SxH1y B4S62dzO1KNypl+abcjbcqyyUcXH10/eeqVUUkjplzpGcLp28guNXpz4ajOchA5jwFAyRhvh9XoC4 WatRWTk0izdam/FXIAR9WA84LZ8KQYfFVeWfd+L0ERq5VF0WPMoDfIiNmKQ9K8wdZR3k5v1SHD0DW qBE8YwZu3hLXwmEewHrsLJEBgCcDhrF21UBIfOy0axdjOm91+wN/NFDRbjliXAHhHiRZzn2b5SrlE Ov8izecSe1r3Yio4qVjSt2pGDfTGHZoVieh5zK4Vd+6CKxnvJCBhgjA3gOZSvUIG0ExB0RV39NaS8 oP6rZCM0hHouZSIQgguw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1crpB1-0004Ni-PP; Sat, 25 Mar 2017 17:08:31 +0000 Received: from server1.vittgam.net ([2a01:4f8:130:5143::1] helo=mail.vittgam.net) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1crpAw-0004Lr-ML for lede-dev@lists.infradead.org; Sat, 25 Mar 2017 17:08:28 +0000 X-DKIM: OpenDKIM Filter v2.4.2 mail.vittgam.net v2PH82FC100894 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=vittgam.net; s=20150519; t=1490461682; bh=/019+nisoA2G3vqHp/9jQK62Kc71L8KMpYSaB6qrTVQ=; h=From:To:Subject:Content-Type:Message-ID; b=KGneWTgS+ouHlJ3tKPdKCoLQV9SmVDtdwjoucynR3h7aTkBdBeShFiGNVVkeh/R/G qBS7I2s998DVLw91TRH9laN7yVjI67BiU0Ttm5EFxZU6c6BnhVMJWD90eHb/yzGFMw 62iGTXem/28Iu34XPVwwkzJPOjTH0DCt/muVf/X/hNXF5fmJHgCzVELI8LVXalWiEC ynjRd4ux+iy3yDa2AqKItrkdraUJpSVjoVLfBDx4xvA+o/yzVCqO7ZkH3g55pzkgbd rdkujNl3hplEj26Zb3xdqBcPy3nDnSTv3hJgYTEM14jC7/d/0SqW2dBRBEyDm0oFkR q6uStiRCIkeO+bNFwRdLPYMq3J2kEtz3gi+fIVExWALIKU8UXi7l04yNQoMzzGJy0W nIuC4foUIicBbnPRw1n8OUXPjZ1tQWBbl3rHb24GzqfTrijBK4NWXnTFXE3q6ovbF2 ZpUO16ARFzIMwBTLa+4hSXOUbIsazGhMSkLoUV4eoa8RTClMfAUHLhDGSkwuigYnl9 QD0hozacwAHOhXPYmXQ7GdGWmuZCf/sRcndVtrMUy4o9TaexGF3Fb3UzmGMKG+d7hm ReHlhCKwMY0ceEnGJMvNyjn7IkI63ybvW/MlsdoeiRlhkA/MIp5B2Y2MsrTtFE4bwK yX5HrAat9kVaFCQviImnTKZ0= X-VittGamMilter-Outgoing-SubjectPrefix: [lede-dev] X-VittGamMilter-Outgoing-OriginalSubject: [PATCH] ag71xx: Fix rx ring buffer stall on small packets flood on qca956x and qca953x. Received: from vl3 (vl3.r12.network.mietitrebbia.rocks [10.48.6.117]) by mail.vittgam.net with SMTP id v2PH82FC100894; Sat, 25 Mar 2017 18:08:02 +0100 Date: Sat, 25 Mar 2017 18:08:02 +0100 From: "Vittorio Gambaletta (VittGam)" To: Message-ID: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170325_100827_230811_B21DF8CC X-CRM114-Status: UNSURE ( 7.82 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a01:4f8:130:5143:0:0:0:1 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH] ag71xx: Fix rx ring buffer stall on small packets flood on qca956x and qca953x. X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Backported from Code Aurora QSDK Signed-off-by: Vittorio Gambaletta --- .../linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 5 +++++ .../mips/include/asm/mach-ath79/ag71xx_platform.h | 2 +- .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index a8b19b6..427de6a 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -996,6 +996,9 @@ void __init ath79_register_eth(unsigned int id) pdata->reset_bit = AR934X_RESET_GE0_MAC | AR934X_RESET_GE0_MDIO; pdata->set_speed = ar934x_set_speed_ge0; + + if (ath79_soc == ATH79_SOC_QCA9533) + pdata->disable_inline_checksum_engine = 1; } else { pdata->reset_bit = AR934X_RESET_GE1_MAC | AR934X_RESET_GE1_MDIO; @@ -1097,6 +1100,8 @@ void __init ath79_register_eth(unsigned int id) pdata->set_speed = qca956x_set_speed_sgmii; else pdata->set_speed = ar934x_set_speed_ge0; + + pdata->disable_inline_checksum_engine = 1; } else { pdata->reset_bit = QCA955X_RESET_GE1_MAC | QCA955X_RESET_GE1_MDIO; diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h index 078fa15..5fdc59c 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h @@ -37,7 +37,7 @@ struct ag71xx_platform_data { u8 is_ar724x:1; u8 has_ar8216:1; u8 use_flow_control:1; - u8 is_qca956x:1; + u8 disable_inline_checksum_engine:1; struct ag71xx_switch_platform_data *switch_data; diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 566e951..72dd654 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -629,6 +629,22 @@ __ag71xx_link_adjust(struct ag71xx *ag, bool update) ag71xx_wr(ag, AG71XX_REG_MAC_CFG2, cfg2); ag71xx_wr(ag, AG71XX_REG_FIFO_CFG5, fifo5); ag71xx_wr(ag, AG71XX_REG_MAC_IFCTL, ifctl); + + if (pdata->disable_inline_checksum_engine) { + /* + * The rx ring buffer can stall on small packets on QCA953x and + * QCA956x. Disabling the inline checksum engine fixes the stall. + * The wr, rr functions cannot be used since this hidden register + * is outside of the normal ag71xx register block. + */ + void __iomem *dam = ioremap_nocache(0xb90001bc, 0x4); + if (dam) { + __raw_writel(__raw_readl(dam) & ~BIT(27), dam); + (void)__raw_readl(dam); + iounmap(dam); + } + } + ag71xx_hw_start(ag); netif_carrier_on(ag->dev);