Re: [OpenWrt-Devel] QinQ on MT7530/MT7621

2015-09-14 Thread Sven Eckelmann
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), 0x8100);
+   for (i = 0; i < MT7530_NUM_PORTS; i++) {
+   if (i == MT7530_CPU_PORT)
+   mt7530_w32(priv, REG_ESW_PORT_PVC(i), 0x8100);
+   else
+   mt7530_w32(priv, REG_ESW_PORT_PVC(i), 0x81c0);
+   }
 
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,
Sven
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] QinQ on MT7530/MT7621

2015-09-08 Thread Sven Eckelmann
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.

Setup
=

 --
| eth0.1.23 | eth0.1.42 | eth0.1.5 | eth0.2.23 | eth0.2.5 | eth0.2.6   |
|--|---|
| eth0.1   | eth0.2|
|--|
|eth0  |
 --

 * eth0 is the raw device/switch which gives the packets up with vlan headers
   based on the ports (we need to address each port separately).
 * eth0.1 is for port 1 and eth0.2 is for port 2

 * eth0.1.23 is for packets which are send out to port 1 with vlan header 23
   sending already works but we don't receive packets on eth0 from this port
   when the received packet had vlan header 23 set
 * eth0.1.42 is for packets which are send out to port 1 with vlan header 42
   sending already works but we don't receive packets on eth0 from this port
   when the received packet had vlan header 42 set
 * eth0.1.5 is for packets which are send out to port 1 with vlan header 5
   sending already works but we don't receive packets on eth0 from this port
   when the received packet had vlan header 5 set

 * eth0.2.23 is for packets which are send out to port 2 with vlan header 23
   sending already works but we don't receive packets on eth0 from this port
   when the received packet had vlan header 23 set
 * eth0.2.5 is for packets which are send out to port 2 with vlan header 5
   sending already works but we don't receive packets on eth0 from this port
   when the received packet had vlan header 5 set
 * eth0.2.6 is for packets which are send out to port 2 with vlan header 6
   sending already works but we don't receive packets on eth0 from this port
   when the received packet had vlan header 6 set

I would expect that I see following ethernet frame when I send a simple ping
through eth0.1.23:

--
|ETH HDR|VLAN 23|IP stuff|
--

This seems to work perfectly fine.

Now the receiver of the ICMP packet will send a reply:

--
|ETH HDR|VLAN 23|IP stuff|
--

And thus I would expect that the CPU (eth0) sees following packet:

-
|ETH HDR|VLAN 1|VLAN 23|IP stuff|
-

But instead I get nothing at all.

I've already tried to change the tagged CPU port egress mode to stack 
but then I will get following packets as replies for eth0.1


|ETH HDR|VLAN 0|VLAN 1|IP stuff|


And I get no replies for eth0.1.23 on eth0.


Question


I was told that on older ralink (esw_rt3052) switches there was a
register 0xe4 (SGC2) which could influence the behavior of
vlan-in-vlan. I don't have more information about that.

Does anyone have the register specification for the MT7530 or any other
idea how I could configure specific VLANs for each port.

Kind regards,
Sven
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel