官方文档查看地址:
http://doc.dpdk.org/guides/sample_app_ug/test_pipeline.html
PDF下载地址:
https://www.intel.com/content/www/us/en/embedded/technology/packet-processing/dpdk/dpdk-sample-applications-user-guide.html?eu-cookie-notice
本篇难度系数:
翻译:☆☆☆☆☆
理解:★★☆☆☆
41.测试管道的应用程序
测试管道应用程序演示了DPDK包框架工具套件的使用。其目的是演示单表DPDK管道的性能。
41.1.概述
应用程序使用三个CPU核心:
- Core A(“RX Core”)接收来自NIC端口的流量,并通过SW队列向Core B提供流量。
- Core B(“Pipeline Core”)实现了一个单表DPDK管道,其类型可以通过特定的命令行参数进行选择。Core B通过软件队列接收来自Core A的流量,根据表条目中配置的被输入包命中的操作对其进行处理,并通过另一组软件队列将其提供给Core C。
- Core C(“TX Core”)通过软件队列接收来自Core B的流量,并将其发送到NIC端口进行传输。
41.2.编译应用程序
要编译示例应用程序,请参见 Compiling the Sample Applications
应用程序位于$RTE_SDK/app/test-pipline目录中。
41.3.运行应用程序
41.3.1应用程序命令行
应用程序执行命令行为:
./test-pipeline [EAL options] -- -p PORTMASK --TABLE_TYPE
c或-l EAL CPU coremask/corelist选项必须恰好包含3个CPU内核。核心掩码中的第一个CPU内核分配给核心A,第二个CPU分配给核心B,第三个CPU分配给核心C。
PORTMASK 端口掩码参数必须包含2或4个端口。
41.3.2表类型和行为
表1描述了使用的表类型及其填充方式。哈希表预先填充了1600万个键。对于哈希表,可以选择以下参数:
- 可配置密钥大小实现或固定(专用)密钥大小实现(例如hash-8-ext或hash-spec-8-ext)。对于8字节和16字节的密钥大小,期望密钥大小专用实现提供更好的性能,而对于较大的密钥大小,期望密钥大小非专用实现提供更好的性能;
- 密钥大小(例如散列-spec-8-ext或散列-spec-16-ext)。可用选项有8、16和32字节;
- 表类型(例如hash-spec-16-ext或hash-spec-16-lru)。可用的选项是ext(可扩展桶)或lru(最近最少使用)。
# | TABLE_TYPE | Description of Core B Table | Pre-added Table Entries |
---|---|---|---|
1 | none | Core B is not implementing a DPDK pipeline. Core B is implementing a pass-through from its input set of software queues to its output set of software queues. | N/A |
2 | stub | Stub table. Core B is implementing the same pass-through functionality as described for the “none” option by using the DPDK Packet Framework by using one stub table for each input NIC port. | N/A |
3 | hash-[spec]-8-lru | LRU hash table with 8-byte key size and 16 million entries. | 16 million entries are successfully added to the hash table with the following key format:[4-byte index, 4 bytes of 0]The action configured for all table entries is “Sendto output port”, with the output port index uniformly distributed for the range of output ports.The default table rule (used in the case of a lookup miss) is to drop the packet.At run time, core A is creating the following lookup key and storing it into the packet meta data for core B to use for table lookup:[destination IPv4 address, 4 bytes of 0] |
4 | hash-[spec]-8-ext | Extendable bucket hash table with 8-byte key size and 16 million entries. | Same as hash-[spec]-8-lru table entries, above. |
5 | hash-[spec]-16-lru | LRU hash table with 16-byte key size and 16 million entries. | 16 million entries are successfully added to the hash table with the following key format:[4-byte index, 12 bytes of 0]The action configured for all table entries is “Send to output port”, with the output port index uniformly distributed for the range of output ports.The default table rule (used in the case of a lookup miss) is to drop the packet.At run time, core A is creating the following lookup key and storing it into the packet meta data for core B to use for table lookup:[destination IPv4 address, 12 bytes of 0] |
6 | hash-[spec]-16-ext | Extendable bucket hash table with 16-byte key size and 16 million entries. | Same as hash-[spec]-16-lru table entries, above. |
7 | hash-[spec]-32-lru | LRU hash table with 32-byte key size and 16 million entries. | 16 million entries are successfully added to the hash table with the following key format:[4-byte index, 28 bytes of 0].The action configured for all table entries is “Send to output port”, with the output port index uniformly distributed for the range of output ports.The default table rule (used in the case of a lookup miss) is to drop the packet.At run time, core A is creating the following lookup key and storing it into the packet meta data for Lpmcore B to use for table lookup:[destination IPv4 address, 28 bytes of 0] |
8 | hash-[spec]-32-ext | Extendable bucket hash table with 32-byte key size and 16 million entries. | Same as hash-[spec]-32-lru table entries, above. |
9 | lpm | Longest Prefix Match (LPM) IPv4 table. | In the case of two ports, two routes are added to the table:[0.0.0.0/9 => send to output port 0][0.128.0.0/9 => send to output port 1]In case of four ports, four entries are added to the table:[0.0.0.0/10 => send to output port 0][0.64.0.0/10 => send to output port 1][0.128.0.0/10 => send to output port 2][0.192.0.0/10 => send to output port 3]The default table rule (used in the case of a lookup miss) is to drop the packet.At run time, core A is storing the IPv4 destination within the packet meta data to be later used by core B as the lookup key. |
10 | acl | Access Control List (ACL) table | In the case of two ports, two ACL rules are added to the table:[priority = 0 (highest),IPv4 source = ANY,IPv4 destination = 0.0.0.0/9,L4 protocol = ANY,TCP source port = ANY,TCP destination port = ANY=> send to output port 0][priority = 0 highest),IPv4 source = ANY,IPv4 destination = 0.128.0.0/9,L4 protocol = ANY,TCP source port = ANY,TCP destination port = ANY=> send to output port 0].The default table rule (used in the case of a lookup miss) is to drop the packet. |
41.3.3输入流量
无论core B管道使用哪种表类型,都可以使用相同的输入流量来命中所有具有均匀分布的表条目,这导致在输出NIC端口集上发送的数据包分布均匀。输入流量配置文件为TCP/IPv4包,其中:
- 目标IP地址为A.B.C.D A固定为0,B、C、D随机
- 源IP地址固定为0.0.0.0
- 目标TCP端口固定为0
- 源TCP端口固定为0