mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
fix ipq40xx
This commit is contained in:
parent
d130b2575f
commit
7872dec617
8 changed files with 132 additions and 212 deletions
|
@ -56,6 +56,9 @@ pangu,l1000)
|
||||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wlan2g" "phy0tpt"
|
ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wlan2g" "phy0tpt"
|
||||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "blue:wlan5g" "phy1tpt"
|
ucidef_set_led_wlan "wlan5g" "WLAN5G" "blue:wlan5g" "phy1tpt"
|
||||||
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1"
|
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1"
|
||||||
|
ucidef_set_led_netdev "4g1" "4g1" "blue:4g1" "4g1"
|
||||||
|
ucidef_set_led_netdev "4g2" "4g2" "blue:4g2" "4g2"
|
||||||
|
ucidef_set_led_netdev "4g3" "4g3" "blue:4g3" "4g3"
|
||||||
;;
|
;;
|
||||||
netgear,ex6100v2 |\
|
netgear,ex6100v2 |\
|
||||||
netgear,ex6150v2)
|
netgear,ex6150v2)
|
||||||
|
|
|
@ -247,15 +247,15 @@ case "$FIRMWARE" in
|
||||||
caldata_extract "ART" 0x5000 0x2f20
|
caldata_extract "ART" 0x5000 0x2f20
|
||||||
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
|
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
|
||||||
;;
|
;;
|
||||||
|
pangu,l1000)
|
||||||
|
caldata_extract "ART" 0x5000 0x2f20
|
||||||
|
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
|
||||||
|
;;
|
||||||
meraki,mr33)
|
meraki,mr33)
|
||||||
caldata_extract_ubi "ART" 0x5000 0x2f20
|
caldata_extract_ubi "ART" 0x5000 0x2f20
|
||||||
caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20
|
caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20
|
||||||
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3)
|
ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3)
|
||||||
;;
|
;;
|
||||||
pangu,l1000)
|
|
||||||
caldata_extract "ART" 0x5000 0x2f20
|
|
||||||
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
|
|
||||||
;;
|
|
||||||
netgear,ex6100v2 |\
|
netgear,ex6100v2 |\
|
||||||
netgear,ex6150v2)
|
netgear,ex6150v2)
|
||||||
caldata_extract "ART" 0x5000 0x2f20
|
caldata_extract "ART" 0x5000 0x2f20
|
||||||
|
|
19
root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network
Executable file
19
root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network
Executable file
|
@ -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
|
||||||
|
}
|
|
@ -1,205 +0,0 @@
|
||||||
#!/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
|
|
||||||
}
|
|
89
root/target/linux/ipq40xx/base-files/lib/adjust_network.sh
Executable file
89
root/target/linux/ipq40xx/base-files/lib/adjust_network.sh
Executable file
|
@ -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
|
||||||
|
}
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
|
|
||||||
model = "ANTROUTERGZ1000";
|
model = "GZ841902_55860.com";
|
||||||
compatible = "pangu,l1000", "qcom,ipq4019";
|
compatible = "pangu,l1000", "qcom,ipq4019";
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,8 +141,20 @@
|
||||||
label = "bule:wan";
|
label = "bule:wan";
|
||||||
gpios = <&tlmm 4 GPIO_ACTIVE_LOW>;
|
gpios = <&tlmm 4 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
4g1 {
|
||||||
|
label = "bule:4g1";
|
||||||
|
gpios = <&tlmm 44 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
|
4g2 {
|
||||||
|
label = "bule:4g2";
|
||||||
|
gpios = <&tlmm 45 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
|
4g3 {
|
||||||
|
label = "bule:4g3";
|
||||||
|
gpios = <&tlmm 46 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
usb {
|
usb {
|
||||||
label = "bule::usb";
|
label = "bule:usb";
|
||||||
gpios = <&tlmm 5 GPIO_ACTIVE_LOW>;
|
gpios = <&tlmm 5 GPIO_ACTIVE_LOW>;
|
||||||
trigger-sources = <&usb2>, <&usb3>;
|
trigger-sources = <&usb2>, <&usb3>;
|
||||||
linux,default-trigger = "usbport";
|
linux,default-trigger = "usbport";
|
||||||
|
|
|
@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||||
|
|
||||||
--- a/arch/arm/boot/dts/Makefile
|
--- a/arch/arm/boot/dts/Makefile
|
||||||
+++ b/arch/arm/boot/dts/Makefile
|
+++ b/arch/arm/boot/dts/Makefile
|
||||||
@@ -837,11 +837,59 @@ dtb-$(CONFIG_ARCH_QCOM) += \
|
@@ -837,11 +837,61 @@ dtb-$(CONFIG_ARCH_QCOM) += \
|
||||||
qcom-apq8074-dragonboard.dtb \
|
qcom-apq8074-dragonboard.dtb \
|
||||||
qcom-apq8084-ifc6540.dtb \
|
qcom-apq8084-ifc6540.dtb \
|
||||||
qcom-apq8084-mtp.dtb \
|
qcom-apq8084-mtp.dtb \
|
||||||
|
@ -18,6 +18,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||||
+ qcom-ipq4018-ap120c-ac.dtb \
|
+ qcom-ipq4018-ap120c-ac.dtb \
|
||||||
+ qcom-ipq4018-dap-2610.dtb \
|
+ qcom-ipq4018-dap-2610.dtb \
|
||||||
+ qcom-ipq4018-cs-w3-wd1200g-eup.dtb \
|
+ qcom-ipq4018-cs-w3-wd1200g-eup.dtb \
|
||||||
|
+ qcom-ipq4018-magic-2-wifi-next.dtb \
|
||||||
+ qcom-ipq4018-ea6350v3.dtb \
|
+ qcom-ipq4018-ea6350v3.dtb \
|
||||||
+ qcom-ipq4018-eap1300.dtb \
|
+ qcom-ipq4018-eap1300.dtb \
|
||||||
+ qcom-ipq4018-ecw5211.dtb \
|
+ qcom-ipq4018-ecw5211.dtb \
|
||||||
|
@ -27,6 +28,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
||||||
+ qcom-ipq4018-ex6100v2.dtb \
|
+ qcom-ipq4018-ex6100v2.dtb \
|
||||||
+ qcom-ipq4018-ex6150v2.dtb \
|
+ qcom-ipq4018-ex6150v2.dtb \
|
||||||
+ qcom-ipq4018-fritzbox-4040.dtb \
|
+ qcom-ipq4018-fritzbox-4040.dtb \
|
||||||
|
+ qcom-ipq4018-gl-ap1300.dtb \
|
||||||
+ qcom-ipq4018-jalapeno.dtb \
|
+ qcom-ipq4018-jalapeno.dtb \
|
||||||
+ qcom-ipq4018-meshpoint-one.dtb \
|
+ qcom-ipq4018-meshpoint-one.dtb \
|
||||||
+ qcom-ipq4018-nbg6617.dtb \
|
+ qcom-ipq4018-nbg6617.dtb \
|
||||||
|
|
0
root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch
Normal file → Executable file
0
root/target/linux/ipq40xx/patches-5.4/999-ipq40xx-unlock-cpu-frequency.patch
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue