Messages in this thread | | | Date | Tue, 25 Jan 2022 19:37:52 -0800 | Subject | Re: [RFC PATCH v7 09/16] net: dsa: qca8k: add tracking state of master port | From | Florian Fainelli <> |
| |
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@gmail.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@gmail.com> -- Florian
| |