VPP环境搭建及配置

git下载源码:https://github.com/vpp-dev/dpdk

  • VPP编译:

1.cd vpp; compiler /bin/bash
2.cd vpp; make install-dep 下载依赖包
3.cd vpp/build-root; make distclean; ./boostrap.sh
4.cd vpp;make; make build(debug版);make build-release(release版);

 

  • 配置文件:startup.config

/*****************************************************************************/
unix {
  Interactive //将CLI命令加入到输入输出,提供调试
  log /tmp/vpp.log //日志
  full-coredump //请求Linux内核转储所有内存映射地址区域
  cli-listen 127.0.0.1:5002 //绑定CLI监听TCP端口5002
}

api-trace {
  on //程序崩溃时可以追踪
}

cpu {
  //works <n> //创建n个线程
  //skip_cores <n> //对于worker线程来说跳过前n个核
  main-core 0 //将主线程分配给第0个核
  corelist-workers 1-3 //将worker线程放到核1 2 3上
}

dpdk {
    dev default {
           num-rx-desc 4096
           num-tx-desc 4096
         }
  dev 0000:04:00.0 {num-rx-queues 1} //将网卡与网卡驱动绑定
  dev 0000:04:00.1 {num-rx-queues 1}
  dev 0000:05:00.0
  dev 0000:05:00.1
  num-mbufs 128000 //IO缓冲区数量
  socket-mem 2048 //vpp感知NUMA,在NUMA0上分配2G内存
}

plugins{
    path /sf/data/vpp-multi/vpp-rxq/build-root/install-vpp-native/vpp/lib64/vpp_plugins
    //插件路径
}
/*****************************************************************************/

  • 运行脚本:run.sh

#!/bin/bash
export LD_LIBRARY_PATH=/sf/data/vpp-1710/vpp/build-root/install-vpp-native/vpp/lib64
/sf/data/vpp-1710/vpp/build-root/install-vpp-native/vpp/bin/vpp 
-c /sf/data/vpp-1710/vpp/startup.conf

 

  • dpkd绑定网卡相关操作

查看dpdk绑定的网卡
cd /sf/dpdk/sbin
dpdk绑定网卡:
./dpdk-devbind --bind=igb_uio 0000:01:00.0
dpdk解绑网卡:
./dpdk-devbind -u 0000:01:00.0
将dpdk管理的网卡换成内核管理
echo “0000:01:00.0” >/sys/bus/pci/driver/igb_uio/unbind
echo “8086 100e” >/sys/bus/pci/drivers/网卡类型/new_id

 

  • vpp命令行:

show int 查看基本信息
show hardware-interfaces 查看收发队列的个数
show interface rx-placement 查看收发队列分配
show run 查看vpp运行信息
show threads 查看线程信息
开启二层转发:
set interface state TenGigabitEthernet4/0/0 up 
set interface state TenGigabitEthernet4/0/1 up
set interface l2 bridge TenGigabitEthernet4/0/0 200
set interface l2 bridge TenGigabitEthernet4/0/1 200

 

posted @ 2019-03-11 16:54  ll_1997_ll  阅读(5122)  评论(0编辑  收藏  举报