dpdk21.11 编译(meson+ninja)及VFIO模块的加载和运行
ninja
a small build system with a focus on speed
项目地址:https://gitcode.com/gh_mirrors/ni/ninja

·
目录
前言
操作系统:ubuntu22.04.2 LTS
内核版本:5.19.0-42-generic
dpdk版本:dpdk-stable-21.11.4
安装前的环境配置
sudo apt install libnuma-dev
sudo apt install meson
sudo apt install ninja-build
pyelftools-0.28-py2.py3-none-any.whl #(这个是从pypi网站下载的,通过 pip install 安装)
# ---- 如果是 ubuntu 20.04.2 ----
# 之前是通过Python-pip 安装
# 从 pypi 网站下载
meson-0.61.3-py3-none-any.whl
ninja-1.10.2.3-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
编译流程
由于dpdk19.11 版本以后取消了 dpdk_setup.sh 的脚本,所以编译命令需要手动执行
1. 设置环境变量(好像也不需要了)
ninja
a small build system with a focus on speed
项目地址:https://gitcode.com/gh_mirrors/ni/ninja
export RTE_SDK=`pwd`
export RTE_TARGET=x86_64-native-linuxapp-gcc
2. 构建dpdk
meson -Dexamples=All build
meson configure -Dexamples=All build -Dprefix=`pwd`/x86_64-native-linuxapp-gcc
# -Dexamples=All 标识编译所有的 examples 目录下的示例,也可以单独的写一个或多个(l2fwd)
# -Dprefix=`pwd`/x86_64-native-linuxapp-gcc 目标目录,注意修改 `pwd` 为当前dpdk所在目录
# -Ddisable_drivers='common/cnxk' 编译时禁用cnxk模块
3. 编译
ninja install -C build
执行测试
1. 绑定vfio-pci 模块
sudo modprobe vfio-pci
2. 挂载网卡
dpdk-devbind.py -s
# 以ens38 0000:02:06.0 为例
sudo ifconfig ens38 down
sudo dpdk-devbind.py -b vfio-pci 0000:02:06.0
# 因为ens38网卡为激活状态,当前挂载在内核驱动上,需要先down掉,然后才能绑定dpdk驱动
3. 设置大页
大页可以直接通过修改 grub进行预设,也可以后期直接设置
grub预设的好处是 在系统启动时就直接分配了对应的大页空间,减少系统资源的浪费
大页设置可以通过 dpdk-hugepage.py 脚本进行设置
官网 dpdk-Hugepages 的使用
https://doc.dpdk.org/guides-21.11/tools/hugepages.html?highlight=huge
也可以通过 命令行直接写入数据设置
echo 256 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
# 其中 256 为大页个数
# 如果当前操作系统有多个node,需要每个都设置上(网卡所在node以及要使用的node)
# 大页分为 2048K(2M) 和 1048576kB(1G),当前使用 2M 大页
4. 启动测试程序-testpmd
testpmd 为例
命令:sudo ./x86_64-native-linuxapp-gcc/bin/dpdk-testpmd -l 1-2 -- -i
推荐内容
阅读全文
AI总结




a small build system with a focus on speed
最近提交(Master分支:7 个月前 )
649ec6cd
Fix depfile parser to support ? 2 个月前
e9033575
The `?` is actually valid on Unix filesystems, as well as on Windows
when it appears at the start of the path, as in `\\?\C:\foo` or
`//?/C:/foo`.
Before this patch, the depfile parser considered it as whitespace
and would mistakenly decompose `//?/C:/foo` into two separate paths
(`//` and `/C:/foo`) which broke Ninja incremental builds.
The major change in in src/depfile_parser.in.cc
Note that re2c version 3.1 was used to regenerate depfile_parser.cc
from that file.
Fixes #2568
2 个月前
更多推荐
所有评论(1)
您需要登录才能发言
相关推荐
查看更多
ninja

Ninja is a full stack web framework for Java. Rock solid, fast and super productive.
ninja

Reverse engineered ChatGPT proxy
Ninja

Yet another web browser for Android.
热门开源项目
活动日历
查看更多
直播时间 2025-04-09 14:34:18

樱花限定季|G-Star校园行&华中师范大学专场
直播时间 2025-04-07 14:51:20

樱花限定季|G-Star校园行&华中农业大学专场
直播时间 2025-03-26 14:30:09

开源工业物联实战!
直播时间 2025-03-25 14:30:17

Heygem.ai数字人超4000颗星火燎原!
直播时间 2025-03-13 18:32:35

全栈自研企业级AI平台:Java核心技术×私有化部署实战
Error: bind failed for 0000:00:04.0 - Cannot bind to driver vfio-pci
Error: unbind failed for 0000:00:04.0 - Cannot open /sys/bus/pci/drivers//unbind