OSDN Git Service

eluci-app-turboacc: drop shortcut-fe support
authorTianling Shen <cnsztl@immortalwrt.org>
Thu, 12 May 2022 13:27:27 +0000 (21:27 +0800)
committerTianling Shen <cnsztl@immortalwrt.org>
Thu, 12 May 2022 13:37:57 +0000 (21:37 +0800)
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
applications/luci-app-turboacc/Makefile
applications/luci-app-turboacc/luasrc/controller/turboacc.lua
applications/luci-app-turboacc/luasrc/model/cbi/turboacc.lua
applications/luci-app-turboacc/luasrc/view/turboacc/status.htm
applications/luci-app-turboacc/root/etc/config/turboacc
applications/luci-app-turboacc/root/etc/init.d/turboacc

index 24b7888..416f238 100644 (file)
@@ -11,28 +11,22 @@ PKG_RELEASE:=$(COMMITCOUNT)
 PKG_LICENSE:=GPL-3.0-only
 PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
 
-LUCI_TITLE:=LuCI support for Flow Offload / Shortcut-FE
+LUCI_TITLE:=LuCI support for flow offloading
 LUCI_DEPENDS:=+pdnsd-alt \
        +PACKAGE_TURBOACC_INCLUDE_BBR_CCA:kmod-tcp-bbr \
        +PACKAGE_TURBOACC_INCLUDE_DNSFORWARDER:dnsforwarder \
        +PACKAGE_TURBOACC_INCLUDE_DNSPROXY:dnsproxy \
-       +PACKAGE_TURBOACC_INCLUDE_OFFLOADING:kmod-nft-offload \
-       +PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE:kmod-fast-classifier
+       +PACKAGE_TURBOACC_INCLUDE_OFFLOADING:kmod-nft-offload
 LUCI_PKGARCH:=all
 
 define Package/luci-app-turboacc/config
 config PACKAGE_TURBOACC_INCLUDE_OFFLOADING
        bool "Include Flow Offload"
-       depends on PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE=n
        default y
 
-config PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE
-       bool "Include Shortcut-FE"
-       default n
-
 config PACKAGE_TURBOACC_INCLUDE_BBR_CCA
        bool "Include BBR CCA"
-       default y
+       default n
 
 config PACKAGE_TURBOACC_INCLUDE_DNSFORWARDER
        bool "Include DNSForwarder"
@@ -47,8 +41,7 @@ PKG_CONFIG_DEPENDS:= \
        CONFIG_PACKAGE_TURBOACC_INCLUDE_BBR_CCA \
        CONFIG_PACKAGE_TURBOACC_INCLUDE_DNSFORWARDER \
        CONFIG_PACKAGE_TURBOACC_INCLUDE_DNSPROXY \
-       CONFIG_PACKAGE_TURBOACC_INCLUDE_OFFLOADING \
-       CONFIG_PACKAGE_TURBOACC_INCLUDE_SHORTCUT_FE
+       CONFIG_PACKAGE_TURBOACC_INCLUDE_OFFLOADING
 
 include ../../luci.mk
 
index f4b0d68..05b0f00 100644 (file)
@@ -4,6 +4,7 @@ function index()
        if not nixio.fs.access("/etc/config/turboacc") then
                return
        end
+
        local page
        page = entry({"admin", "network", "turboacc"}, cbi("turboacc"), _("Turbo ACC Center"), 101)
        page.i18n = "turboacc"
index 6af7ee3..4f4d891 100644 (file)
@@ -1,4 +1,7 @@
-local kernel_version = luci.sys.exec("echo -n $(uname -r)")
+local fs = require "nixio.fs"
+
+local boardinfo = luci.util.ubus("system", "board") or {}
+local m, s, o
 
 m = Map("turboacc")
 m.title        = translate("Turbo ACC Acceleration Settings")
@@ -6,74 +9,54 @@ m.description = translate("Opensource Flow Offloading driver (Fast Path or Hardw
 
 m:append(Template("turboacc/status"))
 
-s = m:section(TypedSection, "turboacc", "")
+s = m:section(TypedSection, "turboacc")
 s.addremove = false
 s.anonymous = true
 
-if nixio.fs.access("/lib/modules/" .. kernel_version .. "/nft_flow_offload.ko") then
-sw_flow = s:option(Flag, "sw_flow", translate("Software flow offloading"))
-sw_flow.default = 0
-sw_flow.description = translate("Software based offloading for routing/NAT")
-sw_flow:depends("sfe_flow", 0)
-end
-
-if luci.sys.call("cat /etc/openwrt_release | grep -q mt762") == 0 then
-hw_flow = s:option(Flag, "hw_flow", translate("Hardware flow offloading"))
-hw_flow.default = 0
-hw_flow.description = translate("Requires hardware NAT support. Implemented at least for mt762x")
-hw_flow:depends("sw_flow", 1)
+if fs.access("/lib/modules/" .. boardinfo.kernel .. "/nft_flow_offload.ko") then
+       o = s:option(Flag, "sw_flow", translate("Software flow offloading"))
+       o.default = 0
+       o.description = translate("Software based offloading for routing/NAT")
+
+       if boardinfo.release.target:match("(mt762[0-9])$") then
+               o = s:option(Flag, "hw_flow", translate("Hardware flow offloading"))
+               o.default = 0
+               o.description = translate("Requires hardware NAT support. Implemented at least for mt762x")
+               o:depends("sw_flow", 1)
+       end
 end
 
-if nixio.fs.access("/lib/modules/" .. kernel_version .. "/fast-classifier.ko") then
-sfe_flow = s:option(Flag, "sfe_flow", translate("Shortcut-FE flow offloading"))
-sfe_flow.default = 0
-sfe_flow.description = translate("Shortcut-FE based offloading for routing/NAT")
-sfe_flow:depends("sw_flow", 0)
+if fs.access("/lib/modules/" .. boardinfo.kernel .. "/nft_fullcone.ko") then
+       o = s:option(Flag, "fullcone_nat", translate("FullCone NAT"))
+       o.default = 0
+       o.description = translate("Using FullCone NAT can improve gaming performance effectively")
 end
 
-sfe_bridge = s:option(Flag, "sfe_bridge", translate("Bridge Acceleration"))
-sfe_bridge.default = 0
-sfe_bridge.description = translate("Enable Bridge Acceleration (may be functional conflict with bridge-mode VPN server)")
-sfe_bridge:depends("sfe_flow", 1)
-
-if nixio.fs.access("/proc/sys/net/ipv6") then
-sfe_ipv6 = s:option(Flag, "sfe_ipv6", translate("IPv6 Acceleration"))
-sfe_ipv6.default = 0
-sfe_ipv6.description = translate("Enable IPv6 Acceleration")
-sfe_ipv6:depends("sfe_flow", 1)
+if fs.access("/lib/modules/" .. boardinfo.kernel .. "/tcp_bbr.ko") then
+       o = s:option(Flag, "bbr_cca", translate("BBR CCA"))
+       o.default = 0
+       o.description = translate("Using BBR CCA can improve TCP network performance effectively")
 end
 
-if nixio.fs.access("/lib/modules/" .. kernel_version .. "/tcp_bbr.ko") then
-bbr_cca = s:option(Flag, "bbr_cca", translate("BBR CCA"))
-bbr_cca.default = 0
-bbr_cca.description = translate("Using BBR CCA can improve TCP network performance effectively")
-end 
-
-if nixio.fs.access("/lib/modules/" .. kernel_version .. "/nft_fullcone.ko") then
-fullcone_nat = s:option(Flag, "fullcone_nat", translate("FullCone NAT"))
-fullcone_nat.default = 0
-fullcone_nat.description = translate("Using FullCone NAT can improve gaming performance effectively")
-end 
-
-dns_caching = s:option(Flag, "dns_caching", translate("DNS Caching"))
-dns_caching.default = 0
-dns_caching.rmempty = false
-dns_caching.description = translate("Enable DNS Caching and anti ISP DNS pollution")
+o = s:option(Flag, "dns_caching", translate("DNS Caching"))
+o.default = 0
+o.rmempty = false
+o.description = translate("Enable DNS Caching and anti ISP DNS pollution")
 
-dns_caching_mode = s:option(ListValue, "dns_caching_mode", translate("Resolve DNS Mode"), translate("DNS Program"))
-dns_caching_mode:value("1", translate("Using PDNSD to query and cache"))
-if nixio.fs.access("/usr/bin/dnsforwarder") then
-dns_caching_mode:value("2", translate("Using DNSForwarder to query and cache"))
+o = s:option(ListValue, "dns_caching_mode", translate("Resolve DNS Mode"), translate("DNS Program"))
+o:value("1", translate("Using PDNSD to query and cache"))
+if fs.access("/usr/bin/dnsforwarder") then
+       o:value("2", translate("Using DNSForwarder to query and cache"))
 end
-if nixio.fs.access("/usr/bin/dnsproxy") then
-dns_caching_mode:value("3", translate("Using DNSProxy to query and cache"))
+if fs.access("/usr/bin/dnsproxy") then
+       o:value("3", translate("Using DNSProxy to query and cache"))
 end
-dns_caching_mode.default = 1
-dns_caching_mode:depends("dns_caching", 1)
+o.default = 1
+o:depends("dns_caching", 1)
 
-dns_caching_dns = s:option(Value, "dns_caching_dns", translate("Upsteam DNS Server"))
-dns_caching_dns.default = "114.114.114.114,114.114.115.115,223.5.5.5,223.6.6.6,180.76.76.76,119.29.29.29,119.28.28.28,1.2.4.8,210.2.4.8"
-dns_caching_dns.description = translate("Muitiple DNS server can saperate with ','")
-dns_caching_dns:depends("dns_caching", 1)
+o = s:option(Value, "dns_caching_dns", translate("Upsteam DNS Server"))
+o.default = "114.114.114.114,114.114.115.115,223.5.5.5,223.6.6.6,180.76.76.76,119.29.29.29,119.28.28.28,1.2.4.8,210.2.4.8"
+o.description = translate("Muitiple DNS server can saperate with ','")
+o:depends("dns_caching", 1)
 
 return m
index 87a019b..f14036f 100644 (file)
 
 <script type="text/javascript">//<![CDATA[
        var fastpath_state = document.getElementById('_fastpath_state');
-       var bbr_state = document.getElementById('_bbr_state');
        var fullconenat_state = document.getElementById('_fullconenat_state');
+       var bbr_state = document.getElementById('_bbr_state');
        var dnscaching_state = document.getElementById('_dnscaching_state');
        XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "turboacc", "status")%>', null, function(x, status) {
                if ( x && x.status == 200 ) {
-                       fastpath_state.innerHTML = status.fastpath_state ? '<em><b style=color:green><%=luci.sys.exec("/etc/init.d/turboacc check_status fastpath")%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
+                       fastpath_state.innerHTML = status.fastpath_state ? '<em><b style=color:green><%:RUNNING%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
                        fullconenat_state.innerHTML = status.fullconenat_state ? '<em><b style=color:green><%:RUNNING%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
                        bbr_state.innerHTML = status.bbr_state ? '<em><b style=color:green><%:RUNNING%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
                        dnscaching_state.innerHTML = status.dnscaching_state ? '<em><b style=color:green><%:RUNNING%></b></em>' : '<em><b style=color:red><%:NOT RUNNING%></b></em>';
index 71135e1..d6c461c 100644 (file)
@@ -2,9 +2,6 @@
 config turboacc 'config'
        option sw_flow '1'
        option hw_flow '1'
-       option sfe_flow '1'
-       option sfe_bridge '1'
-       option sfe_ipv6 '0'
        option fullcone_nat '1'
        option bbr_cca '0'
        option dns_caching '0'
index 4fafd3a..df1e28e 100755 (executable)
@@ -13,9 +13,6 @@ inital_conf(){
        config_load "turboacc"
        config_get "sw_flow" "config" "sw_flow" "0"
        config_get "hw_flow" "config" "hw_flow" "0"
-       config_get "sfe_flow" "config" "sfe_flow" "0"
-       config_get "sfe_bridge" "config" "sfe_bridge" "0"
-       config_get "sfe_ipv6" "config" "sfe_ipv6" "0"
        config_get "bbr_cca" "config" "bbr_cca" "0"
        config_get "fullcone_nat" "config" "fullcone_nat" "0"
        config_get "dns_caching" "config" "dns_caching" "0"
@@ -23,7 +20,6 @@ inital_conf(){
        config_get "dns_caching_dns" "config" "dns_caching_dns"
 
        [ ! -e "/lib/modules/$(uname -r)/nft_flow_offload.ko" ] && { sw_flow="0"; hw_flow="0"; }
-       [ ! -e "/lib/modules/$(uname -r)/fast-classifier.ko" ] && { sfe_flow="0"; sfe_bridge="0"; sfe_ipv6="0"; }
        [ ! -e "/lib/modules/$(uname -r)/tcp_bbr.ko" ] && bbr_cca="0"
        [ ! -e "/lib/modules/$(uname -r)/nft_fullcone.ko" ] && fullcone_nat="0"
 }
@@ -236,16 +232,6 @@ start(){
        uci set firewall.@defaults[0].fullcone="${fullcone_nat}"
        uci commit firewall
 
-       [ "${sw_flow}" -ne "1" ] && [ "${sfe_flow}" -eq "1" ] && {
-               lsmod | grep -q fast_classifier || modprobe fast_classifier 2>"/dev/null"
-               echo "${sfe_bridge}" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null"
-               if [ "${sfe_ipv6}" -eq "1" ]; then
-                       [ -e "/dev/sfe_ipv6" ] || mknod "/dev/sfe_ipv6" "c" "$(cat "/sys/sfe_ipv6/debug_dev")" "0"
-               else
-                       rm -f "/dev/sfe_ipv6"
-               fi
-       }
-
        if [ "${bbr_cca}" -eq "1" ];  then
                sysctl -w net.ipv4.tcp_congestion_control="bbr"
        else
@@ -288,12 +274,6 @@ stop(){
        uci set firewall.@defaults[0].fullcone="${fullcone_nat}"
        uci commit firewall
 
-       [ "${sfe_flow}" -eq "1" ] || {
-               echo "0" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null"
-               rm -f "/dev/sfe_ipv6"
-               lsmod | grep -q fast_classifier && rmmod "fast_classifier" 2>"/dev/null"
-       }
-
        stop_dnscache
        revert_dns
 
@@ -319,18 +299,8 @@ restart(){
 check_status(){
        case "$1" in
        "fastpath")
-               if [ "$(cat "/sys/module/nft_flow_offload/refcnt" 2>"/dev/null" || echo 0)" -ne "0" ]; then
-                       echo -n "Flow Offloading"
-                       exit 0
-               elif lsmod | grep -q "ecm"; then
-                       echo -n "QCA-NSS-ECM"
-                       exit 0
-               elif lsmod | grep -q "fast_classifier"; then
-                       echo -n "Shortcut-FE"
-                       exit 0
-               else
-                       exit 1
-               fi
+               [ "$(cat "/sys/module/nft_flow_offload/refcnt" 2>"/dev/null" || echo 0)" -ne "0" ] && \
+                       exit 0 || exit 1
                ;;
        "fullconenat")
                [ "$(cat "/sys/module/nft_fullcone/refcnt" 2>"/dev/null" || echo 0)" -ne "0" ] && \