| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From 7a77233ec6d114322e2c4f71b4e26dbecd9ea8a7 Mon Sep 17 00:00:00 2001 | 
 | 2 | From: Russell King <rmk+kernel@armlinux.org.uk> | 
 | 3 | Date: Wed, 9 Dec 2020 11:22:54 +0000 | 
 | 4 | Subject: net: sfp: relax bitrate-derived mode check | 
 | 5 | MIME-Version: 1.0 | 
 | 6 | Content-Type: text/plain; charset=UTF-8 | 
 | 7 | Content-Transfer-Encoding: 8bit | 
 | 8 |  | 
 | 9 | Do not check the encoding when deriving 1000BASE-X from the bitrate | 
 | 10 | when no other modes are discovered. Some GPON modules (VSOL V2801F | 
 | 11 | and CarlitoxxPro CPGOS03-0490 v2.0) indicate NRZ encoding with a | 
 | 12 | 1200Mbaud bitrate, but should be driven with 1000BASE-X on the host | 
 | 13 | side. | 
 | 14 |  | 
 | 15 | Tested-by: Pali Rohรกr <pali@kernel.org> | 
 | 16 | Reviewed-by: Andrew Lunn <andrew@lunn.ch> | 
 | 17 | Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> | 
 | 18 | Signed-off-by: David S. Miller <davem@davemloft.net> | 
 | 19 | --- | 
 | 20 |  drivers/net/phy/sfp-bus.c | 11 +++++------ | 
 | 21 |  1 file changed, 5 insertions(+), 6 deletions(-) | 
 | 22 |  | 
 | 23 | --- a/drivers/net/phy/sfp-bus.c | 
 | 24 | +++ b/drivers/net/phy/sfp-bus.c | 
 | 25 | @@ -349,14 +349,13 @@ void sfp_parse_support(struct sfp_bus *b | 
 | 26 |  	} | 
 | 27 |   | 
 | 28 |  	/* If we haven't discovered any modes that this module supports, try | 
 | 29 | -	 * the encoding and bitrate to determine supported modes. Some BiDi | 
 | 30 | -	 * modules (eg, 1310nm/1550nm) are not 1000BASE-BX compliant due to | 
 | 31 | -	 * the differing wavelengths, so do not set any transceiver bits. | 
 | 32 | +	 * the bitrate to determine supported modes. Some BiDi modules (eg, | 
 | 33 | +	 * 1310nm/1550nm) are not 1000BASE-BX compliant due to the differing | 
 | 34 | +	 * wavelengths, so do not set any transceiver bits. | 
 | 35 |  	 */ | 
 | 36 |  	if (bitmap_empty(modes, __ETHTOOL_LINK_MODE_MASK_NBITS)) { | 
 | 37 | -		/* If the encoding and bit rate allows 1000baseX */ | 
 | 38 | -		if (id->base.encoding == SFF8024_ENCODING_8B10B && br_nom && | 
 | 39 | -		    br_min <= 1300 && br_max >= 1200) | 
 | 40 | +		/* If the bit rate allows 1000baseX */ | 
 | 41 | +		if (br_nom && br_min <= 1300 && br_max >= 1200) | 
 | 42 |  			phylink_set(modes, 1000baseX_Full); | 
 | 43 |  	} | 
 | 44 |   |