Commit 1693a4d3 authored by David Ward's avatar David Ward Committed by Stephen Hemminger

tc: gred: Improve parameter/statistics output

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: default avatarDavid Ward <david.ward@ll.mit.edu>
parent a77905ef
...@@ -265,14 +265,13 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n ...@@ -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) static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
{ {
struct rtattr *tb[TCA_GRED_MAX + 1]; struct rtattr *tb[TCA_GRED_MAX + 1];
struct tc_gred_sopt *sopt;
struct tc_gred_qopt *qopt; struct tc_gred_qopt *qopt;
__u32 *max_p = NULL; __u32 *max_p = NULL;
int i; unsigned i;
SPRINT_BUF(b1); SPRINT_BUF(b1);
SPRINT_BUF(b2); SPRINT_BUF(b2);
SPRINT_BUF(b3); SPRINT_BUF(b3);
SPRINT_BUF(b4);
SPRINT_BUF(b5);
if (opt == NULL) if (opt == NULL)
return 0; return 0;
...@@ -286,40 +285,50 @@ static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ...@@ -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) RTA_PAYLOAD(tb[TCA_GRED_MAX_P]) >= sizeof(__u32) * MAX_DPs)
max_p = RTA_DATA(tb[TCA_GRED_MAX_P]); max_p = RTA_DATA(tb[TCA_GRED_MAX_P]);
sopt = RTA_DATA(tb[TCA_GRED_DPS]);
qopt = RTA_DATA(tb[TCA_GRED_PARMS]); 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"); fprintf(f,"\n GRED received message smaller than expected\n");
return -1; return -1;
} }
/* Bad hack! should really return a proper message as shown above*/ /* 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++) { for (i=0;i<MAX_DPs;i++, qopt++) {
if (qopt->DP >= MAX_DPs) continue; if (qopt->DP >= MAX_DPs) continue;
fprintf(f, "\n DP:%d (prio %d) Average Queue %s Measured " fprintf(f, "\n DP %u prio %hhu limit %s min %s max %s ",
"Queue %s ",
qopt->DP, qopt->DP,
qopt->prio, qopt->prio,
sprint_size(qopt->qave, b4), sprint_size(qopt->limit, b1),
sprint_size(qopt->backlog, b5)); sprint_size(qopt->qth_min, b2),
fprintf(f, "\n\t Packet drops: %d (forced %d early %d) ", sprint_size(qopt->qth_max, b3));
qopt->forced+qopt->early, if (show_details) {
qopt->forced, fprintf(f, "ewma %u ", qopt->Wlog);
qopt->early); if (max_p)
fprintf(f, "\n\t Packet totals: %u (bytes %u) ", fprintf(f, "probability %lg ", max_p[i] / pow(2, 32));
qopt->packets, else
qopt->bytesin); fprintf(f, "Plog %u ", qopt->Plog);
if (show_details) fprintf(f, "Scell_log %u ", qopt->Scell_log);
fprintf(f, "\n limit %s min %s max %s ", }
sprint_size(qopt->limit, b1), if (show_stats) {
sprint_size(qopt->qth_min, b2), fprintf(f, "\n Queue size: average %s current %s ",
sprint_size(qopt->qth_max, b3)); sprint_size(qopt->qave, b1),
fprintf(f, "ewma %u ", qopt->Wlog); sprint_size(qopt->backlog, b2));
if (max_p) fprintf(f, "\n Dropped packets: forced %u early %u pdrop %u other %u ",
fprintf(f, "probability %lg ", max_p[i] / pow(2, 32)); qopt->forced,
else qopt->early,
fprintf(f, "Plog %u ", qopt->Plog); qopt->pdrop,
fprintf(f, "Scell_log %u", qopt->Scell_log); qopt->other);
fprintf(f, "\n Total packets: %u (%s) ",
qopt->packets,
sprint_size(qopt->bytesin, b1));
}
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment