All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Russell King <rmk+kernel@armlinux.org.uk>
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:42:15 +0100	[thread overview]
Message-ID: <20200229154215.GD6305@lunn.ch> (raw)
In-Reply-To: <E1j7lU0-0003pp-Ff@rmk-PC.armlinux.org.uk>

> -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? If the
port is disabled, maybe that configuration will not stick?

The current code in dsa_slave_open() first enables the port, then
calls phylink_start(). So maybe we should keep the ordering the same?
  
> +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...

Apart from this ordering issue, the code looks good.

Thanks
    Andrew

  parent reply	other threads:[~2020-02-29 15:42 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 [this message]
2020-02-29 16:45   ` Russell King - ARM Linux admin
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=20200229154215.GD6305@lunn.ch \
    --to=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=rmk+kernel@armlinux.org.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.