From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Vivien Didelot <vivien.didelot@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Ioana Ciornei <ioana.ciornei@nxp.com>,
Vladimir Oltean <olteanv@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH net] net: dsa: fix phylink_start()/phylink_stop() calls
Date: Sat, 29 Feb 2020 16:45:39 +0000 [thread overview]
Message-ID: <20200229164538.GB25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200229154215.GD6305@lunn.ch>
On Sat, Feb 29, 2020 at 04:42:15PM +0100, Andrew Lunn wrote:
> > -int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy)
> > +int dsa_port_enable_locked(struct dsa_port *dp, struct phy_device *phy)
> > {
> > struct dsa_switch *ds = dp->ds;
> > int port = dp->index;
> > int err;
> >
> > + if (dp->pl)
> > + phylink_start(dp->pl);
> > +
> > if (ds->ops->port_enable) {
> > err = ds->ops->port_enable(ds, port, phy);
> > if (err)
> > @@ -81,7 +84,18 @@ int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy)
> > return 0;
> > }
>
> Hi Russell
>
> I'm wondering about the order here. You are starting phylink before
> the port is actually enabled in the hardware. Could phylink_start()
> result in synchronous calls into the MAC to configure the port?
Yes, that's possible.
> If the port is disabled, maybe that configuration will not stick?
No idea...
> The current code in dsa_slave_open() first enables the port, then
> calls phylink_start(). So maybe we should keep the ordering the same?
However, dsa_port_setup() does it in the reverse order, so it was a
bit of guess work which is right. So, if the port needs to be enabled
first, then the dsa_port_setup() path for DSA and CPU ports is wrong.
It's not clear what dsa_port_enable() actually does, and should a port
be enabled before its interface mode and link parameters have been
set?
> > +void dsa_port_disable_locked(struct dsa_port *dp)
> > {
> > struct dsa_switch *ds = dp->ds;
> > int port = dp->index;
> > @@ -91,6 +105,16 @@ void dsa_port_disable(struct dsa_port *dp)
> >
> > if (ds->ops->port_disable)
> > ds->ops->port_disable(ds, port);
> > +
> > + if (dp->pl)
> > + phylink_stop(dp->pl);
> > +}
>
> The current code first stops phylink, then disables the port...
It depends what order is the correct one, which depends on what
port_disable() does vs phylink_stop(), and whether the network
queues should be stopped before or after port_disable().
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
next prev parent reply other threads:[~2020-02-29 16:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 19:39 [PATCH net] net: dsa: fix phylink_start()/phylink_stop() calls Russell King
2020-02-29 0:46 ` Vladimir Oltean
2020-02-29 15:42 ` Andrew Lunn
2020-02-29 16:45 ` Russell King - ARM Linux admin [this message]
2020-02-29 17:06 ` Andrew Lunn
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=20200229164538.GB25745@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).