dpdk-debug
1. download dpdk source and build it
ref: https://core.dpdk.org/doc/quick-start/
meson --buildtype=debug debugbuild
2. Reserve huge pages memory.
mkdir -p /dev/hugepages
mountpoint -q /dev/hugepages || mount -t hugetlbfs nodev /dev/hugepages
echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
3. construct Sample Topology
This tutorial uses the following topology to carry out the tests.
+ +
| |
| +-----+ |
| | | |
| | | |
| +----------+ | DPDK| +----------+ |
| | left | | App | | right | |
| | namespace| | | |namespace | |
+-----+ A +------+ +-----+ B +--------+
| | | A'| | B' | | |
| | | | | | | |
| +----------+ | | +----------+ |
| | | |
| | | |
| | | |
| +-----+ |
| |
| |
+ +
192.168.0.X n/w 10.0.0.X n/w
A = veth_l1
A' = veth_l0
B = veth_r1
B' = veth_r0
Diagram: Sample Topology for conntrack testing
The steps for creation of the setup are mentioned below.
Create “left” network namespace:
$ ip netns add left
Create “right” network namespace:
$ ip netns add right
Create first pair of veth interfaces:
$ ip link add veth_l0 type veth peer name veth_l1
Add veth_l1 to “left” network namespace:
$ ip link set veth_l1 netns left
Create second pair of veth interfaces:
$ ip link add veth_r0 type veth peer name veth_r1
Add veth_r1 to “right” network namespace:
$ ip link set veth_r1 netns right
4. start test dpdk-app:
./debugbuild/app/dpdk-testpmd -c7 --vdev=net_pcap0,iface=veth_l0 --vdev=net_pcap1,iface=veth_r0 -- -i --nb-cores=2 --nb-ports=2 --total-num-mbufs=2048
testpmd> set verbose 1
testpmd> start
left ns:
ip netns exec left ping 192.168.0.6 -c1
right ns:
ip netns exec right tcpdump -i veth_r1 -nn
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on veth_r1, link-type EN10MB (Ethernet), capture size 262144 bytes
15:49:09.967117 ARP, Request who-has 192.168.0.6 tell 192.168.0.2, length 28
15:49:09.967137 ARP, Reply 192.168.0.6 is-at ca:24:08:0c:52:ca, length 28
16:07:16.624179 IP 192.168.0.2 > 192.168.0.6: ICMP echo request, id 30308, seq 1, length 64
16:07:16.624217 IP 192.168.0.6 > 192.168.0.2: ICMP echo reply, id 30308, seq 1, length 64
5. vscode setting
remote-ssh setting:
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config
Host linux
HostName 100.85.244.203
User root
IdentityFile "C:\Users\{replace-username}\.ssh\id_rsa"
NOTE: run ssh-copy-id root@100.85.244.203 to set no-pass login.
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceFolder}/debugbuild/app/dpdk-testpmd",
"cwd": "${workspaceFolder}",
"processId": "19083",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"miDebuggerPath": "/usr/bin/gdb",
}
]
}
install Dependency
yum install zlib-devel
pip3 install meson
pip3 install pyelftools