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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240405162100.5iy2k66bqnhprej4@skbuf>
Date: Fri, 5 Apr 2024 19:21:00 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Florian Fainelli <f.fainelli@...il.com>,
	Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
	Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH RFC net-next 2/3] net: dsa: allow DSA switch drivers to
 provide their own phylink mac ops

On Wed, Apr 03, 2024 at 03:18:41PM +0100, Russell King (Oracle) wrote:
> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index 02bf1c306bdc..4cafbc505009 100644
> --- a/net/dsa/port.c
> +++ b/net/dsa/port.c
> @@ -1662,6 +1662,7 @@ static const struct phylink_mac_ops dsa_port_phylink_mac_ops = {
>  
>  int dsa_port_phylink_create(struct dsa_port *dp)
>  {
> +	const struct phylink_mac_ops *mac_ops;
>  	struct dsa_switch *ds = dp->ds;
>  	phy_interface_t mode;
>  	struct phylink *pl;
> @@ -1685,8 +1686,12 @@ int dsa_port_phylink_create(struct dsa_port *dp)
>  		}
>  	}
>  
> -	pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn),
> -			    mode, &dsa_port_phylink_mac_ops);
> +	mac_ops = &dsa_port_phylink_mac_ops;
> +	if (ds->phylink_mac_ops)
> +		mac_ops = ds->phylink_mac_ops;
> +
> +	pl = phylink_create(&dp->pl_config, of_fwnode_handle(dp->dn), mode,
> +			    mac_ops);
>  	if (IS_ERR(pl)) {
>  		pr_err("error creating PHYLINK: %ld\n", PTR_ERR(pl));
>  		return PTR_ERR(pl);
> -- 
> 2.30.2
> 

This is not sufficient. We will have to make DSA call the driver through
the mac_ops it provides, rather than through ds->ops, here:

dsa_shared_port_link_register_of()

	if (!ds->ops->adjust_link) {
		if (missing_link_description) {
			dev_warn(ds->dev,
				 "Skipping phylink registration for %s port %d\n",
				 dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index);
		} else {
			if (ds->ops->phylink_mac_link_down)
				ds->ops->phylink_mac_link_down(ds, port,
					MLO_AN_FIXED, PHY_INTERFACE_MODE_NA);
			~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

			return dsa_shared_port_phylink_register(dp);
		}
		return 0;
	}

Coincidentally mv88e6xxx is exactly one of those drivers which needs the
early mac_link_down() call that isn't driven by phylink.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