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: ethernet switch mode

Part Number: AM6422


Tool/software:

Hi,

I have now dual emac mode using cpsw on the CPU:

root@PM5680-T-2ETH:~# ifconfig
eth0 Link encap:Ethernet HWaddr 70:FF:76:1F:44:4B
inet addr:192.168.0.10 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:266 errors:0 dropped:0 overruns:0 frame:0
TX packets:251 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19744 (19.2 KiB) TX bytes:18094 (17.6 KiB)

eth1 Link encap:Ethernet HWaddr 70:FF:76:1F:44:4C
inet addr:192.168.1.10 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

That works properly.

As next I try to activate switch mode to use both ports (for daisy chain).

Following commands entered:

devlink dev param set platform/8000000.ethernet name switch_mode value 1 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 type bridge vlan_filtering 1
bridge vlan add dev br0 vid 1 self
bridge vlan add dev br0 vid 1 pvid untagged self

ip addr add 192.168.0.11/24 dev br0
ip link set dev br0 up

I expect that br0 can be pinged in the network, but no reply.

Is something missing  ?

Best regards

Walter

  • Hi,

    Could you please post the results of ifconfig -a?

    Best Regards,

    Schuyler

  • Hi Walter, 

    ip addr add 192.168.0.11/24 dev br0

    Instead of setting the IP address of br0 statically with "ip addr add" can you run "udhcpc -i br0" assuming you have your device connected to a host PC with DHCP service or a router and try testing ping? See https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1448495/sk-am64b-cpsw-switch-mode-not-working/5557385#5557385 for details.

    Is there a particular requirement to set br0 with a static IP address?

    -Daolin

  • Hi Daolin,

    the address must be static.

    Best regards

    Walter

  • Hi,

    here the output:

    root@PM5680-T-2ETH:~# ifconfig -a
    eth0 Link encap:Ethernet HWaddr 70:FF:76:1F:44:4B
    inet addr:192.168.0.10 Bcast:0.0.0.0 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:18 errors:0 dropped:0 overruns:0 frame:0
    TX packets:131 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:1587 (1.5 KiB) TX bytes:6742 (6.5 KiB)

    eth1 Link encap:Ethernet HWaddr 70:FF:76:1F:44:4C
    inet addr:192.168.1.10 Bcast:0.0.0.0 Mask:255.255.255.0
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    br0 Link encap:Ethernet HWaddr 70:FF:76:1F:44:4B
    inet addr:192.168.0.11 Bcast:0.0.0.0 Mask:255.255.255.0
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:13 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:1077 (1.0 KiB) TX bytes:42 (42.0 B)

    can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
    NOARP MTU:16 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:10
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
    Interrupt:77

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    UP LOOPBACK RUNNING MTU:65536 Metric:1
    RX packets:2 errors:0 dropped:0 overruns:0 frame:0
    TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:176 (176.0 B) TX bytes:176 (176.0 B)

    Best regards

    Walter

  • Here also the console output:

    [ 15.002239] am65-cpsw-nuss 8000000.ethernet eth0: Link is Down
    [ 20.043957] am65-cpsw-nuss 8000000.ethernet eth0: PHY [8000f00.mdio:01] driver [Generic PHY] (irq=POLL)
    [ 20.053760] am65-cpsw-nuss 8000000.ethernet eth0: configuring for phy/rgmii-rxid link mode
    [ 20.061697] 8021q: adding VLAN 0 to HW filter on device eth0

    [ 20.073109] am65-cpsw-nuss 8000000.ethernet eth1: PHY [8000f00.mdio:02] driver [Generic PHY] (irq=POLL)
    [ 20.073188] am65-cpsw-nuss 8000000.ethernet eth1: configuring for phy/rgmii-rxid link mode
    [ 20.078254] 8021q: adding VLAN 0 to HW filter on device eth1
    [ 22.114681] am65-cpsw-nuss 8000000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
    [ 25.093739] am65-cpsw-nuss 8000000.ethernet: Enable switch mode
    [ 35.147531] br0: port 1(eth0) entered blocking state
    [ 35.147662] br0: port 1(eth0) entered disabled state
    [ 35.147715] am65-cpsw-nuss 8000000.ethernet eth0: entered allmulticast mode
    [ 35.150002] am65-cpsw-nuss 8000000.ethernet eth0: entered promiscuous mode
    [ 35.158986] br0: port 2(eth1) entered blocking state
    [ 35.159034] br0: port 2(eth1) entered disabled state
    [ 35.159086] am65-cpsw-nuss 8000000.ethernet eth1: entered allmulticast mode
    [ 35.161790] am65-cpsw-nuss 8000000.ethernet eth1: entered promiscuous mode
    [ 35.176687] br0: port 1(eth0) entered blocking state
    [ 35.176734] br0: port 1(eth0) entered listening state
    ARPING 192.168.0.11 from 192.168.0.11 br0
    Sent 5 probe(s) (0 broadcast(s))
    Received 0 response(s) (0 request(s), 0 broadcast(s))
    [ 50.657876] br0: port 1(eth0) entered learning state
    [ 66.017885] br0: port 1(eth0) entered forwarding state
    [ 66.017924] br0: topology change detected, propagating

    after I have changed the script to:

    #!/bin/sh

    ip link set dev ETH1 down
    ip link set dev ETH2 down
    sleep 5
    ip link set dev ETH1 up
    ip link set dev ETH2 up
    sleep 5
    devlink dev param set platform/8000000.ethernet name switch_mode value true cmode runtime
    sleep 5
    ip link add name br0 type bridge
    ip link set dev br0 type bridge ageing_time 1000
    sleep 5
    ip link set dev ETH1 master br0
    ip link set dev ETH2 master br0
    ip link set dev br0 type bridge stp_state 1
    ip link set dev br0 up
    bridge vlan add dev br0 vid 1 self
    bridge vlan add dev br0 vid 1 pvid untagged self
    #udhcpc -i br0
    ip addr add 192.168.0.11/24 dev br0

    sleep 3
    arping -c 5 -U -I br0 192.168.0.11

    Best regards

    Walter

  • Hi Walter,

    Can you clarify the following

    1. What Linux SDK version are you using?

    2. Is this test being done on a custom designed board?

    3. Can you instead try the following to set up the CPSW as a switch with your static address configuration?

    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
    ip link set dev br0 up
    sleep 2
    ip addr add 192.168.0.11/24 dev br0
    

    Instead of using "arping -c 5 -U -I br0 192.168.0.11", can you connect another device to your DUT, make the connected device also have an IP address on the same subnet, then test "ping <IP address of connected device> -I br0"?

    -Daolin

  • Hi Daolin,

    we use both: TI Board AM64-SK with standard SDK and our custom board with vanilla Linux RT.

    We retested the standard solution: it works.

    The difference to us was: in our setup the IP addresses set at eth0 and eth1.

    Seems to be wrong if we want the switch function.

    Following script works properly:

    ifconfig eth0 down
    ifconfig eth1 down
    sleep 2
    ifconfig eth0 0.0.0.0
    ifconfig eth1 0.0.0.0
    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
    ip link set dev br0 up
    sleep 2
    ip addr add 192.168.0.11/24 dev br0

    Many thanks for your support !

    The issue is resolved.

    Best Regards

    Walter