Ethernet System Software on Sitara AM-Class Processors. Why am I not getting an IP address?

Ethernet System Software on Sitara AM-Class Processors “Why am I not getting an IP address?” 1 Agenda • Overview of Ethernet System Software Compon...
Author: Ezra Riley
42 downloads 1 Views 1MB Size
Ethernet System Software on Sitara AM-Class Processors “Why am I not getting an IP address?”

1

Agenda • Overview of Ethernet System Software Components • Ethernet Overview from U-Boot • Ethernet Overview from Linux • Debugging Ethernet • Example Use Cases

2

Takeaways • Determine basic “it’s alive” link status. • Identify the MLO/U-Boot and Linux drivers that make up the Ethernet system on the Sitara AM3x/AM4x/AM5x processors. • Understand configuration options for MLO/U-Boot and Linux Ethernet drivers. • Establish transfer data links for MLO/U-boot and Linux (auto-neg/DHCP/ARP/IP/UDP&TCP). • Access performance data on the TI wiki. • Utilize the available tools: ping, miitool, ethtool, wireshark

3

Ethernet System Driver Ethernet System Software on Sitara AM-Class Processors

4

Ethernet Link Overview (Simplified) • A packet needs to be sent with an application. • The application submits the packet to the network driver. • The network stack passes the packet to the CPSW driver, which sends it out. • The MDIO driver works with the CPSW driver and network stack to indicate valid link status. • Receiving a packet with the application follows the reverse process. • This presentation shows how to prove the “it’s alive” status for an Ethernet link by examining the configuration steps, debug methods to verify link status and packet send/receive, as well as performance.

Application

pkt

Network Stack

CPSW Driver

Network

MDIO Driver

5

U-Boot CPSW/MDIO Driver Support/Configuration Ethernet System Software on Sitara AM-Class Processors

6

U-Boot CPSW/MDIO Driver Questions • What is the network model for MLO/U-boot? • How are the drivers configured and built into MLO/U-boot? • How are PHY addresses managed? • How is Pin Mux set up?

7

U-Boot: Networking Capabilities • The prime function of U-boot is to boot a binary image. For this discussion, this image is the Linux kernel. • U-boot has some basic networking support to allow it to pull images using tftp, bootp (ROM booting), etc.

BOOTP FTP Server

• U-boot does not run any kind of network daemon; Each network transaction causes the HW to be initialized because U-boot is driver stateless. • Each network call goes through a complete initialization of the network interface. • Source tree produces MLO/SPL & U-boot. • Ethernet boot loads SPL/MLO. 8

U-Boot: CPSW/MDIO Driver Configuration #define CONFIG_DRIVER_TI_CPSW

• CPSW – The CONFIG_DRIVER_TI_CPSW define brings in all necessary network driver support for CPSW into the MLO/SPL – U-Boot build.

• MDIO – CPSW automatically enables support for MDIO as well – The main configuration item is ensuring the PHY addresses are correct within the cpsw_slave structure in the board file. – Typically, no special PHY support is needed.

include/configs/ti_am335x_common.h: #define CONFIG_DRIVER_TI_CPSW include/configs/am57xx_evm.h: #define CONFIG_DRIVER_TI_CPSW include/configs/am43xx_evm.h: #define CONFIG_DRIVER_TI_CPSW board/ti/am.../board.c static struct cpsw_slave_data cpsw_slaves[] = { { .slave_reg_ofs = 0x208, .sliver_reg_ofs = 0xd80, .phy_addr = 1, }, { .slave_reg_ofs = 0x308, .sliver_reg_ofs = 0xdc0, .phy_addr = 2, }, }; 9

U-Boot: Ethernet Configuration (AM335x/AM43x Pin Mux) AM335xx/AM43xx pin configuration: • AM33xx and AM43xx “mostly” follow the same method of enabling pin mux for the Ethernet. • AM33xx has several pin mux options already defined. • TI EVMs use an eeprom to decide which pin mux to enable.

