lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 19 Feb 2022 23:12:41 +0200
From:   Vladimir Oltean <olteanv@...il.com>
To:     "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc:     Ansuel Smith <ansuelsmth@...il.com>, Andrew Lunn <andrew@...n.ch>,
        "David S. Miller" <davem@...emloft.net>,
        Florian Fainelli <f.fainelli@...il.com>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        Vivien Didelot <vivien.didelot@...il.com>
Subject: Re: [PATCH net-next v2 1/6] net: dsa: add support for phylink
 mac_select_pcs()

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@...linux.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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