net: dsa: qca8k: add tracking state of master port
authorAnsuel Smith <ansuelsmth@gmail.com>
Wed, 2 Feb 2022 00:03:28 +0000 (01:03 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Feb 2022 14:43:59 +0000 (14:43 +0000)
commitcddbec19466a1dfb4d45ddd507d9f09f991d54ae
treef9c87afb5472bc9e391c00b9173f7336c3a8970e
parent31eb6b4386ad91930417e3f5c8157a4b5e31cbd5
net: dsa: qca8k: add tracking state of master port

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 only checks
CPU port0 if it's operational and enables this mode.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/qca8k.c
drivers/net/dsa/qca8k.h