board/ti/am335x/mux.c static struct module_pin_mux rgmii1_pin_mux[] = { /* ethernet port and mdio port together */ }; void enable_board_pin_mux(void) { }

board/ti/am43xx/mux.c static struct module_pin_mux rmii1_pin_mux[] = { /* ethernet port only */ }; static struct module_pin_mux mdio_pin_mux[] = { }; void enable_board_pin_mux(void) { } 10

U-Boot: Ethernet Configuration (AM57xx Pin Mux) • AM57xx pin mux: board/ti/am57xx/mux_data.h /* output of pin mux tool required */ set_muxconf_regs_essential(void) { do_set_mux32((*ctrl)->control_padconf_core_base, early_padconf, ARRAY_SIZE(early_padconf)); }

• All pin mux settings must be done when the part is in isolation mode on the AM57x only. This function is called early on in MLO/SPL, typically using the s_init function, to allow the pins contexts to be completed while the AM57xx is isolation mode.

11

U-Boot Ethernet Summary • U-boot Ethernet support is stateless; no background server daemons. • ROM will boot MLO/SPL on AM335x/AM43xx. • CPSW support is configured to be built in SDK by default. • PHY driver support is configured to be built in by default. • Pin mux data for MDIO and CPSW • Pin mux configuration function call

12

U-Boot Ethernet Link Establishment Ethernet System Software on Sitara AM-Class Processors

13

U-Boot: Link Establishment • Is there a basic utility that can be used to check the PHY status? • What are basic link establishment commands? • What does a link establishment look like on Wireshark? • PHY link status that happens through auto negotiation does not use software to establish the link.

14

U-Boot: MII Utility The MII utility that is built into U-boot accesses the MII compatible registers of a PHY. This provides a view into the PHY over the MDIO bus; No CPSW interaction here. U-Boot# mii mii - MII utility commands Usage: mii device mii device mii info mii read mii write mii modify

-

list available devices set current device display MII PHY info read MII PHY register write MII PHY register modify MII PHY register updating bits identified in mii dump - pretty-print (0-5 only) Addr and/or reg may be ranges, e.g. 2-7. 15

U-Boot: Looking at the PHY Registers System Boot has halted in U-Boot. Use the MII tool to look at the PHY. U-Boot# mii info PHY 0x00: OUI = 0x0885, Model = 0x22, Rev = 0x02, 1000baseT, FDX PHY 0x01: OUI = 0x0885, Model = 0x22, Rev = 0x02, 10baseT, HDX

1000baseT Full-Duplex is the indicated speed, which could indicate auto-negotiation succeeded.

10baseT Half-Duplex is the lowest possible speed and duplicity, which is an indicator that auto-negotiation failed. Cable not connected.

• Good indication that auto-negotiation has completed successfully. 16

U-Boot: Looking at the PHY Registers (continued) System Boot has halted in U-Boot. Look at the PHY first. Reg Address

PHY Address U-Boot# mii dump 0 0 0. (1140) (8000:0000) 0.15 (4000:0000) 0.14 (2040:0040) 0. 6,13 (1000:1000) 0.12 (0800:0000) 0.11 (0400:0000) 0.10 (0200:0000) 0. 9 (0100:0100) 0. 8 (0080:0000) 0. 7 (003f:0000) 0. 5- 0

= = = = = = = = = =

0 0 b10 1 0 0 0 1 0 0

-- PHY control register -reset loopback speed selection = 1000 Mbps A/N enable power-down isolate restart A/N duplex = full collision test enable (reserved) 17

U-Boot: Looking at the PHY Registers (continued) System Boot has halted in U-Boot. Look at the PHY first. U-Boot# mii dump 0 1 1. (796d) (8000:0000) 1.15 (4000:4000) 1.14 (2000:2000) 1.13 (1000:1000) 1.12 (0800:0800) 1.11 (0400:0000) 1.10 (0200:0000) 1. 9 (0100:0100) 1. 8 (0080:0000) 1. 7 (0040:0040) 1. 6 (0020:0020) 1. 5 (0010:0000) 1. 4 (0008:0008) 1. 3 (0004:0004) 1. 2 (0002:0000) 1. 1 (0001:0001) 1. 0

