[OpenWrt-Devel] [PATCH] ralink: fixbug for mt7530, unused vlan entry will take effect to other vlan.
xfguo at credosemi.com
xfguo at credosemi.com
Wed Dec 31 01:42:22 EST 2014
It will fail when you have an uci network config (swconfig part) like this:
```
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '15'
option vid '1'
option ports '0 6t'
config switch_port
option name 'switch0'
option port '0'
option pvid '1'
```
It will be good until you run:
$ swconfig dev switch0 vlan 1 set vid 333
So it seems that when REG_ESW_VLAN_VAWD1_VALID is unset, it will still take
effect for VTU matching when two VTU entries have a same VID.
Signed-off-by: Xiongfei Guo <xfguo at credosemi.com>
---
.../files/drivers/net/ethernet/ralink/mt7530.c | 26 ++++++++++++++--------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
index 1352b25..27fc51a 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
@@ -408,6 +408,22 @@ mt7530_apply_config(struct switch_dev *dev)
u8 etags = priv->vlan_entries[i].etags;
u32 val;
+
+ /* vlan port membership */
+ if (member)
+ mt7530_w32(priv, REG_ESW_VLAN_VAWD1, REG_ESW_VLAN_VAWD1_IVL_MAC |
+ REG_ESW_VLAN_VAWD1_VTAG_EN | (member << 16) |
+ REG_ESW_VLAN_VAWD1_VALID);
+ else {
+ mt7530_w32(priv, REG_ESW_VLAN_VAWD1, 0);
+
+ /* ignore vid (just set it to 0) when the ports is empty,
+ * because even the REG_ESW_VLAN_VAWD1_VALID is set to disable,
+ * it will still take effect to other vlan when they have
+ * a same vid. */
+ vid = 0;
+ }
+
/* vid of vlan */
val = mt7530_r32(priv, REG_ESW_VLAN_VTIM(i));
if (i % 2 == 0) {
@@ -417,16 +433,8 @@ mt7530_apply_config(struct switch_dev *dev)
val &= 0xfff;
val |= (vid << 12);
}
- mt7530_w32(priv, REG_ESW_VLAN_VTIM(i), val);
-
- /* vlan port membership */
- if (member)
- mt7530_w32(priv, REG_ESW_VLAN_VAWD1, REG_ESW_VLAN_VAWD1_IVL_MAC |
- REG_ESW_VLAN_VAWD1_VTAG_EN | (member << 16) |
- REG_ESW_VLAN_VAWD1_VALID);
- else
- mt7530_w32(priv, REG_ESW_VLAN_VAWD1, 0);
+ mt7530_w32(priv, REG_ESW_VLAN_VTIM(i), val);
/* egress mode */
val = 0;
for (j = 0; j < MT7530_NUM_PORTS; j++) {
--
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list