Closed Aniurm closed 7 months ago
I see the problem, the calculate_rate() routine in app/pktgen-rate.c is not used for latency testing. This routine is used for packet-pacing which is different from rate. In app/pktgen.c look at the pktgen_packet_rate() routine for the calculation of rate used for the other modes.
The only reason I can see the latency to change is the number of packets being handled by testpmd and testpmd could be doing something like batching packets or using rte_eth_tx_buffer_xxxx routines to maintainer better performance. The code in pktgen sends a stream of packets at a given rate then is injects latency packet at 10,000us intervals or whatever the inject rate is set to.
Latency is tricky when trying to use software to measure the values.
I have a performance-update branch, which removes the pktgen-rate.c code and attempts to give better performance along with handling injecting packets into a stream. Have a look at it if you it is still very much a Work-In-Progress.
Thank you for your help, now I can understand the code, I'm very grateful to you.
Since rate
is an irrelevant variable in my experiment, I'll just use a fixed rate.
What's the problem
I have observed varying latency results at different transmission (Tx) rates. I ran pktgen for sufficient time to generate a large number of packets, aiming to minimize the chance of error.
set 0 rate 0.01
set 0 rate 0.001
set 0 rate 0.0001
set 0 rate 0.00001
0.01
- Average 11.84 us0.001
- Average 9.36 us0.0001
. - Average 6.90 us0.00001
- Average 7.72 usI am unsure why latency varies with the Tx rate. I would expect latency to remain consistent regardless of the Tx rate.
By the way, what does Tx rate mean?
I've read the source code:
From this code,
info->tx_cycles
controls the frequency of Tx bursts inpktgen.c
. However, howrate
affectstx_cycles
is somewhat confusing.My current understanding: Pktgen knows the maximum speed of my NIC (but how?), and we can use the rate to control the actual transmission speed (
actual speed = max speed * rate
). Is this correct?My configuration
Testpmd
Pktgen