diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2008-07-20 03:08:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-20 03:08:27 -0400 |
commit | 0abf77e55a2459aa9905be4b226e4729d5b4f0cb (patch) | |
tree | 0224961150c0c2c65b5ad407b1af8cf84266e919 /net/sched/sch_cbq.c | |
parent | 5f86173bdf15981ca49d0434f638b68f70a35644 (diff) |
net_sched: Add accessor function for packet length for qdiscs
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_cbq.c')
-rw-r--r-- | net/sched/sch_cbq.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 1afe3eece627..f1d2f8ec8b4c 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -370,7 +370,6 @@ static int | |||
370 | cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | 370 | cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
371 | { | 371 | { |
372 | struct cbq_sched_data *q = qdisc_priv(sch); | 372 | struct cbq_sched_data *q = qdisc_priv(sch); |
373 | int len = skb->len; | ||
374 | int uninitialized_var(ret); | 373 | int uninitialized_var(ret); |
375 | struct cbq_class *cl = cbq_classify(skb, sch, &ret); | 374 | struct cbq_class *cl = cbq_classify(skb, sch, &ret); |
376 | 375 | ||
@@ -391,7 +390,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
391 | if (ret == NET_XMIT_SUCCESS) { | 390 | if (ret == NET_XMIT_SUCCESS) { |
392 | sch->q.qlen++; | 391 | sch->q.qlen++; |
393 | sch->bstats.packets++; | 392 | sch->bstats.packets++; |
394 | sch->bstats.bytes+=len; | 393 | sch->bstats.bytes += qdisc_pkt_len(skb); |
395 | cbq_mark_toplevel(q, cl); | 394 | cbq_mark_toplevel(q, cl); |
396 | if (!cl->next_alive) | 395 | if (!cl->next_alive) |
397 | cbq_activate_class(cl); | 396 | cbq_activate_class(cl); |
@@ -658,7 +657,6 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer) | |||
658 | #ifdef CONFIG_NET_CLS_ACT | 657 | #ifdef CONFIG_NET_CLS_ACT |
659 | static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) | 658 | static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) |
660 | { | 659 | { |
661 | int len = skb->len; | ||
662 | struct Qdisc *sch = child->__parent; | 660 | struct Qdisc *sch = child->__parent; |
663 | struct cbq_sched_data *q = qdisc_priv(sch); | 661 | struct cbq_sched_data *q = qdisc_priv(sch); |
664 | struct cbq_class *cl = q->rx_class; | 662 | struct cbq_class *cl = q->rx_class; |
@@ -675,7 +673,7 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) | |||
675 | if (qdisc_enqueue(skb, cl->q) == 0) { | 673 | if (qdisc_enqueue(skb, cl->q) == 0) { |
676 | sch->q.qlen++; | 674 | sch->q.qlen++; |
677 | sch->bstats.packets++; | 675 | sch->bstats.packets++; |
678 | sch->bstats.bytes+=len; | 676 | sch->bstats.bytes += qdisc_pkt_len(skb); |
679 | if (!cl->next_alive) | 677 | if (!cl->next_alive) |
680 | cbq_activate_class(cl); | 678 | cbq_activate_class(cl); |
681 | return 0; | 679 | return 0; |
@@ -881,7 +879,7 @@ cbq_dequeue_prio(struct Qdisc *sch, int prio) | |||
881 | if (skb == NULL) | 879 | if (skb == NULL) |
882 | goto skip_class; | 880 | goto skip_class; |
883 | 881 | ||
884 | cl->deficit -= skb->len; | 882 | cl->deficit -= qdisc_pkt_len(skb); |
885 | q->tx_class = cl; | 883 | q->tx_class = cl; |
886 | q->tx_borrowed = borrow; | 884 | q->tx_borrowed = borrow; |
887 | if (borrow != cl) { | 885 | if (borrow != cl) { |
@@ -889,11 +887,11 @@ cbq_dequeue_prio(struct Qdisc *sch, int prio) | |||
889 | borrow->xstats.borrows++; | 887 | borrow->xstats.borrows++; |
890 | cl->xstats.borrows++; | 888 | cl->xstats.borrows++; |
891 | #else | 889 | #else |
892 | borrow->xstats.borrows += skb->len; | 890 | borrow->xstats.borrows += qdisc_pkt_len(skb); |
893 | cl->xstats.borrows += skb->len; | 891 | cl->xstats.borrows += qdisc_pkt_len(skb); |
894 | #endif | 892 | #endif |
895 | } | 893 | } |
896 | q->tx_len = skb->len; | 894 | q->tx_len = qdisc_pkt_len(skb); |
897 | 895 | ||
898 | if (cl->deficit <= 0) { | 896 | if (cl->deficit <= 0) { |
899 | q->active[prio] = cl; | 897 | q->active[prio] = cl; |