aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2011-08-14 15:45:55 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-17 23:06:03 -0400
commitbdeab991918663aed38757904219e8398214334c (patch)
treebc6c02da7ed88e3e568677b4a35fb4e55de363de /net/core
parent792df22cd0499b4e662d4618b0008fdcfef8b04e (diff)
rps: Add flag to skb to indicate rxhash is based on L4 tuple
The l4_rxhash flag was added to the skb structure to indicate that the rxhash value was computed over the 4 tuple for the packet which includes the port information in the encapsulated transport packet. This is used by the stack to preserve the rxhash value in __skb_rx_tunnel. 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.c10
-rw-r--r--net/core/skbuff.c1
2 files changed, 7 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 6578d9483043..e485cb37228f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2519,10 +2519,11 @@ static inline void ____napi_schedule(struct softnet_data *sd,
2519 2519
2520/* 2520/*
2521 * __skb_get_rxhash: calculate a flow hash based on src/dst addresses 2521 * __skb_get_rxhash: calculate a flow hash based on src/dst addresses
2522 * and src/dst port numbers. Returns a non-zero hash number on success 2522 * and src/dst port numbers. Sets rxhash in skb to non-zero hash value
2523 * and 0 on failure. 2523 * on success, zero indicates no valid hash. Also, sets l4_rxhash in skb
2524 * if hash is a canonical 4-tuple hash over transport ports.
2524 */ 2525 */
2525__u32 __skb_get_rxhash(struct sk_buff *skb) 2526void __skb_get_rxhash(struct sk_buff *skb)
2526{ 2527{
2527 int nhoff, hash = 0, poff; 2528 int nhoff, hash = 0, poff;
2528 const struct ipv6hdr *ip6; 2529 const struct ipv6hdr *ip6;
@@ -2574,6 +2575,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
2574 ports.v32 = * (__force u32 *) (skb->data + nhoff); 2575 ports.v32 = * (__force u32 *) (skb->data + nhoff);
2575 if (ports.v16[1] < ports.v16[0]) 2576 if (ports.v16[1] < ports.v16[0])
2576 swap(ports.v16[0], ports.v16[1]); 2577 swap(ports.v16[0], ports.v16[1]);
2578 skb->l4_rxhash = 1;
2577 } 2579 }
2578 } 2580 }
2579 2581
@@ -2586,7 +2588,7 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
2586 hash = 1; 2588 hash = 1;
2587 2589
2588done: 2590done:
2589 return hash; 2591 skb->rxhash = hash;
2590} 2592}
2591EXPORT_SYMBOL(__skb_get_rxhash); 2593EXPORT_SYMBOL(__skb_get_rxhash);
2592 2594
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 27002dffe7ed..edb66f3e24f1 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -529,6 +529,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
529 new->mac_header = old->mac_header; 529 new->mac_header = old->mac_header;
530 skb_dst_copy(new, old); 530 skb_dst_copy(new, old);
531 new->rxhash = old->rxhash; 531 new->rxhash = old->rxhash;
532 new->l4_rxhash = old->l4_rxhash;
532#ifdef CONFIG_XFRM 533#ifdef CONFIG_XFRM
533 new->sp = secpath_get(old->sp); 534 new->sp = secpath_get(old->sp);
534#endif 535#endif