#!/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=71 [ -e /lib/ipq806x.sh ] && . /lib/ipq806x.sh type ipq806x_board_name &>/dev/null || ipq806x_board_name() { echo $(board_name) | sed 's/^\([^-]*-\)\{1\}//g' } 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 local board=$(ipq806x_board_name) local mp_512="$(ls /proc/device-tree/ | grep -rw "MP_512")" if [ "$mp_512" == "MP_512" ]; then sysctl -w dev.nss.n2hcfg.extra_pbuf_core0=3100000 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_high_water_core0=30624 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_wifi_pool_buf=8192 >/dev/null 2>/dev/null else case "$board" in ap-hk09*) sysctl -w dev.nss.n2hcfg.extra_pbuf_core0=9000000 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_high_water_core0=67392 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_wifi_pool_buf=40960 >/dev/null 2>/dev/null ;; ap-oak* | \ ap-mp* | \ ap-hk*) sysctl -w dev.nss.n2hcfg.extra_pbuf_core0=10000000 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_high_water_core0=72512 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_wifi_pool_buf=36864 >/dev/null 2>/dev/null ;; ap-cp*) sysctl -w dev.nss.n2hcfg.extra_pbuf_core0=3100000 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_high_water_core0=30528 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_wifi_pool_buf=4096 >/dev/null 2>/dev/null ;; *) #default settings sysctl -w dev.nss.n2hcfg.extra_pbuf_core0=7800000 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_high_water_core0=60176 >/dev/null 2>/dev/null sysctl -w dev.nss.n2hcfg.n2h_wifi_pool_buf=35840 >/dev/null 2>/dev/null ;; esac fi } start() { if [ -d "/sys/kernel/debug/ath11k" ]; then enable_nss_offload=$(cat /sys/module/ath11k/parameters/nss_offload) if [ "$enable_nss_offload" -eq 1 ]; then /etc/init.d/qca-nss-ecm start apply_nss_config fi if [ "$enable_nss_offload" -eq 0 ]; then /etc/init.d/qca-nss-ecm stop fi fi }