mac80211: backport skb_get_hash_perturb() for 4.1 and older
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 005-backport_skb_get_hash_perturb.patch
1 --- a/backport-include/linux/skbuff.h
2 +++ b/backport-include/linux/skbuff.h
3 @@ -1,6 +1,8 @@
4 #ifndef __BACKPORT_SKBUFF_H
5 #define __BACKPORT_SKBUFF_H
6 #include_next <linux/skbuff.h>
7 +#include <net/flow_keys.h>
8 +#include <linux/jhash.h>
9 #include <linux/version.h>
10 #include <generated/utsrelease.h>
11
12 @@ -305,6 +307,16 @@ static inline void skb_free_frag(void *d
13 {
14 put_page(virt_to_head_page(data));
15 }
16 +
17 +static inline u32 skb_get_hash_perturb(struct sk_buff *skb, u32 key)
18 +{
19 + struct flow_keys keys;
20 +
21 + skb_flow_dissect(skb, &keys);
22 + return jhash_3words((__force u32)keys.dst,
23 + (__force u32)keys.src ^ keys.ip_proto,
24 + (__force u32)keys.ports, key);
25 +}
26 #endif
27
28 #endif /* __BACKPORT_SKBUFF_H */