Skip to content

Commit dbae338

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phylink: Force retrigger in case of latched link-fail indicator
On mv88e6xxx 1G/2.5G PCS, the SerDes register 4.2001.2 has the following description: This register bit indicates when link was lost since the last read. For the current link status, read this register back-to-back. Thus to get current link state, we need to read the register twice. But doing that in the link change interrupt handler would lead to potentially ignoring link down events, which we really want to avoid. Thus this needs to be solved in phylink's resolve, by retriggering another resolve in the event when PCS reports link down and previous link was up, and by re-reading PCS state if the previous link was down. The wrong value is read when phylink requests change from sgmii to 2500base-x mode, and link won't come up. This fixes the bug. Fixes: 9525ae8 ("phylink: add phylink infrastructure") Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: Marek Behún <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 80662f4 commit dbae338

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/net/phy/phylink.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,19 @@ static void phylink_resolve(struct work_struct *w)
741741
case MLO_AN_INBAND:
742742
phylink_mac_pcs_get_state(pl, &link_state);
743743

744+
/* The PCS may have a latching link-fail indicator.
745+
* If the link was up, bring the link down and
746+
* re-trigger the resolve. Otherwise, re-read the
747+
* PCS state to get the current status of the link.
748+
*/
749+
if (!link_state.link) {
750+
if (cur_link_state)
751+
retrigger = true;
752+
else
753+
phylink_mac_pcs_get_state(pl,
754+
&link_state);
755+
}
756+
744757
/* If we have a phy, the "up" state is the union of
745758
* both the PHY and the MAC
746759
*/

0 commit comments

Comments
 (0)