qca-nss-drv: Rework smp_affinity logic

Reworked flawed smp_affinity logic. It was assumed that all 'nss_*' IRQs
needed to be equally balanced across all CPUs. However, what ends up
happening most of the time is messing with scheduling, thrashing, missed
cache and high context switching.

For each core:
  1. nss_empty_buf_sos
  2. nss_empty_buf_queue
  3. nss_queue0

The IRQs should be kept on the same CPU. Doing so allows NSS cores to
properly feed and empty the queues.

Signed-off-by: Sean Khan <datapronix@protonmail.com>
This commit is contained in:
Sean Khan 2024-07-02 20:44:35 -04:00
parent 16716f0305
commit 07cee3d981
2 changed files with 15 additions and 27 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=qca-nss-drv PKG_NAME:=qca-nss-drv
PKG_RELEASE:=5 PKG_RELEASE:=6
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-drv.git PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-drv.git
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git

View File

@ -1,20 +1,6 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
# vim: set syn=bash # vim: set syn=bash
# shellcheck disable=2155,3010,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
# 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=94 START=94
PROG="qca-nss-drv" PROG="qca-nss-drv"
@ -106,32 +92,34 @@ set_affinity() {
enable_rps() { enable_rps() {
# NSS Core 0 : 4 nss queues to each core # NSS Core 0 : 4 nss queues to each core
set_affinity "nss_queue0" 1 1 set_affinity "nss_queue0" 0-3 1
set_affinity "nss_queue1" 2 1 set_affinity "nss_queue1" 1 1
set_affinity "nss_queue2" 3 1 set_affinity "nss_queue2" 2 1
set_affinity "nss_queue3" 0 1 set_affinity "nss_queue3" 3 1
# NSS Core 1 : 1 nss queue to 3rd core # NSS Core 1 : 1 nss queue to 3rd core
set_affinity "nss_queue0" 2 2 set_affinity "nss_queue0" 3 2
# NSS Core 0 : 2 nss sos/queues to last core # NSS Core 0 : 2 nss sos/queues to last core
set_affinity "nss_empty_buf_sos" 3 1 set_affinity "nss_empty_buf_sos" 0-3 1
set_affinity "nss_empty_buf_queue" 3 1 set_affinity "nss_empty_buf_queue" 0-3 1
# NSS Core 1 : 1 nss sos to last core # NSS Core 1 : 1 nss sos to last core
set_affinity "nss_empty_buf_sos" 2 2 set_affinity "nss_empty_buf_sos" 3 2
# USB 3.0 : pin to 3rd core # USB 3.0 : pin to 3rd core
set_affinity "xhci-hcd:usb1" 2 1 set_affinity "xhci-hcd:usb1" 1,3 1
# TCL Completion, REO Dest, ERR, Exception and h2rxdma # TCL Completion, REO Dest, ERR, Exception and h2rxdma
# are offloaded, so balance remaining IRQs accordingly. # are offloaded, so balance remaining IRQs accordingly.
# PPDU IRQ : pin to 2nd and 3rd core # PPDU IRQ : pin to 2nd and 3rd core
set_affinity 'ppdu-end-interrupts-mac1' 1 1 set_affinity 'ppdu-end-interrupts-mac1' 1 1
set_affinity 'ppdu-end-interrupts-mac3' 2 1 set_affinity 'ppdu-end-interrupts-mac3' 2 1
set_affinity 'ath10k_pci' 0-3 1
# Enable NSS RPS # Enable NSS RPS
sysctl -w dev.nss.rps.enable=1 > /dev/null 2> /dev/null sysctl -w dev.nss.rps.enable=1 >/dev/null 2>&1
} }
start() { start() {