diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2024-02-07 16:34:27 +0000 |
---|---|---|
committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-02-07 17:02:13 +0000 |
commit | 6c3c5389bdd3f6b9d40e53596f9f22a2a36bfee9 (patch) | |
tree | fbbea1173c1c929379fecc4b0d08988a11e23d1b /python/vyos/component_version.py | |
parent | a0a18c4fa02c9d8aae30950720362d599a8ba6cd (diff) | |
download | vyos-1x-6c3c5389bdd3f6b9d40e53596f9f22a2a36bfee9.tar.gz vyos-1x-6c3c5389bdd3f6b9d40e53596f9f22a2a36bfee9.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
>>>
```
(cherry picked from commit ce1035e1e8642bf740e2a21693a72fe2127b8f72)
Diffstat (limited to 'python/vyos/component_version.py')
0 files changed, 0 insertions, 0 deletions