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.

AM625: Enabling CPSW switch prevents ethernet communication

Part Number: AM625

We are attempting to use PTP on our platform in the same way as we implement it on our existing am335x product on a new board based on the am625.

If I enable the switch using the command:

devlink dev param set platform/8000000.ethernet \
name switch_mode value true cmode runtime

As per the documentation https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/latest/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW3g.html?highlight=switch#multi-port-switch-mode

All ethernet communication immediately stops.

I have now set up an AM62x SKEVM using the latest binary image tisdk-default-image-am62xx-evm.wic from the TI website and if I boot the device normally, I receive an IP address from my DHCP server and I can communicate with the device over ssh, I then issue the command: devlink dev param set platform/8000000.ethernet name switch_mode value true cmode runtime, and I can no longer communicate at all.

Clearly there is something I am missing.

Are you able to help on this?

  • Hi,

    The way to fix this issue is to add the following command (in red). All the other commands stay the same as the documentation you were following.

    devlink dev param set platform/8000000.ethernet name switch_mode value true cmode runtime
    ip link add name br0 type bridge
    ip link set dev br0 type bridge ageing_time 1000
    ip link set dev eth0 up
    ip link set dev eth1 up
    ip link set dev eth0 master br0
    ip link set dev eth1 master br0
    ip link set dev br0 up
    ip link set dev br0 type bridge vlan_filtering 1
    bridge vlan add dev br0 vid 1 self
    bridge vlan add dev br0 vid 1 pvid untagged self

    The above command is required due to the following commit upstream which is a part of SDK 9.x Linux, but not a part of SDK 8.x Linux:
    https://github.com/torvalds/linux/commit/3116ad0696dd2bf3f53c672f44f77e0d1c2da8ca
    This will be updated on the software documentation.

    Best regards,
    Daolin
  • Hi Daolin,

    Thank you very much for your response. By adding this it works, however we have a particular use-case where vlan filtering is switched off, but unfortunately I do not know the full context of this requirement, but I will speak to the developer who introduced this on Monday and clarify it, but it is to do with our PTP implementation, so for now I am not going to set the issue as resolved, but may come back once I have clarification on vlan filtering.

    Best regards
    Hamish

  • Hi Hamish,

    ip link set dev br0 type bridge vlan_filtering 1

    Are you referring to this command in regards to your use-case?

    If so, this vlan_filtering command is not required for the command that fixes the issue.

    bridge vlan add dev br0 vid 1 self

    This command is only letting a VLAN aware switch what ID is used for the untagged traffic. It is just a way to account for untagged frames.

    Best regards,
    Daolin
  • Hi Daolin,

    Thank you, now I have it set up with vlan_filtering off, however, the switch does not appear to be working correctly. Let me explain our use-case. We often daisy-chain multiple devices which are all time-syncing using PTP. I have a topology as follows:

    SWITCH -> PTP capable-device -> am625-based device -> PTP capable-device

    So with this configuration, the first PTP capable device after the SWITCH receives an IP address and the networking comes up (that device is actually an am335x-based device running kernel 5.10.x), then my am625-based device also receives an IP address from the DHCP server, however, the last device in the chain does not receive an IP address, and I cannot for the life of me figure out what I am going wrong - below is my init script which brings up the switch:

            devlink dev param set platform/${DEVNAME} name switch_mode value true cmode runtime
            ip link add name eth0 type bridge
            ip link set dev eth0 type bridge ageing_time 1000
    
            ip link set dev eth0 type bridge vlan_filtering 0
            echo 1 > /sys/class/net/eth0/bridge/default_pvid
    
            echo 0 > /sys/devices/virtual/net/eth0/bridge/multicast_snooping
    
            ip link set dev ext0 up
            ip link set dev ext1 up
            ip link set dev ext0 master eth0
            ip link set dev ext1 master eth0
            ip link set dev eth0 up
    
            bridge vlan add dev eth0 vid 1 self
    
            bridge vlan add dev eth0 vid 1 pvid untagged self

    Best regards

    Hamish

  • Hi Daolin,

    Just another bit of explanation, you may think it strange that we have interfaces ext0 and ext1 and that the bridge is named eth0, this is actually for backward compatibility reasons and we use a udev rule to change the names of eth0 to ext0 and eth1 to ext1 and then name the bridge eth0.

    Hamish

  • Hi Hamish,

    To debug this, let's try to narrow down to what is working.

    First, if we try running the following with vlan_filtering enabled and removing the two echo commands, does the DHCP server issue an IP address and communication can occur? I also noticed you moved the vlan_filtering command to before setting the interfaces up. I'm not sure if there was a specific reason for this change in order? For this, let's try to move the order of the vlan_filtering command back to the original order as below. 

            devlink dev param set platform/${DEVNAME} name switch_mode value true cmode runtime
            ip link add name eth0 type bridge
            ip link set dev eth0 type bridge ageing_time 1000
    
            ip link set dev ext0 up
            ip link set dev ext1 up
            ip link set dev ext0 master eth0
            ip link set dev ext1 master eth0
            ip link set dev eth0 up
    
            ip link set dev eth0 type bridge vlan_filtering 1
    
            bridge vlan add dev eth0 vid 1 self
    
            bridge vlan add dev eth0 vid 1 pvid untagged self

  • Hi Daolin,

    With the  configuration I sent earlier with the vlan_filtering off but set before bringing up the bridge, I was able to receive an IP address via DHCP and I was able to communicate with the device, however, the next device in the daisy-chain does not get an IP address and I cannot communicate with that device, in other words, it appears as though the bridge/switch is not passing traffic through to the next device.

    I also tried it with the init sequence you just described above and I see the identical result, i.e. on my am62x device I receive an IP address via DHCP but the next device in the chain does not receive an IP address and I cannot communicate with it - I do have a serial console on all of the devices, so I can see that the device is not receiving an IP address, I also see this traffic info on the bridge: RX bytes:0 (0.0 B) TX bytes:266 (266.0 B)

    Best regards

    Hamish

  • Hi Hamish,

    Thanks for clarifying what you observed.

    I just ran the following series of commands with a setup similar to yours with one endpoint device communicating with another endpoint through an AM62x SKEVM acting as a switch and it worked for me. Could you try this series of commands on the AM62x SKEVM running with on original tisdk-default-image-am62xx-evm.wic image from the TI website and see if it works for you? Make sure that you do not change the eth0, eth1 interface names. The idea is that perhaps the changing of the interface names has something to do with the problem.

    #take the interfaces down, by default dual MAC
    ip link set dev eth0 down
    ip link set dev eth1 down
    #tell the kernel hw switch to turn on switching
    devlink dev param set platform/8000000.ethernet name switch_mode value true cmode runtime
    #setup a host port called br0
    ip link add name br0 type bridge
    ip link set dev br0 type bridge ageing_time 1000
    #bring up th external Ethernet MACs, sleep is there to allow the link negotiation to go through
    ip link set dev eth0 up
    sleep 1
    ip link set dev eth1 up
    sleep 1
    #connect the external MACs to the host port
    ip link set dev eth0 master br0
    ip link set dev eth1 master br0
    #tell that the host port is part of the bridge
    ip link set dev br0 type bridge stp_state 1
    #bring the host port up
    ip link set dev br0 up
    #CPSW switch comes up in vlan aware mode, with ports blocked by default
    #vlan id 1 is used for untagged traffic with VLANs, this unblock the untagged traffic to br0 port
    bridge vlan add dev br0 vid 1 self
    bridge vlan add dev br0 vid 1 pvid untagged self
    #echo spanning tree for the switch
    brctl showstp br0
    #get an IP address for the host port using DHCP
    udhcpc -i br0
    

    Best regards,

    Daolin