[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1433412130.1805421.286610153.28C55E6E@webmail.messagingengine.com>
Date: Thu, 04 Jun 2015 12:02:10 +0200
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
To: Tom Herbert <tom@...bertland.com>, davem@...emloft.net,
agartrell@...com, maheshb@...gle.com, tgraf@...g.ch,
netdev@...r.kernel.org
Subject: Re: [RFC net-next 2/6] net: Identfier Locator Addressing module
On Wed, Jun 3, 2015, at 21:58, Tom Herbert wrote:
> +static u32 hashrnd __read_mostly;
> +static __always_inline void ila_init_secret(void)
> +{
> + net_get_random_once(&hashrnd, sizeof(hashrnd));
> +}
> +
> +static inline unsigned int ila_hash(u64 id)
> +{
> + u32 *words = (u32 *)&id;
> +
> + return jhash_2words(words[0], words[1], hashrnd);
> +}
You can put hashrnd as static variable inside ila_hash and use the
net_get_random_once directly before calling jhash, no need to initialize
the secret during kernel bootup.
Thanks,
Hannes
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists