* [PATCH net-next 1/1] net: dsa: fix fixed-link port registration
@ 2019-08-11 1:46 Marek Behún
2019-08-11 1:47 ` Marek Behun
0 siblings, 1 reply; 5+ messages in thread
From: Marek Behún @ 2019-08-11 1:46 UTC (permalink / raw)
To: netdev
Cc: Marek Behún, Heiner Kallweit, Sebastian Reichel,
Vivien Didelot, Andrew Lunn, Florian Fainelli, David S . Miller
Commit 88d6272acaaa ("net: phy: avoid unneeded MDIO reads in
genphy_read_status") broke fixed link DSA port registration in
dsa_port_fixed_link_register_of: the genphy_read_status does not do what
it is supposed to and the following adjust_link is given wrong
parameters.
This causes a regression on Turris Omnia, where the mvneta driver for
the interface connected to the switch reports crc errors, for some
reason.
I realize this fix is not ideal, something else could change in genphy
functions which could cause DSA fixed-link port to break again.
Hopefully DSA fixed-link port functionality will be converted to phylink
API soon.
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Cc: Vivien Didelot <vivien.didelot@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
---
net/dsa/port.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/dsa/port.c b/net/dsa/port.c
index 363eab6df51b..c424ebb373e1 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -485,6 +485,17 @@ static int dsa_port_fixed_link_register_of(struct dsa_port *dp)
phydev->interface = mode;
genphy_config_init(phydev);
+
+ /*
+ * Commit 88d6272acaaa caused genphy_read_status not to do it's work if
+ * autonegotiation is enabled and link status did not change. This is
+ * the case for fixed_phy. By setting phydev->link = 0 before the call
+ * to genphy_read_status we force it to read and fill in the parameters.
+ *
+ * Hopefully this dirty hack will be removed soon by converting DSA
+ * fixed link ports to phylink API.
+ */
+ phydev->link = 0;
genphy_read_status(phydev);
if (ds->ops->adjust_link)
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next 1/1] net: dsa: fix fixed-link port registration
2019-08-11 1:46 [PATCH net-next 1/1] net: dsa: fix fixed-link port registration Marek Behún
@ 2019-08-11 1:47 ` Marek Behun
2019-08-11 2:02 ` Marek Behun
0 siblings, 1 reply; 5+ messages in thread
From: Marek Behun @ 2019-08-11 1:47 UTC (permalink / raw)
To: netdev
Cc: Heiner Kallweit, Sebastian Reichel, Vivien Didelot, Andrew Lunn,
Florian Fainelli, David S . Miller
This should probably go into stable as well, after review.
Marek
On Sun, 11 Aug 2019 03:46:50 +0200
Marek Behún <marek.behun@nic.cz> wrote:
> Commit 88d6272acaaa ("net: phy: avoid unneeded MDIO reads in
> genphy_read_status") broke fixed link DSA port registration in
> dsa_port_fixed_link_register_of: the genphy_read_status does not do what
> it is supposed to and the following adjust_link is given wrong
> parameters.
>
> This causes a regression on Turris Omnia, where the mvneta driver for
> the interface connected to the switch reports crc errors, for some
> reason.
>
> I realize this fix is not ideal, something else could change in genphy
> functions which could cause DSA fixed-link port to break again.
> Hopefully DSA fixed-link port functionality will be converted to phylink
> API soon.
>
> Signed-off-by: Marek Behún <marek.behun@nic.cz>
> Cc: Heiner Kallweit <hkallweit1@gmail.com>
> Cc: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> Cc: Vivien Didelot <vivien.didelot@gmail.com>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: David S. Miller <davem@davemloft.net>
> ---
> net/dsa/port.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index 363eab6df51b..c424ebb373e1 100644
> --- a/net/dsa/port.c
> +++ b/net/dsa/port.c
> @@ -485,6 +485,17 @@ static int dsa_port_fixed_link_register_of(struct dsa_port *dp)
> phydev->interface = mode;
>
> genphy_config_init(phydev);
> +
> + /*
> + * Commit 88d6272acaaa caused genphy_read_status not to do it's work if
> + * autonegotiation is enabled and link status did not change. This is
> + * the case for fixed_phy. By setting phydev->link = 0 before the call
> + * to genphy_read_status we force it to read and fill in the parameters.
> + *
> + * Hopefully this dirty hack will be removed soon by converting DSA
> + * fixed link ports to phylink API.
> + */
> + phydev->link = 0;
> genphy_read_status(phydev);
>
> if (ds->ops->adjust_link)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net-next 1/1] net: dsa: fix fixed-link port registration
2019-08-11 1:47 ` Marek Behun
@ 2019-08-11 2:02 ` Marek Behun
2019-08-11 3:00 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Marek Behun @ 2019-08-11 2:02 UTC (permalink / raw)
To: netdev
Cc: Heiner Kallweit, Sebastian Reichel, Vivien Didelot, Andrew Lunn,
Florian Fainelli, David S . Miller
Which means I should have added the Fixes tag /o\
On Sun, 11 Aug 2019 03:47:42 +0200
Marek Behun <marek.behun@nic.cz> wrote:
> This should probably go into stable as well, after review.
>
> Marek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/1] net: dsa: fix fixed-link port registration
2019-08-11 2:02 ` Marek Behun
@ 2019-08-11 3:00 ` David Miller
2019-08-11 3:19 ` Marek Behun
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2019-08-11 3:00 UTC (permalink / raw)
To: marek.behun
Cc: netdev, hkallweit1, sebastian.reichel, vivien.didelot, andrew,
f.fainelli
From: Marek Behun <marek.behun@nic.cz>
Date: Sun, 11 Aug 2019 04:02:47 +0200
> Which means I should have added the Fixes tag /o\
Which means you need to repost this patch with it added.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/1] net: dsa: fix fixed-link port registration
2019-08-11 3:00 ` David Miller
@ 2019-08-11 3:19 ` Marek Behun
0 siblings, 0 replies; 5+ messages in thread
From: Marek Behun @ 2019-08-11 3:19 UTC (permalink / raw)
To: David Miller
Cc: netdev, hkallweit1, sebastian.reichel, vivien.didelot, andrew,
f.fainelli
On Sat, 10 Aug 2019 20:00:01 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Marek Behun <marek.behun@nic.cz>
> Date: Sun, 11 Aug 2019 04:02:47 +0200
>
> > Which means I should have added the Fixes tag /o\
>
> Which means you need to repost this patch with it added.
Sent as v2
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-08-11 3:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-11 1:46 [PATCH net-next 1/1] net: dsa: fix fixed-link port registration Marek Behún
2019-08-11 1:47 ` Marek Behun
2019-08-11 2:02 ` Marek Behun
2019-08-11 3:00 ` David Miller
2019-08-11 3:19 ` Marek Behun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).