net: dsa: rtl8366: Refactor VLAN/PVID init
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 1 Sep 2020 22:09:35 +0000 (00:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Sep 2020 21:13:35 +0000 (14:13 -0700)
commit7e1301ed1881447d2a25f9c6423738c33cbca133
treeaa0ae8fe12420b66378109668c5209aed3432210
parent6641a2c42b0a307b7638d10e5d4b90debc61389d
net: dsa: rtl8366: Refactor VLAN/PVID init

The VLANs and PVIDs on the RTL8366 utilizes a "member
configuration" (MC) which is largely unexplained in the
code.

This set-up requires a special ordering: rtl8366_set_pvid()
must be called first, followed by rtl8366_set_vlan(),
else the MC will not be properly allocated. Relax this
by factoring out the code obtaining an MC and reuse
the helper in both rtl8366_set_pvid() and
rtl8366_set_vlan() so we remove this strict ordering
requirement.

In the process, add some better comments and debug prints
so people who read the code understand what is going on.

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/realtek-smi-core.h
drivers/net/dsa/rtl8366.c