Subject: Re: [PATCH 2/5 v2] soreuseport: TCP/IPv4 implementation

From: YOSHIFUJI Hideaki <[email-masked]>
Date: Mon, 21 Jan 2013 11:30:25 +0900

Tom Herbert wrote:

> +		} else if (score == hiscore && reuseport) {
> +			matches++;
> +			if (((u64)phash * matches) >> 32 == 0)
> +				result = sk;
> +			phash = next_pseudo_random32(phash);
>  		}
>  	}
>  	/*

Well, honestly, this seems the most difficult part to understand
at a glance.  Plus, there seems multiple ways to do this.
Maybe, inline?

static inline sock_true_1_in_n(u32 r, unsigned int n)
{
	/* return (r < ~0U / n); */
	/* return (r % n == 0); */
	return ((u64)r * n >> 32) == 0;
}