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: <dcb0c749-8535-d7ef-5921-6af479f4a432@gmail.com>
Date:   Tue, 25 Jan 2022 19:37:52 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Ansuel Smith <ansuelsmth@...il.com>, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [RFC PATCH v7 09/16] net: dsa: qca8k: add tracking state of
 master port



On 1/22/2022 5:33 PM, Ansuel Smith wrote:
> MDIO/MIB Ethernet require the master port and the tagger availabale to
> correctly work. Use the new api master_state_change to track when master
> is operational or not and set a bool in qca8k_priv.
> We cache the first cached master available and we check if other cpu
> port are operational when the cached one goes down.
> This cached master will later be used by mdio read/write and mib request to
> correctly use the working function.
> 
> qca8k implementation for MDIO/MIB Ethernet is bad. CPU port0 is the only
> one that answers with the ack packet or sends MIB Ethernet packets. For
> this reason the master_state_change ignore CPU port6 and checkes only
> CPU port0 if it's operational and enables this mode.

s/checkes only/only checks/

> 
> Signed-off-by: Ansuel Smith <ansuelsmth@...il.com>
> ---
>   drivers/net/dsa/qca8k.c | 18 ++++++++++++++++++
>   drivers/net/dsa/qca8k.h |  1 +
>   2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
> index 039694518788..4bc5064414b5 100644
> --- a/drivers/net/dsa/qca8k.c
> +++ b/drivers/net/dsa/qca8k.c
> @@ -2383,6 +2383,23 @@ qca8k_port_lag_leave(struct dsa_switch *ds, int port,
>   	return qca8k_lag_refresh_portmap(ds, port, lag, true);
>   }
>   
> +static void
> +qca8k_master_change(struct dsa_switch *ds, const struct net_device *master,
> +		    bool operational)
> +{
> +	struct dsa_port *dp = master->dsa_ptr;
> +	struct qca8k_priv *priv = ds->priv;
> +
> +	/* Ethernet MIB/MDIO is only supported for CPU port 0 */
> +	if (dp->index != 0)

We sort of have a define for this: QCA8K_CPU_PORT0 even though that enum 
definition might be more accidental than on purpose.

> +		return;
> +
> +	if (operational)
> +		priv->mgmt_master = master;
> +	else
> +		priv->mgmt_master = NULL;

	priv->mgmt_master = operational ? master : NULL;

but this is really because the bike shed is blue. So in any case:

Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