SPRADJ8 October   2024 AM3351 , AM3352 , AM3354 , AM3356 , AM3357 , AM3358 , AM3359 , AM4372 , AM4376 , AM4377 , AM4378 , AM4379 , AM620-Q1 , AM623 , AM625 , AM625-Q1 , AM62A3 , AM62A3-Q1 , AM62A7 , AM62A7-Q1 , AM62P , AM6411 , AM6412 , AM6421 , AM6422 , AM6441 , AM6442 , DP83822H , DP83822HF , DP83822I , DP83822IF , DP83826E , DP83826I , DP83848-EP , DP83848Q-Q1 , DP83867CR , DP83867CS , DP83867E , DP83867IR , DP83867IS , DP83TC812R-Q1 , DP83TC812S-Q1 , DP83TC813R-Q1 , DP83TC813S-Q1 , DP83TC814R-Q1 , DP83TC814S-Q1 , DP83TG720R-Q1 , DP83TG720S-Q1 , DP83TG721R-Q1 , DP83TG721S-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. Terminology
  5. Prerequisites
  6. Quick Initial Steps
  7. Debug Overview
  8. Network Driver Initialization Process
  9. Ethernet PHY Analysis
  10. Ethernet MAC Statistics Analysis
  11. How IPv4 Address is Obtained
  12. Follow the Packet
  13. 10Debug Network Topologies and Techniques
    1. 10.1 Direct Connection
    2. 10.2 Static IP Addresses
    3. 10.3 Setting Low Bit Rates
    4. 10.4 Beware When Connecting to a Switch
  14. 11Linux® Utilities Summary
  15. 12Checklist for Requesting Ethernet Support

Quick Initial Steps

Before debugging a potential network connection issue, there are some initial steps to verify if there is an issue with basic transmission or reception of Ethernet packets. The first step is to see if there is an Ethernet interface defined. The next step is to determine if a link was established between two link partners. The final step is verifying if Ethernet MAC statistics show packets are being transmitted or received without any corruption.

The following is a summary of the first steps in debugging the Ethernet interface. Perform these steps after the DUT has successfully booted into a Linux environment.

  1. Check if the interface has initialized by using ifconfig -a or ip link show
  2. Determine if a link was established with a link partner by using ethtool <interface name>
    • On TI EVMs this is ethtool eth0 to view the details for the first Ethernet interface
  3. Verify if any packets have been sent or received by using ethtool -S <interface name>

The term link partners simply means two directly connected platforms such as what is shown Figure 3-1. This is called a direct connect topology. For the above three initial steps, a recommended link partner to the DUT is a PC running Ubuntu or another known good Linux platform. The reason why the recommended link partner is on a Linux platform is to provide a symmetric test environment such that the link partner mirrors a similar platform to that of the DUT running Linux. Additionally, ethtool is easily available on a Linux platform.

Figure 3-1 shows how the Ethernet interface is broken down into two components: the MAC and the PHY. The MAC is responsible for sending and receiving packets. The PHY is responsible for converting the signals from the MAC to the Ethernet cable.

AM62x, AM64x, AM62Ax, AM62P Full Ethernet Packet FlowFigure 3-1 Full Ethernet Packet Flow

After confirming the interface to test is listed with ifconfig -a or ip link show, the next step is to see if there is an Ethernet link detected with a link partner.

Note:

Debug Suggestions:

If the interface is not listed from the ifconfig or ip a command, then this can mean there is an error in the DTS file that defines the CPSW or PRU-ICSSG Ethernet interface. Both CPSW and PRU-ICSSG are TI-designed Ethernet interfaces. See also Section 5.

When an Ethernet cable is connected between the two link partners such as a TI EVM and a PC, the Ethernet PHY on both devices attempts to establish a link between the two devices independent of any software running such as a ping test. If there is a link detected, the next step is to check if any traffic has occurred for either reception of packets or transmission of packets. If the Ethernet driver on the DUT does not see a link detection, then the Ethernet driver does not initialize and no network traffic passes.

The ethtool utility is used for both steps of link detection and traffic analysis. Step 1 is checking for link detection. In this example, the interface under test is assumed to be eth0. The following code snippet shows a partial output of the ethtool command. There is a lot of information printed out but the section of interest is the Link detected: property. The Linked detected: is either yes if a link is detected or no if a link is not detected. The speed and duplex mode are also returned by this command and indicate what the link speed and duplex mode are.

root@am62xx-evm:~# ethtool eth0
Settings for eth0:
         ...
         Speed: 1000Mb/s
         Duplex: Full
         ...
         PHYAD: 0
         Link detected: yes

If a link is not detected, then no traffic is able to pass. Resolve this situation before proceeding.

Note:

Debug Suggestions:

If no link is detected by the connected PHY, then the next step is to review the PHY hardware configuration and MDIO communication information explained in Section 6.

After an Ethernet link is detected, the MAC hardware statistics (results from ethtool -S <interface name>) can be reviewed. The information returned from the MAC hardware statistics contains data about basic packet send and receive. Examining if packets are sent and received on the DUT gives an indication to whether the Ethernet interface and Ethernet PHY is functioning or not. Additionally, the DUT not receiving an IPv4 address or not receiving a ping response does not necessarily mean that there is an issue with the basic sending and receiving of packets. For example, not receiving an IPv4 address can be as simple as there not being a DHCP server to provide the IPv4 address.

The Ethernet MAC statistics are the most accurate set of statistics in terms of whether the Ethernet MAC is sending and receiving packets. These are the most accurate statistics to look at because this data is directly measured from the physical wire, with no additional abstraction layers. The transmitted (TX packets) or received (RX packets) packet counts shown by the ifconfig or ip -s link command is not completely accurate from a MAC perspective. Packets can be dropped between the kernel network stack and the MAC driver.

The following code snippet shows a partial example of Ethernet MAC hardware statistics showing received and transmitted packets as well as any associated errors. This example shows what is expected when there is good reception of Ethernet frames being detected and successfully transmitted Ethernet frames. There can be transmit errors that are only be viewable by the connected link partner Ethernet MAC hardware statistics. More details on link partner analysis are found in Section 9.

root@am62xx-evm:~# ethtool -S eth0
NIC statistics:
         ...
         rx_good_frames: 1127
         ...
         rx_crc_errors: 0
         rx_align_code_errors: 0
         ...
         tx_good_frames: 163

Find more information on how RX and TX traffic errors can be analyzed in Section 7.

In summary, if there is a network interface defined (for example, eth0), a link is detected with a link partner, the send and receive packet counters are incrementing, and no error counters are incrementing in the MAC statistics, then there is not an issue with basic send and receive of Ethernet packets.

One common question is if applications such as ping or iperf3 (formerly iperf) are needed to do basic send and receive of Ethernet frames. Once Linux has booted, there is an attempt to acquire an IP address using broadcast messages. The traffic from these broadcast messages are what is used to do basic send and receive of Ethernet frames. Find more details on how IPv4 addresses are obtained in Section 8.

Note:

Debug Suggestions:

  • If there is no transmitted traffic, several reasons can cause this such as no PHY clocking, PinMuxing, and so forth. See also Section 6.
  • If there is no received traffic, there can be one of several reasons such as clocking, data timing, PinMuxing, and so forth. See also Section 6 and review the relevant DTS properties.
  • Review Ethernet MAC Statistics Analysis.

Section Summary:

  • Use ethtool <interface name> to check for a link in the desired interface. If there is no link then this issue must be debugged. No data can pass without a link detection.
  • If a link is detected then ethtool -S <interface name> can be used to detect basic Ethernet frame (or packet) send and receive (that is, to view the Ethernet MAC hardware statistics). If there are Ethernet frames or packets detected, then the interface is working at a basic level. If the statistics indicate no Ethernet frames or packets have been sent or received, then this is the area to debug.