dpdk+ovs安装和编译(一)

本文介绍了在华为鲲鹏920服务器上安装DPDK 19.11和Open vSwitch (OVS)时遇到的版本不匹配问题。在尝试编译OVS 2.13.1时发现需要DPDK 2.13对应的版本,同时,文章提到了服务器中网卡与DPDK绑定失败的问题。解决方案包括更新Python版本、修改配置文件并重新编译OVS,以及处理智能网卡的Representors。此外,还涉及到了DPDK representors的概念和配置方法。
摘要由CSDN通过智能技术生成

绑定前网卡驱动

[root@localhost ~]# ethtool -i  enp5s0
driver: hinic
version: 
firmware-version: 
expansion-rom-version: 
bus-info: 0000:05:00.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
[root@localhost ~]# 

安装ovs遇到一个问题那就是ovs version和dpdk version不匹配,华为鲲鹏920上安装的dpdk是dpdk-19.11 

ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev

[root@localhost ~]# ovs-vsctl add-port br0 dpdk1 -- set Interface dpdk1 type=dpdk options:dpdk-devargs=0000:05:00.0
ovs-vsctl: Error detected while setting up 'dpdk1': could not open network device dpdk1 (Address family not supported by protocol). See ovs-vswitchd log for details.
ovs-vsctl: The default log directory is "/var/log/openvswitch".
[root@localhost ~]# ovs-vsctl show
bb6aa323-f96b-4872-98f8-7aa87fc99958
Bridge "br0"
datapath_type: netdev
Port "dpdk1"
Interface "dpdk1"
type: dpdk
options: {dpdk-devargs="0000:05:00.0"}
error: "could not open network device dpdk1 (Address family not supported by protocol)"
Port "br0"
Interface "br0"
type: internal
[root@localhost ~]#

 查看网卡与dpdk绑定状态

[root@localhost dpdk-19.11]# ./usertools/dpdk-devbind.py   --status

Network devices using DPDK-compatible driver
============================================
0000:05:00.0 'Hi1822 Family (2*25GE) 0200' drv=vfio-pci unused=hinic
0000:06:00.0 'Hi1822 Family (2*25GE) 0200' drv=vfio-pci unused=hinic

Network devices using kernel driver
===================================
0000:7d:00.0 'HNS GE/10GE/25GE RDMA Network Controller a222' if=enp125s0f0 drv=hns3 unused=hns_roce_hw_v2,vfio-pci *Active*
0000:7d:00.1 'HNS GE/10GE/25GE Network Controller a221' if=enp125s0f1 drv=hns3 unused=vfio-pci 
0000:7d:00.2 'HNS GE/10GE/25GE RDMA Network Controller a222' if=enp125s0f2 drv=hns3 unused=hns_roce_hw_v2,vfio-pci 
0000:7d:00.3 'HNS GE/10GE/25GE Network Controller a221' if=enp125s0f3 drv=hns3 unused=vfio-pci 

No 'Baseband' devices detected
==============================

No 'Crypto' devices detected
============================

No 'Eventdev' devices detected
==============================

No 'Mempool' devices detected
=============================

No 'Compress' devices detected
==============================

No 'Misc (rawdev)' devices detected
===================================
[root@localhost dpdk-19.11]# 

 编译dpdk

修改配置文件config/common_linuxapp,这里我们测试vhost模式,所以需要把下面两个配置项,配置为yes。


CONFIG_RTE_BUILD_COMBINE_LIBS=y
CONFIG_RTE_LIBRTE_VHOST=y

[root@localhost dpdk-19.11]# grep -n CONFIG_RTE_LIBRTE_VHOST config/common_base
1030:CONFIG_RTE_LIBRTE_VHOST=y
1031:CONFIG_RTE_LIBRTE_VHOST_NUMA=n
1032:CONFIG_RTE_LIBRTE_VHOST_DEBUG=n

 

[root@localhost dpdk-19.11]# mkdir -p /usr/src/dpdk
[root@localhost dpdk-19.11]# make install T=arm64-armv8a-linuxapp-gcc  DESTDIR=/usr/src/dpdk -j 64

将dpdk安装到当前系统
make install T=arm64-armv8a-linuxapp-gcc  DESTDIR=/usr -j 64

安装完成后可以使用dpdk的命令了

[root@localhost ~]# dpdk-devbind --status

 

Network devices using DPDK-compatible driver
============================================
0000:05:00.0 'Hi1822 Family (2*25GE) 0200' drv=vfio-pci unused=hinic
0000:06:00.0 'Hi1822 Family (2*25GE) 0200' drv=vfio-pci unused=hinic

 

Network devices using kernel driver
===================================
0000:7d:00.0 'HNS GE/10GE/25GE RDMA Network Controller a222' if=enp125s0f0 drv=hns3 unused=hns_roce_hw_v2,vfio-pci *Active*
0000:7d:00.1 'HNS GE/10GE/25GE Network Controller a221' if=enp125s0f1 drv=hns3 unused=vfio-pci
0000:7d:00.2 'HNS GE/10GE/25GE RDMA Network Controller a222' if=enp125s0f2 drv=hns3 unused=hns_roce_hw_v2,vfio-pci
0000:7d:00.3 'HNS GE/10GE/25GE Network Controller a221' if=enp125s0f3 drv=hns3 unused=vfio-pci

 

No 'Baseband' devices detected
==============================

 

No 'Crypto' devices detected
============================

 

No 'Eventdev' devices detected
==============================

 

No 'Mempool' devices detected
=============================

 

No 'Compress' devices detected
==============================

 

No 'Misc (rawdev)' devices detected
===================================

 

[root@localhost ~]# cd /usr/
[root@localhost usr]# find ./ -name dpdk*
./sbin/dpdk-devbind
./bin/dpdk-test-compress-perf
./bin/dpdk-pdump
./bin/dpdk-test-crypto-perf
./bin/dpdk-pmdinfo
./bin/dpdk-test-eventdev
./bin/dpdk-procinfo
./src/dpdk
./src/dpdk/sbin/dpdk-devbind
./src/dpdk/bin/dpdk-test-compress-perf
./src/dpdk/bin/dpdk-pdump
./src/dpdk/bin/dpdk-test-crypto-perf
./src/dpdk/bin/dpdk-pmdinfo
./src/dpdk/bin/dpdk-test-eventdev
./src/dpdk/bin/dpdk-procinfo
./src/dpdk/lib/modules/4.14.0-115.el7a.0.1.aarch64/extra/dpdk
./src/dpdk/include/dpdk
./src/dpdk/share/dpdk
./src/dpdk/share/dpdk/usertools/dpdk-pmdinfo.py
./src/dpdk/share/dpdk/usertools/dpdk-devbind.py
./src/dpdk/share/dpdk/usertools/dpdk-telemetry-client.py
./src/dpdk/share/dpdk/usertools/dpdk-setup.sh
./src/dpdk/share/dpdk/arm64-armv8a-linuxapp-gcc/app/dpdk-pmdinfogen
./lib/modules/4.14.0-115.el7a.0.1.aarch64/extra/dpdk
./include/dpdk
./share/dpdk
./share/dpdk/usertools/dpdk-pmdinfo.py
./share/dpdk/usertools/dpdk-devbind.py
./share/dpdk/usertools/dpdk-telemetry-client.py
./share/dpdk/usertools/dpdk-setup.sh
./share/dpdk/arm64-armv8a-linuxapp-gcc/app/dpdk-pmdinfogen
[root@localhost usr]# dpdk-devbind -u 0000:05:00.0 0000:06:00.0

 

编译ovs

[root@localhost data1]#  mkdir -p ~/rpmbuild/SOURCES 
 
[root@localhost data1]#  cp openvswitch-2.13.1 ~/rpmbuild/SOURCES/ -r
[root@localhost data1]# 

[root@localhost SOURCES]# python3 -m pip install --upgrade pip
Collecting pip
  Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 5.9 MB/s 
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.4
    Uninstalling pip-20.2.4:
      Successfully uninstalled pip-20.2.4
Successfully installed pip-20.3.3
[root@localhost SOURCES]#  pip3 install sphinx -i https://pypi.tuna.tsinghua.edu.cn/simpl

 无法安装openvswitch-2.13.1-1

[root@localhost SOURCES]# rpmbuild -bb --without check openvswitch-2.13.1/rhel/openvswitch.spec
error: Failed build dependencies:
        python3-sphinx is needed by openvswitch-2.13.1-1.aarch64
        unwind-devel is needed by openvswitch-2.13.1-1.aarch64

[root@localhost openvswitch-2.12.0]# ls
acinclude.m4  config.log        Documentation    Makefile     ovsdb       tests                windows
aclocal.m4    config.status     include          Makefile.am  package.m4  third-party          xenserver
appveyor.yml  configure         ipsec            Makefile.in  poc         tutorial
AUTHORS.rst   configure.ac      lib              manpages.mk  python      utilities
boot.sh       CONTRIBUTING.rst  libtool          NEWS         README.rst  Vagrantfile
build-aux     datapath          LICENSE          NOTICE       rhel        Vagrantfile-FreeBSD
config.h      datapath-windows  m4               ofproto      selinux     vswitchd
config.h.in   debian            MAINTAINERS.rst  ovn          stamp-h1    vtep
[root@localhost openvswitch-2.12.0]# ./configure --with-dpdk=/usr/src/dpdk --prefix=/usr --sysconfdir=/etc --localstatedir=/var

[root@localhost SOURCES]# pwd
/root/rpmbuild/SOURCES
[root@localhost SOURCES]# rpmbuild -bb --without check openvswitch-2.12.0/rhel/openvswitch.spec


[root@localhost ~]# ls /etc/openvswitch/
system-id.conf

[root@localhost ~]# ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema
[root@localhost ~]#  ls /etc/openvswitch/
conf.db  system-id.conf
[root@localhost ~]# 

 ovs启动 :

 ovs.sh

#启动ovsdb server
ovsdb-server /etc/openvswitch/conf.db \
-vconsole:emer -vsyslog:err -vfile:info \
--remote=punix:/var/run/openvswitch/db.sock \
--private-key=db:Open_vSwitch,SSL,private_key \
--certificate=db:Open_vSwitch,SSL,certificate \
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --no-chdir \
--log-file=/var/log/openvswitch/ovsdb-server.log \
--pidfile=/var/run/openvswitch/ovsdb-server.pid \
--detach --monitor

#第一次启动ovs需要初始化
ovs-vsctl --no-wait init
#从ovs-v2.7.0开始,开启dpdk功能已不是vswitchd进程启动时指定–dpdk等参数了,而是通过设置ovsdb来开启dpdk功能

ovs-vsctl -
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值