Merge Mainline
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
1fb5af6de4
@ -1,49 +0,0 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-turboacc
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_LICENSE:=GPLv3.0+
|
||||
|
||||
LUCI_TITLE:=LuCI support for Flow Offload / Shortcut-FE
|
||||
LUCI_DEPENDS:=+pdnsd-alt \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe:kmod-fast-classifier \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload:kmod-ipt-offload \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_bbr-cca:kmod-tcp-bbr \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder:dnsforwarder
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload
|
||||
bool "Include Flow Offload"
|
||||
depends on PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe=n
|
||||
default y
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe
|
||||
bool "Include Shortcut-FE"
|
||||
default n
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_bbr-cca
|
||||
bool "Include BBR CCA"
|
||||
default y
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder
|
||||
bool "Include DNSForwarder"
|
||||
default n
|
||||
endef
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_shortcut-fe \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_flow-offload \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_bbr-cca \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_dnsforwarder
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@ -1,39 +0,0 @@
|
||||
module("luci.controller.turboacc", package.seeall)
|
||||
|
||||
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"
|
||||
page.dependent = true
|
||||
|
||||
entry({"admin", "network", "turboacc", "status"}, call("action_status"))
|
||||
end
|
||||
|
||||
local function fastpath_status()
|
||||
return luci.sys.call("{ [ -e /sys/module/xt_FLOWOFFLOAD/refcnt ] && [ x$(cat /sys/module/xt_FLOWOFFLOAD/refcnt 2>/dev/null) != x0 ]; } || lsmod | grep -q fast_classifier") == 0
|
||||
end
|
||||
|
||||
local function bbr_status()
|
||||
return luci.sys.call("[ x$(cat /proc/sys/net/ipv4/tcp_congestion_control 2>/dev/null) = xbbr ]") == 0
|
||||
end
|
||||
|
||||
local function fullconebat_status()
|
||||
return luci.sys.call("[ -e /sys/module/xt_FULLCONENAT/refcnt ] && [ x$(cat /sys/module/xt_FULLCONENAT/refcnt 2>/dev/null) != x0 ]") == 0
|
||||
end
|
||||
|
||||
local function dnscaching_status()
|
||||
return luci.sys.call("pgrep dnscache >/dev/null") == 0
|
||||
end
|
||||
|
||||
function action_status()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
fastpath_state = fastpath_status(),
|
||||
bbr_state = bbr_status(),
|
||||
fullconenat_state = fullconebat_status(),
|
||||
dnscaching_state = dnscaching_status()
|
||||
})
|
||||
end
|
||||
@ -1,87 +0,0 @@
|
||||
local kernel_version = luci.sys.exec("echo -n $(uname -r)")
|
||||
|
||||
m = Map("turboacc")
|
||||
m.title = translate("Turbo ACC Acceleration Settings")
|
||||
m.description = translate("Opensource Flow Offloading driver (Fast Path or Hardware NAT)")
|
||||
|
||||
m:append(Template("turboacc/status"))
|
||||
|
||||
s = m:section(TypedSection, "turboacc", "")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
if nixio.fs.access("/lib/modules/" .. kernel_version .. "/xt_FLOWOFFLOAD.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 /proc/cpuinfo | grep -q MT76") == 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 mt76xx")
|
||||
hw_flow:depends("sw_flow", 1)
|
||||
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)
|
||||
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)
|
||||
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 .. "/xt_FULLCONENAT.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_acc = s:option(Flag, "dns_acc", translate("DNS Acceleration"))
|
||||
dns_acc.default = 0
|
||||
dns_acc.rmempty = false
|
||||
dns_acc.description = translate("Using optimized DNS records for GoogleHosts (Don't use under Clash Fake-IP mode)")
|
||||
|
||||
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")
|
||||
|
||||
dns_caching_mode = s:option(ListValue, "dns_caching_mode", translate("Resolve DNS Mode"), translate("Only PDNSD and DNSForwarder is supported now"))
|
||||
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"))
|
||||
end
|
||||
dns_caching_mode.default = 1
|
||||
dns_caching_mode:depends("dns_caching", 1)
|
||||
|
||||
dns_caching_v4_dns = s:option(Value, "dns_caching_v4_dns", translate("Upsteam IPv4 DNS Server"))
|
||||
dns_caching_v4_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_v4_dns.description = translate("Muitiple IPv4 DNS server can saperate with ','")
|
||||
dns_caching_v4_dns:depends("dns_caching_mode", 1)
|
||||
dns_caching_v4_dns:depends("dns_caching_mode", 2)
|
||||
|
||||
dns_caching_v6_dns = s:option(Value, "dns_caching_v6_dns", translate("Upsteam IPv6 DNS Server"))
|
||||
dns_caching_v6_dns.default = "2001:4860:4860::8888,2001:4860:4860::8844,2001:2001::1111,2001:2001::1001,2400:da00::6666,240C::6666,240C::6644"
|
||||
dns_caching_v6_dns.description = translate("Muitiple IPv6 DNS server can saperate with ','")
|
||||
dns_caching_v6_dns:depends("dns_caching_mode", 2)
|
||||
|
||||
return m
|
||||
@ -1,25 +0,0 @@
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Running Status%></legend>
|
||||
<table width="100%" cellspacing="10" id="_turboacc_status_table">
|
||||
<tr><td width="33%"><%:Flow Offloading%></td><td id="_fastpath_state"><em><%:Collecting data...%></em></td></tr>
|
||||
<tr><td width="33%"><%:BBR CCA%></td><td id="_bbr_state"><em><%:Collecting data...%></em></td></tr>
|
||||
<tr><td width="33%"><%:FullCone NAT%></td><td id="_fullconenat_state"><em><%:Collecting data...%></em></td></tr>
|
||||
<tr><td width="33%"><%:DNS Caching%></td><td id="_dnscaching_state"><em><%:Collecting data...%></em></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<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 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><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
|
||||
bbr_state.innerHTML = status.bbr_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
|
||||
fullconenat_state.innerHTML = status.fullconenat_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
|
||||
dnscaching_state.innerHTML = status.dnscaching_state ? '<em><b><font color=green><%:RUNNING%></font></b></em>' : '<em><b><font color=red><%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
});
|
||||
//]]>
|
||||
//]]></script>
|
||||
@ -1,107 +0,0 @@
|
||||
msgid "Turbo ACC Center"
|
||||
msgstr "Turbo ACC 网络加速"
|
||||
|
||||
msgid "Turbo ACC Acceleration Settings"
|
||||
msgstr "Turbo ACC 网络加速设置"
|
||||
|
||||
msgid "Linux Flow Offload Forwarding Engine Settings"
|
||||
msgstr "Linux Flow Offload Forwarding 转发加速引擎设置"
|
||||
|
||||
msgid "Opensource Flow Offloading driver (Fast Path or Hardware NAT)"
|
||||
msgstr "开源流量分载驱动 (支持 Fast Path 或者 硬件 NAT)"
|
||||
|
||||
msgid "Software flow offloading"
|
||||
msgstr "软件流量分载"
|
||||
|
||||
msgid "Software based offloading for routing/NAT"
|
||||
msgstr "基于软件的 Routing/NAT 分载"
|
||||
|
||||
msgid "Hardware flow offloading"
|
||||
msgstr "硬件流量分载"
|
||||
|
||||
msgid "Requires hardware NAT support. Implemented at least for mt76xx"
|
||||
msgstr "需要硬件 NAT 支持。目前 mt76xx 已实现"
|
||||
|
||||
msgid "Shortcut-FE flow offloading"
|
||||
msgstr "Shortcut-FE 流量分载"
|
||||
|
||||
msgid "Shortcut-FE based offloading for routing/NAT"
|
||||
msgstr "基于 Shortcut-FE 的 Routing/NAT 分载"
|
||||
|
||||
msgid "Bridge Acceleration"
|
||||
msgstr "桥接加速"
|
||||
|
||||
msgid "Enable Bridge Acceleration (may be functional conflict with bridge-mode VPN server)"
|
||||
msgstr "启用桥接加速 (可能会和路由器上桥接模式的VPN服务器冲突)"
|
||||
|
||||
msgid "IPv6 Acceleration"
|
||||
msgstr "IPv6 加速"
|
||||
|
||||
msgid "Enable IPv6 Acceleration"
|
||||
msgstr "启用 IPv6 加速"
|
||||
|
||||
msgid "BBR CCA"
|
||||
msgstr "BBR 拥塞控制算法"
|
||||
|
||||
msgid "Using BBR CCA can improve TCP network performance effectively"
|
||||
msgstr "使用 BBR 拥塞控制算法可以有效提升 TCP 网络性能"
|
||||
|
||||
msgid "FullCone NAT"
|
||||
msgstr "全锥形 NAT"
|
||||
|
||||
msgid "Using FullCone NAT can improve gaming performance effectively"
|
||||
msgstr "使用全锥形 NAT 可以有效提升游戏体验"
|
||||
|
||||
msgid "DNS Acceleration"
|
||||
msgstr "DNS 加速"
|
||||
|
||||
msgid "Using optimized DNS records for GoogleHosts (Don't use under Clash Fake-IP mode)"
|
||||
msgstr "使用来自 GoogleHosts 的优质 DNS 记录(请勿在 Clash Fake-IP 模式下使用)"
|
||||
|
||||
msgid "DNS Caching"
|
||||
msgstr "DNS 缓存"
|
||||
|
||||
msgid "Enable DNS Caching and anti ISP DNS pollution"
|
||||
msgstr "启用 DNS 多线程查询、缓存,并防止 ISP 的 DNS 广告和域名劫持"
|
||||
|
||||
msgid "Resolve DNS Mode"
|
||||
msgstr "DNS 解析方式"
|
||||
|
||||
msgid "Only PDNSD and DNSForwarder is supported now"
|
||||
msgstr "目前仅支持 PDNSD 和 DNSForwarder"
|
||||
|
||||
msgid "Using PDNSD to query and cache"
|
||||
msgstr "使用 PDNSD 解析"
|
||||
|
||||
msgid "Using DNSForwarder to query and cache"
|
||||
msgstr "使用 DNSForwarder 解析"
|
||||
|
||||
msgid "Upsteam IPv4 DNS Server"
|
||||
msgstr "上游 IPv4 DNS 服务器"
|
||||
|
||||
msgid "Muitiple IPv4 DNS server can saperate with ','"
|
||||
msgstr "多个上游 IPv4 DNS 服务器请用 ',' 分隔(注意用英文逗号)"
|
||||
|
||||
msgid "Upsteam IPv6 DNS Server"
|
||||
msgstr "上游 IPv6 DNS 服务器"
|
||||
|
||||
msgid "Muitiple IPv6 DNS server can saperate with ','"
|
||||
msgstr "多个上游 IPv6 DNS 服务器请用 ',' 分隔(注意用英文逗号)"
|
||||
|
||||
msgid "Running Status"
|
||||
msgstr "运行状态"
|
||||
|
||||
msgid "Flow Offloading"
|
||||
msgstr "流量分载"
|
||||
|
||||
msgid "BBR CCA"
|
||||
msgstr "BBR 拥塞控制算法"
|
||||
|
||||
msgid "FullCone NAT"
|
||||
msgstr "全锥型 NAT"
|
||||
|
||||
msgid "DNS Caching"
|
||||
msgstr "DNS 缓存"
|
||||
|
||||
msgid "Open Web Interface"
|
||||
msgstr "打开 Web 界面"
|
||||
@ -1,14 +0,0 @@
|
||||
|
||||
config turboacc 'config'
|
||||
option sw_flow '1'
|
||||
option hw_flow '1'
|
||||
option sfe_flow '1'
|
||||
option sfe_bridge '1'
|
||||
option sfe_ipv6 '0'
|
||||
option bbr_cca '1'
|
||||
option fullcone_nat '1'
|
||||
option dns_acc '0'
|
||||
option dns_caching '0'
|
||||
option dns_caching_mode '1'
|
||||
option dns_caching_v4_dns '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'
|
||||
option dns_caching_v6_dns '240c::6666,240c::6644,2001:da8::666,2001:da8:202:10::36,2001:da8:8000:1:202:120:2:100'
|
||||
@ -1,295 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (c) 2011-2015 OpenWrt.org
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
restart_utils="true"
|
||||
|
||||
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_acc" "config" "dns_acc" "0"
|
||||
config_get "dns_caching" "config" "dns_caching" "0"
|
||||
config_get "dns_caching_mode" "config" "dns_caching_mode" "0"
|
||||
config_get "dns_caching_v4_dns" "config" "dns_caching_v4_dns"
|
||||
config_get "dns_caching_v6_dns" "config" "dns_caching_v6_dns"
|
||||
|
||||
[ ! -e "/lib/modules/$(uname -r)/xt_FLOWOFFLOAD.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)/xt_FULLCONENAT.ko" ] && fullcone_nat="0"
|
||||
}
|
||||
|
||||
start_pdnsd() {
|
||||
[ -d "/var/etc" ] || mkdir -p "/var/etc"
|
||||
cat > "/var/etc/dnscache.conf" <<EOF
|
||||
global {
|
||||
perm_cache=1024; # dns缓存大小,单位KB,建议不要写的太大
|
||||
cache_dir="/var/dnscache"; # 缓存文件的位置
|
||||
pid_file = /var/run/dnscache.pid;
|
||||
server_ip = 127.0.0.1; # pdnsd监听的网卡,0.0.0.0是全部网卡
|
||||
server_port=5333; # pdnsd监听的端口,不要和别的服务冲突即可
|
||||
status_ctl = on;
|
||||
paranoid=on; # 二次请求模式,如果请求主DNS服务器返回的是垃圾地址,就向备用服务器请求
|
||||
query_method=udp_only;
|
||||
neg_domain_pol = off;
|
||||
par_queries = 400; # 最多同时请求数
|
||||
min_ttl = 1h; # DNS结果最短缓存时间
|
||||
max_ttl = 1w; # DNS结果最长缓存时间
|
||||
timeout = 10; # DNS请求超时时间,单位秒
|
||||
}
|
||||
|
||||
server {
|
||||
label = "routine";
|
||||
ip = ${dns_caching_v4_dns}; # 这里为主要上级 dns 的 ip 地址,建议填写一个当地最快的DNS地址
|
||||
timeout = 5; # DNS请求超时时间
|
||||
reject = 74.125.127.102, # 以下是脏IP,也就是DNS污染一般会返回的结果,如果收到如下DNS结果会触发二次请求(TCP协议一般不会碰到脏IP)
|
||||
74.125.155.102,
|
||||
74.125.39.102,
|
||||
74.125.39.113,
|
||||
209.85.229.138,
|
||||
128.121.126.139,
|
||||
159.106.121.75,
|
||||
169.132.13.103,
|
||||
192.67.198.6,
|
||||
202.106.1.2,
|
||||
202.181.7.85,
|
||||
203.161.230.171,
|
||||
203.98.7.65,
|
||||
207.12.88.98,
|
||||
208.56.31.43,
|
||||
209.145.54.50,
|
||||
209.220.30.174,
|
||||
209.36.73.33,
|
||||
211.94.66.147,
|
||||
213.169.251.35,
|
||||
216.221.188.182,
|
||||
216.234.179.13,
|
||||
243.185.187.39,
|
||||
37.61.54.158,
|
||||
4.36.66.178,
|
||||
46.82.174.68,
|
||||
59.24.3.173,
|
||||
64.33.88.161,
|
||||
64.33.99.47,
|
||||
64.66.163.251,
|
||||
65.104.202.252,
|
||||
65.160.219.113,
|
||||
66.45.252.237,
|
||||
69.55.52.253,
|
||||
72.14.205.104,
|
||||
72.14.205.99,
|
||||
78.16.49.15,
|
||||
8.7.198.45,
|
||||
93.46.8.89,
|
||||
37.61.54.158,
|
||||
243.185.187.39,
|
||||
190.93.247.4,
|
||||
190.93.246.4,
|
||||
190.93.245.4,
|
||||
190.93.244.4,
|
||||
65.49.2.178,
|
||||
189.163.17.5,
|
||||
23.89.5.60,
|
||||
49.2.123.56,
|
||||
54.76.135.1,
|
||||
77.4.7.92,
|
||||
118.5.49.6,
|
||||
159.24.3.173,
|
||||
188.5.4.96,
|
||||
197.4.4.12,
|
||||
220.250.64.24,
|
||||
243.185.187.30,
|
||||
249.129.46.48,
|
||||
253.157.14.165;
|
||||
reject_policy = fail;
|
||||
}
|
||||
|
||||
server {
|
||||
label = "special"; # 这个随便写
|
||||
ip = 117.50.10.10,52.80.52.52,119.29.29.29; # 这里为备用DNS服务器的 ip 地址
|
||||
port = 5353; # 推荐使用53以外的端口(DNS服务器必须支持
|
||||
proxy_only = on;
|
||||
timeout = 5;
|
||||
}
|
||||
|
||||
source {
|
||||
owner=localhost;
|
||||
// serve_aliases=on;
|
||||
file="/etc/hosts";
|
||||
}
|
||||
|
||||
rr {
|
||||
name=localhost;
|
||||
reverse=on;
|
||||
a=127.0.0.1;
|
||||
owner=localhost;
|
||||
soa=localhost,root.localhost,42,86400,900,86400,86400;
|
||||
}
|
||||
EOF
|
||||
|
||||
if [ ! -f "/var/dnscache/pdnsd.cache" ]; then
|
||||
mkdir -p "/var/dnscache"
|
||||
echo -ne "pd13\000\000\000\000" > "/var/dnscache/pdnsd.cache"
|
||||
chown -R nobody.nogroup "/var/dnscache"
|
||||
fi
|
||||
|
||||
[ -d "/var/sbin" ] || mkdir -p "/var/sbin" && cp -a "/usr/sbin/pdnsd" "/var/sbin/dnscache"
|
||||
/var/sbin/dnscache -c "/var/etc/dnscache.conf" &
|
||||
echo "PDNSD: Start DNS Caching"
|
||||
}
|
||||
|
||||
start_dnsforwarder() {
|
||||
mkdir -p "/var/run/dnscache"
|
||||
cat > "/var/run/dnscache/dnscache.conf" <<EOF
|
||||
LogOn false
|
||||
LogFileThresholdLength 102400
|
||||
LogFileFolder /var/run/dnscache
|
||||
UDPLocal 127.0.0.1:5333
|
||||
UDPGroup ${dns_caching_v4_dns},${dns_caching_v6_dns} * on
|
||||
GroupFile
|
||||
BlockIP 243.185.187.39,46.82.174.68,37.61.54.158,93.46.8.89,59.24.3.173,203.98.7.65,8.7.198.45,78.16.49.15,159.106.121.75,69.63.187.12,31.13.76.8,31.13.64.49
|
||||
IPSubstituting
|
||||
BlockNegativeResponse false
|
||||
Hosts
|
||||
HostsUpdateInterval 18000
|
||||
HostsDownloadPath
|
||||
HostsScript
|
||||
HostsRetryInterval 30
|
||||
AppendHosts
|
||||
BlockIpv6WhenIpv4Exists false
|
||||
UseCache true
|
||||
CacheSize 1048576
|
||||
MemoryCache true
|
||||
CacheFile
|
||||
IgnoreTTL false
|
||||
OverrideTTL -1
|
||||
MultipleTTL 1
|
||||
ReloadCache false
|
||||
OverwriteCache false
|
||||
DisabledType
|
||||
DisabledDomain
|
||||
DisabledList
|
||||
DomainStatistic false
|
||||
DomainStatisticTempletFile
|
||||
StatisticUpdateInterval 29
|
||||
EOF
|
||||
|
||||
[ -d "/var/sbin" ] || mkdir -p "/var/sbin" && cp -a "/usr/bin/dnsforwarder" "/var/sbin/dnscache"
|
||||
/var/sbin/dnscache -f "/var/run/dnscache/dnscache.conf" &
|
||||
echo "DnsForwarder: Start DNS Caching"
|
||||
|
||||
}
|
||||
|
||||
stop_dnscache() {
|
||||
killall -9 "dnscache" 2>"/dev/null"
|
||||
kill -9 $(ps | grep dnscache-while.sh | grep -v "grep" | awk '{print $1}') 2>"/dev/null"
|
||||
rm -rf "/var/dnscache" "/var/run/dnscache"
|
||||
echo "Stop DNS Caching"
|
||||
}
|
||||
|
||||
change_dns() {
|
||||
uci -q delete dhcp.@dnsmasq[0].server
|
||||
uci add_list dhcp.@dnsmasq[0].server="127.0.0.1#5333"
|
||||
uci set dhcp.@dnsmasq[0].noresolv="1"
|
||||
uci commit dhcp
|
||||
|
||||
}
|
||||
|
||||
revert_dns() {
|
||||
uci -q del_list dhcp.@dnsmasq[0].server="127.0.0.1#5333"
|
||||
uci set dhcp.@dnsmasq[0].resolvfile="/tmp/resolv.conf.d/resolv.conf.auto"
|
||||
uci set dhcp.@dnsmasq[0].noresolv="0"
|
||||
uci commit dhcp
|
||||
}
|
||||
|
||||
start(){
|
||||
inital_conf
|
||||
|
||||
uci set firewall.@defaults[0].flow_offloading="${sw_flow}"
|
||||
uci set firewall.@defaults[0].flow_offloading_hw="${hw_flow}"
|
||||
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
|
||||
sysctl -w net.ipv4.tcp_congestion_control="cubic"
|
||||
fi
|
||||
|
||||
[ "${dns_acc}" -eq "1" ] && {
|
||||
mkdir -p "/tmp/dnsmasq.d"
|
||||
wget-ssl -q -t "20" -T "5" "https://cdn.jsdelivr.net/gh/googlehosts/hosts@master/hosts-files/dnsmasq.conf" -O "/tmp/dnsmasq.d/dnsmasq-googlehosts.conf" &
|
||||
}
|
||||
|
||||
if [ "${dns_caching}" -eq "1" ]; then
|
||||
stop_dnscache
|
||||
sleep 1
|
||||
rm -f "/var/log/dnscache.file"
|
||||
if [ "${dns_caching_mode}" = "1" ]; then
|
||||
start_pdnsd
|
||||
elif [ "${dns_caching_mode}" = "2" ]; then
|
||||
start_dnsforwarder
|
||||
fi
|
||||
change_dns
|
||||
nohup "/usr/share/dnscache/dnscache-while.sh" > "/var/log/dnscache.file" 2>&1 &
|
||||
else
|
||||
stop_dnscache
|
||||
revert_dns
|
||||
fi
|
||||
|
||||
if [ "${restart_utils}" = "true" ]; then
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1 && echo "DNSMASQ change"
|
||||
/etc/init.d/firewall restart >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
stop(){
|
||||
inital_conf
|
||||
|
||||
uci set firewall.@defaults[0].flow_offloading="${sw_flow}"
|
||||
uci set firewall.@defaults[0].flow_offloading_hw="${hw_flow}"
|
||||
uci set firewall.@defaults[0].fullcone="${fullcone_nat}"
|
||||
uci commit firewall
|
||||
|
||||
[ "${sfe_flow}" -ne "1" ] && {
|
||||
echo "0" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null"
|
||||
rm -f "/dev/sfe_ipv6"
|
||||
rmmod "fast_classifier" 2>"/dev/null"
|
||||
}
|
||||
|
||||
[ "${dns_acc}" -eq "0" ] && rm -f "/tmp/dnsmasq.d/dnsmasq-googlehosts.conf"
|
||||
|
||||
stop_dnscache
|
||||
revert_dns
|
||||
|
||||
if [ "${restart_utils}" = "true" ]; then
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1 && echo "DNSMASQ revert"
|
||||
/etc/init.d/firewall restart >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
restart(){
|
||||
restart_utils="false"
|
||||
stop
|
||||
start
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1 && echo "DNSMASQ restart"
|
||||
/etc/init.d/firewall restart >/dev/null 2>&1
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@turboacc[-1]
|
||||
add ucitrack turboacc
|
||||
set ucitrack.@turboacc[-1].init=turboacc
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
exit 0
|
||||
@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
sleeptime=60
|
||||
logfile="/var/log/dnscache.file"
|
||||
dns_caching="$(uci -q get turboacc.config.dns_caching)"
|
||||
dns_caching_mode="$(uci -q get turboacc.config.dns_caching_mode 2>/dev/null)"
|
||||
|
||||
clean_log(){
|
||||
logrow="$(grep -c "" "${logfile}")"
|
||||
if [ "${logrow}" -ge "500" ];then
|
||||
echo "${curtime} Log条数超限,清空处理!" > "${logfile}"
|
||||
fi
|
||||
}
|
||||
|
||||
while [ "${dns_caching}" -eq "1" ];
|
||||
do
|
||||
curtime="$(date "+%H:%M:%S")"
|
||||
echo "${curtime} online!"
|
||||
pidof dnscache>/dev/null || {
|
||||
if [ "${dns_caching_mode}" = "1" ]; then
|
||||
/var/sbin/dnscache -c "/var/etc/dnscache.conf" &
|
||||
elif [ "${dns_caching_mode}" = "2" ]; then
|
||||
/var/sbin/dnscache -f "/var/run/dnscache/dnscache.conf" &
|
||||
fi
|
||||
echo "${curtime} 重启服务!" >> ${logfile}
|
||||
}
|
||||
|
||||
clean_log
|
||||
sleep "${sleeptime}"
|
||||
continue
|
||||
done
|
||||
74
package/emortal/autocore/Makefile
Normal file
74
package/emortal/autocore/Makefile
Normal file
@ -0,0 +1,74 @@
|
||||
#
|
||||
# Copyright (C) 2020 Lean <coolsnowwolf@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=autocore
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=40
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/autocore-arm
|
||||
TITLE:=Arm auto core loadbalance script.
|
||||
MAINTAINER:=CN_SZTL
|
||||
DEPENDS:=@(TARGET_bcm27xx||TARGET_bcm53xx||TARGET_ipq40xx||TARGET_ipq806x||TARGET_mvebu||TARGET_rockchip||TARGET_sunxi) \
|
||||
+TARGET_bcm27xx:bcm27xx-userland \
|
||||
+TARGET_bcm53xx:nvram \
|
||||
+(TARGET_ipq40xx||TARGET_ipq806x):lm-sensors
|
||||
VARIANT:=arm
|
||||
endef
|
||||
|
||||
define Package/autocore-x86
|
||||
TITLE:=x86/x64 auto core loadbalance script.
|
||||
MAINTAINER:=Lean
|
||||
DEPENDS:=@TARGET_x86 +bc +lm-sensors +ethtool
|
||||
VARIANT:=x86
|
||||
endef
|
||||
|
||||
define Package/autocore-arm/description
|
||||
A luci autoconfig hotplug script.
|
||||
endef
|
||||
|
||||
define Package/autocore-x86/description
|
||||
A usb autoconfig hotplug script.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/autocore-arm/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/arm/index.htm $(1)/etc/index.htm
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/arm/090-cover-index_htm $(1)/etc/uci-defaults/090-cover-index_htm
|
||||
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) ./files/arm/sbin/cpuinfo $(1)/sbin/cpuinfo
|
||||
ifneq (, $(findstring $(BOARD), ipq40xx ipq806x))
|
||||
$(INSTALL_BIN) ./files/arm/sbin/tempinfo $(1)/sbin/tempinfo
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/autocore-x86/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/x86/autocore $(1)/etc/init.d/autocore
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/x86/index.htm $(1)/etc/index.htm
|
||||
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(CP) ./files/x86/sbin/* $(1)/sbin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,autocore-arm))
|
||||
$(eval $(call BuildPackage,autocore-x86))
|
||||
5
package/emortal/autocore/files/arm/090-cover-index_htm
Executable file
5
package/emortal/autocore/files/arm/090-cover-index_htm
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f /etc/index.htm ] && mv /etc/index.htm /usr/lib/lua/luci/view/admin_status/index.htm
|
||||
|
||||
exit 0
|
||||
822
package/emortal/autocore/files/arm/index.htm
Normal file
822
package/emortal/autocore/files/arm/index.htm
Normal file
@ -0,0 +1,822 @@
|
||||
<%#
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-%>
|
||||
|
||||
<%
|
||||
local fs = require "nixio.fs"
|
||||
local util = require "luci.util"
|
||||
local stat = require "luci.tools.status"
|
||||
local ver = require "luci.version"
|
||||
|
||||
local has_ipv6 = fs.access("/usr/sbin/ip6tables")
|
||||
local has_dhcp = fs.access("/etc/config/dhcp")
|
||||
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
|
||||
local has_temp = fs.access("/sbin/tempinfo")
|
||||
|
||||
local sysinfo = luci.util.ubus("system", "info") or { }
|
||||
local boardinfo = luci.util.ubus("system", "board") or { }
|
||||
local unameinfo = nixio.uname() or { }
|
||||
|
||||
local meminfo = sysinfo.memory or {
|
||||
total = 0,
|
||||
free = 0,
|
||||
buffered = 0,
|
||||
shared = 0
|
||||
}
|
||||
|
||||
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
|
||||
|
||||
local swapinfo = sysinfo.swap or {
|
||||
total = 0,
|
||||
free = 0
|
||||
}
|
||||
|
||||
local has_dsl = fs.access("/etc/init.d/dsl_control")
|
||||
|
||||
if luci.http.formvalue("status") == "1" then
|
||||
local ntm = require "luci.model.network".init()
|
||||
local wan = ntm:get_wannet()
|
||||
local wan6 = ntm:get_wan6net()
|
||||
|
||||
local conn_count = tonumber(
|
||||
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
|
||||
|
||||
local conn_max = tonumber(luci.sys.exec(
|
||||
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
|
||||
):match("%d+")) or 4096
|
||||
|
||||
local user_info = luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l")
|
||||
|
||||
local cpu_usage = luci.sys.exec("top -n1 | awk '/^CPU/ {printf(\"%d%%\", 100 - $8)}'") or "6%"
|
||||
local cpu_info = luci.sys.exec("/sbin/cpuinfo") or "ARM Processor"
|
||||
|
||||
local rv = {
|
||||
cpuinfo = cpu_info,
|
||||
cpuusage = cpu_usage,
|
||||
userinfo = user_info,
|
||||
uptime = sysinfo.uptime or 0,
|
||||
localtime = os.date(),
|
||||
loadavg = sysinfo.load or { 0, 0, 0 },
|
||||
memory = meminfo,
|
||||
memcached = mem_cached,
|
||||
swap = swapinfo,
|
||||
connmax = conn_max,
|
||||
conncount = conn_count,
|
||||
leases = stat.dhcp_leases(),
|
||||
leases6 = stat.dhcp6_leases(),
|
||||
wifinets = stat.wifi_networks()
|
||||
}
|
||||
|
||||
if wan then
|
||||
rv.wan = {
|
||||
ipaddr = wan:ipaddr(),
|
||||
gwaddr = wan:gwaddr(),
|
||||
netmask = wan:netmask(),
|
||||
dns = wan:dnsaddrs(),
|
||||
expires = wan:expires(),
|
||||
uptime = wan:uptime(),
|
||||
proto = wan:proto(),
|
||||
ifname = wan:ifname(),
|
||||
link = wan:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if wan6 then
|
||||
rv.wan6 = {
|
||||
ip6addr = wan6:ip6addr(),
|
||||
gw6addr = wan6:gw6addr(),
|
||||
dns = wan6:dns6addrs(),
|
||||
ip6prefix = wan6:ip6prefix(),
|
||||
uptime = wan6:uptime(),
|
||||
proto = wan6:proto(),
|
||||
ifname = wan6:ifname(),
|
||||
link = wan6:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if has_dsl then
|
||||
local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
|
||||
local dsl_func = loadstring(dsl_stat)
|
||||
if dsl_func then
|
||||
rv.dsl = dsl_func()
|
||||
end
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(rv)
|
||||
|
||||
return
|
||||
elseif luci.http.formvalue("hosts") == "1" then
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(luci.sys.net.host_hints())
|
||||
|
||||
return
|
||||
end
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function progressbar(v, m)
|
||||
{
|
||||
var vn = parseInt(v) || 0;
|
||||
var mn = parseInt(m) || 100;
|
||||
var pc = Math.floor((100 / mn) * vn);
|
||||
|
||||
return String.format(
|
||||
'<div style="width:200px; position:relative; border:1px solid #999999">' +
|
||||
'<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
|
||||
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
|
||||
'<small>%s / %s (%d%%)</small>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>', pc, v, m, pc
|
||||
);
|
||||
}
|
||||
|
||||
function wifirate(bss, rx) {
|
||||
var p = rx ? 'rx_' : 'tx_',
|
||||
s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
|
||||
.format(bss[p+'rate'] / 1000, bss[p+'mhz']),
|
||||
ht = bss[p+'ht'], vht = bss[p+'vht'],
|
||||
mhz = bss[p+'mhz'], nss = bss[p+'nss'],
|
||||
mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'];
|
||||
|
||||
if (ht || vht) {
|
||||
if (vht) s += ', VHT-MCS %d'.format(mcs);
|
||||
if (nss) s += ', VHT-NSS %d'.format(nss);
|
||||
if (ht) s += ', MCS %s'.format(mcs);
|
||||
if (sgi) s += ', <%:Short GI%>';
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function duid2mac(duid) {
|
||||
// DUID-LLT / Ethernet
|
||||
if (duid.length === 28 && duid.substr(0, 8) === '00010001')
|
||||
return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
// DUID-LL / Ethernet
|
||||
if (duid.length === 20 && duid.substr(0, 8) === '00030001')
|
||||
return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var npoll = 1;
|
||||
var hosts = <%=luci.http.write_json(luci.sys.net.host_hints())%>;
|
||||
|
||||
function updateHosts() {
|
||||
XHR.get('<%=REQUEST_URI%>', { hosts: 1 }, function(x, data) {
|
||||
hosts = data;
|
||||
});
|
||||
}
|
||||
|
||||
XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 },
|
||||
function(x, info)
|
||||
{
|
||||
if (!(npoll++ % 5))
|
||||
updateHosts();
|
||||
|
||||
var si = document.getElementById('wan4_i');
|
||||
var ss = document.getElementById('wan4_s');
|
||||
var ifc = info.wan;
|
||||
|
||||
if (ifc && ifc.ifname && ifc.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s<br />' +
|
||||
'<strong><%:Address%>: </strong>%s<br />' +
|
||||
'<strong><%:Netmask%>: </strong>%s<br />' +
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
ifc.proto,
|
||||
(ifc.ipaddr) ? ifc.ipaddr : '0.0.0.0',
|
||||
(ifc.netmask && ifc.netmask != ifc.ipaddr) ? ifc.netmask : '255.255.255.255',
|
||||
(ifc.gwaddr) ? ifc.gwaddr : '0.0.0.0'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.expires > -1)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Expires%>: </strong>%t<br />',
|
||||
ifc.expires
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss.innerHTML = String.format('<small>%s</small>', s);
|
||||
si.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc.link, ifc.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
var si6 = document.getElementById('wan6_i');
|
||||
var ss6 = document.getElementById('wan6_s');
|
||||
var ifc6 = info.wan6;
|
||||
|
||||
if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s%s<br />',
|
||||
ifc6.proto, (ifc6.ip6prefix) ? '-pd' : ''
|
||||
);
|
||||
|
||||
if (!ifc6.ip6prefix)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
(ifc6.ip6addr) ? ifc6.ip6addr : '::'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Prefix Delegated%>: </strong>%s<br />',
|
||||
ifc6.ip6prefix
|
||||
);
|
||||
if (ifc6.ip6addr)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
ifc6.ip6addr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
s += String.format(
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
(ifc6.gw6addr) ? ifc6.gw6addr : '::'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc6.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc6.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc6.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc6.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss6.innerHTML = String.format('<small>%s</small>', s);
|
||||
si6.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc6.link, ifc6.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si6.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss6.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
var dsl_i = document.getElementById('dsl_i');
|
||||
var dsl_s = document.getElementById('dsl_s');
|
||||
|
||||
var s = String.format(
|
||||
'<strong><%:Status%>: </strong>%s<br />' +
|
||||
'<strong><%:Line State%>: </strong>%s [0x%x]<br />' +
|
||||
'<strong><%:Line Mode%>: </strong>%s<br />' +
|
||||
'<strong><%:Annex%>: </strong>%s<br />' +
|
||||
'<strong><%:Profile%>: </strong>%s<br />' +
|
||||
'<strong><%:Data Rate%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Max. Attainable Data Rate (ATTNDR)%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Latency%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Attenuation (LATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Signal Attenuation (SATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Noise Margin (SNR)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Aggregate Transmit Power(ACTATP)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Forward Error Correction Seconds (FECS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Errored seconds (ES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Severely Errored Seconds (SES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Loss of Signal Seconds (LOSS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Unavailable Seconds (UAS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Header Error Code Errors (HEC)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Non Pre-emtive CRC errors (CRC_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Pre-emtive CRC errors (CRCP_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Uptime%>: </strong>%s<br />' +
|
||||
'<strong><%:ATU-C System Vendor ID%>: </strong>%s<br />' +
|
||||
'<strong><%:Power Management Mode%>: </strong>%s<br />',
|
||||
info.dsl.line_state, info.dsl.line_state_detail,
|
||||
info.dsl.line_state_num,
|
||||
info.dsl.line_mode_s,
|
||||
info.dsl.annex_s,
|
||||
info.dsl.profile_s,
|
||||
info.dsl.data_rate_down_s, info.dsl.data_rate_up_s,
|
||||
info.dsl.max_data_rate_down_s, info.dsl.max_data_rate_up_s,
|
||||
info.dsl.latency_num_down, info.dsl.latency_num_up,
|
||||
info.dsl.line_attenuation_down, info.dsl.line_attenuation_up,
|
||||
info.dsl.signal_attenuation_down, info.dsl.signal_attenuation_up,
|
||||
info.dsl.noise_margin_down, info.dsl.noise_margin_up,
|
||||
info.dsl.actatp_down, info.dsl.actatp_up,
|
||||
info.dsl.errors_fec_near, info.dsl.errors_fec_far,
|
||||
info.dsl.errors_es_near, info.dsl.errors_es_far,
|
||||
info.dsl.errors_ses_near, info.dsl.errors_ses_far,
|
||||
info.dsl.errors_loss_near, info.dsl.errors_loss_far,
|
||||
info.dsl.errors_uas_near, info.dsl.errors_uas_far,
|
||||
info.dsl.errors_hec_near, info.dsl.errors_hec_far,
|
||||
info.dsl.errors_crc_p_near, info.dsl.errors_crc_p_far,
|
||||
info.dsl.errors_crcp_p_near, info.dsl.errors_crcp_p_far,
|
||||
info.dsl.line_uptime_s,
|
||||
info.dsl.atuc_vendor_id,
|
||||
info.dsl.power_mode_s
|
||||
);
|
||||
|
||||
dsl_s.innerHTML = String.format('<small>%s</small>', s);
|
||||
dsl_i.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small>DSL</small>'
|
||||
);
|
||||
<% end %>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
var ls = document.getElementById('lease_status_table');
|
||||
if (ls)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ls.rows.length > 1 )
|
||||
ls.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases[i].expires);
|
||||
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].hostname ? info.leases[i].hostname : '?';
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].ipaddr;
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].macaddr;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls.rows.length == 1 )
|
||||
{
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
|
||||
var ls6 = document.getElementById('lease6_status_table');
|
||||
if (ls6 && info.leases6)
|
||||
{
|
||||
ls6.parentNode.style.display = 'block';
|
||||
|
||||
/* clear all rows */
|
||||
while( ls6.rows.length > 1 )
|
||||
ls6.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases6.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases6[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases6[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases6[i].expires);
|
||||
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
var host = hosts[duid2mac(info.leases6[i].duid)];
|
||||
if (!info.leases6[i].hostname)
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && (host.name || host.ipv4 || host.ipv6))
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
|
||||
: '?';
|
||||
else
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && host.name && info.leases6[i].hostname != host.name)
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(info.leases6[i].hostname, host.name)
|
||||
: info.leases6[i].hostname;
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].duid;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls6.rows.length == 1 )
|
||||
{
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
var assoclist = [ ];
|
||||
|
||||
var ws = document.getElementById('wifi_status_table');
|
||||
if (ws)
|
||||
{
|
||||
var wsbody = ws.rows[0].parentNode;
|
||||
while (ws.rows.length > 0)
|
||||
wsbody.deleteRow(0);
|
||||
|
||||
for (var didx = 0; didx < info.wifinets.length; didx++)
|
||||
{
|
||||
var dev = info.wifinets[didx];
|
||||
|
||||
var tr = wsbody.insertRow(-1);
|
||||
var td;
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
td.width = "33%";
|
||||
td.innerHTML = dev.name;
|
||||
td.style.verticalAlign = "top";
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
|
||||
var s = '';
|
||||
|
||||
for (var nidx = 0; nidx < dev.networks.length; nidx++)
|
||||
{
|
||||
var net = dev.networks[nidx];
|
||||
var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
|
||||
|
||||
var icon;
|
||||
if (!is_assoc)
|
||||
icon = "<%=resource%>/icons/signal-none.png";
|
||||
else if (net.quality == 0)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (net.quality < 25)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (net.quality < 50)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (net.quality < 75)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
s += String.format(
|
||||
'<table><tr><td style="text-align:center; width:32px; padding:3px">' +
|
||||
'<img src="%s" title="<%:Signal%>: %d dBm / <%:Noise%>: %d dBm" />' +
|
||||
'<br /><small>%d%%</small>' +
|
||||
'</td><td style="text-align:left; padding:3px"><small>' +
|
||||
'<strong><%:SSID%>:</strong> <a href="%s">%h</a><br />' +
|
||||
'<strong><%:Mode%>:</strong> %s<br />' +
|
||||
'<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' +
|
||||
'<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%><br />',
|
||||
icon, net.signal, net.noise,
|
||||
net.quality,
|
||||
net.link, net.ssid || '?',
|
||||
net.mode,
|
||||
net.channel, net.frequency,
|
||||
net.bitrate || '?'
|
||||
);
|
||||
|
||||
if (is_assoc)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:BSSID%>:</strong> %s<br />' +
|
||||
'<strong><%:Encryption%>:</strong> %s',
|
||||
net.bssid || '?',
|
||||
net.encryption
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += '<em><%:Wireless is disabled or not associated%></em>';
|
||||
}
|
||||
|
||||
s += '</small></td></tr></table>';
|
||||
|
||||
for (var bssid in net.assoclist)
|
||||
{
|
||||
var bss = net.assoclist[bssid];
|
||||
|
||||
bss.bssid = bssid;
|
||||
bss.link = net.link;
|
||||
bss.name = net.name;
|
||||
bss.ifname = net.ifname;
|
||||
bss.radio = dev.name;
|
||||
|
||||
assoclist.push(bss);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s)
|
||||
s = '<em><%:No information available%></em>';
|
||||
|
||||
td.innerHTML = s;
|
||||
}
|
||||
}
|
||||
|
||||
var ac = document.getElementById('wifi_assoc_table');
|
||||
if (ac)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ac.rows.length > 1 )
|
||||
ac.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
assoclist.sort(function(a, b) {
|
||||
return (a.name == b.name)
|
||||
? (a.bssid < b.bssid)
|
||||
: (a.name > b.name )
|
||||
;
|
||||
});
|
||||
|
||||
for( var i = 0; i < assoclist.length; i++ )
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2));
|
||||
|
||||
var icon;
|
||||
var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5;
|
||||
if (q < 1)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (q < 2)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (q < 3)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (q < 4)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> %h</span>',
|
||||
assoclist[i].radio, assoclist[i].ifname
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<a href="%s">%s</a>',
|
||||
assoclist[i].link,
|
||||
'%h'.format(assoclist[i].name).nobr()
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = assoclist[i].bssid;
|
||||
|
||||
var host = hosts[assoclist[i].bssid];
|
||||
if (host)
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
|
||||
((host.name && (host.ipv4 || host.ipv6))
|
||||
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
|
||||
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
|
||||
);
|
||||
else
|
||||
tr.insertCell(-1).innerHTML = '?';
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>',
|
||||
assoclist[i].signal, assoclist[i].noise, assoclist[i].signal - assoclist[i].noise,
|
||||
icon,
|
||||
assoclist[i].signal, assoclist[i].noise
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = wifirate(assoclist[i], true).nobr() + '<br />' + wifirate(assoclist[i], false).nobr();
|
||||
}
|
||||
|
||||
if (ac.rows.length == 1)
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 7;
|
||||
td.innerHTML = '<br /><em><%:No information available%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
var e;
|
||||
|
||||
if (e = document.getElementById('localtime'))
|
||||
e.innerHTML = info.localtime;
|
||||
|
||||
if (e = document.getElementById('uptime'))
|
||||
e.innerHTML = String.format('%t', info.uptime);
|
||||
|
||||
if (e = document.getElementById('userinfo'))
|
||||
e.innerHTML = info.userinfo;
|
||||
|
||||
if (e = document.getElementById('cpuusage'))
|
||||
e.innerHTML = info.cpuusage;
|
||||
|
||||
if (e = document.getElementById('cpuinfo'))
|
||||
e.innerHTML = info.cpuinfo;
|
||||
|
||||
if (e = document.getElementById('loadavg'))
|
||||
e.innerHTML = String.format(
|
||||
'%.02f, %.02f, %.02f',
|
||||
info.loadavg[0] / 65535.0,
|
||||
info.loadavg[1] / 65535.0,
|
||||
info.loadavg[2] / 65535.0
|
||||
);
|
||||
|
||||
if (e = document.getElementById('memtotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(((info.memory.free + info.memory.buffered) / 1048576) + (info.memcached / 1024)) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('membuff'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.memory.buffered / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swaptotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swapfree'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('conns'))
|
||||
e.innerHTML = progressbar(info.conncount, info.connmax);
|
||||
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<h2 name="content"><%:Status%></h2>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:System%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Hostname%></td><td><%=luci.sys.hostname() or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Model%></td><td><%=pcdata(boardinfo.model or "?")%> <%=luci.sys.exec("cat /etc/bench.log") or ""%></td></tr>
|
||||
<tr><td width="33%"><%:Architecture%></td><td id="cpuinfo">-</td></tr>
|
||||
<% if has_temp then %>
|
||||
<tr><td width="33%"><%:Temperature%></td><td><%=luci.sys.exec("/sbin/tempinfo") or "?"%></td></tr>
|
||||
<% end %>
|
||||
<tr><td width="33%"><%:Firmware Version%></td><td>
|
||||
<%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> /
|
||||
<%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>)
|
||||
</td></tr>
|
||||
<tr><td width="33%"><%:Kernel Version%></td><td><%=unameinfo.release or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr>
|
||||
<tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr>
|
||||
<tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr>
|
||||
<tr><td width="33%"><%:CPU usage (%)%></td><td id="cpuusage">-</td></tr>
|
||||
<tr><td width="33%"><%:Source Code%></td><td><a href="https://github.com/immortalwrt" target="_blank">
|
||||
Project ImmortalWrt</a> / <a href="https://github.com/immortalwrt/immortalwrt" target="_blank">ImmortalWrt Core</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Memory%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="memtotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Buffered%></td><td id="membuff">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if swapinfo.total > 0 then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Swap%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="swaptotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Free%></td><td id="swapfree">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Network%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv4 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan4_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan4_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% if has_ipv6 then %>
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv6 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan6_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan6_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% end %>
|
||||
<tr><td width="33%"><%:Online Users%></td><td id="userinfo">0</td></tr>
|
||||
<tr><td width="33%"><%:Active Connections%></td><td id="conns">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DHCP Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
<fieldset class="cbi-section" style="display:none">
|
||||
<legend><%:DHCPv6 Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease6_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Host%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv6-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:DUID%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DSL%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:DSL Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="dsl_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="dsl_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Wireless%></legend>
|
||||
|
||||
<table id="wifi_status_table" width="100%" cellspacing="10">
|
||||
<tr><td><em><%:Collecting data...%></em></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<%+footer%>
|
||||
35
package/emortal/autocore/files/arm/sbin/cpuinfo
Executable file
35
package/emortal/autocore/files/arm/sbin/cpuinfo
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
cpu_arch="$(cat "/proc/cpuinfo" | grep "model name" | sed -n "1p" | awk -F ': ' '{print $2}')"
|
||||
[ -z "${cpu_arch}" ] && cpu_arch="?"
|
||||
cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)"
|
||||
|
||||
if grep -q "bcm27xx" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(expr $(vcgencmd measure_clock arm | awk -F '=' '{print $2}') / 1000000)Mhz"
|
||||
elif grep -q "bcm53xx" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz"
|
||||
elif grep -q "mvebu" "/etc/openwrt_release"; then
|
||||
cpu_freq="$(cat "/proc/cpuinfo" | grep "BogoMIPS" | sed -n "1p" | awk -F ': ' '{print $2}')MHz"
|
||||
elif [ -e "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq" ]; then
|
||||
cpu_freq="$(expr $(cat "/sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq") / 1000)MHz"
|
||||
fi
|
||||
if [ -e "/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq" ]; then
|
||||
big_cpu_freq="$(expr $(cat "/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq") / 1000)MHz "
|
||||
fi
|
||||
|
||||
if grep -q "bcm27xx" "/etc/openwrt_release"; then
|
||||
cpu_temp="$(vcgencmd measure_temp | awk -F '=' '{print $2}' | awk -F "'" '{print $1}')°C"
|
||||
else
|
||||
[ -e "/sys/class/thermal/thermal_zone0/temp" ] && \
|
||||
cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' /sys/class/thermal/thermal_zone0/temp)"
|
||||
fi
|
||||
|
||||
if [ -z "${cpu_freq}" ] && [ -z "${cpu_temp}" ]; then
|
||||
echo -n "${cpu_arch} x ${cpu_cores}"
|
||||
elif [ -z "${cpu_temp}" ] || grep -q "ipq" "/etc/openwrt_release"; then
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_freq})"
|
||||
elif [ -z "${cpu_freq}" ]; then
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${cpu_temp})"
|
||||
else
|
||||
echo -n "${cpu_arch} x ${cpu_cores} (${big_cpu_freq}${cpu_freq}, ${cpu_temp})"
|
||||
fi
|
||||
15
package/emortal/autocore/files/arm/sbin/tempinfo
Executable file
15
package/emortal/autocore/files/arm/sbin/tempinfo
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
mt76_path="/sys/kernel/debug/ieee80211/phy0/mt76/temperature"
|
||||
if [ -e "${mt76_path}" ]; then
|
||||
mt76_temp=" $(cat "${mt76_path}" | awk -F ': ' '{print $2}')°C"
|
||||
fi
|
||||
|
||||
sys_temp="$(sensors | grep -Eo '\+[0-9]+.+C' | grep -Ev 'high' | sed ':a;N;$!ba;s/\n/ /g;s/+//g')"
|
||||
|
||||
if grep -q "ipq40xx" "/etc/openwrt_release"; then
|
||||
echo -n "WiFi:${mt76_temp} ${sys_temp}"
|
||||
else
|
||||
cpu_temp="$(awk "BEGIN{printf (\"%.1f\n\",$(cat /sys/class/thermal/thermal_zone0/temp)/1000) }")°C"
|
||||
echo -n "CPU: ${cpu_temp}, WiFi: ${sys_temp}"
|
||||
fi
|
||||
52
package/emortal/autocore/files/x86/autocore
Executable file
52
package/emortal/autocore/files/x86/autocore
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2017 lean <coolsnowwolf@gmail.com>
|
||||
|
||||
START=99
|
||||
|
||||
start()
|
||||
{
|
||||
rfc=4096
|
||||
cc=$(grep -c processor /proc/cpuinfo)
|
||||
rsfe=$(echo $cc*$rfc | bc)
|
||||
sysctl -w net.core.rps_sock_flow_entries=$rsfe >/dev/null
|
||||
for fileRps in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
|
||||
do
|
||||
echo $cc > $fileRps
|
||||
done
|
||||
|
||||
for fileRfc in $(ls /sys/class/net/eth*/queues/rx-*/rps_flow_cnt)
|
||||
do
|
||||
echo $rfc > $fileRfc
|
||||
done
|
||||
|
||||
uci set network.@globals[0].packet_steering=1
|
||||
uci commit network
|
||||
|
||||
a=$(cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq)
|
||||
b=$(echo -n ' : ')
|
||||
c=$(cat /proc/cpuinfo | grep 'core id' | sort -u | wc -l)
|
||||
d=$(echo -n ' Core ')
|
||||
e=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
|
||||
f=$(echo -n ' Thread ')
|
||||
g=${a}${b}${c}${d}${e}${f}
|
||||
|
||||
mkdir -p /tmp/sysinfo
|
||||
echo $g > /tmp/sysinfo/model
|
||||
|
||||
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
|
||||
b=$(echo "$a" | wc -l)
|
||||
for i in $(seq 1 $b)
|
||||
do
|
||||
c=$(echo "$a" | sed -n ${i}p)
|
||||
ethtool -K $c rx-checksum on >/dev/null 2>&1
|
||||
ethtool -K $c tx-checksum-ip-generic on >/dev/null 2>&1 || (
|
||||
ethtool -K $c tx-checksum-ipv4 on >/dev/null 2>&1
|
||||
ethtool -K $c tx-checksum-ipv6 on >/dev/null 2>&1)
|
||||
ethtool -K $c tx-scatter-gather on >/dev/null 2>&1
|
||||
ethtool -K $c gso on >/dev/null 2>&1
|
||||
ethtool -K $c tso on >/dev/null 2>&1
|
||||
ethtool -K $c ufo on >/dev/null 2>&1
|
||||
done
|
||||
|
||||
[ -f /etc/index.htm ] && mv /etc/index.htm /usr/lib/lua/luci/view/admin_status/index.htm
|
||||
}
|
||||
843
package/emortal/autocore/files/x86/index.htm
Normal file
843
package/emortal/autocore/files/x86/index.htm
Normal file
@ -0,0 +1,843 @@
|
||||
<%#
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
|
||||
Licensed to the public under the Apache License 2.0.
|
||||
-%>
|
||||
|
||||
<%
|
||||
local fs = require "nixio.fs"
|
||||
local util = require "luci.util"
|
||||
local stat = require "luci.tools.status"
|
||||
local ver = require "luci.version"
|
||||
|
||||
local has_ipv6 = fs.access("/usr/sbin/ip6tables")
|
||||
local has_dhcp = fs.access("/etc/config/dhcp")
|
||||
local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0)
|
||||
|
||||
local sysinfo = luci.util.ubus("system", "info") or { }
|
||||
local boardinfo = luci.util.ubus("system", "board") or { }
|
||||
local unameinfo = nixio.uname() or { }
|
||||
|
||||
local meminfo = sysinfo.memory or {
|
||||
total = 0,
|
||||
free = 0,
|
||||
buffered = 0,
|
||||
shared = 0
|
||||
}
|
||||
|
||||
local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo")
|
||||
|
||||
local swapinfo = sysinfo.swap or {
|
||||
total = 0,
|
||||
free = 0
|
||||
}
|
||||
|
||||
local has_dsl = fs.access("/etc/init.d/dsl_control")
|
||||
|
||||
if luci.http.formvalue("status") == "1" then
|
||||
local ntm = require "luci.model.network".init()
|
||||
local wan = ntm:get_wannet()
|
||||
local wan6 = ntm:get_wan6net()
|
||||
|
||||
local conn_count = tonumber(
|
||||
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
|
||||
|
||||
local conn_max = tonumber(luci.sys.exec(
|
||||
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
|
||||
):match("%d+")) or 4096
|
||||
|
||||
local cpu_info = luci.sys.exec("cpuinfo")
|
||||
|
||||
local eth_info = luci.sys.exec("ethinfo")
|
||||
|
||||
local user_info = luci.sys.exec("cat /proc/net/arp | grep '0x2' | wc -l") or 0
|
||||
|
||||
local cpu_usage = luci.sys.exec("top -n1 | awk '/^CPU/ {printf(\"%d%%\", 100 - $8)}'") or "6%"
|
||||
|
||||
local rv = {
|
||||
cpuusage = cpu_usage,
|
||||
cpuinfo = cpu_info,
|
||||
ethinfo = eth_info,
|
||||
userinfo = user_info,
|
||||
uptime = sysinfo.uptime or 0,
|
||||
localtime = os.date(),
|
||||
loadavg = sysinfo.load or { 0, 0, 0 },
|
||||
memory = meminfo,
|
||||
memcached = mem_cached,
|
||||
swap = swapinfo,
|
||||
connmax = conn_max,
|
||||
conncount = conn_count,
|
||||
leases = stat.dhcp_leases(),
|
||||
leases6 = stat.dhcp6_leases(),
|
||||
wifinets = stat.wifi_networks()
|
||||
}
|
||||
|
||||
if wan then
|
||||
rv.wan = {
|
||||
ipaddr = wan:ipaddr(),
|
||||
gwaddr = wan:gwaddr(),
|
||||
netmask = wan:netmask(),
|
||||
dns = wan:dnsaddrs(),
|
||||
expires = wan:expires(),
|
||||
uptime = wan:uptime(),
|
||||
proto = wan:proto(),
|
||||
ifname = wan:ifname(),
|
||||
link = wan:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if wan6 then
|
||||
rv.wan6 = {
|
||||
ip6addr = wan6:ip6addr(),
|
||||
gw6addr = wan6:gw6addr(),
|
||||
dns = wan6:dns6addrs(),
|
||||
ip6prefix = wan6:ip6prefix(),
|
||||
uptime = wan6:uptime(),
|
||||
proto = wan6:proto(),
|
||||
ifname = wan6:ifname(),
|
||||
link = wan6:adminlink()
|
||||
}
|
||||
end
|
||||
|
||||
if has_dsl then
|
||||
local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
|
||||
local dsl_func = loadstring(dsl_stat)
|
||||
if dsl_func then
|
||||
rv.dsl = dsl_func()
|
||||
end
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(rv)
|
||||
|
||||
return
|
||||
elseif luci.http.formvalue("hosts") == "1" then
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(luci.sys.net.host_hints())
|
||||
|
||||
return
|
||||
end
|
||||
-%>
|
||||
|
||||
<%+header%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-19.167.54478-71e2af4"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function progressbar(v, m)
|
||||
{
|
||||
var vn = parseInt(v) || 0;
|
||||
var mn = parseInt(m) || 100;
|
||||
var pc = Math.floor((100 / mn) * vn);
|
||||
|
||||
return String.format(
|
||||
'<div style="width:200px; position:relative; border:1px solid #999999">' +
|
||||
'<div style="background-color:#CCCCCC; width:%d%%; height:15px">' +
|
||||
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%; color:#000000">' +
|
||||
'<small>%s / %s (%d%%)</small>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>', pc, v, m, pc
|
||||
);
|
||||
}
|
||||
|
||||
function wifirate(bss, rx) {
|
||||
var p = rx ? 'rx_' : 'tx_',
|
||||
s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
|
||||
.format(bss[p+'rate'] / 1000, bss[p+'mhz']),
|
||||
ht = bss[p+'ht'], vht = bss[p+'vht'],
|
||||
mhz = bss[p+'mhz'], nss = bss[p+'nss'],
|
||||
mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'];
|
||||
|
||||
if (ht || vht) {
|
||||
if (vht) s += ', VHT-MCS %d'.format(mcs);
|
||||
if (nss) s += ', VHT-NSS %d'.format(nss);
|
||||
if (ht) s += ', MCS %s'.format(mcs);
|
||||
if (sgi) s += ', <%:Short GI%>';
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function duid2mac(duid) {
|
||||
// DUID-LLT / Ethernet
|
||||
if (duid.length === 28 && duid.substr(0, 8) === '00010001')
|
||||
return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
// DUID-LL / Ethernet
|
||||
if (duid.length === 20 && duid.substr(0, 8) === '00030001')
|
||||
return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var npoll = 1;
|
||||
var hosts = <%=luci.http.write_json(luci.sys.net.host_hints())%>;
|
||||
|
||||
function updateHosts() {
|
||||
XHR.get('<%=REQUEST_URI%>', { hosts: 1 }, function(x, data) {
|
||||
hosts = data;
|
||||
});
|
||||
}
|
||||
|
||||
XHR.poll(1, '<%=REQUEST_URI%>', { status: 1 },
|
||||
function(x, info)
|
||||
{
|
||||
if (!(npoll++ % 5))
|
||||
updateHosts();
|
||||
|
||||
var si = document.getElementById('wan4_i');
|
||||
var ss = document.getElementById('wan4_s');
|
||||
var ifc = info.wan;
|
||||
|
||||
if (ifc && ifc.ifname && ifc.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s<br />' +
|
||||
'<strong><%:Address%>: </strong>%s<br />' +
|
||||
'<strong><%:Netmask%>: </strong>%s<br />' +
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
ifc.proto,
|
||||
(ifc.ipaddr) ? ifc.ipaddr : '0.0.0.0',
|
||||
(ifc.netmask && ifc.netmask != ifc.ipaddr) ? ifc.netmask : '255.255.255.255',
|
||||
(ifc.gwaddr) ? ifc.gwaddr : '0.0.0.0'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.expires > -1)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Expires%>: </strong>%t<br />',
|
||||
ifc.expires
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss.innerHTML = String.format('<small>%s</small>', s);
|
||||
si.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc.link, ifc.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
var si6 = document.getElementById('wan6_i');
|
||||
var ss6 = document.getElementById('wan6_s');
|
||||
var ifc6 = info.wan6;
|
||||
|
||||
if (ifc6 && ifc6.ifname && ifc6.proto != 'none')
|
||||
{
|
||||
var s = String.format(
|
||||
'<strong><%:Type%>: </strong>%s%s<br />',
|
||||
ifc6.proto, (ifc6.ip6prefix) ? '-pd' : ''
|
||||
);
|
||||
|
||||
if (!ifc6.ip6prefix)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
(ifc6.ip6addr) ? ifc6.ip6addr : '::'
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Prefix Delegated%>: </strong>%s<br />',
|
||||
ifc6.ip6prefix
|
||||
);
|
||||
if (ifc6.ip6addr)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Address%>: </strong>%s<br />',
|
||||
ifc6.ip6addr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
s += String.format(
|
||||
'<strong><%:Gateway%>: </strong>%s<br />',
|
||||
(ifc6.gw6addr) ? ifc6.gw6addr : '::'
|
||||
);
|
||||
|
||||
for (var i = 0; i < ifc6.dns.length; i++)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:DNS%> %d: </strong>%s<br />',
|
||||
i + 1, ifc6.dns[i]
|
||||
);
|
||||
}
|
||||
|
||||
if (ifc6.uptime > 0)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:Connected%>: </strong>%t<br />',
|
||||
ifc6.uptime
|
||||
);
|
||||
}
|
||||
|
||||
ss6.innerHTML = String.format('<small>%s</small>', s);
|
||||
si6.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small><a href="%s">%s</a></small>',
|
||||
ifc6.link, ifc6.ifname
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
si6.innerHTML = '<img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small>';
|
||||
ss6.innerHTML = '<em><%:Not connected%></em>';
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
var dsl_i = document.getElementById('dsl_i');
|
||||
var dsl_s = document.getElementById('dsl_s');
|
||||
|
||||
var s = String.format(
|
||||
'<strong><%:Status%>: </strong>%s<br />' +
|
||||
'<strong><%:Line State%>: </strong>%s [0x%x]<br />' +
|
||||
'<strong><%:Line Mode%>: </strong>%s<br />' +
|
||||
'<strong><%:Annex%>: </strong>%s<br />' +
|
||||
'<strong><%:Profile%>: </strong>%s<br />' +
|
||||
'<strong><%:Data Rate%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Max. Attainable Data Rate (ATTNDR)%>: </strong>%s/s / %s/s<br />' +
|
||||
'<strong><%:Latency%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Attenuation (LATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Signal Attenuation (SATN)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Noise Margin (SNR)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Aggregate Transmit Power(ACTATP)%>: </strong>%s dB / %s dB<br />' +
|
||||
'<strong><%:Forward Error Correction Seconds (FECS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Errored seconds (ES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Severely Errored Seconds (SES)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Loss of Signal Seconds (LOSS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Unavailable Seconds (UAS)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Header Error Code Errors (HEC)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Non Pre-emtive CRC errors (CRC_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Pre-emtive CRC errors (CRCP_P)%>: </strong>%s / %s<br />' +
|
||||
'<strong><%:Line Uptime%>: </strong>%s<br />' +
|
||||
'<strong><%:ATU-C System Vendor ID%>: </strong>%s<br />' +
|
||||
'<strong><%:Power Management Mode%>: </strong>%s<br />',
|
||||
info.dsl.line_state, info.dsl.line_state_detail,
|
||||
info.dsl.line_state_num,
|
||||
info.dsl.line_mode_s,
|
||||
info.dsl.annex_s,
|
||||
info.dsl.profile_s,
|
||||
info.dsl.data_rate_down_s, info.dsl.data_rate_up_s,
|
||||
info.dsl.max_data_rate_down_s, info.dsl.max_data_rate_up_s,
|
||||
info.dsl.latency_num_down, info.dsl.latency_num_up,
|
||||
info.dsl.line_attenuation_down, info.dsl.line_attenuation_up,
|
||||
info.dsl.signal_attenuation_down, info.dsl.signal_attenuation_up,
|
||||
info.dsl.noise_margin_down, info.dsl.noise_margin_up,
|
||||
info.dsl.actatp_down, info.dsl.actatp_up,
|
||||
info.dsl.errors_fec_near, info.dsl.errors_fec_far,
|
||||
info.dsl.errors_es_near, info.dsl.errors_es_far,
|
||||
info.dsl.errors_ses_near, info.dsl.errors_ses_far,
|
||||
info.dsl.errors_loss_near, info.dsl.errors_loss_far,
|
||||
info.dsl.errors_uas_near, info.dsl.errors_uas_far,
|
||||
info.dsl.errors_hec_near, info.dsl.errors_hec_far,
|
||||
info.dsl.errors_crc_p_near, info.dsl.errors_crc_p_far,
|
||||
info.dsl.errors_crcp_p_near, info.dsl.errors_crcp_p_far,
|
||||
info.dsl.line_uptime_s,
|
||||
info.dsl.atuc_vendor_id,
|
||||
info.dsl.power_mode_s
|
||||
);
|
||||
|
||||
dsl_s.innerHTML = String.format('<small>%s</small>', s);
|
||||
dsl_i.innerHTML = String.format(
|
||||
'<img src="<%=resource%>/icons/ethernet.png" />' +
|
||||
'<br /><small>DSL</small>'
|
||||
);
|
||||
<% end %>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
var ls = document.getElementById('lease_status_table');
|
||||
if (ls)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ls.rows.length > 1 )
|
||||
ls.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases[i].expires);
|
||||
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].hostname ? info.leases[i].hostname : '?';
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].ipaddr;
|
||||
tr.insertCell(-1).innerHTML = info.leases[i].macaddr;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls.rows.length == 1 )
|
||||
{
|
||||
var tr = ls.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
|
||||
var ls6 = document.getElementById('lease6_status_table');
|
||||
if (ls6 && info.leases6)
|
||||
{
|
||||
ls6.parentNode.style.display = 'block';
|
||||
|
||||
/* clear all rows */
|
||||
while( ls6.rows.length > 1 )
|
||||
ls6.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
for( var i = 0; i < info.leases6.length; i++ )
|
||||
{
|
||||
var timestr;
|
||||
|
||||
if (info.leases6[i].expires === false)
|
||||
timestr = '<em><%:unlimited%></em>';
|
||||
else if (info.leases6[i].expires <= 0)
|
||||
timestr = '<em><%:expired%></em>';
|
||||
else
|
||||
timestr = String.format('%t', info.leases6[i].expires);
|
||||
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||
|
||||
var host = hosts[duid2mac(info.leases6[i].duid)];
|
||||
if (!info.leases6[i].hostname)
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && (host.name || host.ipv4 || host.ipv6))
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
|
||||
: '?';
|
||||
else
|
||||
tr.insertCell(-1).innerHTML =
|
||||
(host && host.name && info.leases6[i].hostname != host.name)
|
||||
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(info.leases6[i].hostname, host.name)
|
||||
: info.leases6[i].hostname;
|
||||
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
|
||||
tr.insertCell(-1).innerHTML = info.leases6[i].duid;
|
||||
tr.insertCell(-1).innerHTML = timestr;
|
||||
}
|
||||
|
||||
if( ls6.rows.length == 1 )
|
||||
{
|
||||
var tr = ls6.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 4;
|
||||
td.innerHTML = '<em><br /><%:There are no active leases.%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
var assoclist = [ ];
|
||||
|
||||
var ws = document.getElementById('wifi_status_table');
|
||||
if (ws)
|
||||
{
|
||||
var wsbody = ws.rows[0].parentNode;
|
||||
while (ws.rows.length > 0)
|
||||
wsbody.deleteRow(0);
|
||||
|
||||
for (var didx = 0; didx < info.wifinets.length; didx++)
|
||||
{
|
||||
var dev = info.wifinets[didx];
|
||||
|
||||
var tr = wsbody.insertRow(-1);
|
||||
var td;
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
td.width = "33%";
|
||||
td.innerHTML = dev.name;
|
||||
td.style.verticalAlign = "top";
|
||||
|
||||
td = tr.insertCell(-1);
|
||||
|
||||
var s = '';
|
||||
|
||||
for (var nidx = 0; nidx < dev.networks.length; nidx++)
|
||||
{
|
||||
var net = dev.networks[nidx];
|
||||
var is_assoc = (net.bssid != '00:00:00:00:00:00' && net.channel && !net.disabled);
|
||||
|
||||
var icon;
|
||||
if (!is_assoc)
|
||||
icon = "<%=resource%>/icons/signal-none.png";
|
||||
else if (net.quality == 0)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (net.quality < 25)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (net.quality < 50)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (net.quality < 75)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
s += String.format(
|
||||
'<table><tr><td style="text-align:center; width:32px; padding:3px">' +
|
||||
'<img src="%s" title="<%:Signal%>: %d dBm / <%:Noise%>: %d dBm" />' +
|
||||
'<br /><small>%d%%</small>' +
|
||||
'</td><td style="text-align:left; padding:3px"><small>' +
|
||||
'<strong><%:SSID%>:</strong> <a href="%s">%h</a><br />' +
|
||||
'<strong><%:Mode%>:</strong> %s<br />' +
|
||||
'<strong><%:Channel%>:</strong> %d (%.3f <%:GHz%>)<br />' +
|
||||
'<strong><%:Bitrate%>:</strong> %s <%:Mbit/s%><br />',
|
||||
icon, net.signal, net.noise,
|
||||
net.quality,
|
||||
net.link, net.ssid || '?',
|
||||
net.mode,
|
||||
net.channel, net.frequency,
|
||||
net.bitrate || '?'
|
||||
);
|
||||
|
||||
if (is_assoc)
|
||||
{
|
||||
s += String.format(
|
||||
'<strong><%:BSSID%>:</strong> %s<br />' +
|
||||
'<strong><%:Encryption%>:</strong> %s',
|
||||
net.bssid || '?',
|
||||
net.encryption
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
s += '<em><%:Wireless is disabled or not associated%></em>';
|
||||
}
|
||||
|
||||
s += '</small></td></tr></table>';
|
||||
|
||||
for (var bssid in net.assoclist)
|
||||
{
|
||||
var bss = net.assoclist[bssid];
|
||||
|
||||
bss.bssid = bssid;
|
||||
bss.link = net.link;
|
||||
bss.name = net.name;
|
||||
bss.ifname = net.ifname;
|
||||
bss.radio = dev.name;
|
||||
|
||||
assoclist.push(bss);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s)
|
||||
s = '<em><%:No information available%></em>';
|
||||
|
||||
td.innerHTML = s;
|
||||
}
|
||||
}
|
||||
|
||||
var ac = document.getElementById('wifi_assoc_table');
|
||||
if (ac)
|
||||
{
|
||||
/* clear all rows */
|
||||
while( ac.rows.length > 1 )
|
||||
ac.rows[0].parentNode.deleteRow(1);
|
||||
|
||||
assoclist.sort(function(a, b) {
|
||||
return (a.name == b.name)
|
||||
? (a.bssid < b.bssid)
|
||||
: (a.name > b.name )
|
||||
;
|
||||
});
|
||||
|
||||
for( var i = 0; i < assoclist.length; i++ )
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2));
|
||||
|
||||
var icon;
|
||||
var q = (-1 * (assoclist[i].noise - assoclist[i].signal)) / 5;
|
||||
if (q < 1)
|
||||
icon = "<%=resource%>/icons/signal-0.png";
|
||||
else if (q < 2)
|
||||
icon = "<%=resource%>/icons/signal-0-25.png";
|
||||
else if (q < 3)
|
||||
icon = "<%=resource%>/icons/signal-25-50.png";
|
||||
else if (q < 4)
|
||||
icon = "<%=resource%>/icons/signal-50-75.png";
|
||||
else
|
||||
icon = "<%=resource%>/icons/signal-75-100.png";
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> %h</span>',
|
||||
assoclist[i].radio, assoclist[i].ifname
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<a href="%s">%s</a>',
|
||||
assoclist[i].link,
|
||||
'%h'.format(assoclist[i].name).nobr()
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = assoclist[i].bssid;
|
||||
|
||||
var host = hosts[assoclist[i].bssid];
|
||||
if (host)
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
|
||||
((host.name && (host.ipv4 || host.ipv6))
|
||||
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
|
||||
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
|
||||
);
|
||||
else
|
||||
tr.insertCell(-1).innerHTML = '?';
|
||||
|
||||
tr.insertCell(-1).innerHTML = String.format(
|
||||
'<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>',
|
||||
assoclist[i].signal, assoclist[i].noise, assoclist[i].signal - assoclist[i].noise,
|
||||
icon,
|
||||
assoclist[i].signal, assoclist[i].noise
|
||||
);
|
||||
|
||||
tr.insertCell(-1).innerHTML = wifirate(assoclist[i], true).nobr() + '<br />' + wifirate(assoclist[i], false).nobr();
|
||||
}
|
||||
|
||||
if (ac.rows.length == 1)
|
||||
{
|
||||
var tr = ac.rows[0].parentNode.insertRow(-1);
|
||||
tr.className = 'cbi-section-table-row';
|
||||
|
||||
var td = tr.insertCell(-1);
|
||||
td.colSpan = 7;
|
||||
td.innerHTML = '<br /><em><%:No information available%></em>';
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
var e;
|
||||
|
||||
if (e = document.getElementById('ethinfo')) {
|
||||
var ports = eval('(' + info.ethinfo + ')');
|
||||
var tmp = "";
|
||||
for (var i in ports)
|
||||
{
|
||||
tmp = tmp + String.format(
|
||||
'<td style="text-align:center"><span style="line-height:25px">%s</span><br /><small><img src="<%=resource%>/icons/%s" /><br />%s<br />%s</small></td>', ports[i].name,
|
||||
ports[i].status ? 'port_up.png' : 'port_down.png',
|
||||
ports[i].speed,
|
||||
ports[i].duplex ? '<%:full-duplex%>' : '<%:half-duplex%>');
|
||||
};
|
||||
e.innerHTML = "<tr>" + tmp + "</tr>";
|
||||
}
|
||||
|
||||
if (e = document.getElementById('localtime'))
|
||||
e.innerHTML = info.localtime;
|
||||
|
||||
if (e = document.getElementById('uptime'))
|
||||
e.innerHTML = String.format('%t', info.uptime);
|
||||
|
||||
if (e = document.getElementById('userinfo'))
|
||||
e.innerHTML = info.userinfo;
|
||||
|
||||
if (e = document.getElementById('cpuinfo'))
|
||||
e.innerHTML = info.cpuinfo;
|
||||
|
||||
if (e = document.getElementById('cpuusage'))
|
||||
e.innerHTML = info.cpuusage;
|
||||
|
||||
if (e = document.getElementById('loadavg'))
|
||||
e.innerHTML = String.format(
|
||||
'%.02f, %.02f, %.02f',
|
||||
info.loadavg[0] / 65535.0,
|
||||
info.loadavg[1] / 65535.0,
|
||||
info.loadavg[2] / 65535.0
|
||||
);
|
||||
|
||||
if (e = document.getElementById('memtotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(((info.memory.free + info.memory.buffered) / 1048576) + (info.memcached / 1024)) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('membuff'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.memory.buffered / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.memory.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swaptotal'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('swapfree'))
|
||||
e.innerHTML = progressbar(
|
||||
Math.floor(info.swap.free / 1048576) + " <%:MB%>",
|
||||
Math.floor(info.swap.total / 1048576) + " <%:MB%>"
|
||||
);
|
||||
|
||||
if (e = document.getElementById('conns'))
|
||||
e.innerHTML = progressbar(info.conncount, info.connmax);
|
||||
|
||||
}
|
||||
);
|
||||
//]]></script>
|
||||
|
||||
<h2 name="content"><%:Status%></h2>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:System%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Hostname%></td><td><%=luci.sys.hostname() or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Model%></td><td><%=pcdata(boardinfo.model or "?")%> <%=luci.sys.exec("cat /etc/bench.log") or " "%></td></tr>
|
||||
<tr><td width="33%"><%:CPU Info%></td><td id="cpuinfo">-</td></tr>
|
||||
<tr><td width="33%"><%:Firmware Version%></td><td>
|
||||
<%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> /
|
||||
<%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>)
|
||||
</td></tr>
|
||||
<tr><td width="33%"><%:Kernel Version%></td><td><%=unameinfo.release or "?"%></td></tr>
|
||||
<tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr>
|
||||
<tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr>
|
||||
<tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr>
|
||||
<tr><td width="33%"><%:CPU usage (%)%></td><td id="cpuusage">-</td></tr>
|
||||
<tr><td width="33%"><%:Source Code%></td><td><a href="https://github.com/immortalwrt" target="_blank">
|
||||
Project ImmortalWrt</a> / <a href="https://github.com/immortalwrt/immortalwrt" target="_blank">ImmortalWrt Core</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Memory%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="memtotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Buffered%></td><td id="membuff">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if swapinfo.total > 0 then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Swap%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%"><%:Total Available%></td><td id="swaptotal">-</td></tr>
|
||||
<tr><td width="33%"><%:Free%></td><td id="swapfree">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Interfaces%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10" id="ethinfo">
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Network%></legend>
|
||||
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv4 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan4_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan4_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% if has_ipv6 then %>
|
||||
<tr><td width="33%" style="vertical-align:top"><%:IPv6 WAN Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="wan6_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="wan6_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
<% end %>
|
||||
<tr><td width="33%"><%:Online Users%></td><td id="userinfo">0</td></tr>
|
||||
<tr><td width="33%"><%:Active Connections%></td><td id="conns">-</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_dhcp then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DHCP Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Hostname%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<% if has_ipv6 then %>
|
||||
<fieldset class="cbi-section" style="display:none">
|
||||
<legend><%:DHCPv6 Leases%></legend>
|
||||
|
||||
<table class="cbi-section-table" id="lease6_status_table">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"><%:Host%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv6-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:DUID%></th>
|
||||
<th class="cbi-section-table-cell"><%:Leasetime remaining%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row">
|
||||
<td colspan="4"><em><br /><%:Collecting data...%></em></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if has_dsl then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:DSL%></legend>
|
||||
<table width="100%" cellspacing="10">
|
||||
<tr><td width="33%" style="vertical-align:top"><%:DSL Status%></td><td>
|
||||
<table><tr>
|
||||
<td id="dsl_i" style="width:16px; text-align:center; padding:3px"><img src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
|
||||
<td id="dsl_s" style="vertical-align:middle; padding: 3px"><em><%:Collecting data...%></em></td>
|
||||
</tr></table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% if has_wifi then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Wireless%></legend>
|
||||
|
||||
<table id="wifi_status_table" width="100%" cellspacing="10">
|
||||
<tr><td><em><%:Collecting data...%></em></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<%+footer%>
|
||||
5
package/emortal/autocore/files/x86/sbin/cpuinfo
Executable file
5
package/emortal/autocore/files/x86/sbin/cpuinfo
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
MHz=`grep 'MHz' /proc/cpuinfo | cut -c11- |sed -n '1p'`
|
||||
TEMP=`sensors 2>/dev/null | grep 'Core 0' | cut -c12-`
|
||||
echo "$MHz MHz $TEMP "
|
||||
39
package/emortal/autocore/files/x86/sbin/ethinfo
Executable file
39
package/emortal/autocore/files/x86/sbin/ethinfo
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
a=$(ip address | grep ^[0-9] | awk -F: '{print $2}' | sed "s/ //g" | grep '^[e]' | grep -v "@" | grep -v "\.")
|
||||
b=$(echo "$a" | wc -l)
|
||||
rm -f /tmp/state/ethinfo
|
||||
|
||||
echo -n "[" > /tmp/state/ethinfo
|
||||
|
||||
for i in $(seq 1 $b)
|
||||
do
|
||||
h=$(echo '{"name":' )
|
||||
c=$(echo "$a" | sed -n ${i}p)
|
||||
d=$(ethtool $c)
|
||||
|
||||
e=$(echo "$d" | grep "Link detected" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
|
||||
if [ $e = yes ]; then
|
||||
l=1
|
||||
else
|
||||
l=0
|
||||
fi
|
||||
|
||||
f=$(echo "$d" | grep "Speed" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g' | tr -d "Unknown!")
|
||||
[ -z "$f" ] && f=" - "
|
||||
|
||||
g=$(echo "$d" | grep "Duplex" | awk -F: '{printf $2}' | sed 's/^[ \t]*//g')
|
||||
if [ "$g" == "Full" ]; then
|
||||
x=1
|
||||
else
|
||||
x=0
|
||||
fi
|
||||
|
||||
echo -n "$h \"$c\", \"status\": $l, \"speed\": \"$f\", \"duplex\": $x}," >> /tmp/state/ethinfo
|
||||
done
|
||||
|
||||
sed -i 's/.$//' /tmp/state/ethinfo
|
||||
|
||||
echo -n "]" >> /tmp/state/ethinfo
|
||||
|
||||
cat /tmp/state/ethinfo
|
||||
8
package/emortal/autocore/files/x86/sbin/getcpu
Executable file
8
package/emortal/autocore/files/x86/sbin/getcpu
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $(busybox ps -w | grep getcpu | grep -v grep | wc -l) -le 2 ]; then
|
||||
AT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
|
||||
sleep 1
|
||||
BT=$(cat /proc/stat | grep "^cpu " | awk '{print $2+$3+$4+$5+$6+$7+$8 " " $2+$3+$4+$7+$8}')
|
||||
printf "%.01f%%" $(echo $AT $BT | awk '{print (($4-$2)/($3-$1))*100}') >/tmp/cpuusage
|
||||
fi
|
||||
38
package/emortal/automount/Makefile
Normal file
38
package/emortal/automount/Makefile
Normal file
@ -0,0 +1,38 @@
|
||||
#
|
||||
# Copyright (C) 2010-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=automount
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=$(COMMITCOUNT)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/automount
|
||||
TITLE:=Mount autoconfig hotplug script.
|
||||
MAINTAINER:=Lean
|
||||
DEPENDS:=+block-mount +kmod-usb-storage +kmod-usb-storage-extras +!TARGET_ramips:kmod-usb-storage-uas \
|
||||
+kmod-fs-vfat +kmod-fs-ext4 +LINUX_5_4:kmod-fs-exfat0 +!LINUX_5_4:kmod-fs-exfat +ntfs-3g
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/automount/description
|
||||
A usb autoconfig hotplug script.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/automount/install
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/15-automount $(1)/etc/15-automount
|
||||
$(INSTALL_BIN) ./files/zzz-move-automount $(1)/etc/uci-defaults/zzz-move-automount
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,automount))
|
||||
27
package/emortal/automount/files/15-automount
Executable file
27
package/emortal/automount/files/15-automount
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
# 0 yes blockdevice handles this - 1 no it is not there
|
||||
blkdev=`dirname $DEVPATH`
|
||||
basename=`basename $blkdev`
|
||||
device=`basename $DEVPATH`
|
||||
skip=`block info | sed 's/\(.*\): .*/\1/' | grep -q $device ; echo $?`
|
||||
path=$DEVPATH
|
||||
|
||||
if [ $basename != "block" ] && [ -z "${device##sd*}" ] && [ $skip -eq 1 ]; then
|
||||
mntpnt=$device
|
||||
case "$ACTION" in
|
||||
add)
|
||||
mkdir -p /mnt/$mntpnt
|
||||
chmod 777 /mnt/$mntpnt
|
||||
# Try to be gentle on solid state devices
|
||||
mount -o rw,noatime,discard /dev/$device /mnt/$mntpnt
|
||||
;;
|
||||
remove)
|
||||
# Once the device is removed, the /dev entry disappear. We need mountpoint
|
||||
mountpoint=`mount |grep /dev/$device | sed 's/.* on \(.*\) type.*/\1/'`
|
||||
umount -l $mountpoint
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
4
package/emortal/automount/files/zzz-move-automount
Executable file
4
package/emortal/automount/files/zzz-move-automount
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
sleep 15
|
||||
mv /etc/15-automount /etc/hotplug.d/block/
|
||||
36
package/emortal/autosamba/Makefile
Normal file
36
package/emortal/autosamba/Makefile
Normal file
@ -0,0 +1,36 @@
|
||||
#
|
||||
# Copyright (C) 2010-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=autosamba
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=12
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/autosamba
|
||||
TITLE:=Samba autoconfig hotplug script.
|
||||
MAINTAINER:=Lean
|
||||
DEPENDS:=+luci-app-samba +wsdd2
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/autosamba/description
|
||||
A hotplug script to config Samba share automatically.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/autosamba/install
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/block
|
||||
$(INSTALL_BIN) ./files/20-smb $(1)/etc/hotplug.d/block/20-smb
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,autosamba))
|
||||
105
package/emortal/autosamba/files/20-smb
Executable file
105
package/emortal/autosamba/files/20-smb
Executable file
@ -0,0 +1,105 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# D-Team Technology Co.,Ltd. ShenZhen
|
||||
# 作者:Vic
|
||||
#
|
||||
# 警告:对着屏幕的哥们,我们允许你使用此脚本,但不允许你抹去作者的信息,请保留这段话。
|
||||
#
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/service.sh
|
||||
|
||||
global=0
|
||||
config_file="/etc/config/samba"
|
||||
|
||||
wait_for_init() {
|
||||
for i in `seq 30`
|
||||
do
|
||||
[ -e /tmp/procd.done ] || {
|
||||
sleep 1; continue;
|
||||
}
|
||||
return
|
||||
done
|
||||
}
|
||||
|
||||
smb_handle() {
|
||||
config_get path $1 path
|
||||
if [ "$path" = "$2" ] ;then
|
||||
global=1
|
||||
fi
|
||||
}
|
||||
|
||||
chk_en() {
|
||||
config_get_bool autoshare $1 autoshare 1
|
||||
[ $autoshare -eq 0 ] && exit
|
||||
}
|
||||
|
||||
config_load samba
|
||||
config_foreach chk_en samba
|
||||
|
||||
device=`basename $DEVPATH`
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
|
||||
case "$device" in
|
||||
sd*);;
|
||||
md*);;
|
||||
hd*);;
|
||||
mmcblk*);;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
path="/dev/$device"
|
||||
|
||||
wait_for_init
|
||||
|
||||
cat /proc/mounts | while read j
|
||||
do
|
||||
str=${j%% *}
|
||||
if [ "$str" == $path ];then
|
||||
strr=${j#* }
|
||||
target=${strr%% *}
|
||||
global=0
|
||||
config_foreach smb_handle sambashare $target
|
||||
name=${target#*/mnt/}
|
||||
|
||||
if [ $global -eq 0 ] ;then
|
||||
echo -e "\n\nconfig sambashare" >> $config_file
|
||||
echo -e "\toption auto '1'" >> $config_file
|
||||
echo -e "\toption name '$name'" >> $config_file
|
||||
echo -e "\toption path '$target'" >> $config_file
|
||||
echo -e "\toption read_only 'no'" >> $config_file
|
||||
echo -e "\toption guest_ok 'yes'" >> $config_file
|
||||
echo -e "\toption create_mask '0666'" >> $config_file
|
||||
echo -e "\toption dir_mask '0777'" >> $config_file
|
||||
echo -e "\toption device '$device'" >> $config_file
|
||||
/etc/init.d/samba reload
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
||||
remove)
|
||||
i=0
|
||||
while true
|
||||
do
|
||||
dev=`uci get samba.@sambashare[$i].device`
|
||||
[ $? -ne 0 ] && break
|
||||
|
||||
[ "$dev" = "$device" ] && {
|
||||
auto=`uci get samba.@sambashare[$i].auto`
|
||||
[ $auto = "1" ] && {
|
||||
mount_dir=`uci get samba.@sambashare[$i].name`
|
||||
uci delete samba.@sambashare[$i]
|
||||
uci commit
|
||||
/etc/init.d/samba reload
|
||||
return
|
||||
}
|
||||
}
|
||||
let i+=1
|
||||
done
|
||||
;;
|
||||
esac
|
||||
49
package/emortal/default-settings/Makefile
Normal file
49
package/emortal/default-settings/Makefile
Normal file
@ -0,0 +1,49 @@
|
||||
#
|
||||
# Copyright (C) 2021 Lean <coolsnowwolf@gmail.com>
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=default-settings
|
||||
PKG_VERSION:=1.1
|
||||
PKG_RELEASE:=61
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/default-settings
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
TITLE:=LuCI support for Default Settings
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+luci-base +@LUCI_LANG_en +@LUCI_LANG_zh-cn
|
||||
endef
|
||||
|
||||
define Package/default-settings/description
|
||||
Language Support Packages.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/default-settings/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/openwrt_banner $(1)/etc/openwrt_banner
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/zzz-default-settings $(1)/etc/uci-defaults/99-default-settings
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./i18n/default.zh-cn.po $(1)/usr/lib/lua/luci/i18n/default.zh-cn.lmo
|
||||
po2lmo ./i18n/more.zh-cn.po $(1)/usr/lib/lua/luci/i18n/more.zh-cn.lmo
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,default-settings))
|
||||
11
package/emortal/default-settings/files/openwrt_banner
Normal file
11
package/emortal/default-settings/files/openwrt_banner
Normal file
@ -0,0 +1,11 @@
|
||||
[0;1;34;94m┌────────────[0;34m────────────[0;37m─────────────[0;1;30;90m────────┐[0m
|
||||
[0;1;34;94m│[0m [0;1;30;90m│[0m
|
||||
[0;1;34;94m│[0m [0;1;34;94mmmmmm[0m [0;37mm[0m [0;1;30;90m""#[0m [0;34m│[0m
|
||||
[0;1;34;94m│[0m [0;34m#[0m [0;34mmmmmm[0m [0;34mm[0;37mmmmm[0m [0;37mmmm[0m [0;37mm[0m[0;1;30;90mmm[0m [0;1;30;90mmm#mm[0m [0;1;30;90mmmm[0m [0;1;34;94m#[0m [0;34m│[0m
|
||||
[0;37m│[0m [0;34m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#"[0m [0;1;30;90m"#[0m [0;1;30;90m#"[0m [0;1;30;90m"[0m [0;1;30;90m#[0m [0;1;34;94m"[0m [0;1;34;94m#[0m [0;1;34;94m#[0m [0;34m│[0m
|
||||
[0;37m│[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;37m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;34;94m#[0m [0;1;34;94mm"""#[0m [0;34m#[0m [0;1;34;94m│[0m
|
||||
[0;37m│[0m [0;37mmm#mm[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m#[0m [0;1;30;90m"#[0;1;34;94mm#"[0m [0;1;34;94m#[0m [0;1;34;94m"m[0;34mm[0m [0;34m"mm"#[0m [0;34m"mm[0m [0;1;34;94m│[0m
|
||||
[0;1;30;90m│[0m [0;37m│[0m
|
||||
[0;1;30;90m│[0;34m───────────────────[0;1;34;94m────────────[0;37m──────────────│[0m
|
||||
[0;1;30;90m│[0m [0;1;34;94mImmortalWrt[0m [0;1;34;94m18.06[0m [0;37m│[0m
|
||||
[0;1;34;94m└[0;1;34;94m─────────────[0;34m──────────────[0;1;30;90m───────────[0;37m───────┘[0m
|
||||
54
package/emortal/default-settings/files/zzz-default-settings
Executable file
54
package/emortal/default-settings/files/zzz-default-settings
Executable file
@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci set luci.main.lang=auto
|
||||
uci commit luci
|
||||
|
||||
uci set system.@system[0].timezone=CST-8
|
||||
uci set system.@system[0].zonename=Asia/Shanghai
|
||||
uci commit system
|
||||
|
||||
uci set fstab.@global[0].anon_mount=1
|
||||
uci commit fstab
|
||||
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/mwan.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/upnp.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/ddns.htm
|
||||
rm -f /usr/lib/lua/luci/view/admin_status/index/minidlna.htm
|
||||
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/aria2.lua
|
||||
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/aria2/overview_status.htm
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/hd_idle.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/samba.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/minidlna.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/transmission.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/mjpg-streamer.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/p910nd.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/usb_printer.lua
|
||||
sed -i 's/\"services\"/\"nas\"/g' /usr/lib/lua/luci/controller/xunlei.lua
|
||||
sed -i 's/services/nas/g' /usr/lib/lua/luci/view/minidlna_status.htm
|
||||
|
||||
ln -sf /sbin/ip /usr/bin/ip
|
||||
|
||||
sed -i 's#https://downloads.openwrt.org#https://mirrors.tencent.com/lede#g' /etc/opkg/distfeeds.conf
|
||||
sed -i '/openwrt_luci/ { s/snapshots/releases\/18.06.9/g; }' /etc/opkg/distfeeds.conf
|
||||
sed -i "s/# //g" /etc/opkg/distfeeds.conf
|
||||
|
||||
sed -i 's/root::0:0:99999:7:::/root:$1$V4UetPzk$CYXluq4wUazHjmCDBCqXF.:0:0:99999:7:::/g' /etc/shadow
|
||||
[ -f '/bin/bash' ] && sed -i 's|root:x:0:0:root:/root:/bin/ash|root:x:0:0:root:/root:/bin/bash|g' /etc/passwd
|
||||
|
||||
sed -i '/option disabled/d' /etc/config/wireless
|
||||
sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
|
||||
|
||||
sed -i '/log-facility/d' /etc/dnsmasq.conf
|
||||
echo "log-facility=/dev/null" >> /etc/dnsmasq.conf
|
||||
|
||||
sed -i 's/cbi.submit\"] = true/cbi.submit\"] = \"1\"/g' /usr/lib/lua/luci/dispatcher.lua
|
||||
|
||||
echo 'hsts=0' > /root/.wgetrc
|
||||
|
||||
rm -rf /tmp/luci-modulecache/
|
||||
rm -f /tmp/luci-indexcache
|
||||
|
||||
mv /etc/openwrt_banner /etc/banner
|
||||
|
||||
exit 0
|
||||
73
package/emortal/default-settings/i18n/default.zh-cn.po
Normal file
73
package/emortal/default-settings/i18n/default.zh-cn.po
Normal file
@ -0,0 +1,73 @@
|
||||
msgid "Processor"
|
||||
msgstr "处理器"
|
||||
|
||||
msgid "Architecture"
|
||||
msgstr "架构"
|
||||
|
||||
msgid "CPU Temperature"
|
||||
msgstr "CPU 温度"
|
||||
|
||||
msgid "CPU Info"
|
||||
msgstr "CPU 信息"
|
||||
|
||||
msgid "CPU Model"
|
||||
msgstr "处理器型号"
|
||||
|
||||
msgid "CPU frequency"
|
||||
msgstr "CPU 频率"
|
||||
|
||||
msgid "RAM frequency"
|
||||
msgstr "RAM 频率"
|
||||
|
||||
msgid "Flash Size"
|
||||
msgstr "闪存大小"
|
||||
|
||||
msgid "Free Memory"
|
||||
msgstr "释放内存"
|
||||
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "ZRam Settings"
|
||||
msgstr "ZRam 设置"
|
||||
|
||||
msgid "ZRam Compression Algorithm"
|
||||
msgstr "ZRam 压缩算法"
|
||||
|
||||
msgid "ZRam Compression Streams"
|
||||
msgstr "ZRam 压缩数据流线程数"
|
||||
|
||||
msgid "ZRam Size"
|
||||
msgstr "ZRam 大小"
|
||||
|
||||
msgid "Size of the ZRam device in megabytes"
|
||||
msgstr "划分给 ZRam 分区的内存大小(MB),推荐留空由系统自动管理"
|
||||
|
||||
msgid "Number of parallel threads used for compression"
|
||||
msgstr "用于压缩内存数据的CPU并发线程数"
|
||||
|
||||
msgid "Swap"
|
||||
msgstr "虚拟内存"
|
||||
|
||||
msgid "Base Setting"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "Log"
|
||||
msgstr "日志"
|
||||
|
||||
msgid "Force 40MHz mode"
|
||||
msgstr "强制 40MHz 频宽"
|
||||
|
||||
msgid ""
|
||||
"Always use 40MHz channels even if the secondary channel overlaps. Using this "
|
||||
"option does not comply with IEEE 802.11n-2009!"
|
||||
msgstr "强制启用 40MHz 频宽并忽略辅助信道重叠。此选项可能不兼容某些无线硬件导致无法启用!"
|
||||
|
||||
msgid "Disassociate On Low Acknowledgement"
|
||||
msgstr "弱信号剔除"
|
||||
|
||||
msgid "Allow AP mode to disconnect STAs based on low ACK condition"
|
||||
msgstr "允许 AP 模式基于低 ACK 条件判断剔除弱信号的客户端"
|
||||
1048
package/emortal/default-settings/i18n/more.zh-cn.po
Normal file
1048
package/emortal/default-settings/i18n/more.zh-cn.po
Normal file
File diff suppressed because it is too large
Load Diff
45
package/emortal/ipv6-helper/Makefile
Normal file
45
package/emortal/ipv6-helper/Makefile
Normal file
@ -0,0 +1,45 @@
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt-dist
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ipv6helper
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=LEAN
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ipv6helper
|
||||
SECTION:=ipv6
|
||||
TITLE:=IPv6 Helper and Dynamic Update he.net of ip
|
||||
DEPENDS:=+luci-proto-ipv6 +wget-ssl +libip6tc +ip6tables +ip6tables-mod-nat \
|
||||
+kmod-ipt-nat6 +kmod-nf-nat6 +odhcpd-ipv6only +odhcp6c +6in4
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/description
|
||||
IPv6 Helper and Dynamic Update he.net of ip
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/ipv6helper/install
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/60-6in4 $(1)/etc/hotplug.d/iface/60-6in4
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/60-ipv6-hybrid $(1)/etc/uci-defaults/60-ipv6-hybrid
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ipv6helper))
|
||||
12
package/emortal/ipv6-helper/files/60-6in4
Executable file
12
package/emortal/ipv6-helper/files/60-6in4
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
if [ "$ACTION" != "ifup" ]; then
|
||||
exit
|
||||
fi
|
||||
config_load network
|
||||
config_get tunnelid $INTERFACE tunnelid
|
||||
config_get username $INTERFACE username
|
||||
config_get password $INTERFACE password
|
||||
if [ "$tunnelid" != "" ]; then
|
||||
wget -O - https://$username:$password@ipv4.tunnelbroker.net/nic/update?hostname=$tunnelid --no-check-certificate
|
||||
fi
|
||||
9
package/emortal/ipv6-helper/files/60-ipv6-hybrid
Executable file
9
package/emortal/ipv6-helper/files/60-ipv6-hybrid
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci set dhcp.lan.ra='hybrid'
|
||||
uci set dhcp.lan.ndp='hybrid'
|
||||
uci set dhcp.lan.dhcpv6='hybrid'
|
||||
uci set dhcp.lan.ra_management='1'
|
||||
uci commit dhcp
|
||||
|
||||
exit 0
|
||||
18
package/emortal/luci-app-mtwifi/Makefile
Normal file
18
package/emortal/luci-app-mtwifi/Makefile
Normal file
@ -0,0 +1,18 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Hua Shao <nossiac@163.com>
|
||||
|
||||
LUCI_TITLE:=LuCI support for mt wifi driver
|
||||
LUCI_DEPENDS:=@TARGET_ramips +mt_wifi
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=16
|
||||
|
||||
define Package/luci-app-mtwifi/conffiles
|
||||
/etc/wireless/mt7615/
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
833
package/emortal/luci-app-mtwifi/luasrc/controller/mtkwifi.lua
Normal file
833
package/emortal/luci-app-mtwifi/luasrc/controller/mtkwifi.lua
Normal file
@ -0,0 +1,833 @@
|
||||
-- This module is a demo to configure MTK' proprietary WiFi driver.
|
||||
-- Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
|
||||
-- LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
|
||||
-- translate uci into MTK's WiFi profile (like we did in "uci2dat").
|
||||
-- And you will get your hands dirty.
|
||||
--
|
||||
-- Hua Shao <nossiac@163.com>
|
||||
|
||||
module("luci.controller.mtkwifi", package.seeall)
|
||||
local http = require("luci.http")
|
||||
local mtkwifi = require("mtkwifi")
|
||||
|
||||
function __mtkwifi_reload(devname)
|
||||
local profiles = mtkwifi.search_dev_and_profile()
|
||||
|
||||
for dev,profile in pairs(profiles) do
|
||||
if not devname or devname == dev then
|
||||
local diff = mtkwifi.diff_profile(profile)
|
||||
-- Adding or deleting a vif will need to reinstall the wifi ko,
|
||||
-- so we call "mtkwifi restart" here.
|
||||
if diff.BssidNum then
|
||||
os.execute("/sbin/mtkwifi restart "..devname)
|
||||
else
|
||||
os.execute("/sbin/mtkwifi reload "..devname)
|
||||
end
|
||||
-- keep a backup for this commit
|
||||
-- it will be used in mtkwifi.diff_profile()
|
||||
os.execute("cp -f "..profile.." "..mtkwifi.__profile_bak_path(profile))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function index()
|
||||
|
||||
entry({"admin", "network", "wifi"}, template("admin_mtk/mtk_wifi_overview"), _("Wireless"), 25)
|
||||
entry({"admin", "network", "wifi", "dev_cfg_view"}, template("admin_mtk/mtk_wifi_dev_cfg")).leaf = true
|
||||
entry({"admin", "network", "wifi", "dev_cfg"}, call("dev_cfg")).leaf = true
|
||||
entry({"admin", "network", "wifi", "dev_cfg_reset"}, call("dev_cfg_reset")).leaf = true
|
||||
entry({"admin", "network", "wifi", "dev_cfg_raw"}, call("dev_cfg_raw")).leaf = true
|
||||
entry({"admin", "network", "wifi", "vif_cfg_view"}, template("admin_mtk/mtk_wifi_vif_cfg")).leaf = true
|
||||
entry({"admin", "network", "wifi", "vif_cfg"}, call("vif_cfg")).leaf = true
|
||||
entry({"admin", "network", "wifi", "vif_add_view"}, template("admin_mtk/mtk_wifi_vif_cfg")).leaf = true
|
||||
entry({"admin", "network", "wifi", "vif_add"}, call("vif_cfg")).leaf = true
|
||||
entry({"admin", "network", "wifi", "vif_del"}, call("vif_del")).leaf = true
|
||||
entry({"admin", "network", "wifi", "vif_disable"}, call("vif_disable")).leaf = true
|
||||
entry({"admin", "network", "wifi", "vif_enable"}, call("vif_enable")).leaf = true
|
||||
entry({"admin", "network", "wifi", "get_station_list"}, call("get_station_list"))
|
||||
entry({"admin", "network", "wifi", "get_country_region_list"}, call("get_country_region_list")).leaf = true
|
||||
entry({"admin", "network", "wifi", "get_channel_list"}, call("get_channel_list"))
|
||||
entry({"admin", "network", "wifi", "get_HT_ext_channel_list"}, call("get_HT_ext_channel_list"))
|
||||
entry({"admin", "network", "wifi", "get_5G_2nd_80Mhz_channel_list"}, call("get_5G_2nd_80Mhz_channel_list"))
|
||||
entry({"admin", "network", "wifi", "reset"}, call("reset_wifi")).leaf = true
|
||||
entry({"admin", "network", "wifi", "reload"}, call("reload_wifi")).leaf = true
|
||||
entry({"admin", "network", "wifi", "get_raw_profile"}, call("get_raw_profile"))
|
||||
entry({"admin", "network", "wifi", "apcli_cfg_view"}, template("admin_mtk/mtk_wifi_apcli")).leaf = true
|
||||
entry({"admin", "network", "wifi", "apcli_cfg"}, call("apcli_cfg")).leaf = true
|
||||
entry({"admin", "network", "wifi", "apcli_disconnect"}, call("apcli_disconnect")).leaf = true
|
||||
entry({"admin", "network", "wifi", "apcli_connect"}, call("apcli_connect")).leaf = true
|
||||
entry({"admin", "network", "wifi", "apcli_scan"}, call("apcli_scan")).leaf = true;
|
||||
end
|
||||
|
||||
function dev_cfg(devname)
|
||||
local profiles = mtkwifi.search_dev_and_profile()
|
||||
assert(profiles[devname])
|
||||
local cfgs = mtkwifi.load_profile(profiles[devname])
|
||||
|
||||
for k,v in pairs(http.formvalue()) do
|
||||
if type(v) ~= type("") and type(v) ~= type(0) then
|
||||
nixio.syslog("err", "dev_cfg, invalid value type for "..k..","..type(v))
|
||||
elseif string.byte(k) == string.byte("_") then
|
||||
nixio.syslog("err", "dev_cfg, special: "..k.."="..v)
|
||||
else
|
||||
cfgs[k] = v or ""
|
||||
end
|
||||
end
|
||||
|
||||
if mtkwifi.band(cfgs.WirelessMode) == "5G" then
|
||||
cfgs.CountryRegionABand = http.formvalue("__cr");
|
||||
else
|
||||
cfgs.CountryRegion = http.formvalue("__cr");
|
||||
end
|
||||
|
||||
if cfgs.Channel == "0" then -- Auto Channel Select
|
||||
cfgs.AutoChannelSelect = "3"
|
||||
else
|
||||
cfgs.AutoChannelSelect = "0"
|
||||
end
|
||||
|
||||
if http.formvalue("__bw") == "20" then
|
||||
cfgs.HT_BW = 0
|
||||
cfgs.VHT_BW = 0
|
||||
elseif http.formvalue("__bw") == "40" then
|
||||
cfgs.HT_BW = 1
|
||||
cfgs.VHT_BW = 0
|
||||
cfgs.HT_BSSCoexistence = 0
|
||||
elseif http.formvalue("__bw") == "60" then
|
||||
cfgs.HT_BW = 1
|
||||
cfgs.VHT_BW = 0
|
||||
cfgs.HT_BSSCoexistence = 1
|
||||
elseif http.formvalue("__bw") == "80" then
|
||||
cfgs.HT_BW = 1
|
||||
cfgs.VHT_BW = 1
|
||||
elseif http.formvalue("__bw") == "160" then
|
||||
cfgs.HT_BW = 1
|
||||
cfgs.VHT_BW = 2
|
||||
elseif http.formvalue("__bw") == "161" then
|
||||
cfgs.HT_BW = 1
|
||||
cfgs.VHT_BW = 3
|
||||
cfgs.VHT_Sec80_Channel = http.formvalue("VHT_Sec80_Channel") or ""
|
||||
end
|
||||
|
||||
if cfgs.ApCliAuthMode == "WEP" then
|
||||
cfgs.ApCliEncrypType = http.formvalue("__apcli_wep_enctype")
|
||||
else
|
||||
cfgs.ApCliEncrypType = http.formvalue("__apcli_wpa_enctype")
|
||||
end
|
||||
|
||||
local mimo = http.formvalue("__mimo")
|
||||
if mimo == "0" then
|
||||
cfgs.ETxBfEnCond=1
|
||||
cfgs.MUTxRxEnable=0
|
||||
cfgs.ITxBfEn=1
|
||||
elseif mimo == "1" then
|
||||
cfgs.ETxBfEnCond=1
|
||||
cfgs.MUTxRxEnable=0
|
||||
cfgs.ITxBfEn=1
|
||||
elseif mimo == "2" then
|
||||
cfgs.ETxBfEnCond=1
|
||||
cfgs.MUTxRxEnable=0
|
||||
cfgs.ITxBfEn=1
|
||||
elseif mimo == "3" then
|
||||
cfgs.ETxBfEnCond=1
|
||||
cfgs.MUTxRxEnable=0
|
||||
cfgs.ITxBfEn=1
|
||||
elseif mimo == "4" then
|
||||
cfgs.ETxBfEnCond=1
|
||||
cfgs.MUTxRxEnable=0
|
||||
cfgs.ITxBfEn=1
|
||||
else
|
||||
cfgs.ETxBfEnCond=1
|
||||
cfgs.MUTxRxEnable=0
|
||||
cfgs.ITxBfEn=1
|
||||
end
|
||||
|
||||
-- if cfgs.ApCliEnable == "1" then
|
||||
-- cfgs.Channel = http.formvalue("__apcli_channel")
|
||||
-- end
|
||||
|
||||
-- VOW
|
||||
-- ATC should actually be scattered into each SSID, but I'm just lazy.
|
||||
if cfgs.VOW_Airtime_Fairness_En then
|
||||
for i = 1,tonumber(cfgs.BssidNum) do
|
||||
__atc_tp = http.formvalue("__atc_vif"..i.."_tp") or "0"
|
||||
__atc_min_tp = http.formvalue("__atc_vif"..i.."_min_tp") or "0"
|
||||
__atc_max_tp = http.formvalue("__atc_vif"..i.."_max_tp") or "0"
|
||||
__atc_at = http.formvalue("__atc_vif"..i.."_at") or "0"
|
||||
__atc_min_at = http.formvalue("__atc_vif"..i.."_min_at") or "0"
|
||||
__atc_max_at = http.formvalue("__atc_vif"..i.."_max_at") or "0"
|
||||
|
||||
nixio.syslog("info", "ATC.__atc_tp ="..i..__atc_tp );
|
||||
nixio.syslog("info", "ATC.__atc_min_tp ="..i..__atc_min_tp );
|
||||
nixio.syslog("info", "ATC.__atc_max_tp ="..i..__atc_max_tp );
|
||||
nixio.syslog("info", "ATC.__atc_at ="..i..__atc_at );
|
||||
nixio.syslog("info", "ATC.__atc_min_at ="..i..__atc_min_at );
|
||||
nixio.syslog("info", "ATC.__atc_max_at ="..i..__atc_max_at );
|
||||
|
||||
cfgs.VOW_Rate_Ctrl_En = mtkwifi.token_set(cfgs.VOW_Rate_Ctrl_En, i, __atc_tp)
|
||||
cfgs.VOW_Group_Min_Rate = mtkwifi.token_set(cfgs.VOW_Group_Min_Rate, i, __atc_min_tp)
|
||||
cfgs.VOW_Group_Max_Rate = mtkwifi.token_set(cfgs.VOW_Group_Max_Rate, i, __atc_max_tp)
|
||||
|
||||
cfgs.VOW_Airtime_Ctrl_En = mtkwifi.token_set(cfgs.VOW_Airtime_Ctrl_En, i, __atc_at)
|
||||
cfgs.VOW_Group_Min_Ratio = mtkwifi.token_set(cfgs.VOW_Group_Min_Ratio, i, __atc_min_at)
|
||||
cfgs.VOW_Group_Max_Ratio = mtkwifi.token_set(cfgs.VOW_Group_Max_Ratio, i, __atc_max_at)
|
||||
end
|
||||
|
||||
cfgs.VOW_RX_En = http.formvalue("VOW_RX_En") or "0"
|
||||
end
|
||||
|
||||
-- http.write_json(http.formvalue())
|
||||
mtkwifi.save_profile(cfgs, profiles[devname])
|
||||
|
||||
if http.formvalue("__apply") then
|
||||
__mtkwifi_reload(devname)
|
||||
end
|
||||
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi", "dev_cfg_view",devname))
|
||||
end
|
||||
|
||||
function dev_cfg_raw(devname)
|
||||
-- http.write_json(http.formvalue())
|
||||
local profiles = mtkwifi.search_dev_and_profile()
|
||||
assert(profiles[devname])
|
||||
|
||||
local raw = http.formvalue("raw")
|
||||
raw = string.gsub(raw, "\r\n", "\n")
|
||||
local cfgs = mtkwifi.load_profile(nil, raw)
|
||||
mtkwifi.save_profile(cfgs, profiles[devname])
|
||||
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi", "dev_cfg_view", devname))
|
||||
end
|
||||
|
||||
function dev_cfg_reset(devname)
|
||||
-- http.write_json(http.formvalue())
|
||||
local profiles = mtkwifi.search_dev_and_profile()
|
||||
assert(profiles[devname])
|
||||
|
||||
local fd = io.open("/rom"..profiles[devname], "r")
|
||||
if fd then
|
||||
fd:close() -- just to test if file exists.
|
||||
os.execute("cp -f /rom"..profiles[devname].." "..profiles[devname])
|
||||
else
|
||||
mtkwifi.debug("unable to find /rom"..profiles[devname])
|
||||
end
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi", "dev_cfg_view", devname))
|
||||
end
|
||||
|
||||
function vif_del(dev, vif)
|
||||
mtkwifi.debug("vif_del("..dev..vif..")")
|
||||
local devname,vifname = dev, vif
|
||||
mtkwifi.debug("devname="..devname)
|
||||
mtkwifi.debug("vifname="..vifname)
|
||||
local devs = mtkwifi.get_all_devs()
|
||||
local idx = devs[devname]["vifs"][vifname].vifidx -- or tonumber(string.match(vifname, "%d+")) + 1
|
||||
mtkwifi.debug("idx="..idx, devname, vifname)
|
||||
local profile = devs[devname].profile
|
||||
assert(profile)
|
||||
if idx and tonumber(idx) >= 0 then
|
||||
local cfgs = mtkwifi.load_profile(profile)
|
||||
if cfgs then
|
||||
mtkwifi.debug("ssid"..idx.."="..cfgs["SSID"..idx].."<br>")
|
||||
cfgs["SSID"..idx] = ""
|
||||
mtkwifi.debug("ssid"..idx.."="..cfgs["SSID"..idx].."<br>")
|
||||
mtkwifi.debug("wpapsk"..idx.."="..cfgs["WPAPSK"..idx].."<br>")
|
||||
cfgs["WPAPSK"..idx] = ""
|
||||
local ssidlist = {}
|
||||
local j = 1
|
||||
for i = 1,16 do
|
||||
if cfgs["SSID"..i] ~= "" then
|
||||
ssidlist[j] = cfgs["SSID"..i]
|
||||
j = j + 1
|
||||
end
|
||||
end
|
||||
for i,v in ipairs(ssidlist) do
|
||||
mtkwifi.debug("ssidlist"..i.."="..v)
|
||||
end
|
||||
mtkwifi.debug("cfgs.BssidNum="..cfgs.BssidNum.." #ssidlist="..#ssidlist)
|
||||
assert(tonumber(cfgs.BssidNum) == #ssidlist + 1, "Please delete vif from larger idx.")
|
||||
cfgs.BssidNum = #ssidlist
|
||||
for i = 1,16 do
|
||||
if i <= cfgs.BssidNum then
|
||||
cfgs["SSID"..i] = ssidlist[i]
|
||||
elseif cfgs["SSID"..i] then
|
||||
cfgs["SSID"..i] = ""
|
||||
end
|
||||
end
|
||||
|
||||
mtkwifi.save_profile(cfgs, profile)
|
||||
else
|
||||
mtkwifi.debug(profile.." cannot be found!")
|
||||
end
|
||||
end
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi"))
|
||||
end
|
||||
|
||||
function vif_disable(iface)
|
||||
os.execute("ifconfig "..iface.." down")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi"))
|
||||
end
|
||||
|
||||
function vif_enable(iface)
|
||||
os.execute("ifconfig "..iface.." up")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi"))
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
-- security config in mtk wifi is quite complicated!
|
||||
-- cfgs listed below are attached with vif and combined like "0;0;0;0". They need specicial treatment.
|
||||
TxRate, WmmCapable, NoForwarding,
|
||||
HideSSID, IEEE8021X, PreAuth,
|
||||
AuthMode, EncrypType, RekeyMethod,
|
||||
RekeyInterval, PMKCachePeriod,
|
||||
DefaultKeyId, Key{n}Type, HT_EXTCHA,
|
||||
RADIUS_Server, RADIUS_Port,
|
||||
]]
|
||||
|
||||
local function conf_wep_keys(cfgs,vifidx)
|
||||
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vifidx, http.formvalue("__DefaultKeyID") or 1)
|
||||
cfgs["Key1Str"..vifidx] = http.formvalue("Key1Str"..vifidx)
|
||||
cfgs["Key2Str"..vifidx] = http.formvalue("Key2Str"..vifidx)
|
||||
cfgs["Key3Str"..vifidx] = http.formvalue("Key3Str"..vifidx)
|
||||
cfgs["Key4Str"..vifidx] = http.formvalue("Key4Str"..vifidx)
|
||||
|
||||
cfgs["Key1Type"]=mtkwifi.token_set(cfgs["Key1Type"],vifidx, http.formvalue("WEP1Type"..vifidx))
|
||||
cfgs["Key2Type"]=mtkwifi.token_set(cfgs["Key2Type"],vifidx, http.formvalue("WEP2Type"..vifidx))
|
||||
cfgs["Key3Type"]=mtkwifi.token_set(cfgs["Key3Type"],vifidx, http.formvalue("WEP3Type"..vifidx))
|
||||
cfgs["Key4Type"]=mtkwifi.token_set(cfgs["Key4Type"],vifidx, http.formvalue("WEP4Type"..vifidx))
|
||||
|
||||
return cfgs
|
||||
end
|
||||
|
||||
local function __security_cfg(cfgs, vif_idx)
|
||||
mtkwifi.debug("__security_cfg, before, HideSSID="..tostring(cfgs.HideSSID))
|
||||
mtkwifi.debug("__security_cfg, before, NoForwarding="..tostring(cfgs.NoForwarding))
|
||||
mtkwifi.debug("__security_cfg, before, WmmCapable="..tostring(cfgs.WmmCapable))
|
||||
mtkwifi.debug("__security_cfg, before, TxRate="..tostring(cfgs.TxRate))
|
||||
mtkwifi.debug("__security_cfg, before, RekeyInterval="..tostring(cfgs.RekeyInterval))
|
||||
mtkwifi.debug("__security_cfg, before, AuthMode="..tostring(cfgs.AuthMode))
|
||||
mtkwifi.debug("__security_cfg, before, EncrypType="..tostring(cfgs.EncrypType))
|
||||
mtkwifi.debug("__security_cfg, before, WscModeOption="..tostring(cfgs.WscModeOption))
|
||||
mtkwifi.debug("__security_cfg, before, RekeyMethod="..tostring(cfgs.RekeyMethod))
|
||||
mtkwifi.debug("__security_cfg, before, IEEE8021X="..tostring(cfgs.IEEE8021X))
|
||||
mtkwifi.debug("__security_cfg, before, DefaultKeyID="..tostring(cfgs.DefaultKeyID))
|
||||
mtkwifi.debug("__security_cfg, before, PMFMFPC="..tostring(cfgs.PMFMFPC))
|
||||
mtkwifi.debug("__security_cfg, before, PMFMFPR="..tostring(cfgs.PMFMFPR))
|
||||
mtkwifi.debug("__security_cfg, before, PMFSHA256="..tostring(cfgs.PMFSHA256))
|
||||
mtkwifi.debug("__security_cfg, before, RADIUS_Server="..tostring(cfgs.RADIUS_Server))
|
||||
mtkwifi.debug("__security_cfg, before, RADIUS_Port="..tostring(cfgs.RADIUS_Port))
|
||||
mtkwifi.debug("__security_cfg, before, session_timeout_interval="..tostring(cfgs.session_timeout_interval))
|
||||
mtkwifi.debug("__security_cfg, before, PMKCachePeriod="..tostring(cfgs.PMKCachePeriod))
|
||||
mtkwifi.debug("__security_cfg, before, PreAuth="..tostring(cfgs.PreAuth))
|
||||
mtkwifi.debug("__security_cfg, before, Wapiifname="..tostring(cfgs.Wapiifname))
|
||||
|
||||
cfgs.HideSSID = mtkwifi.token_set(cfgs.HideSSID, vif_idx, http.formvalue("__hidessid") or "0")
|
||||
cfgs.NoForwarding = mtkwifi.token_set(cfgs.NoForwarding, vif_idx, http.formvalue("__noforwarding") or "0")
|
||||
cfgs.WmmCapable = mtkwifi.token_set(cfgs.WmmCapable, vif_idx, http.formvalue("__wmmcapable") or "0")
|
||||
cfgs.TxRate = mtkwifi.token_set(cfgs.TxRate, vif_idx, http.formvalue("__txrate") or "0");
|
||||
cfgs.RekeyInterval = mtkwifi.token_set(cfgs.RekeyInterval, vif_idx, http.formvalue("__rekeyinterval") or "0");
|
||||
|
||||
local __authmode = http.formvalue("__authmode") or "Disable"
|
||||
cfgs.AuthMode = mtkwifi.token_set(cfgs.AuthMode, vif_idx, __authmode)
|
||||
|
||||
--[[ need to handle disable case as it conflicts with OPENWEP
|
||||
case = disable; authmode = OPEN, encryption = NONE
|
||||
case = open/OPENWEP; authmode = OPEN, encryption = WEP
|
||||
]]
|
||||
if __authmode == "Disable" then
|
||||
cfgs.AuthMode = mtkwifi.token_set(cfgs.AuthMode, vif_idx, "OPEN")
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "NONE")
|
||||
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "DISABLE")
|
||||
elseif __authmode == "OPEN" or __authmode == "SHARED" or __authmode == "WEPAUTO" then
|
||||
--[[ the following required cfgs are already set in loop above
|
||||
cfgs.Key{n}Str, ...
|
||||
cfgs.Key{n}Type, ...
|
||||
cfgs.DefaultKeyID
|
||||
]]
|
||||
cfgs.WscModeOption = "0"
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "WEP")
|
||||
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "DISABLE")
|
||||
cfgs = conf_wep_keys(cfgs,vif_idx)
|
||||
cfgs.WscConfMode = mtkwifi.token_set(cfgs.WscConfMode, vif_idx, 0)
|
||||
elseif __authmode == "WPAPSK" or __authmode == "WPAPSKWPA2PSK" then
|
||||
--[[ the following required cfgs are already set in loop above
|
||||
cfgs.WPAPSK{n}, ...
|
||||
cfgs.RekeyInterval
|
||||
]]
|
||||
|
||||
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
|
||||
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
|
||||
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "NONE")
|
||||
--cfgs["WPAPSK"..vif_idx] = http.formvalue("WPAPSK"..vif_idx)
|
||||
elseif __authmode == "WPA2PSK" then
|
||||
--[[ the following required cfgs are already set in loop above
|
||||
cfgs.WPAPSK{n}, ...
|
||||
cfgs.RekeyInterval
|
||||
]]
|
||||
-- for DOT11W_PMF_SUPPORT
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "0")
|
||||
if cfgs.PMFMFPC then
|
||||
cfgs.PMFMFPC = mtkwifi.token_set(cfgs.PMFMFPC, vif_idx, http.formvalue("__pmfmfpc") or "0")
|
||||
end
|
||||
if cfgs.PMFMFPR then
|
||||
cfgs.PMFMFPR = mtkwifi.token_set(cfgs.PMFMFPR, vif_idx, http.formvalue("__pmfmfpr") or "0")
|
||||
end
|
||||
if cfgs.PMFSHA256 then
|
||||
cfgs.PMFSHA256 = mtkwifi.token_set(cfgs.PMFSHA256, vif_idx, http.formvalue("__pmfsha256") or "0")
|
||||
end
|
||||
|
||||
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
|
||||
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
|
||||
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
|
||||
elseif __authmode == "WPA" then
|
||||
--[[ the following required cfgs are already set in loop above
|
||||
cfgs.WPAPSK{n}, ...
|
||||
cfgs.RekeyInterval
|
||||
cfgs.RADIUS_Key
|
||||
]]
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "0")
|
||||
cfgs.RADIUS_Server = mtkwifi.token_set(cfgs.RADIUS_Server, vif_idx, http.formvalue("__radius_server") or "0")
|
||||
cfgs.RADIUS_Port = mtkwifi.token_set(cfgs.RADIUS_Port, vif_idx, http.formvalue("__radius_port") or "0")
|
||||
cfgs.session_timeout_interval = mtkwifi.token_set(cfgs.session_timeout_interval, vif_idx, http.formvalue("__session_timeout_interval") or "0")
|
||||
|
||||
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
|
||||
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
|
||||
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
|
||||
elseif __authmode == "WPA2" then
|
||||
--[[ the following required cfgs are already set in loop above
|
||||
cfgs.WPAPSK{n}, ...
|
||||
cfgs.RekeyInterval
|
||||
cfgs.RADIUS_Key
|
||||
]]
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "0")
|
||||
cfgs.RADIUS_Server = mtkwifi.token_set(cfgs.RADIUS_Server, vif_idx, http.formvalue("__radius_server") or "0")
|
||||
cfgs.RADIUS_Port = mtkwifi.token_set(cfgs.RADIUS_Port, vif_idx, http.formvalue("__radius_port") or "0")
|
||||
cfgs.session_timeout_interval = mtkwifi.token_set(cfgs.session_timeout_interval, vif_idx, http.formvalue("__session_timeout_interval") or "0")
|
||||
cfgs.PMKCachePeriod = mtkwifi.token_set(cfgs.PMKCachePeriod, vif_idx, http.formvalue("__pmkcacheperiod") or "0")
|
||||
cfgs.PreAuth = mtkwifi.token_set(cfgs.PreAuth, vif_idx, http.formvalue("__preauth") or "0")
|
||||
-- for DOT11W_PMF_SUPPORT
|
||||
if cfgs.PMFMFPC then
|
||||
cfgs.PMFMFPC = mtkwifi.token_set(cfgs.PMFMFPC, vif_idx, http.formvalue("__pmfmfpc") or "0")
|
||||
end
|
||||
if cfgs.PMFMFPR then
|
||||
cfgs.PMFMFPR = mtkwifi.token_set(cfgs.PMFMFPR, vif_idx, http.formvalue("__pmfmfpr") or "0")
|
||||
end
|
||||
if cfgs.PMFSHA256 then
|
||||
cfgs.PMFSHA256 = mtkwifi.token_set(cfgs.PMFSHA256, vif_idx, http.formvalue("__pmfsha256") or "0")
|
||||
end
|
||||
|
||||
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
|
||||
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
|
||||
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
|
||||
elseif __authmode == "WPA1WPA2" then
|
||||
--[[ the following required cfgs are already set in loop above
|
||||
cfgs.WPAPSK{n}, ...
|
||||
cfgs.RekeyInterval
|
||||
cfgs.RADIUS_Key
|
||||
]]
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, http.formvalue("__wpa_encrypttype") or "0")
|
||||
cfgs.RADIUS_Server = mtkwifi.token_set(cfgs.RADIUS_Server, vif_idx, http.formvalue("__radius_server") or "0")
|
||||
cfgs.RADIUS_Port = mtkwifi.token_set(cfgs.RADIUS_Port, vif_idx, http.formvalue("__radius_port") or "1812")
|
||||
cfgs.session_timeout_interval = mtkwifi.token_set(cfgs.session_timeout_interval, vif_idx, http.formvalue("__session_timeout_interval") or "0")
|
||||
cfgs.PMKCachePeriod = mtkwifi.token_set(cfgs.PMKCachePeriod, vif_idx, http.formvalue("__pmkcacheperiod") or "0")
|
||||
cfgs.PreAuth = mtkwifi.token_set(cfgs.PreAuth, vif_idx, http.formvalue("__preauth") or "0")
|
||||
|
||||
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "TIME")
|
||||
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "0")
|
||||
cfgs.DefaultKeyID = mtkwifi.token_set(cfgs.DefaultKeyID, vif_idx, "2")
|
||||
elseif __authmode == "IEEE8021X" then
|
||||
cfgs.RekeyMethod = mtkwifi.token_set(cfgs.RekeyMethod, vif_idx, "DISABLE")
|
||||
cfgs.AuthMode = mtkwifi.token_set(cfgs.AuthMode, vif_idx, "OPEN")
|
||||
cfgs.IEEE8021X = mtkwifi.token_set(cfgs.IEEE8021X, vif_idx, "1")
|
||||
cfgs.RADIUS_Server = mtkwifi.token_set(cfgs.RADIUS_Server, vif_idx, http.formvalue("__radius_server") or "0")
|
||||
cfgs.RADIUS_Port = mtkwifi.token_set(cfgs.RADIUS_Port, vif_idx, http.formvalue("__radius_port") or "0")
|
||||
cfgs.session_timeout_interval = mtkwifi.token_set(cfgs.session_timeout_interval, vif_idx, http.formvalue("__session_timeout_interval") or "0")
|
||||
if http.formvalue("__8021x_wep") then
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "WEP")
|
||||
else
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "NONE")
|
||||
end
|
||||
elseif __authmode == "WAICERT" then
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "SMS4")
|
||||
cfgs.Wapiifname = mtkwifi.token_set(cfgs.Wapiifname, vif_idx, "br-lan")
|
||||
-- cfgs.wapicert_asipaddr
|
||||
-- cfgs.WapiAsPort
|
||||
-- cfgs.wapicert_ascert
|
||||
-- cfgs.wapicert_usercert
|
||||
elseif __authmode == "WAIPSK" then
|
||||
cfgs.EncrypType = mtkwifi.token_set(cfgs.EncrypType, vif_idx, "SMS4")
|
||||
-- cfgs.wapipsk_keytype
|
||||
-- cfgs.wapipsk_prekey
|
||||
end
|
||||
|
||||
mtkwifi.debug("__security_cfg, after, HideSSID="..tostring(cfgs.HideSSID))
|
||||
mtkwifi.debug("__security_cfg, after, NoForwarding="..tostring(cfgs.NoForwarding))
|
||||
mtkwifi.debug("__security_cfg, after, WmmCapable="..tostring(cfgs.WmmCapable))
|
||||
mtkwifi.debug("__security_cfg, after, TxRate="..tostring(cfgs.TxRate))
|
||||
mtkwifi.debug("__security_cfg, after, RekeyInterval="..tostring(cfgs.RekeyInterval))
|
||||
mtkwifi.debug("__security_cfg, after, AuthMode="..tostring(cfgs.AuthMode))
|
||||
mtkwifi.debug("__security_cfg, after, EncrypType="..tostring(cfgs.EncrypType))
|
||||
mtkwifi.debug("__security_cfg, after, WscModeOption="..tostring(cfgs.WscModeOption))
|
||||
mtkwifi.debug("__security_cfg, after, RekeyMethod="..tostring(cfgs.RekeyMethod))
|
||||
mtkwifi.debug("__security_cfg, after, IEEE8021X="..tostring(cfgs.IEEE8021X))
|
||||
mtkwifi.debug("__security_cfg, after, DefaultKeyID="..tostring(cfgs.DefaultKeyID))
|
||||
mtkwifi.debug("__security_cfg, after, PMFMFPC="..tostring(cfgs.PMFMFPC))
|
||||
mtkwifi.debug("__security_cfg, after, PMFMFPR="..tostring(cfgs.PMFMFPR))
|
||||
mtkwifi.debug("__security_cfg, after, PMFSHA256="..tostring(cfgs.PMFSHA256))
|
||||
mtkwifi.debug("__security_cfg, after, RADIUS_Server="..tostring(cfgs.RADIUS_Server))
|
||||
mtkwifi.debug("__security_cfg, after, RADIUS_Port="..tostring(cfgs.RADIUS_Port))
|
||||
mtkwifi.debug("__security_cfg, after, session_timeout_interval="..tostring(cfgs.session_timeout_interval))
|
||||
mtkwifi.debug("__security_cfg, after, PMKCachePeriod="..tostring(cfgs.PMKCachePeriod))
|
||||
mtkwifi.debug("__security_cfg, after, PreAuth="..tostring(cfgs.PreAuth))
|
||||
mtkwifi.debug("__security_cfg, after, Wapiifname="..tostring(cfgs.Wapiifname))
|
||||
end
|
||||
|
||||
function initialize_multiBssParameters(cfgs,vif_idx)
|
||||
cfgs["WPAPSK"..vif_idx]="12345678"
|
||||
cfgs["Key1Type"]=mtkwifi.token_set(cfgs["Key1Type"],vif_idx,"0")
|
||||
cfgs["Key2Type"]=mtkwifi.token_set(cfgs["Key2Type"],vif_idx,"0")
|
||||
cfgs["Key3Type"]=mtkwifi.token_set(cfgs["Key3Type"],vif_idx,"0")
|
||||
cfgs["Key4Type"]=mtkwifi.token_set(cfgs["Key4Type"],vif_idx,"0")
|
||||
cfgs["RADIUS_Server"]=mtkwifi.token_set(cfgs["RADIUS_Server"],vif_idx,"0")
|
||||
cfgs["RADIUS_Key"..vif_idx]="ralink"
|
||||
cfgs["DefaultKeyID"]=mtkwifi.token_set(cfgs["DefaultKeyID"],vif_idx,"1")
|
||||
cfgs["IEEE8021X"]=mtkwifi.token_set(cfgs["IEEE8021X"],vif_idx,"0")
|
||||
cfgs["WscConfMode"]=mtkwifi.token_set(cfgs["WscConfMode"],vif_idx,"0")
|
||||
cfgs["PreAuth"]=mtkwifi.token_set(cfgs["PreAuth"],vif_idx,"0")
|
||||
return cfgs
|
||||
end
|
||||
|
||||
function vif_cfg(dev, vif)
|
||||
local devname, vifname = dev, vif
|
||||
if not devname then devname = vif end
|
||||
mtkwifi.debug("devname="..devname)
|
||||
mtkwifi.debug("vifname="..(vifname or ""))
|
||||
local devs = mtkwifi.get_all_devs()
|
||||
local profile = devs[devname].profile
|
||||
assert(profile)
|
||||
|
||||
local cfgs = mtkwifi.load_profile(profile)
|
||||
|
||||
for k,v in pairs(http.formvalue()) do
|
||||
if type(v) == type("") or type(v) == type(0) then
|
||||
nixio.syslog("debug", "post."..k.."="..tostring(v))
|
||||
else
|
||||
nixio.syslog("debug", "post."..k.." invalid, type="..type(v))
|
||||
end
|
||||
end
|
||||
|
||||
-- sometimes vif_idx start from 0, like AccessPolicy0
|
||||
-- sometimes it starts from 1, like WPAPSK1. nice!
|
||||
local vif_idx
|
||||
local to_url
|
||||
if http.formvalue("__action") == "vif_cfg_view" then
|
||||
vif_idx = devs[devname]["vifs"][vifname].vifidx
|
||||
mtkwifi.debug("vif_idx=", vif_idx, devname, vifname)
|
||||
to_url = luci.dispatcher.build_url("admin", "network", "wifi", "vif_cfg_view", devname, vifname)
|
||||
elseif http.formvalue("__action") == "vif_add_view" then
|
||||
cfgs.BssidNum = tonumber(cfgs.BssidNum) + 1
|
||||
vif_idx = tonumber(cfgs.BssidNum)
|
||||
to_url = luci.dispatcher.build_url("admin", "network", "wifi")
|
||||
-- initializing ; separated parameters for the new interface
|
||||
cfgs = initialize_multiBssParameters(cfgs, vif_idx)
|
||||
|
||||
end
|
||||
|
||||
-- "__" should not be in the name if user wants to copy formvalue data directly in the dat file variable
|
||||
for k,v in pairs(http.formvalue()) do
|
||||
if type(v) ~= type("") and type(v) ~= type(0) then
|
||||
nixio.syslog("err", "vif_cfg, invalid value type for "..k..","..type(v))
|
||||
elseif string.byte(k) ~= string.byte("_") then
|
||||
mtkwifi.debug("copying values for "..k)
|
||||
cfgs[k] = v or ""
|
||||
end
|
||||
end
|
||||
|
||||
cfgs["AccessPolicy"..vif_idx-1] = http.formvalue("__accesspolicy")
|
||||
local t = mtkwifi.parse_mac(http.formvalue("__maclist"))
|
||||
cfgs["AccessControlList"..vif_idx-1] = table.concat(t, ";")
|
||||
|
||||
__security_cfg(cfgs, vif_idx)
|
||||
|
||||
mtkwifi.debug(devname, profile)
|
||||
mtkwifi.save_profile(cfgs, profile)
|
||||
if http.formvalue("__apply") then
|
||||
__mtkwifi_reload(devname)
|
||||
end
|
||||
return luci.http.redirect(to_url)
|
||||
end
|
||||
|
||||
function apcli_scan(ifname)
|
||||
local aplist = mtkwifi.scan_ap(ifname)
|
||||
http.write_json(aplist)
|
||||
end
|
||||
|
||||
function get_station_list()
|
||||
http.write("get_station_list")
|
||||
end
|
||||
|
||||
function reset_wifi(devname)
|
||||
if devname then
|
||||
os.execute("cp -f /rom/etc/wireless/"..devname.."/ /etc/wireless/")
|
||||
else
|
||||
os.execute("cp -rf /rom/etc/wireless /etc/")
|
||||
end
|
||||
os.execute("rm -rf /tmp/mtk/wifi")
|
||||
__mtkwifi_reload(devname)
|
||||
return luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi"))
|
||||
end
|
||||
|
||||
function reload_wifi(devname)
|
||||
__mtkwifi_reload(devname)
|
||||
return luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi"))
|
||||
end
|
||||
|
||||
function get_raw_profile()
|
||||
local sid = http.formvalue("sid")
|
||||
http.write_json("get_raw_profile")
|
||||
end
|
||||
|
||||
function get_country_region_list()
|
||||
local mode = http.formvalue("mode")
|
||||
local cr_list;
|
||||
|
||||
if mtkwifi.band(mode) == "5G" then
|
||||
cr_list = mtkwifi.CountryRegionList_5G_All
|
||||
else
|
||||
cr_list = mtkwifi.CountryRegionList_2G_All
|
||||
end
|
||||
|
||||
http.write_json(cr_list)
|
||||
end
|
||||
|
||||
function remove_ch_by_region(ch_list, region)
|
||||
for i = #ch_list,2,-1 do
|
||||
if not ch_list[i].region[region] then
|
||||
table.remove(ch_list, i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function get_channel_list()
|
||||
local mode = http.formvalue("mode")
|
||||
local region = tonumber(http.formvalue("country_region")) or 1
|
||||
local ch_list
|
||||
|
||||
if mtkwifi.band(mode) == "5G" then
|
||||
ch_list = mtkwifi.ChannelList_5G_All
|
||||
else
|
||||
ch_list = mtkwifi.ChannelList_2G_All
|
||||
end
|
||||
|
||||
remove_ch_by_region(ch_list, region)
|
||||
http.write_json(ch_list)
|
||||
end
|
||||
|
||||
function get_HT_ext_channel_list()
|
||||
local ch_cur = tonumber(http.formvalue("ch_cur"))
|
||||
local region = tonumber(http.formvalue("country_region")) or 1
|
||||
local ext_ch_list = {}
|
||||
|
||||
if ch_cur <= 14 then -- 2.4G Channel
|
||||
local ch_list = mtkwifi.ChannelList_2G_All
|
||||
local below_ch = ch_cur - 4
|
||||
local above_ch = ch_cur + 4
|
||||
local i = 1
|
||||
|
||||
if below_ch > 0 and ch_list[below_ch + 1].region[region] then
|
||||
ext_ch_list[i] = {}
|
||||
ext_ch_list[i].val = 0
|
||||
ext_ch_list[i].text = ch_list[below_ch + 1].text
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
if above_ch <= 14 and ch_list[above_ch + 1].region[region] then
|
||||
ext_ch_list[i] = {}
|
||||
ext_ch_list[i].val = 1
|
||||
ext_ch_list[i].text = ch_list[above_ch + 1].text
|
||||
end
|
||||
else -- 5G Channel
|
||||
local ch_list = mtkwifi.ChannelList_5G_All
|
||||
local ext_ch_idx = -1
|
||||
local len = 0
|
||||
|
||||
for k, v in ipairs(ch_list) do
|
||||
len = len + 1
|
||||
if v.channel == ch_cur then
|
||||
ext_ch_idx = (k % 2 == 0) and k + 1 or k - 1
|
||||
end
|
||||
end
|
||||
|
||||
if ext_ch_idx > 0 and ext_ch_idx < len and ch_list[ext_ch_idx].region[region] then
|
||||
ext_ch_list[1] = {}
|
||||
ext_ch_list[1].val = ext_ch_idx % 2
|
||||
ext_ch_list[1].text = ch_list[ext_ch_idx].text
|
||||
end
|
||||
end
|
||||
|
||||
http.write_json(ext_ch_list)
|
||||
end
|
||||
|
||||
function get_5G_2nd_80Mhz_channel_list()
|
||||
local ch_cur = tonumber(http.formvalue("ch_cur"))
|
||||
local region = tonumber(http.formvalue("country_region"))
|
||||
local ch_list = mtkwifi.ChannelList_5G_2nd_80MHZ_ALL
|
||||
local ch_list_5g = mtkwifi.ChannelList_5G_All
|
||||
local i, j, test_ch, test_idx
|
||||
local bw80_1st_idx = -1
|
||||
|
||||
-- remove adjacent freqencies starting from list tail.
|
||||
for i = #ch_list,1,-1 do
|
||||
for j = 0,3 do
|
||||
if ch_list[i].channel == -1 then
|
||||
break
|
||||
end
|
||||
|
||||
test_ch = ch_list[i].channel + j * 4
|
||||
test_idx = ch_list[i].chidx + j
|
||||
|
||||
if test_ch == ch_cur then
|
||||
if i + 1 <= #ch_list and ch_list[i + 1] then
|
||||
table.remove(ch_list, i + 1)
|
||||
end
|
||||
table.remove(ch_list, i)
|
||||
bw80_1st_idx = i
|
||||
break
|
||||
end
|
||||
|
||||
if i == (bw80_1st_idx - 1) or (not ch_list_5g[test_idx].region[region]) then
|
||||
table.remove(ch_list, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- remove unused channel.
|
||||
for i = #ch_list,1,-1 do
|
||||
if ch_list[i].channel == -1 then
|
||||
table.remove(ch_list, i)
|
||||
end
|
||||
end
|
||||
http.write_json(ch_list)
|
||||
end
|
||||
|
||||
function apcli_cfg(dev, vif)
|
||||
local devname = dev
|
||||
mtkwifi.debug(devname)
|
||||
local profiles = mtkwifi.search_dev_and_profile()
|
||||
mtkwifi.debug(profiles[devname])
|
||||
assert(profiles[devname])
|
||||
|
||||
local cfgs = mtkwifi.load_profile(profiles[devname])
|
||||
|
||||
for k,v in pairs(http.formvalue()) do
|
||||
if type(v) ~= type("") and type(v) ~= type(0) then
|
||||
nixio.syslog("err", "apcli_cfg, invalid value type for "..k..","..type(v))
|
||||
elseif string.byte(k) ~= string.byte("_") then
|
||||
cfgs[k] = v or ""
|
||||
end
|
||||
end
|
||||
|
||||
cfgs.ApCliSsid = ''..mtkwifi.__handleSpecialChars(http.formvalue("ApCliSsid"))
|
||||
local __authmode = http.formvalue("ApCliAuthMode")
|
||||
if __authmode == "Disable" then
|
||||
cfgs.ApCliAuthMode = "OPEN"
|
||||
cfgs.ApCliEncrypType = "NONE"
|
||||
elseif __authmode == "OPEN" or __authmode == "SHARED" then
|
||||
cfgs.ApCliAuthMode = __authmode
|
||||
cfgs.ApCliEncrypType = http.formvalue("wep_ApCliEncrypType")
|
||||
else
|
||||
cfgs.ApCliAuthMode = __authmode
|
||||
cfgs.ApCliEncrypType = http.formvalue("wpa_ApCliEncrypType")
|
||||
end
|
||||
|
||||
mtkwifi.save_profile(cfgs, profiles[devname])
|
||||
|
||||
if http.formvalue("__apply") then
|
||||
__mtkwifi_reload(devname)
|
||||
end
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi", "apcli_cfg_view", dev, vif))
|
||||
end
|
||||
|
||||
function apcli_connect(dev, vif)
|
||||
-- dev_vif can be
|
||||
-- 1. mt7620.apcli0 # simple case
|
||||
-- 2. mt7615e.1.apclix0 # multi-card
|
||||
-- 3. mt7615e.1.2G.apclix0 # multi-card & multi-profile
|
||||
local devname,vifname = dev, vif
|
||||
mtkwifi.debug("devname=", dev, "vifname=", vif)
|
||||
mtkwifi.debug(devname)
|
||||
mtkwifi.debug(vifname)
|
||||
local profiles = mtkwifi.search_dev_and_profile()
|
||||
mtkwifi.debug(profiles[devname])
|
||||
assert(profiles[devname])
|
||||
|
||||
local cfgs = mtkwifi.load_profile(profiles[devname])
|
||||
cfgs.ApCliEnable = "1"
|
||||
mtkwifi.save_profile(cfgs, profiles[devname])
|
||||
|
||||
os.execute("ifconfig "..vifname.." up")
|
||||
-- local brvifs = mtkwifi.__trim(mtkwifi.read_pipe("uci get network.lan.ifname"))
|
||||
-- if not string.match(brvifs, vifname) then
|
||||
-- brvifs = brvifs.." "..vifname
|
||||
-- nixio.syslog("debug", "add "..vifname.." into lan")
|
||||
-- os.execute("uci set network.lan.ifname=\""..brvifs.."\"")
|
||||
-- os.execute("uci commit")
|
||||
-- os.execute("ubus call network.interface.lan add_device \"{\\\"name\\\":\\\""..vifname.."\\\"}\"")
|
||||
-- end
|
||||
|
||||
os.execute("iwpriv "..vifname.." set MACRepeaterEn="..cfgs.MACRepeaterEn)
|
||||
os.execute("iwpriv "..vifname.." set ApCliEnable=0")
|
||||
os.execute("iwpriv "..vifname.." set Channel="..cfgs.Channel)
|
||||
os.execute("iwpriv "..vifname.." set ApCliAuthMode="..cfgs.ApCliAuthMode)
|
||||
os.execute("iwpriv "..vifname.." set ApCliEncrypType="..cfgs.ApCliEncrypType)
|
||||
if cfgs.ApCliAuthMode == "WEP" then
|
||||
os.execute("#iwpriv "..vifname.." set ApCliDefaultKeyID="..cfgs.ApCliDefaultKeyID)
|
||||
os.execute("#iwpriv "..vifname.." set ApCliKey1="..cfgs.ApCliKey1Str)
|
||||
elseif cfgs.ApCliAuthMode == "WPAPSK"
|
||||
or cfgs.ApCliAuthMode == "WPA2PSK"
|
||||
or cfgs.ApCliAuthMode == "WPA1PSKWPA2PSK" then
|
||||
os.execute("iwpriv "..vifname.." set ApCliWPAPSK="..cfgs.ApCliWPAPSK)
|
||||
end
|
||||
if cfgs.ApCliBssid ~= nil then
|
||||
os.execute("iwpriv "..vifname.." set ApCliBssid="..cfgs.ApCliBssid)
|
||||
end
|
||||
os.execute("iwpriv "..vifname.." set ApCliSsid=\""..cfgs.ApCliSsid.."\"")
|
||||
os.execute("iwpriv "..vifname.." set ApCliEnable=1")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi"))
|
||||
end
|
||||
|
||||
function apcli_disconnect(dev, vif)
|
||||
-- dev_vif can be
|
||||
-- 1. mt7620.apcli0 # simple case
|
||||
-- 2. mt7615e.1.apclix0 # multi-card
|
||||
-- 3. mt7615e.1.2G.apclix0 # multi-card & multi-profile
|
||||
local devname,vifname = dev, vif
|
||||
mtkwifi.debug("devname=", dev, "vifname", vif)
|
||||
mtkwifi.debug(devname)
|
||||
mtkwifi.debug(vifname)
|
||||
local profiles = mtkwifi.search_dev_and_profile()
|
||||
mtkwifi.debug(profiles[devname])
|
||||
assert(profiles[devname])
|
||||
|
||||
local cfgs = mtkwifi.load_profile(profiles[devname])
|
||||
cfgs.ApCliEnable = "1"
|
||||
mtkwifi.save_profile(cfgs, profiles[devname])
|
||||
|
||||
os.execute("iwpriv "..vifname.." set ApCliEnable=0")
|
||||
|
||||
-- local brvifs = mtkwifi.__trim(mtkwifi.read_pipe("uci get network.lan.ifname"))
|
||||
-- if string.match(brvifs, vifname) then
|
||||
-- brvifs = mtkwifi.__trim(string.gsub(brvifs, vifname, ""))
|
||||
-- nixio.syslog("debug", "add "..vifname.." into lan")
|
||||
-- os.execute("uci set network.lan.ifname=\""..brvifs.."\"")
|
||||
-- os.execute("uci commit")
|
||||
-- os.execute("ubus call network.interface.lan remove_device \"{\\\"name\\\":\\\""..vifname.."\\\"}\"")
|
||||
-- end
|
||||
os.execute("ifconfig "..vifname.." down")
|
||||
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "wifi"))
|
||||
end
|
||||
|
||||
@ -0,0 +1,352 @@
|
||||
|
||||
<%+header%>
|
||||
<!--
|
||||
This module is a demo to configure MTK' proprietary WiFi driver.
|
||||
Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
|
||||
LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
|
||||
translate uci into MTK's WiFi profile (like we did in "uci2dat").
|
||||
|
||||
Hua Shao <nossiac@163.com>
|
||||
-->
|
||||
<%
|
||||
local disp = require "luci.dispatcher"
|
||||
-- local request = disp.context.path
|
||||
local request = disp.context.request
|
||||
local mtkwifi = require("mtkwifi")
|
||||
--local devname = string.match(request[5], "(mt.+)%.")
|
||||
local devname = request[5]
|
||||
local devs = mtkwifi.get_all_devs()
|
||||
local dev = {}
|
||||
local vif = {}
|
||||
local vifidx
|
||||
for _,v in ipairs(devs) do
|
||||
if v.devname == devname then
|
||||
dev = v
|
||||
end
|
||||
end
|
||||
|
||||
local vifname = request[6] or dev.apcli.vifname
|
||||
assert(vifname)
|
||||
vif = dev and dev.vifs[vifname] or nil
|
||||
vifidx = vif and vif.vifidx or nil
|
||||
--print(devs, dev, dev.apcli, devname, vifname)
|
||||
|
||||
local cfgs = mtkwifi.load_profile(dev.profile)
|
||||
local debug = 0
|
||||
%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-17.250.41546-90ac861"></script>
|
||||
|
||||
<div id="loading" style="margin-top: 1em; display: none;">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:e;" />
|
||||
Please waiting while the page is loading......
|
||||
</div>
|
||||
|
||||
<form method="post" name="cbi" action="<%=luci.dispatcher.build_url("admin", "network", "wifi", "apcli_cfg", devname, vifname)%>" enctype="multipart/form-data" onreset="return cbi_validate_reset(this)" onsubmit="return cbi_validate_form(this, 'Some fields are invalid, cannot save values!')" autocomplete="off">
|
||||
|
||||
<fieldset class="cbi-section" id="vif-cfg-apcli">
|
||||
<legend> <a name="apcli_scan_section">Wireless Repeater - <%=devname.."@"..vifname%> </a></legend>
|
||||
<pre> Manually setup apcli0 connection:
|
||||
iwpriv <%=vifname%> set ApCliEnable=0 // disable sta mode first
|
||||
iwpriv <%=vifname%> set ApCliAuthMode= // root ap authentication mode
|
||||
iwpriv <%=vifname%> set ApCliEncrypType= // root ap encryption type
|
||||
iwpriv <%=vifname%> set ApCliWPAPSK= // root ap password
|
||||
iwpriv <%=vifname%> set ApCliWirelessMode= // root ap wifi mode
|
||||
iwpriv <%=vifname%> set ApCliSsid= // root ap ssid
|
||||
iwpriv <%=vifname%> set ApCliEnable=1 // enable sta mode</pre>
|
||||
<br />
|
||||
<p class="left">
|
||||
<input id="scan" type="button" class="cbi-button cbi-button-find" onclick="get_ap_list('<%=vifname%>')" value="扫描网络" />
|
||||
</p>
|
||||
<div id="loading" style="display:none;">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle;" />
|
||||
Please waiting while the page is loading......
|
||||
</div>
|
||||
<div id="aplist">
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="cbi-section" id="vif-cfg-apcli-config">
|
||||
<legend> <a name="apcli_cfg_section"> 中继参数</a> </legend>
|
||||
<table class="cbi-section-table">
|
||||
<tbody>
|
||||
<tr><th class="th1"></th><th></th><th></th></tr>
|
||||
<tr>
|
||||
<td>MAC Repeater Mode</td>
|
||||
<td>
|
||||
<input type="radio" name="MACRepeaterEn" value="1" <% if cfgs.MACRepeaterEn == "1" then %> checked="checked"<% end %> /> Enable
|
||||
<input type="radio" name="MACRepeaterEn" value="0" <% if cfgs.MACRepeaterEn ~= "1" then %> checked="checked"<% end %> /> Disable
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>上级无线名称</td>
|
||||
<td>
|
||||
<input type="text" name="ApCliSsid" id="ApCliSsid" value="<%=cfgs.ApCliSsid%>"/>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>BSSID</td>
|
||||
<td>
|
||||
<input type="text" name="ApCliBssid" id="ApCliBssid" value="<%=cfgs.ApCliBssid%>"/>
|
||||
</td>
|
||||
<td><span style="color:green;">可选</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>上级无线信道</td>
|
||||
<td>
|
||||
<input type="text" name="Channel" id="Channel" value="<%=dev.Channel%>"/>
|
||||
</td>
|
||||
<td> <span style="color:red;">将会重置当前信道</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>上级无线加密模式</td>
|
||||
<td>
|
||||
<select name="ApCliAuthMode" cfg="ApCliAuthMode" id="ApCliAuthMode" onchange="ApCliAuthMode_onchange(this.options[this.options.selectedIndex].value)">
|
||||
<% for _,v in ipairs(dev.ApCliAuthModeList) do %>
|
||||
<% if (cfgs.ApCliAuthMode == "OPEN" and cfgs.ApCliEncrypType== "NONE") then
|
||||
if(v == "Disable") then %>
|
||||
<option value="<%=v%>" selected="selected" ><%=v%>
|
||||
</option>
|
||||
<% else %>
|
||||
<option value="<%=v%>" ><%=v%>
|
||||
</option>
|
||||
<% end
|
||||
else %>
|
||||
<option value="<%=v%>" <% if cfgs.ApCliAuthMode==v then %>selected="selected" <% end %>><%=v%>
|
||||
</option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="apcli_wpa"<% if cfgs.ApCliAuthMode ~= "WPA2PSK" then %> style="display: none;"<% end %>>
|
||||
<tr>
|
||||
<td>上级无线加密算法</td>
|
||||
<td>
|
||||
<select name="wpa_ApCliEncrypType" id="wpa_ApCliEncrypType" >
|
||||
<% for _, v in ipairs(dev.WPA_Enc_List) do %>
|
||||
<option value="<%=v%>" <% if cfgs.ApCliEncrypType==v then %>selected="selected" <% end %>><%=v%>
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>上级无线密码</td>
|
||||
<td>
|
||||
<input type="text" name="ApCliWPAPSK" id="ApCliWPAPSK" value="<%=cfgs.ApCliWPAPSK%>"/>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="apcli_wep"<% if cfgs.ApCliAuthMode ~= "WEP" then %> style="display: none;"<% end %>>
|
||||
<tr>
|
||||
<td>上级无线加密算法</td>
|
||||
<td>
|
||||
<select name="wep_ApCliEncrypType" id="wep_ApCliEncrypType" >
|
||||
<% for _, v in ipairs(dev.WEP_Enc_List) do %>
|
||||
<option value="<%=v%>" <% if cfgs.ApCliEncrypType==v then %>selected="selected" <% end %>><%=v%>
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>上级无线密码</td>
|
||||
<td>
|
||||
<input type="text" name="ApCliKey1Str" id="ApCliKey1Str" value="<%=cfgs.ApCliKey1Str%>"/>
|
||||
<input type="hidden" name="ApCliDefaultKeyID" value="1"/>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<div class="cbi-page-actions" id="apcli_form_buttons">
|
||||
<input class="cbi-button cbi-button-apply" value="重启无线" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>");' />
|
||||
<input class="cbi-button cbi-button-apply" value="保存设置" type="submit" />
|
||||
<input class="cbi-button cbi-button-apply" value="连接中继" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "apcli_connect", dev.devname, dev.apcli.vifname)%>")' />
|
||||
<input class="cbi-button cbi-button-reset" value="重置设置" type="reset" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
function wifi_reload(url) {
|
||||
window.scrollTo(0, 0);
|
||||
document.getElementById('loading').style.display="";
|
||||
XHR.get(url, null,
|
||||
function(x)
|
||||
{
|
||||
console.log(x);
|
||||
document.getElementById("loading").style.display="none";
|
||||
window.location.reload();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function decode_ssid(ssid)
|
||||
{
|
||||
ssid = ssid.replace(/&/g, "&");
|
||||
ssid = ssid.replace(/</g, "<");
|
||||
ssid = ssid.replace(/>/g, ">");
|
||||
ssid = ssid.replace(/"/g, "\"");
|
||||
ssid = ssid.replace(/'/g, "'");
|
||||
ssid = ssid.replace(/ /g, " ");
|
||||
var patt = new RegExp(/&#(\d+);/);
|
||||
|
||||
while (res = patt.exec(ssid))
|
||||
{
|
||||
ssid = ssid.replace("&#" + res[1] + ";", String.fromCharCode(res[1]));
|
||||
}
|
||||
return ssid;
|
||||
}
|
||||
|
||||
var ap_list;
|
||||
function create_ap_table (aplist) {
|
||||
var table = document.createElement('table');
|
||||
table.setAttribute("id", "aplist_table");
|
||||
for (i in aplist) {
|
||||
var tr = table.insertRow(i);
|
||||
var td0 = tr.insertCell(0);
|
||||
td0.innerHTML = aplist[i].ssid;
|
||||
var td1 = tr.insertCell(1);
|
||||
td1.innerHTML = aplist[i].channel;
|
||||
var td2 = tr.insertCell(2);
|
||||
td2.innerHTML = aplist[i].bssid;
|
||||
var td3 = tr.insertCell(3);
|
||||
td3.innerHTML = aplist[i].security;
|
||||
var td4 = tr.insertCell(4);
|
||||
td4.innerHTML = aplist[i].rssi;
|
||||
var td5 = tr.insertCell(5);
|
||||
if (aplist[i].authmode == "OPEN"
|
||||
|| aplist[i].authmode == "WPAPSK"
|
||||
|| aplist[i].authmode == "WPA2PSK"
|
||||
|| aplist[i].authmode == "WPAPSKWPA2PSK") {
|
||||
td5.innerHTML = '<a href="javascript:choose_rootap(\''+i+'\')" >Choose This</a>';
|
||||
|
||||
} else {
|
||||
td5.innerHTML = 'Security Not Supported';
|
||||
}
|
||||
}
|
||||
|
||||
var tr = table.insertRow(0);
|
||||
var td0 = tr.insertCell(0);
|
||||
td0.innerHTML = '<strong>无线名称</strong>';
|
||||
var td1 = tr.insertCell(1);
|
||||
td1.innerHTML = '<strong>信道</strong>';
|
||||
var td2 = tr.insertCell(2);
|
||||
td2.innerHTML = '<strong>BSSID</strong>';
|
||||
var td3 = tr.insertCell(3);
|
||||
td3.innerHTML = '<strong>加密方式</strong>';
|
||||
var td4 = tr.insertCell(4);
|
||||
td4.innerHTML = '<strong>信号强度</strong>';
|
||||
var td5 = tr.insertCell(5);
|
||||
td5.innerHTML = '<strong>动作</strong>';
|
||||
|
||||
var div = document.getElementById('aplist');
|
||||
div.innerHTML = "";
|
||||
div.appendChild(table);
|
||||
}
|
||||
|
||||
function get_ap_list(vifname) {
|
||||
|
||||
document.getElementById("loading").style.display="";
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "wifi", "apcli_scan")%>/' + vifname, null,
|
||||
function(x)
|
||||
{
|
||||
console.log(x)
|
||||
ap_list = eval(x.response);
|
||||
console.log(ap_list);
|
||||
create_ap_table(ap_list);
|
||||
document.getElementById("loading").style.display="none";
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function toggle_apcli (show) {
|
||||
if (show) {
|
||||
document.getElementById('apcli_cfg').style.display = "";
|
||||
|
||||
var a = document.getElementById('ApCliAuthMode')
|
||||
var to = a.options[a.options.selectedIndex].value
|
||||
if (to == "WPA2PSK"
|
||||
|| to == "WPAPSK"
|
||||
|| to == "WPAPSKWPA2PSK") {
|
||||
document.getElementById("apcli_wpa").style.display="";
|
||||
document.getElementById("apcli_wep").style.display="none";
|
||||
} else if (to == "WEP") {
|
||||
document.getElementById("apcli_wpa").style.display="none";
|
||||
document.getElementById("apcli_wep").style.display="";
|
||||
} else {
|
||||
document.getElementById("apcli_wpa").style.display="none";
|
||||
document.getElementById("apcli_wep").style.display="none";
|
||||
}
|
||||
}
|
||||
else {
|
||||
document.getElementById('apcli_cfg').style.display = "none";
|
||||
document.getElementById('apcli_wpa').style.display = "none";
|
||||
document.getElementById('apcli_wep').style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function ApCliAuthMode_onchange (to) {
|
||||
if (to == "WPA2PSK"
|
||||
|| to == "WPAPSK"
|
||||
|| to == "WPAPSKWPA2PSK") {
|
||||
document.getElementById("apcli_wpa").style.display="";
|
||||
document.getElementById("apcli_wep").style.display="none";
|
||||
} else if (to == "OPEN" || to == "SHARED") {
|
||||
document.getElementById("apcli_wpa").style.display="none";
|
||||
document.getElementById("apcli_wep").style.display="";
|
||||
} else {
|
||||
document.getElementById("apcli_wpa").style.display="none";
|
||||
document.getElementById("apcli_wep").style.display="none";
|
||||
}
|
||||
}
|
||||
|
||||
function choose_rootap(index) {
|
||||
document.getElementById("ApCliSsid").value=decode_ssid(ap_list[index].ssid);
|
||||
document.getElementById("ApCliBssid").value=ap_list[index].bssid;
|
||||
document.getElementById("Channel").value=ap_list[index].channel;
|
||||
document.getElementById("ApCliAuthMode").value=ap_list[index].authmode;
|
||||
if (ap_list[index].authmode == "WPA2PSK"
|
||||
|| ap_list[index].authmode == "WPAPSK"
|
||||
|| ap_list[index].authmode == "WPAPSKWPA2PSK") {
|
||||
document.getElementById("wpa_ApCliEncrypType").value=ap_list[index].encrypttype;
|
||||
} else if (ap_list[index].authmode == "OPEN" || ap_list[index].authmode == "SHARED") {
|
||||
if (ap_list[index].encrypttype == "NONE")
|
||||
{
|
||||
document.getElementById("ApCliAuthMode").value="Disable";
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("wep_ApCliEncrypType").value=ap_list[index].encrypttype;
|
||||
}
|
||||
}
|
||||
ApCliAuthMode_onchange(document.getElementById("ApCliAuthMode").value);
|
||||
document.getElementById("ApCliWPAPSK").value="";
|
||||
document.getElementById("ApCliKey1Str").value="";
|
||||
location.href="#apcli_cfg_section";
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
ApCliAuthMode_onchange(document.getElementById("ApCliAuthMode").value);
|
||||
<% if cfgs.ApCliEnable == "1" then %>
|
||||
toggle_apcli(true);
|
||||
<% else %>
|
||||
toggle_apcli(false);
|
||||
<% end %>
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<%+footer%>
|
||||
@ -0,0 +1,851 @@
|
||||
|
||||
<%+header%>
|
||||
<!--
|
||||
This module is a demo to configure MTK' proprietary WiFi driver.
|
||||
Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
|
||||
LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
|
||||
translate uci into MTK's WiFi profile (like we did in "uci2dat").
|
||||
|
||||
Hua Shao <nossiac@163.com>
|
||||
-->
|
||||
|
||||
<%
|
||||
local disp = require "luci.dispatcher"
|
||||
-- local request = disp.context.path
|
||||
local request = disp.context.request
|
||||
local mtkwifi = require("mtkwifi")
|
||||
local devname = request[5]
|
||||
local devs = mtkwifi.get_all_devs()
|
||||
local dev = {}
|
||||
for _,v in ipairs(devs) do
|
||||
if v.devname == devname then
|
||||
dev = v
|
||||
end
|
||||
end
|
||||
|
||||
local cfgs = mtkwifi.load_profile(dev.profile)
|
||||
|
||||
%>
|
||||
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-17.250.41546-90ac861"></script>
|
||||
|
||||
<div id="loading" style="margin-top: 1em; display: none;">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:e;" />
|
||||
Please waiting while the page is loading......
|
||||
</div>
|
||||
|
||||
<form method="post" name="cbi" action="<%=luci.dispatcher.build_url("admin", "network", "wifi", "dev_cfg", devname)%>" enctype="multipart/form-data" onreset="return cbi_validate_reset(this)" onsubmit="return cbi_validate_form(this, 'Some fields are invalid, cannot save values!')" autocomplete="false">
|
||||
<fieldset class="cbi-section">
|
||||
<legend> 无线高级设置 - <%=devname%>
|
||||
<%
|
||||
local diff = mtkwifi.diff_profile(dev.profile)
|
||||
if next(diff) ~= nil then
|
||||
%>
|
||||
<span style="color:red;">(<a href="javascript:location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", dev.devname)%>'">reload</a> to apply changes)</span>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</legend>
|
||||
<table id="dev-cfg-basic" class="cbi-section-table">
|
||||
<tr><th></th><td></td><td></td></tr>
|
||||
<tr>
|
||||
<td>模式</td>
|
||||
<td>
|
||||
<select style="width:auto" name="WirelessMode" id="WirelessMode" onchange="WirelessMode_onchange(this.options[this.options.selectedIndex].value)">
|
||||
<% for k,v in pairs(dev.WirelessModeList) do %>
|
||||
<option value="<%=k%>" <% if tonumber(dev.WirelessMode) == tonumber(k) then%> selected="selected"<% end %>><%=k%> - <%=v%></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>信道</td>
|
||||
<td>
|
||||
<select style="width:auto; min-width:180px;" name="Channel" id="Channel" onchange="Channel_onchange(this.value)" <% if cfgs.ApCliEnable == "1" then %> disabled="disabled" <% end %>>
|
||||
</select>
|
||||
</td>
|
||||
<td><% if cfgs.ApCliEnable == "1" then %> APClient/Repeater Mode. <% end %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>区域代码</td>
|
||||
<td>
|
||||
<select name="CountryCode" style="width:auto">
|
||||
<option value="US" id="advCountryCodeUS" <% if cfgs.CountryCode == "US" then %> selected="selected"<% end %>>US (United States)</option>
|
||||
<option value="JP" id="advCountryCodeJP" <% if cfgs.CountryCode == "JP" then %> selected="selected"<% end %>>JP (Japan)</option>
|
||||
<option value="FR" id="advCountryCodeFR" <% if cfgs.CountryCode == "FR" then %> selected="selected"<% end %>>FR (France)</option>
|
||||
<option value="TW" id="advCountryCodeTW" <% if cfgs.CountryCode == "TW" then %> selected="selected"<% end %>>TW (Taiwan)</option>
|
||||
<option value="IE" id="advCountryCodeIE" <% if cfgs.CountryCode == "IE" then %> selected="selected"<% end %>>IE (Ireland)</option>
|
||||
<option value="HK" id="advCountryCodeHK" <% if cfgs.CountryCode == "HK" then %> selected="selected"<% end %>>HK (Hong Kong)</option>
|
||||
<option value="NONE" id="advCountryCodeNONE"<% if cfgs.CountryCode == "NONE" then %> checked="checked"<% end %>>NONE</option>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Country Region</td>
|
||||
<td>
|
||||
<select style="width:auto; min-width:180px;" name="__cr" id="__cr" onchange="CountryRegion_onchange(this.value)">
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% if cfgs.HT_OpMode then %>
|
||||
<tr>
|
||||
<td>无线模式</td>
|
||||
<td>
|
||||
<select style="width:auto" name="HT_OpMode">
|
||||
<option value="0" <% if cfgs.HT_OpMode == "0" then %> selected="selected"<% end%>>正常模式</option>
|
||||
<option value="1" <% if cfgs.HT_OpMode == "1" then %> selected="selected"<% end%>>绿色模式</option>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.HT_GI then %>
|
||||
<tr>
|
||||
<td>HT Guard Interval</td>
|
||||
<td>
|
||||
<select style="width:auto" name="HT_GI">
|
||||
<option value="0" <% if cfgs.HT_GI == "0" then %> selected="selected"<% end%>>Long</option>
|
||||
<option value="1" <% if cfgs.HT_GI == "1" then %> selected="selected"<% end%>>Short</option>
|
||||
<option value="2" <% if cfgs.HT_GI == "2" then %> selected="selected"<% end%>>Auto</option>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td>信道带宽</td>
|
||||
<td>
|
||||
<select style="width:auto" name="__bw" id="__bw" onchange="Bw_onchange(this.options[this.options.selectedIndex].value)">
|
||||
<option value="20" <% if dev.__bw == "20" then %> selected="selected"<% end%>>20 MHz</option>
|
||||
<option value="40" <% if dev.__bw == "40" then %> selected="selected"<% end%>>40 MHz</option>
|
||||
<option value="60" <% if dev.__bw == "60" then %> selected="selected"<% end%>>20/40 MHz</option>
|
||||
<option value="80" <% if dev.__bw == "80" then %> selected="selected"<% end%>>80 MHz</option>
|
||||
<option value="160" <% if dev.__bw == "160" then %> selected="selected"<% end%>>160 MHz</option>
|
||||
<option value="161" <% if dev.__bw == "161" then %> selected="selected"<% end%>>80+80 MHz</option>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% if cfgs.VHT_BW then %>
|
||||
<tr>
|
||||
<td>2G 40MHZ模式辅助信道</td>
|
||||
<td>
|
||||
<select style="width:auto; min-width:180px;" name="HT_EXTCHA" id="HT_EXTCHA" <% if cfgs.ApCliEnable == "1" or dev.__bw ~= "40" or dev.__bw ~= "60" then %> disabled="disabled" <% end %>>
|
||||
</select>
|
||||
</td>
|
||||
<td><% if cfgs.ApCliEnable == "1" then %> APClient/Repeater Mode. <% end %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>5G 2nd 80Mhz Channel</td>
|
||||
<td>
|
||||
<select style="width:auto; min-width:180px;" name="VHT_Sec80_Channel" id="VHT_Sec80_Channel" <% if cfgs.ApCliEnable == "1" or dev.__bw ~= "180" then %> disabled="disabled" <% end %>>
|
||||
</select>
|
||||
</td>
|
||||
<td><% if cfgs.ApCliEnable == "1" then %> APClient/Repeater Mode. <% end %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.HT_STBC then %>
|
||||
<tr>
|
||||
<td>STBC</td>
|
||||
<td>
|
||||
<input type="radio" name="HT_STBC" value="1" <% if cfgs.HT_STBC == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="HT_STBC" value="0" <% if cfgs.HT_STBC == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.HT_AMSDU then %>
|
||||
<tr>
|
||||
<td>A-MSDU</td>
|
||||
<td>
|
||||
<input type="radio" name="HT_AMSDU" value="1" <% if cfgs.HT_AMSDU == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="HT_AMSDU" value="0" <% if cfgs.HT_AMSDU == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.HT_AutoBA then %>
|
||||
<tr>
|
||||
<td>Auto Block ACK</td>
|
||||
<td>
|
||||
<input type="radio" name="HT_AutoBA" value="1" <% if cfgs.HT_AutoBA == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="HT_AutoBA" value="0" <% if cfgs.HT_AutoBA == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.HT_BADecline then %>
|
||||
<tr>
|
||||
<td>Decline BA Request</td>
|
||||
<td>
|
||||
<input type="radio" name="HT_BADecline" value="1" <% if cfgs.HT_BADecline == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="HT_BADecline" value="0" <% if cfgs.HT_BADecline == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.HT_DisallowTKIP then %>
|
||||
<tr>
|
||||
<td>HT Disallow TKIP</td>
|
||||
<td>
|
||||
<input type="radio" name="HT_DisallowTKIP" value="1" <% if cfgs.HT_DisallowTKIP == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="HT_DisallowTKIP" value="0" <% if cfgs.HT_DisallowTKIP == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.HT_LDPC then %>
|
||||
<tr>
|
||||
<td>HT LDPC</td>
|
||||
<td>
|
||||
<input type="radio" name="HT_LDPC" value="1" <% if cfgs.HT_LDPC == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="HT_LDPC" value="0" <% if cfgs.HT_LDPC == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.VHT_SGI then %>
|
||||
<tr>
|
||||
<td>VHT Short GI</td>
|
||||
<td>
|
||||
<select style="width:auto" name="VHT_SGI">
|
||||
<option value="0" <% if cfgs.VHT_SGI == "0" then %> selected="selected"<% end%>>Long</option>
|
||||
<option value="1" <% if cfgs.VHT_SGI == "1" then %> selected="selected"<% end%>>Short</option>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.VHT_STBC then %>
|
||||
<tr>
|
||||
<td>VHT STBC</td>
|
||||
<td>
|
||||
<input type="radio" name="VHT_STBC" value="1" <% if cfgs.VHT_STBC == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="VHT_STBC" value="0" <% if cfgs.VHT_STBC == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.VHT_BW_SIGNAL then %>
|
||||
<tr>
|
||||
<td>VHT BW Signaling</td>
|
||||
<td>
|
||||
<input type="radio" name="VHT_BW_SIGNAL" value="1" <% if cfgs.VHT_BW_SIGNAL == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="VHT_BW_SIGNAL" value="0" <% if cfgs.VHT_BW_SIGNAL == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
<input type="radio" name="VHT_BW_SIGNAL" value="0" <% if cfgs.VHT_BW_SIGNAL == "2" then %> checked="checked"<% end %>/> Dynamic
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.VHT_LDPC then %>
|
||||
<tr>
|
||||
<td>VHT LDPC</td>
|
||||
<td>
|
||||
<input type="radio" name="VHT_LDPC" value="1" <% if cfgs.VHT_LDPC == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="VHT_LDPC" value="0" <% if cfgs.VHT_LDPC == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.BGProtection then %>
|
||||
<tr>
|
||||
<td>BG Protection Mode</td>
|
||||
<td>
|
||||
<select name="BGProtection" style="width:auto">
|
||||
<option value="0" <% if cfgs.BGProtection == "0" then %>selected="selected"<% end %>>Auto</option>
|
||||
<option value="1" <% if cfgs.BGProtection == "1" then %>selected="selected"<% end %>>Always On</option>
|
||||
<option value="2" <% if cfgs.BGProtection == "2" then %>selected="selected"<% end %>>Always Off</option>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.VHT_BW then %>
|
||||
<tr>
|
||||
<td>HT Protection</td>
|
||||
<td>
|
||||
<input type="radio" name="HT_PROTECT" value="1" <% if cfgs.HT_PROTECT == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="HT_PROTECT" value="0" <% if cfgs.HT_PROTECT == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.BeaconPeriod then %>
|
||||
<tr>
|
||||
<td>Beacon Interval</td>
|
||||
<td>
|
||||
<input name="BeaconPeriod" value="<%=cfgs.BeaconPeriod%>" />ms(范围 20-999, 默认值 100)
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.DtimPeriod then %>
|
||||
<tr>
|
||||
<td>Data Beacon Rate (DTIM)</td>
|
||||
<td>
|
||||
<input name="DtimPeriod" value="<%=cfgs.DtimPeriod%>" />ms(范围 1-255, 默认值 1)
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.FragThreshold then %>
|
||||
<tr>
|
||||
<td>Fragment Threshold</td>
|
||||
<td>
|
||||
<input name="FragThreshold" value="<%=cfgs.FragThreshold%>" />(范围 256-2346, 默认值 2346)
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.RTSThreshold then %>
|
||||
<tr>
|
||||
<td>RTS Threshold</td>
|
||||
<td>
|
||||
<input name="RTSThreshold" value="<%=cfgs.RTSThreshold%>" />(范围 256-2347, 默认值 2347)
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.TxPower then %>
|
||||
<tr>
|
||||
<td>TX Power</td>
|
||||
<td>
|
||||
<input name="TxPower" value="<%=cfgs.TxPower%>" />dbm(范围 1-100, 默认值 100)
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.TxPreamble then %>
|
||||
<tr>
|
||||
<td>Short Preamble</td>
|
||||
<td>
|
||||
<input type="radio" name="TxPreamble" value="1" <% if cfgs.TxPreamble == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="TxPreamble" value="0" <% if cfgs.TxPreamble == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.ShortSlot then %>
|
||||
<tr>
|
||||
<td>Short Slot</td>
|
||||
<td>
|
||||
<input type="radio" name="ShortSlot" value="1" <% if cfgs.ShortSlot == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="ShortSlot" value="0" <% if cfgs.ShortSlot == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.TxBurst then %>
|
||||
<tr>
|
||||
<td>TX Burst</td>
|
||||
<td>
|
||||
<input type="radio" name="TxBurst" value="1" <% if cfgs.TxBurst == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="TxBurst" value="0" <% if cfgs.TxBurst == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.PktAggregate then %>
|
||||
<tr>
|
||||
<td>Packet Aggregate</td>
|
||||
<td>
|
||||
<input type="radio" name="PktAggregate" value="1" <% if cfgs.PktAggregate == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="PktAggregate" value="0" <% if cfgs.PktAggregate == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if cfgs.IEEE80211H then %>
|
||||
<tr>
|
||||
<td>802.11H</td>
|
||||
<td>
|
||||
<input type="radio" name="IEEE80211H" value="1" <% if cfgs.IEEE80211H == "1" then %> checked="checked"<% end %>/> 启用
|
||||
<input type="radio" name="IEEE80211H" value="0" <% if cfgs.IEEE80211H == "0" then %> checked="checked"<% end %>/> 禁用
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
|
||||
</fieldset>
|
||||
<div class="cbi-page-actions">
|
||||
<input class="cbi-button cbi-button-apply" value="重启无线" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>");' />
|
||||
<input class="cbi-button cbi-button-apply" value="保存设置" type="submit" />
|
||||
<input class="cbi-button cbi-button-apply" name="__apply" value="保存&应用" type="submit" />
|
||||
<input class="cbi-button cbi-button-reset" value="重置" type="reset" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<form method="post" name="cbi2" action="<%=luci.dispatcher.build_url("admin", "network", "wifi", "dev_cfg_raw", devname)%>" enctype="multipart/form-data" onreset="return cbi_validate_reset(this)" onsubmit="return cbi_validate_form(this, 'Some fields are invalid, cannot save values!')" autocomplete="off">
|
||||
<fieldset class="cbi-section">
|
||||
<legend> 无线参数(直接修改无线配置)</legend>
|
||||
<p> <span style="color: red"><b>警告</b></span> : 如果你不了解请不要修改!</p>
|
||||
<textarea name="raw" id="raw" style="width:98%; height: 200px;"><%
|
||||
local fd = io.open(dev.profile)
|
||||
for line in fd:lines() do
|
||||
print(line)
|
||||
end
|
||||
%></textarea>
|
||||
</fieldset>
|
||||
<div class="cbi-page-actions">
|
||||
<input class="cbi-button cbi-button-reset" value="重置" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "dev_cfg_view", devname)%>'" type="button" />
|
||||
<input class="cbi-button cbi-button-apply" id="save" value="保存" type="submit" onclick="if (confirm('你将修改无线参数,确认要修改?')) return true; else return false;" />
|
||||
<input class="cbi-button cbi-button-apply" id="reset" value="恢复出厂设置" type="button" onclick="if (confirm(' 确认恢复<%=devname%> 至出厂设置?')) location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "dev_cfg_reset", devname)%>'" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function wifi_reload(url) {
|
||||
window.scrollTo(0, 0);
|
||||
document.getElementById('loading').style.display="";
|
||||
XHR.get(url, null,
|
||||
function(x)
|
||||
{
|
||||
console.log(x);
|
||||
document.getElementById("loading").style.display="none";
|
||||
window.location.reload();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function WirelessMode_onchange (mode) {
|
||||
var cr = GetCountryRegion(mode);
|
||||
|
||||
getCountryRegionList(mode, cr);
|
||||
}
|
||||
|
||||
function CountryRegion_onchange(country_region) {
|
||||
var wmode_o = document.getElementById('WirelessMode');
|
||||
var wmode;
|
||||
|
||||
if (wmode_o)
|
||||
wmode = wmode_o.value;
|
||||
|
||||
if (wmode == "")
|
||||
wmode = "<%=cfgs.WirelessMode%>";
|
||||
|
||||
getChannelList(wmode, country_region);
|
||||
}
|
||||
|
||||
function Channel_onchange (ch) {
|
||||
getBw(null, ch);
|
||||
}
|
||||
|
||||
function Bw_onchange(bw, ch) {
|
||||
var ch_val;
|
||||
|
||||
if (!ch){
|
||||
var ch_o = document.getElementById('Channel');
|
||||
|
||||
if (ch_o)
|
||||
ch_val = ch_o.value;
|
||||
|
||||
if (ch_val == "")
|
||||
ch_val = "<%=cfgs.Channel%>";
|
||||
} else {
|
||||
ch_val = ch
|
||||
}
|
||||
|
||||
get5G2nd80MhzChannelList(bw, ch_val);
|
||||
getHTExtChannel(bw, ch_val);
|
||||
}
|
||||
|
||||
function initCountryRegionList(list, mode){
|
||||
var select = document.getElementById('__cr');
|
||||
var cr = {};
|
||||
|
||||
if (is_mode_gband(mode))
|
||||
cr = "<%=cfgs.CountryRegion%>";
|
||||
else if (is_mode_aband(mode))
|
||||
cr = "<%=cfgs.CountryRegionABand%>";
|
||||
|
||||
var new_cr = initList(select, list, cr, "region");
|
||||
|
||||
CountryRegion_onchange(new_cr);
|
||||
}
|
||||
|
||||
function getCountryRegionList(mode) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "wifi", "get_country_region_list")%>', 'mode='+mode,
|
||||
function(x)
|
||||
{
|
||||
//console.log(x);
|
||||
//console.log(x.response);
|
||||
var json = eval(x.response);
|
||||
initCountryRegionList(json, mode);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function initChannelList(list) {
|
||||
/* choose auto select when no matching item in the lis */
|
||||
var select = document.getElementById('Channel');
|
||||
var ch = {};
|
||||
var new_ch = null;
|
||||
|
||||
ch.cval = select.value;
|
||||
ch.oval = "<%=dev.Channel%>";
|
||||
|
||||
var new_ch = initList(select, list, ch, "channel");
|
||||
Channel_onchange(new_ch);
|
||||
}
|
||||
|
||||
function getChannelList(mode, country_region) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "wifi", "get_channel_list")%>', 'mode='+mode+'&country_region='+country_region,
|
||||
function(x)
|
||||
{
|
||||
console.log(x);
|
||||
console.log(x.response);
|
||||
var json = eval(x.response);
|
||||
initChannelList(json);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function GetCountryRegion(mode) {
|
||||
var cr_o = document.getElementById('__cr');
|
||||
var cr = "";
|
||||
|
||||
if (cr_o) {
|
||||
cr = cr_o.value;
|
||||
}
|
||||
|
||||
if (cr == "") {
|
||||
if (is_mode_gband(mode)) {
|
||||
cr = "<%=cfgs.CountryRegion%>";
|
||||
} else if (is_mode_aband(mode)) {
|
||||
cr = "<%=cfgs.CountryRegionABand%>";
|
||||
} else {
|
||||
alert("Cannot get valid CountryRegion from invalid WireleeMode");
|
||||
}
|
||||
}
|
||||
|
||||
return cr;
|
||||
}
|
||||
|
||||
function getBw(mode, ch) {
|
||||
/* choose bw as wide as possible if modification is needed */
|
||||
var bw_sel = document.getElementById('__bw');
|
||||
var wmode;
|
||||
|
||||
if (!mode) {
|
||||
wmode = document.getElementById('WirelessMode');
|
||||
wmode = wmode.value*1;
|
||||
} else {
|
||||
wmode = mode*1;
|
||||
}
|
||||
|
||||
if (is_mode_legacy_only(wmode)) {
|
||||
for (var idx in bw_sel.options) {
|
||||
bw_sel.options[idx].disabled = false;
|
||||
|
||||
if (bw_sel.options[idx].value == 20)
|
||||
bw_sel.options[idx].selected = true;
|
||||
|
||||
if (bw_sel.options[idx].value > 20)
|
||||
bw_sel.options[idx].disabled = true;
|
||||
}
|
||||
} else if (is_ch_gband(ch)) {
|
||||
for (var idx in bw_sel.options) {
|
||||
bw_sel.options[idx].disabled = false;
|
||||
|
||||
if ((bw_sel.options[idx].value == 60) && (bw_sel.selectedIndex > idx))
|
||||
bw_sel.options[idx].selected = true;
|
||||
|
||||
if (bw_sel.options[idx].value > 60)
|
||||
bw_sel.options[idx].disabled = true;
|
||||
}
|
||||
} else if (is_ch_aband(ch)) {
|
||||
var chosen60 = false;
|
||||
var bw160 = "<%=cfgs.VHT_BW%>"*1;
|
||||
|
||||
if (bw_sel.value == 60)
|
||||
chosen60 = 1;
|
||||
|
||||
for (var idx in bw_sel.options) {
|
||||
bw_sel.options[idx].disabled = false;
|
||||
|
||||
if (bw_sel.options[idx].value == 40 && chosen60 && bw160 == 0) {
|
||||
bw_sel.options[idx].selected = true;
|
||||
} else if (bw_sel.options[idx].value == 60) {
|
||||
bw_sel.options[idx].disabled = true;
|
||||
bw_sel.options[idx].selected = false;
|
||||
} else if (bw_sel.options[idx].value == 160 && chosen60 && bw160 == 1) {
|
||||
bw_sel.options[idx].selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bw_onchange(bw_sel.value, ch);
|
||||
}
|
||||
|
||||
function init5G2nd80MhzChannelList(list) {
|
||||
var select = document.getElementById('VHT_Sec80_Channel');
|
||||
var ch2 = {};
|
||||
var new_ch2 = null;
|
||||
|
||||
ch2.cval = select.value;
|
||||
ch2.oval = "<%=cfgs.VHT_Sec80_Channel%>";
|
||||
|
||||
initList(select, list, ch2, "channel");
|
||||
|
||||
if (select.length > 0)
|
||||
select.disabled = false;
|
||||
else
|
||||
alert("[Warning] 5G 2nd 80Mhz Channel is not available. Please Check CountryRegion.");
|
||||
}
|
||||
|
||||
function get5G2nd80MhzChannelList(bw, ch) {
|
||||
var ch_5g_2nd = document.getElementById('VHT_Sec80_Channel');
|
||||
|
||||
ch_5g_2nd.disabled = true;
|
||||
|
||||
if (ch == "0")
|
||||
return;
|
||||
|
||||
if (bw != "161" || ch == "0")
|
||||
return;
|
||||
|
||||
var mode = document.getElementById('WirelessMode');
|
||||
mode = mode.value*1;
|
||||
|
||||
var cr = GetCountryRegion(mode);
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "wifi", "get_5G_2nd_80Mhz_channel_list")%>', 'ch_cur='+ch+'&country_region='+cr,
|
||||
function(x)
|
||||
{
|
||||
//console.log(x);
|
||||
//console.log(x.response);
|
||||
var json = eval(x.response);
|
||||
init5G2nd80MhzChannelList(json);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function initHTExtChannelList(list) {
|
||||
var select = document.getElementById('HT_EXTCHA');
|
||||
var ch2 = {};
|
||||
var new_ch2 = null;
|
||||
|
||||
ch2.cval = select.value;
|
||||
ch2.oval = "<%=cfgs.HT_EXTCHA%>";
|
||||
|
||||
initList(select, list, ch2, "val");
|
||||
|
||||
if (select.length > 0)
|
||||
select.disabled = false;
|
||||
else
|
||||
alert("[Warning] 2G 40Mhz Ext Channel is not avalable. Please Check CountryRegion.");
|
||||
}
|
||||
|
||||
function getHTExtChannel(bw, ch) {
|
||||
var ch_2g_ext = document.getElementById('HT_EXTCHA');
|
||||
|
||||
ch_2g_ext.disabled = true;
|
||||
|
||||
if (ch == "0")
|
||||
return;
|
||||
|
||||
if (bw != "40" && bw != "60")
|
||||
return;
|
||||
|
||||
var mode = document.getElementById('WirelessMode');
|
||||
mode = mode.value*1;
|
||||
|
||||
var cr = GetCountryRegion(mode);
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "wifi", "get_HT_ext_channel_list")%>', 'ch_cur='+ch+'&country_region='+cr,
|
||||
function(x)
|
||||
{
|
||||
console.log(x);
|
||||
console.log(x.response);
|
||||
var json = eval(x.response);
|
||||
initHTExtChannelList(json);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function toggle_apcli (show) {
|
||||
if (show) {
|
||||
document.getElementById('apcli_cfg').style.display = "";
|
||||
|
||||
var a = document.getElementById('ApCliAuthMode')
|
||||
var to = a.options[a.options.selectedIndex].value
|
||||
if (to == "WPA2PSK") {
|
||||
document.getElementById("apcli_wpa").style.display="";
|
||||
document.getElementById("apcli_wep").style.display="none";
|
||||
} else if (to == "WEP") {
|
||||
document.getElementById("apcli_wpa").style.display="none";
|
||||
document.getElementById("apcli_wep").style.display="";
|
||||
} else {
|
||||
document.getElementById("apcli_wpa").style.display="none";
|
||||
document.getElementById("apcli_wep").style.display="none";
|
||||
}
|
||||
}
|
||||
else {
|
||||
document.getElementById('apcli_cfg').style.display = "none";
|
||||
document.getElementById('apcli_wpa').style.display = "none";
|
||||
document.getElementById('apcli_wep').style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function ApCliAuthMode_onchange (to) {
|
||||
if (to == "WPA2PSK") {
|
||||
document.getElementById("apcli_wpa").style.display="";
|
||||
document.getElementById("apcli_wep").style.display="none";
|
||||
} else if (to == "WEP") {
|
||||
document.getElementById("apcli_wpa").style.display="none";
|
||||
document.getElementById("apcli_wep").style.display="";
|
||||
} else {
|
||||
document.getElementById("apcli_wpa").style.display="none";
|
||||
document.getElementById("apcli_wep").style.display="none";
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_atf(o) {
|
||||
if (o.getAttribute("value") == "1") {
|
||||
document.getElementById("VOW_Airtime_Fairness_En").value = "0";
|
||||
o.setAttribute("value", "0");
|
||||
o.className = "cbi-button cbi-button-add";
|
||||
o.innerHTML = "Enable ATC";
|
||||
} else {
|
||||
document.getElementById("VOW_Airtime_Fairness_En").value = "1";
|
||||
o.setAttribute("value", "1");
|
||||
o.className = "cbi-button cbi-button-remove";
|
||||
o.innerHTML = "Disable ATC";
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_atc(o) {
|
||||
if (o.getAttribute("value") == "1") {
|
||||
document.getElementById("VOW_BW_Ctrl").value = "0";
|
||||
o.setAttribute("value", "0");
|
||||
o.className = "cbi-button cbi-button-add";
|
||||
o.innerHTML = "Enable ATC";
|
||||
document.getElementById("atc-table").style.display = "none";
|
||||
} else {
|
||||
document.getElementById("VOW_BW_Ctrl").value = "1";
|
||||
o.setAttribute("value", "1");
|
||||
o.className = "cbi-button cbi-button-remove";
|
||||
o.innerHTML = "Disable ATC";
|
||||
document.getElementById("atc-table").style.display = "";
|
||||
}
|
||||
}
|
||||
|
||||
function is_mode_legacy_only(mode) {
|
||||
var imode = mode*1;
|
||||
|
||||
return ((imode >= 0) && (imode <= 4));
|
||||
}
|
||||
|
||||
function is_mode_gband(mode) {
|
||||
var imode = mode*1;
|
||||
var gband_mode_list = [0,1,4,6,7,9];
|
||||
var i;
|
||||
|
||||
for (i = 0; i < gband_mode_list.length; i++){
|
||||
if( gband_mode_list[i] == imode )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function is_mode_aband(mode) {
|
||||
var imode = mode*1;
|
||||
var aband_mode_list = [2,8,11,14,15];
|
||||
var i;
|
||||
|
||||
for (i = 0; i < aband_mode_list.length; i++){
|
||||
if( aband_mode_list[i] == imode )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function is_ch_gband(ch) {
|
||||
ch = ch*1;
|
||||
|
||||
if (ch == 0) {
|
||||
var wmode = document.getElementById('WirelessMode');
|
||||
|
||||
return is_mode_gband(wmode.value);
|
||||
}
|
||||
|
||||
return ((ch > 0) && (ch <= 14));
|
||||
}
|
||||
|
||||
function is_ch_aband(ch) {
|
||||
ch = ch*1;
|
||||
|
||||
if (ch == 0) {
|
||||
var wmode = document.getElementById('WirelessMode');
|
||||
|
||||
return is_mode_aband(wmode.value);
|
||||
}
|
||||
|
||||
return ((ch >= 36 ) && (ch <= 165));
|
||||
}
|
||||
|
||||
function initList(selobj, list, selvals, value, text){
|
||||
var sel = {};
|
||||
var id = selobj.id;
|
||||
|
||||
if (typeof(selvals) != "object")
|
||||
sel[0] = selvals;
|
||||
else
|
||||
sel = selvals;
|
||||
|
||||
selobj.innerHTML = "";
|
||||
for (var i in list) {
|
||||
var opt = document.createElement('option');
|
||||
|
||||
if(value)
|
||||
opt.value = list[i][value];
|
||||
else
|
||||
opt.value = list[i].value;
|
||||
|
||||
if(text)
|
||||
opt.text = list[i][text];
|
||||
else
|
||||
opt.text = list[i].text;
|
||||
|
||||
selobj.appendChild(opt);
|
||||
}
|
||||
|
||||
var selv = null;
|
||||
for (var k in sel) {
|
||||
//console.log("[initList][" + id + "] sel[" + k + "]=" + sel[k]);
|
||||
for (var i in selobj.options){
|
||||
if (selobj.options[i].value == sel[k]){
|
||||
selobj.options[i].selected = true;
|
||||
selv = sel[k];
|
||||
//console.log("[initList][" + id + "] found selv=" + selv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (selv) break;
|
||||
}
|
||||
|
||||
if (!selv) {
|
||||
selv = selobj.value;
|
||||
//console.log("[initList][" + id + "] !selv, selv=" + selv);
|
||||
}
|
||||
|
||||
return selv;
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
WirelessMode_onchange('<%=dev.WirelessMode%>');
|
||||
ApCliAuthMode_onchange('<%=cfgs.ApCliAuthMode%>');
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<%+footer%>
|
||||
@ -0,0 +1,174 @@
|
||||
<%+header%>
|
||||
<!--
|
||||
This module is a demo to configure MTK' proprietary WiFi driver.
|
||||
Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
|
||||
LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
|
||||
translate uci into MTK's WiFi profile (like we did in "uci2dat").
|
||||
|
||||
Hua Shao <nossiac@163.com>
|
||||
-->
|
||||
<%
|
||||
local mtkwifi = require("mtkwifi")
|
||||
local devs = mtkwifi.get_all_devs()
|
||||
%>
|
||||
<h2><a name="content">无线概况</a></h2>
|
||||
|
||||
<div id="loading" style="margin-top: 1em; display: none;">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:e;" />
|
||||
Please waiting while the page is loading......
|
||||
</div>
|
||||
|
||||
<% if #devs == 0 then %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend>No wireless device found.</legend>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% for _,dev in ipairs(devs) do %>
|
||||
<fieldset class="cbi-section">
|
||||
<table class="cbi-section-table" style="margin:10px; empty-cells:hide">
|
||||
<!-- physical device -->
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width:34px">
|
||||
<img src="/luci-static/resources/icons/wifi_big.png" style="float:left; margin-right:10px" />
|
||||
</td>
|
||||
<td colspan="2" style="text-align:left">
|
||||
<big><strong title="<%=dev.profile%>"> Generic Mediatek <%=dev.devname%></strong></big>
|
||||
<%
|
||||
local diff = mtkwifi.diff_profile(dev.profile)
|
||||
if next(diff) ~= nil then
|
||||
%>
|
||||
<span style="color:red;">* need reload to apply changes</span>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
<br/>
|
||||
<span><strong>模式:</strong> <% if dev.ApCliEnable == "1" then %> APCli <% else %> Master AP<% end %> </span>
|
||||
</td>
|
||||
<td style="width:310px;text-align:right">
|
||||
<input class="cbi-button cbi-button-reload" style="width:100px" title="重启无线" value="重启无线" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", dev.devname)%>");' />
|
||||
<input class="cbi-button cbi-button-edit" style="width:100px" title="配置无线高级设置" value="高级设置" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "dev_cfg_view", dev.devname)%>'" />
|
||||
<input class="cbi-button cbi-button-add" style="width:100px" title="添加SSID" value="添加" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_add_view", dev.devname,dev.vifs.__prefix)%>'" />
|
||||
</td>
|
||||
</tr>
|
||||
<!-- /physical device -->
|
||||
<!-- network list -->
|
||||
<% for _,vif in ipairs(dev.vifs) do %>
|
||||
<tr class="cbi-section-table-row cbi-rowstyle-1">
|
||||
<td></td>
|
||||
<td class="cbi-value-field" style="width:16px; padding:3px">
|
||||
<% if vif.state == "up" then %>
|
||||
<img src="/luci-static/resources/icons/signal-75-100.png" />
|
||||
<% else %>
|
||||
<img src="/luci-static/resources/icons/signal-none.png" />
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px"><strong>接口:</strong> <%=vif.vifname%> | <strong>无线名称:</strong> <%=vif.__ssid%> | <strong>信道:</strong> <%=vif.__channel or dev.Channel%>
|
||||
<br/>
|
||||
<% if vif.state == "up" then %>
|
||||
<strong>BSSID:</strong>:<%=vif.__bssid%> | <strong>无线模式:</strong> <%=dev.WirelessModeList[tonumber(vif.__wirelessmode or dev.WirelessMode)]%>
|
||||
<% else %>
|
||||
Wireless is disabled or not associated
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="cbi-value-field" style="text-align:right">
|
||||
<% if not vif.state then %>
|
||||
<input class="cbi-button cbi-button-apply" style="width:100px" title="启用无线" value="启用" type="button" onclick="alert('Please restart manually to create this interface.')" />
|
||||
<% elseif vif.state == "up" then %>
|
||||
<input class="cbi-button cbi-button-reset" style="width:100px" title="禁用无线" value="停用" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_disable", vif.vifname)%>'" />
|
||||
<% else %>
|
||||
<input class="cbi-button cbi-button-apply" style="width:100px" title="禁用无线" value="启用" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_enable", vif.vifname)%>'" />
|
||||
<% end %>
|
||||
<input class="cbi-button cbi-button-edit" style="width:100px" title="修改无线基本设置" value="基本设置" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_cfg_view", dev.devname, vif.vifname)%>'" />
|
||||
<% if dev.apcli then %>
|
||||
<% if dev.apcli.state == "down" then %>
|
||||
<input class="cbi-button cbi-button-apply" style="width:100px" title="启用无线" value="启用中继" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_enable", dev.apcli.vifname)%>'" />
|
||||
<% end %>
|
||||
<% end %>
|
||||
<input class="cbi-button cbi-button-remove" style="width:100px" title="删除网络" value="移除" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_del", dev.devname, vif.vifname)%>'" />
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- /network list -->
|
||||
<!-- apcli list -->
|
||||
<% if dev.apcli then %>
|
||||
<% if dev.apcli.state == "up" then %>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="cbi-value-field" style="width:16px; padding:3px">
|
||||
<% if dev.apcli.state == "up" then %>
|
||||
<img src="/luci-static/resources/icons/signal-75-100.png" />
|
||||
<% else %>
|
||||
<img src="/luci-static/resources/icons/signal-none.png" />
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="cbi-value-field" style="vertical-align:middle; text-align:left; padding:3px"><strong>接口:</strong> <%=dev.apcli.devname%> | <strong>类型:</strong> STA | <strong>状态:</strong> <%=dev.apcli.status%>
|
||||
<br/>
|
||||
<% if dev.apcli.status == "Connected" then %>
|
||||
<strong>BSSID:</strong>:<%=dev.apcli.bssid%> |
|
||||
<strong>SSID:</strong>:<%=dev.apcli.ssid%>
|
||||
<% else %>
|
||||
Wireless is disabled or not associated
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="text-align:right">
|
||||
<input class="cbi-button cbi-button-reset" style="width:100px" title="禁用无线" value="禁用中继" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_disable", dev.apcli.vifname)%>'" />
|
||||
|
||||
<% if dev.apcli.status == "Connected" then %>
|
||||
<input class="cbi-button cbi-button-remove" style="width:100px" title="重启无线" value="断开中继" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "apcli_disconnect", dev.devname, dev.apcli.vifname)%>")' />
|
||||
<% else %>
|
||||
<input class="cbi-button cbi-button-reload" style="width:100px" title="重启无线" value="连接中继" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "apcli_connect", dev.devname, dev.apcli.vifname)%>")' />
|
||||
<% end %>
|
||||
|
||||
<input class="cbi-button cbi-button-edit" style="width:100px" title="配置无线设置" value="中继设置" type="button" onclick="location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "apcli_cfg_view", dev.devname, dev.apcli.vifname)%>'" />
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- /apcli list -->
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<!--
|
||||
<h2><a id="content" name="content"><%:Station List%></a></h2>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<table class="cbi-section-table" style="margin:10px" id="iw-assoclist">
|
||||
<tr class="cbi-section-table-titles">
|
||||
<th class="cbi-section-table-cell"></th>
|
||||
<th class="cbi-section-table-cell"><%:SSID%></th>
|
||||
<th class="cbi-section-table-cell"><%:MAC-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:IPv4-Address%></th>
|
||||
<th class="cbi-section-table-cell"><%:Signal%></th>
|
||||
<th class="cbi-section-table-cell"><%:Noise%></th>
|
||||
<th class="cbi-section-table-cell"><%:RX Rate%></th>
|
||||
<th class="cbi-section-table-cell"><%:TX Rate%></th>
|
||||
</tr>
|
||||
<tr class="cbi-section-table-row cbi-rowstyle-2">
|
||||
<td class="cbi-value-field" colspan="8">
|
||||
<em><%:Collecting data...%></em>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
-->
|
||||
|
||||
<script type="text/javascript">
|
||||
function wifi_reload(url) {
|
||||
window.scrollTo(0, 0);
|
||||
document.getElementById('loading').style.display="";
|
||||
XHR.get(url, null,
|
||||
function(x)
|
||||
{
|
||||
console.log(x);
|
||||
document.getElementById("loading").style.display="none";
|
||||
window.location.reload();
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<%+footer%>
|
||||
@ -0,0 +1,590 @@
|
||||
|
||||
<%+header%>
|
||||
<!--
|
||||
This module is a demo to configure MTK' proprietary WiFi driver.
|
||||
Basic idea is to bypass uci and edit wireless profile (mt76xx.dat) directly.
|
||||
LuCI's WiFi configuration is more logical and elegent, but it's quite tricky to
|
||||
translate uci into MTK's WiFi profile (like we did in "uci2dat").
|
||||
|
||||
Hua Shao <nossiac@163.com>
|
||||
-->
|
||||
<%
|
||||
function any_wsc_enabled(wsc_conf_mode)
|
||||
if (wsc_conf_mode == "7") then
|
||||
return 1;
|
||||
end
|
||||
if (wsc_conf_mode == "4") then
|
||||
return 1;
|
||||
end
|
||||
if (wsc_conf_mode == "2") then
|
||||
return 1;
|
||||
end
|
||||
if (wsc_conf_mode == "1") then
|
||||
return 1;
|
||||
end
|
||||
return 0;
|
||||
end
|
||||
|
||||
local disp = require "luci.dispatcher"
|
||||
local path = disp.context.path
|
||||
local request = disp.context.request
|
||||
local mtkwifi = require("mtkwifi")
|
||||
local devname
|
||||
local vifname, vifidx
|
||||
local dev = {}
|
||||
local vif = {}
|
||||
|
||||
if request[4] == "vif_add_view" then
|
||||
devname, vifname = request[5], request[6]
|
||||
local devs = mtkwifi.get_all_devs()
|
||||
dev = devs and devs[devname]
|
||||
vifname = vifname..#dev.vifs
|
||||
vifidx = #dev.vifs + 1
|
||||
|
||||
elseif request[4] == "vif_cfg_view" then
|
||||
devname, vifname = request[5], request[6]
|
||||
local devs = mtkwifi.get_all_devs()
|
||||
dev = devs and devs[devname] or nil
|
||||
vif = dev and dev.vifs[vifname] or nil
|
||||
vifidx = vif and vif.vifidx or nil
|
||||
end
|
||||
|
||||
local cfgs = mtkwifi.load_profile(dev.profile)
|
||||
local WscValue = mtkwifi.token_get(cfgs["WscConfMode"], vifidx, "0") or "0"
|
||||
%>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-17.250.41546-90ac861"></script>
|
||||
|
||||
<div id="loading" style="margin-top: 1em; display: none;">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:e;" />
|
||||
Please waiting while the page is loading......
|
||||
</div>
|
||||
|
||||
<form method="post" name="cbi" action="<%=luci.dispatcher.build_url("admin", "network", "wifi", "vif_cfg", devname, vifname)%>" enctype="multipart/form-data" onsubmit="return validate_security(<%=vifidx%>,<%=cfgs["HT_DisallowTKIP"]%>)" autocomplete="off">
|
||||
<% if not dev or not vif then%>
|
||||
<fieldset class="cbi-section">
|
||||
<legend>Interface Not Exist - <%=vifname and devname.."@"..vifname or devname%>
|
||||
</legend>
|
||||
</fieldset>
|
||||
<% else %>
|
||||
<fieldset class="cbi-section">
|
||||
<legend>无线高级设置 - <%=vifname and devname.."@"..vifname or devname%>
|
||||
<%
|
||||
local diff = mtkwifi.diff_profile(dev.profile)
|
||||
if next(diff) ~= nil then
|
||||
%>
|
||||
<span style="color:red;">(<a href="javascript:location.href='<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", dev.devname)%>'">reload</a> to apply changes)</span>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</legend>
|
||||
<table id="vif-cfg-basic">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>SSID</td>
|
||||
<td>
|
||||
<input value="<%=vif.__ssid%>" name="<%="SSID"..vifidx%>" required="required" />
|
||||
<input value="<%=request[4]%>" name="__action" type="hidden" />
|
||||
</td>
|
||||
</tr>
|
||||
<% if dev.DBDC_MODE == "0" then %>
|
||||
<tr>
|
||||
<td>Channel</td>
|
||||
<td>
|
||||
<select style="width:auto" name="__channel">
|
||||
<% for i=0,14 do %>
|
||||
<option value="<%=i%>" <% if i==vif.__channel then %> selected="selected"<% end %>>
|
||||
<% if i==0 then %>Auto<% else %><%=i%><% end %>
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td>加密</td>
|
||||
<td>
|
||||
<select name="__authmode" cfg="AuthMode" id="AuthMode" onchange="AuthMode_onchange(this.options[this.options.selectedIndex].value)">
|
||||
<%
|
||||
local AuthModes
|
||||
if(WscValue == "0") then
|
||||
AuthModes = dev.AuthModeList
|
||||
else
|
||||
AuthModes = dev.WpsEnableAuthModeList
|
||||
end
|
||||
for _, v in ipairs(AuthModes) do
|
||||
if (mtkwifi.token_get(cfgs.IEEE8021X, vifidx, nil) == "1") then
|
||||
if(v == "IEEE8021X") then %>
|
||||
<option value="<%=v%>" selected="selected" ><%=v%>
|
||||
</option>
|
||||
<% else %>
|
||||
<option value="<%=v%>" ><%=v%>
|
||||
</option>
|
||||
<% end
|
||||
elseif (vif.__authmode == "OPEN" and vif.__encrypttype== "NONE") then
|
||||
if(v == "Disable") then %>
|
||||
<option value="<%=v%>" selected="selected" ><%=v%>
|
||||
</option>
|
||||
<% else %>
|
||||
<option value="<%=v%>" ><%=v%>
|
||||
</option>
|
||||
<% end
|
||||
else%>
|
||||
<option value="<%=v%>" <% if vif.__authmode==v then %>selected="selected" <% end %>><%=v%>
|
||||
</option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="wpacommon" style="display:none;">
|
||||
<tr>
|
||||
<td>算法</td>
|
||||
<td>
|
||||
<select name="__wpa_encrypttype" id="__wpa_encrypttype" cfg="EncrypType">
|
||||
<% for _,v in ipairs(dev.WPA_Enc_List) do %>
|
||||
<option value="<%=v%>" <% if vif.__encrypttype==v then %>selected="selected" <% end %>><%=v%>
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>密钥更新时间</td>
|
||||
<td>
|
||||
<input value="<%=vif.__rekeyinterval%>" type="text" name="__rekeyinterval" id="__rekeyinterval" cfg="RekeyInterval" /> (0 ~ 4194303) 秒
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="WPA2PSK" style="display:none;">
|
||||
<tr>
|
||||
<td>密码</td>
|
||||
<td>
|
||||
<input value="<%=vif.__wpapsk%>" type="text" name="<%="WPAPSK"..vifidx%>" id="<%="WPAPSK"..vifidx%>" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="WEP" style="display:none;">
|
||||
<tr>
|
||||
<td>Encryption</td>
|
||||
<td>
|
||||
<select name="__wep_encrypttype" cfg="EncrypType">
|
||||
<% for _,v in ipairs(dev.WEP_Enc_List) do %>
|
||||
<option value="<%=v%>" <% if vif.__encrypttype==v then %>selected="selected" <% end %>><%=v%>
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Default Key</td>
|
||||
<td>
|
||||
<select name="__DefaultKeyID" id="__DefaultKeyID">
|
||||
<option value="1" <%if tonumber(vif.__wepkey_id) == 1 then%>selected="selected"<%end%>>1</option>
|
||||
<option value="2" <%if tonumber(vif.__wepkey_id) == 2 then%>selected="selected"<%end%>>2</option>
|
||||
<option value="3" <%if tonumber(vif.__wepkey_id) == 3 then%>selected="selected"<%end%>>3</option>
|
||||
<option value="4" <%if tonumber(vif.__wepkey_id) == 4 then%>selected="selected"<%end%>>4</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>WEP Key 1</td>
|
||||
<td>
|
||||
<input value="<%=cfgs["Key1Str"..vifidx]%>" type="text" name="<%="Key1Str"..vifidx%>" id="<%="Key1Str"..vifidx%>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Key Type 1</td>
|
||||
<td>
|
||||
<select id="<%="WEP1Type"..vifidx%>" name="<%="WEP1Type"..vifidx%>">
|
||||
<option value="1" <%if(mtkwifi.token_get(cfgs["Key1Type"], vifidx, 0)) == "1" then %> selected="selected"<%end%>>ASCII</option>
|
||||
<option value="0" <%if(mtkwifi.token_get(cfgs["Key1Type"], vifidx, 0)) == "0" then %> selected="selected"<%end%>>Hex</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>WEP Key 2</td>
|
||||
<td>
|
||||
<input value="<%=cfgs["Key2Str"..vifidx]%>" type="text" name="<%="Key2Str"..vifidx%>" id="<%="Key2Str"..vifidx%>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Key Type 2</td>
|
||||
<td>
|
||||
<select id="<%="WEP2Type"..vifidx%>" name="<%="WEP2Type"..vifidx%>">
|
||||
<option value="1" <%if(mtkwifi.token_get(cfgs["Key2Type"], vifidx, 0)) == "1" then %> selected="selected"<%end%>>ASCII</option>
|
||||
<option value="0" <%if(mtkwifi.token_get(cfgs["Key2Type"], vifidx, 0)) == "0" then %> selected="selected"<%end%>>Hex</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>WEP Key 3</td>
|
||||
<td>
|
||||
<input value="<%=cfgs["Key3Str"..vifidx]%>" type="text" name="<%="Key3Str"..vifidx%>" id="<%="Key3Str"..vifidx%>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Key Type 3</td>
|
||||
<td>
|
||||
<select id="<%="WEP3Type"..vifidx%>" name="<%="WEP3Type"..vifidx%>">
|
||||
<option value="1" <%if(mtkwifi.token_get(cfgs["Key3Type"], vifidx, 0)) == "1" then %> selected="selected"<%end%>>ASCII</option>
|
||||
<option value="0" <%if(mtkwifi.token_get(cfgs["Key3Type"], vifidx, 0)) == "0" then %> selected="selected"<%end%>>Hex</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>WEP Key 4</td>
|
||||
<td>
|
||||
<input value="<%=cfgs["Key4Str"..vifidx]%>" type="text" name="<%="Key4Str"..vifidx%>" id="<%="Key4Str"..vifidx%>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Key Type 4</td>
|
||||
<td>
|
||||
<select id="<%="WEP4Type"..vifidx%>" name="<%="WEP4Type"..vifidx%>">
|
||||
<option value="1" <%if(mtkwifi.token_get(cfgs["Key4Type"], vifidx, 0)) == "1" then %> selected="selected"<%end%>>ASCII</option>
|
||||
<option value="0" <%if(mtkwifi.token_get(cfgs["Key4Type"], vifidx, 0)) == "0" then %> selected="selected"<%end%>>Hex</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="WPA2" style="display:none;">
|
||||
<tr>
|
||||
<td>PMK Cache Period</td>
|
||||
<td>
|
||||
<input value="<%=vif.__pmkcacheperiod%>" type="text" name="__pmkcacheperiod" id="__pmkcacheperiod" cfg="PMKCachePeriod" /> minute(s)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Pre-Authentication</td>
|
||||
<td>
|
||||
<input name="__preauth" id="__preauth" value="1"
|
||||
<% if mtkwifi.token_get(cfgs["PreAuth"], vifidx, 0) == "1" then %>
|
||||
checked="checked"
|
||||
<% end %> type="checkbox" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="PMF" style="display:none;">
|
||||
<tr>
|
||||
<td>MFPC </td>
|
||||
<td> <input name="__pmfmfpc" id="__pmfmfpc" value="1"
|
||||
<% if mtkwifi.token_get(cfgs["PMFMFPC"], vifidx, 0) == "1" then %>
|
||||
checked="checked"
|
||||
<% end %> type="checkbox" /> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MFPR </td>
|
||||
<td> <input name="__pmfmfpr" id="__pmfmfpr" value="1"
|
||||
<% if mtkwifi.token_get(cfgs["PMFMFPR"], vifidx, 0) == "1" then %>
|
||||
checked="checked"
|
||||
<% end %> type="checkbox" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MFPSHA256 </td>
|
||||
<td> <input name="__pmfsha256" id="__pmfsha256" value="1"
|
||||
<% if mtkwifi.token_get(cfgs["PMFSHA256"], vifidx, 0) == "1" then %>
|
||||
checked="checked"
|
||||
<% end %> type="checkbox" /> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="IEEE8021X" style="display:none;">
|
||||
<tr>
|
||||
<td>WEP for 8021X</td>
|
||||
<td>
|
||||
<input value="1" type="checkbox" name="__8021x_wep" <% if vif.__encrypttype=="WEP" then %>checked="checked" <% end %> />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody id="radius" style="display:none">
|
||||
<tr>
|
||||
<td>Radius Server IP</td>
|
||||
<td>
|
||||
<input value="<%=vif.__radius_server%>" type="text" name="__radius_server" id="__radius_server" cfg="RADIUS_Server" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Radius Server Port</td>
|
||||
<td>
|
||||
<input value="<%=vif.__radius_port%>" type="text" name="__radius_port" id="__radius_port" cfg="RADIUS_Port" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shared Secret</td>
|
||||
<td>
|
||||
<input value="<%=cfgs["RADIUS_Key"..vifidx]%>" type="text" name="<%="RADIUS_Key"..vifidx%>" id="<%="RADIUS_Key"..vifidx%>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Session Timeout</td>
|
||||
<td>
|
||||
<input value="<%=mtkwifi.token_get(cfgs.session_timeout_interval, vifidx, 0)%>" type="text" name="__session_timeout_interval" id="__session_timeout_interval" /> second(s)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Idle Timeout</td>
|
||||
<td>
|
||||
<input value="<%=cfgs.idle_timeout_interval%>" type="text" name="idle_timeout_interval" id="idle_timeout_interval" /> second(s)
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>隐藏 SSID</td>
|
||||
<td>
|
||||
<input name="__hidessid" cfg="HideSSID" value="1"
|
||||
<% if vif.__hidessid == "1" then %>
|
||||
checked="checked"
|
||||
<% end %> type="checkbox" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>隔离客户端</td>
|
||||
<td>
|
||||
<input name="__noforwarding" cfg="NoForwarding" value="1"
|
||||
<% if vif.__noforwarding == "1" then %>
|
||||
checked="checked"
|
||||
<% end %> type="checkbox" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>WMM 模式</td>
|
||||
<td>
|
||||
<input name="__wmmcapable" cfg="WmmCapable" value="1"
|
||||
<% if vif.__wmmcapable ~= "0" then %>
|
||||
checked="checked"
|
||||
<% end %> type="checkbox" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>强制发射速率 ( 0为自动,建议值 )</td>
|
||||
<td>
|
||||
<input value="<%=vif.__txrate or 0%>" name="__txrate" id="__txrate" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
</fieldset>
|
||||
|
||||
<div class="cbi-page-actions">
|
||||
<input class="cbi-button cbi-button-apply" value="重新加载" type="button" onclick='wifi_reload("<%=luci.dispatcher.build_url("admin", "network", "wifi", "reload", devname)%>");' />
|
||||
<input class="cbi-button cbi-button-apply" value="保存" type="submit" />
|
||||
<input class="cbi-button cbi-button-apply" name="__apply" value="保存&应用" type="submit" />
|
||||
<input class="cbi-button cbi-button-reset" value="重置" type="reset" />
|
||||
</div>
|
||||
<% end %> <!-- if not dev -->
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
function wifi_reload(url) {
|
||||
window.scrollTo(0, 0);
|
||||
document.getElementById('loading').style.display="";
|
||||
XHR.get(url, null,
|
||||
function(x)
|
||||
{
|
||||
console.log(x);
|
||||
document.getElementById("loading").style.display="none";
|
||||
window.location.reload();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function AuthMode_onchange(to) {
|
||||
var enc_list = new Array()
|
||||
enc_list[0] = "OPEN";
|
||||
enc_list[1] = "WEP";
|
||||
enc_list[2] = "WPA2PSK";
|
||||
enc_list[3] = "WPA2";
|
||||
enc_list[4] = "IEEE8021X";
|
||||
enc_list[5] = "WPAPSKWPA2PSK";
|
||||
enc_list[6] = "WPA1WPA2";
|
||||
|
||||
//replacing input string to WEP (for the case of OPEN, SHARED, WEPAUTO) so as to enable the control with id wep
|
||||
if ((to == "WEPAUTO") || (to == "SHARED") || (to == "OPEN")) {
|
||||
to = "WEP";
|
||||
}
|
||||
for (enc in enc_list) {
|
||||
var e = document.getElementById(enc_list[enc])
|
||||
if (enc_list[enc] == to) {
|
||||
if (e) e.style.display = "";
|
||||
} else {
|
||||
if (e) e.style.display = "none";
|
||||
}
|
||||
}
|
||||
if (to == "WPA2" || to == "IEEE8021X" || to == "WPA1WPA2") {
|
||||
document.getElementById("radius").style.display = "";
|
||||
} else {
|
||||
document.getElementById("radius").style.display = "none";
|
||||
}
|
||||
if (to == "WPA2" || to == "WPA2PSK" || to == "WPAPSKWPA2PSK" || to == "WPA1WPA2") {
|
||||
document.getElementById("wpacommon").style.display = "";
|
||||
if (to != "WPAPSKWPA2PSK") {
|
||||
document.getElementById("PMF").style.display = "";
|
||||
} else {
|
||||
document.getElementById("PMF").style.display = "none";
|
||||
}
|
||||
} else {
|
||||
document.getElementById("wpacommon").style.display = "none";
|
||||
}
|
||||
if (to == "WPAPSKWPA2PSK") {
|
||||
document.getElementById("WPA2PSK").style.display = "";
|
||||
}
|
||||
}
|
||||
|
||||
function validate_security(vifidx, ht_disallow_tkip) {
|
||||
if (document.getElementById("__activeTab").value != "basic") {
|
||||
return true;
|
||||
}
|
||||
var e = document.getElementById("AuthMode");
|
||||
var AuthMode = e.options[e.selectedIndex].value;
|
||||
|
||||
if (AuthMode == "Disable") {
|
||||
if (isNaN(document.getElementById("__txrate").value) == true || (document.getElementById("__txrate").value == "")) {
|
||||
alert('Please input a valid TX Rate value');
|
||||
return false;
|
||||
}
|
||||
} else if (AuthMode == "OPEN" || AuthMode == "WEPAUTO" || AuthMode == "SHARED") {
|
||||
return check_Wep(AuthMode, vifidx, ht_disallow_tkip);
|
||||
} else if (AuthMode == "WPAPSK" || AuthMode == "WPA2PSK" || AuthMode == "WPAPSKWPA2PSK") {
|
||||
return check_WpaKey(AuthMode, vifidx, ht_disallow_tkip);
|
||||
} else if (AuthMode == "WPA2") {
|
||||
if (check_Wpa2(AuthMode, vifidx) == false)
|
||||
return false;
|
||||
|
||||
if (check_radius(vifidx) == false)
|
||||
return false;
|
||||
} else if (AuthMode == "8021X") {
|
||||
if (check_radius(vifidx) == false)
|
||||
return false;
|
||||
} else if (AuthMode == "WPA" || AuthMode == "WPA1WPA2") // WPA or WPA1WP2 mixed mode
|
||||
{
|
||||
if (check_Wpa(AuthMode, vifidx, ht_disallow_tkip) == false)
|
||||
return false;
|
||||
if (check_radius(vifidx) == false)
|
||||
return false;
|
||||
} else if (AuthMode == "IEEE8021X") // 802.1x
|
||||
{
|
||||
if (check_radius(vifidx) == false)
|
||||
return false;
|
||||
} else {
|
||||
alert("Unknown value " + AuthMode + "for Auth Mode");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function check_Wpa2(AuthMode, vifidx) {
|
||||
if (isNaN(document.getElementById("__rekeyinterval").value) == true) {
|
||||
alert('Please input a valid key renewal interval');
|
||||
return false;
|
||||
}
|
||||
if (document.getElementById("__rekeyinterval").value == 0) {
|
||||
alert('Renew key interval is equal to 0, so the device will not refresh key');
|
||||
}
|
||||
if (!document.getElementById("__pmkcacheperiod").value.length) {
|
||||
alert('Please input the PMK Cache Period.');
|
||||
return false;
|
||||
} else if (isNaN(document.getElementById("__pmkcacheperiod").value)) {
|
||||
alert('Please input a number for PMK Cache Period.');
|
||||
return false;
|
||||
}
|
||||
if (check_radius(vifidx) == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
function check_WpaKey(AuthMode, vifidx, ht_disallow_tkip) {
|
||||
var keyvalue = document.getElementById("WPAPSK" + vifidx).value;
|
||||
if (keyvalue.length == 0) {
|
||||
alert('Please input wpapsk key!');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keyvalue.length < 8) {
|
||||
alert('Please input at least 8 character of wpapsk key!');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keyvalue.length == 64 && checkHex(keyvalue) == false) {
|
||||
alert('Please input 8~63 ASCII or 64 Hexadecimal character!');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkInjection(keyvalue) == false) {
|
||||
alert('Invalid characters in Pass Phrase.');
|
||||
return false;
|
||||
}
|
||||
return check_Wpa(AuthMode, vifidx, ht_disallow_tkip);
|
||||
}
|
||||
|
||||
function check_Wpa(AuthMode, vifidx, ht_disallow_tkip) {
|
||||
var e = document.getElementById("__wpa_encrypttype");
|
||||
var EncrypType = e.options[e.selectedIndex].value;
|
||||
// there is no tkip-aes mixed mode in WPA-PSK.
|
||||
if ((AuthMode == "WPA" || AuthMode == "WPAPSK") && (EncrypType == "TKIPAES")) {
|
||||
alert("There is no TKIP-AES mode in WPA-PSK");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ht_disallow_tkip == "1" && EncrypType == "TKIP")
|
||||
alert("Disallow TKIP/WEP encryption is enabled, so 11N rate will turn off!");
|
||||
|
||||
if (isNaN(document.getElementById("__rekeyinterval").value) == true) {
|
||||
alert('Please input a valid key renewal interval');
|
||||
return false;
|
||||
}
|
||||
if (document.getElementById("__rekeyinterval").value == 0) {
|
||||
alert('Renew key interval is equal to 0, so the device will not refresh key');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function check_Wep(AuthMode, vifidx, ht_disallow_tkip) {
|
||||
var e = document.getElementById("__DefaultKeyID");
|
||||
var defaultid = e.options[e.selectedIndex].value;
|
||||
var keyvalue = document.getElementById("Key" + defaultid + "Str" + vifidx).value;
|
||||
if (keyvalue.length == 0) {
|
||||
alert('Please input wep key' + defaultid + ' !');
|
||||
return false;
|
||||
}
|
||||
var keylength = keyvalue.length;
|
||||
if (keylength != 0) {
|
||||
if (document.getElementById("WEP" + defaultid + "Type" + vifidx).selectedIndex == 0) {
|
||||
if (keylength != 5 && keylength != 13) {
|
||||
alert('Please input 5 or 13 characters of wep key' + defaultid + ' !');
|
||||
return false;
|
||||
}
|
||||
if (checkInjection(keyvalue) == false) {
|
||||
alert('Wep key' + defaultid + " contains invalid characters.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (document.getElementById("WEP" + defaultid + "Type" + vifidx).selectedIndex == 1) {
|
||||
if (keylength != 10 && keylength != 26) {
|
||||
alert('Please input 10 or 26 characters of wep key' + defaultid + ' !');
|
||||
return false;
|
||||
}
|
||||
if (checkHex(keyvalue) == false) {
|
||||
alert('Invalid Wep key1 format!');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ht_disallow_tkip == "1")
|
||||
alert("Disallow TKIP/WEP encryption is enabled, so 11N rate will turn off!");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
window.onload = AuthMode_onchange(document.getElementById("AuthMode").options[document.getElementById("AuthMode").selectedIndex].value)
|
||||
</script>
|
||||
<%+footer%>
|
||||
@ -0,0 +1,2 @@
|
||||
/etc/wireless/mt7615/
|
||||
|
||||
199
package/emortal/luci-app-mtwifi/root/sbin/mtkwifi
Normal file
199
package/emortal/luci-app-mtwifi/root/sbin/mtkwifi
Normal file
@ -0,0 +1,199 @@
|
||||
#!/usr/bin/env lua
|
||||
-- Alternative for OpenWrt's /sbin/wifi.
|
||||
-- Copyright Not Reserved.
|
||||
-- Hua Shao <nossiac@163.com>
|
||||
|
||||
package.path = '/lib/wifi/?.lua;'..package.path
|
||||
|
||||
local mtkwifi = require("mtkwifi")
|
||||
local nixio = require("nixio")
|
||||
|
||||
function usage()
|
||||
print("wifi <up|down|reset|reload|status> [devname]")
|
||||
end
|
||||
|
||||
|
||||
function wifi_common_up(devname)
|
||||
nixio.syslog("debug", "wifi_common_up "..tostring(devname))
|
||||
|
||||
-- need to find out the vif prefix for this device
|
||||
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
|
||||
do
|
||||
if string.match(vif, "ra%a-%d+") then
|
||||
os.execute("ifconfig "..vif.." up")
|
||||
end
|
||||
end
|
||||
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
|
||||
do
|
||||
if string.match(vif, "apcli%a-%d+") then
|
||||
os.execute("ifconfig "..vif.." up")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function wifi_common_down(devname)
|
||||
nixio.syslog("debug", "wifi_common_down "..tostring(devname))
|
||||
|
||||
-- need to find out the vif prefix for this device
|
||||
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
|
||||
do
|
||||
if string.match(vif, "apcli%d+")
|
||||
or string.match(vif, "apclii%d+") then
|
||||
os.execute("ifconfig "..vif.." down")
|
||||
end
|
||||
end
|
||||
for _,vif in ipairs(string.split(mtkwifi.read_pipe("ls /sys/class/net"), "\n"))
|
||||
do
|
||||
if string.match(vif, "ra%d+")
|
||||
or string.match(vif, "rai%d+")
|
||||
or string.match(vif, "rae%d+")
|
||||
or string.match(vif, "rax%d+") then
|
||||
os.execute("ifconfig "..vif.." down")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function wifi_common_reload(devname)
|
||||
nixio.syslog("debug", "wifi_common_reload "..tostring(devname))
|
||||
wifi_common_up()
|
||||
wifi_common_down()
|
||||
end
|
||||
|
||||
function wifi_common_restart(devname)
|
||||
nixio.syslog("debug", "wifi_common_restart "..tostring(devname))
|
||||
wifi_common_reload()
|
||||
end
|
||||
|
||||
function wifi_common_reset(devname)
|
||||
nixio.syslog("debug", "wifi_common_reset called!")
|
||||
local curpath = "/etc/wireless/"
|
||||
if devname then
|
||||
curpath = curpath..devname.."/"
|
||||
end
|
||||
local defpath = "/rom"..defpath
|
||||
if mtkwifi.exists(defpath) then
|
||||
os.execute("rm -rf "..curpath)
|
||||
os.execute("cp -rf "..defpath.." "..curpath)
|
||||
wifi_common_reload()
|
||||
else
|
||||
nixio.syslog("debug", defpath.." missing, unable to reset!")
|
||||
end
|
||||
end
|
||||
|
||||
function wifi_common_status(devname)
|
||||
nixio.syslog("debug", "wifi_common_status "..tostring(devname))
|
||||
print(mtkwifi.read_pipe("iwconfig"))
|
||||
print(mtkwifi.read_pipe("ifconfig -a"))
|
||||
end
|
||||
|
||||
function wifi_common_detect(devname)
|
||||
nixio.syslog("debug", "wifi_common_detect "..tostring(devname))
|
||||
local devs = mtkwifi.getdevs()
|
||||
for _,dev in ipairs(devs) do
|
||||
print("config wifi-device "..dev.devname..
|
||||
"\n\toption type "..dev.devname..
|
||||
"\n\toption vendor ralink"..
|
||||
"\n\toption channel "..dev.Channel)
|
||||
for _,vif in ipairs(dev.vifs) do
|
||||
print("\nconfig wifi-iface"..
|
||||
"\n\toption device"..dev.devname..
|
||||
"\n\toption ifname"..vif.vifname..
|
||||
"\n\toption network lan"..
|
||||
"\n\toption mode ap")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _,f in ipairs(string.split(mtkwifi.read_pipe("find /lib/wifi/ -name \"*.lua\" 2>/dev/null"), "\n")) do
|
||||
dofile(f)
|
||||
end
|
||||
|
||||
function wifi(cmd, devname)
|
||||
local mtkwifi = require("mtkwifi")
|
||||
local devs, l1parser = mtkwifi.__get_l1dat()
|
||||
if not devs or not l1parser then
|
||||
return wifi_orig(cmd, devname)
|
||||
end
|
||||
|
||||
if devname then
|
||||
local dev = devs.devname_ridx[devname]
|
||||
assert(mtkwifi.exists(dev.init_script))
|
||||
local compatname = dev.init_compatible
|
||||
assert(compatname)
|
||||
|
||||
if _G[compatname.."_"..cmd] then
|
||||
nixio.syslog("info", "call "..compatname.."_"..cmd.."("..devname..")")
|
||||
_G[compatname.."_"..cmd](devname)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
-- if devname not not specified
|
||||
for devname, dev in pairs(devs.devname_ridx) do
|
||||
local compatname = dev.init_compatible
|
||||
nixio.syslog("info", "call "..compatname.."_"..cmd.."("..devname..")")
|
||||
_G[compatname.."_"..cmd](devname)
|
||||
end
|
||||
end
|
||||
|
||||
function wifi_orig(cmd,devname)
|
||||
local relname = nil
|
||||
if devname then
|
||||
relname = string.split(devname,".")[1]
|
||||
end
|
||||
|
||||
if relname then
|
||||
if _G[relname.."_"..cmd] then
|
||||
nixio.syslog("info", "call "..relname.."_"..cmd.."("..devname..")")
|
||||
_G[relname.."_"..cmd](devname)
|
||||
end
|
||||
else
|
||||
local devinfo = mtkwifi.search_dev_and_profile()
|
||||
local done = {}
|
||||
for __devname in pairs(devinfo) do
|
||||
local __relname = string.split(__devname,".")[1]
|
||||
repeat
|
||||
-- common case
|
||||
if done[__relname] then break else done[__relname] = true end
|
||||
if _G[__relname.."_"..cmd] then
|
||||
nixio.syslog("info", "call "..__relname.."_"..cmd.."("..__devname..")")
|
||||
_G[__relname.."_"..cmd](__devname)
|
||||
break
|
||||
end
|
||||
-- try shell
|
||||
local dev_shell = "/lib/wifi/"..__relname..".sh"
|
||||
if mtkwifi.exists(dev_shell) then
|
||||
local cmd = "source "..dev_shell.."; "..__relname.."_"..cmd.." > /dev/null"
|
||||
nixio.syslog("info", cmd)
|
||||
if os.execute(cmd) ~= 0 then
|
||||
nixio.syslog("err", cmd)
|
||||
end
|
||||
break
|
||||
end
|
||||
-- fall back on common api
|
||||
nixio.syslog("info", "no scripts for "..__relname.." found, fall back on common api!")
|
||||
_G["wifi_common_"..cmd](__devname)
|
||||
until true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
cmd = arg[1]
|
||||
dev = arg[2]
|
||||
|
||||
if cmd == "up"
|
||||
or cmd == "down"
|
||||
or cmd == "status"
|
||||
or cmd == "detect"
|
||||
or cmd == "reload"
|
||||
or cmd == "restart"
|
||||
or cmd == "reset" then
|
||||
wifi(cmd, dev)
|
||||
elseif cmd == "reload_legacy" then
|
||||
nixio.syslog("info", "legacy command "..cmd)
|
||||
wifi("up", dev)
|
||||
else
|
||||
usage()
|
||||
end
|
||||
|
||||
959
package/emortal/luci-app-mtwifi/root/usr/lib/lua/mtkwifi.lua
Normal file
959
package/emortal/luci-app-mtwifi/root/usr/lib/lua/mtkwifi.lua
Normal file
@ -0,0 +1,959 @@
|
||||
#!/usr/bin/env lua
|
||||
|
||||
--[[
|
||||
* A lua library to manipulate mtk's wifi driver. used in luci-app-mtk.
|
||||
*
|
||||
* Hua Shao <nossiac@163.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 2.1
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
]]
|
||||
|
||||
local mtkwifi = {}
|
||||
local _, nixio = pcall(require, "nixio")
|
||||
|
||||
function mtkwifi.debug(...)
|
||||
local ff = io.open("/tmp/mtkwifi.dbg.log", "a")
|
||||
local vars = {...}
|
||||
for _, v in pairs(vars) do
|
||||
ff:write(v.." ")
|
||||
end
|
||||
ff:write("\n")
|
||||
ff:close()
|
||||
end
|
||||
|
||||
if not nixio then
|
||||
nixio.syslog = mtkwifi.debug
|
||||
end
|
||||
|
||||
function string:split(sep)
|
||||
local sep, fields = sep or ":", {}
|
||||
local pattern = string.format("([^%s]+)", sep)
|
||||
self:gsub(pattern, function(c) fields[#fields+1] = c end)
|
||||
return fields
|
||||
end
|
||||
|
||||
function mtkwifi.__trim(s)
|
||||
if s then return (s:gsub("^%s*(.-)%s*$", "%1")) end
|
||||
end
|
||||
|
||||
function mtkwifi.__handleSpecialChars(s)
|
||||
s = s:gsub("\\", "\\\\")
|
||||
s = s:gsub("\"", "\\\"")
|
||||
s = mtkwifi.__trim(s)
|
||||
return s
|
||||
end
|
||||
|
||||
-- if order function given, sort by it by passing the table and keys a, b,
|
||||
-- otherwise just sort the keys
|
||||
function mtkwifi.__spairs(t, order)
|
||||
-- collect the keys
|
||||
local keys = {}
|
||||
for k in pairs(t) do keys[#keys+1] = k end
|
||||
table.sort(keys, order)
|
||||
-- return the iterator function
|
||||
local i = 0
|
||||
return function()
|
||||
i = i + 1
|
||||
if keys[i] then
|
||||
return keys[i], t[keys[i]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mtkwifi.__lines(str)
|
||||
local t = {}
|
||||
local function helper(line) table.insert(t, line) return "" end
|
||||
helper((str:gsub("(.-)\r?\n", helper)))
|
||||
return t
|
||||
end
|
||||
|
||||
function mtkwifi.__get_l1dat()
|
||||
if not pcall(require, "l1dat_parser") then
|
||||
return
|
||||
end
|
||||
|
||||
local parser = require("l1dat_parser")
|
||||
local l1dat = parser.load_l1_profile(parser.L1_DAT_PATH)
|
||||
|
||||
return l1dat, parser
|
||||
end
|
||||
|
||||
function mtkwifi.sleep(s)
|
||||
local ntime = os.clock() + s
|
||||
repeat until os.clock() > ntime
|
||||
end
|
||||
|
||||
function mtkwifi.deepcopy(orig)
|
||||
local orig_type = type(orig)
|
||||
local copy
|
||||
if orig_type == 'table' then
|
||||
copy = {}
|
||||
for orig_key, orig_value in next, orig, nil do
|
||||
copy[mtkwifi.deepcopy(orig_key)] = mtkwifi.deepcopy(orig_value)
|
||||
end
|
||||
setmetatable(copy, mtkwifi.deepcopy(getmetatable(orig)))
|
||||
else -- number, string, boolean, etc
|
||||
copy = orig
|
||||
end
|
||||
return copy
|
||||
end
|
||||
|
||||
function mtkwifi.read_pipe(pipe)
|
||||
local fp = io.popen(pipe)
|
||||
local txt = fp:read("*a")
|
||||
fp:close()
|
||||
return txt
|
||||
end
|
||||
|
||||
function mtkwifi.load_profile(path, raw)
|
||||
local cfgs = {}
|
||||
local content
|
||||
|
||||
if path then
|
||||
local fd = io.open(path, "r")
|
||||
if not fd then return end
|
||||
content = fd:read("*all")
|
||||
fd:close()
|
||||
elseif raw then
|
||||
content = raw
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
-- convert profile into lua table
|
||||
for _,line in ipairs(mtkwifi.__lines(content)) do
|
||||
line = mtkwifi.__trim(line)
|
||||
if string.byte(line) ~= string.byte("#") then
|
||||
local i = string.find(line, "=")
|
||||
if i then
|
||||
local k,v
|
||||
k = string.sub(line, 1, i-1)
|
||||
v = string.sub(line, i+1)
|
||||
if cfgs[mtkwifi.__trim(k)] then
|
||||
mtkwifi.debug("warning", "skip repeated key"..line)
|
||||
end
|
||||
cfgs[mtkwifi.__trim(k)] = mtkwifi.__trim(v) or ""
|
||||
else
|
||||
mtkwifi.debug("warning", "skip line without '=' "..line)
|
||||
end
|
||||
else
|
||||
mtkwifi.debug("warning", "skip comment line "..line)
|
||||
end
|
||||
end
|
||||
return cfgs
|
||||
end
|
||||
|
||||
function mtkwifi.__profile_bak_path(profile)
|
||||
local bak = "/tmp/mtk/wifi/"..string.match(profile, "([^/]+\.dat)")..".last"
|
||||
os.execute("mkdir -p /tmp/mtk/wifi")
|
||||
return bak
|
||||
end
|
||||
|
||||
function mtkwifi.save_profile(cfgs, path)
|
||||
|
||||
if not cfgs then
|
||||
mtkwifi.debug("configuration was empty, nothing saved")
|
||||
return
|
||||
end
|
||||
|
||||
local fd = io.open(path, "w")
|
||||
table.sort(cfgs, function(a,b) return a<b end)
|
||||
if not fd then return end
|
||||
fd:write("# Generated by mtkwifi.lua\n")
|
||||
fd:write("Default\n")
|
||||
for k,v in mtkwifi.__spairs(cfgs, function(a,b) return string.upper(a) < string.upper(b) end) do
|
||||
fd:write(k.."="..v.."\n")
|
||||
end
|
||||
fd:close()
|
||||
|
||||
if pcall(require, "mtknvram") then
|
||||
local nvram = require("mtknvram")
|
||||
local l1dat, l1 = mtkwifi.__get_l1dat()
|
||||
local zone = l1 and l1.l1_path_to_zone(path)
|
||||
|
||||
if not l1dat then
|
||||
mtkwifi.debug("save_profile: no l1dat", path)
|
||||
nvram.nvram_save_profile(path)
|
||||
else
|
||||
if zone then
|
||||
mtkwifi.debug("save_profile:", path, zone)
|
||||
nvram.nvram_save_profile(path, zone)
|
||||
else
|
||||
mtkwifi.debug("save_profile:", path)
|
||||
nvram.nvram_save_profile(path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- if path2 not give, we use path1's backup.
|
||||
function mtkwifi.diff_profile(path1, path2)
|
||||
assert(path1)
|
||||
if not path2 then
|
||||
path2 = mtkwifi.__profile_bak_path(path1)
|
||||
if not mtkwifi.exists(path2) then
|
||||
return {}
|
||||
end
|
||||
end
|
||||
assert(path2)
|
||||
|
||||
local diff = {}
|
||||
local cfg1 = mtkwifi.load_profile(path1) or {}
|
||||
local cfg2 = mtkwifi.load_profile(path2) or {}
|
||||
|
||||
for k,v in pairs(cfg1) do
|
||||
if cfg2[k] ~= cfg1[k] then
|
||||
diff[k] = {cfg1[k] or "", cfg2[k] or ""}
|
||||
end
|
||||
end
|
||||
|
||||
for k,v in pairs(cfg2) do
|
||||
if cfg2[k] ~= cfg1[k] then
|
||||
diff[k] = {cfg1[k] or "", cfg2[k] or ""}
|
||||
end
|
||||
end
|
||||
|
||||
return diff
|
||||
end
|
||||
|
||||
|
||||
-- Mode 12 and 13 are only available for STAs.
|
||||
local WirelessModeList = {
|
||||
[0] = "B/G mixed",
|
||||
[1] = "B only",
|
||||
[2] = "A only",
|
||||
-- [3] = "A/B/G mixed",
|
||||
[4] = "G only",
|
||||
-- [5] = "A/B/G/GN/AN mixed",
|
||||
[6] = "N in 2.4G only",
|
||||
[7] = "G/GN", -- i.e., no CCK mode
|
||||
[8] = "A/N in 5 band",
|
||||
[9] = "B/G/GN mode",
|
||||
-- [10] = "A/AN/G/GN mode", --not support B mode
|
||||
[11] = "only N in 5G band",
|
||||
-- [12] = "B/G/GN/A/AN/AC mixed",
|
||||
-- [13] = "G/GN/A/AN/AC mixed", -- no B mode
|
||||
[14] = "A/AC/AN mixed",
|
||||
[15] = "AC/AN mixed", --but no A mode
|
||||
}
|
||||
|
||||
local DevicePropertyMap = {
|
||||
-- 2.4G
|
||||
{device="MT7603", band={"0", "1", "4", "6", "7", "9"}},
|
||||
{device="MT7620", band={"0", "1", "4", "6", "7", "9"}},
|
||||
{device="MT7622", band={"0", "1", "4", "9"}},
|
||||
{device="MT7628", band={"0", "1", "4", "6", "7", "9"}},
|
||||
-- 5G
|
||||
{device="MT7610", band={"2", "8", "11", "14", "15"}},
|
||||
{device="MT7612", band={"2", "8", "11", "14", "15"}},
|
||||
{device="MT7662", band={"2", "8", "11", "14", "15"}},
|
||||
-- Mix
|
||||
{device="MT7615", band={"0", "1", "4", "9", "2", "8", "14", "15"}}
|
||||
}
|
||||
|
||||
mtkwifi.CountryRegionList_5G_All = {
|
||||
{region=0, text="0: Ch36~64, Ch149~165"},
|
||||
{region=1, text="1: Ch36~64, Ch100~140"},
|
||||
{region=2, text="2: Ch36~64"},
|
||||
{region=3, text="3: Ch52~64, Ch149~161"},
|
||||
{region=4, text="4: Ch149~165"},
|
||||
{region=5, text="5: Ch149~161"},
|
||||
{region=6, text="6: Ch36~48"},
|
||||
{region=7, text="7: Ch36~64, Ch100~140, Ch149~165"},
|
||||
{region=8, text="8: Ch52~64"},
|
||||
{region=9, text="9: Ch36~64, Ch100~116, Ch132~140, Ch149~165"},
|
||||
{region=10, text="10: Ch36~48, Ch149~165"},
|
||||
{region=11, text="11: Ch36~64, Ch100~120, Ch149~161"},
|
||||
{region=12, text="12: Ch36~64, Ch100~144"},
|
||||
{region=13, text="13: Ch36~64, Ch100~144, Ch149~165"},
|
||||
{region=14, text="14: Ch36~64, Ch100~116, Ch132~144, Ch149~165"},
|
||||
{region=15, text="15: Ch149~173"},
|
||||
{region=16, text="16: Ch52~64, Ch149~165"},
|
||||
{region=17, text="17: Ch36~48, Ch149~161"},
|
||||
{region=18, text="18: Ch36~64, Ch100~116, Ch132~140"},
|
||||
{region=19, text="19: Ch56~64, Ch100~140, Ch149~161"},
|
||||
{region=20, text="20: Ch36~64, Ch100~124, Ch149~161"},
|
||||
{region=21, text="21: Ch36~64, Ch100~140, Ch149~161"},
|
||||
{region=22, text="22: Ch100~140"},
|
||||
{region=30, text="30: Ch36~48, Ch52~64, Ch100~140, Ch149~165"},
|
||||
{region=31, text="31: Ch52~64, Ch100~140, Ch149~165"},
|
||||
{region=32, text="32: Ch36~48, Ch52~64, Ch100~140, Ch149~161"},
|
||||
{region=33, text="33: Ch36~48, Ch52~64, Ch100~140"},
|
||||
{region=34, text="34: Ch36~48, Ch52~64, Ch149~165"},
|
||||
{region=35, text="35: Ch36~48, Ch52~64"},
|
||||
{region=36, text="36: Ch36~48, Ch100~140, Ch149~165"},
|
||||
{region=37, text="37: Ch36~48, Ch52~64, Ch149~165, Ch173"},
|
||||
}
|
||||
|
||||
mtkwifi.CountryRegionList_2G_All = {
|
||||
{region=0, text="0: Ch1~11"},
|
||||
{region=1, text="1: Ch1~13"},
|
||||
{region=2, text="2: Ch10~11"},
|
||||
{region=3, text="3: Ch10~13"},
|
||||
{region=4, text="4: Ch14"},
|
||||
{region=5, text="5: Ch1~14"},
|
||||
{region=6, text="6: Ch3~9"},
|
||||
{region=7, text="7: Ch5~13"},
|
||||
{region=31, text="31: Ch1~11, Ch12~14"},
|
||||
{region=32, text="32: Ch1~11, Ch12~13"},
|
||||
{region=33, text="33: Ch1~14"},
|
||||
}
|
||||
|
||||
mtkwifi.ChannelList_5G_All = {
|
||||
{channel=0, text="Channel 0 (Auto )", region={}},
|
||||
{channel= 36, text="Channel 36 (5.180 GHz)", region={[0]=1, [1]=1, [2]=1, [6]=1, [7]=1, [9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [14]=1, [17]=1, [18]=1, [20]=1, [21]=1, [30]=1, [32]=1, [33]=1, [34]=1, [35]=1, [36]=1, [37]=1}},
|
||||
{channel= 40, text="Channel 40 (5.200 GHz)", region={[0]=1, [1]=1, [2]=1, [6]=1, [7]=1, [9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [14]=1, [17]=1, [18]=1, [20]=1, [21]=1, [30]=1, [32]=1, [33]=1, [34]=1, [35]=1, [36]=1, [37]=1}},
|
||||
{channel= 44, text="Channel 44 (5.220 GHz)", region={[0]=1, [1]=1, [2]=1, [6]=1, [7]=1, [9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [14]=1, [17]=1, [18]=1, [20]=1, [21]=1, [30]=1, [32]=1, [33]=1, [34]=1, [35]=1, [36]=1, [37]=1}},
|
||||
{channel= 48, text="Channel 48 (5.240 GHz)", region={[0]=1, [1]=1, [2]=1, [6]=1, [7]=1, [9]=1, [10]=1, [11]=1, [12]=1, [13]=1, [14]=1, [17]=1, [18]=1, [20]=1, [21]=1, [30]=1, [32]=1, [33]=1, [34]=1, [35]=1, [36]=1, [37]=1}},
|
||||
{channel= 52, text="Channel 52 (5.260 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [7]=1, [8]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [16]=1, [18]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [33]=1, [34]=1, [35]=1, [37]=1}},
|
||||
{channel= 56, text="Channel 56 (5.280 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [7]=1, [8]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [16]=1, [18]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [33]=1, [34]=1, [35]=1, [37]=1}},
|
||||
{channel= 60, text="Channel 60 (5.300 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [7]=1, [8]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [16]=1, [18]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [33]=1, [34]=1, [35]=1, [37]=1}},
|
||||
{channel= 64, text="Channel 64 (5.320 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [7]=1, [8]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [16]=1, [18]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [33]=1, [34]=1, [35]=1, [37]=1}},
|
||||
{channel=100, text="Channel 100 (5.500 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=104, text="Channel 104 (5.520 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=108, text="Channel 108 (5.540 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=112, text="Channel 112 (5.560 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=116, text="Channel 116 (5.580 GHz)", region={[1]=1, [7]=1, [9]=1, [11]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=120, text="Channel 120 (5.600 GHz)", region={[1]=1, [7]=1, [11]=1, [12]=1, [13]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=124, text="Channel 124 (5.620 GHz)", region={[1]=1, [7]=1, [12]=1, [13]=1, [19]=1, [20]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=128, text="Channel 128 (5.640 GHz)", region={[1]=1, [7]=1, [12]=1, [13]=1, [19]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=132, text="Channel 132 (5.660 GHz)", region={[1]=1, [7]=1, [9]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=136, text="Channel 136 (5.680 GHz)", region={[1]=1, [7]=1, [9]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=140, text="Channel 140 (5.700 GHz)", region={[1]=1, [7]=1, [9]=1, [12]=1, [13]=1, [14]=1, [18]=1, [19]=1, [21]=1, [22]=1, [30]=1, [31]=1, [32]=1, [33]=1, [36]=1}},
|
||||
{channel=144, text="Channel 144 (5.720 GHz)", region={[12]=1, [13]=1, [14]=1}},
|
||||
{channel=149, text="Channel 149 (5.745 GHz)", region={[0]=1, [3]=1, [4]=1, [5]=1, [7]=1, [9]=1, [10]=1, [11]=1, [13]=1, [14]=1, [15]=1, [16]=1, [17]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [34]=1, [36]=1, [37]=1}},
|
||||
{channel=153, text="Channel 153 (5.765 GHz)", region={[0]=1, [3]=1, [4]=1, [5]=1, [7]=1, [9]=1, [10]=1, [11]=1, [13]=1, [14]=1, [15]=1, [16]=1, [17]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [34]=1, [36]=1, [37]=1}},
|
||||
{channel=157, text="Channel 157 (5.785 GHz)", region={[0]=1, [3]=1, [4]=1, [5]=1, [7]=1, [9]=1, [10]=1, [11]=1, [13]=1, [14]=1, [15]=1, [16]=1, [17]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [34]=1, [36]=1, [37]=1}},
|
||||
{channel=161, text="Channel 161 (5.805 GHz)", region={[0]=1, [3]=1, [4]=1, [5]=1, [7]=1, [9]=1, [10]=1, [11]=1, [13]=1, [14]=1, [15]=1, [16]=1, [17]=1, [19]=1, [20]=1, [21]=1, [30]=1, [31]=1, [32]=1, [34]=1, [36]=1, [37]=1}},
|
||||
{channel=165, text="Channel 165 (5.825 GHz)", region={[0]=1, [4]=1, [7]=1, [9]=1, [10]=1, [13]=1, [14]=1, [15]=1, [16]=1, [30]=1, [31]=1, [34]=1, [36]=1, [37]=1}},
|
||||
{channel=169, text="Channel 169 (5.845 GHz)", region={[15]=1}},
|
||||
{channel=173, text="Channel 173 (5.865 GHz)", region={[15]=1, [37]=1}},
|
||||
}
|
||||
|
||||
mtkwifi.ChannelList_2G_All = {
|
||||
{channel=0, text="Channel 0 (Auto )", region={}},
|
||||
{channel= 1, text="Channel 1 (2412 GHz)", region={[0]=1, [1]=1, [5]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel= 2, text="Channel 2 (2417 GHz)", region={[0]=1, [1]=1, [5]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel= 3, text="Channel 3 (2422 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel= 4, text="Channel 4 (2427 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel= 5, text="Channel 5 (2432 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel= 6, text="Channel 6 (2437 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel= 7, text="Channel 7 (2442 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel= 8, text="Channel 8 (2447 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel= 9, text="Channel 9 (2452 GHz)", region={[0]=1, [1]=1, [5]=1, [6]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel=10, text="Channel 10 (2457 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [5]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel=11, text="Channel 11 (2462 GHz)", region={[0]=1, [1]=1, [2]=1, [3]=1, [5]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel=12, text="Channel 12 (2467 GHz)", region={[1]=1, [3]=1, [5]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel=13, text="Channel 13 (2472 GHz)", region={[1]=1, [3]=1, [5]=1, [7]=1, [31]=1, [32]=1, [33]=1}},
|
||||
{channel=14, text="Channel 14 (2477 GHz)", region={[4]=1, [5]=1, [31]=1, [33]=1}},
|
||||
}
|
||||
|
||||
mtkwifi.ChannelList_5G_2nd_80MHZ_ALL = {
|
||||
{channel=36, text="Ch36(5.180 GHz) - Ch48(5.240 GHz)", chidx=2},
|
||||
{channel=52, text="Ch52(5.260 GHz) - Ch64(5.320 GHz)", chidx=6},
|
||||
{channel=-1, text="Channel between 64 100", chidx=-1},
|
||||
{channel=100, text="Ch100(5.500 GHz) - Ch112(5.560 GHz)", chidx=10},
|
||||
{channel=112, text="Ch116(5.580 GHz) - Ch128(5.640 GHz)", chidx=14},
|
||||
{channel=-1, text="Channel between 128 132", chidx=-1},
|
||||
{channel=132, text="Ch132(5.660 GHz) - Ch144(5.720 GHz)", chidx=18},
|
||||
{channel=-1, text="Channel between 144 149", chidx=-1},
|
||||
{channel=149, text="Ch149(5.745 GHz) - Ch161(5.805 GHz)", chidx=22},
|
||||
}
|
||||
|
||||
local AuthModeList = {
|
||||
"Disable",
|
||||
"OPEN",--OPENWEP
|
||||
"SHARED",--SHAREDWEP
|
||||
"WEPAUTO",
|
||||
"WPA2",
|
||||
"WPA2PSK",
|
||||
"WPAPSKWPA2PSK",
|
||||
"WPA1WPA2",
|
||||
"IEEE8021X",
|
||||
}
|
||||
|
||||
local WpsEnableAuthModeList = {
|
||||
"Disable",
|
||||
"OPEN",--OPENWEP
|
||||
"WPA2PSK",
|
||||
"WPAPSKWPA2PSK",
|
||||
}
|
||||
|
||||
local ApCliAuthModeList = {
|
||||
"Disable",
|
||||
"OPEN",
|
||||
"SHARED",
|
||||
"WPAPSK",
|
||||
"WPA2PSK",
|
||||
"WPAPSKWPA2PSK",
|
||||
-- "WPA",
|
||||
-- "WPA2",
|
||||
-- "WPAWPA2",
|
||||
-- "8021X",
|
||||
}
|
||||
|
||||
local WPA_Enc_List = {
|
||||
"AES",
|
||||
"TKIP",
|
||||
"TKIPAES",
|
||||
}
|
||||
|
||||
|
||||
local WEP_Enc_List = {
|
||||
"WEP",
|
||||
}
|
||||
|
||||
local dbdc_prefix = {
|
||||
{"ra", "rax"},
|
||||
{"rai", "ray"},
|
||||
{"rae", "raz"},
|
||||
}
|
||||
|
||||
local dbdc_apcli_prefix = {
|
||||
{"apcli", "apclix"},
|
||||
{"apclii", "apcliy"},
|
||||
{"apclie", "apcliz"},
|
||||
}
|
||||
|
||||
function mtkwifi.band(mode)
|
||||
local i = tonumber(mode)
|
||||
if i == 0
|
||||
or i == 1
|
||||
or i == 4
|
||||
or i == 6
|
||||
or i == 7
|
||||
or i == 9 then
|
||||
return "2.4G"
|
||||
else
|
||||
return "5G"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function mtkwifi.__cfg2list(str)
|
||||
-- delimeter == ";"
|
||||
local i = 1
|
||||
local list = {}
|
||||
for k in string.gmatch(str, "([^;]+)") do
|
||||
list[i] = k
|
||||
i = i + 1
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
function mtkwifi.token_set(str, n, v)
|
||||
-- n start from 1
|
||||
-- delimeter == ";"
|
||||
if not str then return end
|
||||
local tmp = mtkwifi.__cfg2list(str)
|
||||
if type(v) ~= type("") and type(v) ~= type(0) then
|
||||
mtkwifi.debug("err", "invalid value type in token_set, "..type(v))
|
||||
return
|
||||
end
|
||||
if #tmp < tonumber(n) then
|
||||
for i=#tmp, tonumber(n) do
|
||||
if not tmp[i] then
|
||||
tmp[i] = v -- pad holes with v !
|
||||
end
|
||||
end
|
||||
else
|
||||
tmp[n] = v
|
||||
end
|
||||
return table.concat(tmp, ";")
|
||||
end
|
||||
|
||||
|
||||
function mtkwifi.token_get(str, n, v)
|
||||
-- n starts from 1
|
||||
-- v is the backup in case token n is nil
|
||||
if not str then return v end
|
||||
local tmp = mtkwifi.__cfg2list(str)
|
||||
return tmp[tonumber(n)] or v
|
||||
end
|
||||
|
||||
function mtkwifi.search_dev_and_profile_orig()
|
||||
local dir = io.popen("ls /etc/wireless/")
|
||||
if not dir then return end
|
||||
local result = {}
|
||||
-- case 1: mt76xx.dat (best)
|
||||
-- case 2: mt76xx.n.dat (multiple card of same dev)
|
||||
-- case 3: mt76xx.n.nG.dat (case 2 plus dbdc and multi-profile, bloody hell....)
|
||||
for line in dir:lines() do
|
||||
-- mtkwifi.debug("debug", "scan "..line)
|
||||
local tmp = io.popen("find /etc/wireless/"..line.." -type f -name \"*.dat\"")
|
||||
for datfile in tmp:lines() do
|
||||
-- mtkwifi.debug("debug", "test "..datfile)
|
||||
|
||||
repeat do
|
||||
-- for case 1
|
||||
local devname = string.match(datfile, "("..line..").dat")
|
||||
if devname then
|
||||
result[devname] = datfile
|
||||
-- mtkwifi.debug("debug", "yes "..devname.."="..datfile)
|
||||
break
|
||||
end
|
||||
-- for case 2
|
||||
local devname = string.match(datfile, "("..line.."%.%d)%.dat")
|
||||
if devname then
|
||||
result[devname] = datfile
|
||||
-- mtkwifi.debug("debug", "yes "..devname.."="..datfile)
|
||||
break
|
||||
end
|
||||
-- for case 3
|
||||
local devname = string.match(datfile, "("..line.."%.%d%.%dG)%.dat")
|
||||
if devname then
|
||||
result[devname] = datfile
|
||||
-- mtkwifi.debug("debug", "yes "..devname.."="..datfile)
|
||||
break
|
||||
end
|
||||
end until true
|
||||
end
|
||||
end
|
||||
|
||||
for k,v in pairs(result) do
|
||||
mtkwifi.debug("debug", "search_dev_and_profile_orig: "..k.."="..v)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function mtkwifi.search_dev_and_profile_l1()
|
||||
local l1dat = mtkwifi.__get_l1dat()
|
||||
|
||||
if not l1dat then return end
|
||||
|
||||
local result = {}
|
||||
local dbdc_2nd_if = ""
|
||||
|
||||
for k, dev in ipairs(l1dat) do
|
||||
dbdc_2nd_if = mtkwifi.token_get(dev.main_ifname, 2, nil)
|
||||
if dbdc_2nd_if then
|
||||
result[dev["INDEX"].."."..dev["mainidx"]..".1"] = mtkwifi.token_get(dev.profile_path, 1, nil)
|
||||
result[dev["INDEX"].."."..dev["mainidx"]..".2"] = mtkwifi.token_get(dev.profile_path, 2, nil)
|
||||
else
|
||||
result[dev["INDEX"].."."..dev["mainidx"]] = dev.profile_path
|
||||
end
|
||||
end
|
||||
|
||||
for k,v in pairs(result) do
|
||||
mtkwifi.debug("debug", "search_dev_and_profile_l1: "..k.."="..v)
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function mtkwifi.search_dev_and_profile()
|
||||
return mtkwifi.search_dev_and_profile_l1() or mtkwifi.search_dev_and_profile_orig()
|
||||
end
|
||||
|
||||
function mtkwifi.__setup_vifs(cfgs, devname, mainidx, subidx)
|
||||
local l1dat, l1 = mtkwifi.__get_l1dat()
|
||||
local dridx = l1dat and l1.DEV_RINDEX
|
||||
|
||||
local prefix
|
||||
local main_ifname
|
||||
local vifs = {}
|
||||
local dev_idx = ""
|
||||
|
||||
|
||||
prefix = l1dat and l1dat[dridx][devname].ext_ifname or dbdc_prefix[mainidx][subidx]
|
||||
|
||||
dev_idx = string.match(devname, "(%w+)")
|
||||
|
||||
vifs["__prefix"] = prefix
|
||||
if (cfgs.BssidNum == nil) then
|
||||
mtkwifi.debug("BssidNum configuration value not found.")
|
||||
mtkwifi.debug("debug","BssidNum configuration value not found.")
|
||||
return
|
||||
end
|
||||
|
||||
for j=1,tonumber(cfgs.BssidNum) do
|
||||
vifs[j] = {}
|
||||
vifs[j].vifidx = j -- start from 1
|
||||
dev_idx = string.match(devname, "(%w+)")
|
||||
main_ifname = l1dat and l1dat[dridx][devname].main_ifname or dbdc_prefix[mainidx][subidx].."0"
|
||||
|
||||
mtkwifi.debug("setup_vifs", prefix, dev_idx, mainidx, subidx)
|
||||
|
||||
vifs[j].vifname = j == 1 and main_ifname or prefix..(j-1)
|
||||
if mtkwifi.exists("/sys/class/net/"..vifs[j].vifname) then
|
||||
local flags = tonumber(mtkwifi.read_pipe("cat /sys/class/net/"..vifs[j].vifname.."/flags 2>/dev/null")) or 0
|
||||
vifs[j].state = flags%2 == 1 and "up" or "down"
|
||||
end
|
||||
vifs[j].__ssid = cfgs["SSID"..j]
|
||||
vifs[j].__bssid = mtkwifi.read_pipe("cat /sys/class/net/"..prefix..(j-1).."/address 2>/dev/null") or "?"
|
||||
if dbdc then
|
||||
vifs[j].__channel = mtkwifi.token_get(cfgs.Channel, j, 0)
|
||||
vifs[j].__wirelessmode = mtkwifi.token_get(cfgs.WirelessMode, j, 0)
|
||||
end
|
||||
|
||||
vifs[j].__authmode = mtkwifi.token_get(cfgs.AuthMode, j, "OPEN")
|
||||
vifs[j].__encrypttype = mtkwifi.token_get(cfgs.EncrypType, j, "NONE")
|
||||
vifs[j].__hidessid = mtkwifi.token_get(cfgs.HideSSID, j, 0)
|
||||
vifs[j].__noforwarding = mtkwifi.token_get(cfgs.NoForwarding, j, 0)
|
||||
vifs[j].__wmmcapable = mtkwifi.token_get(cfgs.WmmCapable, j, 0)
|
||||
vifs[j].__txrate = mtkwifi.token_get(cfgs.TxRate, j, 0)
|
||||
vifs[j].__ieee8021x = mtkwifi.token_get(cfgs.IEEE8021X, j, 0)
|
||||
vifs[j].__preauth = mtkwifi.token_get(cfgs.PreAuth, j, 0)
|
||||
vifs[j].__rekeymethod = mtkwifi.token_get(cfgs.RekeyMethod, j, 0)
|
||||
vifs[j].__rekeyinterval = mtkwifi.token_get(cfgs.RekeyInterval, j, 0)
|
||||
vifs[j].__pmkcacheperiod = mtkwifi.token_get(cfgs.PMKCachePeriod, j, 0)
|
||||
vifs[j].__ht_extcha = mtkwifi.token_get(cfgs.HT_EXTCHA, j, 0)
|
||||
vifs[j].__radius_server = mtkwifi.token_get(cfgs.RADIUS_Server, j, 0)
|
||||
vifs[j].__radius_port = mtkwifi.token_get(cfgs.RADIUS_Port, j, 0)
|
||||
vifs[j].__wepkey_id = mtkwifi.token_get(cfgs.DefaultKeyID, j, 0)
|
||||
vifs[j].__wscconfmode = mtkwifi.token_get(cfgs.WscConfMode, j, 0)
|
||||
vifs[j].__wepkeys = {
|
||||
cfgs["Key"..j.."Str1"],
|
||||
cfgs["Key"..j.."Str2"],
|
||||
cfgs["Key"..j.."Str3"],
|
||||
cfgs["Key"..j.."Str4"],
|
||||
}
|
||||
vifs[j].__wpapsk = cfgs["WPAPSK"..j]
|
||||
|
||||
-- VoW
|
||||
vifs[j].__atc_tp = mtkwifi.token_get(cfgs.VOW_Rate_Ctrl_En, j, 0)
|
||||
vifs[j].__atc_min_tp = mtkwifi.token_get(cfgs.VOW_Group_Min_Rate, j, "")
|
||||
vifs[j].__atc_max_tp = mtkwifi.token_get(cfgs.VOW_Group_Max_Rate, j, "")
|
||||
vifs[j].__atc_at = mtkwifi.token_get(cfgs.VOW_Airtime_Ctrl_En, j, 0)
|
||||
vifs[j].__atc_min_at = mtkwifi.token_get(cfgs.VOW_Group_Min_Ratio, j, "")
|
||||
vifs[j].__atc_max_at = mtkwifi.token_get(cfgs.VOW_Group_Max_Ratio, j, "")
|
||||
|
||||
-- TODO index by vifname
|
||||
vifs[vifs[j].vifname] = vifs[j]
|
||||
end
|
||||
|
||||
return vifs
|
||||
end
|
||||
|
||||
function mtkwifi.__setup_apcli(cfgs, devname, mainidx, subidx)
|
||||
local l1dat, l1 = mtkwifi.__get_l1dat()
|
||||
local dridx = l1dat and l1.DEV_RINDEX
|
||||
|
||||
local apcli = {}
|
||||
local dev_idx = string.match(devname, "(%w+)")
|
||||
local apcli_prefix = l1dat and l1dat[dridx][devname].apcli_ifname or
|
||||
dbdc_apcli_prefix[mainidx][subidx]
|
||||
|
||||
local apcli_name = apcli_prefix.."0"
|
||||
|
||||
if mtkwifi.exists("/sys/class/net/"..apcli_name) then
|
||||
apcli.vifname = apcli_name
|
||||
apcli.vifidx = "1"
|
||||
local iwapcli = mtkwifi.read_pipe("iwconfig "..apcli_name.." | grep ESSID 2>/dev/null")
|
||||
|
||||
local _,_,ssid = string.find(iwapcli, "ESSID:\"(.*)\"")
|
||||
local flags = tonumber(mtkwifi.read_pipe("cat /sys/class/net/"..apcli_name.."/flags 2>/dev/null")) or 0
|
||||
apcli.state = flags%2 == 1 and "up" or "down"
|
||||
if not ssid or ssid == "" then
|
||||
apcli.status = "Disconnected"
|
||||
else
|
||||
apcli.ssid = ssid
|
||||
apcli.status = "Connected"
|
||||
end
|
||||
apcli.devname = apcli_name
|
||||
apcli.bssid = mtkwifi.read_pipe("cat /sys/class/net/"..apcli_name.."/address 2>/dev/null") or "?"
|
||||
local flags = tonumber(mtkwifi.read_pipe("cat /sys/class/net/"..apcli_name.."/flags 2>/dev/null")) or 0
|
||||
apcli.ifstatus = flags%2 == 1 and "up" or ""
|
||||
return apcli
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function mtkwifi.get_all_devs()
|
||||
local devs = {}
|
||||
local i = 1 -- dev idx
|
||||
local profiles = mtkwifi.search_dev_and_profile()
|
||||
local wpa_support = 0
|
||||
local wapi_support = 0
|
||||
|
||||
for devname,profile in pairs(profiles) do
|
||||
mtkwifi.debug("debug", "checking "..profile)
|
||||
|
||||
local fd = io.open(profile,"r")
|
||||
if not fd then
|
||||
mtkwifi.debug("debug", "cannot find "..profile)
|
||||
else
|
||||
fd:close()
|
||||
mtkwifi.debug("debug", "load "..profile)
|
||||
mtkwifi.debug("loading profile"..profile)
|
||||
local cfgs = mtkwifi.load_profile(profile)
|
||||
if not cfgs then
|
||||
mtkwifi.debug("error loading profile"..profile)
|
||||
mtkwifi.debug("err", "error loading "..profile)
|
||||
return
|
||||
end
|
||||
devs[i] = {}
|
||||
devs[i].vifs = {}
|
||||
devs[i].apcli = {}
|
||||
devs[i].devname = devname
|
||||
devs[i].profile = profile
|
||||
local tmp = ""
|
||||
tmp = string.split(devname, ".")
|
||||
devs[i].maindev = tmp[1]
|
||||
devs[i].mainidx = tonumber(tmp[2]) or 1
|
||||
devs[i].subdev = devname
|
||||
devs[i].subidx = string.match(tmp[3] or "", "(%d+)")=="2" and 2 or 1
|
||||
devs[i].devband = tonumber(tmp[3])
|
||||
if devs[i].devband then
|
||||
devs[i].multiprofile = true
|
||||
devs[i].dbdc = true
|
||||
end
|
||||
devs[i].version = mtkwifi.read_pipe("cat /etc/wireless/"..devs[i].maindev.."/version 2>/dev/null") or "unknown"
|
||||
devs[i].ApCliEnable = cfgs.ApCliEnable
|
||||
devs[i].WirelessMode = cfgs.WirelessMode
|
||||
devs[i].WirelessModeList = {}
|
||||
for key, value in pairs(DevicePropertyMap) do
|
||||
local found = string.find(string.upper(devname), string.upper(value.device))
|
||||
if found then
|
||||
for k=1,#value.band do
|
||||
devs[i].WirelessModeList[tonumber(value.band[k])] = WirelessModeList[tonumber(value.band[k])]
|
||||
end
|
||||
end
|
||||
end
|
||||
devs[i].WscConfMode = cfgs.WscConfMode
|
||||
devs[i].AuthModeList = AuthModeList
|
||||
devs[i].WpsEnableAuthModeList = WpsEnableAuthModeList
|
||||
|
||||
if wpa_support == 1 then
|
||||
table.insert(devs[i].AuthModeList,"WPAPSK")
|
||||
table.insert(devs[i].AuthModeList,"WPA")
|
||||
end
|
||||
|
||||
if wapi_support == 1 then
|
||||
table.insert(devs[i].AuthModeList,"WAIPSK")
|
||||
table.insert(devs[i].AuthModeList,"WAICERT")
|
||||
end
|
||||
devs[i].ApCliAuthModeList = ApCliAuthModeList
|
||||
devs[i].WPA_Enc_List = WPA_Enc_List
|
||||
devs[i].WEP_Enc_List = WEP_Enc_List
|
||||
devs[i].Channel = tonumber(cfgs.Channel)
|
||||
devs[i].DBDC_MODE = tonumber(cfgs.DBDC_MODE)
|
||||
devs[i].band = devs[i].devband or mtkwifi.band(cfgs.WirelessMode)
|
||||
|
||||
if cfgs.MUTxRxEnable then
|
||||
if tonumber(cfgs.ETxBfEnCond)==1
|
||||
and tonumber(cfgs.MUTxRxEnable)==0
|
||||
and tonumber(cfgs.ITxBfEn)==0
|
||||
then devs[i].__mimo = 0
|
||||
elseif tonumber(cfgs.ETxBfEnCond)==0
|
||||
and tonumber(cfgs.MUTxRxEnable)==0
|
||||
and tonumber(cfgs.ITxBfEn)==1
|
||||
then devs[i].__mimo = 1
|
||||
elseif tonumber(cfgs.ETxBfEnCond)==1
|
||||
and tonumber(cfgs.MUTxRxEnable)==0
|
||||
and tonumber(cfgs.ITxBfEn)==1
|
||||
then devs[i].__mimo = 2
|
||||
elseif tonumber(cfgs.ETxBfEnCond)==1
|
||||
and tonumber(cfgs.MUTxRxEnable)>0
|
||||
and tonumber(cfgs.ITxBfEn)==0
|
||||
then devs[i].__mimo = 3
|
||||
elseif tonumber(cfgs.ETxBfEnCond)==1
|
||||
and tonumber(cfgs.MUTxRxEnable)>0
|
||||
and tonumber(cfgs.ITxBfEn)==1
|
||||
then devs[i].__mimo = 4
|
||||
else devs[i].__mimo = 5
|
||||
end
|
||||
end
|
||||
|
||||
if cfgs.HT_BW == "0" or not cfgs.HT_BW then
|
||||
devs[i].__bw = "20"
|
||||
elseif cfgs.HT_BW == "1" and cfgs.VHT_BW == "0" or not cfgs.VHT_BW then
|
||||
if cfgs.HT_BSSCoexistence == "0" or not cfgs.HT_BSSCoexistence then
|
||||
devs[i].__bw = "40"
|
||||
else
|
||||
devs[i].__bw = "60" -- 20/40 coexist
|
||||
end
|
||||
elseif cfgs.HT_BW == "1" and cfgs.VHT_BW == "1" then
|
||||
devs[i].__bw = "80"
|
||||
elseif cfgs.HT_BW == "1" and cfgs.VHT_BW == "2" then
|
||||
devs[i].__bw = "160"
|
||||
elseif cfgs.HT_BW == "1" and cfgs.VHT_BW == "3" then
|
||||
devs[i].__bw = "161"
|
||||
end
|
||||
|
||||
devs[i].vifs = mtkwifi.__setup_vifs(cfgs, devname, devs[i].mainidx, devs[i].subidx)
|
||||
devs[i].apcli = mtkwifi.__setup_apcli(cfgs, devname, devs[i].mainidx, devs[i].subidx)
|
||||
|
||||
-- Setup reverse indices by devname
|
||||
devs[devname] = devs[i]
|
||||
|
||||
if devs[i].apcli then
|
||||
devs[i][devs[i].apcli.devname] = devs[i].apcli
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
return devs
|
||||
end
|
||||
|
||||
function mtkwifi.exists(path)
|
||||
local fp = io.open(path, "rb")
|
||||
if fp then fp:close() end
|
||||
return fp ~= nil
|
||||
end
|
||||
|
||||
function mtkwifi.parse_mac(str)
|
||||
local macs = {}
|
||||
local pat = "^[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]$"
|
||||
|
||||
local function ismac(str)
|
||||
if str:match(pat) then return str end
|
||||
end
|
||||
|
||||
if not str then return macs end
|
||||
local t = str:split("\n")
|
||||
for _,v in pairs(t) do
|
||||
local mac = ismac(mtkwifi.__trim(v))
|
||||
if mac then
|
||||
table.insert(macs, mac)
|
||||
end
|
||||
end
|
||||
|
||||
return macs
|
||||
-- body
|
||||
end
|
||||
|
||||
|
||||
function mtkwifi.scan_ap(vifname)
|
||||
os.execute("iwpriv "..vifname.." set SiteSurvey=0")
|
||||
os.execute("sleep 10") -- depends on your env
|
||||
local scan_result = mtkwifi.read_pipe("iwpriv "..vifname.." get_site_survey 2>/dev/null")
|
||||
|
||||
local aplist = {}
|
||||
local xx = {}
|
||||
for i, line in ipairs(mtkwifi.__lines(scan_result)) do
|
||||
if #line>40 and string.match(line, " BSSID ") then
|
||||
xx.Ch = {string.find(line, "Ch "),3}
|
||||
xx.SSID = {string.find(line, "SSID "),32}
|
||||
xx.BSSID = {string.find(line, "BSSID "),17}
|
||||
xx.Security = {string.find(line, "Security "),22}
|
||||
xx.Signal = {string.find(line, "Sig%a%al"),4}
|
||||
xx.Mode = {string.find(line, "W-Mode"),5}
|
||||
xx.ExtCh = {string.find(line, "ExtCH"),6}
|
||||
xx.WPS = {string.find(line, "WPS"),3}
|
||||
xx.NT = {string.find(line, "NT"),2}
|
||||
end
|
||||
|
||||
local tmp = {}
|
||||
if #line>40 and not string.match(line, " BSSID ") then
|
||||
tmp = {}
|
||||
tmp.channel = mtkwifi.__trim(string.sub(line, xx.Ch[1], xx.Ch[1]+xx.Ch[2]))
|
||||
tmp.ssid = mtkwifi.__trim(string.sub(line, xx.SSID[1], xx.SSID[1]+xx.SSID[2]))
|
||||
tmp.bssid = string.upper(mtkwifi.__trim(string.sub(line, xx.BSSID[1], xx.BSSID[1]+xx.BSSID[2])))
|
||||
tmp.security = mtkwifi.__trim(string.sub(line, xx.Security[1], xx.Security[1]+xx.Security[2]))
|
||||
tmp.security = string.gsub(tmp.security, "WPA1PSKWPA2PSK", "WPAPSKWPA2PSK")
|
||||
if (string.find(tmp.security, "/") == nil) then
|
||||
tmp.security = "OPEN" .. "/" .. tmp.security
|
||||
end
|
||||
tmp.authmode = mtkwifi.__trim(string.split(tmp.security, "/")[1])
|
||||
tmp.encrypttype = mtkwifi.__trim(string.split(tmp.security, "/")[2] or "NONE")
|
||||
tmp.rssi = mtkwifi.__trim(string.sub(line, xx.Signal[1], xx.Signal[1]+xx.Signal[2]))
|
||||
tmp.extch = mtkwifi.__trim(string.sub(line, xx.ExtCh[1], xx.ExtCh[1]+xx.ExtCh[2]))
|
||||
tmp.mode = mtkwifi.__trim(string.sub(line, xx.Mode[1], xx.Mode[1]+xx.Mode[2]))
|
||||
if (xx.WPS[1] ~= nil and xx.WPS[2] ~= nil) then
|
||||
tmp.wps = mtkwifi.__trim(string.sub(line, xx.WPS[1], xx.WPS[1]+xx.WPS[2]))
|
||||
end
|
||||
tmp.nt = mtkwifi.__trim(string.sub(line, xx.NT[1], xx.NT[1]+xx.NT[2]))
|
||||
table.insert(aplist, tmp)
|
||||
end
|
||||
end
|
||||
|
||||
return aplist
|
||||
end
|
||||
|
||||
function mtkwifi.__any_wsc_enabled(wsc_conf_mode)
|
||||
if (wsc_conf_mode == "") then
|
||||
return 0;
|
||||
end
|
||||
if (wsc_conf_mode == "7") then
|
||||
return 1;
|
||||
end
|
||||
if (wsc_conf_mode == "4") then
|
||||
return 1;
|
||||
end
|
||||
if (wsc_conf_mode == "2") then
|
||||
return 1;
|
||||
end
|
||||
if (wsc_conf_mode == "1") then
|
||||
return 1;
|
||||
end
|
||||
return 0;
|
||||
end
|
||||
|
||||
function mtkwifi.__restart_if_wps(devname, ifname, cfgs)
|
||||
local devs = mtkwifi.get_all_devs()
|
||||
local ssid_index = devs[devname]["vifs"][ifname].vifidx
|
||||
local wsc_conf_mode = ""
|
||||
|
||||
wsc_conf_mode=mtkwifi.token_get(cfgs["WscConfMode"], ssid_index, "")
|
||||
|
||||
os.execute("iwpriv "..ifname.." set WscConfMode=0")
|
||||
mtkwifi.debug("iwpriv "..ifname.." set WscConfMode=0")
|
||||
os.execute("route delete 239.255.255.250")
|
||||
mtkwifi.debug("route delete 239.255.255.250")
|
||||
if(mtkwifi.__any_wsc_enabled(wsc_conf_mode)) then
|
||||
os.execute("iwpriv "..ifname.." set WscConfMode=7")
|
||||
mtkwifi.debug("iwpriv "..ifname.." set WscConfMode=7")
|
||||
os.execute("route add -host 239.255.255.250 dev br0")
|
||||
mtkwifi.debug("route add -host 239.255.255.250 dev br0")
|
||||
end
|
||||
|
||||
-- execute wps_action.lua file to send signal for current interface
|
||||
os.execute("lua wps_action.lua "..ifname)
|
||||
mtkwifi.debug("lua wps_action.lua "..ifname)
|
||||
return cfgs
|
||||
end
|
||||
|
||||
function mtkwifi.restart_8021x(devname, devices)
|
||||
local l1dat, l1 = mtkwifi.__get_l1dat()
|
||||
local dridx = l1dat and l1.DEV_RINDEX
|
||||
|
||||
local devs = devices or mtkwifi.get_all_devs()
|
||||
local dev = devs[devname]
|
||||
local main_ifname = l1dat and l1dat[dridx][devname].main_ifname or dbdc_prefix[mainidx][subidx].."0"
|
||||
local prefix = l1dat and l1dat[dridx][devname].ext_ifname or dbdc_prefix[mainidx][subidx]
|
||||
|
||||
local ps_cmd = "ps | grep -v grep | grep rt2860apd | grep "..main_ifname.." | awk '{print $1}'"
|
||||
local pid_cmd = "cat /var/run/rt2860apd_"..devs[devname].vifs[1].vifname..".pid"
|
||||
local apd_pid = mtkwifi.read_pipe(pid_cmd) or mtkwifi.read_pipe(ps_cmd)
|
||||
if tonumber(apd_pid) then
|
||||
os.execute("kill "..apd_pid)
|
||||
end
|
||||
|
||||
local cfgs = mtkwifi.load_profile(devs[devname].profile)
|
||||
local auth_mode = cfgs['AuthMode']
|
||||
local ieee8021x = cfgs['IEEE8021X']
|
||||
local pat_auth_mode = {"WPA$", "WPA;", "WPA2$", "WPA2;", "WPA1WPA2$", "WPA1WPA2;"}
|
||||
local pat_ieee8021x = {"1$", "1;"}
|
||||
local apd_en = false
|
||||
|
||||
for _, pat in ipairs(pat_auth_mode) do
|
||||
if string.find(auth_mode, pat) then
|
||||
apd_en = true
|
||||
end
|
||||
end
|
||||
|
||||
for _, pat in ipairs(pat_ieee8021x) do
|
||||
if string.find(ieee8021x, pat) then
|
||||
apd_en = true
|
||||
end
|
||||
end
|
||||
|
||||
if not apd_en then
|
||||
return
|
||||
end
|
||||
|
||||
os.execute("rt2860apd -i "..main_ifname.." -p "..prefix)
|
||||
end
|
||||
|
||||
return mtkwifi
|
||||
70
package/kernel/fast-classifier/Makefile
Normal file
70
package/kernel/fast-classifier/Makefile
Normal file
@ -0,0 +1,70 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=fast-classifier
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/fast-classifier
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Support
|
||||
TITLE:=Kernel driver for FAST Classifier
|
||||
FILES:=$(PKG_BUILD_DIR)/fast-classifier.ko
|
||||
KCONFIG:= \
|
||||
CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y \
|
||||
CONFIG_NF_CONNTRACK_MARK=y
|
||||
DEPENDS:=+kmod-ipt-conntrack +kmod-shortcut-fe
|
||||
PROVIDES:=fast-classifier
|
||||
endef
|
||||
|
||||
define KernelPackage/fast-classifier/description
|
||||
FAST Classifier talks to SFE to make decisions about offloading connections
|
||||
endef
|
||||
|
||||
define Package/fast-classifier-example
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Example user space program for fast-classifier
|
||||
DEPENDS:=+kmod-fast-classifier +libnl
|
||||
endef
|
||||
|
||||
define Package/fast-classifier-example/description
|
||||
Example user space program that communicates with fast
|
||||
classifier kernel module.
|
||||
endef
|
||||
|
||||
SFE_MAKE_OPTS:=SFE_SUPPORT_IPV6=y
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" $(strip $(SFE_MAKE_OPTS)) \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
$(PKG_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
CONFIG_FAST_CLASSIFIER=m \
|
||||
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
|
||||
modules
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_fast-classifier-example),)
|
||||
$(TARGET_CC) -o $(PKG_BUILD_DIR)/userspace_fast_classifier \
|
||||
-I $(PKG_BUILD_DIR) \
|
||||
-I$(STAGING_DIR)/usr/include/libnl \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-lnl-genl-3 -lnl-3 \
|
||||
$(PKG_BUILD_DIR)/nl_classifier_test.c
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/fast-classifier.h $(1)/usr/include/
|
||||
endef
|
||||
|
||||
define Package/fast-classifier-example/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/userspace_fast_classifier $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fast-classifier))
|
||||
$(eval $(call BuildPackage,fast-classifier-example))
|
||||
10
package/kernel/fast-classifier/src/Makefile
Normal file
10
package/kernel/fast-classifier/src/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
obj-$(CONFIG_FAST_CLASSIFIER) += fast-classifier.o
|
||||
|
||||
ifeq ($(SFE_SUPPORT_IPV6),)
|
||||
SFE_SUPPORT_IPV6=y
|
||||
endif
|
||||
ccflags-$(SFE_SUPPORT_IPV6) += -DSFE_SUPPORT_IPV6
|
||||
|
||||
ccflags-y += -I$(obj)/../shortcut-fe
|
||||
|
||||
obj ?= .
|
||||
1974
package/kernel/fast-classifier/src/fast-classifier.c
Normal file
1974
package/kernel/fast-classifier/src/fast-classifier.c
Normal file
File diff suppressed because it is too large
Load Diff
57
package/kernel/fast-classifier/src/fast-classifier.h
Normal file
57
package/kernel/fast-classifier/src/fast-classifier.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* User space header to send message to the fast classifier
|
||||
*
|
||||
* Copyright (c) 2013,2016 The Linux Foundation. All rights reserved.
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all copies.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
#define FAST_CLASSIFIER_GENL_VERSION (1)
|
||||
#define FAST_CLASSIFIER_GENL_NAME "FC"
|
||||
#define FAST_CLASSIFIER_GENL_MCGRP "FC_MCGRP"
|
||||
#define FAST_CLASSIFIER_GENL_HDRSIZE (0)
|
||||
|
||||
enum {
|
||||
FAST_CLASSIFIER_A_UNSPEC,
|
||||
FAST_CLASSIFIER_A_TUPLE,
|
||||
__FAST_CLASSIFIER_A_MAX,
|
||||
};
|
||||
|
||||
#define FAST_CLASSIFIER_A_MAX (__FAST_CLASSIFIER_A_MAX - 1)
|
||||
|
||||
enum {
|
||||
FAST_CLASSIFIER_C_UNSPEC,
|
||||
FAST_CLASSIFIER_C_OFFLOAD,
|
||||
FAST_CLASSIFIER_C_OFFLOADED,
|
||||
FAST_CLASSIFIER_C_DONE,
|
||||
__FAST_CLASSIFIER_C_MAX,
|
||||
};
|
||||
|
||||
#define FAST_CLASSIFIER_C_MAX (__FAST_CLASSIFIER_C_MAX - 1)
|
||||
|
||||
struct fast_classifier_tuple {
|
||||
unsigned short ethertype;
|
||||
unsigned char proto;
|
||||
union {
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
} src_saddr;
|
||||
union {
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
} dst_saddr;
|
||||
unsigned short sport;
|
||||
unsigned short dport;
|
||||
unsigned char smac[ETH_ALEN];
|
||||
unsigned char dmac[ETH_ALEN];
|
||||
};
|
||||
281
package/kernel/fast-classifier/src/nl_classifier_test.c
Normal file
281
package/kernel/fast-classifier/src/nl_classifier_test.c
Normal file
@ -0,0 +1,281 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The Linux Foundation. All rights reserved.
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all copies.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <netlink/genl/genl.h>
|
||||
#include <netlink/genl/ctrl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#define NL_CLASSIFIER_GENL_VERSION 1
|
||||
#define NL_CLASSIFIER_GENL_FAMILY "FC"
|
||||
#define NL_CLASSIFIER_GENL_GROUP "FC_MCGRP"
|
||||
#define NL_CLASSIFIER_GENL_HDRSIZE 0
|
||||
|
||||
enum NL_CLASSIFIER_CMD {
|
||||
NL_CLASSIFIER_CMD_UNSPEC,
|
||||
NL_CLASSIFIER_CMD_ACCEL,
|
||||
NL_CLASSIFIER_CMD_ACCEL_OK,
|
||||
NL_CLASSIFIER_CMD_CONNECTION_CLOSED,
|
||||
NL_CLASSIFIER_CMD_MAX,
|
||||
};
|
||||
|
||||
enum NL_CLASSIFIER_ATTR {
|
||||
NL_CLASSIFIER_ATTR_UNSPEC,
|
||||
NL_CLASSIFIER_ATTR_TUPLE,
|
||||
NL_CLASSIFIER_ATTR_MAX,
|
||||
};
|
||||
|
||||
union nl_classifier_tuple_ip {
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
};
|
||||
|
||||
struct nl_classifier_tuple {
|
||||
unsigned short af;
|
||||
unsigned char proto;
|
||||
union nl_classifier_tuple_ip src_ip;
|
||||
union nl_classifier_tuple_ip dst_ip;
|
||||
unsigned short sport;
|
||||
unsigned short dport;
|
||||
unsigned char smac[6];
|
||||
unsigned char dmac[6];
|
||||
};
|
||||
|
||||
struct nl_classifier_instance {
|
||||
struct nl_sock *sock;
|
||||
int family_id;
|
||||
int group_id;
|
||||
int stop;
|
||||
};
|
||||
|
||||
struct nl_classifier_instance nl_cls_inst;
|
||||
|
||||
static struct nla_policy nl_classifier_genl_policy[(NL_CLASSIFIER_ATTR_MAX+1)] = {
|
||||
[NL_CLASSIFIER_ATTR_TUPLE] = { .type = NLA_UNSPEC },
|
||||
};
|
||||
|
||||
void nl_classifier_dump_nl_tuple(struct nl_classifier_tuple *tuple)
|
||||
{
|
||||
char ip_str[64];
|
||||
|
||||
printf("protocol = %s\n", (tuple->proto == IPPROTO_UDP) ? "udp" : ((tuple->proto == IPPROTO_TCP) ? "tcp" : "unknown"));
|
||||
printf("source ip = %s\n", inet_ntop(tuple->af, &tuple->src_ip, ip_str, sizeof(ip_str)));
|
||||
printf("destination ip = %s\n", inet_ntop(tuple->af, &tuple->dst_ip, ip_str, sizeof(ip_str)));
|
||||
printf("source port = %d\n", ntohs(tuple->sport));
|
||||
printf("destination port = %d\n", ntohs(tuple->dport));
|
||||
}
|
||||
|
||||
int nl_classifier_msg_recv(struct nl_msg *msg, void *arg)
|
||||
{
|
||||
struct nlmsghdr *nlh = nlmsg_hdr(msg);
|
||||
struct genlmsghdr *gnlh = nlmsg_data(nlh);
|
||||
struct nlattr *attrs[(NL_CLASSIFIER_ATTR_MAX+1)];
|
||||
|
||||
genlmsg_parse(nlh, NL_CLASSIFIER_GENL_HDRSIZE, attrs, NL_CLASSIFIER_ATTR_MAX, nl_classifier_genl_policy);
|
||||
|
||||
switch (gnlh->cmd) {
|
||||
case NL_CLASSIFIER_CMD_ACCEL_OK:
|
||||
printf("Acceleration successful:\n");
|
||||
nl_classifier_dump_nl_tuple(nla_data(attrs[NL_CLASSIFIER_ATTR_TUPLE]));
|
||||
return NL_OK;
|
||||
case NL_CLASSIFIER_CMD_CONNECTION_CLOSED:
|
||||
printf("Connection is closed:\n");
|
||||
nl_classifier_dump_nl_tuple(nla_data(attrs[NL_CLASSIFIER_ATTR_TUPLE]));
|
||||
return NL_OK;
|
||||
default:
|
||||
printf("nl classifier received unknow message %d\n", gnlh->cmd);
|
||||
}
|
||||
|
||||
return NL_SKIP;
|
||||
}
|
||||
|
||||
void nl_classifier_offload(struct nl_classifier_instance *inst,
|
||||
unsigned char proto, unsigned long *src_saddr,
|
||||
unsigned long *dst_saddr, unsigned short sport,
|
||||
unsigned short dport, int af)
|
||||
{
|
||||
struct nl_msg *msg;
|
||||
int ret;
|
||||
struct nl_classifier_tuple classifier_msg;
|
||||
|
||||
memset(&classifier_msg, 0, sizeof(classifier_msg));
|
||||
classifier_msg.af = af;
|
||||
classifier_msg.proto = proto;
|
||||
memcpy(&classifier_msg.src_ip, src_saddr, (af == AF_INET ? 4 : 16));
|
||||
memcpy(&classifier_msg.dst_ip, dst_saddr, (af == AF_INET ? 4 : 16));
|
||||
classifier_msg.sport = sport;
|
||||
classifier_msg.dport = dport;
|
||||
|
||||
msg = nlmsg_alloc();
|
||||
if (!msg) {
|
||||
printf("Unable to allocate message\n");
|
||||
return;
|
||||
}
|
||||
|
||||
genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, inst->family_id,
|
||||
NL_CLASSIFIER_GENL_HDRSIZE, NLM_F_REQUEST,
|
||||
NL_CLASSIFIER_CMD_ACCEL, NL_CLASSIFIER_GENL_VERSION);
|
||||
nla_put(msg, NL_CLASSIFIER_ATTR_TUPLE, sizeof(classifier_msg), &classifier_msg);
|
||||
|
||||
ret = nl_send_auto(inst->sock, msg);
|
||||
if (ret < 0) {
|
||||
printf("send netlink message failed.\n");
|
||||
nlmsg_free(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
nlmsg_free(msg);
|
||||
printf("nl classifier offload connection successful\n");
|
||||
}
|
||||
|
||||
int nl_classifier_init(struct nl_classifier_instance *inst)
|
||||
{
|
||||
int ret;
|
||||
|
||||
inst->sock = nl_socket_alloc();
|
||||
if (!inst->sock) {
|
||||
printf("Unable to allocation socket.\n");
|
||||
return -1;
|
||||
}
|
||||
genl_connect(inst->sock);
|
||||
|
||||
inst->family_id = genl_ctrl_resolve(inst->sock, NL_CLASSIFIER_GENL_FAMILY);
|
||||
if (inst->family_id < 0) {
|
||||
printf("Unable to resolve family %s\n", NL_CLASSIFIER_GENL_FAMILY);
|
||||
goto init_failed;
|
||||
}
|
||||
|
||||
inst->group_id = genl_ctrl_resolve_grp(inst->sock, NL_CLASSIFIER_GENL_FAMILY, NL_CLASSIFIER_GENL_GROUP);
|
||||
if (inst->group_id < 0) {
|
||||
printf("Unable to resolve mcast group %s\n", NL_CLASSIFIER_GENL_GROUP);
|
||||
goto init_failed;
|
||||
}
|
||||
|
||||
ret = nl_socket_add_membership(inst->sock, inst->group_id);
|
||||
if (ret < 0) {
|
||||
printf("Unable to add membership\n");
|
||||
goto init_failed;
|
||||
}
|
||||
|
||||
nl_socket_disable_seq_check(inst->sock);
|
||||
nl_socket_modify_cb(inst->sock, NL_CB_VALID, NL_CB_CUSTOM, nl_classifier_msg_recv, NULL);
|
||||
|
||||
printf("nl classifier init successful\n");
|
||||
return 0;
|
||||
|
||||
init_failed:
|
||||
if (inst->sock) {
|
||||
nl_close(inst->sock);
|
||||
nl_socket_free(inst->sock);
|
||||
inst->sock = NULL;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void nl_classifier_exit(struct nl_classifier_instance *inst)
|
||||
{
|
||||
if (inst->sock) {
|
||||
nl_close(inst->sock);
|
||||
nl_socket_free(inst->sock);
|
||||
inst->sock = NULL;
|
||||
}
|
||||
printf("nl classifier exit successful\n");
|
||||
}
|
||||
|
||||
int nl_classifier_parse_arg(int argc, char *argv[], unsigned char *proto, unsigned long *src_saddr,
|
||||
unsigned long *dst_saddr, unsigned short *sport, unsigned short *dport, int *af)
|
||||
{
|
||||
int ret;
|
||||
unsigned short port;
|
||||
|
||||
if (argc < 7) {
|
||||
printf("help: nl_classifier <v4|v6> <udp|tcp> <source ip> <destination ip> <source port> <destination port>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (0 == strncmp(argv[1], "v4", 2)) {
|
||||
*af = AF_INET;
|
||||
} else if (0 == strncmp(argv[1], "v6", 2)) {
|
||||
*af = AF_INET6;
|
||||
} else {
|
||||
printf("Address family is not supported");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (0 == strncmp(argv[2], "udp", 3)) {
|
||||
*proto = IPPROTO_UDP;
|
||||
} else if (0 == strncmp(argv[2], "tcp", 3)) {
|
||||
*proto = IPPROTO_TCP;
|
||||
} else {
|
||||
printf("Protocol is not supported");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = inet_pton(*af, argv[3], src_saddr);
|
||||
if (ret <= 0) {
|
||||
printf("source ip has wrong format\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = inet_pton(*af, argv[4], dst_saddr);
|
||||
if (ret <= 0) {
|
||||
printf("destination ip has wrong format\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
port = strtol(argv[5], NULL, 0);
|
||||
*sport = htons(port);
|
||||
port = strtol(argv[6], NULL, 0);
|
||||
*dport = htons(port);
|
||||
|
||||
printf("nl classifier parse arguments successful\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct nl_classifier_instance *inst = &nl_cls_inst;
|
||||
unsigned char proto;
|
||||
unsigned long src_addr[4];
|
||||
unsigned long dst_addr[4];
|
||||
unsigned short sport;
|
||||
unsigned short dport;
|
||||
int af;
|
||||
int ret;
|
||||
|
||||
ret = nl_classifier_parse_arg(argc, argv, &proto, src_addr, dst_addr, &sport, &dport, &af);
|
||||
if (ret < 0) {
|
||||
printf("Failed to parse arguments\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = nl_classifier_init(inst);
|
||||
if (ret < 0) {
|
||||
printf("Unable to init generic netlink\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
nl_classifier_offload(inst, proto, src_addr, dst_addr, sport, dport, af);
|
||||
|
||||
/* main loop to listen on message */
|
||||
while (!inst->stop) {
|
||||
nl_recvmsgs_default(inst->sock);
|
||||
}
|
||||
|
||||
nl_classifier_exit(inst);
|
||||
|
||||
return 0;
|
||||
}
|
||||
232
package/kernel/fast-classifier/src/userspace_example.c
Normal file
232
package/kernel/fast-classifier/src/userspace_example.c
Normal file
@ -0,0 +1,232 @@
|
||||
/*
|
||||
* Copyright (c) 2013,2016 The Linux Foundation. All rights reserved.
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
* above copyright notice and this permission notice appear in all copies.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <netlink/genl/genl.h>
|
||||
#include <netlink/genl/ctrl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <fast-classifier.h>
|
||||
|
||||
static struct nl_sock *sock;
|
||||
static struct nl_sock *sock_event;
|
||||
static int family;
|
||||
static int grp_id;
|
||||
|
||||
static struct nla_policy fast_classifier_genl_policy[FAST_CLASSIFIER_A_MAX + 1] = {
|
||||
[FAST_CLASSIFIER_A_TUPLE] = { .type = NLA_UNSPEC },
|
||||
};
|
||||
|
||||
void dump_fc_tuple(struct fast_classifier_tuple *fc_msg)
|
||||
{
|
||||
char src_str[INET_ADDRSTRLEN];
|
||||
char dst_str[INET_ADDRSTRLEN];
|
||||
|
||||
printf("TUPLE: %d, %s, %s, %d, %d"
|
||||
" SMAC=%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
" DMAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
fc_msg->proto,
|
||||
inet_ntop(AF_INET,
|
||||
&fc_msg->src_saddr.in.s_addr,
|
||||
src_str,
|
||||
INET_ADDRSTRLEN),
|
||||
inet_ntop(AF_INET,
|
||||
&fc_msg->dst_saddr.in.s_addr,
|
||||
dst_str,
|
||||
INET_ADDRSTRLEN),
|
||||
fc_msg->sport, fc_msg->dport,
|
||||
fc_msg->smac[0], fc_msg->smac[1], fc_msg->smac[2],
|
||||
fc_msg->smac[3], fc_msg->smac[4], fc_msg->smac[5],
|
||||
fc_msg->dmac[0], fc_msg->dmac[1], fc_msg->dmac[2],
|
||||
fc_msg->dmac[3], fc_msg->dmac[4], fc_msg->dmac[5]);
|
||||
}
|
||||
|
||||
static int parse_cb(struct nl_msg *msg, void *arg)
|
||||
{
|
||||
struct nlmsghdr *nlh = nlmsg_hdr(msg);
|
||||
struct genlmsghdr *gnlh = nlmsg_data(nlh);
|
||||
struct nlattr *attrs[FAST_CLASSIFIER_A_MAX];
|
||||
|
||||
genlmsg_parse(nlh, 0, attrs, FAST_CLASSIFIER_A_MAX, fast_classifier_genl_policy);
|
||||
|
||||
switch (gnlh->cmd) {
|
||||
case FAST_CLASSIFIER_C_OFFLOADED:
|
||||
printf("Got a offloaded message\n");
|
||||
dump_fc_tuple(nla_data(attrs[FAST_CLASSIFIER_A_TUPLE]));
|
||||
return NL_OK;
|
||||
case FAST_CLASSIFIER_C_DONE:
|
||||
printf("Got a done message\n");
|
||||
dump_fc_tuple(nla_data(attrs[FAST_CLASSIFIER_A_TUPLE]));
|
||||
return NL_OK;
|
||||
}
|
||||
|
||||
return NL_SKIP;
|
||||
}
|
||||
|
||||
int fast_classifier_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
sock = nl_socket_alloc();
|
||||
if (!sock) {
|
||||
printf("Unable to allocation socket.\n");
|
||||
return -1;
|
||||
}
|
||||
genl_connect(sock);
|
||||
|
||||
sock_event = nl_socket_alloc();
|
||||
if (!sock_event) {
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock);
|
||||
printf("Unable to allocation socket.\n");
|
||||
return -1;
|
||||
}
|
||||
genl_connect(sock_event);
|
||||
|
||||
family = genl_ctrl_resolve(sock, FAST_CLASSIFIER_GENL_NAME);
|
||||
if (family < 0) {
|
||||
nl_close(sock_event);
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock);
|
||||
nl_socket_free(sock_event);
|
||||
printf("Unable to resolve family\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
grp_id = genl_ctrl_resolve_grp(sock, FAST_CLASSIFIER_GENL_NAME,
|
||||
FAST_CLASSIFIER_GENL_MCGRP);
|
||||
if (grp_id < 0) {
|
||||
printf("Unable to resolve mcast group\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = nl_socket_add_membership(sock_event, grp_id);
|
||||
if (err < 0) {
|
||||
printf("Unable to add membership\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
nl_socket_disable_seq_check(sock_event);
|
||||
nl_socket_modify_cb(sock_event, NL_CB_VALID, NL_CB_CUSTOM, parse_cb, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fast_classifier_close(void)
|
||||
{
|
||||
nl_close(sock_event);
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock_event);
|
||||
nl_socket_free(sock);
|
||||
}
|
||||
|
||||
void fast_classifier_ipv4_offload(unsigned char proto, unsigned long src_saddr,
|
||||
unsigned long dst_saddr, unsigned short sport,
|
||||
unsigned short dport)
|
||||
{
|
||||
struct nl_msg *msg;
|
||||
int ret;
|
||||
#ifdef DEBUG
|
||||
char src_str[INET_ADDRSTRLEN];
|
||||
char dst_str[INET_ADDRSTRLEN];
|
||||
#endif
|
||||
struct fast_classifier_tuple fc_msg;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("DEBUG: would offload: %d, %s, %s, %d, %d\n", proto,
|
||||
inet_ntop(AF_INET, &src_saddr, src_str, INET_ADDRSTRLEN),
|
||||
inet_ntop(AF_INET, &dst_saddr, dst_str, INET_ADDRSTRLEN),
|
||||
sport, dport);
|
||||
#endif
|
||||
|
||||
fc_msg.proto = proto;
|
||||
fc_msg.src_saddr.in.s_addr = src_saddr;
|
||||
fc_msg.dst_saddr.in.s_addr = dst_saddr;
|
||||
fc_msg.sport = sport;
|
||||
fc_msg.dport = dport;
|
||||
fc_msg.smac[0] = 'a';
|
||||
fc_msg.smac[1] = 'b';
|
||||
fc_msg.smac[2] = 'c';
|
||||
fc_msg.smac[3] = 'd';
|
||||
fc_msg.smac[4] = 'e';
|
||||
fc_msg.smac[5] = 'f';
|
||||
fc_msg.dmac[0] = 'f';
|
||||
fc_msg.dmac[1] = 'e';
|
||||
fc_msg.dmac[2] = 'd';
|
||||
fc_msg.dmac[3] = 'c';
|
||||
fc_msg.dmac[4] = 'b';
|
||||
fc_msg.dmac[5] = 'a';
|
||||
|
||||
if (fast_classifier_init() < 0) {
|
||||
printf("Unable to init generic netlink\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
msg = nlmsg_alloc();
|
||||
if (!msg) {
|
||||
nl_socket_free(sock);
|
||||
printf("Unable to allocate message\n");
|
||||
return;
|
||||
}
|
||||
|
||||
genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family,
|
||||
FAST_CLASSIFIER_GENL_HDRSIZE, NLM_F_REQUEST,
|
||||
FAST_CLASSIFIER_C_OFFLOAD, FAST_CLASSIFIER_GENL_VERSION);
|
||||
nla_put(msg, 1, sizeof(fc_msg), &fc_msg);
|
||||
|
||||
ret = nl_send_auto_complete(sock, msg);
|
||||
|
||||
nlmsg_free(msg);
|
||||
if (ret < 0) {
|
||||
printf("nlmsg_free failed");
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = nl_wait_for_ack(sock);
|
||||
if (ret < 0) {
|
||||
printf("wait for ack failed");
|
||||
nl_close(sock);
|
||||
nl_socket_free(sock);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void fast_classifier_listen_for_messages(void)
|
||||
{
|
||||
printf("waiting for netlink events\n");
|
||||
|
||||
while (1) {
|
||||
nl_recvmsgs_default(sock_event);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (fast_classifier_init() < 0) {
|
||||
printf("Unable to init generic netlink\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fast_classifier_ipv4_offload('a', 0, 0, 0, 0);
|
||||
|
||||
/* this never returns */
|
||||
fast_classifier_listen_for_messages();
|
||||
|
||||
fast_classifier_close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
66
package/kernel/fullconenat/Makefile
Normal file
66
package/kernel/fullconenat/Makefile
Normal file
@ -0,0 +1,66 @@
|
||||
#
|
||||
# Copyright (C) 2018 Chion Tang <tech@chionlab.moe>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=fullconenat
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/Chion82/netfilter-full-cone-nat.git
|
||||
PKG_SOURCE_DATE:=2019-10-21
|
||||
PKG_SOURCE_VERSION:=0cf3b48fd7d2fa81d0297d1fff12bbd0580fc435
|
||||
PKG_MIRROR_HASH:=e7bb77d9916d190b3c02975faf62d1794557d4a4a774cd0cf1f3a6ddb7403e3e
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/iptables-mod-fullconenat
|
||||
SUBMENU:=Firewall
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=FULLCONENAT iptables extension
|
||||
DEPENDS:=+iptables +kmod-ipt-fullconenat
|
||||
MAINTAINER:=Chion Tang <tech@chionlab.moe>
|
||||
endef
|
||||
|
||||
define Package/iptables-mod-fullconenat/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/iptables
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libipt_FULLCONENAT.so $(1)/usr/lib/iptables
|
||||
endef
|
||||
|
||||
define KernelPackage/ipt-fullconenat
|
||||
SUBMENU:=Netfilter Extensions
|
||||
TITLE:=FULLCONENAT netfilter module
|
||||
DEPENDS:=+kmod-nf-ipt +kmod-nf-nat
|
||||
MAINTAINER:=Chion Tang <tech@chionlab.moe>
|
||||
KCONFIG:=CONFIG_NF_CONNTRACK_EVENTS=y CONFIG_NF_CONNTRACK_CHAIN_EVENTS=y
|
||||
FILES:=$(PKG_BUILD_DIR)/xt_FULLCONENAT.ko
|
||||
endef
|
||||
|
||||
include $(INCLUDE_DIR)/kernel-defaults.mk
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(CP) ./files/Makefile $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
EXTRA_CFLAGS="$(BUILDFLAGS)" \
|
||||
modules
|
||||
$(call Build/Compile/Default)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,iptables-mod-fullconenat))
|
||||
$(eval $(call KernelPackage,ipt-fullconenat))
|
||||
7
package/kernel/fullconenat/files/Makefile
Normal file
7
package/kernel/fullconenat/files/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
libipt_FULLCONENAT.so: libipt_FULLCONENAT.o
|
||||
$(CC) -shared -lxtables -o $@ $^;
|
||||
libipt_FULLCONENAT.o: libipt_FULLCONENAT.c
|
||||
$(CC) ${CFLAGS} -fPIC -D_INIT=$*_init -c -o $@ $<;
|
||||
|
||||
obj-m += xt_FULLCONENAT.o
|
||||
|
||||
17
package/kernel/fullconenat/patches/000-printk.patch
Normal file
17
package/kernel/fullconenat/patches/000-printk.patch
Normal file
@ -0,0 +1,17 @@
|
||||
diff --git a/xt_FULLCONENAT.c b/xt_FULLCONENAT.c
|
||||
index 9e52eba..8658c5f 100644
|
||||
--- a/xt_FULLCONENAT.c
|
||||
+++ b/xt_FULLCONENAT.c
|
||||
@@ -697,9 +697,11 @@ static struct xt_target tg_reg[] __read_mostly = {
|
||||
|
||||
static int __init fullconenat_tg_init(void)
|
||||
{
|
||||
+ printk(KERN_INFO "xt_FULLCONENAT: RFC3489 Full Cone NAT module\n"
|
||||
+ "xt_FULLCONENAT: Copyright (C) 2018 Chion Tang <tech@chionlab.moe>\n");
|
||||
wq = create_singlethread_workqueue("xt_FULLCONENAT");
|
||||
if (wq == NULL) {
|
||||
- printk("xt_FULLCONENAT: warning: failed to create workqueue\n");
|
||||
+ printk(KERN_WARNING "xt_FULLCONENAT: warning: failed to create workqueue\n");
|
||||
}
|
||||
|
||||
return xt_register_targets(tg_reg, ARRAY_SIZE(tg_reg));
|
||||
62
package/kernel/mt-drivers/mt7603e/Makefile
Normal file
62
package/kernel/mt-drivers/mt7603e/Makefile
Normal file
@ -0,0 +1,62 @@
|
||||
# All rights reserved.
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=mt7603e
|
||||
P4REV:=2
|
||||
PKG_VERSION:=4.1.2.0
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/mt7603_wifi
|
||||
PKG_KCONFIG:= \
|
||||
RALINK_MT7620 RALINK_RT7621 RLT_WIFI MT_WIFI_PATH FIRST_IF_MT7603E\
|
||||
FIRST_IF_EEPROM_PROM FIRST_IF_EEPROM_EFUSE FIRST_IF_EEPROM_FLASH RT_FIRST_CARD_EEPROM WIFI_BASIC_FUNC\
|
||||
MULTI_INF_SUPPORT WSC_INCLUDED WSC_V2_SUPPORT DOT11N_DRAFT3 DOT11_VHT_AC DOT11W_PMF_SUPPORT\
|
||||
TXBF_SUPPORT WMM_ACM_SUPPORT QOS_DLS_SUPPORT WAPI_SUPPORT CARRIER_DETECTION_SUPPORT\
|
||||
IGMP_SNOOP_SUPPORT BLOCK_NET_IF RATE_ADAPTION NEW_RATE_ADAPT_SUPPORT AGS_SUPPORT\
|
||||
IDS_SUPPORT WIFI_WORK_QUEUE WIFI_SKB_RECYCLE RTMP_FLASH_SUPPORT LED_CONTROL_SUPPORT\
|
||||
SINGLE_SKU_V2 HW_ANTENNA_DIVERSITY ATE_SUPPORT RT2860V2_AP_V24_DATA_STRUCTURE RT2860V2_AP_32B_DESC\
|
||||
MEMORY_OPTIMIZATION HOTSPOT HOTSPOT_R2 ACL_V2_SUPPORT UAPSD PA_LNA RLT_BBP RLT_RF RTMP_BBP RTMP_RF RLT_MAC RLT_BBP RLT_RF RTMP_MAC RTMP_BBP RTMP_RF \
|
||||
RTMP_PCI_SUPPORT RTMP_USB_SUPPORT RTMP_RBUS_SUPPORT RLT_AP_SUPPORT RALINK_MT7603E MT_MAC AP_SUPPORT\
|
||||
WDS_SUPPORT MBSS_SUPPORT NEW_MBSSID_MODE ENHANCE_NEW_MBSSID_MODE APCLI_SUPPORT MULTI_APCLI_SUPPORT \
|
||||
AIRPLAY_SUPPORT MAC_REPEATER_SUPPORT DFS_SUPPORT NINTENDO_AP DOT11K_RRM_SUPPORT RT2860V2_SNMP\
|
||||
LLTD_SUPPORT NINTENDO_AP COC_SUPPORT MULTI_CORE_SUPPORT MCAST_RATE_SPECIFIC PREVENT_ARP_SPOOFING_SUPPORT \
|
||||
EXT_BUILD_CHANNEL_LIST AUTO_CH_SELECT_ENHANCE MEMORY_OPTIMIZATION RTMP_TEMPERATURE_CALIBRATION\
|
||||
SNIFFER_SUPPORT CFG80211_SUPPORT SNIFFER_MIB_CMD ALL_NET_EVENT
|
||||
|
||||
|
||||
PKG_CONFIG_DEPENDS:=$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_$c),CONFIG_$(c)))
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS)
|
||||
|
||||
define KernelPackage/mt7603e
|
||||
CATEGORY:=Kernel modules
|
||||
TITLE:=MTK wifi AP driver
|
||||
DEPENDS:=@TARGET_ramips
|
||||
FILES:=$(PKG_BUILD_DIR)/mt7603_wifi_ap/mt7603e.ko
|
||||
SUBMENU:=Wireless Drivers
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define KernelPackage/mt7603e/config
|
||||
source "$(SOURCE)/config.in"
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(LINUX_DIR)" V=1 \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
M="$(PKG_BUILD_DIR)/mt7603_wifi_ap" \
|
||||
$(foreach c, $(PKG_KCONFIG),$(if $(CONFIG_MT7603E_$c),CONFIG_$(c)=$(CONFIG_MT7603E_$(c)))) \
|
||||
modules
|
||||
endef
|
||||
|
||||
define KernelPackage/mt7603e/install
|
||||
$(INSTALL_DIR) $(1)/etc/wireless/mt7603/
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,mt7603e))
|
||||
523
package/kernel/mt-drivers/mt7603e/config.in
Normal file
523
package/kernel/mt-drivers/mt7603e/config.in
Normal file
@ -0,0 +1,523 @@
|
||||
if PACKAGE_kmod-mt7603e
|
||||
|
||||
#if FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
config MT7603E_FIRST_IF_MT7603E
|
||||
bool
|
||||
default y
|
||||
depends on PACKAGE_kmod-mt7603e
|
||||
|
||||
config MT7603E_RLT_WIFI
|
||||
tristate "MT WIFI Driver"
|
||||
default y
|
||||
|
||||
config MT7603E_MT_WIFI_PATH
|
||||
string
|
||||
depends on MT7603E_RLT_WIFI
|
||||
default "rlt_wifi"
|
||||
|
||||
if MT7603E_RLT_WIFI
|
||||
menu "WiFi Generic Feature Options"
|
||||
|
||||
if MT7603E_FIRST_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 1st Card"
|
||||
default MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
#depends on ! FIRST_IF_NONE
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
endchoice
|
||||
|
||||
config MT7603E_RT_FIRST_CARD_EEPROM
|
||||
string
|
||||
#depends on ! FIRST_IF_NONE
|
||||
default "prom" if MT7603E_FIRST_IF_EEPROM_PROM
|
||||
default "efuse" if MT7603E_FIRST_IF_EEPROM_EFUSE
|
||||
default "flash" if MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
endif
|
||||
|
||||
config MT7603E_MULTI_INF_SUPPORT
|
||||
bool
|
||||
#default y if !FIRST_IF_NONE && !SECOND_IF_NONE
|
||||
default y
|
||||
|
||||
#config MT7603E_WIFI_BASIC_FUNC
|
||||
# bool "Basic Functions"
|
||||
# select WIRELESS_EXT
|
||||
# select WEXT_SPY
|
||||
# select WEXT_PRIV
|
||||
|
||||
config MT7603E_WSC_INCLUDED
|
||||
bool "WSC (WiFi Simple Config)"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_WSC_V2_SUPPORT
|
||||
bool "WSC V2(WiFi Simple Config Version 2.0)"
|
||||
depends on MT7603E_MMT_WSC_INCLUDED
|
||||
default y
|
||||
config MT7603E_WSC_NFC_SUPPORT
|
||||
bool "WSC out-of-band(NFC)"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
config MT7603E_DOT11N_DRAFT3
|
||||
bool "802.11n Draft3"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
#config MT7603E_DOT11_VHT_AC
|
||||
# bool "802.11 ac"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_DOT11W_PMF_SUPPORT
|
||||
bool "PMF Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_TXBF_SUPPORT
|
||||
bool "Tx Bean Forming Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_WMM_ACM_SUPPORT
|
||||
# bool "WMM ACM"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_LLTD_SUPPORT
|
||||
bool "LLTD (Link Layer Topology Discovery Protocol)"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_QOS_DLS_SUPPORT
|
||||
bool "802.11e DLS ((Direct-Link Setup) Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WAPI_SUPPORT
|
||||
bool "WAPI Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_CARRIER_DETECTION_SUPPORT
|
||||
bool "Carrier Detect"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_IGMP_SNOOP_SUPPORT
|
||||
bool "IGMP Snooping"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_BLOCK_NET_IF
|
||||
bool "NETIF Block"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
help
|
||||
Support Net interface block while Tx-Sw queue full
|
||||
|
||||
#config MT7603E_MT_TXBF_SUPPORT
|
||||
# bool "Tx Bean Forming Support (Only 3883)"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT2883 || RALINK_RT3883
|
||||
# default n
|
||||
|
||||
#config MT7603E_MT_VIDEO_TURBINE_SUPPORT
|
||||
# bool "Video Turbine support"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_RATE_ADAPTION
|
||||
# tristate "Ralink Flow Classifier"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_NEW_RATE_ADAPT_SUPPORT
|
||||
bool "New Rate Adaptation support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_MT_NEW_RATE_ADAPT_SUPPORT
|
||||
bool "Intelligent Rate Adaption"
|
||||
# depends on WIFI_DRIVER && MT_RATE_ADAPTION
|
||||
default y
|
||||
|
||||
config MT7603E_AGS_SUPPORT
|
||||
bool "Adaptive Group Switching"
|
||||
depends on MT7603E_MT_RATE_ADAPTION
|
||||
default n
|
||||
|
||||
config MT7603E_IDS_SUPPORT
|
||||
bool "IDS (Intrusion Detection System) Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_WORK_QUEUE
|
||||
bool "Work Queue"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_SKB_RECYCLE
|
||||
bool "SKB Recycle(Linux)"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_FLASH_SUPPORT
|
||||
bool "Flash Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_LED_CONTROL_SUPPORT
|
||||
bool "LED Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_SINGLE_SKU
|
||||
bool "Single SKU"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_SINGLE_SKU_V2
|
||||
bool "Single SKU V2"
|
||||
depends on MT7603E_SINGLE_SKU && RALINK_RT6352
|
||||
default n
|
||||
|
||||
config MT7603E_HW_ANTENNA_DIVERSITY
|
||||
bool "Antenna Diversity Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT || MT7603E_RLT_STA_SUPPORT
|
||||
depends on RALINK_RT5350
|
||||
default n
|
||||
|
||||
config MT7603E_ATE_SUPPORT
|
||||
bool "ATE/QA Support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_RT2860V2_AP_V24_DATA_STRUCTURE
|
||||
bool
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_RT2860V2_AP_32B_DESC
|
||||
bool "32 Byte Descriptor Support"
|
||||
# depends on WIFI_DRIVER
|
||||
depends on RALINK_RT6352 || RALINK_MT7620
|
||||
default n
|
||||
|
||||
config MT7603E_MEMORY_OPTIMIZATION
|
||||
bool "Memory Optimization"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_RTMP_INTERNAL_TX_ALC
|
||||
# bool "TSSI Compensation"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352
|
||||
# default n
|
||||
|
||||
#config MT7603E_RTMP_TEMPERATURE_CALIBRATION
|
||||
# bool "Temperature Calibration"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT6352
|
||||
# default n
|
||||
|
||||
config MT7603E_HOTSPOT
|
||||
bool "Passpoint-R1"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_MT_HOTSPOT_R2
|
||||
bool "Passpoint Release-2 Support"
|
||||
depends on HOTSPOT
|
||||
select MT7603E_MT_DOT11W_PMF_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_MT_RTMP_TEMPERATURE_TX_ALC
|
||||
bool "Temperature Tx Power Compensation"
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_UAPSD
|
||||
bool "UAPSD support"
|
||||
# depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
|
||||
#
|
||||
# Section for chip architectures
|
||||
#
|
||||
# "RLT MAC Support"
|
||||
config MT7603E_RLT_MAC
|
||||
bool
|
||||
# depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RLT_BBP
|
||||
bool
|
||||
|
||||
config MT7603E_RLT_RF
|
||||
bool
|
||||
|
||||
# "RTMP MAC Support"
|
||||
config MT7603E_RTMP_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_BBP
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_RF
|
||||
bool
|
||||
|
||||
#config MT7603E_MT_EPA_ELNA
|
||||
# bool "ePAeLNA"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
#choice
|
||||
# prompt "PA,LNA Type"
|
||||
# depends on MT7603E_MT_WIFI
|
||||
#
|
||||
# config MT7603E_MT_IPA_ILNA
|
||||
# bool "iPAiLNA"
|
||||
#
|
||||
# config MT7603E_MT_IPA_ELNA
|
||||
# bool "iPAeLNA"
|
||||
#
|
||||
# config MT7603E_MT_EPA_ILNA
|
||||
# bool "ePAiLNA"
|
||||
#
|
||||
# config MT7603E_MT_EPA_ELNA
|
||||
# bool "ePAeLNA"
|
||||
#endchoice
|
||||
#
|
||||
#config MT7603E_MT_PA_LNA
|
||||
# string
|
||||
# depends on MT7603E_MT_WIFI
|
||||
# default "iPAiLNA" if MT7603E_MT_IPA_ILNA
|
||||
# default "iPAeLNA" if MT7603E_MT_IPA_ELNA
|
||||
# default "ePAiLNA" if MT7603E_MT_EPA_ILNA
|
||||
# default "ePAeLNA" if MT7603E_MT_EPA_ELNA
|
||||
#
|
||||
#
|
||||
# Section for chip architectures
|
||||
#
|
||||
# "RLT MAC Support"
|
||||
#config MT7603E_RLT_MAC
|
||||
# bool
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_RLT_BBP
|
||||
# bool
|
||||
|
||||
#config MT7603E_RLT_RF
|
||||
# bool
|
||||
|
||||
# "RTMP MAC Support"
|
||||
#config MT7603E_RTMP_MAC
|
||||
# bool
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_RTMP_BBP
|
||||
# bool
|
||||
|
||||
#config MT7603E_RTMP_RF
|
||||
# bool
|
||||
|
||||
#
|
||||
# Section for interfaces
|
||||
#
|
||||
config MT7603E_RTMP_PCI_SUPPORT
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_USB_SUPPORT
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_RBUS_SUPPORT
|
||||
bool
|
||||
|
||||
endmenu
|
||||
|
||||
menu "WiFi Operation Modes"
|
||||
choice
|
||||
prompt "Main Mode"
|
||||
default MT7603E_MT_WIFI_MODE_AP
|
||||
|
||||
config MT7603E_MT_WIFI_MODE_AP
|
||||
bool "AP"
|
||||
|
||||
config MT7603E_MT_WIFI_MODE_STA
|
||||
bool "STA"
|
||||
|
||||
config MT7603E_MT_WIFI_MODE_BOTH
|
||||
bool "APSTA"
|
||||
endchoice
|
||||
|
||||
if MT7603E_MT_WIFI_MODE_AP || MT7603E_MT_WIFI_MODE_BOTH
|
||||
|
||||
config MT7603E_RLT_AP_SUPPORT
|
||||
tristate "UnifyMAC 802.11n AP support"
|
||||
default y
|
||||
# depends on NET_RADIO
|
||||
select WIRELESS_EXT
|
||||
select WEXT_SPY
|
||||
select WEXT_PRIV
|
||||
|
||||
config MT7603E_WDS_SUPPORT
|
||||
bool "WDS"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_MBSS_SUPPORT
|
||||
bool "MBSSID"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default y
|
||||
|
||||
config MT7603E_NEW_MBSSID_MODE
|
||||
bool "New MBSSID MODE"
|
||||
depends on MT7603E_RLT_AP_SUPPORT && MT7603E_MBSS_SUPPORT
|
||||
# depends on RALINK_RT3883 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352 || RALINK_MT7620 || RALINK_MT7621
|
||||
default n
|
||||
|
||||
config MT7603E_ENHANCE_NEW_MBSSID_MODE
|
||||
bool "Enhanced MBSSID mode"
|
||||
depends on MT7603E_NEW_MBSSID_MODE
|
||||
default n
|
||||
config MT7603E_CFG80211_SUPPORT
|
||||
bool "CFG80211"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_SNIFFER_MIB_CMD
|
||||
bool "SNIFFER_MIB_CMD"
|
||||
depends on MT7603E_SNIFFER_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_ALL_NET_EVENT
|
||||
bool "ALL_NET_EVENT"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_ACL_V2_SUPPORT
|
||||
bool "ACL_V2"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
|
||||
config MT7603E_APCLI_SUPPORT
|
||||
bool "AP-Client Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default y
|
||||
config MT7603E_MULTI_APCLI_SUPPORT
|
||||
bool "MULTI AP-Client Support"
|
||||
depends on MT7603E_APCLI_SUPPORT
|
||||
default y
|
||||
config MT7603E_MAC_REPEATER_SUPPORT
|
||||
bool "MAC Repeater Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
depends on MT7603E_APCLI_SUPPORT
|
||||
depends on RALINK_RT6352 || RALINK_MT7620 || MT7603E_RALINK_MT7603E
|
||||
default y
|
||||
config MT7603E_AIRPLAY_SUPPORT
|
||||
bool "AirPlay Support"
|
||||
depends on MT7603E_APCLI_SUPPORT
|
||||
|
||||
#config MT7603E_MT_MESH_SUPPORT
|
||||
# bool "MESH Support"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_DFS_SUPPORT
|
||||
bool "DFS"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
select RALINK_TIMER_DFS
|
||||
|
||||
#config MT7603E_DOT11R_FT_SUPPORT
|
||||
# bool "802.11r Fast BSS Transition"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
#config MT7603E_DOT11K_RRM_SUPPORT
|
||||
# bool "802.11k Radio Resource Management"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_LLTD_SUPPORT
|
||||
bool "LLTD (Link Layer Topology Discovery Protocol)"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default y
|
||||
|
||||
config MT7603E_NINTENDO_AP
|
||||
bool "Nintendo AP"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_COC_SUPPORT
|
||||
bool "CoC Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
default n
|
||||
|
||||
#config MT7603E_ RT2860V2_SNMP
|
||||
# bool "Net-SNMP Support"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_MCAST_RATE_SPECIFIC
|
||||
bool "User specific tx rate of mcast pkt"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
config MT7603E_PREVENT_ARP_SPOOFING_SUPPORT
|
||||
bool "Detect ARP spoof pkts attack"
|
||||
depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
#config MT7603E_EXT_BUILD_CHANNEL_LIST
|
||||
# bool "Extension Channel List"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
#config MT7603E_AUTO_CH_SELECT_ENHANCE
|
||||
# bool "Auto Channel Selection Enhancement"
|
||||
# depends on MT7603E_RLT_AP_SUPPORT
|
||||
|
||||
config MT7603E_MULTI_CORE_SUPPORT
|
||||
bool "multi core support"
|
||||
depends on TARGET_ramips_mt7621
|
||||
default n
|
||||
|
||||
endif
|
||||
|
||||
source "./src/mt7603_wifi_ap/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
#"MT7603E"
|
||||
config MT7603E_RALINK_MT7603E
|
||||
bool
|
||||
default y
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
endif
|
||||
|
||||
#if MT7603E_RLT_MAC
|
||||
# config MT7603E_RLT_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if MT7603E_RTMP_MAC
|
||||
# config MT7603E_RTMP_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if MT7603E_MT_MAC
|
||||
if MT7603E_RALINK_MT7603E
|
||||
config MT7603E_MT_MAC
|
||||
bool
|
||||
default y
|
||||
endif
|
||||
#endif MT7603E_MT_WIFI
|
||||
#endif
|
||||
#endif FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
endif
|
||||
@ -0,0 +1,96 @@
|
||||
Release Note:
|
||||
|
||||
[V4.0.0.7]
|
||||
Host Driver:
|
||||
1. Bug fixed for TGn 4.2.12 PMK caching and 4.2.11 pre-authentication issue.
|
||||
2. Bug fixed for 802.1x issue of WEP encryption.
|
||||
3. Add UAPSD support.
|
||||
4. Add APCLI_AUTO_CONNECT_SUPPORT function.
|
||||
5. Fix MCU INT CR read/write issue.
|
||||
6. modify rate retry rule.
|
||||
7. Fix QA tool: check the writing length to write all to flash.
|
||||
8. Fix memory leak issue when command TxPwr send fail.
|
||||
9. Fix MT7603E load fw fail issue that need to adjust PCIe LDO setting to 1.2V.
|
||||
10. Fix the WSC config status( in beacon & probe resp ) is wrong when we key the wrong DUT's enrolee PIN.
|
||||
11. ATE tool:
|
||||
a. fix txpower can not be set at ATE mode issue.
|
||||
b. Add code for TxTone Power HQADLL command and iwpriv.
|
||||
12. Fix Makefile/Kconfig:
|
||||
a. we should use CONFIG_SINGLE_SKU_V2, not CONFIG_SINGLE_SKU.
|
||||
b. Remove RTMP_TEMPERATURE_TX_ALC because this driver flag is not valid. (controlled by FW)
|
||||
|
||||
F/W:
|
||||
1. Add EDCA and Slot time set command.
|
||||
2. Enable and update CCK_MRC fix.
|
||||
3. Enable TX PA dynamic GC
|
||||
4. Support negative TMAC PWR
|
||||
5. Set CR_TSSI_PA_OFFSET_HPA
|
||||
6. Lower WF0/WF1 TSSI ON TH to 0dBm
|
||||
|
||||
|
||||
[V4.0.0.6 ]
|
||||
Host Driver:
|
||||
1.Add tx power percentage function for iPA
|
||||
2. Modify AP PS, use CR replace AP PS CMD
|
||||
3.fix apcli vs DIR655 IOT can't set ba size to 21
|
||||
4.Set MSSID *7, iPhone5 connect then ping overnight, still ping fail (?¶çˆ¾PSE Redirection bit被è?èµ? STA ping fail)
|
||||
for ps retrieve function, rename "token_enq_fail" to "token_enq_all_fail" to let it more clear.
|
||||
5. MT7603 auto rate update
|
||||
6. Fix [AP][TGn]:4.2.47 Power Save, fail on step 8,each PS poll the station sends to the APUT, the APUT is expected to send only one directed data packet in response.
|
||||
7. Fix TGn 4.2.11 & 4.2.12 PMK cache is delete in Auth. Req.
|
||||
8. add PSE logical reset when detect pse abonormal condition
|
||||
9. add sw based PDMA watchdog to detect & recovery PDMA TX/RX hang
|
||||
|
||||
F/W:
|
||||
Fix PCIE FW download fail when sw reboot, reset HIF then trigger WDT.
|
||||
1. Add DMA scheduler workaround.
|
||||
2. Add Admission control.
|
||||
3. Add TX power % support.
|
||||
|
||||
|
||||
[MT7603E_DPA_LinuxAP_4.0.0.5_20140511]
|
||||
1. Fixed Cal Free IC eeprom endian issue.
|
||||
2. Fixed IOT issue with Linksys WUSB6300.
|
||||
3. AP-client repeater: fixed icv error when authmode/encryptype update.
|
||||
4. Fixed crash issue that tasklet for processing pci dma done for mcu cmd sometimes will execute after event tasklet.
|
||||
5. Update auto fall back config and algorithm.
|
||||
6. Update firmware to fixed FW re-download fail issue.
|
||||
7. Do 802.11 header endian swap for ps retrieve packet.
|
||||
8. Fixed LED command big endian issue.
|
||||
9. Fixed MlmeHardTransmitTxRing cache flush issue that will cause memory for dma and cache non sync at big endian platform.
|
||||
10. Modify check en/disable RTS/CTS conditions.
|
||||
11. Fixed radio on/off cmd parameters to correct value.
|
||||
12. Update patch for flash mode.
|
||||
13. Fixed LED RadioOff issue.
|
||||
14. ATE:
|
||||
a. fixed Tx/Rx antenna switch resulting wrong Tx power level work around.
|
||||
b. patch PCIE ASPM write efuse Add PCIe Compile flag.
|
||||
c. add iwpriv TXCONT
|
||||
d. add iwpriv for carrier suppression test TXCARR
|
||||
e. Initialize Tx power with EEPROM array when ATESTART
|
||||
f. Fix CONFIG_QA blocking setting power when only CONFIG_ATE is chosen
|
||||
|
||||
|
||||
[MT7603E_DPA_LinuxAP_4.0.0.4_20140411]
|
||||
1. Support IGMP Snooping function.
|
||||
2. Fix NewRateAdapt Error in STA mode.
|
||||
3. Fixed apcli ICV error issue to decrypt Broadcast packet from AP.
|
||||
4. Fixed BAR issues:
|
||||
a. Change SW BAR rate to CCK 1M.
|
||||
b. Send SW BAR for ap power saving to refresh peer sta side reordering buffer (Intel IOT).
|
||||
c. Add SW BAR mechanism which SN will control by wtbl per tid.
|
||||
d. Considering the BAR data rate in both 2.4G & 5G
|
||||
e. SendRefreshBar when recv. CmdPsClearRsp, this modify will make sure the 1st. packet in PSE is BAR after PS.
|
||||
5. Update new firmware for BBP issue.
|
||||
6. Upload E1/E2 default EEPROM bin file.
|
||||
7. Fixed ATE bugs for Tx power setting, BW40 channel control, and Rx issue.
|
||||
8. Change MAX_NUMBER_OF_MAC definition to support 32 association STAs.
|
||||
9. Correct ApCli entry setting to fix throughput issue.
|
||||
10. Fix sometimes software tx will stuck since Intel STA in ps mode is very frequently.
|
||||
11. Fine tune TXOP settings.
|
||||
12. Fixed the bug when spatial extension on/off.
|
||||
13. Fixed AP client TKIP/WEP connection issue with Broadcom AP.
|
||||
|
||||
|
||||
[MT7603E_DPA_LinuxAP_4.0.0.4_20140401]
|
||||
1. Init AP Driver version
|
||||
533
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/Kconfig
Normal file
533
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/Kconfig
Normal file
@ -0,0 +1,533 @@
|
||||
if FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
config MT7603E_RLT_WIFI
|
||||
tristate "RLT 7603 WIFI Driver"
|
||||
select MT7603E_WIFI_BASIC_FUNC if MT7603E_RLT_WIFI
|
||||
|
||||
config MT7603E_MT_WIFI_PATH
|
||||
string
|
||||
depends on MT7603E_RLT_WIFI
|
||||
default "rlt_wifi"
|
||||
|
||||
if MT7603E_RLT_WIFI
|
||||
menu "WiFi Generic Feature Options"
|
||||
|
||||
if FIRST_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 1st Card"
|
||||
depends on ! FIRST_IF_NONE
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
|
||||
config MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
endchoice
|
||||
|
||||
config MT7603E_RT_FIRST_CARD_EEPROM
|
||||
string
|
||||
depends on ! FIRST_IF_NONE
|
||||
default "prom" if MT7603E_FIRST_IF_EEPROM_PROM
|
||||
default "efuse" if MT7603E_FIRST_IF_EEPROM_EFUSE
|
||||
default "flash" if MT7603E_FIRST_IF_EEPROM_FLASH
|
||||
endif
|
||||
# endif FIRST_IF_MT7603E
|
||||
|
||||
if SECOND_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 2nd Card"
|
||||
depends on ! SECOND_IF_NONE
|
||||
|
||||
config MT7603E_SECOND_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config MT7603E_SECOND_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
|
||||
config MT7603E_SECOND_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
endchoice
|
||||
|
||||
config MT7603E_RT_SECOND_CARD_EEPROM
|
||||
string
|
||||
depends on ! SECOND_IF_NONE
|
||||
default "prom" if MT7603E_SECOND_IF_EEPROM_PROM
|
||||
default "efuse" if MT7603E_SECOND_IF_EEPROM_EFUSE
|
||||
default "flash" if MT7603E_SECOND_IF_EEPROM_FLASH
|
||||
endif
|
||||
#endif SECOND_IF_MT7603E
|
||||
|
||||
config MT7603E_MULTI_INF_SUPPORT
|
||||
bool
|
||||
default y if !FIRST_IF_NONE && !SECOND_IF_NONE
|
||||
|
||||
config MT7603E_WIFI_BASIC_FUNC
|
||||
bool "Basic Functions"
|
||||
select WIRELESS_EXT
|
||||
select WEXT_SPY
|
||||
select WEXT_PRIV
|
||||
|
||||
config MT7603E_WSC_INCLUDED
|
||||
bool "WSC (WiFi Simple Config)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_WSC_V2_SUPPORT
|
||||
bool "WSC V2(WiFi Simple Config Version 2.0)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_WSC_NFC_SUPPORT
|
||||
bool "WSC out-of-band(NFC)"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_DOT11N_DRAFT3
|
||||
bool "802.11n Draft3"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_DOT11_VHT_AC
|
||||
# bool "802.11 ac"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_DOT11W_PMF_SUPPORT
|
||||
bool "PMF"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
#config MT7603E_TXBF_SUPPORT
|
||||
# bool "Tx Bean Forming Support"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_WMM_ACM_SUPPORT
|
||||
# bool "WMM ACM"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_LLTD_SUPPORT
|
||||
bool "LLTD (Link Layer Topology Discovery Protocol)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_QOS_DLS_SUPPORT
|
||||
bool "802.11e DLS ((Direct-Link Setup) Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
|
||||
config MT7603E_WAPI_SUPPORT
|
||||
bool "WAPI Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_CARRIER_DETECTION_SUPPORT
|
||||
bool "Carrier Detect"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_IGMP_SNOOP_SUPPORT
|
||||
bool "IGMP Snooping"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_BLOCK_NET_IF
|
||||
bool "NETIF Block"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
help
|
||||
Support Net interface block while Tx-Sw queue full
|
||||
|
||||
config MT7603E_TXBF_SUPPORT
|
||||
bool "Tx Bean Forming Support (Only 3883)"
|
||||
depends on WIFI_DRIVER
|
||||
depends on RALINK_RT2883 || RALINK_RT3883
|
||||
default n
|
||||
#
|
||||
# optimize dma cache mapping for internal mips platform
|
||||
#
|
||||
config MT7603E_DMA_CACHE_OPTIMIZE
|
||||
bool "optimize dma cache mapping for internal mips platform"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_VIDEO_TURBINE_SUPPORT
|
||||
# bool "Video Turbine support"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT7603E_RA_CLASSIFIER
|
||||
# tristate "Ralink Flow Classifier"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_RATE_ADAPTION
|
||||
bool "New Rate Adaptation support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_NEW_RATE_ADAPT_SUPPORT
|
||||
bool "Intelligent Rate Adaption"
|
||||
depends on WIFI_DRIVER && MT7603E_RATE_ADAPTION
|
||||
default y
|
||||
|
||||
config MT7603E_AGS_SUPPORT
|
||||
bool "Adaptive Group Switching"
|
||||
depends on WIFI_DRIVER && MT7603E_RATE_ADAPTION
|
||||
default n
|
||||
|
||||
config MT7603E_IDS_SUPPORT
|
||||
bool "IDS (Intrusion Detection System) Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_WORK_QUEUE
|
||||
bool "Work Queue"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_SKB_RECYCLE
|
||||
bool "SKB Recycle(Linux)"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_PUSH_SUPPORT
|
||||
bool "Config Push Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT7603E_EASY_SETUP_SUPPORT
|
||||
# bool "Whole Home Coverage - Easy Setup"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT7603E_EVENT_NOTIFIER_SUPPORT
|
||||
bool "Whole Home Coverage - Event Notifier"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_SMART_CARRIER_SENSE_SUPPORT
|
||||
bool "Smart Carrier Sense"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
config MT7603E_MBO_SUPPORT
|
||||
bool "MBO Support"
|
||||
depends on WIFI_DRIVER
|
||||
select INTERWORKING
|
||||
select WNM_SUPPORT
|
||||
select DOT11K_RRM_SUPPORT
|
||||
select DOT11R_FT_SUPPORT
|
||||
select DOT11W_PMF_SUPPORT
|
||||
select PASSPOINT_R2
|
||||
default n
|
||||
config MT7603E_RTMP_FLASH_SUPPORT
|
||||
bool "Flash Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_MWDS_SUPPORT
|
||||
bool "Mixed WDS(MWDS)"
|
||||
default n
|
||||
|
||||
config MT7603E_AIR_MONITOR_SUPPORT
|
||||
bool "Air Monitor Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_STA_FORCE_ROAM_SUPPORT
|
||||
bool "Sta Force Roam Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_ROAMING_ENHANCE_SUPPORT
|
||||
bool "Roaming Enhance Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_WIFI_FWD_UPDATED
|
||||
bool "Wifi Forwarding Support Update"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_BTCOEX_CONCURRENT
|
||||
bool "Coexisence Event Notify between BT and WiFi"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_LED_CONTROL_SUPPORT
|
||||
bool "LED Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_SINGLE_SKU_V2
|
||||
bool "Single SKU V2"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_HW_ANTENNA_DIVERSITY
|
||||
bool "Antenna Diversity Support"
|
||||
depends on MT7603E_RLT_AP_SUPPORT || RLT_STA_SUPPORT
|
||||
depends on RALINK_RT5350
|
||||
default n
|
||||
|
||||
config MT7603E_ATE_SUPPORT
|
||||
bool "ATE/QA Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_RT2860V2_AP_V24_DATA_STRUCTURE
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT7603E_RT2860V2_AP_32B_DESC
|
||||
bool "32 Byte Descriptor Support"
|
||||
depends on WIFI_DRIVER
|
||||
depends on MT7603E_RALINK_RT6352 || RALINK_MT7620
|
||||
default n
|
||||
|
||||
config MT7603E_MEMORY_OPTIMIZATION
|
||||
bool "Memory Optimization"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_INTERNAL_TX_ALC
|
||||
bool "TSSI Compensation"
|
||||
depends on WIFI_DRIVER
|
||||
depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 || MT7603E_RALINK_RT6352
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_TEMPERATURE_CALIBRATION
|
||||
bool "Temperature Calibration"
|
||||
depends on WIFI_DRIVER
|
||||
depends on MT7603E_RALINK_RT6352
|
||||
default n
|
||||
|
||||
config MT7603E_HOTSPOT
|
||||
bool "Passpoint-R1"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_PASSPOINT_R2
|
||||
bool "Passpoint Release-2 Support"
|
||||
depends on MT7603E_HOTSPOT
|
||||
select MT7603E_DOT11W_PMF_SUPPORT
|
||||
default n
|
||||
|
||||
config MT7603E_UAPSD
|
||||
bool "MT7603E_UAPSD support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
#config MT7603E_EPA_ELNA
|
||||
# bool "ePAeLNA"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
choice
|
||||
prompt "PA,LNA Type"
|
||||
depends on MT7603E_RLT_WIFI
|
||||
|
||||
config MT7603E_IPA_ILNA
|
||||
bool "iPAiLNA"
|
||||
|
||||
config MT7603E_IPA_ELNA
|
||||
bool "iPAeLNA"
|
||||
|
||||
config MT7603E_EPA_ILNA
|
||||
bool "ePAiLNA"
|
||||
|
||||
config MT7603E_EPA_ELNA
|
||||
bool "ePAeLNA"
|
||||
endchoice
|
||||
|
||||
config MT7603E_PA_LNA
|
||||
string
|
||||
depends on MT7603E_RLT_WIFI
|
||||
default "iPAiLNA" if MT7603E_IPA_ILNA
|
||||
default "iPAeLNA" if MT7603E_IPA_ELNA
|
||||
default "ePAiLNA" if MT7603E_EPA_ILNA
|
||||
default "ePAeLNA" if MT7603E_EPA_ELNA
|
||||
|
||||
#
|
||||
# Section for chip architectures
|
||||
#
|
||||
# "RLT MAC Support"
|
||||
config MT7603E_RLT_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RLT_BBP
|
||||
bool
|
||||
|
||||
config MT7603E_RLT_RF
|
||||
bool
|
||||
|
||||
# "RTMP MAC Support"
|
||||
config MT7603E_RTMP_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_RTMP_BBP
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_RF
|
||||
bool
|
||||
|
||||
#
|
||||
# Section for interfaces
|
||||
#
|
||||
config MT7603E_RTMP_PCI_SUPPORT
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_USB_SUPPORT
|
||||
bool
|
||||
|
||||
config MT7603E_RTMP_RBUS_SUPPORT
|
||||
bool
|
||||
|
||||
endmenu
|
||||
|
||||
menu "WiFi Operation Modes"
|
||||
choice
|
||||
prompt "Main Mode"
|
||||
default MT7603E_WIFI_MODE_AP
|
||||
|
||||
config MT7603E_WIFI_MODE_AP
|
||||
bool "AP"
|
||||
|
||||
config MT7603E_WIFI_MODE_STA
|
||||
bool "STA"
|
||||
|
||||
config MT7603E_WIFI_MODE_BOTH
|
||||
bool "APSTA"
|
||||
endchoice
|
||||
|
||||
if MT7603E_WIFI_MODE_AP || MT7603E_WIFI_MODE_BOTH
|
||||
source "drivers/net/wireless/mtk/mt7603e/mt7603_wifi_ap/Kconfig"
|
||||
endif
|
||||
|
||||
#if MT7603E_WIFI_MODE_STA || MT7603E_WIFI_MODE_BOTH
|
||||
# source "drivers/net/wireless/rlt_wifi_sta/Kconfig"
|
||||
#endif
|
||||
endmenu
|
||||
|
||||
#"RT2860 series"
|
||||
config MT7603E_RALINK_RT28XX
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT3092"
|
||||
config MT7603E_RALINK_RT3092
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT3572"
|
||||
config MT7603E_RALINK_RT3572
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
#"RT5392"
|
||||
config MT7603E_RALINK_RT5392
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT5572"
|
||||
config MT7603E_RALINK_RT5572
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
#"RT5592"
|
||||
config MT7603E_RALINK_RT5592
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7620/RT6352"
|
||||
config MT7603E_RALINK_RT6352
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_RBUS_SUPPORT
|
||||
# select MT7603E_RTMP_TEMPERATURE_CALIBRATION
|
||||
# select MT7603E_RTMP_INTERNAL_TX_ALC
|
||||
|
||||
#"MT7610E"
|
||||
config MT7603E_RALINK_MT7610E
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7610U"
|
||||
config MT7603E_RALINK_MT7610U
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
#"RT8592"
|
||||
config MT7603E_RALINK_RT8592
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7612E"
|
||||
config MT7603E_RALINK_MT7612E
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7612U"
|
||||
config MT7603E_RALINK_MT7612U
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
#"MT7603E"
|
||||
config MT7603E_RALINK_MT7603E
|
||||
bool
|
||||
default y
|
||||
select MT7603E_RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7603U"
|
||||
config MT7603E_RALINK_MT7603U
|
||||
bool
|
||||
default n
|
||||
select MT7603E_RTMP_USB_SUPPORT
|
||||
|
||||
endif
|
||||
|
||||
#if MT7603E_RLT_MAC
|
||||
# config MT7603E_RLT_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if MT7603E_RTMP_MAC
|
||||
# config MT7603E_RTMP_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
if MT7603E_RALINK_MT7603E
|
||||
config MT7603E_MT_MAC
|
||||
bool
|
||||
default y
|
||||
endif
|
||||
|
||||
if MT7603E_RALINK_MT7603U
|
||||
config MT7603E_MT_MAC
|
||||
bool
|
||||
default y
|
||||
endif
|
||||
endif
|
||||
#endif FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
@ -0,0 +1,513 @@
|
||||
if FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
config MT_WIFI
|
||||
tristate "MT WIFI Driver"
|
||||
|
||||
config MT_WIFI_PATH
|
||||
string
|
||||
depends on MT_WIFI
|
||||
default "mt_wifi"
|
||||
|
||||
if MT_WIFI
|
||||
menu "WiFi Generic Feature Options"
|
||||
|
||||
if FIRST_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 1st Card"
|
||||
depends on ! FIRST_IF_NONE
|
||||
|
||||
config FIRST_MT_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config FIRST_MT_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
|
||||
config FIRST_MT_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
endchoice
|
||||
|
||||
config RT_FIRST_CARD_EEPROM
|
||||
string
|
||||
depends on ! FIRST_IF_NONE
|
||||
default "prom" if FIRST_MT_IF_EEPROM_PROM
|
||||
default "efuse" if FIRST_MT_IF_EEPROM_EFUSE
|
||||
default "flash" if FIRST_MT_IF_EEPROM_FLASH
|
||||
endif
|
||||
# endif FIRST_IF_MT7603E
|
||||
|
||||
if SECOND_IF_MT7603E
|
||||
choice
|
||||
prompt "EEPROM Type of 2nd Card"
|
||||
depends on ! SECOND_IF_NONE
|
||||
|
||||
config SECOND_MT_IF_EEPROM_PROM
|
||||
bool "EEPROM"
|
||||
|
||||
config SECOND_MT_IF_EEPROM_EFUSE
|
||||
bool "EFUSE"
|
||||
|
||||
config SECOND_MT_IF_EEPROM_FLASH
|
||||
bool "FLASH"
|
||||
endchoice
|
||||
|
||||
config RT_SECOND_CARD_EEPROM
|
||||
string
|
||||
depends on ! SECOND_IF_NONE
|
||||
default "prom" if SECOND_MT_IF_EEPROM_PROM
|
||||
default "efuse" if SECOND_MT_IF_EEPROM_EFUSE
|
||||
default "flash" if SECOND_MT_IF_EEPROM_FLASH
|
||||
endif
|
||||
#endif SECOND_IF_MT7603E
|
||||
|
||||
config MULTI_INF_SUPPORT
|
||||
bool
|
||||
default y if !FIRST_IF_NONE && !SECOND_IF_NONE
|
||||
|
||||
#config WIFI_BASIC_FUNC
|
||||
# bool "Basic Functions"
|
||||
# select WIRELESS_EXT
|
||||
# select WEXT_SPY
|
||||
# select WEXT_PRIV
|
||||
|
||||
config MT_WSC_INCLUDED
|
||||
bool "WSC (WiFi Simple Config)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_WSC_V2_SUPPORT
|
||||
bool "WSC V2(WiFi Simple Config Version 2.0)"
|
||||
depends on MT_WSC_INCLUDED
|
||||
default y
|
||||
|
||||
config MT_DOT11N_DRAFT3
|
||||
bool "802.11n Draft3"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_DOT11_VHT_AC
|
||||
bool "802.11 ac"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config WSC_NFC_SUPPORT
|
||||
bool "WSC out-of-band(NFC)"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_DOT11W_PMF_SUPPORT
|
||||
bool "PMF Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_TXBF_SUPPORT
|
||||
bool "Tx Bean Forming Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT_WMM_ACM_SUPPORT
|
||||
# bool "WMM ACM"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT_LLTD_SUPPORT
|
||||
bool "LLTD (Link Layer Topology Discovery Protocol)"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_QOS_DLS_SUPPORT
|
||||
bool "802.11e DLS ((Direct-Link Setup) Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_WAPI_SUPPORT
|
||||
bool "WAPI Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_CARRIER_DETECTION_SUPPORT
|
||||
bool "Carrier Detect"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT7603E_MBO_SUPPORT
|
||||
bool "MBO Support"
|
||||
depends on WIFI_DRIVER
|
||||
select INTERWORKING
|
||||
select WNM_SUPPORT
|
||||
select DOT11K_RRM_SUPPORT
|
||||
select DOT11R_FT_SUPPORT
|
||||
select DOT11W_PMF_SUPPORT
|
||||
select PASSPOINT_R2
|
||||
default n
|
||||
|
||||
config MT_IGMP_SNOOP_SUPPORT
|
||||
bool "IGMP Snooping"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_BLOCK_NET_IF
|
||||
bool "NETIF Block"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
help
|
||||
Support Net interface block while Tx-Sw queue full
|
||||
|
||||
config MT_DMA_CACHE_OPTIMIZE
|
||||
bool "optimize dma cache mapping for internal mips platform"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT_TXBF_SUPPORT
|
||||
# bool "Tx Bean Forming Support (Only 3883)"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT2883 || RALINK_RT3883
|
||||
# default n
|
||||
|
||||
#config MT_VIDEO_TURBINE_SUPPORT
|
||||
# bool "Video Turbine support"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
#config MT_RA_CLASSIFIER
|
||||
# tristate "Ralink Flow Classifier"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
config MT_RATE_ADAPTION
|
||||
bool "New Rate Adaptation support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_NEW_RATE_ADAPT_SUPPORT
|
||||
bool "Intelligent Rate Adaption"
|
||||
depends on WIFI_DRIVER && MT_RATE_ADAPTION
|
||||
default y
|
||||
|
||||
config MT_AGS_SUPPORT
|
||||
bool "Adaptive Group Switching"
|
||||
depends on WIFI_DRIVER && MT_RATE_ADAPTION
|
||||
default n
|
||||
|
||||
config MT_IDS_SUPPORT
|
||||
bool "IDS (Intrusion Detection System) Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_WIFI_WORK_QUEUE
|
||||
bool "Work Queue"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_WIFI_SKB_RECYCLE
|
||||
bool "SKB Recycle(Linux)"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_RTMP_FLASH_SUPPORT
|
||||
bool "Flash Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config CONFIG_PUSH_SUPPORT
|
||||
bool "Config Push Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
config CONFIG_EASY_SETUP_SUPPORT
|
||||
bool "Whole Home Coverage - Easy Setup"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config EVENT_NOTIFIER_SUPPORT
|
||||
bool "Whole Home Coverage - Event Notifier"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
config MWDS_SUPPORT
|
||||
bool "Mixed WDS(MWDS)"
|
||||
default y
|
||||
config AIR_MONITOR_SUPPORT
|
||||
bool "Air Monitor Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config STA_FORCE_ROAM_SUPPORT
|
||||
bool "Sta Force Roam Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config ROAMING_ENHANCE_SUPPORT
|
||||
bool "Roaming Enhance Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config WIFI_FWD_UPDATED
|
||||
bool "Wifi Forwarding Support Update"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_BTCOEX_CONCURRENT
|
||||
bool "Coexisence Event Notify between BT and WiFi"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_LED_CONTROL_SUPPORT
|
||||
bool "LED Support"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_SINGLE_SKU_V2
|
||||
bool "Single SKU V2"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_HW_ANTENNA_DIVERSITY
|
||||
bool "Antenna Diversity Support"
|
||||
depends on RLT_AP_SUPPORT || RLT_STA_SUPPORT
|
||||
depends on RALINK_RT5350
|
||||
default n
|
||||
|
||||
config MT_ATE_SUPPORT
|
||||
bool "ATE/QA Support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_RT2860V2_AP_V24_DATA_STRUCTURE
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
config MT_RT2860V2_AP_32B_DESC
|
||||
bool "32 Byte Descriptor Support"
|
||||
depends on WIFI_DRIVER
|
||||
depends on RALINK_RT6352 || RALINK_MT7620
|
||||
default n
|
||||
|
||||
config MT_MEMORY_OPTIMIZATION
|
||||
bool "Memory Optimization"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
#config MT_RTMP_INTERNAL_TX_ALC
|
||||
# bool "TSSI Compensation"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT3350 || RALINK_RT3352 || RALINK_RT5350 || RALINK_RT6352
|
||||
# default n
|
||||
|
||||
#config MT_RTMP_TEMPERATURE_CALIBRATION
|
||||
# bool "Temperature Calibration"
|
||||
# depends on WIFI_DRIVER
|
||||
# depends on RALINK_RT6352
|
||||
# default n
|
||||
|
||||
config MT_HOTSPOT
|
||||
bool "Passpoint-R1"
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config MT_HOTSPOT_R2
|
||||
bool "Passpoint Release-2 Support"
|
||||
depends on HOTSPOT
|
||||
select MT_DOT11W_PMF_SUPPORT
|
||||
default n
|
||||
|
||||
config MT_UAPSD
|
||||
bool "UAPSD support"
|
||||
depends on WIFI_DRIVER
|
||||
default y
|
||||
|
||||
#config MT_EPA_ELNA
|
||||
# bool "ePAeLNA"
|
||||
# depends on WIFI_DRIVER
|
||||
# default n
|
||||
|
||||
choice
|
||||
prompt "PA,LNA Type"
|
||||
depends on MT_WIFI
|
||||
|
||||
config MT_IPA_ILNA
|
||||
bool "iPAiLNA"
|
||||
|
||||
config MT_IPA_ELNA
|
||||
bool "iPAeLNA"
|
||||
|
||||
config MT_EPA_ILNA
|
||||
bool "ePAiLNA"
|
||||
|
||||
config MT_EPA_ELNA
|
||||
bool "ePAeLNA"
|
||||
endchoice
|
||||
|
||||
config MT_PA_LNA
|
||||
string
|
||||
depends on MT_WIFI
|
||||
default "iPAiLNA" if MT_IPA_ILNA
|
||||
default "iPAeLNA" if MT_IPA_ELNA
|
||||
default "ePAiLNA" if MT_EPA_ILNA
|
||||
default "ePAeLNA" if MT_EPA_ELNA
|
||||
|
||||
#
|
||||
# Section for chip architectures
|
||||
#
|
||||
# "RLT MAC Support"
|
||||
config RLT_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config RLT_BBP
|
||||
bool
|
||||
|
||||
config RLT_RF
|
||||
bool
|
||||
|
||||
# "RTMP MAC Support"
|
||||
config RTMP_MAC
|
||||
bool
|
||||
depends on WIFI_DRIVER
|
||||
default n
|
||||
|
||||
config RTMP_BBP
|
||||
bool
|
||||
|
||||
config RTMP_RF
|
||||
bool
|
||||
|
||||
#
|
||||
# Section for interfaces
|
||||
#
|
||||
config RTMP_PCI_SUPPORT
|
||||
bool
|
||||
|
||||
config RTMP_USB_SUPPORT
|
||||
bool
|
||||
|
||||
config RTMP_RBUS_SUPPORT
|
||||
bool
|
||||
|
||||
endmenu
|
||||
|
||||
menu "WiFi Operation Modes"
|
||||
choice
|
||||
prompt "Main Mode"
|
||||
default MT_WIFI_MODE_AP
|
||||
|
||||
config MT_WIFI_MODE_AP
|
||||
bool "AP"
|
||||
|
||||
config MT_WIFI_MODE_STA
|
||||
bool "STA"
|
||||
|
||||
config MT_WIFI_MODE_BOTH
|
||||
bool "APSTA"
|
||||
endchoice
|
||||
|
||||
if MT_WIFI_MODE_AP || MT_WIFI_MODE_BOTH
|
||||
source "drivers/net/wireless/mt_wifi_ap/Kconfig"
|
||||
endif
|
||||
|
||||
#if MT_WIFI_MODE_STA || MT_WIFI_MODE_BOTH
|
||||
# source "drivers/net/wireless/rlt_wifi_sta/Kconfig"
|
||||
#endif
|
||||
endmenu
|
||||
|
||||
#"RT2860 series"
|
||||
config RALINK_RT28XX
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT3092"
|
||||
config RALINK_RT3092
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT3572"
|
||||
config RALINK_RT3572
|
||||
bool
|
||||
default n
|
||||
select RTMP_USB_SUPPORT
|
||||
|
||||
#"RT5392"
|
||||
config RALINK_RT5392
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"RT5572"
|
||||
config RALINK_RT5572
|
||||
bool
|
||||
default n
|
||||
select RTMP_USB_SUPPORT
|
||||
|
||||
#"RT5592"
|
||||
config RALINK_RT5592
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7620/RT6352"
|
||||
config RALINK_RT6352
|
||||
bool
|
||||
default n
|
||||
select RTMP_RBUS_SUPPORT
|
||||
# select RTMP_TEMPERATURE_CALIBRATION
|
||||
# select RTMP_INTERNAL_TX_ALC
|
||||
|
||||
#"MT7610E"
|
||||
config RALINK_MT7610E
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7610U"
|
||||
config RALINK_MT7610U
|
||||
bool
|
||||
default n
|
||||
select RTMP_USB_SUPPORT
|
||||
|
||||
#"RT8592"
|
||||
config RALINK_RT8592
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7612E"
|
||||
config RALINK_MT7612E
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
#"MT7612U"
|
||||
config RALINK_MT7612U
|
||||
bool
|
||||
default n
|
||||
select RTMP_USB_SUPPORT
|
||||
|
||||
#"MT7603E"
|
||||
config RALINK_MT7603E
|
||||
bool
|
||||
default n
|
||||
select RTMP_PCI_SUPPORT
|
||||
|
||||
endif
|
||||
|
||||
#if RLT_MAC
|
||||
# config RLT_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if RTMP_MAC
|
||||
# config RTMP_MAC
|
||||
# bool
|
||||
# default y
|
||||
#endif
|
||||
|
||||
#if MT_MAC
|
||||
if RALINK_MT7603E
|
||||
config MT_MAC
|
||||
bool
|
||||
default y
|
||||
endif
|
||||
#endif MT_WIFI
|
||||
endif
|
||||
#endif FIRST_IF_MT7603E || SECOND_IF_MT7603E
|
||||
678
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/Makefile
Normal file
678
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/Makefile
Normal file
@ -0,0 +1,678 @@
|
||||
RT28xx_MODE = AP
|
||||
|
||||
|
||||
|
||||
TARGET = LINUX
|
||||
|
||||
|
||||
# CHIPSET
|
||||
# rt2860, rt2870, rt2880, rt2070, rt3070, rt3090, rt3572, rt3062, rt3562, rt3593, rt3573
|
||||
# rt3562(for rt3592), rt3050, rt3350, rt3352, rt5350, rt5370, rt5390, rt5572, rt5592,
|
||||
# rt8592(for rt85592),
|
||||
# mt7601e, mt7601u,
|
||||
# mt7650e, mt7630e, mt7610e, mt7650u, mt7630u, mt7610u
|
||||
# mt7662e, mt7632e, mt7612e, mt7662u, mt7632u, mt7612u
|
||||
# mt7603e, mt7603u, mt7636u, mt7636s
|
||||
|
||||
|
||||
CHIPSET = mt7603e
|
||||
|
||||
|
||||
MODULE = $(word 1, $(CHIPSET))
|
||||
|
||||
#OS ABL - YES or NO
|
||||
OSABL = NO
|
||||
|
||||
#Build Prealloc ko
|
||||
PREALLOC = NO
|
||||
|
||||
ifneq ($(TARGET),THREADX)
|
||||
#RT28xx_DIR = home directory of RT28xx source code
|
||||
RT28xx_DIR = $(shell pwd)
|
||||
endif
|
||||
|
||||
include $(RT28xx_DIR)/os/linux/config.mk
|
||||
|
||||
RTMP_SRC_DIR = $(RT28xx_DIR)/RT$(MODULE)
|
||||
|
||||
#PLATFORM: Target platform
|
||||
PLATFORM = PC
|
||||
#PLATFORM = MT53XX
|
||||
#PLATFORM = PC_AUTO_BUILD
|
||||
#PLATFORM = BB_SOC
|
||||
#PLATFORM = 5VT
|
||||
#PLATFORM = IKANOS_V160
|
||||
#PLATFORM = IKANOS_V180
|
||||
#PLATFORM = SIGMA
|
||||
#PLATFORM = SIGMA_8622
|
||||
#PLATFORM = INIC
|
||||
#PLATFORM = STAR
|
||||
#PLATFORM = IXP
|
||||
#PLATFORM = INF_TWINPASS
|
||||
#PLATFORM = INF_DANUBE
|
||||
#PLATFORM = INF_AR9
|
||||
#PLATFORM = INF_VR9
|
||||
#PLATFORM = BRCM_6358
|
||||
#PLATFORM = INF_AMAZON_SE
|
||||
#PLATFORM = CAVM_OCTEON
|
||||
#PLATFORM = CMPC
|
||||
#PLATFORM = RALINK_2880
|
||||
#PLATFORM = RALINK_3052
|
||||
#PLATFORM = SMDK
|
||||
#PLATFORM = RMI
|
||||
#PLATFORM = RMI_64
|
||||
#PLATFORM = KODAK_DC
|
||||
#PLATFORM = DM6446
|
||||
#PLATFORM = FREESCALE8377
|
||||
#PLATFORM = BL2348
|
||||
#PLATFORM = BL23570
|
||||
#PLATFORM = BLUBB
|
||||
#PLATFORM = BLPMP
|
||||
#PLATFORM = MT85XX
|
||||
#PLATFORM = NXP_TV550
|
||||
#PLATFORM = MVL5
|
||||
#PLATFORM = RALINK_3352
|
||||
#PLATFORM = UBICOM_IPX8
|
||||
#PLATFORM = INTELP6
|
||||
#PLATFORM = MT7620
|
||||
#PLATFORM = MT7621
|
||||
#PLATFORM = MSTAR
|
||||
|
||||
#APSOC
|
||||
ifeq ($(MODULE),3050)
|
||||
PLATFORM = RALINK_3050
|
||||
endif
|
||||
ifeq ($(MODULE),3052)
|
||||
PLATFORM = RALINK_3052
|
||||
endif
|
||||
ifeq ($(MODULE),3350)
|
||||
PLATFORM = RALINK_3050
|
||||
endif
|
||||
ifeq ($(MODULE),3352)
|
||||
PLATFORM = RALINK_3352
|
||||
endif
|
||||
ifeq ($(CHIPSET),mt7628)
|
||||
PLATFORM = MT7628
|
||||
endif
|
||||
|
||||
#RELEASE Package
|
||||
RELEASE = DPA
|
||||
|
||||
|
||||
ifeq ($(TARGET),LINUX)
|
||||
MAKE = make
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), UCOS)
|
||||
MAKE = make
|
||||
endif
|
||||
ifeq ($(TARGET),THREADX)
|
||||
MAKE = gmake
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET), ECOS)
|
||||
MAKE = make
|
||||
MODULE = $(shell pwd | sed "s/.*\///" ).o
|
||||
export MODULE
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BB_SOC)
|
||||
LINUX_SRC = $(KERNEL_DIR)
|
||||
#CROSS_COMPILE = /opt/trendchip/mips-linux-uclibc/usr/bin/mips-linux-uclibc-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),5VT)
|
||||
LINUX_SRC = /home/ralink-2860-sdk-5vt-distribution/linux-2.6.17
|
||||
CROSS_COMPILE = /opt/crosstool/uClibc_v5te_le_gcc_4_1_1/bin/arm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),UBICOM_IPX8)
|
||||
LINUX_SRC = /home/sample/Customers/UBICOM/ubicom-linux-dist-2.1.1/linux-2.6.x
|
||||
CROSS_COMPILE = ubicom32-elf-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),IKANOS_V160)
|
||||
LINUX_SRC = /home/sample/projects/LX_2618_RG_5_3_00r4_SRC/linux-2.6.18
|
||||
CROSS_COMPILE = mips-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),IKANOS_V180)
|
||||
LINUX_SRC = /home/sample/projects/LX_BSP_VX180_5_4_0r1_ALPHA_26DEC07/linux-2.6.18
|
||||
CROSS_COMPILE = mips-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),SIGMA)
|
||||
LINUX_SRC = /root/sigma/smp86xx_kernel_source_2.7.172.0/linux-2.6.15
|
||||
CROSS_COMPILE = /root/sigma/smp86xx_toolchain_2.7.172.0/build_mipsel_nofpu/staging_dir/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),SIGMA_8622)
|
||||
LINUX_SRC = /home/snowpin/armutils_2.5.120.1/build_arm/linux-2.4.22-em86xx
|
||||
CROSS_COMPILE = /home/snowpin/armutils_2.5.120.1/toolchain/bin/arm-elf-
|
||||
CROSS_COMPILE_INCLUDE = /home/snowpin/armutils_2.5.120.1/toolchain/lib/gcc-lib/arm-elf/2.95.3
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INIC)
|
||||
UCOS_SRC = /opt/uCOS/iNIC_rt2880
|
||||
CROSS_COMPILE = /usr/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),STAR)
|
||||
LINUX_SRC = /opt/star/kernel/linux-2.4.27-star
|
||||
CROSS_COMPILE = /opt/star/tools/arm-linux/bin/arm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),RMI)
|
||||
LINUX_SRC = /opt/rmi/1.7.0/linux/src/
|
||||
CROSS_COMPILE = /opt/rmi/1.7.0/mipscross/nptl/bin/mips64-unknown-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),RMI_64)
|
||||
LINUX_SRC = /opt/rmi/1.7.0/linux_64/src/
|
||||
CROSS_COMPILE = /opt/rmi/1.7.0/mipscross/nptl/bin/mips64-unknown-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM), RALINK_2880)
|
||||
LINUX_SRC = /project/stable/RT288x/RT288x_SDK/source/linux-2.4.x
|
||||
CROSS_COMPILE = /opt/buildroot-gdb/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),RALINK_3052)
|
||||
LINUX_SRC = /home/peter/ap_soc/SDK_3_3_0_0/RT288x_SDK/source/linux-2.6.21.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc342/bin/mipsel-linux-uclibc-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),FREESCALE8377)
|
||||
LINUX_SRC = /opt/ltib-mpc8377_rds-20090309/rpm/BUILD/linux-2.6.25
|
||||
CROSS_COMPILE = /opt/freescale/usr/local/gcc-4.2.187-eglibc-2.5.187/powerpc-linux-gnu/bin/powerpc-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BL2348)
|
||||
LINUX_SRC = /home/sample/Customers/BroadLight/bl234x-linux-2.6.21-small-v29
|
||||
CROSS_COMPILE = mips-wrs-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BL23570)
|
||||
LINUX_SRC = /home/FIBERHOME/linux-2.6.34.8
|
||||
CROSS_COMPILE = mips-wrs-linux-gnu-mips_74k_softfp-glibc_small-
|
||||
ARCH:=mips
|
||||
export $ARCH
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),BLUBB)
|
||||
LINUX_SRC = /home/sample/Customers/BroadLight/UBB/gmp20/linux-2.6.21-small
|
||||
CROSS_COMPILE = mips-wrs-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BLPMP)
|
||||
LINUX_SRC = /home/sample/Customers/BroadLight/UBB/pmp16/bl234x-linux-2.6.21-small-v30.2
|
||||
CROSS_COMPILE = mips-wrs-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),PC)
|
||||
# Linux 2.6
|
||||
LINUX_SRC = /lib/modules/$(shell uname -r)/build
|
||||
# Linux 2.4 Change to your local setting
|
||||
#LINUX_SRC = /usr/src/linux-2.4
|
||||
LINUX_SRC_MODULE = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless/
|
||||
CROSS_COMPILE =
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INTELP6)
|
||||
LINUX_SRC = /tftpboot/IntelCE-20.0.11052.243193/project_build_i686/IntelCE/kernel-20.0.11024.238456/linux-2.6.35
|
||||
CROSS_COMPILE = /tftpboot/IntelCE-20.0.11052.243193/build_i686/i686-linux-elf/bin/i686-cm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),IXP)
|
||||
LINUX_SRC = /project/stable/Gmtek/snapgear-uclibc/linux-2.6.x
|
||||
CROSS_COMPILE = arm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_TWINPASS)
|
||||
# Linux 2.6
|
||||
#LINUX_SRC = /lib/modules/$(shell uname -r)/build
|
||||
# Linux 2.4 Change to your local setting
|
||||
LINUX_SRC = /project/stable/twinpass/release/2.0.1/source/kernel/opensource/linux-2.4.31/
|
||||
CROSS_COMPILE = mips-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_DANUBE)
|
||||
LINUX_SRC = /opt/danube/sdk/linux-2.6.16.x
|
||||
CROSS_COMPILE = mips-linux-
|
||||
ROOTDIR = /opt/danube/sdk
|
||||
export ROOTDIR
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_AR9)
|
||||
LINUX_SRC = /root/ar9/xR9_BSP1.2.2.0/source/kernel/opensource/linux-2.6.20/
|
||||
CROSS_COMPILE = /root/ar9/ifx-lxdb26-1.0.2/gcc-3.4.4/toolchain-mips/bin/
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_VR9)
|
||||
LINUX_SRC = /home/public/lantiq/VR9/UGW-4.2/build_dir/linux-ifxcpe_platform_vr9/linux-2.6.20.19
|
||||
CROSS_COMPILE = /home/public/lantiq/VR9/UGW-4.2/staging_dir/toolchain-mips_gcc-3.4.6_uClibc-0.9.29/bin/mips-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),BRCM_6358)
|
||||
LINUX_SRC =
|
||||
CROSS_COMPILE =
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),INF_AMAZON_SE)
|
||||
# Linux 2.6
|
||||
#LINUX_SRC = /lib/modules/$(shell uname -r)/build
|
||||
# Linux 2.4 Change to your local setting
|
||||
LINUX_SRC = /backup/ifx/3.6.2.2/source/kernel/opensource/linux-2.4.31
|
||||
#CROSS_COMPILE = mips-linux-
|
||||
#LINUX_SRC = /project/Infineon/3.6.2.2/source/kernel/opensource/linux-2.4.31
|
||||
CROSS_COMPILE = /opt/uclibc-toolchain/ifx-lxdb-1-2-3-external/gcc-3.3.6/toolchain-mips/R0208V35/mips-linux-uclibc/bin/
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),ST)
|
||||
LINUX_SRC = /opt/STM/STLinux-2.2/devkit/sources/kernel/linux0039
|
||||
CROSS_COMPILE = /opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-
|
||||
ARCH := sh
|
||||
export ARCH
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),CAVM_OCTEON)
|
||||
OCTEON_ROOT = /usr/local/Cavium_Networks/OCTEON-SDK
|
||||
LINUX_SRC = $(OCTEON_ROOT)/linux/kernel_2.6/linux
|
||||
CROSS_COMPILE = mips64-octeon-linux-gnu-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),CMPC)
|
||||
LINUX_SRC = /opt/fvt_11N_SDK_0807/fvt131x_SDK_11n/linux-2.6.17
|
||||
CROSS_COMPILE =
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),SMDK)
|
||||
LINUX_SRC = /home/bhushan/itcenter/may28/linux-2.6-samsung
|
||||
CROSS_COMPILE = /usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),RALINK_3352)
|
||||
LINUX_SRC = /home/sample/3352/RT288x_SDK/source/linux-2.6.21.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc342/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),KODAK_DC)
|
||||
SKD_SRC = C:/SigmaTel/DC1250_SDK_v1-9/sdk
|
||||
CROSS_COMPILE = $(cc)
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),DM6446)
|
||||
LINUX_SRC = /home/fonchi/work/soc/ti-davinci
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
ifeq ($(OSABL),YES)
|
||||
LINUX_SRC = $(RT28xx_DIR)/../../../../../build_linux
|
||||
else
|
||||
LINUX_SRC = $(RT28xx_DIR)/../../../../build_linux
|
||||
endif
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
CROSS_COMPILE=armv7a-mediatek451_001_vfp-linux-gnueabi-
|
||||
endif
|
||||
CC=$(CROSS_COMPILE)gcc
|
||||
$(warning =============================================)
|
||||
$(warning CC=$(CC) for wifi driver)
|
||||
$(warning =============================================)
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),MT53XX)
|
||||
TARGET = LINUX
|
||||
#****** For system auto build ******
|
||||
#LINUX_SRC=$(KERNEL_OBJ_ROOT)/$(KERNEL_VER)/$(KERNEL_CONFIG)_modules
|
||||
#****** For local build ******
|
||||
# uncomment the following lines
|
||||
VM_LINUX_ROOT ?= $(word 1, $(subst /vm_linux/,/vm_linux /, $(shell pwd)))
|
||||
LINUX_ROOT ?= $(VM_LINUX_ROOT)
|
||||
LINUX_SRC=$(VM_LINUX_ROOT)/output/mtk_android/mt5399_cn_android/rel/obj/kernel/chiling/kernel/linux-3.10/mt5399_android_smp_mod_defconfig_modules
|
||||
OBJ_ROOT ?= $(VM_LINUX_ROOT)/output/mtk_android/mt5399_cn_android/rel/obj
|
||||
export KERNEL_OBJ_ROOT=$(LINUX_SRC)/../..
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
CROSS_COMPILE=/mtkoss/gnuarm/vfp_4.5.1_2.6.27_cortex-a9-rhel4/i686/bin/armv7a-mediatek451_001_vfp-linux-gnueabi-
|
||||
endif
|
||||
ifeq "$(CC)" "gcc"
|
||||
CC ?= $(CROSS_COMPILE)gcc
|
||||
endif
|
||||
$(warning =============================================)
|
||||
$(warning CC=$(CC) for wifi driver LINUX_SRC=$(LINUX_SRC))
|
||||
$(warning TARGET=$(TARGET))
|
||||
$(warning =============================================)
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),NXP_TV550)
|
||||
LINUX_SRC = /data/tv550/kernel/linux-2.6.28.9
|
||||
LINUX_SRC_MODULE = /data/tv550/kernel/linux-2.6.28.9/drivers/net/wireless
|
||||
CROSS_COMPILE = /opt/embeddedalley/nxp_tv550/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),PC_AUTO_BUILD)
|
||||
LINUX_SRC=/proj/srv_wcnautobuild/external/linux-3.10.59/
|
||||
#CROSS_COMPILE=/proj/srv_wcnautobuild/external/gcc-4.9.2/bin/
|
||||
CROSS_COMPILE=
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),MVL5)
|
||||
LINUX_SRC = /home2/charlestu/AP-VT3426/linux-2.6.18
|
||||
CROSS_COMPILE = /opt/montavista/pro/devkit/arm/v5t_le_mvl5/bin/arm_v5t_le-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),MT7620)
|
||||
LINUX_SRC = /home/share/src/MT7601/AP/RT288x_SDK/source/linux-2.6.36.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc342/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),MT7621)
|
||||
LINUX_SRC = /root/SDK_4_2_0_0/RT288x_SDK/source/linux-2.6.36.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc463/usr/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),MT7628)
|
||||
LINUX_SRC = /root/Working/MT7628_SDK_2013_0912/RT288x_SDK/source/linux-2.6.36.x
|
||||
CROSS_COMPILE = /opt/buildroot-gcc342/bin/mipsel-linux-
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),MSTAR)
|
||||
PREALLOC = YES
|
||||
|
||||
#628 TV Platform
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/628/kernel/RedLion/3.1.10/
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/628/kernel/3.10.23/3.10.23/
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/628/kernel/3.1.10_Madison_TVOS/3.1.10/
|
||||
|
||||
#918 TV Android4.3 Platform
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/918_TV/android4.3/kernel/3.1.10_Napoli_tvos/3.1.10/
|
||||
|
||||
#918 Box Android4.4 Platform
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/toolchain/918_Box_android4.4/3.1.10_Napoli_tvos_0616_new_kernel/3.1.10/
|
||||
|
||||
#928 Box Android4.4 Platform
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/928/928_kernel_0716/3.10.23/
|
||||
#LINUX_SRC = /proj/mtk05650/share/mstar/928/928_kernel_0722/3.10.23/
|
||||
LINUX_SRC = /proj/mtk05650/share/mstar/928/20140710_KERN-3.10.23-00911089/3.10.23/
|
||||
|
||||
#ToolChian Setting
|
||||
#CROSS_COMPILE = /proj/mtk05650/share/mstar/628/toolchain/arm-2012.09/bin/arm-none-linux-gnueabi-
|
||||
CROSS_COMPILE = /proj/mtk05650/share/mstar/toolchain/arm-2010.09/bin/arm-none-linux-gnueabi-
|
||||
#CROSS_COMPILE = /proj/mtk05650/share/mstar/toolchain/918_Box_android4.4/arm-2012.09/bin/arm-none-linux-gnueabi-
|
||||
#CROSS_COMPILE = /proj/mtk05650/share/mstar/toolchain/918_Box_android4.4/arm-2012.09/bin/arm-none-linux-gnueabi-
|
||||
endif
|
||||
|
||||
export OSABL RT28xx_DIR RT28xx_MODE LINUX_SRC CROSS_COMPILE CROSS_COMPILE_INCLUDE PLATFORM RELEASE CHIPSET MODULE RTMP_SRC_DIR LINUX_SRC_MODULE TARGET HAS_WOW_SUPPORT
|
||||
|
||||
# The targets that may be used.
|
||||
PHONY += all build_tools test UCOS THREADX LINUX release prerelease clean uninstall install libwapi osabl sdk_build_tools
|
||||
|
||||
ifeq ($(TARGET),LINUX)
|
||||
all: build_tools $(TARGET) plug_in
|
||||
else
|
||||
all: $(TARGET)
|
||||
endif
|
||||
|
||||
build_tools:
|
||||
$(MAKE) -C tools
|
||||
$(RT28xx_DIR)/tools/bin2h
|
||||
|
||||
sdk_build_tools:
|
||||
if [ -f $(RT28xx_DIR)/eeprom_log ]; then \
|
||||
rm -f $(RT28xx_DIR)/eeprom_log
|
||||
fi
|
||||
echo $(EE_TYPE) >> eeprom_log
|
||||
echo $(CHIPSET) >> eeprom_log
|
||||
if [ -f $(RT28xx_DIR)/eeprom/SA/MT7603E_EEPROM.bin ]; then \
|
||||
echo 'find SA/MT7603E_EEPROM.bin' >> eeprom_log ; \
|
||||
cp -f $(RT28xx_DIR)/eeprom/SA/MT7603E_EEPROM.bin $(RT28xx_DIR)/eeprom/MT7603E_EEPROM.bin ; \
|
||||
else \
|
||||
cp -f $(RT28xx_DIR)/eeprom/$(EE_TYPE)/MT7603E_EEPROM.bin $(RT28xx_DIR)/eeprom/MT7603E_EEPROM.bin ; \
|
||||
fi
|
||||
$(MAKE) -C tools
|
||||
$(RT28xx_DIR)/tools/bin2h
|
||||
# rm -f $(RT28xx_DIR)/eeprom/SA/MT7603E_EEPROM.bin
|
||||
|
||||
test:
|
||||
$(MAKE) -C tools test
|
||||
|
||||
UCOS:
|
||||
$(MAKE) -C os/ucos/ MODE=$(RT28xx_MODE)
|
||||
echo $(RT28xx_MODE)
|
||||
|
||||
ECOS:
|
||||
$(MAKE) -C os/ecos/ MODE=$(RT28xx_MODE)
|
||||
cp -f os/ecos/$(MODULE) $(MODULE)
|
||||
|
||||
THREADX:
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/Threadx -f $(RT28xx_DIR)/os/ThreadX/Makefile
|
||||
|
||||
LINUX:
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f os/linux/Makefile.4.util $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
endif
|
||||
|
||||
cp -f os/linux/Makefile.4 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f os/linux/Makefile.4.netif $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
endif
|
||||
|
||||
ifeq ($(RT28xx_MODE),AP)
|
||||
ifneq ($(PLATFORM),BB_SOC)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap.o /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtutil$(MODULE)_ap.o /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtnet$(MODULE)_ap.o /tftpboot
|
||||
endif
|
||||
ifeq ($(PLATFORM),INF_AMAZON_SE)
|
||||
cp -f /tftpboot/rt2870ap.o /backup/ifx/build/root_filesystem/lib/modules/2.4.31-Amazon_SE-3.6.2.2-R0416_Ralink/kernel/drivers/net
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifeq ($(RT28xx_MODE),APSTA)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta.o /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtutil$(MODULE)_apsta.o /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtnet$(MODULE)_apsta.o /tftpboot
|
||||
endif
|
||||
else
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta.o /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtutil$(MODULE)_sta.o /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/rtnet$(MODULE)_sta.o /tftpboot
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
endif
|
||||
ifeq ($(PREALLOC), YES)
|
||||
cp -f PREALLOC/os/linux/Makefile.6.prealloc PREALLOC/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/PREALLOC/os/linux modules
|
||||
$(SHELL) cp_prealloc.sh
|
||||
endif
|
||||
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
|
||||
ifeq ($(PLATFORM),DM6446)
|
||||
$(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
else
|
||||
ifeq ($(PLATFORM),FREESCALE8377)
|
||||
$(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
else
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
endif
|
||||
|
||||
ifeq ($(RT28xx_MODE),AP)
|
||||
ifneq ($(PLATFORM),BB_SOC)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap.ko /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap_util.ko /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap_net.ko /tftpboot
|
||||
endif
|
||||
else
|
||||
rm -f os/linux/$(MODULE)_ap.ko.lzma
|
||||
/root/bin/lzma e os/linux/$(MODULE)_ap.ko os/linux/$(MODULE)_ap.ko.lzma
|
||||
endif
|
||||
else
|
||||
ifeq ($(RT28xx_MODE),APSTA)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta.ko /tftpboot
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta_util.ko /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta_net.ko /tftpboot
|
||||
endif
|
||||
else
|
||||
ifeq ($(PLATFORM),PC_AUTO_BUILD)
|
||||
else
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta.ko /tftpboot
|
||||
endif
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta_util.ko /tftpboot
|
||||
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta_net.ko /tftpboot
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
mkdir -p $(RT28xx_DIR)/../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
endif
|
||||
|
||||
plug_in:
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/tools/plug_in MODULE_FLAGS="$(WFLAGS)"
|
||||
|
||||
release: build_tools
|
||||
$(MAKE) -C $(RT28xx_DIR)/striptool -f Makefile.release clean
|
||||
$(MAKE) -C $(RT28xx_DIR)/striptool -f Makefile.release
|
||||
striptool/striptool.out
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
cp -f tools/osabl_check.sh $(RELEASE)/
|
||||
endif
|
||||
ifeq ($(RELEASE), DPO)
|
||||
gcc -o striptool/banner striptool/banner.c
|
||||
./striptool/banner -b striptool/copyright.gpl -s DPO/ -d DPO_GPL -R
|
||||
./striptool/banner -b striptool/copyright.frm -s DPO_GPL/include/firmware.h
|
||||
endif
|
||||
|
||||
prerelease:
|
||||
ifeq ($(MODULE), 2880)
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.release.2880 prerelease
|
||||
else
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.release prerelease
|
||||
endif
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPB $(RTMP_SRC_DIR)/os/linux/.
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPA $(RTMP_SRC_DIR)/os/linux/.
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPC $(RTMP_SRC_DIR)/os/linux/.
|
||||
ifeq ($(RT28xx_MODE),STA)
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPD $(RTMP_SRC_DIR)/os/linux/.
|
||||
cp $(RT28xx_DIR)/os/linux/Makefile.DPO $(RTMP_SRC_DIR)/os/linux/.
|
||||
endif
|
||||
|
||||
clean:
|
||||
ifeq ($(TARGET), LINUX)
|
||||
cp -f os/linux/Makefile.clean os/linux/Makefile
|
||||
$(MAKE) -C os/linux clean
|
||||
rm -rf os/linux/Makefile
|
||||
ifeq ($(PREALLOC), YES)
|
||||
cp -f PREALLOC/os/linux/Makefile.clean PREALLOC/os/linux/Makefile
|
||||
$(MAKE) -C PREALLOC/os/linux clean
|
||||
rm -rf PREALLOC/os/linux/Makefile
|
||||
endif
|
||||
endif
|
||||
ifeq ($(TARGET), UCOS)
|
||||
$(MAKE) -C os/ucos clean MODE=$(RT28xx_MODE)
|
||||
endif
|
||||
ifeq ($(TARGET), ECOS)
|
||||
$(MAKE) -C os/ecos clean MODE=$(RT28xx_MODE)
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
ifeq ($(TARGET), LINUX)
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 uninstall
|
||||
else
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 uninstall
|
||||
endif
|
||||
endif
|
||||
|
||||
install:
|
||||
ifeq ($(TARGET), LINUX)
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 install
|
||||
else
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 install
|
||||
endif
|
||||
endif
|
||||
|
||||
libwapi:
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
cp -f os/linux/Makefile.libwapi.4 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
else
|
||||
cp -f os/linux/Makefile.libwapi.6 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
endif
|
||||
|
||||
osutil:
|
||||
ifeq ($(OSABL),YES)
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
cp -f os/linux/Makefile.4.util $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
else
|
||||
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
osnet:
|
||||
ifeq ($(OSABL),YES)
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
cp -f os/linux/Makefile.4.netif $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
else
|
||||
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
osdrv:
|
||||
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
|
||||
cp -f os/linux/Makefile.4 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(RT28xx_DIR)/os/linux/
|
||||
else
|
||||
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
|
||||
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
|
||||
ifeq ($(PLATFORM),MT85XX)
|
||||
ifeq ($(OSABL),YES)
|
||||
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Declare the contents of the .PHONY variable as phony. We keep that information in a variable
|
||||
.PHONY: $(PHONY)
|
||||
|
||||
|
||||
|
||||
147
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/RT2860AP.dat
Normal file
147
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/RT2860AP.dat
Normal file
@ -0,0 +1,147 @@
|
||||
#The word of "Default" must not be removed
|
||||
Default
|
||||
ed_th_nonCE=52
|
||||
Cts2SelfTh=1500
|
||||
CountryRegion=5
|
||||
CountryRegionABand=7
|
||||
CountryCode=TW
|
||||
BssidNum=1
|
||||
SSID1=RT2860AP1
|
||||
SSID2=
|
||||
SSID3=
|
||||
SSID4=
|
||||
WirelessMode=9
|
||||
TxRate=0
|
||||
Channel=11
|
||||
BasicRate=15
|
||||
BeaconPeriod=100
|
||||
DtimPeriod=1
|
||||
TxPower=100
|
||||
DisableOLBC=0
|
||||
BGProtection=0
|
||||
MaxStaNum=0
|
||||
TxPreamble=0
|
||||
RTSThreshold=2347
|
||||
FragThreshold=2346
|
||||
TxBurst=1
|
||||
PktAggregate=0
|
||||
TurboRate=0
|
||||
WmmCapable=0
|
||||
APSDCapable=0
|
||||
DLSCapable=0
|
||||
APAifsn=3;7;1;1
|
||||
APCwmin=4;4;3;2
|
||||
APCwmax=6;10;4;3
|
||||
APTxop=0;0;94;47
|
||||
APACM=0;0;0;0
|
||||
BSSAifsn=3;7;2;2
|
||||
BSSCwmin=4;4;3;2
|
||||
BSSCwmax=10;10;4;3
|
||||
BSSTxop=0;0;94;47
|
||||
BSSACM=0;0;0;0
|
||||
AckPolicy=0;0;0;0
|
||||
NoForwarding=0
|
||||
NoForwardingBTNBSSID=0
|
||||
HideSSID=0
|
||||
StationKeepAlive=0
|
||||
ShortSlot=1
|
||||
AutoChannelSelect=0
|
||||
IEEE8021X=0
|
||||
IEEE80211H=0
|
||||
CSPeriod=10
|
||||
WirelessEvent=0
|
||||
IdsEnable=0
|
||||
AuthFloodThreshold=32
|
||||
AssocReqFloodThreshold=32
|
||||
ReassocReqFloodThreshold=32
|
||||
ProbeReqFloodThreshold=32
|
||||
DisassocFloodThreshold=32
|
||||
DeauthFloodThreshold=32
|
||||
EapReqFooldThreshold=32
|
||||
PreAuth=0
|
||||
AuthMode=OPEN
|
||||
EncrypType=NONE
|
||||
RekeyInterval=0
|
||||
RekeyMethod=DISABLE
|
||||
PMKCachePeriod=10
|
||||
WPAPSK1=
|
||||
WPAPSK2=
|
||||
WPAPSK3=
|
||||
WPAPSK4=
|
||||
DefaultKeyID=1
|
||||
Key1Type=0
|
||||
Key1Str1=
|
||||
Key1Str2=
|
||||
Key1Str3=
|
||||
Key1Str4=
|
||||
Key2Type=0
|
||||
Key2Str1=
|
||||
Key2Str2=
|
||||
Key2Str3=
|
||||
Key2Str4=
|
||||
Key3Type=0
|
||||
Key3Str1=
|
||||
Key3Str2=
|
||||
Key3Str3=
|
||||
Key3Str4=
|
||||
Key4Type=0
|
||||
Key4Str1=
|
||||
Key4Str2=
|
||||
Key4Str3=
|
||||
Key4Str4=
|
||||
HSCounter=0
|
||||
AccessPolicy0=0
|
||||
AccessControlList0=
|
||||
AccessPolicy1=0
|
||||
AccessControlList1=
|
||||
AccessPolicy2=0
|
||||
AccessControlList2=
|
||||
AccessPolicy3=0
|
||||
AccessControlList3=
|
||||
WdsEnable=0
|
||||
WdsEncrypType=NONE
|
||||
WdsList=
|
||||
WdsKey=
|
||||
RADIUS_Server=192.168.2.3
|
||||
RADIUS_Port=1812
|
||||
RADIUS_Key=ralink
|
||||
own_ip_addr=192.168.5.234
|
||||
EAPifname=br0
|
||||
PreAuthifname=br0
|
||||
HT_HTC=0
|
||||
HT_RDG=0
|
||||
HT_EXTCHA=0
|
||||
HT_LinkAdapt=0
|
||||
HT_OpMode=0
|
||||
HT_MpduDensity=5
|
||||
HT_BW=1
|
||||
HT_AutoBA=1
|
||||
HT_AMSDU=0
|
||||
HT_BAWinSize=64
|
||||
HT_GI=1
|
||||
HT_LDPC=0
|
||||
HT_MCS=33
|
||||
VHT_BW=1
|
||||
VHT_SGI=1
|
||||
VHT_STBC=0
|
||||
VHT_BW_SIGNAL=0
|
||||
VHT_DisallowNonVHT=0
|
||||
VHT_LDPC=0
|
||||
MeshId=MESH
|
||||
MeshAutoLink=1
|
||||
MeshAuthMode=OPEN
|
||||
MeshEncrypType=NONE
|
||||
MeshWPAKEY=
|
||||
MeshDefaultkey=1
|
||||
MeshWEPKEY=
|
||||
WscManufacturer=
|
||||
WscModelName=
|
||||
WscDeviceName=
|
||||
WscModelNumber=
|
||||
WscSerialNumber=
|
||||
RadioOn=1
|
||||
PMFMFPC=0
|
||||
PMFMFPR=0
|
||||
PMFSHA256=0
|
||||
LoadCodeMethod=0
|
||||
ed_th_nonCE=52
|
||||
@ -0,0 +1,19 @@
|
||||
#The word of "Default" must not be removed, maximum 32 cards, 00 ~ 31
|
||||
Default
|
||||
|
||||
#CARDID, MAC, CARDTYPE
|
||||
SELECT=CARDTYPE
|
||||
|
||||
00CARDID=/etc/Wireless/RT2860AP/RT2860AP1.dat
|
||||
01CARDID=/etc/Wireless/RT2860AP/RT2860AP2.dat
|
||||
02CARDID=/etc/Wireless/RT2860AP/RT2860AP3.dat
|
||||
|
||||
00MAC00:0E:2E:C3:D0:48=/etc/Wireless/RT2860AP/RT2860AP1.dat
|
||||
01MAC00:40:F4:FF:AA:40=/etc/Wireless/RT2860AP/RT2860AP2.dat
|
||||
02MAC00:0C:43:10:11:5C=/etc/Wireless/RT2860AP/RT2860AP3.dat
|
||||
|
||||
00CARDTYPEbgn=/etc/Wireless/RT2860AP/RT2860AP1.dat
|
||||
01CARDTYPEbgn=/etc/Wireless/RT2860AP/RT2860AP2.dat
|
||||
02CARDTYPEabgn=/etc/Wireless/RT2860AP/RT2860AP3.dat
|
||||
|
||||
|
||||
3983
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap.c
Normal file
3983
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap.c
Normal file
File diff suppressed because it is too large
Load Diff
724
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_acl_v2.c
Normal file
724
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_acl_v2.c
Normal file
@ -0,0 +1,724 @@
|
||||
|
||||
#ifdef ACL_V2_SUPPORT
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
// check http://www.coffer.com/mac_find/ not all can be found, need huawei to refine this table!!
|
||||
OUI_ENTRY OUI_ACL_TABLE[] =
|
||||
{
|
||||
{FBT_IOT_PEER_UNKNOWN, {0x00,0x00,0x00}},
|
||||
|
||||
/*Realtek why need 5 IDs ??, only 3 can be found*/
|
||||
{FBT_IOT_PEER_REALTEK, {0x00,0x48,0x54}}, //first three
|
||||
{FBT_IOT_PEER_REALTEK_92SE, {0x00,0xe0,0x4c}}, //first three
|
||||
{FBT_IOT_PEER_REALTEK_SOFTAP, {0x52,0x54,0x05}}, //first three
|
||||
//{FBT_IOT_PEER_RTK_APCLIENT, {0x00,0x00,0x00}}, //can't be found
|
||||
//{FBT_IOT_PEER_REALTEK_81XX, {0x00,0x00,0x00}}, //can't be found
|
||||
//{FBT_IOT_PEER_REALTEK_WOW, {0x00,0x00,0x00}}, //can't be found
|
||||
|
||||
{FBT_IOT_PEER_BROADCOM, {0x00,0x05,0xb5}},
|
||||
|
||||
{FBT_IOT_PEER_RALINK, {0x00,0x0c,0x43}},
|
||||
|
||||
{FBT_IOT_PEER_ATHEROS, {0x00,0x03,0x7f}},
|
||||
{FBT_IOT_PEER_ATHEROS, {0x00,0x13,0x74}},
|
||||
{FBT_IOT_PEER_ATHEROS, {0x88,0x12,0x4e}},
|
||||
|
||||
/*too many cisco OUIs, only keep 3*/
|
||||
{FBT_IOT_PEER_CISCO, {0x00,0x00,0x0c}},
|
||||
{FBT_IOT_PEER_CISCO, {0x00,0x01,0x42}},
|
||||
{FBT_IOT_PEER_CISCO, {0x00,0x01,0x43}},
|
||||
|
||||
{FBT_IOT_PEER_MERU, {0x00,0x0c,0xe6}},
|
||||
|
||||
{FBT_IOT_PEER_MARVEL, {0x00,0x50,0x43}},
|
||||
|
||||
//{FBT_IOT_PEER_SELF_SOFTAP, {000000}}, // can't be found
|
||||
|
||||
{FBT_IOT_PEER_AIRGO, {0x00,0x0a,0xf5}},
|
||||
|
||||
/*too many cisco OUIs, only keep 3*/
|
||||
{FBT_IOT_PEER_INTEL, {0x00,0x02,0xb3}},
|
||||
{FBT_IOT_PEER_INTEL, {0x00,0x03,0x47}},
|
||||
{FBT_IOT_PEER_INTEL, {0x00,0x04,0x23}},
|
||||
|
||||
/*too many , only keep 1! */
|
||||
{FBT_IOT_PEER_HTC, {0x00,0x04,0x23}},
|
||||
//{FBT_IOT_PEER_MAX, {0x00,0x00,0x00}}, // can't be found
|
||||
};
|
||||
|
||||
INT OUI_ACL_TABLE_NUM = (sizeof(OUI_ACL_TABLE)/sizeof(OUI_ENTRY));
|
||||
|
||||
|
||||
|
||||
VOID ACL_V2_Timeout(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3);
|
||||
|
||||
|
||||
BUILD_TIMER_FUNCTION(ACL_V2_Timeout);
|
||||
|
||||
|
||||
|
||||
VOID ACL_V2_CtrlInit(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
UCHAR APIndex;
|
||||
#endif /* CONFIG_AP_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
for (APIndex = 0; APIndex < MAX_MBSSID_NUM(pAd); APIndex++)
|
||||
{
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[APIndex].AccessControlList_V2;
|
||||
|
||||
NdisZeroMemory(pACLCtrl, sizeof(*pACLCtrl));
|
||||
pACLCtrl->BlockTime = 2; //spec is 2 seconds by default
|
||||
|
||||
pACLCtrl->pAd = pAd;
|
||||
|
||||
RTMPInitTimer(pAd, &pACLCtrl->AgeOutTimer,
|
||||
GET_TIMER_FUNCTION(ACL_V2_Timeout), pACLCtrl, FALSE);
|
||||
|
||||
pACLCtrl->AgeOutTimer_Running = FALSE;
|
||||
NdisAllocateSpinLock(pAd, &pACLCtrl->MAC_ListLock);
|
||||
NdisAllocateSpinLock(pAd, &pACLCtrl->OUI_ListLock);
|
||||
|
||||
DlListInit(&pACLCtrl->MAC_List);
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
VOID ACL_V2_CtrlExit(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
UINT32 Ret;
|
||||
BOOLEAN Cancelled;
|
||||
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
ACL_MAC_CTRL *pMACEntry, *pMACEntryTmp;
|
||||
ACL_OUI_CTRL *pOUIEntry, *pOUITmp;
|
||||
UCHAR APIndex;
|
||||
#endif /* CONFIG_AP_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
for (APIndex = 0; APIndex < MAX_MBSSID_NUM(pAd); APIndex++)
|
||||
{
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[APIndex].AccessControlList_V2;
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
DlListForEachSafe(pMACEntry, pMACEntryTmp, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
DlListDel(&pMACEntry->List);
|
||||
os_free_mem(NULL, pMACEntry);
|
||||
}
|
||||
DlListInit(&pACLCtrl->MAC_List);
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEachSafe(pOUIEntry, pOUITmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
}
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
if(pACLCtrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&pACLCtrl->AgeOutTimer, &Cancelled);
|
||||
pACLCtrl->AgeOutTimer_Running = FALSE;
|
||||
}
|
||||
RTMPReleaseTimer(&pACLCtrl->AgeOutTimer, &Cancelled);
|
||||
|
||||
NdisFreeSpinLock(&pACLCtrl->MAC_ListLock);
|
||||
NdisFreeSpinLock(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
}
|
||||
#endif /* CONFIG_AP_SUPPORT */
|
||||
}
|
||||
|
||||
INT Set_ACL_V2_DisConnectSta_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
UCHAR macAddr[MAC_ADDR_LEN];
|
||||
RTMP_STRING *value;
|
||||
INT i;
|
||||
MAC_TABLE_ENTRY *pEntry = NULL;
|
||||
|
||||
if(strlen(arg) != 17) /*Mac address acceptable format 01:02:03:04:05:06 length 17 */
|
||||
return FALSE;
|
||||
|
||||
for (i=0, value = rstrtok(arg,":"); value; value = rstrtok(NULL,":"))
|
||||
{
|
||||
if((strlen(value) != 2) || (!isxdigit(*value)) || (!isxdigit(*(value+1))) )
|
||||
return FALSE; /*Invalid */
|
||||
|
||||
AtoH(value, (UCHAR *)&macAddr[i++], 1);
|
||||
}
|
||||
|
||||
pEntry = MacTableLookup(pAd, macAddr);
|
||||
|
||||
|
||||
Set_ACL_V2_AddSTAEntry_Proc(pAd, macAddr);
|
||||
|
||||
if (pEntry)
|
||||
{
|
||||
MlmeDeAuthAction(pAd, pEntry, REASON_DISASSOC_STA_LEAVING, FALSE);
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: MAC=%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,PRINT_MAC(macAddr)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
INT Set_ACL_V2_DisConnectOUI_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
INT i=0;
|
||||
INT32 Ret;
|
||||
BOOLEAN Cancelled;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_OUI_CTRL *pOUIEntry, *pOUIEntryTmp;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
ULONG Value = (ULONG) simple_strtol(arg, 0, 16);
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
if(pACLCtrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&pACLCtrl->AgeOutTimer, &Cancelled);
|
||||
pACLCtrl->AgeOutTimer_Running = FALSE;
|
||||
}
|
||||
if (Value)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI=0x%08x\n", __FUNCTION__,Value));
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
if(pACLCtrl->OUI_Enable)
|
||||
{
|
||||
DlListForEachSafe(pOUIEntry, pOUIEntryTmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
pACLCtrl->OUI_ListNum --;
|
||||
if(pACLCtrl->OUI_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
}
|
||||
}
|
||||
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
for (i=0; i <OUI_ACL_TABLE_NUM ; i++)
|
||||
{
|
||||
if(Value & OUI_ACL_TABLE[i].ID)
|
||||
{
|
||||
Set_ACL_V2_AddOUIEntry_Proc(pAd, OUI_ACL_TABLE[i].OUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
if(pACLCtrl->OUI_Enable)
|
||||
{
|
||||
DlListForEachSafe(pOUIEntry, pOUIEntryTmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
pACLCtrl->OUI_ListNum --;
|
||||
if(pACLCtrl->OUI_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
}
|
||||
}
|
||||
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
}
|
||||
|
||||
i=0;
|
||||
|
||||
//dump all OUI list
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEach(pOUIEntry, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI [%d]=%02x:%02x:%02x\n", __FUNCTION__,i++, pOUIEntry->OUI[0],pOUIEntry->OUI[1],pOUIEntry->OUI[2]));
|
||||
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
if(pACLCtrl->BlockTime)
|
||||
{
|
||||
RTMPSetTimer(&pACLCtrl->AgeOutTimer, pACLCtrl->BlockTime * 1000);
|
||||
pACLCtrl->AgeOutTimer_Running = TRUE;
|
||||
}
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI count=%d\n", __FUNCTION__,i));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT32 Set_ACL_V2_AddSTAEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pTargetMACAddr)
|
||||
{
|
||||
BOOLEAN find_list = FALSE;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_MAC_CTRL *pMACEntry;
|
||||
ULONG Now32;
|
||||
INT32 Ret;
|
||||
BOOLEAN Cancelled;
|
||||
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
if (pACLCtrl->MAC_ListNum >= (MAX_NUM_OF_ACL_V2_MAC - 1))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN, ("%s : AccessControlList is full, and no more entry can join the list!\n",__FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s\n", __FUNCTION__));
|
||||
|
||||
if(pACLCtrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&pACLCtrl->AgeOutTimer, &Cancelled);
|
||||
pACLCtrl->AgeOutTimer_Running = FALSE;
|
||||
}
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
if (MAC_ADDR_EQUAL(pMACEntry->MACAddr, pTargetMACAddr))
|
||||
{
|
||||
find_list = TRUE;
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : duplicate mac =%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,PRINT_MAC(pTargetMACAddr)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
if (find_list == FALSE)
|
||||
os_alloc_mem(NULL, (UCHAR **)&pMACEntry, sizeof(*pMACEntry));
|
||||
|
||||
if (!pMACEntry)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s Not available memory\n", __FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (find_list == FALSE)
|
||||
{
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
NdisMoveMemory(pMACEntry->MACAddr, pTargetMACAddr, 6);
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
pMACEntry->SetTime = Now32;
|
||||
|
||||
DlListAddTail(&pACLCtrl->MAC_List, &pMACEntry->List);
|
||||
|
||||
pACLCtrl->MAC_ListNum ++;
|
||||
|
||||
if(pACLCtrl->MAC_ListNum)
|
||||
{
|
||||
pACLCtrl->MAC_Enable = 1;
|
||||
}
|
||||
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
}
|
||||
else
|
||||
{
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
pMACEntry->SetTime = Now32;
|
||||
}
|
||||
if(pACLCtrl->BlockTime)
|
||||
{
|
||||
RTMPSetTimer(&pACLCtrl->AgeOutTimer, pACLCtrl->BlockTime * 1000);
|
||||
pACLCtrl->AgeOutTimer_Running = TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
INT Show_ACL_V2_OUI_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
INT i=0;
|
||||
INT32 Ret;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_OUI_CTRL *pOUIEntry;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
//dump all OUI list
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEach(pOUIEntry, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI [%d]=%02x:%02x:%02x\n", __FUNCTION__,i++, pOUIEntry->OUI[0],pOUIEntry->OUI[1],pOUIEntry->OUI[2]));
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: OUI count=%d\n", __FUNCTION__,i));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
INT Show_ACL_V2_STAEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
INT i=0;
|
||||
INT32 Ret;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_MAC_CTRL *pMACEntry;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
//dump all OUI list
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: MAC [%d]=%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,i++, PRINT_MAC(pMACEntry->MACAddr)));
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: MAC count=%d\n", __FUNCTION__,i));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID Set_ACL_V2_DelSTAEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pTargetMACAddr)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_MAC_CTRL *pMACEntry, *pMACEntryTmp;
|
||||
|
||||
INT32 Ret;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s\n", __FUNCTION__));
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
DlListForEachSafe(pMACEntry, pMACEntryTmp, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
if (!pMACEntry)
|
||||
break;
|
||||
|
||||
if (MAC_ADDR_EQUAL(pMACEntry->MACAddr, pTargetMACAddr))
|
||||
{
|
||||
DlListDel(&pMACEntry->List);
|
||||
|
||||
pACLCtrl->MAC_ListNum --;
|
||||
|
||||
if(pACLCtrl->MAC_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->MAC_Enable = 0;
|
||||
}
|
||||
|
||||
os_free_mem(NULL, pMACEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
}
|
||||
|
||||
|
||||
UINT32 Set_ACL_V2_AddOUIEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pTargetOUIAddr)
|
||||
{
|
||||
BOOLEAN find_list = FALSE;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_OUI_CTRL *pOUIEntry;
|
||||
ULONG Now32;
|
||||
INT32 Ret;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
if (pACLCtrl->OUI_ListNum >= (MAX_NUM_OF_ACL_V2_OUI - 1))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN, ("%s : AccessControlList is full, and no more entry can join the list!\n",__FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s\n", __FUNCTION__));
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEach(pOUIEntry, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
if (RTMPEqualMemory(pOUIEntry->OUI, pTargetOUIAddr, OUI_LEN))
|
||||
{
|
||||
find_list = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
if (find_list == FALSE)
|
||||
os_alloc_mem(NULL, (UCHAR **)&pOUIEntry, sizeof(*pOUIEntry));
|
||||
|
||||
if (!pOUIEntry)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s Not available memory\n", __FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (find_list == FALSE)
|
||||
{
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
NdisMoveMemory(pOUIEntry->OUI, pTargetOUIAddr, OUI_LEN);
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
pOUIEntry->SetTime = Now32;
|
||||
|
||||
DlListAddTail(&pACLCtrl->OUI_List, &pOUIEntry->List);
|
||||
|
||||
pACLCtrl->OUI_ListNum ++;
|
||||
if (pACLCtrl->OUI_ListNum)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 1;
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
}
|
||||
else
|
||||
{ // only update timestamp
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
pOUIEntry->SetTime = Now32;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID Set_ACL_V2_DelOUIEntry_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pTargetOUIAddr)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_OUI_CTRL *pOUIEntry, *pOUIEntryTmp;
|
||||
|
||||
INT32 Ret;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s\n", __FUNCTION__));
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
DlListForEachSafe(pOUIEntry, pOUIEntryTmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
if (!pOUIEntry)
|
||||
break;
|
||||
|
||||
if (RTMPEqualMemory(pOUIEntry->OUI, pTargetOUIAddr, OUI_LEN))
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
|
||||
pACLCtrl->OUI_ListNum --;
|
||||
if(pACLCtrl->OUI_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
}
|
||||
|
||||
VOID Set_ACL_V2_EntryExpire_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ULONG Value;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
Value = (ULONG) simple_strtol(arg, 0, 10);
|
||||
pACLCtrl->BlockTime = Value;
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : pACLCtrl->BlockTime=%lu\n", __FUNCTION__,pACLCtrl->BlockTime));
|
||||
|
||||
}
|
||||
|
||||
|
||||
VOID Show_ACL_V2_EntryExpire_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RTMP_STRING *arg)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[pObj->ioctl_if].AccessControlList_V2;
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : pACLCtrl->BlockTime=%lu\n", __FUNCTION__,pACLCtrl->BlockTime));
|
||||
|
||||
}
|
||||
|
||||
BOOLEAN ACL_V2_List_Check(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN UCHAR *pAddr,
|
||||
IN UCHAR Apidx)
|
||||
{
|
||||
BOOLEAN Result = TRUE;
|
||||
PACL_V2_CTRL pACLCtrl;
|
||||
ACL_MAC_CTRL *pMACEntry;
|
||||
ACL_OUI_CTRL *pOUIEntry;
|
||||
|
||||
INT32 Ret;
|
||||
|
||||
pACLCtrl = &pAd->ApCfg.MBSSID[Apidx].AccessControlList_V2;
|
||||
|
||||
|
||||
check_oui:
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
DlListForEach(pOUIEntry, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
if (RTMPEqualMemory(pOUIEntry->OUI, pAddr, OUI_LEN))
|
||||
{
|
||||
Result = FALSE;
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : hit OUI =%02x:%02x:%02x\n", __FUNCTION__,pOUIEntry->OUI[0],pOUIEntry->OUI[1],pOUIEntry->OUI[2]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
|
||||
if (Result == FALSE)
|
||||
goto done;
|
||||
|
||||
|
||||
check_mac:
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
if (MAC_ADDR_EQUAL(pMACEntry->MACAddr, pAddr))
|
||||
{
|
||||
Result = FALSE;
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : hit mac =%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,PRINT_MAC(pAddr)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
done:
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
VOID ACL_V2_AgeOut(
|
||||
IN PACL_V2_CTRL pACLCtrl)
|
||||
{
|
||||
ACL_MAC_CTRL *pMACEntry, *pMACEntryTmp;
|
||||
ACL_OUI_CTRL *pOUIEntry, *pOUIEntryTmp;
|
||||
|
||||
INT32 Ret;
|
||||
UINT32 Now32;
|
||||
INT i = 0;
|
||||
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
UCHAR Apidx;
|
||||
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
{
|
||||
RTMP_SEM_LOCK(&pACLCtrl->OUI_ListLock);
|
||||
if(pACLCtrl->OUI_Enable)
|
||||
{
|
||||
DlListForEachSafe(pOUIEntry, pOUIEntryTmp, &pACLCtrl->OUI_List, ACL_OUI_CTRL, List)
|
||||
{
|
||||
if(RTMP_TIME_AFTER(Now32, pOUIEntry->SetTime + (pACLCtrl->BlockTime * OS_HZ)))
|
||||
{
|
||||
DlListDel(&pOUIEntry->List);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : age OUI[%d] =%02x:%02x:%02x\n", __FUNCTION__, i, pOUIEntry->OUI[0], pOUIEntry->OUI[1], pOUIEntry->OUI[2]));
|
||||
i++;
|
||||
pACLCtrl->OUI_ListNum --;
|
||||
if(pACLCtrl->OUI_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->OUI_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pOUIEntry);
|
||||
}
|
||||
}
|
||||
|
||||
DlListInit(&pACLCtrl->OUI_List);
|
||||
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->OUI_ListLock);
|
||||
|
||||
|
||||
i=0;
|
||||
|
||||
RTMP_SEM_LOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
if(pACLCtrl->MAC_Enable)
|
||||
{
|
||||
DlListForEachSafe(pMACEntry, pMACEntryTmp, &pACLCtrl->MAC_List, ACL_MAC_CTRL, List)
|
||||
{
|
||||
if(RTMP_TIME_AFTER(Now32, pMACEntry->SetTime + (pACLCtrl->BlockTime * OS_HZ)))
|
||||
{
|
||||
DlListDel(&pMACEntry->List);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : age MAC[%d] =%02x:%02x:%02x,%02x:%02x:%02x\n", __FUNCTION__, i, PRINT_MAC(pMACEntry->MACAddr)));
|
||||
i++;
|
||||
|
||||
pACLCtrl->MAC_ListNum --;
|
||||
if(pACLCtrl->MAC_ListNum == 0)
|
||||
{
|
||||
pACLCtrl->MAC_Enable = 0;
|
||||
}
|
||||
os_free_mem(NULL, pMACEntry);
|
||||
}
|
||||
}
|
||||
|
||||
DlListInit(&pACLCtrl->MAC_List);
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&pACLCtrl->MAC_ListLock);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ACL_V2_Timeout(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
{
|
||||
PACL_V2_CTRL pACLCtrl = (ACL_V2_CTRL *)FunctionContext;
|
||||
PRTMP_ADAPTER pAd = pACLCtrl->pAd;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s\n", __FUNCTION__));
|
||||
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s: fRTMP_ADAPTER_HALT_IN_PROGRESS\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
ACL_V2_AgeOut(pACLCtrl);
|
||||
|
||||
}
|
||||
|
||||
#endif /* ACL_V2_SUPPORT */
|
||||
4961
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_apcli.c
Normal file
4961
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_apcli.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,195 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002-2006, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
ap_apcli.c
|
||||
|
||||
Abstract:
|
||||
Support AP-Client function.
|
||||
|
||||
Note:
|
||||
1. Call RT28xx_ApCli_Init() in init function and
|
||||
call RT28xx_ApCli_Remove() in close function
|
||||
|
||||
2. MAC of ApCli-interface is initialized in RT28xx_ApCli_Init()
|
||||
|
||||
3. ApCli index (0) of different rx packet is got in
|
||||
|
||||
4. ApCli index (0) of different tx packet is assigned in
|
||||
|
||||
5. ApCli index (0) of different interface is got in APHardTransmit() by using
|
||||
|
||||
6. ApCli index (0) of IOCTL command is put in pAd->OS_Cookie->ioctl_if
|
||||
|
||||
8. The number of ApCli only can be 1
|
||||
|
||||
9. apcli convert engine subroutines, we should just take care data packet.
|
||||
Revision History:
|
||||
Who When What
|
||||
-------------- ---------- ----------------------------------------------
|
||||
Shiang, Fonchi 02-13-2007 created
|
||||
*/
|
||||
#define RTMP_MODULE_OS
|
||||
|
||||
#ifdef APCLI_SUPPORT
|
||||
|
||||
/*#include "rt_config.h" */
|
||||
#include "rtmp_comm.h"
|
||||
#include "rt_os_util.h"
|
||||
#include "rt_os_net.h"
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Init AP-Client function.
|
||||
|
||||
Arguments:
|
||||
pAd points to our adapter
|
||||
main_dev_p points to the main BSS network interface
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
1. Only create and initialize virtual network interfaces.
|
||||
2. No main network interface here.
|
||||
========================================================================
|
||||
*/
|
||||
VOID RT28xx_ApCli_Init(VOID *pAd, PNET_DEV main_dev_p)
|
||||
{
|
||||
RTMP_OS_NETDEV_OP_HOOK netDevOpHook;
|
||||
|
||||
/* init operation functions */
|
||||
NdisZeroMemory(&netDevOpHook, sizeof(RTMP_OS_NETDEV_OP_HOOK));
|
||||
netDevOpHook.open = ApCli_VirtualIF_Open;
|
||||
netDevOpHook.stop = ApCli_VirtualIF_Close;
|
||||
netDevOpHook.xmit = rt28xx_send_packets;
|
||||
netDevOpHook.ioctl = rt28xx_ioctl;
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_APC_INIT,
|
||||
0, &netDevOpHook, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Open a virtual network interface.
|
||||
|
||||
Arguments:
|
||||
dev_p which WLAN network interface
|
||||
|
||||
Return Value:
|
||||
0: open successfully
|
||||
otherwise: open fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT ApCli_VirtualIF_Open(PNET_DEV dev_p)
|
||||
{
|
||||
VOID *pAd;
|
||||
|
||||
/* increase MODULE use count */
|
||||
RT_MOD_INC_USE_COUNT();
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(dev_p);
|
||||
ASSERT(pAd);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s: ===> %s\n", __FUNCTION__, RTMP_OS_NETDEV_GET_DEVNAME(dev_p)));
|
||||
|
||||
if (VIRTUAL_IF_UP(pAd) != 0)
|
||||
return -1;
|
||||
|
||||
#ifdef CONFIG_RA_HW_NAT_WIFI_NEW_ARCH
|
||||
RT_MOD_HNAT_REG(dev_p);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_APC_OPEN, 0, dev_p, 0);
|
||||
|
||||
#ifdef MTFWD
|
||||
RTMP_OS_NETDEV_CARRIER_OFF(dev_p);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Close a virtual network interface.
|
||||
|
||||
Arguments:
|
||||
dev_p which WLAN network interface
|
||||
|
||||
Return Value:
|
||||
0: close successfully
|
||||
otherwise: close fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT ApCli_VirtualIF_Close(PNET_DEV dev_p)
|
||||
{
|
||||
VOID *pAd;
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(dev_p);
|
||||
ASSERT(pAd);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s: ===> %s\n", __FUNCTION__, RTMP_OS_NETDEV_GET_DEVNAME(dev_p)));
|
||||
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_APC_CLOSE, 0, dev_p, 0);
|
||||
|
||||
#ifdef CONFIG_RA_HW_NAT_WIFI_NEW_ARCH
|
||||
RT_MOD_HNAT_DEREG(dev_p);
|
||||
#endif
|
||||
|
||||
VIRTUAL_IF_DOWN(pAd);
|
||||
|
||||
RT_MOD_DEC_USE_COUNT();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Remove ApCli-BSS network interface.
|
||||
|
||||
Arguments:
|
||||
pAd points to our adapter
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
VOID RT28xx_ApCli_Remove(VOID *pAd)
|
||||
{
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_APC_REMOVE, 0, NULL, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif /* APCLI_SUPPORT */
|
||||
|
||||
3417
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_assoc.c
Normal file
3417
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_assoc.c
Normal file
File diff suppressed because it is too large
Load Diff
1374
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_auth.c
Normal file
1374
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_auth.c
Normal file
File diff suppressed because it is too large
Load Diff
1563
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_autoChSel.c
Normal file
1563
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_autoChSel.c
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
17758
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_cfg.c
Normal file
17758
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_cfg.c
Normal file
File diff suppressed because it is too large
Load Diff
1890
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_connect.c
Normal file
1890
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_connect.c
Normal file
File diff suppressed because it is too large
Load Diff
4133
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_data.c
Normal file
4133
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_data.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
/****************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Abstract:
|
||||
|
||||
Handle WMM-DLS state machine.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
|
||||
|
||||
/* End of ap_dls.c */
|
||||
1775
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_ftkd.c
Normal file
1775
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_ftkd.c
Normal file
File diff suppressed because it is too large
Load Diff
481
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_ids.c
Normal file
481
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_ids.c
Normal file
@ -0,0 +1,481 @@
|
||||
/****************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
****************************************************************************
|
||||
|
||||
Module Name:
|
||||
ap_ids.c
|
||||
|
||||
Abstract:
|
||||
monitor intrusion detection condition
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
*/
|
||||
#ifdef IDS_SUPPORT
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
#define IDS_EXEC_INTV 1000 /* 1 sec */
|
||||
|
||||
|
||||
VOID RTMPIdsStart(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
|
||||
if (pAd->ApCfg.IDSTimerRunning == FALSE)
|
||||
{
|
||||
RTMPSetTimer(&pAd->ApCfg.IDSTimer, IDS_EXEC_INTV);
|
||||
pAd->ApCfg.IDSTimerRunning = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
VOID RTMPIdsStop(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
BOOLEAN Cancelled;
|
||||
|
||||
if (pAd->ApCfg.IDSTimerRunning == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&pAd->ApCfg.IDSTimer, &Cancelled);
|
||||
pAd->ApCfg.IDSTimerRunning = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SYSTEM_LOG_SUPPORT
|
||||
VOID RTMPHandleIdsEvent(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
INT i, j;
|
||||
|
||||
UINT32 FloodFrameCount[IW_FLOOD_EVENT_TYPE_NUM];
|
||||
UINT32 FloodFrameThreshold[IW_FLOOD_EVENT_TYPE_NUM];
|
||||
|
||||
FloodFrameCount[0] = pAd->ApCfg.RcvdAuthCount;
|
||||
FloodFrameCount[1] = pAd->ApCfg.RcvdAssocReqCount;
|
||||
FloodFrameCount[2] = pAd->ApCfg.RcvdReassocReqCount;
|
||||
FloodFrameCount[3] = pAd->ApCfg.RcvdProbeReqCount;
|
||||
FloodFrameCount[4] = pAd->ApCfg.RcvdDisassocCount;
|
||||
FloodFrameCount[5] = pAd->ApCfg.RcvdDeauthCount;
|
||||
FloodFrameCount[6] = pAd->ApCfg.RcvdEapReqCount;
|
||||
|
||||
FloodFrameThreshold[0] = pAd->ApCfg.AuthFloodThreshold;
|
||||
FloodFrameThreshold[1] = pAd->ApCfg.AssocReqFloodThreshold;
|
||||
FloodFrameThreshold[2] = pAd->ApCfg.ReassocReqFloodThreshold;
|
||||
FloodFrameThreshold[3] = pAd->ApCfg.ProbeReqFloodThreshold;
|
||||
FloodFrameThreshold[4] = pAd->ApCfg.DisassocFloodThreshold;
|
||||
FloodFrameThreshold[5] = pAd->ApCfg.DeauthFloodThreshold;
|
||||
FloodFrameThreshold[6] = pAd->ApCfg.EapReqFloodThreshold;
|
||||
|
||||
/* trigger flooding traffic event */
|
||||
for (j = 0; j < IW_FLOOD_EVENT_TYPE_NUM; j++)
|
||||
{
|
||||
if ((FloodFrameThreshold[j] > 0) && (FloodFrameCount[j] > FloodFrameThreshold[j]))
|
||||
{
|
||||
RTMPSendWirelessEvent(pAd, IW_FLOOD_AUTH_EVENT_FLAG + j, NULL, MAX_MBSSID_NUM(pAd), 0);
|
||||
/*DBGPRINT(RT_DEBUG_TRACE, ("flooding traffic event(%d) - %d\n", IW_FLOOD_AUTH_EVENT_FLAG + j, FloodFrameCount[j])); */
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < pAd->ApCfg.BssidNum; i++)
|
||||
{
|
||||
UINT32 SpoofedFrameCount[IW_SPOOF_EVENT_TYPE_NUM];
|
||||
CHAR RssiOfSpoofedFrame[IW_SPOOF_EVENT_TYPE_NUM];
|
||||
INT k;
|
||||
|
||||
SpoofedFrameCount[0] = pAd->ApCfg.MBSSID[i].RcvdConflictSsidCount;
|
||||
SpoofedFrameCount[1] = pAd->ApCfg.MBSSID[i].RcvdSpoofedAssocRespCount;
|
||||
SpoofedFrameCount[2] = pAd->ApCfg.MBSSID[i].RcvdSpoofedReassocRespCount;
|
||||
SpoofedFrameCount[3] = pAd->ApCfg.MBSSID[i].RcvdSpoofedProbeRespCount;
|
||||
SpoofedFrameCount[4] = pAd->ApCfg.MBSSID[i].RcvdSpoofedBeaconCount;
|
||||
SpoofedFrameCount[5] = pAd->ApCfg.MBSSID[i].RcvdSpoofedDisassocCount;
|
||||
SpoofedFrameCount[6] = pAd->ApCfg.MBSSID[i].RcvdSpoofedAuthCount;
|
||||
SpoofedFrameCount[7] = pAd->ApCfg.MBSSID[i].RcvdSpoofedDeauthCount;
|
||||
SpoofedFrameCount[8] = pAd->ApCfg.MBSSID[i].RcvdSpoofedUnknownMgmtCount;
|
||||
SpoofedFrameCount[9] = pAd->ApCfg.MBSSID[i].RcvdReplayAttackCount;
|
||||
|
||||
RssiOfSpoofedFrame[0] = pAd->ApCfg.MBSSID[i].RssiOfRcvdConflictSsid;
|
||||
RssiOfSpoofedFrame[1] = pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedAssocResp;
|
||||
RssiOfSpoofedFrame[2] = pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedReassocResp;
|
||||
RssiOfSpoofedFrame[3] = pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedProbeResp;
|
||||
RssiOfSpoofedFrame[4] = pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedBeacon;
|
||||
RssiOfSpoofedFrame[5] = pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedDisassoc;
|
||||
RssiOfSpoofedFrame[6] = pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedAuth;
|
||||
RssiOfSpoofedFrame[7] = pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedDeauth;
|
||||
RssiOfSpoofedFrame[8] = pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedUnknownMgmt;
|
||||
RssiOfSpoofedFrame[9] = pAd->ApCfg.MBSSID[i].RssiOfRcvdReplayAttack;
|
||||
|
||||
/* trigger spoofed attack event */
|
||||
for (k = 0; k < IW_SPOOF_EVENT_TYPE_NUM; k++)
|
||||
{
|
||||
if (SpoofedFrameCount[k] > 0)
|
||||
{
|
||||
RTMPSendWirelessEvent(pAd, IW_CONFLICT_SSID_EVENT_FLAG + k, NULL, i, RssiOfSpoofedFrame[k]);
|
||||
/*DBGPRINT(RT_DEBUG_TRACE, ("spoofed attack event(%d) - %d\n", IW_CONFLICT_SSID_EVENT_FLAG + k, SpoofedFrameCount[k])); */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif /* SYSTEM_LOG_SUPPORT */
|
||||
|
||||
VOID RTMPClearAllIdsCounter(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
INT i;
|
||||
|
||||
pAd->ApCfg.RcvdAuthCount = 0;
|
||||
pAd->ApCfg.RcvdAssocReqCount = 0;
|
||||
pAd->ApCfg.RcvdReassocReqCount = 0;
|
||||
pAd->ApCfg.RcvdProbeReqCount = 0;
|
||||
pAd->ApCfg.RcvdDisassocCount = 0;
|
||||
pAd->ApCfg.RcvdDeauthCount = 0;
|
||||
pAd->ApCfg.RcvdEapReqCount = 0;
|
||||
pAd->ApCfg.RcvdMaliciousDataCount = 0;
|
||||
|
||||
for (i = 0; i < pAd->ApCfg.BssidNum; i++)
|
||||
{
|
||||
pAd->ApCfg.MBSSID[i].RcvdConflictSsidCount = 0;
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedAssocRespCount = 0;
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedReassocRespCount = 0;
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedProbeRespCount = 0;
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedBeaconCount = 0;
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedDisassocCount = 0;
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedAuthCount = 0;
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedDeauthCount = 0;
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedUnknownMgmtCount = 0;
|
||||
pAd->ApCfg.MBSSID[i].RcvdReplayAttackCount = 0;
|
||||
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdConflictSsid = 0;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedAssocResp = 0;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedReassocResp = 0;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedProbeResp = 0;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedBeacon = 0;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedDisassoc = 0;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedAuth = 0;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedDeauth = 0;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedUnknownMgmt = 0;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdReplayAttack = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
VOID RTMPIdsPeriodicExec(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
{
|
||||
PRTMP_ADAPTER pAd = (RTMP_ADAPTER *)FunctionContext;
|
||||
|
||||
pAd->ApCfg.IDSTimerRunning = FALSE;
|
||||
|
||||
#ifdef SYSTEM_LOG_SUPPORT
|
||||
/* when IDS occured, send out wireless event */
|
||||
if (pAd->CommonCfg.bWirelessEvent)
|
||||
RTMPHandleIdsEvent(pAd);
|
||||
#endif /* SYSTEM_LOG_SUPPORT */
|
||||
|
||||
/* clear all IDS counter */
|
||||
RTMPClearAllIdsCounter(pAd);
|
||||
|
||||
/* set timer */
|
||||
if (pAd->ApCfg.IdsEnable)
|
||||
{
|
||||
RTMPSetTimer(&pAd->ApCfg.IDSTimer, IDS_EXEC_INTV);
|
||||
pAd->ApCfg.IDSTimerRunning = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
This routine is used to check if a rogue AP sent an 802.11 management
|
||||
frame to a client using our BSSID.
|
||||
|
||||
Arguments:
|
||||
pAd - Pointer to our adapter
|
||||
pHeader - Pointer to 802.11 header
|
||||
|
||||
Return Value:
|
||||
TRUE - This is a spoofed frame
|
||||
FALSE - This isn't a spoofed frame
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
BOOLEAN RTMPSpoofedMgmtDetection(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN HEADER_802_11 *pHeader,
|
||||
IN RX_BLK *rxblk)
|
||||
{
|
||||
INT i;
|
||||
|
||||
for (i = 0; i < pAd->ApCfg.BssidNum; i++)
|
||||
{
|
||||
/* Spoofed BSSID detection */
|
||||
if (NdisEqualMemory(pHeader->Addr2, pAd->ApCfg.MBSSID[i].wdev.bssid, MAC_ADDR_LEN))
|
||||
{
|
||||
CHAR RcvdRssi;
|
||||
struct raw_rssi_info rssi_info;
|
||||
|
||||
rssi_info.raw_rssi[0] = rxblk->rx_signal.raw_rssi[0];
|
||||
rssi_info.raw_rssi[1] = rxblk->rx_signal.raw_rssi[1];
|
||||
rssi_info.raw_rssi[2] = rxblk->rx_signal.raw_rssi[2];
|
||||
RcvdRssi = RTMPMaxRssi(pAd,
|
||||
ConvertToRssi(pAd, &rssi_info, RSSI_IDX_0),
|
||||
ConvertToRssi(pAd, &rssi_info, RSSI_IDX_1),
|
||||
ConvertToRssi(pAd, &rssi_info, RSSI_IDX_2));
|
||||
|
||||
switch (pHeader->FC.SubType)
|
||||
{
|
||||
case SUBTYPE_ASSOC_RSP:
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedAssocRespCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedAssocResp = RcvdRssi;
|
||||
break;
|
||||
|
||||
case SUBTYPE_REASSOC_RSP:
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedReassocRespCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedReassocResp = RcvdRssi;
|
||||
break;
|
||||
|
||||
case SUBTYPE_PROBE_RSP:
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedProbeRespCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedProbeResp = RcvdRssi;
|
||||
break;
|
||||
|
||||
case SUBTYPE_BEACON:
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedBeaconCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedBeacon = RcvdRssi;
|
||||
break;
|
||||
|
||||
case SUBTYPE_DISASSOC:
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedDisassocCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedDisassoc = RcvdRssi;
|
||||
break;
|
||||
|
||||
case SUBTYPE_AUTH:
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedAuthCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedAuth = RcvdRssi;
|
||||
break;
|
||||
|
||||
case SUBTYPE_DEAUTH:
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedDeauthCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedDeauth = RcvdRssi;
|
||||
break;
|
||||
|
||||
default:
|
||||
pAd->ApCfg.MBSSID[i].RcvdSpoofedUnknownMgmtCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdSpoofedUnknownMgmt = RcvdRssi;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
VOID RTMPConflictSsidDetection(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pSsid,
|
||||
IN UCHAR SsidLen,
|
||||
IN CHAR Rssi0,
|
||||
IN CHAR Rssi1,
|
||||
IN CHAR Rssi2)
|
||||
{
|
||||
INT i;
|
||||
|
||||
for (i = 0; i < pAd->ApCfg.BssidNum; i++)
|
||||
{
|
||||
/* Conflict SSID detection */
|
||||
if (SSID_EQUAL(pSsid, SsidLen, pAd->ApCfg.MBSSID[i].Ssid, pAd->ApCfg.MBSSID[i].SsidLen))
|
||||
{
|
||||
CHAR RcvdRssi;
|
||||
struct raw_rssi_info rssi_info;
|
||||
|
||||
rssi_info.raw_rssi[0] = Rssi0;
|
||||
rssi_info.raw_rssi[1] = Rssi1;
|
||||
rssi_info.raw_rssi[2] = Rssi2;
|
||||
|
||||
RcvdRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, &rssi_info, RSSI_IDX_0),
|
||||
ConvertToRssi(pAd, &rssi_info, RSSI_IDX_1),
|
||||
ConvertToRssi(pAd, &rssi_info, RSSI_IDX_2));
|
||||
|
||||
pAd->ApCfg.MBSSID[i].RcvdConflictSsidCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdConflictSsid = RcvdRssi;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN RTMPReplayAttackDetection(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN UCHAR *pAddr2,
|
||||
IN RX_BLK *rxblk)
|
||||
{
|
||||
INT i;
|
||||
|
||||
for (i = 0; i < pAd->ApCfg.BssidNum; i++)
|
||||
{
|
||||
/* Conflict SSID detection */
|
||||
if (NdisEqualMemory(pAddr2, pAd->ApCfg.MBSSID[i].wdev.bssid, MAC_ADDR_LEN))
|
||||
{
|
||||
CHAR RcvdRssi;
|
||||
struct raw_rssi_info rssi_info;
|
||||
|
||||
rssi_info.raw_rssi[0] = rxblk->rx_signal.raw_rssi[0];
|
||||
rssi_info.raw_rssi[1] = rxblk->rx_signal.raw_rssi[1];
|
||||
rssi_info.raw_rssi[2] = rxblk->rx_signal.raw_rssi[2];
|
||||
|
||||
RcvdRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, &rssi_info, RSSI_IDX_0),
|
||||
ConvertToRssi(pAd, &rssi_info, RSSI_IDX_1),
|
||||
ConvertToRssi(pAd, &rssi_info, RSSI_IDX_2));
|
||||
|
||||
pAd->ApCfg.MBSSID[i].RcvdReplayAttackCount ++;
|
||||
pAd->ApCfg.MBSSID[i].RssiOfRcvdReplayAttack = RcvdRssi;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID RTMPUpdateStaMgmtCounter(RTMP_ADAPTER *pAd, USHORT type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SUBTYPE_ASSOC_REQ:
|
||||
pAd->ApCfg.RcvdAssocReqCount ++;
|
||||
break;
|
||||
|
||||
case SUBTYPE_REASSOC_REQ:
|
||||
pAd->ApCfg.RcvdReassocReqCount ++;
|
||||
break;
|
||||
|
||||
case SUBTYPE_PROBE_REQ:
|
||||
pAd->ApCfg.RcvdProbeReqCount ++;
|
||||
break;
|
||||
|
||||
case SUBTYPE_DISASSOC:
|
||||
pAd->ApCfg.RcvdDisassocCount ++;
|
||||
break;
|
||||
|
||||
case SUBTYPE_DEAUTH:
|
||||
pAd->ApCfg.RcvdDeauthCount ++;
|
||||
break;
|
||||
|
||||
case SUBTYPE_AUTH:
|
||||
pAd->ApCfg.RcvdAuthCount ++;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("RcvdAssocReqCount=%d\n", pAd->ApCfg.RcvdAssocReqCount));
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("RcvdReassocReqCount=%d\n", pAd->ApCfg.RcvdReassocReqCount));
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("RcvdProbeReqCount=%d\n", pAd->ApCfg.RcvdProbeReqCount));
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("RcvdDisassocCount=%d\n", pAd->ApCfg.RcvdDisassocCount));
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("RcvdDeauthCount=%d\n", pAd->ApCfg.RcvdDeauthCount));
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("RcvdAuthCount=%d\n", pAd->ApCfg.RcvdAuthCount));
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
VOID rtmp_read_ids_from_file(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
RTMP_STRING *tmpbuf,
|
||||
RTMP_STRING *buffer)
|
||||
{
|
||||
/*IdsEnable */
|
||||
if(RTMPGetKeyParameter("IdsEnable", tmpbuf, 10, buffer, TRUE))
|
||||
{
|
||||
if (simple_strtol(tmpbuf, 0, 10) == 1)
|
||||
pAd->ApCfg.IdsEnable = TRUE;
|
||||
else
|
||||
pAd->ApCfg.IdsEnable = FALSE;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("IDS is %s\n", pAd->ApCfg.IdsEnable ? "enabled" : "disabled"));
|
||||
}
|
||||
|
||||
/*AuthFloodThreshold */
|
||||
if(RTMPGetKeyParameter("AuthFloodThreshold", tmpbuf, 10, buffer, TRUE))
|
||||
{
|
||||
pAd->ApCfg.AuthFloodThreshold = simple_strtol(tmpbuf, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AuthFloodThreshold = %d\n", pAd->ApCfg.AuthFloodThreshold));
|
||||
}
|
||||
|
||||
/*AssocReqFloodThreshold */
|
||||
if(RTMPGetKeyParameter("AssocReqFloodThreshold", tmpbuf, 10, buffer, TRUE))
|
||||
{
|
||||
pAd->ApCfg.AssocReqFloodThreshold = simple_strtol(tmpbuf, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AssocReqFloodThreshold = %d\n", pAd->ApCfg.AssocReqFloodThreshold));
|
||||
}
|
||||
|
||||
/*ReassocReqFloodThreshold */
|
||||
if(RTMPGetKeyParameter("ReassocReqFloodThreshold", tmpbuf, 10, buffer, TRUE))
|
||||
{
|
||||
pAd->ApCfg.ReassocReqFloodThreshold = simple_strtol(tmpbuf, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("ReassocReqFloodThreshold = %d\n", pAd->ApCfg.ReassocReqFloodThreshold));
|
||||
}
|
||||
|
||||
/*ProbeReqFloodThreshold */
|
||||
if(RTMPGetKeyParameter("ProbeReqFloodThreshold", tmpbuf, 10, buffer, TRUE))
|
||||
{
|
||||
pAd->ApCfg.ProbeReqFloodThreshold = simple_strtol(tmpbuf, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("ProbeReqFloodThreshold = %d\n", pAd->ApCfg.ProbeReqFloodThreshold));
|
||||
}
|
||||
|
||||
/*DisassocFloodThreshold */
|
||||
if(RTMPGetKeyParameter("DisassocFloodThreshold", tmpbuf, 10, buffer, TRUE))
|
||||
{
|
||||
pAd->ApCfg.DisassocFloodThreshold = simple_strtol(tmpbuf, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("DisassocFloodThreshold = %d\n", pAd->ApCfg.DisassocFloodThreshold));
|
||||
}
|
||||
|
||||
/*DeauthFloodThreshold */
|
||||
if(RTMPGetKeyParameter("DeauthFloodThreshold", tmpbuf, 10, buffer, TRUE))
|
||||
{
|
||||
pAd->ApCfg.DeauthFloodThreshold = simple_strtol(tmpbuf, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("DeauthFloodThreshold = %d\n", pAd->ApCfg.DeauthFloodThreshold));
|
||||
}
|
||||
|
||||
/*EapReqFloodThreshold */
|
||||
if(RTMPGetKeyParameter("EapReqFloodThreshold", tmpbuf, 10, buffer, TRUE))
|
||||
{
|
||||
pAd->ApCfg.EapReqFloodThreshold = simple_strtol(tmpbuf, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("EapReqFloodThreshold = %d\n", pAd->ApCfg.EapReqFloodThreshold));
|
||||
}
|
||||
|
||||
/* DataFloodThreshold */
|
||||
if(RTMPGetKeyParameter("DataFloodThreshold", tmpbuf, 10, buffer, TRUE))
|
||||
{
|
||||
pAd->ApCfg.DataFloodThreshold = simple_strtol(tmpbuf, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("DataFloodThreshold = %d\n", pAd->ApCfg.DataFloodThreshold));
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* IDS_SUPPORT */
|
||||
454
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_mbss.c
Normal file
454
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_mbss.c
Normal file
@ -0,0 +1,454 @@
|
||||
/****************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Abstract:
|
||||
|
||||
Support multi-BSS function.
|
||||
|
||||
Note:
|
||||
1. Call RT28xx_MBSS_Init() in init function and
|
||||
call RT28xx_MBSS_Remove() in close function
|
||||
|
||||
2. MAC of different BSS is initialized in APStartUp()
|
||||
|
||||
3. BSS Index (0 ~ 15) of different rx packet is got in
|
||||
|
||||
4. BSS Index (0 ~ 15) of different tx packet is assigned in
|
||||
|
||||
5. BSS Index (0 ~ 15) of different BSS is got in APHardTransmit() by using
|
||||
|
||||
6. BSS Index (0 ~ 15) of IOCTL command is put in pAd->OS_Cookie->ioctl_if
|
||||
|
||||
7. Beacon of different BSS is enabled in APMakeAllBssBeacon() by writing 1
|
||||
to the register MAC_BSSID_DW1
|
||||
|
||||
8. The number of MBSS can be 1, 2, 4, or 8
|
||||
|
||||
***************************************************************************/
|
||||
#ifdef MBSS_SUPPORT
|
||||
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
|
||||
/* --------------------------------- Public -------------------------------- */
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Initialize Multi-BSS function.
|
||||
|
||||
Arguments:
|
||||
pAd points to our adapter
|
||||
pDevMain points to the main BSS network interface
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
1. Only create and initialize virtual network interfaces.
|
||||
2. No main network interface here.
|
||||
3. If you down ra0 and modify the BssNum of RT2860AP.dat/RT2870AP.dat,
|
||||
it will not work! You must rmmod rt2860ap.ko and lsmod rt2860ap.ko again.
|
||||
========================================================================
|
||||
*/
|
||||
VOID MBSS_Init(RTMP_ADAPTER *pAd, RTMP_OS_NETDEV_OP_HOOK *pNetDevOps)
|
||||
{
|
||||
#define MBSS_MAX_DEV_NUM 32
|
||||
PNET_DEV pDevNew;
|
||||
INT32 IdBss, MaxNumBss;
|
||||
//INT status;
|
||||
RTMP_OS_NETDEV_OP_HOOK netDevHook;
|
||||
|
||||
/* sanity check to avoid redundant virtual interfaces are created */
|
||||
if (pAd->FlgMbssInit != FALSE)
|
||||
return;
|
||||
|
||||
|
||||
MaxNumBss = pAd->ApCfg.BssidNum;
|
||||
if (MaxNumBss > MAX_MBSSID_NUM(pAd))
|
||||
MaxNumBss = MAX_MBSSID_NUM(pAd);
|
||||
|
||||
/* first IdBss must not be 0 (BSS0), must be 1 (BSS1) */
|
||||
for(IdBss=FIRST_MBSSID; IdBss<MAX_MBSSID_NUM(pAd); IdBss++)
|
||||
pAd->ApCfg.MBSSID[IdBss].wdev.if_dev = NULL;
|
||||
|
||||
/* create virtual network interface */
|
||||
for(IdBss=FIRST_MBSSID; IdBss<MaxNumBss; IdBss++)
|
||||
{
|
||||
struct wifi_dev *wdev;
|
||||
UINT32 MC_RowID = 0, IoctlIF = 0;
|
||||
char *dev_name;
|
||||
#ifdef MULTIPLE_CARD_SUPPORT
|
||||
MC_RowID = pAd->MC_RowID;
|
||||
#endif /* MULTIPLE_CARD_SUPPORT */
|
||||
#ifdef HOSTAPD_SUPPORT
|
||||
IoctlIF = pAd->IoctlIF;
|
||||
#endif /* HOSTAPD_SUPPORT */
|
||||
BSS_STRUCT *pMbss;
|
||||
|
||||
dev_name = get_dev_name_prefix(pAd, INT_MBSSID);
|
||||
pDevNew = RtmpOSNetDevCreate(MC_RowID, &IoctlIF, INT_MBSSID, IdBss, sizeof(struct mt_dev_priv), dev_name);
|
||||
#ifdef HOSTAPD_SUPPORT
|
||||
pAd->IoctlIF = IoctlIF;
|
||||
#endif /* HOSTAPD_SUPPORT */
|
||||
if (pDevNew == NULL)
|
||||
{
|
||||
pAd->ApCfg.BssidNum = IdBss; /* re-assign new MBSS number */
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Register MBSSID IF (%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pDevNew)));
|
||||
}
|
||||
|
||||
pMbss = &pAd->ApCfg.MBSSID[IdBss];
|
||||
wdev = &pAd->ApCfg.MBSSID[IdBss].wdev;
|
||||
wdev->wdev_type = WDEV_TYPE_AP;
|
||||
wdev->func_dev = &pAd->ApCfg.MBSSID[IdBss];
|
||||
wdev->func_idx = IdBss;
|
||||
wdev->sys_handle = (void *)pAd;
|
||||
wdev->if_dev = pDevNew;
|
||||
if (rtmp_wdev_idx_reg(pAd, wdev) < 0) {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("Assign wdev idx for %s failed, free net device!\n",
|
||||
RTMP_OS_NETDEV_GET_DEVNAME(pDevNew)));
|
||||
RtmpOSNetDevFree(pDevNew);
|
||||
break;
|
||||
}
|
||||
wdev->tx_pkt_allowed = ApAllowToSendPacket;
|
||||
wdev->tx_pkt_handle = APSendPacket;
|
||||
wdev->wdev_hard_tx = APHardTransmit;
|
||||
|
||||
wdev->rx_pkt_allowed = ap_rx_pkt_allow;
|
||||
wdev->rx_ps_handle = ap_rx_ps_handle;
|
||||
wdev->rx_pkt_foward = ap_rx_foward_handle;
|
||||
|
||||
RTMP_OS_NETDEV_SET_PRIV(pDevNew, pAd);
|
||||
RTMP_OS_NETDEV_SET_WDEV(pDevNew, wdev);
|
||||
|
||||
/* init operation functions and flags */
|
||||
NdisCopyMemory(&netDevHook, pNetDevOps, sizeof(netDevHook));
|
||||
|
||||
netDevHook.priv_flags = INT_MBSSID;
|
||||
netDevHook.needProtcted = TRUE;
|
||||
netDevHook.wdev = wdev;
|
||||
|
||||
/* Init MAC address of virtual network interface */
|
||||
NdisMoveMemory(&netDevHook.devAddr[0], &wdev->bssid[0], MAC_ADDR_LEN);
|
||||
|
||||
/* register this device to OS */
|
||||
/*status =*/ RtmpOSNetDevAttach(pAd->OpMode, pDevNew, &netDevHook);
|
||||
ASSERT(pMbss);
|
||||
if (pMbss) {
|
||||
wdev_bcn_buf_init(pAd, &pMbss->bcn_buf);
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s():func_dev is NULL!\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pAd->FlgMbssInit = TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Remove Multi-BSS network interface.
|
||||
|
||||
Arguments:
|
||||
pAd points to our adapter
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
FIRST_MBSSID = 1
|
||||
Main BSS is not removed here.
|
||||
========================================================================
|
||||
*/
|
||||
VOID MBSS_Remove(RTMP_ADAPTER *pAd)
|
||||
{
|
||||
struct wifi_dev *wdev;
|
||||
UINT IdBss;
|
||||
BSS_STRUCT *pMbss;
|
||||
|
||||
|
||||
|
||||
for(IdBss=FIRST_MBSSID; IdBss<MAX_MBSSID_NUM(pAd); IdBss++)
|
||||
{
|
||||
wdev = &pAd->ApCfg.MBSSID[IdBss].wdev;
|
||||
pMbss = &pAd->ApCfg.MBSSID[IdBss];
|
||||
if (pMbss) {
|
||||
wdev_bcn_buf_deinit(pAd, &pMbss->bcn_buf);
|
||||
}
|
||||
if (wdev->if_dev)
|
||||
{
|
||||
RtmpOSNetDevProtect(1);
|
||||
RtmpOSNetDevDetach(wdev->if_dev);
|
||||
RtmpOSNetDevProtect(0);
|
||||
rtmp_wdev_idx_unreg(pAd, wdev);
|
||||
RtmpOSNetDevFree(wdev->if_dev);
|
||||
wdev->if_dev = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Get multiple bss idx.
|
||||
|
||||
Arguments:
|
||||
pAd points to our adapter
|
||||
pDev which WLAN network interface
|
||||
|
||||
Return Value:
|
||||
0: close successfully
|
||||
otherwise: close fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT32 RT28xx_MBSS_IdxGet(RTMP_ADAPTER *pAd, PNET_DEV pDev)
|
||||
{
|
||||
INT32 BssId = -1;
|
||||
INT32 IdBss;
|
||||
|
||||
|
||||
for(IdBss=0; IdBss<pAd->ApCfg.BssidNum; IdBss++)
|
||||
{
|
||||
if (pAd->ApCfg.MBSSID[IdBss].wdev.if_dev == pDev)
|
||||
{
|
||||
BssId = IdBss;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return BssId;
|
||||
}
|
||||
|
||||
#ifdef MT_MAC
|
||||
INT32 mbss_cr_enable(PNET_DEV pDev)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
INT BssId;
|
||||
UINT32 Value = 0;
|
||||
//register for sub Bssid start from 0x603000a0
|
||||
UINT32 bssid_reg_base = LPON_SBTOR1;
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(pDev);
|
||||
BssId = RT28xx_MBSS_IdxGet(pAd, pDev);
|
||||
printk("##### %s, BssId = %d\n", __func__, BssId);
|
||||
if (BssId < 0)
|
||||
return -1;
|
||||
|
||||
if (pAd->chipCap.hif_type != HIF_MT)
|
||||
return 0;
|
||||
|
||||
|
||||
if (BssId >= 1) {
|
||||
//if there is any sub bssid is enable. this bit in LPON_SBTOR1 shall be 1 always.
|
||||
RTMP_IO_READ32(pAd, bssid_reg_base, &Value);
|
||||
Value |= SBSS_TBTT0_TSF0_EN;
|
||||
RTMP_IO_WRITE32(pAd, bssid_reg_base, Value);
|
||||
|
||||
RTMP_IO_READ32(pAd, (bssid_reg_base + (BssId - 1) * (0x4)), &Value);
|
||||
Value = 0;
|
||||
Value &= ~SUB_BSSID0_TIME_OFFSET_n_MASK;
|
||||
Value |= SUB_BSSID0_TIME_OFFSET_n(BssId * (20 + 4096));
|
||||
|
||||
/* SIFS time, 20us, and assume bcn len is 512 byte, tx by 1Mbps.*/
|
||||
Value |= TBTT0_n_INT_EN;
|
||||
Value |= PRE_TBTT0_n_INT_EN;
|
||||
Value |= SBSS_TBTT0_TSF0_EN;
|
||||
|
||||
RTMP_IO_WRITE32(pAd, (bssid_reg_base + (BssId - 1) * (0x4)), Value);
|
||||
|
||||
/* Start Beacon Queue */
|
||||
RTMP_IO_READ32(pAd, ARB_BCNQCR0, &Value);
|
||||
Value |= (0x1 << (BssId+15));
|
||||
RTMP_IO_WRITE32(pAd, ARB_BCNQCR0, Value);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT mbss_cr_disable(PNET_DEV pDev)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
INT BssId;
|
||||
UINT32 Value;
|
||||
UINT32 bssid_reg_base = LPON_SBTOR1;
|
||||
UCHAR loop = 0;
|
||||
BOOLEAN any_mbss_enable = FALSE;
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(pDev);
|
||||
BssId = RT28xx_MBSS_IdxGet(pAd, pDev);
|
||||
if (BssId < 0)
|
||||
return -1;
|
||||
|
||||
if (pAd->chipCap.hif_type != HIF_MT)
|
||||
return 0;
|
||||
|
||||
for (loop = 1; loop < pAd->ApCfg.BssidNum; loop++) {
|
||||
if (loop == BssId)
|
||||
continue;//skip itself.
|
||||
if (pAd->ApCfg.MBSSID[loop].bcn_buf.bBcnSntReq == TRUE)
|
||||
any_mbss_enable = TRUE;
|
||||
}
|
||||
|
||||
if (BssId >= 1) {
|
||||
RTMP_IO_READ32(pAd, (bssid_reg_base + (BssId - 1) * (0x4)), &Value);
|
||||
Value = 0;
|
||||
Value &= ~SUB_BSSID0_TIME_OFFSET_n_MASK;
|
||||
Value |= SUB_BSSID0_TIME_OFFSET_n(BssId * (20 + 4096));
|
||||
Value &= ~TBTT0_n_INT_EN;
|
||||
Value &= ~PRE_TBTT0_n_INT_EN;
|
||||
if (any_mbss_enable == TRUE)
|
||||
Value |= SBSS_TBTT0_TSF0_EN;
|
||||
else
|
||||
Value &= ~SBSS_TBTT0_TSF0_EN;
|
||||
RTMP_IO_WRITE32(pAd, (bssid_reg_base + (BssId - 1) * (0x4)), Value);
|
||||
RTMP_IO_READ32(pAd, ARB_BCNQCR0, &Value);
|
||||
Value &= ~(0x1 << (BssId+15));
|
||||
RTMP_IO_WRITE32(pAd, ARB_BCNQCR0, Value);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* MT_MAC */
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Open a virtual network interface.
|
||||
|
||||
Arguments:
|
||||
pDev which WLAN network interface
|
||||
|
||||
Return Value:
|
||||
0: open successfully
|
||||
otherwise: open fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT32 MBSS_Open(PNET_DEV pDev)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
INT BssId;
|
||||
UINT32 u4MaxMBSSIDSize;
|
||||
|
||||
u4MaxMBSSIDSize = sizeof(pAd->ApCfg.MBSSID)/sizeof(pAd->ApCfg.MBSSID[0]);
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(pDev);
|
||||
BssId = RT28xx_MBSS_IdxGet(pAd, pDev);
|
||||
if (BssId < 0)
|
||||
return -1;
|
||||
|
||||
if(BssId >= u4MaxMBSSIDSize)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s(): Over buffer size!\n", __FUNCTION__));
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef AIRPLAY_SUPPORT
|
||||
if (AIRPLAY_ON(pAd))
|
||||
pAd->ApCfg.MBSSID[BssId].bcn_buf.bBcnSntReq = TRUE;
|
||||
else
|
||||
pAd->ApCfg.MBSSID[BssId].bcn_buf.bBcnSntReq = FALSE;
|
||||
#else
|
||||
pAd->ApCfg.MBSSID[BssId].bcn_buf.bBcnSntReq = TRUE;
|
||||
#endif /* AIRPLAY_SUPPORT */
|
||||
|
||||
#ifdef BAND_STEERING
|
||||
if(pAd->ApCfg.BandSteering)
|
||||
{
|
||||
PBND_STRG_CLI_TABLE table;
|
||||
table = Get_BndStrgTable(pAd, BssId);
|
||||
if(table)
|
||||
{
|
||||
/* Inform daemon interface ready */
|
||||
BndStrg_SetInfFlags(pAd, &pAd->ApCfg.MBSSID[BssId].wdev, table, TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Close a virtual network interface.
|
||||
|
||||
Arguments:
|
||||
pDev which WLAN network interface
|
||||
|
||||
Return Value:
|
||||
0: close successfully
|
||||
otherwise: close fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT MBSS_Close(PNET_DEV pDev)
|
||||
{
|
||||
PRTMP_ADAPTER pAd;
|
||||
INT BssId;
|
||||
UINT32 u4MaxMBSSIDSize;
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(pDev);
|
||||
BssId = RT28xx_MBSS_IdxGet(pAd, pDev);
|
||||
if (BssId < 0)
|
||||
return -1;
|
||||
|
||||
RTMP_OS_NETDEV_STOP_QUEUE(pDev);
|
||||
|
||||
/* kick out all stas behind the Bss */
|
||||
MbssKickOutStas(pAd, BssId, REASON_DISASSOC_INACTIVE);
|
||||
|
||||
u4MaxMBSSIDSize = sizeof(pAd->ApCfg.MBSSID)/sizeof(pAd->ApCfg.MBSSID[0]);
|
||||
if(BssId >= u4MaxMBSSIDSize)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s(): Over buffer size!\n", __FUNCTION__));
|
||||
return -1;
|
||||
}
|
||||
|
||||
pAd->ApCfg.MBSSID[BssId].bcn_buf.bBcnSntReq = FALSE;
|
||||
|
||||
|
||||
APMakeAllBssBeacon(pAd);
|
||||
APUpdateAllBeaconFrame(pAd);
|
||||
|
||||
#ifdef BAND_STEERING
|
||||
if(pAd->ApCfg.BandSteering)
|
||||
{
|
||||
PBND_STRG_CLI_TABLE table;
|
||||
table = Get_BndStrgTable(pAd, BssId);
|
||||
if(table)
|
||||
{
|
||||
/* Inform daemon interface down */
|
||||
BndStrg_SetInfFlags(pAd, &pAd->ApCfg.MBSSID[BssId].wdev, table, FALSE);
|
||||
}
|
||||
}
|
||||
#endif /* BAND_STEERING */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* MBSS_SUPPORT */
|
||||
|
||||
@ -0,0 +1,202 @@
|
||||
/****************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Abstract:
|
||||
|
||||
Support multi-BSS function.
|
||||
|
||||
Note:
|
||||
1. Call RT28xx_MBSS_Init() in init function and
|
||||
call RT28xx_MBSS_Remove() in close function
|
||||
|
||||
2. MAC of different BSS is initialized in APStartUp()
|
||||
|
||||
3. BSS Index (0 ~ 15) of different rx packet is got in
|
||||
|
||||
4. BSS Index (0 ~ 15) of different tx packet is assigned in
|
||||
|
||||
5. BSS Index (0 ~ 15) of different BSS is got in APHardTransmit() by using
|
||||
|
||||
6. BSS Index (0 ~ 15) of IOCTL command is put in pAd->OS_Cookie->ioctl_if
|
||||
|
||||
7. Beacon of different BSS is enabled in APMakeAllBssBeacon() by writing 1
|
||||
to the register MAC_BSSID_DW1
|
||||
|
||||
8. The number of MBSS can be 1, 2, 4, or 8
|
||||
|
||||
***************************************************************************/
|
||||
#define RTMP_MODULE_OS
|
||||
|
||||
#ifdef MBSS_SUPPORT
|
||||
|
||||
/*#include "rt_config.h" */
|
||||
#include "rtmp_comm.h"
|
||||
#include "rt_os_util.h"
|
||||
#include "rt_os_net.h"
|
||||
|
||||
|
||||
/* --------------------------------- Public -------------------------------- */
|
||||
NET_DEV_STATS *RT28xx_get_ether_stats(PNET_DEV net_dev);
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Initialize Multi-BSS function.
|
||||
|
||||
Arguments:
|
||||
pAd points to our adapter
|
||||
pDevMain points to the main BSS network interface
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
1. Only create and initialize virtual network interfaces.
|
||||
2. No main network interface here.
|
||||
3. If you down ra0 and modify the BssNum of RT2860AP.dat/RT2870AP.dat,
|
||||
it will not work! You must rmmod rt2860ap.ko and lsmod rt2860ap.ko again.
|
||||
========================================================================
|
||||
*/
|
||||
VOID RT28xx_MBSS_Init(VOID *pAd, PNET_DEV pDevMain)
|
||||
{
|
||||
RTMP_OS_NETDEV_OP_HOOK netDevHook;
|
||||
|
||||
NdisZeroMemory(&netDevHook, sizeof(netDevHook));
|
||||
netDevHook.open = MBSS_VirtualIF_Open; /* device opem hook point */
|
||||
netDevHook.stop = MBSS_VirtualIF_Close; /* device close hook point */
|
||||
netDevHook.xmit = rt28xx_send_packets; /* hard transmit hook point */
|
||||
netDevHook.ioctl = rt28xx_ioctl; /* ioctl hook point */
|
||||
netDevHook.get_stats = RT28xx_get_ether_stats;
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_MBSS_INIT,
|
||||
0, &netDevHook, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Remove Multi-BSS network interface.
|
||||
|
||||
Arguments:
|
||||
pAd points to our adapter
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
FIRST_MBSSID = 1
|
||||
Main BSS is not removed here.
|
||||
========================================================================
|
||||
*/
|
||||
VOID RT28xx_MBSS_Remove(VOID *pAd)
|
||||
{
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_MBSS_REMOVE, 0, NULL, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* --------------------------------- Private -------------------------------- */
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Open a virtual network interface.
|
||||
|
||||
Arguments:
|
||||
pDev which WLAN network interface
|
||||
|
||||
Return Value:
|
||||
0: open successfully
|
||||
otherwise: open fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT MBSS_VirtualIF_Open(PNET_DEV pDev)
|
||||
{
|
||||
VOID *pAd;
|
||||
|
||||
/* increase MODULE use count */
|
||||
RT_MOD_INC_USE_COUNT();
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s: ===> MBSSVirtualIF_open\n", RTMP_OS_NETDEV_GET_DEVNAME(pDev)));
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(pDev);
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_MBSS_OPEN, 0, pDev, 0);
|
||||
|
||||
if (VIRTUAL_IF_UP(pAd) != 0)
|
||||
return -1;
|
||||
|
||||
#ifdef MT_MAC
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_MBSS_CR_ENABLE, 0, pDev, 0);
|
||||
#ifdef CONFIG_RA_HW_NAT_WIFI_NEW_ARCH
|
||||
RT_MOD_HNAT_REG(pDev);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
RTMP_OS_NETDEV_START_QUEUE(pDev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Close a virtual network interface.
|
||||
|
||||
Arguments:
|
||||
pDev which WLAN network interface
|
||||
|
||||
Return Value:
|
||||
0: close successfully
|
||||
otherwise: close fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT MBSS_VirtualIF_Close(PNET_DEV pDev)
|
||||
{
|
||||
VOID *pAd;
|
||||
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s: ===> MBSSVirtualIF_close\n", RTMP_OS_NETDEV_GET_DEVNAME(pDev)));
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(pDev);
|
||||
|
||||
#ifdef MT_MAC
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_MBSS_CR_DISABLE, 0, pDev, 0);
|
||||
#endif
|
||||
|
||||
RTMP_OS_NETDEV_STOP_QUEUE(pDev);
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_MBSS_CLOSE, 0, pDev, 0);
|
||||
|
||||
#ifdef CONFIG_RA_HW_NAT_WIFI_NEW_ARCH
|
||||
RT_MOD_HNAT_DEREG(pDev);
|
||||
#endif
|
||||
VIRTUAL_IF_DOWN(pAd);
|
||||
|
||||
RT_MOD_DEC_USE_COUNT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* MBSS_SUPPORT */
|
||||
|
||||
@ -0,0 +1,533 @@
|
||||
#include "rt_config.h"
|
||||
#include "mix_mode.h"
|
||||
|
||||
|
||||
static INT scan_ch_restore_for_MixMode(RTMP_ADAPTER *pAd, UCHAR OpMode)
|
||||
{
|
||||
INT bw, ch;
|
||||
|
||||
|
||||
if (pAd->CommonCfg.BBPCurrentBW != pAd->hw_cfg.bbp_bw)
|
||||
bbp_set_bw(pAd, pAd->hw_cfg.bbp_bw);
|
||||
|
||||
#ifdef DOT11_VHT_AC
|
||||
if (pAd->hw_cfg.bbp_bw == BW_80)
|
||||
ch = pAd->CommonCfg.vht_cent_ch;
|
||||
else
|
||||
#endif /* DOT11_VHT_AC */
|
||||
if (pAd->hw_cfg.bbp_bw == BW_40)
|
||||
ch = pAd->CommonCfg.CentralChannel;
|
||||
else
|
||||
ch = pAd->CommonCfg.Channel;
|
||||
|
||||
switch(pAd->CommonCfg.BBPCurrentBW)
|
||||
{
|
||||
case BW_80:
|
||||
bw = 80;
|
||||
break;
|
||||
case BW_40:
|
||||
bw = 40;
|
||||
break;
|
||||
case BW_10:
|
||||
bw = 10;
|
||||
break;
|
||||
case BW_20:
|
||||
default:
|
||||
bw =20;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
ASSERT((ch != 0));
|
||||
AsicSwitchChannel(pAd, ch, FALSE);
|
||||
AsicLockChannel(pAd, ch);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("SYNC - End of SCAN, restore to %dMHz channel %d, Total BSS[%02d]\n",
|
||||
bw, ch, pAd->ScanTab.BssNr));
|
||||
|
||||
|
||||
#ifdef CONFIG_AP_SUPPORT
|
||||
if (OpMode == OPMODE_AP)
|
||||
{
|
||||
#ifdef APCLI_SUPPORT
|
||||
#ifdef APCLI_AUTO_CONNECT_SUPPORT
|
||||
if (pAd->ApCfg.ApCliAutoConnectRunning == TRUE)
|
||||
{
|
||||
if (!ApCliAutoConnectExec(pAd))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("Error in %s\n", __FUNCTION__));
|
||||
}
|
||||
}
|
||||
#endif /* APCLI_AUTO_CONNECT_SUPPORT */
|
||||
#endif /* APCLI_SUPPORT */
|
||||
pAd->Mlme.ApSyncMachine.CurrState = AP_SYNC_IDLE;
|
||||
RTMPResumeMsduTransmission(pAd);
|
||||
|
||||
/* iwpriv set auto channel selection*/
|
||||
/* scanned all channels*/
|
||||
if (pAd->ApCfg.bAutoChannelAtBootup==TRUE)
|
||||
{
|
||||
pAd->CommonCfg.Channel = SelectBestChannel(pAd, pAd->ApCfg.AutoChannelAlg);
|
||||
pAd->ApCfg.bAutoChannelAtBootup = FALSE;
|
||||
#ifdef DOT11_N_SUPPORT
|
||||
N_ChannelCheck(pAd);
|
||||
#endif /* DOT11_N_SUPPORT */
|
||||
APStop(pAd);
|
||||
APStartUp(pAd);
|
||||
}
|
||||
|
||||
if (!((pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == TRUE) && (pAd->Dot11_H.RDMode != RD_NORMAL_MODE)))
|
||||
AsicEnableBssSync(pAd, pAd->CommonCfg.BeaconPeriod);
|
||||
}
|
||||
#endif /* CONFIG_AP_SUPPORT */
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN MixModeChannelCheck(IN PRTMP_ADAPTER pAd, UCHAR channel, struct wifi_dev *wdev)
|
||||
{
|
||||
|
||||
if(channel == 0) {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("%s pass a invalid channel\n", __FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*check channel in channel list*/
|
||||
if(ChannelSanity(pAd, channel) == 0) {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("the channel parameter is out of channel list\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*check channel & phy mode*/
|
||||
if((channel < 14 && WMODE_CAP_5G(wdev->PhyMode)) ||
|
||||
(channel > 14 && WMODE_CAP_2G(wdev->PhyMode))) {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("the channel parameter and phy mode is not matched\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static INT MixModeSwitchCH(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
UCHAR channel;
|
||||
struct wifi_dev *wdev;
|
||||
struct peer_info *mon_sta_info = &pAd->MixModeCtrl.sta_info[0];
|
||||
|
||||
if(pAd == NULL)
|
||||
return -1;
|
||||
|
||||
channel = pAd->MixModeCtrl.sta_info[0].channel;
|
||||
wdev = pAd->MixModeCtrl.pMixModewdev;
|
||||
|
||||
/*check channel with current band channel*/
|
||||
if(channel == wdev->channel) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("%s:: current channel is the sniffer set channel %d\n", __FUNCTION__, channel));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Disable BCN */
|
||||
AsicDisableSync(pAd);
|
||||
|
||||
/*need to poll tx Q unitl empty*/
|
||||
|
||||
/* Suspend MSDU transmission here */
|
||||
RTMPSuspendMsduTransmission(pAd);
|
||||
|
||||
bbp_set_bw(pAd, mon_sta_info->bw);
|
||||
|
||||
/*Switch Channel*/
|
||||
AsicSwitchChannel(pAd, mon_sta_info->center_channel, FALSE);
|
||||
AsicLockChannel(pAd, mon_sta_info->center_channel);
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF,
|
||||
("%s:: switch to channel %d\n", __FUNCTION__, channel));
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static CHAR MixModeCalcAvgRssi(RTMP_ADAPTER *pAd, UCHAR idx)
|
||||
{
|
||||
UCHAR mnt_idx = 0;
|
||||
LONG avgRssi = -127;
|
||||
|
||||
struct peer_info *sta = &pAd->MixModeCtrl.sta_info[mnt_idx];
|
||||
LONG mgmt_rssi = sta->mnt_sta.frm[FC_TYPE_MGMT].rssi;
|
||||
LONG data_rssi = sta->mnt_sta.frm[FC_TYPE_DATA].rssi;
|
||||
LONG cntl_rssi = sta->mnt_sta.frm[FC_TYPE_CNTL].rssi;
|
||||
LONG total = sta->mnt_sta.Count;
|
||||
|
||||
/*
|
||||
* weight * rssi
|
||||
* But need to check vaule
|
||||
* it cannot overflow
|
||||
*/
|
||||
if (total)
|
||||
avgRssi = (mgmt_rssi + data_rssi + cntl_rssi) / total;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF,
|
||||
("%s:: %02x:%02x:%02x:%02x:%02x:%02x, avgRssi=%ld\n", __FUNCTION__, PRINT_MAC(sta->mac_addr), avgRssi));
|
||||
|
||||
return avgRssi;
|
||||
}
|
||||
|
||||
static INT MixModeSniffer(RTMP_ADAPTER *pAd, UINT8 enable)
|
||||
{
|
||||
if (enable == TRUE)
|
||||
pAd->MixModeCtrl.current_monitor_mode = MIX_MODE_FULL;
|
||||
else if (enable == FALSE)
|
||||
pAd->MixModeCtrl.current_monitor_mode = MIX_MODE_OFF;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF,
|
||||
("%s(): set Current Monitor Mode = %d\n",
|
||||
__FUNCTION__, pAd->MixModeCtrl.current_monitor_mode));
|
||||
|
||||
switch(pAd->MixModeCtrl.current_monitor_mode)
|
||||
{
|
||||
/*reset to normal */
|
||||
case MIX_MODE_OFF:
|
||||
pAd->ApCfg.BssType = BSS_INFRA;
|
||||
AsicSetRxFilter(pAd);
|
||||
break;
|
||||
|
||||
/*fully report, Enable Rx with promiscuous reception*/
|
||||
case MIX_MODE_FULL:
|
||||
pAd->ApCfg.BssType = BSS_MONITOR;
|
||||
AsicSetRxFilter(pAd);
|
||||
break;
|
||||
default:
|
||||
DBGPRINT(RT_DEBUG_OFF,
|
||||
("MIX MODE index ONLY be set to 0 or 2\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//extern INT scan_ch_restore(RTMP_ADAPTER *pAd, UCHAR OpMode);
|
||||
|
||||
static VOID MixModeRestoreCH(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
if(pAd->MixModeCtrl.pMixModewdev != NULL &&
|
||||
(pAd->MixModeCtrl.sta_info[0].channel != (pAd->MixModeCtrl.pMixModewdev)->channel))
|
||||
/*scan ch restore for MixMode will do enable BCN*/
|
||||
scan_ch_restore_for_MixMode(pAd, OPMODE_AP);
|
||||
}
|
||||
|
||||
static VOID MixModeReset(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
pAd->MixModeCtrl.MixModeOn = FALSE;
|
||||
pAd->MixModeCtrl.pMixModewdev = NULL;
|
||||
pAd->MixModeCtrl.MixModeStatMachine.CurrState = MIX_MODE_STATE_INIT;
|
||||
pAd->MixModeCtrl.ioctl_if = -1;
|
||||
}
|
||||
|
||||
static VOID MixModeListenExit(RTMP_ADAPTER *pAd)
|
||||
{
|
||||
BOOLEAN disbleSniffer = FALSE;
|
||||
BOOLEAN mixmode_done = TRUE;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s()\n", __FUNCTION__));
|
||||
|
||||
if(MixModeSniffer(pAd,disbleSniffer) !=0)
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s fail by sniffer mode\n",__FUNCTION__));
|
||||
|
||||
MixModeRestoreCH(pAd);
|
||||
MixModeReset(pAd);
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s::Exit mix mode\n", __FUNCTION__));
|
||||
/* send event to userspace */
|
||||
RtmpOSWrielessEventSend(pAd->net_dev,
|
||||
RT_WLAN_EVENT_CUSTOM,
|
||||
RT_MIX_MODE_EVENT_FLAG,
|
||||
NULL,
|
||||
(char *)&mixmode_done,
|
||||
sizeof(mixmode_done));
|
||||
}
|
||||
|
||||
static VOID MixModeListenCancel(RTMP_ADAPTER *pAd,MLME_QUEUE_ELEM *pElem)
|
||||
{
|
||||
if(pAd == NULL)
|
||||
return;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s()\n", __FUNCTION__));
|
||||
|
||||
MixModeListenExit(pAd);
|
||||
}
|
||||
|
||||
|
||||
static VOID MixModeListenTimeout(RTMP_ADAPTER *pAd,MLME_QUEUE_ELEM *pElem)
|
||||
{
|
||||
if(pAd == NULL)
|
||||
return;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s()\n", __FUNCTION__));
|
||||
|
||||
MixModeListenExit(pAd);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static VOID MixModeEnterListen(RTMP_ADAPTER *pAd,MLME_QUEUE_ELEM *pElem)
|
||||
{
|
||||
INT32 ret;
|
||||
BOOLEAN enbleSniffer = TRUE;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s()\n", __FUNCTION__));
|
||||
|
||||
if(pAd == NULL)
|
||||
return;
|
||||
|
||||
/*switch channel*/
|
||||
ret = MixModeSwitchCH(pAd);
|
||||
if(ret != 0) {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("%s fail by switch channel\n",__FUNCTION__));
|
||||
MixModeReset(pAd);
|
||||
return;
|
||||
}
|
||||
|
||||
/*enter sniffer mode*/
|
||||
ret = MixModeSniffer(pAd,enbleSniffer);
|
||||
if(ret != 0) {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("%s fail by sniffer mode\n",__FUNCTION__));
|
||||
MixModeRestoreCH(pAd);
|
||||
MixModeReset(pAd);
|
||||
return;
|
||||
}
|
||||
pAd->MixModeCtrl.MixModeOn = TRUE;
|
||||
pAd->MixModeCtrl.MixModeStatMachine.CurrState = MIX_MODE_STATE_RUNNING;
|
||||
DBGPRINT(RT_DEBUG_OFF, ("pAd->MixModeCtrl.sta_info[0].duration = %d\n", pAd->MixModeCtrl.sta_info[0].duration));
|
||||
RTMPSetTimer(&pAd->MixModeCtrl.MixModeTimer, pAd->MixModeCtrl.sta_info[0].duration);
|
||||
}
|
||||
|
||||
static VOID MixModeStateMachineInit(IN RTMP_ADAPTER *pAd, IN STATE_MACHINE *Sm, OUT STATE_MACHINE_FUNC Trans[])
|
||||
{
|
||||
/*Init*/
|
||||
StateMachineInit(Sm,(STATE_MACHINE_FUNC *)Trans,MIX_MODE_STATE_MAX, MIX_MODE_MSG_MAX, (STATE_MACHINE_FUNC)Drop, MIX_MODE_STATE_INIT, MIX_MODE_STATE_BASE);
|
||||
|
||||
/*Idle*/
|
||||
StateMachineSetAction(Sm, MIX_MODE_STATE_INIT, MIX_MODE_MSG_LISTEN, (STATE_MACHINE_FUNC)MixModeEnterListen);
|
||||
/*Running*/
|
||||
StateMachineSetAction(Sm, MIX_MODE_STATE_RUNNING, MIX_MODE_MSG_CANCLE, (STATE_MACHINE_FUNC)MixModeListenCancel);
|
||||
StateMachineSetAction(Sm, MIX_MODE_STATE_RUNNING, MIX_MODE_MSG_TIMEOUT, (STATE_MACHINE_FUNC)MixModeListenTimeout);
|
||||
}
|
||||
|
||||
|
||||
VOID MixModeTimeout(IN PVOID SystemSpecific1, IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2, IN PVOID SystemSpecific3)
|
||||
{
|
||||
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)FunctionContext;
|
||||
if(pAd == NULL)
|
||||
return;
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s()\n", __FUNCTION__));
|
||||
|
||||
MlmeEnqueue(pAd, MIX_MODE_STATE_MACHINE, MIX_MODE_MSG_TIMEOUT, 0, NULL, 0);
|
||||
RTMP_MLME_HANDLER(pAd);
|
||||
}
|
||||
|
||||
VOID MixModeDebugInfo(IN PRTMP_ADAPTER pAd, IN int idx)
|
||||
{
|
||||
MIX_MODE_CTRL *MixModeCtrl = &pAd->MixModeCtrl;
|
||||
DBGPRINT(RT_DEBUG_OFF,
|
||||
("MixMode status = %d\nMixMode CurrState = %lu\nMixMode CH = %d\n"
|
||||
"targetMac = %02x:%02x:%02x:%02x:%02x:%02x\nMixMode Duration = %d\n",
|
||||
MixModeCtrl->MixModeOn, MixModeCtrl->MixModeStatMachine.CurrState,
|
||||
MixModeCtrl->sta_info[idx].channel,
|
||||
PRINT_MAC(MixModeCtrl->sta_info[idx].mac_addr),
|
||||
MixModeCtrl->sta_info[idx].duration));
|
||||
|
||||
}
|
||||
|
||||
VOID MixModeProcessData(RTMP_ADAPTER *pAd, void *rxBlk)
|
||||
{
|
||||
RX_BLK *pRxBlk = (RX_BLK*)rxBlk;
|
||||
PHEADER_802_11 pHeader;
|
||||
CHAR avg_rssi;
|
||||
struct peer_info *mon_sta_info = &pAd->MixModeCtrl.sta_info[0];
|
||||
FRAME_CONTROL *fc;
|
||||
struct MNT_STA_INFO *mnt_sta;
|
||||
|
||||
// DBGPRINT(RT_DEBUG_OFF, ("%s()\n", __FUNCTION__));
|
||||
|
||||
ASSERT(pRxBlk->pRxPacket);
|
||||
|
||||
pHeader = pRxBlk->pHeader;
|
||||
fc = &pHeader->FC;
|
||||
mnt_sta = &mon_sta_info->mnt_sta;
|
||||
|
||||
// DBGPRINT(RT_DEBUG_OFF, ("mon_sta_info->mac_addr = %02x:%02x:%02x:%02x:%02x:%02x\n", PRINT_MAC(mon_sta_info->mac_addr)));
|
||||
|
||||
if (NdisEqualMemory(pHeader->Addr2, mon_sta_info->mac_addr, MAC_ADDR_LEN)) {
|
||||
if (fc->Type == FC_TYPE_DATA)
|
||||
Update_Rssi_Sample(pAd, &mon_sta_info->RssiSample, &pRxBlk->rx_signal,
|
||||
pRxBlk->rx_rate.field.MODE, pRxBlk->rx_rate.field.BW);
|
||||
else
|
||||
Update_Rssi_Sample(pAd, &mon_sta_info->RssiSample, &pRxBlk->rx_signal,
|
||||
0, pRxBlk->rx_rate.field.BW);
|
||||
|
||||
avg_rssi = RTMPAvgRssi(pAd, &mon_sta_info->RssiSample);
|
||||
|
||||
if (fc->Type < FC_TYPE_RSVED) {
|
||||
mnt_sta->frm[fc->Type].cnt++;
|
||||
mnt_sta->frm[fc->Type].rssi += avg_rssi;
|
||||
mnt_sta->Count++;
|
||||
}
|
||||
DBGPRINT(RT_DEBUG_OFF,
|
||||
("fctype = %d ,mgmt = %ld , data = %ld , cnt = %ld "
|
||||
"frame FROM %02x:%02x:%02x:%02x:%02x:%02x TO "
|
||||
"%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
fc->Type,
|
||||
mnt_sta->frm[FC_TYPE_MGMT].cnt,
|
||||
mnt_sta->frm[FC_TYPE_DATA].cnt,
|
||||
mnt_sta->frm[FC_TYPE_CNTL].cnt,
|
||||
PRINT_MAC(pHeader->Addr2),
|
||||
PRINT_MAC(pHeader->Addr1)));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* 1. check parameters
|
||||
* 2. check other SMs
|
||||
* 3. run SM
|
||||
*/
|
||||
INT MixModeSet(IN PRTMP_ADAPTER pAd, struct mix_peer_parameter *sta_info, IN UCHAR idx)
|
||||
{
|
||||
POS_COOKIE pObj;
|
||||
struct wifi_dev *wdev;
|
||||
struct peer_info *mon_sta_info = &pAd->MixModeCtrl.sta_info[0];
|
||||
|
||||
if (pAd == NULL)
|
||||
return -EFAULT;
|
||||
|
||||
pObj = (POS_COOKIE)pAd->OS_Cookie;
|
||||
wdev = &pAd->ApCfg.MBSSID[pObj->ioctl_if].wdev;
|
||||
|
||||
if (wdev == NULL)
|
||||
return -EFAULT;
|
||||
|
||||
pAd->MixModeCtrl.pMixModewdev = wdev;
|
||||
pAd->MixModeCtrl.ioctl_if = pObj->ioctl_if;
|
||||
|
||||
if (sta_info->mac_addr == NULL)
|
||||
return -EFAULT;
|
||||
|
||||
if (NdisEqualMemory(sta_info->mac_addr, &BROADCAST_ADDR[0], MAC_ADDR_LEN) ||
|
||||
NdisEqualMemory(sta_info->mac_addr, &ZERO_MAC_ADDR[0], MAC_ADDR_LEN)) {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("%s pass a invalid mac %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
__FUNCTION__, PRINT_MAC(sta_info->mac_addr)));
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
NdisZeroMemory(mon_sta_info, sizeof(struct peer_info));
|
||||
NdisCopyMemory(mon_sta_info->mac_addr, sta_info->mac_addr, MAC_ADDR_LEN);
|
||||
|
||||
if (MixModeChannelCheck(pAd, sta_info->channel, wdev))
|
||||
mon_sta_info->channel = sta_info->channel;
|
||||
else
|
||||
return -EFAULT;
|
||||
|
||||
if (sta_info->duration == 0)
|
||||
mon_sta_info->duration = MixModeDefualtListenTime;
|
||||
else
|
||||
mon_sta_info->duration = sta_info->duration;
|
||||
|
||||
#ifdef DOT11_VHT_AC
|
||||
if (sta_info->channel > 14) {
|
||||
mon_sta_info->bw = BW_80;
|
||||
mon_sta_info->center_channel = vht_cent_ch_freq(pAd, sta_info->channel);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
mon_sta_info->bw = sta_info->bw;
|
||||
mon_sta_info->ch_offset = sta_info->ch_offset;
|
||||
|
||||
if(sta_info->bw == BW_40) {
|
||||
/*check bw & channel*/
|
||||
if ((sta_info->channel < 5 && sta_info->ch_offset == EXTCHA_BELOW)
|
||||
|| (sta_info->channel > 9 && sta_info->ch_offset == EXTCHA_ABOVE)) {
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("%s pass a invalid primary channel & second channel\n", __FUNCTION__));
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if(sta_info->ch_offset == EXTCHA_ABOVE)
|
||||
mon_sta_info->center_channel = sta_info->channel + 2;
|
||||
else if(sta_info->ch_offset == EXTCHA_BELOW)
|
||||
mon_sta_info->center_channel = sta_info->channel - 2;
|
||||
} else
|
||||
mon_sta_info->center_channel = sta_info->channel;
|
||||
}
|
||||
|
||||
/*check other SMs like autsel or bgscan etc*/
|
||||
MlmeEnqueue(pAd, MIX_MODE_STATE_MACHINE, MIX_MODE_MSG_LISTEN, 0, NULL, 0);
|
||||
RTMP_MLME_HANDLER(pAd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
INT RTMPIoctlQueryMixModeRssi(IN PRTMP_ADAPTER pAd, IN RTMP_IOCTL_INPUT_STRUCT *wrq)
|
||||
{
|
||||
INT Status;
|
||||
CHAR avg_rssi;
|
||||
|
||||
avg_rssi = MixModeCalcAvgRssi(pAd, 0);
|
||||
|
||||
wrq->u.data.length = sizeof(avg_rssi);
|
||||
|
||||
Status = copy_to_user(wrq->u.data.pointer, &avg_rssi, wrq->u.data.length);
|
||||
|
||||
if(Status)
|
||||
DBGPRINT(RT_DEBUG_ERROR,
|
||||
("%s: copy_to_user() fail\n", __FUNCTION__));
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID MixModeCancel(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
BOOLEAN Cancelled;
|
||||
if(pAd == NULL)
|
||||
return;
|
||||
|
||||
RTMPCancelTimer(&pAd->MixModeCtrl.MixModeTimer,&Cancelled);
|
||||
|
||||
MlmeEnqueue(pAd, MIX_MODE_STATE_MACHINE, MIX_MODE_MSG_CANCLE, 0, NULL, 0);
|
||||
RTMP_MLME_HANDLER(pAd);
|
||||
}
|
||||
|
||||
VOID MixModeInit(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
if(pAd == NULL)
|
||||
return;
|
||||
|
||||
MixModeReset(pAd);
|
||||
MixModeStateMachineInit(pAd, &pAd->MixModeCtrl.MixModeStatMachine, pAd->MixModeCtrl.MixModeStateFunc);
|
||||
RTMPInitTimer(pAd, &pAd->MixModeCtrl.MixModeTimer, GET_TIMER_FUNCTION(MixModeTimeout), pAd, FALSE);
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Enter %s\n", __FUNCTION__));
|
||||
}
|
||||
|
||||
VOID MixModeDel(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
BOOLEAN Cancelled;
|
||||
if(pAd == NULL)
|
||||
return;
|
||||
|
||||
RTMPReleaseTimer(&pAd->MixModeCtrl.MixModeTimer, &Cancelled);
|
||||
NdisZeroMemory(&pAd->MixModeCtrl.sta_info, sizeof(pAd->MixModeCtrl.sta_info));
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Exit %s\n", __FUNCTION__));
|
||||
}
|
||||
|
||||
769
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_mlme.c
Normal file
769
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_mlme.c
Normal file
@ -0,0 +1,769 @@
|
||||
/****************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
****************************************************************************
|
||||
|
||||
Module Name:
|
||||
mlme.c
|
||||
|
||||
Abstract:
|
||||
Major MLME state machiones here
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
John Chang 08-04-2003 created for 11g soft-AP
|
||||
*/
|
||||
|
||||
#include "rt_config.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef BTCOEX_CONCURRENT
|
||||
extern void MT7662ReceCoexFromOtherCHip(
|
||||
IN UCHAR channel,
|
||||
IN UCHAR centralchannel,
|
||||
IN UCHAR channel_bw
|
||||
);
|
||||
#endif
|
||||
#if defined(MAX_CONTINUOUS_TX_CNT) || defined(NEW_IXIA_METHOD)
|
||||
VOID rtmp_deqmode_detect(RTMP_ADAPTER *pAd);
|
||||
#endif
|
||||
#ifdef DOT11_N_SUPPORT
|
||||
|
||||
int DetectOverlappingPeriodicRound;
|
||||
|
||||
|
||||
#ifdef DOT11N_DRAFT3
|
||||
VOID Bss2040CoexistTimeOut(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
{
|
||||
int apidx;
|
||||
PRTMP_ADAPTER pAd = (RTMP_ADAPTER *)FunctionContext;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Bss2040CoexistTimeOut(): Recovery to original setting!\n"));
|
||||
|
||||
/* Recovery to original setting when next DTIM Interval. */
|
||||
pAd->CommonCfg.Bss2040CoexistFlag &= (~BSS_2040_COEXIST_TIMER_FIRED);
|
||||
NdisZeroMemory(&pAd->CommonCfg.LastBSSCoexist2040, sizeof(BSS_2040_COEXIST_IE));
|
||||
pAd->CommonCfg.Bss2040CoexistFlag |= BSS_2040_COEXIST_INFO_SYNC;
|
||||
|
||||
if (pAd->CommonCfg.bBssCoexEnable == FALSE)
|
||||
{
|
||||
/* TODO: Find a better way to handle this when the timer is fired and we disable the bBssCoexEable support!! */
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Bss2040CoexistTimeOut(): bBssCoexEnable is FALSE, return directly!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
for (apidx = 0; apidx < pAd->ApCfg.BssidNum; apidx++)
|
||||
SendBSS2040CoexistMgmtAction(pAd, MCAST_WCID, apidx, 0);
|
||||
|
||||
}
|
||||
#endif /* DOT11N_DRAFT3 */
|
||||
|
||||
#endif /* DOT11_N_SUPPORT */
|
||||
|
||||
|
||||
VOID APDetectOverlappingExec(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
{
|
||||
#ifdef DOT11_N_SUPPORT
|
||||
PRTMP_ADAPTER pAd = (RTMP_ADAPTER *)FunctionContext;
|
||||
|
||||
if (DetectOverlappingPeriodicRound == 0)
|
||||
{
|
||||
/* switch back 20/40 */
|
||||
if ((pAd->CommonCfg.Channel <=14) && (pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == BW_40))
|
||||
{
|
||||
pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 1;
|
||||
pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = pAd->CommonCfg.RegTransmitSetting.field.EXTCHA;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((DetectOverlappingPeriodicRound == 25) || (DetectOverlappingPeriodicRound == 1))
|
||||
{
|
||||
if ((pAd->CommonCfg.Channel <=14) && (pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth==BW_40))
|
||||
{
|
||||
SendBeaconRequest(pAd, 1);
|
||||
SendBeaconRequest(pAd, 2);
|
||||
SendBeaconRequest(pAd, 3);
|
||||
}
|
||||
|
||||
}
|
||||
DetectOverlappingPeriodicRound--;
|
||||
}
|
||||
#endif /* DOT11_N_SUPPORT */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
This routine is executed every second -
|
||||
1. Decide the overall channel quality
|
||||
2. Check if need to upgrade the TX rate to any client
|
||||
3. perform MAC table maintenance, including ageout no-traffic clients,
|
||||
and release packet buffer in PSQ is fail to TX in time.
|
||||
==========================================================================
|
||||
*/
|
||||
VOID APMlmePeriodicExec(
|
||||
PRTMP_ADAPTER pAd)
|
||||
{
|
||||
#ifdef A4_CONN
|
||||
UCHAR mbss_idx;
|
||||
#endif
|
||||
/*
|
||||
Reqeust by David 2005/05/12
|
||||
It make sense to disable Adjust Tx Power on AP mode, since we can't
|
||||
take care all of the client's situation
|
||||
ToDo: need to verify compatibility issue with WiFi product.
|
||||
*/
|
||||
|
||||
#ifdef BTCOEX_CONCURRENT
|
||||
MT7662ReceCoexFromOtherCHip(pAd->CommonCfg.Channel,pAd->CommonCfg.CentralChannel,pAd->CommonCfg.BBPCurrentBW);
|
||||
#endif
|
||||
|
||||
#ifdef CARRIER_DETECTION_SUPPORT
|
||||
if (isCarrierDetectExist(pAd) == TRUE)
|
||||
{
|
||||
PCARRIER_DETECTION_STRUCT pCarrierDetect = &pAd->CommonCfg.CarrierDetect;
|
||||
if (pCarrierDetect->OneSecIntCount < pCarrierDetect->CarrierGoneThreshold)
|
||||
{
|
||||
pCarrierDetect->CD_State = CD_NORMAL;
|
||||
pCarrierDetect->recheck = pCarrierDetect->recheck1;
|
||||
if (pCarrierDetect->Debug != RT_DEBUG_TRACE)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Carrier gone\n"));
|
||||
/* start all TX actions. */
|
||||
APMakeAllBssBeacon(pAd);
|
||||
APUpdateAllBeaconFrame(pAd);
|
||||
AsicEnableBssSync(pAd, pAd->CommonCfg.BeaconPeriod);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Carrier gone\n"));
|
||||
}
|
||||
}
|
||||
pCarrierDetect->OneSecIntCount = 0;
|
||||
}
|
||||
|
||||
#endif /* CARRIER_DETECTION_SUPPORT */
|
||||
|
||||
RTMP_CHIP_HIGH_POWER_TUNING(pAd, &pAd->ApCfg.RssiSample);
|
||||
|
||||
|
||||
/* Disable Adjust Tx Power for WPA WiFi-test. */
|
||||
/* Because high TX power results in the abnormal disconnection of Intel BG-STA. */
|
||||
/*#ifndef WIFI_TEST */
|
||||
/* if (pAd->CommonCfg.bWiFiTest == FALSE) */
|
||||
/* for SmartBit 64-byte stream test */
|
||||
/* removed based on the decision of Ralink congress at 2011/7/06 */
|
||||
/* if (pAd->MacTab.Size > 0) */
|
||||
RTMP_CHIP_ASIC_ADJUST_TX_POWER(pAd);
|
||||
/*#endif // WIFI_TEST */
|
||||
|
||||
RTMP_CHIP_ASIC_TEMPERATURE_COMPENSATION(pAd);
|
||||
|
||||
/* walk through MAC table, see if switching TX rate is required */
|
||||
|
||||
/* MAC table maintenance */
|
||||
if (pAd->Mlme.PeriodicRound % MLME_TASK_EXEC_MULTIPLE == 0)
|
||||
{
|
||||
#if defined(BAND_STEERING) || defined(CUSTOMER_DCC_FEATURE) || defined(WIFI_DIAG)\
|
||||
|| defined(WAPP_SUPPORT)
|
||||
UINT32 msdr9;
|
||||
|
||||
/* NAV, CCA, or TX active timer in unit of TU, used for Measurement. (channel busy time) */
|
||||
RTMP_IO_READ32(pAd, MIB_MSDR9, &msdr9);
|
||||
msdr9 &= 0xFFFFFF;
|
||||
pAd->OneSecChBusyTime = msdr9;
|
||||
#ifdef BAND_STEERING
|
||||
if (pAd->ApCfg.BandSteering)
|
||||
pAd->ApCfg.BndStrgOneSecChBusyTime = (pAd->ApCfg.BndStrgOneSecChBusyTime == 0)? \
|
||||
msdr9 : ((msdr9 + pAd->ApCfg.BndStrgOneSecChBusyTime)>>1);
|
||||
#endif
|
||||
#endif
|
||||
/* one second timer */
|
||||
MacTableMaintenance(pAd);
|
||||
|
||||
#ifdef WH_EZ_SETUP
|
||||
#ifdef NEW_CONNECTION_ALGO
|
||||
if(IS_ADPTR_EZ_SETUP_ENABLED(pAd)) {
|
||||
EzMlmeEnqueue(pAd, EZ_STATE_MACHINE, EZ_PERIODIC_EXEC_REQ, 0, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_FPGA_MODE
|
||||
if (pAd->fpga_ctl.fpga_tr_stop)
|
||||
{
|
||||
INT enable = FALSE, ctrl_type;
|
||||
|
||||
/* enable/disable tx/rx*/
|
||||
switch (pAd->fpga_ctl.fpga_tr_stop)
|
||||
{
|
||||
case 3: //stop tx + rx
|
||||
ctrl_type = ASIC_MAC_TXRX;
|
||||
break;
|
||||
case 2: // stop rx
|
||||
ctrl_type = ASIC_MAC_RX;
|
||||
break;
|
||||
case 1: // stop tx
|
||||
ctrl_type = ASIC_MAC_TX;
|
||||
break;
|
||||
case 4:
|
||||
default:
|
||||
enable = TRUE;
|
||||
ctrl_type = ASIC_MAC_TXRX;
|
||||
break;
|
||||
}
|
||||
AsicSetMacTxRx(pAd, ctrl_type, enable);
|
||||
}
|
||||
#endif /* CONFIG_FPGA_MODE */
|
||||
|
||||
RTMPMaintainPMKIDCache(pAd);
|
||||
|
||||
#ifdef WDS_SUPPORT
|
||||
WdsTableMaintenance(pAd);
|
||||
#endif /* WDS_SUPPORT */
|
||||
|
||||
|
||||
#ifdef CLIENT_WDS
|
||||
CliWds_ProxyTabMaintain(pAd);
|
||||
#endif /* CLIENT_WDS */
|
||||
#ifdef A4_CONN
|
||||
for(mbss_idx = 0; mbss_idx < pAd->ApCfg.BssidNum; mbss_idx++)
|
||||
a4_proxy_maintain(pAd, mbss_idx);
|
||||
pAd->a4_need_refresh = FALSE;
|
||||
#endif /* A4_CONN */
|
||||
#ifdef WH_EVENT_NOTIFIER
|
||||
//WHCMlmePeriodicExec(pAd); // Arvind : Need to confirm that we have to support this event
|
||||
#endif /* WH_EVENT_NOTIFIER */
|
||||
|
||||
#ifdef WIFI_DIAG
|
||||
DiagApMlmeOneSecProc(pAd);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef AP_SCAN_SUPPORT
|
||||
AutoChannelSelCheck(pAd);
|
||||
#endif /* AP_SCAN_SUPPORT */
|
||||
|
||||
APUpdateCapabilityAndErpIe(pAd);
|
||||
|
||||
#ifdef APCLI_SUPPORT
|
||||
if (pAd->Mlme.OneSecPeriodicRound % 2 == 0)
|
||||
ApCliIfMonitor(pAd);
|
||||
|
||||
if (pAd->Mlme.OneSecPeriodicRound % 2 == 1
|
||||
#ifdef APCLI_AUTO_CONNECT_SUPPORT
|
||||
&& (pAd->ApCfg.ApCliAutoConnectChannelSwitching == FALSE)
|
||||
#endif /* APCLI_AUTO_CONNECT_SUPPORT */
|
||||
) {
|
||||
ApCliIfUp(pAd);
|
||||
}
|
||||
|
||||
{
|
||||
INT loop;
|
||||
ULONG Now32;
|
||||
|
||||
#ifdef MAC_REPEATER_SUPPORT
|
||||
if (pAd->ApCfg.bMACRepeaterEn)
|
||||
{
|
||||
RTMPRepeaterReconnectionCheck(pAd);
|
||||
}
|
||||
#endif /* MAC_REPEATER_SUPPORT */
|
||||
|
||||
NdisGetSystemUpTime(&Now32);
|
||||
for (loop = 0; loop < MAX_APCLI_NUM; loop++)
|
||||
{
|
||||
PAPCLI_STRUCT pApCliEntry = &pAd->ApCfg.ApCliTab[loop];
|
||||
if ((pApCliEntry->Valid == TRUE)
|
||||
&& (pApCliEntry->MacTabWCID < MAX_LEN_OF_MAC_TABLE))
|
||||
{
|
||||
/* update channel quality for Roaming and UI LinkQuality display */
|
||||
MlmeCalculateChannelQuality(pAd,
|
||||
&pAd->MacTab.Content[pApCliEntry->MacTabWCID], Now32);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* APCLI_SUPPORT */
|
||||
|
||||
#ifdef DOT11_N_SUPPORT
|
||||
if (pAd->CommonCfg.bHTProtect) {
|
||||
/*APUpdateCapabilityAndErpIe(pAd); */
|
||||
APUpdateOperationMode(pAd);
|
||||
if (pAd->CommonCfg.IOTestParm.bRTSLongProtOn == FALSE)
|
||||
AsicUpdateProtect(pAd, (USHORT)pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode,
|
||||
ALLN_SETPROTECT, FALSE, pAd->MacTab.fAnyStationNonGF);
|
||||
}
|
||||
#endif /* DOT11_N_SUPPORT */
|
||||
|
||||
#ifdef A_BAND_SUPPORT
|
||||
if ( (pAd->CommonCfg.Channel > 14)
|
||||
&& (pAd->CommonCfg.bIEEE80211H == 1))
|
||||
{
|
||||
#ifdef DFS_SUPPORT
|
||||
ApRadarDetectPeriodic(pAd);
|
||||
#else
|
||||
pAd->Dot11_H.InServiceMonitorCount++;
|
||||
if (pAd->Dot11_H.RDMode == RD_SILENCE_MODE)
|
||||
{
|
||||
if (pAd->Dot11_H.RDCount++ > pAd->Dot11_H.ChMovingTime)
|
||||
{
|
||||
AsicEnableBssSync(pAd, pAd->CommonCfg.BeaconPeriod);
|
||||
pAd->Dot11_H.RDMode = RD_NORMAL_MODE;
|
||||
}
|
||||
}
|
||||
#endif /* !DFS_SUPPORT */
|
||||
}
|
||||
#endif /* A_BAND_SUPPORT */
|
||||
#ifdef MBO_SUPPORT
|
||||
MboCheckBssTermination(pAd);
|
||||
#endif/* MBO_SUPPORT */
|
||||
#ifdef DOT11R_FT_SUPPORT
|
||||
FT_R1KHInfoMaintenance(pAd);
|
||||
#endif /* DOT11R_FT_SUPPORT */
|
||||
#if defined(MAX_CONTINUOUS_TX_CNT) || defined(NEW_IXIA_METHOD)
|
||||
if(pAd->MonitorFlag == TRUE)
|
||||
rtmp_deqmode_detect(pAd); /* 1s detect*/
|
||||
#endif
|
||||
#ifdef BAND_STEERING
|
||||
BndStrgHeartBeatMonitor(pAd);
|
||||
#endif
|
||||
#ifdef NEW_IXIA_METHOD
|
||||
if (pAd->Mlme.OneSecPeriodicRound % pAd->chkTmr == 0) {
|
||||
if ((txpktdetect2s < pAd->pktthld)
|
||||
&& (rxpktdetect2s < pAd->pktthld)) {/*Threshold*/
|
||||
pAd->tmrlogctrl++;
|
||||
if (pAd->tmrlogctrl <= 1)
|
||||
wifi_txrx_parmtrs_dump(pAd);
|
||||
else
|
||||
pAd->tmrlogctrl = 10;/*prevent pAd->tmrlogctrl overflow*/
|
||||
} else
|
||||
pAd->tmrlogctrl = 0;
|
||||
txpktdetect2s = 0;
|
||||
rxpktdetect2s = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*! \brief To substitute the message type if the message is coming from external
|
||||
* \param *Fr The frame received
|
||||
* \param *Machine The state machine
|
||||
* \param *MsgType the message type for the state machine
|
||||
* \return TRUE if the substitution is successful, FALSE otherwise
|
||||
* \pre
|
||||
* \post
|
||||
*/
|
||||
BOOLEAN APMsgTypeSubst(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PFRAME_802_11 pFrame,
|
||||
OUT INT *Machine,
|
||||
OUT INT *MsgType)
|
||||
{
|
||||
USHORT Seq;
|
||||
#ifdef DOT11_SAE_SUPPORT
|
||||
USHORT Alg;
|
||||
#endif /* DOT11_SAE_SUPPORT */
|
||||
UCHAR EAPType;
|
||||
BOOLEAN Return = FALSE;
|
||||
#ifdef WSC_AP_SUPPORT
|
||||
UCHAR EAPCode;
|
||||
PMAC_TABLE_ENTRY pEntry;
|
||||
#endif /* WSC_AP_SUPPORT */
|
||||
unsigned char hdr_len = LENGTH_802_11;
|
||||
|
||||
#ifdef A4_CONN
|
||||
if ((pFrame->Hdr.FC.FrDs == 1) && (pFrame->Hdr.FC.ToDs == 1))
|
||||
hdr_len = LENGTH_802_11_WITH_ADDR4;
|
||||
#endif
|
||||
/*
|
||||
TODO:
|
||||
only PROBE_REQ can be broadcast, all others must be unicast-to-me && is_mybssid;
|
||||
otherwise, ignore this frame
|
||||
*/
|
||||
|
||||
/* wpa EAPOL PACKET */
|
||||
if (pFrame->Hdr.FC.Type == FC_TYPE_DATA)
|
||||
{
|
||||
#ifdef WSC_AP_SUPPORT
|
||||
WSC_CTRL *wsc_ctrl;
|
||||
/*WSC EAPOL PACKET */
|
||||
pEntry = MacTableLookup(pAd, pFrame->Hdr.Addr2);
|
||||
if (pEntry &&
|
||||
((pEntry->bWscCapable) ||
|
||||
(pAd->ApCfg.MBSSID[pEntry->func_tb_idx].wdev.AuthMode < Ndis802_11AuthModeWPA)))
|
||||
{
|
||||
/*
|
||||
WSC AP only can service one WSC STA in one WPS session.
|
||||
Forward this EAP packet to WSC SM if this EAP packets is from
|
||||
WSC STA that WSC AP services or WSC AP doesn't service any
|
||||
WSC STA now.
|
||||
*/
|
||||
wsc_ctrl = &pAd->ApCfg.MBSSID[pEntry->func_tb_idx].WscControl;
|
||||
if ((MAC_ADDR_EQUAL(wsc_ctrl->EntryAddr, pEntry->Addr) ||
|
||||
MAC_ADDR_EQUAL(wsc_ctrl->EntryAddr, ZERO_MAC_ADDR)) &&
|
||||
IS_ENTRY_CLIENT(pEntry) &&
|
||||
(wsc_ctrl->WscConfMode != WSC_DISABLE))
|
||||
{
|
||||
*Machine = WSC_STATE_MACHINE;
|
||||
EAPType = *((UCHAR *)pFrame + hdr_len + LENGTH_802_1_H + 1);
|
||||
EAPCode = *((UCHAR *)pFrame + hdr_len + LENGTH_802_1_H + 4);
|
||||
Return = WscMsgTypeSubst(EAPType, EAPCode, MsgType);
|
||||
}
|
||||
}
|
||||
#endif /* WSC_AP_SUPPORT */
|
||||
if (!Return)
|
||||
{
|
||||
*Machine = WPA_STATE_MACHINE;
|
||||
EAPType = *((UCHAR *)pFrame + hdr_len + LENGTH_802_1_H + 1);
|
||||
Return = WpaMsgTypeSubst(EAPType, (INT *) MsgType);
|
||||
}
|
||||
return Return;
|
||||
}
|
||||
|
||||
if (pFrame->Hdr.FC.Type != FC_TYPE_MGMT)
|
||||
return FALSE;
|
||||
|
||||
switch (pFrame->Hdr.FC.SubType)
|
||||
{
|
||||
case SUBTYPE_ASSOC_REQ:
|
||||
*Machine = AP_ASSOC_STATE_MACHINE;
|
||||
*MsgType = APMT2_PEER_ASSOC_REQ;
|
||||
|
||||
break;
|
||||
/*
|
||||
case SUBTYPE_ASSOC_RSP:
|
||||
*Machine = AP_ASSOC_STATE_MACHINE;
|
||||
*MsgType = APMT2_PEER_ASSOC_RSP;
|
||||
break;
|
||||
*/
|
||||
case SUBTYPE_REASSOC_REQ:
|
||||
*Machine = AP_ASSOC_STATE_MACHINE;
|
||||
*MsgType = APMT2_PEER_REASSOC_REQ;
|
||||
break;
|
||||
/*
|
||||
case SUBTYPE_REASSOC_RSP:
|
||||
*Machine = AP_ASSOC_STATE_MACHINE;
|
||||
*MsgType = APMT2_PEER_REASSOC_RSP;
|
||||
break;
|
||||
*/
|
||||
case SUBTYPE_PROBE_REQ:
|
||||
*Machine = AP_SYNC_STATE_MACHINE;
|
||||
*MsgType = APMT2_PEER_PROBE_REQ;
|
||||
break;
|
||||
|
||||
/* For Active Scan */
|
||||
case SUBTYPE_PROBE_RSP:
|
||||
*Machine = AP_SYNC_STATE_MACHINE;
|
||||
*MsgType = APMT2_PEER_PROBE_RSP;
|
||||
break;
|
||||
case SUBTYPE_BEACON:
|
||||
*Machine = AP_SYNC_STATE_MACHINE;
|
||||
*MsgType = APMT2_PEER_BEACON;
|
||||
break;
|
||||
/*
|
||||
case SUBTYPE_ATIM:
|
||||
*Machine = AP_SYNC_STATE_MACHINE;
|
||||
*MsgType = APMT2_PEER_ATIM;
|
||||
break;
|
||||
*/
|
||||
case SUBTYPE_DISASSOC:
|
||||
*Machine = AP_ASSOC_STATE_MACHINE;
|
||||
*MsgType = APMT2_PEER_DISASSOC_REQ;
|
||||
break;
|
||||
case SUBTYPE_AUTH:
|
||||
/* get the sequence number from payload 24 Mac Header + 2 bytes algorithm */
|
||||
#ifdef DOT11_SAE_SUPPORT
|
||||
NdisMoveMemory(&Alg, &pFrame->Octet[0], sizeof(USHORT));
|
||||
#endif /* DOT11_SAE_SUPPORT */
|
||||
NdisMoveMemory(&Seq, &pFrame->Octet[2], sizeof(USHORT));
|
||||
|
||||
*Machine = AP_AUTH_STATE_MACHINE;
|
||||
if (Seq == 1
|
||||
#ifdef DOT11_SAE_SUPPORT
|
||||
|| (Alg == AUTH_MODE_SAE && Seq == 2)
|
||||
#endif /* DOT11_SAE_SUPPORT */
|
||||
)
|
||||
*MsgType = APMT2_PEER_AUTH_REQ;
|
||||
else if (Seq == 3)
|
||||
*MsgType = APMT2_PEER_AUTH_CONFIRM;
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE,("wrong AUTH seq=%d Octet=%02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
Seq,
|
||||
pFrame->Octet[0], pFrame->Octet[1], pFrame->Octet[2], pFrame->Octet[3],
|
||||
pFrame->Octet[4], pFrame->Octet[5], pFrame->Octet[6], pFrame->Octet[7]));
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case SUBTYPE_DEAUTH:
|
||||
*Machine = AP_AUTH_STATE_MACHINE; /*AP_AUTH_RSP_STATE_MACHINE;*/
|
||||
*MsgType = APMT2_PEER_DEAUTH;
|
||||
break;
|
||||
|
||||
case SUBTYPE_ACTION:
|
||||
case SUBTYPE_ACTION_NO_ACK:
|
||||
*Machine = ACTION_STATE_MACHINE;
|
||||
/* Sometimes Sta will return with category bytes with MSB = 1, if they receive catogory out of their support */
|
||||
if ((pFrame->Octet[0]&0x7F) > MAX_PEER_CATE_MSG)
|
||||
{
|
||||
*MsgType = MT2_ACT_INVALID;
|
||||
}
|
||||
else
|
||||
{
|
||||
*MsgType = (pFrame->Octet[0]&0x7F);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Periodic evaluate antenna link status
|
||||
|
||||
Arguments:
|
||||
pAd - Adapter pointer
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
VOID APAsicEvaluateRxAnt(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
ULONG TxTotalCnt;
|
||||
|
||||
#ifdef CONFIG_ATE
|
||||
if (ATE_ON(pAd))
|
||||
return;
|
||||
#endif /* CONFIG_ATE */
|
||||
#ifdef CARRIER_DETECTION_SUPPORT
|
||||
if(pAd->CommonCfg.CarrierDetect.CD_State == CD_SILENCE)
|
||||
return;
|
||||
#endif /* CARRIER_DETECTION_SUPPORT */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef DOT11_N_SUPPORT
|
||||
#ifdef GREENAP_SUPPORT
|
||||
if (pAd->ApCfg.bGreenAPActive == TRUE)
|
||||
bbp_set_rxpath(pAd, 1);
|
||||
else
|
||||
#endif /* GREENAP_SUPPORT */
|
||||
#endif /* DOT11_N_SUPPORT */
|
||||
bbp_set_rxpath(pAd, pAd->Antenna.field.RxPath);
|
||||
|
||||
TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount +
|
||||
pAd->RalinkCounters.OneSecTxRetryOkCount +
|
||||
pAd->RalinkCounters.OneSecTxFailCount;
|
||||
|
||||
if (TxTotalCnt > 50)
|
||||
{
|
||||
RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 20);
|
||||
pAd->Mlme.bLowThroughput = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 300);
|
||||
pAd->Mlme.bLowThroughput = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
After evaluation, check antenna link status
|
||||
|
||||
Arguments:
|
||||
pAd - Adapter pointer
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
VOID APAsicRxAntEvalTimeout(RTMP_ADAPTER *pAd)
|
||||
{
|
||||
CHAR rssi[3], *target_rssi;
|
||||
|
||||
#ifdef CONFIG_ATE
|
||||
if (ATE_ON(pAd))
|
||||
return;
|
||||
#endif /* CONFIG_ATE */
|
||||
|
||||
/* if the traffic is low, use average rssi as the criteria */
|
||||
if (pAd->Mlme.bLowThroughput == TRUE)
|
||||
target_rssi = &pAd->ApCfg.RssiSample.LastRssi[0];
|
||||
else
|
||||
target_rssi = &pAd->ApCfg.RssiSample.AvgRssi[0];
|
||||
NdisMoveMemory(&rssi[0], target_rssi, 3);
|
||||
|
||||
#ifdef DOT11N_SS3_SUPPORT
|
||||
if(pAd->Antenna.field.RxPath == 3)
|
||||
{
|
||||
CHAR larger = -127;
|
||||
|
||||
larger = max(rssi[0], rssi[1]);
|
||||
if (pAd->CommonCfg.RxStream >= 3)
|
||||
pAd->Mlme.RealRxPath = 3;
|
||||
else
|
||||
{
|
||||
if (larger > (rssi[2] + 20))
|
||||
pAd->Mlme.RealRxPath = 2;
|
||||
else
|
||||
pAd->Mlme.RealRxPath = 3;
|
||||
}
|
||||
}
|
||||
#endif /* DOT11N_SS3_SUPPORT */
|
||||
|
||||
/* Disable the below to fix 1T/2R issue. It's suggested by Rory at 2007/7/11. */
|
||||
|
||||
#ifdef DOT11_N_SUPPORT
|
||||
#ifdef GREENAP_SUPPORT
|
||||
if (pAd->ApCfg.bGreenAPActive == TRUE)
|
||||
bbp_set_rxpath(pAd, 1);
|
||||
else
|
||||
#endif /* GREENAP_SUPPORT */
|
||||
#endif /* DOT11_N_SUPPORT */
|
||||
bbp_set_rxpath(pAd, pAd->Mlme.RealRxPath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
After evaluation, check antenna link status
|
||||
|
||||
Arguments:
|
||||
pAd - Adapter pointer
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
VOID APAsicAntennaAvg(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UCHAR AntSelect,
|
||||
IN SHORT* RssiAvg)
|
||||
{
|
||||
SHORT realavgrssi;
|
||||
LONG realavgrssi1;
|
||||
ULONG recvPktNum = pAd->RxAnt.RcvPktNum[AntSelect];
|
||||
|
||||
realavgrssi1 = pAd->RxAnt.Pair1AvgRssiGroup1[AntSelect];
|
||||
|
||||
if(realavgrssi1 == 0)
|
||||
{
|
||||
*RssiAvg = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
realavgrssi = (SHORT) (realavgrssi1 / recvPktNum);
|
||||
|
||||
pAd->RxAnt.Pair1AvgRssiGroup1[0] = 0;
|
||||
pAd->RxAnt.Pair1AvgRssiGroup1[1] = 0;
|
||||
pAd->RxAnt.Pair1AvgRssiGroup2[0] = 0;
|
||||
pAd->RxAnt.Pair1AvgRssiGroup2[1] = 0;
|
||||
pAd->RxAnt.RcvPktNum[0] = 0;
|
||||
pAd->RxAnt.RcvPktNum[1] = 0;
|
||||
*RssiAvg = realavgrssi - 256;
|
||||
}
|
||||
#if defined(MAX_CONTINUOUS_TX_CNT) || defined(NEW_IXIA_METHOD)
|
||||
BOOLEAN Rtmp_Max_Continuous_Tx_OnOff(RTMP_ADAPTER *pAd)
|
||||
{
|
||||
PMAC_TABLE_ENTRY pEntry = NULL;
|
||||
INT i;
|
||||
CHAR MaxRssi = -127,MinRssi = -127,myAvgRssi = -127; //for RSSI
|
||||
ULONG DataRate=0; //for datarate.
|
||||
for (i=0; i < MAX_LEN_OF_MAC_TABLE; i++)
|
||||
{
|
||||
pEntry = &pAd->MacTab.Content[i];
|
||||
if (!(IS_ENTRY_CLIENT(pEntry) && (pEntry->Sst == SST_ASSOC)))
|
||||
continue;
|
||||
myAvgRssi = RTMPAvgRssi(pAd, &pEntry->RssiSample);// get my rssi average.
|
||||
getRate(pEntry->HTPhyMode, &DataRate);
|
||||
|
||||
if(DataRate < pAd->RateTh)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN,("%s(%d)Some sta's rate is low. DataRate = %lu\n",__FUNCTION__,__LINE__,DataRate));
|
||||
return FALSE;
|
||||
}
|
||||
if((MaxRssi == -127) && (MinRssi == -127))
|
||||
{
|
||||
MaxRssi= myAvgRssi;
|
||||
MinRssi = myAvgRssi;
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxRssi = RTMPMaxRssi(pAd,MaxRssi,myAvgRssi,0);// find the max rssi in mactable size.
|
||||
MinRssi = RTMPMinRssi(pAd,MinRssi,myAvgRssi,0);// find the min rssi in mactable size.
|
||||
}
|
||||
|
||||
}
|
||||
DBGPRINT(RT_DEBUG_WARN,("%s(%d)MaxRssi = %-3d,MinRssi = %-3d\n",__FUNCTION__,__LINE__,MaxRssi,MinRssi));
|
||||
if((MaxRssi - MinRssi) < pAd->DeltaRssiTh) /*pAd->DeltaRssiTh default 10 dBm*/
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN,("%s(%d) in in in in in in \n",__FUNCTION__,__LINE__));
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID rtmp_deqmode_detect(RTMP_ADAPTER *pAd)
|
||||
{
|
||||
if(pAd->MacTab.Size >=5)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN,("%s(%d) MacTab.Size = %d\n",__FUNCTION__,__LINE__,pAd->MacTab.Size));
|
||||
if(Rtmp_Max_Continuous_Tx_OnOff(pAd) == TRUE)
|
||||
{
|
||||
pAd->ContinousTxCnt = CONTINUOUS_TX_CNT;/*set tx 21 packets one time*/
|
||||
DBGPRINT(RT_DEBUG_WARN,("%s(%d)Countinous to Tx %d Packets\n",__FUNCTION__,__LINE__,pAd->ContinousTxCnt));
|
||||
}
|
||||
else
|
||||
{
|
||||
pAd->ContinousTxCnt = 1; /*default tx 1 packet one time*/
|
||||
DBGPRINT(RT_DEBUG_WARN,("%s(%d)tx 1 packet!\n",__FUNCTION__,__LINE__));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN,("%s(%d)client num = %d\n",__FUNCTION__,__LINE__, pAd->MacTab.Size));
|
||||
pAd->ContinousTxCnt = 1; /*default tx 1 packet one time*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
ap_nintendo.c
|
||||
|
||||
Abstract:
|
||||
Miniport Query information related subroutines
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
JuemingChen 12-28-2006 created
|
||||
|
||||
*/
|
||||
#include "rt_config.h"
|
||||
|
||||
309
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_nps.c
Normal file
309
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_nps.c
Normal file
@ -0,0 +1,309 @@
|
||||
/****************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
****************************************************************************
|
||||
|
||||
Module Name:
|
||||
ap_nps.c
|
||||
|
||||
Abstract:
|
||||
IEEE 802.11v NPS SoftAP related function
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Carter Chen 08-23-2013 created for 7603 AP
|
||||
*/
|
||||
#ifdef MT_MAC
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
extern VOID write_tmac_info_tim(RTMP_ADAPTER *pAd, INT apidx, UCHAR *tmac_buf, HTTRANSMIT_SETTING *BeaconTransmit, ULONG frmLen);
|
||||
|
||||
BOOLEAN TimTransmitRequired(RTMP_ADAPTER *pAd, INT apidx, BSS_STRUCT *pMbss)
|
||||
{
|
||||
BOOLEAN result = FALSE;
|
||||
TIM_BUF_STRUC *tim_info;
|
||||
|
||||
tim_info = &pMbss->tim_buf;
|
||||
if (tim_info->TimBufIdx >= HW_BEACON_MAX_NUM)
|
||||
return result;
|
||||
|
||||
if (tim_info->bTimSntReq == TRUE)
|
||||
{
|
||||
result = TRUE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef MT_MAC
|
||||
VOID RT28xx_UpdateTimToAsic(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN INT apidx,
|
||||
IN ULONG FrameLen)
|
||||
{
|
||||
TIM_BUF_STRUC *tim_buf = NULL;
|
||||
UCHAR *buf;
|
||||
INT len;
|
||||
PNDIS_PACKET *pkt = NULL;
|
||||
|
||||
IF_DEV_CONFIG_OPMODE_ON_AP(pAd) {
|
||||
tim_buf = &pAd->ApCfg.MBSSID[apidx].tim_buf;
|
||||
}
|
||||
|
||||
if (!tim_buf) {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s(): bcn_buf is NULL!\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
pkt = tim_buf->TimPkt;
|
||||
if (pkt) {
|
||||
buf = (UCHAR *)GET_OS_PKT_DATAPTR(pkt);
|
||||
len = FrameLen + pAd->chipCap.tx_hw_hdr_len;
|
||||
SET_OS_PKT_LEN(pkt, len);
|
||||
|
||||
/* Now do hardware-depened kick out.*/
|
||||
RTMP_SEM_LOCK(&pAd->BcnRingLock);
|
||||
HAL_KickOutMgmtTx(pAd, Q_IDX_BCN, pkt, buf, len);
|
||||
RTMP_SEM_UNLOCK(&pAd->BcnRingLock);
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s(): TimPkt is NULL!\n", __FUNCTION__));
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* MT_MAC */
|
||||
|
||||
VOID write_tmac_info_tim(RTMP_ADAPTER *pAd, INT apidx, UCHAR *tmac_buf, HTTRANSMIT_SETTING *BeaconTransmit, ULONG frmLen)
|
||||
{
|
||||
MAC_TX_INFO mac_info;
|
||||
|
||||
NdisZeroMemory((UCHAR *)&mac_info, sizeof(mac_info));
|
||||
|
||||
mac_info.FRAG = FALSE;
|
||||
mac_info.CFACK = FALSE;
|
||||
mac_info.InsTimestamp = FALSE;
|
||||
mac_info.AMPDU = FALSE;
|
||||
mac_info.BM = 1;
|
||||
mac_info.Ack = FALSE;
|
||||
mac_info.NSeq = TRUE;
|
||||
mac_info.BASize = 0;
|
||||
mac_info.WCID = 0;
|
||||
mac_info.Length = frmLen;
|
||||
mac_info.PID = PID_MGMT;
|
||||
mac_info.TID = 0;
|
||||
mac_info.TxRate = 0;
|
||||
mac_info.Txopmode = IFS_HTTXOP;
|
||||
mac_info.q_idx = Q_IDX_BCN;
|
||||
mac_info.hdr_len = 24;
|
||||
mac_info.bss_idx = apidx;
|
||||
mac_info.SpeEn = 1;
|
||||
mac_info.Preamble = LONG_PREAMBLE;
|
||||
write_tmac_info(pAd, tmac_buf, &mac_info, BeaconTransmit);
|
||||
}
|
||||
|
||||
VOID APMakeBssTimFrame(RTMP_ADAPTER *pAd, INT apidx)
|
||||
{
|
||||
BSS_STRUCT *pMbss = &pAd->ApCfg.MBSSID[apidx];
|
||||
HEADER_802_11 TimHdr;
|
||||
LARGE_INTEGER FakeTimestamp;
|
||||
ULONG FrameLen = 0;
|
||||
UCHAR *pTimFrame, *ptr, *tmac_info;
|
||||
HTTRANSMIT_SETTING TimTransmit = {.word = 0}; /* MGMT frame PHY rate setting when operatin at HT rate. */
|
||||
//UINT8 TXWISize = pAd->chipCap.TXWISize;
|
||||
UINT8 tx_hw_hdr_len = pAd->chipCap.tx_hw_hdr_len;
|
||||
UCHAR Cat = 11;//Tim Category field
|
||||
UCHAR Act = 0;//Tim Action field
|
||||
UCHAR ChkBcn = 0;//Check Beacon field init from 0.
|
||||
//UCHAR *pTim;
|
||||
//UCHAR ID_1B, TimFirst, TimLast;
|
||||
//UINT i;
|
||||
|
||||
if(!TimTransmitRequired(pAd, apidx, pMbss))
|
||||
return;
|
||||
|
||||
if (pMbss->tim_buf.TimPkt == NULL) {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s():Invalid TimPkt for MBSS[%d]\n",
|
||||
__func__, apidx));
|
||||
return;
|
||||
}
|
||||
|
||||
tmac_info = (UCHAR *)GET_OS_PKT_DATAPTR(pMbss->tim_buf.TimPkt);
|
||||
pTimFrame = (UCHAR *)(tmac_info + tx_hw_hdr_len);
|
||||
|
||||
ActHeaderInit(pAd,
|
||||
&TimHdr,
|
||||
BROADCAST_ADDR,
|
||||
pMbss->wdev.if_addr,
|
||||
pMbss->wdev.bssid);
|
||||
|
||||
|
||||
MakeOutgoingFrame(pTimFrame, &FrameLen,
|
||||
sizeof(HEADER_802_11), &TimHdr,
|
||||
1, &Cat,
|
||||
1, &Act,
|
||||
1, &ChkBcn,
|
||||
TIMESTAMP_LEN, &FakeTimestamp,
|
||||
END_OF_ARGS);
|
||||
|
||||
TimTransmit.word = 0;
|
||||
|
||||
pMbss->TimIELocationInTim = (UCHAR)FrameLen;
|
||||
|
||||
/*
|
||||
step 2 - update TIM IE
|
||||
TODO: enlarge TIM bitmap to support up to 64 STAs
|
||||
TODO: re-measure if RT2600 TBTT interrupt happens faster than BEACON sent out time
|
||||
*/
|
||||
ptr = pTimFrame + (UCHAR)FrameLen;
|
||||
*ptr = IE_TIM;
|
||||
*(ptr+1) = 0x0e;
|
||||
*(ptr + 2) = pAd->ApCfg.DtimCount;
|
||||
*(ptr + 3) = pAd->ApCfg.DtimPeriod;
|
||||
|
||||
*(ptr + 4) = 0xa0;
|
||||
*(ptr + 5) = 0xa0;
|
||||
*(ptr + 6) = 0xa0;
|
||||
*(ptr + 7) = 0xa0;
|
||||
*(ptr + 8) = 0xa0;
|
||||
*(ptr + 9) = 0xa0;
|
||||
*(ptr + 10) = 0xa0;
|
||||
*(ptr + 11) = 0xa0;
|
||||
*(ptr + 12) = 0xa0;
|
||||
*(ptr + 13) = 0xa0;
|
||||
*(ptr + 14) = 0xa0;
|
||||
*(ptr + 15) = 0xa0;
|
||||
|
||||
|
||||
// /* find the smallest AID (PS mode) */
|
||||
// TimFirst = 0; /* record first TIM byte != 0x00 */
|
||||
// TimLast = 0; /* record last TIM byte != 0x00 */
|
||||
// pTim = pMbss->TimBitmaps;
|
||||
//
|
||||
// for(ID_1B=0; ID_1B<WLAN_MAX_NUM_OF_TIM; ID_1B++)
|
||||
// {
|
||||
// /* get the TIM indicating PS packets for 8 stations */
|
||||
// UCHAR tim_1B = pTim[ID_1B];
|
||||
//
|
||||
// if (ID_1B == 0)
|
||||
// tim_1B &= 0xfe; /* skip bit0 bc/mc */
|
||||
//
|
||||
// if (tim_1B == 0)
|
||||
// continue; /* find next 1B */
|
||||
//
|
||||
// if (TimFirst == 0)
|
||||
// TimFirst = ID_1B;
|
||||
//
|
||||
// TimLast = ID_1B;
|
||||
// }
|
||||
//
|
||||
// /* fill TIM content to beacon buffer */
|
||||
// if (TimFirst & 0x01)
|
||||
// TimFirst --; /* find the even offset byte */
|
||||
//
|
||||
// *(ptr + 1) = 3+(TimLast-TimFirst+1); /* TIM IE length */
|
||||
// *(ptr + 4) = TimFirst;
|
||||
//
|
||||
// for(i=TimFirst; i<=TimLast; i++)
|
||||
// *(ptr + 5 + i - TimFirst) = pTim[i];
|
||||
//
|
||||
// /* bit0 means backlogged mcast/bcast */
|
||||
// /* per spec, this bit in TIM frame shall always 0. */
|
||||
// //TODO: MTK proprietary mechanism.
|
||||
// //if (pAd->ApCfg.DtimCount == 0)
|
||||
// //*(ptr + 4) |= (pMbss->TimBitmaps[WLAN_CT_TIM_BCMC_OFFSET] & 0x01);
|
||||
// *(ptr + 4) = 0;
|
||||
|
||||
/* adjust TIM length according to the new TIM */
|
||||
FrameLen += 16;//(2 + *(ptr+1));
|
||||
|
||||
/* When Beacon is use CCK to send, TIM shall use OFDM to send. and it's mandatory. */
|
||||
if (pAd->CommonCfg.Channel <= 14) {
|
||||
TimTransmit.field.MODE = MODE_OFDM;
|
||||
TimTransmit.field.MCS = MCS_RATE_6;
|
||||
}
|
||||
|
||||
write_tmac_info_tim(pAd, apidx, tmac_info, &TimTransmit, FrameLen);
|
||||
|
||||
// asic_write_bcn_buf(pAd,
|
||||
// tmac_info, TXWISize,
|
||||
// pTimFrame, FrameLen,
|
||||
// pAd->BeaconOffset[pMbss->bcn_buf.BcnBufIdx]);
|
||||
|
||||
RT28xx_UpdateTimToAsic(pAd, apidx, FrameLen);
|
||||
|
||||
//+++Add by shiang for debug
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s(): Dump the Beacon Packet of BSS%d!\n", __FUNCTION__, apidx));
|
||||
hex_dump("Initial BeaconBuf", tmac_info, FrameLen + tx_hw_hdr_len);
|
||||
//---Add by shiang for debug
|
||||
}
|
||||
|
||||
static UCHAR GetTimNum(RTMP_ADAPTER *pAd)
|
||||
{
|
||||
int i;
|
||||
int NumTim;
|
||||
TIM_BUF_STRUC *tim_info;
|
||||
|
||||
NumTim = 0;
|
||||
for (i=0; i<pAd->ApCfg.BssidNum; i++)
|
||||
{
|
||||
tim_info = &pAd->ApCfg.MBSSID[i].tim_buf;
|
||||
if (tim_info->bTimSntReq)
|
||||
{
|
||||
tim_info->TimBufIdx = NumTim;
|
||||
NumTim ++;
|
||||
}
|
||||
}
|
||||
|
||||
return NumTim;
|
||||
}
|
||||
|
||||
VOID APMakeAllTimFrame(RTMP_ADAPTER *pAd)
|
||||
{
|
||||
INT i;
|
||||
//UCHAR NumOfTims;
|
||||
|
||||
/* choose the Beacon number */
|
||||
/*NumOfTims =*/ GetTimNum(pAd);
|
||||
|
||||
for(i=0; i<pAd->ApCfg.BssidNum; i++) {
|
||||
APMakeBssTimFrame(pAd, i);
|
||||
// APMakeBssTimFrame2(pAd, i);//Carter, for test tttt 2 pkt purpose
|
||||
}
|
||||
}
|
||||
|
||||
INT wdev_tim_buf_init(RTMP_ADAPTER *pAd, TIM_BUF_STRUC *tim_info)
|
||||
{
|
||||
//bcn_info->bBcnSntReq = FALSE;
|
||||
tim_info->TimBufIdx = HW_BEACON_MAX_NUM;
|
||||
|
||||
if (!tim_info->TimPkt) {
|
||||
RTMPAllocateNdisPacket(pAd, &tim_info->TimPkt, NULL, 0, NULL, MAX_TIM_SIZE);
|
||||
//NdisAllocateSpinLock(pAd, &bcn_info->bcn_lock);
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s():TimPkt is allocated!\n", __func__));
|
||||
|
||||
}
|
||||
// if (!tim_info->TimPkt2) {
|
||||
// RTMPAllocateNdisPacket(pAd, &tim_info->TimPkt2, NULL, NULL, NULL, MAX_TIM_SIZE);
|
||||
//NdisAllocateSpinLock(pAd, &bcn_info->bcn_lock);
|
||||
// } else {
|
||||
// DBGPRINT(RT_DEBUG_OFF, ("%s():TimPkt2 is allocated!\n", __func__));
|
||||
//}
|
||||
tim_info->bTimSntReq = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
#endif /* MT_MAC */
|
||||
923
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_qload.c
Normal file
923
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_qload.c
Normal file
@ -0,0 +1,923 @@
|
||||
/****************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Abstract:
|
||||
|
||||
Provide information on the current STA population and traffic levels
|
||||
in the QBSS.
|
||||
|
||||
This attribute is available only at a QAP. This attribute, when TRUE,
|
||||
indicates that the QAP implementation is capable of generating and
|
||||
transmitting the QBSS load element in the Beacon and Probe Response frames.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
#ifdef AP_QLOAD_SUPPORT
|
||||
|
||||
typedef struct GNU_PACKED _ELM_QBSS_LOAD{
|
||||
|
||||
UINT8 ElementId;
|
||||
UINT8 Length;
|
||||
|
||||
/* the total number of STAs currently associated with this QBSS */
|
||||
UINT16 StationCount;
|
||||
|
||||
/* defined as the percentage of time, nomalized to 255, the QAP sensed the
|
||||
medium busy, as indicated by either the physical or virtual carrier
|
||||
sense mechanism.
|
||||
This percentage is computed using the formula:
|
||||
((channel busy time / (dot11ChannelUtilizationBeaconIntervals *
|
||||
dot11BeaconPeriod * 1024)) * 255) */
|
||||
UINT8 ChanUtil;
|
||||
|
||||
/* specifies the remaining amount of medium time available via explicit
|
||||
admission control, in units of 32 microsecond periods per 1 second.
|
||||
The field is helpful for roaming non-AP QSTAs to select a QAP that is
|
||||
likely to accept future admission control requests, but it does not
|
||||
represent a guarantee that the HC will admit these requests. */
|
||||
UINT16 AvalAdmCap;
|
||||
|
||||
} ELM_QBSS_LOAD;
|
||||
|
||||
#define ELM_QBSS_LOAD_ID 11
|
||||
#define ELM_QBSS_LOAD_LEN 5
|
||||
|
||||
/*
|
||||
We will send a alarm when channel busy time (primary or secondary) >=
|
||||
Time Threshold and Num Threshold.
|
||||
|
||||
QBSS_LOAD_ALRAM_BUSY_TIME_THRESHOLD = 0 means alarm function is disabled.
|
||||
|
||||
If you want to enable it, use command
|
||||
"iwpriv ra0 set qloadalarmtimethres=90"
|
||||
*/
|
||||
#define QBSS_LOAD_ALRAM_BUSY_TIME_THRESHOLD 0 /* unit: % */
|
||||
#define QBSS_LOAD_ALRAM_BUSY_NUM_THRESHOLD 10 /* unit: 1 */
|
||||
|
||||
/* a alarm will not re-issued until QBSS_LOAD_ALARM_DURATION * TBTT */
|
||||
#define QBSS_LOAD_ALARM_DURATION 100 /* unit: TBTT */
|
||||
|
||||
|
||||
static VOID QBSS_LoadAlarmSuspend(
|
||||
IN RTMP_ADAPTER *pAd);
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
/* handle a alarm */
|
||||
static VOID QBSS_LoadAlarm(
|
||||
IN RTMP_ADAPTER *pAd);
|
||||
static VOID QBSS_LoadAlarmBusyTimeThresholdReset(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN UINT32 TimePeriod);
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
|
||||
|
||||
|
||||
|
||||
/* --------------------------------- Private -------------------------------- */
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Handle a alarm.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
You can use different methods to handle QBSS Load alarm here.
|
||||
|
||||
Current methods are:
|
||||
1. Change 20/40 to 20-only.
|
||||
2. Change channel to the clear channel.
|
||||
========================================================================
|
||||
*/
|
||||
static VOID QBSS_LoadAlarm(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
{
|
||||
/* suspend alarm until channel switch */
|
||||
QBSS_LoadAlarmSuspend(pAd);
|
||||
|
||||
pAd->phy_ctrl.QloadAlarmNumber ++;
|
||||
|
||||
/* check if we have already been 20M bandwidth */
|
||||
#ifdef DOT11_N_SUPPORT
|
||||
#ifdef DOT11N_DRAFT3
|
||||
if ((pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset != 0) &&
|
||||
(pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth != 0))
|
||||
{
|
||||
MAC_TABLE *pMacTable;
|
||||
UINT32 StaId;
|
||||
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("qbss> Alarm! Change to 20 bw...\n"));
|
||||
|
||||
/* disassociate stations without D3 2040Coexistence function */
|
||||
pMacTable = &pAd->MacTab;
|
||||
|
||||
for(StaId=1; StaId<MAX_LEN_OF_MAC_TABLE; StaId++)
|
||||
{
|
||||
MAC_TABLE_ENTRY *pEntry = &pMacTable->Content[StaId];
|
||||
BOOLEAN bDisconnectSta = FALSE;
|
||||
|
||||
if (!IS_ENTRY_CLIENT(pEntry))
|
||||
continue;
|
||||
|
||||
if (pEntry->Sst != SST_ASSOC)
|
||||
continue;
|
||||
|
||||
if (pEntry->BSS2040CoexistenceMgmtSupport)
|
||||
bDisconnectSta = TRUE;
|
||||
|
||||
if (bDisconnectSta)
|
||||
{
|
||||
/* send wireless event - for ageout */
|
||||
RTMPSendWirelessEvent(pAd, IW_AGEOUT_EVENT_FLAG, pEntry->Addr, 0, 0);
|
||||
|
||||
{
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
NDIS_STATUS NStatus;
|
||||
ULONG FrameLen = 0;
|
||||
HEADER_802_11 DeAuthHdr;
|
||||
USHORT Reason;
|
||||
|
||||
/* send out a DISASSOC request frame */
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);
|
||||
if (NStatus != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, (" MlmeAllocateMemory fail ..\n"));
|
||||
/*NdisReleaseSpinLock(&pAd->MacTabLock); */
|
||||
continue;
|
||||
}
|
||||
|
||||
Reason = REASON_DEAUTH_STA_LEAVING;
|
||||
MgtMacHeaderInit(pAd, &DeAuthHdr, SUBTYPE_DEAUTH, 0,
|
||||
pEntry->Addr,
|
||||
pAd->ApCfg.MBSSID[pEntry->func_tb_idx].wdev.if_addr,
|
||||
pAd->ApCfg.MBSSID[pEntry->func_tb_idx].wdev.bssid);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen,
|
||||
sizeof(HEADER_802_11), &DeAuthHdr,
|
||||
2, &Reason,
|
||||
END_OF_ARGS);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
MlmeFreeMemory(pAd, pOutBuffer);
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("qbss> Alarm! Deauth the station "
|
||||
"%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
PRINT_MAC(pEntry->Addr)));
|
||||
|
||||
MacTableDeleteEntry(pAd, pEntry->wcid, pEntry->Addr);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* for 11n */
|
||||
pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth = 0;
|
||||
pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset = 0;
|
||||
|
||||
/* always 20M */
|
||||
pAd->CommonCfg.RegTransmitSetting.field.BW = BW_20;
|
||||
|
||||
/* mark alarm flag */
|
||||
pAd->phy_ctrl.FlgQloadAlarm = TRUE;
|
||||
|
||||
QBSS_LoadAlarmResume(pAd);
|
||||
}
|
||||
else
|
||||
#endif /* DOT11N_DRAFT3 */
|
||||
#endif /* DOT11_N_SUPPORT */
|
||||
{
|
||||
/* we are in 20MHz bandwidth so try to switch channel */
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("qbss> Alarm! Switch channel...\n"));
|
||||
|
||||
/* send command to switch channel */
|
||||
RTEnqueueInternalCmd(pAd, CMDTHREAD_CHAN_RESCAN, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Re-calculate busy time threshold.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
TimePeriod - TBTT
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
EX: TBTT=100ms, 90%, pAd->QloadBusyTimeThreshold = 90ms
|
||||
========================================================================
|
||||
*/
|
||||
static VOID QBSS_LoadAlarmBusyTimeThresholdReset(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN UINT32 TimePeriod)
|
||||
{
|
||||
pAd->phy_ctrl.QloadBusyTimeThreshold = TimePeriod;
|
||||
pAd->phy_ctrl.QloadBusyTimeThreshold *= pAd->phy_ctrl.QloadAlarmBusyTimeThreshold;
|
||||
pAd->phy_ctrl.QloadBusyTimeThreshold /= 100;
|
||||
pAd->phy_ctrl.QloadBusyTimeThreshold <<= 10; /* translate mini-sec to micro-sec */
|
||||
}
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Initialize ASIC Channel Busy Calculation mechanism.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
Init Condition: WMM must be enabled.
|
||||
========================================================================
|
||||
*/
|
||||
VOID QBSS_LoadInit(RTMP_ADAPTER *pAd)
|
||||
{
|
||||
UINT32 IdBss;
|
||||
|
||||
|
||||
/* check whether any BSS enables WMM feature */
|
||||
for(IdBss=0; IdBss<pAd->ApCfg.BssidNum; IdBss++)
|
||||
{
|
||||
if ((pAd->ApCfg.MBSSID[IdBss].wdev.bWmmCapable)
|
||||
#ifdef DOT11K_RRM_SUPPORT
|
||||
|| (IS_RRM_ENABLE(pAd, IdBss))
|
||||
#endif /* DOT11K_RRM_SUPPORT */
|
||||
)
|
||||
{
|
||||
pAd->phy_ctrl.FlgQloadEnable = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pAd->phy_ctrl.FlgQloadEnable == TRUE)
|
||||
{
|
||||
/* default value is 50, please reference to IEEE802.11e 2005 Annex D */
|
||||
pAd->phy_ctrl.QloadChanUtilBeaconInt = 50;
|
||||
}
|
||||
AsicSetChBusyStat(pAd, pAd->phy_ctrl.FlgQloadEnable);
|
||||
|
||||
pAd->phy_ctrl.QloadChanUtilTotal = 0;
|
||||
pAd->phy_ctrl.QloadUpTimeLast = 0;
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_STATS
|
||||
/* clear busy time statistics */
|
||||
NdisZeroMemory(pAd->phy_ctrl.QloadBusyCountPri, sizeof(pAd->phy_ctrl.QloadBusyCountPri));
|
||||
NdisZeroMemory(pAd->phy_ctrl.QloadBusyCountSec, sizeof(pAd->phy_ctrl.QloadBusyCountSec));
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_STATS */
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
/* init threshold before QBSS_LoadAlarmReset */
|
||||
pAd->phy_ctrl.QloadAlarmBusyTimeThreshold = QBSS_LOAD_ALRAM_BUSY_TIME_THRESHOLD;
|
||||
pAd->phy_ctrl.QloadAlarmBusyNumThreshold = QBSS_LOAD_ALRAM_BUSY_NUM_THRESHOLD;
|
||||
|
||||
QBSS_LoadAlarmReset(pAd);
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Reset alarm function.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
VOID QBSS_LoadAlarmReset(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
{
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
pAd->phy_ctrl.FlgQloadAlarm = FALSE;
|
||||
pAd->phy_ctrl.QloadAlarmDuration = 0;
|
||||
pAd->phy_ctrl.QloadAlarmNumber = 0;
|
||||
|
||||
pAd->phy_ctrl.FlgQloadAlarmIsSuspended = FALSE;
|
||||
|
||||
QBSS_LoadAlarmBusyTimeThresholdReset(pAd, pAd->CommonCfg.BeaconPeriod);
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Resume alarm function.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
VOID QBSS_LoadAlarmResume(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
{
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
pAd->phy_ctrl.FlgQloadAlarmIsSuspended = FALSE;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Suspend alarm function.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
static VOID QBSS_LoadAlarmSuspend(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
{
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
pAd->phy_ctrl.FlgQloadAlarmIsSuspended = TRUE;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Get average busy time in current channel.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
|
||||
Return Value:
|
||||
average busy time
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
UINT32 QBSS_LoadBusyTimeGet(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
{
|
||||
if (pAd->phy_ctrl.QloadChanUtilBeaconCnt == 0)
|
||||
return pAd->phy_ctrl.QloadChanUtilTotal;
|
||||
|
||||
return (pAd->phy_ctrl.QloadChanUtilTotal / pAd->phy_ctrl.QloadChanUtilBeaconCnt);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Check if a alarm is occurred and clear the alarm.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
|
||||
Return Value:
|
||||
TRUE - alarm occurs
|
||||
FALSE - no alarm
|
||||
|
||||
Note:
|
||||
We will clear the alarm in the function.
|
||||
========================================================================
|
||||
*/
|
||||
BOOLEAN QBSS_LoadIsAlarmIssued(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
{
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
BOOLEAN FlgQloadAlarm = pAd->phy_ctrl.FlgQloadAlarm;
|
||||
|
||||
pAd->phy_ctrl.FlgQloadAlarm = FALSE;
|
||||
return FlgQloadAlarm;
|
||||
#else
|
||||
|
||||
return FALSE;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Check if the busy time is accepted.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
|
||||
Return Value:
|
||||
TURE - ok
|
||||
FALSE - fail
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
BOOLEAN QBSS_LoadIsBusyTimeAccepted(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN UINT32 BusyTime)
|
||||
{
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
if (pAd->phy_ctrl.QloadAlarmBusyTimeThreshold == 0)
|
||||
return TRUE; /* always ok */
|
||||
|
||||
if (BusyTime >= pAd->phy_ctrl.QloadBusyTimeThreshold)
|
||||
return FALSE;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HOTSPOT_R2
|
||||
UINT32 QBSS_LoadElementAppend_HSTEST(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
OUT UINT8 *pBeaconBuf,
|
||||
IN UCHAR apidx)
|
||||
{
|
||||
ELM_QBSS_LOAD load, *pLoad = &load;
|
||||
ULONG ElmLen;
|
||||
|
||||
/* check whether channel busy time calculation is enabled */
|
||||
if (pAd->phy_ctrl.FlgQloadEnable == 0)
|
||||
return 0;
|
||||
/* End of if */
|
||||
|
||||
/* init */
|
||||
pLoad->ElementId = ELM_QBSS_LOAD_ID;
|
||||
pLoad->Length = ELM_QBSS_LOAD_LEN;
|
||||
|
||||
pLoad->StationCount = le2cpu16(pAd->ApCfg.MBSSID[apidx].HotSpotCtrl.QLoadStaCnt);
|
||||
pLoad->ChanUtil = pAd->ApCfg.MBSSID[apidx].HotSpotCtrl.QLoadCU;
|
||||
|
||||
/* because no ACM is supported, the available bandwidth is 1 sec */
|
||||
pLoad->AvalAdmCap = le2cpu16(0xffff); /* 0x7a12 * 32us = 1 second */
|
||||
|
||||
|
||||
/* copy the element to the frame */
|
||||
MakeOutgoingFrame(pBeaconBuf, &ElmLen,
|
||||
sizeof(ELM_QBSS_LOAD), pLoad,
|
||||
END_OF_ARGS);
|
||||
|
||||
return ElmLen;
|
||||
} /* End of QBSS_LoadElementAppend */
|
||||
#endif
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Append the QBSS Load element to the beacon frame.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
*pBeaconBuf - the beacon or probe response frame
|
||||
|
||||
Return Value:
|
||||
the element total Length
|
||||
|
||||
Note:
|
||||
Append Condition: You must check whether WMM is enabled before the
|
||||
function is using.
|
||||
========================================================================
|
||||
*/
|
||||
UINT32 QBSS_LoadElementAppend(RTMP_ADAPTER *pAd, UINT8 *pBeaconBuf)
|
||||
{
|
||||
ELM_QBSS_LOAD load, *pLoad = &load;
|
||||
ULONG ElmLen;
|
||||
|
||||
|
||||
/* check whether channel busy time calculation is enabled */
|
||||
if (pAd->phy_ctrl.FlgQloadEnable == 0)
|
||||
return 0;
|
||||
|
||||
/* init */
|
||||
pLoad->ElementId = ELM_QBSS_LOAD_ID;
|
||||
pLoad->Length = ELM_QBSS_LOAD_LEN;
|
||||
|
||||
pLoad->StationCount = le2cpu16(MacTableAssocStaNumGet(pAd));
|
||||
pLoad->ChanUtil = pAd->phy_ctrl.QloadChanUtil;
|
||||
|
||||
/* because no ACM is supported, the available bandwidth is 1 sec */
|
||||
pLoad->AvalAdmCap = le2cpu16(0x7a12); /* 0x7a12 * 32us = 1 second */
|
||||
|
||||
|
||||
/* copy the element to the frame */
|
||||
MakeOutgoingFrame(pBeaconBuf, &ElmLen,
|
||||
sizeof(ELM_QBSS_LOAD), pLoad,
|
||||
END_OF_ARGS);
|
||||
|
||||
return ElmLen;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Update Channel Utilization.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
UpTime - current up time
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
UpTime is used in QLOAD_FUNC_BUSY_TIME_STATS & QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
|
||||
If UpTime != 0, it means that the time period calling the function
|
||||
maybe not TBTT so we need to re-calculate the time period.
|
||||
|
||||
If you call the function in kernel thread, the time period sometimes
|
||||
will not accurate due to kernel thread is not real-time, so we need to
|
||||
recalculate the time period.
|
||||
========================================================================
|
||||
*/
|
||||
VOID QBSS_LoadUpdate(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN ULONG UpTime)
|
||||
{
|
||||
UINT32 ChanUtilNu, ChanUtilDe;
|
||||
UINT32 BusyTime = 0;
|
||||
UINT32 BusyTimeId;
|
||||
UINT32 TimePeriod = pAd->CommonCfg.BeaconPeriod;
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
BOOLEAN FlgIsBusyOverThreshold = FALSE;
|
||||
BOOLEAN FlgIsAlarmNeeded = FALSE;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
|
||||
|
||||
/* check whether channel busy time calculation is enabled */
|
||||
if ((pAd->phy_ctrl.FlgQloadEnable == 0) ||
|
||||
(pAd->phy_ctrl.FlgQloadAlarmIsSuspended == TRUE))
|
||||
return;
|
||||
|
||||
/* calculate new time period if needed */
|
||||
if ((UpTime > 0) &&
|
||||
(pAd->phy_ctrl.QloadUpTimeLast > 0) &&
|
||||
(UpTime > pAd->phy_ctrl.QloadUpTimeLast))
|
||||
{
|
||||
/* re-calculate time period */
|
||||
TimePeriod = (UINT32)(UpTime - pAd->phy_ctrl.QloadUpTimeLast);
|
||||
|
||||
/* translate to mini-second */
|
||||
TimePeriod = (TimePeriod*1000)/OS_HZ;
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
/* re-calculate QloadBusyTimeThreshold */
|
||||
if (TimePeriod != pAd->phy_ctrl.QloadTimePeriodLast)
|
||||
QBSS_LoadAlarmBusyTimeThresholdReset(pAd, TimePeriod);
|
||||
|
||||
pAd->phy_ctrl.QloadTimePeriodLast = TimePeriod;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
}
|
||||
|
||||
/* update up time */
|
||||
pAd->phy_ctrl.QloadUpTimeLast = UpTime;
|
||||
|
||||
/* do busy time statistics */
|
||||
#ifdef DOT11_N_SUPPORT
|
||||
if ((pAd->CommonCfg.AddHTInfo.AddHtInfo.ExtChanOffset != 0) &&
|
||||
(pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth != 0))
|
||||
{
|
||||
/* in 20MHz, no need to check busy time of secondary channel */
|
||||
BusyTime = AsicGetChBusyCnt(pAd, 1);
|
||||
pAd->phy_ctrl.QloadLatestChannelBusyTimeSec = BusyTime;
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_STATS
|
||||
BusyTimeId = BusyTime >> 10; /* translate us to ms */
|
||||
|
||||
/* ex:95ms, 95*20/100 = 19 */
|
||||
BusyTimeId = (BusyTimeId*QLOAD_BUSY_INTERVALS)/TimePeriod;
|
||||
|
||||
if (BusyTimeId >= QLOAD_BUSY_INTERVALS)
|
||||
BusyTimeId = QLOAD_BUSY_INTERVALS - 1;
|
||||
|
||||
pAd->phy_ctrl.QloadBusyCountSec[BusyTimeId] ++;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_STATS */
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
if ((pAd->phy_ctrl.FlgQloadAlarmIsSuspended == FALSE) &&
|
||||
(pAd->phy_ctrl.QloadAlarmBusyTimeThreshold > 0))
|
||||
{
|
||||
/* Alarm is not suspended and is enabled */
|
||||
|
||||
if ((pAd->phy_ctrl.QloadBusyTimeThreshold != 0) &&
|
||||
(BusyTime >= pAd->phy_ctrl.QloadBusyTimeThreshold))
|
||||
{
|
||||
FlgIsBusyOverThreshold = TRUE;
|
||||
}
|
||||
}
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
}
|
||||
#endif /* DOT11_N_SUPPORT */
|
||||
|
||||
/* do busy time statistics for primary channel */
|
||||
BusyTime = AsicGetChBusyCnt(pAd, 0);
|
||||
pAd->phy_ctrl.QloadLatestChannelBusyTimePri = BusyTime;
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_STATS
|
||||
BusyTimeId = BusyTime >> 10; /* translate us to ms */
|
||||
|
||||
/* ex:95ms, 95*20/100 = 19 */
|
||||
BusyTimeId = (BusyTimeId*QLOAD_BUSY_INTERVALS)/TimePeriod;
|
||||
|
||||
if (BusyTimeId >= QLOAD_BUSY_INTERVALS)
|
||||
BusyTimeId = QLOAD_BUSY_INTERVALS - 1;
|
||||
|
||||
pAd->phy_ctrl.QloadBusyCountPri[BusyTimeId] ++;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_STATS */
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
if ((pAd->phy_ctrl.FlgQloadAlarmIsSuspended == FALSE) &&
|
||||
(pAd->phy_ctrl.QloadAlarmBusyTimeThreshold > 0))
|
||||
{
|
||||
/* Alarm is not suspended and is enabled */
|
||||
|
||||
if ((pAd->phy_ctrl.QloadBusyTimeThreshold != 0) &&
|
||||
(BusyTime >= pAd->phy_ctrl.QloadBusyTimeThreshold))
|
||||
{
|
||||
FlgIsBusyOverThreshold = TRUE;
|
||||
}
|
||||
}
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
|
||||
/* accumulate channel busy time for primary channel */
|
||||
pAd->phy_ctrl.QloadChanUtilTotal += BusyTime;
|
||||
|
||||
/* update new channel utilization for primary channel */
|
||||
if (++pAd->phy_ctrl.QloadChanUtilBeaconCnt >= pAd->phy_ctrl.QloadChanUtilBeaconInt)
|
||||
{
|
||||
ChanUtilNu = pAd->phy_ctrl.QloadChanUtilTotal;
|
||||
ChanUtilNu *= 255;
|
||||
|
||||
ChanUtilDe = pAd->phy_ctrl.QloadChanUtilBeaconInt;
|
||||
|
||||
/*
|
||||
Still use pAd->CommonCfg.BeaconPeriod.
|
||||
Because we change QloadChanUtil not every TBTT.
|
||||
*/
|
||||
ChanUtilDe *= pAd->CommonCfg.BeaconPeriod;
|
||||
|
||||
ChanUtilDe <<= 10; /* ms to us */
|
||||
|
||||
pAd->phy_ctrl.QloadChanUtil = (UINT8)(ChanUtilNu/ChanUtilDe);
|
||||
|
||||
/* re-accumulate channel busy time */
|
||||
pAd->phy_ctrl.QloadChanUtilBeaconCnt = 0;
|
||||
pAd->phy_ctrl.QloadChanUtilTotal = 0;
|
||||
}
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
/* check if alarm function is enabled */
|
||||
if ((pAd->phy_ctrl.FlgQloadAlarmIsSuspended == FALSE) &&
|
||||
(pAd->phy_ctrl.QloadAlarmBusyTimeThreshold > 0))
|
||||
{
|
||||
/* Alarm is not suspended and is enabled */
|
||||
|
||||
/* check if we need to issue a alarm */
|
||||
if (FlgIsBusyOverThreshold == TRUE)
|
||||
{
|
||||
if (pAd->phy_ctrl.QloadAlarmDuration == 0)
|
||||
{
|
||||
/* last alarm ended so we can check new alarm */
|
||||
|
||||
pAd->phy_ctrl.QloadAlarmBusyNum ++;
|
||||
|
||||
if (pAd->phy_ctrl.QloadAlarmBusyNum >= pAd->phy_ctrl.QloadAlarmBusyNumThreshold)
|
||||
{
|
||||
/*
|
||||
The continued number of busy time >= threshold is larger
|
||||
than number threshold so issuing a alarm.
|
||||
*/
|
||||
FlgIsAlarmNeeded = TRUE;
|
||||
pAd->phy_ctrl.QloadAlarmDuration ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
pAd->phy_ctrl.QloadAlarmBusyNum = 0;
|
||||
|
||||
if (pAd->phy_ctrl.QloadAlarmDuration > 0)
|
||||
{
|
||||
/*
|
||||
New alarm occurs so we can not re-issue new alarm during
|
||||
QBSS_LOAD_ALARM_DURATION * TBTT.
|
||||
*/
|
||||
if (++pAd->phy_ctrl.QloadAlarmDuration >= QBSS_LOAD_ALARM_DURATION)
|
||||
{
|
||||
/* can re-issue next alarm */
|
||||
pAd->phy_ctrl.QloadAlarmDuration = 0;
|
||||
pAd->phy_ctrl.QloadAlarmBusyNum = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (FlgIsAlarmNeeded == TRUE)
|
||||
QBSS_LoadAlarm(pAd);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* clear statistics counts */
|
||||
pAd->phy_ctrl.QloadAlarmBusyNum = 0;
|
||||
pAd->phy_ctrl.QloadAlarmDuration = 0;
|
||||
pAd->phy_ctrl.FlgQloadAlarm = FALSE;
|
||||
}
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Clear QoS Load information.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
VOID QBSS_LoadStatusClear(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
{
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_STATS
|
||||
/* clear busy time statistics */
|
||||
NdisZeroMemory(pAd->phy_ctrl.QloadBusyCountPri, sizeof(pAd->phy_ctrl.QloadBusyCountPri));
|
||||
NdisZeroMemory(pAd->phy_ctrl.QloadBusyCountSec, sizeof(pAd->phy_ctrl.QloadBusyCountSec));
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_STATS */
|
||||
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
/* clear alarm function variables */
|
||||
pAd->phy_ctrl.QloadChanUtilTotal = 0;
|
||||
pAd->phy_ctrl.FlgQloadAlarm = FALSE;
|
||||
pAd->phy_ctrl.QloadAlarmBusyNum = 0;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Show QoS Load information.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
Arg - Input arguments
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT Show_QoSLoad_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg)
|
||||
{
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_STATS
|
||||
UINT32 BusyTimeId;
|
||||
#ifdef DBG
|
||||
UINT32 Time;
|
||||
Time = pAd->CommonCfg.BeaconPeriod / QLOAD_BUSY_INTERVALS;
|
||||
#endif /* DBG */
|
||||
DBGPRINT(RT_DEBUG_OFF, ("\n\tPrimary Busy Time\tTimes\n"));
|
||||
|
||||
for(BusyTimeId=0; BusyTimeId<QLOAD_BUSY_INTERVALS; BusyTimeId++)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_OFF, ("\t%dms ~ %dms\t\t%d\n",
|
||||
BusyTimeId*Time,
|
||||
(BusyTimeId+1)*Time,
|
||||
pAd->phy_ctrl.QloadBusyCountPri[BusyTimeId]));
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("\n\tSecondary Busy Time\tTimes\n"));
|
||||
|
||||
for(BusyTimeId=0; BusyTimeId<QLOAD_BUSY_INTERVALS; BusyTimeId++)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_OFF, ("\t%dms ~ %dms\t\t%d\n",
|
||||
BusyTimeId*Time,
|
||||
(BusyTimeId+1)*Time,
|
||||
pAd->phy_ctrl.QloadBusyCountSec[BusyTimeId]));
|
||||
}
|
||||
#else
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("\tBusy time statistics is not included into the driver!\n"));
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_STATS */
|
||||
|
||||
DBGPRINT(RT_DEBUG_OFF, ("\n"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Command for QoS Load information clear.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
Arg - Input arguments
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT Set_QloadClr_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg)
|
||||
{
|
||||
QBSS_LoadStatusClear(pAd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Command for QoS Alarm Time Threshold set.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
Arg - Input arguments
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT Set_QloadAlarmTimeThreshold_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *Arg)
|
||||
{
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
pAd->phy_ctrl.QloadAlarmBusyTimeThreshold = (UCHAR)simple_strtol(Arg, 0, 10);
|
||||
|
||||
QBSS_LoadAlarmReset(pAd);
|
||||
|
||||
pAd->phy_ctrl.QloadTimePeriodLast = pAd->CommonCfg.BeaconPeriod;
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Command for QoS Alarm Number Threshold set.
|
||||
|
||||
Arguments:
|
||||
pAd - WLAN control block pointer
|
||||
Arg - Input arguments
|
||||
|
||||
Return Value:
|
||||
None
|
||||
|
||||
Note:
|
||||
========================================================================
|
||||
*/
|
||||
INT Set_QloadAlarmNumThreshold_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *Arg)
|
||||
{
|
||||
#ifdef QLOAD_FUNC_BUSY_TIME_ALARM
|
||||
pAd->phy_ctrl.QloadAlarmBusyNumThreshold = (UCHAR)simple_strtol(Arg, 0, 10);
|
||||
#endif /* QLOAD_FUNC_BUSY_TIME_ALARM */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* AP_QLOAD_SUPPORT */
|
||||
|
||||
1027
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_repeater.c
Normal file
1027
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_repeater.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
||||
/****************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
****************************************************************************
|
||||
|
||||
Module Name:
|
||||
ap_sanity.c
|
||||
|
||||
Abstract:
|
||||
Handle association related requests either from WSTA or from local MLME
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
John Chang 08-14-2003 created for 11g soft-AP
|
||||
John Chang 12-30-2004 merge with STA driver for RT2600
|
||||
*/
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
2296
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_sync.c
Normal file
2296
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_sync.c
Normal file
File diff suppressed because it is too large
Load Diff
1403
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_wds.c
Normal file
1403
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_wds.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,113 @@
|
||||
|
||||
/*
|
||||
***************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
ap_wds.c
|
||||
|
||||
Abstract:
|
||||
Support WDS function.
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
------ ---------- ----------------------------------------------
|
||||
Fonchi 02-13-2007 created
|
||||
*/
|
||||
#define RTMP_MODULE_OS
|
||||
|
||||
#ifdef WDS_SUPPORT
|
||||
|
||||
/*#include "rt_config.h" */
|
||||
#include "rtmp_comm.h"
|
||||
#include "rt_os_util.h"
|
||||
#include "rt_os_net.h"
|
||||
|
||||
|
||||
NET_DEV_STATS *RT28xx_get_wds_ether_stats(PNET_DEV net_dev);
|
||||
|
||||
|
||||
/* Register WDS interface */
|
||||
VOID RT28xx_WDS_Init(VOID *pAd, PNET_DEV net_dev)
|
||||
{
|
||||
RTMP_OS_NETDEV_OP_HOOK netDevOpHook;
|
||||
|
||||
NdisZeroMemory((PUCHAR)&netDevOpHook, sizeof(RTMP_OS_NETDEV_OP_HOOK));
|
||||
netDevOpHook.open = WdsVirtualIF_open;
|
||||
netDevOpHook.stop = WdsVirtualIF_close;
|
||||
netDevOpHook.xmit = rt28xx_send_packets;
|
||||
netDevOpHook.ioctl = rt28xx_ioctl;
|
||||
netDevOpHook.get_stats = RT28xx_get_wds_ether_stats;
|
||||
NdisMoveMemory(&netDevOpHook.devAddr[0], RTMP_OS_NETDEV_GET_PHYADDR(net_dev), MAC_ADDR_LEN);
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("The new WDS interface MAC = %02X:%02X:%02X:%02X:%02X:%02X\n",
|
||||
PRINT_MAC(netDevOpHook.devAddr)));
|
||||
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_WDS_INIT,
|
||||
0, &netDevOpHook, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
INT WdsVirtualIF_open(PNET_DEV dev)
|
||||
{
|
||||
VOID *pAd;
|
||||
|
||||
/* increase MODULE use count */
|
||||
RT_MOD_INC_USE_COUNT();
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s: ===> VirtualIF_open\n", RTMP_OS_NETDEV_GET_DEVNAME(dev)));
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(dev);
|
||||
if (VIRTUAL_IF_UP(pAd) != 0)
|
||||
return -1;
|
||||
|
||||
#ifdef CONFIG_RA_HW_NAT_WIFI_NEW_ARCH
|
||||
RT_MOD_HNAT_REG(dev);
|
||||
#endif
|
||||
RTMP_OS_NETDEV_START_QUEUE(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
INT WdsVirtualIF_close(PNET_DEV dev)
|
||||
{
|
||||
VOID *pAd;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s: ===> VirtualIF_close\n", RTMP_OS_NETDEV_GET_DEVNAME(dev)));
|
||||
|
||||
|
||||
pAd = RTMP_OS_NETDEV_GET_PRIV(dev);
|
||||
|
||||
//RTMP_OS_NETDEV_CARRIER_OFF(dev);
|
||||
RTMP_OS_NETDEV_STOP_QUEUE(dev);
|
||||
|
||||
#ifdef CONFIG_RA_HW_NAT_WIFI_NEW_ARCH
|
||||
RT_MOD_HNAT_DEREG(dev);
|
||||
#endif
|
||||
VIRTUAL_IF_DOWN(pAd);
|
||||
|
||||
RT_MOD_DEC_USE_COUNT();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VOID RT28xx_WDS_Remove(VOID *pAd)
|
||||
{
|
||||
RTMP_AP_IoctlHandle(pAd, NULL, CMD_RTPRIV_IOCTL_WDS_REMOVE, 0, NULL, 0);
|
||||
}
|
||||
|
||||
#endif /* WDS_SUPPORT */
|
||||
1545
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_wpa.c
Normal file
1545
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/ap_wpa.c
Normal file
File diff suppressed because it is too large
Load Diff
1288
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/apcli_assoc.c
Normal file
1288
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/apcli_assoc.c
Normal file
File diff suppressed because it is too large
Load Diff
1132
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/apcli_auth.c
Normal file
1132
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/apcli_auth.c
Normal file
File diff suppressed because it is too large
Load Diff
2105
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/apcli_ctrl.c
Normal file
2105
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/apcli_ctrl.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,144 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002-2006, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
apcli_ctrl.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Fonchi 2006-06-23 modified for rt61-APClinent
|
||||
*/
|
||||
#ifdef APCLI_SUPPORT
|
||||
#ifdef APCLI_LINK_COVER_SUPPORT
|
||||
#include "rt_config.h"
|
||||
|
||||
extern VOID* p5G_pAd;
|
||||
extern VOID* p2G_pAd;
|
||||
|
||||
INT ApcliLinkMonitorThread(
|
||||
IN ULONG Context)
|
||||
{
|
||||
RTMP_ADAPTER *pAd;
|
||||
RTMP_ADAPTER *pAd_other_band;
|
||||
RTMP_OS_TASK *pTask;
|
||||
int status;
|
||||
status = 0;
|
||||
|
||||
pTask = (RTMP_OS_TASK *)Context;
|
||||
pAd = (PRTMP_ADAPTER)RTMP_OS_TASK_DATA_GET(pTask);
|
||||
|
||||
RtmpOSTaskCustomize(pTask);
|
||||
|
||||
if (p2G_pAd == NULL) {
|
||||
printk("##### no 2G pAd!!!\n");
|
||||
//RtmpOSTaskNotifyToExit(pTask);
|
||||
// return 0;
|
||||
} else if (p5G_pAd == NULL) {
|
||||
printk("##### no 5G pAd!!!\n");
|
||||
//RtmpOSTaskNotifyToExit(pTask);
|
||||
// return 0;
|
||||
}
|
||||
if (p5G_pAd == pAd) {
|
||||
printk("we are 5G interface, wait 2G link update\n");
|
||||
pAd_other_band = p2G_pAd;
|
||||
}
|
||||
else {
|
||||
printk("we are 2G interface, wait 5G link update\n");
|
||||
pAd_other_band = p5G_pAd;
|
||||
}
|
||||
|
||||
while (pTask && !RTMP_OS_TASK_IS_KILLED(pTask) && (pAd_other_band != NULL))
|
||||
{
|
||||
if (RtmpOSTaskWait(pAd, pTask, &status) == FALSE)
|
||||
{
|
||||
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
|
||||
break;
|
||||
}
|
||||
if (status != 0)
|
||||
break;
|
||||
//TODO: wait_for_completion
|
||||
}
|
||||
|
||||
/* notify the exit routine that we're actually exiting now
|
||||
*
|
||||
* complete()/wait_for_completion() is similar to up()/down(),
|
||||
* except that complete() is safe in the case where the structure
|
||||
* is getting deleted in a parallel mode of execution (i.e. just
|
||||
* after the down() -- that's necessary for the thread-shutdown
|
||||
* case.
|
||||
*
|
||||
* complete_and_exit() goes even further than this -- it is safe in
|
||||
* the case that the thread of the caller is going away (not just
|
||||
* the structure) -- this is necessary for the module-remove case.
|
||||
* This is important in preemption kernels, which transfer the flow
|
||||
* of execution immediately upon a complete().
|
||||
*/
|
||||
printk("<---ApcliLinkMonitorThread\n");
|
||||
|
||||
//if (pTask)
|
||||
// RtmpOSTaskNotifyToExit(pTask);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NDIS_STATUS RtmpApcliLinkTaskInit(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
RTMP_OS_TASK *pTask;
|
||||
NDIS_STATUS status;
|
||||
|
||||
printk("##### %s\n", __func__);
|
||||
/* Creat ApCli Link Monitor Thread */
|
||||
pTask = &pAd->apcliLinkTask;
|
||||
RTMP_OS_TASK_INIT(pTask, "LinkMonitorTask", pAd);
|
||||
//status = RtmpOSTaskAttach(pTask, RTPCICmdThread, (ULONG)pTask);
|
||||
status = RtmpOSTaskAttach(pTask, ApcliLinkMonitorThread, (ULONG)pTask);
|
||||
if (status == NDIS_STATUS_FAILURE)
|
||||
{
|
||||
/* printk ("%s: unable to start RTPCICmdThread\n", RTMP_OS_NETDEV_GET_DEVNAME(pAd->net_dev)); */
|
||||
printk ("%s: Unable to start ApcliLinkMonitorThread!\n", get_dev_name_prefix(pAd, INT_APCLI));
|
||||
return NDIS_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID RtmpApcliLinkTaskExit(
|
||||
IN RTMP_ADAPTER *pAd)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
printk("##### %s\n", __func__);
|
||||
/* Terminate cmdQ thread */
|
||||
RTMP_OS_TASK_LEGALITY(&pAd->apcliLinkTask)
|
||||
{
|
||||
/*RTUSBCMDUp(&pAd->cmdQTask); */
|
||||
ret = RtmpOSTaskKill(&pAd->apcliLinkTask);
|
||||
if (ret == NDIS_STATUS_FAILURE)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("Kill command task fail!\n"));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#endif /* APCLI_LINK_COVER_SUPPORT */
|
||||
#endif /* APCLI_SUPPORT */
|
||||
|
||||
1581
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/apcli_sync.c
Normal file
1581
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ap/apcli_sync.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,551 @@
|
||||
|
||||
#ifdef SNIFFER_MIB_CMD
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
VOID sniffer_timeout(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3);
|
||||
|
||||
BUILD_TIMER_FUNCTION(sniffer_timeout);
|
||||
|
||||
INT sniffer_channel_restore(IN RTMP_ADAPTER *pAd)
|
||||
{
|
||||
INT bw, ch;
|
||||
pAd->hw_cfg.bbp_bw = pAd->ApCfg.sniffer_mib_ctrl.bbp_bw;
|
||||
#ifdef DOT11_VHT_AC
|
||||
pAd->CommonCfg.vht_cent_ch = pAd->ApCfg.sniffer_mib_ctrl.vht_cent_ch;
|
||||
#endif /* DOT11_VHT_AC */
|
||||
pAd->CommonCfg.CentralChannel = pAd->ApCfg.sniffer_mib_ctrl.CentralChannel;
|
||||
pAd->CommonCfg.Channel = pAd->ApCfg.sniffer_mib_ctrl.Channel;
|
||||
|
||||
bbp_set_bw(pAd, pAd->hw_cfg.bbp_bw);
|
||||
|
||||
#ifdef DOT11_VHT_AC
|
||||
if (pAd->hw_cfg.bbp_bw == BW_80)
|
||||
ch = pAd->CommonCfg.vht_cent_ch;
|
||||
else
|
||||
#endif /* DOT11_VHT_AC */
|
||||
if (pAd->hw_cfg.bbp_bw == BW_40)
|
||||
ch = pAd->CommonCfg.CentralChannel;
|
||||
else
|
||||
ch = pAd->CommonCfg.Channel;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("ch_restore - End of Monitor, restore to %dMHz channel %d\n",
|
||||
bw, ch));
|
||||
|
||||
ASSERT((ch != 0));
|
||||
AsicSwitchChannel(pAd, ch, FALSE);
|
||||
AsicLockChannel(pAd, ch);
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
void sniffer_timeout(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
{
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl = (SNIFFER_MIB_CTRL *)FunctionContext;
|
||||
PRTMP_ADAPTER pAd = psniffer_mib_ctrl->pAd;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s\n", __FUNCTION__));
|
||||
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_OFF, ("%s: fRTMP_ADAPTER_HALT_IN_PROGRESS\n", __FUNCTION__));
|
||||
return;
|
||||
}
|
||||
|
||||
//set back the sniffer mode to off
|
||||
#ifdef CONFIG_SNIFFER_SUPPORT
|
||||
Set_MonitorMode_Proc(pAd,"0");
|
||||
#endif /* CONFIG_SNIFFER_SUPPORT */
|
||||
|
||||
//if (psniffer_mib_ctrl->scan_channel != 0) // restore to original channel
|
||||
{
|
||||
//sniffer_channel_restore(pAd);
|
||||
RTEnqueueInternalCmd(pAd, CMDTHREAD_CHAN_RESTORE, NULL, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_SNIFFER_SUPPORT
|
||||
#ifdef ALL_NET_EVENT
|
||||
VOID vSnifferMacTimeout(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
{
|
||||
INT32 i4AvgRssi = 0;
|
||||
SNIFFER_MAC_CTRL *pMACEntry = (SNIFFER_MAC_CTRL *)FunctionContext;
|
||||
PSNIFFER_MAC_NOTIFY_T pMACEntryNotify = NULL;
|
||||
UCHAR bssid[MAC_ADDR_LEN] = {0}; //report zero bssid, to prevent too many check
|
||||
|
||||
if(pMACEntry == NULL)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s():%d: pMACEntry is NULL!\n", __FUNCTION__,__LINE__));
|
||||
return;
|
||||
}
|
||||
|
||||
pMACEntryNotify = &pMACEntry->rNotify;
|
||||
if(pMACEntryNotify->i4RxPacketConut > 0)
|
||||
{
|
||||
i4AvgRssi = pMACEntryNotify->i4RssiAccum/pMACEntryNotify->i4RxPacketConut;
|
||||
wext_send_event(pMACEntryNotify->pNetDev,pMACEntry->MACAddr,bssid,pMACEntryNotify->u4Channel,i4AvgRssi,FBT_LINK_STA_FOUND_NOTIFY);
|
||||
|
||||
// Only clear data for next collection.
|
||||
NdisZeroMemory(pMACEntryNotify,sizeof(*pMACEntryNotify));
|
||||
}
|
||||
}
|
||||
BUILD_TIMER_FUNCTION(vSnifferMacTimeout);
|
||||
#endif /* ALL_NET_EVENT */
|
||||
#endif /* CONFIG_SNIFFER_SUPPORT */
|
||||
|
||||
VOID sniffer_mib_ctrlInit(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
NdisZeroMemory(psniffer_mib_ctrl, sizeof(SNIFFER_MIB_CTRL));
|
||||
psniffer_mib_ctrl->AgeOutTime = 100 ; //set default 100 ms
|
||||
psniffer_mib_ctrl->pAd = pAd;
|
||||
|
||||
RTMPInitTimer(pAd, &psniffer_mib_ctrl->AgeOutTimer,
|
||||
GET_TIMER_FUNCTION(sniffer_timeout), psniffer_mib_ctrl, FALSE);
|
||||
psniffer_mib_ctrl->AgeOutTimer_Running = FALSE;
|
||||
|
||||
NdisAllocateSpinLock(pAd, &psniffer_mib_ctrl->MAC_ListLock);
|
||||
|
||||
DlListInit(&psniffer_mib_ctrl->MAC_List);
|
||||
|
||||
psniffer_mib_ctrl->MAC_ListNum = 0 ; // if we don't set MAC to listen, we expect to sniffer all
|
||||
}
|
||||
|
||||
|
||||
VOID sniffer_mib_ctrlExit(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl;
|
||||
BOOLEAN Cancelled;
|
||||
SNIFFER_MAC_CTRL *pMACEntry, *pMACEntryTmp;
|
||||
psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
|
||||
if(psniffer_mib_ctrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&psniffer_mib_ctrl->AgeOutTimer, &Cancelled);
|
||||
psniffer_mib_ctrl->AgeOutTimer_Running = FALSE;
|
||||
}
|
||||
RTMPReleaseTimer(&psniffer_mib_ctrl->AgeOutTimer, &Cancelled);
|
||||
|
||||
RTMP_SEM_LOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
DlListForEachSafe(pMACEntry, pMACEntryTmp, &psniffer_mib_ctrl->MAC_List, SNIFFER_MAC_CTRL, List)
|
||||
{
|
||||
#ifdef CONFIG_SNIFFER_SUPPORT
|
||||
#ifdef ALL_NET_EVENT
|
||||
RTMPReleaseTimer(&pMACEntry->rNotifyTimer, &Cancelled);
|
||||
#endif /* ALL_NET_EVENT */
|
||||
#endif /* CONFIG_SNIFFER_SUPPORT */
|
||||
DlListDel(&pMACEntry->List);
|
||||
os_free_mem(NULL, pMACEntry);
|
||||
}
|
||||
DlListInit(&psniffer_mib_ctrl->MAC_List);
|
||||
RTMP_SEM_UNLOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
|
||||
NdisFreeSpinLock(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
}
|
||||
|
||||
INT exsta_proc(IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg)
|
||||
{
|
||||
BOOLEAN find_list = FALSE;
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl;
|
||||
SNIFFER_MAC_CTRL *pMACEntry;
|
||||
UCHAR macAddr[MAC_ADDR_LEN];
|
||||
RTMP_STRING *value;
|
||||
INT i;
|
||||
|
||||
BOOLEAN Cancelled;
|
||||
|
||||
psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: ==>\n",__FUNCTION__));
|
||||
|
||||
if (psniffer_mib_ctrl->MAC_ListNum >= (MAX_NUM_OF_SNIFFER_MAC - 1))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN, ("%s : sniffer mac table is full, and no more entry can join the list!\n",__FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(strlen(arg) != 17) /*Mac address acceptable format 01:02:03:04:05:06 length 17 */
|
||||
return FALSE;
|
||||
|
||||
for (i=0, value = rstrtok(arg,":"); value; value = rstrtok(NULL,":"))
|
||||
{
|
||||
if((strlen(value) != 2) || (!isxdigit(*value)) || (!isxdigit(*(value+1))) )
|
||||
return FALSE; /*Invalid */
|
||||
|
||||
AtoH(value, (UCHAR *)&macAddr[i++], 1);
|
||||
}
|
||||
|
||||
//need to cancel timer ?
|
||||
if(psniffer_mib_ctrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&psniffer_mib_ctrl->AgeOutTimer, &Cancelled);
|
||||
psniffer_mib_ctrl->AgeOutTimer_Running = FALSE;
|
||||
}
|
||||
|
||||
RTMP_SEM_LOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &psniffer_mib_ctrl->MAC_List, SNIFFER_MAC_CTRL, List)
|
||||
{
|
||||
if (MAC_ADDR_EQUAL(pMACEntry->MACAddr, macAddr))
|
||||
{
|
||||
find_list = TRUE;
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s : duplicate mac =%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,PRINT_MAC(macAddr)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
|
||||
if (find_list == FALSE)
|
||||
os_alloc_mem(NULL, (UCHAR **)&pMACEntry, sizeof(*pMACEntry));
|
||||
|
||||
if (!pMACEntry)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s Not available memory\n", __FUNCTION__));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (find_list == FALSE)
|
||||
{
|
||||
RTMP_SEM_LOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
NdisZeroMemory(pMACEntry,sizeof(*pMACEntry));
|
||||
NdisMoveMemory(pMACEntry->MACAddr, macAddr, MAC_ADDR_LEN);
|
||||
#ifdef CONFIG_SNIFFER_SUPPORT
|
||||
#ifdef ALL_NET_EVENT
|
||||
RTMPInitTimer(pAd, &pMACEntry->rNotifyTimer, GET_TIMER_FUNCTION(vSnifferMacTimeout), pMACEntry, TRUE);
|
||||
#endif /* ALL_NET_EVENT */
|
||||
#endif /* CONFIG_SNIFFER_SUPPORT */
|
||||
DlListAddTail(&psniffer_mib_ctrl->MAC_List, &pMACEntry->List);
|
||||
psniffer_mib_ctrl->MAC_ListNum ++;
|
||||
RTMP_SEM_UNLOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT exsta_list_proc(IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg)
|
||||
{
|
||||
SNIFFER_MAC_CTRL *pMACEntry;
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
INT i=0;
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: ==>\n",__FUNCTION__));
|
||||
|
||||
RTMP_SEM_LOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &psniffer_mib_ctrl->MAC_List, SNIFFER_MAC_CTRL, List)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: MAC [%d]=%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,i++, PRINT_MAC(pMACEntry->MACAddr)));
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s:: MAC count=%d\n", __FUNCTION__,i));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT exsta_clear_proc(IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg)
|
||||
{
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl;
|
||||
BOOLEAN Cancelled;
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: ==>\n",__FUNCTION__));
|
||||
|
||||
SNIFFER_MAC_CTRL *pMACEntry, *pMACEntryTmp;
|
||||
psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
|
||||
if(psniffer_mib_ctrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&psniffer_mib_ctrl->AgeOutTimer, &Cancelled);
|
||||
psniffer_mib_ctrl->AgeOutTimer_Running = FALSE;
|
||||
}
|
||||
|
||||
RTMP_SEM_LOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
DlListForEachSafe(pMACEntry, pMACEntryTmp, &psniffer_mib_ctrl->MAC_List, SNIFFER_MAC_CTRL, List)
|
||||
{
|
||||
#ifdef CONFIG_SNIFFER_SUPPORT
|
||||
#ifdef ALL_NET_EVENT
|
||||
RTMPReleaseTimer(&pMACEntry->rNotifyTimer, &Cancelled);
|
||||
#endif /* ALL_NET_EVENT */
|
||||
#endif /* CONFIG_SNIFFER_SUPPORT */
|
||||
DlListDel(&pMACEntry->List);
|
||||
os_free_mem(NULL, pMACEntry);
|
||||
}
|
||||
DlListInit(&psniffer_mib_ctrl->MAC_List);
|
||||
|
||||
psniffer_mib_ctrl->MAC_ListNum = 0;
|
||||
RTMP_SEM_UNLOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
INT set_monitor_channel(IN RTMP_ADAPTER *ad, IN INT bw, IN INT channel, IN INT pri_idx)
|
||||
{
|
||||
UINT8 ext_ch;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s(): bw = %d, channel = %d, pri_idx = %d\n", __FUNCTION__, bw, channel, pri_idx));
|
||||
|
||||
ad->CommonCfg.Channel = channel;
|
||||
if (bw == BW_40) {
|
||||
if (pri_idx == 0) {
|
||||
ad->CommonCfg.CentralChannel = ad->CommonCfg.Channel + 2;
|
||||
ext_ch = EXTCHA_ABOVE;
|
||||
} else if (pri_idx == 1) {
|
||||
ext_ch = EXTCHA_BELOW;
|
||||
if (channel == 14) {
|
||||
ad->CommonCfg.CentralChannel = ad->CommonCfg.Channel - 1;
|
||||
} else {
|
||||
ad->CommonCfg.CentralChannel = ad->CommonCfg.Channel - 2;
|
||||
}
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("pri_idx(%d) is invalid\n"));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (bw == BW_20) {
|
||||
ad->CommonCfg.CentralChannel = channel;
|
||||
} else if ((bw == BW_80) && channel > 14) {
|
||||
#ifdef DOT11_VHT_AC
|
||||
ad->CommonCfg.vht_bw = VHT_BW_80;
|
||||
ad->CommonCfg.vht_cent_ch = vht_cent_ch_freq(ad, ad->CommonCfg.Channel);
|
||||
#endif
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bbp_set_bw(ad, bw);
|
||||
|
||||
/* TX/Rx : control channel setting */
|
||||
#if defined(RTMP_MAC) || defined(RLT_MAC)
|
||||
if (ad->chipCap.hif_type == HIF_RTMP || ad->chipCap.hif_type == HIF_RLT)
|
||||
rtmp_mac_set_ctrlch(ad, ext_ch);
|
||||
#endif /* defined(RTMP_MAC) || defined(RLT_MAC) */
|
||||
|
||||
#ifdef MT_MAC
|
||||
if (ad->chipCap.hif_type == HIF_MT)
|
||||
mt_mac_set_ctrlch(ad, ext_ch);
|
||||
#endif /* MT_MAC */
|
||||
|
||||
bbp_set_ctrlch(ad, ext_ch);
|
||||
|
||||
#ifdef DOT11_VHT_AC
|
||||
if (ad->CommonCfg.BBPCurrentBW == BW_80)
|
||||
ad->hw_cfg.cent_ch = ad->CommonCfg.vht_cent_ch;
|
||||
else
|
||||
#endif /* DOT11_VHT_AC */
|
||||
ad->hw_cfg.cent_ch = ad->CommonCfg.CentralChannel;
|
||||
|
||||
AsicSwitchChannel(ad, ad->hw_cfg.cent_ch, FALSE);
|
||||
AsicLockChannel(ad, ad->hw_cfg.cent_ch);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* trigger sniffer timmer*/
|
||||
INT exsta_scan_proc(IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg)
|
||||
{
|
||||
BOOLEAN Cancelled;
|
||||
ULONG start = 0;
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl;
|
||||
psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
#ifdef CONFIG_SNIFFER_SUPPORT
|
||||
#ifdef ALL_NET_EVENT
|
||||
SNIFFER_MAC_CTRL *pMACEntry = NULL;
|
||||
PSNIFFER_MAC_NOTIFY_T pMACEntryNotify = NULL;
|
||||
#endif /* ALL_NET_EVENT */
|
||||
#endif /* CONFIG_SNIFFER_SUPPORT */
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: ==>\n",__FUNCTION__));
|
||||
|
||||
start = simple_strtol(arg, 0, 10);
|
||||
|
||||
if(psniffer_mib_ctrl->AgeOutTimer_Running == TRUE)
|
||||
{
|
||||
RTMPCancelTimer(&psniffer_mib_ctrl->AgeOutTimer, &Cancelled);
|
||||
psniffer_mib_ctrl->AgeOutTimer_Running = FALSE;
|
||||
#ifdef CONFIG_SNIFFER_SUPPORT
|
||||
#ifdef ALL_NET_EVENT
|
||||
RTMP_SEM_LOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &psniffer_mib_ctrl->MAC_List, SNIFFER_MAC_CTRL, List)
|
||||
{
|
||||
if(pMACEntry)
|
||||
{
|
||||
RTMPCancelTimer(&pMACEntry->rNotifyTimer, &Cancelled);
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
#endif /* ALL_NET_EVENT */
|
||||
#endif /* CONFIG_SNIFFER_SUPPORT */
|
||||
}
|
||||
|
||||
if(start)
|
||||
{
|
||||
if (psniffer_mib_ctrl->AgeOutTime)
|
||||
{
|
||||
RTMPSetTimer(&psniffer_mib_ctrl->AgeOutTimer, psniffer_mib_ctrl->AgeOutTime);
|
||||
psniffer_mib_ctrl->AgeOutTimer_Running = TRUE;
|
||||
|
||||
psniffer_mib_ctrl->bbp_bw = pAd->CommonCfg.BBPCurrentBW;//pAd->hw_cfg.bbp_bw;
|
||||
#ifdef DOT11_VHT_AC
|
||||
psniffer_mib_ctrl->vht_cent_ch = pAd->CommonCfg.vht_cent_ch;
|
||||
#endif /* DOT11_VHT_AC */
|
||||
psniffer_mib_ctrl->CentralChannel = pAd->CommonCfg.CentralChannel;
|
||||
psniffer_mib_ctrl->Channel = pAd->CommonCfg.Channel;
|
||||
|
||||
#ifdef DOT11_VHT_AC
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: psniffer_mib_ctrl->bbp_bw=%d,psniffer_mib_ctrl->CentralChannel=%d,psniffer_mib_ctrl->Channel\n",__FUNCTION__,
|
||||
psniffer_mib_ctrl->bbp_bw,psniffer_mib_ctrl->CentralChannel,psniffer_mib_ctrl->Channel));
|
||||
#else /* DOT11_VHT_AC */
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: psniffer_mib_ctrl->bbp_bw=%d, psniffer_mib_ctrl->vht_cent_ch=%d,psniffer_mib_ctrl->CentralChannel=%d,psniffer_mib_ctrl->Channel\n",__FUNCTION__,
|
||||
psniffer_mib_ctrl->bbp_bw,psniffer_mib_ctrl->vht_cent_ch,psniffer_mib_ctrl->CentralChannel,psniffer_mib_ctrl->Channel));
|
||||
#endif /* !DOT11_VHT_AC */
|
||||
|
||||
// no cmd to set bw, keep the original bw
|
||||
if (psniffer_mib_ctrl->scan_channel == 0)
|
||||
{
|
||||
;// do nothing, don't switch channel
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pAd->hw_cfg.bbp_bw !=BW_20 )
|
||||
{
|
||||
if (psniffer_mib_ctrl->scan_channel <=7 ) //EXTCHA_ABOVE , ch 1~7 use EXTCHA_ABOVE
|
||||
{
|
||||
set_monitor_channel(pAd,psniffer_mib_ctrl->bbp_bw, psniffer_mib_ctrl->scan_channel, 0);
|
||||
}
|
||||
else // others use EXTCHA_BELOW
|
||||
{
|
||||
set_monitor_channel(pAd,psniffer_mib_ctrl->bbp_bw, psniffer_mib_ctrl->scan_channel, 1);
|
||||
}
|
||||
}
|
||||
else //BW_20 case
|
||||
{
|
||||
set_monitor_channel(pAd,psniffer_mib_ctrl->bbp_bw, psniffer_mib_ctrl->scan_channel, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SNIFFER_SUPPORT
|
||||
#ifdef ALL_NET_EVENT
|
||||
RTMP_SEM_LOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
DlListForEach(pMACEntry, &psniffer_mib_ctrl->MAC_List, SNIFFER_MAC_CTRL, List)
|
||||
{
|
||||
if(pMACEntry)
|
||||
{
|
||||
pMACEntryNotify = &pMACEntry->rNotify;
|
||||
NdisZeroMemory(pMACEntryNotify,sizeof(*pMACEntryNotify));
|
||||
RTMPSetTimer(&pMACEntry->rNotifyTimer, SNIFFER_MAC_TIMEOUT);
|
||||
}
|
||||
}
|
||||
RTMP_SEM_UNLOCK(&psniffer_mib_ctrl->MAC_ListLock);
|
||||
#endif /* ALL_NET_EVENT */
|
||||
#endif /* CONFIG_SNIFFER_SUPPORT */
|
||||
Set_MonitorMode_Proc(pAd,"2");
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: psniffer_mib_ctrl->AgeOutTime=%lu, not start timer!\n",__FUNCTION__,psniffer_mib_ctrl->AgeOutTime));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT set_mib_passive_scan_proc(IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg)
|
||||
{
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl;
|
||||
psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
|
||||
ULONG scan_type = (ULONG) simple_strtol(arg, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: ==>\n",__FUNCTION__));
|
||||
|
||||
if (scan_type == PASSIVE_TYPE)
|
||||
{
|
||||
psniffer_mib_ctrl->scan_type = PASSIVE_TYPE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: not implement yet !, force set to PASSIVE_TYPE\n",__FUNCTION__));
|
||||
psniffer_mib_ctrl->scan_type = PASSIVE_TYPE;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: psniffer_mib_ctrl->scan_type=%u\n",__FUNCTION__,psniffer_mib_ctrl->scan_type));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT set_mib_scan_interval_proc(IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg)
|
||||
{
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl;
|
||||
psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
ULONG interval = (ULONG) simple_strtol(arg, 0, 10);
|
||||
|
||||
psniffer_mib_ctrl->AgeOutTime = interval;
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: ==> psniffer_mib_ctrl->AgeOutTime=%u\n",__FUNCTION__,psniffer_mib_ctrl->AgeOutTime));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT set_mib_scan_scope_proc(IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg)
|
||||
{
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl;
|
||||
psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
ULONG scope = (ULONG) simple_strtol(arg, 0, 10);
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: ==>\n",__FUNCTION__));
|
||||
|
||||
if (scope == SCAN_ONE)
|
||||
{
|
||||
psniffer_mib_ctrl->scan_scope = SCAN_ONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: not implement yet !, force set to SCAN_ONE\n",__FUNCTION__));
|
||||
psniffer_mib_ctrl->scan_scope = SCAN_ONE;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: psniffer_mib_ctrl->scan_scope=%u\n",__FUNCTION__,psniffer_mib_ctrl->scan_scope));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT set_mib_scan_channel_proc(IN RTMP_ADAPTER *pAd, IN RTMP_STRING *arg)
|
||||
{
|
||||
PSNIFFER_MIB_CTRL psniffer_mib_ctrl;
|
||||
psniffer_mib_ctrl = &pAd->ApCfg.sniffer_mib_ctrl;
|
||||
ULONG channel;
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: ==>\n",__FUNCTION__));
|
||||
|
||||
channel = (ULONG) simple_strtol(arg, 0, 10);
|
||||
if ((channel>0) && (channel <=14))
|
||||
{
|
||||
psniffer_mib_ctrl->scan_channel = channel;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: ==> error channel=%u, force set to channel 0\n",__FUNCTION__,channel));
|
||||
psniffer_mib_ctrl->scan_channel = 0; // 0 means current channel
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: psniffer_mib_ctrl->scan_channel = %u\n",__FUNCTION__,psniffer_mib_ctrl->scan_channel));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* SNIFFER_MIB_CMD */
|
||||
|
||||
|
||||
1231
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ate/ate_agent.c
Normal file
1231
package/kernel/mt-drivers/mt7603e/src/mt7603_wifi/ate/ate_agent.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,243 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* MediaTek Inc.
|
||||
*
|
||||
* All rights reserved. source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of MediaTek. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of MediaTek, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
ate.h
|
||||
*/
|
||||
|
||||
#ifndef __ATE_H__
|
||||
#define __ATE_H__
|
||||
|
||||
#define ATE_ON(_p) ((((_p)->ATECtrl.Mode) & ATE_START) == ATE_START)
|
||||
INT32 ATEInit(struct _RTMP_ADAPTER *pAd);
|
||||
INT32 ATEExit(struct _RTMP_ADAPTER *pAd);
|
||||
|
||||
/*
|
||||
Use bitmap to allow coexist of ATE_TXFRAME
|
||||
and ATE_RXFRAME(i.e.,to support LoopBack mode).
|
||||
*/
|
||||
#define fATE_IDLE (1 << 0)
|
||||
#define fATE_TX_ENABLE (1 << 1)
|
||||
#define fATE_RX_ENABLE (1 << 2)
|
||||
#define fATE_TXCONT_ENABLE (1 << 3)
|
||||
#define fATE_TXCARR_ENABLE (1 << 4)
|
||||
#define fATE_TXCARRSUPP_ENABLE (1 << 5)
|
||||
#define fATE_RESERVED_1 (1 << 6)
|
||||
#define fATE_RFTEST_ENABLE (1 << 7)
|
||||
#define fATE_EXIT (1 << 8)
|
||||
|
||||
/* Stop Transmission */
|
||||
#define ATE_TXSTOP ((~(fATE_TX_ENABLE))&(~(fATE_TXCONT_ENABLE))&(~(fATE_TXCARR_ENABLE))&(~(fATE_TXCARRSUPP_ENABLE)))
|
||||
/* Stop Receiving Frames */
|
||||
#define ATE_RXSTOP (~(fATE_RX_ENABLE))
|
||||
|
||||
|
||||
/* Enter/Reset ATE */
|
||||
#define ATE_START (fATE_IDLE)
|
||||
/* Stop/Exit ATE */
|
||||
#define ATE_STOP (fATE_EXIT)
|
||||
/* Continuous Transmit Frames (without time gap) */
|
||||
#define ATE_TXCONT ((fATE_TX_ENABLE)|(fATE_TXCONT_ENABLE))
|
||||
/* Transmit Carrier */
|
||||
#define ATE_TXCARR ((fATE_TX_ENABLE)|(fATE_TXCARR_ENABLE))
|
||||
/* Transmit Carrier Suppression (information without carrier) */
|
||||
#define ATE_TXCARRSUPP ((fATE_TX_ENABLE)|(fATE_TXCARRSUPP_ENABLE))
|
||||
/* Transmit Frames */
|
||||
#define ATE_TXFRAME (fATE_TX_ENABLE)
|
||||
/* Receive Frames */
|
||||
#define ATE_RXFRAME (fATE_RX_ENABLE)
|
||||
|
||||
|
||||
#define ATE_RFTEST (fATE_RFTEST_ENABLE)
|
||||
|
||||
#define BULK_OUT_LOCK(pLock, IrqFlags) \
|
||||
if(1 /*!(in_interrupt() & 0xffff0000)*/) \
|
||||
RTMP_IRQ_LOCK((pLock), IrqFlags);
|
||||
|
||||
#define BULK_OUT_UNLOCK(pLock, IrqFlags) \
|
||||
if(1 /*!(in_interrupt() & 0xffff0000)*/) \
|
||||
RTMP_IRQ_UNLOCK((pLock), IrqFlags);
|
||||
|
||||
/* ContiTxTone */
|
||||
#define WF0_TX_ONE_TONE_5M 0x0
|
||||
#define WF0_TX_TWO_TONE_5M 0x1
|
||||
#define WF1_TX_ONE_TONE_5M 0x2
|
||||
#define WF1_TX_TWO_TONE_5M 0x3
|
||||
#define WF0_TX_ONE_TONE_10M 0x4
|
||||
#define WF1_TX_ONE_TONE_10M 0x5
|
||||
#define WF0_TX_ONE_TONE_DC 0x6
|
||||
#define WF1_TX_ONE_TONE_DC 0x7
|
||||
|
||||
struct _RTMP_ADAPTER;
|
||||
struct _RX_BLK;
|
||||
|
||||
typedef struct _ATE_OPERATION {
|
||||
INT32 (*ATEStart)(struct _RTMP_ADAPTER *pAd);
|
||||
INT32 (*ATEStop)(struct _RTMP_ADAPTER *pAd);
|
||||
INT32 (*StartTx)(struct _RTMP_ADAPTER *pAd);
|
||||
INT32 (*StartRx)(struct _RTMP_ADAPTER *pAd);
|
||||
INT32 (*StopTx)(struct _RTMP_ADAPTER *pAd, UINT32 Mode);
|
||||
INT32 (*StopRx)(struct _RTMP_ADAPTER *pAd);
|
||||
INT32 (*SetTxPath)(struct _RTMP_ADAPTER *pAd);
|
||||
INT32 (*SetRxPath)(struct _RTMP_ADAPTER *pAd);
|
||||
INT32 (*SetTxPower0)(struct _RTMP_ADAPTER *pAd, CHAR Value);
|
||||
INT32 (*SetTxPower1)(struct _RTMP_ADAPTER *pAd, CHAR Value);
|
||||
INT32 (*SetTxAntenna)(struct _RTMP_ADAPTER *pAd, CHAR Ant);
|
||||
INT32 (*SetRxAntenna)(struct _RTMP_ADAPTER *pAd, CHAR Ant);
|
||||
INT32 (*SetTxFreqOffset)(struct _RTMP_ADAPTER *pAd, UINT32 FreqOffset);
|
||||
INT32 (*SetChannel)(struct _RTMP_ADAPTER *pAd, INT16 Value);
|
||||
INT32 (*SetBW)(struct _RTMP_ADAPTER *pAd, INT16 Value);
|
||||
INT32 (*SampleRssi)(struct _RTMP_ADAPTER *pAd, struct _RX_BLK *pRxBlk);
|
||||
INT32 (*SetAIFS)(struct _RTMP_ADAPTER *pAd, CHAR Value);
|
||||
INT32 (*SetTSSI)(struct _RTMP_ADAPTER *pAd, CHAR WFSel, CHAR Setting);
|
||||
INT32 (*SetDPD)(struct _RTMP_ADAPTER *pAd, CHAR WFSel, CHAR Setting);
|
||||
INT32 (*StartTxTone)(struct _RTMP_ADAPTER *pAd, UINT32 Mode);
|
||||
INT32 (*SetTxTonePower)(struct _RTMP_ADAPTER *pAd, INT32 pwr1, INT pwr2);
|
||||
INT32 (*StopTxTone)(struct _RTMP_ADAPTER *pAd);
|
||||
INT32 (*StartContinousTx)(struct _RTMP_ADAPTER *pAd, CHAR WFSel);
|
||||
INT32 (*RfRegWrite)(struct _RTMP_ADAPTER *pAd, UINT32 WFSel, UINT32 Offset, UINT32 Value);
|
||||
INT32 (*RfRegRead)(struct _RTMP_ADAPTER *pAd, UINT32 WFSel, UINT32 Offset, UINT32 *Value);
|
||||
INT32 (*GetFWInfo)(struct _RTMP_ADAPTER *pAd, UCHAR *FWInfo);
|
||||
} ATE_OPERATION;
|
||||
|
||||
typedef struct _ATE_CTRL {
|
||||
ATE_OPERATION *ATEOp;
|
||||
#ifdef RTMP_MAC_PCI
|
||||
PVOID AteAllocVa[TX_RING_SIZE];
|
||||
PNDIS_PACKET pAtePacket[TX_RING_SIZE];
|
||||
#endif /* RTMP_MAC_PCI */
|
||||
UINT32 Mode;
|
||||
BOOLEAN PassiveMode;
|
||||
CHAR TxPower0;
|
||||
CHAR TxPower1;
|
||||
CHAR TxPower2;
|
||||
CHAR MinTxPowerBandA; /* Power range of early chipsets is -7~15 in A band */
|
||||
CHAR MaxTxPowerBandA; /* Power range of early chipsets is -7~15 in A band */
|
||||
CHAR TxAntennaSel;
|
||||
CHAR RxAntennaSel;
|
||||
USHORT TxInfoLen;
|
||||
USHORT TxWILen;
|
||||
USHORT QID;
|
||||
UCHAR *TemplateFrame;
|
||||
UCHAR Addr1[MAC_ADDR_LEN];
|
||||
UCHAR Addr2[MAC_ADDR_LEN];
|
||||
UCHAR Addr3[MAC_ADDR_LEN];
|
||||
UCHAR Channel;
|
||||
UCHAR ControlChl;
|
||||
UCHAR BW;
|
||||
UCHAR PhyMode;
|
||||
UCHAR Stbc;
|
||||
UCHAR Sgi;
|
||||
UCHAR Mcs;
|
||||
UCHAR Preamble;
|
||||
UCHAR Payload; /* Payload pattern */
|
||||
BOOLEAN bFixedPayload;
|
||||
UCHAR TxMethod; /* Early chipsets must be applied old TXCONT/TXCARR/TXCARS mechanism. */
|
||||
UINT32 TxLength;
|
||||
UINT32 TxCount;
|
||||
UINT32 TxDoneCount; /* Tx DMA Done */
|
||||
UINT32 RFFreqOffset;
|
||||
UINT32 IPG;
|
||||
BOOLEAN bRxFER; /* Show Rx Frame Error Rate */
|
||||
/* Used when using QA Tool */
|
||||
BOOLEAN bQAEnabled; /* QA is used. */
|
||||
BOOLEAN bQATxStart; /* Have compiled QA in and use it to ATE tx. */
|
||||
BOOLEAN bQARxStart; /* Have compiled QA in and use it to ATE rx. */
|
||||
BOOLEAN bAutoTxAlc; /* Set Auto Tx Alc */
|
||||
BOOLEAN bAutoVcoCal; /* Set Auto VCO periodic calibration. */
|
||||
BOOLEAN bLowTemperature; /* Trigger Temperature Sensor */
|
||||
BOOLEAN bTestTimeReduction; /* Set ATE test time reduction. */
|
||||
#ifdef RTMP_MAC_PCI
|
||||
BOOLEAN bFWLoading; /* Reload firmware when ATE is done. */
|
||||
#endif /* RTMP_MAC_PCI */
|
||||
UINT32 RxTotalCnt;
|
||||
UINT32 RxCntPerSec;
|
||||
|
||||
CHAR LastSNR0; /* last received SNR */
|
||||
CHAR LastSNR1; /* last received SNR for 2nd antenna */
|
||||
CHAR LastSNR2;
|
||||
CHAR LastRssi0; /* last received RSSI */
|
||||
CHAR LastRssi1; /* last received RSSI for 2nd antenna */
|
||||
CHAR LastRssi2; /* last received RSSI for 3rd antenna */
|
||||
CHAR AvgRssi0; /* last 8 frames' average RSSI */
|
||||
CHAR AvgRssi1; /* last 8 frames' average RSSI */
|
||||
CHAR AvgRssi2; /* last 8 frames' average RSSI */
|
||||
SHORT AvgRssi0X8; /* sum of last 8 frames' RSSI */
|
||||
SHORT AvgRssi1X8; /* sum of last 8 frames' RSSI */
|
||||
SHORT AvgRssi2X8; /* sum of last 8 frames' RSSI */
|
||||
UINT32 NumOfAvgRssiSample;
|
||||
UINT32 Default_TX_PIN_CFG;
|
||||
USHORT HLen; /* Header Length */
|
||||
|
||||
#ifdef CONFIG_QA
|
||||
/* Tx frame */
|
||||
USHORT PLen; /* Pattern Length */
|
||||
UCHAR Header[32]; /* Header buffer */
|
||||
UCHAR Pattern[32]; /* Pattern buffer */
|
||||
USHORT DLen; /* Data Length */
|
||||
USHORT seq;
|
||||
UINT32 CID;
|
||||
RTMP_OS_PID AtePid;
|
||||
/* counters */
|
||||
UINT32 U2M;
|
||||
UINT32 OtherData;
|
||||
UINT32 Beacon;
|
||||
UINT32 OtherCount;
|
||||
UINT32 TxAc0;
|
||||
UINT32 TxAc1;
|
||||
UINT32 TxAc2;
|
||||
UINT32 TxAc3;
|
||||
UINT32 TxHCCA;
|
||||
UINT32 TxMgmt;
|
||||
UINT32 RSSI0;
|
||||
UINT32 RSSI1;
|
||||
UINT32 RSSI2;
|
||||
UINT32 SNR0;
|
||||
UINT32 SNR1;
|
||||
UINT32 SNR2;
|
||||
INT32 BF_SNR[3]; /* Last RXWI BF SNR. Units=0.25 dB */
|
||||
/* TxStatus : 0 --> task is idle, 1 --> task is running */
|
||||
UCHAR TxStatus;
|
||||
UINT32 RCPI0;
|
||||
UINT32 RCPI1;
|
||||
UINT32 RCPI2;
|
||||
UINT32 FreqOffsetFromRx;
|
||||
UINT32 RxMacFCSErrCount;
|
||||
UINT32 RxMacMdrdyCount;
|
||||
UINT32 thermal_val;
|
||||
#endif
|
||||
RTMP_OS_COMPLETION cmd_done;
|
||||
ULONG cmd_expire;
|
||||
RALINK_TIMER_STRUCT PeriodicTimer;
|
||||
ULONG OneSecPeriodicRound;
|
||||
ULONG PeriodicRound;
|
||||
OS_NDIS_SPIN_LOCK TssiSemLock;
|
||||
UINT32 tssi0_wf0_cr;
|
||||
UINT32 tssi0_wf1_cr;
|
||||
UINT32 tssi1_wf0_cr;
|
||||
UINT32 tssi1_wf1_cr;
|
||||
UINT32 phy_mux_27;
|
||||
UINT32 rmac_pcr1;
|
||||
UINT32 rmac_pcr;
|
||||
} ATE_CTRL;
|
||||
VOID RtmpDmaEnable(RTMP_ADAPTER *pAd, INT Enable);
|
||||
|
||||
|
||||
VOID ATE_RTUSBBulkOutDataPacket(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UCHAR BulkOutPipeId);
|
||||
|
||||
VOID ATE_RTUSBCancelPendingBulkInIRP(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
|
||||
#endif /* __ATE_H__ */
|
||||
@ -0,0 +1,83 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* MediaTek Inc.
|
||||
*
|
||||
* All rights reserved. source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of MediaTek. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of MediaTek, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
ate_agent.h
|
||||
*/
|
||||
|
||||
#ifndef __ATE_AGENT_H__
|
||||
#define __ATE_AGENT_H__
|
||||
|
||||
struct _RTMP_ADAPTER;
|
||||
|
||||
INT32 SetTxStop(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetRxStop(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 RtmpDoAte(struct _RTMP_ADAPTER *pAd, RTMP_IOCTL_INPUT_STRUCT *wrq, RTMP_STRING *wrq_name);
|
||||
VOID ATE_QA_Statistics(struct _RTMP_ADAPTER *pAd, RXWI_STRUC *pRxWI, RXINFO_STRUC *pRxInfo, PHEADER_802_11 pHeader);
|
||||
|
||||
#ifdef DBG
|
||||
INT32 SetEERead(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetEEWrite(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetBBPRead(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetBBPWrite(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetRFWrite(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
#endif /* DBG */
|
||||
VOID rt_ee_read_all(struct _RTMP_ADAPTER *pAd, UINT16 *Data);
|
||||
VOID rt_ee_write_all(struct _RTMP_ADAPTER pAd, UINT16 *Data);
|
||||
VOID rt_ee_write_bulk(struct _RTMP_ADAPTER pAd, UINT16 *Data, UINT16 offset, UINT16 length);
|
||||
INT32 SetATEDa(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATESa(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEBssid(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEInitChan(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetADCDump(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxPower0(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxPower1(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxPowerEvaluation(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxAntenna(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATERxAntenna(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 Default_Set_ATE_TX_FREQ_OFFSET_Proc(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxFreqOffset(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 Default_Set_ATE_TX_BW_Proc(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxLength(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxCount(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxMcs(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxStbc(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxMode(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxGi(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATERxFer(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEReadRF(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATELoadE2p(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
#ifdef RTMP_EFUSE_SUPPORT
|
||||
INT32 SetATELoadE2pFromBuf(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
#endif /* RTMP_EFUSE_SUPPORT */
|
||||
INT32 SetATEReadE2p(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEAutoAlc(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxGi(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETempSensor(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEIpg(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEPayload(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEFixedPayload(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETtr(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEShow(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEHelp(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
VOID ATESampleRssi(struct _RTMP_ADAPTER *pAd, RXWI_STRUC *pRxWI);
|
||||
VOID ATEPeriodicExec(PVOID SystemSpecific1, PVOID FunctionContext,
|
||||
PVOID SystemSpecific2, PVOID SystemSpecific3);
|
||||
INT32 SetATE(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATEChannel(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 SetATETxBw(struct _RTMP_ADAPTER *pAd, RTMP_STRING *Arg);
|
||||
INT32 MT_ATEInit(struct _RTMP_ADAPTER *pAd);
|
||||
PNDIS_PACKET ATEPayloadInit(struct _RTMP_ADAPTER *pAd, UINT32 TxIdx);
|
||||
INT32 ATEPayloadAlloc(struct _RTMP_ADAPTER *pAd, UINT32 Index);
|
||||
VOID EEReadAll(struct _RTMP_ADAPTER *pAd, UINT16 *Data);
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* MediaTek Inc.
|
||||
*
|
||||
* All rights reserved. source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of MediaTek. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of MediaTek, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
qa_agent.h
|
||||
*/
|
||||
|
||||
#ifndef __QA_AGENT_H__
|
||||
#define __QA_AGENT_H__
|
||||
|
||||
#define HQA_CMD_MAGIC_NO 0x18142880
|
||||
|
||||
/* RX STAT */
|
||||
#define HQA_RX_STAT_MACFCSERRCNT 0x1
|
||||
#define HQA_RX_STAT_MAC_MDRDYCNT 0x2
|
||||
#define HQA_RX_STAT_PHY_MDRDYCNT 0x3
|
||||
#define HQA_RX_STAT_PHY_FCSERRCNT 0x4
|
||||
#define HQA_RX_STAT_PD 0x5
|
||||
#define HQA_RX_STAT_CCK_SIG_SFD 0x6
|
||||
#define HQA_RX_STAT_OFDM_SIG_TAG 0x7
|
||||
#define HQA_RX_STAT_RSSI 0x8
|
||||
#define HQA_RX_RESET_PHY_COUNT 0x9
|
||||
|
||||
/* FW Event Callback */
|
||||
VOID HQA_GetThermalValue_CB(struct cmd_msg *msg, char *Data, UINT16 Len);
|
||||
|
||||
|
||||
typedef struct _HQA_CMD_FRAME {
|
||||
UINT32 MagicNo;
|
||||
UINT16 Type;
|
||||
UINT16 Id;
|
||||
UINT16 Length;
|
||||
UINT16 Sequence;
|
||||
UCHAR Data[2048];
|
||||
} __attribute__((packed))HQA_CMD_FRAME;
|
||||
|
||||
typedef INT32 (*HQA_CMD_HANDLER)(
|
||||
struct _RTMP_ADAPTER *pAd,
|
||||
RTMP_IOCTL_INPUT_STRUCT *wrq,
|
||||
HQA_CMD_FRAME *HqaCmdFrame);
|
||||
|
||||
typedef struct _HQA_CMD_TABLE{
|
||||
HQA_CMD_HANDLER *CmdSet;
|
||||
UINT32 CmdSetSize;
|
||||
UINT32 CmdOffset;
|
||||
} HQA_CMD_TABLE;
|
||||
|
||||
typedef struct _HQA_RX_STAT{
|
||||
UINT32 MacFCSErr;
|
||||
UINT32 MacMdrdy;
|
||||
UINT32 FCSErr_CCK;
|
||||
UINT32 FCSErr_OFDM;
|
||||
UINT32 CCK_PD;
|
||||
UINT32 OFDM_PD;
|
||||
UINT32 CCK_SIG_Err;
|
||||
UINT32 CCK_SFD_Err;
|
||||
UINT32 OFDM_SIG_Err;
|
||||
UINT32 OFDM_TAG_Err;
|
||||
UINT32 WB_RSSSI0;
|
||||
UINT32 IB_RSSSI0;
|
||||
UINT32 WB_RSSSI1;
|
||||
UINT32 IB_RSSSI1;
|
||||
UINT32 PhyMdrdyCCK;
|
||||
UINT32 PhyMdrdyOFDM;
|
||||
UINT32 DriverRxCount;
|
||||
UINT32 RCPI0;
|
||||
UINT32 RCPI1;
|
||||
UINT32 FreqOffsetFromRX;
|
||||
UINT32 RSSI0;
|
||||
UINT32 RSSI1;
|
||||
} __attribute__((packed))HQA_RX_STAT;
|
||||
|
||||
#endif /* __QA_AGENT_H__ */
|
||||
@ -0,0 +1,799 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002-2010, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
rt_ate.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
*/
|
||||
|
||||
#ifndef __RT_ATE_H__
|
||||
#define __RT_ATE_H__
|
||||
|
||||
#ifdef CONFIG_ATE
|
||||
#ifndef STATS_COUNT_SUPPORT
|
||||
#error "For ATE support, please set HAS_ATE=y and HAS_STATS_COUNT=y."
|
||||
#endif /* !STATS_COUNT_SUPPORT */
|
||||
#endif /* CONFIG_ATE */
|
||||
|
||||
#if defined(RTMP_MAC) || defined(RLT_MAC)
|
||||
#include "mac/mac_ral/rtmp_mac.h"
|
||||
#elif defined(MT_MAC)
|
||||
#include "mac/mac_mt/mt_mac.h"
|
||||
#endif
|
||||
#include "phy/phy.h"
|
||||
|
||||
// TODO: shiang-6590, remove it after ATE code is re-organized!!
|
||||
#define BBP_R1 1
|
||||
#define BBP_R3 3
|
||||
#define BBP_R4 4
|
||||
#define BBP_R21 21
|
||||
#define BBP_R22 22
|
||||
#define BBP_R24 24
|
||||
#define BBP_R27 27
|
||||
#define BBP_R50 50
|
||||
#define BBP_R51 51
|
||||
#define BBP_R52 52
|
||||
#define BBP_R60 60
|
||||
#define BBP_R66 66
|
||||
#define BBP_R69 69
|
||||
#define BBP_R70 70
|
||||
#define BBP_R174 174
|
||||
#define BBP_R182 182
|
||||
// TODO: ---End
|
||||
|
||||
typedef struct _ATE_CHIP_STRUCT {
|
||||
/* functions */
|
||||
VOID (*ChannelSwitch)(PRTMP_ADAPTER pAd);
|
||||
INT (*TxPwrHandler)(PRTMP_ADAPTER pAd, char index);
|
||||
INT (*TxPwrEvaluation)(PRTMP_ADAPTER pAd);
|
||||
INT (*TssiCalibration)(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
INT (*ExtendedTssiCalibration)(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
VOID (*RxVGAInit)(PRTMP_ADAPTER pAd);
|
||||
VOID (*AsicSetTxRxPath)(PRTMP_ADAPTER pAd);
|
||||
VOID (*AdjustTxPower)(PRTMP_ADAPTER pAd);
|
||||
VOID (*AsicExtraPowerOverMAC)(PRTMP_ADAPTER pAd);
|
||||
VOID (*AsicCalibration)(PRTMP_ADAPTER pAd, UCHAR ate_mode);
|
||||
VOID (*TemperCompensation)(RTMP_ADAPTER *pAd);
|
||||
|
||||
/* command handlers */
|
||||
INT (*Set_BW_Proc)(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
INT (*Set_FREQ_OFFSET_Proc)(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
/* variables */
|
||||
INT maxTxPwrCnt;
|
||||
BOOLEAN bBBPStoreTXCARR;
|
||||
BOOLEAN bBBPStoreTXCARRSUPP;
|
||||
BOOLEAN bBBPStoreTXCONT;
|
||||
BOOLEAN bBBPLoadATESTOP;
|
||||
|
||||
/* TSSI related */
|
||||
INT32 tssi_slope[2];
|
||||
INT32 tssi_offset[3][2];
|
||||
INT32 pwr_diff_pre[2];
|
||||
INT32 ant_pwr_offset[2];
|
||||
INT32 curr_temperature;
|
||||
}ATE_CHIP_STRUCT, *PATE_CHIP_STRUCT;
|
||||
|
||||
typedef union _CAPTURE_MODE_SHARE_MEMORY {
|
||||
struct
|
||||
{
|
||||
UINT32 LOW_BYTE0:8;
|
||||
UINT32 LOW_BYTE1:8;
|
||||
UINT32 HIGH_BYTE0:8;
|
||||
UINT32 HIGH_BYTE1:8;
|
||||
} field;
|
||||
UINT32 Value;
|
||||
}CAPTURE_MODE_SHARE_MEMORY, *PCAPTURE_MODE_SHARE_MEMORY;
|
||||
|
||||
typedef struct _ATE_INFO {
|
||||
PATE_CHIP_STRUCT pChipStruct;
|
||||
#ifdef RTMP_MAC_PCI
|
||||
PVOID AteAllocVa[TX_RING_SIZE];
|
||||
PNDIS_PACKET pAtePacket[TX_RING_SIZE];
|
||||
#endif /* RTMP_MAC_PCI */
|
||||
UCHAR Mode;
|
||||
BOOLEAN PassiveMode;
|
||||
#ifdef RT3350
|
||||
UCHAR PABias;
|
||||
#endif /* RT3350 */
|
||||
CHAR TxPower0;
|
||||
CHAR TxPower1;
|
||||
#ifdef DOT11N_SS3_SUPPORT
|
||||
CHAR TxPower2;
|
||||
#endif /* DOT11N_SS3_SUPPORT */
|
||||
CHAR MinTxPowerBandA; /* Power range of early chipsets is -7~15 in A band */
|
||||
CHAR MaxTxPowerBandA; /* Power range of early chipsets is -7~15 in A band */
|
||||
CHAR TxAntennaSel;
|
||||
CHAR RxAntennaSel;
|
||||
USHORT TxInfoLen;
|
||||
USHORT TxWILen;
|
||||
TXINFO_STRUC TxInfo; /* TxInfo */
|
||||
TXWI_STRUC TxWI; /* TXWI */
|
||||
USHORT QID;
|
||||
UCHAR Addr1[MAC_ADDR_LEN];
|
||||
UCHAR Addr2[MAC_ADDR_LEN];
|
||||
UCHAR Addr3[MAC_ADDR_LEN];
|
||||
UCHAR Channel;
|
||||
UCHAR Payload; /* Payload pattern */
|
||||
BOOLEAN bFixedPayload;
|
||||
UCHAR TxMethod; /* Early chipsets must be applied old TXCONT/TXCARR/TXCARS mechanism. */
|
||||
UINT32 TxLength;
|
||||
UINT32 TxCount;
|
||||
UINT32 TxDoneCount; /* Tx DMA Done */
|
||||
UINT32 RFFreqOffset;
|
||||
UINT32 IPG;
|
||||
BOOLEAN bRxFER; /* Show Rx Frame Error Rate */
|
||||
BOOLEAN bQAEnabled; /* QA is used. */
|
||||
BOOLEAN bQATxStart; /* Have compiled QA in and use it to ATE tx. */
|
||||
BOOLEAN bQARxStart; /* Have compiled QA in and use it to ATE rx. */
|
||||
BOOLEAN bAutoTxAlc; /* Set Auto Tx Alc */
|
||||
BOOLEAN bAutoVcoCal; /* Set Auto VCO periodic calibration. */
|
||||
BOOLEAN bLowTemperature; /* Trigger Temperature Sensor */
|
||||
BOOLEAN bTestTimeReduction; /* Set ATE test time reduction. */
|
||||
#ifdef RTMP_INTERNAL_TX_ALC
|
||||
#if defined(RT3350) || defined(RT3352)
|
||||
BOOLEAN bTSSICalbrEnableG; /* Enable TSSI calibration */
|
||||
CHAR TssiRefPerChannel[CFG80211_NUM_OF_CHAN_2GHZ];
|
||||
CHAR TssiDeltaPerChannel[CFG80211_NUM_OF_CHAN_2GHZ];
|
||||
#endif /* defined(RT3350) || defined(RT3352) */
|
||||
#endif /* RTMP_INTERNAL_TX_ALC */
|
||||
#ifdef RTMP_MAC_PCI
|
||||
BOOLEAN bFWLoading; /* Reload firmware when ATE is done. */
|
||||
#endif /* RTMP_MAC_PCI */
|
||||
UINT32 RxTotalCnt;
|
||||
UINT32 RxCntPerSec;
|
||||
UCHAR forceBBPReg; /* force to not update the specific BBP register, now used for ATE TxBF */
|
||||
|
||||
CHAR LastSNR0; /* last received SNR */
|
||||
CHAR LastSNR1; /* last received SNR for 2nd antenna */
|
||||
#ifdef DOT11N_SS3_SUPPORT
|
||||
CHAR LastSNR2;
|
||||
#endif /* DOT11N_SS3_SUPPORT */
|
||||
CHAR LastRssi0; /* last received RSSI */
|
||||
CHAR LastRssi1; /* last received RSSI for 2nd antenna */
|
||||
CHAR LastRssi2; /* last received RSSI for 3rd antenna */
|
||||
CHAR AvgRssi0; /* last 8 frames' average RSSI */
|
||||
CHAR AvgRssi1; /* last 8 frames' average RSSI */
|
||||
CHAR AvgRssi2; /* last 8 frames' average RSSI */
|
||||
SHORT AvgRssi0X8; /* sum of last 8 frames' RSSI */
|
||||
SHORT AvgRssi1X8; /* sum of last 8 frames' RSSI */
|
||||
SHORT AvgRssi2X8; /* sum of last 8 frames' RSSI */
|
||||
UINT32 NumOfAvgRssiSample;
|
||||
UINT32 Default_TX_PIN_CFG;
|
||||
USHORT HLen; /* Header Length */
|
||||
|
||||
#ifdef CONFIG_QA
|
||||
/* Tx frame */
|
||||
USHORT PLen; /* Pattern Length */
|
||||
UCHAR Header[32]; /* Header buffer */
|
||||
UCHAR Pattern[32]; /* Pattern buffer */
|
||||
USHORT DLen; /* Data Length */
|
||||
USHORT seq;
|
||||
UINT32 CID;
|
||||
RTMP_OS_PID AtePid;
|
||||
/* counters */
|
||||
UINT32 U2M;
|
||||
UINT32 OtherData;
|
||||
UINT32 Beacon;
|
||||
UINT32 OtherCount;
|
||||
UINT32 TxAc0;
|
||||
UINT32 TxAc1;
|
||||
UINT32 TxAc2;
|
||||
UINT32 TxAc3;
|
||||
UINT32 TxHCCA;
|
||||
UINT32 TxMgmt;
|
||||
UINT32 RSSI0;
|
||||
UINT32 RSSI1;
|
||||
UINT32 RSSI2;
|
||||
UINT32 SNR0;
|
||||
UINT32 SNR1;
|
||||
#ifdef DOT11N_SS3_SUPPORT
|
||||
UINT32 SNR2;
|
||||
#endif /* DOT11N_SS3_SUPPORT */
|
||||
INT32 BF_SNR[3]; /* Last RXWI BF SNR. Units=0.25 dB */
|
||||
/* TxStatus : 0 --> task is idle, 1 --> task is running */
|
||||
UCHAR TxStatus;
|
||||
#ifdef DOT11_VHT_AC
|
||||
UCHAR vht_nss;
|
||||
#endif /* DOT11_VHT_AC */
|
||||
#endif /* CONFIG_QA */
|
||||
RALINK_TIMER_STRUCT PeriodicTimer;
|
||||
ULONG OneSecPeriodicRound;
|
||||
ULONG PeriodicRound;
|
||||
OS_NDIS_SPIN_LOCK TssiSemLock;
|
||||
} ATE_INFO, *PATE_INFO;
|
||||
|
||||
/*
|
||||
Use bitmap to allow coexist of ATE_TXFRAME
|
||||
and ATE_RXFRAME(i.e.,to support LoopBack mode).
|
||||
*/
|
||||
#define fATE_IDLE 0x00
|
||||
#define fATE_TX_ENABLE 0x01
|
||||
#define fATE_RX_ENABLE 0x02
|
||||
#define fATE_TXCONT_ENABLE 0x04
|
||||
#define fATE_TXCARR_ENABLE 0x08
|
||||
#define fATE_TXCARRSUPP_ENABLE 0x10
|
||||
#define fATE_RESERVED_1 0x20
|
||||
#define fATE_RESERVED_2 0x40
|
||||
#define fATE_EXIT 0x80
|
||||
|
||||
/* Enter/Reset ATE */
|
||||
#define ATE_START (fATE_IDLE)
|
||||
/* Stop/Exit ATE */
|
||||
#define ATE_STOP (fATE_EXIT)
|
||||
/* Continuous Transmit Frames (without time gap) */
|
||||
#define ATE_TXCONT ((fATE_TX_ENABLE)|(fATE_TXCONT_ENABLE))
|
||||
/* Transmit Carrier */
|
||||
#define ATE_TXCARR ((fATE_TX_ENABLE)|(fATE_TXCARR_ENABLE))
|
||||
/* Transmit Carrier Suppression (information without carrier) */
|
||||
#define ATE_TXCARRSUPP ((fATE_TX_ENABLE)|(fATE_TXCARRSUPP_ENABLE))
|
||||
/* Transmit Frames */
|
||||
#define ATE_TXFRAME (fATE_TX_ENABLE)
|
||||
/* Receive Frames */
|
||||
#define ATE_RXFRAME (fATE_RX_ENABLE)
|
||||
|
||||
|
||||
#ifdef RTMP_INTERNAL_TX_ALC
|
||||
#define EEPROM_TSSI_ENABLE 0x36
|
||||
#define EEPROM_TSSI_MODE_EXTEND 0x76
|
||||
|
||||
#define ATE_MDSM_NORMAL_TX_POWER 0x00
|
||||
#define ATE_MDSM_DROP_TX_POWER_BY_6dBm 0x01
|
||||
#define ATE_MDSM_DROP_TX_POWER_BY_12dBm 0x02
|
||||
#define ATE_MDSM_ADD_TX_POWER_BY_6dBm 0x03
|
||||
#define ATE_MDSM_BBP_R1_STATIC_TX_POWER_CONTROL_MASK 0x03
|
||||
#endif /* RTMP_INTERNAL_TX_ALC */
|
||||
|
||||
#define LEN_OF_ARG 16
|
||||
#define ATE_ON(_p) (((_p)->ate.Mode) != ATE_STOP)
|
||||
#define TX_METHOD_0 0 /* Early chipsets must be applied this original TXCONT/TXCARR/TXCARS mechanism. */
|
||||
#define TX_METHOD_1 1 /* Default TXCONT/TXCARR/TXCARS mechanism is TX_METHOD_1 */
|
||||
#define ANT_ALL 0
|
||||
#define ANT_0 1
|
||||
#define ANT_1 2
|
||||
#ifdef DOT11N_SS3_SUPPORT
|
||||
#define ANT_2 3
|
||||
#endif /* DOT11N_SS3_SUPPORT */
|
||||
|
||||
#define ATE_ASIC_CALIBRATION(__pAd, __ate_mode) \
|
||||
do { \
|
||||
if (__pAd->ate.pChipStruct->AsicCalibration != NULL) \
|
||||
__pAd->ate.pChipStruct->AsicCalibration(__pAd, __ate_mode); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define ATE_MAC_TX_ENABLE(_A, _I, _pV) \
|
||||
{ \
|
||||
RTMP_IO_READ32(_A, _I, _pV); \
|
||||
(*(_pV)) |= (1 << 2); \
|
||||
RTMP_IO_WRITE32(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
#define ATE_MAC_TX_DISABLE(_A, _I, _pV) \
|
||||
{ \
|
||||
RTMP_IO_READ32(_A, _I, _pV); \
|
||||
(*(_pV)) &= ~(1 << 2); \
|
||||
RTMP_IO_WRITE32(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
#define ATE_MAC_RX_ENABLE(_A, _I, _pV) \
|
||||
{ \
|
||||
RTMP_IO_READ32(_A, _I, _pV); \
|
||||
(*(_pV)) |= (1 << 3); \
|
||||
RTMP_IO_WRITE32(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
#define ATE_MAC_RX_DISABLE(_A, _I, _pV) \
|
||||
{ \
|
||||
RTMP_IO_READ32(_A, _I, _pV); \
|
||||
(*(_pV)) &= ~(1 << 3); \
|
||||
RTMP_IO_WRITE32(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
/* Set MAC_SYS_CTRL(0x1004) Continuous Tx Production Test (bit4) = 1. */
|
||||
#define ATE_MAC_TX_CTS_ENABLE(_A, _I, _pV) \
|
||||
{ \
|
||||
RTMP_IO_READ32(_A, _I, _pV); \
|
||||
(*(_pV)) |= (1 << 4); \
|
||||
RTMP_IO_WRITE32(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
/* Clear MAC_SYS_CTRL(0x1004) Continuous Tx Production Test (bit4) = 0. */
|
||||
#define ATE_MAC_TX_CTS_DISABLE(_A, _I, _pV) \
|
||||
{ \
|
||||
RTMP_IO_READ32(_A, _I, _pV); \
|
||||
(*(_pV)) &= ~(1 << 4); \
|
||||
RTMP_IO_WRITE32(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
/* Clear BBP R22 to reset Tx Mode (bit7~bit0) = 0. */
|
||||
#ifdef RTMP_BBP
|
||||
#define ATE_BBP_RESET_TX_MODE(_A, _I, _pV) \
|
||||
{ \
|
||||
ATE_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV); \
|
||||
(*(_pV)) &= (0x00); \
|
||||
ATE_BBP_IO_WRITE8_BY_REG_ID(_A, _I, (*(_pV))); \
|
||||
}
|
||||
#endif /* RTMP_BBP */
|
||||
|
||||
/* Set BBP R22 to start Continuous Tx Mode (bit7) = 1. */
|
||||
#define ATE_BBP_START_CTS_TX_MODE(_A, _I, _pV) \
|
||||
{ \
|
||||
ATE_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV); \
|
||||
(*(_pV)) |= (1 << 7); \
|
||||
ATE_BBP_IO_WRITE8_BY_REG_ID(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
/* Clear BBP R22 to stop Continuous Tx Mode (bit7) = 0. */
|
||||
#define ATE_BBP_STOP_CTS_TX_MODE(_A, _I, _pV) \
|
||||
{ \
|
||||
ATE_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV); \
|
||||
(*(_pV)) &= ~(1 << 7); \
|
||||
ATE_BBP_IO_WRITE8_BY_REG_ID(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
/* Set BBP R24 to send out Continuous Tx sin wave (bit0) = 1. */
|
||||
#define ATE_BBP_CTS_TX_SIN_WAVE_ENABLE(_A, _I, _pV) \
|
||||
{ \
|
||||
ATE_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV); \
|
||||
(*(_pV)) |= (1 << 0); \
|
||||
ATE_BBP_IO_WRITE8_BY_REG_ID(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
/* Clear BBP R24 to stop Continuous Tx sin wave (bit0) = 0. */
|
||||
#define ATE_BBP_CTS_TX_SIN_WAVE_DISABLE(_A, _I, _pV) \
|
||||
{ \
|
||||
ATE_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV); \
|
||||
(*(_pV)) &= ~(1 << 0); \
|
||||
ATE_BBP_IO_WRITE8_BY_REG_ID(_A, _I, (*(_pV))); \
|
||||
}
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
This routine sets initial value of VGA in the RX chain.
|
||||
AGC is the abbreviation of "Automatic Gain Controller",
|
||||
while VGA (Variable Gain Amplifier) is a part of AGC loop.
|
||||
(i.e., VGA + level detector + feedback loop = AGC)
|
||||
|
||||
Return:
|
||||
VOID
|
||||
==========================================================================
|
||||
*/
|
||||
#define ATE_CHIP_RX_VGA_GAIN_INIT(__pAd) \
|
||||
if (__pAd->ate.pChipStruct->RxVGAInit != NULL) \
|
||||
__pAd->ate.pChipStruct->RxVGAInit(__pAd)
|
||||
|
||||
#define ATE_CHIP_SET_TX_RX_PATH(__pAd) \
|
||||
if (__pAd->ate.pChipStruct->AsicSetTxRxPath != NULL) \
|
||||
__pAd->ate.pChipStruct->AsicSetTxRxPath(__pAd)
|
||||
|
||||
|
||||
#ifdef RTMP_MAC_PCI
|
||||
#define ATEPCIReadBBPRegister(_A, _I, _pV) \
|
||||
{ \
|
||||
BBP_CSR_CFG_STRUC BbpCsr; \
|
||||
int j, k; \
|
||||
if (!IS_RT65XX(_A)) {\
|
||||
for (j=0; j<MAX_BUSY_COUNT; j++) \
|
||||
{ \
|
||||
RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
|
||||
if (BbpCsr.field.Busy == BUSY) \
|
||||
{ \
|
||||
continue; \
|
||||
} \
|
||||
BbpCsr.word = 0; \
|
||||
BbpCsr.field.fRead = 1; \
|
||||
BbpCsr.field.BBP_RW_MODE = 1; \
|
||||
BbpCsr.field.Busy = 1; \
|
||||
BbpCsr.field.RegNum = _I; \
|
||||
RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
|
||||
for (k=0; k<MAX_BUSY_COUNT; k++) \
|
||||
{ \
|
||||
RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
|
||||
if (BbpCsr.field.Busy == IDLE) \
|
||||
break; \
|
||||
} \
|
||||
if ((BbpCsr.field.Busy == IDLE) && \
|
||||
(BbpCsr.field.RegNum == _I)) \
|
||||
{ \
|
||||
*(_pV) = (UCHAR)BbpCsr.field.Value; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
if (BbpCsr.field.Busy == BUSY) \
|
||||
{ \
|
||||
DBGPRINT_ERR(("BBP read R%d fail\n", _I)); \
|
||||
*(_pV) = (_A)->BbpWriteLatch[_I]; \
|
||||
} \
|
||||
}\
|
||||
}
|
||||
|
||||
#define ATEPCIWriteBBPRegister(_A, _I, _V) \
|
||||
{ \
|
||||
BBP_CSR_CFG_STRUC BbpCsr; \
|
||||
int BusyCnt; \
|
||||
if (!IS_RT65XX(_A)) {\
|
||||
for (BusyCnt=0; BusyCnt<MAX_BUSY_COUNT; BusyCnt++) \
|
||||
{ \
|
||||
RTMP_IO_READ32(_A, BBP_CSR_CFG, &BbpCsr.word); \
|
||||
if (BbpCsr.field.Busy == BUSY) \
|
||||
continue; \
|
||||
BbpCsr.word = 0; \
|
||||
BbpCsr.field.fRead = 0; \
|
||||
BbpCsr.field.BBP_RW_MODE = 1; \
|
||||
BbpCsr.field.Busy = 1; \
|
||||
BbpCsr.field.Value = _V; \
|
||||
BbpCsr.field.RegNum = _I; \
|
||||
RTMP_IO_WRITE32(_A, BBP_CSR_CFG, BbpCsr.word); \
|
||||
(_A)->BbpWriteLatch[_I] = _V; \
|
||||
break; \
|
||||
} \
|
||||
if (BusyCnt == MAX_BUSY_COUNT) \
|
||||
{ \
|
||||
DBGPRINT_ERR(("BBP write R%d fail\n", _I)); \
|
||||
} \
|
||||
}\
|
||||
}
|
||||
|
||||
|
||||
#define ATE_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) ATEPCIReadBBPRegister(_A, _I, _pV)
|
||||
#define ATE_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) ATEPCIWriteBBPRegister(_A, _I, _V)
|
||||
#endif /* RTMP_MAC_PCI */
|
||||
|
||||
|
||||
INT DefaultATETxPwrHandler(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN char index);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(RT28xx) || defined(RT2880)
|
||||
VOID RT28xxATEAsicSwitchChannel(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
INT RT28xxATETxPwrHandler(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN char index);
|
||||
#endif /* defined(RT28xx) || defined(RT2880) */
|
||||
|
||||
|
||||
|
||||
#ifdef CONFIG_QA
|
||||
VOID ATE_QA_Statistics(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN RXWI_STRUC *pRxWI,
|
||||
IN RXINFO_STRUC *pRxInfo,
|
||||
IN PHEADER_802_11 pHeader);
|
||||
|
||||
INT RtmpDoAte(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN RTMP_IOCTL_INPUT_STRUCT *wrq,
|
||||
IN RTMP_STRING *wrq_name);
|
||||
|
||||
INT Set_TxStop_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_RxStop_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
#ifdef DBG
|
||||
INT Set_EERead_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_EEWrite_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_BBPRead_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_BBPWrite_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_RFWrite_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* DBG */
|
||||
#endif /* CONFIG_QA */
|
||||
|
||||
#ifdef RTMP_RF_RW_SUPPORT
|
||||
#ifdef RLT_RF
|
||||
#define ATE_RF_IO_READ8_BY_REG_ID(_A, _B, _I, _pV) rlt_rf_read(_A, _B, _I, _pV)
|
||||
#define ATE_RF_IO_WRITE8_BY_REG_ID(_A, _B, _I, _V) rlt_rf_write(_A, _B, _I, _V)
|
||||
#endif /* RLT_RF */
|
||||
#ifdef RTMP_RF
|
||||
#define ATE_RF_IO_READ8_BY_REG_ID(_A, _I, _pV) RT30xxReadRFRegister(_A, _I, _pV)
|
||||
#define ATE_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V) RT30xxWriteRFRegister(_A, _I, _V)
|
||||
#endif /* RTMP_RF */
|
||||
#ifdef MT_RF
|
||||
#define ATE_RF_IO_READ8_BY_REG_ID(_A, _I, _pV)
|
||||
#define ATE_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V)
|
||||
#endif /* MT_RF */
|
||||
#endif /* RTMP_RF_RW_SUPPORT */
|
||||
|
||||
#ifdef CONFIG_QA
|
||||
#define SYNC_CHANNEL_WITH_QA(_A, _pV)\
|
||||
if ((_A->bQATxStart == TRUE) || (_A->bQARxStart == TRUE))\
|
||||
{\
|
||||
return;\
|
||||
}\
|
||||
else\
|
||||
*_pV = _A->Channel
|
||||
#else
|
||||
#define SYNC_CHANNEL_WITH_QA(_A, _pV)\
|
||||
*_pV = _A->Channel
|
||||
#endif /* CONFIG_QA */
|
||||
|
||||
VOID rt_ee_read_all(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
OUT USHORT *Data);
|
||||
|
||||
VOID rt_ee_write_all(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN USHORT *Data);
|
||||
|
||||
VOID rt_ee_write_bulk(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN USHORT *Data,
|
||||
IN USHORT offset,
|
||||
IN USHORT length);
|
||||
|
||||
INT Set_ATE_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_DA_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_SA_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_BSSID_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
|
||||
INT Set_ATE_CHANNEL_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_INIT_CHAN_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ADCDump_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
#if defined(RTMP_INTERNAL_TX_ALC) || defined(RTMP_TEMPERATURE_COMPENSATION)
|
||||
INT Set_ATE_TSSI_CALIBRATION_EX_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* defined(RTMP_INTERNAL_TX_ALC) || defined(RTMP_TEMPERATURE_COMPENSATION) */
|
||||
|
||||
#ifdef RTMP_INTERNAL_TX_ALC
|
||||
INT Set_ATE_TSSI_CALIBRATION_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TSSI_CALIBRATION_EX_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
|
||||
#if defined(RT3350) || defined(RT3352)
|
||||
INT RT335x_Set_ATE_TSSI_CALIBRATION_ENABLE_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
CHAR InsertTssi(
|
||||
IN UCHAR InChannel,
|
||||
IN UCHAR Channel0,
|
||||
IN UCHAR Channel1,
|
||||
IN CHAR Tssi0,
|
||||
IN CHAR Tssi1);
|
||||
|
||||
INT RT335xATETssiCalibrationExtend(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* defined(RT3350) || defined(RT3352) */
|
||||
|
||||
CHAR ATEGetDesiredTSSI(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
#endif /* RTMP_INTERNAL_TX_ALC */
|
||||
|
||||
#ifdef RTMP_TEMPERATURE_CALIBRATION
|
||||
INT Set_ATE_TEMP_CAL_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_SHOW_TSSI_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
#endif /* RTMP_TEMPERATURE_CALIBRATION */
|
||||
|
||||
#ifdef RTMP_TEMPERATURE_COMPENSATION
|
||||
|
||||
INT Set_ATE_READ_EXTERNAL_TSSI_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* RTMP_TEMPERATURE_COMPENSATION */
|
||||
|
||||
INT Set_ATE_TX_POWER0_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TX_POWER1_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
#ifdef DOT11N_SS3_SUPPORT
|
||||
INT Set_ATE_TX_POWER2_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* DOT11N_SS3_SUPPORT */
|
||||
|
||||
INT Set_ATE_TX_POWER_EVALUATION_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TX_Antenna_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_RX_Antenna_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
VOID DefaultATEAsicExtraPowerOverMAC(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID ATEAsicExtraPowerOverMAC(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
#ifdef RT3350
|
||||
INT Set_ATE_PA_Bias_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* RT3350 */
|
||||
|
||||
INT Default_Set_ATE_TX_FREQ_OFFSET_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(RT28xx) || defined(RT2880)
|
||||
INT RT28xx_Set_ATE_TX_FREQ_OFFSET_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* defined(RT28xx) || defined(RT2880) */
|
||||
|
||||
|
||||
INT Set_ATE_TX_FREQ_OFFSET_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Default_Set_ATE_TX_BW_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(RT28xx) || defined(RT2880)
|
||||
INT RT28xx_Set_ATE_TX_BW_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* defined(RT28xx) || defined(RT2880) */
|
||||
|
||||
|
||||
INT Set_ATE_TX_BW_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TX_LENGTH_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TX_COUNT_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TX_MCS_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TX_STBC_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TX_MODE_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TX_GI_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
|
||||
INT Set_ATE_RX_FER_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_Read_RF_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
#if (!defined(RTMP_RF_RW_SUPPORT)) && (!defined(RLT_RF))
|
||||
INT Set_ATE_Write_RF1_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_Write_RF2_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_Write_RF3_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_Write_RF4_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* (!defined(RTMP_RF_RW_SUPPORT)) && (!defined(RLT_RF)) */
|
||||
|
||||
INT Set_ATE_Load_E2P_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
#ifdef RTMP_EFUSE_SUPPORT
|
||||
INT Set_ATE_Load_E2P_From_Buf_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
#endif /* RTMP_EFUSE_SUPPORT */
|
||||
|
||||
INT Set_ATE_Read_E2P_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
#ifdef LED_CONTROL_SUPPORT
|
||||
#endif /* LED_CONTROL_SUPPORT */
|
||||
|
||||
INT Set_ATE_AUTO_ALC_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_TEMP_SENSOR_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_IPG_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_Payload_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_Fixed_Payload_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
|
||||
|
||||
INT Set_ATE_TTR_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_Show_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
INT Set_ATE_Help_Proc(RTMP_ADAPTER *pAd, RTMP_STRING *arg);
|
||||
|
||||
VOID DefaultATEAsicAdjustTxPower(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
|
||||
|
||||
|
||||
VOID ATEAsicAdjustTxPower(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
|
||||
VOID ATESampleRssi(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN RXWI_STRUC *pRxWI);
|
||||
|
||||
#ifdef RTMP_MAC_PCI
|
||||
NDIS_STATUS ATEPayloadAlloc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UINT32 idx);
|
||||
|
||||
PNDIS_PACKET ATEPayloadInit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UINT32 TxIdx);
|
||||
|
||||
NDIS_STATUS TxRingGetReady(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
#endif /* RTMP_MAC_PCI */
|
||||
|
||||
|
||||
INT TxDmaBusy(RTMP_ADAPTER *pAd);
|
||||
INT RxDmaBusy(RTMP_ADAPTER *pAd);
|
||||
|
||||
VOID RtmpDmaEnable(RTMP_ADAPTER *pAd, INT Enable);
|
||||
|
||||
INT ATESetUpFrame(RTMP_ADAPTER *pAd, UINT32 TxIdx);
|
||||
|
||||
|
||||
|
||||
NDIS_STATUS ChipStructAssign(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
NDIS_STATUS ATEInit(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
#ifdef CONFIG_QA
|
||||
VOID ReadQATxTypeFromBBP(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
#endif /* CONFIG_QA */
|
||||
|
||||
#ifdef RTMP_BBP
|
||||
NDIS_STATUS ATEBBPWriteWithRxChain(
|
||||
IN RTMP_ADAPTER *pAd,
|
||||
IN UCHAR bbpId,
|
||||
IN CHAR bbpVal,
|
||||
IN RX_CHAIN_IDX rx_ch_idx);
|
||||
#endif /* RTMP_BBP */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(RT28xx) || defined(RT2880)
|
||||
VOID RT28xxATERxVGAInit(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
#endif /* defined(RT28xx) || defined(RT2880) */
|
||||
|
||||
|
||||
|
||||
VOID ATEPeriodicExec(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3);
|
||||
|
||||
VOID ATEAsicSetTxRxPath(RTMP_ADAPTER *pAd);
|
||||
|
||||
VOID RtmpRfIoWrite(RTMP_ADAPTER *pAd);
|
||||
|
||||
VOID ATEAsicSwitchChannel(RTMP_ADAPTER *pAd);
|
||||
|
||||
VOID BbpSoftReset(RTMP_ADAPTER *pAd);
|
||||
|
||||
|
||||
#endif /* __RT_ATE_H__ */
|
||||
|
||||
@ -0,0 +1,179 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002-2010, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
rt_qa.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
*/
|
||||
|
||||
#ifndef __RT_QA_H__
|
||||
#define __RT_QA_H__
|
||||
|
||||
#ifdef CONFIG_QA
|
||||
#ifndef CONFIG_ATE
|
||||
#error "For supporting QA GUI, please set HAS_ATE=y and HAS_QA_SUPPORT=y."
|
||||
#endif /* CONFIG_ATE */
|
||||
|
||||
#include "rt_ate.h"
|
||||
|
||||
typedef struct ate_racfghdr {
|
||||
UINT32 magic_no;
|
||||
USHORT command_type;
|
||||
USHORT command_id;
|
||||
USHORT length;
|
||||
USHORT sequence;
|
||||
USHORT status;
|
||||
UCHAR data[2046];
|
||||
} __attribute__((packed))RACFGHDR, *pRACFGHDR;
|
||||
|
||||
/* Stop Transmission */
|
||||
#define ATE_TXSTOP ((~(fATE_TX_ENABLE))&(~(fATE_TXCONT_ENABLE))&(~(fATE_TXCARR_ENABLE))&(~(fATE_TXCARRSUPP_ENABLE)))
|
||||
/* Stop Receiving Frames */
|
||||
#define ATE_RXSTOP (~(fATE_RX_ENABLE))
|
||||
|
||||
/* NOTE : may be different with chipset in the future ++ */
|
||||
#define BBP22_TXFRAME 0x00 /* Transmit Frames */
|
||||
#define BBP22_TXCONT_OR_CARRSUPP 0x80 /* Continuous Transmit or Carrier Suppression */
|
||||
#define BBP22_TXCARR 0xc1 /* Transmit Carrier */
|
||||
#define BBP24_TXCONT 0x00 /* Continuous Transmit */
|
||||
#define BBP24_CARRSUPP 0x01 /* Carrier Suppression */
|
||||
/* NOTE : may be different with chipset in the future -- */
|
||||
|
||||
/* Eth QA RACFG Command */
|
||||
#define RACFG_MAGIC_NO 0x18142880
|
||||
/* command id with Cmd Type == 0x0005(for iNIC)/0x0008(for others) */
|
||||
#define RACFG_CMD_RF_WRITE_ALL 0x0000
|
||||
#define RACFG_CMD_E2PROM_READ16 0x0001
|
||||
#define RACFG_CMD_E2PROM_WRITE16 0x0002
|
||||
#define RACFG_CMD_E2PROM_READ_ALL 0x0003
|
||||
#define RACFG_CMD_E2PROM_WRITE_ALL 0x0004
|
||||
#define RACFG_CMD_IO_READ 0x0005
|
||||
#define RACFG_CMD_IO_WRITE 0x0006
|
||||
#define RACFG_CMD_IO_READ_BULK 0x0007
|
||||
#define RACFG_CMD_BBP_READ8 0x0008
|
||||
#define RACFG_CMD_BBP_WRITE8 0x0009
|
||||
#define RACFG_CMD_BBP_READ_ALL 0x000a
|
||||
#define RACFG_CMD_GET_COUNTER 0x000b
|
||||
#define RACFG_CMD_CLEAR_COUNTER 0x000c
|
||||
|
||||
#define RACFG_CMD_RSV1 0x000d
|
||||
#define RACFG_CMD_RSV2 0x000e
|
||||
#define RACFG_CMD_RSV3 0x000f
|
||||
|
||||
#define RACFG_CMD_TX_START 0x0010
|
||||
#define RACFG_CMD_GET_TX_STATUS 0x0011
|
||||
#define RACFG_CMD_TX_STOP 0x0012
|
||||
#define RACFG_CMD_RX_START 0x0013
|
||||
#define RACFG_CMD_RX_STOP 0x0014
|
||||
#define RACFG_CMD_GET_NOISE_LEVEL 0x0015
|
||||
|
||||
#define RACFG_CMD_ATE_START 0x0080
|
||||
#define RACFG_CMD_ATE_STOP 0x0081
|
||||
|
||||
#define RACFG_CMD_ATE_START_TX_CARRIER 0x0100
|
||||
#define RACFG_CMD_ATE_START_TX_CONT 0x0101
|
||||
#define RACFG_CMD_ATE_START_TX_FRAME 0x0102
|
||||
#define RACFG_CMD_ATE_SET_BW 0x0103
|
||||
#define RACFG_CMD_ATE_SET_TX_POWER0 0x0104
|
||||
#define RACFG_CMD_ATE_SET_TX_POWER1 0x0105
|
||||
#define RACFG_CMD_ATE_SET_FREQ_OFFSET 0x0106
|
||||
#define RACFG_CMD_ATE_GET_STATISTICS 0x0107
|
||||
#define RACFG_CMD_ATE_RESET_COUNTER 0x0108
|
||||
#define RACFG_CMD_ATE_SEL_TX_ANTENNA 0x0109
|
||||
#define RACFG_CMD_ATE_SEL_RX_ANTENNA 0x010a
|
||||
#define RACFG_CMD_ATE_SET_PREAMBLE 0x010b
|
||||
#define RACFG_CMD_ATE_SET_CHANNEL 0x010c
|
||||
#define RACFG_CMD_ATE_SET_ADDR1 0x010d
|
||||
#define RACFG_CMD_ATE_SET_ADDR2 0x010e
|
||||
#define RACFG_CMD_ATE_SET_ADDR3 0x010f
|
||||
#define RACFG_CMD_ATE_SET_RATE 0x0110
|
||||
#define RACFG_CMD_ATE_SET_TX_FRAME_LEN 0x0111
|
||||
#define RACFG_CMD_ATE_SET_TX_FRAME_COUNT 0x0112
|
||||
#define RACFG_CMD_ATE_START_RX_FRAME 0x0113
|
||||
#define RACFG_CMD_ATE_E2PROM_READ_BULK 0x0114
|
||||
#define RACFG_CMD_ATE_E2PROM_WRITE_BULK 0x0115
|
||||
#define RACFG_CMD_ATE_IO_WRITE_BULK 0x0116
|
||||
#define RACFG_CMD_ATE_BBP_READ_BULK 0x0117
|
||||
#define RACFG_CMD_ATE_BBP_WRITE_BULK 0x0118
|
||||
#define RACFG_CMD_ATE_RF_READ_BULK 0x0119
|
||||
#define RACFG_CMD_ATE_RF_WRITE_BULK 0x011a
|
||||
#define RACFG_CMD_ATE_SET_TX_POWER2 0x011b
|
||||
#ifdef RLT_RF
|
||||
#define RACFG_CMD_ATE_RF_READ_BULK_BANK 0x0123
|
||||
#define RACFG_CMD_ATE_RF_WRITE_BULK_BANK 0x0124
|
||||
#endif /* RLT_RF */
|
||||
#define RACFG_CMD_TX_START_V2 0x0125
|
||||
|
||||
|
||||
|
||||
/* QA RACFG Command for ate test from localhost */
|
||||
#define RACFG_CMD_ATE_SHOW_PARAM 0xff00
|
||||
|
||||
/* ATE export paramters to uppler layer */
|
||||
typedef struct __ATE_EX_PARAM
|
||||
{
|
||||
unsigned char mode;
|
||||
char TxPower0;
|
||||
char TxPower1;
|
||||
#ifdef DOT11N_SS3_SUPPORT
|
||||
char TxPower2;
|
||||
#endif /* DOT11N_SS3_SUPPORT */
|
||||
char TxAntennaSel;
|
||||
char RxAntennaSel;
|
||||
unsigned char DA[MAC_ADDR_LEN];
|
||||
unsigned char SA[MAC_ADDR_LEN];
|
||||
unsigned char BSSID[MAC_ADDR_LEN];
|
||||
unsigned char MCS;
|
||||
unsigned char PhyMode;
|
||||
BOOLEAN ShortGI;
|
||||
BOOLEAN BW;
|
||||
unsigned int Channel;
|
||||
unsigned int TxLength;
|
||||
unsigned int TxCount;
|
||||
unsigned int RFFreqOffset;
|
||||
unsigned int IPG;
|
||||
unsigned int RxTotalCnt;
|
||||
unsigned int RxCntPerSec;
|
||||
char LastSNR0;
|
||||
char LastSNR1;
|
||||
char LastSNR2;
|
||||
char LastRssi0;
|
||||
char LastRssi1;
|
||||
char LastRssi2;
|
||||
char AvgRssi0;
|
||||
char AvgRssi1;
|
||||
char AvgRssi2;
|
||||
short AvgRssi0X8;
|
||||
short AvgRssi1X8;
|
||||
short AvgRssi2X8;
|
||||
}ATE_EX_PARAM, *pATE_EX_PARAM;
|
||||
|
||||
NDIS_STATUS TXSTOP(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
NDIS_STATUS RXSTOP(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
#endif /* CONFIG_QA */
|
||||
|
||||
#endif /* __RT_QA_H__ */
|
||||
@ -0,0 +1,530 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002-2006, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
ate_pci.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
*/
|
||||
|
||||
#ifdef RTMP_MAC_PCI
|
||||
|
||||
#include "rt_config.h"
|
||||
|
||||
/* 802.11 MAC Header, Type:Data, Length:24bytes + 6 bytes QOS/HTC + 2 bytes padding */
|
||||
extern UCHAR TemplateFrame[32];
|
||||
|
||||
INT TxDmaBusy(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
INT result;
|
||||
WPDMA_GLO_CFG_STRUC GloCfg;
|
||||
|
||||
#if defined(RTMP_MAC) || defined(RLT_MAC)
|
||||
RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); /* disable DMA */
|
||||
#elif defined(MT_MAC)
|
||||
RTMP_IO_READ32(pAd, MT_WPDMA_GLO_CFG, &GloCfg.word); /* disable DMA */
|
||||
#endif
|
||||
result = (GloCfg.field.TxDMABusy) ? TRUE : FALSE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
INT RxDmaBusy(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
INT result;
|
||||
WPDMA_GLO_CFG_STRUC GloCfg;
|
||||
|
||||
#if defined(RTMP_MAC) || defined(RLT_MAC)
|
||||
RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word); /* disable DMA */
|
||||
#elif defined(MT_MAC)
|
||||
RTMP_IO_READ32(pAd, MT_WPDMA_GLO_CFG, &GloCfg.word); /* disable DMA */
|
||||
#endif
|
||||
result = (GloCfg.field.RxDMABusy) ? TRUE : FALSE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
VOID RtmpDmaEnable(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN INT Enable)
|
||||
{
|
||||
ULONG WaitCnt = 0;
|
||||
|
||||
/* check if DMA is in busy mode or not. */
|
||||
while (TxDmaBusy(pAd) || RxDmaBusy(pAd))
|
||||
{
|
||||
RtmpusecDelay(10);
|
||||
if (WaitCnt++ > 100)
|
||||
break;
|
||||
}
|
||||
|
||||
AsicSetWPDMA(pAd, PDMA_TX_RX, (Enable > 0 ? TRUE : FALSE));
|
||||
|
||||
RtmpOsMsDelay(5);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
Routine Description:
|
||||
Write TxWI for ATE mode.
|
||||
|
||||
Return Value:
|
||||
None
|
||||
========================================================================
|
||||
*/
|
||||
VOID ATEWriteTxWI(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN TXWI_STRUC *pOutTxWI,
|
||||
IN BOOLEAN FRAG,
|
||||
IN BOOLEAN CFACK,
|
||||
IN BOOLEAN InsTimestamp,
|
||||
IN BOOLEAN AMPDU,
|
||||
IN BOOLEAN Ack,
|
||||
IN BOOLEAN NSeq, /* HW new a sequence. */
|
||||
IN UCHAR BASize,
|
||||
IN UCHAR WCID,
|
||||
IN ULONG Length,
|
||||
IN UCHAR PID,
|
||||
IN UCHAR TID,
|
||||
IN UCHAR TxRate,
|
||||
IN UCHAR Txopmode,
|
||||
IN BOOLEAN CfAck,
|
||||
IN HTTRANSMIT_SETTING *pTransmit)
|
||||
{
|
||||
TXWI_STRUC TxWI, *pTxWI;
|
||||
UINT8 TXWISize = pAd->chipCap.TXWISize;
|
||||
UCHAR bw;
|
||||
|
||||
/* If CCK or OFDM, BW must be 20 */
|
||||
bw = (pTransmit->field.MODE <= MODE_OFDM) ? (BW_20) : (pTransmit->field.BW);
|
||||
|
||||
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_SHORT_PREAMBLE_INUSED);
|
||||
NdisZeroMemory(&TxWI, TXWISize);
|
||||
pTxWI = &TxWI;
|
||||
|
||||
#ifdef RLT_MAC
|
||||
if (pAd->chipCap.hif_type == HIF_RLT) {
|
||||
struct _TXWI_NMAC *txwi_n = (struct _TXWI_NMAC *)pTxWI;
|
||||
|
||||
txwi_n->FRAG= FRAG;
|
||||
txwi_n->CFACK = CFACK;
|
||||
txwi_n->TS= InsTimestamp;
|
||||
txwi_n->AMPDU = AMPDU;
|
||||
txwi_n->ACK = Ack;
|
||||
txwi_n->txop = Txopmode;
|
||||
txwi_n->NSEQ= NSeq;
|
||||
txwi_n->BAWinSize = BASize;
|
||||
txwi_n->wcid = WCID;
|
||||
txwi_n->MPDUtotalByteCnt = Length;
|
||||
txwi_n->BW = bw;
|
||||
txwi_n->ShortGI = pTransmit->field.ShortGI;
|
||||
txwi_n->STBC = pTransmit->field.STBC;
|
||||
txwi_n->MCS = pTransmit->field.MCS;
|
||||
txwi_n->PHYMODE = pTransmit->field.MODE;
|
||||
txwi_n->CFACK = CfAck;
|
||||
txwi_n->MIMOps = 0;
|
||||
txwi_n->MpduDensity = 0;
|
||||
txwi_n->TxPktId = txwi_n->MCS;
|
||||
}
|
||||
#endif /* RLT_MAC */
|
||||
|
||||
#ifdef RTMP_MAC
|
||||
if (pAd->chipCap.hif_type == HIF_RTMP) {
|
||||
struct _TXWI_OMAC *txwi_o = (struct _TXWI_OMAC *)pTxWI;
|
||||
|
||||
txwi_o->FRAG= FRAG;
|
||||
txwi_o->CFACK = CFACK;
|
||||
txwi_o->TS= InsTimestamp;
|
||||
txwi_o->AMPDU = AMPDU;
|
||||
txwi_o->ACK = Ack;
|
||||
txwi_o->txop = Txopmode;
|
||||
txwi_o->NSEQ = NSeq;
|
||||
txwi_o->BAWinSize = BASize;
|
||||
txwi_o->wcid = WCID;
|
||||
txwi_o->MPDUtotalByteCnt = Length;
|
||||
txwi_o->BW = bw;
|
||||
txwi_o->ShortGI = pTransmit->field.ShortGI;
|
||||
txwi_o->STBC = pTransmit->field.STBC;
|
||||
txwi_o->MCS = pTransmit->field.MCS;
|
||||
txwi_o->PHYMODE = pTransmit->field.MODE;
|
||||
txwi_o->CFACK = CfAck;
|
||||
txwi_o->MIMOps = 0;
|
||||
txwi_o->MpduDensity = 0;
|
||||
txwi_o->PacketId = txwi_o->MCS;
|
||||
}
|
||||
#endif /* RTMP_MAC */
|
||||
|
||||
NdisMoveMemory(pOutTxWI, &TxWI, TXWISize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Allocate Frame payload buffer.
|
||||
NOTE:
|
||||
This routine should only be used in ATE mode.
|
||||
==========================================================================
|
||||
*/
|
||||
NDIS_STATUS ATEPayloadAlloc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UINT32 idx)
|
||||
{
|
||||
ATE_INFO *pATEInfo = &(pAd->ate);
|
||||
NDIS_PHYSICAL_ADDRESS AllocPa;
|
||||
|
||||
/* alloc buffer for payload */
|
||||
#ifdef CONFIG_QA
|
||||
if ((pATEInfo->bQAEnabled == TRUE) && (pATEInfo->DLen != 0))
|
||||
{
|
||||
pATEInfo->pAtePacket[idx] = RTMP_AllocateRxPacketBuffer(pAd, ((POS_COOKIE)(pAd->OS_Cookie))->pci_dev,
|
||||
pATEInfo->DLen + 0x100, FALSE, &pATEInfo->AteAllocVa[idx], &AllocPa);
|
||||
}
|
||||
else
|
||||
#endif /* CONFIG_QA */
|
||||
{
|
||||
pATEInfo->pAtePacket[idx] = RTMP_AllocateRxPacketBuffer(pAd, ((POS_COOKIE)(pAd->OS_Cookie))->pci_dev,
|
||||
pATEInfo->TxLength, FALSE, &pATEInfo->AteAllocVa[idx], &AllocPa);
|
||||
}
|
||||
|
||||
if (pATEInfo->pAtePacket[idx] == NULL)
|
||||
{
|
||||
pATEInfo->TxCount = 0;
|
||||
DBGPRINT_ERR(("%s : fail to alloc packet space.\n", __FUNCTION__));
|
||||
return (NDIS_STATUS_RESOURCES);
|
||||
}
|
||||
|
||||
return (NDIS_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Initialize Frame payload.
|
||||
NOTE:
|
||||
This routine should only be used in ATE mode.
|
||||
==========================================================================
|
||||
*/
|
||||
PNDIS_PACKET ATEPayloadInit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UINT32 idx)
|
||||
{
|
||||
ATE_INFO *pATEInfo = &(pAd->ate);
|
||||
RTMP_TX_RING *pTxRing = &pAd->TxRing[QID_AC_BE];
|
||||
PNDIS_PACKET pPacket = pTxRing->Cell[idx].pNdisPacket;
|
||||
PUCHAR pDest = (PUCHAR)pATEInfo->AteAllocVa[idx];
|
||||
UINT pos = 0;
|
||||
|
||||
#ifdef CONFIG_QA
|
||||
if ((pATEInfo->bQATxStart == TRUE) && (pATEInfo->DLen != 0))
|
||||
{
|
||||
GET_OS_PKT_LEN(pPacket) = pATEInfo->DLen;
|
||||
#ifndef LINUX
|
||||
GET_OS_PKT_TOTAL_LEN(pPacket) = pATEInfo->DLen;
|
||||
#endif /* LIMUX */
|
||||
}
|
||||
else
|
||||
#endif /* CONFIG_QA */
|
||||
{
|
||||
GET_OS_PKT_LEN(pPacket) = pATEInfo->TxLength - pATEInfo->HLen;
|
||||
#ifndef LINUX
|
||||
GET_OS_PKT_TOTAL_LEN(pPacket) = pATEInfo->TxLength - pATEInfo->HLen;
|
||||
#endif /* LINUX */
|
||||
}
|
||||
|
||||
/* prepare frame payload */
|
||||
#ifdef CONFIG_QA
|
||||
if ((pATEInfo->bQATxStart == TRUE) && (pATEInfo->DLen != 0))
|
||||
{
|
||||
/* copy pattern to payload */
|
||||
if ((pATEInfo->PLen != 0))
|
||||
{
|
||||
for (pos = 0; pos < pATEInfo->DLen; pos += pATEInfo->PLen)
|
||||
{
|
||||
memcpy(GET_OS_PKT_DATAPTR(pPacket) + pos, pATEInfo->Pattern, pATEInfo->PLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* CONFIG_QA */
|
||||
{
|
||||
for (pos = 0; pos < GET_OS_PKT_LEN(pPacket); pos++)
|
||||
{
|
||||
if ( pATEInfo->bFixedPayload )
|
||||
{
|
||||
/* default payload is 0xA5 */
|
||||
pDest[pos] = pATEInfo->Payload;
|
||||
}
|
||||
else
|
||||
{
|
||||
pDest[pos] = RandomByte(pAd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pPacket;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Setup Frame format.
|
||||
NOTE:
|
||||
This routine should only be used in ATE mode.
|
||||
==========================================================================
|
||||
*/
|
||||
INT ATESetUpFrame(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UINT32 TxIdx)
|
||||
{
|
||||
PATE_INFO pATEInfo = &(pAd->ate);
|
||||
TXINFO_STRUC *pTxInfo;
|
||||
TXD_STRUC *pTxD;
|
||||
#ifdef RT_BIG_ENDIAN
|
||||
TXD_STRUC *pDestTxD;
|
||||
UCHAR tx_hw_info[TXD_SIZE];
|
||||
#endif /* RT_BIG_ENDIAN */
|
||||
PNDIS_PACKET pPacket=NULL;
|
||||
PUCHAR pDest=NULL;
|
||||
HTTRANSMIT_SETTING TxHTPhyMode;
|
||||
|
||||
RTMP_TX_RING *pTxRing = &pAd->TxRing[QID_AC_BE];
|
||||
TXWI_STRUC *pTxWI = (TXWI_STRUC *)pTxRing->Cell[TxIdx].DmaBuf.AllocVa;
|
||||
PUCHAR pDMAHeaderBufVA = (PUCHAR) pTxRing->Cell[TxIdx].DmaBuf.AllocVa;
|
||||
UINT8 TXWISize = pAd->chipCap.TXWISize;
|
||||
#ifdef CONFIG_QA
|
||||
PHEADER_802_11 pHeader80211;
|
||||
#endif /* CONFIG_QA */
|
||||
UCHAR bw, sgi, stbc, mcs, phy_mode, frag, cfack, ts, ampdu, ack, nseq, bawinsize, pkt_id, txop;
|
||||
USHORT byte_cnt;
|
||||
|
||||
bw = sgi = stbc = mcs = phy_mode = frag = cfack = ts =0;
|
||||
ampdu = ack = nseq = bawinsize = pkt_id = txop = 0;
|
||||
byte_cnt = 0;
|
||||
#ifdef RLT_MAC
|
||||
if (pAd->chipCap.hif_type == HIF_RLT)
|
||||
{
|
||||
bw = pATEInfo->TxWI.TXWI_N.BW;
|
||||
sgi = pATEInfo->TxWI.TXWI_N.ShortGI;
|
||||
stbc = pATEInfo->TxWI.TXWI_N.STBC;
|
||||
mcs = pATEInfo->TxWI.TXWI_N.MCS;
|
||||
phy_mode = pATEInfo->TxWI.TXWI_N.PHYMODE;
|
||||
|
||||
frag = pATEInfo->TxWI.TXWI_N.FRAG;
|
||||
cfack = pATEInfo->TxWI.TXWI_N.CFACK,
|
||||
ts = pATEInfo->TxWI.TXWI_N.TS;
|
||||
ampdu = pATEInfo->TxWI.TXWI_N.AMPDU;
|
||||
ack = pATEInfo->TxWI.TXWI_N.ACK;
|
||||
nseq = pATEInfo->TxWI.TXWI_N.NSEQ;
|
||||
bawinsize =pATEInfo->TxWI.TXWI_N.BAWinSize;
|
||||
byte_cnt = pATEInfo->TxWI.TXWI_N.MPDUtotalByteCnt;
|
||||
pkt_id = pATEInfo->TxWI.TXWI_N.TxPktId;
|
||||
txop = pATEInfo->TxWI.TXWI_N.txop;
|
||||
cfack = pATEInfo->TxWI.TXWI_N.CFACK;
|
||||
}
|
||||
#endif /* RLT_MAC */
|
||||
#ifdef RTMP_MAC
|
||||
if (pAd->chipCap.hif_type == HIF_RTMP)
|
||||
{
|
||||
bw = pATEInfo->TxWI.TXWI_O.BW;
|
||||
sgi = pATEInfo->TxWI.TXWI_O.ShortGI;
|
||||
stbc = pATEInfo->TxWI.TXWI_O.STBC;
|
||||
mcs = pATEInfo->TxWI.TXWI_O.MCS;
|
||||
phy_mode = pATEInfo->TxWI.TXWI_O.PHYMODE;
|
||||
|
||||
frag = pATEInfo->TxWI.TXWI_O.FRAG;
|
||||
cfack = pATEInfo->TxWI.TXWI_O.CFACK,
|
||||
ts = pATEInfo->TxWI.TXWI_O.TS;
|
||||
ampdu = pATEInfo->TxWI.TXWI_O.AMPDU;
|
||||
ack = pATEInfo->TxWI.TXWI_O.ACK;
|
||||
nseq = pATEInfo->TxWI.TXWI_O.NSEQ;
|
||||
bawinsize =pATEInfo->TxWI.TXWI_O.BAWinSize;
|
||||
byte_cnt = pATEInfo->TxWI.TXWI_O.MPDUtotalByteCnt;
|
||||
pkt_id = pATEInfo->TxWI.TXWI_O.PacketId;
|
||||
txop = pATEInfo->TxWI.TXWI_O.txop;
|
||||
cfack = pATEInfo->TxWI.TXWI_O.CFACK;
|
||||
}
|
||||
#endif /* RTMP_MAC */
|
||||
|
||||
/* fill TxWI */
|
||||
TxHTPhyMode.field.BW = bw;
|
||||
TxHTPhyMode.field.ShortGI = sgi;
|
||||
TxHTPhyMode.field.STBC = stbc;
|
||||
TxHTPhyMode.field.MCS = mcs;
|
||||
TxHTPhyMode.field.MODE = phy_mode;
|
||||
|
||||
if (pATEInfo->bQATxStart == TRUE)
|
||||
{
|
||||
/* always use QID_AC_BE and FIFO_EDCA */
|
||||
ATEWriteTxWI(pAd, pTxWI, frag, cfack,
|
||||
ts, ampdu, ack,
|
||||
nseq, bawinsize, 0,
|
||||
byte_cnt, pkt_id, 0, 0,
|
||||
txop, cfack,
|
||||
&TxHTPhyMode);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ATEWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
|
||||
4, 0, pATEInfo->TxLength, 0, 0, 0, IFS_HTTXOP, FALSE, &TxHTPhyMode);
|
||||
|
||||
}
|
||||
|
||||
/* fill 802.11 header */
|
||||
#ifdef CONFIG_QA
|
||||
if (pATEInfo->bQATxStart == TRUE)
|
||||
{
|
||||
NdisMoveMemory(pDMAHeaderBufVA + TXWISize, pATEInfo->Header, pATEInfo->HLen);
|
||||
}
|
||||
else
|
||||
#endif /* CONFIG_QA */
|
||||
{
|
||||
pATEInfo->HLen = LENGTH_802_11;
|
||||
NdisMoveMemory(pDMAHeaderBufVA + TXWISize, TemplateFrame, pATEInfo->HLen);
|
||||
NdisMoveMemory(pDMAHeaderBufVA + TXWISize + 4, pATEInfo->Addr1, MAC_ADDR_LEN);
|
||||
NdisMoveMemory(pDMAHeaderBufVA + TXWISize + 10, pATEInfo->Addr2, MAC_ADDR_LEN);
|
||||
NdisMoveMemory(pDMAHeaderBufVA + TXWISize + 16, pATEInfo->Addr3, MAC_ADDR_LEN);
|
||||
}
|
||||
|
||||
#ifdef RT_BIG_ENDIAN
|
||||
RTMPFrameEndianChange(pAd, (((PUCHAR)pDMAHeaderBufVA) + TXWISize), DIR_READ, FALSE);
|
||||
#endif /* RT_BIG_ENDIAN */
|
||||
|
||||
pPacket = ATEPayloadInit(pAd, TxIdx);
|
||||
/* error check */
|
||||
if (pPacket == NULL)
|
||||
{
|
||||
pATEInfo->TxCount = 0;
|
||||
DBGPRINT_ERR(("%s : fail to init frame payload.\n", __FUNCTION__));
|
||||
return -1;
|
||||
}
|
||||
pTxRing->Cell[TxIdx].pNdisPacket = pPacket;
|
||||
|
||||
/* build Tx descriptor */
|
||||
#ifndef RT_BIG_ENDIAN
|
||||
pTxD = (TXD_STRUC *) pTxRing->Cell[TxIdx].AllocVa;
|
||||
pTxInfo = (TXINFO_STRUC *)(pTxRing->Cell[TxIdx].AllocVa + sizeof(TXD_STRUC));
|
||||
#else
|
||||
pDestTxD = (TXD_STRUC *)pTxRing->Cell[TxIdx].AllocVa;
|
||||
NdisMoveMemory(&tx_hw_info[0], (UCHAR *)pDestTxD, TXD_SIZE);
|
||||
pTxD = (TXD_STRUC *)&tx_hw_info[0];
|
||||
pTxInfo = (TXINFO_STRUC *)(&tx_hw_info[0] + sizeof(TXD_STRUC));
|
||||
#endif /* !RT_BIG_ENDIAN */
|
||||
{
|
||||
/* prepare TxD */
|
||||
TX_BLK txblk;
|
||||
txblk.SrcBufLen = GET_OS_PKT_LEN(pATEInfo->pAtePacket[TxIdx]);
|
||||
txblk.pSrcBufData = (PUCHAR)pATEInfo->AteAllocVa[TxIdx];
|
||||
NdisZeroMemory(pTxD, TXD_SIZE);
|
||||
/* build Tx descriptor */
|
||||
pTxD->SDPtr0 = RTMP_GetPhysicalAddressLow (pTxRing->Cell[TxIdx].DmaBuf.AllocPa);
|
||||
pTxD->SDLen0 = TXWISize + pATEInfo->HLen;
|
||||
pTxD->LastSec0 = 0;
|
||||
pTxD->SDPtr1 = PCI_MAP_SINGLE(pAd, &txblk, 0, 1, RTMP_PCI_DMA_TODEVICE);
|
||||
pTxD->SDLen1 = GET_OS_PKT_LEN(pATEInfo->pAtePacket[TxIdx]);
|
||||
pTxD->LastSec1 = 1;
|
||||
pTxD->Burst = 0;
|
||||
#if defined(RTMP_MAC) || defined(RLT_MAC)
|
||||
ral_write_txd(pAd, pTxD, pTxInfo, FALSE, FIFO_EDCA);
|
||||
#endif /* defined(RTMP_MAC) || defined(RLT_MAC) */
|
||||
#ifdef MT_MAC
|
||||
mt_write_txd(pAd, pTxD);
|
||||
#endif /* MT_MAC */
|
||||
}
|
||||
#ifdef CONFIG_QA
|
||||
if (pATEInfo->bQATxStart == TRUE)
|
||||
{
|
||||
pDest = (PUCHAR)pTxWI;
|
||||
pDest += TXWISize;
|
||||
pHeader80211 = (PHEADER_802_11)pDest;
|
||||
|
||||
/* modify sequence number... */
|
||||
if (pATEInfo->TxDoneCount == 0)
|
||||
pATEInfo->seq = pHeader80211->Sequence;
|
||||
else
|
||||
pHeader80211->Sequence = ++pATEInfo->seq;
|
||||
}
|
||||
#endif /* CONFIG_QA */
|
||||
|
||||
#ifdef RT_BIG_ENDIAN
|
||||
RTMPWIEndianChange(pAd, (PUCHAR)pTxWI, TYPE_TXWI);
|
||||
RTMPFrameEndianChange(pAd, (((PUCHAR)pDMAHeaderBufVA) + TXWISize), DIR_WRITE, FALSE);
|
||||
RTMPDescriptorEndianChange((PUCHAR)pTxD, TYPE_TXD);
|
||||
WriteBackToDescriptor((PUCHAR)pDestTxD, (PUCHAR)pTxD, FALSE, TYPE_TXD);
|
||||
#endif /* RT_BIG_ENDIAN */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Tx ring skb hook and ring index setting.
|
||||
NOTE:
|
||||
This routine should only be used in ATE mode.
|
||||
==========================================================================
|
||||
*/
|
||||
NDIS_STATUS TxRingGetReady(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
ATE_INFO *pATEInfo = &(pAd->ate);
|
||||
RTMP_TX_RING *pTxRing = &pAd->TxRing[QID_AC_BE];
|
||||
UINT32 TxIdx = 0;
|
||||
UINT32 ring_idx = 0;
|
||||
RTMP_IO_READ32(pAd, pTxRing->hw_didx_addr, &pTxRing->TxDmaIdx);
|
||||
pTxRing->TxSwFreeIdx = pTxRing->TxDmaIdx;
|
||||
pTxRing->TxCpuIdx = pTxRing->TxDmaIdx;
|
||||
RTMP_IO_WRITE32(pAd, pTxRing->hw_cidx_addr, pTxRing->TxCpuIdx);
|
||||
|
||||
for (ring_idx = 0; (ring_idx < TX_RING_SIZE) && (ring_idx < pATEInfo->TxCount); ring_idx++)
|
||||
{
|
||||
TxIdx = pTxRing->TxCpuIdx;
|
||||
|
||||
if (ATESetUpFrame(pAd, TxIdx) != 0)
|
||||
{
|
||||
return (NDIS_STATUS_FAILURE);
|
||||
}
|
||||
|
||||
if (((ring_idx + 1) < TX_RING_SIZE) && (ring_idx < pATEInfo->TxCount))
|
||||
{
|
||||
INC_RING_INDEX(pTxRing->TxCpuIdx, TX_RING_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
return (NDIS_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
#endif /* RTMP_MAC_PCI */
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
/*
|
||||
***************************************************************************
|
||||
* Ralink Tech Inc.
|
||||
* 4F, No. 2 Technology 5th Rd.
|
||||
* Science-based Industrial Park
|
||||
* Hsin-chu, Taiwan, R.O.C.
|
||||
*
|
||||
* (c) Copyright 2002-2006, Ralink Technology, Inc.
|
||||
*
|
||||
* All rights reserved. Ralink's source code is an unpublished work and the
|
||||
* use of a copyright notice does not imply otherwise. This source code
|
||||
* contains confidential trade secret material of Ralink Tech. Any attemp
|
||||
* or participation in deciphering, decoding, reverse engineering or in any
|
||||
* way altering the source code is stricitly prohibited, unless the prior
|
||||
* written consent of Ralink Technology, Inc. is obtained.
|
||||
***************************************************************************
|
||||
|
||||
Module Name:
|
||||
ate_usb.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
*/
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user