Zephyrnet Logo

VLAN Frames Testing Procedure on MPSoC Devices

Date:

VLAN is defined as a virtual local area network. It is used to keep network applications separate despite being connected to the same physical network, and without requiring multiple sets of cabling and networking devices to be deployed.

VLAN works by applying tags to network frames and handling these tags in networking systems, i.e., creating the appearance and functionality of network traffic that is physically on a single network but acts as if it is split between separate networks.

The PS Gigabit Ethernet Controllers (GEMs) on Zynq, MPSoC and Versal devices all support VLAN tagged frames. 

This blog will document detailed steps on how to test VLAN frames with PS GEM on MPSoC devices. For convenience, here we are using a Xilinx pre-provided ZCU102 BSP. You can use a custom XSA which has either of the PS GEMs enabled. 

Build the PetaLinux Project with VLAN Support Enabled

Here, we are using a Xilinx pre-provided ZCU102 BSP to build the PetaLinux project by following the below steps.

To create a project use the following command:

  •  petalinux-create -t project -s ./xilinx-zcu102-v2020.2-final.bsp

After the project has been created, navigate to the project directory, and enable 8021Q support:

  •  petalinux-config -c kernel
    • To select VLAN support: select Networking support – > Networking options → 802.1Q/802.1ad VLAN Support

Enable tcpdump and net-tools:

  • petalinux-config -c rootfs
    • To enable tcpdump, select Filesystem Packages → net → tcpdump → tcpdump
    • To enable net-tools, select Filesystem Packages → misc → net-tools → net-tools

Then build the PetaLinux project:

  •  petalinux-build

To build the Linux Image, navigate to the directory ./images/linux and use the below command:

  • petalinux-package --boot --fsbl zynqmp_fsbl.elf --fpga system.bit --pmufw pmufw.elf --u-boot

Boot the design on a ZCU102 board

You can copy the images to the SD card and boot it up on the ZCU102 board. If a remote connection is used, the following boot command can be used instead:

  • petalinux-boot --jtag --kernel --bitstream images/linux/system.bit --hw_server-url hostmachine:3121

I am using a remote connection here and the host machine is that my ZCU102 is connected to. 

Steps to Setup VLAN Interfaces on Both Target (ZCU102) and Host Interfaces

On the board after logging in as root, use “ifconfig” to get the IP address. In my case, my PS GEM3 is showing up as eth0 with the IP address 10.10.70.1.

Then do the following commands to add a slave VLAN interface attached to eth0:

  • ip link add link eth0 name eth0.100 type vlan id 100
  • ip addr add 10.10.70.50/24 brd 10.10.70.255 dev eth0.100
  • ip link set dev eth0.100 up
  • ifconfig

You should see the below output in the console. The VLAN interface eth0.100 has been created. 

image2021-7-1_13-17-30.png

On the host machine, first, type “ifconfig” to find the existing interfaces. In my case, I have two Ethernet interfaces and a local loopback interface shown below.

The “eth0” is the normal internet connection while “eth1” is connecting to the ZCU102 and has an IP address of 10.10.70.101.

image2021-7-1_13-21-8.png

Now, we will create a slave VLAN interface attached to eth1. Here are the steps:

  • sudo modprobe 8021q
  • sudo ip link add link eth1 name eth1.5 type vlan id 100
  • sudo ip addr add 10.10.70.40/24 brd 10.10.71.255 dev eth1.5
  • sudo ip link set dev eth1.5 up
  • ifconfig

After “ifconfig”, the VLAN interface can be seen on the host. 

image2021-7-1_13-19-48.png

 

VLAN Testing

We have now set up two slave VLAN interfaces on the target (ZCU102) and host machines respectively with both having the same VLAN ID of 100. This is to make sure that we can transmit and receive responses for VLAN tagged frames on both sides. 

We are going to test both TX and RX VLAN frames sent from and to the ZCU102 board. The “tcpdump” command can be used to view VLAN tagged frames in the console directly or it can be captured in a .pcap file so that it can also be viewed in Wireshark. 

TX Testing

To test TX, on the host, set up “tcpdump” to capture incoming frames and listen on the eth1 interface with the following command:

  • tcpdump -i eth1 -w hostvlanZCU102.pcap &

On the target (ZCU102), run the following “ping” command.

  • ping -I eth0.100 10.10.70.40 &

Then we need to kill “tcpdump” so that the frames are captured in the pcap file.

  • sudo killall -s INT tcpdump &

Now we can review the capture in Wireshark. Below is a snapshot:

image2021-7-1_13-45-6.png

 

As shown, the VLAN tagged frames are sent from the VLAN interface on the target, which also gets the response from the VLAN interface on the host. 

RX Testing

To test RX, on the target run the “tcpdump” command and add a filter for VLAN frames.

  • tcpdump -i eth0 'vlan and icmp' and ip host 10.10.70.1 and ether host 00:0a:35:00:22:01 -n -ev &

On the host, run the “ping” command:

  • ping 10.10.70.1 -I eth1.5 -c 3 &

On the target, we can see that 3 VLAN frames have been captured:

image2021-7-1_14-10-48.png

PlatoAi. Web3 Reimagined. Data Intelligence Amplified.
Click here to access.

Source: https://forums.xilinx.com/t5/Design-and-Debug-Techniques-Blog/VLAN-Frames-Testing-Procedure-on-MPSoC-Devices/ba-p/1240602

spot_img

Latest Intelligence

spot_img