netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Ayaz Abdulla <aabdulla@nvidia.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jeff Garzik <jgarzik@pobox.com>, nedev <netdev@vger.kernel.org>
Subject: Re: [PATCH] forcedeth: new backoff implementation
Date: Tue, 08 Apr 2008 18:15:32 +0200	[thread overview]
Message-ID: <47FB9A24.7030709@colorfullife.com> (raw)
In-Reply-To: <20080408011425.ff2dc98a.akpm@linux-foundation.org>

Andrew Morton wrote:
> On Mon, 07 Apr 2008 17:40:28 -0400 Ayaz Abdulla <aabdulla@nvidia.com> wrote:
>   
>> +static void nv_gear_backoff_reseed(struct net_device *dev)
>> +{
>> +	u8 __iomem *base = get_hwbase(dev);
>> +	u32 miniseed1, miniseed2, miniseed2_reversed, miniseed3, miniseed3_reversed;
>> +	u32 temp, seedset, combinedSeed;
>> +	int i;
>> +
>> +	/* Setup seed for free running LFSR */
>> +	/* We are going to read the time stamp counter 3 times and swizzle bits around to increase randomness */
>>     
>
> I see this driver rigorously observes the 800-column-xterm convention.
>
>   
>> +	rdtscl(miniseed1);
>>     
>
> err, no.  We don't have sufficient Kconfig dependencies in place to be able
> to do this.  You just broke all non-x86.
>
> Suitable fixes would be
>
> a) add #ifdef CONFIG_X86 all over the place
>
> b) use do_gettimeofday() (might be tricky if called from interrupt)
>
> c) use cpu_clock().
>
>   
d) use get_random_bytes()?
It's irq-safe, used e.g. by the network code for the TCP sequence numbers.
>> +	/* Ensure seeds are not the same */
>> +	if ((combinedSeed & NVREG_BKOFFCTRL_SEED_MASK) ==
>> +	    (combinedSeed & (NVREG_BKOFFCTRL_SEED_MASK << NVREG_BKOFFCTRL_GEAR)))
>> +		combinedSeed = 0x3FF3FF;
>> +
>>     
I don't understand this block: The seed consists of two parts, each 12 bits.
Both parts mustn't be identical. If both parts are identical, then both 
are set to 0x3ff.
But if both are 0x3ff, then they are identical. Is that intentional?

--
    Manfred

  reply	other threads:[~2008-04-08 16:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-07 21:40 [PATCH] forcedeth: new backoff implementation Ayaz Abdulla
2008-04-08  8:14 ` Andrew Morton
2008-04-08 16:15   ` Manfred Spraul [this message]
2008-04-08 19:13     ` Ayaz Abdulla
  -- strict thread matches above, loose matches on Subject: below --
2008-04-09 23:36 Ayaz Abdulla
2008-04-10 16:25 ` Ingo Oeser
2008-04-10 19:54 Ayaz Abdulla
2008-04-11 16:52 ` Ingo Oeser
2008-04-12  4:50   ` Andrew Morton
2008-04-11 18:31 Ayaz Abdulla

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=47FB9A24.7030709@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=aabdulla@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=jgarzik@pobox.com \
    --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).