mac80211: Update to version 5.3.6
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / ath / 558-ath9k-dynack-introduce-ath_dynack_set_timeout-routin.patch
1 From 4420866ef1b602682b009e0186fbb8aefd2125be Mon Sep 17 00:00:00 2001
2 From: Lorenzo Bianconi <lorenzo@kernel.org>
3 Date: Tue, 20 Aug 2019 18:20:19 +0200
4 Subject: [PATCH 1/4] ath9k: dynack: introduce ath_dynack_set_timeout routine
5
6 Introduce ath_dynack_set_timeout routine to configure slottime/ack/cts
7 timeouts and remove duplicated code
8
9 Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
10 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
11 ---
12 drivers/net/wireless/ath/ath9k/dynack.c | 37 ++++++++++++++-----------
13 1 file changed, 21 insertions(+), 16 deletions(-)
14
15 --- a/drivers/net/wireless/ath/ath9k/dynack.c
16 +++ b/drivers/net/wireless/ath/ath9k/dynack.c
17 @@ -79,6 +79,24 @@ static inline bool ath_dynack_bssidmask(
18 }
19
20 /**
21 + * ath_dynack_set_timeout - configure timeouts/slottime registers
22 + * @ah: ath hw
23 + * @to: timeout value
24 + *
25 + */
26 +static void ath_dynack_set_timeout(struct ath_hw *ah, int to)
27 +{
28 + struct ath_common *common = ath9k_hw_common(ah);
29 + int slottime = (to - 3) / 2;
30 +
31 + ath_dbg(common, DYNACK, "ACK timeout %u slottime %u\n",
32 + to, slottime);
33 + ath9k_hw_setslottime(ah, slottime);
34 + ath9k_hw_set_ack_timeout(ah, to);
35 + ath9k_hw_set_cts_timeout(ah, to);
36 +}
37 +
38 +/**
39 * ath_dynack_compute_ackto - compute ACK timeout as the maximum STA timeout
40 * @ah: ath hw
41 *
42 @@ -86,7 +104,6 @@ static inline bool ath_dynack_bssidmask(
43 */
44 static void ath_dynack_compute_ackto(struct ath_hw *ah)
45 {
46 - struct ath_common *common = ath9k_hw_common(ah);
47 struct ath_dynack *da = &ah->dynack;
48 struct ath_node *an;
49 int to = 0;
50 @@ -96,15 +113,8 @@ static void ath_dynack_compute_ackto(str
51 to = an->ackto;
52
53 if (to && da->ackto != to) {
54 - u32 slottime;
55 -
56 - slottime = (to - 3) / 2;
57 + ath_dynack_set_timeout(ah, to);
58 da->ackto = to;
59 - ath_dbg(common, DYNACK, "ACK timeout %u slottime %u\n",
60 - da->ackto, slottime);
61 - ath9k_hw_setslottime(ah, slottime);
62 - ath9k_hw_set_ack_timeout(ah, da->ackto);
63 - ath9k_hw_set_cts_timeout(ah, da->ackto);
64 }
65 }
66
67 @@ -198,10 +208,7 @@ void ath_dynack_sample_tx_ts(struct ath_
68 ieee80211_is_assoc_resp(hdr->frame_control) ||
69 ieee80211_is_auth(hdr->frame_control)) {
70 ath_dbg(common, DYNACK, "late ack\n");
71 -
72 - ath9k_hw_setslottime(ah, (LATEACK_TO - 3) / 2);
73 - ath9k_hw_set_ack_timeout(ah, LATEACK_TO);
74 - ath9k_hw_set_cts_timeout(ah, LATEACK_TO);
75 + ath_dynack_set_timeout(ah, LATEACK_TO);
76 if (sta) {
77 struct ath_node *an;
78
79 @@ -340,9 +347,7 @@ void ath_dynack_reset(struct ath_hw *ah)
80 da->ack_rbf.h_rb = 0;
81
82 /* init acktimeout */
83 - ath9k_hw_setslottime(ah, (ackto - 3) / 2);
84 - ath9k_hw_set_ack_timeout(ah, ackto);
85 - ath9k_hw_set_cts_timeout(ah, ackto);
86 + ath_dynack_set_timeout(ah, ackto);
87 }
88 EXPORT_SYMBOL(ath_dynack_reset);
89