diff options
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r-- | net/sched/sch_htb.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 15ccd7f8fb2a..87b02ed3d5f2 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -600,6 +600,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
600 | htb_activate(q, cl); | 600 | htb_activate(q, cl); |
601 | } | 601 | } |
602 | 602 | ||
603 | qdisc_qstats_backlog_inc(sch, skb); | ||
603 | sch->q.qlen++; | 604 | sch->q.qlen++; |
604 | return NET_XMIT_SUCCESS; | 605 | return NET_XMIT_SUCCESS; |
605 | } | 606 | } |
@@ -889,6 +890,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch) | |||
889 | ok: | 890 | ok: |
890 | qdisc_bstats_update(sch, skb); | 891 | qdisc_bstats_update(sch, skb); |
891 | qdisc_unthrottled(sch); | 892 | qdisc_unthrottled(sch); |
893 | qdisc_qstats_backlog_dec(sch, skb); | ||
892 | sch->q.qlen--; | 894 | sch->q.qlen--; |
893 | return skb; | 895 | return skb; |
894 | } | 896 | } |
@@ -955,6 +957,7 @@ static unsigned int htb_drop(struct Qdisc *sch) | |||
955 | unsigned int len; | 957 | unsigned int len; |
956 | if (cl->un.leaf.q->ops->drop && | 958 | if (cl->un.leaf.q->ops->drop && |
957 | (len = cl->un.leaf.q->ops->drop(cl->un.leaf.q))) { | 959 | (len = cl->un.leaf.q->ops->drop(cl->un.leaf.q))) { |
960 | sch->qstats.backlog -= len; | ||
958 | sch->q.qlen--; | 961 | sch->q.qlen--; |
959 | if (!cl->un.leaf.q->q.qlen) | 962 | if (!cl->un.leaf.q->q.qlen) |
960 | htb_deactivate(q, cl); | 963 | htb_deactivate(q, cl); |
@@ -984,12 +987,12 @@ static void htb_reset(struct Qdisc *sch) | |||
984 | } | 987 | } |
985 | cl->prio_activity = 0; | 988 | cl->prio_activity = 0; |
986 | cl->cmode = HTB_CAN_SEND; | 989 | cl->cmode = HTB_CAN_SEND; |
987 | |||
988 | } | 990 | } |
989 | } | 991 | } |
990 | qdisc_watchdog_cancel(&q->watchdog); | 992 | qdisc_watchdog_cancel(&q->watchdog); |
991 | __skb_queue_purge(&q->direct_queue); | 993 | __skb_queue_purge(&q->direct_queue); |
992 | sch->q.qlen = 0; | 994 | sch->q.qlen = 0; |
995 | sch->qstats.backlog = 0; | ||
993 | memset(q->hlevel, 0, sizeof(q->hlevel)); | 996 | memset(q->hlevel, 0, sizeof(q->hlevel)); |
994 | memset(q->row_mask, 0, sizeof(q->row_mask)); | 997 | memset(q->row_mask, 0, sizeof(q->row_mask)); |
995 | for (i = 0; i < TC_HTB_NUMPRIO; i++) | 998 | for (i = 0; i < TC_HTB_NUMPRIO; i++) |
@@ -1163,14 +1166,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, | |||
1163 | cl->common.classid)) == NULL) | 1166 | cl->common.classid)) == NULL) |
1164 | return -ENOBUFS; | 1167 | return -ENOBUFS; |
1165 | 1168 | ||
1166 | sch_tree_lock(sch); | 1169 | *old = qdisc_replace(sch, new, &cl->un.leaf.q); |
1167 | *old = cl->un.leaf.q; | ||
1168 | cl->un.leaf.q = new; | ||
1169 | if (*old != NULL) { | ||
1170 | qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); | ||
1171 | qdisc_reset(*old); | ||
1172 | } | ||
1173 | sch_tree_unlock(sch); | ||
1174 | return 0; | 1170 | return 0; |
1175 | } | 1171 | } |
1176 | 1172 | ||
@@ -1272,7 +1268,6 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg) | |||
1272 | { | 1268 | { |
1273 | struct htb_sched *q = qdisc_priv(sch); | 1269 | struct htb_sched *q = qdisc_priv(sch); |
1274 | struct htb_class *cl = (struct htb_class *)arg; | 1270 | struct htb_class *cl = (struct htb_class *)arg; |
1275 | unsigned int qlen; | ||
1276 | struct Qdisc *new_q = NULL; | 1271 | struct Qdisc *new_q = NULL; |
1277 | int last_child = 0; | 1272 | int last_child = 0; |
1278 | 1273 | ||
@@ -1292,9 +1287,11 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg) | |||
1292 | sch_tree_lock(sch); | 1287 | sch_tree_lock(sch); |
1293 | 1288 | ||
1294 | if (!cl->level) { | 1289 | if (!cl->level) { |
1295 | qlen = cl->un.leaf.q->q.qlen; | 1290 | unsigned int qlen = cl->un.leaf.q->q.qlen; |
1291 | unsigned int backlog = cl->un.leaf.q->qstats.backlog; | ||
1292 | |||
1296 | qdisc_reset(cl->un.leaf.q); | 1293 | qdisc_reset(cl->un.leaf.q); |
1297 | qdisc_tree_decrease_qlen(cl->un.leaf.q, qlen); | 1294 | qdisc_tree_reduce_backlog(cl->un.leaf.q, qlen, backlog); |
1298 | } | 1295 | } |
1299 | 1296 | ||
1300 | /* delete from hash and active; remainder in destroy_class */ | 1297 | /* delete from hash and active; remainder in destroy_class */ |
@@ -1428,10 +1425,11 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1428 | sch_tree_lock(sch); | 1425 | sch_tree_lock(sch); |
1429 | if (parent && !parent->level) { | 1426 | if (parent && !parent->level) { |
1430 | unsigned int qlen = parent->un.leaf.q->q.qlen; | 1427 | unsigned int qlen = parent->un.leaf.q->q.qlen; |
1428 | unsigned int backlog = parent->un.leaf.q->qstats.backlog; | ||
1431 | 1429 | ||
1432 | /* turn parent into inner node */ | 1430 | /* turn parent into inner node */ |
1433 | qdisc_reset(parent->un.leaf.q); | 1431 | qdisc_reset(parent->un.leaf.q); |
1434 | qdisc_tree_decrease_qlen(parent->un.leaf.q, qlen); | 1432 | qdisc_tree_reduce_backlog(parent->un.leaf.q, qlen, backlog); |
1435 | qdisc_destroy(parent->un.leaf.q); | 1433 | qdisc_destroy(parent->un.leaf.q); |
1436 | if (parent->prio_activity) | 1434 | if (parent->prio_activity) |
1437 | htb_deactivate(q, parent); | 1435 | htb_deactivate(q, parent); |