luci-app-mtk/wifi-profile: add support for KickStaRssiLow and AssocReqRssiThres

This commit is contained in:
hanwckf 2023-12-05 22:54:33 +08:00
parent 5b1a7d3b24
commit 225db6977a
5 changed files with 57 additions and 0 deletions

View File

@ -781,6 +781,8 @@ function __update_mbss_para(cfgs, vif_idx)
cfgs.RRMEnable = mtkwifi.token_set(cfgs.RRMEnable, vif_idx, http.formvalue("__rrmenable") or "0")
cfgs.APSDCapable = mtkwifi.token_set(cfgs.APSDCapable, vif_idx, http.formvalue("__apsd_capable") or "0")
cfgs.FragThreshold = mtkwifi.token_set(cfgs.FragThreshold, vif_idx, http.formvalue("__frag_threshold") or "0")
cfgs.KickStaRssiLow = mtkwifi.token_set(cfgs.KickStaRssiLow, vif_idx, http.formvalue("__kickrssi") or "0")
cfgs.AssocReqRssiThres = mtkwifi.token_set(cfgs.AssocReqRssiThres, vif_idx, http.formvalue("__assocthres") or "0")
cfgs.RTSThreshold = mtkwifi.token_set(cfgs.RTSThreshold, vif_idx, http.formvalue("__rts_threshold") or "0")
cfgs.VHT_SGI = mtkwifi.token_set(cfgs.VHT_SGI, vif_idx, http.formvalue("__vht_sgi") or "0")
cfgs.VHT_BW_SIGNAL = mtkwifi.token_set(cfgs.VHT_BW_SIGNAL, vif_idx, http.formvalue("__vht_bw_signal") or "0")

View File

@ -499,6 +499,18 @@ function hi(to, devname, vifname)
<input name="__rts_threshold" id="RTSThreshold" value="<%=vif.__rts_threshold or 2347%>" />
</td>
</tr>
<tr>
<td><%:Kick STA Threshold%> (-100-0)</td>
<td>
<input name="__kickrssi" id="KickStaRssiLow" value="<%=vif.__kickrssi or 0%>" />
</td>
</tr>
<tr>
<td><%:STA Assoc Threshold%> (-100-0)</td>
<td>
<input name="__assocthres" id="AssocReqRssiThres" value="<%=vif.__assocthres or 0%>" />
</td>
</tr>
<tr>
<td><%:VHT Short GI%></td>
<td>
@ -1223,6 +1235,20 @@ function hi(to, devname, vifname)
document.getElementById("RTSThreshold").select();
return false;
}
tmpVal = document.getElementById("KickStaRssiLow").value;
if(isNaN(tmpVal) || parseInt(tmpVal) < -100 || parseInt(tmpVal) > 0){
alert("Kick STA Threshold is incorrect!\nPlease enter an integer number between -100 to 0 inclusive.");
document.getElementById("KickStaRssiLow").focus();
document.getElementById("KickStaRssiLow").select();
return false;
}
tmpVal = document.getElementById("AssocReqRssiThres").value;
if(isNaN(tmpVal) || parseInt(tmpVal) < -100 || parseInt(tmpVal) > 0){
alert("STA Assoc Threshold is incorrect!\nPlease enter an integer number between -100 to 0 inclusive.");
document.getElementById("AssocReqRssiThres").focus();
document.getElementById("AssocReqRssiThres").select();
return false;
}
return true;
}

View File

@ -507,3 +507,9 @@ msgstr "启用此无线设备"
msgid "Wireless device is disabled"
msgstr "无线设备已禁用"
msgid "Kick STA Threshold"
msgstr "弱信号剔除阈值"
msgid "STA Assoc Threshold"
msgstr "弱信号接入阈值"

View File

@ -1198,6 +1198,8 @@ function mtkwifi.__setup_vifs(cfgs, devname, mainidx, subidx)
vifs[j].__rrmenable = mtkwifi.token_get(cfgs.RRMEnable, j, mtkwifi.__split(cfgs.RRMEnable,";")[1])
vifs[j].__apsd_capable = mtkwifi.token_get(cfgs.APSDCapable, j, mtkwifi.__split(cfgs.APSDCapable,";")[1])
vifs[j].__frag_threshold = mtkwifi.token_get(cfgs.FragThreshold, j, mtkwifi.__split(cfgs.FragThreshold,";")[1])
vifs[j].__kickrssi = mtkwifi.token_get(cfgs.KickStaRssiLow, j, mtkwifi.__split(cfgs.KickStaRssiLow,";")[1])
vifs[j].__assocthres = mtkwifi.token_get(cfgs.AssocReqRssiThres, j, mtkwifi.__split(cfgs.AssocReqRssiThres,";")[1])
vifs[j].__rts_threshold = mtkwifi.token_get(cfgs.RTSThreshold, j, mtkwifi.__split(cfgs.RTSThreshold,";")[1])
vifs[j].__vht_sgi = mtkwifi.token_get(cfgs.VHT_SGI, j, mtkwifi.__split(cfgs.VHT_SGI,";")[1])
vifs[j].__vht_bw_signal = mtkwifi.token_get(cfgs.VHT_BW_SIGNAL, j, mtkwifi.__split(cfgs.VHT_BW_SIGNAL,";")[1])

View File

@ -105,6 +105,25 @@ function d8021xd_chk(devname, prefix, vif, enable)
end
end
function __exec_iwpriv_cmd(ifname, key, val)
local cmd = string.format("iwpriv %s set %s=%s", ifname, key, tostring(val))
nixio.syslog("info", "wifi-profile: iwpriv cmd: "..cmd)
os.execute(cmd)
end
function mtwifi_iwpriv_hook(devname)
local mtkwifi = require("mtkwifi")
local devs = mtkwifi.get_all_devs()
local dev = devs[devname]
if dev then
for _,vif in ipairs(dev.vifs) do
__exec_iwpriv_cmd(vif.vifname, "KickStaRssiLow", vif.__kickrssi or "0")
__exec_iwpriv_cmd(vif.vifname, "AssocReqRssiThres", vif.__assocthres or "0")
end
end
end
function mtwifi_up(devname)
local nixio = require("nixio")
local mtkwifi = require("mtkwifi")
@ -200,6 +219,8 @@ function mtwifi_up(devname)
nixio.syslog("debug", "mtwifi_up: skip "..devname..", config(l1profile) not exist")
end
mtwifi_iwpriv_hook(devname)
os.execute(" rm -rf /tmp/mtk/wifi/mtwifi*.need_reload")
end