DPDK安装

源码安装

1
export RTE_SDK="/usr/src/dpdk"
2
export DPDK_VERSION="2.2.0"
3
export RTE_TARGET="x86_64-native-linuxapp-gcc"
4
5
######################## ubuntu ######################################
6
apt-get install -y vim gcc-multilib libfuse-dev linux-source libssl-dev llvm-dev python autoconf libtool libpciaccess-dev make libcunit1-dev libaio-dev
7
8
######################## centos ######################################
9
yum -y install git cmake gcc autoconf automake device-mapper-devel \
10
sqlite-devel pcre-devel libsepol-devel libselinux-devel \
11
automake autoconf gcc make glibc-devel glibc-devel.i686 kernel-devel \
12
fuse-devel pciutils libtool openssl-devel libpciaccess-devel CUnit-devel libaio-devel
13
mkdir -p /lib/modules/$(uname -r)
14
ln -sf /usr/src/kernels/$(uname -r) /lib/modules/$(uname -r)/build
15
16
# download dpdk
17
curl -sSL http://dpdk.org/browse/dpdk/snapshot/dpdk-${DPDK_VERSION}.tar.gz | tar -xz && mv dpdk-${DPDK_VERSION} ${RTE_SDK}
18
19
# install dpdk
20
cd ${RTE_SDK}
21
sed -ri 's,(CONFIG_RTE_BUILD_COMBINE_LIBS=).*,\1y,' config/common_linuxapp
22
sed -ri 's,(CONFIG_RTE_LIBRTE_VHOST=).*,\1y,' config/common_linuxapp
23
sed -ri 's,(CONFIG_RTE_LIBRTE_VHOST_USER=).*,\1n,' config/common_linuxapp
24
sed -ri '/CONFIG_RTE_LIBNAME/a CONFIG_RTE_BUILD_FPIC=y' config/common_linuxapp
25
make config CC=gcc T=$RTE_TARGET
26
make -j `nproc` RTE_KERNELDIR=/lib/modules/$(uname -r)/build
27
make install
28
depmod
Copied!
配置Hugepages: 添加"default_hugepagesz=1G hugepagesz=1G hugepages=4"/etc/grub/defaultGRUB_CMDLINE_LINUX,并执行(测试环境可以配置GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet transparent_hugepage=never default_hugepagesz=2MB hugepagesz=2MB hugepages=512"
1
grub2-mkconfig -o /boot/grub2/grub.cfg
2
systemctl reboot
Copied!
加载内核模块
1
modprobe uio
2
insmod kmod/igb_uio.ko
3
./tools/dpdk-devbind.py --bind=igb_uio <Device BDF>
Copied!

REHL 7.2

1
subscription-manager repos --enable rhel-7-server-extras-rpms
2
yum install dpdk dpdk-tools
Copied!

Ubuntu 15+

1
apt-get install dpdk
Copied!
最近更新 3yr ago