mac80211: Update to version 4.19.112
[librecmc/librecmc.git] / package / kernel / mac80211 / patches / ath / 561-ath9k-dynack-set-ackto-to-max-timeout-in-ath_dynack_.patch
1 From cc783bfa67e87d2e6206f7626b7bbb74d5c5f269 Mon Sep 17 00:00:00 2001
2 From: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Tue, 20 Aug 2019 18:20:22 +0200
4 Subject: [PATCH 4/4] ath9k: dynack: set ackto to max timeout in
5  ath_dynack_reset
6
7 Initialize acktimeout to the maximum configurable value in
8 ath_dynack_reset in order to not disconnect long distance static links
9 enabling dynack and even to take care of possible errors configuring
10 a static timeout. Moreover initialize station timeout value to the current
11 acktimeout value
12
13 Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
14 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
15 ---
16  drivers/net/wireless/ath/ath9k/dynack.c | 20 +++++++++++++-------
17  1 file changed, 13 insertions(+), 7 deletions(-)
18
19 --- a/drivers/net/wireless/ath/ath9k/dynack.c
20 +++ b/drivers/net/wireless/ath/ath9k/dynack.c
21 @@ -321,11 +321,9 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts);
22   */
23  void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
24  {
25 -       /* ackto = slottime + sifs + air delay */
26 -       u32 ackto = 9 + 16 + 64;
27         struct ath_dynack *da = &ah->dynack;
28  
29 -       an->ackto = ackto;
30 +       an->ackto = da->ackto;
31  
32         spin_lock_bh(&da->qlock);
33         list_add_tail(&an->list, &da->nodes);
34 @@ -356,20 +354,26 @@ EXPORT_SYMBOL(ath_dynack_node_deinit);
35   */
36  void ath_dynack_reset(struct ath_hw *ah)
37  {
38 -       /* ackto = slottime + sifs + air delay */
39 -       u32 ackto = 9 + 16 + 64;
40         struct ath_dynack *da = &ah->dynack;
41 +       struct ath_node *an;
42 +
43 +       spin_lock_bh(&da->qlock);
44  
45         da->lto = jiffies + COMPUTE_TO;
46 -       da->ackto = ackto;
47  
48         da->st_rbf.t_rb = 0;
49         da->st_rbf.h_rb = 0;
50         da->ack_rbf.t_rb = 0;
51         da->ack_rbf.h_rb = 0;
52  
53 +       da->ackto = ath_dynack_get_max_to(ah);
54 +       list_for_each_entry(an, &da->nodes, list)
55 +               an->ackto = da->ackto;
56 +
57         /* init acktimeout */
58 -       ath_dynack_set_timeout(ah, ackto);
59 +       ath_dynack_set_timeout(ah, da->ackto);
60 +
61 +       spin_unlock_bh(&da->qlock);
62  }
63  EXPORT_SYMBOL(ath_dynack_reset);
64  
65 @@ -386,6 +390,8 @@ void ath_dynack_init(struct ath_hw *ah)
66  
67         spin_lock_init(&da->qlock);
68         INIT_LIST_HEAD(&da->nodes);
69 +       /* ackto = slottime + sifs + air delay */
70 +       da->ackto = 9 + 16 + 64;
71  
72         ah->hw->wiphy->features |= NL80211_FEATURE_ACKTO_ESTIMATION;
73  }