net: phy: sfp: handle cases where neither BR, min nor BR, max is given
authorAntoine Tenart <antoine.tenart@bootlin.com>
Fri, 4 May 2018 15:21:03 +0000 (17:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:47:53 +0000 (07:47 +0200)
commitaf4a392e5a15920e7a337fae01a5f866cb9f605c
treea23a71688431f0b75a381e3d745be7d23fd978d8
parent8410a8ddfea1c80b9d9532bdbc5972850c6b2b08
net: phy: sfp: handle cases where neither BR, min nor BR, max is given

[ Upstream commit 2b999ba899059eed00a03d029894a62486e7e2bc ]

When computing the bitrate using values read from an SFP module EEPROM,
we use the nominal BR plus BR,min and BR,max to determine the
boundaries. But in some cases BR,min and BR,max aren't provided, which
led the SFP code to end up having the nominal value for both the minimum
and maximum bitrate values. When using a passive cable, the nominal
value should be used as the maximum one, and there is no minimum one
so we should use 0.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/phy/sfp-bus.c