diff --git a/package/base-files/files/etc/hotplug.d/net/00-sysctl b/package/base-files/files/etc/hotplug.d/net/00-sysctl index 17e5775e04..8abe7f8bbd 100644 --- a/package/base-files/files/etc/hotplug.d/net/00-sysctl +++ b/package/base-files/files/etc/hotplug.d/net/00-sysctl @@ -6,6 +6,4 @@ if [ "$ACTION" = add ]; then sed -ne "/^[[:space:]]*net\..*\.$DEVICENAME\./p" "$CONF" | \ sysctl -e -p - | logger -t sysctl done - - [ -f /sbin/smp.sh ] && /sbin/smp.sh fi diff --git a/package/mtk/applications/mtk-smp/Makefile b/package/mtk/applications/mtk-smp/Makefile new file mode 100644 index 0000000000..20f1067e76 --- /dev/null +++ b/package/mtk/applications/mtk-smp/Makefile @@ -0,0 +1,30 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mtk-smp +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/mtk-smp + SECTION:=MTK Properties + CATEGORY:=MTK Properties + TITLE:=Setup mtk smp settings + SUBMENU:=Applications +endef + +define Build/Compile +endef + +define Package/mtk-smp/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/smp.sh $(1)/sbin/ + $(INSTALL_BIN) ./files/mtk_smp.init $(1)/etc/init.d/mtk_smp +endef + +$(eval $(call BuildPackage,mtk-smp)) diff --git a/package/mtk/applications/mtk-smp/files/mtk_smp.init b/package/mtk/applications/mtk-smp/files/mtk_smp.init new file mode 100644 index 0000000000..0b041a9295 --- /dev/null +++ b/package/mtk/applications/mtk-smp/files/mtk_smp.init @@ -0,0 +1,8 @@ +#!/bin/sh /etc/rc.common + +START=99 +USE_PROCD=1 + +start_service() { + /sbin/smp.sh +} diff --git a/target/linux/mediatek/base-files/sbin/smp.sh b/package/mtk/applications/mtk-smp/files/smp.sh similarity index 98% rename from target/linux/mediatek/base-files/sbin/smp.sh rename to package/mtk/applications/mtk-smp/files/smp.sh index 86036861bb..5902638cfd 100755 --- a/target/linux/mediatek/base-files/sbin/smp.sh +++ b/package/mtk/applications/mtk-smp/files/smp.sh @@ -34,6 +34,7 @@ MT7986_whnat() PCIe0= eth_tx=229 eth_rx0=230 + usb=205 if [ -d "/proc/warp_ctrl/warp0" ]; then wifi1_irq=237 wifi2_irq=237 @@ -51,7 +52,7 @@ MT7986_whnat() if [ "$num_of_wifi" = "0" ]; then CPU0_AFFINITY="$eth_rx0" CPU1_AFFINITY="$eth_tx" - CPU2_AFFINITY="" + CPU2_AFFINITY="$usb" CPU3_AFFINITY="" CPU0_RPS="" @@ -61,7 +62,7 @@ MT7986_whnat() elif [ "$num_of_wifi" = "1" ]; then CPU0_AFFINITY="$eth_rx0" CPU1_AFFINITY="$eth_tx" - CPU2_AFFINITY="" + CPU2_AFFINITY="$usb" CPU3_AFFINITY="$wifi1_irq" CPU0_RPS=" $wifi1 $wifi1_apcli0" @@ -71,7 +72,7 @@ MT7986_whnat() elif [ "$num_of_wifi" = "2" ]; then CPU0_AFFINITY="$eth_rx0" CPU1_AFFINITY="$eth_tx" - CPU2_AFFINITY="" + CPU2_AFFINITY="$usb" CPU3_AFFINITY="$wifi1_irq $wifi2_irq" CPU0_RPS=" $wifi1 $wifi2 $wifi1_apcli0 $wifi2_apcli0" @@ -81,7 +82,7 @@ MT7986_whnat() elif [ "$num_of_wifi" = "3" ]; then CPU0_AFFINITY="$eth_tx $eth_rx0" CPU1_AFFINITY="$wifi1_irq $wifi2_irq" - CPU2_AFFINITY="$PCIe0 $wifi3_irq" + CPU2_AFFINITY="$PCIe0 $wifi3_irq $usb" CPU3_AFFINITY="" CPU0_RPS="" @@ -210,6 +211,7 @@ MT7981_whnat() PCIe0= eth_tx=229 eth_rx0=230 + usb=205 if [ -d "/proc/warp_ctrl/warp0" ]; then wifi1_irq=237 wifi2_irq=237 @@ -226,25 +228,25 @@ MT7981_whnat() dbg "[MT7981_whnat]" if [ "$num_of_wifi" = "0" ]; then CPU0_AFFINITY="$eth_rx0" - CPU1_AFFINITY="$eth_tx" + CPU1_AFFINITY="$eth_tx $usb" CPU0_RPS="" CPU1_RPS="$ethif1 $ethif2" elif [ "$num_of_wifi" = "1" ]; then CPU0_AFFINITY="$eth_tx $eth_rx0" - CPU1_AFFINITY="$wifi1_irq" + CPU1_AFFINITY="$wifi1_irq $usb" CPU0_RPS="$ethif1 $ethif2 $wifi1 $wifi1_apcli0" CPU1_RPS=" $wifi1 $wifi1_apcli0" elif [ "$num_of_wifi" = "2" ]; then CPU0_AFFINITY="$eth_tx $eth_rx0" - CPU1_AFFINITY="$wifi1_irq $wifi2_irq" + CPU1_AFFINITY="$wifi1_irq $wifi2_irq $usb" CPU0_RPS="$ethif1 $ethif2 $wifi1 $wifi2 $wifi1_apcli0 $wifi2_apcli0" CPU1_RPS=" $wifi1 $wifi2 $wifi1_apcli0 $wifi2_apcli0" elif [ "$num_of_wifi" = "3" ]; then CPU0_AFFINITY="$eth_tx $eth_rx0" - CPU1_AFFINITY="$PCIe0 $wifi1_irq $wifi2_irq $wifi3_irq" + CPU1_AFFINITY="$PCIe0 $wifi1_irq $wifi2_irq $wifi3_irq $usb" CPU0_RPS="$ethif1 $ethif2 $wifi1 $wifi2 $wifi3 $wifi1_apcli0 $wifi2_apcli0 $wifi3_apcli0" CPU1_RPS=" $wifi1 $wifi2 $wifi3 $wifi1_apcli0 $wifi2_apcli0 $wifi3_apcli0" @@ -708,6 +710,8 @@ setup_model() num_of_wifi=$(get_wifi_num) mt_whnat_en=$(module_exist "mt_whnat") + logger -t "mtk_smp" "board=${board}, wifi_num=${num_of_wifi}, cpu_num=${NUM_OF_CPU}" + case $board in xiaomi,redmi-router-ax6000* |\ bananapi,bpi-r3mini* |\ diff --git a/target/linux/mediatek/Makefile b/target/linux/mediatek/Makefile index e0d876683a..7a1d156c3c 100644 --- a/target/linux/mediatek/Makefile +++ b/target/linux/mediatek/Makefile @@ -14,6 +14,6 @@ KERNEL_TESTING_PATCHVER:=5.4 include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ kmod-leds-gpio kmod-gpio-button-hotplug \ - autocore-arm uboot-envtools + autocore-arm uboot-envtools mtk-smp $(eval $(call BuildTarget))