[LEDE-DEV] AR8334 switch (AR8216/AR8236/AR8316 driver) VLAN QinQ issue

Nino Benedetto neoben.86 at gmail.com
Thu Sep 1 06:05:39 PDT 2016


Hello,
I'm having some issue trying to configure an 8334 switch with VLANs on
a db120 board.

I configured the internal switch with two VLANs using swconfig in the
following way:

swconfig dev switch0 set reset 1
swconfig dev switch0 set enable_vlan 1
swconfig dev switch0 vlan 1 set ports "0t 3"      # phy 3, first eth port
swconfig dev switch0 vlan 2 set ports "0t 2 6"   # phy2-6, second eth port
swconfig dev switch0 set apply
vconfig set_name_type DEV_PLUS_VID_NO_PAD
vconfig add eth0 1
vconfig add eth0 2

When I send untagged packets everything works fine but I have problems
sending tagged packets with a VID different from 1 or 2 (e.g. VID =
10).

I tried to change the switch configuration working on the
ar8327_setup_port function located in ar8327.c (linux generic phy
driver).
By default, you can find the following code:

if (priv->vlan) {
  egress = AR8327_PORT_VLAN1_OUT_MODE_UNMOD;
  ingress = AR8216_IN_SECURE; // 3
}

Sniffing on eth0, if I send untagged packets, I can see packets tagged
with VID 1 (I am connected to the first switch port, phy 3) so
everything is OK.
If I send tagged packets (with VID = 10), I'm not able to see any
packets on eth0.
I am assuming that the hardware discards tagged packets with this configuration.

I changed the code this way:

if (priv->vlan) {
  egress = AR8327_PORT_VLAN1_OUT_MODE_UNMOD;
  ingress = AR8216_IN_PORT_FALLBACK; // 1
}

Once again, if I send untagged packets, I can see packets tagged with
VID 1 on eth0, as expected. Works for me.
If I send tagged packets (with VID = 10), I receive tagged packets
with VID 10 on eth0 but it's not enough.
I need to see double-tagged packets on eth0: tagged with VID 10
internally and with VID 1 externally so essentially I need to perform
a sort of QinQ mechanism.

I tried various way to initialize the 8334 switch without success.
Can anyone help me with this?
Thanks!

Carmine Benedetto



More information about the Lede-dev mailing list