提交 4ddcaf1e 编写于 作者: L Linus Walleij 提交者: Jakub Kicinski

net: dsa: rtl8366: Properly clear member config

When removing a port from a VLAN we are just erasing the
member config for the VLAN, which is wrong: other ports
can be using it.

Just mask off the port and only zero out the rest of the
member config once ports using of the VLAN are removed
from it.
Reported-by: NFlorian Fainelli <f.fainelli@gmail.com>
Fixes: d8652956 ("net: dsa: realtek-smi: Add Realtek SMI driver")
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 d7739b0b
...@@ -452,13 +452,19 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port, ...@@ -452,13 +452,19 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port,
return ret; return ret;
if (vid == vlanmc.vid) { if (vid == vlanmc.vid) {
/* clear VLAN member configurations */ /* Remove this port from the VLAN */
vlanmc.vid = 0; vlanmc.member &= ~BIT(port);
vlanmc.priority = 0; vlanmc.untag &= ~BIT(port);
vlanmc.member = 0; /*
vlanmc.untag = 0; * If no ports are members of this VLAN
vlanmc.fid = 0; * anymore then clear the whole member
* config so it can be reused.
*/
if (!vlanmc.member && vlanmc.untag) {
vlanmc.vid = 0;
vlanmc.priority = 0;
vlanmc.fid = 0;
}
ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); ret = smi->ops->set_vlan_mc(smi, i, &vlanmc);
if (ret) { if (ret) {
dev_err(smi->dev, dev_err(smi->dev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册