Skip to content

Commit 6c15e41

Browse files
paligregkh
authored andcommitted
net: sfp: add mode quirk for GPON module Ubiquiti U-Fiber Instant
[ Upstream commit f0b4f84 ] The Ubiquiti U-Fiber Instant SFP GPON module has nonsensical information stored in its EEPROM. It claims to support all transceiver types including 10G Ethernet. Clear all claimed modes and set only 1000baseX_Full, which is the only one supported. This module has also phys_id set to SFF, and the SFP subsystem currently does not allow to use SFP modules detected as SFFs. Add exception for this module so it can be detected as supported. This change finally allows to detect and use SFP GPON module Ubiquiti U-Fiber Instant on Linux system. EEPROM content of this SFP module is (where XX is serial number): 00: 02 04 0b ff ff ff ff ff ff ff ff 03 0c 00 14 c8 ???........??.?? 10: 00 00 00 00 55 42 4e 54 20 20 20 20 20 20 20 20 ....UBNT 20: 20 20 20 20 00 18 e8 29 55 46 2d 49 4e 53 54 41 .??)UF-INSTA 30: 4e 54 20 20 20 20 20 20 34 20 20 20 05 1e 00 36 NT 4 ??.6 40: 00 06 00 00 55 42 4e 54 XX XX XX XX XX XX XX XX .?..UBNTXXXXXXXX 50: 20 20 20 20 31 34 30 31 32 33 20 20 60 80 02 41 140123 `??A Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0b5d22c commit 6c15e41

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

drivers/net/phy/sfp-bus.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
4444
phylink_set(modes, 2500baseX_Full);
4545
}
4646

47+
static void sfp_quirk_ubnt_uf_instant(const struct sfp_eeprom_id *id,
48+
unsigned long *modes)
49+
{
50+
/* Ubiquiti U-Fiber Instant module claims that support all transceiver
51+
* types including 10G Ethernet which is not truth. So clear all claimed
52+
* modes and set only one mode which module supports: 1000baseX_Full.
53+
*/
54+
phylink_zero(modes);
55+
phylink_set(modes, 1000baseX_Full);
56+
}
57+
4758
static const struct sfp_quirk sfp_quirks[] = {
4859
{
4960
// Alcatel Lucent G-010S-P can operate at 2500base-X, but
@@ -63,6 +74,10 @@ static const struct sfp_quirk sfp_quirks[] = {
6374
.vendor = "HUAWEI",
6475
.part = "MA5671A",
6576
.modes = sfp_quirk_2500basex,
77+
}, {
78+
.vendor = "UBNT",
79+
.part = "UF-INSTANT",
80+
.modes = sfp_quirk_ubnt_uf_instant,
6681
},
6782
};
6883

drivers/net/phy/sfp.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,21 @@ static const struct sff_data sff_data = {
272272

273273
static bool sfp_module_supported(const struct sfp_eeprom_id *id)
274274
{
275-
return id->base.phys_id == SFF8024_ID_SFP &&
276-
id->base.phys_ext_id == SFP_PHYS_EXT_ID_SFP;
275+
if (id->base.phys_id == SFF8024_ID_SFP &&
276+
id->base.phys_ext_id == SFP_PHYS_EXT_ID_SFP)
277+
return true;
278+
279+
/* SFP GPON module Ubiquiti U-Fiber Instant has in its EEPROM stored
280+
* phys id SFF instead of SFP. Therefore mark this module explicitly
281+
* as supported based on vendor name and pn match.
282+
*/
283+
if (id->base.phys_id == SFF8024_ID_SFF_8472 &&
284+
id->base.phys_ext_id == SFP_PHYS_EXT_ID_SFP &&
285+
!memcmp(id->base.vendor_name, "UBNT ", 16) &&
286+
!memcmp(id->base.vendor_pn, "UF-INSTANT ", 16))
287+
return true;
288+
289+
return false;
277290
}
278291

279292
static const struct sff_data sfp_data = {

0 commit comments

Comments
 (0)