q_cake: Fix incorrect printing of signed values in class statistics
The deficit returned from the kernel is signed, but was printed with a %u
specifier in the format string, leading to negative values to be printed as
high unsigned values instead. In addition, we passed a negative value to
sprint_time() even though that expects an unsigned value. Fix this by
changing the format specifier and reversing the sign of negative time
values.
Fixes: 714444c0cb ("Add support for CAKE qdisc")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
9f366536ed
commit
60204c81e4
|
|
@ -675,7 +675,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
|
||||||
|
|
||||||
/* class stats */
|
/* class stats */
|
||||||
if (st[TCA_CAKE_STATS_DEFICIT])
|
if (st[TCA_CAKE_STATS_DEFICIT])
|
||||||
print_int(PRINT_ANY, "deficit", " deficit %u",
|
print_int(PRINT_ANY, "deficit", " deficit %d",
|
||||||
GET_STAT_S32(DEFICIT));
|
GET_STAT_S32(DEFICIT));
|
||||||
if (st[TCA_CAKE_STATS_COBALT_COUNT])
|
if (st[TCA_CAKE_STATS_COBALT_COUNT])
|
||||||
print_uint(PRINT_ANY, "count", " count %u",
|
print_uint(PRINT_ANY, "count", " count %u",
|
||||||
|
|
@ -688,7 +688,7 @@ static int cake_print_xstats(struct qdisc_util *qu, FILE *f,
|
||||||
|
|
||||||
if (drop_next < 0) {
|
if (drop_next < 0) {
|
||||||
print_string(PRINT_FP, NULL, " drop_next -%s",
|
print_string(PRINT_FP, NULL, " drop_next -%s",
|
||||||
sprint_time(drop_next, b1));
|
sprint_time(-drop_next, b1));
|
||||||
} else {
|
} else {
|
||||||
print_uint(PRINT_JSON, "drop_next", NULL,
|
print_uint(PRINT_JSON, "drop_next", NULL,
|
||||||
drop_next);
|
drop_next);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue