aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@o2.pl>2006-12-08 03:25:55 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-08 20:19:31 -0500
commita37ef2e3258d65e43ec876233bba0b288a9d3260 (patch)
tree121a4bfc31c94c5f1c09d964247f37112b4c3017
parent93366c537b3426261cac4db27acc10a99cd91b06 (diff)
[NET_SCHED] sch_cbq: deactivating when grafting, purging etc.
- deactivating of active classes when q.qlen drops to zero (cbq_drop) - a redundant instruction removed from cbq_deactivate_class PS: probably htb_deactivate in htb_delete and cbq_deactivate_class in cbq_delete are also redundant now. Signed-off-by: Jarek Poplawski <jarkao2@o2.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/sch_cbq.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index ba82dfab6043..f79a4f3d0a95 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -371,8 +371,6 @@ static void cbq_deactivate_class(struct cbq_class *this)
371 return; 371 return;
372 } 372 }
373 } 373 }
374
375 cl = cl_prev->next_alive;
376 return; 374 return;
377 } 375 }
378 } while ((cl_prev = cl) != q->active[prio]); 376 } while ((cl_prev = cl) != q->active[prio]);
@@ -1258,6 +1256,8 @@ static unsigned int cbq_drop(struct Qdisc* sch)
1258 do { 1256 do {
1259 if (cl->q->ops->drop && (len = cl->q->ops->drop(cl->q))) { 1257 if (cl->q->ops->drop && (len = cl->q->ops->drop(cl->q))) {
1260 sch->q.qlen--; 1258 sch->q.qlen--;
1259 if (!cl->q->q.qlen)
1260 cbq_deactivate_class(cl);
1261 return len; 1261 return len;
1262 } 1262 }
1263 } while ((cl = cl->next_alive) != cl_head); 1263 } while ((cl = cl->next_alive) != cl_head);
@@ -1685,8 +1685,7 @@ static int cbq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1685#endif 1685#endif
1686 } 1686 }
1687 sch_tree_lock(sch); 1687 sch_tree_lock(sch);
1688 *old = cl->q; 1688 *old = xchg(&cl->q, new);
1689 cl->q = new;
1690 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); 1689 qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
1691 qdisc_reset(*old); 1690 qdisc_reset(*old);
1692 sch_tree_unlock(sch); 1691 sch_tree_unlock(sch);
@@ -1704,6 +1703,14 @@ cbq_leaf(struct Qdisc *sch, unsigned long arg)
1704 return cl ? cl->q : NULL; 1703 return cl ? cl->q : NULL;
1705} 1704}
1706 1705
1706static void cbq_qlen_notify(struct Qdisc *sch, unsigned long arg)
1707{
1708 struct cbq_class *cl = (struct cbq_class *)arg;
1709
1710 if (cl->q->q.qlen == 0)
1711 cbq_deactivate_class(cl);
1712}
1713
1707static unsigned long cbq_get(struct Qdisc *sch, u32 classid) 1714static unsigned long cbq_get(struct Qdisc *sch, u32 classid)
1708{ 1715{
1709 struct cbq_sched_data *q = qdisc_priv(sch); 1716 struct cbq_sched_data *q = qdisc_priv(sch);
@@ -1988,12 +1995,17 @@ static int cbq_delete(struct Qdisc *sch, unsigned long arg)
1988{ 1995{
1989 struct cbq_sched_data *q = qdisc_priv(sch); 1996 struct cbq_sched_data *q = qdisc_priv(sch);
1990 struct cbq_class *cl = (struct cbq_class*)arg; 1997 struct cbq_class *cl = (struct cbq_class*)arg;
1998 unsigned int qlen;
1991 1999
1992 if (cl->filters || cl->children || cl == &q->link) 2000 if (cl->filters || cl->children || cl == &q->link)
1993 return -EBUSY; 2001 return -EBUSY;
1994 2002
1995 sch_tree_lock(sch); 2003 sch_tree_lock(sch);
1996 2004
2005 qlen = cl->q->q.qlen;
2006 qdisc_reset(cl->q);
2007 qdisc_tree_decrease_qlen(cl->q, qlen);
2008
1997 if (cl->next_alive) 2009 if (cl->next_alive)
1998 cbq_deactivate_class(cl); 2010 cbq_deactivate_class(cl);
1999 2011
@@ -2084,6 +2096,7 @@ static void cbq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
2084static struct Qdisc_class_ops cbq_class_ops = { 2096static struct Qdisc_class_ops cbq_class_ops = {
2085 .graft = cbq_graft, 2097 .graft = cbq_graft,
2086 .leaf = cbq_leaf, 2098 .leaf = cbq_leaf,
2099 .qlen_notify = cbq_qlen_notify,
2087 .get = cbq_get, 2100 .get = cbq_get,
2088 .put = cbq_put, 2101 .put = cbq_put,
2089 .change = cbq_change_class, 2102 .change = cbq_change_class,