mirror of
https://github.com/FUjr/gl-infra-builder.git
synced 2025-12-16 17:15:08 +00:00
a1300: add wifi performance patch
This commit is contained in:
parent
3a6cbe2527
commit
cea8e4e9d7
@ -0,0 +1,125 @@
|
||||
From 3b2235f8a89b612cef7b311da8e3586a2c191cdf Mon Sep 17 00:00:00 2001
|
||||
From: Dongming Han <handongming@gl-inet.com>
|
||||
Date: Fri, 15 Jul 2022 10:42:57 +0800
|
||||
Subject: [PATCH] ipq40xx: add smp network performance optimization
|
||||
|
||||
source: https://github.com/coolsnowwolf/lede/commit/b93293ef8dde8c0447c01569f968b389bedbbdb1
|
||||
---
|
||||
.../etc/hotplug.d/net/21_adjust_network | 8 ++
|
||||
.../ipq40xx/base-files/lib/adjust_network.sh | 89 +++++++++++++++++++
|
||||
2 files changed, 97 insertions(+)
|
||||
create mode 100644 target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network
|
||||
create mode 100644 target/linux/ipq40xx/base-files/lib/adjust_network.sh
|
||||
|
||||
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network b/target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network
|
||||
new file mode 100644
|
||||
index 0000000000..bb4d215b4d
|
||||
--- /dev/null
|
||||
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/net/21_adjust_network
|
||||
@@ -0,0 +1,8 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+[ -f /lib/adjust_network.sh ] && {
|
||||
+ . /lib/adjust_network.sh
|
||||
+ adjust_edma_smp_affinity
|
||||
+ adjust_radio_smp_affinity
|
||||
+ adjust_eth_queue
|
||||
+}
|
||||
diff --git a/target/linux/ipq40xx/base-files/lib/adjust_network.sh b/target/linux/ipq40xx/base-files/lib/adjust_network.sh
|
||||
new file mode 100644
|
||||
index 0000000000..99423022c5
|
||||
--- /dev/null
|
||||
+++ b/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
|
||||
+}
|
||||
--
|
||||
2.17.1
|
||||
|
||||
83
patches-21.02.2/0016-enable-2.4G-vht.patch
Normal file
83
patches-21.02.2/0016-enable-2.4G-vht.patch
Normal file
@ -0,0 +1,83 @@
|
||||
From 4d2b913699a2a9a0077381996e00bc443c9811d2 Mon Sep 17 00:00:00 2001
|
||||
From: Dongming Han <handongming@gl-inet.com>
|
||||
Date: Fri, 15 Jul 2022 12:11:35 +0800
|
||||
Subject: [PATCH] enable 2.4G vht
|
||||
|
||||
source: https://github.com/coolsnowwolf/lede
|
||||
---
|
||||
.../mac80211/files/lib/netifd/wireless/mac80211.sh | 4 ++--
|
||||
.../patches/ath/983-ath10k-allow-vht-on-2g.patch | 10 ++++++++++
|
||||
package/network/services/hostapd/files/hostapd.sh | 4 +++-
|
||||
3 files changed, 15 insertions(+), 3 deletions(-)
|
||||
create mode 100644 package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch
|
||||
|
||||
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
|
||||
index d69667bf8c..8b3a37c81c 100644
|
||||
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
|
||||
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
|
||||
@@ -138,7 +138,7 @@ mac80211_hostapd_setup_base() {
|
||||
[ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
|
||||
append base_cfg "acs_exclude_dfs=1" "$N"
|
||||
|
||||
- json_get_vars noscan ht_coex
|
||||
+ json_get_vars noscan ht_coex vendor_vht
|
||||
json_get_values ht_capab_list ht_capab tx_burst
|
||||
json_get_values channel_list channels
|
||||
|
||||
@@ -284,7 +284,7 @@ mac80211_hostapd_setup_base() {
|
||||
}
|
||||
[ "$hwmode" = "a" ] || enable_ac=0
|
||||
|
||||
- if [ "$enable_ac" != "0" ]; then
|
||||
+ if [ "$enable_ac" != "0" -o "$vendor_vht" = "1" ]; then
|
||||
json_get_vars \
|
||||
rxldpc:1 \
|
||||
short_gi_80:1 \
|
||||
diff --git a/package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch b/package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch
|
||||
new file mode 100644
|
||||
index 0000000000..78a09b9ae1
|
||||
--- /dev/null
|
||||
+++ b/package/kernel/mac80211/patches/ath/983-ath10k-allow-vht-on-2g.patch
|
||||
@@ -0,0 +1,10 @@
|
||||
+--- a/drivers/net/wireless/ath/ath10k/mac.c
|
||||
++++ b/drivers/net/wireless/ath/ath10k/mac.c
|
||||
+@@ -4841,6 +4841,7 @@ static void ath10k_mac_setup_ht_vht_cap(
|
||||
+ if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
|
||||
+ band = &ar->mac.sbands[NL80211_BAND_2GHZ];
|
||||
+ band->ht_cap = ht_cap;
|
||||
++ band->vht_cap = vht_cap;
|
||||
+ }
|
||||
+ if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
|
||||
+ band = &ar->mac.sbands[NL80211_BAND_5GHZ];
|
||||
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
|
||||
index fe6af98f4d..21da6903d6 100644
|
||||
--- a/package/network/services/hostapd/files/hostapd.sh
|
||||
+++ b/package/network/services/hostapd/files/hostapd.sh
|
||||
@@ -108,6 +108,7 @@ hostapd_common_add_device_config() {
|
||||
config_add_int rssi_reject_assoc_rssi
|
||||
config_add_int rssi_ignore_probe_request
|
||||
config_add_int maxassoc
|
||||
+ config_add_boolean vendor_vht
|
||||
|
||||
config_add_string acs_chan_bias
|
||||
config_add_array hostapd_options
|
||||
@@ -125,7 +126,7 @@ hostapd_prepare_device_config() {
|
||||
|
||||
json_get_vars country country3 country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
|
||||
acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \
|
||||
- rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc
|
||||
+ rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc vendor_vht
|
||||
|
||||
hostapd_set_log_options base_cfg
|
||||
|
||||
@@ -194,6 +195,7 @@ hostapd_prepare_device_config() {
|
||||
set_default rate_list "24000 36000 48000 54000"
|
||||
set_default basic_rate_list "24000"
|
||||
fi
|
||||
+ [ -n "$vendor_vht" ] && append base_cfg "vendor_vht=$vendor_vht" "$N"
|
||||
;;
|
||||
a)
|
||||
if [ "$cell_density" -eq 1 ]; then
|
||||
--
|
||||
2.17.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user