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>
This commit is contained in:
Tom Herbert
2013-12-15 22:12:18 -08:00
committed by David S. Miller
parent 3958afa1b2
commit 7539fadcb8
5 changed files with 22 additions and 12 deletions

View File

@@ -712,6 +712,18 @@ static inline __u32 skb_get_hash(struct sk_buff *skb)
return skb->rxhash;
}
static inline void skb_clear_hash(struct sk_buff *skb)
{
skb->rxhash = 0;
skb->l4_rxhash = 0;
}
static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb)
{
if (!skb->l4_rxhash)
skb_clear_hash(skb);
}
#ifdef NET_SKBUFF_DATA_USES_OFFSET
static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
{