一台服务器运行多个DPDK程序
一台电脑运行多个DPDK程序(同时两个l3fwd+同时跑两个pktgen) 此博文包含图片 (2016-10-02 00:03:43)转载▼
标签: 多个 dpdk l3fwd --proc-typeauto 同时运行 分类: DPDK
作者:温兴泵,原文地址:http://blog.sina.com.cn/s/blog_90cfda2f0102x58j.html
版权所有,转载请注明以上信息,谢谢合作~
如何在一台电脑上同时运行多个DPDK程序呢?如果在你启动一个程序后,再启动第二个程序是会报错的!那么如何实现呢,本教程叫你如何实现一个电脑同时跑四个DPDK程序,两个l3fwd+两个pktgen~
所用的版本为DPDK16.04,pktgen2.9.17
(安装教程见我的之前一个博文:http://blog.sina.com.cn/s/blog_90cfda2f0102ws79.html)
step1:查看电脑的网卡
root@dpdk3-Super-Server:/home/dpdk3/wenxingbeng/dpdk-16.04# lspci | grep Ethernet
02:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
02:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
03:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
03:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
06:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
07:00.0 Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev 03)
其中黑色斜体部分是我教程中使用的四个DPDK绑定的网卡~
step2:查看电脑的CPU
root@dpdk3-Super-Server:/home/dpdk3/wenxingbeng/dpdk-16.04# ./tools/cpu_layout.py
Core and Socket Information (as reported by ‘/proc/cpuinfo’)
cores = [0, 1, 2, 3, 4, 5, 6, 7]
sockets = [0]
Socket 0
--------
Core 0 [0]
Core 1 [1]
Core 2 [2]
Core 3 [3]
Core 4 [4]
Core 5 [5]
Core 6 [6]
Core 7 [7]
可以看出电脑有一个Socket,没有开超线程,一个Socket有8个核~
step3:规划端口和核给l3fwd和pktgen
step4:启动多个DPDK程序
【特别提醒:命令行第二行起,最好前面加一个多余的空格】
-
[1]第一个l3fwd
./build/l3fwd -c 0x3 -n 2 –proc-type auto \
–socket-mem 512 --file-prefix pg1 \
-w 02:00.0 \
– -p 0x1 --config="(0,0,1)" -
[2]第二个l3fwd
./build/l3fwd -c 0xC -n 2 --proc-type auto
–socket-mem 512 --file-prefix pg2 \
-w 02:00.1\
– -p 0x1 --config="(0,0,3)" -
[3]第一个pktgen
./app/app/x86_64-native-linuxapp-gcc/pktgen -c 0x30 -n 3 --proc-type auto
–socket-mem 512 --file-prefix pg3 \
-w 03:00.0\
–
-T -P -m “5.0”
-f themes/black-yellow.theme -
[4]第二个pktgen
./app/app/x86_64-native-linuxapp-gcc/pktgen -c 0xC0 -n 3 --proc-type auto
–socket-mem 512 --file-prefix pg4 \
-w 03:00.1\
–
-T -P -m “7.0”
-f themes/black-yellow.theme
step5:在多个窗口中输入命令即可,界面如下一台电脑运行多个DPDK程序(同时两个l3fwd+同时跑两个pktgen)
EAL的启动命令可以在下面查到:
EAL common options:
- -c COREMASK Hexadecimal bitmask of cores to run on
- -l CORELIST List of cores to run on
The argument format is [-c2][,c3[-c4],…]
where c1, c2, etc are core indexes between 0 and 128 - –lcores COREMAP Map lcore set to physical cpu set
The argument format is
‘[<,lcores[@cpus]>…]’
lcores and cpus list are grouped by ‘(’ and ‘)’
Within the group, ‘-’ is used for range separator,
‘,’ is used for single number separator.
‘( )’ can be omitted for single element group,
‘@’ can be omitted if cpus and lcores have the same value - –master-lcore ID Core ID that is used as master
- -n CHANNELS Number of memory channels
- -m MB Memory to allocate (see also --socket-mem)
- -r RANKS Force number of memory ranks (don’t detect)
- -b, --pci-blacklist Add a PCI device in black list.
Prevent EAL from using this PCI device. The argument
format is .
-w, --pci-whitelist Add a PCI device in white list.
Only use the specified PCI devices. The argument format
is <[domain:]bus:devid.func>. This option can be present
several times (once per device).
[NOTE: PCI whitelist cannot be used with -b option]
例如使用两个网口,用逗号隔开,-w pci1 -w pci2
- –vdev Add a virtual device.
The argument format is [,key=val,…]
(ex: --vdev=eth_pcap0,iface=eth2). - -d LIB.so|DIR Add a driver or driver directory
(can be used multiple times) - –vmware-tsc-map Use VMware TSC map instead of native RDTSC
–proc-type Type of this process (primary|secondary|auto)
- –syslog Set syslog facility
- –log-level Set default log level
- -v Display version information on startup
- -h, --help This help
EAL options for DEBUG use only:
- –huge-unlink Unlink hugepage files after init
- –no-huge Use malloc instead of hugetlbfs
- –no-pci Disable PCI
- –no-hpet Disable HPET
- –no-shconf No shared config (mmap’d files)
EAL Linux options:
–socket-mem Memory to allocate on sockets (comma separated
values) 例如:双numa节点的,需要给每个socket配置大页内存并用逗号隔开,–socket-mem=512,512
- –huge-dir Directory where hugetlbfs is mounted
–file-prefix Prefix for hugepage filenames
- –base-virtaddr Base virtual address
- –create-uio-dev Create /dev/uioX (usually done by hotplug)
- –vfio-intr Interrupt mode for VFIO (legacy|msi|msix)
- –xen-dom0 Support running on Xen dom0 without hugetlbfs