DPDK環境搭建及Helloworld樣例

配置虛擬機環境


  • 多張網卡,一張網卡是沒法運行DPDK的,至少要兩張。
  • 多核CPU,能夠在實現多個DPDK邏輯調度核lcore。

  • DPDK依賴參考:http://www.cnblogs.com/vancasola/p/8881197.html

安裝DPDK


1.在DPDK官網下載DPDK的壓縮包:http://core.dpdk.org/download, 我下載的是穩定版本18.05.1.
2.進入root權限,解壓下載的安裝包到用戶目錄下。html

tar xJf ddpdk-stable-18.05.1.tar.xz
cd dpdk-stable-18.05.1/

3.配置環境變量node

make config T=x86_64-native-linuxapp-gcc
sed -ri 's,(PMD_PCAP=).*,\1y,' build/.config

4.安裝linux

make

運行DPDK


1.設置環境變量app

export RTE_SDK=/home/liuhy/dpdk-stable-18.05.1/
export RTE_TARGET=build

2.編譯example程序socket

make -C examples

3.配置大頁表ui

mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

4.運行helloworld,效果以下:code

root@liuhy-VirtualBox:/home/liuhy/dpdk-stable-18.05.1/examples/helloworld/build# ./helloworld -c f
EAL: Detected 4 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Probing VFIO support...
EAL: PCI device 0000:00:03.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:08.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:09.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
EAL: PCI device 0000:00:0a.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:100e net_e1000_em
hello from core 1
hello from core 2
hello from core 3
hello from core 0
相關文章
相關標籤/搜索