diff mbox

[net-next] net: phy: Invalidate LP advertising flags when restarting or disabling AN

Message ID 1422320295.3524.26.camel@xylophone.i.decadent.org.uk
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Ben Hutchings Jan. 27, 2015, 12:58 a.m. UTC
It is possible to see the old value of the LP advertising flags
through ethtool after reconfiguring the PHY and before autonegotiation
completes.  If autonegotiation is turned off then the last value seen
will persist indefinitely.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
---
 drivers/net/phy/phy.c |    3 +++
 1 file changed, 3 insertions(+)

Comments

Florian Fainelli Jan. 27, 2015, 1:06 a.m. UTC | #1
On 26/01/15 16:58, Ben Hutchings wrote:
> It is possible to see the old value of the LP advertising flags
> through ethtool after reconfiguring the PHY and before autonegotiation
> completes.  If autonegotiation is turned off then the last value seen
> will persist indefinitely.

Good catch!

> 
> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
>  drivers/net/phy/phy.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 767cd11..cdcac6a 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -439,6 +439,9 @@ int phy_start_aneg(struct phy_device *phydev)
>  	if (AUTONEG_DISABLE == phydev->autoneg)
>  		phy_sanitize_settings(phydev);
>  
> +	/* Invalidate LP advertising flags */
> +	phydev->lp_advertising = 0;
> +
>  	err = phydev->drv->config_aneg(phydev);
>  	if (err < 0)
>  		goto out_unlock;
>
diff mbox

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 767cd11..cdcac6a 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -439,6 +439,9 @@  int phy_start_aneg(struct phy_device *phydev)
 	if (AUTONEG_DISABLE == phydev->autoneg)
 		phy_sanitize_settings(phydev);
 
+	/* Invalidate LP advertising flags */
+	phydev->lp_advertising = 0;
+
 	err = phydev->drv->config_aneg(phydev);
 	if (err < 0)
 		goto out_unlock;