Skip to contentSkip to conversation

100base Fx link modes

PATCH Superseded Dan Murphy 2 participants 13 messages Sep 15, 2020 – Sep 17, 2020

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
author
#1 lore raw

PATCH 1/3 ethtool: Add 100base-FX link mode entries

In reply to Dan Murphy

Add entries for the 100base-FX full and half duplex supported modes.

$ ethtool eth0
        Supported ports: [ TP    MII     FIBRE ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                100baseFX/Half 100baseFX/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                100baseFX/Half 100baseFX/Full
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 100Mb/s
        Duplex: Full
        Auto-negotiation: off
        Port: MII
        PHYAD: 1
        Transceiver: external
        Supports Wake-on: gs
        Wake-on: d
        SecureOn password: 00:00:00:00:00:00
        Current message level: 0x00000000 (0)

Link detected: yes

---
 drivers/net/phy/phy-core.c   | 4 +++-
 include/uapi/linux/ethtool.h | 2 ++
 net/ethtool/common.c         | 2 ++
 net/ethtool/linkmodes.c      | 2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/phy/phy-core.c +3 -1
index ff8e14b01eeb..de5b869139d7 100644
@@ -8,7 +8,7 @@
 
 const char *phy_speed_to_str(int speed)
 {
-	BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 90,
+	BUILD_BUG_ON_MSG(__ETHTOOL_LINK_MODE_MASK_NBITS != 92,
 		"Enum ethtool_link_mode_bit_indices and phylib are out of sync. "
 		"If a speed or mode has been added please update phy_speed_to_str "
 		"and the PHY settings array.\n");
@@ -160,6 +160,8 @@ static const struct phy_setting settings[] = {
 	PHY_SETTING(    100, FULL,    100baseT_Full		),
 	PHY_SETTING(    100, FULL,    100baseT1_Full		),
 	PHY_SETTING(    100, HALF,    100baseT_Half		),
+	PHY_SETTING(    100, HALF,    100baseFX_Half		),
+	PHY_SETTING(    100, FULL,    100baseFX_Full		),
 	/* 10M */
 	PHY_SETTING(     10, FULL,     10baseT_Full		),
 	PHY_SETTING(     10, HALF,     10baseT_Half		),
include/uapi/linux/ethtool.h +2 -0
index b4f2d134e713..9ca87bc73c44 100644
@@ -1617,6 +1617,8 @@ enum ethtool_link_mode_bit_indices {
 	ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87,
 	ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT	 = 88,
 	ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT	 = 89,
+	ETHTOOL_LINK_MODE_100baseFX_Half_BIT		 = 90,
+	ETHTOOL_LINK_MODE_100baseFX_Full_BIT		 = 91,
 	/* must be last entry */
 	__ETHTOOL_LINK_MODE_MASK_NBITS
 };
net/ethtool/common.c +2 -0
index ed19573fccd7..24036e3055a1 100644
@@ -192,6 +192,8 @@ const char link_mode_names[][ETH_GSTRING_LEN] = {
 	__DEFINE_LINK_MODE_NAME(400000, LR4_ER4_FR4, Full),
 	__DEFINE_LINK_MODE_NAME(400000, DR4, Full),
 	__DEFINE_LINK_MODE_NAME(400000, CR4, Full),
+	__DEFINE_LINK_MODE_NAME(100, FX, Half),
+	__DEFINE_LINK_MODE_NAME(100, FX, Full),
 };
 static_assert(ARRAY_SIZE(link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS);
 
net/ethtool/linkmodes.c +2 -0
index 7044a2853886..29dcd675b65a 100644
@@ -272,6 +272,8 @@ static const struct link_mode_info link_mode_params[] = {
 	__DEFINE_LINK_MODE_PARAMS(400000, LR4_ER4_FR4, Full),
 	__DEFINE_LINK_MODE_PARAMS(400000, DR4, Full),
 	__DEFINE_LINK_MODE_PARAMS(400000, CR4, Full),
+	__DEFINE_LINK_MODE_PARAMS(100, FX, Half),
+	__DEFINE_LINK_MODE_PARAMS(100, FX, Full),
 };
 
 static const struct nla_policy
Signature · 1 line
2.28.0
author
#12 lore raw

PATCH 3/3 net: phy: dp83822: Update the fiber advertisement for speed

In reply to Dan Murphy

Update the fiber advertisement for speed and duplex modes with the 100base-FX full and half linkmode entries.

---
 drivers/net/phy/dp83822.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/phy/dp83822.c +10 -3
index 732c8bec7452..c162c9551bd1 100644
@@ -110,9 +110,8 @@
 #define DP83822_RX_ER_SHIFT	8
 
 #define MII_DP83822_FIBER_ADVERTISE    (ADVERTISED_TP | ADVERTISED_MII | \
-					ADVERTISED_FIBRE | ADVERTISED_BNC |  \
-					ADVERTISED_Pause | ADVERTISED_Asym_Pause | \
-					ADVERTISED_100baseT_Full)
+					ADVERTISED_FIBRE | \
+					ADVERTISED_Pause | ADVERTISED_Asym_Pause)
 
 struct dp83822_private {
 	bool fx_signal_det_low;
@@ -406,6 +405,14 @@ static int dp83822_config_init(struct phy_device *phydev)
 				 phydev->supported);
 		linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT,
 				 phydev->advertising);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Full_BIT,
+				 phydev->supported);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Half_BIT,
+				 phydev->supported);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Full_BIT,
+				 phydev->advertising);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Half_BIT,
+				 phydev->advertising);
 
 		/* Auto neg is not supported in fiber mode */
 		bmcr = phy_read(phydev, MII_BMCR);
Signature · 1 line
2.28.0
author
#7 lore raw

PATCH 2/3 net: dp83869: Add ability to advertise Fiber connection

In reply to Dan Murphy

Add the ability to advertise the Fiber connection if the strap or the op-mode is configured for 100Base-FX.

Auto negotiation is not supported on this PHY when in fiber mode.

---
 drivers/net/phy/dp83869.c | 73 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
drivers/net/phy/dp83869.c +73 -0
index 6b98d74b5102..81899bc99add 100644
@@ -52,6 +52,10 @@
 					 BMCR_FULLDPLX | \
 					 BMCR_SPEED1000)
 
+#define MII_DP83869_FIBER_ADVERTISE    (ADVERTISED_FIBRE | \
+					ADVERTISED_Pause | \
+					ADVERTISED_Asym_Pause)
+
 /* This is the same bit mask as the BMCR so re-use the BMCR default */
 #define DP83869_FX_CTRL_DEFAULT	MII_DP83869_BMCR_DEFAULT
 
@@ -118,6 +122,28 @@ struct dp83869_private {
 	int mode;
 };
 
+static int dp83869_read_status(struct phy_device *phydev)
+{
+	struct dp83869_private *dp83869 = phydev->priv;
+	int ret;
+
+	ret = genphy_read_status(phydev);
+	if (ret)
+		return ret;
+
+	if (linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, phydev->supported)) {
+		if (phydev->link) {
+			if (dp83869->mode == DP83869_RGMII_100_BASE)
+				phydev->speed = SPEED_100;
+		} else {
+			phydev->speed = SPEED_UNKNOWN;
+			phydev->duplex = DUPLEX_UNKNOWN;
+		}
+	}
+
+	return 0;
+}
+
 static int dp83869_ack_interrupt(struct phy_device *phydev)
 {
 	int err = phy_read(phydev, MII_DP83869_ISR);
@@ -295,6 +321,51 @@ static int dp83869_configure_rgmii(struct phy_device *phydev,
 	return ret;
 }
 
+static int dp83869_configure_fiber(struct phy_device *phydev,
+				   struct dp83869_private *dp83869)
+{
+	int bmcr;
+	int ret;
+
+	/* Only allow advertising what this PHY supports */
+	linkmode_and(phydev->advertising, phydev->advertising,
+		     phydev->supported);
+
+	linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, phydev->supported);
+	linkmode_set_bit(ADVERTISED_FIBRE, phydev->advertising);
+
+	if (dp83869->mode == DP83869_RGMII_1000_BASE) {
+		linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
+				 phydev->supported);
+	} else {
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Full_BIT,
+				 phydev->supported);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Half_BIT,
+				 phydev->supported);
+
+		/* Auto neg is not supported in 100base FX mode */
+		bmcr = phy_read(phydev, MII_BMCR);
+		if (bmcr < 0)
+			return bmcr;
+
+		phydev->autoneg = AUTONEG_DISABLE;
+		linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported);
+		linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->advertising);
+
+		if (bmcr & BMCR_ANENABLE) {
+			ret =  phy_modify(phydev, MII_BMCR, BMCR_ANENABLE, 0);
+			if (ret < 0)
+				return ret;
+		}
+	}
+
+	/* Update advertising from supported */
+	linkmode_or(phydev->advertising, phydev->advertising,
+		    phydev->supported);
+
+	return 0;
+}
+
 static int dp83869_configure_mode(struct phy_device *phydev,
 				  struct dp83869_private *dp83869)
 {
@@ -384,6 +455,7 @@ static int dp83869_configure_mode(struct phy_device *phydev,
 		break;
 	case DP83869_RGMII_1000_BASE:
 	case DP83869_RGMII_100_BASE:
+		ret = dp83869_configure_fiber(phydev, dp83869);
 		break;
 	default:
 		return -EINVAL;
@@ -494,6 +566,7 @@ static struct phy_driver dp83869_driver[] = {
 		/* IRQ related */
 		.ack_interrupt	= dp83869_ack_interrupt,
 		.config_intr	= dp83869_config_intr,
+		.read_status	= dp83869_read_status,
 
 		.suspend	= genphy_suspend,
 		.resume		= genphy_resume,
Signature · 1 line
2.28.0

Dan Murphy

author
#0 lore raw

cover 100base Fx link modes

Hello

As per patch https://lore.kernel.org/patchwork/patch/1300241/ the link modes for 100base FX full and half duplex modes did not exist. Adding these link modes to the core and ethtool allow devices like the DP83822, DP83869 and Broadcomm PHYs to properly advertise the correct mode for Fiber 100Mbps.

Corresponding user land ethtool patches are available but rely on these patches to be applied first.

Dan

Dan Murphy (3):
ethtool: Add 100base-FX link mode entries
net: dp83869: Add ability to advertise Fiber connection
net: phy: dp83822: Update the fiber advertisement for speed

 drivers/net/phy/dp83822.c    | 13 +++++--
 drivers/net/phy/dp83869.c    | 73 ++++++++++++++++++++++++++++++++++++
 drivers/net/phy/phy-core.c   |  4 +-
 include/uapi/linux/ethtool.h |  2 +
 net/ethtool/common.c         |  2 +
 net/ethtool/linkmodes.c      |  2 +
 6 files changed, 92 insertions(+), 4 deletions(-)
Signature · 1 line
2.28.0
maintainer
#2 lore raw

Re: [PATCH net-next 1/3] ethtool: Add 100base-FX link mode entries

In reply to Dan Murphy

drivers/net/phy/phy-core.c static const struct phy_setting settings[] = { · line 164

Quoted 6 lines · Dan Murphy
drivers/net/phy/phy-core.c +2 -0
@@ -160,6 +160,8 @@ static const struct phy_setting settings[] = {
 	PHY_SETTING(    100, FULL,    100baseT_Full		),
 	PHY_SETTING(    100, FULL,    100baseT1_Full		),
 	PHY_SETTING(    100, HALF,    100baseT_Half		),
+	PHY_SETTING(    100, HALF,    100baseFX_Half		),
+	PHY_SETTING(    100, FULL,    100baseFX_Full		),

Hi Dan

Does 100baseFX_Half make an sense? My understanding of 802.3 section 26 is that it is always a pair, not a single fibre where you might need CSMA/CD?

Andrew

maintainer
#8 lore raw

Re: [PATCH net-next 2/3] net: dp83869: Add ability to advertise Fiber connection

In reply to Dan Murphy

drivers/net/phy/dp83869.c static int dp83869_configure_rgmii(struct phy_device *phydev, · line 346

Quoted 6 lines
drivers/net/phy/dp83869.c +6 -0
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Full_BIT,
+				 phydev->supported);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Half_BIT,
+				 phydev->supported);
+
+		/* Auto neg is not supported in 100base FX mode */

Hi Dan

If it does not support auto neg, how do you decide to do half duplex? I don't see any code here which allows the user to configure it.

Andrew

maintainer
#4 lore raw

Re: [PATCH net-next 1/3] ethtool: Add 100base-FX link mode entries

In reply to Dan Murphy
Quoted 13 lines · Dan Murphy

Add entries for the 100base-FX full and half duplex supported modes.

$ ethtool eth0
        Supported ports: [ TP    MII     FIBRE ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                100baseFX/Half 100baseFX/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                100baseFX/Half 100baseFX/Full

I thought this PHY could not switch between TP and Fibre. It has a strap which decides? So i would expect the supported modes to be either BaseT or BaseFX. Not both. Same for Advertised?

Andrew

author
#3 lore raw

Re: [PATCH net-next 1/3] ethtool: Add 100base-FX link mode entries

In reply to Andrew Lunn

Andrew

Quoted 9 lines · Andrew Lunn

drivers/net/phy/phy-core.c static const struct phy_setting settings[] = { · line 164

Quoted 6 lines · Dan Murphy
drivers/net/phy/phy-core.c +2 -0
@@ -160,6 +160,8 @@ static const struct phy_setting settings[] = {
  	PHY_SETTING(    100, FULL,    100baseT_Full		),
  	PHY_SETTING(    100, FULL,    100baseT1_Full		),
  	PHY_SETTING(    100, HALF,    100baseT_Half		),
+	PHY_SETTING(    100, HALF,    100baseFX_Half		),
+	PHY_SETTING(    100, FULL,    100baseFX_Full		),

Hi Dan

Quoted 3 lines

Does 100baseFX_Half make an sense? My understanding of 802.3 section 26 is that it is always a pair, not a single fibre where you might need CSMA/CD?

I actually questioned that too and looked it up

I found these and thought they could be viable

http://www.certiology.com/tech-terms/network/100base-fx.html

"The 100Base-FX can be used in a maximum length of 412 meters if being used in

half-duplex connections or as 2 kilometer lengths in the case of full-duplex transmissions over optical fiber."

https://www.cnet.com/products/half-duplex-100basefx-interface-pb7/

Of course I never have seen one myself

Dan

Quoted 1 line

Andrew

author
#5 lore raw

Re: [PATCH net-next 1/3] ethtool: Add 100base-FX link mode entries

In reply to Andrew Lunn

Andrew

Quoted 14 lines · Andrew Lunn
Quoted 13 lines · Dan Murphy

Add entries for the 100base-FX full and half duplex supported modes.

$ ethtool eth0
         Supported ports: [ TP    MII     FIBRE ]
         Supported link modes:   10baseT/Half 10baseT/Full
                                 100baseT/Half 100baseT/Full
                                 100baseFX/Half 100baseFX/Full
         Supported pause frame use: Symmetric Receive-only
         Supports auto-negotiation: No
         Supported FEC modes: Not reported
         Advertised link modes:  10baseT/Half 10baseT/Full
                                 100baseT/Half 100baseT/Full
                                 100baseFX/Half 100baseFX/Full
Quoted 5 lines

I thought this PHY could not switch between TP and Fibre. It has a strap which decides? So i would expect the supported modes to be either BaseT or BaseFX. Not both. Same for Advertised?

Andrew

I found that the phy-device was setting all these bits in phy_init in features_init.

My first pass was to clear all these bits as well because the PHY was still advertising these modes.

But you are right this PHY cannot switch without strapping.

I can clear these bits.

Dan

author
#9 lore raw

Re: [PATCH net-next 2/3] net: dp83869: Add ability to advertise Fiber connection

In reply to Andrew Lunn

Andrew

Quoted 10 lines · Andrew Lunn

drivers/net/phy/dp83869.c static int dp83869_configure_rgmii(struct phy_device *phydev, · line 346

Quoted 6 lines
drivers/net/phy/dp83869.c +6 -0
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Full_BIT,
+				 phydev->supported);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Half_BIT,
+				 phydev->supported);
+
+		/* Auto neg is not supported in 100base FX mode */

Hi Dan

If it does not support auto neg, how do you decide to do half duplex? I don't see any code here which allows the user to configure it.

Ethtool has the provisions to set the duplex and speed right?.

The only call back I see which is valid is config_aneg which would still require a user space tool to set the needed link modes.

I could implement the config_aneg to call genphy_setup_forced if auto neg is disabled but that function just writes the BMCR which is already updated and if auto neg is enabled it would just call genphy_check_and_restart_aneg.

I verified the ethtool path with the DP83822 by reading the BMCR and ethtool displayed the correct advertisement

root@am335x-evm:~# ethtool -s eth0 speed 100 duplex full
root@am335x-evm:~# ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII FIBRE ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  100baseT/Full

<snip>

root@am335x-evm:~# ethtool -s eth0 speed 10 duplex half
root@am335x-evm:~# ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII FIBRE ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half
root@am335x-evm:~# ./mdio-test g eth0 0
0x0000
root@am335x-evm:~# ethtool -s eth0 speed 100 duplex full
root@am335x-evm:~# ./mdio-test g eth0 0
0x2100
root@am335x-evm:~# ethtool -s eth0 speed 10 duplex half
root@am335x-evm:~# ./mdio-test g eth0 0
0x0000
root@am335x-evm:~# ethtool -s eth0 speed 10 duplex full
root@am335x-evm:~# ./mdio-test g eth0 0
0x0100
root@am335x-evm:~# ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII FIBRE ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Full

Dan

maintainer
#10 lore raw

Re: [PATCH net-next 2/3] net: dp83869: Add ability to advertise Fiber connection

Quoted 11 lines · Dan Murphy

Andrew

Quoted 8 lines · Andrew Lunn

drivers/net/phy/dp83869.c static int dp83869_configure_rgmii(struct phy_device *phydev, · line 346

Quoted 6 lines
drivers/net/phy/dp83869.c +6 -0
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Full_BIT,
+				 phydev->supported);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Half_BIT,
+				 phydev->supported);
+
+		/* Auto neg is not supported in 100base FX mode */

Hi Dan

Quoted 4 lines
Quoted 2 lines

If it does not support auto neg, how do you decide to do half duplex? I don't see any code here which allows the user to configure it.

Ethtool has the provisions to set the duplex and speed right?.

What i'm getting at is you say you support ETHTOOL_LINK_MODE_100baseFX_Full_BIT & ETHTOOL_LINK_MODE_100baseFX_Half_BIT. If there is no auto neg in FX mode, i'm questioning how these two different modes code be used? I'm guessing the PHY defaults to ETHTOOL_LINK_MODE_100baseFX_Full_BIT? How does the user set it to ETHTOOL_LINK_MODE_100baseFX_Half_BIT?

Quoted 2 lines

The only call back I see which is valid is config_aneg which would still require a user space tool to set the needed link modes.

Correct. Maybe all you need to do is point me at the code in the driver which actually sets the PHY into half duplex in FX mode when the user asks for it. Is it just clearing BMCR_FULLDPLX?

Andrew

author
#6 lore raw

Re: [PATCH net-next 1/3] ethtool: Add 100base-FX link mode entries

In reply to Dan Murphy

Andrew

Quoted 23 lines · Dan Murphy

Andrew

Quoted 14 lines · Andrew Lunn
Quoted 13 lines · Dan Murphy

Add entries for the 100base-FX full and half duplex supported modes.

$ ethtool eth0
         Supported ports: [ TP    MII     FIBRE ]
         Supported link modes:   10baseT/Half 10baseT/Full
                                 100baseT/Half 100baseT/Full
                                 100baseFX/Half 100baseFX/Full
         Supported pause frame use: Symmetric Receive-only
         Supports auto-negotiation: No
         Supported FEC modes: Not reported
         Advertised link modes:  10baseT/Half 10baseT/Full
                                 100baseT/Half 100baseT/Full
                                 100baseFX/Half 100baseFX/Full
Quoted 5 lines

I thought this PHY could not switch between TP and Fibre. It has a strap which decides? So i would expect the supported modes to be either BaseT or BaseFX. Not both. Same for Advertised?

        Andrew

Quoted 7 lines

I found that the phy-device was setting all these bits in phy_init in features_init.

My first pass was to clear all these bits as well because the PHY was still advertising these modes.

But you are right this PHY cannot switch without strapping.

I can clear these bits.

I re-read your reply and this is just an example.  This patch really has nothing to do with any PHY as it is just adding in the new link modes.

Unless you comment wanted me to remove the TP and advertised modes from the example in the commit message?

Dan

Quoted 3 lines

Dan

author
#11 lore raw

Re: [PATCH net-next 2/3] net: dp83869: Add ability to advertise Fiber connection

In reply to Andrew Lunn

Andrew

Quoted 14 lines · Andrew Lunn
Quoted 13 lines · Dan Murphy

Andrew

Quoted 10 lines · Andrew Lunn

drivers/net/phy/dp83869.c static int dp83869_configure_rgmii(struct phy_device *phydev, · line 346

Quoted 6 lines
drivers/net/phy/dp83869.c +6 -0
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Full_BIT,
+				 phydev->supported);
+		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseFX_Half_BIT,
+				 phydev->supported);
+
+		/* Auto neg is not supported in 100base FX mode */

Hi Dan

If it does not support auto neg, how do you decide to do half duplex? I don't see any code here which allows the user to configure it.

Quoted 7 lines
Quoted 1 line

Ethtool has the provisions to set the duplex and speed right?.

What i'm getting at is you say you support ETHTOOL_LINK_MODE_100baseFX_Full_BIT & ETHTOOL_LINK_MODE_100baseFX_Half_BIT. If there is no auto neg in FX mode, i'm questioning how these two different modes code be used? I'm guessing the PHY defaults to ETHTOOL_LINK_MODE_100baseFX_Full_BIT? How does the user set it to ETHTOOL_LINK_MODE_100baseFX_Half_BIT?

The user can use ethtool to set the speed and duplex. And ethtool uses the IOCTLs to configure the device.

So if the user creates their own HAL then they can use those IOCTLs as well.

The data sheet indicates

"In fiber mode, the speed is not
decided through auto-negotiation. Both sides of the link must be configured to the same operating speed."

Quoted 6 lines
Quoted 3 lines

The only call back I see which is valid is config_aneg which would still require a user space tool to set the needed link modes.

Correct. Maybe all you need to do is point me at the code in the driver which actually sets the PHY into half duplex in FX mode when the user asks for it. Is it just clearing BMCR_FULLDPLX?

Here is the full flow when setting the speed and duplex mode from the Ethtool or when the IOCTL's are called to update the PHY

phy_ethtool_ksettings_set updates the phydev->speed and phydev->duplex

Since Auto Neg is disabled the call to genphy_setup_forced is done in the __genphy_config_aneg in phy_device.

genphy_setup_forced updates the BMCR with the updated values.

So IMO there is no need to populate the config_aneg call back to

root@am335x-evm:~# ./ethtool -s eth0 speed 10 duplex half
[   92.098491] phy_ethtool_ksettings_set
[   92.102247] phy_ethtool_ksettings_set: speed 10 duplex 0
[   92.107755] phy_sanitize_settings
[   92.111085] phy_config_aneg
[   92.113930] genphy_config_aneg
[   92.116997] __genphy_config_aneg
[   92.120237] genphy_setup_forced
[   92.123419] genphy_setup_forced: Update the BMCR
root@am335x-evm:~# ./ethtool -s eth0 speed 100 duplex full
[  102.693105] phy_ethtool_ksettings_set
[  102.697029] phy_ethtool_ksettings_set: speed 100 duplex 1
[  102.702462] phy_sanitize_settings
[  102.705892] phy_config_aneg
[  102.708702] genphy_config_aneg
[  102.711770] __genphy_config_aneg
[  102.715051] genphy_setup_forced
[  102.718209] genphy_setup_forced: Update the BMCR

I am hoping this answers your question.

Dan