= = = = = = = = = = = = = = = =

0 1 1 1 1 0 0 1 0 1 1 0 1 1 0 1

-- PHY status register -100BASE-T4 able 100BASE-X full duplex able 100BASE-X half duplex able 10 Mbps full duplex able 10 Mbps half duplex able 100BASE-T2 full duplex able 100BASE-T2 half duplex able extended status (reserved) MF preamble suppression A/N complete remote fault A/N able link status jabber detect extended capabilities

Auto-negotiation completed … and most importantly, the PHY indicates a link has been completed with the link partner.

Are the speeds and mode duplicity matching PHY strapping? 18

U-Boot: Try a Ping • Before any network transactions, U-boot must set the ipaddr environment variable through either DHCP or env.txt or save environment. • To use DHCP to only obtain an IP address, set the autoload parameter to no. Otherwise, it will try to tftp an image. • DHCP command will acquire an IP address. • Ping another address.

U-Boot# setenv autoload n U-Boot# dhcp link up on port 0, speed 1000, full duplex BOOTP broadcast 1 BOOTP broadcast 2 BOOTP broadcast 3 DHCP client bound to address 128.247.83.212 (1008 ms)

• Can you ping the target board running U-boot? – No. U-boot initiates all of its network transactions.

• What does this indicate? 19

U-Boot: IP Address Acquisition • U-boot sends out DHCP Discover message. • DHCP server offers an IP address. • U-Boot accepts IP offer. • Notice that U-boot is not responding to any ARP request from DHCP Server, even after ACKing IP address. • Only in a loop looking for DHCP messages. 20

U-Boot: Link Establishment Summary • AM33xx/AM43xx ROMs have Ethernet boot capability. • The PHY must have a link with a link partner. The MII utility can provide update on auto-negotiation result, as well as link status (Remember: No software is used in auto-negotiation to establish the link). • U-Boot has tools, such as ping, that can be used to test Ethernet connectivity. • U-Boot is a driver stateless piece of software. Remember the DHCP example: No ARP processing, single-thread DHCP waiting for a response. 21

Linux Ethernet CPSW & MDIO Driver Support Ethernet System Software on Sitara AM-Class Processors

22

Linux: CPSW/MDIO Driver Support/Configuration • How are the drivers CPSW and MDIO configured to be built? • How are the bindings done to enable switch/dual-MAC mode? • How are the PHY modes set? • How are the PHY addresses set?

23

Linux: CPSW/MDIO Device Tree • The processor include file (EX:am33xx.dtsi) contains most of the interface definitions required.

Don’t modify

arch/arm/boot/dts/custom_board.dts &mac {

• The remaining definitions are PHY mode and address, dual-mac or switch mode. • The drivers need to have the DTS status set to “okay” for the kernel to probe them.

#include “xx.dtsi"

pinctrl-names = "default", "sleep"; pinctrl-0 = ; pinctrl-1 = ; dual_emac = ; status = "okay"; };

&davinci_mdio { pinctrl-names = "default", "sleep"; pinctrl-0 = ; pinctrl-1 = ; status = "okay"; }; 24

Linux: CPSW/MDIO Device Tree • How is PHY mode set for an interface? arch/arm/boot/dts/custom_board.dts

• How is the PHY address set per interface

&cpsw_emac0 { phy_id = , ; phy-mode = "rgmii-txid"; dual_emac_res_vlan = ; };

&cpsw_emac1 { phy_id = , ; phy-mode = "rgmii-txid"; dual_emac_res_vlan = ; };

25

Linux: CPSW/MDIO Driver Support • The default kernel config for Sitara devices has CPSW and MDIO support. • Notice the menuconfig path to this configuration screen.

26

Linux: PHY Driver Support • The default kernel config for Sitara devices has support for the PHYs that are on the EVMs. • Notice the menuconfig path to this configuraion screen. • This is one method to see what PHY support is in the TI/Mainline kernel.

