openwrtv4/target/linux/ramips/patches-4.4/0519-gsw_mt7621.patch
Felix Fietkau 566de813c3 ramips: prevent packet forwarding on mt7620 between switch ports during init (FS#103)
By default, forwarding between all ports is allowed on init. This is
problematic in cases where some ports are supposed to be isolated from
each other, most commonly LAN/WAN separation.

REG_ESW_PORT_PCR(port) has a destination mask for a particular port,
controlling what other ports it is allowed to send packets to.
Instead of initializing all to 0xff (all ports), allow each physical
port to send to the CPU port, and the CPU port to send to all other
ports.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-12-04 11:41:49 +01:00

31 lines
859 B
Diff

--- a/drivers/net/ethernet/mediatek/mt7530.c
+++ b/drivers/net/ethernet/mediatek/mt7530.c
@@ -543,6 +543,7 @@ mt7530_apply_config(struct switch_dev *d
u8 etags = priv->vlan_entries[i].etags;
u32 val;
+#ifndef CONFIG_SOC_MT7621
/* vid of vlan */
val = mt7530_r32(priv, REG_ESW_VLAN_VTIM(i));
if (i % 2 == 0) {
@@ -553,7 +554,7 @@ mt7530_apply_config(struct switch_dev *d
val |= (vid << 12);
}
mt7530_w32(priv, REG_ESW_VLAN_VTIM(i), val);
-
+#endif
/* vlan port membership */
if (member)
mt7530_w32(priv, REG_ESW_VLAN_VAWD1, REG_ESW_VLAN_VAWD1_IVL_MAC |
@@ -573,7 +574,11 @@ mt7530_apply_config(struct switch_dev *d
mt7530_w32(priv, REG_ESW_VLAN_VAWD2, val);
/* write to vlan table */
+#ifdef CONFIG_SOC_MT7621
+ mt7530_vtcr(priv, 1, vid);
+#else
mt7530_vtcr(priv, 1, i);
+#endif
}
/* Port Default PVID */