diff options
author | khramshinr <khramshinr@gmail.com> | 2024-04-12 13:32:52 +0800 |
---|---|---|
committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-04-13 11:11:07 +0000 |
commit | 92f236989bc8fee0cc0170999204dc5ffc5cc1f8 (patch) | |
tree | 90bff1230431992cfb2a66c3dfb1fe3ad9bc94b2 /python | |
parent | 7441c14810e5254d53c7fefca87297ad10ab9c1d (diff) | |
download | vyos-1x-92f236989bc8fee0cc0170999204dc5ffc5cc1f8.tar.gz vyos-1x-92f236989bc8fee0cc0170999204dc5ffc5cc1f8.zip |
qos: T6035: QoS policy shaper queue-type random-detect requires limit avpkt
Added params for configuration red on the shaper policy
(cherry picked from commit 31cd75aec6d035b36537046ae0d034c03009a3fc)
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/qos/base.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/python/vyos/qos/base.py b/python/vyos/qos/base.py index c8e881ee2..f9366c6b1 100644 --- a/python/vyos/qos/base.py +++ b/python/vyos/qos/base.py @@ -90,6 +90,23 @@ class QoSBase: else: return value + def _calc_random_detect_queue_params(self, avg_pkt, max_thr, limit=None, min_thr=None, mark_probability=None): + params = dict() + avg_pkt = int(avg_pkt) + max_thr = int(max_thr) + mark_probability = int(mark_probability) + limit = int(limit) if limit else 4 * max_thr + min_thr = int(min_thr) if min_thr else (9 * max_thr) // 18 + + params['avg_pkt'] = avg_pkt + params['limit'] = limit * avg_pkt + params['min_val'] = min_thr * avg_pkt + params['max_val'] = max_thr * avg_pkt + params['burst'] = (2 * min_thr + max_thr) // 3 + params['probability'] = 1 / mark_probability + + return params + def _build_base_qdisc(self, config : dict, cls_id : int): """ Add/replace qdisc for every class (also default is a class). This is @@ -144,6 +161,18 @@ class QoSBase: elif queue_type == 'random-detect': default_tc += f' red' + qparams = self._calc_random_detect_queue_params( + avg_pkt=dict_search('average_packet', config), + max_thr=dict_search('maximum_threshold', config), + limit=dict_search('queue_limit', config), + min_thr=dict_search('minimum_threshold', config), + mark_probability=dict_search('mark_probability', config) + ) + + default_tc += f' limit {qparams["limit"]} avpkt {qparams["avg_pkt"]}' + default_tc += f' max {qparams["max_val"]} min {qparams["min_val"]}' + default_tc += f' burst {qparams["burst"]} probability {qparams["probability"]}' + self._cmd(default_tc) elif queue_type == 'drop-tail': |