aredn/patches/712-auto-distance-settings....

157 lines
5.3 KiB
Diff
Raw Normal View History

Index: openwrt/package/kernel/mac80211/patches/569-ath9k-dynack-set-max-timeout.patch
===================================================================
--- /dev/null
+++ openwrt/package/kernel/mac80211/patches/569-ath9k-dynack-set-max-timeout.patch
@@ -0,0 +1,36 @@
+--- a/drivers/net/wireless/ath/ath9k/dynack.c
++++ b/drivers/net/wireless/ath/ath9k/dynack.c
+@@ -103,9 +103,10 @@
+ struct ath_dynack *da = &ah->dynack;
+ struct ath_node *an;
+ int to = 0;
++ u32 max_to = ath_dynack_get_max_to(ah);
+
+ list_for_each_entry(an, &da->nodes, list)
+- if (an->ackto > to)
++ if (an->ackto > to && an->ackto < max_to)
+ to = an->ackto;
+
+ if (to && da->ackto != to) {
+@@ -308,8 +309,8 @@
+ */
+ void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an)
+ {
+- /* ackto = slottime + sifs + air delay */
+- u32 ackto = 9 + 16 + 64;
++ /* AREDN set ackto to max_to initialize */
++ u32 ackto = ath_dynack_get_max_to(ah);
+ struct ath_dynack *da = &ah->dynack;
+
+ an->ackto = ackto;
+@@ -343,8 +344,8 @@
+ */
+ void ath_dynack_reset(struct ath_hw *ah)
+ {
+- /* ackto = slottime + sifs + air delay */
+- u32 ackto = 9 + 16 + 64;
++ /* AREDN set ackto to max_to initialize */
++ u32 ackto = ath_dynack_get_max_to(ah);
+ struct ath_dynack *da = &ah->dynack;
+
+ da->lto = jiffies;
Index: openwrt/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
===================================================================
--- openwrt.orig/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ openwrt/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -769,7 +769,11 @@ drv_mac80211_setup() {
iw phy "$phy" set antenna $txantenna $rxantenna >/dev/null 2>&1
iw phy "$phy" set antenna_gain $antenna_gain
- iw phy "$phy" set distance "$distance"
+ if [ $distance -eq 0 -a -d /sys/kernel/debug/ieee80211/$phy/ath9k ]; then
+ iw phy "$phy" set distance auto
+ else
+ iw phy "$phy" set distance "$distance"
+ fi
[ -n "$frag" ] && iw phy "$phy" set frag "${frag%%.*}"
[ -n "$rts" ] && iw phy "$phy" set rts "${rts%%.*}"
Index: openwrt/package/kernel/mac80211/patches/568-ath-dynack-set-max-timeout-according-to-clockrate.patch
===================================================================
--- /dev/null
+++ openwrt/package/kernel/mac80211/patches/568-ath-dynack-set-max-timeout-according-to-clockrate.patch
@@ -0,0 +1,93 @@
+From 72f4ba6f6b6021fcc48d07d03407c2fdb16a46c5 Mon Sep 17 00:00:00 2001
+Message-Id: <72f4ba6f6b6021fcc48d07d03407c2fdb16a46c5.1554035972.git.lorenzo@kernel.org>
+In-Reply-To: <cover.1554035972.git.lorenzo@kernel.org>
+References: <cover.1554035972.git.lorenzo@kernel.org>
+From: Lorenzo Bianconi <lorenzo@kernel.org>
+Date: Sun, 31 Mar 2019 14:38:49 +0200
+Subject: [PATCH] ath: dynack: set max timeout according to clockrate
+
+Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
+---
+ drivers/net/wireless/ath/ath9k/dynack.c | 36 ++++++++++++++++++-------
+ 1 file changed, 26 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c
+index f112fa5b2eac..0627111249dd 100644
+--- a/drivers/net/wireless/ath/ath9k/dynack.c
++++ b/drivers/net/wireless/ath/ath9k/dynack.c
+@@ -20,11 +20,24 @@
+
+ #define COMPUTE_TO (5 * HZ)
+ #define LATEACK_DELAY (10 * HZ)
+-#define LATEACK_TO 256
+-#define MAX_DELAY 300
+ #define EWMA_LEVEL 96
+ #define EWMA_DIV 128
+
++/**
++ * ath_dynack_get_max_to - set max timeout according to clockrate
++ * @ah: ath hw
++ *
++ */
++static u32 ath_dynack_get_max_to(struct ath_hw *ah)
++{
++ struct ath_common *common = ath9k_hw_common(ah);
++
++ if (common->clockrate)
++ return AR_TIME_OUT_ACK / common->clockrate;
++
++ return 300;
++}
++
+ /**
+ * ath_dynack_ewma - EWMA (Exponentially Weighted Moving Average) calculation
+ *
+@@ -116,15 +129,16 @@ static void ath_dynack_compute_ackto(struct ath_hw *ah)
+ */
+ static void ath_dynack_compute_to(struct ath_hw *ah)
+ {
+- u32 ackto, ack_ts;
+- u8 *dst, *src;
++ struct ath_dynack *da = &ah->dynack;
++ u32 ackto, ack_ts, max_to;
+ struct ieee80211_sta *sta;
+- struct ath_node *an;
+ struct ts_info *st_ts;
+- struct ath_dynack *da = &ah->dynack;
++ struct ath_node *an;
++ u8 *dst, *src;
+
+ rcu_read_lock();
+
++ max_to = ath_dynack_get_max_to(ah);
+ while (da->st_rbf.h_rb != da->st_rbf.t_rb &&
+ da->ack_rbf.h_rb != da->ack_rbf.t_rb) {
+ ack_ts = da->ack_rbf.tstamp[da->ack_rbf.h_rb];
+@@ -140,7 +154,7 @@ static void ath_dynack_compute_to(struct ath_hw *ah)
+ if (ack_ts > st_ts->tstamp + st_ts->dur) {
+ ackto = ack_ts - st_ts->tstamp - st_ts->dur;
+
+- if (ackto < MAX_DELAY) {
++ if (ackto < max_to) {
+ sta = ieee80211_find_sta_by_ifaddr(ah->hw, dst,
+ src);
+ if (sta) {
+@@ -197,11 +211,13 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
+ if (ieee80211_is_assoc_req(hdr->frame_control) ||
+ ieee80211_is_assoc_resp(hdr->frame_control) ||
+ ieee80211_is_auth(hdr->frame_control)) {
++ u32 max_to = ath_dynack_get_max_to(ah);
++
+ ath_dbg(common, DYNACK, "late ack\n");
+
+- ath9k_hw_setslottime(ah, (LATEACK_TO - 3) / 2);
+- ath9k_hw_set_ack_timeout(ah, LATEACK_TO);
+- ath9k_hw_set_cts_timeout(ah, LATEACK_TO);
++ ath9k_hw_setslottime(ah, (max_to - 3) / 2);
++ ath9k_hw_set_ack_timeout(ah, max_to);
++ ath9k_hw_set_cts_timeout(ah, max_to);
+ if (sta) {
+ struct ath_node *an;
+
+--
+2.20.1