Skip to content

Commit 9962acf

Browse files
Russell Kingdavem330
authored andcommitted
sfp: add support for 1000Base-PX and 1000Base-BX10
Add support for decoding the transceiver information for 1000Base-PX and 1000Base-BX10. These use 1000BASE-X protocol. Signed-off-by: Russell King <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3fa7d19 commit 9962acf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/net/phy/sfp-bus.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,26 @@ EXPORT_SYMBOL_GPL(sfp_parse_interface);
165165
void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
166166
unsigned long *support)
167167
{
168+
unsigned int br_min, br_nom, br_max;
169+
168170
phylink_set(support, Autoneg);
169171
phylink_set(support, Pause);
170172
phylink_set(support, Asym_Pause);
171173

174+
/* Decode the bitrate information to MBd */
175+
br_min = br_nom = br_max = 0;
176+
if (id->base.br_nominal) {
177+
if (id->base.br_nominal != 255) {
178+
br_nom = id->base.br_nominal * 100;
179+
br_min = br_nom + id->base.br_nominal * id->ext.br_min;
180+
br_max = br_nom + id->base.br_nominal * id->ext.br_max;
181+
} else if (id->ext.br_max) {
182+
br_nom = 250 * id->ext.br_max;
183+
br_max = br_nom + br_nom * id->ext.br_min / 100;
184+
br_min = br_nom - br_nom * id->ext.br_min / 100;
185+
}
186+
}
187+
172188
/* Set ethtool support from the compliance fields. */
173189
if (id->base.e10g_base_sr)
174190
phylink_set(support, 10000baseSR_Full);
@@ -187,6 +203,11 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
187203
phylink_set(support, 1000baseT_Full);
188204
}
189205

206+
/* 1000Base-PX or 1000Base-BX10 */
207+
if ((id->base.e_base_px || id->base.e_base_bx10) &&
208+
br_min <= 1300 && br_max >= 1200)
209+
phylink_set(support, 1000baseX_Full);
210+
190211
switch (id->base.extended_cc) {
191212
case 0x00: /* Unspecified */
192213
break;

0 commit comments

Comments
 (0)