77ecc82302f8c3220346749a2a5962763746a554
[openwrt/staging/neocturne.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sun, 26 Jul 2020 14:37:02 +0200
3 Subject: [PATCH] net/fq_impl: use skb_get_hash instead of
4 skb_get_hash_perturb
5
6 This avoids unnecessary regenerating of the skb flow hash
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/include/net/fq.h
12 +++ b/include/net/fq.h
13 @@ -69,15 +69,6 @@ struct fq {
14 struct list_head backlogs;
15 spinlock_t lock;
16 u32 flows_cnt;
17 -#if LINUX_VERSION_IS_GEQ(5,3,10) || \
18 - LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
19 - LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
20 - LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
21 - LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
22 - siphash_key_t perturbation;
23 -#else
24 - u32 perturbation;
25 -#endif
26 u32 limit;
27 u32 memory_limit;
28 u32 memory_usage;
29 --- a/include/net/fq_impl.h
30 +++ b/include/net/fq_impl.h
31 @@ -108,15 +108,7 @@ begin:
32
33 static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)
34 {
35 -#if LINUX_VERSION_IS_GEQ(5,3,10) || \
36 - LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
37 - LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
38 - LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
39 - LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
40 - u32 hash = skb_get_hash_perturb(skb, &fq->perturbation);
41 -#else
42 - u32 hash = skb_get_hash_perturb(skb, fq->perturbation);
43 -#endif
44 + u32 hash = skb_get_hash(skb);
45
46 return reciprocal_scale(hash, fq->flows_cnt);
47 }
48 @@ -316,7 +308,6 @@ static int fq_init(struct fq *fq, int fl
49 INIT_LIST_HEAD(&fq->backlogs);
50 spin_lock_init(&fq->lock);
51 fq->flows_cnt = max_t(u32, flows_cnt, 1);
52 - get_random_bytes(&fq->perturbation, sizeof(fq->perturbation));
53 fq->quantum = 300;
54 fq->limit = 8192;
55 fq->memory_limit = 16 << 20; /* 16 MBytes */