From a45860ddc18d3e5f83f86e7a35b7c0a8a7555062 Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Mon, 29 Aug 2022 01:02:57 +0800 Subject: [PATCH 1/4] fix --- .../etc/hotplug.d/net/21_adjust_network | 7 ++ .../base-files/etc/init.d/adjust_network | 19 ++++ .../ipq40xx/base-files/lib/adjust_network.sh | 89 +++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 root/target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network create mode 100644 root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network create mode 100644 root/target/linux/ipq40xx/base-files/lib/adjust_network.sh diff --git a/root/target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network b/root/target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network new file mode 100644 index 00000000..7aa4f6f7 --- /dev/null +++ b/root/target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network @@ -0,0 +1,7 @@ +#!/bin/sh + +[ -f /lib/adjust_network.sh ] && { + . /lib/adjust_network.sh + + adjust_eth_queue +} diff --git a/root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network b/root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network new file mode 100644 index 00000000..02af8198 --- /dev/null +++ b/root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network @@ -0,0 +1,19 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=11 +STOP=98 + +adjust_smp_affinity() { + test -f /lib/adjust_network.sh && { + . /lib/adjust_network.sh + + adjust_eth_queue + adjust_edma_smp_affinity + adjust_radio_smp_affinity + } +} + +boot() { + adjust_smp_affinity +} diff --git a/root/target/linux/ipq40xx/base-files/lib/adjust_network.sh b/root/target/linux/ipq40xx/base-files/lib/adjust_network.sh new file mode 100644 index 00000000..99423022 --- /dev/null +++ b/root/target/linux/ipq40xx/base-files/lib/adjust_network.sh @@ -0,0 +1,89 @@ +#!/bin/sh +# this scripts is used for adjust cpu's choice of interrupts. +# + +################################################ +# Adjust smp_affinity of edma +# Globals: +# None +# Arguments: +# None +# Returns: +# None +# Remark: +# execute only once on start-up. +################################################ +adjust_edma_smp_affinity() { + grep -q edma_eth_ /proc/interrupts || return 0 + local nr=`cat /proc/cpuinfo | grep processor | wc -l` + local cpu=0 + local tx_irq_num + + for tx_num in `seq 0 1 15` ; do + cpu=`printf "%x" $((1<<((tx_num/4+0)%nr)))` + tx_irq_num=`grep -m1 edma_eth_tx$tx_num /proc/interrupts | cut -d ':' -f 1 | tail -n1 | tr -d ' '` + [ -n "$tx_irq_num" ] && echo $cpu > /proc/irq/$tx_irq_num/smp_affinity + done + + for rx_num in `seq 0 1 7` ; do + cpu=`printf "%x" $((1<<((rx_num/2)%nr)))` + rx_irq_num=`grep -m1 edma_eth_rx$rx_num /proc/interrupts | cut -d ':' -f 1 | tail -n1 | tr -d ' '` + [ -n "$rx_irq_num" ] && echo $cpu > /proc/irq/$rx_irq_num/smp_affinity + done +} + +################################################ +# Adjust smp_affinity of ath10k for 2G and 5G +# Globals: +# None +# Arguments: +# None +# Returns: +# None +# Remark: +# execute only once on start-up. +################################################ +adjust_radio_smp_affinity() { + local irqs="`grep -E 'ath10k' /proc/interrupts | cut -d ':' -f 1 | tr -d ' '`" + local nr=`cat /proc/cpuinfo | grep processor | wc -l` + local idx=2 + + for irq in $irqs; do + cpu=`printf "%x" $((1<<((idx)%nr)))` + echo $cpu > /proc/irq/$irq/smp_affinity + idx=$((idx+1)) + done +} + +################################################ +# Adjust queue of eth +# Globals: +# None +# Arguments: +# None +# Returns: +# None +# Remark: +# Each network reboot needs to be executed. +################################################ +adjust_eth_queue() { + local nr=`cat /proc/cpuinfo | grep processor | wc -l` + local idx=0 + + for epath in /sys/class/net/eth[0-9]*; do + test -e $epath || break + echo $epath | grep -q "\." && continue + eth=`basename $epath` + idx=0 + for exps in /sys/class/net/$eth/queues/rx-[0-9]*/rps_cpus; do + test -e $exps || break + cpu=`printf "%x" $((1<<((idx+1)%nr)))` + idx=$((idx+1)) + echo $cpu > $exps + echo 256 > `dirname $exps`/rps_flow_cnt + done + which ethtool >/dev/null 2>&1 && ethtool -K $eth gro off + done + + echo 1024 > /proc/sys/net/core/rps_sock_flow_entries +} From 821e5fe524bfc75935f644ea643fd55e30910293 Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Tue, 6 Sep 2022 04:18:16 +0800 Subject: [PATCH 2/4] fixfix --- config-5gx3 | 3 +++ config-l1000 | 3 +++ config-zbt4019 | 3 +++ root/target/linux/ipq40xx/config-5.4 | 3 +++ 4 files changed, 12 insertions(+) diff --git a/config-5gx3 b/config-5gx3 index 28cee5e3..fa7bbd40 100755 --- a/config-5gx3 +++ b/config-5gx3 @@ -2,6 +2,9 @@ # Automatically generated file; DO NOT EDIT. # OpenWrt Configuration # +CONFIG_ARM_MODULE_PLTS=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y CONFIG_MODULES=y CONFIG_HAVE_DOT_CONFIG=y # CONFIG_TARGET_sunxi is not set diff --git a/config-l1000 b/config-l1000 index 09766712..15ece074 100755 --- a/config-l1000 +++ b/config-l1000 @@ -2,6 +2,9 @@ # Automatically generated file; DO NOT EDIT. # OpenWrt Configuration # +CONFIG_ARM_MODULE_PLTS=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y CONFIG_MODULES=y CONFIG_HAVE_DOT_CONFIG=y # CONFIG_TARGET_sunxi is not set diff --git a/config-zbt4019 b/config-zbt4019 index 4b0266d2..a208be67 100755 --- a/config-zbt4019 +++ b/config-zbt4019 @@ -2,6 +2,9 @@ # Automatically generated file; DO NOT EDIT. # OpenWrt Configuration # +CONFIG_ARM_MODULE_PLTS=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y CONFIG_MODULES=y CONFIG_HAVE_DOT_CONFIG=y # CONFIG_TARGET_sunxi is not set diff --git a/root/target/linux/ipq40xx/config-5.4 b/root/target/linux/ipq40xx/config-5.4 index 2a9fec93..cc171020 100644 --- a/root/target/linux/ipq40xx/config-5.4 +++ b/root/target/linux/ipq40xx/config-5.4 @@ -1,4 +1,7 @@ CONFIG_ALIGNMENT_TRAP=y +CONFIG_ARM_MODULE_PLTS=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y # CONFIG_APQ_GCC_8084 is not set # CONFIG_APQ_MMCC_8084 is not set CONFIG_AR40XX_PHY=y From 38952786a8dff889048885e9ccd1053007ca7e2e Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Tue, 6 Sep 2022 04:22:28 +0800 Subject: [PATCH 3/4] Update qcom-ipq4019-z4019.dts --- .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-z4019.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-z4019.dts b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-z4019.dts index c89e9c30..da4dae9c 100755 --- a/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-z4019.dts +++ b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-z4019.dts @@ -39,7 +39,7 @@ memory { device_type = "memory"; - reg = <0x80000000 0x10000000>; + reg = <0x80000000 0x20000000>; }; soc { From 2c70403d33e8d2e72d8ba965a69bc3959dfbe83f Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Fri, 16 Sep 2022 23:02:59 +0800 Subject: [PATCH 4/4] Update qcom-ipq4019-z4019.dts --- .../arch/arm/boot/dts/qcom-ipq4019-z4019.dts | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-z4019.dts b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-z4019.dts index da4dae9c..8e91989e 100755 --- a/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-z4019.dts +++ b/root/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-z4019.dts @@ -152,6 +152,34 @@ label = "green:4g3"; gpios = <&tlmm 4 GPIO_ACTIVE_LOW>; }; + + 4gpwr { + label = "green:4gpwr"; + gpios = <&tlmm 20 GPIO_ACTIVE_LOW>; + }; + + 4g2pwr { + label = "green:4g2pwr"; + gpios = <&tlmm 8 GPIO_ACTIVE_LOW>; + }; + + 4g3pwr { + label = "green:4g3pwr"; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + }; + + 4g2sim { + label = "green:4g2sim"; + gpios = <&tlmm 0 GPIO_ACTIVE_LOW>; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&tlmm 11 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + hw_margin_ms = <6000>; + always-running; + }; }; }; @@ -279,13 +307,7 @@ bias-disable; }; }; - serial_1_pins: serial1_pinmux { - mux { - pins = "gpio8", "gpio9"; - function = "blsp_uart1"; - bias-disable; - }; - }; + power_4g_pinmux { mux { @@ -322,8 +344,8 @@ pins = "gpio0"; function = "gpio"; drive-strength = <12>; - bias-pull-down; - output-high; + bias-disable; + output-low; }; };