Ethernet Firmware
Ethernet Firmware differentiating features demos

Introduction


The applications that are part of this demo show Jacinto 7 integrated switch differentiating features like interVLAN routing in hardware, firewall, packet header based classification and rate limiting along with Layer-2 switching with VLAN, multicast and software-based interVLAN routing among the ports. The traffic forwarding process among the ports don't require CPU involvement or DMA bandwidth as everything is completely handled by CPSW hardware.

The intention behind this demo which encompasses multiple sub-demos is to show the switching capabilities of the J721E integrated Ethernet Switch (CPSW9G) as well as the software developed which includes CPSW IP low-level driver (CPSW LLD), TI NDK TCP/IP integration and Ethernet Switch Firmware (EthFw) application.

Below are top-level features demonstrated:

  • Basic L2 switching
  • Switching with VLAN
  • Multicast switching
  • HTTP server
  • Send/receive packets over TCP/UDP
  • Support for remote cores (Linux and TI RTOS)
  • Software-based interVLAN routing
  • Hardware-based interVLAN routing
  • IP next header filtering
  • MAC address based rate limiting

The Ethernet Firmware demo application is in charge of:

  • Opening the CPSW modules like ALE, MAC ports, host port and UDMA
  • Opening and configuring the MAC ports along with corresponding PHYs present in the GESI expansion board at RGMII/RMII 1Gbps mode
  • Initializing NDK stack
  • Configuring the HTTP and TCP/IP data servers

This application runs on the J721E EVM with GESI (Gateway/Ethernet Switch/Industrial Expansion Board) board. The demo requires two PCs running Ubuntu connected to the GESI board in order to demonstrate the L2 switching capabilities as well as to generate and monitor Ethernet traffic at different stages of the demo. The connection diagram is shown below.

demo_l2_switching_connections.png
EthFw demo connections diagram

Note: The IP addresses in above diagram can change based on your network configuration.

The demo application has a HTTP server hosting a web page which can be accessed by any external device connected to the CPSW switch.

A GUI-based control interface to enable/disable/configure features like VLAN, multicast, rate limiting, interVLAN routing and also to show the load of the CPU is added in the release.

A video streaming application, like Plex or VLC, can be used to demonstrate Ethernet packet switching functionality between multiple PCs. The media server will run on one PC and the client(s) will run on other PC(s), all connected to the switch via GESI board.

This demo uses Plex media system for video streaming. Plex clients can access media content via web interface, so any PC connected to the switch can easily access it.

Note: Please check licensing information and terms of usage of Plex TV media server and make sure it adheres to your organization's policy before using and configuring it.

A Remote Client application for the Main R5F core 1 is also available as part of this demo. This application runs a local NDK stack on a virtual network device which demonstrates the TI RTOS switch remote core integration.


Dependencies

This application depends on multiple components and are detailed in sections below:

  1. TI RTOS: Uses Task, Semaphore, Interrupt Handling HWI and Profiling Utility.
  2. PDK
    • Board library: Required for the configuration of pin muxing, clocking, etc.
    • OSAL library: Provides the abstraction layer implementation for TI RTOS
    • UART driver: Required to print output messages to serial port
    • UDMA driver: Required for global level initialization of the UDMA driver
    • CPSW driver: Provides an interface for the application to configure the control path of the CPSW switch, as well as the interface to send and receive Ethernet frames to/from CPSW's host port

Back To Top


Compile Time Configurations


Not applicable.

Back To Top


Demo Setup


Prerequisites

Plex server

Note: Plex server is required only in PC 1.

  1. Install Plex Media Server. The Ubuntu/Windows installation executable and instructions can be found in their website.
    • It's recommended to disable Plex authentication on the local network because this demo is not connected to internet and will not be able to login otherwise. Follow the instructions in this website.
  2. Once setup, the media server will be started every time that the PC is powered on.
  3. Add video samples to the Library as needed.

packETH tool

Note: packETH tool is required only in PC 1.

Install packETH packet generator tool on the Linux PC. The Ubuntu installation instructions can be found in their website.

The packEth configurations used in this demo are included in the Ethernet Firmware package at <ETHFW_PATH>/docs/packeth_configurations/

Note: Please check licensing information and terms of usage of packETH tool and make sure it adheres to your organization's policy before using and configuring it.

Python3 and Pip3

The GUI tool to send configurations is developed using Python3 and PyQt. Pip3 can be used to install additional Python modules required by the GUI tool.

Note: The GUI tool can be executed from either PC 1 or PC 2, so Python and its dependencies must be installed only on the selected PC.

