diff options
author | Patrick McHardy <kaber@trash.net> | 2006-11-29 20:35:48 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:31:42 -0500 |
commit | 43effa1e57fc4635e0301b27d78f9d83afe78974 (patch) | |
tree | dc4a22fdaad074a547438050fb428f32b1cb2ded /include/net | |
parent | 9f9afec48221fe4a19f84a9341f5b304bf7d7783 (diff) |
[NET_SCHED]: Fix endless loops caused by inaccurate qlen counters (part 1)
There are multiple problems related to qlen adjustment that can lead
to an upper qdisc getting out of sync with the real number of packets
queued, leading to endless dequeueing attempts by the upper layer code.
All qdiscs must maintain an accurate q.qlen counter. There are basically
two groups of operations affecting the qlen: operations that propagate
down the tree (enqueue, dequeue, requeue, drop, reset) beginning at the
root qdisc and operations only affecting a subtree or single qdisc
(change, graft, delete class). Since qlen changes during operations from
the second group don't propagate to ancestor qdiscs, their qlen values
become desynchronized.
This patch adds a function to propagate qlen changes up the qdisc tree,
optionally calling a callback function to perform qdisc-internal
maintenance when the child qdisc becomes empty. The follow-up patches
will convert all qdiscs to use this function where necessary.
Noticed by Timo Steinbach <tsteinbach@astaro.com>.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/sch_generic.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index b37572db12a..82086392735 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -60,6 +60,7 @@ struct Qdisc_class_ops | |||
60 | int (*graft)(struct Qdisc *, unsigned long cl, | 60 | int (*graft)(struct Qdisc *, unsigned long cl, |
61 | struct Qdisc *, struct Qdisc **); | 61 | struct Qdisc *, struct Qdisc **); |
62 | struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl); | 62 | struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl); |
63 | void (*qlen_notify)(struct Qdisc *, unsigned long); | ||
63 | 64 | ||
64 | /* Class manipulation routines */ | 65 | /* Class manipulation routines */ |
65 | unsigned long (*get)(struct Qdisc *, u32 classid); | 66 | unsigned long (*get)(struct Qdisc *, u32 classid); |
@@ -172,6 +173,7 @@ extern void dev_activate(struct net_device *dev); | |||
172 | extern void dev_deactivate(struct net_device *dev); | 173 | extern void dev_deactivate(struct net_device *dev); |
173 | extern void qdisc_reset(struct Qdisc *qdisc); | 174 | extern void qdisc_reset(struct Qdisc *qdisc); |
174 | extern void qdisc_destroy(struct Qdisc *qdisc); | 175 | extern void qdisc_destroy(struct Qdisc *qdisc); |
176 | extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); | ||
175 | extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); | 177 | extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); |
176 | extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, | 178 | extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, |
177 | struct Qdisc_ops *ops, u32 parentid); | 179 | struct Qdisc_ops *ops, u32 parentid); |