Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp895058yba; Thu, 18 Apr 2019 11:21:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyegK5qvQMM5agZkewmeIg3Mg8RfLsz9C9AOMvMxpW7iBz5Pv580cysedBwuP2xo5QqhsQ+ X-Received: by 2002:a63:360e:: with SMTP id d14mr88897137pga.188.1555611709196; Thu, 18 Apr 2019 11:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611709; cv=none; d=google.com; s=arc-20160816; b=QXo+J0MVDhzi6k55chOTpdfBBN5KJJJXo6eChMZTtRa5r/XYSbXrS5eQFgtQcOhcUb Uq0kPZG/GZK0jj53OnML/fcqwOKG4O//NIy8ltY2OajcDSmkcAWYGfJYTAyHZCD+kN2x RKi1zgNVLBp0AkpRnjmhK3X2WOtcduIFUHIEiH6DUgEiFg+u+GNAGGSDKnwgAiooClgG eiv4KdxHLy5tKlrqNK7jjUqOp+D/js+g58Li5l1m+AW35gjYcZ2Go0QtNKVj3A4PbTjZ z2ofEZzlov1W6Hs5skMgUr4DflqYXD6r2/g6SUoGpBwH+1GD/aQZdtwZ8QDBKbcYgXo0 u04Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q1BLjKtIPMpZj3D3P8XFOOfgJ4DWo6Br1HBOz71NmMs=; b=eEl/fH9kHFjpBkmHyLMZI6ynLVNAXeFpLKgSoQh4yMHw/SA3kMLj80Fn3DtF0y/SKo UDZV8t6XavWmi0spkLLoEgfCWXKz3KqAOgbksW8psS+nAPXSF43nqs+e3Ix/OZihufX2 cCly3AWRsDEN9n40F2e9wL+t+G3DxyJPC1nR0w+D8p0mcxAB6zMzxaZY8kRRc/HH9dbh 2Z1rN/i657mIX2ioWboQfw7TuDnWWLYRVAb0QIwZXI/ZASXLO0UBYq5yVhvtmQzCIaK0 KRaD5WVbqQ3Aj2Ur7uBStJbjhvuxPOnApUsrNCix+1AfMB7wmSfOrbQJ5R9zf12RHmCl VGhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1tmsve2y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4si1750746plb.425.2019.04.18.11.21.33; Thu, 18 Apr 2019 11:21:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1tmsve2y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391764AbfDRSUB (ORCPT + 99 others); Thu, 18 Apr 2019 14:20:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:40578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391827AbfDRSJE (ORCPT ); Thu, 18 Apr 2019 14:09:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7910B218EA; Thu, 18 Apr 2019 18:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610944; bh=Kozx6rVjCq0BWkqGI3kkDVJAJ546/GGS6RANrUEK358=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1tmsve2yfYgy+venFNXb95aYMSeFWxWV0r5R+JoHTdr9QVMShNmAe+/XWa8EvvPid p1YiNl2C2WSBpwR3OrMEtkcDmDEyhzaNvIZ7InYbrjqiP+rSLzNHEyVxqSCoFB1Mss KkPqCHR9F/WahyNf4Hdp90OlyLjb0r3V8pxNbhUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , "peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, Lars Persson" , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Lars Persson Subject: [PATCH 4.9 50/50] net: stmmac: Set dma ring length before enabling the DMA Date: Thu, 18 Apr 2019 19:58:01 +0200 Message-Id: <20190418160428.349970571@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160422.455656724@linuxfoundation.org> References: <20190418160422.455656724@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lars Persson This was fixed in upstream by commit 7d9e6c5afab6 ("net: stmmac: Integrate XGMAC into main driver flow") that is a new feature commit. We found a race condition in the DMA init sequence that hits if the PHY already has link up during stmmac_hw_setup. Since the ring length was programmed after enabling the RX path, we might receive a packet before the correct ring length is programmed. When that happened we could not get reliable interrupts for DMA RX and the MTL complained about RX FIFO overrun. Signed-off-by: Lars Persson Cc: stable@vger.kernel.org # 4.9.x Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Cc: Jose Abreu Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1747,11 +1747,6 @@ static int stmmac_hw_setup(struct net_de if (ret < 0) pr_warn("%s: failed debugFS registration\n", __func__); #endif - /* Start the ball rolling... */ - pr_debug("%s: DMA RX/TX processes started...\n", dev->name); - priv->hw->dma->start_tx(priv->ioaddr); - priv->hw->dma->start_rx(priv->ioaddr); - /* Dump DMA/MAC registers */ if (netif_msg_hw(priv)) { priv->hw->mac->dump_regs(priv->hw); @@ -1779,6 +1774,11 @@ static int stmmac_hw_setup(struct net_de if (priv->tso) priv->hw->dma->enable_tso(priv->ioaddr, 1, STMMAC_CHAN0); + /* Start the ball rolling... */ + pr_debug("%s: DMA RX/TX processes started...\n", dev->name); + priv->hw->dma->start_tx(priv->ioaddr); + priv->hw->dma->start_rx(priv->ioaddr); + return 0; }