aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-08-23 14:58:54 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-23 15:21:21 -0400
commit8fc54f68919298ff9689d980efb495707ef43f30 (patch)
treec8a0c89621a9e670be02764a357bb6e73ed7ab6c /net/ipv6
parent690e36e726d00d2528bc569809048adf61550d80 (diff)
net: use reciprocal_scale() helper
Replace open codings of (((u64) <x> * <y>) >> 32) with reciprocal_scale(). Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/inet6_hashtables.c2
-rw-r--r--net/ipv6/udp.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index 262e13c02ec2..826019008958 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -198,7 +198,7 @@ begin:
198 } 198 }
199 } else if (score == hiscore && reuseport) { 199 } else if (score == hiscore && reuseport) {
200 matches++; 200 matches++;
201 if (((u64)phash * matches) >> 32 == 0) 201 if (reciprocal_scale(phash, matches) == 0)
202 result = sk; 202 result = sk;
203 phash = next_pseudo_random32(phash); 203 phash = next_pseudo_random32(phash);
204 } 204 }
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 4836af8f582d..25ffe737b975 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -243,7 +243,7 @@ begin:
243 goto exact_match; 243 goto exact_match;
244 } else if (score == badness && reuseport) { 244 } else if (score == badness && reuseport) {
245 matches++; 245 matches++;
246 if (((u64)hash * matches) >> 32 == 0) 246 if (reciprocal_scale(hash, matches) == 0)
247 result = sk; 247 result = sk;
248 hash = next_pseudo_random32(hash); 248 hash = next_pseudo_random32(hash);
249 } 249 }
@@ -323,7 +323,7 @@ begin:
323 } 323 }
324 } else if (score == badness && reuseport) { 324 } else if (score == badness && reuseport) {
325 matches++; 325 matches++;
326 if (((u64)hash * matches) >> 32 == 0) 326 if (reciprocal_scale(hash, matches) == 0)
327 result = sk; 327 result = sk;
328 hash = next_pseudo_random32(hash); 328 hash = next_pseudo_random32(hash);
329 } 329 }