鲲鹏920上vpp--dpdk编译

./build/external/packages/dpdk.mk

 先要将网卡down才能去绑定vpp

DPDK_VERSION                 ?= 19.08

 

 参考一

https://fd.io/docs/vpp/master/usecases/vppinazure.html

$ git clone https://gerrit.fd.io/r/vpp
$ git checkout v18.07

参考二

https://github.com/plajjan/vpp/tree/master/build-data

/usr/lib/gcc/aarch64-redhat-linux/4.8.5/include/arm_neon.h:24143:1: note: expected 'uint64x2_t' but argument is of type 'u64x2'
 vst1q_u64 (uint64_t *a, uint64x2_t b)

 

[root@localhost vpp]# cat  build-data/platforms/vpp.mk
# Copyright (c) 2015 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# vector packet processor

MACHINE=$(shell uname -m)

vpp_arch = native
ifeq ($(TARGET_PLATFORM),thunderx)
vpp_dpdk_target = arm64-thunderx-linuxapp-gcc
endif
vpp_dpdk_target = arm64-armv8a-linuxapp-gcc
vpp_native_tools = vppapigen

vpp_uses_dpdk = yes

# Uncoment to enable building unit tests
# vpp_enable_tests = yes

vpp_root_packages = vpp vom

# DPDK configuration parameters
# vpp_uses_dpdk_mlx4_pmd = yes
# vpp_uses_dpdk_mlx5_pmd = yes
# vpp_uses_external_dpdk = yes
# vpp_dpdk_inc_dir = /usr/include/dpdk
# vpp_dpdk_lib_dir = /usr/lib
# vpp_dpdk_shared_lib = yes

# Use '--without-libnuma' for non-numa aware architecture
vpp_configure_args_vpp =

# load balancer plugin is not portable on 32 bit platform
ifeq ($(MACHINE),i686)
vpp_configure_args_vpp += --disable-lb-plugin
endif

vpp_debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 
        -fstack-protector-all -fPIC -Werror
vpp_debug_TAG_CXXFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 
        -fstack-protector-all -fPIC -Werror
vpp_debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 
        -fstack-protector-all -fPIC -Werror

vpp_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror
vpp_TAG_CXXFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror
vpp_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror -pie -Wl,-z,now

vpp_clang_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror
vpp_clang_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror

vpp_gcov_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -fPIC -Werror -fprofile-arcs -ftest-coverage
vpp_gcov_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -fPIC -Werror -coverage

vpp_coverity_TAG_CFLAGS = -g -O2 -fPIC -Werror -D__COVERITY__
vpp_coverity_TAG_LDFLAGS = -g -O2 -fPIC -Werror -D__COVERITY__

[root@localhost vpp]# 
[root@localhost vpp]# export PLATFORM=arm32
[root@localhost vpp]#  make arm32_uses_external_dpdk=yes arm32_dpdk_inc_dir=/usr/src/dpdk_vpp/include arm32_dpdk_lib_dir=/usr/src/dpdk_vpp/lib  build -j96


[root@localhost vpp]# cat  build-data/packages/vpp.mk 
# Copyright (c) 2015 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

vpp_source = src

ifeq ($($(PLATFORM)_dpdk_shared_lib),yes)
vpp_configure_args = --enable-dpdk-shared
else
vpp_configure_args =
endif

# Platform dependent configure flags
vpp_configure_args += $(vpp_configure_args_$(PLATFORM))


vpp_CPPFLAGS =
vpp_LDFLAGS =

ifneq ($($(PLATFORM)_uses_dpdk),no)
ifeq ($($(PLATFORM)_uses_external_dpdk),yes)
vpp_CPPFLAGS += -I$($(PLATFORM)_dpdk_inc_dir)
vpp_LDFLAGS += -L$($(PLATFORM)_dpdk_lib_dir)

