Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: marvell: mvpp2: fix lack of link interrupts

Sven Auhagen reports that if he changes a SFP+ module for a SFP module
on the Macchiatobin Single Shot, the link does not come back up. For
Sven, it is as easy as:

- Insert a SFP+ module connected, and use ping6 to verify link is up.
- Remove SFP+ module
- Insert SFP 1000base-X module use ping6 to verify link is up: Link
up event did not trigger and the link is down

but that doesn't show the problem for me. Locally, this has been
reproduced by:

- Boot with no modules.
- Insert SFP+ module, confirm link is up.
- Replace module with 25000base-X module. Confirm link is up.
- Set remote end down, link is reported as dropped at both ends.
- Set remote end up, link is reported up at remote end, but not local
end due to lack of link interrupt.

Fix this by setting up both GMAC and XLG interrupts for port 0, but
only unmasking the appropriate interrupt according to the current mode
set in the mac_config() method. However, only do the mask/unmask
dance when we are really changing the link mode to avoid missing any
link interrupts.

Tested-by: Sven Auhagen <sven.auhagen@voleatech.de>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Russell King and committed by
David S. Miller
bf2fa125 4a4cec72

+14 -7
+14 -7
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 1133 1133 { 1134 1134 u32 val; 1135 1135 1136 - if (phy_interface_mode_is_rgmii(port->phy_interface) || 1136 + if (port->phylink || 1137 + phy_interface_mode_is_rgmii(port->phy_interface) || 1137 1138 phy_interface_mode_is_8023z(port->phy_interface) || 1138 1139 port->phy_interface == PHY_INTERFACE_MODE_SGMII) { 1139 1140 val = readl(port->base + MVPP22_GMAC_INT_MASK); ··· 4621 4620 const struct phylink_link_state *state) 4622 4621 { 4623 4622 struct mvpp2_port *port = netdev_priv(dev); 4623 + bool change_interface = port->phy_interface != state->interface; 4624 4624 4625 4625 /* Check for invalid configuration */ 4626 4626 if (state->interface == PHY_INTERFACE_MODE_10GKR && port->gop_id != 0) { ··· 4631 4629 4632 4630 /* Make sure the port is disabled when reconfiguring the mode */ 4633 4631 mvpp2_port_disable(port); 4632 + if (change_interface) { 4633 + mvpp22_gop_mask_irq(port); 4634 4634 4635 - if (port->priv->hw_version == MVPP22 && 4636 - port->phy_interface != state->interface) { 4637 - port->phy_interface = state->interface; 4635 + if (port->priv->hw_version == MVPP22) { 4636 + port->phy_interface = state->interface; 4638 4637 4639 - /* Reconfigure the serdes lanes */ 4640 - phy_power_off(port->comphy); 4641 - mvpp22_mode_reconfigure(port); 4638 + /* Reconfigure the serdes lanes */ 4639 + phy_power_off(port->comphy); 4640 + mvpp22_mode_reconfigure(port); 4641 + } 4642 4642 } 4643 4643 4644 4644 /* mac (re)configuration */ ··· 4653 4649 4654 4650 if (port->priv->hw_version == MVPP21 && port->flags & MVPP2_F_LOOPBACK) 4655 4651 mvpp2_port_loopback_set(port, state); 4652 + 4653 + if (change_interface) 4654 + mvpp22_gop_unmask_irq(port); 4656 4655 4657 4656 mvpp2_port_enable(port); 4658 4657 }