summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/realtek-smi.h
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2020-09-02 00:09:35 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-29 09:55:10 +0100
commit999c5c5f0665008b63206ebb4088101f5b8fdbfd (patch)
tree5f072154e201753bed3008f8f35b59ab2391840e /drivers/net/dsa/realtek-smi.h
parent67248582ccd6716627fc70ac11a37444744fdf84 (diff)
downloadlinux-stable-999c5c5f0665008b63206ebb4088101f5b8fdbfd.tar.gz
linux-stable-999c5c5f0665008b63206ebb4088101f5b8fdbfd.tar.bz2
linux-stable-999c5c5f0665008b63206ebb4088101f5b8fdbfd.zip
net: dsa: rtl8366: Refactor VLAN/PVID init
[ Upstream commit 7e1301ed1881447d2a25f9c6423738c33cbca133 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/dsa/realtek-smi.h')
-rw-r--r--drivers/net/dsa/realtek-smi.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/dsa/realtek-smi.h b/drivers/net/dsa/realtek-smi.h
index 9a63b51e1d82..6f2dab7e33d6 100644
--- a/drivers/net/dsa/realtek-smi.h
+++ b/drivers/net/dsa/realtek-smi.h
@@ -25,6 +25,9 @@ struct rtl8366_mib_counter {
const char *name;
};
+/**
+ * struct rtl8366_vlan_mc - Virtual LAN member configuration
+ */
struct rtl8366_vlan_mc {
u16 vid;
u16 untag;
@@ -119,7 +122,6 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi);
int rtl8366_mc_is_used(struct realtek_smi *smi, int mc_index, int *used);
int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member,
u32 untag, u32 fid);
-int rtl8366_get_pvid(struct realtek_smi *smi, int port, int *val);
int rtl8366_set_pvid(struct realtek_smi *smi, unsigned int port,
unsigned int vid);
int rtl8366_enable_vlan4k(struct realtek_smi *smi, bool enable);