aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c3
-rw-r--r--net/core/flow_dissector.c7
2 files changed, 4 insertions, 6 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index b65a5051361f..1421dad4cb29 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3124,8 +3124,7 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
3124 } 3124 }
3125 3125
3126 if (map) { 3126 if (map) {
3127 tcpu = map->cpus[((u64) hash * map->len) >> 32]; 3127 tcpu = map->cpus[reciprocal_scale(hash, map->len)];
3128
3129 if (cpu_online(tcpu)) { 3128 if (cpu_online(tcpu)) {
3130 cpu = tcpu; 3129 cpu = tcpu;
3131 goto done; 3130 goto done;
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,
298 qcount = dev->tc_to_txq[tc].count; 298 qcount = dev->tc_to_txq[tc].count;
299 } 299 }
300 300
301 return (u16) (((u64)skb_get_hash(skb) * qcount) >> 32) + qoffset; 301 return (u16) reciprocal_scale(skb_get_hash(skb), qcount) + qoffset;
302} 302}
303EXPORT_SYMBOL(__skb_tx_hash); 303EXPORT_SYMBOL(__skb_tx_hash);
304 304
@@ -371,9 +371,8 @@ static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
371 if (map->len == 1) 371 if (map->len == 1)
372 queue_index = map->queues[0]; 372 queue_index = map->queues[0];
373 else 373 else
374 queue_index = map->queues[ 374 queue_index = map->queues[reciprocal_scale(skb_get_hash(skb),
375 ((u64)skb_get_hash(skb) * map->len) >> 32]; 375 map->len)];
376
377 if (unlikely(queue_index >= dev->real_num_tx_queues)) 376 if (unlikely(queue_index >= dev->real_num_tx_queues))
378 queue_index = -1; 377 queue_index = -1;
379 } 378 }