dpdk-trafgen#
Repository: guenterfischer-public/networking/dpdk-trafgen
Summary#
DPDK Trafgen is a tool for generating Ethernet traffic designed for Mellanox ConnectX network interface cards (NICs). It can be controlled via a REST API and is intended for use in system testing.
Installation#
Pre-built versions of the tool can be downloaded from the GitLab Repository.
cd /tmp
curl -O https://gitlab.com/api/v4/projects/72310114/packages/generic/releases/0.2.0/dpdk-trafgen_0.2.0_amd64.deb
sudo apt install /tmp/dpdk-trafgen_0.2.0_amd64.deb
The application and all its associated resources are installed in the /opt/dpdk-trafgen directory.
Usage#
1) Verify NICs#
The mlx5_core driver must be assigned to the relevant NICs (ConnectX-6).
dpdk-devbind.py -s
Network devices using kernel driver
===================================
0000:02:00.0 'MT28908 Family [ConnectX-6] 101b' if=enp2s0f0np0 drv=mlx5_core unused=
0000:02:00.1 'MT28908 Family [ConnectX-6] 101b' if=enp2s0f1np1 drv=mlx5_core unused=
0000:80:1f.6 'Device 550c' if=enp128s31f6 drv=e1000e unused=
2) Configure Hugepages#
sudo dpdk-hugepages.py -p 1G --setup 4G
3) Start DPDK Trafgen#
sudo /opt/dpdk-trafgen -l 0-3 -n 4 -a 0000:02:00.0
[2026-03-11 20:37:03.327] [info] [main] Starting DPDK-Trafgen 0.1.0...
EAL: Detected CPU lcores: 14
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
[2026-03-11 20:37:03.818] [info] [dpdk-trafgen-devices] [port 0]
[2026-03-11 20:37:03.818] [info] [dpdk-trafgen-devices] driver: mlx5_pci
[2026-03-11 20:37:03.818] [info] [dpdk-trafgen-devices] if_index: 3
[2026-03-11 20:37:03.818] [info] [dpdk-trafgen-devices] mtu: 46-65535
[2026-03-11 20:37:03.818] [info] [dpdk-trafgen-devices] >> Link up at 100 Gbps FDX Autoneg
[2026-03-11 20:37:03.828] [info] [dpdk-trafgen-api] Start server...
[2026-03-11 20:37:03.829] [info] [dpdk-trafgen-api] Started server on port 8000!
4) Control via REST API#
Note
The application also provides a Swagger UI documentation, which is available at http://localhost:8000/swagger/ui.
Tip
When using cURL, the JSON response can be formatted using the JSON Pretty Printer (json_pp).
# Example
curl -X POST "http://localhost:8000/api/v1/start" | json_pp
Configuration#
Set new runtime configuration
Note: It’s also possible to change the configuration during an active traffic generation!
curl -X POST "http://localhost:8000/api/v1/config/runtime" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d "{\"data_rate_bps\":25000000,\"burst_size\":64}"
{
"code" : 0,
"message" : "",
"solution" : ""
}
Get current runtime configuration
curl -X GET "http://localhost:8000/api/v1/config/runtime" \
-H "accept: application/json" \
{
"burst_size" : 64,
"data_rate_bps" : 25000000
}
Set new packet configuration
Note: The packet configuration can not be changed during an active traffic generation!
curl -X POST "http://localhost:8000/api/v1/config/packet" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d "[{\"eth\":{\"src_addr\":\"00:11:22:33:44:55\",\"dst_addr\":\"66:77:88:99:aa:bb\"},\"ipv4\":{\"ttl\":64,\"src_addr\":\"192.168.42.1\",\"dst_addr\":\"192.168.42.2\"},\"udp\":{\"src_port\":9000,\"dst_port\":9001},\"payload_length\":1000},{\"eth\":{\"src_addr\":\"00:11:22:33:44:55\",\"dst_addr\":\"66:77:88:99:aa:bb\"},\"ipv4\":{\"ttl\":64,\"src_addr\":\"192.168.42.3\",\"dst_addr\":\"192.168.42.4\"},\"udp\":{\"src_port\":9002,\"dst_port\":9003},\"payload_length\":1200}]"
Get current packet configuration
curl -X GET "http://localhost:8000/api/v1/config/packet" \
-H "accept: application/json"
[
{
"eth" : {
"dst_addr" : "66:77:88:99:aa:bb",
"src_addr" : "00:11:22:33:44:55"
},
"ipv4" : {
"dst_addr" : "192.168.42.2",
"src_addr" : "192.168.42.1",
"ttl" : 64
},
"payload_length" : 1000,
"udp" : {
"dst_port" : 9001,
"src_port" : 9000
}
},
{
"eth" : {
"dst_addr" : "66:77:88:99:aa:bb",
"src_addr" : "00:11:22:33:44:55"
},
"ipv4" : {
"dst_addr" : "192.168.42.4",
"src_addr" : "192.168.42.3",
"ttl" : 64
},
"payload_length" : 1200,
"udp" : {
"dst_port" : 9003,
"src_port" : 9002
}
}
]
Control#
Start sending packets
curl -X POST "http://localhost:8000/api/v1/start" \
-H "accept: application/json" \
-d ""
{
"code" : 0,
"message" : "Traffic generation started!",
"solution" : ""
}
Stop sending packets
curl -X POST "http://localhost:8000/api/v1/stop" \
-H "accept: application/json" \
-d ""
{
"code" : 0,
"message" : "Traffic generation stopped!",
"solution" : ""
}
Statistics and Metrics#
Get statistics
The following queries can be used to control which statistics and metrics are returned:
incl_stats: Include common statistics (default: true)
incl_xstats: Include extended statistics (default: false)
incl_metrics: Include metrics (default: true)
curl -X GET "http://localhost:8000/api/v1/stats?incl_stats=true&incl_xstats=false&incl_metrics=true" \
-H "accept: application/json"
{
"ports": [
{
"id": 0,
"stats": [
{
"key": "oerrors",
"value": 0
},
{
"key": "ierrors",
"value": 0
},
{
"key": "obytes",
"value": 1304509440
},
{
"key": "imissed",
"value": 0
},
{
"key": "ibytes",
"value": 0
},
{
"key": "opackets",
"value": 1156480
},
{
"key": "rx_nombuf",
"value": 0
},
{
"key": "ipackets",
"value": 0
}
],
"xstats": null,
"metrics": [
{
"key": "peak_bits_in",
"value": 0
},
{
"key": "peak_bits_out",
"value": 24834048
},
{
"key": "mean_bits_out",
"value": 24834048
},
{
"key": "mean_bits_in",
"value": 0
},
{
"key": "ewma_bits_out",
"value": 24834046
},
{
"key": "ewma_bits_in",
"value": 0
}
]
}
]
}
Note
For more details, check the repository.