提交 2b999ba8 编写于 作者: A Antoine Tenart 提交者: David S. Miller

net: phy: sfp: handle cases where neither BR, min nor BR, max is given

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: NAntoine Tenart <antoine.tenart@bootlin.com>
Acked-by: NRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8d42eada
...@@ -132,6 +132,13 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, ...@@ -132,6 +132,13 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
br_max = br_nom + br_nom * id->ext.br_min / 100; br_max = br_nom + br_nom * id->ext.br_min / 100;
br_min = br_nom - br_nom * id->ext.br_min / 100; br_min = br_nom - br_nom * id->ext.br_min / 100;
} }
/* When using passive cables, in case neither BR,min nor BR,max
* are specified, set br_min to 0 as the nominal value is then
* used as the maximum.
*/
if (br_min == br_max && id->base.sfp_ct_passive)
br_min = 0;
} }
/* Set ethtool support from the compliance fields. */ /* Set ethtool support from the compliance fields. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册