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-AM437X: AM437x ETH0 and ETH1 loopback - ping not working

Part Number: PROCESSOR-SDK-AM437X
Other Parts Discussed in Thread: AM4378

On our hardware we are trying to ping eth0 from eth1 (loopback) for board level functional testing, but I am not able to ping eth0 from eth1 or vice versa. 

Note:

  • I also have tried same test on AM4378 SK EVM, with the default images present on SD card. On SK EMV also I am not able to ping eth0 from eth1 (loopback) or vice versa.
  • I am able to ping to PC/laptop from eth0/eth1.

See following block diagram illustrating the Ethernet cable connection.

Following is eth0 and eth1 configurations and ping command results:   

root@picv6-1:~# [  275.209337] cpsw 4a100000.ethernet eth1: Link is Down

[  279.849350] cpsw 4a100000.ethernet eth0: Link is Down

[  286.089616] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off

[  286.169688] cpsw 4a100000.ethernet eth1: Link is Up - 100Mbps/Full - flow control off

 

root@picv6-1:~# ifconfig -a

eth0      Link encap:Ethernet  HWaddr 14:42:FC:D2:84:61 

          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: 2001:db8::1642:fcff:fed2:8461/128 Scope:Global

          inet6 addr: fe80::1642:fcff:fed2:8461/64 Scope:Link

          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1

          RX packets:177 errors:0 dropped:3 overruns:0 frame:0

          TX packets:43 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3000

          RX bytes:22610 (22.0 KiB)  TX bytes:9169 (8.9 KiB)

          Interrupt:48

 

eth1      Link encap:Ethernet  HWaddr 14:42:FC:D2:84:63 

          inet addr:192.168.2.100  Bcast:192.168.2.255  Mask:255.255.255.0

          inet6 addr: fe80::1642:fcff:fed2:8463/64 Scope:Link

          inet6 addr: 2001:db8::1642:fcff:fed2:8463/128 Scope:Global

          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1

          RX packets:182 errors:0 dropped:3 overruns:0 frame:0

          TX packets:45 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3000

          RX bytes:23611 (23.0 KiB)  TX bytes:9307 (9.0 KiB)

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          inet6 addr: 2001:db8::200:ff:fe00:0/128 Scope:Global

          UP LOOPBACK RUNNING PROMISC  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:3000

          RX bytes:140 (140.0 B)  TX bytes:140 (140.0 B)

 

sit0      Link encap:IPv6-in-IPv4 

          NOARP  MTU:1480  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)

 

wlan0     Link encap:Ethernet  HWaddr 30:EB:1F:1D:A9:9A 

          UP BROADCAST PROMISC 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:3000

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 

root@picv6-1:~# netstat -rn

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1

root@picv6-1:~# ping -I eth0 192.168.2.100

PING 192.168.2.100 (192.168.2.100) from 192.168.1.100 eth0: 56(84) bytes of data.

^C

--- 192.168.2.100 ping statistics ---

15 packets transmitted, 0 received, 100% packet loss, time 558ms

pipe 3

root@picv6-1:~# ping -I eth1 192.168.1.100

PING 192.168.1.100 (192.168.1.100) from 192.168.2.100 eth1: 56(84) bytes of data.

^C

--- 192.168.1.100 ping statistics ---

9 packets transmitted, 0 received, 100% packet loss, time 346ms

pipe 3

 

We are using processor SDK 06_03_00_106, while going through CPSW driver section I came across following constraints while using dual standalone emac mode:

https://software-dl.ti.com/processor-sdk-linux/esd/docs/06_03_00_106/AM437X/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/CPSW.html

 

Constraints

 

The following are the constrains for Dual emac mode implementation

 

  • VLAN id 1 and 2 are reserved for EMAC 0 and 1 respectively for port segregation
  • Port vlans mentioned in dts file are reserved and should not be added to cpsw through vconfig as it violate the Dual EMAC implementation and switch mode will be enabled.
  • While adding VLAN id to the eth interfaces, same VLAN id should not be added in both interfaces which will lead to VLAN forwarding and act as switch
  • Manual ip for eth1 is not supported from Linux kernel arguments
  • Both the interfaces should not be connected to the same subnet unless only configuring bridging, and not doing IP routing, then you can configure the two interfaces on the same subnet.

               

I have following questions:

  1. Is it possible to ping from eth0 to eth1 in dual MAC configuration with Am437x.
  2. Do I have to configure eth0 and eth1 in specific way to make this work?
  3. I don’t completely understand this constraint “Both the interfaces should not be connected to the same subnet unless only configuring bridging, and not doing IP routing, then you can configure the two interfaces on the same subnet". As my eth0 and eth1 are on same subnet is that stopping me from pinging from eth1 to eth0 and vice versa.

 

  • Hello,

    The subnet is the 3rd number in the IP address. so for eth0 = 192.168.1.100, the subnet is 1. Even if two ethernet ports are physically connected, they will only look for communication on their subnet. Since one ethernet port is on subnet 1 and the other ethernet port is on subnet 2, it makes sense that you cannot ping from one to another.

    The constraint says, if your Ethernet ports are physically connected to each other (for example, both plugged into the same external Ethernet switch or the same network), they should be on different subnets. If you are curious about why that is required, let me know and I will find where we document the reasoning.

    Off the top of my head, I am not sure what would happen if you are doing a loopback from one Ethernet port to the other. Try putting them on the same subnet (e.g., 192.168.1.100 and 192.168.1.101) and see what happens.

    Regards,

    Nick

  • Following up: Without testing, I cannot say for sure what would happen when doing loopback with Linux Ethernet ports. However, there is potential that 1) The loopback test would not work, or 2) The kernel would figure out the source and destination is the host machine, and then just pass the data between the two applications without sending anything out an Ethernet port. So my initial suggestion would be to test Ethernet with a separate link partner (PC, a second AM437x EVM, etc).

    Regards,

    Nick

  • Hello Nick,

    I tried putting eth0 & eth1 on same subnet on our hardware and AM4378 SK EVM, but I am not able to see ping working on our hardware as well as on AM4378 SK EVM.

    see the following log:

    #Our hardware
    
    root@picv6-1:~# ifconfig eth0; ifconfig eth1
    eth0      Link encap:Ethernet  HWaddr 14:42:FC:D2:84:61
              inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: 2001:db8::1642:fcff:fed2:8461/128 Scope:Global
              inet6 addr: fe80::1642:fcff:fed2:8461/64 Scope:Link
              UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
              RX packets:86 errors:0 dropped:0 overruns:0 frame:0
              TX packets:54 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:3000
              RX bytes:16451 (16.0 KiB)  TX bytes:9965 (9.7 KiB)
              Interrupt:48
    
    eth1      Link encap:Ethernet  HWaddr 14:42:FC:D2:84:63
              inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::1642:fcff:fed2:8463/64 Scope:Link
              inet6 addr: 2001:db8::1642:fcff:fed2:8463/128 Scope:Global
              UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
              RX packets:52 errors:0 dropped:0 overruns:0 frame:0
              TX packets:86 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:3000
              RX bytes:9873 (9.6 KiB)  TX bytes:16107 (15.7 KiB)
    
    root@picv6-1:~# ping -I eth0 192.168.1.101
    PING 192.168.1.101 (192.168.1.101) from 192.168.1.100 eth0: 56(84) bytes of data.
    ^C
    --- 192.168.1.101 ping statistics ---
    9 packets transmitted, 0 received, 100% packet loss, time 326ms
    pipe 3
    root@picv6-1:~# ping -I eth1 192.168.1.100
    PING 192.168.1.100 (192.168.1.100) from 192.168.1.101 eth1: 56(84) bytes of data.
    ^C
    --- 192.168.1.100 ping statistics ---
    6 packets transmitted, 0 received, 100% packet loss, time 233ms
    pipe 3
    root@picv6-1:~#
    
    
    #SK EVM
    root@am437x-evm:~# ifconfig -a
    eth0      Link encap:Ethernet  HWaddr C4:BE:84:CC:87:B2
              inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:6840 (6.6 KiB)
              Interrupt:72
    
    eth1      Link encap:Ethernet  HWaddr C4:BE:84:CC:87:B4
              inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
              UP BROADCAST RUNNING 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:118 errors:0 dropped:0 overruns:0 frame:0
              TX packets:118 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:193518 (188.9 KiB)  TX bytes:193518 (188.9 KiB)
    
    root@am437x-evm:~# ping -I eth0 192.168.1.101
    PING 192.168.1.101 (192.168.1.101): 56 data bytes
    ^C
    --- 192.168.1.101 ping statistics ---
    9 packets transmitted, 0 packets received, 100% packet loss
    root@am437x-evm:~# ping -I eth1 192.168.1.100
    PING 192.168.1.100 (192.168.1.100): 56 data bytes
    ^V^C
    --- 192.168.1.100 ping statistics ---
    7 packets transmitted, 0 packets received, 100% packet loss
    root@am437x-evm:~

    1) The loopback test would not work

    • On our previous hardware which is AM335x bases, we used to run board level functional testing by doing loopback with Linux Ethernet ports. We had no problem pinging from eth0 to eth1.

    2) The kernel would figure out the source and destination is the host machine, and then just pass the data between the two applications without sending anything out an Ethernet port

    • kernel will pass the data between two application if we do not provide "-I" option while pinging. When we provide -I option while pinging kernel sends data out on Ethernet port 

    So my initial suggestion would be to test Ethernet with a separate link partner (PC, a second AM437x EVM, etc)

    • I have tested ethernet with separate link partner and it works with PC

  • Hi,

    The reason the ping failing is due the kernel is confused as to which port a MAC address belongs to. This presentation describes what is happening.

    What you are experiencing is a kernel level issue and not a driver issue. As you point out specifying the interface port does cause the packets to be transmitted but the issue of MAC address confusion still remains.

    I can't explain why you had success on the AM335x, perhaps there were some ip table rules in use that allowed the packets to be associated with the correct port. 

    Best Regards,

    Schuyler