27

Linux: CPSW/MDIO Driver Support/Configuration • The default SDK kernel configuration has the drivers for CPSW and MDIO enabled. • The device tree node for CPSW & MDIO was reviewed on how to setup the PHY mode, PHY address, dual-MAC mode and how to enable the nodes so they are probed by the kernel.

28

Linux Ethernet Link Establishment Ethernet System Software on Sitara AM-Class Processors

29

Link to IP Address to Data Transfer • What initialization is the kernel doing of the network drivers? • What does the default SDK do to bring up a network interface? • How is the console log of the link establishment used? • Once Linux is booted what tools are there to look at the link establishment?

30

Linux Ethernet Link: SDK Network Interface Bringup • The kernel initializes the drivers. But how is the eth0 network interface started? • Before starting, /etc/network/interfaces defines the network interfaces for the system. • On systems using sysVinit to init the system, a run-level script issues the command to bring up the interface.

/etc/network/interfaces (snippet) # Wired or wireless interfaces auto eth0 iface eth0 inet dhcp ... ... iface eth1 inet dhcp iface eth2 inet dhcp iface eth3 inet dhcp iface eth4 inet dhcp /etc/rc5.d/S01networking (snippet) . echo -n "Configuring network interfaces... " ifup -a echo "done .

31

Linux: Boot Log PHY Related

• When Linux starts up, typically the first output seen in the boot log is the MDIO driver looking for PHYs on the MDIO bus. • In the example log below, the MDIO driver is finding two PHYs and is able to associate the found PHYs with a driver. • Please note that just because a PHY answers up on the bus does not mean a valid link or PHY state.

Starting kernel ... [

0.000000] Booting Linux on physical CPU 0x0

davinci_mdio 48485000.mdio: davinci mdio revision 1.6 davinci_mdio 48485000.mdio: detected phy mask fffffffc libphy: 48485000.mdio: probed davinci_mdio 48485000.mdio: phy[0]: device 48485000.mdio:00, driver Micrel KSZ9031 Gigabit PHY davinci_mdio 48485000.mdio: phy[1]: device 48485000.mdio:01, driver Micrel KSZ9031 Gigabit PHY cpsw 48484000.ethernet: Detected MACID = d4:f5:13:87:0b:8c 32

Linux: Boot Log PHY Related am57xx-idk-common.dtsi &cpsw_emac0 { phy_id = , ; phy-mode = "rgmii"; dual_emac_res_vlan = ; };

The PHY address found has to correlate to the device tree entry for the PHY addresses for each MAC interface.

&cpsw_emac1 { phy_id = , ; phy-mode = "rgmii"; dual_emac_res_vlan = ; };

davinci_mdio 48485000.mdio: phy[0]: device 48485000.mdio:00, driver Micrel KSZ9031 Gigabit PHY davinci_mdio 48485000.mdio: phy[1]: device 48485000.mdio:01, driver Micrel KSZ9031 Gigabit PHY

33

Linux: Boot Log Ethernet Status

The log shows cycling of the link status up/down as the PHY driver communicates with the PHY. When an IP lease is obtained, there is a good chance the link is now valid and can be used.

Starting kernel ... INIT: Entering runlevel: 5 Configuring network interfaces... [ 9.378836] net eth0: initializing cpsw version 1.15 (0) net eth0: phy found : id is : 0x221622 net eth0: phy found : id is : 0x221622 udhcpc (v1.23.1) started Sending discover... cpsw 48484000.ethernet eth0: Link is Up - Unsupported (update phy.c)/Half - flow control off cpsw 48484000.ethernet eth0: Link is Down Sending discover... cpsw 48484000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx Sending discover... Sending select for 128.247.83.21... Lease of 128.247.83.21 obtained, lease time 3600 /etc/udhcpc.d/50default: Adding DNS 192.0.2.2 /etc/udhcpc.d/50default: Adding DNS 192.0.2.3 34

