Skip to content

Commit 2b999ba

Browse files
atenartdavem330
authored andcommitted
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: Antoine Tenart <[email protected]> Acked-by: Russell King <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8d42ead commit 2b999ba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/net/phy/sfp-bus.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
132132
br_max = br_nom + br_nom * id->ext.br_min / 100;
133133
br_min = br_nom - br_nom * id->ext.br_min / 100;
134134
}
135+
136+
/* When using passive cables, in case neither BR,min nor BR,max
137+
* are specified, set br_min to 0 as the nominal value is then
138+
* used as the maximum.
139+
*/
140+
if (br_min == br_max && id->base.sfp_ct_passive)
141+
br_min = 0;
135142
}
136143

137144
/* Set ethtool support from the compliance fields. */

0 commit comments

Comments
 (0)