一臺服務器運行多個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