public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Golle <daniel@makrotopia•org>
To: "Russell King (Oracle)" <rmk+kernel@armlinux•org.uk>
Cc: Andrew Lunn <andrew@lunn•ch>,
	Heiner Kallweit <hkallweit1@gmail•com>,
	"David S. Miller" <davem@davemloft•net>,
	Eric Dumazet <edumazet@google•com>,
	Frank Wunderlich <frank-w@public-files•de>,
	Jakub Kicinski <kuba@kernel•org>,
	netdev@vger•kernel.org, Paolo Abeni <pabeni@redhat•com>
Subject: Re: [PATCH net-next 2/2] net: sfp: add quirk for 2.5G copper SFP
Date: Sat, 25 Mar 2023 02:12:16 +0000	[thread overview]
Message-ID: <ZB5YgPiZYwbf/G2u@makrotopia.org> (raw)
In-Reply-To: <E1pefJz-00Dn4V-Oc@rmk-PC.armlinux.org.uk>

Hi Russell,

On Tue, Mar 21, 2023 at 04:58:51PM +0000, Russell King (Oracle) wrote:
> Add a quirk for a copper SFP that identifies itself as "OEM"
> "SFP-2.5G-T". This module's PHY is inaccessible, and can only run
> at 2500base-X with the host without negotiation. Add a quirk to
> enable the 2500base-X interface mode with 2500base-T support, and
> disable autonegotiation.
> 
> Reported-by: Frank Wunderlich <frank-w@public-files•de>
> Tested-by: Frank Wunderlich <frank-w@public-files•de>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux•org.uk>

I've tried the same fix also with my 2500Base-T SFP module:
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 4223c9fa6902..c7a18a72d2c5 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -424,6 +424,7 @@ static const struct sfp_quirk sfp_quirks[] = {
        SFP_QUIRK_F("Turris", "RTSFP-10", sfp_fixup_rollball),
        SFP_QUIRK_F("Turris", "RTSFP-10G", sfp_fixup_rollball),
        SFP_QUIRK_F("OEM", "SFP-GE-T", sfp_fixup_ignore_tx_fault),
+       SFP_QUIRK_M("TP-LINK", "TL-SM410U", sfp_quirk_oem_2_5g),
 };

 static size_t sfp_strlen(const char *str, size_t maxlen)

However, the results are a bit of a mixed bag. The link now does come up
without having to manually disable autonegotiation. However, I see this
new warning in the bootlog:
[   17.344155] sfp sfp2: module TP-LINK          TL-SM410U        rev 1.0  sn 12154J6000864    dc 210606  
...
[   21.653812] mt7530 mdio-bus:1f sfp2: selection of interface failed, advertisement 00,00000000,00000000,00006440

Also link speed and status appears unknown, though we do know at least
that the speed is 2500M, and also full duplex will always be true for
2500Base-T:
[   56.004937] mt7530 mdio-bus:1f sfp2: Link is Up - Unknown/Unknown - flow control off

root@OpenWrt:/# ethtool sfp2
Settings for sfp2:
        Supported ports: [ FIBRE ]
        Supported link modes:   2500baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  2500baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Auto-negotiation: off
        Port: FIBRE
        PHYAD: 0
        Transceiver: internal
        Supports Wake-on: d
        Wake-on: d
        Link detected: yes

So it seems like this new quirk has brought also some new problems or at
least doesn't address them all.

> ---
>  drivers/net/phy/sfp.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> index 39e3095796d0..9c1fa0b1737f 100644
> --- a/drivers/net/phy/sfp.c
> +++ b/drivers/net/phy/sfp.c
> @@ -360,6 +360,23 @@ static void sfp_quirk_2500basex(const struct sfp_eeprom_id *id,
>  	__set_bit(PHY_INTERFACE_MODE_2500BASEX, interfaces);
>  }
>  
> +static void sfp_quirk_disable_autoneg(const struct sfp_eeprom_id *id,
> +				      unsigned long *modes,
> +				      unsigned long *interfaces)
> +{
> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, modes);
> +}
> +
> +static void sfp_quirk_oem_2_5g(const struct sfp_eeprom_id *id,
> +			       unsigned long *modes,
> +			       unsigned long *interfaces)
> +{
> +	/* Copper 2.5G SFP */
> +	linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, modes);
> +	__set_bit(PHY_INTERFACE_MODE_2500BASEX, interfaces);
> +	sfp_quirk_disable_autoneg(id, modes, interfaces);
> +}
> +
>  static void sfp_quirk_ubnt_uf_instant(const struct sfp_eeprom_id *id,
>  				      unsigned long *modes,
>  				      unsigned long *interfaces)
> @@ -401,6 +418,7 @@ static const struct sfp_quirk sfp_quirks[] = {
>  	SFP_QUIRK_M("UBNT", "UF-INSTANT", sfp_quirk_ubnt_uf_instant),
>  
>  	SFP_QUIRK_F("OEM", "SFP-10G-T", sfp_fixup_rollball_cc),
> +	SFP_QUIRK_M("OEM", "SFP-2.5G-T", sfp_quirk_oem_2_5g),
>  	SFP_QUIRK_F("OEM", "RTSFP-10", sfp_fixup_rollball_cc),
>  	SFP_QUIRK_F("OEM", "RTSFP-10G", sfp_fixup_rollball_cc),
>  	SFP_QUIRK_F("Turris", "RTSFP-10", sfp_fixup_rollball),
> -- 
> 2.30.2
> 

  parent reply	other threads:[~2023-03-25  2:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 16:58 [PATCH net-next 0/2] Quirk for OEM SFP-2.5G-T copper module Russell King (Oracle)
2023-03-21 16:58 ` [PATCH net-next 1/2] net: sfp-bus: allow SFP quirks to override Autoneg and pause bits Russell King (Oracle)
2023-03-22 15:52   ` Simon Horman
2023-03-21 16:58 ` [PATCH net-next 2/2] net: sfp: add quirk for 2.5G copper SFP Russell King (Oracle)
2023-03-22 15:52   ` Simon Horman
2023-03-25  2:12   ` Daniel Golle [this message]
2023-03-25 14:05     ` Russell King (Oracle)
2023-03-25 15:35       ` Daniel Golle
2023-03-25 19:36         ` Russell King (Oracle)
2023-03-26 11:36           ` Aw: " Frank Wunderlich
2023-03-26 14:44             ` Russell King (Oracle)
2023-03-28 15:10           ` Russell King (Oracle)
2023-03-28 18:28             ` Daniel Golle
2023-03-28 19:16               ` Russell King (Oracle)
2023-03-28 20:56                 ` Daniel Golle
2023-03-23  5:50 ` [PATCH net-next 0/2] Quirk for OEM SFP-2.5G-T copper module patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZB5YgPiZYwbf/G2u@makrotopia.org \
    --to=daniel@makrotopia$(echo .)org \
    --cc=andrew@lunn$(echo .)ch \
    --cc=davem@davemloft$(echo .)net \
    --cc=edumazet@google$(echo .)com \
    --cc=frank-w@public-files$(echo .)de \
    --cc=hkallweit1@gmail$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=rmk+kernel@armlinux$(echo .)org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox