Commit 52c5cd1b authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: phy: sfp: fix the BR,min computation

In an SFP EEPROM values can be read to get information about a given SFP
module. One of those is the bitrate, which can be determined using a
nominal bitrate in addition with min and max values (in %). The SFP code
currently compute both BR,min and BR,max values thanks to this nominal
and min,max values.

This patch fixes the BR,min computation as the min value should be
subtracted to the nominal one, not added.

Fixes: 9962acf7 ("sfp: add support for 1000Base-PX and 1000Base-BX10")
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 14224923
...@@ -125,7 +125,7 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, ...@@ -125,7 +125,7 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
if (id->base.br_nominal) { if (id->base.br_nominal) {
if (id->base.br_nominal != 255) { if (id->base.br_nominal != 255) {
br_nom = id->base.br_nominal * 100; br_nom = id->base.br_nominal * 100;
br_min = br_nom + id->base.br_nominal * id->ext.br_min; br_min = br_nom - id->base.br_nominal * id->ext.br_min;
br_max = br_nom + id->base.br_nominal * id->ext.br_max; br_max = br_nom + id->base.br_nominal * id->ext.br_max;
} else if (id->ext.br_max) { } else if (id->ext.br_max) {
br_nom = 250 * id->ext.br_max; br_nom = 250 * id->ext.br_max;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment