赞
踩
官方文档查看地址:
http://doc.dpdk.org/guides/linux_gsg/quick_start.html
PDF下载地址:
https://www.intel.com/content/www/us/en/embedded/technology/packet-processing/dpdk/dpdk-getting-started-guide.html
本篇难度系数:
翻译:★☆☆☆☆
理解:★☆☆☆☆
9.快速启动设置脚本
在usertools子目录中找到的dpdk-setup.sh脚本允许用户执行以下任务:
完成这些步骤后,用户可以编译自己的应用程序,这些应用程序链接到EAL库中,以创建DPDK映像。
9.1脚本组织
sh脚本逻辑上组织为用户按顺序执行的一系列步骤。每个步骤都提供许多选项来指导用户完成所需的任务。下面是每个步骤的简要概述。
9.2用例
下面是如何使用dpdk-setup.sh脚本的一些示例。脚本应该使用source命令运行。脚本中的一些选项提示用户在继续之前输入更多的数据。
警告
应该使用root特权运行dpdk-setup.sh脚本。
source usertools/dpdk-setup.sh ------------------------------------------------------------------------ RTE_SDK exported as /home/user/rte ------------------------------------------------------------------------ Step 1: Select the DPDK environment to build ------------------------------------------------------------------------ [1] i686-native-linux-gcc [2] i686-native-linux-icc [3] ppc_64-power8-linux-gcc [4] x86_64-native-freebsd-clang [5] x86_64-native-freebsd-gcc [6] x86_64-native-linux-clang [7] x86_64-native-linux-gcc [8] x86_64-native-linux-icc ------------------------------------------------------------------------ Step 2: Setup linux environment ------------------------------------------------------------------------ [11] Insert IGB UIO module [12] Insert VFIO module [13] Insert KNI module [14] Setup hugepage mappings for non-NUMA systems [15] Setup hugepage mappings for NUMA systems [16] Display current Ethernet device settings [17] Bind Ethernet device to IGB UIO module [18] Bind Ethernet device to VFIO module [19] Setup VFIO permissions ------------------------------------------------------------------------ Step 3: Run test application for linux environment ------------------------------------------------------------------------ [20] Run test application ($RTE_TARGET/app/test) [21] Run testpmd application in interactive mode ($RTE_TARGET/app/testpmd) ------------------------------------------------------------------------ Step 4: Other tools ------------------------------------------------------------------------ [22] List hugepage info from /proc/meminfo ------------------------------------------------------------------------ Step 5: Uninstall and system cleanup ------------------------------------------------------------------------ [23] Uninstall all targets [24] Unbind NICs from IGB UIO driver [25] Remove IGB UIO module [26] Remove VFIO module [27] Remove KNI module [28] Remove hugepage mappings [29] Exit Script
选项:
下面的选择演示了x86_64-native-linux-gcc
DPDK库的创建。
Option: 9
================== Installing x86_64-native-linux-gcc
Configuration done
== Build lib
...
Build complete
RTE_TARGET exported as x86_64-native-linux-gcc
下面的选择演示了DPDK UIO驱动程序的启动。
Option: 25
Unloading any existing DPDK UIO module
Loading DPDK UIO module
下面的选择演示了如何在NUMA系统中创建大型页面。每个节点分配1024个2 MByte的页面。结果是,应用程序应该使用-m 4096来启动应用程序,以访问这两个内存区域(如果没有提供-m选项,则自动执行)。
请注意
如果显示删除临时文件的提示,请键入“y”。
Option: 15
Removing currently reserved hugepages
mounting /mnt/huge and removing directory
Input the number of 2MB pages for each node
Example: to have 128MB of hugepages available per node,
enter '64' to reserve 64 * 2MB pages on each node
Number of pages for node0: 1024
Number of pages for node1: 1024
Reserving hugepages
Creating /mnt/huge and mounting as hugetlbfs
下面的选择演示了在单个核心上运行测试应用程序的启动。
Option: 20
Enter hex bitmask of cores to execute test app on
Example: to execute app on cores 0 to 7, enter 0xff
bitmask: 0x01
Launching app
EAL: coremask set to 1
EAL: Detected lcore 0 on socket 0
...
EAL: Master core 0 is ready (tid=1b2ad720)
RTE>>
9.3应用程序
一旦用户运行了dpdk-setup.sh脚本,构建了一个EAL目标并设置了大页(如果使用Linux EAL目标之一),用户就可以继续构建和运行他们的应用程序或提供的示例之一。
/examples目录中的示例为理解DPDK的操作提供了一个很好的起点。下面的命令序列显示了如何构建和运行helloworld示例应用程序。正如4.2.1节“应用程序使用逻辑核心”所建议的,在为应用程序选择要使用的核心掩码时,应该确定平台的逻辑核心布局。
cd helloworld/ make CC main.o LD helloworld INSTALL-APP helloworld INSTALL-MAP helloworld.map sudo ./build/app/helloworld -l 0-3 -n 3 [sudo] password for rte: EAL: coremask set to f EAL: Detected lcore 0 as core 0 on socket 0 EAL: Detected lcore 1 as core 0 on socket 1 EAL: Detected lcore 2 as core 1 on socket 0 EAL: Detected lcore 3 as core 1 on socket 1 EAL: Setting up hugepage memory... EAL: Ask a virtual area of 0x200000 bytes EAL: Virtual area found at 0x7f0add800000 (size = 0x200000) EAL: Ask a virtual area of 0x3d400000 bytes EAL: Virtual area found at 0x7f0aa0200000 (size = 0x3d400000) EAL: Ask a virtual area of 0x400000 bytes EAL: Virtual area found at 0x7f0a9fc00000 (size = 0x400000) EAL: Ask a virtual area of 0x400000 bytes EAL: Virtual area found at 0x7f0a9f600000 (size = 0x400000) EAL: Ask a virtual area of 0x400000 bytes EAL: Virtual area found at 0x7f0a9f000000 (size = 0x400000) EAL: Ask a virtual area of 0x800000 bytes EAL: Virtual area found at 0x7f0a9e600000 (size = 0x800000) EAL: Ask a virtual area of 0x800000 bytes EAL: Virtual area found at 0x7f0a9dc00000 (size = 0x800000) EAL: Ask a virtual area of 0x400000 bytes EAL: Virtual area found at 0x7f0a9d600000 (size = 0x400000) EAL: Ask a virtual area of 0x400000 bytes EAL: Virtual area found at 0x7f0a9d000000 (size = 0x400000) EAL: Ask a virtual area of 0x400000 bytes EAL: Virtual area found at 0x7f0a9ca00000 (size = 0x400000) EAL: Ask a virtual area of 0x200000 bytes EAL: Virtual area found at 0x7f0a9c600000 (size = 0x200000) EAL: Ask a virtual area of 0x200000 bytes EAL: Virtual area found at 0x7f0a9c200000 (size = 0x200000) EAL: Ask a virtual area of 0x3fc00000 bytes EAL: Virtual area found at 0x7f0a5c400000 (size = 0x3fc00000) EAL: Ask a virtual area of 0x200000 bytes EAL: Virtual area found at 0x7f0a5c000000 (size = 0x200000) EAL: Requesting 1024 pages of size 2MB from socket 0 EAL: Requesting 1024 pages of size 2MB from socket 1 EAL: Master core 0 is ready (tid=de25b700) EAL: Core 1 is ready (tid=5b7fe700) EAL: Core 3 is ready (tid=5a7fc700) EAL: Core 2 is ready (tid=5affd700) hello from core 1 hello from core 2 hello from core 3 hello from core 0
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。