Skip to content

Commit

Permalink
davinci_mdio: Fix MDIO timeout check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christian Riesch authored and David S. Miller committed Apr 18, 2012
1 parent cda31e1 commit 5b76d06
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/ti/davinci_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5b76d06

Please sign in to comment.