-
Notifications
You must be signed in to change notification settings - Fork 752
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
Add support for TCA_HTB_DIRECT_QLEN in HTB qdisc #963
Conversation
bc-lee
commented
Apr 1, 2024
- Extend Htb struct in qdisc.go to include DirectQlen field
- Implement the DirectQlen option in qdisc_linux.go
- Modify TestHtbAddDel test to validate DirectQlen changes
qdisc.go
Outdated
@@ -133,6 +134,7 @@ func NewHtb(attrs QdiscAttrs) *Htb { | |||
Rate2Quantum: 10, | |||
Debug: 0, | |||
DirectPkts: 0, | |||
DirectQlen: 0xFFFFFFFF, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume 0
is a valid value for DirectQlen
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume
0
is a valid value forDirectQlen
?
Yes, 0 is a valid value for DirectQlen
. Also, 0xFFFFFFFF(=4294967295) is a valid value for DirectQlen
as well. (Although tc
command doesn't allow to set direct_qlen
to 4294967295)
# Create a qdisc
$ tc qdisc add dev enp6s0 root handle 1:0 htb
# Create a class
$ tc class add dev enp6s0 parent 1:0 classid 1:1 htb rate 1000mbit ceil 1000mbit
# Create a qdisc
$ tc qdisc add dev enp6s0 parent 1:1 handle 10:0 htb default 30 direct_qlen 4294967295
# Describe the qdisc
$ tc qdisc show dev enp6s0
qdisc htb 1: root refcnt 2 r2q 10 default 0 direct_packets_stat 226 direct_qlen 1000
qdisc htb 10: parent 1:1 r2q 10 default 0x30 direct_packets_stat 0 direct_qlen 1000
Check the last line of the output. The direct_qlen
is set to 1000, not 4294967295.
However, after testing, TCA_HTB_DIRECT_QLEN
itself doesn't have a restriction on the value of direct_qlen
. So, I modified the patch to allow any value for direct_qlen
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. All fields you mentioned are in tc_htb_glob struct, so we have to set them all.
LGTM |
@bc-lee please squash the two commits into one |
- Extend Htb struct in qdisc.go to include DirectQlen field - Implement the DirectQlen option in qdisc_linux.go - Modify TestHtbAddDel test to validate DirectQlen changes
Done. |