diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2024-02-07 16:34:27 +0000 |
---|---|---|
committer | Viacheslav Hletenko <v.gletenko@vyos.io> | 2024-02-07 16:34:27 +0000 |
commit | ce1035e1e8642bf740e2a21693a72fe2127b8f72 (patch) | |
tree | 87353d1fa2ebb731a832d20b199b2d7f393ef83a /src | |
parent | 9d74ae52092e97aa0ef285df4d44a5eb7ae93fbf (diff) | |
download | vyos-1x-ce1035e1e8642bf740e2a21693a72fe2127b8f72.tar.gz vyos-1x-ce1035e1e8642bf740e2a21693a72fe2127b8f72.zip |
T6021: Fix QoS shaper r2q calculation
The current calculation `r2q` is wrong as it uses `Floor division`
but expecting `division`
This way `math.ceil` calculate wrong value as we expect
round a number upward to its nearest integer
For example for speed 710 mbits expected value `444` but we get `443`
```
from math import ceil
MAXQUANTUM = 200000
speed = 710000000
speed_bps = int(speed) // 8
>>> speed_bps // MAXQUANTUM
443
>>> speed_bps / MAXQUANTUM
443.75
>>>
>>>
>>> ceil(speed_bps // MAXQUANTUM)
443
>>> ceil(speed_bps / MAXQUANTUM)
444
>>>
```
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions