lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Aug 2019 17:37:40 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Marco Hartmann <marco.hartmann@....com>
Cc:     "f.fainelli@...il.com" <f.fainelli@...il.com>,
        "hkallweit1@...il.com" <hkallweit1@...il.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Christian Herber <christian.herber@....com>
Subject: Re: [PATCH v2 net] Add genphy_c45_config_aneg() function to phy-c45.c

On Wed, Aug 21, 2019 at 11:00:46AM +0000, Marco Hartmann wrote:
> Commit 34786005eca3 ("net: phy: prevent PHYs w/o Clause 22 regs from calling
> genphy_config_aneg") introduced a check that aborts phy_config_aneg()
> if the phy is a C45 phy.
> This causes phy_state_machine() to call phy_error() so that the phy
> ends up in PHY_HALTED state.
> 
> Instead of returning -EOPNOTSUPP, call genphy_c45_config_aneg()
> (analogous to the C22 case) so that the state machine can run
> correctly.
> 
> genphy_c45_config_aneg() closely resembles mv3310_config_aneg()
> in drivers/net/phy/marvell10g.c, excluding vendor specific
> configurations for 1000BaseT.

> +/**
> + * genphy_c45_config_aneg - restart auto-negotiation or forced setup
> + * @phydev: target phy_device struct
> + *
> + * Description: If auto-negotiation is enabled, we configure the
> + *   advertising, and then restart auto-negotiation.  If it is not
> + *   enabled, then we force a configuration.
> + */
> +int genphy_c45_config_aneg(struct phy_device *phydev)
> +{
> +	bool changed = false;
> +	int ret;
> +
> +	if (phydev->autoneg == AUTONEG_DISABLE)
> +		return genphy_c45_pma_setup_forced(phydev);
> +
> +	ret = genphy_c45_an_config_aneg(phydev);
> +	if (ret < 0)
> +		return ret;
> +	if (ret > 0)
> +		changed = true;
> +
> +	return genphy_c45_check_and_restart_aneg(phydev, changed);
> +}
> +EXPORT_SYMBOL_GPL(genphy_c45_config_aneg);

The vendor parts for 1000BaseT makes this interesting. Do we expect to
see an C45 PHYs which don't support 1000BaseT? I think that
unlikely. So all C45 PHYs are going to implement their own config_aneg
callback so they can set their vendor registers for 1000BaseT.

> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index f3adea9ef400..74c4e15ebe52 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -507,7 +507,7 @@ static int phy_config_aneg(struct phy_device *phydev)
>  	 * allowed to call genphy_config_aneg()
>  	 */
>  	if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0)))
> -		return -EOPNOTSUPP;
> +		return genphy_c45_config_aneg(phydev);
>  
>  	return genphy_config_aneg(phydev);

So here we should be calling the driver config_aneg function. It can
then call genphy_c45_config_aneg(phydev) to do the generic parts.

Heiner, what do you think?

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