Install Python3, PyQt, pip3 and other dependencies:

sudo apt install python3-pip
pip3 install --user pyqt5
sudo apt-get install python3-pyqt5
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools
pip3 install jsonschema pyserial serial xmodem

Wireshark

Note: Wireshark packet analyzer tool is required in both PC 1 and PC 2.

Refer to the Wireshark installation instructions on Ubuntu in this website.

iperf

Note: iperf network performance measurement tool is required on either PC 1 or PC 2.

Install iperf in the selected Ubuntu PC(s):

sudo apt-get install iperf

bmon

Note: bmon is required only on PC 2.

bmon is a network bandwidth monitoring tool that will be used in this demo to monitor the traffic received on PC 2 during the interVLAN tests.

Install bmon in the Ubuntu PC as follows:

sudo apt-get install bmon

DHCP Server

Note: DHCP server is required only in PC 1.

A DHCP server is required to assign IPs dynamically to all internal cores (A72, Main R5F core0, Main R5F core1) or external devices (PC 1, PC 2) in this demo.

  1. Refer to the DHCP installation and setup instructions on the Ubuntu website for further details.
  2. A possible configuration could be:
    subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.200 192.168.1.210;
        ...
    }
    
  3. Set the PC 1 IP to 192.168.1.<pc1> and the restart the DHCP server.
  4. Optional - If dynamic IP configuration is not possible, static IPs can be setup as follows:
    • For Linux,
      sudo ifconfig <ethDeviceName> 192.168.1.x netmask 255.255.255.0 up
      
    • For Windows, refer to the following website for suggested instructions about static IP configuration under a Windows environment.
Device IP address
PC 1 (Plex server) 192.168.1.202
J721E Main R5F core (running EthFw) 192.168.1.203
PC 2 (Plex client) 192.168.1.204
J721E A72 core (virtual net driver) 192.168.1.205
Default Gateway 192.168.1.1
Subnet Mask 255.255.255.0

Back To Top

CCS Boot

Prerequisites

Install Code Composer Studio and setup a Target Configuration for use with J721E EVM. Refer to IDE (CCS).

Steps

  1. Connect a micro USB cable to JTAG port of J721E_EVM. The XDS110 JTAG connector is labeled XDS110 (J3).
  2. Connect a micro USB cable to MAIN Domain UART port on J721E_EVM. It's labeled UART (J44).
  3. Set EVM's DIP switches SW8 and SW9 for no-boot mode:
    • SW8 = 10001000
    • SW9 = 01110000
  4. Open up a serial terminal for UART2 communication. This terminal will show logs from MCU2_0 core where the demo application runs.

    • Set serial parameters to: 115200 8N1.
    • Set hardware and software flow control to "No".
    • Below figure shows serial parameters set in Minicom.
    demo_l2_switching_minicom.png
    Serial Port Settings in Minicom
  5. Power on the J721E EVM board. Ensure that SD card is not present or QSPI flashed.
  6. Connect the laptops/PCs as per demo connections diagram above.
    • Important: DHCP server (if required) must be connected to MAC Port 1.
    • Note: Do not connect any device to MAC Port 0 as it may not be functional, please refer to the Known issues sections for further details
  7. For loading demo application binaries through CCS on J721E, please refer to Load Example Binaries on J721E section.
    • Main R5F core 0: app_remoteswitchcfg_server.xer5f
    • Main R5F core 1: app_remoteswitchcfg_client.xer5f

Note: Linux running on A72 core is not compatible with CCS boot mode.

Back To Top

SD Card Boot

Steps

  1. Create a bootable SD card with Linux bootloader, kernel and file system. For details about SD card creation, refer to the Processor SDK Linux Automotive User's Guide.
  2. Copy the demo application to the firmware directory of Linux file system in SD card:
    cp <SDK_INSTALL_PATH>/ethfw_xx_xx_xx/out/J721E/R5F/SYSBIOS/debug/app_remoteswitchcfg_server.xer5f <MOUNT>/rootfs/lib/firmware/
    
  3. Update the soft-link j7-main-r5f0_0-fw to point to the demo application copied to SD card in the previous step:
    cd <MOUNT>/rootfs/lib/firmware/
    ln -sf app_remoteswitchcfg_server.xer5f j7-main-r5f0_0-fw
    
  4. Optional: Copy the remote client application to the firmware directory of Linux filesystem in SD card and update soft-link:
    cp <SDK_INSTALL_PATH>/ethfw_xx_xx_xx/out/J721E/R5F/SYSBIOS/debug/app_remoteswitchcfg_client.xer5f <MOUNT>/rootfs/lib/firmware/
    cd <MOUNT>/rootfs/lib/firmware/
    ln -sf app_remoteswitchcfg_client.xer5f j7-main-r5f0_1-fw
    
  5. Connect a micro USB cable to MAIN Domain UART port on J721E_EVM. It's labeled UART (J44).
  6. Set EVM's DIP switches SW8 and SW9 for SD card boot:
    • SW8 = 10000010
    • SW9 = 00000000
  7. Open up a serial terminal for UART0 communication. This terminal will show logs from Linux bootloader and kernel.
    • Set serial parameters to: 115200 8N1.
  8. Open up a serial terminal for UART2 communication. This terminal will show logs from MCU2_0 core where the demo application runs.

    • Set serial parameters to: 115200 8N1.
    • Set hardware and software flow control to "No".
    • Below figure shows serial parameters set in Minicom.
    demo_l2_switching_minicom.png
    Serial Port Settings in Minicom
  9. Insert SD card into slot labeled MICRO SD and power on the J721E EVM board.

Back To Top


Running the Demo


Connecting External Devices

  1. Connect PC 1 to MAC port 3 of GESI board. Refer to the J721E EVM GESI Expansion Board section to find the right RJ-45 connector.
  2. Connect PC 2 to MAC port 2 of GESI board.

Note: The demo application in this release assumes that external devices, PC 1 and PC 2, are connected prior to starting the demo. It's a mandatory step.

The IPs assigned dynamically to Main R5F cores 0 and 1 will be printed in the UART2 serial terminal.

HTTP Server

A HTTP server is also part of the demo application running in the Main R5F core 0. The following is a snapshot of the webpage loaded when client accesses the HTTP server on J721E EVM using a web browser: http://192.168.1.<r5f_0>.

tcpipdemopage.png
TCP/IP HTTP Server Landing Page

Also, if Main R5F core 1 has been loaded with the remote client application, then a second HTTP server running on that core can be access from either PC connected to the switch using a web browser: http://192.168.1.<r5f_1>.

Back To Top

Plex TV

Plex TV Server

Plex TV server running on PC 1 requires an initial setup covered in the Prerequisites section. Note that Plex server may required to be explicitly launched after PC has been booted.

Plex TV Client

Run Plex client from PC 2 by accessing the following address using your favorite web browser: http://192.168.1.<pc1>:32400/web/index.html

PlexClient.png
Plex client interface

Back To Top

Virtual Net Driver on A72

Once the EVM is booted along with Linux on A72, the virtual net driver module should be loaded and the eth1 network device corresponding to CPSW9G should be added.

  1. Verify this by running ifconfig -a on Linux terminal console of the EVM.
  2. Activate network interface on A72 core as follows:
    sudo ifconfig eth1 up
    
  3. At this point, data transfer with other devices connected to the network should be possible. Ping the two PCs connected to the switch:
    ping 192.168.1.<pc1>
    ping 192.168.1.<pc2>
    
  4. Similarly, ping the A72 core for either PC connected to the switch:
    ping 192.168.1.<a72>
    

Back To Top

iperf

The CPSW switch is capable of steering network traffic without CPU intervention by classifying it based on its characteristics. This can be demonstrated by running iperf server on Linux running on the A72 core and iperf client on any of the external devices, PC 1 or PC 2.

  1. Start iperf server on Linux running on A72.
    iperf -s
    
  2. Run iperf client on the selected PC. Set test duration with -t option as needed.
    iperf -c 192.168.1.<a72> -t 20 -i 1
    
  3. Simultaneously, access the HTTP server at http://192.168.1.<r5f_0> from the same PC shows traffic being steered towards different processing cores (A72 or R5F).

Back To Top

GUI Configurator Tool

  1. After getting the IP address printed on the console, launch the GUI tool:

    cd <SDK_INSTALL_PATH>/pdk/packages/ti/drv/cpsw/tools/cpsw_configclient
    sudo python3 switchconfig_client.py
    

    You should be able to see a window opening up as shown below.

    cpswconfigurationtool.png
    CPSW Remote Configuration Tool
  2. Select the SETTINGS tab and enter the target IP 192.168.1.<r5f_0> as shown below.

    cpsw_cfgtool_ipset.png
    CPSW Remote Configuration Tool

    Once the IP is set, the Main R5 Load progress bar will get updated periodically.

  3. Using the tool the Port statistics can be obtained using the PORT STATISTICS tab.

Back To Top

InterVLAN Routing

