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.

PROCESSOR-SDK-AM62X: How to use CPSW3g in HW Switch Mode using Linux

Part Number: PROCESSOR-SDK-AM62X
Other Parts Discussed in Thread: SK-AM62B

Tool/software:

Our customer is using Processor SDK Linux 10.01.10.04 with Yocto and wants to know how to use CPSW3g in HW switch mode.

The Yocto pre-built SD card image seems to use CPSW3g in Dual Emac mode (eth0 and eth1) by default.

root@am62xx-evm:~# ifconfig -a
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 1c:63:49:0f:61:86 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 9a:27:b7:50:c8:f0 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 10 bytes 1436 (1.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10 bytes 1436 (1.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

The Yocto SDK user manual describes the Switch mode features available with CPSW3g,but the configurations seem to use CPSW3g in bridge mode (br0).

https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/10_01_10_04/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW3g.html#multi-port-switch-mode

How to use CPSW3g in Switch mode without using bridge mode?

Best regards,

Daisuke

  • Hi,

    By configuring it with the commands below, the two Ethernet ports on SK-AM62B can act as a bridge between PC and network, and communication can also be established between the PC and the bridge interface (br0).

    ip link set dev eth0 down
    ip link set dev eth1 down

    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

    bridge vlan add dev br0 vid 1 self
    bridge vlan add dev br0 vid 1 pvid untagged self
    if vlan_filtering=1, where default_pvid=1

    udhcpc -i br0

    How to use CPSW3g in Switch mode without using bridge mode?

    Our customer wants to use CPSW3g in Switch mode, but does not need the bridge mode.

    Is the bridge mode required to use CPSW3g in Switch mode?

    If so, does the bridge configured with the above commands work in Switch mode using hardware instead of software?

    The bridge mode typically bridges multiple NICs (physical network interfaces) using software.

    Please give me an answer as soon as possible. Your prompt reply would be appreciated.

    Best regards,

    Daisuke

  • Dear TI support team,

    Thank you for your support. Our customer is waiting for your reply.

    Please give me an answer as soon as possible. Your prompt reply would be appreciated.

    Best regards,

    Daisuke

  • Hello Daisuke,

    Apologies for the delayed response, yesterday was a TI US holiday.

    If so, does the bridge configured with the above commands work in Switch mode using hardware instead of software?

    Since the "devlink dev param set platform/8000000.ethernet name switch_mode value true cmode runtime" is used in the configuration, this essentially ensures the setup is a hardware switch. The main distinguishing step between a hardware switch and a software switch is the devlink command.

    Is the bridge mode required to use CPSW3g in Switch mode?

    The bridge interface is needed for upper-layer interfacing such as sending/receiving TCP/UDP packets, traffic shaping, VLANs, and filtering. It simply ensures that the Ethernet ports in the hardware switch configuration from the lower layers have a configurable interface to perform these upper layer functions. Underneath the bridge commands, hardware switching is used if the "devlink" step is used.

    -Daolin

  • Hi Daolin-san,

    Thank you for your reply.

    The SDK for the older product AM335x does not use the bridge interface. The documentation describes that there is no such standard interface in Linux to configure a switch.

    software-dl.ti.com/.../CPSW.html
    "The CPSW Ethernet Switch can be configured in various different combination of Ethernet Packet forwarding and blocking. There is no such standard interface in Linux to configure a switch. This user guide provides an interface to configure the switch using Socket IOCTL through SIOCSWITCHCONFIG command."

    Does this mean that the bridge interface have become a standard interface to configure a switch?

    Best regards,

    Daisuke

  • Hi Daisuke-san,

    The SDK for the older product AM335x does not use the bridge interface. The documentation describes that there is no such standard interface in Linux to configure a switch.
    Does this mean that the bridge interface have become a standard interface to configure a switch?

    As you have mentioned, on AM335x there was no standard interface in Linux to configure a switch via any Linux utility tools. The way to configure a switch for AM335x is directly modifying the DTS.

    In K3 class devices like AM62x, as indicated the commands previously discussed in this thread, there are standard Linux utility tools to configure a switch and this is done with those commands, with the "devlink" command to configure the switch as a hardware switch.

    -Daolin