Skip to content

[Bug] AF_XDP sender sends at maximum speed #896

@svlobanov

Description

@svlobanov

Describe the bug
when using --xdp, tcpreplay sends traffic at maximum speed. I have a file rec1-4-4.pcap at rate ~153Mbps, but AF_XDP tcpreplay sender sends it at maximum speed:

tcpreplay --xdp --no-flow-stats -W  -i veth-replay rec1-4-4.pcap 
Actual: 446032 packets (614632096 bytes) sent in 0.936726 seconds
Rated: 656149285.9 Bps, 5249.19 Mbps, 476160.58 pps
Statistics for network device: veth-replay
	Successful packets:        446032
	Failed packets:            0
	Truncated packets:         0
	Retried packets (ENOBUFS): 0
	Retried packets (EAGAIN):  0

When I use non-xdp sender variant, it works as expected (sends ~153Mbps):

tcpreplay --no-flow-stats -W  -i veth-replay rec1-4-4.pcap 
Actual: 446032 packets (614632096 bytes) sent in 32.07 seconds
Rated: 19164560.9 Bps, 153.31 Mbps, 13907.51 pps
Statistics for network device: veth-replay
	Successful packets:        446032
	Failed packets:            0
	Truncated packets:         0
	Retried packets (ENOBUFS): 0
	Retried packets (EAGAIN):  0

To Reproduce
Steps to reproduce the behavior:

  1. Create veth pair (ip link add type veth, ip link set dev veth0 up, ip link set veth1 up)
  2. Run tcpreplay --xdp --no-flow-stats -W -i veth0 file.pcap
  3. Check if sending speed is the same as in file, compare xdp and non-xdp sending mode (remove --xdp)

Expected behavior
xdp mode should respect .pcap timestamps (send at the same speed as it was recorded)

Screenshots

System (please complete the following information):

  • OS: Ubuntu
  • OS version: 24.04
  • Tcpreplay Version 4.5.1

Additional context

tcpreplay version: 4.5.1 (build git:v4.5.1)
Copyright 2013-2024 by Fred Klassen <tcpreplay at appneta dot com> - AppNeta
Copyright 2000-2012 by Aaron Turner <aturner at synfin dot net>
The entire Tcpreplay Suite is licensed under the GPLv3
Cache file supported: 04
Not compiled with libdnet.
Compiled against libpcap: 1.10.4
64 bit packet counters: enabled
Verbose printing via tcpdump: disabled
Packet editing: disabled
Fragroute engine: disabled
Injection method: PF_PACKET send()
Not compiled with netmap
Optional injection method: AF_XDP```

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions