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.

AM6422: VLAN ID 0 TX/RX behavior on AM64x CPSW3G

Part Number: AM6422

Clarification on VLAN ID 0 TX/RX behavior on AM64x CPSW3G

Purpose

We would like TI FAE to clarify whether the default VLAN ID 0 handling on TI AM64x CPSW3G may cause the following behavior:

  1. Packets sent through eth1.0 are observed on the wire without an explicit VLAN tag
  2. Reception of externally injected VLAN ID 0 packets may also be affected
  3. What is the recommended way to handle this scenario in software or configuration

Hardware and Software Environment

Hardware platform

  • SoC: TI AM64x
  • Switch IP: CPSW3G
  • Network/PTP interface under investigation: eth1
  • PTP device: /dev/ptp1

Software environment

  • OS: Linux, built in a Yocto/KAS environment
  • CPSW driver: am65-cpsw-nuss
  • Kernel-side files involved in our analysis:
    • am65-cpsw-nuss.c
    • cpsw_ale.c
  • Application-side scenario:
    • VLAN sub-interface eth1.0 is used to send/receive VLAN ID 0 traffic
    • eth1.100 is used as a comparison point and transmits frames with VLAN 100 as expected
    • ptp4l work in IEEE C37.238-2011 as slave. GM work in IEEE C37.238-2011  with VLAN ID 0 by default .

Diagnostic tool


Observed Behavior

Observation 1: VLAN 100 behaves normally, VLAN 0 does not

  • Frames sent from eth1.100 are captured externally with VLAN tag 100
  • Frames sent from eth1.0 are captured externally without an explicit VLAN tag 0
  • From the Linux side, eth1.0 is configured correctly and we already verified:
    • VLAN ID = 0
    • reorder_hdr off
    • egress-qos-map 4:4

Observation 2: External equipment can send VLAN 0 frames toward this device

  • The peer clock is able to transmit VLAN ID 0 PTP packets
  • Our application logs indicate that the receive path can enter VLAN mode, so at least part of the RX path appears VLAN-aware

Observation 3: ALE dump shows VLAN 0 is force-untagged

We executed the following command on the target:

./switch-config -I eth1 -d

Relevant output is shown below:

K3 cpsw dump version (1) len(11704)
ALE table dump ents(512):
0   : type: vlan , vid = 0, untag_force = 0x7, reg_mcast = 0x0, unreg_mcast = 0x0, member_list = 0x7
1   : type: ucast, addr = 98:03:8a:84:88:15, ucast_type = persistant, port_num = 0x0, Secure
2   : type: mcast, vid = 0, addr = ff:ff:ff:ff:ff:ff, mcast_state = f, no super, port_mask = 0x7
3   : type: mcast, addr = 33:33:00:00:00:01, mcast_state = f, no super, port_mask = 0x7
4   : type: mcast, addr = 01:00:5e:00:00:01, mcast_state = f, no super, port_mask = 0x7
5   : type: ucast, addr = 00:00:54:68:00:00, ucast_type = persistant, port_num = 0x0, Secure
6   : type: mcast, addr = 33:33:ff:84:88:15, mcast_state = f, no super, port_mask = 0x3
7   : type: mcast, addr = 01:00:5e:00:00:fc, mcast_state = f, no super, port_mask = 0x3
8   : type: mcast, addr = 01:00:5e:00:00:fb, mcast_state = f, no super, port_mask = 0x3
9   : type: mcast, addr = 33:33:00:01:00:03, mcast_state = f, no super, port_mask = 0x3
10  : type: mcast, addr = 33:33:00:00:00:fb, mcast_state = f, no super, port_mask = 0x3
11  : type: mcast, addr = 01:80:c2:00:00:21, mcast_state = f, no super, port_mask = 0x3
12  : type: vlan , vid = 100, untag_force = 0x0, reg_mcast = 0x0, unreg_mcast = 0x0, member_list = 0x3

The most important ALE entry for us is:

vid = 0, untag_force = 0x7, member_list = 0x7

Compared with VLAN 100:

vid = 100, untag_force = 0x0, member_list = 0x3

This suggests that VLAN 100 is not force-untagged, while VLAN 0 is force-untagged.


Our Current Understanding

Based on source code review, our current understanding is as follows.

1. No explicit VLAN 0 stripping logic was found in the TX netdev path

In the ndo_start_xmit path of am65-cpsw-nuss.c, we did not find an obvious special-case branch that strips VLAN tags only when VLAN ID equals 0.

2. Default VLAN 0 initialization may program ALE to force untag egress

In am65-cpsw-nuss.c, we found logic similar to:

port_mask = GENMASK(common->port_num, 0) &
            ~common->disabled_ports_mask;

cpsw_ale_add_vlan(common->ale, 0, port_mask,
                  port_mask, port_mask,
                  port_mask & ~ALE_PORT_HOST);

Our interpretation is:

  • member_list = port_mask
  • untag_force = port_mask

If port_mask = 0x7, this matches the ALE dump exactly.

3. This may explain why eth1.0 traffic appears untagged on the wire

Even if Linux constructs a VLAN ID 0 packet on eth1.0, once the packet enters CPSW/ALE, it may be converted to an untagged egress frame because of the default VLAN 0 untag_force policy.

However, we are not sure whether this is only an egress behavior or whether it also affects ingress delivery to eth1.0.


Questions for TI FAE