else vpp_configure_depend += dpdk-install vpp_CPPFLAGS += $(call installed_includes_fn, dpdk)/dpdk vpp_LDFLAGS += $(call installed_libs_fn, dpdk) vpp_CPPFLAGS += -I/usr/include/dpdk endif ifeq ($($(PLATFORM)_uses_dpdk_mlx5_pmd),yes) vpp_configure_args += --with-dpdk-mlx5-pmd endif ifeq ($($(PLATFORM)_uses_dpdk_mlx4_pmd),yes) vpp_configure_args += --with-dpdk-mlx4-pmd endif else vpp_configure_args += --disable-dpdk-plugin endif ifeq ($($(PLATFORM)_enable_tests),yes) vpp_configure_args += --enable-tests endif [root@localhost vpp]#
ModuleNotFoundError: No module named 'ply'
[6/1957] Generating API header /root/vpp/vpp/build-root...vpp_debug-native/vpp/vnet/ip-neighbor/ip_neighbor.api.h
FAILED: vnet/ip-neighbor/ip_neighbor.api.h 
cd /root/vpp/vpp/build-root/build-vpp_debug-native/vpp/vnet && mkdir -p /root/vpp/vpp/build-root/build-vpp_debug-native/vpp/vnet/ip-neighbor && /root/vpp/vpp/src/tools/vppapigen/vppapigen --includedir /root/vpp/vpp/src --input /root/vpp/vpp/src/vnet/ip-neighbor/ip_neighbor.api --outputdir /root/vpp/vpp/build-root/build-vpp_debug-native/vpp/vnet/ip-neighbor --output /root/vpp/vpp/build-root/build-vpp_debug-native/vpp/vnet/ip-neighbor/ip_neighbor.api.h
Traceback (most recent call last):
  File "/root/vpp/vpp/src/tools/vppapigen/vppapigen", line 3, in <module>
    import ply.lex as lex
ModuleNotFoundError: No module named 'ply'
[7/1957] Generating API header /root/vpp/vpp/build-root/build-vpp_debug-native/vpp/vnet/bfd/bfd.api.h
FAILED: vnet/bfd/bfd.api.h 
cd /root/vpp/vpp/build-root/build-vpp_debug-native/vpp/vnet && mkdir -p /root/vpp/vpp/build-root/build-vpp_debug-native/vpp/vnet/bfd && /root/vpp/vpp/src/tools/vppapigen/vppapigen --includedir /root/vpp/vpp/src --input /root/vpp/vpp/src/vnet/bfd/bfd.api --outputdir /root/vpp/vpp/build-root/build-vpp_debug-native/vpp/vnet/bfd --output /root/vpp/vpp/build-root/build-vpp_debug-native/vpp/vnet/bfd/bfd.api.h
Traceback (most recent call last):
  File "/root/vpp/vpp/src/tools/vppapigen/vppapigen", line 3, in <module>
    import ply.lex as lex
ModuleNotFoundError: No module named 'ply'
[130/1957] Building C object vlib/CMakeFiles/vlib.dir/unix/cli.c.o
ninja: build stopped: subcommand failed.
make[1]: *** [vpp-build] Error 1
make[1]: Leaving directory `/root/vpp/vpp/build-root'
make: *** [build] Error 2

make wipe 删除--------- make distclean<删除所有的.o .so .a文件
make install-dep
make build

 

 总结

ls /root/vpp/vpp/build-root/rpmbuild/vpp-20.01/build/external

build-root/install-vpp_debug-native/vpp/bin/vpp  –c  ./build-root/install-vpp_debug-native/vpp/etc/vpp/startup.conf

[root@localhost bin]# ./vppctl
clib_socket_init: connect (fd 3, '/run/vpp/cli.sock'): No such file or directory
[root@localhost bin]#

 总结

1、编译

find ./ -name dpdk.mk
./build/external/packages/dpdk.mk
./build-root/rpmbuild/vpp-20.01/build/external/packages/dpdk.mk

 cp  ./build-root/build-vpp_debug-native/external/custom-config  ~/dpdk-19.11/
make build

 

add:    添加

 $(call set,RTE_LIBRTE_HNS3_PMD,y)

  

 

 debug版本

[root@localhost vpp]# grep -i DPDK_MAKE_ARGS -rn * | grep DPDK_SOURCE
build/external/packages/dpdk.mk.bak:161:DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) 
build/external/packages/dpdk.mk:167:#DPDK_MAKE_ARGS := -C $(DPDK_SOURCE) -j $(JOBS) 

release

make wipe-release

build/external/packages/dpdk.mk

/opt/rh/devtoolset-7/root/usr/libexec/gcc/aarch64-redhat-linux/7/ld: /usr/lib/librte_bus_dpaa.a(process.o)(.text+0x2c0): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stderr@@GLIBC_2.17'
/opt/rh/devtoolset-7/root/usr/libexec/gcc/aarch64-redhat-linux/7/ld: 最后的链结失败: 错误的值
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
make[1]: [vpp-install] 错误 1 (忽略)
make[1]: 离开目录“/root/vpp.19.08/build-root”
make: *** 没有规则可以创建目标“128”。 停止。
[root@localhost vpp.19.08]# find ./ -name librte_bus_dpaa.a
[root@localhost vpp.19.08]# find ./ -name process.o
[root@localhost vpp.19.08]# ls /usr/lib/librte_bus_dpaa.a
/usr/lib/librte_bus_dpaa.a
[root@localhost vpp.19.08]# mv  /usr/lib/librte_bus_dpaa.a  /usr/lib/librte_bus_dpaa.a.bak
[root@localhost vpp.19.08]# 

vi build-data/platforms/dpaa.mk +75

 unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `stderr@@GLIBC_2.17'

