Subject: [PATCH 2/4] net: sfp: allow to use also SFP modules which are detected as SFF

From: Pali Rohár <[email-masked]>
Date: Wed, 30 Dec 2020 16:47:53 +0100

Some GPON SFP modules (e.g. Ubiquiti U-Fiber Instant) have set SFF phys_id
in their EEPROM. Kernel SFP subsystem currently does not allow to use
modules detected as SFF.

This change extends check for SFP modules so also those with SFF phys_id
are allowed. With this change also GPON SFP module Ubiquiti U-Fiber Instant
is recognized.

Signed-off-by: Pali Rohár <[email-masked]>
---
 drivers/net/phy/sfp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 490e78a72dd6..73f3ecf15260 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -273,7 +273,8 @@ static const struct sff_data sff_data = {
 
 static bool sfp_module_supported(const struct sfp_eeprom_id *id)
 {
-	return id->base.phys_id == SFF8024_ID_SFP &&
+	return (id->base.phys_id == SFF8024_ID_SFP ||
+		id->base.phys_id == SFF8024_ID_SFF_8472) &&
 	       id->base.phys_ext_id == SFP_PHYS_EXT_ID_SFP;
 }
 
-- 
2.20.1