This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5716: Problems with VLAN0 in Dual EMAC mode

Part Number: AM5716

Tool/software: Linux

Hey there.

I have a very big issue with default VLAN handling in Dual Mac Mode. It seems like in CPSW frames with VLAN ID 0 will be untagged. Can anybody explain me why? I need the VLAN ID 0 tag, because of my transfer protocol needs it for correct response. There is no other use case for me for using VLAN functionality.

There is a function called cpsw_ale_add_vlan for my Port (cpsw_ndo_open), which seems to be able to force specific ports to tag or untag. The thing is with these 2 options, that if I use tagging all ports every frame get's a VLAN frame part, which is very unpleasant. If I untag all, no matter if there is a VLAN frame inside my paket, it will be forced to remove. So there is no VLAN frame anymore in the outgoing paket.

I dont know enough about the cpsw code and how I can configure the leave the packets as they are, like when I use raw sockets. Why does it seem like, that either all VLAN tags will be removed or will be attached to each frame?

VLAN_aware mode is activated.

Hope somebody can help me.

  • The software team have been notified. They will respond here.
  • I solved the problem by a workaround. The VLAN Aware mode is the problem and I stopped the host port from beeing set with this mode. But I did it in the source code. How can I set the ALE_CONTROL register?
  • Sorry for the resolving mistakes :)
  • There is a tool in the TI file system called switch-config that allows you to dump the contents of the ALE.

    This is the source to the tool that shows how to access the ALE that could be used in an application.
    git.ti.com/.../

    Ideally you should not have to modify the driver. Could you post switch-config -d to the link? Could you explain what you are trying to do with your application and why you need VLAN0?
  • I can't get an output of the faulty behaviour right now of switch-config -d, because i am a bit busy. This is the current output of switch-config -d, but I guess it's useless because of the hard coded fix in cpsw.c (avoided to start the VLAN Aware Mode).

    cpsw hw version 1.15 (0)
    0 : type: vlan , vid = 2, untag_force = 0x5, reg_mcast = 0x5, unreg_mcast = 0x1, member_list = 0x5
    1 : type: mcast, vid = 2, addr = ff:ff:ff:ff:ff:ff, mcast_state = f, no super, port_mask = 0x5
    2 : type: ucast, vid = 2, addr = fc:0f:4b:6e:2d:79, ucast_type = persistant, port_num = 0x0, Secure
    3 : type: vlan , vid = 0, untag_force = 0x7, reg_mcast = 0x0, unreg_mcast = 0x1, member_list = 0x7
    4 : type: mcast, vid = 2, addr = 01:00:5e:00:00:01, mcast_state = f, no super, port_mask = 0x5
    5 : type: mcast, vid = 2, addr = 33:33:00:00:00:01, mcast_state = f, no super, port_mask = 0x5
    6 : type: vlan , vid = 1, untag_force = 0x3, reg_mcast = 0x3, unreg_mcast = 0x1, member_list = 0x3
    7 : type: mcast, vid = 1, addr = ff:ff:ff:ff:ff:ff, mcast_state = f, no super, port_mask = 0x3
    8 : type: ucast, vid = 1, addr = fc:0f:4b:6d:2d:79, ucast_type = persistant, port_num = 0x0, Secure
    9 : type: mcast, vid = 1, addr = 33:33:00:00:00:01, mcast_state = f, no super, port_mask = 0x3
    10 : type: mcast, vid = 1, addr = 01:00:5e:00:00:01, mcast_state = f, no super, port_mask = 0x3
    11 : type: mcast, vid = 2, addr = 33:33:ff:6e:2d:79, mcast_state = f, no super, port_mask = 0x5
    12 : type: mcast, vid = 2, addr = 33:33:00:00:00:fb, mcast_state = f, no super, port_mask = 0x5
    13 : type: mcast, vid = 2, addr = 33:33:00:01:00:03, mcast_state = f, no super, port_mask = 0x5
    17 : type: ucast, addr = 28:63:36:81:3d:c1, ucast_type = touched , port_num = 0x2
    23 : type: ucast, addr = 68:05:ca:36:4e:7c, ucast_type = untouched , port_num = 0x2
    27 : type: ucast, addr = 00:90:68:00:d3:a0, ucast_type = untouched , port_num = 0x2
    32 : type: ucast, addr = 00:0e:8c:f3:15:1c, ucast_type = untouched , port_num = 0x2
    35 : type: ucast, addr = fc:0f:4b:6e:2d:79, ucast_type = untouched , port_num = 0x0
    36 : type: ucast, addr = 00:1b:1b:23:81:36, ucast_type = touched , port_num = 0x2
    52 : type: ucast, addr = 00:1b:1b:0e:9e:64, ucast_type = touched , port_num = 0x2
    71 : type: ucast, addr = fc:0f:4b:6e:2d:7a, ucast_type = untouched , port_num = 0x0

    This is how I avoided to start VLAN Aware Mode in cpsw.c:
    static void cpsw_init_host_port(struct cpsw_priv *priv)
    {
    u32 fifo_mode;
    // u32 control_reg;
    struct cpsw_common *cpsw = priv->cpsw;

    /* soft reset the controller and initialize ale */
    soft_reset("cpsw", &cpsw->regs->soft_reset);
    cpsw_ale_start(cpsw->ale);

    /* switch to vlan unaware mode */
    // cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM, ALE_VLAN_AWARE,
    CPSW_ALE_VLAN_AWARE);
    // control_reg = readl(&cpsw->regs->control);
    // control_reg |= CPSW_VLAN_AWARE;
    // writel(control_reg, &cpsw->regs->control);




    How can I set the ALE_CONTROL register without modiying the driver?
  • Hi,
    For experimentation purposes there is another utility called omapconf. Using the -h option will show a lot commands so you may want to try piping it to more with " omapconf --help| more". Take a look at these two commands in the help "omapconf write ..." or " omapconf set bit ...."

    Please let me know if that works.

    Regards,
    Schuyler
  • This might could work, i was able to change the ALE_CONTROL with omapconf set bit 0x48484004 1 to VLAN-Aware mode, but couldn't try if it worked. I guess I have to restart the netdriver to see the change in every paket, if there are the VLAN tags appearing in every paket.