dpdk編譯開發

下載源碼

http://core.dpdk.org/download/

編譯

http://core.dpdk.org/doc/quick-start/

安裝python3

安裝ninja

yum install ninja-build

安裝meson

pip3 install meson

開始編譯

  tar xf dpdk.tar.gz
  cd dpdk
  meson build
  ninja -C build

確定配置好大頁內存

  mkdir -p /dev/hugepages
  mountpoint -q /dev/hugepages || mount -t hugetlbfs nodev /dev/hugepages
  echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

運行測試程序

iface需要對應機器上支持的網卡名稱

  build/app/dpdk-testpmd -c7 --vdev=net_pcap0,iface=eth0 --vdev=net_pcap1,iface=eth1 -- -i --nb-cores=2 --nb-ports=2 --total-num-mbufs=2048

  testpmd> show port stats all

  ######################## NIC statistics for port 0  ########################
  RX-packets: 0          RX-errors: 0         RX-bytes: 0
  TX-packets: 0          TX-errors: 0         TX-bytes: 0
  ############################################################################

  ######################## NIC statistics for port 1  ########################
  RX-packets: 0          RX-errors: 0         RX-bytes: 0
  TX-packets: 0          TX-errors: 0         TX-bytes: 0
  ############################################################################

  testpmd> start tx_first

  testpmd> stop

  ---------------------- Forward statistics for port 0  ----------------------
  RX-packets: 2377688        RX-dropped: 0             RX-total: 2377688
  TX-packets: 2007009        TX-dropped: 0             TX-total: 2007009
  ----------------------------------------------------------------------------

  ---------------------- Forward statistics for port 1  ----------------------
  RX-packets: 2006977        RX-dropped: 0             RX-total: 2006977
  TX-packets: 2377720        TX-dropped: 0             TX-total: 2377720
  ----------------------------------------------------------------------------

  +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
  RX-packets: 4384665        RX-dropped: 0             RX-total: 4384665
  TX-packets: 4384729        TX-dropped: 0             TX-total: 4384729
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

遇到的錯誤

ERROR: Problem encountered: missing python module: elftools

pip3 install pyelftools

error while loading shared libraries: libatomic.so.1: cannot open shared object file

yum install libatomic

DPDK is running on a NUMA system, but is compiled without NUMA support.

這個不算問題,如果需要dpdk自己支持NUMA,需要在編譯前安裝對應的開發庫

dnf install numactl-devel

在19版本的文檔中說明了numa的作用
https://doc.dpdk.org/guides-19.02/linux_gsg/sys_reqs.html

Library for handling NUMA (Non Uniform Memory Access).

    numactl-devel in Red Hat/Fedora;
    libnuma-dev in Debian/Ubuntu;

Note

On systems with NUMA support, libnuma-dev (aka numactl-devel) is a recommended dependency when –legacy-mem switch is used, and a required dependency if default memory mode is used. While DPDK will compile and run without libnuma even on NUMA-enabled systems, both usability and performance will be degraded.

https://forum.openeuler.org/t/topic/670
http://core.dpdk.org/doc/archives/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章