1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
.. Copyright (c) 2010,2011 Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
- Neither the name of Intel Corporation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
==================
Layer-2 Forwarding
==================
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.
The ``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
itself.
- ``-p PORTMASK``: hexadecimal bitmask of ports to configure
- ``-q NQ``: number of queue per lcore (default is 1)
Prerequisites
=============
Support igb_uio and vfio driver, if used vfio, kernel need 3.6+ and enable vt-d in bios.
When used vfio , used "modprobe vfio" and "modprobe vfio-pci" insmod vfiod driver, then used
"./tools/dpdk_nic_bind.py --bind=vfio-pci device_bus_id" to bind vfio driver to test driver.
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.
Test Case: Port testing
=======================
Assume ``port A`` on packet generator connects to NIC ``port 0``, while ``port B``
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
from ``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
check if ``port 1`` could receive them and ``port 0`` could forward them back.
Test Case: ``64/128/256/512/1024/1500`` bytes packet forwarding test
====================================================================
Set the packet stream to be sent out from packet generater before testing as below.
+-------+---------+---------+---------+-----------+
| Frame | 1q | 2q | 4q | 8 q |
| Size | | | | |
+-------+---------+---------+---------+-----------+
| 64 | | | | |
+-------+---------+---------+---------+-----------+
| 65 | | | | |
+-------+---------+---------+---------+-----------+
| 128 | | | | |
+-------+---------+---------+---------+-----------+
| 256 | | | | |
+-------+---------+---------+---------+-----------+
| 512 | | | | |
+-------+---------+---------+---------+-----------+
| 1024 | | | | |
+-------+---------+---------+---------+-----------+
| 1280 | | | | |
+-------+---------+---------+---------+-----------+
| 1518 | | | | |
+-------+---------+---------+---------+-----------+
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.
|