netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc
@ 2007-07-24 22:33 PJ Waskiewicz
  2007-07-24 22:33 ` [PATCH 1/2] NET: Fix sch_api to properly set sch->parent on " PJ Waskiewicz
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: PJ Waskiewicz @ 2007-07-24 22:33 UTC (permalink / raw)
  To: davem; +Cc: netdev, kaber

This is a patch from Patrick McHardy to fix the sch_api code, which I
went ahead and tested and made a slight fix to.  This also includes
the fix to sch_prio based on Patrick's patch.

The sch->parent handle should contain the parent qdisc ID.  When the
qdisc is the root qdisc (TC_H_ROOT), the parent handle should be the
value TC_H_ROOT.  This fixes sch_api to set this correctly on
qdisc_create() for both ingress and egress qdiscs.

Change this check in prio_tune() so that only the root qdisc can be
multiqueue-enabled; use sch->parent instead of sch->handle.

-- 
PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] NET: Fix sch_api to properly set sch->parent on the root qdisc
  2007-07-24 22:33 [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc PJ Waskiewicz
@ 2007-07-24 22:33 ` PJ Waskiewicz
  2007-07-24 22:33 ` [PATCH 2/2] NET: Fix sch_prio to properly detect the root qdisc on multiqueue PJ Waskiewicz
  2007-07-25  0:35 ` [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc Patrick McHardy
  2 siblings, 0 replies; 7+ messages in thread
From: PJ Waskiewicz @ 2007-07-24 22:33 UTC (permalink / raw)
  To: davem; +Cc: netdev, kaber

From: Patrick McHardy <kaber@trash.net>

Fix sch_api to correctly set sch->parent for both ingress and egress
qdiscs in qdisc_create().

Signed-off-by: Patrick McHardy <trash@kaber.net>
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
---

 net/sched/sch_api.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 13c09bc..dee0d5f 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -380,6 +380,10 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
 		return;
 	while ((parentid = sch->parent)) {
 		sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid));
+		if (sch == NULL) {
+			WARN_ON(parentid != TC_H_ROOT);
+			return;
+		}
 		cops = sch->ops->cl_ops;
 		if (cops->qlen_notify) {
 			cl = cops->get(sch, parentid);
@@ -420,8 +424,6 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
 			unsigned long cl = cops->get(parent, classid);
 			if (cl) {
 				err = cops->graft(parent, cl, new, old);
-				if (new)
-					new->parent = classid;
 				cops->put(parent, cl);
 			}
 		}
@@ -436,7 +438,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
  */
 
 static struct Qdisc *
-qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
+qdisc_create(struct net_device *dev, u32 parent, u32 handle,
+	   struct rtattr **tca, int *errp)
 {
 	int err;
 	struct rtattr *kind = tca[TCA_KIND-1];
@@ -482,6 +485,8 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
 		goto err_out2;
 	}
 
