From: John Fastabend <john.r.fastabend@intel.com>
To: Jarek Poplawski <jarkao2@gmail.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"hadi@cyberus.ca" <hadi@cyberus.ca>,
"shemminger@vyatta.com" <shemminger@vyatta.com>,
"tgraf@infradead.org" <tgraf@infradead.org>,
"eric.dumazet@gmail.com" <eric.dumazet@gmail.com>,
"bhutchings@solarflare.com" <bhutchings@solarflare.com>,
"nhorman@tuxdriver.com" <nhorman@tuxdriver.com>
Subject: Re: [net-next-2.6 PATCH v2 3/3] net_sched: implement a root container qdisc sch_mclass
Date: Sun, 02 Jan 2011 21:46:16 -0800 [thread overview]
Message-ID: <4D2162A8.60305@intel.com> (raw)
In-Reply-To: <20101231092543.GA7809@ff.dom.local>
On 12/31/2010 1:25 AM, Jarek Poplawski wrote:
> On 2010-12-21 20:29, John Fastabend wrote:
>> This implements a mclass 'multi-class' queueing discipline that by
>> default creates multiple mq qdisc's one for each traffic class. Each
>> mq qdisc then owns a range of queues per the netdev_tc_txq mappings.
>
> Btw, you could also consider better name (mqprio?) because there're
> many 'multi-class' queueing disciplines around.
>
OK.
>> +static int mclass_parse_opt(struct net_device *dev, struct tc_mclass_qopt *qopt)
>> +{
>> + int i, j;
>> +
>> + /* Verify TC offset and count are sane */
>
> if (qopt->num_tc > TC_MAX_QUEUE) ?
> return -EINVAL;
This would be caught later when netdev_set_num_tc() fails although probably best to catch all failures in this function as early as possible.
>
>> + for (i = 0; i < qopt->num_tc; i++) {
>> + int last = qopt->offset[i] + qopt->count[i];
>> + if (last > dev->num_tx_queues)
>
> if (last >= dev->num_tx_queues) ?
>
>> + return -EINVAL;
>> + for (j = i + 1; j < qopt->num_tc; j++) {
>> + if (last > qopt->offset[j])
>
> if (last >= qopt->offset[j]) ?
I believe the below works as expected. The offset needs to be verified (this I missed) but offset+count can be equal to num_tx_queue indicating the last queue is in use. With 8 tx queues and num_tc=2 a valid configuration is, tc1 offset of 0 and a count of 7 with tc2 offset of 7 and count of 1.
/* Verify num_tc is in max range */
if (qopt->num_tc > TC_MAX_QUEUE)
return -EINVAL;
for (i = 0; i < qopt->num_tc; i++) {
/* Verify the queue offset is in the num tx range */
if (qopt->offset[i] >= dev->num_tx_queues)
return -EINVAL;
/* Verify the queue count is in tx range being equal to the
* num_tx_queues indicates the last queue is in use.
*/
else if (qopt->offset[i] + qopt->count[i] > dev->num_tx_queues)
return -EINVAL;
/* Verify that the offset and counts do not overlap */
for (j = i + 1; j < qopt->num_tc; j++) {
if (last > qopt->offset[j])
return -EINVAL;
}
}
Thanks for the review!
John.
>
> Jarek P.
next prev parent reply other threads:[~2011-01-03 5:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-21 19:28 [net-next-2.6 PATCH v2 1/3] net: implement mechanism for HW based QOS John Fastabend
2010-12-21 19:29 ` [net-next-2.6 PATCH v2 2/3] net_sched: Allow multiple mq qdisc to be used as non-root John Fastabend
2010-12-21 19:29 ` [net-next-2.6 PATCH v2 3/3] net_sched: implement a root container qdisc sch_mclass John Fastabend
2010-12-30 23:37 ` Jarek Poplawski
2010-12-30 23:56 ` Jarek Poplawski
2011-01-03 5:43 ` John Fastabend
2011-01-03 17:02 ` Jarek Poplawski
2011-01-03 20:37 ` John Fastabend
2011-01-03 22:59 ` Jarek Poplawski
2011-01-04 0:18 ` John Fastabend
2011-01-04 2:59 ` John Fastabend
2010-12-31 9:25 ` Jarek Poplawski
2011-01-03 5:46 ` John Fastabend [this message]
2011-01-03 17:04 ` Jarek Poplawski
2010-12-22 9:12 ` [net-next-2.6 PATCH v2 1/3] net: implement mechanism for HW based QOS Johannes Berg
2010-12-23 5:29 ` John Fastabend
2010-12-26 23:47 ` Stephen Hemminger
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=4D2162A8.60305@intel.com \
--to=john.r.fastabend@intel.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=hadi@cyberus.ca \
--cc=jarkao2@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=shemminger@vyatta.com \
--cc=tgraf@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).