mirror of
https://github.com/breeze303/nss-packages.git
synced 2025-12-16 16:57:29 +00:00
qca-nss-drv: better logging + handle more IRQs + sane defaults
1.) Rather than modify upstream `smp_affinity` script, move changes into
this init script.
Primarily: "xhci-hcd:usb1", "ppdu-end-interrupts-mac1", "ppdu-end-interrupts-mac2"
2.) Move logging into separate function, and better account for NSS core
specific output.
3.) Set the defaults for `enable_rps` and `enable_log` to true ('1').
4.) Change startup to sequence to `94` [after `smp_affinity` (93)]
Signed-off-by: Qosmio <datapronix@protonmail.com>
This commit is contained in:
parent
2670f4c75a
commit
f47aab0ae0
@ -1,6 +1,6 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# vim: set syn=bash
|
||||
# shellcheck disable=2155,3019,3043,3057,3060
|
||||
# shellcheck disable=2155,3010,3019,3043,3057,3060
|
||||
# Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
@ -16,12 +16,23 @@
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
######################################################################
|
||||
|
||||
START=70
|
||||
START=94
|
||||
PROG="qca-nss-drv"
|
||||
|
||||
log_msg() {
|
||||
|
||||
local irq_name="$1" affinity="$2" occurrence="$3" irq="$4"
|
||||
|
||||
msg="$(printf "Pinning IRQ($irq) %-24s to CPU ${affinity}\n" "$irq_name")"
|
||||
|
||||
[[ $irq_name =~ "nss" ]] && msg="$msg (NSS Core $((occurrence - 1)))"
|
||||
|
||||
logger -t "$PROG" "$msg"
|
||||
}
|
||||
|
||||
######################################################################
|
||||
### Takes a comma or space separated list of CPU numbers or ranges
|
||||
## and returns a bitmask of CPUs.
|
||||
### Takes a comma, space separated, or range list of CPU numbers and
|
||||
## returns a bitmask of CPUs.
|
||||
## cpus_to_bitmask "0,1,2,3" -> f
|
||||
## cpus_to_bitmask "0 1 2 3" -> f
|
||||
## cpus_to_bitmask "0-3" -> f
|
||||
@ -75,7 +86,7 @@ bitmask_to_cpus() {
|
||||
|
||||
set_affinity() {
|
||||
|
||||
local irq_name="$1" affinity="$2" occurrence="$3" bitmask
|
||||
local irq_name="$1" affinity="$2" occurrence="${3:-1}" bitmask
|
||||
|
||||
awk -v irq_name="$irq_name" -v occurrence="$occurrence" '
|
||||
BEGIN{count=0}
|
||||
@ -86,7 +97,7 @@ set_affinity() {
|
||||
}
|
||||
}' /proc/interrupts | while read -r irq; do
|
||||
$enable_log && {
|
||||
logger -t "$PROG" "$(printf "NSS Core $((occurrence - 1)): Pinning IRQ($irq) %-19s to CPU ${affinity}\n" "$irq_name")"
|
||||
log_msg "$irq_name" "$affinity" "$occurrence" "$irq"
|
||||
}
|
||||
bitmask=$(cpus_to_bitmask "$affinity") && echo "$bitmask" > /proc/irq/"$irq"/smp_affinity
|
||||
done
|
||||
@ -108,7 +119,16 @@ enable_rps() {
|
||||
set_affinity "nss_empty_buf_queue" 3 1
|
||||
|
||||
# NSS Core 1 : 1 nss sos to last core
|
||||
set_affinity "nss_empty_buf_sos" 3 2
|
||||
set_affinity "nss_empty_buf_sos" 2 2
|
||||
|
||||
# USB 3.0 : pin to 3rd core
|
||||
set_affinity "xhci-hcd:usb1" 2 1
|
||||
|
||||
# TCL Completion, REO Dest, ERR, Exception and h2rxdma
|
||||
# are offloaded, so balance remaining IRQs accordingly.
|
||||
# PPDU IRQ : pin to 2nd and 3rd core
|
||||
set_affinity 'ppdu-end-interrupts-mac1' 1 1
|
||||
set_affinity 'ppdu-end-interrupts-mac3' 2 1
|
||||
|
||||
# Enable NSS RPS
|
||||
sysctl -w dev.nss.rps.enable=1 > /dev/null 2> /dev/null
|
||||
@ -119,8 +139,8 @@ start() {
|
||||
local enable_rps
|
||||
|
||||
config_load nss
|
||||
config_get enable_rps "general" enable_rps 0
|
||||
config_get_bool enable_log "general" enable_log 0
|
||||
config_get enable_rps "general" enable_rps 1
|
||||
config_get_bool enable_log "general" enable_log 1
|
||||
|
||||
[ "$enable_log" -eq 1 ] && enable_log=true || enable_log=false
|
||||
[ "$enable_rps" -eq 1 ] && enable_rps
|
||||
|
||||
Loading…
Reference in New Issue
Block a user