本人小白一枚 从官方转的贴
原贴地址底部
具体是干嘛用的 看文档~! 大佬们勿喷~!
在 OpenWrt 上启用 DPDK本文档介绍如何在虚拟和物理 x86 环境中在 OpenWrt 上启用数据平面开发工具包 (DPDK)。 简介OpenWrt项目是一个众所周知的基于源代码的路由器操作系统,它提供了一个具有包管理的完全可写文件系统。
12.2. 构建 OpenWrt您可以通过 https://downloads.openwrt.org/releases 获取OpenWrt图像。要完全自定义您自己的OpenWrt,强烈建议从源代码构建它。您可以按如下方式克隆OpenWrt源代码: git clone https://git.openwrt.org/openwrt/openwrt.git
12.2.1. OpenWrt 配置- 选择范围x86Target System
- 选择范围x86_64Subtarget
- 选择交叉编译环境Build the OpenWrt SDK
- 然后选择然后选择Use glibcAdvanced configuration options (for developers)ToolChain OptionsC Library implementation
12.2.2. 内核配置应启用以下配置: - CONFIG_VFIO_IOMMU_TYPE1=y
- CONFIG_VFIO_VIRQFD=y
- CONFIG_VFIO=y
- CONFIG_VFIO_NOIOMMU=y
- CONFIG_VFIO_PCI=y
- CONFIG_VFIO_PCI_MMAP=y
- CONFIG_HUGETLBFS=y
- CONFIG_HUGETLB_PAGE=y
- CONFIG_PROC_PAGE_MONITOR=y
12.2.3. 构建步骤有关详细的 OpenWrt 构建步骤和先决条件,请参阅 OpenWrt 构建指南。 生成完成后,可以在 中找到映像和 SDK。<OpenWrt Root>/bin/targets/x86/64-glibc/
12.3. OpenWrt 的 DPDK 交叉编译12.3.1. 先决条件NUMA 需要在 x86 中运行 DPDK。 注意 要编译 NUMA 库,请运行以确保 libtool 版本>= 2.2,否则编译将失败并显示错误。libtool --version
git clone https://github.com/numactl/numactl.gitcd numactlgit checkout v2.0.13 -b v2.0.13./autogen.shautoconf -iexport PATH=<OpenWrt SDK>/glibc/openwrt-sdk-x86-64_gcc-8.3.0_glibc.Linux-x86_64/staging_dir/toolchain-x86_64_gcc-8.3.0_glibc/bin/PATH./configure CC=x86_64-openwrt-linux-gnu-gcc --prefix=<OpenWrt SDK toolchain dir>make install
numa 头文件和 lib 文件分别在包含和 lib 文件夹中生成,位于 <OpenWrt SDK 工具链目录下>。
12.3.2. 构建 DPDK要使用介子构建进行交叉编译,您需要先编写一个自定义的交叉文件。 [binaries]c = 'x86_64-openwrt-linux-gcc'cpp = 'x86_64-openwrt-linux-cpp'ar = 'x86_64-openwrt-linux-ar'strip = 'x86_64-openwrt-linux-strip'meson builddir --cross-file openwrt-crossninja -C builddir
12.4. 在 OpenWrt 上运行 DPDK 应用程序12.4.1. 虚拟机gzip -d openwrt-x86-64-combined-ext4.img.gz
qemu-system-x86_64 \ -cpu host \ -smp 8 \ -enable-kvm \ -M q35 \ -m 2048M \ -object memory-backend-file,id=mem,size=2048M,mem-path=/tmp/hugepages,share=on \ -drive file=<Your OpenWrt images folder>/openwrt-x86-64-combined-ext4.img,id=d0,if=none,bus=0,unit=0 \ -device ide-hd,drive=d0,bus=ide.0 \ -net nic,vlan=0 \ -net nic,vlan=1 \ -net user,vlan=1 \ -display none \
12.4.2. 物理机您可以使用该工具将 OpenWrt 映像写入要在其上写入映像的驱动器。dd dd if=openwrt-18.06.1-x86-64-combined-squashfs.img of=/dev/sdX
其中 sdX 是驱动器的名称。(你可以找到它fdisk -l)
12.4.3. 运行 DPDK有关如何运行 DPDK 应用程序的更多详细信息,请参阅 DPDK 文档的部分。Running DPDK Applications 注意 您需要在 OpenWrt 中将预构建的 NUMA 库(包括软链接)安装到 /usr/lib64。
原贴地址:在 OpenWrt 上启用 DPDK — 数据平面开发工具包 22.03.0 文档
|