Software InterVLAN Routing

  1. Open the CONFIGURATION FILE tab of the GUI tool. Configuration files can be sent to the switch in order to enable or disable features of the CPSW9G.
  2. To enable software-based interVLAN routing, click on the Open button and select the sw_intervlan_routing_config.txt file present in the <SDK_INSTALL_PATH>/pdk/packages/ti/drv/cpsw/tools/cpsw_configclient/config_files directory.
  3. Always parse the configuration before sending to the EVM using the Parse button.
    • Note: The list of allowed commands and the configurations are present in the schemas.py file in the cpsw_configclient/inc directory.
  4. If the parsing succeeded, press the Send Config button to send the configuration to the switch.
  5. Now that the software-based interVLAN routing is enabled, the functionality can be verified by sending packets with VLAN ID using packETH tool.
  6. In the packETH tool on the PC 1, which has IP address 192.168.1.<pc1>, load the swintervlanrouting configuration file from <ETHFW_PATH>/docs/packeth_configurations/ directory.

    The loaded configuration should match with the below picture.

    packethswintervlan.png
    packETH settings for software interVLAN routing
  7. packETH configuration for software interVLAN routing:

    • Destination MAC = 02:00:00:00:00:02
    • Source MAC = 00:11:01:00:00:01
    • VLAN ID = 0x64
    • Source IP = 192.168.1.202
    • Destination IP = 192.168.1.204
    • TTL = 255
    • Payload = 300 bytes

    Note that source and destination IP address don't have to match either PC 1 or PC 2 address. They match the IP address in the sw_intervlan_routing_config.txt config file, so they must not be changed.

  8. The packets sent with the above configuration will be routed to the PC 2 with IP address 192.168.1.<pc2> and the VLAN ID will be changed to 0xC8 (200 in decimal). This can be verified using tools like Wireshark on the receiver PC.
  9. The received packets should have the following header:
    • Destination MAC = 00:11:02:00:00:01
    • Source MAC = 02:00:00:00:00:02
    • VLAN ID = 0xC8
    • Source IP = 192.168.1.202
    • Destination IP = 192.168.1.204
    • TTL = 254
    • Payload = 300 bytes
  10. Run bmon tool on PC 2 to monitor the bandwidth of the traffic being received from the switch.
  11. If packets are sent at a higher data rate, the CPU load will spike up. This can be clearly seen from the GUI tool.

Hardware InterVLAN Routing

  1. Open the CONFIGURATION FILE tab of the GUI tool.
  2. To enable hardware-based interVLAN routing, click on the Open button and select the hw_intervlan_routing_config.txt file present in the <SDK_INSTALL_PATH>/pdk/packages/ti/drv/cpsw/tools/cpsw_configclient/config_files directory.
  3. Always parse the configuration before sending to the EVM using the Parse button.
  4. If the parsing succeeded, press the Send Config button to send the configuration to the switch.
  5. Now that the hardware-based interVLAN routing is enabled, the functionality can be verified by sending packets with VLAN ID using packETH tool.
  6. Load the hwintervlanrouting configuration file from <ETHFW_PATH>/docs/packeth_configurations/ directory.

    The loaded configuration should match with the below picture.

    packethhwintervlan.png
    packETH settings for hardware interVLAN routing
  7. packETH configuration for hardware interVLAN routing:

    • Destination MAC = 02:00:00:00:00:02
    • Source MAC = 00:11:01:00:00:01
    • VLAN ID = 0x64
    • Source IP = 192.168.1.201
    • Destination IP = 192.168.1.204
    • TTL = 255
    • Payload = 300 Bytes

    Note that source and destination IP address don't have to match either PC 1 or PC 2 address. They match the IP address in the hw_intervlan_routing_config.txt config file, so they must not be changed.

  8. The packets sent with the above configuration will be routed to the PC 2 with IP address 192.168.1.<pc2> and the VLAN ID will be changed to 0xC8 (200 in decimal). This can be verified using tools like Wireshark on the receiver PC.
  9. The received packets should have the following header:
    • Destination MAC = 00:11:02:00:00:01
    • Source MAC = 02:00:00:00:00:02
    • VLAN ID = 0xC8
    • Source IP = 192.168.1.201
    • Destination IP = 192.168.1.204
    • TTL = 254
    • Payload = 300 bytes
  10. Run bmon tool on PC 2 to monitor the bandwidth of the traffic being received from the switch.
  11. Since the routing is now offloaded to hardware, there will be no impact on the CPU load even for data rates as high as 1Gbps.

Back To Top

IP Next Header Filtering