# compiler/linker custom arguments
ifeq ($(DPDK_CC),clang)
DPDK_CPU_CFLAGS := -fPIE -fPIC
else
DPDK_CPU_CFLAGS := -pie -fPIC
endif

2、运行

1、 mkdir -p  /var/log/vpp/  
2、 dpdk-devbind   -u   0000:06:00.0
3、dpdk-devbind -s
4、dpdk-devbind   --bind=vfio-pci   0000:06:00.0
5、 /root/vpp/vpp/build-root/install-vpp_debug-native/vpp/bin/vpp  -c ./etc/vpp/startup.conf
要用绝对路径:/root/vpp/vpp/build-root/install-vpp_debug-native/vpp/bin/vpp





 ./vppctl -s /run/vpp/cli-vpp1.sock
 
 
more /etc/vpp/startup.conf
unix {
    nodaemon
    cli-listen /run/vpp/cli.sock
    cli-no-pager
    coredump-size unlimited
    full-coredump
    poll-sleep-usec 100
}
nat {
    endpoint-dependent
}
api-trace {
   on
   nitems 500
}
dpdk {
    dev 0000:06:00.0
    uio-driver vfio-pci
}

STARTUP_CONF=/etc/vpp/startup.conf
export STARTUP_CONF
make run

 

 

telnet localhost 5002
B := $(BUILD_DIR)
make pkg-rpm DPDK_VERSION=dpdk-19.11
开pmd 调试信息
DBGvpp# show version 
vpp v20.01-34~g844ec17-dirty built by root on localhost.localdomain at 2020-04-22T00:55:20
DBGvpp#

 ========================================

bug

/root/vpp.19.08/src/plugins/dpdk/device/init.c:605:26: error: passing argument 2 of ‘rte_eth_macaddr_get’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  rte_eth_macaddr_get (i, (struct ether_addr *) addr);
                          ^
In file included from /root/vpp.19.08/src/plugins/dpdk/device/dpdk.h:36:0
error = rte_eth_dev_default_mac_addr_set (xd->port_id,
                                            (struct ether_addr *) address);

vpp/src/plugins/dpdk/buffer.c:155:            rte_vfio_dma_map (pointer_to_uword (va), pa, page_sz))

if (do_vfio_map &&
rte_vfio_dma_map (pointer_to_uword (va), pa, page_sz))
do_vfio_map = 0;

 

 vpp编译指令

获取 VPP 源码:

git clone https://gerrit.fd.io/r/vpp

获取指定版本源码:

git checkout -b stable/1804 origin/stable/1804

编译 VPP
进入 VPP 目录
make install-dep

编译 VPP
执行:

make distclean
执行: make bootstrap
执行: ./build-root/bootstrap.sh
执行: make build
执行: make plugins

原文地址:https://www.cnblogs.com/dream397/p/12742268.html