From c0f947c6271011832d298d5496d69fd6ba08e733 Mon Sep 17 00:00:00 2001 From: suyuan <175338101@qq.com> Date: Thu, 31 Dec 2020 16:55:47 +0800 Subject: [PATCH] fix ipq40xx --- .../wireless-regdb/patches/501-CN-regd.patch | 24 ---- .../mac80211/files/lib/wifi/mac80211.sh | 127 ------------------ .../etc/hotplug.d/net/21_adjust_network | 7 - .../ipq40xx/base-files/etc/init.d/bootcount | 16 --- .../{adjust_network => set_smp_affinity} | 2 +- .../ipq40xx/base-files/lib/adjust_network.sh | 89 ------------ .../base-files/lib/upgrade/openmesh.sh | 0 .../base-files/lib/upgrade/platform.sh | 0 8 files changed, 1 insertion(+), 264 deletions(-) delete mode 100755 root/package/firmware/wireless-regdb/patches/501-CN-regd.patch delete mode 100755 root/package/kernel/mac80211/files/lib/wifi/mac80211.sh delete mode 100755 root/target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network delete mode 100755 root/target/linux/ipq40xx/base-files/etc/init.d/bootcount rename root/target/linux/ipq40xx/base-files/etc/init.d/{adjust_network => set_smp_affinity} (99%) delete mode 100755 root/target/linux/ipq40xx/base-files/lib/adjust_network.sh mode change 100644 => 100755 root/target/linux/ipq40xx/base-files/lib/upgrade/openmesh.sh mode change 100644 => 100755 root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh diff --git a/root/package/firmware/wireless-regdb/patches/501-CN-regd.patch b/root/package/firmware/wireless-regdb/patches/501-CN-regd.patch deleted file mode 100755 index 198d1978..00000000 --- a/root/package/firmware/wireless-regdb/patches/501-CN-regd.patch +++ /dev/null @@ -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) diff --git a/root/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/root/package/kernel/mac80211/files/lib/wifi/mac80211.sh deleted file mode 100755 index bf1dddd5..00000000 --- a/root/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ /dev/null @@ -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 -} 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 deleted file mode 100755 index 2caf2494..00000000 --- a/root/target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -[ -f /lib/adjust_network.sh ] && { - . /lib/adjust_network.sh - - adjust_eth_queue -} \ No newline at end of file diff --git a/root/target/linux/ipq40xx/base-files/etc/init.d/bootcount b/root/target/linux/ipq40xx/base-files/etc/init.d/bootcount deleted file mode 100755 index 68c5fc11..00000000 --- a/root/target/linux/ipq40xx/base-files/etc/init.d/bootcount +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network b/root/target/linux/ipq40xx/base-files/etc/init.d/set_smp_affinity similarity index 99% rename from root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network rename to root/target/linux/ipq40xx/base-files/etc/init.d/set_smp_affinity index 6089259e..4ce4bf4f 100755 --- a/root/target/linux/ipq40xx/base-files/etc/init.d/adjust_network +++ b/root/target/linux/ipq40xx/base-files/etc/init.d/set_smp_affinity @@ -202,4 +202,4 @@ set_irqs() { start() { set_interface_queues set_irqs -} \ No newline at end of file +} diff --git a/root/target/linux/ipq40xx/base-files/lib/adjust_network.sh b/root/target/linux/ipq40xx/base-files/lib/adjust_network.sh deleted file mode 100755 index d4829b09..00000000 --- a/root/target/linux/ipq40xx/base-files/lib/adjust_network.sh +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/root/target/linux/ipq40xx/base-files/lib/upgrade/openmesh.sh b/root/target/linux/ipq40xx/base-files/lib/upgrade/openmesh.sh old mode 100644 new mode 100755 diff --git a/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/root/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh old mode 100644 new mode 100755