aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/files-4.9/drivers
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-02-13 15:37:49 +0100
committerJo-Philipp Wich <jo@mein.io>2018-02-14 16:43:30 +0100
commit341b1427fc247fd4c53f390f2f17258dcf052a50 (patch)
treef300d70cc84b07f8904e12cd5f655325d96270d5 /target/linux/ramips/files-4.9/drivers
parentbb4002c79dd8ea7bec9643707277944da90d002c (diff)
downloadupstream-341b1427fc247fd4c53f390f2f17258dcf052a50.tar.gz
upstream-341b1427fc247fd4c53f390f2f17258dcf052a50.tar.bz2
upstream-341b1427fc247fd4c53f390f2f17258dcf052a50.zip
ramips: properly map pvid for vlans with remapped vid on mt7530/762x switches
Currently, untagged port primary vlan IDs are set to the VLAN table index, and not the actual VLAN ID, breaking configurations with IDs deviating from the VLAN index. Fix the issue by resolving the per-port pvid property to the target VLAN ID value before committing to the hardware. Fixes FS#991, FS#1147, FS#1341 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'target/linux/ramips/files-4.9/drivers')
-rw-r--r--target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mt7530.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mt7530.c b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mt7530.c
index e61f9fd8d3..21f892655a 100644
--- a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mt7530.c
+++ b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mt7530.c
@@ -616,10 +616,16 @@ mt7530_apply_config(struct switch_dev *dev)
/* Port Default PVID */
for (i = 0; i < MT7530_NUM_PORTS; i++) {
+ int vlan = priv->port_entries[i].pvid;
+ u16 pvid = 0;
u32 val;
+
+ if (vlan < MT7530_NUM_VLANS && priv->vlan_entries[vlan].member)
+ pvid = priv->vlan_entries[vlan].vid;
+
val = mt7530_r32(priv, REG_ESW_PORT_PPBV1(i));
val &= ~0xfff;
- val |= priv->port_entries[i].pvid;
+ val |= pvid;
mt7530_w32(priv, REG_ESW_PORT_PPBV1(i), val);
}