All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] davinci_mdio: Fix MDIO timeout check
@ 2012-04-16 14:35 Christian Riesch
  2012-04-18  2:32 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Riesch @ 2012-04-16 14:35 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	ravonereal-Re5JQEeQqe8AvxtiuMwx3w, stable-u79uwXL29TY76Z2rM5mHXA,
	Manfred Rudigier

Under heavy load (flood ping) it is possible for the MDIO timeout to
expire before the loop checks the GO bit again. This patch adds an
additional check whether the operation was done before actually
returning -ETIMEDOUT.

To reproduce this bug, flood ping the device, e.g., ping -f -l 1000
After some time, a "timed out waiting for user access" warning
may appear. And even worse, link may go down since the PHY reported a
timeout.

Signed-off-by: Christian Riesch <christian.riesch-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Cyril Chemparathy <cyril-l0cyMroinI0@public.gmane.org>
---
 drivers/net/ethernet/ti/davinci_mdio.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
index 2757c7d..e4e4708 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -181,6 +181,11 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data)
 		__davinci_mdio_reset(data);
 		return -EAGAIN;
 	}
+
+	reg = __raw_readl(&regs->user[0].access);
+	if ((reg & USERACCESS_GO) == 0)
+		return 0;
+
 	dev_err(data->dev, "timed out waiting for user access\n");
 	return -ETIMEDOUT;
 }
-- 
1.7.0.4

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

* Re: [PATCH] davinci_mdio: Fix MDIO timeout check
  2012-04-16 14:35 [PATCH] davinci_mdio: Fix MDIO timeout check Christian Riesch
@ 2012-04-18  2:32 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-04-18  2:32 UTC (permalink / raw)
  To: christian.riesch
  Cc: netdev, davinci-linux-open-source, ravonereal, manfred.rudigier,
	stable, cyril

From: Christian Riesch <christian.riesch@omicron.at>
Date: Mon, 16 Apr 2012 16:35:25 +0200

> Under heavy load (flood ping) it is possible for the MDIO timeout to
> expire before the loop checks the GO bit again. This patch adds an
> additional check whether the operation was done before actually
> returning -ETIMEDOUT.
> 
> To reproduce this bug, flood ping the device, e.g., ping -f -l 1000
> After some time, a "timed out waiting for user access" warning
> may appear. And even worse, link may go down since the PHY reported a
> timeout.
> 
> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
> Cc: <stable@vger.kernel.org>
> Cc: Cyril Chemparathy <cyril@ti.com>

Applied.

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

end of thread, other threads:[~2012-04-18  2:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-16 14:35 [PATCH] davinci_mdio: Fix MDIO timeout check Christian Riesch
2012-04-18  2:32 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.