Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T5295: QoS fix policy limiter tc filter rate limit #2065

Merged
merged 2 commits into from
Jul 1, 2023

Conversation

sever-sever
Copy link
Member

@sever-sever sever-sever commented Jul 1, 2023

Change Summary

  1. tc filter rate limit should be used only if qostype is limiter and not shaper
  2. Fix QoS tc class with multiple matches generates one rule but expects multiple filter rules:

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Component(s) name

qos, limiter

Proposed changes

How to test

VyOS configuration:

set qos interface eth0 ingress '300m-in'
set qos policy limiter 300m-in default bandwidth '300mbit'
set qos policy limiter 300m-in default burst '125000000b'
commit

Before fix

vyos@r14# commit
[ qos ]
DEBUG/QoS: tc qdisc add dev eth0 handle ffff: ingress
{'default': {'bandwidth': '300mbit',
             'burst': '125000000b',
             'exceed': 'drop',
             'not_exceed': 'ok'}}

[edit]
vyos@r14# 

After fix:

vyos@r14# commit
[ qos ]
DEBUG/QoS: tc qdisc add dev eth0 handle ffff: ingress
{'default': {'bandwidth': '300mbit',
             'burst': '125000000b',
             'exceed': 'drop',
             'not_exceed': 'ok'}}
DEBUG/QoS: tc filter replace dev eth0 parent ffff: prio 255 protocol all basic action police conform-exceed drop/ok rate 300000000 burst 125000000b

[edit]
vyos@r14# 

Expected 300 mbit

vyos@r14# sudo iperf3 -c 192.168.122.11 -R 
Connecting to host 192.168.122.11, port 5201
Reverse mode, remote host 192.168.122.11 is sending
[  5] local 192.168.122.14 port 45878 connected to 192.168.122.11 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   150 MBytes  1.26 Gbits/sec                  
[  5]   1.00-2.00   sec  34.5 MBytes   290 Mbits/sec                  
[  5]   2.00-3.00   sec  34.3 MBytes   288 Mbits/sec                  
[  5]   3.00-4.00   sec  34.7 MBytes   291 Mbits/sec                  
[  5]   4.00-5.00   sec  34.5 MBytes   290 Mbits/sec                  
[  5]   5.00-6.00   sec  34.5 MBytes   290 Mbits/sec                  
[  5]   6.00-7.00   sec  34.5 MBytes   290 Mbits/sec                  
[  5]   7.00-8.00   sec  34.5 MBytes   290 Mbits/sec                  
[  5]   8.00-9.00   sec  34.5 MBytes   289 Mbits/sec                  
[  5]   9.00-10.00  sec  34.6 MBytes   290 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.04  sec   465 MBytes   389 Mbits/sec  46377             sender
[  5]   0.00-10.00  sec   460 MBytes   386 Mbits/sec                  receiver

iperf Done.
[edit]
vyos@r14# 

the second fix for multiple matches:
VyOS config

set qos interface eth0 egress 'test'
set qos policy shaper test bandwidth '300mbit'
set qos policy shaper test class 23 bandwidth '150mbit'
set qos policy shaper test class 23 match one ip protocol 'tcp'
set qos policy shaper test class 23 match two ip protocol 'udp'
set qos policy shaper test default bandwidth '20mbit'
set qos policy shaper test default queue-type 'fair-queue'
commit

Before fix generates filter rules in one line that is incorrect:

DEBUG/QoS: tc qdisc replace dev eth0 root handle 1: htb r2q 187 default 18
DEBUG/QoS: tc class replace dev eth0 parent 1: classid 1:1 htb rate 300000000
DEBUG/QoS: tc class replace dev eth0 parent 1:1 classid 1:17 htb rate 150000000 burst 15k quantum 1514
DEBUG/QoS: tc qdisc replace dev eth0 parent 1:17 sfq
DEBUG/QoS: tc class replace dev eth0 parent 1:1 classid 1:18 htb rate 20000000 burst 15k quantum 1514 prio 20
DEBUG/QoS: tc qdisc replace dev eth0 parent 1:18 sfq
DEBUG/QoS: tc qdisc replace dev eth0 parent 1:17 fq_codel quantum 1514 flows 1024 interval 100 interval 100 target 5 noecn
DEBUG/QoS: tc filter replace dev eth0 parent 1: protocol all u32 match ip protocol 6 0xff u32 match ip protocol 17 0xff flowid 1:17

  File "/usr/lib/python3/dist-packages/vyos/util.py", line 161, in cmd
    raise OSError(code, feedback)
PermissionError: [Errno 1] failed to run command: tc filter replace dev eth0 parent 1: protocol all u32 match ip protocol 6 0xff u32 match ip protocol 17 0xff flowid 1:17
returned: 
exit code: 1

After fix:

DEBUG/QoS: tc qdisc replace dev eth0 root handle 1: htb r2q 187 default 18
DEBUG/QoS: tc class replace dev eth0 parent 1: classid 1:1 htb rate 300000000
DEBUG/QoS: tc class replace dev eth0 parent 1:1 classid 1:17 htb rate 150000000 burst 15k quantum 1514
DEBUG/QoS: tc qdisc replace dev eth0 parent 1:17 sfq
DEBUG/QoS: tc class replace dev eth0 parent 1:1 classid 1:18 htb rate 20000000 burst 15k quantum 1514 prio 20
DEBUG/QoS: tc qdisc replace dev eth0 parent 1:18 sfq
DEBUG/QoS: tc qdisc replace dev eth0 parent 1:17 fq_codel quantum 1514 flows 1024 interval 100 interval 100 target 5 noecn
DEBUG/QoS: tc filter add dev eth0 parent 1: protocol all prio 1 u32 match ip protocol 6 0xff flowid 1:17
DEBUG/QoS: tc filter add dev eth0 parent 1: protocol all prio 2 u32 match ip protocol 17 0xff flowid 1:17

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

tc filter rate limit should be used only if qostype is 'limiter'
and not 'shaper'
@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro and c-po and removed request for a team July 1, 2023 12:46
@sever-sever sever-sever marked this pull request as draft July 1, 2023 16:06
Fix QoS tc class with multiple matches generates one rule but
expects multiple filter rules:

set qos policy shaper test class 23 match one ip protocol 'tcp'
set qos policy shaper test class 23 match two ip protocol 'udp'

tc filter add dev eth0 parent 1: protocol all prio 1 u32 match ip protocol 6 0xff flowid 1:17
tc filter add dev eth0 parent 1: protocol all prio 2 u32 match ip protocol 17 0xff flowid 1:17
@sever-sever sever-sever marked this pull request as ready for review July 1, 2023 17:38
@vyosbot vyosbot requested a review from a team July 1, 2023 17:38
@c-po c-po merged commit 9c4c2f4 into vyos:current Jul 1, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants