ath9k: backport dynack improvements
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 560-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 diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c
20 index fe9181533de3..f786be04d0ac 100644
21 --- a/drivers/net/wireless/ath/ath9k/dynack.c
22 +++ b/drivers/net/wireless/ath/ath9k/dynack.c
23 @@ -321,11 +321,9 @@ EXPORT_SYMBOL(ath_dynack_sample_ack_ts);
24   */
25  void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
26  {
27 -       /* ackto = slottime + sifs + air delay */
28 -       u32 ackto = 9 + 16 + 64;
29         struct ath_dynack *da = &ah->dynack;
30  
31 -       an->ackto = ackto;
32 +       an->ackto = da->ackto;
33  
34         spin_lock(&da->qlock);
35         list_add_tail(&an->list, &da->nodes);
36 @@ -356,20 +354,26 @@ EXPORT_SYMBOL(ath_dynack_node_deinit);
37   */
38  void ath_dynack_reset(struct ath_hw *ah)
39  {
40 -       /* ackto = slottime + sifs + air delay */
41 -       u32 ackto = 9 + 16 + 64;
42         struct ath_dynack *da = &ah->dynack;
43 +       struct ath_node *an;
44 +
45 +       spin_lock_bh(&da->qlock);
46  
47         da->lto = jiffies + COMPUTE_TO;
48 -       da->ackto = ackto;
49  
50         da->st_rbf.t_rb = 0;
51         da->st_rbf.h_rb = 0;
52         da->ack_rbf.t_rb = 0;
53         da->ack_rbf.h_rb = 0;
54  
55 +       da->ackto = ath_dynack_get_max_to(ah);
56 +       list_for_each_entry(an, &da->nodes, list)
57 +               an->ackto = da->ackto;
58 +
59         /* init acktimeout */
60 -       ath_dynack_set_timeout(ah, ackto);
61 +       ath_dynack_set_timeout(ah, da->ackto);
62 +
63 +       spin_unlock_bh(&da->qlock);
64  }
65  EXPORT_SYMBOL(ath_dynack_reset);
66  
67 @@ -386,6 +390,8 @@ void ath_dynack_init(struct ath_hw *ah)
68  
69         spin_lock_init(&da->qlock);
70         INIT_LIST_HEAD(&da->nodes);
71 +       /* ackto = slottime + sifs + air delay */
72 +       da->ackto = 9 + 16 + 64;
73  
74         ah->hw->wiphy->features |= NL80211_FEATURE_ACKTO_ESTIMATION;
75  }
76 -- 
77 2.17.1
78