Linux: ethtool ethtool can be used to look at basic link status for the network interface. root@am57xx-evm:~# ethtool eth0 Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supported pause frame use: Symmetric Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Advertised pause frame use: Symmetric Advertised auto-negotiation: Yes Link partner advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full 35

Linux: ethtool • Link status, duplicity mode, and speed reported is the key information being reported here. root@am57xx-evm:~# ethtool eth0

• Link speed of 10Mb/s and halfduplex are indications that the PHY link failed auto negotiation.

Link partner advertised pause frame use: Symmetric Link partner advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: MII PHYAD: 0 Transceiver: external Auto-negotiation: on Supports Wake-on: d Wake-on: d Current message level: 0x00000000 (0) Link detected: yes 36

Linux: ethtool • This ethtool option will dump the hardware statistics of the MAC. • From Ethernet System Hardware on Sitara AM-Class Processors: – The RX CRC errors indicate the packet was received wrong at the MAC interface. – The RX DMA Overruns indicate RX descriptor exhaustion. This typically shows up as dropped packets in performance tests.

root@am57xx-evm:~# ethtool -S eth0 NIC statistics: Good Rx Frames: 2172 Broadcast Rx Frames: 854 Multicast Rx Frames: 1272 Pause Rx Frames: 0 Rx CRC Errors: 0 Rx Align/Code Errors: 0 Oversize Rx Frames: 0 Rx Jabbers: 0 Undersize (Short) Rx Frames: 0 Rx Fragments: 0 Rx Octets: 418917 Good Tx Frames: 34 Broadcast Tx Frames: 2 Multicast Tx Frames: 32 Pause Tx Frames: 0 Deferred Tx Frames: 0 Collisions: 0 Rx DMA Overruns: 0 root@am57xx-evm:~# 37

Linux: How an IPv4 Address is Obtained Filtering on a MAC address.

38

Linux: Ping Transaction Note the ARP request followed by the ICMP request (ping) from PC and the response from the EVM.

39

Linux: ifconfig • This is the network interface config command. In this example, the status of the interface is returned: eth0 is Up and has an IP address. • This command can also be used to set the IP address statically and other parameters for the interface.

root@am57xx-evm:~# ifconfig eth0 Link encap:Ethernet HWaddr D4:F5:13:87:0B:8C inet addr:192.168.2.9 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::d6f5:13ff:fe87:b8c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:13 errors:0 dropped:0 overruns:0 frame:0 TX packets:28 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1545 (1.5 KiB) TX bytes:5155 (5.0 KiB) Interrupt:104 40

Summary of Linux Link Establishment • Now you have the tools to answer the question of why “I am

connected to a gateway but the board is not getting the IP address.”

• What does the boot log show? • What does ethtool show for the link speed, duplicity mode and link status? • What does ethtool show for the HW MAC or CPSW CPSTATS? • What does Wireshark show on the link establishment?

41

Linux Ethernet Performance Ethernet System Software on Sitara AM-Class Processors

42

Linux Ethernet Performance • What are the different modes of ping? • What is iperf? • How is iperf used?

43

Network Performance Wiki • Every core SDK release the Ethernet system is tested using iperf to measure throughput. • Each Processor in the catalog portfolio is tested on some, not all, EVMs • TCP and UDP tests are performed, the link below points the latest performance testing

http://ap-fpdsp-swapps.dal.design.ti.com/index.php/Sdk_2015.03_(4.1)#Ethernet_Driver 44

Network Performance Wiki

http://ap-fpdsp-swapps.dal.design.ti.com/index.php/Sdk_2015.03_(4.1)#Ethernet_Driver 45

Linux Ethernet Performance • Iperf is a key utility that is used to benchmark the SDK performance. • Iperf is also used as a “what if” for evaluating system performance.

46

Linux Ethernet Dual MAC/Switch Mode Ethernet System Software on Sitara AM-Class Processors

47

Topologies

AM3x/AM4x/AM5x

AM3x/AM4x/AM5x

eth0 192.168.0.1

eth0 192.168.0.x

Port 2

Port 2

CPSW

CPSW

• Single Port Mode

Port 0

• Daisy chain (switch)

Network Switch

• Dual MAC mode (Gateway)

CPSW

Port 0

Subnet 1

Port 1

AM3x/AM4x/AM5x

AM3x/AM4x/AM5x

eth0 192.168.0.1

eth0 192.168.0.x

Port 2

Port 2

CPSW

AM3x/AM4x/AM5x Port 2

Port 0

Port 0

Port 1

CPSW

Port 0

Port 1

Subnet 0 Subnet 2 48

Network Switch Network Switch

• Switches use Store and Forward.

Port Mirroring

• Only broadcast traffic is seen on all ports. Otherwise, traffic is port-specific. • To be able to use a packet sniffer with a network switch, Port Mirroring must be used.

Network

• Why is this important on how Wireshark is hooked up?

(DHCP Server)

PC

Packet Sniffer

Target Device

49

Linux Ethernet: Highlighted Use Cases Ethernet System Software on Sitara AM-Class Processors

50

Linux Ethernet: Why Different Subnets are Required When using Dual-MAC Mode Ethernet System Software on Sitara AM-Class Processors Linux Ethernet: Highlighted Use Cases

51

Linux Ethernet: Same Subnet Problem (Dual MAC) Network Switch

• There are problems that can occur when one or more network interfaces are plugged into the same subnet in a dual-MAC configuration. • For this experiment, the topology shown here was used. A TI EVM with the CPSW in dual-mac mode is connected with both ports on the same subnet. • There are articles that can be Googled indicating this is not a recommended topology.

Port Mirroring

192.168.0.2

Laptop (Wireshark) (DHCP)

Port Mirroring

192.168.0.5

192.168.0.3 Port 0

Port 1

CPSW Port 2

192.168.0.4

Laptop (Wireshark)

AM3x/AM4x/AM5x

Block diagram of setup

Ethernet Bonding is used when link redundancy is desired.

52

Linux Ethernet: Same Subnet Problem (Dual MAC) Network Switch

• First attempt to ping the laptop with the address 192.168.0.4. • Since there was an interface specified, the ping packets were sent out through port 0.

Port Mirroring

192.168.0.2

Laptop (Wireshark) (DHCP) root@am57xx-evm:~# ping 192.168.0.4 PING 192.168.0.4 (192.168.0.4): 56 data bytes 64 bytes from 192.168.0.4: seq=0 ttl=64 time=0.327 ms 64 bytes from 192.168.0.4: seq=1 ttl=64 time=0.277 ms

Port Mirroring

192.168.0.5

192.168.0.3 Port 0

Port 1

CPSW Port 2

192.168.0.4

Laptop (Wireshark)

AM3x/AM4x/AM5x

Block diagram of setup

53

Linux Ethernet: Same Subnet Problem (Dual MAC) Network Switch

• Second attempt fails to ping the laptop with the address 192.168.0.4 works. • The eth1 interface was specified. So now the ping packets are sent out through port 1. • All ping packets were lost.

Port Mirroring

192.168.0.2

192.168.0.5

192.168.0.3

Laptop (Wireshark) (DHCP)

Port Mirroring

Port 0

Port 1

CPSW Port 2

192.168.0.4

Laptop (Wireshark)

AM3x/AM4x/AM5x root@am57xx-evm:~# ping -I eth1 192.168.0.4 PING 192.168.0.4 (192.168.0.4): 56 data bytes ^C --- 192.168.0.4 ping statistics --9 packets transmitted, 0 packets received, 100% packet loss

Block diagram of setup

54

Linux Ethernet: Same Subnet Problem (Dual MAC) • Why are none of the ping packets returning from the laptop? • Follow the packets… • Ping Req from eth1 on EVM to laptop. • PC sends ARP to find MAC address of EVM. • Since ARP is a broadcast, eth0 responds with its MAC address, which is incorrect for eth1. 55