CPSW9G supports whitelisting of upto four different IP protocols for a VLAN group. This demo whitelists TCP and UDP protocols and hence blocking packets of other protocols in the VLAN network.

  1. Add a VLAN entry with vlanId: 0x2BC (700 in decimal) with host port, MAC ports 2 and 3 as members of the VLAN group.
  2. Open the CONFIGURATION FILE tab of the GUI tool.
  3. To add the above mentioned VLAN entry, click on the Open button and select the ip_nxt_hdr_whitelisting_config.txt file present in the <SDK_INSTALL_PATH>/pdk/packages/ti/drv/cpsw/tools/cpsw_configclient/config_files directory.
  4. Always parse the configuration before sending to the EVM using the Parse button.
  5. If the parsing succeeded, press the Send Config button to send the configuration to the switch.
  6. Load the ipnxthdr_tcp configuration file from <ETHFW_PATH>/docs/packeth_configurations/ directory to the packEth tool and start sending packets.
  7. Since TCP is whitelisted, the packets will be received at PC 2. This can be verified by using Wireshark in PC 2 with ip.addr eq 192.168.1.202 && vlan filter.
  8. Similarly, ipnxthdr_udp packETH configuration can be used to verify UDP.
  9. Since the ICMP protocol is not whitelisted, packets sent using ipnxthdr_icmp_echorequest from packETH won't be received at PC 2.

Back To Top

Rate Limiting

  1. Rate Limiting can be enabled by adding a policer entry with parameters like Source and Destination MAC address of the traffic to be limited. The rate at which the traffic is limited is based on the values of Peak Information Rate (PIR) and Committed Information Rate (CIR) both in bits per second (bps) set in the policer entry.
  2. Open the CONFIGURATION FILE tab of the GUI tool.
  3. To enable rate limiting, click on the Open button and select the rate_limiting_config.txt file present in the <SDK_INSTALL_PATH>/pdk/packages/ti/drv/cpsw/tools/cpsw_configclient/config_files directory.
  4. Always parse the configuration before sending to the EVM using the Parse button.
  5. If the parsing succeeded, press the Send Config button to send the configuration to the switch.
  6. Load the ratelimiting configuration file from <ETHFW_PATH>/docs/packeth_configurations/ directory to the packETH tool and stat sending packets at a rate more than 200 Mbps.
  7. The packets received at the PC 2 will not exceed the receive rate of 200Mbps (~25MBps), since the PIR is set to 200 Mbps. This can be verified by checking the receive rate using bmon or System Monitor in PC 2.

Back To Top


Sample output

Below is a sample log from the execution of this demo application.

### UART Console Logs
=======================================================
CPSW_9G Test on MAIN NAVSS
CPSW L2 Switching APP
CpswPhy_bindDriver: PHY 0: OUI:080028 Model:23 Ver:01 <-> 'dp83867' : OK
=======================================================
CpswPhy_bindDriver: PHY 3: OUI:080028 Model:23 Ver:01 <-> 'dp83867' : OK
IPC_echo_test (core : mcu2_0) .....
Remote device (core : mcu2_1) .....
PHY 0 is alive
Remote demo device (core : mcu2_0) .....
PHY 3 is alive
PHY 12 is alive
PHY 15 is alive
PHY 16 is alive
PHY 17 is alive
PHY 18 is alive
PHY 23 is alive
Host MAC address: 70:ff:76:1d:87:8c
[NIMU_NDK] CPSW has been started successfully
CPSW NIMU application, IP address I/F 1: 192.168.1.203
Rx Flow for Software Inter-VLAN Routing is up
Cpsw_handleLinkUp: port 3: Link up: 1-Gpbs Full-Duplex
Cpsw_handleLinkUp: port 2: Link up: 1-Gpbs Full-Duplex
Function:app_ethrdev_srv_cb_attach_ext_handler,HostId:0,CpswType:1
Function:app_ethrdev_srv_cb_register_mac_handler,HostId:0,Handle:a2b336c0,CoreKey:38acb7e60
Cpsw_ioctlInternal: CPSW: Registered MAC address.ALE entry:10, Policer Entry:0Function:app5
================LLI Table entries===========
Number of Static ARP Entries: 1
SNo. IP Address MAC Address
------ ------------- ---------------
0 192.168.1.205 70:FF:76:1D:87:8B

Back To Top


Document Revision History


Revision Date Author Description
0.1 01 Apr 2019 Prasad J, Misael Lopez Created for v.0.08.00
0.2 12 Jun 2019 Prasad J Updates for EVM demo (.85 release)
0.3 17 Jul 2019 Misael Lopez Updates for v.0.09.00
0.4 14 Oct 2019 Santhana Bharathi N Updates for v.1.00.00