public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Cc: Marek Beh__n <kabel@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH RFC net-next 3/6] net: dsa: sja1105: use .mac_select_pcs() interface
Date: Fri, 25 Feb 2022 12:39:13 +0200	[thread overview]
Message-ID: <20220225103913.abn4pc57ow6dy2m6@skbuf> (raw)
In-Reply-To: <E1nNGm6-00AOip-6r@rmk-PC.armlinux.org.uk>

On Thu, Feb 24, 2022 at 04:15:26PM +0000, Russell King (Oracle) wrote:
> Convert the PCS selection to use mac_select_pcs, which allows the PCS
> to perform any validation it needs, and removes the need to set the PCS
> in the mac_config() callback, delving into the higher DSA levels to do
> so.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

>  drivers/net/dsa/sja1105/sja1105_main.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
> index e278bd86e3c6..b5c36f808df1 100644
> --- a/drivers/net/dsa/sja1105/sja1105_main.c
> +++ b/drivers/net/dsa/sja1105/sja1105_main.c
> @@ -1358,18 +1358,16 @@ static int sja1105_adjust_port_config(struct sja1105_private *priv, int port,
>  	return sja1105_clocking_setup_port(priv, port);
>  }
>  
> -static void sja1105_mac_config(struct dsa_switch *ds, int port,
> -			       unsigned int mode,
> -			       const struct phylink_link_state *state)
> +static struct phylink_pcs *
> +sja1105_mac_select_pcs(struct dsa_switch *ds, int port, phy_interface_t iface)
>  {
> -	struct dsa_port *dp = dsa_to_port(ds, port);
>  	struct sja1105_private *priv = ds->priv;
> -	struct dw_xpcs *xpcs;
> -
> -	xpcs = priv->xpcs[port];
> +	struct dw_xpcs *xpcs = priv->xpcs[port];
>  
>  	if (xpcs)
> -		phylink_set_pcs(dp->pl, &xpcs->pcs);
> +		return &xpcs->pcs;
> +
> +	return NULL;
>  }
>  
>  static void sja1105_mac_link_down(struct dsa_switch *ds, int port,
> @@ -3137,7 +3135,7 @@ static const struct dsa_switch_ops sja1105_switch_ops = {
>  	.port_max_mtu		= sja1105_get_max_mtu,
>  	.phylink_get_caps	= sja1105_phylink_get_caps,
>  	.phylink_validate	= sja1105_phylink_validate,
> -	.phylink_mac_config	= sja1105_mac_config,

Deleting sja1105_mac_config() here is safe not because
phylink_mac_config() stops calling pl->mac_ops->mac_config(), but
because dsa_port_phylink_mac_config() first checks whether
ds->ops->phylink_mac_config is implemented, and that is purely an
artefact of providing a phylib-style ds->ops->adjust_link, right?

Maybe it's worth mentioning.

> +	.phylink_mac_select_pcs	= sja1105_mac_select_pcs,
>  	.phylink_mac_link_up	= sja1105_mac_link_up,
>  	.phylink_mac_link_down	= sja1105_mac_link_down,
>  	.get_strings		= sja1105_get_strings,
> -- 
> 2.30.2
> 


  reply	other threads:[~2022-02-25 10:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24 16:14 [PATCH RFC net-next 0/6] net: dsa: sja1105: phylink updates Russell King (Oracle)
2022-02-24 16:15 ` [PATCH RFC net-next 1/6] net: dsa: sja1105: populate supported_interfaces Russell King (Oracle)
2022-02-25 10:18   ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 2/6] net: dsa: sja1105: remove interface checks Russell King (Oracle)
2022-02-25 10:20   ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 3/6] net: dsa: sja1105: use .mac_select_pcs() interface Russell King (Oracle)
2022-02-25 10:39   ` Vladimir Oltean [this message]
2022-02-25 10:57     ` Russell King (Oracle)
2022-02-25 11:25       ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 4/6] net: dsa: sja1105: mark as non-legacy Russell King (Oracle)
2022-02-25 10:40   ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 5/6] net: dsa: sja1105: convert to phylink_generic_validate() Russell King (Oracle)
2022-02-25 10:44   ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 6/6] net: dsa: sja1105: support switching between SGMII and 2500BASE-X Russell King (Oracle)
2022-02-25 11:16   ` Vladimir Oltean
2022-02-25 11:23     ` Russell King (Oracle)
2022-02-25 11:27       ` Vladimir Oltean

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=20220225103913.abn4pc57ow6dy2m6@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox