Skip to contentSkip to conversation

Add 100 base-x mode

PATCH Applied Bjarni Jonasson 3 participants 6 messages Jan 13, 2021 – Jan 15, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v2 cover Add 100 base-x mode

Adding support for 100 base-x in phylink.
The Sparx5 switch supports 100 base-x pcs (IEEE 802.3 Clause 24) 4b5b encoded. These patches adds phylink support for that mode.

Tested in Sparx5, using sfp modules:
Axcen 100fx AXFE-1314-0521 (base-fx)
Axcen 100lx AXFE-1314-0551 (base-lx)
HP SFP 100FX J9054C (bx-10)
Excom SFP-SX-M1002 (base-lx)

v1 -> v2:
Added description to Documentation/networking/phy.rst Moved PHY_INTERFACE_MODE_100BASEX to above 1000BASEX Patching against net-next

Bjarni Jonasson (2):
net: phy: Add 100 base-x mode
sfp: add support for 100 base-x SFPs

 Documentation/networking/phy.rst | 5 +++++
 drivers/net/phy/sfp-bus.c        | 9 +++++++++
 include/linux/phy.h              | 4 ++++
 3 files changed, 18 insertions(+)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/2 net: phy: Add 100 base-x mode

Sparx-5 supports this mode and it is missing in the PHY core.

---
 Documentation/networking/phy.rst | 5 +++++
 include/linux/phy.h              | 4 ++++
 2 files changed, 9 insertions(+)
Documentation/networking/phy.rst +5 -0
index b2f7ec794bc8..399f17976a6c 100644
@@ -286,6 +286,11 @@ Some of the interface modes are described below:
     Note: due to legacy usage, some 10GBASE-R usage incorrectly makes
     use of this definition.
 
+``PHY_INTERFACE_MODE_100BASEX``
+    This defines IEEE 802.3 Clause 24.  The link operates at a fixed data
+    rate of 125Mpbs using a 4B/5B encoding scheme, resulting in an underlying
+    data rate of 100Mpbs.
+
 Pause frames / flow control
 ===========================
 
include/linux/phy.h +4 -0
index 9effb511acde..24fcc6456a9e 100644
@@ -104,6 +104,7 @@ extern const int phy_10gbit_features_array[1];
  * @PHY_INTERFACE_MODE_MOCA: Multimedia over Coax
  * @PHY_INTERFACE_MODE_QSGMII: Quad SGMII
  * @PHY_INTERFACE_MODE_TRGMII: Turbo RGMII
+ * @PHY_INTERFACE_MODE_100BASEX: 100 BaseX
  * @PHY_INTERFACE_MODE_1000BASEX: 1000 BaseX
  * @PHY_INTERFACE_MODE_2500BASEX: 2500 BaseX
  * @PHY_INTERFACE_MODE_RXAUI: Reduced XAUI
@@ -135,6 +136,7 @@ typedef enum {
 	PHY_INTERFACE_MODE_MOCA,
 	PHY_INTERFACE_MODE_QSGMII,
 	PHY_INTERFACE_MODE_TRGMII,
+	PHY_INTERFACE_MODE_100BASEX,
 	PHY_INTERFACE_MODE_1000BASEX,
 	PHY_INTERFACE_MODE_2500BASEX,
 	PHY_INTERFACE_MODE_RXAUI,
@@ -217,6 +219,8 @@ static inline const char *phy_modes(phy_interface_t interface)
 		return "usxgmii";
 	case PHY_INTERFACE_MODE_10GKR:
 		return "10gbase-kr";
+	case PHY_INTERFACE_MODE_100BASEX:
+		return "100base-x";
 	default:
 		return "unknown";
 	}
Signature · 1 line
2.17.1
maintainer Reviewed-by Russell King on v2 1/2
#2 lore raw

Re: [PATCH net-next v2 1/2] net: phy: Add 100 base-x mode

Quoted 3 lines · Bjarni Jonasson

Sparx-5 supports this mode and it is missing in the PHY core.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#3 lore raw

PATCH v2 2/2 sfp: add support for 100 base-x SFPs

In reply to Bjarni Jonasson

Add support for 100Base-FX, 100Base-LX, 100Base-PX and 100Base-BX10 modules This is needed for Sparx-5 switch.

---
 drivers/net/phy/sfp-bus.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/phy/sfp-bus.c +9 -0
index cdfa0a190962..3c67ad9951ab 100644
@@ -265,6 +265,12 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
 	    br_min <= 1300 && br_max >= 1200)
 		phylink_set(modes, 1000baseX_Full);
 
+	/* 100Base-FX, 100Base-LX, 100Base-PX, 100Base-BX10 */
+	if (id->base.e100_base_fx || id->base.e100_base_lx)
+		phylink_set(modes, 100baseFX_Full);
+	if ((id->base.e_base_px || id->base.e_base_bx10) && br_nom == 100)
+		phylink_set(modes, 100baseFX_Full);
+
 	/* For active or passive cables, select the link modes
 	 * based on the bit rates and the cable compliance bytes.
 	 */
@@ -389,6 +395,9 @@ phy_interface_t sfp_select_interface(struct sfp_bus *bus,
 	if (phylink_test(link_modes, 1000baseX_Full))
 		return PHY_INTERFACE_MODE_1000BASEX;
 
+	if (phylink_test(link_modes, 100baseFX_Full))
+		return PHY_INTERFACE_MODE_100BASEX;
+
 	dev_warn(bus->sfp_dev, "Unable to ascertain link mode\n");
 
 	return PHY_INTERFACE_MODE_NA;
Signature · 1 line
2.17.1
maintainer Reviewed-by Russell King on v2 2/2
#4 lore raw

Re: [PATCH net-next v2 2/2] sfp: add support for 100 base-x SFPs

Quoted 4 lines · Bjarni Jonasson

Add support for 100Base-FX, 100Base-LX, 100Base-PX and 100Base-BX10 modules This is needed for Sparx-5 switch.

Thanks!

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
#5 lore raw
In reply to Bjarni Jonasson
This series was applied to netdev/net-next.git (refs/heads/master):

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

Quoted 11 lines · On Wed, 13 Jan 2021 12:56:24 +0100 you wrote:

Adding support for 100 base-x in phylink.
The Sparx5 switch supports 100 base-x pcs (IEEE 802.3 Clause 24) 4b5b encoded. These patches adds phylink support for that mode.

Tested in Sparx5, using sfp modules:
Axcen 100fx AXFE-1314-0521 (base-fx)
Axcen 100lx AXFE-1314-0551 (base-lx)
HP SFP 100FX J9054C (bx-10)
Excom SFP-SX-M1002 (base-lx)

[...]

Here is the summary with links:
- [net-next,v2,1/2] net: phy: Add 100 base-x mode

    https://git.kernel.org/netdev/net-next/c/b1ae3587d16a
  - [net-next,v2,2/2] sfp: add support for 100 base-x SFPs
    https://git.kernel.org/netdev/net-next/c/6e12f35cef6b

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html