Files
Jonathan Lennox d947f36560 tc: Fix rounding in tc_calc_xmittime and tc_calc_xmitsize.
Currently, tc_calc_xmittime and tc_calc_xmitsize round from double to
int three times — once when they call tc_core_time2tick /
tc_core_tick2time (whose argument is int), once when those functions
return (their return value is int), and then finally when the tc_calc_*
functions return.  This leads to extremely granular and inaccurate
conversions.

As a result, for example, on my test system (where tick_in_usec=15.625,
clock_factor=1, and hz=1000000000) for a bitrate of 1Gbps, all tc htb
burst values between 0 and 999 bytes get encoded as 0 ticks; all values
between 1000 and 1999 bytes get encoded as 15 ticks (equivalent to 960
bytes); all values between 2000 and 2999 bytes as 31 ticks (1984 bytes);
etc.

The patch changes the code so these calculations are done internally in
floating-point, and only rounded to integer values when the value is
returned. It also changes tc_calc_xmittime to round its calculated value
up, rather than down, to ensure that the calculated time is actually
sufficient for the requested size.

Signed-off-by: Jonathan Lennox <jonathan.lennox@8x8.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
2025-02-28 15:47:23 +00:00
..
2020-01-20 09:43:22 -08:00
2024-03-12 15:11:43 -07:00
2024-01-25 16:49:10 -08:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2020-01-20 09:43:22 -08:00
2023-01-14 09:00:34 -08:00
2024-12-12 15:22:22 -08:00
2024-03-12 15:11:43 -07:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2024-01-08 01:44:50 +00:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2023-01-14 09:00:34 -08:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-10-07 09:37:24 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2017-11-24 12:21:35 -08:00
2024-03-12 15:11:43 -07:00
2023-01-14 09:00:34 -08:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2024-03-12 15:11:43 -07:00
2020-07-20 16:34:02 +00:00
2023-01-14 09:00:34 -08:00
2018-11-24 07:10:58 -08:00
2023-01-14 09:00:34 -08:00
2024-10-05 17:48:11 +00:00