diff mbox series

[net-next,2/2] net: sfp: add some quirks for GPON modules

Message ID E1iXONj-0005ev-NC@rmk-PC.armlinux.org.uk
State Accepted
Delegated to: David Miller
Headers show
Series Add rudimentary SFP module quirk support | expand

Commit Message

Russell King (Oracle) Nov. 20, 2019, 11:42 a.m. UTC
Marc Micalizzi reports that Huawei MA5671A and Alcatel/Lucent G-010S-P
modules are capable of 2500base-X, but incorrectly report their
capabilities in the EEPROM.  It seems rather common that GPON modules
mis-report.

Let's fix these modules by adding some quirks.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/sfp-bus.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Jakub Kicinski Nov. 20, 2019, 10:46 p.m. UTC | #1
On Wed, 20 Nov 2019 11:42:47 +0000, Russell King wrote:
>  static const struct sfp_quirk sfp_quirks[] = {
> +	{
> +		// Alcatel Lucent G-010S-P can operate at 2500base-X, but
> +		// incorrectly report 2500MBd NRZ in their EEPROM
> +		.vendor = "ALCATELLUCENT",
> +		.part = "G010SP",
> +		.modes = sfp_quirk_2500basex,
> +	}, {
> +		// Alcatel Lucent G-010S-A can operate at 2500base-X, but
> +		// report 3.2GBd NRZ in their EEPROM
> +		.vendor = "ALCATELLUCENT",
> +		.part = "3FE46541AA",
> +		.modes = sfp_quirk_2500basex,
> +	}, {
> +		// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
> +		// NRZ in their EEPROM
> +		.vendor = "HUAWEI",
> +		.part = "MA5671A",
> +		.modes = sfp_quirk_2500basex,
> +	},
>  };

nit: no C++ comment style?
Russell King (Oracle) Nov. 21, 2019, 12:03 a.m. UTC | #2
On Wed, Nov 20, 2019 at 02:46:32PM -0800, Jakub Kicinski wrote:
> On Wed, 20 Nov 2019 11:42:47 +0000, Russell King wrote:
> >  static const struct sfp_quirk sfp_quirks[] = {
> > +	{
> > +		// Alcatel Lucent G-010S-P can operate at 2500base-X, but
> > +		// incorrectly report 2500MBd NRZ in their EEPROM
> > +		.vendor = "ALCATELLUCENT",
> > +		.part = "G010SP",
> > +		.modes = sfp_quirk_2500basex,
> > +	}, {
> > +		// Alcatel Lucent G-010S-A can operate at 2500base-X, but
> > +		// report 3.2GBd NRZ in their EEPROM
> > +		.vendor = "ALCATELLUCENT",
> > +		.part = "3FE46541AA",
> > +		.modes = sfp_quirk_2500basex,
> > +	}, {
> > +		// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
> > +		// NRZ in their EEPROM
> > +		.vendor = "HUAWEI",
> > +		.part = "MA5671A",
> > +		.modes = sfp_quirk_2500basex,
> > +	},
> >  };
> 
> nit: no C++ comment style?

Did you read Linus' opinions on commentry style during the discussion
over the SPDX tags?

https://lkml.org/lkml/2017/11/2/715
https://lkml.org/lkml/2017/11/25/133

It seems that Linus has decided to prefer // over /* */
Jakub Kicinski Nov. 21, 2019, 12:14 a.m. UTC | #3
On Thu, 21 Nov 2019 00:03:28 +0000, Russell King - ARM Linux admin
wrote:
> On Wed, Nov 20, 2019 at 02:46:32PM -0800, Jakub Kicinski wrote:
> > On Wed, 20 Nov 2019 11:42:47 +0000, Russell King wrote:  
> > >  static const struct sfp_quirk sfp_quirks[] = {
> > > +	{
> > > +		// Alcatel Lucent G-010S-P can operate at 2500base-X, but
> > > +		// incorrectly report 2500MBd NRZ in their EEPROM
> > > +		.vendor = "ALCATELLUCENT",
> > > +		.part = "G010SP",
> > > +		.modes = sfp_quirk_2500basex,
> > > +	}, {
> > > +		// Alcatel Lucent G-010S-A can operate at 2500base-X, but
> > > +		// report 3.2GBd NRZ in their EEPROM
> > > +		.vendor = "ALCATELLUCENT",
> > > +		.part = "3FE46541AA",
> > > +		.modes = sfp_quirk_2500basex,
> > > +	}, {
> > > +		// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
> > > +		// NRZ in their EEPROM
> > > +		.vendor = "HUAWEI",
> > > +		.part = "MA5671A",
> > > +		.modes = sfp_quirk_2500basex,
> > > +	},
> > >  };  
> > 
> > nit: no C++ comment style?  
> 
> Did you read Linus' opinions on commentry style during the discussion
> over the SPDX tags?
> 
> https://lkml.org/lkml/2017/11/2/715
> https://lkml.org/lkml/2017/11/25/133
> 
> It seems that Linus has decided to prefer // over /* */

Yeah, I remember that, I did:

$ git grep '// ' drivers/net/phy/ | grep -v SPDX
drivers/net/phy/microchip_t1.c:// Copyright (C) 2018 Microchip Technology

before I asked, and assumed since for the last two years they didn't
gain much popularity in this corner of the kernel it's worth asking if
this is intentional :)
Andrew Lunn Nov. 21, 2019, 2:26 a.m. UTC | #4
On Wed, Nov 20, 2019 at 11:42:47AM +0000, Russell King wrote:
> Marc Micalizzi reports that Huawei MA5671A and Alcatel/Lucent G-010S-P
> modules are capable of 2500base-X, but incorrectly report their
> capabilities in the EEPROM.  It seems rather common that GPON modules
> mis-report.
> 
> Let's fix these modules by adding some quirks.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Florian Fainelli Nov. 21, 2019, 3:46 a.m. UTC | #5
On 11/20/2019 3:42 AM, Russell King wrote:
> Marc Micalizzi reports that Huawei MA5671A and Alcatel/Lucent G-010S-P
> modules are capable of 2500base-X, but incorrectly report their
> capabilities in the EEPROM.  It seems rather common that GPON modules
> mis-report.
> 
> Let's fix these modules by adding some quirks.
> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index aebb6978e91a..97680414b5a9 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -38,7 +38,32 @@  struct sfp_bus {
 	bool started;
 };
 
+static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
+				unsigned long *modes)
+{
+	phylink_set(modes, 2500baseX_Full);
+}
+
 static const struct sfp_quirk sfp_quirks[] = {
+	{
+		// Alcatel Lucent G-010S-P can operate at 2500base-X, but
+		// incorrectly report 2500MBd NRZ in their EEPROM
+		.vendor = "ALCATELLUCENT",
+		.part = "G010SP",
+		.modes = sfp_quirk_2500basex,
+	}, {
+		// Alcatel Lucent G-010S-A can operate at 2500base-X, but
+		// report 3.2GBd NRZ in their EEPROM
+		.vendor = "ALCATELLUCENT",
+		.part = "3FE46541AA",
+		.modes = sfp_quirk_2500basex,
+	}, {
+		// Huawei MA5671A can operate at 2500base-X, but report 1.2GBd
+		// NRZ in their EEPROM
+		.vendor = "HUAWEI",
+		.part = "MA5671A",
+		.modes = sfp_quirk_2500basex,
+	},
 };
 
 static size_t sfp_strlen(const char *str, size_t maxlen)