下载并安装DPDK-快速上手指南

下载并安装DPDK-快速上手指南

翻译自官网的文档
原文链接:http://core.dpdk.org/doc/quick-start/
DPDK的压缩包可以在官网https://www.dpdk.org/下载到。

1.解压文件

  tar xf dpdk.tar.gz
  cd dpdk

2.启用pcap(需要有libpcap头文件)

如果没有这个头文件可以到它的官网http://www.tcpdump.org下载,然后安装即可。

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

3.构建库和测试应用程序(默认配置下可能需要Linux头)

这一步通常需要一些依赖项,如果没有没有将无法编译成功,需要自己去下载。

make

4.保留巨页内存

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

5.运行轮询模式驱动程序测试(端口之间保持连通)

  build/app/testpmd -c7 -n3 --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
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

6.一些示例应用程序可以在构建它们之后进行测试

 make -C examples RTE_SDK=$(pwd) RTE_TARGET=build O=$(pwd)/build/examples

你可能感兴趣的:(下载并安装DPDK-快速上手指南)