aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/patches/subsys/308-net-fq_impl-use-skb_get_hash-instead-of-skb_get_hash.patch
blob: 77ecc82302f8c3220346749a2a5962763746a554 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From: Felix Fietkau <nbd@nbd.name>
Date: Sun, 26 Jul 2020 14:37:02 +0200
Subject: [PATCH] net/fq_impl: use skb_get_hash instead of
 skb_get_hash_perturb

This avoids unnecessary regenerating of the skb flow hash

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---

--- a/include/net/fq.h
+++ b/include/net/fq.h
@@ -69,15 +69,6 @@ struct fq {
 	struct list_head backlogs;
 	spinlock_t lock;
 	u32 flows_cnt;
-#if LINUX_VERSION_IS_GEQ(5,3,10) || \
-    LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
-    LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
-    LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
-    LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
-	siphash_key_t	perturbation;
-#else
-	u32 perturbation;
-#endif
 	u32 limit;
 	u32 memory_limit;
 	u32 memory_usage;
--- a/include/net/fq_impl.h
+++ b/include/net/fq_impl.h
@@ -108,15 +108,7 @@ begin:
 
 static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)
 {
-#if LINUX_VERSION_IS_GEQ(5,3,10) || \
-    LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
-    LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
-    LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
-    LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
-	u32 hash = skb_get_hash_perturb(skb, &fq->perturbation);
-#else
-	u32 hash = skb_get_hash_perturb(skb, fq->perturbation);
-#endif
+	u32 hash = skb_get_hash(skb);
 
 	return reciprocal_scale(hash, fq->flows_cnt);
 }
@@ -316,7 +308,6 @@ static int fq_init(struct fq *fq, int fl
 	INIT_LIST_HEAD(&fq->backlogs);
 	spin_lock_init(&fq->lock);
 	fq->flows_cnt = max_t(u32, flows_cnt, 1);
-	get_random_bytes(&fq->perturbation, sizeof(fq->perturbation));
 	fq->quantum = 300;
 	fq->limit = 8192;
 	fq->memory_limit = 16 << 20; /* 16 MBytes */