summaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/005-backport_skb_get_hash_perturb.patch
blob: 8212910577b13eb23501d04f0b3c73eab5233141 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- a/backport-include/linux/skbuff.h
+++ b/backport-include/linux/skbuff.h
@@ -1,6 +1,8 @@
 #ifndef __BACKPORT_SKBUFF_H
 #define __BACKPORT_SKBUFF_H
 #include_next <linux/skbuff.h>
+#include <net/flow_keys.h>
+#include <linux/jhash.h>
 #include <linux/version.h>
 #include <generated/utsrelease.h>
 
@@ -305,6 +307,16 @@ static inline void skb_free_frag(void *d
 {
 	put_page(virt_to_head_page(data));
 }
+
+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
 
 #endif /* __BACKPORT_SKBUFF_H */