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: CPSW3G vlan configuration

Part Number: PROCESSOR-SDK-AM62X

Tool/software:

I am using Ti DP83848 PHY connected to cpsw3g internal switch. 

Now my requirement is to allow untagged packets and VLAN 20 tagged packets.


ip link add name br0 type bridge 

ip link set eth1 master br0

ip link set br0 type bridge vlan_filtering 1 vlan_default_pvid 20

ip link set br0 up

With this, the untagged packets are transmitting but Iwith VLAN 20 tagged packets it fails.

 

When I create another eth1.20 interface using vconfig and add it to the bridge, then it worked for both tagged and untagged. But, I doubt this is the right way to do this?

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

  • Hello Kanishk,

    What SDK version are you currently using?

    Are you testing on a TI AM62x EVM or a custom built board?

    Are you planning on using the CPSW in switch mode or dual emac mode?

    If you're using in switch mode, have you tried following the instructions in https://software-dl.ti.com/processor-sdk-linux/esd/AM64X/latest/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW3g.html#vlan-configuration ?

    If you're using in dual emac mode, may I ask why you are setting up a br0 interface?

    -Daolin

  • Hello Qiu,


    I am testing it on a custom-built board and I use Linux v6.11.5 version.

    I assume, I was using dual emac mode - since "ti, mac-only" entry was there in my dts.

    I have two PHYs whom are connected to two cpsw ports, and are eth0 and eth1.

    Simply put, what I need is - I need to access the two interfaces with a single ip, plus both should allow untagged packets and VLAN 20 tagged packets. That's why, I have created a bridge with VLAN 20 and put the eth interfaces to that bridge. 

    ip link set dev br0 type bridge vlan_filtering 1 vlan_default_pvid 20

    But, tagged 20 packets are not going through unless make the egress packets tagged. - bridge vlan add dev eth1 vid 20 pvid. But, this breaks the untagged packets going through.

  • I tried to test in in switch mode, but unfortunately our busybox doesn't support devlink. I got devlink not found.
    If I remove the "ti,mac-only" will the cpsw goes to switch mode without using devlink?

  • Hi Kanishk, 

    I am testing it on a custom-built board and I use Linux v6.11.5 version.
    I tried to test in in switch mode, but unfortunately our busybox doesn't support devlink. I got devlink not found.
    If I remove the "ti,mac-only" will the cpsw goes to switch mode without using devlink?

    From my understanding, on older kernel versions, changing between switch and emac mode is done through the device tree. However, now that can be enabled simply via Linux commands. The devlink only ensures that the switching capability is in hardware rather than software. If you don't need hardware switch then you can also skip running devlink.

    Simply put, what I need is - I need to access the two interfaces with a single ip, plus both should allow untagged packets and VLAN 20 tagged packets. That's why, I have created a bridge with VLAN 20 and put the eth interfaces to that bridge. 

    Do you expect the two interfaces to act as a switch, to pass traffic in from one port out through the port? If so, you would need to set up switch mode. Otherwise, if you need the two interfaces/ports to have completely isolated traffic, you would need to use dual emac mode. 

    If you are making a bridge, have you added both eth0 and eth1 to the bridge interface? In your commands, I see only eth1 added.

    But, tagged 20 packets are not going through unless make the egress packets tagged. - bridge vlan add dev eth1 vid 20 pvid. But, this breaks the untagged packets going through.

    Does this still happen if you run the steps in I provided in my previous link to add VLAN ID? My understanding is the below part of the configuration is to ensure that allow a VLAN aware switch know what ID is used for untagged traffic and is a way to account for untagged frames. 

    [*] 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

    ip link set dev br0 type bridge vlan_filtering 1 vlan_default_pvid 20
     
    Also, why did you choose to configure vlan_filtering to 1 but vlan_default_pvid to 20?

    -Daolin