[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <5226d9535b31269e0388b781ef815ee2183ee3b9.1510745986.git.jan.kundrat@cesnet.cz>
Date: Wed, 15 Nov 2017 12:39:33 +0100
From: Jan Kundrát <jan.kundrat@...net.cz>
To: netdev@...r.kernel.org
Cc: Russell King <rmk+kernel@....linux.org.uk>
Subject: [PATCH] sfp: Add support for DWDM SFP modules
Without this patch, but with CONFIG_SFP enabled, my NIC won't detect
module unplugging, which is suboptimal.
I'm using an OEM "Cisco compatible" DWDM fixed-frequency 100Ghz-grid SFP
module. It reports itself as a 0x0b 0x24. According to SFF-8024, byte 0
value "0Bh" refers to a "DWDM-SFP/SFP+ (not using SFF-8472)". In
practice, there's a lot of shared properties here.
Everything is apparently defined in a document called "DWDM SFP MSA
(Multi-source Agreement), Revision 1.0, 19th September 2005". I don't
have access to that ocument (yet). Its likely source, the
http://www.dwdmsfpmsa.org/ has been down for years.
>From the datasheets that I was able to find on random vendors' web, the
second byte can vary -- 0x27 is used, too.
Tested on Clearfog Base with v4.14 and Russell King's SFP patches.
Signed-off-by: Jan Kundrát <jan.kundrat@...net.cz>
---
drivers/net/phy/sfp.c | 8 ++++++--
include/linux/sfp.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index e381811e5f11..c937ef40b72c 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -463,8 +463,12 @@ static int sfp_sm_mod_probe(struct sfp *sfp)
vendor, part, rev, sn, date);
/* We only support SFP modules, not the legacy GBIC modules. */
- if (sfp->id.base.phys_id != SFP_PHYS_ID_SFP ||
- sfp->id.base.phys_ext_id != SFP_PHYS_EXT_ID_SFP) {
+ if (sfp->id.base.phys_id == SFP_PHYS_ID_SFP &&
+ sfp->id.base.phys_ext_id == SFP_PHYS_EXT_ID_SFP) {
+ /* a regular SFP module */
+ } else if (sfp->id.base.phys_id == SFP_PHYS_ID_DWDM_SFP) {
+ /* DWDM SFP or a DWDM SFP+ -- let's treat it as a regular SFP */
+ } else {
dev_err(sfp->dev, "module is not SFP - phys id 0x%02x 0x%02x\n",
sfp->id.base.phys_id, sfp->id.base.phys_ext_id);
return -EINVAL;
diff --git a/include/linux/sfp.h b/include/linux/sfp.h
index 4a906f560817..21f53adc4434 100644
--- a/include/linux/sfp.h
+++ b/include/linux/sfp.h
@@ -223,6 +223,7 @@ enum {
SFP_CC_EXT = 0x5f,
SFP_PHYS_ID_SFP = 0x03,
+ SFP_PHYS_ID_DWDM_SFP = 0x0b,
SFP_PHYS_EXT_ID_SFP = 0x04,
SFP_CONNECTOR_UNSPEC = 0x00,
/* codes 01-05 not supportable on SFP, but some modules have single SC */
--
2.14.3
Powered by blists - more mailing lists