diff options
| author | Tom Herbert <therbert@google.com> | 2013-12-16 01:12:18 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-12-17 16:36:21 -0500 |
| commit | 7539fadcb8146a5f0db51e80d99c9e724efec7b0 (patch) | |
| tree | 7d3563c2240b16402d536162b4f49bdf036b91ed /include | |
| parent | 3958afa1b272eb07109fd31549e69193b4d7c364 (diff) | |
net: Add utility functions to clear rxhash
In several places 'skb->rxhash = 0' is being done to clear the
rxhash value in an skb. This does not clear l4_rxhash which could
still be set so that the rxhash wouldn't be recalculated on subsequent
call to skb_get_rxhash. This patch adds an explict function to clear
all the rxhash related information in the skb properly.
skb_clear_hash_if_not_l4 clears the rxhash only if it is not marked as
l4_rxhash.
Fixed up places where 'skb->rxhash = 0' was being called.
Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/skbuff.h | 12 | ||||
| -rw-r--r-- | include/net/dst.h | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 4725b953e00d..7deb7ad65914 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -712,6 +712,18 @@ static inline __u32 skb_get_hash(struct sk_buff *skb) | |||
| 712 | return skb->rxhash; | 712 | return skb->rxhash; |
| 713 | } | 713 | } |
| 714 | 714 | ||
| 715 | static inline void skb_clear_hash(struct sk_buff *skb) | ||
| 716 | { | ||
| 717 | skb->rxhash = 0; | ||
| 718 | skb->l4_rxhash = 0; | ||
| 719 | } | ||
| 720 | |||
| 721 | static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb) | ||
| 722 | { | ||
| 723 | if (!skb->l4_rxhash) | ||
| 724 | skb_clear_hash(skb); | ||
| 725 | } | ||
| 726 | |||
| 715 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | 727 | #ifdef NET_SKBUFF_DATA_USES_OFFSET |
| 716 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) | 728 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) |
| 717 | { | 729 | { |
diff --git a/include/net/dst.h b/include/net/dst.h index 44995c13e941..77eb53fabfb0 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -322,12 +322,11 @@ static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev, | |||
| 322 | skb->dev = dev; | 322 | skb->dev = dev; |
| 323 | 323 | ||
| 324 | /* | 324 | /* |
| 325 | * Clear rxhash so that we can recalulate the hash for the | 325 | * Clear hash so that we can recalulate the hash for the |
| 326 | * encapsulated packet, unless we have already determine the hash | 326 | * encapsulated packet, unless we have already determine the hash |
| 327 | * over the L4 4-tuple. | 327 | * over the L4 4-tuple. |
| 328 | */ | 328 | */ |
| 329 | if (!skb->l4_rxhash) | 329 | skb_clear_hash_if_not_l4(skb); |
| 330 | skb->rxhash = 0; | ||
| 331 | skb_set_queue_mapping(skb, 0); | 330 | skb_set_queue_mapping(skb, 0); |
| 332 | skb_scrub_packet(skb, !net_eq(net, dev_net(dev))); | 331 | skb_scrub_packet(skb, !net_eq(net, dev_net(dev))); |
| 333 | } | 332 | } |
