Commit 00ed1fa47b823dcf87fb3b7c3d064804f18d1a2d

Authored by Christian Riesch
Committed by Mugunthan V N
1 parent 0e6a805aac

davinci_mdio: Fix MDIO timeout check

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff

drivers/net/ethernet/ti/davinci_mdio.c
... ... @@ -186,6 +186,11 @@
186 186 __davinci_mdio_reset(data);
187 187 return -EAGAIN;
188 188 }
  189 +
  190 + reg = __raw_readl(&regs->user[0].access);
  191 + if ((reg & USERACCESS_GO) == 0)
  192 + return 0;
  193 +
189 194 dev_err(data->dev, "timed out waiting for user access\n");
190 195 return -ETIMEDOUT;
191 196 }