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

Add support for TCA_HTB_DIRECT_QLEN in HTB qdisc #963

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

bc-lee
Copy link
Contributor

@bc-lee 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,
Copy link
Collaborator

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 ?

Copy link
Contributor Author

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 ?

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this would be the first optional HTB field, I just to make sure, existing fields are all mandatory?

image

Copy link
Contributor Author

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.

@bc-lee bc-lee requested a review from aboch April 12, 2024 19:59
@aboch
Copy link
Collaborator

aboch commented Jul 3, 2024

LGTM

@aboch
Copy link
Collaborator

aboch commented Jul 3, 2024

@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
@bc-lee
Copy link
Contributor Author

bc-lee commented Jul 3, 2024

@bc-lee please squash the two commits into one

Done.

@aboch aboch merged commit a1c5e02 into vishvananda:main Jul 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants