* [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
@ 2024-12-19 17:38 A. Sverdlin
2024-12-19 17:46 ` Vladimir Oltean
2024-12-19 17:46 ` Andrew Lunn
0 siblings, 2 replies; 9+ messages in thread
From: A. Sverdlin @ 2024-12-19 17:38 UTC (permalink / raw)
To: netdev; +Cc: Alexander Sverdlin, Andrew Lunn, Vladimir Oltean
From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
If the PHYs on user ports are not specified explicitly, but a common
user_mii_bus is being registered and scanned there is no way to limit
Auto Negotiation options currently. If a gigabit switch is deployed in a
way that the ports cannot support gigabit rates (4-wire PCB/magnetics,
for instance), there is no way to limit ports' AN not to advertise gigabit
options. Some PHYs take considerably longer time to AutoNegotiate in such
cases.
Provide a way to limit AN advertisement options by examining "max-speed"
property in the DT node of the corresponding user port and call
phy_set_max_speed() right before attaching the PHY to he port netdevice.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
net/dsa/user.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/dsa/user.c b/net/dsa/user.c
index 4a8de48a6f24..9e3f5b0f9af3 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -2625,6 +2625,13 @@ static int dsa_user_phy_connect(struct net_device *user_dev, int addr,
user_dev->phydev->dev_flags |= flags;
+ if (dp->dn) {
+ u32 max_speed;
+
+ if (!of_property_read_u32(dp->dn, "max-speed", &max_speed))
+ phy_set_max_speed(user_dev->phydev, max_speed);
+ }
+
return phylink_connect_phy(dp->pl, user_dev->phydev);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
2024-12-19 17:38 [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports A. Sverdlin
@ 2024-12-19 17:46 ` Vladimir Oltean
2024-12-19 18:50 ` Sverdlin, Alexander
2024-12-19 17:46 ` Andrew Lunn
1 sibling, 1 reply; 9+ messages in thread
From: Vladimir Oltean @ 2024-12-19 17:46 UTC (permalink / raw)
To: A. Sverdlin; +Cc: netdev, Andrew Lunn
On Thu, Dec 19, 2024 at 06:38:01PM +0100, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
>
> If the PHYs on user ports are not specified explicitly, but a common
> user_mii_bus is being registered and scanned there is no way to limit
> Auto Negotiation options currently. If a gigabit switch is deployed in a
> way that the ports cannot support gigabit rates (4-wire PCB/magnetics,
> for instance), there is no way to limit ports' AN not to advertise gigabit
> options. Some PHYs take considerably longer time to AutoNegotiate in such
> cases.
>
> Provide a way to limit AN advertisement options by examining "max-speed"
> property in the DT node of the corresponding user port and call
> phy_set_max_speed() right before attaching the PHY to he port netdevice.
>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
The user_mii_bus mechanism is redundant when we have device tree
available (as opposed to probing on platform data), let's not make it
even more redundant. Why don't you just declare the MDIO bus in the
device tree, with the PHYs on it, and place max-speed there?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
2024-12-19 17:38 [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports A. Sverdlin
2024-12-19 17:46 ` Vladimir Oltean
@ 2024-12-19 17:46 ` Andrew Lunn
1 sibling, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2024-12-19 17:46 UTC (permalink / raw)
To: A. Sverdlin; +Cc: netdev, Vladimir Oltean
On Thu, Dec 19, 2024 at 06:38:01PM +0100, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
>
> If the PHYs on user ports are not specified explicitly, but a common
> user_mii_bus is being registered and scanned there is no way to limit
> Auto Negotiation options currently.
Please could you expand on this. This sounds like a reason you would
want to explicitly list the PHY on an MDIO bus so that you can use the
max-speed property in the PHY node.
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
2024-12-19 17:46 ` Vladimir Oltean
@ 2024-12-19 18:50 ` Sverdlin, Alexander
2024-12-19 19:36 ` Vladimir Oltean
0 siblings, 1 reply; 9+ messages in thread
From: Sverdlin, Alexander @ 2024-12-19 18:50 UTC (permalink / raw)
To: olteanv@gmail.com, andrew@lunn.ch; +Cc: netdev@vger.kernel.org
Hello Vladimir, Andrew,
thanks for the quick feedback!
On Thu, 2024-12-19 at 19:46 +0200, Vladimir Oltean wrote:
> On Thu, Dec 19, 2024 at 06:38:01PM +0100, A. Sverdlin wrote:
> > From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> >
> > If the PHYs on user ports are not specified explicitly, but a common
> > user_mii_bus is being registered and scanned there is no way to limit
> > Auto Negotiation options currently. If a gigabit switch is deployed in a
> > way that the ports cannot support gigabit rates (4-wire PCB/magnetics,
> > for instance), there is no way to limit ports' AN not to advertise gigabit
> > options. Some PHYs take considerably longer time to AutoNegotiate in such
> > cases.
> >
> > Provide a way to limit AN advertisement options by examining "max-speed"
> > property in the DT node of the corresponding user port and call
> > phy_set_max_speed() right before attaching the PHY to he port netdevice.
> >
> > Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> > ---
>
> The user_mii_bus mechanism is redundant when we have device tree
> available (as opposed to probing on platform data), let's not make it
> even more redundant. Why don't you just declare the MDIO bus in the
> device tree, with the PHYs on it, and place max-speed there?
There are still switch drivers in tree, which only implement .phy_read/.phy_write
callbacks (which means, they rely on .user_mii_bus ?), even gigabit-capable,
such as vsc73xx, rtl8365mb, rtl8366rb... But I'm actually interested in an
out of tree driver for a new generation of lantiq_gsw hardware, under
Maxlinear branch, which is planned to be submitted upstream at some point.
The relevant question is then, is it acceptable API (.phy_read/.phy_write),
or any new gigabit-capable driver must use some form of mdiobus_register
to populate the MDIO bus explicitly itself?
--
Alexander Sverdlin
Siemens AG
www.siemens.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
2024-12-19 18:50 ` Sverdlin, Alexander
@ 2024-12-19 19:36 ` Vladimir Oltean
2024-12-20 7:17 ` Sverdlin, Alexander
0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Oltean @ 2024-12-19 19:36 UTC (permalink / raw)
To: Sverdlin, Alexander; +Cc: andrew@lunn.ch, netdev@vger.kernel.org
On Thu, Dec 19, 2024 at 06:50:18PM +0000, Sverdlin, Alexander wrote:
> There are still switch drivers in tree, which only implement .phy_read/.phy_write
> callbacks (which means, they rely on .user_mii_bus ?), even gigabit-capable,
> such as vsc73xx, rtl8365mb, rtl8366rb... But I'm actually interested in an
> out of tree driver for a new generation of lantiq_gsw hardware, under
> Maxlinear branch, which is planned to be submitted upstream at some point.
>
> The relevant question is then, is it acceptable API (.phy_read/.phy_write),
> or any new gigabit-capable driver must use some form of mdiobus_register
> to populate the MDIO bus explicitly itself?
See the documentation patches which I never managed to finish for general
future directions:
https://patchwork.kernel.org/project/netdevbpf/patch/20231208193518.2018114-4-vladimir.oltean@nxp.com/
Not explicitly having a phy-handle should be seen a legacy feature,
which we are forced to keep for compatibility with existing drivers.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
2024-12-19 19:36 ` Vladimir Oltean
@ 2024-12-20 7:17 ` Sverdlin, Alexander
2024-12-20 7:30 ` Sverdlin, Alexander
2024-12-20 10:15 ` Vladimir Oltean
0 siblings, 2 replies; 9+ messages in thread
From: Sverdlin, Alexander @ 2024-12-20 7:17 UTC (permalink / raw)
To: olteanv@gmail.com, andrew@lunn.ch; +Cc: netdev@vger.kernel.org
Hi Vladimir!
On Thu, 2024-12-19 at 21:36 +0200, Vladimir Oltean wrote:
> On Thu, Dec 19, 2024 at 06:50:18PM +0000, Sverdlin, Alexander wrote:
> > There are still switch drivers in tree, which only implement .phy_read/.phy_write
> > callbacks (which means, they rely on .user_mii_bus ?), even gigabit-capable,
> > such as vsc73xx, rtl8365mb, rtl8366rb... But I'm actually interested in an
> > out of tree driver for a new generation of lantiq_gsw hardware, under
> > Maxlinear branch, which is planned to be submitted upstream at some point.
> >
> > The relevant question is then, is it acceptable API (.phy_read/.phy_write),
> > or any new gigabit-capable driver must use some form of mdiobus_register
> > to populate the MDIO bus explicitly itself?
>
> See the documentation patches which I never managed to finish for general
> future directions:
> https://patchwork.kernel.org/project/netdevbpf/patch/20231208193518.2018114-4-vladimir.oltean@nxp.com/
>
> Not explicitly having a phy-handle should be seen a legacy feature,
> which we are forced to keep for compatibility with existing drivers.
Thanks for the references!
I've complitely missed the story of
fe7324b93222 ("net: dsa: OF-ware slave_mii_bus")
vs ae94dc25fd73
("net: dsa: remove OF-based MDIO bus registration from DSA core").
But I'm still having hard time to get the motivation behind removing
2 function calls from the DSA core and forcing all individual DSA drivers
to have this very same boilerplate...
But well, if all the DSA maintainers are so committed to it, this answers
my original question... Please ignore the patch!
--
Alexander Sverdlin
Siemens AG
www.siemens.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
2024-12-20 7:17 ` Sverdlin, Alexander
@ 2024-12-20 7:30 ` Sverdlin, Alexander
2024-12-20 8:28 ` Andrew Lunn
2024-12-20 10:15 ` Vladimir Oltean
1 sibling, 1 reply; 9+ messages in thread
From: Sverdlin, Alexander @ 2024-12-20 7:30 UTC (permalink / raw)
To: olteanv@gmail.com, andrew@lunn.ch; +Cc: netdev@vger.kernel.org
Hi Vladimir!
On Fri, 2024-12-20 at 08:17 +0100, Alexander Sverdlin wrote:
> > On Thu, Dec 19, 2024 at 06:50:18PM +0000, Sverdlin, Alexander wrote:
> > > There are still switch drivers in tree, which only implement .phy_read/.phy_write
> > > callbacks (which means, they rely on .user_mii_bus ?), even gigabit-capable,
> > > such as vsc73xx, rtl8365mb, rtl8366rb... But I'm actually interested in an
> > > out of tree driver for a new generation of lantiq_gsw hardware, under
> > > Maxlinear branch, which is planned to be submitted upstream at some point.
> > >
> > > The relevant question is then, is it acceptable API (.phy_read/.phy_write),
> > > or any new gigabit-capable driver must use some form of mdiobus_register
> > > to populate the MDIO bus explicitly itself?
> >
> > See the documentation patches which I never managed to finish for general
> > future directions:
> > https://patchwork.kernel.org/project/netdevbpf/patch/20231208193518.2018114-4-vladimir.oltean@nxp.com/
> >
> > Not explicitly having a phy-handle should be seen a legacy feature,
> > which we are forced to keep for compatibility with existing drivers.
>
> Thanks for the references!
>
> I've complitely missed the story of
> fe7324b93222 ("net: dsa: OF-ware slave_mii_bus")
> vs ae94dc25fd73
> ("net: dsa: remove OF-based MDIO bus registration from DSA core").
>
> But I'm still having hard time to get the motivation behind removing
> 2 function calls from the DSA core and forcing all individual DSA drivers
> to have this very same boilerplate...
>
> But well, if all the DSA maintainers are so committed to it, this answers
> my original question... Please ignore the patch!
However, after reading the whole referenced thread, I still have a question:
will MFD approach (with both drivers and dt-bindings) will be a requirement
for any new drivers or a simpler approach with "mdio {}" node under the
switch node will still be acceptable?
--
Alexander Sverdlin
Siemens AG
www.siemens.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
2024-12-20 7:30 ` Sverdlin, Alexander
@ 2024-12-20 8:28 ` Andrew Lunn
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2024-12-20 8:28 UTC (permalink / raw)
To: Sverdlin, Alexander; +Cc: olteanv@gmail.com, netdev@vger.kernel.org
> However, after reading the whole referenced thread, I still have a question:
> will MFD approach (with both drivers and dt-bindings) will be a requirement
> for any new drivers or a simpler approach with "mdio {}" node under the
> switch node will still be acceptable?
There is a long history of MAC drivers having MDIO drivers embedded in
them. So i see no need for an MFD just to have an MDIO device. If
there are additional drivers, GPIO, I2C, etc, then an MFD makes sense.
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
2024-12-20 7:17 ` Sverdlin, Alexander
2024-12-20 7:30 ` Sverdlin, Alexander
@ 2024-12-20 10:15 ` Vladimir Oltean
1 sibling, 0 replies; 9+ messages in thread
From: Vladimir Oltean @ 2024-12-20 10:15 UTC (permalink / raw)
To: Sverdlin, Alexander; +Cc: andrew@lunn.ch, netdev@vger.kernel.org
On Fri, Dec 20, 2024 at 07:17:37AM +0000, Sverdlin, Alexander wrote:
> Thanks for the references!
>
> I've complitely missed the story of
> fe7324b93222 ("net: dsa: OF-ware slave_mii_bus")
> vs ae94dc25fd73
> ("net: dsa: remove OF-based MDIO bus registration from DSA core").
>
> But I'm still having hard time to get the motivation behind removing
> 2 function calls from the DSA core and forcing all individual DSA drivers
> to have this very same boilerplate...
>
> But well, if all the DSA maintainers are so committed to it, this answers
> my original question... Please ignore the patch!
My motivation is that as things stand, ds->ops->phy_read() and
ds->ops->phy_write() are just too attractive to implement, but lure
developers into an OF-unaware internal MDIO bus model which is just
redundant and provides less functionality compared to its OF-aware
counterpart. You can surely understand this if you look at what prompted
you to submit this patch.
As for the OF-aware MDIO bus, the idea would be for DSA to focus less on
imposing a device model, and more on just the Ethernet switch component.
I'm yet to be convinced that it's exactly DSA's business to assist with that.
Being slimmer helps. For example if somebody wanted to add ACPI bindings
for the DSA core, not having to think about MDIO as part of the core
bindings, but as a device specific thing, is a simplifying factor.
You're also exaggerating that all DSA switches have internal PHYs.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-12-20 10:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-19 17:38 [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports A. Sverdlin
2024-12-19 17:46 ` Vladimir Oltean
2024-12-19 18:50 ` Sverdlin, Alexander
2024-12-19 19:36 ` Vladimir Oltean
2024-12-20 7:17 ` Sverdlin, Alexander
2024-12-20 7:30 ` Sverdlin, Alexander
2024-12-20 8:28 ` Andrew Lunn
2024-12-20 10:15 ` Vladimir Oltean
2024-12-19 17:46 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox