diff options
author | Changli Gao <xiaosuo@gmail.com> | 2010-09-03 23:12:37 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-08 13:10:53 -0700 |
commit | 6febfca98f25c7ee5c3ff7fc85e048bf82230ad5 (patch) | |
tree | f9eb98d11c62db1ba18a73d225526ac8975b87f8 /net/core/dev.c | |
parent | 65040c33ee8d0199ab7686402bffdbf9e1e26cbe (diff) | |
download | op-kernel-dev-6febfca98f25c7ee5c3ff7fc85e048bf82230ad5.zip op-kernel-dev-6febfca98f25c7ee5c3ff7fc85e048bf82230ad5.tar.gz |
net: rps: add the shortcut for one rps_cpus
When there is only one rps_cpus, skb_get_rxhash() can be eliminated.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-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 efd318d..cdbbea3 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, struct rps_dev_flow **rflowp) { struct netdev_rx_queue *rxqueue; - struct rps_map *map; + struct rps_map *map = NULL; struct rps_dev_flow_table *flow_table; struct rps_sock_flow_table *sock_flow_table; int cpu = -1; @@ -2361,8 +2361,17 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, } else rxqueue = dev->_rx; - if (!rxqueue->rps_map && !rxqueue->rps_flow_table) + if (rxqueue->rps_map) { + map = rcu_dereference(rxqueue->rps_map); + if (map && map->len == 1) { + tcpu = map->cpus[0]; + if (cpu_online(tcpu)) + cpu = tcpu; + goto done; + } + } else if (!rxqueue->rps_flow_table) { goto done; + } skb_reset_network_header(skb); if (!skb_get_rxhash(skb)) @@ -2407,7 +2416,6 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, } } - map = rcu_dereference(rxqueue->rps_map); if (map) { tcpu = map->cpus[((u64) skb->rxhash * map->len) >> 32]; |