aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-11-29 20:35:18 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:31:41 -0500
commit9f9afec48221fe4a19f84a9341f5b304bf7d7783 (patch)
tree26a906902a7af4a835d59d452f567ca641fa1917 /net
parent814a175e7b1531a4bcaa63be47bf58cacdcb5010 (diff)
[NET_SCHED]: Set parent classid in default qdiscs
Set parent classids in default qdiscs to allow walking up the tree from outside the qdiscs. This is needed by the next patch. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/sch_atm.c5
-rw-r--r--net/sched/sch_cbq.c8
-rw-r--r--net/sched/sch_dsmark.c5
-rw-r--r--net/sched/sch_generic.c7
-rw-r--r--net/sched/sch_hfsc.c8
-rw-r--r--net/sched/sch_htb.c7
-rw-r--r--net/sched/sch_netem.c3
-rw-r--r--net/sched/sch_prio.c3
-rw-r--r--net/sched/sch_red.c8
-rw-r--r--net/sched/sch_tbf.c8
10 files changed, 39 insertions, 23 deletions
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index dbf44da0912f..edc7bb0b9c8b 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -316,7 +316,7 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
316 } 316 }
317 memset(flow,0,sizeof(*flow)); 317 memset(flow,0,sizeof(*flow));
318 flow->filter_list = NULL; 318 flow->filter_list = NULL;
319 if (!(flow->q = qdisc_create_dflt(sch->dev,&pfifo_qdisc_ops))) 319 if (!(flow->q = qdisc_create_dflt(sch->dev,&pfifo_qdisc_ops,classid)))
320 flow->q = &noop_qdisc; 320 flow->q = &noop_qdisc;
321 DPRINTK("atm_tc_change: qdisc %p\n",flow->q); 321 DPRINTK("atm_tc_change: qdisc %p\n",flow->q);
322 flow->sock = sock; 322 flow->sock = sock;
@@ -576,7 +576,8 @@ static int atm_tc_init(struct Qdisc *sch,struct rtattr *opt)
576 576
577 DPRINTK("atm_tc_init(sch %p,[qdisc %p],opt %p)\n",sch,p,opt); 577 DPRINTK("atm_tc_init(sch %p,[qdisc %p],opt %p)\n",sch,p,opt);
578 p->flows = &p->link; 578 p->flows = &p->link;
579 if(!(p->link.q = qdisc_create_dflt(sch->dev,&pfifo_qdisc_ops))) 579 if(!(p->link.q = qdisc_create_dflt(sch->dev,&pfifo_qdisc_ops,
580 sch->handle)))
580 p->link.q = &noop_qdisc; 581 p->link.q = &noop_qdisc;
581 DPRINTK("atm_tc_init: link (%p) qdisc %p\n",&p->link,p->link.q); 582 DPRINTK("atm_tc_init: link (%p) qdisc %p\n",&p->link,p->link.q);
582 p->link.filter_list = NULL; 583 p->link.filter_list = NULL;
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index bac881bfe362..908b10d0d61f 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1429,7 +1429,8 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt)
1429 q->link.sibling = &q->link; 1429 q->link.sibling = &q->link;
1430 q->link.classid = sch->handle; 1430 q->link.classid = sch->handle;
1431 q->link.qdisc = sch; 1431 q->link.qdisc = sch;
1432 if (!(q->link.q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops))) 1432 if (!(q->link.q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
1433 sch->handle)))
1433 q->link.q = &noop_qdisc; 1434 q->link.q = &noop_qdisc;
1434 1435
1435 q->link.priority = TC_CBQ_MAXPRIO-1; 1436 q->link.priority = TC_CBQ_MAXPRIO-1;
@@ -1674,7 +1675,8 @@ static int cbq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1674 1675
1675 if (cl) { 1676 if (cl) {
1676 if (new == NULL) { 1677 if (new == NULL) {
1677 if ((new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops)) == NULL) 1678 if ((new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
1679 cl->classid)) == NULL)
1678 return -ENOBUFS; 1680 return -ENOBUFS;
1679 } else { 1681 } else {
1680#ifdef CONFIG_NET_CLS_POLICE 1682#ifdef CONFIG_NET_CLS_POLICE
@@ -1932,7 +1934,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t
1932 cl->R_tab = rtab; 1934 cl->R_tab = rtab;
1933 rtab = NULL; 1935 rtab = NULL;
1934 cl->refcnt = 1; 1936 cl->refcnt = 1;
1935 if (!(cl->q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops))) 1937 if (!(cl->q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, classid)))
1936 cl->q = &noop_qdisc; 1938 cl->q = &noop_qdisc;
1937 cl->classid = classid; 1939 cl->classid = classid;
1938 cl->tparent = parent; 1940 cl->tparent = parent;
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index 0b7c0e82d600..afedd92b7496 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -88,7 +88,8 @@ static int dsmark_graft(struct Qdisc *sch, unsigned long arg,
88 sch, p, new, old); 88 sch, p, new, old);
89 89
90 if (new == NULL) { 90 if (new == NULL) {
91 new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); 91 new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
92 sch->handle);
92 if (new == NULL) 93 if (new == NULL)
93 new = &noop_qdisc; 94 new = &noop_qdisc;
94 } 95 }
@@ -387,7 +388,7 @@ static int dsmark_init(struct Qdisc *sch, struct rtattr *opt)
387 p->default_index = default_index; 388 p->default_index = default_index;
388 p->set_tc_index = RTA_GET_FLAG(tb[TCA_DSMARK_SET_TC_INDEX-1]); 389 p->set_tc_index = RTA_GET_FLAG(tb[TCA_DSMARK_SET_TC_INDEX-1]);
389 390
390 p->q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); 391 p->q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, sch->handle);
391 if (p->q == NULL) 392 if (p->q == NULL)
392 p->q = &noop_qdisc; 393 p->q = &noop_qdisc;
393 394
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 88c6a99ce53c..deafeb9cb70e 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -450,13 +450,15 @@ errout:
450 return ERR_PTR(-err); 450 return ERR_PTR(-err);
451} 451}
452 452
453struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops) 453struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops,
454 unsigned int parentid)
454{ 455{
455 struct Qdisc *sch; 456 struct Qdisc *sch;
456 457
457 sch = qdisc_alloc(dev, ops); 458 sch = qdisc_alloc(dev, ops);
458 if (IS_ERR(sch)) 459 if (IS_ERR(sch))
459 goto errout; 460 goto errout;
461 sch->parent = parentid;
460 462
461 if (!ops->init || ops->init(sch, NULL) == 0) 463 if (!ops->init || ops->init(sch, NULL) == 0)
462 return sch; 464 return sch;
@@ -520,7 +522,8 @@ void dev_activate(struct net_device *dev)
520 if (dev->qdisc_sleeping == &noop_qdisc) { 522 if (dev->qdisc_sleeping == &noop_qdisc) {
521 struct Qdisc *qdisc; 523 struct Qdisc *qdisc;
522 if (dev->tx_queue_len) { 524 if (dev->tx_queue_len) {
523 qdisc = qdisc_create_dflt(dev, &pfifo_fast_ops); 525 qdisc = qdisc_create_dflt(dev, &pfifo_fast_ops,
526 TC_H_ROOT);
524 if (qdisc == NULL) { 527 if (qdisc == NULL) {
525 printk(KERN_INFO "%s: activation failed\n", dev->name); 528 printk(KERN_INFO "%s: activation failed\n", dev->name);
526 return; 529 return;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 6a6735a2ed35..1142d298ecf6 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1138,7 +1138,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
1138 cl->classid = classid; 1138 cl->classid = classid;
1139 cl->sched = q; 1139 cl->sched = q;
1140 cl->cl_parent = parent; 1140 cl->cl_parent = parent;
1141 cl->qdisc = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); 1141 cl->qdisc = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, classid);
1142 if (cl->qdisc == NULL) 1142 if (cl->qdisc == NULL)
1143 cl->qdisc = &noop_qdisc; 1143 cl->qdisc = &noop_qdisc;
1144 cl->stats_lock = &sch->dev->queue_lock; 1144 cl->stats_lock = &sch->dev->queue_lock;
@@ -1271,7 +1271,8 @@ hfsc_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1271 if (cl->level > 0) 1271 if (cl->level > 0)
1272 return -EINVAL; 1272 return -EINVAL;
1273 if (new == NULL) { 1273 if (new == NULL) {
1274 new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); 1274 new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
1275 cl->classid);
1275 if (new == NULL) 1276 if (new == NULL)
1276 new = &noop_qdisc; 1277 new = &noop_qdisc;
1277 } 1278 }
@@ -1514,7 +1515,8 @@ hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt)
1514 q->root.refcnt = 1; 1515 q->root.refcnt = 1;
1515 q->root.classid = sch->handle; 1516 q->root.classid = sch->handle;
1516 q->root.sched = q; 1517 q->root.sched = q;
1517 q->root.qdisc = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); 1518 q->root.qdisc = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
1519 sch->handle);
1518 if (q->root.qdisc == NULL) 1520 if (q->root.qdisc == NULL)
1519 q->root.qdisc = &noop_qdisc; 1521 q->root.qdisc = &noop_qdisc;
1520 q->root.stats_lock = &sch->dev->queue_lock; 1522 q->root.stats_lock = &sch->dev->queue_lock;
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 08fa4d083615..3b36e9d60c20 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1223,8 +1223,9 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1223 struct htb_class *cl = (struct htb_class *)arg; 1223 struct htb_class *cl = (struct htb_class *)arg;
1224 1224
1225 if (cl && !cl->level) { 1225 if (cl && !cl->level) {
1226 if (new == NULL && (new = qdisc_create_dflt(sch->dev, 1226 if (new == NULL &&
1227 &pfifo_qdisc_ops)) 1227 (new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
1228 cl->classid))
1228 == NULL) 1229 == NULL)
1229 return -ENOBUFS; 1230 return -ENOBUFS;
1230 sch_tree_lock(sch); 1231 sch_tree_lock(sch);
@@ -1415,7 +1416,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1415 /* create leaf qdisc early because it uses kmalloc(GFP_KERNEL) 1416 /* create leaf qdisc early because it uses kmalloc(GFP_KERNEL)
1416 so that can't be used inside of sch_tree_lock 1417 so that can't be used inside of sch_tree_lock
1417 -- thanks to Karlis Peisenieks */ 1418 -- thanks to Karlis Peisenieks */
1418 new_q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); 1419 new_q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, classid);
1419 sch_tree_lock(sch); 1420 sch_tree_lock(sch);
1420 if (parent && !parent->level) { 1421 if (parent && !parent->level) {
1421 /* turn parent into inner node */ 1422 /* turn parent into inner node */
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 0441876aa1e7..90aeeb7b7167 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -574,7 +574,8 @@ static int netem_init(struct Qdisc *sch, struct rtattr *opt)
574 q->timer.function = netem_watchdog; 574 q->timer.function = netem_watchdog;
575 q->timer.data = (unsigned long) sch; 575 q->timer.data = (unsigned long) sch;
576 576
577 q->qdisc = qdisc_create_dflt(sch->dev, &tfifo_qdisc_ops); 577 q->qdisc = qdisc_create_dflt(sch->dev, &tfifo_qdisc_ops,
578 TC_H_MAKE(sch->handle, 1));
578 if (!q->qdisc) { 579 if (!q->qdisc) {
579 pr_debug("netem: qdisc create failed\n"); 580 pr_debug("netem: qdisc create failed\n");
580 return -ENOMEM; 581 return -ENOMEM;
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index a5fa03c0c19b..3fc0c0fa5bcc 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -230,7 +230,8 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
230 for (i=0; i<q->bands; i++) { 230 for (i=0; i<q->bands; i++) {
231 if (q->queues[i] == &noop_qdisc) { 231 if (q->queues[i] == &noop_qdisc) {
232 struct Qdisc *child; 232 struct Qdisc *child;
233 child = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops); 233 child = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops,
234 TC_H_MAKE(sch->handle, i + 1));
234 if (child) { 235 if (child) {
235 sch_tree_lock(sch); 236 sch_tree_lock(sch);
236 child = xchg(&q->queues[i], child); 237 child = xchg(&q->queues[i], child);
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index d65cadddea69..ee66c5ca80c6 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -175,12 +175,14 @@ static void red_destroy(struct Qdisc *sch)
175 qdisc_destroy(q->qdisc); 175 qdisc_destroy(q->qdisc);
176} 176}
177 177
178static struct Qdisc *red_create_dflt(struct net_device *dev, u32 limit) 178static struct Qdisc *red_create_dflt(struct Qdisc *sch, u32 limit)
179{ 179{
180 struct Qdisc *q = qdisc_create_dflt(dev, &bfifo_qdisc_ops); 180 struct Qdisc *q;
181 struct rtattr *rta; 181 struct rtattr *rta;
182 int ret; 182 int ret;
183 183
184 q = qdisc_create_dflt(sch->dev, &bfifo_qdisc_ops,
185 TC_H_MAKE(sch->handle, 1));
184 if (q) { 186 if (q) {
185 rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), 187 rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)),
186 GFP_KERNEL); 188 GFP_KERNEL);
@@ -219,7 +221,7 @@ static int red_change(struct Qdisc *sch, struct rtattr *opt)
219 ctl = RTA_DATA(tb[TCA_RED_PARMS-1]); 221 ctl = RTA_DATA(tb[TCA_RED_PARMS-1]);
220 222
221 if (ctl->limit > 0) { 223 if (ctl->limit > 0) {
222 child = red_create_dflt(sch->dev, ctl->limit); 224 child = red_create_dflt(sch, ctl->limit);
223 if (child == NULL) 225 if (child == NULL)
224 return -ENOMEM; 226 return -ENOMEM;
225 } 227 }
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index d9a5d298d755..2562a6040b76 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -273,12 +273,14 @@ static void tbf_reset(struct Qdisc* sch)
273 del_timer(&q->wd_timer); 273 del_timer(&q->wd_timer);
274} 274}
275 275
276static struct Qdisc *tbf_create_dflt_qdisc(struct net_device *dev, u32 limit) 276static struct Qdisc *tbf_create_dflt_qdisc(struct Qdisc *sch, u32 limit)
277{ 277{
278 struct Qdisc *q = qdisc_create_dflt(dev, &bfifo_qdisc_ops); 278 struct Qdisc *q;
279 struct rtattr *rta; 279 struct rtattr *rta;
280 int ret; 280 int ret;
281 281
282 q = qdisc_create_dflt(sch->dev, &bfifo_qdisc_ops,
283 TC_H_MAKE(sch->handle, 1));
282 if (q) { 284 if (q) {
283 rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL); 285 rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
284 if (rta) { 286 if (rta) {
@@ -341,7 +343,7 @@ static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
341 goto done; 343 goto done;
342 344
343 if (qopt->limit > 0) { 345 if (qopt->limit > 0) {
344 if ((child = tbf_create_dflt_qdisc(sch->dev, qopt->limit)) == NULL) 346 if ((child = tbf_create_dflt_qdisc(sch, qopt->limit)) == NULL)
345 goto done; 347 goto done;
346 } 348 }
347 349