1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

fix ipq40xx

This commit is contained in:
suyuan 2020-12-31 16:55:47 +08:00
parent 54fb00aed8
commit c0f947c627
8 changed files with 1 additions and 264 deletions

View file

@ -1,24 +0,0 @@
diff -uprN a/db.txt b/db.txt
--- a/db.txt 2020-01-06 19:33:27.707188000 +0800
+++ b/db.txt 2020-01-06 19:39:28.663199594 +0800
@@ -291,15 +291,15 @@ country CL: DFS-JP
(5735 - 5835 @ 80), (20)
country CN: DFS-FCC
- (2402 - 2482 @ 40), (20)
- (5170 - 5250 @ 80), (23), AUTO-BW
- (5250 - 5330 @ 80), (23), DFS, AUTO-BW
+ (2402 - 2482 @ 40), (30)
+ (5170 - 5250 @ 80), (30), AUTO-BW
+ (5250 - 5330 @ 80), (30), DFS, AUTO-BW
(5735 - 5835 @ 80), (30)
# 60 GHz band channels 1,4: 28dBm, channels 2,3: 44dBm
# ref: http://www.miit.gov.cn/n11293472/n11505629/n11506593/n11960250/n11960606/n11960700/n12330791.files/n12330790.pdf
- (57240 - 59400 @ 2160), (28)
+ (57240 - 59400 @ 2160), (30)
(59400 - 63720 @ 2160), (44)
- (63720 - 65880 @ 2160), (28)
+ (63720 - 65880 @ 2160), (30)
country CO: DFS-FCC
(2402 - 2482 @ 40), (20)

View file

@ -1,127 +0,0 @@
#!/bin/sh
. /lib/netifd/mac80211.sh
append DRIVERS "mac80211"
lookup_phy() {
[ -n "$phy" ] && {
[ -d /sys/class/ieee80211/$phy ] && return
}
local devpath
config_get devpath "$device" path
[ -n "$devpath" ] && {
phy="$(mac80211_path_to_phy "$devpath")"
[ -n "$phy" ] && return
}
local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
[ -n "$macaddr" ] && {
for _phy in /sys/class/ieee80211/*; do
[ -e "$_phy" ] || continue
[ "$macaddr" = "$(cat ${_phy}/macaddress)" ] || continue
phy="${_phy##*/}"
return
done
}
phy=
return
}
find_mac80211_phy() {
local device="$1"
config_get phy "$device" phy
lookup_phy
[ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] || {
echo "PHY for wifi device $1 not found"
return 1
}
config_set "$device" phy "$phy"
config_get macaddr "$device" macaddr
[ -z "$macaddr" ] && {
config_set "$device" macaddr "$(cat /sys/class/ieee80211/${phy}/macaddress)"
}
return 0
}
check_mac80211_device() {
config_get phy "$1" phy
[ -z "$phy" ] && {
find_mac80211_phy "$1" >/dev/null || return 0
config_get phy "$1" phy
}
[ "$phy" = "$dev" ] && found=1
}
detect_mac80211() {
devidx=0
config_load wireless
while :; do
config_get type "radio$devidx" type
[ -n "$type" ] || break
devidx=$(($devidx + 1))
done
for _dev in /sys/class/ieee80211/*; do
[ -e "$_dev" ] || continue
dev="${_dev##*/}"
found=0
config_foreach check_mac80211_device wifi-device
[ "$found" -gt 0 ] && continue
mode_band="g"
channel="13"
htmode=""
ht_capab=""
iw phy "$dev" info | grep -q 'Capabilities:' && htmode=HT40
iw phy "$dev" info | grep -q '\* 5... MHz \[' && {
mode_band="a"
channel=$(iw phy "$dev" info | grep '\* 5... MHz \[' | grep '(disabled)' -v -m 1 | sed 's/[^[]*\[\|\].*//g')
iw phy "$dev" info | grep -q 'VHT Capabilities' && htmode="VHT80"
}
[ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode"
path="$(mac80211_phy_to_path "$dev")"
if [ -n "$path" ]; then
dev_id="set wireless.radio${devidx}.path='$path'"
else
dev_id="set wireless.radio${devidx}.macaddr=$(cat /sys/class/ieee80211/${dev}/macaddress)"
fi
if [ x$mode_band == x"a" ]; then
ssid_5ghz="-5G"
else
ssid_5ghz="-2.4G"
fi
uci -q batch <<-EOF
set wireless.radio${devidx}=wifi-device
set wireless.radio${devidx}.type=mac80211
set wireless.radio${devidx}.channel=${channel}
set wireless.radio${devidx}.hwmode=11${mode_band}
set wireless.radio${devidx}.txpower=22
set wireless.radio${devidx}.country=CN
${dev_id}
${ht_capab}
set wireless.radio${devidx}.disabled=0
set wireless.default_radio${devidx}=wifi-iface
set wireless.default_radio${devidx}.device=radio${devidx}
set wireless.default_radio${devidx}.network=lan
set wireless.default_radio${devidx}.mode=ap
set wireless.default_radio${devidx}.ssid=OpenWrt${ssid_5ghz}-$(cat /sys/class/ieee80211/${dev}/macaddress | awk -F ":" '{print $4""$5""$6 }'| tr a-z A-Z)
set wireless.default_radio${devidx}.encryption=none
EOF
uci -q commit wireless
devidx=$(($devidx + 1))
done
}

View file

@ -1,7 +0,0 @@
#!/bin/sh
[ -f /lib/adjust_network.sh ] && {
. /lib/adjust_network.sh
adjust_eth_queue
}

View file

@ -1,16 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
boot() {
case $(board_name) in
alfa-network,ap120c-ac)
[ -n "$(fw_printenv bootcount changed 2>/dev/null)" ] &&\
echo -e "bootcount\nchanged\n" | /usr/sbin/fw_setenv -s -
;;
linksys,ea6350v3|\
linksys,ea8300)
mtd resetbc s_env || true
;;
esac
}

View file

@ -202,4 +202,4 @@ set_irqs() {
start() {
set_interface_queues
set_irqs
}
}

View file

@ -1,89 +0,0 @@
#!/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
}

View file

View file