netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Cc: Ansuel Smith <ansuelsmth@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Vivien Didelot <vivien.didelot@gmail.com>
Subject: Re: [PATCH net-next v2 1/6] net: dsa: add support for phylink mac_select_pcs()
Date: Sat, 19 Feb 2022 23:12:41 +0200	[thread overview]
Message-ID: <20220219211241.beyajbwmuz7fg2bt@skbuf> (raw)
In-Reply-To: <E1nKlY3-009aKs-Oo@rmk-PC.armlinux.org.uk>

Hello,

On Thu, Feb 17, 2022 at 06:30:35PM +0000, Russell King (Oracle) wrote:
> Add DSA support for the phylink mac_select_pcs() method so DSA drivers
> can return provide phylink with the appropriate PCS for the PHY
> interface mode.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  include/net/dsa.h |  3 +++
>  net/dsa/port.c    | 15 +++++++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 85cb9aed4c51..87aef3ed88a7 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -788,6 +788,9 @@ struct dsa_switch_ops {
>  	void	(*phylink_validate)(struct dsa_switch *ds, int port,
>  				    unsigned long *supported,
>  				    struct phylink_link_state *state);
> +	struct phylink_pcs *(*phylink_mac_select_pcs)(struct dsa_switch *ds,
> +						      int port,
> +						      phy_interface_t iface);
>  	int	(*phylink_mac_link_state)(struct dsa_switch *ds, int port,
>  					  struct phylink_link_state *state);
>  	void	(*phylink_mac_config)(struct dsa_switch *ds, int port,
> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index cca5cf686f74..d8534fd9fab9 100644
> --- a/net/dsa/port.c
> +++ b/net/dsa/port.c
> @@ -1053,6 +1053,20 @@ static void dsa_port_phylink_mac_pcs_get_state(struct phylink_config *config,
>  	}
>  }
>  
> +static struct phylink_pcs *
> +dsa_port_phylink_mac_select_pcs(struct phylink_config *config,
> +				phy_interface_t interface)
> +{
> +	struct dsa_port *dp = container_of(config, struct dsa_port, pl_config);
> +	struct dsa_switch *ds = dp->ds;
> +	struct phylink_pcs *pcs = NULL;
> +
> +	if (ds->ops->phylink_mac_select_pcs)
> +		pcs = ds->ops->phylink_mac_select_pcs(ds, dp->index, interface);
> +
> +	return pcs;
> +}
> +
>  static void dsa_port_phylink_mac_config(struct phylink_config *config,
>  					unsigned int mode,
>  					const struct phylink_link_state *state)
> @@ -1119,6 +1133,7 @@ static void dsa_port_phylink_mac_link_up(struct phylink_config *config,
>  
>  static const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
>  	.validate = dsa_port_phylink_validate,
> +	.mac_select_pcs = dsa_port_phylink_mac_select_pcs,

This patch breaks probing on DSA switch drivers that weren't converted
to supported_interfaces, due to this check in phylink_create():

	/* Validate the supplied configuration */
	if (mac_ops->mac_select_pcs &&
	    phy_interface_empty(config->supported_interfaces)) {
		dev_err(config->dev,
			"phylink: error: empty supported_interfaces but mac_select_pcs() method present\n");
		return ERR_PTR(-EINVAL);
	}

>  	.mac_pcs_get_state = dsa_port_phylink_mac_pcs_get_state,
>  	.mac_config = dsa_port_phylink_mac_config,
>  	.mac_an_restart = dsa_port_phylink_mac_an_restart,
> -- 
> 2.30.2
> 

  reply	other threads:[~2022-02-19 21:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 18:29 [PATCH net-next v2 0/6] net: dsa: qca8k: convert to phylink_pcs and mark as non-legacy Russell King (Oracle)
2022-02-17 18:30 ` [PATCH net-next v2 1/6] net: dsa: add support for phylink mac_select_pcs() Russell King (Oracle)
2022-02-19 21:12   ` Vladimir Oltean [this message]
2022-02-19 21:22     ` Vladimir Oltean
2022-02-21 13:30       ` Russell King (Oracle)
2022-02-21 14:15         ` Russell King (Oracle)
2022-02-21 14:41           ` Vladimir Oltean
2022-02-21 14:32         ` Vladimir Oltean
2022-02-21 14:44           ` Russell King (Oracle)
2022-02-21 14:55             ` Vladimir Oltean
2022-02-21 16:38               ` Russell King (Oracle)
2022-02-17 18:30 ` [PATCH net-next v2 2/6] net: dsa: qca8k: move qca8k_setup() Russell King (Oracle)
2022-02-17 18:30 ` [PATCH net-next v2 3/6] net: dsa: qca8k: move qca8k_phylink_mac_link_state() Russell King (Oracle)
2022-02-17 18:30 ` [PATCH net-next v2 4/6] net: dsa: qca8k: convert to use phylink_pcs Russell King (Oracle)
2022-02-17 18:30 ` [PATCH net-next v2 5/6] net: dsa: qca8k: move pcs configuration Russell King (Oracle)
2022-02-17 18:31 ` [PATCH net-next v2 6/6] net: dsa: qca8k: mark as non-legacy Russell King (Oracle)
2022-02-18 11:50 ` [PATCH net-next v2 0/6] net: dsa: qca8k: convert to phylink_pcs and " patchwork-bot+netdevbpf

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=20220219211241.beyajbwmuz7fg2bt@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).