File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -80,14 +80,41 @@ set_congestion() {
80
80
fi
81
81
}
82
82
83
+ set_tcp_pacing () {
84
+ local ca=" $1 "
85
+ local ss=" $2 "
86
+ echo " $ca " > /proc/sys/net/ipv4/tcp_pacing_ca_ratio 2> /dev/null
87
+ echo " $ss " > /proc/sys/net/ipv4/tcp_pacing_ss_ratio 2> /dev/null
88
+ }
89
+
83
90
get_active_iface () {
84
91
iface=$( ip route get 192.0.2.1 2> /dev/null | awk ' /dev/ {for(i=1;i<=NF;i++) if($i=="dev") print $(i+1)}' )
85
92
echo " $iface "
86
93
}
87
94
95
+ get_wifi_freq () {
96
+ local iface=" $1 "
97
+ iw dev " $iface " link 2> /dev/null | grep " freq:" | awk ' {print $2}'
98
+ }
99
+
88
100
apply_wifi_settings () {
89
101
local iface=" $1 "
90
102
local applied=0
103
+ freq=$( get_wifi_freq " $iface " )
104
+ log_print " Wi-Fi band detected: ${freq} MHz"
105
+ if [ -n " $freq " ]; then
106
+ if [ " $freq " -lt 3000 ]; then
107
+ # 2.4 GHz
108
+ set_tcp_pacing 150 200
109
+ elif [ " $freq " -lt 6000 ]; then
110
+ # 5 GHz or higher
111
+ set_tcp_pacing 200 300
112
+ else
113
+ # 6 GHz or higher
114
+ set_tcp_pacing 250 350
115
+ fi
116
+ fi
117
+
91
118
for algo in $congestion_algorithms ; do
92
119
if [ -f " $MODPATH /wlan_$algo " ]; then
93
120
set_congestion " $algo " " Wi-Fi"
@@ -106,6 +133,9 @@ apply_wifi_settings() {
106
133
apply_cellular_settings () {
107
134
local iface=" $1 "
108
135
local applied=0
136
+
137
+ set_tcp_pacing 120 200
138
+
109
139
for algo in $congestion_algorithms ; do
110
140
if [ -f " $MODPATH /rmnet_data_$algo " ]; then
111
141
set_congestion " $algo " " Cellular"
You can’t perform that action at this time.
0 commit comments