Linux Ethernet: Same Subnet Problem (Dual MAC) • Since the ARP broadcast returned the wrong MAC address for eth1, every Ping reply from the laptop has the incorrect destination mac address. Therefore, eth0 is getting all the responses instead of eth1. • Initial look on Wireshark looks like every ping request has a matching ping reply.

root@am57xx-evm:~# ifconfig eth0 HWaddr D4:F5:13:87:0B:8C eth1 HWaddr D4:F5:13:87:0B:8D

56

Linux Ethernet: Bonding Links Ethernet System Software on Sitara AM-Class Processors Linux Ethernet: Highlighted Use Cases

57

Ethernet Example Bonding: Link Setup • Bonding is a form of link aggregation used to provide a method of a link failsafe. • Depending on the bonding mode, the failover can happen instantaneously or will have a latency.

Data streamed one direction EVM1

EVM2

192.168.0.1

192.168.0.2

• You are encouraged to perform research to understand all the aspects of the method (e.g., There are six modes of bonding). • Requires configuring the kernel to enable the bonding feature as a module. 58

Ethernet Example Bonding: Kernel Configuration • To enable Ethernet Bonding support in the kernel, follow the path in the red box. • This driver will only select as a module. It will not be selectable to be built in. According to kernel documentation, the reason is because there are parameters that are only passable in module mode.

59

Ethernet Example Redundant Link Setup

Script to enable a redundant link. Two EVMs listed here.

• Example for setting up a bonded link on an EVM with two external CPSW ports. • In this example, the ports between the two EVMs are configured with static IP addresses using ifconfig. • Using Mode 3, which is broadcast and provides fault tolerance if one link fails

#!/bin/sh modprobe bonding ifconfig eth0 down ifconfig eth1 down echo 3 > /sys/class/net/bond0/bonding/mode ifconfig bond0 192.168.0.1 netmask 255.255.255.0 up echo +eth0>/sys/class/net/bond0/bonding/slaves echo +eth1>/sys/class/net/bond0/bonding/slaves #!/bin/sh modprobe bonding ifconfig eth0 down ifconfig eth1 down echo 3 > /sys/class/net/bond0/bonding/mode ifconfig bond0 192.168.0.2 netmask 255.255.255.0 up echo +eth0>/sys/class/net/bond0/bonding/slaves echo +eth1>/sys/class/net/bond0/bonding/slaves 60

Linux Ethernet: Single Interface using Second Port on AM3x/AM4x/AM5x Ethernet System Software on Sitara AM-Class Processors

61

Linux Ethernet: Single Interface using Second Port • There are some pin mux configurations on devices that use the CPSW 3P to enable Ethernet. This requires using the second external port as the primary interface. • The key step is setting the active_slave flag to 1 in the MAC node of the board DTS. This tells the driver to use the second interface as primary in a single MAC configuration. • NOTE: The appended &mac node, which modifies any processor dtsi file, limits future merges from TI.

arch/arm/boot/dts/am33xx.dtsi active_slave = ;

Leave as is

arch/arm/boot/dts/custom_board.dts &mac { pinctrl-names = "default", "sleep"; pinctrl-0 = ; pinctrl-1 = ; active_slave = ;Appending new interface value status = "okay"; };

http://processors.wiki.ti.com/index.php/Linux_Core_CPSW_User's_Guide#Primary_Interface_on_Second_External_Port

62

Summary Ethernet System Software on Sitara AM-Class Processors

63

Summary / Final Exam / Checklist • What state does the PHY need to be in to communicate? – Connected

• What configuration is needed to build in U-Boot support for networking? – Support comes by default, CONFIG_DRIVER_TI_CPSW

• What is the U-Boot command to read PHY status? – mii

• What configuration is needed to building Linux Ethernet support – Kernel Config and board DTS file

• What is the Linux tool used to read and set interface status? – ethtool

64

For More Information • Ethernet System Hardware on Sitara AM-Class Processors • For questions regarding topics covered in this training, visit the support forums at the TI E2E Community website: http://e2e.ti.com

65

Suggest Documents