From: "Sergey V. Lobanov" <sergey@lobanov.in>
To: netdev@vger.kernel.org
Cc: "Sergey V. Lobanov" <sergey@lobanov.in>
Subject: [PATCH iproute2] Fixed 'tc qdisc show' for tbf when latency<0
Date: Sun, 11 May 2014 03:01:14 +0400 [thread overview]
Message-ID: <1399762874-17902-1-git-send-email-sergey@lobanov.in> (raw)
When limit<burst latency becomes <0, for example:
# tc qdisc add dev eth0 root handle 1: tbf limit 100K burst 256K rate 256kbit
# tc qdisc show
qdisc tbf 1: dev eth0 root refcnt 2 rate 256Kbit burst 256Kb lat 4290.0s
If latency<0 there is no reason to show it. Limit will be printed instead of
latency when latency<0:
# tc qdisc show
qdisc tbf 1: dev eth0 root refcnt 2 rate 256Kbit burst 256Kb limit 100Kb
Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
---
tc/q_tbf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index f3022b6..2d56331 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -302,16 +302,16 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
}
}
- if (show_raw)
- fprintf(f, "limit %s ", sprint_size(qopt->limit, b1));
-
latency = TIME_UNITS_PER_SEC*(qopt->limit/(double)rate64) - tc_core_tick2time(qopt->buffer);
if (prate64) {
double lat2 = TIME_UNITS_PER_SEC*(qopt->limit/(double)prate64) - tc_core_tick2time(qopt->mtu);
if (lat2 > latency)
latency = lat2;
}
- fprintf(f, "lat %s ", sprint_time(latency, b1));
+ if (latency >= 0.0)
+ fprintf(f, "lat %s ", sprint_time(latency, b1));
+ if (show_raw || latency < 0.0)
+ fprintf(f, "limit %s ", sprint_size(qopt->limit, b1));
if (qopt->rate.overhead) {
fprintf(f, "overhead %d", qopt->rate.overhead);
--
1.9.1
reply other threads:[~2014-05-10 23:02 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=1399762874-17902-1-git-send-email-sergey@lobanov.in \
--to=sergey@lobanov.in \
--cc=netdev@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 NNTP newsgroup(s).