summaryrefslogtreecommitdiff
path: root/python/vyos/qos/base.py
diff options
context:
space:
mode:
authorkhramshinr <khramshinr@gmail.com>2024-04-12 13:32:52 +0800
committerkhramshinr <khramshinr@gmail.com>2024-04-12 18:47:53 +0800
commit31cd75aec6d035b36537046ae0d034c03009a3fc (patch)
tree7d0c918fdbab899ef5a9855f4ade72589e9ee0e9 /python/vyos/qos/base.py
parent5d890037b177ce6971ac00f52e4cce2cac898f46 (diff)
downloadvyos-1x-31cd75aec6d035b36537046ae0d034c03009a3fc.tar.gz
vyos-1x-31cd75aec6d035b36537046ae0d034c03009a3fc.zip
qos: T6035: QoS policy shaper queue-type random-detect requires limit avpkt
Added params for configuration red on the shaper policy
Diffstat (limited to 'python/vyos/qos/base.py')
-rw-r--r--python/vyos/qos/base.py29
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':