diff options
author | Felix Fietkau <nbd@nbd.name> | 2017-11-16 15:38:53 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2017-11-17 10:46:20 +0100 |
commit | 75cfbdb91ce1f67dbae55a1d1271061ac1f5eabd (patch) | |
tree | 0c7f5205516757f012182296a5fdfdd215a2c1fd /backport | |
parent | 13c2e5b76bab51411459c66125aa0717b439e3a4 (diff) |
backport-include: backport skb_get_hash_perturb
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'backport')
-rw-r--r-- | backport/backport-include/linux/skbuff.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h index 61f3b98f..034206b6 100644 --- a/backport/backport-include/linux/skbuff.h +++ b/backport/backport-include/linux/skbuff.h @@ -306,14 +306,28 @@ static inline void skb_free_frag(void *data) put_page(virt_to_head_page(data)); } -/* iwlwifi doesn't need this function, so it's safe to just return 0 */ -static inline -__u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb) +#if LINUX_VERSION_IS_LESS(3,3,0) + +static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key) { return 0; } -#endif +#else +#include <net/flow_keys.h> +#include <linux/jhash.h> + +static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key) +{ + struct flow_keys keys; + + skb_flow_dissect(skb, &keys); + return jhash_3words((__force u32)keys.dst, + (__force u32)keys.src ^ keys.ip_proto, + (__force u32)keys.ports, key); +} +#endif /* LINUX_VERSION_IS_LESS(3,3,0) */ +#endif /* LINUX_VERSION_IS_LESS(4,2,0) */ #if LINUX_VERSION_IS_LESS(4,13,0) static inline void *backport_skb_put(struct sk_buff *skb, unsigned int len) |