Skip to content

[Bug] 64 bit rollover causes pps replay to switch to max rate fairly quickly #629

@p-sandie

Description

@p-sandie

64 bit rollover causes pps replay to switch to max rate fairly quickly, due to code below in calc_sleep_time() (in send_packets.c):

 /*
  * packets * 1000000 divided by pps = microseconds
  * packets per sec (pps) = packets per hour / (60 * 60)
  */
 COUNTER next_tx_us = (pkts_sent * 1000000) * (60 * 60) / pph;
 COUNTER tx_us = now_us - start_us;

The use of an absolute microseconds value means that the numerator in the next_ts_us calculation rolls over at max COUNTER / 3.6 billion, e.g. at 400Kpps that's around three and half hours.

That results in the next packet being sent immediately, so effectively a switch to full rate.

Maybe worth moving away from microseconds there, e.g. use seconds and microseconds, however a quick fix
is changing to e.g.:

 COUNTER next_tx_us = pkts_sent * 3600 /(pph / 1000000);

At 400Kpps that allows over 400 years.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions