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: <20211123120825.jvuh7444wdxzugbo@skbuf>
Date:   Tue, 23 Nov 2021 14:08:25 +0200
From:   Vladimir Oltean <olteanv@...il.com>
To:     "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc:     Chris Snook <chris.snook@...il.com>, Felix Fietkau <nbd@....name>,
        Florian Fainelli <f.fainelli@...il.com>,
        John Crispin <john@...ozen.org>,
        Mark Lee <Mark-MC.Lee@...iatek.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Michal Simek <michal.simek@...inx.com>,
        Radhey Shyam Pandey <radhey.shyam.pandey@...inx.com>,
        Sean Wang <sean.wang@...iatek.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Andrew Lunn <andrew@...n.ch>,
        "David S. Miller" <davem@...emloft.net>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Jakub Kicinski <kuba@...nel.org>,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org, netdev@...r.kernel.org
Subject: Re: [PATCH RFC net-next 8/8] net: phylink: allow PCS to be removed

On Tue, Nov 23, 2021 at 10:00:50AM +0000, Russell King (Oracle) wrote:
> Allow phylink_set_pcs() to be called with a NULL pcs argument to remove
> the PCS from phylink. This is only supported on non-legacy drivers
> where doing so will have no effect on the mac_config() calling
> behaviour.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
>  drivers/net/phy/phylink.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index a935655c39c0..9f0f0e0aad55 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -1196,15 +1196,25 @@ EXPORT_SYMBOL_GPL(phylink_create);
>   * in mac_prepare() or mac_config() methods if it is desired to dynamically
>   * change the PCS.
>   *
> - * Please note that there are behavioural changes with the mac_config()
> - * callback if a PCS is present (denoting a newer setup) so removing a PCS
> - * is not supported, and if a PCS is going to be used, it must be registered
> - * by calling phylink_set_pcs() at the latest in the first mac_config() call.
> + * Please note that for legacy phylink users, there are behavioural changes
> + * with the mac_config() callback if a PCS is present (denoting a newer setup)
> + * so removing a PCS is not supported. If a PCS is going to be used, it must
> + * be registered by calling phylink_set_pcs() at the latest in the first
> + * mac_config() call.
> + *
> + * For modern drivers, this may be called with a NULL pcs argument to
> + * disconnect the PCS from phylink.
>   */
>  void phylink_set_pcs(struct phylink *pl, struct phylink_pcs *pcs)
>  {
> +	if (pl->config->legacy_pre_march2020 && pl->pcs && !pcs) {
> +		phylink_warn(pl,
> +			     "Removing PCS is not supported in a legacy driver");
> +		return;
> +	}
> +
>  	pl->pcs = pcs;
> -	pl->pcs_ops = pcs->ops;
> +	pl->pcs_ops = pcs ? pcs->ops : NULL;
>  }
>  EXPORT_SYMBOL_GPL(phylink_set_pcs);
>  
> -- 
> 2.30.2
> 

I've read the discussion at
https://lore.kernel.org/netdev/cfcb368f-a785-9ea5-c446-1906eacd8c03@seco.com/
and I still am not sure that I understand what is the use case behind
removing a PCS?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