[PATCH 2/2] net: sfp: support 25G long-range modules (extended compliance code 0x3)

Josua Mayer posted 2 patches 3 weeks ago
[PATCH 2/2] net: sfp: support 25G long-range modules (extended compliance code 0x3)
Posted by Josua Mayer 3 weeks ago
The extended compliance code value SFF8024_ECC_100GBASE_ER4_25GBASE_ER
(0x3) means either 4-lane 100G or single lane 25G.

Set 25000baseLR_Full mode supported in addition to the already set
100000baseLR4_ER4_Full, and handle it in sfp_select_interface.

This fixes detection of 25G capability for two SFP fiber modules:

- GigaLight GSS-SPO250-LRT
- FS SFP-25G23-BX20-I

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
 drivers/net/phy/sfp-bus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index b945d75966d5..2caa0e0c4ec8 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -247,6 +247,7 @@ static void sfp_module_parse_support(struct sfp_bus *bus,
 	case SFF8024_ECC_100GBASE_LR4_25GBASE_LR:
 	case SFF8024_ECC_100GBASE_ER4_25GBASE_ER:
 		phylink_set(modes, 100000baseLR4_ER4_Full);
+		phylink_set(modes, 25000baseLR_Full);
 		break;
 	case SFF8024_ECC_100GBASE_CR4:
 		phylink_set(modes, 100000baseCR4_Full);
@@ -342,7 +343,8 @@ phy_interface_t sfp_select_interface(struct sfp_bus *bus,
 {
 	if (phylink_test(link_modes, 25000baseCR_Full) ||
 	    phylink_test(link_modes, 25000baseKR_Full) ||
-	    phylink_test(link_modes, 25000baseSR_Full))
+	    phylink_test(link_modes, 25000baseSR_Full) ||
+	    phylink_test(link_modes, 25000baseLR_Full))
 		return PHY_INTERFACE_MODE_25GBASER;
 
 	if (phylink_test(link_modes, 10000baseCR_Full) ||

-- 
2.43.0
Re: [PATCH 2/2] net: sfp: support 25G long-range modules (extended compliance code 0x3)
Posted by Jakub Kicinski 2 weeks, 5 days ago
On Sun, 18 Jan 2026 16:07:38 +0200 Josua Mayer wrote:
> @@ -247,6 +247,7 @@ static void sfp_module_parse_support(struct sfp_bus *bus,
>  	case SFF8024_ECC_100GBASE_LR4_25GBASE_LR:
>  	case SFF8024_ECC_100GBASE_ER4_25GBASE_ER:
>  		phylink_set(modes, 100000baseLR4_ER4_Full);
> +		phylink_set(modes, 25000baseLR_Full);

I _think_ the discussion here concluded that the patch is insufficient 
/ DoA? Either way, I wanted to relay that AI code review points out
we may also want to set __set_bit(PHY_INTERFACE_MODE_25GBASER,
interfaces) here:

https://netdev-ai.bots.linux.dev/ai-review.html?id=c91c0f54-56d5-4356-89cd-b57cbb289495
Re: [PATCH 2/2] net: sfp: support 25G long-range modules (extended compliance code 0x3)
Posted by Josua Mayer 2 weeks, 4 days ago
On 19/01/2026 21:30, Jakub Kicinski wrote:
> On Sun, 18 Jan 2026 16:07:38 +0200 Josua Mayer wrote:
>> @@ -247,6 +247,7 @@ static void sfp_module_parse_support(struct sfp_bus *bus,
>>   	case SFF8024_ECC_100GBASE_LR4_25GBASE_LR:
>>   	case SFF8024_ECC_100GBASE_ER4_25GBASE_ER:
>>   		phylink_set(modes, 100000baseLR4_ER4_Full);
>> +		phylink_set(modes, 25000baseLR_Full);
> I _think_ the discussion here concluded that the patch is insufficient
> / DoA? Either way, I wanted to relay that AI code review points out
> we may also want to set __set_bit(PHY_INTERFACE_MODE_25GBASER,
> interfaces) here:
>
> https://netdev-ai.bots.linux.dev/ai-review.html?id=c91c0f54-56d5-4356-89cd-b57cbb289495
>
I concluded the following:

1. there is no confusion with qsfp / 4 serdes lanes

2. 25GBASER is indeed missing, because this case does not fallthrough.

Something open for discussion is whether to handle
SFF8024_ECC_100GBASE_LR4_25GBASE_LR/_ER differently, e.g.:

     case SFF8024_ECC_100GBASE_LR4_25GBASE_LR:
         phylink_set(modes, 25000baseLR_Full);
         fallthrough;
     case SFF8024_ECC_100GBASE_ER4_25GBASE_ER:
         phylink_set(modes, 100000baseLR4_ER4_Full);
         __set_bit(PHY_INTERFACE_MODE_25GBASER, interfaces);
         break;

I.e. should the ER variant support 25000baseLR_Full?

Re: [PATCH 2/2] net: sfp: support 25G long-range modules (extended compliance code 0x3)
Posted by Andrew Lunn 2 weeks, 6 days ago
On Sun, Jan 18, 2026 at 04:07:38PM +0200, Josua Mayer wrote:
> The extended compliance code value SFF8024_ECC_100GBASE_ER4_25GBASE_ER
> (0x3) means either 4-lane 100G or single lane 25G.

Is there a way to tell them apart?

If it is a QSFP, it means 4-lane 100G? You can however split it into
4x 25GBASE_ER, if the MAC supports port spitting? If it is an SFP, it
must mean 25GBASE_ER because the SFP only supports a single lane?

> Set 25000baseLR_Full mode supported in addition to the already set
> 100000baseLR4_ER4_Full, and handle it in sfp_select_interface.
> 
> This fixes detection of 25G capability for two SFP fiber modules:
> 
> - GigaLight GSS-SPO250-LRT
> - FS SFP-25G23-BX20-I

Are these SFPs or QSFPs?

> Signed-off-by: Josua Mayer <josua@solid-run.com>
> ---
>  drivers/net/phy/sfp-bus.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
> index b945d75966d5..2caa0e0c4ec8 100644
> --- a/drivers/net/phy/sfp-bus.c
> +++ b/drivers/net/phy/sfp-bus.c
> @@ -247,6 +247,7 @@ static void sfp_module_parse_support(struct sfp_bus *bus,
>  	case SFF8024_ECC_100GBASE_LR4_25GBASE_LR:
>  	case SFF8024_ECC_100GBASE_ER4_25GBASE_ER:
>  		phylink_set(modes, 100000baseLR4_ER4_Full);
> +		phylink_set(modes, 25000baseLR_Full);

Given the question above, i'm wondering if it is as simple as this, or
we need to look at the type of SFP?

	Andrew
Re: [PATCH 2/2] net: sfp: support 25G long-range modules (extended compliance code 0x3)
Posted by Josua Mayer 2 weeks, 6 days ago
On 18/01/2026 18:01, Andrew Lunn wrote:
> On Sun, Jan 18, 2026 at 04:07:38PM +0200, Josua Mayer wrote:
>> The extended compliance code value SFF8024_ECC_100GBASE_ER4_25GBASE_ER
>> (0x3) means either 4-lane 100G or single lane 25G.
> Is there a way to tell them apart?
The physical connectors are different, so we can know from the
device-tree compatible string.

For now sfp driver does not support qsfp.

>
> If it is a QSFP, it means 4-lane 100G?
This is my suspicion, but I have not parsed real-world qsfp eeproms.
> You can however split it into
> 4x 25GBASE_ER, if the MAC supports port spitting? If it is an SFP, it
> must mean 25GBASE_ER because the SFP only supports a single lane?
Does it?
I thought SR, ER and LR indicate distance not host interface lane count.

Either way if you have a QSFP module, there is a single module with a single
eeprom on a single connector of 4 lanes.

When you have SFP module, there is a module / eeprom for each lane.

>
>> Set 25000baseLR_Full mode supported in addition to the already set
>> 100000baseLR4_ER4_Full, and handle it in sfp_select_interface.
>>
>> This fixes detection of 25G capability for two SFP fiber modules:
>>
>> - GigaLight GSS-SPO250-LRT
>> - FS SFP-25G23-BX20-I
> Are these SFPs or QSFPs?

SFP.

>
>> Signed-off-by: Josua Mayer <josua@solid-run.com>
>> ---
>>   drivers/net/phy/sfp-bus.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
>> index b945d75966d5..2caa0e0c4ec8 100644
>> --- a/drivers/net/phy/sfp-bus.c
>> +++ b/drivers/net/phy/sfp-bus.c
>> @@ -247,6 +247,7 @@ static void sfp_module_parse_support(struct sfp_bus *bus,
>>   	case SFF8024_ECC_100GBASE_LR4_25GBASE_LR:
>>   	case SFF8024_ECC_100GBASE_ER4_25GBASE_ER:
>>   		phylink_set(modes, 100000baseLR4_ER4_Full);
>> +		phylink_set(modes, 25000baseLR_Full);
> Given the question above, i'm wondering if it is as simple as this, or
> we need to look at the type of SFP?
I don't think we need to worry about QSFP at this time.
Re: [PATCH 2/2] net: sfp: support 25G long-range modules (extended compliance code 0x3)
Posted by Russell King (Oracle) 2 weeks, 6 days ago
On Mon, Jan 19, 2026 at 07:30:20AM +0000, Josua Mayer wrote:
> On 18/01/2026 18:01, Andrew Lunn wrote:
> > On Sun, Jan 18, 2026 at 04:07:38PM +0200, Josua Mayer wrote:
> >> The extended compliance code value SFF8024_ECC_100GBASE_ER4_25GBASE_ER
> >> (0x3) means either 4-lane 100G or single lane 25G.
> > Is there a way to tell them apart?
> The physical connectors are different, so we can know from the
> device-tree compatible string.
> 
> For now sfp driver does not support qsfp.

And likely will never do.

I did look at QSFP support due to the LX2160A SR board, and I did
scratch some code together, but I didn't get far with it:

(a) LX2160A is just not flexible enough to consider the possibilities
    properly to implement support (no run-time reconfiguration of the
    interface mode.)

(b) QSFPs can be used as a single interface, or as multiple interfaces.
    There is no way that the SFP and phylink layers can cope with that
    as they are currently structured.

(c) QSFP EEPROMs have a completely different structure to SFP EEPROMs.

(d) I couldn't see any way that the QSFP EEPROM distinguished between
    e.g. a cable that had QSFP at one end and 4x SFP at the other vs
    a cable that had QSFP at each end, thus making it impossible to
    know whether 100G as 4 25G lanes would be possible.

(e) I'm aware that there's devlink which I believe can deal with some
    of this "single network interface of 4 lanes" vs "four network
    interfaces of 1 lane" configuration, but I've never used it, and
    when I looked at it, it wasn't clear how. I have no hardware that
    makes use of devlink to play with to find out.

Basically, QSFP support is something I have little knowledge of, there
is precious little on the 'net about its use, I have no hardware
experience with, and I don't see how it fits into Linux networking.
So I decided it would be a fools errand to attempt to implement
anything.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!