2017-04-07 16:43:26 zy627836411 阅读数 2462


DPDK安装和部署

下载和解压:

(centos下sudo可能不能使用sudo如果不知道如何配置建议使用root)

         创建DPDK目录:sudo mkdir /home/DPDK

         进入DPDK目录:cd /home/DPDK/

         下载稳定版16.11.1sudo wget  http://fast.dpdk.org/rel/dpdk-16.11.1.tar.xz

         解压缩:sudo tar -xvfdpdk-16.11.1.tar.xz

         显示文件夹下内容:

         lib:DPDK库源代码

         driver:DPDKpoll-mode驱动程序的源代码

         app:DPDK应用程序源代码

         example:DPDK应用示例源代码

         config、buildtools、mk:框架相关的makefile,脚本和配置

        

                 

编译

使用gcc编译64位目标:sudo make install T=x86_64-native-linuxapp-gcc

加载合适的uio模块:sudo modprobeuio_pci_generic

(该模块在linux内核中已经包含,所以在任何地方直接加载)

切换目录:cd tools/

         绑定网卡和uio模块:sudo./dpdk-devbind.py --bind=uio_pci_generic enp2s0(我的网卡名)


         注意因为我的主机只有一张网卡,所以绑定是不成功的。这里因为刚开始了解DPDK所以暂时不绑定。 

到此DPDK的下载编译已经完成,当然这里面还有一些需要设置,比如说设置大页。这个后面部分补充,如果没有设置的话,后面运行部分程序是不能编译通过的。

2018-12-07 16:33:54 zhangmingcai 阅读数 1810

dpdk版本:dpdk-17.11.3

1.安装依赖库m4、bison、flex 和eal_memory支持:到对应版本的iso镜像文件中找rpm包

  rpm -ivh m4-1.4.16-10.el7.x86_64.rpm

  rpm -ivh bison-2.7-4.el7.x86_64.rpm

  rpm -ivh flex-2.5.37-3.el7.x86_64.rpm

  rpm -ivh numactl-devel-2.0.9-6.el7_2.x86_64.rpm

   2. 安装libpcap

在root用户下,安装libpcap:

  cd libpcap-1.8.1

./configure

make

make install

安装成功,但是后面安装DPDK的时候却提示找不到libpcap.so.1,因为libpcap.so.1默认安装到了/usr/local/lib下,做一个软链接到/usr/lib/下:

 sudo ln -s /usr/local/lib/libpcap.so.1 /usr/lib/libpcap.so.1

 3. 安装dpdk库:

要安装在目录/home/alipms

[root@aischang alipms]# pwd

/home/alipms

[root@aischang alipms]# unzip dpdkLib-17.11.3.zip

[root@aischang alipms]# cd dpdkLib/

[root@aischang dpdkLib]# make install T=x86_64-native-linuxapp-gcc

Build complete [x86_64-native-linuxapp-gcc]

Installation cannot run with T defined and DESTDIR undefined

[root@aischang dpdkLib]#

4.添加环境变量:

在文件/root/.bash_profile添加环境变量:

export LD_LIBRARY_PATH=/home/alipms/dpdkLib/x86_64-native-linuxapp-gcc/lib

执行命令使立即生效:source ~/.bash_profile

加载模块和绑定网卡请见https://blog.csdn.net/zhangmingcai/article/details/82423535

参考文档https://www.jianshu.com/p/a9a3885efe5a

2019-03-07 16:07:38 weixin_43266488 阅读数 302

1、首先下载dpdk压缩包
2、解压缩(tar.xz格式),安装,配置
3、dpdk绑定网卡
用ifconfig查看网卡信息,我的有2个,下图可以看到
在这里插入图片描述
4、加载模块和绑定网卡
进入你自己下载的dpdk,
在这里插入图片描述如上图,我下载的是dpdk-stable-18.05.1
用find -name dpdk-devbind.py找到你的dpdk-devbind.py路径。一般都在dpdk/usertools下。
然后
modprobe uio
insmod build/kmod/igb_uio.ko(插入uio和igb_uio模块)
usertools/dpdk-devbind.py --bind=igb_uio enp2s0f1(绑定网卡)
如下图所示,enp2s0f1是自己的网卡
在这里插入图片描述
绑定网卡之后,再用ifconfig查看网卡,会发现dpdk绑定的那个网卡没有显示出来。

5、查看网卡状态
用usertools/dpdk-devbind.py --status查看网卡是由dpdk驱动还是由内核驱动。
有一个是由dpdk驱动,所以绑定网卡成功!
在这里插入图片描述

2016-05-07 17:04:53 nimei199 阅读数 4420
环境:
Vmware Workstation 10
系统 - fedora22
kernel - 4.1.10-200.fc22.x86_64
gcc - 5.1.1 20150618 (Red Hat 5.1.1-4)


步骤(使用命令):
1. tar xf dpdk
2. cd dpdk
3. make install T=x86_64-native-linuxapp-gcc(如果修改config文件,可以先make config T=x86_64-native-linuxapp-gcc,然后cd x86_64-native-linuxapp-gcc,vi .config后再make)
(第3步是遇到的错误,因为开了PMD_PCAP=y,所以会用到pcap库,需要yum install libpcap libpcap-devel)
(3. 如果使用tools/setup.sh,需要先设置环境变量,export RTE_SDK=`pwd`,export RTE_TARGET=x86_64-native-linuxapp-gcc)
4. 配置huge pages
sudo mkdir -p /mnt/huge
sudo mount -t hugetlbfs nodev /mnt/huge
sudo echo 128 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
配置完成之后,可以cat /proc/meminfo,看到最后几行已经改变:
HugePages_Total:      128
HugePages_Free:       128
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
5. 查看dev状态(是否已经绑定)
tools/dpdk_nic_bind.py --status
6. 绑定
./tools/dpdk_nic_bind.py --bind=igb_uio 接口名称or接口PCI号
(解除绑定)
./tools/dpdk_nic_bind.py --bind=e1000 接口名称or接口PCI号
(可能遇到的错误:Routing table indicates that interface 0000:02:01.0 is active. Not modifying,先down掉网口)
(注意绑定的驱动一定要正确,不然绑定不成功)
7. 在执行testpmd,或者helloworld示例的时候,会遇到类似以下错误:
EAL: Error reading from file descriptor 13: Input/output error
这个问题已经解决,需要打一个补丁。这个问题有人在dpdk的1.7和1.8版本就已经遇到了,现在2.1版本又遇到,不知道为什么没有在源码中进行修改
http://dpdk.org/dev/patchwork/patch/945/
再次运行testpmd:
[root@localhost app]# ./testpmd -c 3 -n 1
EAL: Detected lcore 0 as core 0 on socket 0
EAL: Detected lcore 1 as core 1 on socket 0
EAL: Support maximum 128 logical core(s) by configuration.
EAL: Detected 2 lcore(s)
EAL: VFIO modules not all loaded, skip VFIO support...
EAL: Setting up physically contiguous memory...
EAL: Ask a virtual area of 0x200000 bytes
EAL: Virtual area found at 0x7efc2a000000 (size = 0x200000)
EAL: Ask a virtual area of 0x200000 bytes
EAL: Virtual area found at 0x7efc29c00000 (size = 0x200000)
EAL: Ask a virtual area of 0x33600000 bytes
EAL: Virtual area found at 0x7efbf6400000 (size = 0x33600000)
EAL: Ask a virtual area of 0xfe00000 bytes
EAL: Virtual area found at 0x7efbe6400000 (size = 0xfe00000)
EAL: Ask a virtual area of 0x600000 bytes
EAL: Virtual area found at 0x7efbe5c00000 (size = 0x600000)
EAL: Ask a virtual area of 0x400000 bytes
EAL: Virtual area found at 0x7efbe5600000 (size = 0x400000)
EAL: Ask a virtual area of 0x800000 bytes
EAL: Virtual area found at 0x7efbe4c00000 (size = 0x800000)
EAL: Requesting 549 pages of size 2MB from socket 0
EAL: TSC frequency is ~3292429 KHz
EAL: Master lcore 0 is ready (tid=2c2b98c0;cpuset=[0])
EAL: lcore 1 is ready (tid=e4bff700;cpuset=[1])
EAL: PCI device 0000:02:01.0 on NUMA socket -1
EAL:   probe driver: 8086:100f rte_em_pmd
EAL:   Not managed by a supported kernel driver, skipped
EAL: PCI device 0000:02:05.0 on NUMA socket -1
EAL:   probe driver: 8086:100f rte_em_pmd
EAL:   PCI memory mapped at 0x7efc2a200000
EAL:   PCI memory mapped at 0x7efc2a220000
PMD: eth_em_dev_init(): port_id 0 vendorID=0x8086 deviceID=0x100f
EAL: PCI device 0000:02:06.0 on NUMA socket -1
EAL:   probe driver: 8086:100f rte_em_pmd
EAL:   PCI memory mapped at 0x7efc2a230000
EAL:   PCI memory mapped at 0x7efc2a250000
PMD: eth_em_dev_init(): port_id 1 vendorID=0x8086 deviceID=0x100f
Configuring Port 0 (socket 0)
PMD: eth_em_tx_queue_setup(): sw_ring=0x7efbe5717100 hw_ring=0x7efbe5719200 dma_addr=0x56919200
PMD: eth_em_rx_queue_setup(): sw_ring=0x7efbe5706bc0 hw_ring=0x7efbe57070c0 dma_addr=0x569070c0
PMD: eth_em_start(): <<
Port 0: 00:0C:29:DA:22:81
Configuring Port 1 (socket 0)
PMD: eth_em_tx_queue_setup(): sw_ring=0x7efbe56f4980 hw_ring=0x7efbe56f6a80 dma_addr=0x568f6a80
PMD: eth_em_rx_queue_setup(): sw_ring=0x7efbe56e4440 hw_ring=0x7efbe56e4940 dma_addr=0x568e4940
PMD: eth_em_start(): <<
Port 1: 00:0C:29:DA:22:8B
Checking link statuses...
Port 0 Link Up - speed 1000 Mbps - full-duplex
Port 1 Link Up - speed 1000 Mbps - full-duplex
Done
No commandline core given, start packet forwarding
  io packet forwarding - CRC stripping disabled - packets/burst=32
  nb forwarding cores=1 - nb forwarding ports=2
  RX queues=1 - RX desc=128 - RX free threshold=0
  RX threshold registers: pthresh=0 hthresh=0 wthresh=0
  TX queues=1 - TX desc=512 - TX free threshold=0
  TX threshold registers: pthresh=0 hthresh=0 wthresh=0
  TX RS bit threshold=0 - TXQ flags=0x0
Press enter to exit
因为只有两个core,所以都用来转发了,没有cp的控制core,只能退出了


Launching app
EAL: Detected lcore 0 as core 0 on socket 0
EAL: Detected lcore 1 as core 1 on socket 0
EAL: Support maximum 128 logical core(s) by configuration.
EAL: Detected 2 lcore(s)
EAL: VFIO modules not all loaded, skip VFIO support...
EAL: Setting up physically contiguous memory...
EAL: Ask a virtual area of 0x200000 bytes
EAL: Virtual area found at 0x7f9457c00000 (size = 0x200000)
EAL: Ask a virtual area of 0x1c00000 bytes
EAL: Virtual area found at 0x7f9455e00000 (size = 0x1c00000)
EAL: Ask a virtual area of 0x1e000000 bytes
EAL: Virtual area found at 0x7f9437c00000 (size = 0x1e000000)
EAL: Ask a virtual area of 0x200000 bytes
EAL: Virtual area found at 0x7f9437800000 (size = 0x200000)
EAL: Requesting 256 pages of size 2MB from socket 0
EAL: TSC frequency is ~3292428 KHz
EAL: Master lcore 0 is ready (tid=59bbd8c0;cpuset=[0])
EAL: lcore 1 is ready (tid=377ff700;cpuset=[1])
EAL: PCI device 0000:02:01.0 on NUMA socket -1
EAL:   probe driver: 8086:100f rte_em_pmd
EAL:   Not managed by a supported kernel driver, skipped
EAL: PCI device 0000:02:05.0 on NUMA socket -1
EAL:   probe driver: 8086:100f rte_em_pmd
EAL:   PCI memory mapped at 0x7f9457e00000
EAL:   PCI memory mapped at 0x7f9457e20000
PMD: eth_em_dev_init(): port_id 0 vendorID=0x8086 deviceID=0x100f
EAL: PCI device 0000:02:06.0 on NUMA socket -1
EAL:   probe driver: 8086:100f rte_em_pmd
EAL:   PCI memory mapped at 0x7f9457e30000
EAL:   PCI memory mapped at 0x7f9457e50000
PMD: eth_em_dev_init(): port_id 1 vendorID=0x8086 deviceID=0x100f
Interactive-mode selected
Configuring Port 0 (socket 0)
PMD: eth_em_tx_queue_setup(): sw_ring=0x7f94379a1200 hw_ring=0x7f94379a3300 dma_addr=0x557a3300
PMD: eth_em_rx_queue_setup(): sw_ring=0x7f9437990cc0 hw_ring=0x7f94379911c0 dma_addr=0x557911c0
PMD: eth_em_start(): <<
Port 0: 00:0C:29:DA:22:81
Configuring Port 1 (socket 0)
PMD: eth_em_tx_queue_setup(): sw_ring=0x7f943797ea80 hw_ring=0x7f9437980b80 dma_addr=0x55780b80
PMD: eth_em_rx_queue_setup(): sw_ring=0x7f943796e540 hw_ring=0x7f943796ea40 dma_addr=0x5576ea40
PMD: eth_em_start(): <<
Port 1: 00:0C:29:DA:22:8B
Checking link statuses...
Port 0 Link Up - speed 1000 Mbps - full-duplex
Port 1 Link Up - speed 1000 Mbps - full-duplex
Done
testpmd> start
  io packet forwarding - CRC stripping disabled - packets/burst=32
  nb forwarding cores=1 - nb forwarding ports=2
  RX queues=1 - RX desc=128 - RX free threshold=0
  RX threshold registers: pthresh=0 hthresh=0 wthresh=0
  TX queues=1 - TX desc=512 - TX free threshold=0
  TX threshold registers: pthresh=0 hthresh=0 wthresh=0
  TX RS bit threshold=0 - TXQ flags=0x0
testpmd> stop
Telling cores to stop...
Waiting for lcores to finish...


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


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


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


Done.
testpmd> 
2018-10-13 21:44:57 Rong_Toa 阅读数 226

目录

DPDK网址

下载

安装

1.解压

2.开启pcap

3.安装依赖

4.编译:

5.后续


DPDK网址

https://www.dpdk.org/

下载

下载地址:https://core.dpdk.org/download/

安装

1.解压

$ls
dpdk-18.02.2.tar.xz
$ tar xf dpdk-18.02.2.tar.xz 
$ ls
dpdk-18.02.2.tar.xz  dpdk-stable-18.02.2
$ cd dpdk-stable-18.02.2/
$ ls
app         devtools  examples     license      meson.build        pkg     usertools
buildtools  doc       GNUmakefile  MAINTAINERS  meson_options.txt  README
config      drivers   lib          Makefile     mk                 test

2.开启pcap

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

3.安装依赖

安装依赖numactl,libpcap:

$sudo yum install numactl-devel*x86_64 ​libpcap*

4.编译:

$make

5.后续

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

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

CentOS安装DPDK

阅读数 2769

安装DPDK

阅读数 1397

没有更多推荐了,返回首页