From: Jarek Poplawski <jarkao2@gmail•com>
To: David Miller <davem@davemloft•net>
Cc: Patrick McHardy <kaber@trash•net>, netdev@vger•kernel.org
Subject: [PATCH] pkt_sched: Fix tx queue selection in tc_modify_qdisc
Date: Mon, 14 Sep 2009 12:22:26 +0000 [thread overview]
Message-ID: <20090914122226.GA14087@ff.dom.local> (raw)
After the recent mq change there is the new select_queue qdisc class
method used in tc_modify_qdisc, but it works OK only for direct child
qdiscs of mq qdisc. Grandchildren always get the first tx queue, which
would give wrong qdisc_root etc. results (e.g. for sch_htb as child of
sch_prio). This patch fixes it by using parent's dev_queue for such
grandchildren qdiscs. The select_queue method is replaced BTW with the
static qdisc_select_tx_queue function (it's used only in one place).
Signed-off-by: Jarek Poplawski <jarkao2@gmail•com>
---
include/net/sch_generic.h | 1 -
net/sched/sch_api.c | 29 +++++++++++++++++++++--------
net/sched/sch_mq.c | 10 ----------
3 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 88eb9de..865120c 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -81,7 +81,6 @@ struct Qdisc
struct Qdisc_class_ops
{
/* Child qdisc manipulation */
- unsigned int (*select_queue)(struct Qdisc *, struct tcmsg *);
int (*graft)(struct Qdisc *, unsigned long cl,
struct Qdisc *, struct Qdisc **);
struct Qdisc * (*leaf)(struct Qdisc *, unsigned long cl);
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 3af1061..223a6bc 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -990,6 +990,24 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
return 0;
}
+static struct netdev_queue *qdisc_select_tx_queue(struct net_device *dev,
+ struct Qdisc *p, u32 clid)
+{
+ unsigned long ntx;
+
+ if (!p)
+ return netdev_get_tx_queue(dev, 0);
+
+ if (!(p->flags & TCQ_F_MQROOT))
+ return p->dev_queue;
+
+ ntx = TC_H_MIN(clid) - 1;
+ if (ntx >= dev->num_tx_queues)
+ ntx = 0;
+
+ return netdev_get_tx_queue(dev, ntx);
+}
+
/*
Create/change qdisc.
*/
@@ -1110,16 +1128,11 @@ create_n_graft:
q = qdisc_create(dev, &dev->rx_queue, p,
tcm->tcm_parent, tcm->tcm_parent,
tca, &err);
- else {
- unsigned int ntx = 0;
-
- if (p && p->ops->cl_ops && p->ops->cl_ops->select_queue)
- ntx = p->ops->cl_ops->select_queue(p, tcm);
-
- q = qdisc_create(dev, netdev_get_tx_queue(dev, ntx), p,
+ else
+ q = qdisc_create(dev, qdisc_select_tx_queue(dev, p, clid), p,
tcm->tcm_parent, tcm->tcm_handle,
tca, &err);
- }
+
if (q == NULL) {
if (err == -EAGAIN)
goto replay;
diff --git a/net/sched/sch_mq.c b/net/sched/sch_mq.c
index dd5ee02..4ad949b 100644
--- a/net/sched/sch_mq.c
+++ b/net/sched/sch_mq.c
@@ -125,15 +125,6 @@ static struct netdev_queue *mq_queue_get(struct Qdisc *sch, unsigned long cl)
return netdev_get_tx_queue(dev, ntx);
}
-static unsigned int mq_select_queue(struct Qdisc *sch, struct tcmsg *tcm)
-{
- unsigned int ntx = TC_H_MIN(tcm->tcm_parent);
-
- if (!mq_queue_get(sch, ntx))
- return 0;
- return ntx - 1;
-}
-
static int mq_graft(struct Qdisc *sch, unsigned long cl, struct Qdisc *new,
struct Qdisc **old)
{
@@ -213,7 +204,6 @@ static void mq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
}
static const struct Qdisc_class_ops mq_class_ops = {
- .select_queue = mq_select_queue,
.graft = mq_graft,
.leaf = mq_leaf,
.get = mq_get,
next reply other threads:[~2009-09-14 12:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-14 12:22 Jarek Poplawski [this message]
2009-09-14 18:05 ` [PATCH] pkt_sched: Fix tx queue selection in tc_modify_qdisc Patrick McHardy
2009-09-14 19:03 ` Jarek Poplawski
2009-09-14 22:50 ` [PATCH v2] " Jarek Poplawski
2009-09-15 9:53 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090914122226.GA14087@ff.dom.local \
--to=jarkao2@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=kaber@trash$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox