[OpenWrt-Devel] QinQ on MT7530/MT7621

Sven Eckelmann sven at open-mesh.com
Mon Sep 14 11:39:13 EDT 2015

On Tuesday 08 September 2015 15:01:09 Sven Eckelmann wrote:
> Hi,
> I was testing QinQ/stacked vlan/double vlan/doubletag on MT7621 and
> noticed that it didn't work. I see packets correctly send with the
> the stacked VLAN tag but the replies are never received by eth0.

Just some notes:

If I change the REG_ESW_PORT_PCR of each port from 0x00ff0003 (only
allow frame when vlan member of vid) to 0x00ff0001 (broadcasting the
port matrix members when port not member of vid) then I can see the
frame on eth0 (port 6).

I would therefore conclude that I need to switch the incoming port to
a state were it doesn't try to get the vlan header from the frame. The
correct one seems to be the transparent mode as already used by the
port matrix (enable_vlan == 0) mode.

My proof of concept patch (yes, I know it is currently in the wrong
place and it should be differentiated between tagged/untagged and
not between CPU port and not CPU port).

--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mt7530.c
@@ -500,8 +500,12 @@ mt7530_apply_config(struct switch_dev *dev)
 		mt7530_w32(priv, REG_ESW_PORT_PCR(i), 0x00ff0003);
 	/* set all ports as user port */
-	for (i = 0; i < MT7530_NUM_PORTS; i++)
-		mt7530_w32(priv, REG_ESW_PORT_PVC(i), 0x81000000);
+	for (i = 0; i < MT7530_NUM_PORTS; i++) {
+		if (i == MT7530_CPU_PORT)
+			mt7530_w32(priv, REG_ESW_PORT_PVC(i), 0x81000000);
+		else
+			mt7530_w32(priv, REG_ESW_PORT_PVC(i), 0x810000c0);
+	}
 	for (i = 0; i < MT7530_NUM_VLANS; i++) {
 		u16 vid = priv->vlan_entries[i].vid;

I am currently not perfectly sure how to best solve the problem that
this setting is per port and the tagging/non-tagging setting is per
vlan. Maybe I will propose a patch that first checks if a port is
used in a vlan in tag/untag mode and then set the port mode to
transparent when it is not used as tagged in any vlan (and print a
warning when used in a mixed mode).

But here are my notes just in case I get struck by an improper
installed accesspoint.

Kind regards,
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list