Question 1

For AM64x CPSW3G, does the ALE entry vid = 0, untag_force = 0x7 cause the following behavior?

  • The application sends packets through eth1.0
  • Internally, Linux treats them as VLAN ID 0 packets
  • But externally, the wire capture shows packets without an explicit VLAN tag

In other words:

Is this ALE configuration sufficient to explain the observed behavior that packets sent via eth1.0 appear untagged on the wire?

Question 2

Does this VLAN 0 / untag_force configuration also affect reception of externally injected VLAN ID 0 frames?

Specifically, we want to understand whether priority-tagged VLAN 0 frames entering the switch port:

  • Are treated as untagged frames on the CPSW/ALE/host path
  • Can still be delivered correctly to eth1.0
  • Or are actually delivered to eth1 instead of eth1.0

Question 3

For applications that must preserve explicit VLAN ID 0 tagging on both TX and RX, what is TI's recommended solution?

For example, should we:

  • Modify the default VLAN 0 ALE initialization so that untag_force != port_mask
  • Change VLAN 0 untag_force to 0
  • Manage VLAN 0 through switchdev / VLAN APIs in a different way
  • Or is explicit preservation of VLAN ID 0 tags fundamentally unsupported/limited on CPSW in this mode?

If TI has a recommended driver patch, reference configuration, kernel version, or design note for this case, please share it.


What We Need Confirmed

We would appreciate a clear answer to the following:

  1. Does vid = 0, untag_force = 0x7 cause packets sent from eth1.0 to appear as untagged frames on the wire?
  2. Does this configuration also affect reception/classification of external VLAN ID 0 packets toward eth1.0?
  3. If the application requires true transmission/reception of explicitly tagged VLAN ID 0 frames, what is the recommended driver/configuration change?

Additional Notes

  • eth1.100 currently behaves as expected and external captures show VLAN 100
  • The issue is specific to eth1.0
  • The current switch-config version can only dump ALE state; it cannot modify the VLAN 0 ALE entry online
  • Therefore, at this stage we can only infer the root cause from observations and source code, and we need TI to confirm the intended CPSW/ALE behavior
  • Hi Mike

    Thanks for reaching out.

    Hi team

    Any updates here?  Already 5 days passed.

    Thanks

    Zekun

  • Hello Mike, 

    Apologies for the delayed response.

    First can I confirm with you the following questions?

    1. What TI Linux SDK version are you using? 

    2. Is this evaluation done on a custom board or TI EVM?

    3. What is the test topology setup? (What devices have you connected to the device under test?)

    4. To capture packets on the wire are you using Wireshark/tcpdump or another mechanism?

    For AM64x CPSW3G, does the ALE entry vid = 0, untag_force = 0x7 cause the following behavior?

    What I understand is that VLAN ID 0 is always reserved and used by Linux for priority tagging (considered untagged VLAN). Additionally from the TRM section "12.2.1.4.6.4.1.2 Priority Tagged Packets (VLAN VID == 0 && EN_VID0_MODE ==0h)" there are two cases presented, one case of which indicates VLAN header is removed. To check if this case is enabled, can you do a "devmem2 0x0803E09C" and check if the UVLAN_FORCE_UNTAGGED_EGRESS is enabled for the port that you are transmitting VLAN ID 0 packets?

    Does this VLAN 0 / untag_force configuration also affect reception of externally injected VLAN ID 0 frames?

    I believe that the untag_force may directly be related to the UVLAN_FORCE_UNTAGGED_EGRESS setting which is only a setting for transmit/egress frames. Just be aware that on receive/ingress that following that is mentioned in the TRM is configured properly.

    If TI has a recommended driver patch, reference configuration, kernel version, or design note for this case, please share it.

    Please allow me some time to check in on this internally. I need to confirm if it indeed is a bug or part of design (VLAN ID 0 is special compared to the other VLAN IDs).

    -Daolin

  • hi Daolin:
    1. Which version of the TI Linux SDK are you using?

     

    We are using TI Linux SDK 11.2.

     

    2. Was this evaluation performed on a custom board or on a TI EVM?

     

    The evaluation was performed on our own custom hardware board.

     

    3. What is the test topology setup? Which devices are connected to the device under test?

     

    The CPSW Ethernet port, either eth1 or eth2, is connected to a hub. The GM device is also connected to the same hub, and the PC is connected to the hub as well.

     

    Topology:
    DUT CPSW eth1/eth2 <--> Hub
    GM device          <--> Hub
    PC                 <--> Hub

     

    4. Are you using Wireshark/tcpdump or another mechanism to capture packets on the wire?

     

    Packets are captured on the PC side.
  • Hello Mike, 

    Apologies for the delay in response. 

    If TI has a recommended driver patch, reference configuration, kernel version, or design note for this case, please share it.
    Or is explicit preservation of VLAN ID 0 tags fundamentally unsupported/limited on CPSW in this mode?

    After checking internally, it appears that CPSW hardware itself reserves VLAN ID 0 and due to that reason it is not part of the software implementation to modify VLAN ID 0 ALE configuration. 

    ptp4l work in IEEE C37.238-2011 as slave. GM work in IEEE C37.238-2011  with VLAN ID 0 by default .

    You mention this GM device uses VLAN ID 0 by default. Is it a hard requirement to use VLAN ID 0 or an alternative VLAN ID can be used for your use-case?

    -Daolin