From: Joe Perches <joe@perches.com>
To: Aruna-Hewapathirane <aruna.hewapathirane@gmail.com>
Cc: netdev@vger.kernel.org, hannes@stressinduktion.org
Subject: Re: [PATCH net-next] net: replace macros net_random and net_srandom with direct calls to prandom
Date: Sat, 11 Jan 2014 09:52:37 -0800 [thread overview]
Message-ID: <1389462757.2537.61.camel@joe-AO722> (raw)
In-Reply-To: <1389442559-13097-1-git-send-email-aruna.hewapathirane@gmail.com>
On Sat, 2014-01-11 at 07:15 -0500, Aruna-Hewapathirane wrote:
> This patch removes the net_random and net_srandom macros and replaces
> them with direct calls to the prandom ones. As new commits only seem to
> use prandom_u32 there is no use to keep them around.
> This change makes it easier to grep for users of prandom_u32.
Seems sensible.
Also, there may be some value in a future patch
to use reciprocal_divide in a few places
> diff --git a/net/802/garp.c b/net/802/garp.c
> @@ -397,7 +397,7 @@ static void garp_join_timer_arm(struct garp_applicant *app)
> {
> unsigned long delay;
>
> - delay = (u64)msecs_to_jiffies(garp_join_time) * net_random() >> 32;
> + delay = (u64)msecs_to_jiffies(garp_join_time) * prandom_u32() >> 32;
reciprocal_divide()
> diff --git a/net/802/mrp.c b/net/802/mrp.c
[]
> @@ -583,7 +583,7 @@ static void mrp_join_timer_arm(struct mrp_applicant *app)
> {
> unsigned long delay;
>
> - delay = (u64)msecs_to_jiffies(mrp_join_time) * net_random() >> 32;
> + delay = (u64)msecs_to_jiffies(mrp_join_time) * prandom_u32() >> 32;
here too
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
[]
> @@ -223,7 +223,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
> inet_get_local_port_range(net, &low, &high);
> remaining = (high - low) + 1;
>
> - rand = net_random();
> + rand = prandom_u32();
> first = (((u64)rand * remaining) >> 32) + low;
another
next prev parent reply other threads:[~2014-01-11 17:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-11 12:15 [PATCH net-next] net: replace macros net_random and net_srandom with direct calls to prandom Aruna-Hewapathirane
2014-01-11 12:21 ` Hannes Frederic Sowa
2014-01-11 17:52 ` Joe Perches [this message]
2014-01-11 18:00 ` Hannes Frederic Sowa
2014-01-11 18:43 ` Joe Perches
2014-01-11 18:58 ` Hannes Frederic Sowa
2014-01-11 18:52 ` Daniel Borkmann
2014-01-11 19:20 ` Joe Perches
2014-01-11 19:29 ` Daniel Borkmann
2014-01-14 23:15 ` 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=1389462757.2537.61.camel@joe-AO722 \
--to=joe@perches.com \
--cc=aruna.hewapathirane@gmail.com \
--cc=hannes@stressinduktion.org \
--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