summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-12-17 20:12:12 +0100
committerGitHub <noreply@github.com>2024-12-17 20:12:12 +0100
commit31e71556f18308c85a1c0b0ef9f6f77b0ab83f7a (patch)
tree8b4b1c380fbdbd928ebe15c00e3de97ccca44b64 /python
parent9ddd71832fd892ae591733b3c6e6e04f6f9bc2fb (diff)
parent99feb3bbe88a3ed96ec5d6dd741689f30a385693 (diff)
downloadvyos-1x-31e71556f18308c85a1c0b0ef9f6f77b0ab83f7a.tar.gz
vyos-1x-31e71556f18308c85a1c0b0ef9f6f77b0ab83f7a.zip
Merge pull request #4175 from HollyGurza/T6800
T6799: QoS: Improve Priority-Queue Policy
Diffstat (limited to 'python')
-rw-r--r--python/vyos/qos/base.py6
-rw-r--r--python/vyos/qos/priority.py19
2 files changed, 13 insertions, 12 deletions
diff --git a/python/vyos/qos/base.py b/python/vyos/qos/base.py
index 12d940e3c..3da9afe04 100644
--- a/python/vyos/qos/base.py
+++ b/python/vyos/qos/base.py
@@ -164,11 +164,11 @@ class QoSBase:
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),
+ avg_pkt=dict_search('average_packet', config) or 1024,
+ max_thr=dict_search('maximum_threshold', config) or 18,
limit=dict_search('queue_limit', config),
min_thr=dict_search('minimum_threshold', config),
- mark_probability=dict_search('mark_probability', config)
+ mark_probability=dict_search('mark_probability', config) or 10
)
default_tc += f' limit {qparams["limit"]} avpkt {qparams["avg_pkt"]}'
diff --git a/python/vyos/qos/priority.py b/python/vyos/qos/priority.py
index 7f0a67032..66d27a639 100644
--- a/python/vyos/qos/priority.py
+++ b/python/vyos/qos/priority.py
@@ -20,17 +20,18 @@ class Priority(QoSBase):
# https://man7.org/linux/man-pages/man8/tc-prio.8.html
def update(self, config, direction):
- if 'class' in config:
- class_id_max = self._get_class_max_id(config)
- bands = int(class_id_max) +1
+ class_id_max = self._get_class_max_id(config)
+ class_id_max = class_id_max if class_id_max else 1
+ bands = int(class_id_max) + 1
- tmp = f'tc qdisc add dev {self._interface} root handle {self._parent:x}: prio bands {bands} priomap ' \
- f'{class_id_max} {class_id_max} {class_id_max} {class_id_max} ' \
- f'{class_id_max} {class_id_max} {class_id_max} {class_id_max} ' \
- f'{class_id_max} {class_id_max} {class_id_max} {class_id_max} ' \
- f'{class_id_max} {class_id_max} {class_id_max} {class_id_max} '
- self._cmd(tmp)
+ tmp = f'tc qdisc add dev {self._interface} root handle {self._parent:x}: prio bands {bands} priomap ' \
+ f'{class_id_max} {class_id_max} {class_id_max} {class_id_max} ' \
+ f'{class_id_max} {class_id_max} {class_id_max} {class_id_max} ' \
+ f'{class_id_max} {class_id_max} {class_id_max} {class_id_max} ' \
+ f'{class_id_max} {class_id_max} {class_id_max} {class_id_max} '
+ self._cmd(tmp)
+ if 'class' in config:
for cls in config['class']:
cls = int(cls)
tmp = f'tc qdisc add dev {self._interface} parent {self._parent:x}:{cls:x} pfifo'