mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
fix nxh
This commit is contained in:
parent
3e7cb2bcfc
commit
6e6a6d1855
3 changed files with 275 additions and 58 deletions
205
root/target/linux/ipq40xx/base-files/etc/init.d/openwrt.sh
Executable file
205
root/target/linux/ipq40xx/base-files/etc/init.d/openwrt.sh
Executable file
|
@ -0,0 +1,205 @@
|
||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
# Copyright (C) 2006-2011 OpenWrt.org
|
||||||
|
|
||||||
|
START=99
|
||||||
|
STOP=98
|
||||||
|
|
||||||
|
rps_flow_cnt=4096
|
||||||
|
core_count=$(grep -c processor /proc/cpuinfo)
|
||||||
|
rps_sock_flow_ent=`expr $core_count \* $rps_flow_cnt`
|
||||||
|
queue_cores="0 1 2"
|
||||||
|
queue_irq_cores="1 2"
|
||||||
|
wifi_core="3"
|
||||||
|
usb_core="0"
|
||||||
|
|
||||||
|
############### util functions ###############
|
||||||
|
|
||||||
|
to_hex_list() {
|
||||||
|
local cores=$1
|
||||||
|
local converted=""
|
||||||
|
for core in $(echo $cores | awk '{print}')
|
||||||
|
do
|
||||||
|
local hex="$(gen_hex_mask "$core")"
|
||||||
|
converted="$converted $hex"
|
||||||
|
done
|
||||||
|
echo `echo $converted | sed 's/^ *//'`
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_hex_mask() {
|
||||||
|
local cores=$1
|
||||||
|
local mask=0
|
||||||
|
for core in $(echo $cores | awk '{print}')
|
||||||
|
do
|
||||||
|
local bit="$((1 << $core))"
|
||||||
|
let "mask = mask + bit"
|
||||||
|
done
|
||||||
|
local hex="$(printf %x "$mask")"
|
||||||
|
echo "$hex"
|
||||||
|
}
|
||||||
|
|
||||||
|
val_at_index() {
|
||||||
|
local values=$1
|
||||||
|
local idx=$2
|
||||||
|
echo `echo $values | awk -v i=$idx '{print $i}'`
|
||||||
|
}
|
||||||
|
|
||||||
|
size_of_list() {
|
||||||
|
local list=$1
|
||||||
|
local spaces=`echo $list | grep -o ' ' | wc -l`
|
||||||
|
echo `expr $spaces + 1`
|
||||||
|
}
|
||||||
|
|
||||||
|
set_core_mask() {
|
||||||
|
local file=$1
|
||||||
|
local cores=$2
|
||||||
|
local mask="$(gen_hex_mask "$cores")"
|
||||||
|
echo $mask > $file
|
||||||
|
}
|
||||||
|
|
||||||
|
set_core_mask_round() {
|
||||||
|
local files=$1
|
||||||
|
local cores=$2
|
||||||
|
local step_size=$3
|
||||||
|
[ ! -n "$3" ] && step_size=1
|
||||||
|
|
||||||
|
local core_count="$(size_of_list "$cores")"
|
||||||
|
local counter=0
|
||||||
|
local idx=1
|
||||||
|
local roof=`expr $core_count \* $step_size`
|
||||||
|
for file in $(echo $files | awk '{print}')
|
||||||
|
do
|
||||||
|
let "idx = counter / step_size + 1"
|
||||||
|
local core="$(val_at_index "$cores" $idx)"
|
||||||
|
set_core_mask $file $core
|
||||||
|
let "counter = counter + 1"
|
||||||
|
[ $counter -ge $roof ] && counter=0
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
############### assign network queues ###############
|
||||||
|
|
||||||
|
set_interface_round() {
|
||||||
|
local interface=$1
|
||||||
|
local cores=$2
|
||||||
|
local step_size=$3
|
||||||
|
[ ! -n "$3" ] && step_size=1
|
||||||
|
|
||||||
|
echo "using round mask for interface: $interface, step size: $step_size"
|
||||||
|
set_core_mask_round "$(ls /sys/class/net/$interface/queues/tx-*/xps_cpus)" "$cores" $step_size
|
||||||
|
set_core_mask_round "$(ls /sys/class/net/$interface/queues/rx-*/rps_cpus)" "$cores" $step_size
|
||||||
|
|
||||||
|
for file in /sys/class/net/$interface/queues/rx-[0-9]*/rps_flow_cnt
|
||||||
|
do
|
||||||
|
echo $rps_flow_cnt > $file
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
set_interface() {
|
||||||
|
local interface=$1
|
||||||
|
local cores=$2
|
||||||
|
|
||||||
|
echo "using cores: $cores for interface: $interface"
|
||||||
|
|
||||||
|
for file in /sys/class/net/$interface/queues/rx-[0-9]*/rps_cpus
|
||||||
|
do
|
||||||
|
set_core_mask $file "$cores"
|
||||||
|
echo $rps_flow_cnt > `dirname $file`/rps_flow_cnt
|
||||||
|
done
|
||||||
|
|
||||||
|
for file in /sys/class/net/$interface/queues/tx-[0-9]*/xps_cpus
|
||||||
|
do
|
||||||
|
set_core_mask $file "$cores"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
set_interface_queues() {
|
||||||
|
echo "using cpu: $queue_cores for network queues"
|
||||||
|
for dev in /sys/class/net/eth*
|
||||||
|
do
|
||||||
|
[ -d "$dev" ] || continue
|
||||||
|
|
||||||
|
local interface=`basename $dev`
|
||||||
|
|
||||||
|
set_interface $interface "$queue_cores"
|
||||||
|
done
|
||||||
|
|
||||||
|
for dev in /sys/class/net/wlan*
|
||||||
|
do
|
||||||
|
[ -d "$dev" ] || continue
|
||||||
|
|
||||||
|
local interface=`basename $dev`
|
||||||
|
|
||||||
|
set_interface $interface "$queue_cores"
|
||||||
|
done
|
||||||
|
|
||||||
|
for dev in /sys/class/net/eth*
|
||||||
|
do
|
||||||
|
local eth=`basename $dev`
|
||||||
|
echo "enabling offload on $eth"
|
||||||
|
ethtool -K $eth rx-checksum on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth tx-checksum-ip-generic on >/dev/null 2>&1 || (
|
||||||
|
ethtool -K $eth tx-checksum-ipv4 on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth tx-checksum-ipv6 on >/dev/null 2>&1)
|
||||||
|
ethtool -K $eth tx-scatter-gather on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth gso on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth gro on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth lro on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth tso on >/dev/null 2>&1
|
||||||
|
ethtool -K $eth ufo on >/dev/null 2>&1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $rps_sock_flow_ent > /proc/sys/net/core/rps_sock_flow_entries
|
||||||
|
sysctl -w net.core.rps_sock_flow_entries=$rps_sock_flow_ent
|
||||||
|
}
|
||||||
|
|
||||||
|
############### assign interrupts ###############
|
||||||
|
set_irq_cores() {
|
||||||
|
local mask="$(gen_hex_mask "$2")"
|
||||||
|
echo "set mask $mask for irq: $1"
|
||||||
|
echo $mask > "/proc/irq/$1/smp_affinity"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_irq_pattern() {
|
||||||
|
local name_pattern="$1"
|
||||||
|
local cores="$2"
|
||||||
|
|
||||||
|
for irq in `grep "$name_pattern" /proc/interrupts | cut -d: -f1 | sed 's, *,,'`
|
||||||
|
do
|
||||||
|
set_irq_cores $irq "$cores"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
set_irq_interleave() {
|
||||||
|
local name_pattern=$1
|
||||||
|
local cores=$2
|
||||||
|
local step_size=$3
|
||||||
|
|
||||||
|
local files=""
|
||||||
|
for irq in `grep "$name_pattern" /proc/interrupts | cut -d: -f1 | sed 's, *,,'`
|
||||||
|
do
|
||||||
|
files="$files\
|
||||||
|
/proc/irq/$irq/smp_affinity"
|
||||||
|
done
|
||||||
|
|
||||||
|
set_core_mask_round "$files" "$cores" "$step_size"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_irqs() {
|
||||||
|
#dma
|
||||||
|
set_irq_pattern bam_dma "$usb_core"
|
||||||
|
|
||||||
|
#ethernet
|
||||||
|
set_irq_interleave eth_tx "$queue_irq_cores" 4
|
||||||
|
set_irq_interleave eth_rx "$queue_irq_cores" 1
|
||||||
|
|
||||||
|
#pcie
|
||||||
|
set_irq_pattern pcie "$wifi_core"
|
||||||
|
|
||||||
|
#usb
|
||||||
|
set_irq_pattern usb "$usb_core"
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
set_interface_queues
|
||||||
|
set_irqs
|
||||||
|
}
|
|
@ -98,63 +98,47 @@
|
||||||
led_sys: status {
|
led_sys: status {
|
||||||
label = "nhx:system";
|
label = "nhx:system";
|
||||||
gpio = <&tlmm 0 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 0 GPIO_ACTIVE_HIGH>;
|
||||||
linux,default-trigger = "none";
|
|
||||||
default-state = "off";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lte1 {
|
lte1 {
|
||||||
label = "nhx:5g1";
|
label = "nhx:5g1";
|
||||||
gpio = <&tlmm 1 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 1 GPIO_ACTIVE_HIGH>;
|
||||||
linux,default-trigger = "none";
|
|
||||||
default-state = "off";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lterssi1 {
|
lterssi1 {
|
||||||
label = "nhx:5g2";
|
label = "nhx:5g2";
|
||||||
gpio = <&tlmm 2 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 2 GPIO_ACTIVE_HIGH>;
|
||||||
linux,default-trigger = "none";
|
|
||||||
default-state = "off";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lterssi2 {
|
lterssi2 {
|
||||||
label = "nhx:5g3";
|
label = "nhx:5g3";
|
||||||
gpio = <&tlmm 3 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 3 GPIO_ACTIVE_HIGH>;
|
||||||
linux,default-trigger = "none";
|
|
||||||
default-state = "off";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
lterssi3 {
|
lterssi3 {
|
||||||
label = "nhx:wifi2";
|
label = "nhx:wifi2";
|
||||||
gpio = <&tlmm 4 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 4 GPIO_ACTIVE_HIGH>;
|
||||||
linux,default-trigger = "none";
|
|
||||||
default-state = "off";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
wifi {
|
wifi {
|
||||||
label = "nhx:wifi5";
|
label = "nhx:wifi5";
|
||||||
gpio = <&tlmm 36 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 36 GPIO_ACTIVE_HIGH>;
|
||||||
linux,default-trigger = "none";
|
|
||||||
default-state = "off";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
err {
|
err {
|
||||||
label = "nhx:net";
|
label = "nhx:net";
|
||||||
gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 37 GPIO_ACTIVE_HIGH>;
|
||||||
linux,default-trigger = "none";
|
|
||||||
default-state = "off";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
net {
|
net {
|
||||||
label = "nhx:xnet";
|
label = "nhx:xnet";
|
||||||
gpio = <&tlmm 44 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 44 GPIO_ACTIVE_HIGH>;
|
||||||
linux,default-trigger = "none";
|
|
||||||
default-state = "off";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
gpio-export {
|
gpio-export {
|
||||||
compatible = "gpio-export";
|
compatible = "gpio-export";
|
||||||
pinctrl-0 = <&m2_pins>;
|
pinctrl-0 = <&power_pins>;
|
||||||
pinctrl-names = "default";
|
pinctrl-names = "default";
|
||||||
|
|
||||||
m2power {
|
m2power {
|
||||||
|
@ -169,17 +153,34 @@
|
||||||
gpio = <&tlmm 49 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 49 GPIO_ACTIVE_HIGH>;
|
||||||
};
|
};
|
||||||
|
|
||||||
wdpower {
|
m2dcpower {
|
||||||
gpio-export,name = "wdpower";
|
gpio-export,name = "m2dcpower";
|
||||||
gpio-export,output = <1>;
|
gpio-export,output = <1>;
|
||||||
gpio = <&tlmm 51 GPIO_ACTIVE_LOW>; // high enbale
|
gpio = <&tlmm 51 GPIO_ACTIVE_HIGH>;
|
||||||
};
|
};
|
||||||
|
|
||||||
wdsig {
|
pcie1dcpower {
|
||||||
gpio-export,name = "wdsig";
|
gpio-export,name = "pcie1dcpower";
|
||||||
gpio-export,output = <1>;
|
gpio-export,output = <1>;
|
||||||
gpio = <&tlmm 50 GPIO_ACTIVE_HIGH>;
|
gpio = <&tlmm 50 GPIO_ACTIVE_HIGH>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pcie1rst {
|
||||||
|
gpio-export,name = "pcie1rst";
|
||||||
|
gpio-export,output = <1>;
|
||||||
|
gpio = <&tlmm 42 GPIO_ACTIVE_HIGH>;
|
||||||
|
};
|
||||||
|
|
||||||
|
pcie2dcpower {
|
||||||
|
gpio-export,name = "pcie2dcpower";
|
||||||
|
gpio-export,output = <1>;
|
||||||
|
gpio = <&tlmm 46 GPIO_ACTIVE_HIGH>;
|
||||||
|
};
|
||||||
|
pcie2rst {
|
||||||
|
gpio-export,name = "pcie2rst";
|
||||||
|
gpio-export,output = <1>;
|
||||||
|
gpio = <&tlmm 43 GPIO_ACTIVE_HIGH>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
keys {
|
keys {
|
||||||
|
@ -426,22 +427,63 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
m2_pins: m2_pinmux {
|
power_pins: m2_pinmux {
|
||||||
mux_1 {
|
m2_pwr_en {
|
||||||
pins = "gpio48", "gpio49";
|
pins = "gpio48";
|
||||||
function = "gpio";
|
function = "gpio";
|
||||||
drive-strength = <2>;
|
drive-strength = <2>;
|
||||||
bias-none;
|
bias-none;
|
||||||
output-high;
|
output-high;
|
||||||
};
|
};
|
||||||
|
|
||||||
mux_2 {
|
m2_reset {
|
||||||
pins = "gpio50", "gpio51";
|
pins = "gpio49";
|
||||||
function = "gpio";
|
function = "gpio";
|
||||||
drive-strength = <2>;
|
drive-strength = <2>;
|
||||||
bias-none;
|
bias-none;
|
||||||
output-high;
|
output-high;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
m2_dc_en {
|
||||||
|
pins = "gpio51";
|
||||||
|
function = "gpio";
|
||||||
|
drive-strength = <2>;
|
||||||
|
bias-none;
|
||||||
|
output-high;
|
||||||
|
};
|
||||||
|
|
||||||
|
pcie1_dc_en {
|
||||||
|
pins = "gpio50";
|
||||||
|
function = "gpio";
|
||||||
|
drive-strength = <2>;
|
||||||
|
bias-none;
|
||||||
|
output-high;
|
||||||
|
};
|
||||||
|
|
||||||
|
pcie1_reset {
|
||||||
|
pins = "gpio42";
|
||||||
|
function = "gpio";
|
||||||
|
drive-strength = <2>;
|
||||||
|
bias-none;
|
||||||
|
output-high;
|
||||||
|
};
|
||||||
|
|
||||||
|
pcie2_dc_en {
|
||||||
|
pins = "gpio46";
|
||||||
|
function = "gpio";
|
||||||
|
drive-strength = <2>;
|
||||||
|
bias-none;
|
||||||
|
output-high;
|
||||||
|
};
|
||||||
|
|
||||||
|
pcie2_reset {
|
||||||
|
pins = "gpio43";
|
||||||
|
function = "gpio";
|
||||||
|
drive-strength = <2>;
|
||||||
|
bias-none;
|
||||||
|
output-high;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -453,36 +495,6 @@
|
||||||
mtd-mac-address = <&art 0x6>;
|
mtd-mac-address = <&art 0x6>;
|
||||||
};
|
};
|
||||||
|
|
||||||
ðphy0 {
|
|
||||||
qcom,single-led-1000;
|
|
||||||
qcom,single-led-100;
|
|
||||||
qcom,single-led-10;
|
|
||||||
};
|
|
||||||
|
|
||||||
ðphy1 {
|
|
||||||
qcom,single-led-1000;
|
|
||||||
qcom,single-led-100;
|
|
||||||
qcom,single-led-10;
|
|
||||||
};
|
|
||||||
|
|
||||||
ðphy2 {
|
|
||||||
qcom,single-led-1000;
|
|
||||||
qcom,single-led-100;
|
|
||||||
qcom,single-led-10;
|
|
||||||
};
|
|
||||||
|
|
||||||
ðphy3 {
|
|
||||||
qcom,single-led-1000;
|
|
||||||
qcom,single-led-100;
|
|
||||||
qcom,single-led-10;
|
|
||||||
};
|
|
||||||
|
|
||||||
ðphy4 {
|
|
||||||
qcom,single-led-1000;
|
|
||||||
qcom,single-led-100;
|
|
||||||
qcom,single-led-10;
|
|
||||||
};
|
|
||||||
|
|
||||||
&usb3_ss_phy {
|
&usb3_ss_phy {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,6 +61,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||||
+ qcom-ipq4019-u4019-32m.dtb \
|
+ qcom-ipq4019-u4019-32m.dtb \
|
||||||
+ qcom-ipq4019-wpj419.dtb \
|
+ qcom-ipq4019-wpj419.dtb \
|
||||||
+ qcom-ipq4019-wtr-m2133hp.dtb \
|
+ qcom-ipq4019-wtr-m2133hp.dtb \
|
||||||
|
+ qcom-ipq4019-nhx4019.dtb \
|
||||||
+ qcom-ipq4028-wpj428.dtb \
|
+ qcom-ipq4028-wpj428.dtb \
|
||||||
+ qcom-ipq4029-ap-303.dtb \
|
+ qcom-ipq4029-ap-303.dtb \
|
||||||
+ qcom-ipq4029-ap-303h.dtb \
|
+ qcom-ipq4029-ap-303h.dtb \
|
||||||
|
@ -70,7 +71,6 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||||
+ qcom-ipq4029-mr33.dtb \
|
+ qcom-ipq4029-mr33.dtb \
|
||||||
+ qcom-ipq4019-l1000.dtb \
|
+ qcom-ipq4019-l1000.dtb \
|
||||||
+ qcom-ipq4019-z4019.dtb \
|
+ qcom-ipq4019-z4019.dtb \
|
||||||
+ qcom-ipq4019-nhx4019.dtb \
|
|
||||||
qcom-ipq8064-ap148.dtb \
|
qcom-ipq8064-ap148.dtb \
|
||||||
qcom-msm8660-surf.dtb \
|
qcom-msm8660-surf.dtb \
|
||||||
qcom-msm8960-cdp.dtb \
|
qcom-msm8960-cdp.dtb \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue