Mediatek:add luci support for extra hnat setting

This commit is contained in:
padavanonly 2023-12-12 22:51:45 +08:00 committed by hanwckf
parent b7ac35dbc6
commit 79ae6c2516
5 changed files with 43 additions and 1 deletions

View File

@ -72,6 +72,8 @@ case "$1" in
echo 0 0 0 0 0 0 0 > /sys/kernel/debug/hnat/qdma_txq0
echo 1 0 0 0 0 0 0 > /sys/kernel/debug/hnat/qdma_txq8
echo "11 5" >/sys/kernel/debug/hnat/hnat_setting
uci -q set "turboacc.config.fastpath_mh_eth_hnat_bind_rate"="5"
uci -q commit "turboacc"
sed -i '/\/etc\/init.d\/eqos start/d' /etc/firewall.user
echo "/etc/init.d/eqos start" >> /etc/firewall.user
echo "10 1" > /sys/kernel/debug/hnat/hnat_setting

View File

@ -173,6 +173,18 @@ return view.extend({
o.default = o.enabled;
o.rmempty = false;
o.depends('fastpath_mh_eth_hnat', '1');
o = s.option(form.Flag, 'fastpath_mh_eth_hnat_macvlan', _('Enable ethernet HNAT for MACVLAN'),
_('Enable hardware offloading for macvlan (sing wan only).'));
o.default = o.enabled;
o.rmempty = false;
o.depends('fastpath_mh_eth_hnat', '1');
o = s.option(form.Value, 'fastpath_mh_eth_hnat_bind_rate', _('HNAT bind rate threshold (pps/s)'),
_('The smaller the threshold, the easier it is for the connection to be accelerated.'));
o.datatype = 'and(uinteger,min(1))';
o.rmempty = false;
o.depends('fastpath_mh_eth_hnat', '1');
o = s.option(form.ListValue, 'fullcone', _('Full cone NAT'),
_('Full cone NAT (NAT1) can improve gaming performance effectively.'));

View File

@ -57,6 +57,24 @@ msgstr "启用以太网 IPv6 HNAT"
msgid "Enable hardware offloading for wired IPv6 connections."
msgstr "为有线 IPv6 连接启用硬件加速。"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:177
msgid "Enable ethernet HNAT for MACVLAN"
msgstr "启用MACVLAN HNAT"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:178
msgid "Enable hardware offloading for macvlan (sing wan only)."
msgstr "为MACVLAN 连接启用硬件加速(仅支持单WAN)。"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:183
msgid "HNAT bind rate threshold (pps/s)"
msgstr "HNAT加速速率阈值(pps/s)"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:184
msgid "The smaller the threshold, the easier it is for the connection to be accelerated."
msgstr "阈值越小,连接越容易被加速。"
#: applications/luci-app-turboacc/htdocs/luci-static/resources/view/turboacc.js:166
msgid "Enable hardware offloading for wired connections."
msgstr "为有线连接启用硬件加速。"

View File

@ -43,7 +43,7 @@ start() {
lsmod |grep -q "shortcut_fe_cm" || modprobe "shortcut_fe_cm" 2>"/dev/null"
;;
"mediatek_hnat")
local fastpath_mh_eth_hnat fastpath_mh_eth_hnat_v6
local fastpath_mh_eth_hnat fastpath_mh_eth_hnat_v6 fastpath_mh_eth_hnat_macvlan
config_get_bool fastpath_mh_eth_hnat "config" "fastpath_mh_eth_hnat" "1"
local hnat_path="/sys/kernel/debug/hnat"
echo "$fastpath_mh_eth_hnat" > "$hnat_path/hook_toggle"
@ -51,6 +51,14 @@ start() {
config_get_bool fastpath_mh_eth_hnat_v6 "config" "fastpath_mh_eth_hnat_v6" "1"
echo "8 $fastpath_mh_eth_hnat_v6" > "$hnat_path/hnat_setting"
fi
if [ "$fastpath_mh_eth_hnat" -eq "1" ]; then
config_get_bool fastpath_mh_eth_hnat_macvlan "config" "fastpath_mh_eth_hnat_macvlan" "1"
echo "12 $fastpath_mh_eth_hnat_macvlan" > "$hnat_path/hnat_setting"
fi
if [ "$fastpath_mh_eth_hnat" -eq "1" ]; then
config_get_bool fastpath_mh_eth_hnat_macvlan "config" "fastpath_mh_eth_hnat_bind_rate" "1"
echo "11 $fastpath_mh_eth_hnat_bind_rate" > "$hnat_path/hnat_setting"
fi
;;
esac

View File

@ -18,6 +18,8 @@ if [ -e "/lib/modules/$kernel_ver/mtkhnat.ko" ]; then
uci -q set "turboacc.config.fastpath"="mediatek_hnat"
uci -q set "turboacc.config.fastpath_mh_eth_hnat"="1"
uci -q set "turboacc.config.fastpath_mh_eth_hnat_v6"="1"
uci -q set "turboacc.config.fastpath_mh_eth_hnat_macvlan"="0"
uci -q set "turboacc.config.fastpath_mh_eth_hnat_bind_rate"="30"
elif [ -e "/lib/modules/$kernel_ver/fast-classifier.ko" ]; then
uci -q set "turboacc.config.fastpath"="fast_classifier"
uci -q set "turboacc.config.fastpath_fc_br"="1"