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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to