summaryrefslogtreecommitdiff
path: root/net/core/flow_dissector.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-08-23 22:58:54 +0400
committerDavid S. Miller <davem@davemloft.net>2014-08-23 23:21:21 +0400
commit8fc54f68919298ff9689d980efb495707ef43f30 (patch)
treec8a0c89621a9e670be02764a357bb6e73ed7ab6c /net/core/flow_dissector.c
parent690e36e726d00d2528bc569809048adf61550d80 (diff)
downloadlinux-8fc54f68919298ff9689d980efb495707ef43f30.tar.xz
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/core/flow_dissector.c')
-rw-r--r--net/core/flow_dissector.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 660c6492fb78..8ffcc97871c8 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -298,7 +298,7 @@ u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
qcount = dev->tc_to_txq[tc].count;
}
- return (u16) (((u64)skb_get_hash(skb) * qcount) >> 32) + qoffset;
+ return (u16) reciprocal_scale(skb_get_hash(skb), qcount) + qoffset;
}
EXPORT_SYMBOL(__skb_tx_hash);
@@ -371,9 +371,8 @@ static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
if (map->len == 1)
queue_index = map->queues[0];
else
- queue_index = map->queues[
- ((u64)skb_get_hash(skb) * map->len) >> 32];
-
+ queue_index = map->queues[reciprocal_scale(skb_get_hash(skb),
+ map->len)];
if (unlikely(queue_index >= dev->real_num_tx_queues))
queue_index = -1;
}