Skip to content

Commit

Permalink
Fixed version of class stats
Browse files Browse the repository at this point in the history
  • Loading branch information
tohojo committed Jul 14, 2018
1 parent be1c549 commit aad5436
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions sch_cake.c
Original file line number Diff line number Diff line change
Expand Up @@ -2999,17 +2999,18 @@ static int cake_dump_class_stats(struct Qdisc *sch, unsigned long cl,
struct gnet_dump *d)
{
struct cake_sched_data *q = qdisc_priv(sch);
const struct cake_tin_data *b = NULL;
const struct cake_flow *flow = NULL;
struct gnet_stats_queue qs = { 0 };
struct nlattr *stats;
u32 idx = cl - 1;

if (idx < CAKE_QUEUES * q->tin_cnt) {
b = &q->tins[q->tin_order[idx / CAKE_QUEUES]];
flow = &b->flows[idx % CAKE_QUEUES];
const struct cake_tin_data *b = \
&q->tins[q->tin_order[idx / CAKE_QUEUES]];
const struct sk_buff *skb;

flow = &b->flows[idx % CAKE_QUEUES];

if (flow->head) {
sch_tree_lock(sch);
skb = flow->head;
Expand All @@ -3024,7 +3025,6 @@ static int cake_dump_class_stats(struct Qdisc *sch, unsigned long cl,
}
if (gnet_stats_copy_queue(d, NULL, &qs, qs.qlen) < 0)
return -1;

if (flow) {
ktime_t now = ktime_get();

Expand All @@ -3046,17 +3046,18 @@ static int cake_dump_class_stats(struct Qdisc *sch, unsigned long cl,
PUT_STAT_U32(COBALT_COUNT, flow->cvars.count);
PUT_STAT_U32(P_DROP, flow->cvars.p_drop);
if (flow->cvars.p_drop) {
PUT_STATS_S32(BLUE_TIMER_US,
ktime_to_us(
ktime_sub(now,
flow->cvars.blue_timer)));
PUT_STAT_S32(BLUE_TIMER_US,
ktime_to_us(
ktime_sub(now,
flow->cvars.blue_timer)));
}
if (flow->cvars.dropping) {
PUT_STATS_S32(DROP_NEXT_US,
ktime_to_us(
ktime_sub(now,
flow->cvars.drop_next)));
PUT_STAT_S32(DROP_NEXT_US,
ktime_to_us(
ktime_sub(now,
flow->cvars.drop_next)));
}

if (nla_nest_end(d->skb, stats) < 0)
return -1;
}
Expand Down

0 comments on commit aad5436

Please sign in to comment.