DPDK环境搭建

先安装一些依赖的软件包:

git clone git://dpdk.org/dpdk # Get DPDK
git clone http://dpdk.org/git/dpdk-kmods # Get igb_uio
cp -r ./dpdk-kmods/linux/igb_uio ./dpdk/kernel/linux/ # Copy dpdk-kmods/linux/igb_uio/ to dpdk/kernel/linux/

更改配置文件

$ vim dpdk/kernel/linux/meson.build
subdirs = ['kni', 'igb_uio']
$ vim dpdk/kernel/linux/igb_uio/meson.build
-------------
# 加入如下的内容:
-------------
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
mkfile = custom_target('igb_uio_makefile',
output: 'Makefile',
command: ['touch', '@OUTPUT@'])
custom_target('igb_uio',
input: ['igb_uio.c', 'Kbuild'],
output: 'igb_uio.ko',
command: ['make', '-C', kernel_dir + '/build',
'M=' + meson.current_build_dir(),
'src=' + meson.current_source_dir(),
'EXTRA_CFLAGS=-I' + meson.current_source_dir() +
'/../../../lib/librte_eal/include',
'modules'],
depends: mkfile,
install: true,
install_dir: kernel_dir + '/extra/dpdk',
build_by_default: get_option('enable_kmods'))

配置环境

$ sudo apt-get install python3 python3-pip
$ sudo pip3 install meson ninja pwntools
$ cd dpdk; sudo meson -D examples=all build
$ cd build
$ sudo ninja install
$ mkdir -p /dev/hugepages
$ sudo mountpoint -q /dev/hugepages || sudo mount -t hugetlbfs nodev /dev/hugepages
$ echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages #大页
(或者 sudo sh -c 'echo 64 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages')

问题:
1.The following packages have unmet dependencies:
python3-setuptools : Depends: python3-pkg-resources (= 59.6.0-1.2) but 59.6.0-1.2ubuntu0.22.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

sudo apt install aptitude
Then, run aptitude with the package name causing the issue:
sudo aptitude install python3-setuptools

1.Release file for http://mirrors.aliyun.com/ubuntu/dists/focal-security/InRelease is not valid yet (invalid for another 5d 11h 43min 44s).
修改时间: https://blog.csdn.net/weixin_45663954/article/details/123394680

测试运行

$ cd dpdk/build/examples; sudo ./dpdk-helloworld
....
Hello from core 0
Hello from core 1

你可能感兴趣的:(网络,linux)