@@ -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++) {
It will fail when you have an uci network config 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@credosemi.com> --- .../files/drivers/net/ethernet/ralink/mt7530.c | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-)