From 571dbf6251040b8b376a2f1b908173045d032aac Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Sat, 11 Feb 2023 11:44:10 -0800 Subject: [PATCH] Disable RTS by default in ath10k devices 02/11/2023 (#706) --- files/etc/uci-defaults/80_aredn_lqm | 2 +- files/usr/local/bin/mgr/lqm.lua | 25 ++++++++++++++++++------- files/www/cgi-bin/advancedconfig | 4 ++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/files/etc/uci-defaults/80_aredn_lqm b/files/etc/uci-defaults/80_aredn_lqm index 4904986b..e130e3be 100755 --- a/files/etc/uci-defaults/80_aredn_lqm +++ b/files/etc/uci-defaults/80_aredn_lqm @@ -7,7 +7,7 @@ do option enable '0' option min_snr '15' option margin_snr '1' - option rts_theshold '1' + option rts_threshold '1' option min_distance '0' option max_distance '80467' option min_quality '50' diff --git a/files/usr/local/bin/mgr/lqm.lua b/files/usr/local/bin/mgr/lqm.lua index 6189f718..74b22f8a 100755 --- a/files/usr/local/bin/mgr/lqm.lua +++ b/files/usr/local/bin/mgr/lqm.lua @@ -62,7 +62,7 @@ function get_config() return { margin = tonumber(c:get("aredn", "@lqm[0]", "margin_snr")), low = tonumber(c:get("aredn", "@lqm[0]", "min_snr")), - rts_theshold = tonumber(c:get("aredn", "@lqm[0]", "rts_theshold") or "1"), + rts_threshold = tonumber(c:get("aredn", "@lqm[0]", "rts_threshold") or "1"), min_distance = tonumber(c:get("aredn", "@lqm[0]", "min_distance")), max_distance = tonumber(c:get("aredn", "@lqm[0]", "max_distance")), auto_distance = tonumber(c:get("aredn", "@lqm[0]", "auto_distance") or "0"), @@ -227,6 +227,12 @@ function lqm() -- Let things startup for a while before we begin wait_for_ticks(math.max(1, 30 - nixio.sysinfo().uptime)) + -- Detect ath10k - we need some special handling (for the moment) + local is_ath10k = false + if nixio.fs.stat("/sys/kernel/debug/ieee80211/" .. phy .. "/ath10k") then + is_ath10k = true + end + -- Create filters (cannot create during install as they disappear on reboot) os.execute(NFT .. " flush chain ip fw4 input_lqm 2> /dev/null") os.execute(NFT .. " delete chain ip fw4 input_lqm 2> /dev/null") @@ -240,7 +246,9 @@ function lqm() -- We dont know any distances yet os.execute(IW .. " " .. phy .. " set distance auto > /dev/null 2>&1") -- Or any hidden nodes - os.execute(IW .. " " .. phy .. " set rts off > /dev/null 2>&1") + if not is_ath10k then + os.execute(IW .. " " .. phy .. " set rts off > /dev/null 2>&1") + end local noise = -95 local tracker = {} @@ -887,11 +895,14 @@ function lqm() do hidden[#hidden + 1] = ninfo end - if (#hidden == 0) ~= (#hidden_nodes == 0) and config.rts_theshold >= 0 and config.rts_theshold <= 2347 then - if #hidden > 0 then - os.execute(IW .. " " .. phy .. " set rts " .. config.rts_theshold .. " > /dev/null 2>&1") - else - os.execute(IW .. " " .. phy .. " set rts off > /dev/null 2>&1") + -- Don't adjust RTS on ath10k for the moment - appear to be some bug to be worked out here + if not is_ath10k then + if (#hidden == 0) ~= (#hidden_nodes == 0) and config.rts_threshold >= 0 and config.rts_threshold <= 2347 then + if #hidden > 0 then + os.execute(IW .. " " .. phy .. " set rts " .. config.rts_threshold .. " > /dev/null 2>&1") + else + os.execute(IW .. " " .. phy .. " set rts off > /dev/null 2>&1") + end end end hidden_nodes = hidden diff --git a/files/www/cgi-bin/advancedconfig b/files/www/cgi-bin/advancedconfig index 4e4a220d..14c661fd 100755 --- a/files/www/cgi-bin/advancedconfig +++ b/files/www/cgi-bin/advancedconfig @@ -134,9 +134,9 @@ local settings = { }, { category = "Link Quality Settings", - key = "aredn.@lqm[0].rts_theshold", + key = "aredn.@lqm[0].rts_threshold", type = "string", - desc = "RTS Threshold in bytes before using RTS/CTS when hidden nodes are detected

aredn.@lqm[0].rts_theshold", + desc = "RTS Threshold in bytes before using RTS/CTS when hidden nodes are detected

aredn.@lqm[0].rts_threshold", default = "1", condition = "lqm_enabled()" },