+	sch->parent = parent;
+
 	if (handle == TC_H_INGRESS) {
 		sch->flags |= TCQ_F_INGRESS;
 		sch->stats_lock = &dev->ingress_lock;
@@ -758,9 +763,11 @@ create_n_graft:
 	if (!(n->nlmsg_flags&NLM_F_CREATE))
 		return -ENOENT;
 	if (clid == TC_H_INGRESS)
-		q = qdisc_create(dev, tcm->tcm_parent, tca, &err);
+		q = qdisc_create(dev, tcm->tcm_parent, tcm->tcm_parent,
+				 tca, &err);
 	else
-		q = qdisc_create(dev, tcm->tcm_handle, tca, &err);
+		q = qdisc_create(dev, tcm->tcm_parent, tcm->tcm_handle,
+				 tca, &err);
 	if (q == NULL) {
 		if (err == -EAGAIN)
 			goto replay;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] NET: Fix sch_prio to properly detect the root qdisc on multiqueue
  2007-07-24 22:33 [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc PJ Waskiewicz
  2007-07-24 22:33 ` [PATCH 1/2] NET: Fix sch_api to properly set sch->parent on " PJ Waskiewicz
@ 2007-07-24 22:33 ` PJ Waskiewicz
  2007-07-25  0:35 ` [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc Patrick McHardy
  2 siblings, 0 replies; 7+ messages in thread
From: PJ Waskiewicz @ 2007-07-24 22:33 UTC (permalink / raw)
  To: davem; +Cc: netdev, kaber

Fix the check in prio_tune() to see if sch->parent is TC_H_ROOT instead of
sch->handle to load or reject the qdisc for multiqueue devices.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
---

 net/sched/sch_prio.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 2d8c084..06441db 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -239,11 +239,13 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
 	/* If we're multiqueue, make sure the number of incoming bands
 	 * matches the number of queues on the device we're associating with.
 	 * If the number of bands requested is zero, then set q->bands to
-	 * dev->egress_subqueue_count.
+	 * dev->egress_subqueue_count.  Also, the root qdisc must be the
+	 * only one that is enabled for multiqueue, since it's the only one
+	 * that interacts with the underlying device.
 	 */
 	q->mq = RTA_GET_FLAG(tb[TCA_PRIO_MQ - 1]);
 	if (q->mq) {
-		if (sch->handle != TC_H_ROOT)
+		if (sch->parent != TC_H_ROOT)
 			return -EINVAL;
 		if (netif_is_multiqueue(sch->dev)) {
 			if (q->bands == 0)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc
  2007-07-24 22:33 [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc PJ Waskiewicz
  2007-07-24 22:33 ` [PATCH 1/2] NET: Fix sch_api to properly set sch->parent on " PJ Waskiewicz
  2007-07-24 22:33 ` [PATCH 2/2] NET: Fix sch_prio to properly detect the root qdisc on multiqueue PJ Waskiewicz
@ 2007-07-25  0:35 ` Patrick McHardy
  2007-07-27 16:22   ` Waskiewicz Jr, Peter P
  2 siblings, 1 reply; 7+ messages in thread
From: Patrick McHardy @ 2007-07-25  0:35 UTC (permalink / raw)
  To: PJ Waskiewicz; +Cc: davem, netdev

PJ Waskiewicz wrote:
> This is a patch from Patrick McHardy to fix the sch_api code, which I
> went ahead and tested and made a slight fix to.  This also includes
> the fix to sch_prio based on Patrick's patch.
> 
> The sch->parent handle should contain the parent qdisc ID.  When the
> qdisc is the root qdisc (TC_H_ROOT), the parent handle should be the
> value TC_H_ROOT.  This fixes sch_api to set this correctly on
> qdisc_create() for both ingress and egress qdiscs.
> 
> Change this check in prio_tune() so that only the root qdisc can be
> multiqueue-enabled; use sch->parent instead of sch->handle.

Both look good, thanks.

Acked-by: Patrick McHardy <kaber@trash.net>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc
  2007-07-25  0:35 ` [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc Patrick McHardy
@ 2007-07-27 16:22   ` Waskiewicz Jr, Peter P
  2007-07-31  0:14     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Waskiewicz Jr, Peter P @ 2007-07-27 16:22 UTC (permalink / raw)
  To: davem; +Cc: netdev, Patrick McHardy

> From: Patrick McHardy [mailto:kaber@trash.net] 
> Sent: Tuesday, July 24, 2007 5:36 PM
> To: Waskiewicz Jr, Peter P
> Cc: davem@davemloft.net; netdev@vger.kernel.org
> Subject: Re: [FIX] NET: Fix sch_api and sch_prio to properly 
> set and detect the root qdisc
>
[...]
> Both look good, thanks.
> 
> Acked-by: Patrick McHardy <kaber@trash.net>
> 

Dave,
	Are these queued for 2.6.24, or are they going to make it into
2.6.23?  I know you're busy with patches and NAPI, but I was curious.
Thanks!

Cheers,

-PJ Waskiewicz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc
  2007-07-27 16:22   ` Waskiewicz Jr, Peter P
@ 2007-07-31  0:14     ` David Miller
  2007-07-31  0:14       ` Waskiewicz Jr, Peter P
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2007-07-31  0:14 UTC (permalink / raw)
  To: peter.p.waskiewicz.jr; +Cc: netdev, kaber

From: "Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>
Date: Fri, 27 Jul 2007 09:22:11 -0700

> 	Are these queued for 2.6.24, or are they going to make it into
> 2.6.23?  I know you're busy with patches and NAPI, but I was
> curious.  Thanks!

I've applied both fixes and will push them into 2.6.23

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc
  2007-07-31  0:14     ` David Miller
@ 2007-07-31  0:14       ` Waskiewicz Jr, Peter P
  0 siblings, 0 replies; 7+ messages in thread
From: Waskiewicz Jr, Peter P @ 2007-07-31  0:14 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, kaber

> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net] 
> Sent: Monday, July 30, 2007 5:14 PM
> To: Waskiewicz Jr, Peter P
> Cc: netdev@vger.kernel.org; kaber@trash.net
> Subject: Re: [FIX] NET: Fix sch_api and sch_prio to properly 
> set and detect the root qdisc
> 
> From: "Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>
> Date: Fri, 27 Jul 2007 09:22:11 -0700
> 
> > 	Are these queued for 2.6.24, or are they going to make it into 
> > 2.6.23?  I know you're busy with patches and NAPI, but I 
> was curious.  
> > Thanks!
> 
> I've applied both fixes and will push them into 2.6.23


Many thanks Dave!

Cheers,
-PJ

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-07-31  0:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 22:33 [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc PJ Waskiewicz
2007-07-24 22:33 ` [PATCH 1/2] NET: Fix sch_api to properly set sch->parent on " PJ Waskiewicz
2007-07-24 22:33 ` [PATCH 2/2] NET: Fix sch_prio to properly detect the root qdisc on multiqueue PJ Waskiewicz
2007-07-25  0:35 ` [FIX] NET: Fix sch_api and sch_prio to properly set and detect the root qdisc Patrick McHardy
2007-07-27 16:22   ` Waskiewicz Jr, Peter P
2007-07-31  0:14     ` David Miller
2007-07-31  0:14       ` Waskiewicz Jr, Peter P

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).