lartc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: 袁建鹏 <yuanjianpeng@xiaomi.com>
To: lartc <lartc@vger.kernel.org>
Subject: htb use pfifo as leaf qdisc has a burst speed which is double of limit rate
Date: Wed, 5 Jun 2024 07:17:09 +0000	[thread overview]
Message-ID: <0f9c98123fa14979bdc4b6ba7abe37cc@xiaomi.com> (raw)

Hi, lartc gurus

I have a home router, and want to use HTB to limit the upload speed of a user.
I connect my phone to router via wifi, got an ip 192.168.10.28 via DHCP
I limit the upload speed to 500KB/s, here is my config

    # tc qdisc show dev eth0.4
    qdisc htb 1: root refcnt 2 r2q 10 default 0 direct_packets_stat 18 direct_qlen 1000
    qdisc pfifo 11d: parent 1:1d limit 1000p

    # tc class show dev eth0.4
    class htb 1:1d root leaf 11d: prio rate 4Mbit ceil 4Mbit burst 4800b cburst 4800b

    # tc filter show dev eth0.4
    filter parent 1: protocol ip pref 1 flow
    filter parent 1: protocol ip pref 1 flow handle 0x1 map keys nfct-src and 0x000000ff baseclass 1:1

I test upload speed of phone using app, e.g. speedtest5g, or other similar app, the result double the limit.
if I change the leaf qdisc to fq_codel, then the limit is quite accurate.

    # tc qdisc del dev eth0.4 handle 11d: parent 1:1d pfifo
    # tc qdisc add dev eth0.4 handle 11d: parent 1:1d fq_codel

after read lots of documents and source code, I guess the reason:

    qdisc has no traffic shaping when enqueue. so when the queue is empty,
    packets can enqueue without limit, so there's a burst speed,  while speed test app often use the max speed as result.
    if i change the leaf pfifo limit from 1000p to 200p, then the test result is more closing to rate limit, but still bigger than it.

But why fq_codel is accurate?
#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!******/#

                 reply	other threads:[~2024-06-05  7:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f9c98123fa14979bdc4b6ba7abe37cc@xiaomi.com \
    --to=yuanjianpeng@xiaomi.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).