dpdk编译安装

环境:
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> 

你可能感兴趣的:(linux,dpdk)