kernel: Add missing configuration option
[oweals/openwrt.git] / package / kernel / mac80211 / patches / build / 102-backports-Adapt-to-changes-to-skb_get_hash_perturb.patch
1 From e3c57dd949835419cee8d3b45db38de58bf6ebd5 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Mon, 18 Nov 2019 01:13:37 +0100
4 Subject: [PATCH] backports: Adapt to changes to skb_get_hash_perturb()
5
6 The skb_get_hash_perturb() function now takes a siphash_key_t instead of
7 an u32. This was changed in commit 55667441c84f ("net/flow_dissector:
8 switch to siphash"). Use the correct type in the fq header file
9 depending on the kernel version.
10
11 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
12 ---
13  include/net/fq.h      | 8 ++++++++
14  include/net/fq_impl.h | 8 ++++++++
15  2 files changed, 16 insertions(+)
16
17 --- a/include/net/fq.h
18 +++ b/include/net/fq.h
19 @@ -69,7 +69,15 @@ struct fq {
20         struct list_head backlogs;
21         spinlock_t lock;
22         u32 flows_cnt;
23 +#if LINUX_VERSION_IS_GEQ(5,3,10) || \
24 +    LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
25 +    LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
26 +    LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
27 +    LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
28 +       siphash_key_t   perturbation;
29 +#else
30         u32 perturbation;
31 +#endif
32         u32 limit;
33         u32 memory_limit;
34         u32 memory_usage;
35 --- a/include/net/fq_impl.h
36 +++ b/include/net/fq_impl.h
37 @@ -108,7 +108,15 @@ begin:
38  
39  static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)
40  {
41 +#if LINUX_VERSION_IS_GEQ(5,3,10) || \
42 +    LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
43 +    LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
44 +    LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
45 +    LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
46 +       u32 hash = skb_get_hash_perturb(skb, &fq->perturbation);
47 +#else
48         u32 hash = skb_get_hash_perturb(skb, fq->perturbation);
49 +#endif
50  
51         return reciprocal_scale(hash, fq->flows_cnt);
52  }
53 @@ -308,7 +316,15 @@ static int fq_init(struct fq *fq, int fl
54         INIT_LIST_HEAD(&fq->backlogs);
55         spin_lock_init(&fq->lock);
56         fq->flows_cnt = max_t(u32, flows_cnt, 1);
57 +#if LINUX_VERSION_IS_GEQ(5,3,10) || \
58 +    LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
59 +    LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
60 +    LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
61 +    LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
62 +       get_random_bytes(&fq->perturbation, sizeof(fq->perturbation));
63 +#else
64         fq->perturbation = prandom_u32();
65 +#endif
66         fq->quantum = 300;
67         fq->limit = 8192;
68         fq->memory_limit = 16 << 20; /* 16 MBytes */