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>
/* 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);
}