Page MenuHomeVyOS Platform

QOS Default classes are not configured with correct qdisc
Closed, ResolvedPublicBUG

Description

qos classes of type "default" are not being setup with the configured queuing discipline.

Bug recreation (variation: no classes)

vyos@vyos# set qos policy shaper TEST bandwidth 777mbit
[edit]
vyos@vyos# set qos policy shaper TEST default bandwidth 333mbit
[edit]
vyos@vyos# set qos interface eth1 egress TEST
[edit]
vyos@vyos# commit
DEBUG/QoS: tc qdisc replace dev eth1 root handle 1: htb r2q 485 default 1
DEBUG/QoS: tc class replace dev eth1 parent 1: classid 1:1 htb rate 777000000
DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:1 htb rate 333000000 burst 15k quantum 1514 prio 20
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:1 sfq
{'bandwidth': '777mbit',
 'default': {'bandwidth': '333mbit',
             'burst': '15k',
             'codel_quantum': '1514',
             'flows': '1024',
             'interval': '100',
             'priority': '20',
             'queue_type': 'fq-codel',
             'target': '5'}}
[edit]
vyos@vyos# tc qdisc show dev eth1
qdisc htb 1: root refcnt 2 r2q 485 default 0x1 direct_packets_stat 0 direct_qlen 1000
qdisc sfq 8001: parent 1:1 limit 127p quantum 1514b depth 127 divisor 1024
[edit]

Bug recreation (variation: with classes)

vyos@vyos# set qos policy shaper TEST class 42 bandwidth 42mbit
[edit]
vyos@vyos# commit
DEBUG/QoS: tc qdisc replace dev eth1 root handle 1: htb r2q 485 default 2b
DEBUG/QoS: tc class replace dev eth1 parent 1: classid 1:1 htb rate 777000000
DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:2a htb rate 42000000 burst 15k quantum 1514
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:2a sfq
DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:2b htb rate 333000000 burst 15k quantum 1514 prio 20
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:2b sfq
{'bandwidth': '777mbit',
 'class': {'42': {'bandwidth': '42mbit',
                  'burst': '15k',
                  'codel_quantum': '1514',
                  'flows': '1024',
                  'interval': '100',
                  'queue_type': 'fq-codel',
                  'target': '5'}},
 'default': {'bandwidth': '333mbit',
             'burst': '15k',
             'codel_quantum': '1514',
             'flows': '1024',
             'interval': '100',
             'priority': '20',
             'queue_type': 'fq-codel',
             'target': '5'}}
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:2a fq_codel quantum 1514 flows 1024 interval 100 interval 100 target 5
DEBUG/QoS: tc filter replace dev eth1 parent 1: protocol all basic flowid 1:2a
[edit]
vyos@vyos# tc qdisc show dev eth1
qdisc htb 1: root refcnt 2 r2q 485 default 0x2b direct_packets_stat 0 direct_qlen 1000
qdisc sfq 8003: parent 1:2b limit 127p quantum 1514b depth 127 divisor 1024
qdisc fq_codel 8004: parent 1:2a limit 10240p flows 1024 quantum 1514 target 4us interval 99us memory_limit 32Mb ecn drop_batch 64
[edit]

This variant correctly configures the class '10' but not 'default'

Bug recreation (variation: with part of T5295 reverted + no classes)

#
if 'default' in config:
    if 'class' in config:
        class_id_max = self._get_class_max_id(config)
        default_cls_id = int(class_id_max) +1
        self._build_base_qdisc(config['default'], default_cls_id)
#
vyos@vyos# commit
DEBUG/QoS: tc qdisc replace dev eth1 root handle 1: htb r2q 485 default 1
DEBUG/QoS: tc class replace dev eth1 parent 1: classid 1:1 htb rate 777000000
DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:1 htb rate 333000000 burst 15k quantum 1514 prio 20
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:1 sfq
{'bandwidth': '777mbit',
 'default': {'bandwidth': '333mbit',
             'burst': '15k',
             'codel_quantum': '1514',
             'flows': '1024',
             'interval': '100',
             'priority': '20',
             'queue_type': 'fq-codel',
             'target': '5'}}
[edit]
vyos@vyos# tc qdisc show dev eth1
qdisc htb 1: root refcnt 2 r2q 485 default 0x1 direct_packets_stat 0 direct_qlen 1000
qdisc sfq 8001: parent 1:1 limit 127p quantum 1514b depth 127 divisor 1024
[edit]

Expected behavior (needed variation: with part of T5295 reverted + with classes)

vyos@vyos# set qos policy shaper TEST class 88 bandwidth 88mbit
[edit]
vyos@vyos# commit
DEBUG/QoS: tc qdisc replace dev eth1 root handle 1: htb r2q 485 default 59
DEBUG/QoS: tc class replace dev eth1 parent 1: classid 1:1 htb rate 777000000
DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:58 htb rate 88000000 burst 15k quantum 1514
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:58 sfq
DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:59 htb rate 333000000 burst 15k quantum 1514 prio 20
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:59 sfq
{'bandwidth': '777mbit',
 'class': {'88': {'bandwidth': '88mbit',
                  'burst': '15k',
                  'codel_quantum': '1514',
                  'flows': '1024',
                  'interval': '100',
                  'queue_type': 'fq-codel',
                  'target': '5'}},
 'default': {'bandwidth': '333mbit',
             'burst': '15k',
             'codel_quantum': '1514',
             'flows': '1024',
             'interval': '100',
             'priority': '20',
             'queue_type': 'fq-codel',
             'target': '5'}}
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:58 fq_codel quantum 1514 flows 1024 interval 100 interval 100 target 5
DEBUG/QoS: tc filter replace dev eth1 parent 1: protocol all basic flowid 1:58
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:59 fq_codel quantum 1514 flows 1024 interval 100 interval 100 target 5
[edit]
vyos@vyos# tc qdisc show dev eth1
qdisc htb 1: root refcnt 2 r2q 485 default 0x59 direct_packets_stat 0 direct_qlen 1000
qdisc fq_codel 8005: parent 1:59 limit 10240p flows 1024 quantum 1514 target 4us interval 99us memory_limit 32Mb ecn drop_batch 64
qdisc fq_codel 8004: parent 1:58 limit 10240p flows 1024 quantum 1514 target 4us interval 99us memory_limit 32Mb ecn drop_batch 64
[edit]

Details

Difficulty level
Easy (less than an hour)
Version
1.4-rolling-202306210317
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

JonSanMan renamed this task from Default qos classes are not configured with correct qdisc to QOS Default classes are not configured with correct qdisc.Jul 5 2023, 2:55 PM
JonSanMan raised the priority of this task from Low to Requires assessment.

In preparing/testing a revised pull-request to fix a merge conflict, with version 1.4-rolling-202307050317, the testing commands need to be slightly modified.

In order to test basic shaper policies with classes a match rule must be created for the class, otherwise python throws an UnboundLocalError.
It doesn't make sense to have a class without a match in the first place, so some guardrails should be put up to prevent that error, but that's a different issue for a different time.