Skip to content

Commit a212027

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phylink: disable autoneg for interfaces that have no inband
Mathew reports that as a result of commit 6561f0e ("net: pcs: pcs-lynx: implement pcs_inband_caps() method"), 10G SFP modules no longer work with the Lynx PCS. This problem is not specific to the Lynx PCS, but is caused by commit df874f9 ("net: phylink: add pcs_inband_caps() method") which added validation of the autoneg state to the optical SFP configuration path. Fix this by handling interface modes that fundamentally have no inband negotiation more correctly - if we only have a single interface mode, clear the Autoneg support bit and the advertising mask. If the module can operate with several different interface modes, autoneg may be supported for other modes, so leave the support mask alone and just clear the Autoneg bit in the advertising mask. This restores 10G optical module functionality with PCS that supply their inband support, and makes ethtool output look sane. Reported-by: Mathew McBride <[email protected]> Closes: https://lore.kernel.org/r/[email protected] Fixes: df874f9 ("net: phylink: add pcs_inband_caps() method") Signed-off-by: Russell King (Oracle) <[email protected]> Tested-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1bd905d commit a212027

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/net/phy/phylink.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3634,6 +3634,7 @@ static int phylink_sfp_config_optical(struct phylink *pl)
36343634
{
36353635
__ETHTOOL_DECLARE_LINK_MODE_MASK(support);
36363636
struct phylink_link_state config;
3637+
enum inband_type inband_type;
36373638
phy_interface_t interface;
36383639
int ret;
36393640

@@ -3680,6 +3681,23 @@ static int phylink_sfp_config_optical(struct phylink *pl)
36803681
phylink_dbg(pl, "optical SFP: chosen %s interface\n",
36813682
phy_modes(interface));
36823683

3684+
inband_type = phylink_get_inband_type(interface);
3685+
if (inband_type == INBAND_NONE) {
3686+
/* If this is the sole interface, and there is no inband
3687+
* support, clear the advertising mask and Autoneg bit in
3688+
* the support mask. Otherwise, just clear the Autoneg bit
3689+
* in the advertising mask.
3690+
*/
3691+
if (phy_interface_weight(pl->sfp_interfaces) == 1) {
3692+
linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
3693+
pl->sfp_support);
3694+
linkmode_zero(config.advertising);
3695+
} else {
3696+
linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
3697+
config.advertising);
3698+
}
3699+
}
3700+
36833701
if (!phylink_validate_pcs_inband_autoneg(pl, interface,
36843702
config.advertising)) {
36853703
phylink_err(pl, "autoneg setting not compatible with PCS");

0 commit comments

Comments
 (0)