luigirizzo / netmap

Automatically exported from code.google.com/p/netmap
BSD 2-Clause "Simplified" License
1.85k stars 536 forks source link

Send Packets while caculate RTT #919

Open missyoyo opened 1 year ago

missyoyo commented 1 year ago

Hello: I see pkt-gen.c source code can caculate RTT,So I have do some test. I have one PC use two igc(2.5Gbps NIC). pkt-gen -i netmap:igc1 -f tx -B pkt-gen -i netmap:igc2 -f rx -B I can get line-rate when use pkt-gen, That is very good. 486.572591 main_thread [2704] 2.053 Mpps (2.055 Mpkts 2.497 Gbps in 1000994 usec) 39.59 avg_batch 704 min_space But I want caculate RTT when do this test. So I have ping on igx1 and pong on igc2(new windows, new command). When I use low send rate, seems works 200.095 Kpps (200.466 Kpkts 243.316 Mbps in 1001854 usec) I get RTT: count 231232 RTT: min 27489 av 461857962 ns[462ms seems very large latency but still works] When I try higher speed,eg:1.001 Mpps (1.002 Mpkts 1.217 Gbps in 1001762 usec),I get PING message 089.904221 ping_body [1364] -- ouch, cannot send 089.904224 ping_body [1364] -- ouch, cannot send 089.904378 ping_body [1364] -- ouch, cannot send 089.904393 ping_body [1364] -- ouch, cannot send 092.906539 ping_body [1397] poll error on queue 0: timeout 095.907572 ping_body [1397] poll error on queue 0: timeout 104.955080 ping_body [1397] poll error on queue 0: timeout

So,May I know,is it possibole to keep high send speed can still can caculate RTT?

jbrandeb commented 1 year ago

The receiver is probably dropping some or a lot of the frames you're sending. The test you're running is a unidirectional flood. This is probably causing the frames from ping to be among the "dropped" frames. You could set up the receiver to "bounce" back all the packets you received and then measure the RTT from the sender. This would involve different or new apps than pkt-gen, but may be commonly covered by something in netmap that I don't know about.

missyoyo commented 1 year ago

@jbrandeb Thank you for your answer. Maybe I have a bit of a misunderstanding about measuring RTT. I thought RTT measurement needed to run PING on the sender and then run PONG on the receiver, and then the sender's PING would measure RTT. But after more test, it seems that it's not like that. My current understanding is that the sender sends packets directly, and then the receiver runs PING. Regardless of the speed of the sender, the PING on the receiver can get the RTT. So, my question is, is this understanding correct? In other words, to complete the packet receiving statistics and RTT measurement on the receiver, the receiver needs two tests, one with PING running on the receiver, and the other with RX running on the receiver? Another Question:Why I get RTT in negative values? 330.643535 ping_body [1454] count 3073704 RTT: min -394137764 av -1712524204 ns and some RTT seems good? 322.643523 ping_body [1454] count 3075012 RTT: min 195784765 av 876248250 ns Thank you

jhk098 commented 1 year ago

Your understanding is correct. One end of the link runs "ping", which sends packets which contain a seqnum and a timestamp, then (in the same loop) receives the same packets echoed back by the other end of the link ("pong"), takes another timestamp and calculate the time difference with the timestamp found in the packet. The other end of the link runs "pong", which just echoes back received packets (swapping MAC addresses and IP addresses).

That "ouch cannot send" message just means that the TX ring has no space for further transmissions, so that it is not able to send more packets. It is not an issue, it's perfectly ok. We should remove the print. The ping/pong is just an example. It could be improved to fix some issues.

You could also try the same ping/pong test on a VALE switch, to perform a local test, e.g.

$ pkt-gen -i vale:0 -f pong
$ pkt-gen -i vale:1 -f ping