84. L2 Forwarding Tests¶
This test application is a basic packet processing application using Intel® DPDK. It is a layer-2 (L2) forwarding application which takes traffic from a single RX port and transmits it with few modification on a single TX port.
For a packet received on a RX port (RX_PORT), it would be transmitted from a TX port (TX_PORT=RX_PORT+1) if RX_PORT is even; otherwise from a TX port (TX_PORT=RX_PORT-1) if RX_PORT is odd. Before being transmitted, the source mac address of the packet would be replaced by the mac address of the TX port, while the destination mac address would be replaced by 00:09:c0:00:00:TX_PORT_ID.
The test application should be run with the wanted paired ports configured using the coremask parameter via the command line. i.e. port 0 and 1 is a valid pair, while port 1 and 2 isn’t. The test is performed by running the test application and using a traffic generator. Tests are run with receiving a variety of size of packets generated by the traffic generator and forwarding back to the traffic generator. The packet loss and the throughput are the right ones need to be measured.
l2fwd application is run with EAL parameters and parameters for
the application itself. For details about the EAL parameters, see the relevant
DPDK Getting Started Guide. This application supports two parameters for
-p PORTMASK: hexadecimal bitmask of ports to configure
-q NQ: number of queue per lcore (default is 1)
If using vfio the kernel must be >= 3.6+ and VT-d must be enabled in bios.When using vfio, use the following commands to load the vfio driver and bind it to the device under test:
modprobe vfio modprobe vfio-pci usertools/dpdk-devbind.py --bind=vfio-pci device_bus_id
Assume port 0 and 1 are connected to the traffic generator, to run the test application in linuxapp environment with 4 lcores, 2 ports and 8 RX queues per lcore:
$ ./l2fwd -n 1 -c f -- -q 8 -p 0x3
Also, if the ports to be tested are different, the port mask should be changed. The lcore used to run the test application and the number of queue used for a lcore could be changed. For benchmarking, the EAL parameters and the parameters for the application itself for different test cases should be the same.
84.2. Test Case: Port testing¶
port A on packet generator connects to NIC
port 0, while
on packet generator connects to NIC
port 1. Set the destination mac address
of the packet stream to be sent out from
port A to the mac address of
port 0, while the destination mac address of the packet stream to be sent out
port B to the mac address of
port 1. Other parameters of the packet
stream could be anything valid. Then run the test application as below:
$ ./l2fwd -n 1 -c f -- -q 8 -p 0x3
Trigger the packet generator of bursting packets from
port A, then check if
port 0 could receive them and
port 1 could forward them back. Stop it
and then trigger the packet generator of bursting packets from
port B, then
port 1 could receive them and
port 0 could forward them back.
84.3. Test Case:
64/128/256/512/1024/1500 bytes packet forwarding test¶
Set the packet stream to be sent out from packet generator before testing as below.
|Frame Size||1q||2q||4q||8 q|
Then run the test application as below:
$ ./l2fwd -n 2 -c f -- -q 1 -p 0x3
The -n command is used to select the number of memory channels. It should match the number of memory channels on that setup.
Trigger the packet generator of bursting packets to the port 0 and 1 on the onboard NIC to be tested. Then measure the forwarding throughput for different packet sizes and different number of queues.