From: Andi Kleen <andi@firstfloor.org>
To: Juliusz Chroboczek <jch@pps.jussieu.fr>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] Stochastic Fair Blue queue discipline
Date: Tue, 08 Apr 2008 10:20:34 +0200 [thread overview]
Message-ID: <873apwrc4t.fsf@basil.nowhere.org> (raw)
In-Reply-To: <87skxxb8br.fsf@pirx.pps.jussieu.fr> (Juliusz Chroboczek's message of "Tue, 08 Apr 2008 00:37:12 +0200")
Juliusz Chroboczek <jch@pps.jussieu.fr> writes:
Have not read everything. General comment you'll likely need to
do some code style cleanups (read Documentation/CodingStyle)
Especially indentation should be consistent (one easy way
to get that would be to run it through Lindent, although you
might need to review it afterwards because Lindent sometimes does
weird things)
> +
> +static unsigned sfb_hash(struct sk_buff *skb, int hash, int filter,
> + struct sfb_sched_data *q)
> +{
> + u32 h, h2;
> + u8 hash_type = q->hash_type;
> +
> + switch (skb->protocol) {
> + case __constant_htons(ETH_P_IP):
I think we have multiple qdiscs now doing very similar such hashes.
Any chance this could be factored out into a common library function
first?
The nice property of that is that it would make it much easier
to add new protocols later.
> +static int sfb_enqueue(struct sk_buff *skb, struct Qdisc* sch)
> +{
> +
> + struct sfb_sched_data *q = qdisc_priv(sch);
> + struct Qdisc *child = q->qdisc;
> + psched_time_t now;
> + int filter;
> + u16 minprob = SFB_MAX_PROB;
> + u16 minqlen = (u16)(~0);
> + u32 r;
> + int ret, i;
> +
> + now = psched_get_time();
Getting high res time can be actually somewhat expensive on different
platforms. I would recommend to only use it if it's actually needed in
the inelastic flow case below and use jiffies to check for rehashing.
> +
> + if(q->rehash_interval > 0) {
> + psched_tdiff_t age;
> + age = psched_tdiff_bounded(now, q->rehash_time,
> + q->rehash_interval *
> + PSCHED_TICKS_PER_SEC);
> + if(unlikely(age >= q->rehash_interval * PSCHED_TICKS_PER_SEC)) {
> + swap_buffers(q);
> + q->rehash_time = now;
> + }
> + if(unlikely(!q->double_buffering && q->db_interval > 0 &&
> + age >= (q->rehash_interval - q->db_interval) *
> + PSCHED_TICKS_PER_SEC))
> + q->double_buffering = 1;
/dev/random is a precious resource (some systems have very little true entropy)
and getting that much data from it regularly is not a good idea because
you take it away from other users who really need it (like strong cryptography)
I'm not sure if the rehash is for security or not (some comments on that
would be good). But in any case it is likely better you only get
the get_random_bytes() entropy once and then use that to init some kind
of RNG (either a secure one if it's for security or some random
fast one if it's not) and then use that output for rehashing.
-Andi
next prev parent reply other threads:[~2008-04-08 8:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-07 22:37 [PATCH] Stochastic Fair Blue queue discipline Juliusz Chroboczek
2008-04-08 0:04 ` Patrick McHardy
2008-04-08 0:56 ` Patrick McHardy
2008-04-08 15:28 ` Juliusz Chroboczek
2008-04-08 8:20 ` Andi Kleen [this message]
2008-04-08 12:11 ` Patrick McHardy
2008-04-08 15:39 ` Juliusz Chroboczek
2008-04-08 15:45 ` Patrick McHardy
2008-04-09 15:48 ` Juliusz Chroboczek
2008-04-09 16:00 ` Patrick McHardy
2008-04-08 15:38 ` Juliusz Chroboczek
2008-04-08 16:32 ` Andi Kleen
2008-04-08 17:35 ` Juliusz Chroboczek
2008-04-08 17:53 ` Andi Kleen
2008-04-09 15:45 ` Juliusz Chroboczek
2008-04-09 17:49 ` Andi Kleen
2008-04-10 1:23 ` Patrick McHardy
2008-04-10 1:38 ` Patrick McHardy
2008-04-10 11:17 ` Juliusz Chroboczek
2008-04-11 13:07 ` Patrick McHardy
2008-04-10 14:04 ` Stephen Hemminger
2008-04-10 7:36 ` Andi Kleen
2008-04-08 16:44 ` Patrick McHardy
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=873apwrc4t.fsf@basil.nowhere.org \
--to=andi@firstfloor.org \
--cc=jch@pps.jussieu.fr \
--cc=netdev@vger.kernel.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).