mirror of
https://github.com/breeze303/openwrt-ipq.git
synced 2025-12-17 15:01:05 +00:00
`dev.nss.n2hcfg.n2h_wifi_pool_buf` must be set BEFORE setting `dev.nss.n2hcfg.n2h_high_water_core0`, otherwise it resets the value.
91 lines
3.2 KiB
Bash
Executable File
91 lines
3.2 KiB
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
#
|
|
# Copyright (c) 2021 The Linux Foundation. All rights reserved.
|
|
# Permission to use, copy, modify, and/or distribute this software for any
|
|
# purpose with or without fee is hereby granted, provided that the above
|
|
# copyright notice and this permission notice appear in all copies.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
#
|
|
|
|
START=20
|
|
|
|
apply_sysctl() {
|
|
[ $(sysctl -n -e dev.nss.general.redirect) = "0" ] && /etc/init.d/qca-nss-ecm start
|
|
# Running this script multiple times is useless, as extra_pbuf_core0
|
|
# can't be changed if it is allocated, assume it's already been run.
|
|
extra_pbuf_core0=$(sysctl -n -e dev.nss.n2hcfg.extra_pbuf_core0)
|
|
|
|
if [ "$extra_pbuf_core0" = "0" ]; then
|
|
logger -t ath11k_nss "$board - setting dev.nss.n2hcfg.extra_pbuf_core0=$extra_pbuf_core0"
|
|
sysctl -w dev.nss.n2hcfg.extra_pbuf_core0=$extra_pbuf_core0 > /dev/null 2> /dev/null
|
|
else
|
|
logger -t ath11k_nss "Sysctl key 'extra_pbuf_core0' already set to '"$extra_pbuf_core0"'. Skipping applying wifi nss configs"
|
|
fi
|
|
|
|
logger -t ath11k_nss "$board - setting dev.nss.n2hcfg.n2h_wifi_pool_buf=$n2h_wifi_pool_buf"
|
|
sysctl -w dev.nss.n2hcfg.n2h_wifi_pool_buf=$n2h_wifi_pool_buf > /dev/null 2> /dev/null
|
|
|
|
logger -t ath11k_nss "$board - setting dev.nss.n2hcfg.n2h_high_water_core0=$n2h_high_water_core0"
|
|
sysctl -w dev.nss.n2hcfg.n2h_high_water_core0=$n2h_high_water_core0
|
|
|
|
}
|
|
|
|
apply_nss_config() {
|
|
|
|
sysctl -w dev.nss.n2hcfg.n2h_queue_limit_core0=256 > /dev/null 2> /dev/null
|
|
sysctl -w dev.nss.n2hcfg.n2h_queue_limit_core1=256 > /dev/null 2> /dev/null
|
|
|
|
board=$(board_name)
|
|
|
|
case "$board" in
|
|
# 1GB+ profile
|
|
buffalo,wxr-5950ax12 | \
|
|
dynalink,dl-wrx36 | \
|
|
edgecore,eap102 | \
|
|
linksys,mx5300 | \
|
|
linksys,mx4200v2 | \
|
|
netgear,rax120v2 | \
|
|
netgear,wax620 | \
|
|
netgear,wax630 | \
|
|
prpl,haze | \
|
|
qnap,301w | \
|
|
xiaomi,ax9000 | \
|
|
zyxel,nbg7815)
|
|
extra_pbuf_core0=9000000 n2h_high_water_core0=67392 n2h_wifi_pool_buf=40960 apply_sysctl
|
|
;;
|
|
# 512MB profile
|
|
edimax,cax1800 | \
|
|
linksys,mx4200v1 | \
|
|
xiaomi,ax3600) # 512MB profile
|
|
extra_pbuf_core0=3100000 n2h_high_water_core0=30624 n2h_wifi_pool_buf=8192 apply_sysctl
|
|
;;
|
|
# 256MB profile
|
|
netgear,wax218)
|
|
extra_pbuf_core0=3100000 n2h_high_water_core0=30258 n2h_wifi_pool_buf=4096 apply_sysctl
|
|
;;
|
|
esac
|
|
}
|
|
|
|
start() {
|
|
if [ ! -r /sys/module/ath11k/parameters/nss_offload ]; then
|
|
logger -t ath11k_nss "Module parameter '/sys/module/ath11k/parameters/nss_offload' does NOT exist. Skipping applying wifi nss configs"
|
|
exit 1
|
|
fi
|
|
|
|
enable_nss_offload=$(cat /sys/module/ath11k/parameters/nss_offload)
|
|
|
|
if [ "$enable_nss_offload" = "0" ]; then
|
|
logger -t ath11k_nss "Module parameter 'nss_offload=0'. Skipping applying wifi nss configs"
|
|
exit 1
|
|
fi
|
|
|
|
apply_nss_config
|
|
}
|