ath11k_nss: modularize nss-pbuf options

The following options can now be specified in `pbuf` uci config.

1.) auto_scale (bool) - enable or disable NSS CPU auto-scaling.
                        default: 'off'.

                        NOTE: Recommended to leave off, as it locks
                        NSS core to it's full 1.7Ghz speed. In the past
                        auto_scaling has been unstable, often causing
                        kernel panics or connection drops. Qualcomm
                        themselves disables scaling in QSDK for
                        ath11k/ath12k/qca-wifi.

                        It is provided to allow users wanting more
                        control over power usage. Setting to 'on' also
                        fixes NSS CPU stats updating properly.

2.) n2h_queue_limit_core0 (int) - set queue limits for CORE 0 and 1.
                                  default: '2048'

                                  For users on low memory systems (<=512M),
                                  that are experiencing issues can try lowering
                                  to the driver default of '256'.
This commit is contained in:
Sean Khan 2024-06-22 18:06:12 -04:00
parent a1188f7457
commit 2dd320aedd
2 changed files with 17 additions and 10 deletions

View File

@ -1,4 +1,5 @@
config general opt
option auto_scale 'off'
# option memory_profile 'off'
option memory_profile 'auto'
# option memory_profile '1gb'

View File

@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common
#
# shellcheck disable=3043
# 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
@ -23,22 +23,24 @@ apply_sysctl() {
# can't be changed if it is allocated, assume it's already been run.
if [ "$(sysctl -n -e dev.nss.n2hcfg.extra_pbuf_core0)" -eq 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
sysctl -w dev.nss.n2hcfg.extra_pbuf_core0="$extra_pbuf_core0" > /dev/null 2>&1
else
logger -t ath11k_nss "Sysctl key 'extra_pbuf_core0' already set to '""$extra_pbuf_core0""'. Skipping applying wifi nss configs"
fi
sysctl -w dev.nss.n2hcfg.n2h_high_water_core0="$n2h_high_water_core0" > /dev/null 2>/dev/null
sysctl -w dev.nss.n2hcfg.n2h_high_water_core0="$n2h_high_water_core0" > /dev/null 2>&1
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"
sysctl -w dev.nss.n2hcfg.n2h_wifi_pool_buf="$n2h_wifi_pool_buf" > /dev/null 2>&1
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"
sysctl -w dev.nss.n2hcfg.n2h_high_water_core0="$n2h_high_water_core0" > /dev/null 2>&1
}
apply_nss_config() {
local auto_scale n2h_queue_limit_core0 n2h_queue_limit_core1
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
@ -56,13 +58,17 @@ apply_nss_config() {
exit 1
}
# Lock NSS clock to highest setting
sysctl -w dev.nss.clock.auto_scale=0 > /dev/null 2> /dev/null
config_load pbuf
config_get_bool auto_scale opt auto_scale 0
config_get n2h_queue_limit_core0 opt n2h_queue_limit_core0 2048
config_get n2h_queue_limit_core1 opt n2h_queue_limit_core1 2048
sysctl -w dev.nss.n2hcfg.n2h_queue_limit_core0=2048 > /dev/null 2> /dev/null
sysctl -w dev.nss.n2hcfg.n2h_queue_limit_core1=2048 > /dev/null 2> /dev/null
sysctl -w dev.nss.clock.auto_scale="$auto_scale" > /dev/null 2>&1
sysctl -w dev.nss.rps.hash_bitmap=15 > /dev/null 2> /dev/null
sysctl -w dev.nss.n2hcfg.n2h_queue_limit_core0="$n2h_queue_limit_core0" > /dev/null 2>&1
sysctl -w dev.nss.n2hcfg.n2h_queue_limit_core1="$n2h_queue_limit_core1" > /dev/null 2>&1
sysctl -w dev.nss.rps.hash_bitmap=15 > /dev/null 2>&1
local memory_profile
if memory_profile=$(uci_get pbuf.opt.memory_profile); then