Skip to content

Commit 4cf6c57

Browse files
Russell Kingdavem330
authored andcommitted
net: phy: fix write to mii-ctrl1000 register
When userspace writes to the MII_ADVERTISE register, we update phylib's advertising mask and trigger a renegotiation. However, writing to the MII_CTRL1000 register, which contains the gigabit advertisement, does neither. This can lead to phylib's copy of the advertisement becoming de-synced with the values in the PHY register set, which can result in incorrect negotiation resolution. Fixes: 5502b21 ("net: phy: use phy_resolve_aneg_linkmode in genphy_read_status") Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Russell King <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2d819d2 commit 4cf6c57

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drivers/net/phy/phy.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,11 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
457457
val);
458458
change_autoneg = true;
459459
break;
460+
case MII_CTRL1000:
461+
mii_ctrl1000_mod_linkmode_adv_t(phydev->advertising,
462+
val);
463+
change_autoneg = true;
464+
break;
460465
default:
461466
/* do nothing */
462467
break;

include/linux/mii.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,15 @@ static inline void mii_lpa_mod_linkmode_lpa_t(unsigned long *lp_advertising,
455455
lp_advertising, lpa & LPA_LPACK);
456456
}
457457

458+
static inline void mii_ctrl1000_mod_linkmode_adv_t(unsigned long *advertising,
459+
u32 ctrl1000)
460+
{
461+
linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, advertising,
462+
ctrl1000 & ADVERTISE_1000HALF);
463+
linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, advertising,
464+
ctrl1000 & ADVERTISE_1000FULL);
465+
}
466+
458467
/**
459468
* linkmode_adv_to_lcl_adv_t
460469
* @advertising:pointer to linkmode advertising

0 commit comments

Comments
 (0)