aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-05-10 01:36:34 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-10 23:33:01 -0400
commit2dd875ff31ac7ff42d6fc7d7f78ac6c0635439f5 (patch)
treec75209ccd8374f9695d4ec854d5b4bfb80c5e0dc /net/sched
parenta6700db17980972199e61c06be535a79e1b0b4e6 (diff)
net_sched: update bstats in dequeue()
Class bytes/packets stats can be misleading because they are updated in enqueue() while packet might be dropped later. We already fixed all qdiscs but sch_atm. This patch makes the final cleanup. class rate estimators can now match qdisc ones. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/sch_atm.c4
-rw-r--r--net/sched/sch_drr.c4
-rw-r--r--net/sched/sch_hfsc.c2
-rw-r--r--net/sched/sch_htb.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index a77a4fbc069a..8522a4793374 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -423,8 +423,6 @@ drop: __maybe_unused
423 } 423 }
424 return ret; 424 return ret;
425 } 425 }
426 qdisc_bstats_update(sch, skb);
427 bstats_update(&flow->bstats, skb);
428 /* 426 /*
429 * Okay, this may seem weird. We pretend we've dropped the packet if 427 * Okay, this may seem weird. We pretend we've dropped the packet if
430 * it goes via ATM. The reason for this is that the outer qdisc 428 * it goes via ATM. The reason for this is that the outer qdisc
@@ -472,6 +470,8 @@ static void sch_atm_dequeue(unsigned long data)
472 if (unlikely(!skb)) 470 if (unlikely(!skb))
473 break; 471 break;
474 472
473 qdisc_bstats_update(sch, skb);
474 bstats_update(&flow->bstats, skb);
475 pr_debug("atm_tc_dequeue: sending on class %p\n", flow); 475 pr_debug("atm_tc_dequeue: sending on class %p\n", flow);
476 /* remove any LL header somebody else has attached */ 476 /* remove any LL header somebody else has attached */
477 skb_pull(skb, skb_network_offset(skb)); 477 skb_pull(skb, skb_network_offset(skb));
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index c2189879359b..9ce0b4fe23ff 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -376,8 +376,6 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch)
376 cl->deficit = cl->quantum; 376 cl->deficit = cl->quantum;
377 } 377 }
378 378
379 bstats_update(&cl->bstats, skb);
380
381 sch->q.qlen++; 379 sch->q.qlen++;
382 return err; 380 return err;
383} 381}
@@ -403,6 +401,8 @@ static struct sk_buff *drr_dequeue(struct Qdisc *sch)
403 skb = qdisc_dequeue_peeked(cl->qdisc); 401 skb = qdisc_dequeue_peeked(cl->qdisc);
404 if (cl->qdisc->q.qlen == 0) 402 if (cl->qdisc->q.qlen == 0)
405 list_del(&cl->alist); 403 list_del(&cl->alist);
404
405 bstats_update(&cl->bstats, skb);
406 qdisc_bstats_update(sch, skb); 406 qdisc_bstats_update(sch, skb);
407 sch->q.qlen--; 407 sch->q.qlen--;
408 return skb; 408 return skb;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 8db3e2c72827..6c2ec4510540 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1609,7 +1609,6 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
1609 if (cl->qdisc->q.qlen == 1) 1609 if (cl->qdisc->q.qlen == 1)
1610 set_active(cl, qdisc_pkt_len(skb)); 1610 set_active(cl, qdisc_pkt_len(skb));
1611 1611
1612 bstats_update(&cl->bstats, skb);
1613 sch->q.qlen++; 1612 sch->q.qlen++;
1614 1613
1615 return NET_XMIT_SUCCESS; 1614 return NET_XMIT_SUCCESS;
@@ -1657,6 +1656,7 @@ hfsc_dequeue(struct Qdisc *sch)
1657 return NULL; 1656 return NULL;
1658 } 1657 }
1659 1658
1659 bstats_update(&cl->bstats, skb);
1660 update_vf(cl, qdisc_pkt_len(skb), cur_time); 1660 update_vf(cl, qdisc_pkt_len(skb), cur_time);
1661 if (realtime) 1661 if (realtime)
1662 cl->cl_cumul += qdisc_pkt_len(skb); 1662 cl->cl_cumul += qdisc_pkt_len(skb);
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index acae5b0e3849..9d75b7761313 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -574,7 +574,6 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
574 } 574 }
575 return ret; 575 return ret;
576 } else { 576 } else {
577 bstats_update(&cl->bstats, skb);
578 htb_activate(q, cl); 577 htb_activate(q, cl);
579 } 578 }
580 579
@@ -835,6 +834,7 @@ next:
835 } while (cl != start); 834 } while (cl != start);
836 835
837 if (likely(skb != NULL)) { 836 if (likely(skb != NULL)) {
837 bstats_update(&cl->bstats, skb);
838 cl->un.leaf.deficit[level] -= qdisc_pkt_len(skb); 838 cl->un.leaf.deficit[level] -= qdisc_pkt_len(skb);
839 if (cl->un.leaf.deficit[level] < 0) { 839 if (cl->un.leaf.deficit[level] < 0) {
840 cl->un.leaf.deficit[level] += cl->quantum; 840 cl->un.leaf.deficit[level] += cl->quantum;