diff options
author | Tom Herbert <therbert@google.com> | 2011-08-14 15:46:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-17 23:06:03 -0400 |
commit | c6865cb3cc6f3c2857fa4c6f5fda2945d70b1e84 (patch) | |
tree | 2c575583ebc973f56714d5ab6751b8745972fd6f /net/core | |
parent | e971b7225bcb1f318811ef04628c441497372999 (diff) |
rps: Inspect GRE encapsulated packets to get flow hash
Crack open GRE packets in __skb_get_rxhash to compute 4-tuple hash on
in encapsulated packet. Note that this is used only when the
__skb_get_rxhash is taken, in particular only when the device does
not compute provide the rxhash (ie. feature is disabled).
This was tested by creating a single GRE tunnel between two 16 core
AMD machines. 200 netperf TCP_RR streams were ran with 1 byte
request and response size.
Without patch: 157497 tps, 50/90/99% latencies 1250/1292/1364 usecs
With patch: 325896 tps, 50/90/99% latencies 603/848/1169
Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 4bee9a9aeef6..a8d91a5dd909 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2570,6 +2570,28 @@ again: | |||
2570 | } | 2570 | } |
2571 | 2571 | ||
2572 | switch (ip_proto) { | 2572 | switch (ip_proto) { |
2573 | case IPPROTO_GRE: | ||
2574 | if (pskb_may_pull(skb, nhoff + 16)) { | ||
2575 | u8 *h = skb->data + nhoff; | ||
2576 | __be16 flags = *(__be16 *)h; | ||
2577 | |||
2578 | /* | ||
2579 | * Only look inside GRE if version zero and no | ||
2580 | * routing | ||
2581 | */ | ||
2582 | if (!(flags & (GRE_VERSION|GRE_ROUTING))) { | ||
2583 | proto = *(__be16 *)(h + 2); | ||
2584 | nhoff += 4; | ||
2585 | if (flags & GRE_CSUM) | ||
2586 | nhoff += 4; | ||
2587 | if (flags & GRE_KEY) | ||
2588 | nhoff += 4; | ||
2589 | if (flags & GRE_SEQ) | ||
2590 | nhoff += 4; | ||
2591 | goto again; | ||
2592 | } | ||
2593 | } | ||
2594 | break; | ||
2573 | default: | 2595 | default: |
2574 | break; | 2596 | break; |
2575 | } | 2597 | } |