stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH stable 4.14] net: stmmac: Set dma ring length before enabling the DMA
@ 2019-04-15  7:49 Lars Persson
  2019-04-17 20:14 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Lars Persson @ 2019-04-15  7:49 UTC (permalink / raw)
  To: stable; +Cc: peppe.cavallaro, alexandre.torgue, joabreu, 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 <larper@axis.com>
Cc: stable@vger.kernel.org # 4.14.x
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4a9dbee6f054..f2429ec07b57 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2536,9 +2536,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 		netdev_warn(priv->dev, "%s: failed debugFS registration\n",
 			    __func__);
 #endif
-	/* Start the ball rolling... */
-	stmmac_start_all_dma(priv);
-
 	priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
 
 	if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) {
@@ -2558,6 +2555,9 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 			priv->hw->dma->enable_tso(priv->ioaddr, 1, chan);
 	}
 
+	/* Start the ball rolling... */
+	stmmac_start_all_dma(priv);
+
 	return 0;
 }
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH stable 4.14] net: stmmac: Set dma ring length before enabling the DMA
  2019-04-15  7:49 [PATCH stable 4.14] net: stmmac: Set dma ring length before enabling the DMA Lars Persson
@ 2019-04-17 20:14 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2019-04-17 20:14 UTC (permalink / raw)
  To: Lars Persson
  Cc: stable, peppe.cavallaro, alexandre.torgue, joabreu, Lars Persson

On Mon, Apr 15, 2019 at 09:49:47AM +0200, Lars Persson wrote:
> 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 <larper@axis.com>
> Cc: stable@vger.kernel.org # 4.14.x
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: Alexandre Torgue <alexandre.torgue@st.com>
> Cc: Jose Abreu <joabreu@synopsys.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

This, and the 4.9 patch now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-17 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-15  7:49 [PATCH stable 4.14] net: stmmac: Set dma ring length before enabling the DMA Lars Persson
2019-04-17 20:14 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).