Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eric Dumazet and committed by
David S. Miller
2dd875ff a6700db1

+6 -6
+2 -2
net/sched/sch_atm.c
··· 423 423 } 424 424 return ret; 425 425 } 426 - qdisc_bstats_update(sch, skb); 427 - bstats_update(&flow->bstats, skb); 428 426 /* 429 427 * Okay, this may seem weird. We pretend we've dropped the packet if 430 428 * it goes via ATM. The reason for this is that the outer qdisc ··· 470 472 if (unlikely(!skb)) 471 473 break; 472 474 475 + qdisc_bstats_update(sch, skb); 476 + bstats_update(&flow->bstats, skb); 473 477 pr_debug("atm_tc_dequeue: sending on class %p\n", flow); 474 478 /* remove any LL header somebody else has attached */ 475 479 skb_pull(skb, skb_network_offset(skb));
+2 -2
net/sched/sch_drr.c
··· 376 376 cl->deficit = cl->quantum; 377 377 } 378 378 379 - bstats_update(&cl->bstats, skb); 380 - 381 379 sch->q.qlen++; 382 380 return err; 383 381 } ··· 401 403 skb = qdisc_dequeue_peeked(cl->qdisc); 402 404 if (cl->qdisc->q.qlen == 0) 403 405 list_del(&cl->alist); 406 + 407 + bstats_update(&cl->bstats, skb); 404 408 qdisc_bstats_update(sch, skb); 405 409 sch->q.qlen--; 406 410 return skb;
+1 -1
net/sched/sch_hfsc.c
··· 1609 1609 if (cl->qdisc->q.qlen == 1) 1610 1610 set_active(cl, qdisc_pkt_len(skb)); 1611 1611 1612 - bstats_update(&cl->bstats, skb); 1613 1612 sch->q.qlen++; 1614 1613 1615 1614 return NET_XMIT_SUCCESS; ··· 1656 1657 return NULL; 1657 1658 } 1658 1659 1660 + bstats_update(&cl->bstats, skb); 1659 1661 update_vf(cl, qdisc_pkt_len(skb), cur_time); 1660 1662 if (realtime) 1661 1663 cl->cl_cumul += qdisc_pkt_len(skb);
+1 -1
net/sched/sch_htb.c
··· 574 574 } 575 575 return ret; 576 576 } else { 577 - bstats_update(&cl->bstats, skb); 578 577 htb_activate(q, cl); 579 578 } 580 579 ··· 834 835 } while (cl != start); 835 836 836 837 if (likely(skb != NULL)) { 838 + bstats_update(&cl->bstats, skb); 837 839 cl->un.leaf.deficit[level] -= qdisc_pkt_len(skb); 838 840 if (cl->un.leaf.deficit[level] < 0) { 839 841 cl->un.leaf.deficit[level] += cl->quantum;