aboutsummaryrefslogtreecommitdiff
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-01-27 16:22:11 -0800
committerDavid S. Miller <davem@davemloft.net>2009-01-27 16:22:11 -0800
commitd5a9e24afb4ab38110ebb777588ea0bd0eacbd0a (patch)
tree819b2f875a9a1835aa92e051460ddcfe53e9e00f /net/core/dev.c
parenta73efd0a8552927ebe5dff84936f7fdac4f7e314 (diff)
net: Allow RX queue selection to seed TX queue hashing.
The idea is that drivers which implement multiqueue RX pre-seed the SKB by recording the RX queue selected by the hardware. If such a seed is found on TX, we'll use that to select the outgoing TX queue. This helps get more consistent load balancing on router and firewall loads. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 5379b0c1190..b21ad0b47aa 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1722,6 +1722,13 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
simple_tx_hashrnd_initialized = 1;
}
+ if (skb_rx_queue_recorded(skb)) {
+ u32 val = skb_get_rx_queue(skb);
+
+ hash = jhash_1word(val, simple_tx_hashrnd);
+ goto out;
+ }
+
switch (skb->protocol) {
case htons(ETH_P_IP):
if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)))
@@ -1759,6 +1766,7 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
hash = jhash_3words(addr1, addr2, ports, simple_tx_hashrnd);
+out:
return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32);
}