]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: all DSA masters must be down when changing the tagging protocol
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 19 Aug 2022 17:48:17 +0000 (20:48 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 23 Aug 2022 09:39:22 +0000 (11:39 +0200)
commit62314f66536705df6ba970653bd719140bab8ec8
treee2e9449a4e2d00fc97007b57303773b2311b648a
parentc02e2ebe12b0e29194cf00a59f1609115ad85033
net: dsa: all DSA masters must be down when changing the tagging protocol

The fact that the tagging protocol is set and queried from the
/sys/class/net/<dsa-master>/dsa/tagging file is a bit of a quirk from
the single CPU port days which isn't aging very well now that DSA can
have more than a single CPU port. This is because the tagging protocol
is a switch property, yet in the presence of multiple CPU ports it can
be queried and set from multiple sysfs files, all of which are handled
by the same implementation.

The current logic ensures that the net device whose sysfs file we're
changing the tagging protocol through must be down. That net device is
the DSA master, and this is fine for single DSA master / CPU port setups.

But exactly because the tagging protocol is per switch [ tree, in fact ]
and not per DSA master, this isn't fine any longer with multiple CPU
ports, and we must iterate through the tree and find all DSA masters,
and make sure that all of them are down.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/dsa/dsa2.c
net/dsa/dsa_priv.h
net/dsa/master.c