mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-08 10:23:47 +08:00
add luci-eqos-mtk(fork from tianling's version)
This commit is contained in:
parent
9a719b3eb7
commit
7fbc4d0d0b
@ -272,6 +272,7 @@ CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_NONE_Server=y
|
|||||||
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Rust_Server is not set
|
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Rust_Server is not set
|
||||||
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Simple_Obfs is not set
|
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Simple_Obfs is not set
|
||||||
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Xray is not set
|
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Xray is not set
|
||||||
|
CONFIG_PACKAGE_luci-app-eqos-mtk=y
|
||||||
CONFIG_PACKAGE_luci-app-turboacc-mtk=y
|
CONFIG_PACKAGE_luci-app-turboacc-mtk=y
|
||||||
CONFIG_PACKAGE_luci-app-upnp=y
|
CONFIG_PACKAGE_luci-app-upnp=y
|
||||||
# CONFIG_PACKAGE_luci-app-vssr_INCLUDE_ShadowsocksR_Libev_Server is not set
|
# CONFIG_PACKAGE_luci-app-vssr_INCLUDE_ShadowsocksR_Libev_Server is not set
|
||||||
|
@ -250,6 +250,7 @@ CONFIG_PACKAGE_libstdcpp=y
|
|||||||
CONFIG_PACKAGE_libudev-zero=y
|
CONFIG_PACKAGE_libudev-zero=y
|
||||||
CONFIG_PACKAGE_libuuid=y
|
CONFIG_PACKAGE_libuuid=y
|
||||||
CONFIG_PACKAGE_luci-app-mtk=y
|
CONFIG_PACKAGE_luci-app-mtk=y
|
||||||
|
CONFIG_PACKAGE_luci-app-eqos-mtk=y
|
||||||
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy is not set
|
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy is not set
|
||||||
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set
|
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set
|
||||||
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Client is not set
|
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Client is not set
|
||||||
|
@ -221,6 +221,7 @@ CONFIG_PACKAGE_libpcap=y
|
|||||||
CONFIG_PACKAGE_libstdcpp=y
|
CONFIG_PACKAGE_libstdcpp=y
|
||||||
CONFIG_PACKAGE_libudev-zero=y
|
CONFIG_PACKAGE_libudev-zero=y
|
||||||
CONFIG_PACKAGE_libuuid=y
|
CONFIG_PACKAGE_libuuid=y
|
||||||
|
CONFIG_PACKAGE_luci-app-eqos-mtk=y
|
||||||
CONFIG_PACKAGE_luci-app-mtk=y
|
CONFIG_PACKAGE_luci-app-mtk=y
|
||||||
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy is not set
|
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy is not set
|
||||||
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set
|
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set
|
||||||
|
@ -219,6 +219,7 @@ CONFIG_PACKAGE_libpcap=y
|
|||||||
CONFIG_PACKAGE_libstdcpp=y
|
CONFIG_PACKAGE_libstdcpp=y
|
||||||
CONFIG_PACKAGE_libudev-zero=y
|
CONFIG_PACKAGE_libudev-zero=y
|
||||||
CONFIG_PACKAGE_libuuid=y
|
CONFIG_PACKAGE_libuuid=y
|
||||||
|
CONFIG_PACKAGE_luci-app-eqos-mtk=y
|
||||||
CONFIG_PACKAGE_luci-app-mtk=y
|
CONFIG_PACKAGE_luci-app-mtk=y
|
||||||
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy is not set
|
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy is not set
|
||||||
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set
|
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set
|
||||||
|
@ -249,6 +249,7 @@ CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_NONE_Server=y
|
|||||||
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Rust_Server is not set
|
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Rust_Server is not set
|
||||||
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Simple_Obfs is not set
|
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Simple_Obfs is not set
|
||||||
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Xray is not set
|
# CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Xray is not set
|
||||||
|
CONFIG_PACKAGE_luci-app-eqos-mtk=y
|
||||||
CONFIG_PACKAGE_luci-app-turboacc-mtk=y
|
CONFIG_PACKAGE_luci-app-turboacc-mtk=y
|
||||||
CONFIG_PACKAGE_luci-app-upnp=y
|
CONFIG_PACKAGE_luci-app-upnp=y
|
||||||
# CONFIG_PACKAGE_luci-app-vssr_INCLUDE_ShadowsocksR_Libev_Server is not set
|
# CONFIG_PACKAGE_luci-app-vssr_INCLUDE_ShadowsocksR_Libev_Server is not set
|
||||||
|
@ -226,6 +226,7 @@ CONFIG_PACKAGE_libpcap=y
|
|||||||
CONFIG_PACKAGE_libstdcpp=y
|
CONFIG_PACKAGE_libstdcpp=y
|
||||||
CONFIG_PACKAGE_libudev-zero=y
|
CONFIG_PACKAGE_libudev-zero=y
|
||||||
CONFIG_PACKAGE_libuuid=y
|
CONFIG_PACKAGE_libuuid=y
|
||||||
|
CONFIG_PACKAGE_luci-app-eqos-mtk=y
|
||||||
CONFIG_PACKAGE_luci-app-mtk=y
|
CONFIG_PACKAGE_luci-app-mtk=y
|
||||||
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy is not set
|
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy is not set
|
||||||
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set
|
# CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client is not set
|
||||||
|
11
package/mtk/applications/luci-app-eqos-mtk/Makefile
Normal file
11
package/mtk/applications/luci-app-eqos-mtk/Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
LUCI_TITLE:=LuCI support for Easy QoS
|
||||||
|
LUCI_DEPENDS:=+tc +kmod-sched-core +kmod-ifb @!PACKAGE_luci-app-eqos
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=Jianhui Zhao <jianhuizhao329@gmail.com>
|
||||||
|
PKG_NAME:=luci-app-eqos-mtk
|
||||||
|
|
||||||
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
# call BuildPackage - OpenWrt buildroot signature
|
@ -0,0 +1,67 @@
|
|||||||
|
'use strict';
|
||||||
|
'require form';
|
||||||
|
'require network';
|
||||||
|
'require uci';
|
||||||
|
'require view';
|
||||||
|
|
||||||
|
return view.extend({
|
||||||
|
load: function() {
|
||||||
|
return Promise.all([
|
||||||
|
uci.load('eqos'),
|
||||||
|
network.getHostHints()
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
|
||||||
|
render: function(data) {
|
||||||
|
var m, s, o;
|
||||||
|
|
||||||
|
m = new form.Map('eqos', _('EQoS'),
|
||||||
|
_('Network speed control service.(Compatiable with Mediatek HNAT)'));
|
||||||
|
|
||||||
|
s = m.section(form.NamedSection, 'config', 'eqos');
|
||||||
|
|
||||||
|
o = s.option(form.Flag, 'enabled', _('Enable'));
|
||||||
|
o.default = o.disabled;
|
||||||
|
o.rmempty = false;
|
||||||
|
|
||||||
|
o = s.option(form.Value, 'download', _('Download speed (Mbit/s)'),
|
||||||
|
_('Total download bandwidth.'));
|
||||||
|
o.datatype = 'and(uinteger,min(1))';
|
||||||
|
o.rmempty = false;
|
||||||
|
|
||||||
|
o = s.option(form.Value, 'upload', _('Upload speed (Mbit/s)'),
|
||||||
|
_('Total upload bandwidth.'));
|
||||||
|
o.datatype = 'and(uinteger,min(1))';
|
||||||
|
o.rmempty = false;
|
||||||
|
|
||||||
|
s = m.section(form.TableSection, 'device', _('Speed limit based on IP address'));
|
||||||
|
s.addremove = true;
|
||||||
|
s.anonymous = true;
|
||||||
|
s.sortable = true;
|
||||||
|
|
||||||
|
o = s.option(form.Flag, 'enabled', _('Enable'));
|
||||||
|
o.default = o.enabled;
|
||||||
|
|
||||||
|
o = s.option(form.Value, 'ip', _('IP address'));
|
||||||
|
o.datatype = 'ip4addr';
|
||||||
|
for (var i of Object.entries(data[1]?.hosts))
|
||||||
|
for (var v in i[1].ipaddrs)
|
||||||
|
if (i[1].ipaddrs[v]) {
|
||||||
|
var ip_addr = i[1].ipaddrs[v], ip_host = i[1].name;
|
||||||
|
o.value(ip_addr, ip_host ? String.format('%s (%s)', ip_host, ip_addr) : ip_addr)
|
||||||
|
}
|
||||||
|
o.rmempty = false;
|
||||||
|
|
||||||
|
o = s.option(form.Value, 'download', _('Download speed (Mbit/s)'));
|
||||||
|
o.datatype = 'and(uinteger,min(0))';
|
||||||
|
o.rmempty = false;
|
||||||
|
|
||||||
|
o = s.option(form.Value, 'upload', _('Upload speed (Mbit/s)'));
|
||||||
|
o.datatype = 'and(uinteger,min(0))';
|
||||||
|
o.rmempty = false;
|
||||||
|
|
||||||
|
o = s.option(form.Value, 'comment', _('Comment'));
|
||||||
|
|
||||||
|
return m.render();
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,50 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:64
|
||||||
|
msgid "Comment"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:28
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:56
|
||||||
|
msgid "Download speed (Mbit/s)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:18
|
||||||
|
#: applications/luci-app-eqos/root/usr/share/luci/menu.d/luci-app-eqos.json:3
|
||||||
|
msgid "EQoS"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:24
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:43
|
||||||
|
msgid "Enable"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/root/usr/share/rpcd/acl.d/luci-app-eqos.json:3
|
||||||
|
msgid "Grant UCI access for luci-app-eqos"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:46
|
||||||
|
msgid "IP address"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:19
|
||||||
|
msgid "Network speed control service."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:38
|
||||||
|
msgid "Speed limit based on IP address"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:29
|
||||||
|
msgid "Total download bandwidth."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:34
|
||||||
|
msgid "Total upload bandwidth."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:33
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:60
|
||||||
|
msgid "Upload speed (Mbit/s)"
|
||||||
|
msgstr ""
|
@ -0,0 +1,58 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: LuCi Chinese Translation\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"Language: zh_Hans\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||||
|
"X-Generator: Pootle 2.0.6\n"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:64
|
||||||
|
msgid "Comment"
|
||||||
|
msgstr "注释"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:28
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:56
|
||||||
|
msgid "Download speed (Mbit/s)"
|
||||||
|
msgstr "下载速度 (Mbit/s)"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:18
|
||||||
|
#: applications/luci-app-eqos/root/usr/share/luci/menu.d/luci-app-eqos.json:3
|
||||||
|
msgid "EQoS"
|
||||||
|
msgstr "网速控制"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:24
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:43
|
||||||
|
msgid "Enable"
|
||||||
|
msgstr "启用"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/root/usr/share/rpcd/acl.d/luci-app-eqos.json:3
|
||||||
|
msgid "Grant UCI access for luci-app-eqos"
|
||||||
|
msgstr "授予 luci-app-eqos 访问 UCI 配置的权限"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:46
|
||||||
|
msgid "IP address"
|
||||||
|
msgstr "IP 地址"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:19
|
||||||
|
msgid "Network speed control service.(Compatiable with Mediatek HNAT)"
|
||||||
|
msgstr "网速控制服务(未设置限速主机可正常使用硬件加速)。"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:38
|
||||||
|
msgid "Speed limit based on IP address"
|
||||||
|
msgstr "基于 IP 限速(设置为0则上行或下载取消限速并启用硬件加速)"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:29
|
||||||
|
msgid "Total download bandwidth."
|
||||||
|
msgstr "总下载带宽。"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:34
|
||||||
|
msgid "Total upload bandwidth."
|
||||||
|
msgstr "总上传带宽。"
|
||||||
|
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:33
|
||||||
|
#: applications/luci-app-eqos/htdocs/luci-static/resources/view/eqos.js:60
|
||||||
|
msgid "Upload speed (Mbit/s)"
|
||||||
|
msgstr "上传速度 (Mbit/s)"
|
@ -0,0 +1,12 @@
|
|||||||
|
# The bandwidth unit is Mbit/s
|
||||||
|
config eqos 'config'
|
||||||
|
option enabled 0
|
||||||
|
option download 100
|
||||||
|
option upload 20
|
||||||
|
|
||||||
|
# Limiting the bandwidth of a single Device
|
||||||
|
#config device
|
||||||
|
# option ip "192.168.1.100"
|
||||||
|
# option download 10
|
||||||
|
# option upload 5
|
||||||
|
# option comment "test"
|
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
[ "$ACTION" = "ifup" ] || exit 0
|
||||||
|
[ "$INTERFACE" = "lan" ] || exit 0
|
||||||
|
|
||||||
|
/etc/init.d/eqos start
|
49
package/mtk/applications/luci-app-eqos-mtk/root/etc/init.d/eqos
Executable file
49
package/mtk/applications/luci-app-eqos-mtk/root/etc/init.d/eqos
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
# Copyright (C) 2006 OpenWrt.org
|
||||||
|
|
||||||
|
START=50
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
|
parse_device() {
|
||||||
|
local cfg="$1"
|
||||||
|
|
||||||
|
local enabled
|
||||||
|
config_get_bool enabled "$cfg" "enabled" "1"
|
||||||
|
[ "$enabled" -eq "1" ] || return 1
|
||||||
|
|
||||||
|
local ip download upload
|
||||||
|
config_get ip "$cfg" ip
|
||||||
|
config_get download "$cfg" "download"
|
||||||
|
config_get upload "$cfg" "upload"
|
||||||
|
|
||||||
|
eqos add "$ip" "$download" "$upload"
|
||||||
|
}
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
config_load "eqos"
|
||||||
|
|
||||||
|
local enabled
|
||||||
|
config_get_bool enabled "config" "enabled" "0"
|
||||||
|
[ "$enabled" -eq "1" ] || return 1
|
||||||
|
|
||||||
|
local download upload
|
||||||
|
config_get download "config" "download"
|
||||||
|
config_get upload "config" "upload"
|
||||||
|
|
||||||
|
eqos start "$download" "$upload"
|
||||||
|
|
||||||
|
config_foreach parse_device "device"
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_service() {
|
||||||
|
eqos stop
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger "eqos"
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
delete ucitrack.@eqos[-1]
|
||||||
|
add ucitrack eqos
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm -f /tmp/luci-indexcache
|
||||||
|
exit 0
|
72
package/mtk/applications/luci-app-eqos-mtk/root/usr/sbin/eqos
Executable file
72
package/mtk/applications/luci-app-eqos-mtk/root/usr/sbin/eqos
Executable file
@ -0,0 +1,72 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
dev=br-lan
|
||||||
|
|
||||||
|
stop_qos() {
|
||||||
|
tc qdisc del dev $dev root 2>/dev/null
|
||||||
|
tc qdisc del dev $dev ingress 2>/dev/null
|
||||||
|
tc qdisc del dev ${dev}-ifb root 2>/dev/null
|
||||||
|
ip link del dev ${dev}-ifb 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
start_qos() {
|
||||||
|
local dl=$1
|
||||||
|
local up=$2
|
||||||
|
|
||||||
|
tc qdisc add dev $dev root handle 1: htb
|
||||||
|
tc class add dev $dev parent 1: classid 1:1 htb rate ${dl}mbit
|
||||||
|
|
||||||
|
ip link add dev ${dev}-ifb name ${dev}-ifb type ifb
|
||||||
|
ip link set dev ${dev}-ifb up
|
||||||
|
|
||||||
|
tc qdisc add dev ${dev}-ifb root handle 1: htb
|
||||||
|
tc class add dev ${dev}-ifb parent 1: classid 1:1 htb rate ${up}mbit
|
||||||
|
|
||||||
|
tc qdisc add dev $dev ingress
|
||||||
|
tc filter add dev $dev parent ffff: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ${dev}-ifb
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
"stop")
|
||||||
|
stop_qos
|
||||||
|
iptables -t mangle -D FORWARD -j eqos
|
||||||
|
;;
|
||||||
|
"start")
|
||||||
|
stop_qos
|
||||||
|
iptables -t mangle -F eqos
|
||||||
|
start_qos $2 $3
|
||||||
|
iptables -t mangle -N eqos
|
||||||
|
iptables -t mangle -D FORWARD -j eqos
|
||||||
|
iptables -t mangle -A FORWARD -j eqos
|
||||||
|
;;
|
||||||
|
"add")
|
||||||
|
ip="$2"
|
||||||
|
dl="$3"
|
||||||
|
up="$4"
|
||||||
|
|
||||||
|
cnt=$(tc class show dev $dev | wc -l)
|
||||||
|
iptables -t mangle -D eqos -s $ip -j MARK --set-mark 0x99
|
||||||
|
iptables -t mangle -D eqos -d $ip -j MARK --set-mark 0x99
|
||||||
|
if [ $up -ne 0 ]; then
|
||||||
|
iptables -t mangle -A eqos -s $ip -j MARK --set-mark 0x99
|
||||||
|
fi
|
||||||
|
if [ $dl -ne 0 ]; then
|
||||||
|
iptables -t mangle -A eqos -d $ip -j MARK --set-mark 0x99
|
||||||
|
fi
|
||||||
|
tc class add dev $dev parent 1:1 classid 1:1$cnt htb rate ${dl}mbit ceil ${dl}mbit
|
||||||
|
tc filter add dev $dev parent 1:0 protocol ip u32 match ip dst $ip flowid 1:1$cnt
|
||||||
|
|
||||||
|
tc class add dev ${dev}-ifb parent 1:1 classid 1:1$cnt htb rate ${up}mbit ceil ${up}mbit
|
||||||
|
tc filter add dev ${dev}-ifb parent 1:0 protocol ip u32 match ip src $ip flowid 1:1$cnt
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 <command> [options]"
|
||||||
|
echo "Commands:"
|
||||||
|
echo " start dl_rate up_rate #Total bandwidth (Mbit/s)"
|
||||||
|
echo " stop"
|
||||||
|
echo " add ip dl_rate up_rate #Limiting the bandwidth of a single IP (Mbit/s)"
|
||||||
|
echo "Example:"
|
||||||
|
echo " $0 start 30 20 # Total bandwidth: down 30Mbit/s up 20Mbit/s"
|
||||||
|
echo " $0 add 192.168.22.12 10 2 # down 10Mbit/s up 2Mbit/s"
|
||||||
|
;;
|
||||||
|
esac
|
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"admin/services/eqos": {
|
||||||
|
"title": "EQoS",
|
||||||
|
"action": {
|
||||||
|
"type": "view",
|
||||||
|
"path": "eqos"
|
||||||
|
},
|
||||||
|
"depends": {
|
||||||
|
"acl": [ "luci-app-eqos" ],
|
||||||
|
"uci": { "eqos": true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"luci-app-eqos": {
|
||||||
|
"description": "Grant UCI access for luci-app-eqos",
|
||||||
|
"read": {
|
||||||
|
"uci": [ "eqos" ]
|
||||||
|
},
|
||||||
|
"write": {
|
||||||
|
"uci": [ "eqos" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -143,16 +143,20 @@ void set_gmac_ppe_fwd(int id, int enable)
|
|||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
cr_set_bits(reg, BITS_GDM_ALL_FRC_P_PPE);
|
cr_set_bits(reg, BITS_GDM_ALL_FRC_P_PPE);
|
||||||
else
|
else {
|
||||||
cr_set_bits(reg, BITS_GDM_ALL_FRC_P_PPE1);
|
if(CFG_PPE_NUM>1)
|
||||||
|
cr_set_bits(reg, BITS_GDM_ALL_FRC_P_PPE1);
|
||||||
|
else
|
||||||
|
cr_set_bits(reg, BITS_GDM_ALL_FRC_P_PPE);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*disabled */
|
/*disabled */
|
||||||
val = readl(reg);
|
val = readl(reg);
|
||||||
if (((val & GDM_ALL_FRC_MASK) == BITS_GDM_ALL_FRC_P_PPE ||
|
if (((val & GDM_ALL_FRC_MASK) == BITS_GDM_ALL_FRC_P_PPE ||
|
||||||
(val & GDM_ALL_FRC_MASK) == BITS_GDM_ALL_FRC_P_PPE1))
|
(val & GDM_ALL_FRC_MASK) == BITS_GDM_ALL_FRC_P_PPE1))
|
||||||
cr_set_field(reg, GDM_ALL_FRC_MASK,
|
cr_set_field(reg, GDM_ALL_FRC_MASK,
|
||||||
BITS_GDM_ALL_FRC_P_CPU_PDMA);
|
BITS_GDM_ALL_FRC_P_CPU_PDMA);
|
||||||
}
|
}
|
||||||
|
@ -611,6 +611,7 @@ struct foe_entry {
|
|||||||
#define MAX_PPE_NUM 1
|
#define MAX_PPE_NUM 1
|
||||||
#endif
|
#endif
|
||||||
#define CFG_PPE_NUM (hnat_priv->ppe_num)
|
#define CFG_PPE_NUM (hnat_priv->ppe_num)
|
||||||
|
#define HNAT_EXCEPTION_TAG 0x99
|
||||||
|
|
||||||
struct mib_entry {
|
struct mib_entry {
|
||||||
u32 byt_cnt_l;
|
u32 byt_cnt_l;
|
||||||
@ -770,8 +771,9 @@ enum FoeIpAct {
|
|||||||
#define BITS_GDM_MFRC_P_PPE1 (NR_PPE1_PORT << 4)
|
#define BITS_GDM_MFRC_P_PPE1 (NR_PPE1_PORT << 4)
|
||||||
#define BITS_GDM_OFRC_P_PPE1 (NR_PPE1_PORT << 0)
|
#define BITS_GDM_OFRC_P_PPE1 (NR_PPE1_PORT << 0)
|
||||||
#define BITS_GDM_ALL_FRC_P_PPE1 \
|
#define BITS_GDM_ALL_FRC_P_PPE1 \
|
||||||
(BITS_GDM_UFRC_P_PPE1 | BITS_GDM_BFRC_P_PPE1 | \
|
(BITS_GDM_UFRC_P_PPE1 | BITS_GDM_BFRC_P_PPE1 | \
|
||||||
BITS_GDM_MFRC_P_PPE1 | BITS_GDM_OFRC_P_PPE1)
|
BITS_GDM_MFRC_P_PPE1 | BITS_GDM_OFRC_P_PPE1)
|
||||||
|
|
||||||
|
|
||||||
#define BITS_GDM_UFRC_P_CPU_PDMA (NR_PDMA_PORT << 12)
|
#define BITS_GDM_UFRC_P_CPU_PDMA (NR_PDMA_PORT << 12)
|
||||||
#define BITS_GDM_BFRC_P_CPU_PDMA (NR_PDMA_PORT << 8)
|
#define BITS_GDM_BFRC_P_CPU_PDMA (NR_PDMA_PORT << 8)
|
||||||
|
@ -1742,7 +1742,7 @@ int mtk_sw_nat_hook_tx(struct sk_buff *skb, int gmac_no)
|
|||||||
|
|
||||||
if (!skb_hnat_is_hashed(skb))
|
if (!skb_hnat_is_hashed(skb))
|
||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
|
|
||||||
if (skb_hnat_entry(skb) >= hnat_priv->foe_etry_num ||
|
if (skb_hnat_entry(skb) >= hnat_priv->foe_etry_num ||
|
||||||
skb_hnat_ppe(skb) >= CFG_PPE_NUM)
|
skb_hnat_ppe(skb) >= CFG_PPE_NUM)
|
||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
@ -2081,6 +2081,9 @@ static unsigned int mtk_hnat_nf_post_routing(
|
|||||||
|
|
||||||
if (unlikely(!skb_hnat_is_hashed(skb)))
|
if (unlikely(!skb_hnat_is_hashed(skb)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (unlikely(skb->mark == HNAT_EXCEPTION_TAG))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (out->netdev_ops->ndo_flow_offload_check) {
|
if (out->netdev_ops->ndo_flow_offload_check) {
|
||||||
out->netdev_ops->ndo_flow_offload_check(&hw_path);
|
out->netdev_ops->ndo_flow_offload_check(&hw_path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user