]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net: phy: consider latched link-down status in polling mode
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 6 Feb 2019 18:39:52 +0000 (19:39 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 9 Feb 2019 06:09:11 +0000 (22:09 -0800)
commit93c0970493c71f264e6c3c7caf1ff24a9e1de786
tree11cb71c6107c6250d9a93458932b0f6e550b39cf
parent3e3e0cdfca483064982329cda07394abff653dd0
net: phy: consider latched link-down status in polling mode

The link status value latches link-down events. To get the current
status we read the register twice in genphy_update_link(). There's
a potential risk that we miss a link-down event in polling mode.
This may cause issues if the user e.g. connects his machine to a
different network.

On the other hand reading the latched value may cause issues in
interrupt mode. Following scenario:

- After boot link goes up
- phy_start() is called triggering an aneg restart, hence link goes
  down and link-down info is latched.
- After aneg has finished link goes up and triggers an interrupt.
  Interrupt handler reads link status, means it reads the latched
  "link is down" info. But there won't be another interrupt as long
  as link stays up, therefore phylib will never recognize that link
  is up.

Deal with both scenarios by reading the register twice in interrupt
mode only.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy-c45.c
drivers/net/phy/phy_device.c