diff options
-rw-r--r-- | net/core/dev.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index efd318db11ab..cdbbea39c549 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2343,7 +2343,7 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, | |||
2343 | struct rps_dev_flow **rflowp) | 2343 | struct rps_dev_flow **rflowp) |
2344 | { | 2344 | { |
2345 | struct netdev_rx_queue *rxqueue; | 2345 | struct netdev_rx_queue *rxqueue; |
2346 | struct rps_map *map; | 2346 | struct rps_map *map = NULL; |
2347 | struct rps_dev_flow_table *flow_table; | 2347 | struct rps_dev_flow_table *flow_table; |
2348 | struct rps_sock_flow_table *sock_flow_table; | 2348 | struct rps_sock_flow_table *sock_flow_table; |
2349 | int cpu = -1; | 2349 | int cpu = -1; |
@@ -2361,8 +2361,17 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, | |||
2361 | } else | 2361 | } else |
2362 | rxqueue = dev->_rx; | 2362 | rxqueue = dev->_rx; |
2363 | 2363 | ||
2364 | if (!rxqueue->rps_map && !rxqueue->rps_flow_table) | 2364 | if (rxqueue->rps_map) { |
2365 | map = rcu_dereference(rxqueue->rps_map); | ||
2366 | if (map && map->len == 1) { | ||
2367 | tcpu = map->cpus[0]; | ||
2368 | if (cpu_online(tcpu)) | ||
2369 | cpu = tcpu; | ||
2370 | goto done; | ||
2371 | } | ||
2372 | } else if (!rxqueue->rps_flow_table) { | ||
2365 | goto done; | 2373 | goto done; |
2374 | } | ||
2366 | 2375 | ||
2367 | skb_reset_network_header(skb); | 2376 | skb_reset_network_header(skb); |
2368 | if (!skb_get_rxhash(skb)) | 2377 | if (!skb_get_rxhash(skb)) |
@@ -2407,7 +2416,6 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, | |||
2407 | } | 2416 | } |
2408 | } | 2417 | } |
2409 | 2418 | ||
2410 | map = rcu_dereference(rxqueue->rps_map); | ||
2411 | if (map) { | 2419 | if (map) { |
2412 | tcpu = map->cpus[((u64) skb->rxhash * map->len) >> 32]; | 2420 | tcpu = map->cpus[((u64) skb->rxhash * map->len) >> 32]; |
2413 | 2421 | ||