From: David Ward <david.ward@ll.mit.edu>
To: netdev@vger.kernel.org
Cc: David Ward <david.ward@ll.mit.edu>
Subject: [PATCH iproute2 07/10] tc: gred: Improve parameter/statistics output
Date: Mon, 18 May 2015 11:35:11 -0400 [thread overview]
Message-ID: <1431963314-56420-8-git-send-email-david.ward@ll.mit.edu> (raw)
In-Reply-To: <1431963314-56420-1-git-send-email-david.ward@ll.mit.edu>
Make the output more consistent with the RED qdisc, and only show
details/statistics if the appropriate flag is set when calling tc.
Show the parameters used with "gred setup". Add missing statistics
"pdrop" and "other". Fix format specifiers for unsigned values.
Signed-off-by: David Ward <david.ward@ll.mit.edu>
---
tc/q_gred.c | 63 +++++++++++++++++++++++++++++++++-------------------------
1 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/tc/q_gred.c b/tc/q_gred.c
index 65caeee..d3e5ec7 100644
--- a/tc/q_gred.c
+++ b/tc/q_gred.c
@@ -265,14 +265,13 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n
static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
{
struct rtattr *tb[TCA_GRED_MAX + 1];
+ struct tc_gred_sopt *sopt;
struct tc_gred_qopt *qopt;
__u32 *max_p = NULL;
- int i;
+ unsigned i;
SPRINT_BUF(b1);
SPRINT_BUF(b2);
SPRINT_BUF(b3);
- SPRINT_BUF(b4);
- SPRINT_BUF(b5);
if (opt == NULL)
return 0;
@@ -286,40 +285,50 @@ static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
RTA_PAYLOAD(tb[TCA_GRED_MAX_P]) >= sizeof(__u32) * MAX_DPs)
max_p = RTA_DATA(tb[TCA_GRED_MAX_P]);
+ sopt = RTA_DATA(tb[TCA_GRED_DPS]);
qopt = RTA_DATA(tb[TCA_GRED_PARMS]);
- if (RTA_PAYLOAD(tb[TCA_GRED_PARMS]) < sizeof(*qopt)*MAX_DPs) {
+ if (RTA_PAYLOAD(tb[TCA_GRED_DPS]) < sizeof(*sopt) ||
+ RTA_PAYLOAD(tb[TCA_GRED_PARMS]) < sizeof(*qopt)*MAX_DPs) {
fprintf(f,"\n GRED received message smaller than expected\n");
return -1;
- }
+ }
/* Bad hack! should really return a proper message as shown above*/
+ fprintf(f, "DPs %u default %u %s",
+ sopt->DPs,
+ sopt->def_DP,
+ sopt->grio ? "grio " : "");
+
for (i=0;i<MAX_DPs;i++, qopt++) {
if (qopt->DP >= MAX_DPs) continue;
- fprintf(f, "\n DP:%d (prio %d) Average Queue %s Measured "
- "Queue %s ",
+ fprintf(f, "\n DP %u prio %hhu limit %s min %s max %s ",
qopt->DP,
qopt->prio,
- sprint_size(qopt->qave, b4),
- sprint_size(qopt->backlog, b5));
- fprintf(f, "\n\t Packet drops: %d (forced %d early %d) ",
- qopt->forced+qopt->early,
- qopt->forced,
- qopt->early);
- fprintf(f, "\n\t Packet totals: %u (bytes %u) ",
- qopt->packets,
- qopt->bytesin);
- if (show_details)
- fprintf(f, "\n limit %s min %s max %s ",
- sprint_size(qopt->limit, b1),
- sprint_size(qopt->qth_min, b2),
- sprint_size(qopt->qth_max, b3));
- fprintf(f, "ewma %u ", qopt->Wlog);
- if (max_p)
- fprintf(f, "probability %lg ", max_p[i] / pow(2, 32));
- else
- fprintf(f, "Plog %u ", qopt->Plog);
- fprintf(f, "Scell_log %u", qopt->Scell_log);
+ sprint_size(qopt->limit, b1),
+ sprint_size(qopt->qth_min, b2),
+ sprint_size(qopt->qth_max, b3));
+ if (show_details) {
+ fprintf(f, "ewma %u ", qopt->Wlog);
+ if (max_p)
+ fprintf(f, "probability %lg ", max_p[i] / pow(2, 32));
+ else
+ fprintf(f, "Plog %u ", qopt->Plog);
+ fprintf(f, "Scell_log %u ", qopt->Scell_log);
+ }
+ if (show_stats) {
+ fprintf(f, "\n Queue size: average %s current %s ",
+ sprint_size(qopt->qave, b1),
+ sprint_size(qopt->backlog, b2));
+ fprintf(f, "\n Dropped packets: forced %u early %u pdrop %u other %u ",
+ qopt->forced,
+ qopt->early,
+ qopt->pdrop,
+ qopt->other);
+ fprintf(f, "\n Total packets: %u (%s) ",
+ qopt->packets,
+ sprint_size(qopt->bytesin, b1));
+ }
}
return 0;
}
--
1.7.1
next prev parent reply other threads:[~2015-05-18 15:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-18 15:35 [PATCH iproute2 00/10] RED and GRED fixes, plus TCA_GRED_LIMIT support David Ward
2015-05-18 15:35 ` [PATCH iproute2 01/10] tc: red, gred: Rename overloaded variable wlog David Ward
2015-05-21 21:29 ` Stephen Hemminger
2015-05-18 15:35 ` [PATCH iproute2 02/10] tc: red, gred: Fix format specifier in burst size warning David Ward
2015-05-18 15:35 ` [PATCH iproute2 03/10] tc: red, gred: Notify when using the default value for "bandwidth" David Ward
2015-05-18 15:35 ` [PATCH iproute2 04/10] tc: red: Mark "bandwidth" parameter as optional in usage text David Ward
2015-05-18 15:35 ` [PATCH iproute2 05/10] tc: gred: Fix whitespace issues in code David Ward
2015-05-18 15:35 ` [PATCH iproute2 06/10] tc: gred: Print usage text if no arguments appear after "gred" David Ward
2015-05-18 15:35 ` David Ward [this message]
2015-05-18 15:35 ` [PATCH iproute2 08/10] tc: gred: Handle unsigned values properly in option parsing/printing David Ward
2015-05-18 15:35 ` [PATCH iproute2 09/10] tc: gred: Adopt the term VQ in the command syntax and output David Ward
2015-05-18 15:35 ` [PATCH iproute2/net-next] tc: gred: Add support for TCA_GRED_LIMIT attribute David Ward
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=1431963314-56420-8-git-send-email-david.ward@ll.mit.edu \
--to=david.ward@ll.mit.edu \
--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).