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:   Fri, 31 May 2019 21:18:26 +0100
From:   Russell King - ARM Linux admin <linux@...linux.org.uk>
To:     Robert Hancock <hancock@...systems.ca>
Cc:     netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net: phy: phylink: add fallback from SGMII to
 1000BaseX

On Fri, May 31, 2019 at 01:18:04PM -0600, Robert Hancock wrote:
> Some copper SFP modules support both SGMII and 1000BaseX,

The situation is way worse than that.  Some copper SFP modules are
programmed to support SGMII only.  Others are programmed to support
1000baseX only.  There is no way to tell from the EEPROM how they
are configured, and there is no way to auto-probe the format of the
control word (which is the difference between the two.)

> but some
> drivers/devices only support the 1000BaseX mode. Currently SGMII mode is
> always being selected as the desired mode for such modules, and this
> fails if the controller doesn't support SGMII. Add a fallback for this
> case by trying 1000BaseX instead if the controller rejects SGMII mode.

So, what happens when a controller supports both SGMII and 1000base-X
modes (such as the Marvell devices) but the module is setup for
1000base-X mode?

> 
> Signed-off-by: Robert Hancock <hancock@...systems.ca>
> ---
>  drivers/net/phy/phylink.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 68d0a89..4fd72c2 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -1626,6 +1626,7 @@ static int phylink_sfp_module_insert(void *upstream,
>  {
>  	struct phylink *pl = upstream;
>  	__ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, };
> +	__ETHTOOL_DECLARE_LINK_MODE_MASK(orig_support) = { 0, };
>  	struct phylink_link_state config;
>  	phy_interface_t iface;
>  	int ret = 0;
> @@ -1635,6 +1636,7 @@ static int phylink_sfp_module_insert(void *upstream,
>  	ASSERT_RTNL();
>  
>  	sfp_parse_support(pl->sfp_bus, id, support);
> +	linkmode_copy(orig_support, support);
>  	port = sfp_parse_port(pl->sfp_bus, id, support);
>  
>  	memset(&config, 0, sizeof(config));
> @@ -1663,6 +1665,25 @@ static int phylink_sfp_module_insert(void *upstream,
>  
>  	config.interface = iface;
>  	ret = phylink_validate(pl, support, &config);
> +
> +	if (ret && iface == PHY_INTERFACE_MODE_SGMII &&
> +	    phylink_test(orig_support, 1000baseX_Full)) {
> +		/* Copper modules may select SGMII but the interface may not
> +		 * support that mode, try 1000BaseX if supported.
> +		 */

Here, you are talking about what the module itself supports, but this
code is determining what it should do based on what the _network
controller_ supports.

If the SFP module is programmed for SGMII, and the network controller
supports 1000base-X, then it isn't going to work very well - the
sender of the control word will be sending one format, and the
receiver will be interpreting the bits wrongly.

> +
> +		netdev_warn(pl->netdev, "validation of %s/%s with support %*pb "
> +			    "failed: %d, trying 1000BaseX\n",
> +			    phylink_an_mode_str(MLO_AN_INBAND),
> +			    phy_modes(config.interface),
> +			    __ETHTOOL_LINK_MODE_MASK_NBITS, orig_support, ret);
> +		iface = PHY_INTERFACE_MODE_1000BASEX;
> +		config.interface = iface;
> +		linkmode_copy(config.advertising, orig_support);
> +		linkmode_copy(support, orig_support);
> +		ret = phylink_validate(pl, support, &config);
> +	}
> +
>  	if (ret) {
>  		phylink_err(pl, "validation of %s/%s with support %*pb failed: %d\n",
>  			    phylink_an_mode_str(MLO_AN_INBAND),
> -- 
> 1.8.3.1
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