diff options
author | 2018-12-05 21:49:40 +0100 | |
---|---|---|
committer | 2018-12-05 16:26:16 -0800 | |
commit | 5f15eed245bc6d7c82d44f0ebcaf62071a9d55bd (patch) | |
tree | bdc52d9ab8e25aa95f33276c62d01c6ef77a32a8 /include/linux/mii.h | |
parent | net: documentation: build a directory structure for drivers (diff) | |
download | linux-5f15eed245bc6d7c82d44f0ebcaf62071a9d55bd.tar.gz linux-5f15eed245bc6d7c82d44f0ebcaf62071a9d55bd.tar.bz2 linux-5f15eed245bc6d7c82d44f0ebcaf62071a9d55bd.zip |
net: mii: Fix autoneg in mii_lpa_to_linkmode_lpa_t()
mii_adv_to_linkmode_adv_t() clears all bits before setting it needs to
set. This means the freshly set Autoneg gets cleared.
Change the order, and add comments about it clearing the old content
of the bitmap.
Fixes: c0ec3c273677 ("net: phy: Convert u32 phydev->lp_advertising to linkmode")
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/mii.h')
-rw-r--r-- | include/linux/mii.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h index fb7ae4ae8ce3..57365224306c 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h @@ -378,7 +378,8 @@ static inline u32 mii_lpa_to_ethtool_lpa_x(u32 lpa) * @adv: value of the MII_ADVERTISE register * * A small helper function that translates MII_ADVERTISE bits - * to linkmode advertisement settings. + * to linkmode advertisement settings. Clears the old value + * of advertising. */ static inline void mii_adv_to_linkmode_adv_t(unsigned long *advertising, u32 adv) @@ -408,16 +409,18 @@ static inline void mii_adv_to_linkmode_adv_t(unsigned long *advertising, * @adv: value of the MII_LPA register * * A small helper function that translates MII_LPA bits, when in - * 1000Base-T mode, to linkmode LP advertisement settings. + * 1000Base-T mode, to linkmode LP advertisement settings. Clears the + * old value of advertising */ static inline void mii_lpa_to_linkmode_lpa_t(unsigned long *lp_advertising, u32 lpa) { + mii_adv_to_linkmode_adv_t(lp_advertising, lpa); + if (lpa & LPA_LPACK) linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, lp_advertising); - mii_adv_to_linkmode_adv_t(lp_advertising, lpa); } /** |